input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
Encoding problem using SQLite and WinForms 2.0 C# <p>I am developing a WinForms app using .NET 2.0 and am trying to use SQLite as a DB solution. My main problem is that I have trouble seeing data from the DB in the WinForm when the data is in a non english language (in my case greek).</p>
<p>For db administration purp... | <p>Are you retrieving a string, or a byte array from the database? Internally, SQLite uses UTF-8 or UTF-16 strings (depending on which method was used to insert the string into the database) which is what it returns when you get a string value using sqlite3_column_text.</p>
<p>On the other hand, if you ask for a blob,... |
Pros and cons of MS Ajax vs. jQuery in an ASP.NET MVC app? <p>Now that RC1 is out I need to decide once and for all whether to use MS Ajax libraries or just jQuery for AJAX requests. The application is a new application. Essentially the way I'll decide is whether or not i get any <strong>significant</strong> benefit fr... | <p>Personally, I would stick with JQuery. MS AJAX is pretty heavyweight in terms of size and you can do so much with JQuery. As far as whether it is easy to convert code, well it depends on how much of the MS AJAX stuff you are using. I don't think there is really much appreciable difference in debugging from one to t... |
What is the PayPal "amount" format in WPS? <p>What is the allowed format for PayPal's Website Payments Standard (WPS) forms in the "amount" field? Must the decimal point be ".", or is it currency-dependant? Must there always be exactly two decimal places, or can there also be three (for currencies that have such small ... | <p>Looks like it's not currency dependent and the API is expecting at most two (2) decimal places with a period separator.</p>
<blockquote>
<p><code>amount</code></p>
<p>[...] Limitations: Value must be a positive number. No currency symbol. Must have two decimal places, decimal separator must be a period (.), ... |
Trim string in JavaScript? <p>How do I trim a string in JavaScript?</p>
| <p>Since new Browsers (IE9+) have <code>trim()</code> already implemented, you should only implement <code>trim()</code> if it is not already available on the Prototype-Object (overriding it is a huge performance hit). This is generally recommended when extending Native Objects! Note that the added property is enumerab... |
Java : How to determine the correct charset encoding of a stream <p>With reference to the following thread:
<a href="http://stackoverflow.com/questions/498636/java-app-unable-to-read-iso-8859-1-encoded-file-correctly">http://stackoverflow.com/questions/498636/java-app-unable-to-read-iso-8859-1-encoded-file-correctly</a... | <p>You cannot determine the encoding of a arbitrary byte stream. This is the nature of encodings. A encoding means a mapping between a byte value and its representation. So every encoding "could" be the right.</p>
<p>The <a href="http://docs.oracle.com/javase/7/docs/api/java/io/InputStreamReader.html#getEncoding%28%29... |
Java NIO: Sending large messages quickly leads to truncated packets and data loss <p>I've got this nasty problem where sending multiple, large messages in quick succession from a Java (NIO) server (running Linux) to a client will lead to truncated packets. The messages have to be large and sent very rapidly for the pr... | <p>There are many reasons why sc.write() would not send some or all of the data. You have to check the return value and/or the number of bytes remaining in the buffer.</p>
<pre><code>for (int n=0; n<20; n++){
ByteBuffer bb = encoder.encode(CharBuffer.wrap(msg+'\0'));
if(sc.write(bb) > 0 && bb.remaini... |
LINQ to SQL - Update to increment a non-primary-key field - thread-safe <p>I have two tables (well, two relevant for this question) :</p>
<p>Bets (holds the bets; Columns : Id, , MessagesPosted, )
Bets_Messages (holds the bets' forum messages; Columns : Id, BetId, )</p>
<p>When I insert a new BetMessage in Bets_Messa... | <p><strong>EDIT</strong>: Actually after rereading your post, I think that the automatic transaction generated by SubmitChanges will already take care of making sure that all of the statements are completed or none are. I was thinking that since you were using the automatically generated id, that you'd do a two-stage ... |
Javascript DOM - add form element to newly created appendChild? <p>I have two functions to add and remove table rows that contain a form input element. They both work fine, but I have a problem in that I need to show a Remove button input only on subsequently created table rows. My two function are as as follows:</p>
... | <p>I'm assuming that you are trying to avoid having the remove button in the first row, but need it there now because you think that to get it in subsequent rows, you need to have it in the row that you are cloning. If, instead, you just insert new HTML for both the upload and delete button inputs in the addRow method... |
Using WebClient to get Remote Images Produces Grainy GIFs and Can't Handle PNG+BMP <p>Greetings!</p>
<p>I'm creating a web form prototype (ImageLaoder.aspx) that will return an image so that it may be used like this simple example other Web Forms/web pages:</p>
<pre><code><img src="http://www.mydomain.com/ImageLoa... | <p>A few points about your GetImage method:</p>
<ul>
<li>When you use Image.FromStream you shouldn't close (or dispose) the stream</li>
<li>If you're calling Dispose on a stream (with the using statement) you don't need to call Close</li>
<li>You're writing to the stream, but then not "rewinding it" so l_image doesn't... |
On Linux, is the command-line program mktemp less safe than the C-function mkstemp? <p>Both operations create an empty file and return the filename but mkstemp leaves the file open in exclusive mode and gives you the handle. Is there a safety benefit to the C-function? Does this imply that there is a safety hole in t... | <p>One trick with temporary files in Unix-like operating systems (including Linux and Mac OS) is as soon as you open the file, delete it. You can still access the file, but nobody else can see it or do anything to it, and it will go away as soon as you close the file, even if your program dies a horrible death.</p>
|
How do I specify that a list property's contents are xml serialized, but the property itself should not be respresented in the markup? <p>I've got a class like this:</p>
<pre><code>[XmlRoot("channel")]
public class Channel
{
[XmlElement("title")]
public String Title { get; set; }
[WhatElseGoesHere]
[XmlAr... | <p>You could start with xml and work back? Put the desired xml in a file (<code>foo.xml</code>), then:</p>
<pre><code>xsd foo.xml
xsd foo.xsd /classes
notepad foo.cs
</code></pre>
<p>This usually provides <em>an</em> answer - although you can usually do the same thing different ways.</p>
|
Google-Analytics: How do I add an e-mail link as the final step of a goal? <p>I send a confirmation link via e-mail (in multiple places) but it seems Analytics doesn't recognize those clicks (given URL is visited) unless the visit immediate. I am guessing the last part is about session expiration.</p>
<p>How can I def... | <p>You can't. All the steps of a goal funnel must occur in the same session.</p>
<p>You could always have one goal for signing up (i.e. sending the e-mail), and another goal for the confirmation landing page. Then compare these goal conversions, and you'll get the same story.</p>
|
SQL Server 2005: Nullable Foreign Key Constraint <p>I have a foreign key constraint between tables Sessions and Users. Specifically, Sessions.UID = Users.ID. Sometimes, I want Sessions.UID to be null. Can this be allowed? Any time I try to do this, I get an FK Constraint Violation.</p>
<p>Specifically, I'm inserting a... | <p>I seemed to remember creating a nullable FK before, so I whipped up a quick test. As you can see below, it is definitely doable (tested on MSSQL 2005).</p>
<p>Script the relevant parts of your tables and constraints and post them so we can troubleshoot further.</p>
<pre><code>CREATE DATABASE [NullableFKTest]
GO
US... |
What is Important to you in your choice of developer tools? <p>My company sells developer tools. As a developer myself, it is hard not to assume that what is important to me is important to many other developers:</p>
<ol>
<li><p>In our case, the thing we lack the most is time. So, I'm willing to spend money on things ... | <p>If you want to get your software out there you should:</p>
<ul>
<li>Have a fully-featured demo;</li>
<li>Be upfront about pricing. As soon as your website says "Contact us for pricing" I've lost interest;</li>
<li>Be sufficiently cheap that it can be bought without getting approval from the CEO. Look at Jira. Re... |
Is PThread a good choice for multi-platorm C/C++ multi-threading program? <p>Been doing mostly Java and smattering of .NET for last five years and haven't written any significant C or C++ during that time. So have been away from that scene for a while.</p>
<p>If I want to write a C or C++ program today that does some ... | <p>Well, pthreads is the old posix standard for writing threaded programs. Its the lowest level threading routines, so its a good choice for cross-platform threading.</p>
<p>However, there are alternatives:</p>
<ul>
<li><a href="http://www.ddj.com/cpp/184401518">boost::thread</a> - an STL style
threading library </li... |
Exist any Obj-c library to integration with paypal? <p>I wonder if exist a pre-made objective-c library to work with paypal, including with credit-cards.</p>
<p>My google search not get returns (I look for objective-c paypal)</p>
<p>Also, if exist other librarys for common gateways....</p>
| <p>If you want it to go through your application, however, you could use WebKit to integrate a web view that connects to PayPal. That way, everything can be contained within the application but you would still work with PayPal the way they want you to work with them.</p>
|
What is your personal approach/take on commenting? <h3>Duplicate</h3>
<blockquote>
<p><a href="http://stackoverflow.com/questions/142830/what-are-your-hard-rules-about-commenting-your-code">What are your hard rules about commenting?</a></p>
</blockquote>
<p>A Developer I work with had some things to say about comme... | <p>There's a tragic flaw with the "self-documenting code" theory. Yes, reading the code will tell you exactly what it <em>is</em> doing. However, the code is incapable of telling you what it's <em>supposed</em> to be doing.</p>
<p>I think it's safe to say that all bugs are caused when code is not doing what it's suppo... |
Why would mod_rewrite rewrite twice? <p><a href="http://stackoverflow.com/questions/180007/how-do-configure-optional-or-extraneous-urls">I only recently found out about URL rewriting</a>, so I've still got a lot to learn.</p>
<p>While following the <a href="http://www.easymodrewrite.com/" rel="nofollow">Easy Mod Rewri... | <p>From Example 1 on <a href="http://web.archive.org/web/20090302114812/http://easymodrewrite.com/notes-last" rel="nofollow">this page</a>, which is part of the tutorial linked in your question:</p>
<blockquote>
<p>Assume you are using a CMS system that rewrites requests for everything to a single index.php script.<... |
What is the significance of starting constants with 'k'? <p>I'm teaching myself Objective-C and I noticed in a lot of books and examples the use of 'k' and camel-casing in constant definition, e.g. </p>
<pre><code>#define kMyConstant 0
</code></pre>
<p>What is the significance of the 'k'?
Is this unique to Objective... | <p>It was mentioned once before in the SO question, <a href="http://stackoverflow.com/questions/472103/lower-case-k-in-cocoa">Lower case "k" in Cocoa</a>.</p>
<blockquote>
<p>It is a general programming notation
not specific to Objective-C (i.e.
Hungarian Notation) and the "k" stands for "constant".</p>
</blockq... |
What's your disaster recovery plan? <p>And what would you recommend for an ASP Net web application, with a not so large SQL server database (around 10Gb)?</p>
<p>I was just wondering, is that a good idea to have an Amazon EC2 instance configured ready to host your app in an emergency?</p>
<p>In this scenario, what wo... | <p><strong>Update</strong> - Just saw your comment. Amazon EC2 with log shipping is definitely the way to go. Don't use mirroring because that normally assumes the other standby database is available. Changing your DNS should not take more than 1/2 hour if you set your TTL to that. That would give you time to integrate... |
Two Tables Same Height <p>I want two tables to have the same height. If the left table contain longer text than the right table I want it to be as long as the left table.</p>
<p>This is how it looks now:</p>
<p><img src="http://i.stack.imgur.com/aCoOR.png" alt="enter image description here"></p>
<p>I can't set the h... | <p>Can you use two side-by-side cells instead?</p>
<pre><code><table>
<tr>
<td style="width: 30%">Left Column</td>
<td style="width: 70%">Right Column</td>
</tr>
</table>
</code></pre>
<p><strong>Edit</strong> - Just for completeness... if there is a technic... |
How do you encourage end users to fill out trouble tickets? <p>So, I work in a fairly small IT section. We have a trouble ticketing system that about half of our end users use. Some of my coworkers don't really do much to encourage our end users to use the system we have in place. The end result? Constant interrupt... | <p><strong>Make it appealing to do so.</strong> </p>
<p>Mention to the user that issues with trouble tickets are viewed by the entire development team and have been found to get fixed significantly faster. Say that anything without a ticket has the potential to get lost in the shuffle. Provide them outward facing l... |
Why does backtracking make an algorithm non-deterministic? <p>So I've had at least two professors mention that backtracking makes an algorithm non-deterministic without giving too much explanation into why that is. I <em>think</em> I understand how this happens, but I have trouble putting it into words. Could somebod... | <p>It's not so much the case that backtracking makes an algorithm non-deterministic.</p>
<p>Rather, you usually need backtracking to process a non-deterministic algorithm, since (by the definition of non-deterministic) you don't know which path to take at a particular time in your processing, but instead you must try ... |
Timezone considerations in sql server <p>I'm using an sql server 2005 hosted in the states. Soon we will move the db to Europe.
I'd like to update the dates in the db to take into account the timezone difference.
Is there a good way to do this?
Or is it just a case of looping through the dates and adding the timezone o... | <p>Does it really need to change because it was physically moved? If you're supporting global applications I would store all my date/time information in GMT and translate to local on the client side.</p>
|
Dynamic Properties for object instances? <p>After the previous question "What are the important rules in Object Model Design", now I want to ask this: </p>
<p><strong>Is there any way to have dynamic properties for class instances?</strong></p>
<p>Suppose that we have this schematic object model:</p>
<p><img src="ht... | <p>What you want is <code>Properties pattern</code>. Check out long and boring but clever article from <a href="http://steve-yegge.blogspot.com/2008/10/universal-design-pattern.html" rel="nofollow">Steve Yegge on this</a></p>
|
In C++/CLI, what does the hat character ^ do? <p>I was reading Ivor Horton's Beginning Visual C++ 2008 and many of its CLR examples have this definition for main:</p>
<pre><code>int main(array<System::String ^> ^args)
</code></pre>
<p>I went back, page by page, to the beginning of the book to find the first suc... | <p>It's a managed pointer - while * marks a pointer to an object that is unmanaged, ^ points to a garbage collected object (handled by the framework). Read <a href="http://msdn.microsoft.com/en-us/library/cxx6f46y.aspx">this</a> for more information about the way pointers are handled in .NET.</p>
|
How do Django model fields work? <p>First of all,I'm not into web programming. I bumped into django and read a bit about models. I was intrigued by the following code ( from djangoproject.com ) :</p>
<pre><code>
class Person(models.Model):
first_name = models.CharField(max_length=50)
last_name = models.CharFie... | <p>The essence of your question is "how come these class variables (which I assign Field objects to) suddenly become instance variables (which I assign data to) in Django's ORM"? The answer to that is the magic of Python <a href="http://docs.python.org/reference/datamodel.html">metaclasses</a>.</p>
<p>A metaclass all... |
Mvc Release Candidate "File" ActionResult <p>K... I'm doing something obviously wrong. I have a simple page with a file input control on and a submit button. I'm trying out the new "File" ActionResult that was released with the Mvc RC...</p>
<p>All, I want to happen is when the submit button is clicked the selected fi... | <p>FileResult returns the ASCII or binary contents of the file. When you say do the following:</p>
<pre><code><img src="<%=Model.FileContent.FileContents %>" />
</code></pre>
<p>You are attempting to push the binary image data into the <code>src</code> attribute. That will never work, because the <code>... |
MySQL NOT LIKE query not working <p>I have 2 tables:</p>
<ul>
<li>posts</li>
<li>tags</li>
</ul>
<p>Tags table is structured like this:</p>
<ul>
<li>post_id</li>
<li>tag</li>
</ul>
<p>So for every tag that's given for a post, I create a record in the tags table. If a post has 10 tags, there will be 10 records in ta... | <p>Make sure you have indexes or this will perform very badly:</p>
<pre><code>SELECT posts.id, posts.title, posts.content
FROM posts
WHERE NOT EXISTS (
SELECT post_id from tags
WHERE tags.tag LIKE '%$keywords%'
AND posts.id=tags.post_id
)
</code></pre>
<p>This gets a list of all posts, excluding those that ... |
How to efficiently implement an event loop? <p><strong>COM Object</strong> (Server) sends <strong>event notification</strong> successfully to <strong>COM Client</strong></p>
<p><strong>Without:</strong></p>
<ul>
<li>ATL</li>
<li>MFC</li>
</ul>
<p>How to efficiently get the <strong>main thread</strong> to <strong>wai... | <p>With event objects.</p>
<p>The main thread calls CreateEvent() in its initialisation to create an auto-reset event object.</p>
<p>The main thread then enters an event loop in which it calls MsgWaitForMultipleObjects() repeatedly. (<a href="http://sarathc.wordpress.com/2008/09/19/when-and-how-should-we-use-msgwait... |
How do I convert a decimal to an int in C#? <p>How do I convert a decimal to an int?</p>
| <p>Use <code>Convert.ToInt32</code> from <code>mscorlib</code> as in</p>
<pre><code>decimal value = 3.14m;
int n = Convert.ToInt32(value);
</code></pre>
<p>See <a href="http://msdn.microsoft.com/en-us/library/93kx4xke.aspx">MSDN</a>. You can also use <code>Decimal.ToInt32</code>. Again, see <a href="http://msdn.micro... |
Windows equivalent of the Mac OS X âopenâ command <p>Liu Chang asked a very similar question to this one here, <a href="http://stackoverflow.com/questions/264395/linux-equivalent-of-the-mac-os-x-open-command">http://stackoverflow.com/questions/264395/linux-equivalent-of-the-mac-os-x-open-command</a>.</p>
<p>Is the... | <p>The closest thing available is <code>start</code>.</p>
|
format date in c# <p>How can I format a date as <code>dd/mm/yyyy</code> or <code>mm/dd/yy</code> ? </p>
<p>Like in VB <code>format("dd/mm/yy",now)</code></p>
<p>How can I do this in C#?</p>
| <p>It's almost the same, simply use the <code>DateTime.ToString()</code> method, e.g:</p>
<pre><code>DateTime.Now.ToString("dd/MM/yy");
</code></pre>
<p>Or:</p>
<pre><code>DateTime dt = GetDate(); // GetDate() returns some date
dt.ToString("dd/MM/yy");
</code></pre>
<p>In addition, you might want to consider using ... |
How to rename XIB/NIB files in Xcode 3? <p>How do I rename XIB/NIB files in Xcode? There is no "Refactor" option, and right clicking and choosing "Rename" does not work correctly.</p>
| <p>The configuration file <code>Info.plist</code> contains the name of the main XIB file. Changing the relevant property to match the new name should fix your issue.</p>
|
Extending borders <p>I have an image that will be centered (left and right) in the window, there is no left border,but there is a right border. I was wondering if it is possible for the top border to go from the very left of the page (past the image) and stop at the right border and for the bottom border to start at th... | <p>You might want to clarify how flexible you're willing to be. You can approach this multiple ways. Do you want the top and bottom borders to extend to the edge of the viewport (thus needing them to be fluid-width)?</p>
<p>You can handle this using background images with <code>background-position</code> and a sliding... |
Post/Redirect/Get: Redirect to specific route <p>I have the following scenario:</p>
<p>I have an edit page, which can be called from different pages. These pages could be the detail view for the current entity, or the list view for the entities (with or without a search in the route).</p>
<p>HOW do I cleanly redirect... | <p><a href="http://blogs.teamb.com/craigstuntz/2009/01/23/37947/" rel="nofollow">Do not use TempData when not redirecting.</a> One AJAX request from your edit page, and the TempData will go away.</p>
<p>Tomas is right that a hidden element or query string parameter is the way to go. But make sure you sanitize the valu... |
Simple simulations for Physics in Python? <p>I would like to know similar, concrete simulations, as the simulation about watering a field <a href="http://stackoverflow.com/questions/494184/simulation-problem-with-mouse-in-pygame">here</a>.</p>
<p>What is your favorite library/internet page for such simulations in Pyth... | <p>If you are looking for some <em>game</em> physics (collisions, deformations, gravity, etc.) which <em>looks</em> real and is reasonably <em>fast</em> consider re-using some <em>physics engine</em> libraries.</p>
<p>As a first reference, you may want to look into <a href="http://www.pymunk.org/" rel="nofollow">pymun... |
WebForm_PostBackOptions documentation <p>Is there any documentation on the parameters to WebForm_PostBackOptions? I can't find anything by Googling.</p>
| <p>There is no official documentation on this. However if you look at the javascript source code you will see this:</p>
<pre><code>function WebForm_PostBackOptions(eventTarget, eventArgument, validation, validationGroup, actionUrl, trackFocus, clientSubmit)
</code></pre>
<p>I think the parameter names are quite self-... |
Bind to a method in WPF? <p>How do you bind to an objects method in this scenario in WPF?</p>
<pre class="lang-cs prettyprint-override"><code>public class RootObject
{
public string Name { get; }
public ObservableCollection<ChildObject> GetChildren() {...}
}
public class ChildObject
{
public string... | <p>Another approach that might work for you is to create a custom <a href="http://msdn.microsoft.com/en-us/library/ms613620.aspx"><code>IValueConverter</code></a> that takes a method name as a parameter, so that it would be used like this:</p>
<pre><code>ItemsSource="{Binding
Converter={StaticResource MethodToVal... |
How do I implement a generic stack in C#? <p>I'm using Visual C# to program an RPN calculator using Stack. Problem is I don't know how to do this. I'm using System.Collections.Generic, but</p>
<pre><code>Stack<double> s = new Stack<double>();
</code></pre>
<p>generates the error:</p>
<blockquote>
<p>Us... | <p>Try this</p>
<pre><code>Stack<int> s = new Stack<int>();
</code></pre>
<p>Replace int with whatever type you are storing in the stack. </p>
|
Equivalent code in jQuery when integrating another library <p>I am using <a href="http://en.wikipedia.org/wiki/MooTools" rel="nofollow">MooTools</a> 1.11 and <a href="http://en.wikipedia.org/wiki/JQuery" rel="nofollow">jQuery</a> 1.2. The Ajax function is not working properly for the following code.</p>
<pre><code>jQu... | <p><a href="http://www.tizag.com/javascriptT/javascriptconfirm.php" rel="nofollow"><code>confirm</code></a> is a built-in function (a reserved name)... try using a different name for it.</p>
|
Passing "const" variable to method in Java <p>Is there an equivalent in Java to the passing on const references in C++?<br>
Isn't leaving out the "constness" misleading in regard to the method signature?</p>
| <p>No, there isn't.</p>
<p>Java "final" is not an exact equivalent of C++ "const". The following (delayed initialization of a final variable) works in Java:</p>
<pre><code>final double x;
int w = 1;
if (w > 2)
{
x = 0.5;
}
else
{
x = - 0.5;
}
</code></pre>
<p>but it doesn't work in C++ with "final" replac... |
sharing asp session over virtual directory <p>In IIS I have asp (classic) site. In that site there is virtual directory. Is there any way to share session between those two web applications?</p>
<p>tnx</p>
| <p>It's possible, but real complicated. Basically, you'll have to make the Session state save in a database rather than in memory. When it's in memory, it'll be scoped to the web application but if you have it in a database, both applications should be able to read it. Here's an article about sharing sessions between a... |
CSS word-wrapping in div <p>I have a div with a width of 250px. When the innertext is wider than that i want it to break down. The div is float: left and now has an overflow. I want the scrollbar to go away by using word-wrapping. How can i achieve this?</p>
<pre><code><div id="Treeview">
<div id="HandboekBox... | <p>As Andrew said, your text should be doing just that.</p>
<p>There is one instance that I can think of that will behave in the manner you suggest, and that is if you have the whitespace property set.</p>
<p>See if you don't have the following in your CSS somewhere:</p>
<pre><code>white-space: nowrap
</code></pre>
... |
Regex: How to get all contents inside a tag #[SOME TEXT HERE] <p>I am working on a simple token replacement feature of our product. I have almost resolved all the issue but I missed one thing. A token must support attributes, and an attribute can also be a token. This is part of a bigger project. hope you can help.</p>... | <p>This is a little border-line for a regexp, since it depends on a context, but still...</p>
<pre><code>#\[(\](?=")|[^\]])+\]
</code></pre>
<p>should do it.</p>
<p>The idea is to mention a closing square bracket can be part of the parsed content if followed by a double quotes, as part of the end of an attribute.</p... |
Versioning CSS files with a query string like Stackoverflow does? <p>If you look at Stackoverflow.com's source you'll see the reference to their css file is:</p>
<pre><code><link href="/Content/all.min.css?v=2383" rel="stylesheet" type="text/css" />
</code></pre>
<p>How is this done so they can pass a version v... | <p><a href="http://particletree.com/notebook/automatically-version-your-css-and-javascript-files/">This (PHP example)</a> article explain you the idea behind it. Basically, you could happend the timestamp of the last time you modified the file. This way everytime you change your CSS, the querystring will change and "fo... |
Running SimpleXMLRPCServer in separate thread and shutting down <p>I have a class that I wish to test via SimpleXMLRPCServer in python. The way I have my unit test set up is that I create a new thread, and start SimpleXMLRPCServer in that. Then I run all the test, and finally shut down.</p>
<p>This is my ServerThread:... | <p>Two suggestions.</p>
<p>Suggestion One is to use a separate process instead of a separate thread.</p>
<ul>
<li><p>Create a stand-alone XMLRPC server program.</p></li>
<li><p>Start it with <code>subprocess.Popen()</code>. </p></li>
<li><p>Kill it when the test is done. In standard OS's (not Windows) the kill works... |
How to do Trim operation to remove space character in a text field in JavaScript? <p>How to do Trim operation to remove space character in a text field in JavaScript?</p>
| <p>A total dupe of this question:</p>
<p><a href="http://stackoverflow.com/questions/196925/what-is-the-best-way-to-trim-in-javascript">http://stackoverflow.com/questions/196925/what-is-the-best-way-to-trim-in-javascript</a></p>
<p>Unless you didn't actually mean trim of course and in fact wanted all the spaces repla... |
Disable/Enable Ribbon Buttons for MFC Feature Pack <p>I am using the MFC Feature Pack and I have some buttons on a ribbon bar, instances of CMFCRibbonButton. The problem is that I would like to enable and disable some of them in certain conditions, but at runtime. How can I do this? because there is no specific method ... | <p>When you create the <code>CMFCRibbonButton</code> object you have to specify the associated command ID (see the documentation for the <code>CMFCRibbonButton</code> constructor <a href="http://msdn.microsoft.com/en-us/library/bb982247.aspx">here</a>). Enabling and disabling of ribbon buttons is then done using the us... |
WCF - advantages and disadvantages <p>I would like to find out about BOTH advantages and disadvantages of Windows Communication Foundation from people who have used it or just know it theoretically.</p>
| <p><strong>Primary advantage</strong>: Once you get over the learning curve, WCF makes it relatively easy to expose and consume software components. i.e. Given a component bakes functionality into a WCF Service Contract, a developer can expose that same component in-proc, across processes on a single box, across a Win... |
How can I get an HTML page to read the contents of a text document? <p>How can I get an HTML page (.html) to read the contents of a text document that can be found in the same folder as the .html file? The server is IIS.</p>
<p>Thanks</p>
| <p>Google for <a href="http://www.google.com/search?q=IIS+includes" rel="nofollow">server-side includes</a>.</p>
|
Crystal Reports hanging <p>The company has recently implemented software not written by us. The software uses Crystal Reports and whenever somebody draws a particularly large report and close their browser before the report is finished loading, we cannot draw anymore reports. The only way to fix it is to reset iis whic... | <p>So if one person closes their browser prematurely, the app breaks for everyone? Can two people try loading one of these long-running reports at once? Are there multiple templates, and this only breaks one and leaves the others ok?</p>
<p>It sounds a bit like the app's implementation of Crystal is holding an exclusi... |
Eclipse: How to build an executable jar with external jar? <p>I am trying to build an executable jar program which depends on external jar downloaded. In my project, I included them in the build path and can be run and debug within eclipse.</p>
<p>When I tried to export it to a jar, I can run the program but I can't w... | <p>Eclipse 3.5 has an option to package required libraries into the runnable jar.
File -> Export...
Choose runnable jar and click next.
The runnable jar export window has a radio button where you can choose to package the required libraries into the jar.</p>
|
How can I drag an eMail from Outlook into an Adobe AIR application <p>This is a quiestion concerning both, Adobe AIR and MS Outlook.</p>
<p>I'd like to drag an eMail from Outlook into an AIR application. I want the following data to be transferred into the AIR application:</p>
<ul>
<li>unique ID of the mail in Outloo... | <ul>
<li>Basically you listen to <a href="http://livedocs.adobe.com/flex/3/langref/flash/events/NativeDragEvent.html" rel="nofollow">NativeDragEvent</a>.NATIVE_DRAG_ENTER, NATIVE_DRAG_DROP and NATIVE_DRAG_EXIT on the UI element that will receive the drop. </li>
<li>All three of these events are raised with a NativeDrag... |
What function was used to code these passwords in AFX? <p>I am trying to work out the format of a password file which is used by a LOGIN DLL of which the source cannot be found. The admin tool was written in AFX, so I hope that it perhaps gives a clue as to the algorithm used to encode the passwords.</p>
<p>Using the ... | <p>Well, I did a quick cryptanalysis on it, and so far, I can tell you that each password appears to start off with it's ascii value + 26. The next octet seems to be the difference between the first char of the password and the second, added to it's ascii value. The 3d letter, I haven't figured out yet. I think it's... |
StructureMap InstanceScope.Hybrid and IDisposable <p>I'm working on an asp.net-mvc application. The linq data context is being passed into my service objects by structure map. I've got is set to have a scope of hybrid. This all works just fine.</p>
<pre><code>protected override void configure()
{
ForRequestedType&... | <p>Ok so the latest version of StructureMap <a href="http://codebetter.com/blogs/jeremy.miller/archive/2009/02/01/structuremap-2-5-3-is-released-and-the-future-of-structuremap.aspx" rel="nofollow">(2.3.5)</a> has a useful little method called </p>
<pre><code>HttpContextBuildPolicy.DisposeAndClearAll();
</code></pre>
... |
mysqli binding fields in a prepared statement <p>I have the following code, for which I get the error:</p>
<p><strong>Warning</strong>: mysqli_stmt::bind_result() [mysqli-stmt.bind-result]: Number of bind variables doesn't match number of fields in prepared statement in file.</p>
<p>If this is only a warning, shouldn... | <p>You may need to explicity state the column names in your SELECT rather than use *, <a href="http://www.php.net/manual/en/mysqli-stmt.bind-result.php" rel="nofollow">as per the examples for MySQLi bind_result()</a>.</p>
<p>In relation to the img line, you have an extra " after .jpg</p>
<pre><code><img src='./ima... |
Role security with active directory <p>I have to ensure the security of a asp.net website at work. they ask me to do a role based security with the active directory of my work so i could do a sitemap and give the right acces at the right personne.</p>
<p>wich class of the framework should i use? make generic identity?... | <p>It's already built into AD authentication. If you are authenticating against the AD, either via NTLM logins or an AD connected forms authentication setup then the thread identity will contain the groups the user belongs to, and the role based parts of the sitemap control will work.</p>
<p>Specifically you use the <... |
How do you map an enum as string in fluent nhibernate? <p>Is it possible to map an enum as a string using Fluent Nhibernate?</p>
| <p>Yes, it does that by default if you just do:</p>
<pre><code>Map(x => x.YourProperty);
</code></pre>
<p>Make sure you're using the latest version off the trunk.</p>
<hr>
<p>As <a href="http://stackoverflow.com/users/463181/yavor-shahpasov">Yavor Shahpasov</a> pointed out in the comments, in more recent version... |
How would you build a HttpTraceListener? <p>My application uses the Trace object to log information. The information is captured in a file with the TextWriterTraceListener and it works perfectly. However, I would like to add another TraceListerner which will record the information to a Web Service. In other words, I ne... | <p>Because of your requirements about variable logging, i.e. not issuing a request for every entry, you will most certainly need to create your own listener.</p>
<p>Per MSDN docs on TraceListener (<a href="http://msdn.microsoft.com/en-us/library/system.diagnostics.tracelistener" rel="nofollow">http://msdn.microsoft.co... |
How do I return an array from a Visual FoxPro 9 OLEPUBLIC class? <p>As a newbie to FoxPro (but an old-hand at Clipper), I'm a bit at a loss to figure out how to return an array from the following OLEPUBLIC class. <em>edit</em>: I've modified the code belw to take into consideration the remarks made by @Stuart below. </... | <p>(5 years late, but perhaps still useful to someone out there...)</p>
<p>A better option would be to have your VFP code create a Collection object instead, then parse the array and add all the elements to the collection (using the .Add() method). Then you can pass the collection object back to VB, which is then happ... |
Why is the Intellisense for properties and methods of instantiated datacontext not showing? <p>I have a web application project within VS 2008 and I have created a Linq to SQL file onto which I have dragged a table from my data base. The data context is created fine but when I instantiate an object of this type the onl... | <p>OK - it turns out relatively simple. It was just that there were compile errors within that class that was causing the intellisense to break. When I recreated the file from new and cleared the compile errors I got the intellisense back.</p>
|
What's the best way to get a column name in asp.net using ODBC? <p>I have a database that has four columns like this</p>
<p>level_1, level_2, level_3, level_4</p>
<p>There are also id, name, etc., but only these four are the ones that matter to me at the moment.</p>
<p>I need to know which column, by columnname, has... | <p>Ok, so you have 4 columns that could have the value BOSS. I guess the best way to solve your problem would be to cycle thought these 4 columns until you get the Value BOSS, when you do find it, store the column name on a variable so you can get it back later.</p>
|
How do I get a list of available NamedCache objects from ScaleOut StateServer (SOSS)? <p>I'm using v4.0.</p>
<p><strong>Update:</strong></p>
<p>I've hacked together this so far:</p>
<pre><code>public class AllFilter : IFilter
{
#region IFilter Members
IndexCollection IFilter.GetIndexCollection()
{
... | <p>Apparently, there is no way to do this in v4.0 - the keys for both the stores themselves, as well as the keys for the values are stored as hashes (in the form of <code>uint</code>s), so unless the NamedCache is retrieved using the actual name, the name cannot be known.</p>
<p>The only alternative would be to track ... |
How to get the value of a control from the child into the properties of the parent in .NET? <p>I have a form that has a few similar controls and the parent contains the properties, but the child actually has the html controls. How could I setup my getters/setters using the "child" controls in the parent class? (Webfor... | <p>If I understood you correctly you have one usercontrol (child) inside another usercontrol(parent) and you need to access the child properties from within the parent.</p>
<p>If this is correct all you need to do is either create properties or methods in the child as you would in any other class. Than just use them f... |
MS SQL 2005 compare field containing square parenthesis <p>I am using MS SQL Server 2005 (9.0.4035) and trying to find rows that contain the same data in a nvarchar(4000) field. The field contains xml that has both opening and closing square parentheses.<br><br>
Here is sample data:<br>
DataID Data<br>
1 ... | <p>Change your query to use = instead of LIKE and you'll get the results that you expect. SQL 2005 T-SQL won't do regex - you'd need to use CLR functions for that - but the LIKE statment does do pattern matching. '[' and ']' are reserved for the pattern matching in a like statment, and you'd have to escape them out i... |
How best to update an XML node in MSBuild <p>I have been using the Tigris community tasks to update various AppSettings keys using the XMLUpdate task. </p>
<p>Now, however I want to add a node to the system.net section to set up the proxy. </p>
<p>I declared a property</p>
<pre><code><PropertyGroup>
<pr... | <p>You could use the XmlMassUpdate instead of XmlUpdate task.</p>
<pre><code><ProjectExtensions>
<defaultProxy>
<proxy usesystemdefault="False" proxyaddress="http://IPADDRESS:PORT"/>
</defaultProxy>
</ProjectExtensions>
<Target Name="SubstituteFromWebConfig">
<XmlMassU... |
How to force process isolation for an out of process COM server? <p>I'm writing managed code that has to interact with a vendor's COM automation server that runs out of process. I have found that this server becomes unstable if more than one client connects to it. For example, if I have managed code in process A and ... | <p>Place the component registered at COM+, this put an isolation layer at your.<br>
Use : Control Panel->Administrative Tools<br>
or cmd/execute DCOMCNFG</p>
<p>Component Services->Computers->My Computer->COM+ Application, right click, new application, next, Create an empty application, enter app name âCOM+ yo... |
Generic Database Monitoring Tool <p>It seems like something like this <em>should</em> exist, but I have never heard of it and would find such a utility to be incredibly useful. Many times, I develop applications that have a database backed - SQL Server or Oracle. During development, end users of the app are encouraged ... | <p>Sounds like something really easy to write yourself. Just query the database schema, then do a select count(*) or select max(lastUpdateTime) query on each table and save the result. If something is different send yourself an email. JDBC in Java gives you access to the schema information in a cross-database manner. D... |
ASP.NET 404 (page not found) redirection with original parameters preserved <p>I'm replacing an old web application with a new one, with different structure.</p>
<p>I can not change the virtual directory path for the new app, as I have users which have bookmarked different links to the old app.</p>
<p>Lets say I have... | <p>For the purposes of SEO, you should <strong>never</strong> redirect on a 404 error. A 404 should be a dead-end, with some helpful information of how to locate the page you're looking for, such a site map.</p>
<p>You should be using a <strong>301, moved permanently</strong>. This allows the search bots to update th... |
JavaScript Endian Encoding? <p><a href="http://stackoverflow.com/questions/503052/javascript-is-ip-in-one-of-these-subnets/503238#503238">A response on SO</a> got me thinking, does JavaScript guarantee a certain endian encoding across OSs and browsers?</p>
<p>Or put another way are bitwise shifts on integers "safe" in... | <p>Shifting is safe, but your question is flawed because endianness doesn't affect bit-shift operations anyway. Shifting left is the same on big-endian and little-endian systems in all languages. (Shifting right can differ, but only due to interpretation of the sign bit, not the relative positions of any bits.)</p>
<p... |
Oracle Delete Rows Matching On Multiple Values <p>I want to do something like:</p>
<pre><code>DELETE FROM student WHERE
student.course, student.major IN
(SELECT schedule.course, schedule.major FROM schedule)
</code></pre>
<p>However, it seems that you can only use one column with the IN operator. Is that true? Seems ... | <p>No, you just need parentheses:</p>
<pre><code>DELETE FROM student WHERE
(student.course, student.major) IN
(SELECT schedule.course, schedule.major FROM schedule)
</code></pre>
|
System.Net.Mail.MailMessage questions <p>I am putting some email functionality into one of my asp.net projects:</p>
<p>I need to send an email to a list of subscribers, list varies from a few dozen to a few hundred subscribers - (down the road there could be thousands).</p>
<p>When I have a few dozen emails, I do thi... | <p>The limit is more driven by your connectivity and SMTP server...BUT, you are going about it the wrong way. One sure fire way to be seen as spam is to send an email with a bunch of BCC items. Send one email per recipient with them as the TO address and you will be better off.</p>
|
SQL 2005 Transactional Replication: Behavior during snapshot processing? <p>So, I've got SQL (2005) Transactional Replication generally working well with a single publisher and single (read-only) subscriber. Data changes and updates flow perfectly, with about 5 second latency, which is just fine. </p>
<p>My one nagg... | <p>Transactional replication only distributes (and then subsequently publishes) the DML (Data Manipulation Language) statements from the transaction log of the source (publication) database.</p>
<p>New tables and stored procedures are not replicated to the subscriber. Schema changes in this particular context, althoug... |
How do I submit a form with a link in ASP.Net MVC? <p>I have a HTML form, and I have a Controller Action that accepts the POST request. Everything works with a regular submit button, but I would like to submit the form with a link (<a>-tag) instead, to be able to further control the formatting. Is there any way o... | <p><a href="http://haacked.com/archive/2009/01/30/delete-link-with-downlevel-support.aspx" rel="nofollow">Here is a complete example.</a> Note that this particular example does something fairly important: it has a fallback for browsers with JavaScript disabled.</p>
|
Intel boot agent problem? <p>keep getting this message over and over adin.. what shoud i do?
Intel(R) Boot Agent FE v4.1.17
Copyright (C) 1997-2004, Intel Corporation</p>
<p>Intel(R) Boot Agent PXE Base Code (PXE-2.1 build 084)
Copyright (C) 1997-2004, Intel Corporation</p>
<p>CLIENT MAC ADDR: 00 16 76 71 64 8B GUID:... | <p>Check if the right hard disk set as boot-device in your BIOS.</p>
<p>If that doesn't work, did you install a new OS? If yes, you might need to boot from a CD and write a new boot record on the hard-disk.</p>
<p>The message means that the Intel Boot Agent couldn't find an Operating System to boot into. Specifically... |
LINQ to XML: Collapse mutliple levels to single list <p>I'm currently working on a Silverlight app and need to convert XML data into appropriate objects to data bind to. The basic class definition for this discussion is:</p>
<pre><code>public class TabularEntry
{
public string Tag { get; set; }
public s... | <p>Try this:</p>
<pre><code> List<TabularEntry> GetTabularEntries(XElement source)
{
List<TabularEntry> result;
result = (from tabularentry in source.Elements()
select new TabularEntry()
{
Tag = tabularentry.Name.ToString(),
... |
Mailchimp API & array <p>I'm having a bear of a time getting the mailchimp api to cough up info. In their example I'm fine (the first is an abridged version of theirs.) How come when the method changes I can't get the array to show the collected information?</p>
<p>Why is this code valid:</p>
<pre><code>$limit = 5;
f... | <p>are you sure that your results ($allstats) is not empty?</p>
|
Create & Copy Access tables to SQL via SSIS? SQL 2008 <p>I am trying come up with a way to pull the tables out of an Access database, automate the creation of those same tables in a SQL 2008 DB, and move the data to the new tables. This process will happen on a regular basis and there may be different tables each time.... | <p>SSIS cannot adapt to new tables at runtime. (You can change connections, move a source to a table with a different name, but the same schema) So, it's not really easy to do what I think you are saying: Upsize an arbitrary set of tables in an Access DB to SQL (mirroring their structure and data, naming, etc), so th... |
Is it possible to initialize a UINavigationController subclass from a NIB? <p>I have a <code>UITabBarController</code> based application. The tabs will be created from database entries, so I don't know them in advance. I'd like to <strong>programmatically</strong> initialize a <code>UINavigationController</code> subcla... | <p>I've ended up not subclassing <code>UINavigationController</code>, it appears it isn't what's recommended. I quickly realized that there wasn't a whole lot of benefit from designing the <code>UINavigationController</code>'s from within IB. Instead, I subclassed <code>UIViewController</code>, wrote the few lines of i... |
logical & physical components <p>For this group assignment we have to produce a design document which includes a decomposition of the system/intermodule dependencies as well as interprocess dependencies. </p>
<p>We are warned to be aware of the differences between logical and physical components. Could someone please ... | <p>A component is a specialized class that has an external specification in the form of one or more provided and required interfaces, and an internal implementation consisting of one or more classifiers that realize its behaviors. (Thanks to the UML spec for that definition).</p>
<p>A physical component is platform-sp... |
What's the best way to read mixed (i.e. text and binary) data? <p>I need to be able to read a file format that mixes binary and non-binary data. Assuming I know the input is good, what's the best way to do this? As an example, let's take a file that has a double as the first line, a newline (0x0D 0x0A) and then ten b... | <p>You can use System.IO.BinaryReader. The problem with this though is you <em>must</em> know what type of data you are going to be reading before you call any of the Read methods.</p>
<pre><code>Read(byte[], int, int)
Read(char[], int, int)
Read()
Read7BitEncodedInt()
ReadBoolean()
ReadByte()
ReadBytes(int)
ReadChar(... |
Driving NDepend with NUnit <p>Is it possible to use NUnit to run CQL queries using NDepend? It would be nice to be able to just include the NDepend dlls in a UnitTests library and write tests like:</p>
<pre><code>[Test] public void
DomainAssemblyHasNoDatabaseDependencies
...
</code></pre>
<p>or something similar.</p... | <p>This is possible thanks to <a href="http://www.ndepend.com/API/webframe.html" rel="nofollow">NDepend.API</a> released with NDepend v4, and especially thanks to the namespace <a href="http://www.ndepend.com/API/webframe.html?NDepend.API~NDepend.CodeQuery_namespace.html" rel="nofollow">NDepend.CodeQuery</a> that conta... |
Accessing hardware from within Internet Explorer <p>Is it possible to access hardware devices (web-cams, magnetic card readers, etc.) from within Internet explorer? </p>
<p>If yes, what technologies are used? And are there any .Net examples.</p>
<p>In my case, I need to access a magnetic card reader that would be att... | <p>Custom ActiveX control is probably your best bet</p>
|
How do I find the current machine's full hostname in C (hostname and domain information)? <p>In a C project (POSIX), how do I get the fully qualified name for the current system?</p>
<p>For example, I can get just the hostname of my machine by doing
<code>gethostname()</code> from unistd.h. This might give me <code>ma... | <p>To get a fully qualified name for a machine, we must first get the local hostname, and then lookup the canonical name.</p>
<p>The easiest way to do this is by first getting the local hostname using <code>uname()</code> or <code>gethostname()</code> and then performing a lookup with <code>gethostbyname()</code> and ... |
scope in PHP classes <p>I am creating a database connection object, and I'm not sure what the best way would be...</p>
<p>If I create a dbConnection class which establishes the connection (using mysql_connect) can I then call mysql_query from anywhere in the main script?</p>
<p>what about from inside OTHER classes? D... | <p>Rather than create your own database abstraction class, I would recommend giving <a href="http://www.woyano.com/jv/ezsql" rel="nofollow">ezSQL</a> a try. The author did an excellent job of making it very easy to use. The data structures returned from the queries done by the class are far more flexible than those r... |
Extract email addresses from a block of text <p>How can I create an array of email addresses contained within a block of text?
I've tried</p>
<p><code>addrs = text.scan(/ .+?@.+? /).map{|e| e[1...-1]}</code></p>
<p>but (not surprisingly) it doesn't work reliably. </p>
| <p>Howabout this for a (slightly) better regular expression</p>
<pre><code>\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b
</code></pre>
<p>You can find this here:</p>
<p><a href="http://www.regular-expressions.info/email.html" rel="nofollow">Email Regex</a></p>
<p>Just an FYI, the problem with your email is that you al... |
SQL tables subquery <p>I have two tables named <code>foo</code> and <code>bar</code>, hypothetically speaking.</p>
<p>foo has columns <code>foo_id</code>, <code>foo_fluff</code>
bar has columns <code>bar_id</code>, <code>foo_id</code>, <code>timestamp</code></p>
<p>I need a query which will retrieve return one row fo... | <p>I think this is what you are looking for (unless it must be a subquery and not a join)</p>
<pre><code>select max(bar.timestamp), foo.foo_fluff
from foo
inner join bar
on foo.foo_id = bar.foo_id
group by foo.foo_fluff
</code></pre>
|
Developing a Robocode type game with .Net, for a School Assignment <p>I am currently in my final year at school, studying for a Higher National Diploma in Computer Studies, and basically in this final semester, we need to develop a Software Project, that basically incorporates a <em>whole</em> system.</p>
<p>Now, what... | <blockquote>
<p>is this project feasible at all ?</p>
</blockquote>
<p>It sounds big. I don't know how much time you have. Here's a rule of thumb:</p>
<ul>
<li><p>When the drop-dead due-date happens, if 90% of the system delivering 90% of the functionality is 100% complete, then you might say that the project is at... |
Refresh A Image Src <p>k... Strager was able to help me a bit. However, it's still not working quite right. Need someone that knows both MVC and jQuery please...</p>
<p>I have a page that has a image that when clicked on will launch a dialog box that gives the ability to upload a file. Once the dialog closes the image... | <p>What is #image shouldn't it be find('img')? Or give the IMG an ID of 'image'.</p>
|
How to change the text color on UINavigationBar button items <p>I've got a UINavigationController and i've changed it to white using the Tint property of the navigation bar in Interface Builder. But the text in buttons and the title is still the default color, white, and so gets lost against the white background. Anyon... | <p>As of iOS 5 this it much easier, using the UIBarButtonItem appearance proxy:</p>
<pre><code> NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys:
[UIColor blackColor],
UITextAttributeTextColor,
[UIColor clearColor],
... |
DeflateStream 4GB Limit in .NET <p>From MSDN: <em><a href="http://msdn.microsoft.com/en-us/library/system.io.compression.deflatestream.aspx" rel="nofollow">DeflateStream Class</a></em></p>
<p>DeflateStream cannot be used to compress files larger than 4 GB.</p>
<p>Are there any other implementations for .NET with... | <p>FYI, we have removed the 4 GB limit from DeflateStream in .NET 4.</p>
|
Recommendation for Sqlite DB manager application? <p>There are quite a few Sqlite GUI applications listed here:</p>
<p><a href="http://www.sqlite.org/cvstrac/wiki?p=ManagementTools">http://www.sqlite.org/cvstrac/wiki?p=ManagementTools</a></p>
<p>some appear to be incomplete, buggy, not maintained, etc. Do you have an... | <p>I use the <a href="https://addons.mozilla.org/en-US/firefox/addon/5817">SQLite manager plugin for Firefox</a>.</p>
<p>It seems pretty stable to me.</p>
|
Py2exe for Python 3.0 <p>I am looking for a Python3.0 version of "py2exe". I tried running 2to3 on the source for py2exe but the code remained broken.</p>
<p>Any ideas?</p>
| <h3>Update 2014-05-15</h3>
<p>py2exe for Python 3.x is now released! <a href="https://pypi.python.org/pypi/py2exe">Get it on PyPI</a>.</p>
<h3>Old information</h3>
<p>Have a look at the py2exe SourceForge project SVN repository at:</p>
<p><a href="http://py2exe.svn.sourceforge.net/">http://py2exe.svn.sourceforge.ne... |
How can i know if a given SPWeb is a SearchCenter site programmatically <p>I have a SPWeb object and I want to know whether or not this is a SearchCenter site. How can I know it programmatically. Is there some setting to check or a guid to match etc?</p>
| <p>A SearchCenter is created from a special site template that you can identify from the <a href="http://www.codeplex.com/sharepointinstaller/Thread/View.aspx?ThreadId=34752" rel="nofollow">WebTemplate</a> property on the SPWeb object. It will carry the value 'SRCHCEN'.</p>
|
How do I specify a return url for a link to the login form? <p>Simple enough, it would seem, but it turns out not to be - mainly due to the fact that the View can't possibly know which way through Model and Controller you got there. Regardless, it is a problem that needs a solution:</p>
<p>I have a login link, that ta... | <p>The solution is to use HttpContext.Current.Request.RawUrl like this:</p>
<pre><code><%= Html.ActionLink("log on", "LogIn", new { controller = "User", returnUrl = HttpContext.Current.Request.RawUrl }) %>
</code></pre>
<p>Or with an extension method from <a href="http://www.codeplex.com/aspnet/Release/ProjectR... |
Don't static members make classes kind of (global) objects themselves? <p>Every time I come across an implementation of the singleton pattern or any static classes (i.e. classes with (almost) only static members) I wonder whether this isn't actually a hack and therefore heavy abuse of the principle of classes and insta... | <p>Static members are effectively just namespacing for globals, yes. Nothing wrong with that; namespacing is good, and globals are the cleanest way to accomplish some tasks.</p>
<p>Singletons can be somewhat more interesting (load on demand...) but they're a similar construct (yeah, you could think of a static member ... |
How to get the next record in SQL table <p>I have a set of records in my MS SQL table. With Date as the primary key. But the Dates are only for working days and not the continues days. Eg:</p>
<p>1/3/2000 12:00:00 AM 5209.540000000 5384.660000000 5209.540000000 5375.110000000
1/4/2000 12:00:00 AM 5533.980000000 ... | <p>There are a few ways of doing this. Here is one.</p>
<pre><code>CREATE TABLE MyTable
(
MyDate datetime NOT NULL PRIMARY KEY,
Col2 decimal(14,4) NOT NULL,
Col3 decimal(14,4) NOT NULL,
Col4 decimal(14,4) NOT NULL,
Col5 decimal(14,4) NOT NULL
)
GO
INSERT INTO MyTable
SELECT '1/3/2000 12:00:00 AM'... |
What are some resources for learning MSIL? <p>Can someone please give me a link to a tutorial or answer how to read msil. </p>
<p>I think once I learn how to read this it could be a very useful tool.</p>
| <p>The instructions are defined in the CLI specification, available at <a href="http://www.ecma-international.org/publications/standards/Ecma-335.htm">http://www.ecma-international.org/publications/standards/Ecma-335.htm</a>, but this is pretty heavy going.</p>
<p><a href="http://rads.stackoverflow.com/amzn/click/1590... |
Idiomatic way to set default value in javascript <p>What would be the most idiomatic way to do the following in javascript:</p>
<p>If myParam is not passed into MyFunc by the caller, then I want to set it to a default value. But first I want to try and get it from another object, which may not yet exist: </p>
<pre><... | <p>If myObj is a global it needs to reference the window object, otherwise it will throw an error if <code>myObj</code> is undefined.</p>
<pre><code>myParam = myParam || (window.myObj ? window.myObj.mParam : 10);
</code></pre>
<p>or</p>
<pre><code>myParam = myParam || (window.myObj && window.myObj.mParam) ||... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.