instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>I've been trying to use Zsh within my emacs session, without emacs remapping all the Zsh keys. I found ansi-term works pretty well for this but, I'm still having some problems. I was getting lots of junk characters outputted with, I was able to fix it with:</p>
<pre><code>## Setup proper term information for emacs ... | <p>Try <a href="http://www.emacswiki.org/emacs/MultiTerm">MultiTerm</a>.</p>
<p>Its the only Emacs terminal mode that seems to play nice with zsh. It allows you to easily set which commands you want captured by emacs and which you want routed to the terminal. The default settings have been good enough for me so far th... | <p>I figured it out. It was an emacs config problem. This bit of elisp in my .emacs was causing it:</p>
<pre><code>(custom-set-variables
'(fringe-mode nil nil (fringe))
'(fringes-outside-margins t t))
</code></pre>
<p>Thanks for the help.</p>
| 47,956 |
<p>I have a query which is meant to show me any rows in table A which have not been updated recently enough. (Each row should be updated within 2 months after "month_no".):</p>
<pre><code>SELECT A.identifier
, A.name
, TO_NUMBER(DECODE( A.month_no
, 1, 200803
, 2, 200804
... | <p>This is not possible directly, because chronologically, WHERE happens <em>before</em> SELECT, which always is the last step in the execution chain.</p>
<p>You can do a sub-select and filter on it:</p>
<pre><code>SELECT * FROM
(
SELECT A.identifier
, A.name
, TO_NUMBER(DECODE( A.month_no
, 1, 200803... | <p>It's possible to effectively define a variable that can be used in both the SELECT, WHERE and other clauses.</p>
<p>A subquery doesn't necessarily allow for appropriate binding to the referenced table columns, however OUTER APPLY does.</p>
<pre><code>SELECT A.identifier
, A.name
, vars.MONTH_NO
, TO... | 46,508 |
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/48935/how-can-i-register-a-global-hot-key-to-say-ctrlshiftletter-using-wpf-and-ne">How can I register a global hot key to say CTRL+SHIFT+(LETTER) using WPF and .NET 3.5?</a> </p>
</blockquote>
<p>I'd like to ha... | <p>The nicest solution I've found is <a href="http://bloggablea.wordpress.com/2007/05/01/global-hotkeys-with-net/" rel="noreferrer">http://bloggablea.wordpress.com/2007/05/01/global-hotkeys-with-net/</a></p>
<pre><code>Hotkey hk = new Hotkey();
hk.KeyCode = Keys.1;
hk.Windows = true;
hk.Pressed += delegate { Console.... | <p><a href="http://www.codeproject.com/KB/cs/CSLLKeyboardHook.aspx" rel="noreferrer">http://www.codeproject.com/KB/cs/CSLLKeyboardHook.aspx</a></p>
<p>If you're not using .net 3.5.</p>
| 10,670 |
<p>POSIX allows mutexes to be recursive. That means the same thread can lock the same mutex twice and won't deadlock. Of course it also needs to unlock it twice, otherwise no other thread can obtain the mutex. Not all systems supporting pthreads also support recursive mutexes, but if they want to be <a href="http://www... | <p>The difference between a recursive and non-recursive mutex has to do with ownership. In the case of a recursive mutex, the kernel has to keep track of the thread who actually obtained the mutex the first time around so that it can detect the difference between recursion vs. a different thread that should block inste... | <blockquote>
<p>What are non-recursive mutexes good for?</p>
</blockquote>
<p>They are absolutely good when you have to make sure the mutex is <strong>unlocked</strong> before doing something. This is because <code>pthread_mutex_unlock</code> can guarantee that the mutex is unlocked only if it is non-recursive.</p>
... | 22,748 |
<p>Okay, so I'm doing my first foray into using the ADO.NET Entity Framework. </p>
<p>My test case right now includes a SQL Server 2008 database with 2 tables, Member and Profile, with a 1:1 relationship.</p>
<p>I then used the Entity Data Model wizard to auto-generate the EDM from the database. It generated a model ... | <p>Okay I managed to find the answer I needed here <a href="http://msdn.microsoft.com/en-us/magazine/cc507640.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/magazine/cc507640.aspx</a>. The following query will make sure that the Profile entity is loaded:</p>
<pre><code>IQueryable<Member> membersQuery = f... | <p>I used this technique on a 1 to many relationship and works well. I have a Survey class and many questions as part of that from a different db table and using this technique managed to extract the related questions ...</p>
<pre><code>context.Survey.Include("SurveyQuestion").Where(x => x.Id == id).First()
</code>... | 20,707 |
<p>I've got an old classic ASP site that connects to a local sql server 2000 instance. We're moving the db to a new box, and the port is non standard for sql (out of my control). .NET connection strings handle the port number fine by adding it with ,1999 after the server name/IP. The classic ASP connection string isn't... | <p>The solution was installing the SQL Native Driver from MS, then updating the connection string to the following:</p>
<pre><code>Driver={SQL Native Client};Server=xxx.xxx.xxx.xxx,port;Database=dbname;Uid=dbuser;Pwd=dbpassword
</code></pre>
<p>I originally couldn't get it working with the SQL Native Client because o... | <p>I think we need more information. What are you using to connect to the database? ODBC? OLE DB? Are you connecting through and ODBC DSN? Is the connection string in your ASP code, or is your data access via a VB or COM DLL?</p>
| 32,628 |
<p>This may seem a bit trivial, but I have not been able to figure it out. I am opening up a SPSite and then trying to open up a SPWeb under that SPSite. This is working fine on the VPC, which has the same Site Collection/Site hierarchy, but on production, I get an exception telling me that the URL is invalid when I ... | <p>Looks at the examples table at the bottom of <a href="http://msdn.microsoft.com/en-us/library/ms955307.aspx" rel="nofollow noreferrer">this page</a>.</p>
<p>Try not sending any parameters into the OpenWeb() method (2nd row).</p>
| <p>It says your Site Collection URL is /mocc, thus your SPWeb underneath would be something like /mocc/internal/scheduletool. So do something like</p>
<p><code>string webServerRelativeUrl = site.ServerRelativeUrl + "/internal/scheduletool"</code></p>
| 23,349 |
<p>DDL for Database Tables:</p>
<pre><code> Users:
id - int - identity
name - varchar - unique
PCs:
id - int - idnetity
name - varchar - unique
userid - FK to Users
Apps:
id - int - identity
name - varchar
pcid - FK to PCs
</code></pre>
<p>I created a DataContext using the... | <p>That will work. It's normal because the second "from" inquires in the PC's set of the users and the third "from", the Apps set of the pcs. And I guess that is not going generate a cross join as T-Sql, because the conditions are already defined in the foreign keys and associations.</p>
<p>But I guess this should be ... | <p>That looks fine to me, I'm not sure why that would create a cross join</p>
| 35,873 |
<p>I'm working on a project with a friend that will utilize Hbase to store it's data. Are there any good query examples? I seem to be writing a ton of Java code to iterate through lists of RowResult's when, in SQL land, I could write a simple query. Am I missing something? Or is Hbase missing something?</p>
| <p>I think you, like many of us, are making the mistake of treating bigtable and HBase like just another RDBMS when it's actually a column-oriented storage model meant for efficiently storing and retrieving large sets of sparse data. This means storing, ideally, many-to-one relationships within a single row, for exampl... | <p>Thanks for the reply Sean, and sorry for my late response. I often make the mistake of treating HBase like a RDBMS. So often in fact that I've had to re-write code because of it! It's such a hard thing to unlearn.</p>
<p>Right now we have only 4 tables. Which, in this case, is very few considering my background... | 7,040 |
<p>I am planning to design an address validation for users registering in my app. Possibly validating by zipcode and state.</p>
<p>Any idea how to handle addresses from around the globe?</p>
<p>Do i need to insert all the zipcodes in the database and then validate the address. Any possible suggestion for the implemen... | <p>Since there is no international standard for zip codes and a list of all zip codes in the world would be out of date before you were finished putting it together, I suggest a smaller approach:</p>
<p>Identify the countries that you will have to handle most and develop seperate validation rules for each of them. Mak... | <p>Postal Codes can actually be a headache because in some places they can represent very tiny areas as opposed to the US where they often represent relatively large areas (except in a big city where they may represent a few blocks).</p>
<p>Look at Canada, their postal codes can actually represent very very tiny areas... | 46,441 |
<p>AFAIK one of the objectives of Stack Overflow is to make sure anyone can come here and find <b>good</b> answers to her Perl related questions. Certainly beginners would ask what is the <a href="https://stackoverflow.com/questions/70573/best-online-%0Asource-to-learn-perl">best online source to learn Perl</a> but oth... | <p>It's worth noting that <a href="http://perlmonks.org" rel="nofollow noreferrer">http://perlmonks.org</a>, in addition to the fora, has the Chatterbox, where simple questions can be answered immediately in conversation with other users.</p>
<p>It requires <a href="http://perlmonks.org/?node=Create+a+New+User" rel="n... | <p>I would say <a href="http://www.stackoverflow.com/">Stackoverflow</a></p>
| 12,553 |
<p>I'm developing an <code>ActiveX EXE</code> that exposes an specific class to a third-party software. This third-party software instanciates an object of this class and uses its methods. </p>
<p>Strangely, this third-party software destroys its object of my exposed class as soon as it calls an specific method, but... | <p>Your object gets "destroyed" when the last reference to it is deleted. Thats normal COM behavior. Or is your object dying unexcepted and the third-party app is getting an activex error?</p>
<p>Some more questions:</p>
<ul>
<li>I don't know what you mean with "data server"? </li>
<li>Do you have access to the sourc... | <p>As Jan stated in COM it is normal, that your object is terminated if no one is referencing it. If you would like to do some kind of caching (e.g. keep the DB connection open), you can use a global variable defined in a bas-module.</p>
<p><strong>basGlobal.bas</strong></p>
<pre><code>Global AGlobalVariable As Objec... | 29,719 |
<p>We have a class library where we keep a lot of the stuff that we often use when doing sharepoint development. How would you go around deploying this? Right now our best bet is to have it in a separate solution, and deploy that so that the assembly is deployed to GAC. That way we ensure that the assembly is deployed ... | <p>The GAC is usually your best choice. Like ensuring you deploy to all applications, it's also easier in terms of security.</p>
| <p>If I remember correctly, putting it in the GAC is the recommended course of action.</p>
| 14,650 |
<p>In the middle of some refactoring and I've moved a resources file from one project to another. I think I clicked a warning telling me to Strongly type the resource file at one point and now I'm getting:</p>
<blockquote>
<p>Could not find any resources
appropriate for the specified culture
or the neutral cultu... | <p>Are you sure these resource files are embedded into the assembly? Maybe you've lost the "Embedded Resource" settings as you moved the files.
Further, the resource names may have changed. The fully qualified name of a resource is
AssemblyName + physical subfolder(s) + resource name</p>
| <p>Can you export them to a text file from the original project and import them into the new project? If it's just key/value pairs it should be simple.</p>
| 30,093 |
<p>I'm looking for (simple) examples of problems for which JMS is a good solution, and also reasons why JMS is a good solution in these cases. In the past I've simply used the database as a means of passing messages from A to B when the message cannot necessarily be processed by B immediately.</p>
<p>A hypothetical ex... | <p>JMS and messaging is really about 2 totally different things.</p>
<ul>
<li>publish and subscribe (sending a message to as many consumers as are interested - a bit like sending an email to a mailing list, the sender does not need to know who is subscribed</li>
<li>high performance reliable load balancing (message qu... | <p>The 'database as message queue' solution may be heavy for the task. The JMS solution is less tightly coupled in that the message sender does not need to know anything about the recipient. This could be accomplished with some additional abstraction in the 'database as message queue' as well so it is not a huge win.... | 27,378 |
<p>I have two questions.</p>
<ol>
<li><p>Do <code>realloc()</code> and <code>memcpy()</code> copy the entries in an array to another in a way faster than just iterating on each element <code>O(N)</code> ? If the answer is yes then what do you think is its complexity ?</p></li>
<li><p>If the size allocated is smaller t... | <p>1 - No. They copy a block at a time. See <a href="http://www.embedded.com/design/configurable-systems/4024961/Optimizing-Memcpy-improves-speed" rel="noreferrer">http://www.embedded.com/design/configurable-systems/4024961/Optimizing-Memcpy-improves-speed</a> for a pretty good analysis.</p>
<p>2 - This is implementat... | <p>Presuming you are talking about glibc, and since your questions are implementation dependent, it's probably best just to check the source:</p>
<p><a href="http://sourceware.org/cgi-bin/cvsweb.cgi/libc/malloc/malloc.c?rev=1.190&content-type=text/x-cvsweb-markup&cvsroot=glibc" rel="nofollow noreferrer">malloc... | 47,347 |
<p>First sorry for my bad english but I'll try my best.</p>
<p>Right now I'm programming a .net application using Access 2007 as datastore.</p>
<p>In a nutshell: I have two threads. One thread inserts a row with a transaction into a table. The other thread updates many rows in constant intervals. </p>
<p><strong>Thr... | <p>Stefan Gruber asked:</p>
<blockquote>
<p>Can I insert my transactions to some
kind of transaction queue into Access?
Why isn't Access doing this by
itselft?</p>
</blockquote>
<p>I think you are failing to understand the Jet database engine. First off, a clarification: MS may use "MS Access" as the name in ... | <p>Use MARS(Multiple Active Resultsets) in this case.
Search on net for how to implement MARS.</p>
| 48,982 |
<p>Is there such thing as a 3D printer with a very large diameter nozzle, that can make low fidelity, large and fast prints? I'm picturing a soft serve ice-cream machine on a gantry, with a hopper. You feed it shredded plastic, and it prints bricks, or boards.</p>
| <p>Yes these exist. 3D printers using pellets is not uncommon for industry, but for the user at home this might be a different question. Pellets are the pre-fabricate before it is extruded into filament (small balls/cylinders of plastic).</p>
<p><a href="https://i.stack.imgur.com/0RIoy.png" rel="nofollow noreferrer"><i... | <p>You can certainly get large nozzles, but the material for extrusion still needs to be consistent. So any chunked plastic would have to be melted and that will produce an erratic flow at the extruder.</p>
<p>By reforming your shredded plastic into a consistent string of filament, then the printer has a steady supply... | 2,054 |
<p>I plan to be storing all my config settings in my application's app.config section (using the <code>ConfigurationManager.AppSettings</code> class). As the user changes settings using the app's UI (clicking checkboxes, choosing radio buttons, etc.), I plan to be writing those changes out to the <code>AppSettings</cod... | <p>since you're using a winforms app, if it's in .net 2.0 there's actually a user settings system (called Properties) that is designed for this purpose. <a href="https://learn.microsoft.com/en-us/previous-versions/aa730869%28v=vs.80%29" rel="nofollow noreferrer">This article on MSDN</a> has a pretty good introduction i... | <p>Could I ask why you're not saving the user's settings in a database?</p>
<p>Generally, I save application settings that are changed very infrequently in the appSettings section (the default email address error logs are sent to, the number of minutes after which you are automatically logged out, etc.) The scope of t... | 2,615 |
<p>Is it possible to delete an GAE application after it has been created?</p>
<p>I made a mistake while typing the name and now have a dummy application that I haven't been able to remove.</p>
| <p>With the new Google Cloud console, you can still disable GAE applications as before (App Engine --> Settings --> Disable). They cannot currently be deleted. However you can delete the entire project by going to IAM --> Settings --> Shut Down. This button is in the header and a bit tricky to spot. It looks like thi... | <p>I wanted to delete some legacy Google App Engine applications I made years ago, but when I tried to delete them from the new Google Cloud Platform (like this: <a href="https://support.google.com/cloud/answer/6251787#shut-down-a-project" rel="nofollow">https://support.google.com/cloud/answer/6251787#shut-down-a-proje... | 6,403 |
<p>In C#, if I declare an auto-implemented property, why do I have to declare BOTH the get and set part? </p>
<p>i.e.</p>
<pre><code>public string ThisWorks { get; set; }
public string ThisDoesnt { get; }
</code></pre>
<p>Isn't this just syntactic sugar - i.e. the compiler inserts a private field for the property?... | <p>If you didn't have a setter - then how would you ever set the property?</p>
<p>Incidentally, you can specify the accessibility, eg:</p>
<pre><code>public string Foo
{
get;
private set;
}
</code></pre>
| <p>Interestingly, the new Roslyn compiler in Visual Studio 2015 now allows this, even if the project is configured to use C# version 5.</p>
| 43,757 |
<p>In my C# source code I may have declared integers as:</p>
<pre><code>int i = 5;
</code></pre>
<p>or</p>
<pre><code>Int32 i = 5;
</code></pre>
<p>In the currently prevalent 32-bit world they are equivalent. However, as we move into a 64-bit world, am I correct in saying that the following will become the same?</p... | <p>No. The C# specification rigidly defines that <code>int</code> is an alias for <code>System.Int32</code> with exactly 32 bits. Changing this would be a <em>major</em> breaking change.</p>
| <p>int without suffix can be either 32bit or 64bit, it depends on the value it represents.</p>
<p>as defined in MSDN:</p>
<blockquote>
<p>When an integer literal has no suffix, its type is the first of these types in which its value can be represented: int, uint, long, ulong.</p>
</blockquote>
<p>Here is the addre... | 19,903 |
<p>We have some methods that call File.Copy, File.Delete, File.Exists, etc. How can we test these methods without actually hitting the file system?</p>
<p>I consider myself a unit testing n00b, so any advice is appreciated.</p>
| <pre><code>public interface IFile {
void Copy(string source, string dest);
void Delete(string fn);
bool Exists(string fn);
}
public class FileImpl : IFile {
public virtual void Copy(string source, string dest) { File.Copy(source, dest); }
public virtual void Delete(string fn) { File.Delete(fn); }
... | <p>You can use a mock framework for this and it will create a fake copy of the File object and you can inject the file in the system under test.</p>
<p>I will recommend Rhino Mock.</p>
| 33,443 |
<p>The exact error is as follows</p>
<blockquote>
<p>Could not load file or assembly 'Microsoft.SqlServer.Replication,
Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91'
or one of its dependencies. An attempt was made to load a program with
an incorrect format.</p>
</blockquote>
<p>I've rece... | <p>The <a href="https://stackoverflow.com/a/41451/148412">answer by baldy</a> below is correct, but you may also need to enable 32-bit applications in your AppPool. </p>
<p>Source: <a href="http://www.alexjamesbrown.com/uncategorized/could-not-load-file-or-assembly-chilkatdotnet2-or-one-of-its-dependencies-an-attempt-... | <p>in windows form application I do this,
Right-click on Project->Properties->Build->Check Prefer 32-bit checkbox.
Thanks all</p>
| 6,274 |
<p>I have a .NET web-service client that has been autogenerated from a wsdl-file using the wsdl.exe tool.</p>
<p>When I first instantiate the generated class, it begins to request a bunch of documents from w3.org and others. The first one being <a href="http://www.w3.org/2001/XMLSchema.dtd" rel="nofollow noreferrer">h... | <p>I needed the XmlResolver, so <a href="https://stackoverflow.com/questions/217841/net-autogenerated-web-service-client-how-do-i-avoid-requesting-schemas-from-w3o#218105">tamberg's solution</a> did not quite work. I solved it by implementing my own XmlResolver that read the necessary schemas from embedded resources in... | <p>Thanks Tamberg, you saved me a great deal of time with your succinct and correct answer. I didn't realise the default resolver would go to the web. Checking MSDN is states - </p>
<blockquote>
<p><em>XmlResolver is the default resolver for all classes in the System.Xml namespace. You can also create your own reso... | 26,777 |
<p>I am in search for a database with translations so I can have comonly used phrases and words translated by a machine and not by an expensive translator. Is there such a thing as a translation database with words and often used phrases?</p>
<p>If you don't know any would you use such a service?</p>
<p>edit: the dat... | <blockquote>
<p>edit: the database should only be monitored by people and not some automatic translater since they tend to be VERY bad</p>
</blockquote>
<p>I don't think this is enough. If you're going to translate single words, you need to have some idea of the context in which the word will be used.</p>
<p>For in... | <p><a href="http://www.google.com/language_tools" rel="nofollow noreferrer">http://www.google.com/language_tools</a></p>
| 34,845 |
<p>I want to call my .NET code from unmanaged C++. My process entrypoint is .NET based, so I don't have to worry about hosting the CLR. I know it can be done using COM wrappers for .NET objects, but I would like to access individual static methods of managed classes, so COM isn't my shortest/easiest route.</p>
| <p>Look at this solution:
<a href="https://sites.google.com/site/robertgiesecke/Home/uploads/unmanagedexports" rel="noreferrer">https://sites.google.com/site/robertgiesecke/Home/uploads/unmanagedexports</a>
The solution allows to call C# function from C by decorating your function with [DllExport] attribute (opposite ... | <p>Your calling code is C++ with <code>/clr</code> enabled. Right? </p>
<p>If yes, then you can simply use the using statement to use your .NET dll in your code. Something like:</p>
<pre><code>#using <Mydll.dll>
</code></pre>
<p>and then you can simply make the objects of your managed classes like:</p>
<pre><... | 27,844 |
<p>Is there a way to hide the google toolbar in my browser programmable?</p>
| <p>You haven't said which browser you are using so I'm going to assume Internet Explorer* and answer No.</p>
<p>If JavaScript on a web page could manipulate the browser, it would be a serious security hole and could create a lot of confusion for users.</p>
<p>So no... for a good reason: Security.</p>
<p>*. If you we... | <p>I really think that it is imposible to do that with javascript. This is because javascript is designed to control the behaviour of the site. And the browser is not part of the site.
<br/><br/>
Of course maby you are talking about some other Google toolbar then the plugin in the browser.</p>
| 10,765 |
<p>I'm trying to output a list of string values into a 2 column format. The standard way of making a list of strings into "normal text" is by using the <strong>string.join</strong> method. However, it only takes 2 arguments so I can only make a single column using "\n". I thought trying to make a loop that would simply... | <p>Two columns, separated by tabs, joined into lines. Look in <em>itertools</em> for iterator equivalents, to achieve a space-efficient solution.</p>
<pre><code>import string
def fmtpairs(mylist):
pairs = zip(mylist[::2],mylist[1::2])
return '\n'.join('\t'.join(i) for i in pairs)
print fmtpairs(list(string.as... | <pre><code>data = [ ("1","2"),("3","4") ]
print "\n".join(map("\t".join,data))
</code></pre>
<p>Not as flexible as the ActiveState solution, but shorter :-)</p>
| 20,697 |
<p>3D Printing's <a href="https://3dprinting.stackexchange.com/election/1">First Pro-Tem moderator election</a> has come to a close, the votes have been tallied, and the new moderators is:</p>
<p><a href="https://3dprinting.stackexchange.com/users/5740"><img src="https://3dprinting.stackexchange.com/users/flair/5740.p... | <p>I like the expanded definitions, but there is probably an issue with some of the things you'd put into "just rough around the edges" portion of what you state.</p>
<p>For instance, "Print Services" are mentioned as far as on-topic and what is allowed. <em>To what extent are Print Services</em> on-topic and allowed?... | <p>I like the expanded definitions, but there is probably an issue with some of the things you'd put into "just rough around the edges" portion of what you state.</p>
<p>For instance, "Print Services" are mentioned as far as on-topic and what is allowed. <em>To what extent are Print Services</em> on-topic and allowed?... | 69 |
<p>How do you create a 1 bit per pixel mask from an image using GDI in C#? The image I am trying to create the mask from is held in a System.Drawing.Graphics object.</p>
<p>I have seen examples that use Get/SetPixel in a loop, which are too slow. The method that interests me is one that uses only BitBlits, like <a hr... | <p>Try this:</p>
<pre><code>using System.Drawing;
using System.Drawing.Imaging;
using System.Runtime.InteropServices;
</code></pre>
<p>...</p>
<pre><code> public static Bitmap BitmapTo1Bpp(Bitmap img) {
int w = img.Width;
int h = img.Height;
Bitmap bmp = new Bitmap(w, h, PixelFormat.Format1bppInd... | <p>Do you mean LockBits? Bob Powell has an overview of LockBits <a href="https://web.archive.org/web/20141229164101/http://bobpowell.net/lockingbits.aspx" rel="nofollow noreferrer">here</a>; this should provide access to the RGB values, to do what you need. You might also want to look at ColorMatrix, <a href="http://ww... | 34,474 |
<p>While looking at a micro-optimization question that I asked yesterday (<a href="https://stackoverflow.com/questions/295579/fastest-way-to-determine-if-an-integers-square-root-is-an-integer">here</a>), I found something strange: an <code>or</code> statement in Java is running <em>slightly</em> faster than looking up... | <p>Loading some random piece of data is generally slower than a little non-branching code.</p>
<p>It all depends upon processor architecture, of course. Your first if statement could be implemented as four instructions. The second may potentially need null pointer checking, bounds checking as well as the load and comp... | <p>It's an interesting piece of code, but 2% is a really small difference. I don't think you can conclude very much from that.</p>
| 38,295 |
<p>When I supply the script with the argument: hi[123].txt it will do exactly what I want.
But if I specify the wildcard character ( hi*.txt ) it will be re-reading some files.</p>
<p>I was wondering how to modify this script to fix that silly problem:</p>
<pre><code>#!/bin/sh
count="0"
total="0"
FILE="$1" #FILE sp... | <p>I don't know what is wrong with it, but one little point i noticed:</p>
<p>Change <code>for FILE in $@</code> into <code>for FILE in "$@"</code> . Because if files have embedded spaces, you are now on the safe way. It will expand into <code>"$1" "$2" ...</code> then, instead of <code>$1 $2 ...</code> (and note ever... | <p>How about this solution:</p>
<pre><code>for FILE in `/bin/ls $@`
do
. . .
</code></pre>
<p>This will effectively eliminate duplicates because <code>/bin/ls hi1.txt hi1.txt hi1.txt</code> should only show <code>hi1.txt</code> once.</p>
<p>Though I'm not sure why it's re-reading files. The wildcard expansion shoul... | 42,539 |
<p>How can I select multiple elements using a WHERE...IN... type of clause as in</p>
<pre><code>select * from orders where orderid in (1, 4, 5)
</code></pre>
<p>in LinqToSql? I'd prefer not to have a lambda expression since they scare me.</p>
| <p>LINQ has "Contains" which is like "IN" but expressed the other way round - an element isn't "in" a set, a set "contains" an element.</p>
<pre><code>int[] validIds = { 1, 4, 5 };
var query = from order in db.Orders
where validIds.Contains(order.Id)
select order
</code></pre>
<p>This is more ... | <pre><code>int[] arry = new int[] {1,4,5};
var q = from r in orders
where Array.IndexOf(array, orderid) != -1
select r;
</code></pre>
<p>or</p>
<pre><code>List<int> lst = new List<int>(new int[] {1,4,5});
var q = from r in orders
where lst.Contains(orderid);
select r;
</co... | 41,025 |
<p>I need to get the lesser n numbers of a list in Python. I need this to be really fast because it's in a critical part for performance and it needs to be repeated a lot of times.</p>
<p>n is usually no greater than 10 and the list usually has around 20000 elements. The list is always different each time I call the f... | <p>You actually want a sorted sequence of mins.</p>
<pre><code>mins = items[:n]
mins.sort()
for i in items[n:]:
if i < mins[-1]:
mins.append(i)
mins.sort()
mins= mins[:n]
</code></pre>
<p>This runs <em>much</em> faster because you aren't even looking at mins unless it's provably got a ... | <p>why not just call the select_n_th element in O(N) time and then divide the array into two parts by the n_th element, this should be the fastest one.</p>
<p>ps:
This O(N) algorithm works if you don't specify the order of the n-smallest elements
The link below seems to do the selection algorithm.
<a href="http://code... | 45,626 |
<p>I need to transform an Oracle SQL statement into a Stored Procedure therefore users with less privileges can access certain data field:</p>
<pre><code>SELECT
info_field, data_field
FROM
table_one
WHERE
some_id = '<id>' -- I need this <id> to be the procedure's parameter
UNION ALL
SELECT
... | <p>If you just want to restrict users' access you could create a view and grant them select on the view but not the tables:</p>
<pre><code>CREATE VIEW info_and_data AS
SELECT info_field, data_field
FROM table_one
UNION ALL
SELECT info_field, data_field
FROM table_two
UNION ALL
S... | <p>Is the expectation that, among all these tables, only one will have a match for a given ID?</p>
<p>If no: You need to explain what you want to do when there are multiple matches.</p>
<p>If yes: You simply do the same SQL query, selecting the result into a variable that you then return.</p>
<p>It would look some... | 39,788 |
<p>Googling 'HDPLA' has so far availed me very little. </p>
<p><a href="http://3dinsider.com/what-is-pla/" rel="nofollow noreferrer">http://3dinsider.com/what-is-pla/</a> indicates that /all/ modern PLA is 'high density' compared to 'the early days'. But a fellow at the local makerspace indicated that he was specifica... | <p>So, low-teck, old-style investigative work from my side.... I contacted <a href="http://www.filright.com" rel="nofollow noreferrer">a company</a> selling HDPLA and they got back to me with the following reply.</p>
<blockquote>
<p>We created HDPLA as an industrial PLA with special additives. As a result, our so ca... | <p>I doubt that it means very much at all. Filament manufacturers are very tight-lipped about the co-polymers that they add to their base stock in order to improve handling and performance characteristics, so it is impossible to say. The only common attribute that I can see is an advertised diameter tolerance of &plusm... | 790 |
<p>As part of a build setup on a windows machine I need to add a registry entry and I'd like to do it from a simple batch file.</p>
<p>The entry is for a third party app so the format is fixed.</p>
<p>The entry takes the form of a REG_SZ string but needs to contain newlines ie. 0xOA characters as separators.</p>
<p>... | <p>You could create a VBScript(.vbs) file and just call it from a batch file, assuming you're doing other things in the batch other than this registry change. In vbscript you would be looking at something like:</p>
<pre><code>set WSHShell = CreateObject("WScript.Shell")
WSHShell.RegWrite "HKEY_LOCAL_MACHINE\SOMEKEY... | <p>Another approach -- that is much easier to read and maintain -- is to use a PowerShell script. Run PowerShell as Admin.</p>
<hr />
<p># SetLegalNotice_AsAdmin.ps1</p>
<p># Define multi-line legal notice registry entry</p>
<p>Push-Location</p>
<p>Set-Location -Path Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Win... | 18,587 |
<p>What I would like is be able to generate a simple report that is the output of svn log for a certain date range. Specifically, all the changes since 'yesterday'. </p>
<p>Is there an easy way to accomplish this in Subversion besides grep-ing the svn log output for the timestamp?</p>
<p>Example:</p>
<pre><code>sv... | <p>Very first hit by google for "svn log date range": <a href="http://svn.haxx.se/users/archive-2006-08/0737.shtml" rel="noreferrer">http://svn.haxx.se/users/archive-2006-08/0737.shtml</a></p>
<blockquote>
<p>So <code>svn log <url> -r
{2008-09-19}:{2008-09-26}</code> will get
all changes for the past week... | <p>You can do this:</p>
<pre><code>svn log -r{2008-9-23}:{2008-9-24} > report.txt
</code></pre>
<p>Add a <code>--xml</code> before the <code>-r</code> if you want ot get the output in xml format for "easier" post processing. </p>
| 17,111 |
<p>Is it possible to use EventListener to Listen to a variable and detect when the value of that variable changes? Thanks.</p>
| <p>This is quite easy to do if you wrap it all into a class. We will be using getter/setter methods. The setter method will dispatch and event whenever it is called. </p>
<p>(Note: Setters and Getters are treated like properties). You merely assign a value, as opposed to calling a method (e.g <code>someVar = 5</code... | <p>You used to be able to do something similar in AS2 using Object.watch. I don't see a direct equivalent, but it looks like <a href="http://livedocs.adobe.com/flex/3/langref/mx/binding/utils/ChangeWatcher.html" rel="nofollow noreferrer">mx.binding.utils.ChangeWatcher</a> will give you similar functionality for any va... | 39,481 |
<p>I have animation code in a class that extends the UIView:</p>
<pre><code>// Start Animation Block
CGContextRef context = UIGraphicsGetCurrentContext();
[UIView beginAnimations:nil context:context];
[UIView setAnimationTransition: UIViewAnimationTransitionFlipFromLeft forView:[self superview] cache:YES];
[UIView set... | <p>Apple have a pretty good tutorial on view transitions <a href="https://developer.apple.com/iphone/library/samplecode/ViewTransitions/index.html" rel="nofollow noreferrer">here</a>. Other than the way they implement them you can also look at using a UINavigationController which manages a bunch of views and transitio... | <p>I think a Linked List of views might be what you should think about implementing.</p>
| 29,518 |
<p>I am using ehCache to store larges amount of data.
This cache is accessed about 3 times every second and must be kept up to date.
I have a thread that runs which retrieves all the data i need for the cache from the database every minute into a different cache(different cachemanager also).
What i want to do is copy t... | <p>It sounds like you are looking for a complicated solution to a problem ehcache solves out-of-the-box.</p>
<p>You only need one cache manager. Configure it to flush once a minute. If need be, do this by creating a thread that flushes the cache once a minute. </p>
<p>When you try to retrieve something from the cache... | <p>+1 to <a href="https://stackoverflow.com/users/2959/steve-mcleod">Steve McLeod</a>.</p>
<p>See <a href="http://ehcache.sourceforge.net/documentation/cache_decorators.html" rel="nofollow noreferrer">SelfPopulatingCache</a></p>
<p>I believe this will do <em>exactly</em> what you want, and quickly.</p>
<p>If you sti... | 32,727 |
<p>I'm trying to wrap my head around asp.net. I have a background as a long time php developer, but I'm now facing the task of learning asp.net and I'm having some trouble with it. It might very well be because I'm trying to force the framework into something it is not intended for - so I'd like to learn how to do it "... | <p>I agree with the other points made here "If you can get out of creating controls dynamically, then do so..." (by @<a href="https://stackoverflow.com/users/11559/jesper-blad-jensen-aka-deldy">Jesper Blad Jenson aka</a>) but here is a trick I worked out with dynamically created controls in the past.</p>
<p>The proble... | <p>Well. If you can get out of creating controls dynamicly, then do so - otherwise, what i whould do is to use Page_Load instead of Page_Init, but instead of placing stuff inside the If Not IsPostBack, then set i just directly in the method.</p>
| 13,847 |
<p>Is there a function in the C Library under Linux which can set the length of a file? Under Windows I know there is a SetFileLength() function.
If there is not, what is the best way of shortening a file without deleting and rewriting it?</p>
| <p>You can use the <a href="http://homepages.cwi.nl/~aeb/linux/man2html/man2/truncate.2.html" rel="nofollow noreferrer">truncate function</a>.</p>
<p><code>int truncate(const char *path, off_t length);</code> </p>
<p>From the man page:</p>
<p>"The truncate() and ftruncate() functions cause the regular file named by ... | <pre><code> #include <unistd.h>
#include <sys/types.h>
int truncate(const char *path, off_t length);
int ftruncate(int fd, off_t length);
</code></pre>
<p>From its manpage:</p>
<blockquote>
<p>The truncate() and ftruncate()
functions cause the regular file named
by path or referenced b... | 46,683 |
<p>Given a SCHEMA for implementing tags</p>
<p>ITEM
ItemId, ItemContent</p>
<p>TAG
TagId, TagName</p>
<p>ITEM_TAG
ItemId, TagId</p>
<p>What is the best way to limit the number of ITEMS to return when selecting with tags?</p>
<pre><code>SELECT i.ItemContent, t.TagName FROM item i
INNER JOIN ItemTag it ON i.id = it... | <p>My second solution uses a MySQL function GROUP_CONCAT() to combine all tags matching the item into a comma-separated string in the result set.</p>
<pre><code>SELECT i.ItemContent, GROUP_CONCAT(t.TagName ORDER BY t.TagName) AS TagList
FROM item AS i
INNER JOIN ItemTag AS it ON i.id = it.ItemId
INNER JOIN tag A... | <p>My first suggestion is to use a subquery to generate the list of item ID's and return items matching those item ID's. But this doesn't include the TagName in your result set. I'll submit a separate answer with another solution.</p>
<pre><code>SELECT i.ItemContent
FROM item AS i
WHERE i.id IN (
SELECT it.ItemId
... | 20,174 |
<p>I'm working on a database project and I need to create Outlook 2007 plugin that saves the current previewed message into my database.</p>
<p>Can someone give me a step-by-step guide on how to create an Outlook plugin in Delphi, and how to deploy it?</p>
<p>Thanks</p>
| <p>If you just want to learn and understand how to do it, just google for Delphi Outlook addin (I'm pretty sure "addin" should give you much more relevant results than "plugin" in this context) and you should come up with a number of slightly dated but still formally correct sample addins, e.g. the <a href="http://www.... | <p>To bad the job has to be done in Delphi. With .NET and VSTO creating Outlook addins is far less painfull compared to the bad old days. I have made Office addins in COM (that was NOT funny at all) and in the previous version of VSTO, but VSTO 3 is very good news for the office developer.</p>
| 26,471 |
<p>Is it alright to do this?</p>
<pre><code>$author = strtolower($_SESSION['valid_username']);
</code></pre>
<p>I want to enter all authors into the table as lower case.</p>
| <p>Yes, that's fine as long as <code>$_SESSION['valid_username']</code> is set, otherwise you'll get a notice (if your error reporting is set that low).</p>
<p>You can check if it exists with <code>if (isset($_SESSION['valid_username']))</code></p>
| <p>yes.</p>
<pre><code>$_SESSION['valid_username']
</code></pre>
<p>is a session variable which evaluates to a string so passing it as a parameter to the strtolower function is not a problem.</p>
| 35,071 |
<p>What's the best way to view the data that LoadPostData event is loading to the controls in ASP.NET? </p>
| <p>It's actually really simple. The NameValueCollection that get's passed to this method of EVERY control that implements the IPostbackDataHandler interface is the contents of Page.Request.Form. So you can access it at any time by getting a Watch on <code>HttpContext.Current.Request.Form</code>.</p>
| <p>Ugh... I would suggest setting your IDE environment up to <a href="http://blogs.msdn.com/sburke/archive/2008/01/16/configuring-visual-studio-to-debug-net-framework-source-code.aspx" rel="nofollow noreferrer">debug the .net framework</a>, and set a breakpoint on the LoadPostData() method of Control. That's a bit heav... | 49,350 |
<p>I have a requirement to create a simple database in Access to collect some user data that will be loaded into another database for further reporting. There will be a module in the Access db that when invoked by the user (probably by clicking a button) will output a query to a delimited file. The user also needs a ... | <p>You can simply write a call to the sftp command line client via a batch file if you want to accomplish that.</p>
<p>Check out the Shell() function in VBA.</p>
<p>Under the click event of the button on your form add in the code:</p>
<pre><code>mySFTPCall = "sftp <insert your options here!>"
Call Shell(mySFTP... | <p>I would imagine you just need to find an FTP COM object. You should then be able to instantiate this in the Access module code. dart.com has one and I'm sure there are many more (just Google FTP COM).</p>
| 24,714 |
<p>A long while back I transitioned to doing all my web application development in Eclipse from BBEdit. But I miss one little feature from BBEdit. I used to be able to show invisible characters like tabs but not show other invisibles like spaces. I know that I can bulk turn all of these on in Eclipse, but I wonder if t... | <p>Unfortunately, you can only turn on all invisible (whitespace) characters at the same time. I suggest you file an enhancement request but I doubt they will pick it up.</p>
<p>The text component in Eclipse is very complicated as it is and they are not keen on making them even worse.</p>
<p><strong>[UPDATE]</strong>... | <p>AnyEdit
Scroll all the way down: <a href="http://andrei.gmxhome.de/anyedit/examples.html" rel="nofollow">http://andrei.gmxhome.de/anyedit/examples.html</a></p>
| 47,541 |
<p>I'm using system catalog views such as SYS.ALL_ OBJECTS, SYS.FOREIGN_KEYS etc. to get information about my database structure in MS SQL 2005. </p>
<p>Are there equivalent functions/views for MySQL (v. 5) servers? </p>
| <p>For the schema (All objects);</p>
<pre><code>SELECT * FROM information_schema.SCHEMATA S;
</code></pre>
<p>For constraints and foreign keys also;</p>
<pre><code>SELECT * FROM information_schema.TABLE_CONSTRAINTS T;
</code></pre>
<p>For everything else check this queries;</p>
<pre><code>SELECT * FROM information... | <p>Hmm, I haven't studied everything it contains, but there's a good deal of information in the <a href="http://dev.mysql.com/doc/refman/5.0/en/information-schema.html" rel="nofollow noreferrer">information_schema</a>. There's also the <a href="http://dev.mysql.com/doc/refman/5.0/en/show.html" rel="nofollow noreferrer... | 36,084 |
<p>I have a DataGrid, with an ItemTemplate that has an image and label. In the EditItemTemplate the label is replaced by a textbox. My problem is that the edit template only shows when I click the Edit button the second time. What gives?</p>
| <p>Make sure you check for Page.IsPostback before binding your datagrid. It may be the case that you are binding during every page load.</p>
<pre><code>If Not Page.IsPostBack() Then
DoDataBinding()
End If
</code></pre>
| <p>Make sure you check for Page.IsPostback before binding your datagrid. It may be the case that you are binding during every page load.</p>
<pre><code>If Not Page.IsPostBack() Then
DoDataBinding()
End If
</code></pre>
| 16,306 |
<p>I'm work on project with django framework and use control version system to synchronize my code with other peoples. But i don't know how organize work with database.
In django, any people, worked on project, may changes django models, and tell 'syncdb' to synchronize model objects with db.
But other people don't ab... | <p>You have to actually talk to the people on your project.</p>
<p>If someone changes any database model, they have to actually tell everyone else about the change. This is not a Django problem. </p>
<p>Think of any SQL database -- without Django. When the DBA drop's a table, they have to tell everyone that they c... | <p>Sounds like you want migrations.</p>
<p>As an example:
<a href="http://www.aswmc.com/dbmigration/" rel="nofollow noreferrer">http://www.aswmc.com/dbmigration/</a></p>
<p>You may also want to add functional unit tests that actually test that the schema is as expected, that way when the tests fail, you can see that ... | 23,598 |
<p>.NET has System.Uri for Uris and System.IO.FileInfo for file paths. I am looking for classes which are traditionally object oriented in that they specify both meaning and behavior for the string which is used in the object's construction. What other useful string encapsulation classes exist?</p>
<p>Things such as r... | <p>Probably trivial, but there are also System.IO.DirectoryInfo and System.Info.Path</p>
| <p>System.Text.StringBuilder
and
System.Text.RegularExpressions.Regex</p>
| 20,372 |
<p>I want to use Apple's or RedHat's built-in Apache but I want to use Perl 5.10 and mod_perl. What's the least intrusive way to accomplish this? I want the advantage of free security patching for the vendor's Apache, dav, php, etc., but I care a lot about which version of Perl I use and what's in my @INC path. I do... | <ol>
<li><p>Build your version of Perl 5.10 following any special instructions from the mod_perl documentation. Tell Perl configurator to install in some non-standard place, like /usr/local/perl/5.10.0</p></li>
<li><p>Use the instructions to build a shared library (or dynamic, or .so) mod_perl against your distribution... | <p>You'll want to look into <a href="http://httpd.apache.org/docs/2.2/mod/mod_so.html" rel="nofollow noreferrer">mod_so</a></p>
| 10,489 |
<p>I have a textbox with an onchange event. Why does this event not fire when the user uses the autocomplete feature to populate the textbox?</p>
<p>I am working with Internet Explorer. Is there a standard and relatively simple solution to workaround this problem, without me having to disable the autocomplete feature?... | <p>Last time I had that issue, I ended up using the <code>onpropertychange</code> event for Internet Explorer instead. I read about that <a href="http://msdn.microsoft.com/en-us/library/ms533032(VS.85).aspx" rel="nofollow noreferrer">here on MSDN</a>: it is the recommended way to get around it.</p>
| <p>I found that the following jQuery (v1.10+) JavaScript does work in the case of text being auto-completed for HTML text input fields. This was tested to work reliably at least in Safari 6.1.1 on Mac OS X 10.8.5, but should work in other compliant browsers also:</p>
<pre><code>$("input:text[id=text_field_id]").bind("... | 44,625 |
<p>How do I programmatically find out the width and height of the video in an mpeg-2 <strike>transport</strike> program stream file? </p>
<p>Edit: I am using C++, but am happy for examples in any language.
Edit: Corrected question - it was probably program streams I was asking about</p>
| <p>Check out the source code to <a href="http://libmpeg2.sourceforge.net/" rel="nofollow noreferrer">libmpeg2</a>, a F/OSS MPEG2 decoder. It appears that the width and height are set in the <code>mpeg2_header_sequence()</code> function in <code>header.c</code>. I'm not sure how control flows to that particular functi... | <p>hamishmcn said that Adam Rosenfield's answer was what he needed. This makes me wonder about the accuracy of the question. An MPEG transport stream doesn't <strong><em>have</em></strong> a video sequence header. That header is found in an MPEG program stream.</p>
<p>I don't have an answer. I was just hoping against ... | 36,508 |
<p>I have been tinkering with BSP trees for a while now and am also playing with threads. When adding a triangle to a BSP tree, an opportunity arises to create a new thread for the purposes of processing data in parallel.</p>
<pre>
insert(triangle, bspnode)
{
....
else if(triangle spans bspnode)
{
(frontpie... | <p>Threads are great if some part of the processing is waiting on something external (user input, I/O, some other processing) - the thread that's waiting can continue to wait, while a thread that isn't waiting forges on ahead.</p>
<p>However, for processing-intensive tasks, more threads than processors actually create... | <p>Sure, for example, Quicksort can be programmed multithreaded quite easily and get some large performance gains on multi-core systems, and some small performance losses on non-multithreaded. Just remember that you're adding overhead twice now - once for the stack save on the recursion and once on the thread, so if y... | 20,168 |
<p>I am getting the following error trying to read from a socket. I'm doing a <code>readInt()</code> on that <code>InputStream</code>, and I am getting this error. Perusing the documentation this suggests that the client part of the connection closed the connection. In this scenario, I am the server.</p>
<p>I have acc... | <p>There are several possible causes.</p>
<ol>
<li><p>The other end has deliberately reset the connection, in a way which I will not document here. It is rare, and generally incorrect, for application software to do this, but it is not unknown for commercial software.</p></li>
<li><p>More commonly, it is caused by wri... | <p>In my experience, I often encounter the following situations;</p>
<ol>
<li><p>If you work in a corporate company, contact the network and security team. Because in requests made to external services, it may be necessary to <strong>give permission for the relevant endpoint.</strong></p></li>
<li><p>Another issue is ... | 8,844 |
<p>How do you run a scheduled task with Quest powershell snap in? </p>
| <p>You would schedule PowerShell.exe, and use one of its command-line parameters to specify the script to run. At the start of that script, add:</p>
<p>Add-PSSnapin Quest.ActiveRoles.ADManagement</p>
<p>That will load the snapin for that script, and then execute whatever else is in the script.</p>
<p>(BTW, this woul... | <p>Another option would be to create a console file (using Export-Console - which will create a *.psc1 ) and adding -PSConsoleFile YourConsole.psc1 to your powershell.exe command line.</p>
| 44,527 |
<h3>TL;DR</h3>
<p>Is it possible to build a hotend, using separate parts, sourced on eBay, from China, and still achieve a high quality print?</p>
<hr />
<p>In my opinion, the E3D V6 hotend is rather expensive, at $/£70, especially to those building to a tight budget. Now, obviously/presumably, there is some quite rigo... | <p>Hard to say for sure - my whole printer is cheap parts bought as a kit in China by a Chinese student who abandoned it in the US (I resurrected it after it was abandoned.) It includes all the parts you list, and I think we finally sorted out what the thermistor actually is so the temperatures are more accurate now.</... | <p><em>Sorry for digging up the topic, but I'd like to share my experience with cheap Chinese parts obtained from those obvious auction sites.</em></p>
<hr>
<p>For my <a href="https://www.thingiverse.com/thing:2254103" rel="nofollow noreferrer">Hypercube Evolution</a> I have ordered all parts from Chinese suppliers e... | 620 |
<p>I would like a batch file to launch two separate programs then have the command line window close. Actually, to clarify, I am launching Internet Explorer with two different URLs.</p>
<p>So far I have something like this:</p>
<pre><code>start "~\iexplore.exe" "url1"
start "~\iexplore.exe" "url2"
</code></pre>
<p>W... | <p>Try this in your batch file:</p>
<pre><code>@echo off
start /d "C:\Program Files\Internet Explorer" IEXPLORE.EXE www.google.com
start /d "C:\Program Files\Internet Explorer" IEXPLORE.EXE www.yahoo.com
</code></pre>
| <p>There is a setting in the IE options that controls whether it should open new links in an existing window or in a new window. I'm not sure if you can control it from the command line but maybe changing this option would be enough for you.</p>
<p>In IE7 it looks like the option is "Reuse windows for launching short... | 22,903 |
<p>I thought that if a c pointer pointing to a char array was incremented then it would point to the next element in that array. But when I tried this I found that I had to increment it twice. Trying the increment using sizeof(char) I found that adding the size of a char was too much so it had to be divided by two. </p... | <p>sizeof(char) is guaranteed to be 1, but sizeof(char*) isn't.</p>
<p>Nevertheless, your function <strong>only works by accident</strong>.</p>
<p>For example, try calling it with the following parameters:</p>
<pre><code>abc defg
</code></pre>
<p>This will yield:</p>
<pre><code>2 args.
input: a, c,
</code></pre>
... | <p>If you have a pointer <code>ptr</code> of type <code>T*</code> and you add <code>N</code>, then the pointer will be advanced by <code>N * sizeof (*ptr)</code> or equivalent <code>N * sizeof (T)</code> bytes. You simply forgot to dereference <code>pi</code>. So what you got with <code>sizeof (pi)</code> was the sizeo... | 40,296 |
<p>Building on <a href="https://stackoverflow.com/questions/318553/getting-emacs-to-untabify-when-saving-files">Getting Emacs to untabify when saving certain file types (and only those file types)</a> , I'd like to run a hook to untabify my C++ files when I start modifying the buffer. I tried adding hooks to untabify t... | <p>Take a look at the variable "before-change-functions".</p>
<p>Perhaps something along this line (warning: code not tested):</p>
<pre><code>(add-hook 'before-change-functions
(lambda (&rest args)
(if (not (buffer-modified-p))
(untabify (point-min) (point-max)))))
</code><... | <p>This answer is tangential, but may be of use.</p>
<p>The package wide-column.el <a href="http://homepages.cs.ncl.ac.uk/phillip.lord/download/emacs/wide-column.el" rel="nofollow noreferrer">link text</a> changes the cursor color when the cursor is past a given column - and actually the cursor colors can vary dependi... | 47,011 |
<p>When reviewing, I sometimes encounter this kind of loop:</p>
<pre><code>i = begin
while ( i != end ) {
// ... do stuff
if ( i == end-1 (the one-but-last element) ) {
... do other stuff
}
increment i
}
</code></pre>
<p>Then I ask the question: would you write this?</p>
<pre><code>i = begin
mi... | <p>I don't think this question should be answered by a principle (e.g. "in a loop, treat every element equally"). Instead, you can look at two factors to evaluate if an implementation is good or bad:</p>
<ol>
<li>Runtime effectivity - does the compiled code run fast, or would it be faster doing it differently?</li>
<l... | <p>The special case should be done outside the loop if it is only to be performed once.</p>
<p>However, there may be an index or some other variable(s) that are just easier to keep inside the loop due to scoping. There may also be a contextual reason for keeping all the operations on the datastructure together inside... | 18,951 |
<p>I want to know if people here typically disable SELinux on installations where it is on by default? If so can you explain why, what kind of system it was, etc?</p>
<p>I'd like to get as many opinions on this as possible.</p>
| <p>I did, three or four years ago when defined policies had many pitfalls and creating policies was too hard and I had 'no time' to learn. This was on not critical machines, of course.</p>
<p>Nowadays with all the work done to ship distros with sensible policies, and the <a href="http://seedit.sourceforge.net/index.ht... | <p>Under Red-hat, you can edit <code>/etc/sysconfig/selinux</code> and set <code>SELINIX=disabled</code>.</p>
<p>I think under all versions of Linux you can add <code>selinux=0 noselinux</code> to the boot line in lilo.conf or grub.conf.</p>
| 12,329 |
<p>I need to schedule several different pages on several different sites to be run at certain times, usually once a night. Is there any software out there to do this? it would be nice if it called the page and then recorded the response and whether the called page was successful run or not. I was using Helm on a dif... | <p>We use standard scheduled tasks that call a bat file that calls a VBS file. I know it is not the most elegant solution ever, but it consistently works.</p>
<p>BAT:</p>
<pre><code>webrun.vbs http://website.com/page.aspx
</code></pre>
<p>VBS:</p>
<pre><code>dim URL, oArgs
Set oArgs = WScript.Arguments
i... | <p>If it's not a requirement to schedule them from the same box, have a look to <a href="http://site24x7.com" rel="nofollow noreferrer">Zoho's site24x7</a>.</p>
<p>It is initially designed to monitor web sites but it has an option to record expected answers and compare them so you can use it for your purpose with the ... | 32,142 |
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/114149/const-correctness-in-c-sharp">“const correctness” in C#</a> </p>
</blockquote>
<p>I have programmed C++ for many years but am fairly new to C#. While learning C# I found that the use of the <... | <p><a href="https://stackoverflow.com/q/132618/16800">Stephen Denne</a> has a Metro implementation that satisfies your requirement. My answer is provided below after a short explination as to why that is the case.</p>
<p>Most Web Service implementations that are built using HTTP as the message protocol are REST compli... | <p>One way to do it is to add a <strong>uploadFileChunk</strong>(byte[] chunkData, int size, int offset, int totalSize) method (or something like that) that uploads parts of the file and the servers writes it the to disk. </p>
| 16,077 |
<p>Are there any good libraries for cool text animation effects for use in Actionscript (for use in an intro screen or banner).</p>
<p>I've given up tryin to use Flash itself because that takes forever, and I dont know which of the many flash text animation tools to choose from.</p>
<p>I'd like to be able to dynamica... | <p>There is <a href="http://www.txeff.com/" rel="nofollow noreferrer">http://www.txeff.com/</a> which is pretty awesome although a little expensive. It even has an <a href="http://www.txeff.com/#/edit/null/" rel="nofollow noreferrer">effect editor</a>.</p>
| <p>txeff is definitely the best thing out there.</p>
<p>In October they have a promotion for their new version which is only $99 and has some great new features. You can use it in actionscript or flash.</p>
<p>Of course i bought it yesterday for $179! ahh</p>
| 22,943 |
<p>I have a block of JSP code that needs to be used in several places (basically a widget that several pages use). What's a good way to modularize this? I'd rather not put it in an object since string manipulation of HTML gets ugly. Using <code><%@ include file="foo.jsp"%></code> is problematic because we wind up... | <p>You can create a simple <em>tag</em> and use it anywhere you want your widget. A tag is a reusable object that you can use in any of your JSP's.</p>
<p>Please see <a href="http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/JSPTags.html" rel="nofollow noreferrer">http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/JSPTags.html... | <ol>
<li><p>Separate the JSP out into its own file and include it (JSP Includes, Tiles Includes, etc)</p></li>
<li><p>Can you create a Tag Lib incorporating the functionality?</p></li>
</ol>
| 35,643 |
<p>For my own project at home, I'm using the rather excellent managed subversion hosting from <a href="http://cvsdude.com/" rel="nofollow noreferrer">CVSDude</a>. As it's only me working on the code right now, I'm not using CruiseControl.net, however I expect this will change in the next couple of months and will want... | <p>Use a subrange of <code>[\u0000-\uFFFF]</code> for what you want.</p>
<p>You can also use the <code>re.UNICODE</code> compile flag. <a href="http://docs.python.org/lib/re-syntax.html" rel="nofollow noreferrer">The docs</a> say that if <code>UNICODE</code> is set, <code>\w</code> will match the characters <code>[0-9... | <p>\X seems to be available as a generic word-character in some languages, it allows you to match a single character disregarding of how many bytes it takes up. Might be useful.</p>
| 3,518 |
<p>Is it necessary to set large objects to <code>null</code> when implementing a <code>Dispose()</code> method?</p>
| <p>Not usually.</p>
<p>The garbage collector looks for rooted objects, and circular dependencies don't prevent collection if neither object is rooted.</p>
<p>There is a caveat: if object A has a reference to object B, and object B is being disposed, you may want to clean up that relationship or else you could end up ... | <p>Think about the purpose of Disposable methods for a bit: it's usually because you're holding some resource that won't be released during garbage collection. This is usually something like a database connection or a file handle. Thus, once the Dispose method has been called, all those resources have been released.... | 7,257 |
<p>In python do you generally use <a href="http://www.python.org/dev/peps/pep-0008/" rel="noreferrer">PEP 8 -- Style Guide for Python Code</a> as your coding standards/guidelines? Are there any other formalized standards that you prefer?</p>
| <blockquote>
<p>"In python do you generally use PEP 8 -- Style Guide for Python Code as your coding standards/guidelines? Are there any other formalized standards that you prefer?"</p>
</blockquote>
<p>As mentioned by you follow <a href="http://www.python.org/dev/peps/pep-0008/" rel="noreferrer">PEP 8</a> for the ma... | <p>I follow the PEP8, it is a great piece of coding style.</p>
| 46,436 |
<p>I've used <a href="http://upx.sourceforge.net/" rel="noreferrer">UPX</a> before to reduce the size of my Windows executables, but I must admit that I am naive to any negative side effects this could have. What's the downside to all of this packing/unpacking?</p>
<p>Are there scenarios in which anyone would recommen... | <blockquote>
<p>... there are downsides to
using EXE compressors. Most notably:</p>
<ul>
<li><p>Upon startup of a compressed EXE/DLL, all of the code is
decompressed from the disk image into
memory in one pass, which can cause
disk thrashing if the system is low on
memory and is forced to access the
swap file. In contr... | <p>I believe there is a possibility that it might not work on computers that have <a href="http://en.wikipedia.org/wiki/Data_Execution_Prevention" rel="nofollow noreferrer">DEP</a> (Data Execution Prevention) turned on. </p>
| 46,066 |
<p>So I'm getting really sick of E*TRADE and, being a developer, would love to find an online broker that offers an API. It would be great to be able to write my own trading tools, and maybe even modify existing ones.</p>
<p>Based on my research so far, I've only found one option. Interactive Brokers offers a multi-la... | <p>I vote for IB(Interactive Brokers). I've used them in the past as was quite happy. Pinnacle Capital Markets trading also has an API (pcmtrading.com) but I haven't used them.</p>
<p><strong>Interactive Brokers:</strong></p>
<p><a href="https://www.interactivebrokers.com/en/?f=%2Fen%2Fsoftware%2Fibapi.php" rel="nore... | <p>Only related with currency trading (Forex), but many Forex brokers are offering MetaTrader which let you code in MQL. The main problem with it (aside that it's limited to Forex) is that you've to code in MQL which might not be your preferred language.</p>
| 8,390 |
<p>I'm creating a really complex dynamic sql, it's got to return one row per user, but now I have to join against a one to many table. I do an outer join to make sure I get at least one row back (and can check for null to see if there's data in that table) but I have to make sure I only get one row back from this outer... | <p>In MySql you can ensure that any query returns at most X rows using</p>
<pre><code>select *
from foo
where bar = 1
limit X;
</code></pre>
<p>Unfortunately, I'm fairly sure this is a MySQL-specific extension to SQL. However, a Google search for something like "mysql sybase limit" might turn up an equivalent for Syb... | <p>Well, you already have a query that works. If you are concerned about the speed you could</p>
<ul>
<li><p>Add a field to table2 which
identifies which sub_id is the
'first one' or</p></li>
<li><p>Keep track of table2's primary key in table1, or in another table</p></li>
</ul>
| 29,699 |
<p>Is it possible to read the data in the php $_SESSION array in the .htaccess file in Apache? So say I have the following:</p>
<pre><code>$_SESSION['foo'] = 'bar';
</code></pre>
<p>could I then in .htaccess do something like:</p>
<pre><code>RewriteRule bla.png folder/{the php session var foo}/file.png
</code></pre>... | <p>I'm not aware that its possible.</p>
<p>But I can think of a few workarounds involving rewriting to a PHP script.</p>
| <p>You can't do that the way you want.</p>
<p>If you are really using the $_SESSION variable maybe there's an Apache environmental variable that you can use that will have the same value as the $_SESSION one.</p>
<p>Look at the following list and see if any of them helps:<br/>
<a href="http://www.zytrax.com/tech/web/... | 44,528 |
<p>I have something that is driving me absolutely crazy...</p>
<pre><code> Public Function GetAccountGroups() As IList(Of AccountGroup)
Dim raw_account_groups As IList(Of AccountGroup)
raw_account_groups = _repository.GetAccountGroups().ToList()
Dim parents = (From ag In raw_account_groups _... | <p>Lambda's in VB.Net have to return a value, so your equal sign ('=') is being intepreted as a comparison (so that the lambda returns a boolean), rather than an assignment.</p>
| <p>I haven't used VB.NET since moving to C# 3.0, but it seems like it could be a type inference issue. The error is a bit odd since List implements IList, so the assignment should work. You can say "p.ID = 123" for the lambda and things seem to work. </p>
<p>For anyone else interested in looking into it, here is code ... | 9,346 |
<p>I have a model class:</p>
<pre><code>class Person(db.Model):
first_name = db.StringProperty(required=True)
last_name = db.StringProperty(required=True)
</code></pre>
<p>I have an instance of this class in <code>p</code>, and string <code>s</code> contains the value <code>'first_name'</code>. I would like to do... | <p>If the model class is sufficiently intelligent, it should recognize the standard Python ways of doing this.</p>
<p>Try:</p>
<pre><code>getattr(p, s)
setattr(p, s, new_value)
</code></pre>
<p>There is also hasattr available.</p>
| <p>p.first_name = "New first name"
p.put()</p>
<p>or p = Person(first_name = "Firsty",
last_name = "Lasty" )
p.put()</p>
| 11,727 |
<p>What is the easiest way to test (using reflection), whether given method (i.e. java.lang.Method instance) has a return type, which can be safely casted to List<String>?</p>
<p>Consider this snippet:</p>
<pre><code>public static class StringList extends ArrayList<String> {}
public List<String> me... | <p>I tried this code and it returns the actual generic type class so it seems the type info can be retrieved. However this only works for method 1 and 2. Method 3 does not seem to return a list typed String as the poster assumes and therefore fails.</p>
<pre><code>public class Main {
/**
* @param args the command lin... | <p><a href="http://forums.java.net/jive/thread.jspa?threadID=47527&tstart=0" rel="nofollow noreferrer" title="Generics and getting the actual type ...">This thread</a> on the java.net forums might be helpful (although I have to admit I didn't understand everything they said).</p>
| 22,096 |
<p>I'm trying to use Exchange Web Services to update a calendar item. I'm creating an ItemChangeType, and then an ItemIdType. I have a unique ID to use for ItemIdType.Id, but I have nothing to use for the ChangeKey. When I leave it out, I get an ErrorChangeKeyRequiredForWriteOperations. But when i try to just put s... | <p>To be a bit more explicit on Hauge's answer: the ChangeKey is stored in Exchange and identifies the current state of the item. Any change to that item creates a new ChangeKey.</p>
<p>This allows Exchange to "know" that your update is being applied to the same item state as when you looked at the item - it hasn't ch... | <p>If you know ID only, you can get ChangeKey easily, for example for folder:</p>
<pre><code> private FolderIdType GetFullFolderID(string folderID)
{
GetFolderType request = new GetFolderType();
request.FolderIds = new BaseFolderIdType[1];
FolderIdType id = new FolderIdType();
id.Id = folderID;... | 18,119 |
<p>Is it possible to do pseudo-streaming(eg start playback at any point) with wmv files and silverlight? </p>
<p>This is possible using Flash in a progressive download setup but can it be done on the Microsoft track?</p>
| <p>You can <strong>use <a href="http://www.microsoft.com/windows/windowsmedia/forpros/server/version.aspx" rel="nofollow noreferrer">Windows Media Services 2008</a></strong>. It enables you to actually stream WMV to Silverlight interface.</p>
| <p>No reason you couldn't stream it like any other HTTP video; it basically just expects the file to be a correct WMV file. You would need to have a server that supports the seeking, though.</p>
| 10,795 |
<p>I just want to know how I can start derby in network server mode and still be able to get an embedded connection?</p>
<p>Thank you.</p>
| <p>The <a href="http://publib.boulder.ibm.com/infocenter/cscv/v10r1/index.jsp?topic=/com.ibm.cloudscape.doc/radminembeddedserverex.html" rel="nofollow noreferrer">Embedded Server mode</a> sounds like what you are asking for. It allows you to start a network server when you start the embedded database.</p>
| <p>It sounds contradictory that you want to start derby in network server mode and get the embedded driver. Even if this might be possible, it is definitely discouraged. You should decide on whether you want to use Apache Derby in the network mode using the DRDA or as an embedded driver and stick to that decision.</p>
... | 49,037 |
<p>How can I find the high water mark (the historical maximum number of concurrent users) in an <strong>oracle database (9i)</strong>.</p>
| <p>This should do the trick:</p>
<pre><code>SELECT sessions_highwater FROM v$license;
</code></pre>
| <pre><code>select max_utilization from v$resource_limit where resource_name = 'sessions';
</code></pre>
<p>A good overview of Oracle system views can be found <a href="http://www.adp-gmbh.ch/ora/misc/dynamic_performance_views.html" rel="nofollow noreferrer">here</a>.</p>
| 2,963 |
<p>Is it possible to see the history of changes to a particular line of code in a Subversion repository?</p>
<p>I'd like, for instance, to be able to see when a particular statement was added or when that statement was changed, even if its line number is not the same any more.</p>
| <p>I don't know a method for tracking statements through time in Subversion.</p>
<p>It is simple however to see when any particular line in a file was last changed using <code>svn blame</code>. Check the SVNBook: <a href="http://svnbook.red-bean.com/en/1.7/svn.ref.svn.c.blame.html" rel="noreferrer"><code>svn blame</co... | <p>The command you're looking for is <a href="http://svnbook.red-bean.com/en/1.7/svn.ref.svn.c.blame.html" rel="nofollow noreferrer"><code>svn blame</code></a>.</p>
| 7,716 |
<p>I want to explicitly call a view from my controller.</p>
<p>Right now I have:</p>
<pre><code>def some_action
.. do something ...
respond_to do |format|
format.xml
end
end
</code></pre>
<p>... then it calls my some_action.xml.builder view. How can I call some other view? Is there a parameter in respond... | <p>You could do something like the following using render:</p>
<pre><code>respond_to do |format|
format.html { render :template => "weblog/show" }
end
</code></pre>
| <p>Use render</p>
<p><a href="http://api.rubyonrails.com/classes/ActionController/Base.html#M000474" rel="nofollow noreferrer">http://api.rubyonrails.com/classes/ActionController/Base.html#M000474</a></p>
| 34,299 |
<p>Do you attach the images? </p>
<p>Use absolute urls? </p>
<p>How do you best avoid getting flagged as spam? </p>
| <p>One of the biggest causes, that I have found, for email to be flagged as spam is DNS. Make sure the domain / MX records from which you are sending the email actually resolve correctly back from the server used for sending.</p>
<p>As for images, you could attach them, but the most common way is to host them and use... | <p>Campaign Monitor is a great resources for html email:
<a href="http://www.campaignmonitor.com/resources/#building" rel="nofollow noreferrer">http://www.campaignmonitor.com/resources/#building</a></p>
<p>Also <a href="http://www.email-standards.org/" rel="nofollow noreferrer">http://www.email-standards.org/</a>, but... | 6,631 |
<p>In postgis, is the <code>ST_GeomFromText</code> call very expensive? I ask mostly because I have a frequently called query that attempts to find the point that is nearest another point that matches some criteria, and which is also within a certain distance of that other point, and the way I currently wrote it, it's... | <p>Go to about:ubiquity in Firefox. Under the section "subscribed feeds" there should be an option to unsubscribe to command feeds you no longer desire.</p>
<p>Also, if you clear your entire browser history, it will delete all command feeds (this will be fixed by 0.2)</p>
| <p>Check this out:
<a href="http://getsatisfaction.com/mozilla/topics/how_do_you_edit_delete_the_default_ubiquity_commands_verbs" rel="nofollow noreferrer">http://getsatisfaction.com/mozilla/topics/how_do_you_edit_delete_the_default_ubiquity_commands_verbs</a></p>
<p>Also, you can find a utility to reset your ubiquity... | 5,686 |
<p>A couple of the options are:</p>
<pre><code>$connection = {my db connection/object};
function PassedIn($connection) { ... }
function PassedByReference(&$connection) { ... }
function UsingGlobal() {
global $connection;
...
}
</code></pre>
<p>So, passed in, passed by reference, or using global. I'm th... | <p>I use a Singleton ResourceManager class to handle stuff like DB connections and config settings through a whole app:</p>
<pre><code>class ResourceManager {
private static $DB;
private static $Config;
public static function get($resource, $options = false) {
if (property_exists('ResourceManager'... | <pre><code>function usingFunc() {
$connection = getConnection();
...
}
function getConnection() {
static $connectionObject = null;
if ($connectionObject == null) {
$connectionObject = connectFoo("whatever","connection","method","you","choose");
}
return $connectionObject;
}
</code></pre>
<p>This way, ... | 28,286 |
<p>I have recently started printing with Polymaker's PolyMax PETG on my Ender 3 v2. I have not been able to get the layer adhesion anywhere near as strong as it should be. I would guess it is around 20-25 % of the strength in the XY direction. The parts snap easily along the layer lines under loads that PLA and nylon h... | <p>I had this problem with my Ender 3 until I changed to a different extruder and now PETG never has adhesion problems. Even 100 % fan is fine at 245 °C. I think the stock hobbed gear just slips on PETG really badly, giving underextrusion. Go slow, increase the flow to compensate, and possibly increase temperature slig... | <p>The layer adhesion with Polymax PETG at 260 °C was great so I didn't go any higher.</p>
| 1,961 |
<p>For example, if I wanted to do it from the command line I would use "a.exe > out.txt". Is it possible to do something similar in Visual Studio when I debug (F5)?</p>
| <p>In project properties:</p>
<ul>
<li>enter command line arguments "> out.txt"</li>
<li>Disable the hosting process</li>
</ul>
| <p>Just checking, you are not looking for outputting within Visual Studio using stuff like</p>
<blockquote>
<p>System.Diagnostics.Debug.WriteLine("this goes into the Output window");</p>
</blockquote>
<p>right?</p>
| 42,347 |
<p>The follow code (running in ASP.Net 2.0) displays the contents of the requested URL <strong>twice</strong>. I only want it to display the contents of the requested URL once. I can't figure out what I'm doing wrong. The URL requested is returning XML and if I visit the URL directly, it works fine.</p>
<pre><code>Htt... | <p>There really aren't any true "private" attributes or methods in Python. One thing you can do is simply override the method you don't want in the subclass, and raise an exception:</p>
<pre><code>>>> class Foo( object ):
... def foo( self ):
... print 'FOO!'
...
>>> class Bar( ... | <p>This is the cleanest way I know to do it.</p>
<p>Override the methods and have each of the overridden methods call your disabledmethods() method. Like this:</p>
<pre><code>class Deck(list):
...
@staticmethod
def disabledmethods():
raise Exception('Function Disabled')
def pop(self): Deck.disabledmet... | 28,699 |
<p>I am running Ruby and MySQL on a Windows box.</p>
<p>I have some Ruby code that needs to connect to a MySQL database a perform a select. To connect to the database I need to provide the password among other things. </p>
<p>The Ruby code can display a prompt requesting the password, the user types in the password a... | <p>To answer my own question, and for the benefit of anyone else who would like to know, there is a Ruby gem called <a href="http://rubydoc.info/gems/highline/frames" rel="noreferrer">HighLine</a> that you need.</p>
<pre><code>require 'rubygems'
require 'highline/import'
def get_password(prompt="Enter Password")
a... | <p>The fancy_gets gem has a password thing that works fine with jruby:</p>
<p><a href="https://github.com/lorint/fancy_gets" rel="nofollow">https://github.com/lorint/fancy_gets</a></p>
<p>Code ends up like:</p>
<pre><code>require 'fancy_gets'
include FancyGets
puts "Password:"
pwd = gets_password
# ...
</code></pre... | 16,186 |
<p>I've got to do some significant development in a large, old, spaghetti-ridden ASP system. I've been away from ASP for a long time, focusing my energies on Rails development.</p>
<p>One basic step I've taken is to refactor pages into subs and functions with meaningful names, so that at least it's easy to understand @... | <p><strong>Assumptions</strong></p>
<p>The documentation for the Classic ASP system is rather light.</p>
<p>Management is not looking for a rewrite.</p>
<p>Since you have been doing ruby on rails, your (VB/C#) ASP.NET is passable at best.</p>
<p><strong>My experience</strong></p>
<p>I too inherited a classic ASP s... | <p>This is very old, but couldn't resist adding my two cents. If you must rewrite, and must continue to use classic ASP:</p>
<ul>
<li>use JScript! much more powerful, you get inheritance, and there some good side benefits like using the same methods for server-side validation as you use for client-side</li>
<li>you ca... | 4,369 |
<p>Okay, I've looked all over the internet for a good solution to get PHP and MySQL working on IIS7.0. It's nearly impossible, I've tried it so many times and given up in vain. Please please help by linking some great step-by-step tutorial to adding PHP and MySQL on IIS7.0 from scratch. PHP and MySQL are essential for ... | <p>Have you taken a look at this:</p>
<p><a href="http://learn.iis.net/page.aspx/246/using-fastcgi-to-host-php-applications-on-iis7/" rel="nofollow noreferrer">http://learn.iis.net/page.aspx/246/using-fastcgi-to-host-php-applications-on-iis7/</a></p>
<p>MySQL should be pretty straight forward.</p>
<p>Let us know wha... | <p>It's supposed to work via FastCGI. But I haven't had great success (using Vista). I can get PHP to run, but it crashes after a page loads (FastCGI does). So I'm modding you up. I'd like to see a reliable answer myself.</p>
| 3,303 |
<p>I'd like my .exe to have access to a resource string with my svn version. I can type this in by hand, but I'd prefer an automated way to embed this at compile time. Is there any such capability in Visual Studio 2008?</p>
| <p>I wanted a similar availability and found $Rev$ to be insufficient because it was only updated for a file if that file's revision was changed (which meant it would have to be edited and committed very time: not something I wanted to do.) Instead, I wanted something that was based on the repository's revision number... | <p>You can get <a href="http://svnbook.red-bean.com/nightly/en/svn.advanced.props.special.keywords.html" rel="nofollow noreferrer">SVN to embed it for you</a>, if that will solve the problem. See the $Rev$ keyword on that page.</p>
| 18,237 |
<p>I've got an NSBrowser hooked up to an NSTreeController bound to an array of NSTreeNode objects. It's easy enough to get the text portion working by setting the Content and Content Value bindings to properly reference the tree controller, but how do I set the image for each cell using bindings?</p>
| <p>The following worked well:</p>
<pre><code>NSData *d = (NSData *)CFHTTPMessageCopySerializedMessage(messageRef);
NSLog(@"%@",[[[NSString alloc] initWithBytes:[d bytes] length:[d length] encoding:NSUTF8StringEncoding] autorelease]);
</code></pre>
<p>Hope this is helpful to others.</p>
| <p>The only reason why you should be getting an EXC_BAD_ACCESS when accessing the bytes is if the messageData is NULL (no HTTP body) and you're dereferencing it.</p>
<p>Point to remember: the HTTP body isn't the "raw request". It doesn't include the headers or the actual HTTP instruction (GET/POST/ETC). If you haven't... | 45,365 |
<p>Port was filtered by ISP.</p>
<p>The problem is that HTTPS 443 port isn't accessible from internet, but it is open in our local network.
Our iSeries v5r4 is connected to inet via L2TP withot IPSec.
If no packet filters are active, nmap shows that ports 25, 80, 110 and even 10322 (WAS admin console) have state 'open... | <p>Some ISPs filter specific ports, like RoadRunner used to filter my webserver. It'd be odd since 80 isn't filtered, but it's a possibility. </p>
| <p>You should configure your firewall to open and close TCP/IP ports.</p>
<p>Each firewall has a list of ports (or port ranges) that are open or closed for trafic. PLease consult you firewall/router documentation or consult your system administrator.</p>
| 40,457 |
<p>I am implementing a HttpRequestValidationException in my Application_Error Handler, and if possible, I want to display a custom message.</p>
<p>Now, I'm thinking about the StatusCode. In my current example, it sends a 200, which I think should not be done. I would like to send the (IMHO) more appropriate 400 Bad Req... | <p>An HTTP 200 Response Code does not indicate an error. It indicates that everything was OK. You should not use a 200 response code for an error. </p>
<p>Internet Explorer shows its "Friendly Errors" page if the response is less than 512 bytes. Here's more on this issue: <a href="http://weblogs.asp.net/scottgu/ar... | <p>No, it's certainly not a good practice. 2XX status codes mean (among other things) that the <strong>request is valid</strong>. Which is just the contrary to raising a HttpRequestValidationException.</p>
<p>I don't know how to make IE behave correctly, sadly. A slightly better way than to send a 200 would be to redi... | 7,352 |
<p>What is the difference between a <strong>Snapshot</strong> Repository and <strong>Release</strong> Repository?</p>
<p>This is with reference to setting up Repositories (like Artifactory, Nexus etc)</p>
| <p>Release repositories hold releases and Snapshot repositories hold snapshots. In maven a snapshot is defined as an artifact with a version ending in -SNAPSHOT. When deployed, the snapshot is turned into a timestamp. By definition, snapshots are mutable, releases are immutable. This is why Nexus makes you store them s... | <p>SNAPSHOT here doesn't really mean ONE snapshot which is frozen and won't change, SNAPSHOT covers several snapshots whose modifications are not big enough for being represented by a new version number</p>
| 34,736 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.