input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
Problem with non blocking fifo in bash <p>I'm running a few Team Fortress 2 servers and I want to write a little management script.</p>
<p>Basically the TF2 servers are a fg process which provides a server console, so I can start the server, type status and get an answer from it:</p>
<pre><code>***@purple:~/tf2$ ./st... | <p>I realize this isn't an answer in the same vein as you were pursuing, but you can probably do this <a href="http://www.gnu.org/software/screen/" rel="nofollow">using Gnu Screen</a>.</p>
<p>Screen is a program that makes a pseudo-TTY. You can use its ability to let you share a screen session. This way, you can be ... |
Android Application and Timers <p>Hello I have an android application which has a service running. After 20 mins from that service and other systems (<code>such as GPS</code>) starting I would like it to automaticly stop. I assume I need to use a Timer for that?</p>
<p>Can someone show an example of how I could do it?... | <p>Maybe you don't even need a timer for that. Just keep track of when your service was started by storing <a href="http://developer.android.com/reference/java/lang/System.html#currentTimeMillis%28" rel="nofollow"><code>System.currentTimeMillis()</code></a> in a member variable and <a href="http://developer.android.com... |
why TDs display within a TR displays in the same line? <p>TD is a block element,</p>
<p>but displays like inline,say,several TDs within a TR display in the same line,</p>
<p>why?</p>
| <p>TD's are actually not technically "block" elements. Have a look at the <a href="http://www.w3schools.com/css/pr%5Fclass%5Fdisplay.asp" rel="nofollow">CSS display property</a>. Cells are technically of type "table-cell" and they are a special case. </p>
<p>There is also another type of display called "inline-bloc... |
Key-value database for .NET <p>Is there a good, scalable key-value database for .NET? Something like BerkeleyDB or Tokyo Cabinet? Specifically, it should allow to store large number of entries, which are mostly binary blobs. I'm fine if it is just a C-wrapper around some native database, as long as binaries for Win x8... | <p>How about <a href="http://www.mcobject.com/perst" rel="nofollow">perst</a>? It's implemented in C# for .net.</p>
|
Does DateTime.ToString("s") return always same format? <p>According to <a href="http://msdn.microsoft.com/en-us/library/8tfzyc64.aspx" rel="nofollow">MSDN on DateTime.ToString</a> ToString("s") should always return string in the format of the sortable XML Schema style formatting, e.g.: 2008-10-01T17:04:32.0000000 </p>... | <p>Yes it does. As others have said it only contains numeric values and string literals (e.g. 'T' and ':'), nothing that is altered by region or culture settings.</p>
|
How to get a free entry in a C# dictionary <p>I am running a server, and I would like to have a users dictionary, and give each user a specific number.</p>
<pre><code>Dictionary<int,ServerSideUser> users = new Dictionary<int,ServerSideUser>();
</code></pre>
<p>The key represents the user on the server, so... | <p>If the size of the "number" doesn't matter, take a Guid, it will always be unique and non-guessable.</p>
|
.Net unicode problem, vb6 legacy <p>I have a decryption routine in VB6. I now want the same decryption in C#.
The strings that need decryption are in unicode, so I use Encoding.Unicode.GetString to read the input in C#. The input now looks exactly the same as in VB6.</p>
<p>The first few characters in the loop are dec... | <p>Your VB6 wasn't reading Unicode (I'd guess at Windows-1252 codepage), which is why it's come back with a different character code.</p>
|
How to add hooks in twisted.web (or twisted.web2)? <p>How can I add a hook before and after processing a request on twisted.web (twisted.web2 is fine too)? The equivalent of webpy's:</p>
<pre><code>app = web.application(urls, globals())
app.add_processor(web.loadhook(my_attach_callback))
app.add_processor(web.unloadho... | <p>One approach Twisted Web allows is to insert an extra resource into the resource hierarchy the only purpose of which is to run your custom hooks, rather than to actually handle a segment of the request URL as resources typically do.</p>
<p>You can find an implementation of this approach in <a href="http://twistedma... |
Mulitple FileSystemWatchers a good idea? <p>I'm writing a mini editor component that is much like Notepad++ or UltraEdit that needs to monitor the files the users open - its a bit slimy, but thats the way it needs to be.</p>
<p>Is it wise to use multiple instances of FileSystemWatcher to monitor the open files - again... | <p>You're not going to run into problems with multiple FileSystemWatchers, and there really isn't any other way to pull this off.</p>
<p>For performance, just be sure to specify as narrow filters as you can get away with.</p>
|
How to do sorting in SQL SERVER varchar types <p>I have a table say tblSwap with a column StroreVals.</p>
<p>StroreVals</p>
<p><hr /></p>
<p>20</p>
<p>21</p>
<p>29</p>
<p>11</p>
<p>10</p>
<p>5</p>
<p>7</p>
<p>I want to get the result in descending order using SQL SERVER 2005.</p>
<p>How to do?</p>
<p>If you... | <p>You have stored the numbers in a varchar field, but you want them to be ordered like numbers.</p>
<p>Do this, convert the field to a numeric one for the sort:</p>
<pre><code>SELECT StroreVals
FROM tblSwap ORDER BY convert(int,StroreVals) DESC
</code></pre>
<p>Assumptions: all the values can be converted to int,... |
Is "the optimized delay" a myth or is it real? <p>From time to time you hear stories that are meant to illustrate how good someone is at something, and sometimes you hear about the guy how is so into code optimization that he optimizes his delay loop.</p>
<p>Since this really sounds like it's a strange thing to do as ... | <p>This has more than a kernel of truth about it... </p>
<p>Spin wait can be <em>much</em> better than a signal based interrupt or a yield. </p>
<ul>
<li>You trade some throughput for much reduced latency.
<ul>
<li>Often this is vitally important within an OS itself. </li>
</ul></li>
<li>You allow yourself the freed... |
Big O and Tree Traversal <p>If I had a function like this:</p>
<pre><code>void myfunction(node* root)
{
for(int i = 0; i<root->children.size();i++)
{
myfunction(root->children[i]);
}
}
</code></pre>
<p>Would that be Big O of n^2 or Big O of n? If you have a for loop and inside that for loop a... | <p>This is an in-order traversal of an n-tree, but you hit every element, so it's O(n) (big-theta is more appropriate).</p>
|
How can I identify a remote actor? <p>I have a remote actor (client) which is registering with another remote actor (server) and then later deregistering (with a shutdown hook). However, although the server picks up the de-registration, the actual <strong><code>sender</code></strong> property is a <em>different Channel... | <p>From a discussion on the scala users' mailing list, it seems that this is not immediately possible without using some alternative kind of client identifier (like <code>UUID</code>). If you send the <code>self</code> reference from the client in your registration object, you will get a <code>ObjectNotSerializable</co... |
How to fix error 'Ora-12154 TNS could not resolve service name' in SSIS? <p>When MS-SQL Server 2000 dtsx job tries to run, gets error <code>Ora-12154 TNS could not resolve service name</code> Tnsping to the oracle service to connect replies OK. The Windows 2003 x64 Server that runs the dtsx jobs has 32 bit Oracle Serve... | <p>The TNSNames setting on a machine may be user specific. i.e. The connection might work logged in as you, but fail when it runs under the SQLAgent user. At our location, we use a networked TNS Names file, and set a system environment variable on the server. This forces it to use the same TNS names file for all users:... |
64 bit java app to use 32 bit dll <p>A Java app running under JBoss (using 64 bit JRockit) needs to communicate with a third-party 32 bit C++ dll (doing calls to an external service). Are there more clever ways to solve this than putting a .NET web service between the two?</p>
| <p>You'll have to run a 32-bit process to load the dll. This could be another JVM that acts as an RMI server and loads the dll using JNI or a web-service. </p>
<p>The RMI server will probably be more performant, but the web-service might be simpler given all the tooling that's available.</p>
<p>If you do go the RMI... |
Are GWT wrappers on top of javascript libraries discouraged? <p>I'm in a process of selecting an API for building a GWT application. The answer to the following questions will help me choose among a set of libraries.</p>
<ol>
<li>Does a third-party code rewritten in
GWT run faster than a code using a
wrapped JavaScrip... | <p>While JavaScript libraries get a lot of programming eyeballs and attention, GWT has the advantage of being able to doing some hideously not-human-readable things to the generated JavaScript code per browser for the sake of performance.</p>
<p>In theory, anything the GWT compiler does, the JavaScript writers should ... |
NHibernate unable to pick up new data from the database <p>I am using NHibernate to as the Data Access layer for my ASP.NET MVC application. I am also using Structure Map as an IoC container. I have configured Structre map to create a session factory as a singleton and create sessions on a per request basis (InstanceSc... | <p>If you have the second-level cache enabled, yet have a background process that is updating the database without going via NHibernate, then you won't see these changes coming through. In this scenario, using the second-level cache is not appropriate.</p>
|
PCI/DSS: Data at Rest <p>Would you consider the use of caching products in the category of data at rest?</p>
| <p>Yes. It doesn't matter what the product is, if it stores, processes or transmits payment card data then it is within scope of PCI-DSS.</p>
<p>Having said that, if your cacheing device only stores encrypted data and doesn't have access to any keys used for decryption then you should be able to agree with your QSA th... |
Adding multiple UIButtons to an UIView <p>I've added some buttons to an UIView (via addSubview) programmatically. However, they appear as overlays (so that I always see the last button only). How do I add new buttons below existing buttons?</p>
<p>Regards</p>
| <p>you can offset the button like this</p>
<pre><code>int newX = previousButton.frame.origin.x + previousButton.frame.size.width ;
int newY = previousButton.frame.origin.y ;
</code></pre>
<p>and either set the frame for new button when you create it:</p>
<pre><code>[[UIButton alloc] initWithFrame:CGRectMake(newX,new... |
Is it possible to reference another application via an environment variable in visual studio? <p>Here is the scenario.</p>
<p>I have application A, which is a add-on tool of application B (a third party product). I need to install a file in a directory of application B during the install of app A (Using Visual Studio... | <p>Yes you can as long as the environment variable is a system environment variable. If it is a user environment variable, the user deploying the app A and B should be the same for you to access that during the deployment of app B. You may use System.Environment class in C# to access the environment variables.</p>
|
Ajax in javascript not working <pre><code>$(document).ready(function() {
$('#content').html('');
$.ajax({
url:'data.json',
dataType: "json",
success: function(data) {
$('#content').append('<p>'+data.rank+'</p>');
}
});});
</code></pre>
<p>In this code (it wo... | <p>The thing is that you are trying to access an url on a different domain (unless you actually are on twittercounter.com of cause). Anyways, if you want to do cross-site AJAXcalls which browsers don't permit due to safety, you have to use the JSONP "trick". You can use JSONP with jQuery, which it seems like you are us... |
Can iPhone web apps get GPS position? <p>Is there an easy way to design a website to facilitate an <strong>iphone</strong> user providing <strong>gps</strong> coordinates to the site? </p>
<p>I am wondering if there might be a naming convention for form fields for example, to let the user input in an automated way.</p... | <p>Here's a snippet on how to read location from the iPhone. Looks like it requires 3.0:</p>
<pre><code> navigator.geolocation.getCurrentPosition(foundLocation, noLocation);
function foundLocation(position)
{
var lat = position.coords.latitude;
var long = position.coords.longitude;
alert('Found location: '... |
FlexUnit and callLater <p>I'm trying to use callLater with FlexUnit v0.9:</p>
<pre><code>public function testCallLater():void {
Application.application.callLater( addAsync(function():void {
assertTrue(true);
}, 1000));
}
</code></pre>
<p>but when it runs I get this error:</p>
<pre><code>ArgumentError: Er... | <p>First, you should really consider migrating to FlexUnit 4.0: <a href="http://blogs.digitalprimates.net/codeSlinger/index.cfm/2009/5/3/FlexUnit-4-in-360-seconds" rel="nofollow">http://blogs.digitalprimates.net/codeSlinger/index.cfm/2009/5/3/FlexUnit-4-in-360-seconds</a></p>
<p>Second, callLater is meant to be used t... |
glUseProgram(0) takes 50ms? <p>Are there any reasons a call to disable a glsl program should take 50ms?</p>
<p>I did a glFlush before, so it can't be the pipeline being flushed before a program change.</p>
<p>Enabling the shader takes 0.03ms.</p>
| <p>Just guessing - if you are working in a compatibility-enabled GL context, disabling the GLSL program may invoke an Fixed-Function Pipeline (FFP) program construction based on the FFP GL state at the current moment.</p>
|
How to get a global location from MouseDown? <p>I'm working on a WinForms app and need to record the location of MouseDown and MouseUp events. My problem is that the events happen on different controls so their coordinate systems don't match (all I need is the amount of drag). I tried adding in the location of the send... | <p>You may use <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.control.pointtoscreen.aspx" rel="nofollow">PointToScreen</a> method for the purpose. Your mouse handler code could then look like this:</p>
<pre><code>private void Form1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
... |
How does Windows protect transition into kernel mode <p>How does Windows protect against a user-mode thread from arbitrarily transitioning the cpu to kernel-mode?</p>
<p>I understand these things are true:</p>
<ol>
<li>User-mode threads DO actually transition to kernel-mode when a system call is made through NTDLL.</... | <p>You're probably thinking that thread running in user mode is calling into Ring 0, but that's not what's actually happening. The user mode thread is causing an exception that's caught by the Ring 0 code. The user mode thread is halted and the CPU switches to a kernel/ring 0 thread, which can then inspect the contex... |
C# Cannot call <function> because it is a web method <p>I have a custom C# component library (D1) that has a web reference, D1 is referenced by in library (D2) that makes call to methods in the web reference. D2 is loaded into a console application using reflection. </p>
<p>When I reference D1 above, in a test cons... | <p>I got the same error when I was checking value in the debugger. I'm not sure how comparable that is to your reflection call.<br />
My code called it just fine but the debugger threw this error.</p>
<p>Hopefully that may help someone</p>
|
activemq No suitable Log constructor <p>this is driving me insane. I'm simply trying to run activemq on Mac OSX 10.5.7. I have java version 1.5.0_19 and activemq 5.2.0. Below is the exception I get when running bin/activemq. It seems to be unable to find log4j which is odd considering it comes with activemq and is ... | <p>This looks like the exception is being caused by a <code>NoClassDefFoundError</code> for <code>org.apache.log4j.Category</code>. You should make sure that the <code>log4j</code> jar is on the classpath.</p>
<p><strong>Edit:</strong> Is there any way that you can inspect the value of the <code>ACTIVEMQ_CLASSPATH</c... |
true isometric projection with opengl <p>I am a newbie in OpenGL programming with C++ and not very good at mathematics. Is there a simple way to have isometric projection?</p>
<p>I mean <a href="http://en.wikipedia.org/wiki/Isometric_projection">the true isometric projection</a>, not the general orthogonal projection.... | <p>Try using <a href="http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/glu/lookat.html">gluLookAt</a></p>
<pre><code>glClearColor(0.0, 0.0, 0.0, 1.0);
glClear(GL_COLOR_BUFFER_BIT);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
/* use this length so that camera is 1 unit away from origin */
doubl... |
Trapping Error Status in MSBuild <p>As part of some <a href="http://jonnekats.wordpress.com/2009/05/07/integrate-xunit-tests-into-your-daily-team-build/#comment-7" rel="nofollow">build automation of running xUnit.net tests with MSBuild</a>, I'm running into a case where I need to loop over a batch of items.</p>
<p>Ins... | <p>This is what we do:</p>
<pre><code><NUnit Assemblies="@(TestAssemblies)"
ToolPath="$(NUnitPath)"
WorkingDirectory="%(TestAssemblies.RootDir)%(TestAssemblies.Directory)"
OutputXmlFile="@(TestAssemblies->'%(FullPath).$(NUnitFile)')"
Condition="'@(TestAssemblies)' != ''"
ExcludeCategory="$(Ex... |
Hide asp.net Wizard next button in javascript <p>I want to hide the Next button on my ASP.NET Wizard control using JavaScript. Can anybody tell me if this is possible and post a javascript snippet on how to do this? Thanks!</p>
| <p>2 options here...</p>
<ol>
<li>TemplatedWizardStep - that way you create the buttons yourself and can then use either the control name or a css class on the button to turn it on & off with javascript or jQuery.</li>
<li>use StartNextButtonStyle to set a css class on your next button so you can grab the button w... |
why is set_intersection in STL so slow? <p>I'm intersecting a set of 100,000 numbers and a set of 1,000 numbers using set_intersection in STL and its taking 21s, where it takes 11ms in C#.</p>
<p>C++ Code:</p>
<pre><code>int runIntersectionTestAlgo()
{
set<int> set1;
set<int> set2;
set<... | <p>A couple things would make your two examples more comparable.</p>
<p>First, your example in STL isn't quite right, for one thing both sets should be sorted in ascending order (in STL speak a "strict weak ordering").</p>
<p>Second, your using "sets" which are implemented as trees in STL, vs. "lists" which are linke... |
Clickonce error: missing files. Need to get missing filename <p>My ClickOnce app gives an error for a user: "Cannot download the application. The application is missing required files. Contact the application vendor or your system administrator for assistance."</p>
<p>How can I pinpoit which file is missing? Do I manu... | <p>What I usually find on these issues is it's related to a dependency that is set as "Include (Auto)" instead of just Include. It will work on some machines but not on others just depending on what DLLs are already installed on the destination machine.</p>
<p><strong>Files to include</strong>
Open up the Publish tab ... |
SHGetFolderPath() for a specific user <p>I'm looking for a good way to get the local application data folder for a specific user -- without having to enter the login details for that user.</p>
<p><b>SHGetFolderPath()</b> can accept an access token for whatever user I want to get the local appdata folder for, but to ge... | <p>There is no documented way to do this without the token AFAIK, but your best bet is to:</p>
<ol>
<li>Find the profile: HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList (%windir%\Profiles on Win9x)</li>
<li>AdjustTokenPrivileges for <code>SE_RESTORE_NAME</code></li>
<li>RegLoadKey NTUSER.DAT (USER.DAT o... |
Math opposite sign function? <p>Does such function exist? I created my own but would like to use an official one:</p>
<pre><code>private function opposite(number:Number):Number
{
if (number < 0)
{
number = Math.abs(number);
}
else
{
number = -(number);
}
return number;
}
... | <p>yes it does...</p>
<pre><code>return num*-1;
</code></pre>
<p>or simply</p>
<pre><code>return -num;
</code></pre>
|
Upload Custom Thumbnail to Sharepoint Image library <p>I've got a webpart to upload images to a SharePoint image library, and SP does the thumbnail generation automagically.</p>
<p>I'd like to give my users the options of uploading their own thumbnails, without SP doing it for them.</p>
<p>Any thoughts how to do this... | <p>I don't think the <code>/_t</code> folders are publicised by SharePoint through the Folders collection. However they are accessible by using:</p>
<pre><code>SPFolder mylibrary = objWeb.GetFolder("Media/_t");
</code></pre>
|
Virtualization & Cloud Computing - Where to start? <p>Virtualization & Cloud Computing.</p>
<p>I know these are very vague, nebulous words that mean so many different things. They are also the topics that are most discussed today. However, because they are so new, they are not taught in schools. I was lucky to hav... | <p>Have a look at Microsoft's Azure - <a href="http://www.microsoft.com/azure/default.mspx" rel="nofollow">http://www.microsoft.com/azure/default.mspx</a></p>
<p>And Amazon's Cloud - <a href="http://aws.amazon.com/ec2/" rel="nofollow">http://aws.amazon.com/ec2/</a></p>
<p>At the moment, Cloud Computing is banded abou... |
Distributed Lock Service <p>Which distributed lock service would you use?</p>
<p>Requirements are:</p>
<ol>
<li>A mutual exclusion (lock) that can be seen from different processes/machines</li>
<li>lock...release semantics</li>
<li>Automatic lock release after a certain timeout - if lock holder dies, it will automati... | <p>A newer kid on the block is <a href="http://www.hazelcast.com/">hazelcast</a>. I've been playing with it and it is amazingly simple to use and configure.</p>
<p>As far as I can see there shouldn't be any conflict between Gigaspaces and hazelcast as hazelcast doesn't have any dependencies i.e. no jgroups.jar etc</p>... |
Default value to a parameter while passing by reference in C++ <p>Is it possible to give a default value to a parameter of a function while we are passing the parameter by reference. in C++</p>
<p>For example, when I try to declare a function like:</p>
<pre><code>virtual const ULONG Write(ULONG &State = 0, bool s... | <p>You can do it for a const reference, but not for a non-const one. This is because C++ does not allow a temporary (the default value in this case) to be bound to non-const reference.</p>
<p>One way round this would be to use an actual instance as the default:</p>
<pre><code>static int AVAL = 1;
void f( int & x... |
Facebook offline access step-by-step <blockquote>
<p><strong>UPDATE</strong>: Facebook <code>offline_access</code> permission is being deprecated. Please refer to the <a href="https://developers.facebook.com/roadmap/offline-access-removal/">official documentation</a> for more information.<br>
You'll have till <stro... | <p>With the new Facebook Graph API, things got a bit simpler but far less well documented. Here's what I did to be able to load my wall posts as me from a server side only (not part of a browser session) php script:</p>
<ol>
<li><p>create a facebook application, if you don't already have one usable for this project
<... |
How to page through large amounts of historical data via a web application? <p>I have a web application that functions as a dashboard, allowing a user to see summaries of historical data to view trends, etc. As an extension to this, I want to allow the user to drill-down into the historical data if they so wish.</p>
<... | <p>paging through huge amounts of data is not very helpful. Give them a summary of the data with groupings (say by a time period). If they want to know what made up the detail let them click on it and 'drill down' into the detail. </p>
|
Transfer Images between iPhone and Web Service <p>Thanks in advance everyone!</p>
<p>Background:</p>
<p>I have a WCF web service running that is communicating with an iPhone app over SOAP.</p>
<p>The WCF web service method is expecting a byte[]. </p>
<p>Problem:</p>
<p>Now I need to transfer images to and from th... | <p>You are probably better off using a simple SOAP library to define the calls:</p>
<p><a href="http://stackoverflow.com/questions/204465/how-to-access-soap-services-from-iphone">http://stackoverflow.com/questions/204465/how-to-access-soap-services-from-iphone</a></p>
<p>Why reinvent the wheel?</p>
|
Finding repeating numbers above or below 1, in an array <p>I need to find out how many times the number greater than or less than <code>1</code> appears in the array. </p>
<p>For example, if I have an array:</p>
<pre><code>{1,1,1,2,3,-18,45,1}
</code></pre>
<p>here numbers that are greater than or less than one app... | <p><a href="http://msdn.microsoft.com/en-us/library/2h3zzhdw%28VS.80%29.aspx" rel="nofollow">Iterate through the array</a> in a foreach loop, and <a href="http://msdn.microsoft.com/en-us/library/6a71f45d.aspx" rel="nofollow">test each value against 1</a>. If it's less than 1, increment num_greater by 1, and if it's les... |
Why does the web need HTTP? <p>No, wait. I'm being totally serious. When HTTP was invented, FTP already existed. Why couldn't FTP be the web's transport protocol?</p>
<p>Sure, it has a lot of missing feautres, but most were added as an afterthought to HTTP and could be added to FTP too, such as caching, compression, v... | <p>Yes, you can serve HTML files using FTP. However FTP is a heavy-weight, stateful, protocol and assumes you will be staying on the same server. It is optimized for downloading larger files (where the setup overhead is amortized over the size and number of downloads) HTTP is very light-weight (you can communicate t... |
Zend Framework and Drupal on the same domain <p>I have a small application written in Zend Framework that I want to embed into Drupal Page.
Both apps (ZF and Drupal) are be located at the same domain.</p>
<p>But per my knowledge ZF requires to be installed in the root of server, where I already have Drupal. My concern... | <p>Note that there already exists a <a href="http://drupal.org/project/zend" rel="nofollow">Zend Framework integration module for Drupal</a>. Using it will normally take care of the path issues.</p>
|
Application linked to msi <p>I'm using VS2005.</p>
<p>After I install an application using an .msi. Everytime this application loads it tries to find the setup and installs itself again if a file has been modified. If I delete the .msi file then the application can't even load.</p>
<p>Is there a way to remove this li... | <p>You're installing an <a href="http://msipackagingforvista.com/what-is-an-advertised-shortcut.html" rel="nofollow">Advertised Shortcut</a>, this means when you double click on the shortcut to run the application Windows Installer checks to ensure that all files, registry keys, etc that should be installed are install... |
A better CDate for VB6 <p>We have a a VB6 app (in a COM component) which uses CDate() to take a string and cast it to a Date, for storing in a database.</p>
<p>Depending on if we want the application to talk in <em>dd/MM/yy</em> or <em>MM/dd/yy</em> for example, we have to change the regional settings of the identity ... | <p>Look, there's no easy way to say this - you're screwed. If you accept freeform input from the web, you have to live with the reality that people around the world format dates differently. That's why <strong>so many</strong> websites use popup calendars, and such, to get user input. No ambiguity there. No matter ... |
ActionScript 3 Newb: TextInput enter event? <p>I'm trying to capture the ENTER event of a TextInput like so:</p>
<pre><code>a_txt.addEventListener(fl.events.ComponentEvent.ENTER, aEnter);
function aEnter(ComponentEvent):void
{
//...
}
</code></pre>
<p>There's probably something in these docs<br />
<a href="http... | <p>I am not sure. I always use an import statement instead of qualifying with package names.
Try adding:</p>
<pre><code>import fl.events.ComponentEvent;
</code></pre>
<p>and then change your code to:</p>
<pre><code>a_txt.addEventListener(ComponentEvent.ENTER, aEnter);
function aEnter(e:ComponentEvent):void
{
... |
How can I fire an event when or before the phone rings? <p>On blackberries, are there any exposed events that you can hook into that occur just before and after the phone rings?</p>
<p>e.g. could you override the ring setting on the fly and NOT have it ring if the number is 999-9999?</p>
| <p>Yes very possible.
You need to hook into the "Phone Events" and create a phone listener.
The docs give some hints on this. so fire up your favorite Java IDE and rock on!</p>
<p><a href="http://na.blackberry.com/eng/deliverables/1076/development.pdf" rel="nofollow">http://na.blackberry.com/eng/deliverables/1076/dev... |
Databound Windows Forms control does not recognize change until losing focus <p>I use data binding to display values in text boxes in a C# Windows Forms client. When the user clicks Save, I persist my changes to the database. However, the new value in the active editor is ignored (the previous value is saved). If I tab... | <p>If you can get the <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.binding.aspx" rel="nofollow"><code>Binding</code></a> instance that corresponds to the input (the <a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.textbox.aspx" rel="nofollow"><code>TextBox</code></a>), y... |
Changing variable names with Python for loops <p>I was just wondering if anyone knew of a way to change variable names based off of a for loop for something like this:</p>
<pre><code>for i in range(3)
group+i=self.getGroup(selected, header+i)
</code></pre>
<p>so that the names of the variables change to accomoda... | <p>You probably want a dict instead of separate variables. For example</p>
<pre><code>d = {}
for i in range(3):
d["group" + str(i)] = self.getGroup(selected, header+i)
</code></pre>
<p>If you insist on actually modifying local variables, you could use the <code>locals</code> function:</p>
<pre><code>for i in ra... |
OS; resources automatically clean up <p>From this answer: <a href="http://stackoverflow.com/questions/1058797/when-is-a-c-terminate-handler-the-right-thingtm/1058894#1058894">http://stackoverflow.com/questions/1058797/when-is-a-c-terminate-handler-the-right-thingtm/1058894#1058894</a></p>
<p>It would be nice to have a... | <p>There are some obscure resources that Windows does not clean up when an app crashes or exits without explicitly releasing them, mostly because the OS doesn't know if they're important to leave around or not.</p>
<ol>
<li>Temporary files -- as others have mentioned.</li>
<li>Globally registered <code>WNDCLASS</code>... |
XML Schema: Setting a default value for a complexType? <p>Let's say I want to set up a generic complexType like so:</p>
<pre><code><xs:complexType name="button">
<xs:sequence>
<xs:element name="id" type="xs:string" minOccurs="0" maxOccurs="1"/>
<xs:element name="href" type="xs:... | <p>No, only for simple values. But maybe you can use them to do what you want, by giving default values for all the simple parts of your complex Type. However, it works better for attributes than for the elements you have (because "Default attribute values apply when attributes are missing, and default element values ... |
Visual Studio 2003 productivity tips <p>I have been using Visual Studio 2005 and 2008 for a long time now, but now I'm consulting somewhere that has all ASP.NET 1.1 apps, so I need to use Visual Studio 2003.</p>
<p>Can anyone recommend some good add-ins, settings, general tips, etc when using VS2003 to make it a littl... | <p>I highly recommend <a href="http://www.wholetomato.com/" rel="nofollow">Visual Assist</a> for any version of VS.</p>
<p>There are some books, e.g. <a href="http://my.safaribooksonline.com/0596003609?tocview=true" rel="nofollow">Mastering Visual Studio .NET</a> and many suggestions common
to all versions of Visual S... |
Summarizing data by multiple columns <p>My boss is asking me to code a report that has the following components:</p>
<ul>
<li>A pie chart of employee count by state</li>
<li>A pie chart of employee count by age bracket (10 year brackets)</li>
<li>A pie chart of employee length of service (5 year brackets)</li>
<li>A p... | <p>if you want 5 pie charts and need to summarize then you need 5 SQL statements since your WHERE clause is different for each</p>
|
What happened to the context menu in my console application? <p>Was creating a simple console application to do some prototyping and was shocked to see that the right-click/context menu is missing from a standard .NET console app!</p>
<p>I'm unable to find any information about this, and intellisense isn't helping.</p... | <p>This is a windows console settings thing. Right click on the task bar of the app, click Properties and check / uncheck quick edit mode.</p>
<p>Also there is no way to get Ctr-C Ctrl-V working in console apps (as far as I know)</p>
|
AnkhSVN - Latest Version <p>What do you guys think of the new Ankh SVN /w Tortoise SVN? </p>
<p>This is my first time using source control and all I used it for was the very basics. It worked well... At first...</p>
<p>Somewhere along the way everything got really screwed up and I had to uninstall it. It seems like y... | <p>i've been using both for a while now without any issues. i found the concept of not having exclusive checkout hard to get used to after sourcesafe but once you've done a few merges the power of SVN is clear.</p>
<p>its also worth looking at <a href="http://www.visualsvn.com/" rel="nofollow">http://www.visualsvn.com... |
excel formulaarray <p>hi why do i get the runtime error 13: type mismatch error
while running the following code</p>
<pre><code> Application.Goto Reference:="R1C1:R232C221"
Selection.FormulaArray = "=ROUND(a(),0)"
Selection.Replace What:="a()", Replacement:="IF(IF(Sheet4!A1:HM232+Sheet5!A1:HM232=2,0," & _
"Sheet... | <p>Let's analyze your Replacement:</p>
<pre><code>Replacement:="IF(IF(Sheet4!A1:HM232+Sheet5!A1:HM232=2,0," & _
"Sheet4!A1:HM232+Sheet5!A1:HM232)+IF(Sheet4!A1:HM232+Sheet5!A1:HM232=2,0," & _
"Sheet4!A1:HM232+Sheet5!A1:HM232)=2,0,IF(Sheet4!A1:HM232+Sheet5!A1:HM232=2,0," & _
"Sheet4!A1:HM232+Sheet5!A1:HM232)... |
InvalidOperationException - object is currently in use elsewhere - red cross <p>I have a C# desktop application in which one thread that I create continously gets an image from a source(it's a digital camera actually) and puts it on a panel(panel.Image = img) in the GUI(which must be another thread as it is the code-be... | <p>This is because Gdi+ Image class is not thread safe. Hovewer you can avoid InvalidOperationException by using lock every time when you need to Image access, for example for painting or getting image size:</p>
<pre><code>Image DummyImage;
// Paint
lock (DummyImage)
e.Graphics.DrawImage(DummyImage, 10, 10);
// ... |
How do I get the second integer in a Ruby string with to_i? <p>I need to convert some strings, and pull out the two first integers e.g:</p>
<blockquote>
<p>unkowntext60moreunknowntext25something</p>
</blockquote>
<p>To:</p>
<pre><code>@width = 60
@height = 25
</code></pre>
<p>If I do <code>string.to_i</code>, I g... | <p>How about something like:</p>
<pre><code>text = "unkowntext60moreunknowntext25something"
@width, @height = text.scan(/\d+/).map { |n| n.to_i } #=> 60, 25
</code></pre>
|
Determining camera parameters <p>Given a picture taken by a simple digital that contains an image of a rectangle of known dimensions. How can I - to some degree of accuracy - determine the parameters of this camera? </p>
<p>I am mostly interested in Pan-, Tilt- and Swing angles.
Optionally distance to the rectangle wo... | <p>What you are looking for are camera calibration algorithms. A commonly used one is <a href="http://research.microsoft.com/en-us/um/people/zhang/papers/tr98-71.pdf" rel="nofollow">Zhang's algorithm</a>.</p>
<p>For more information regarding calibrating cameras, a good source is <a href="http://www.robots.ox.ac.uk/~... |
iframe not editable when it is in a jQuery dialog? <p>I'm trying to develop a simple management system for press releases for my company and one of the requirements for this system is that it has a wysiwyg interface for the content of the press release. The company has four websites and want to put all the press releas... | <p>I had the same scenario. The solution is rather simple. The designmode=on property should be set on the IFRAME once you make the IFRAME visible. You cannot even put the iframe in left:-1000px and set "designmode = on". The IFRAME should be visible within the screen area. So the solution would be to show the IFRAME ... |
Customizing Navigation Menu in SilverStripe <p>I asked this question in SilverStripe forum, but haven't heard in a day. <a href="http://silverstripe.org/customising-the-cms/show/263604#post263604" rel="nofollow">http://silverstripe.org/customising-the-cms/show/263604#post263604</a></p>
<p>I am in the process of migrat... | <p>I do not understand what is wrong with what you did...
Other workarounds would be:</p>
<ul>
<li>Add a "Type" property for your SiteTree page object, in order to separate between a customer and an affiliate.</li>
<li>Inside the SiteTree object's controller you can use the "customize" function which receives either a... |
Are there Virtual Twain Scanners? Sort like Daemon Tools virtual CD <p>I am testing a scanning application and currently I dont have any scanner to plug it in. Is there anyway to have a virtual scanner like Daemon Tools does with Virtual CD Drives?</p>
| <p>There's a <a href="http://sourceforge.net/projects/twain-samples/">Sourceforge project</a> with a sample TWAIN implementation, including a virtual scanner. I haven't found anything similar for WIA.</p>
|
Problems with custom deserialization of a list in C# <p>I'm writing a custom deserializer that will deserialize a list by deserializing each of the individual objects in the collection and then putting it together.</p>
<p>Basically my code looks like this:</p>
<pre><code>//myField is a FieldInfo that represents the f... | <p>The problem is that .NET can't know that your List is actually a List. The following code should work:</p>
<pre><code>//myField is a FieldInfo that represents the field we want to put the data in
//resultObject is the object we want the data to go into
List<MyType> new_objects = new List<MyType>();
fo... |
Turning off inline constructors with MooseX::Declare <p>Greetings, </p>
<p>As a followup to my <a href="http://stackoverflow.com/questions/1057661/dealing-with-multiple-inherited-constructors-in-moose">previous question</a> about Moose, I've now run into a new problem. I've got a Moose class which uses <a href="http:/... | <p>Thanks to some folks on IRC I was able to crack this one. Declaring the class <code>mutable</code> was sufficient to turn off the <code>auto_make_immutable</code> flag in <code>MooseX::Declare</code>, so I could then do it manually. (Of course this also works with a non-MX::Declare class.)</p>
<p>Revised version:</... |
Recognizing new line <p>I've got a fairly complex calculator that prints output when the user inputs ";" (and hits enter.) What I'm trying to do now is allow the user to print output when they hit enter, (without use of semicolon.) I need to know how I can implement this.</p>
<p>Side note: The calculator uses tokeniza... | <p>I would read the line into a string first, and pass that to your 'Token' class.</p>
<p>Something like:</p>
<pre><code>#include <iostream>
#include <string>
...
{
std::string in;
getline( std::cin, in );
Token t( in );
// Do whatever you need to with 't'
std::cout << in <&... |
lauch4j hello world program <p>I created a "hello world" java program and use lauch4j to convert executable jar to .exe file. When I tried to run it in cmd, but nothing printed out. I also tried to run it in launch4j. Log indicates: Executing: C:\Documents and Settings\cnbq84\Desktop\helloworld.exe. But still no "hello... | <p>You may not be in console mode.</p>
<p>From <a href="http://launch4j.sourceforge.net/docs.html" rel="nofollow">http://launch4j.sourceforge.net/docs.html</a> </p>
<blockquote>
<p>To wrap a jar in console mode use
launch4jc.exe and specify the
configuration file. launch4jc.exe
config.xml</p>
</blockquote>
|
Why is non-breaking space not a whitespace character in java? <p>While searching for a proper way to trim non-breaking space from parsed HTML, I've first stumbled on java's spartan definition of <code>String.trim()</code> which is at least properly documented. I wanted to avoid explicitly listing characters eligible fo... | <p><code>Character.isWhitespace(char)</code> is old. Really old. Many things done in the early days of Java followed conventions and implementations from C.</p>
<p>Now, more than a decade later, these things seem erroneous. Consider it evidence how far things have come, even between the first days of Java and the firs... |
what namespaces are needed for this piece of code? (c#) <pre><code>Image Dummy = Image.FromFile("image.png");
Dummy.Save("image.bmp", ImageFormat.Bmp);
</code></pre>
<p>what the question says</p>
<p>i have these</p>
<pre><code>using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.Drawing.Dra... | <p>Add a reference to System.Drawing</p>
<p>When you use <code>using</code> statements, this lets the compiler know that when you say <code>Image</code> you really mean <code>System.Drawing.Image</code> for example.</p>
<p>However, now the compiler needs to know where System.Drawing is. By default, in Visual Studio, ... |
Why does this Prolog predicate work? <p>I have the following code:
Bear in mind that while this code works on lists, these lists represent sets, so [1,1,2,2,3,3] and [1,2,3] should be equivalent. </p>
<pre><code>%contains(L1, L2), returns true if L1 contains L2
contains(_, []).
contains(L1, [Head|Tail]) :- member(Hea... | <p>Prolog uses a technique called "backtracking".</p>
<p>Take a look at the first step, your step 1.</p>
<p>Prolog has two rules it can use here, if it uses the rule you chose in your explanation, it will always fail. But once it has failed, Prolog will backtrack and try the alternative rule:</p>
<p>equals([1,2,3],[... |
Regex - Match a Pattern Before a Character <p>I'm currently building a toy assembler in c# (going through <a href="http://www1.idc.ac.il/tecs/">The Elements Of Computing Systems</a> book).</p>
<p>I need to match a very simple pattern, I thought this would be a good time to learn some regex but I'm struggling!</p>
<p>... | <p>What you want is called a zero-width, lookahead assertion. You do:</p>
<pre>
(<b>Match this and capture</b>)(?=<b>before this</b>)
</pre>
<p>In your case, this would be:</p>
<pre>
([A-Z^]{1,3})(?==)
</pre>
|
Why does XSD validation always work for this file? <p>The following xml file always seems to validate. Not sure why, but when I remove the following ' xmlns="urn:schemas-microsoft-com:office:spreadsheet" ', it seems to throw a validation error as expected.</p>
<p>Somehow MS is preventing validation with the added XSD ... | <p>Your xsd is having no effect. The xsd for urn:schemas-microsoft-com:office:spreadsheet is being picked up from elsewhere, probably built into the .net framework, and being used even though you haven't explicitly told the validator where to find it. This is allowed within the rules for schema validation.</p>
|
What to do when bit mask (flags) enum gets too large <p>I have a very large set of permissions in my application that I represent with a Flags enumeration. It is quickly approaching the practical upper bound of the long data type. And I am forced to come up with a strategy to transition to a different structure soon.... | <p>I see values from at least a handful of different enumerations in there...</p>
<p>My first thought was to approach the problem by splitting the permissions up in logical groups (<code>RuleGroupPermissions</code>, <code>RulePermissions</code>, <code>LocationPermissions</code>, ...) and then having a class (<code>Web... |
I can no longer debug classic asp code with visual studio 2008 <p>I've finally found a way to debug classic asp code in visual studio 2008 ... but...</p>
<p><a href="http://stackoverflow.com/questions/958968/has-anybody-been-able-to-debug-asp-classic-code-with-visual-studio-2005-or-later">http://stackoverflow.com/ques... | <p>The most likely reason for this is because the process hasn't spun up yet. You need to hit an ASP page first before IIS spins up the DLLHOST.exe in which it runs an application if you have that application set to have high isolation (recommended for debugging purposes).</p>
<p>Hence debugging bia attachment requir... |
Mysql what field type to use for dates with a mix of full and part dates <p>I have a table that has three different date columns, so I set each column as type 'date'.</p>
<p>However whenever im importing dates it seems to change them, and I have found it is because mysql does not allow null days and months.</p>
<p>My... | <p>There is no data structure that would act as a date but would allow 00 for any of the components. If you really insisted on emulating this, you could split the data into 3 columns - year, month, day and then write a complicated trigger to validate each update/insert query. </p>
<p>I wouldn't dare though. However, y... |
Determining the HID Path for USB HID device using libhid on Linux <p>Iâm interested in using libhid to access a custom HID device that we are developing on a PIC microcontroller. I have been able to successfully get the test_libhid code to run. The instructions for reading and writing to devices using this library ... | <p>After much trial and error, I was never able to get libhid to work with the report descriptor for my target device. I did find that the HID Device Interface (hiddev) worked very well, and was actually very easy to understand. There is a good <a href="http://www.frogmouth.net/hid-doco/Linux-HID.pdf" rel="nofollow">... |
In a .csproj file, what is <None Include="..."> for? <p>How is</p>
<pre><code><None Include="C:\foo.bar" />
</code></pre>
<p>different from</p>
<pre><code><Content Include="C:\foo.bar" />
</code></pre>
<p>?</p>
| <p>The MSDN article on the <a href="http://msdn.microsoft.com/en-us/library/0c6xyb66%28VS.80%29.aspx">build action</a> property explains the differences.</p>
<blockquote>
<p><b>None</b> - The file is not included in the project output group and is not compiled in the build process. An example is a text file that con... |
GtkNotebook add-tab button <p>Is it possible in Gtk+ to have an add-tab button inline with the tabs in a notebook, ala Opera or Google Chrome? I do know that Opera uses Qt and Chrome uses custom tabs, but is it possible in pure Gtk+?</p>
| <p>Sure. Check out the class BrandedNotebook at <a href="http://bazaar.launchpad.net/~fireball-medsphere/openvista-cis/mainline/annotate/head%3A/src/OpenVistaCIS/Main.cs#L1384" rel="nofollow">line 1384 of this file</a>.</p>
<p>Unfortunately Gtk+ doesn't give you a "nice" way to do this, but you should be able to deter... |
Unable to make Git ask about removal of deleted files <p>Assume you have a file which has been committed in your Git repo.</p>
<p>You remove the file simply by</p>
<pre><code>rm file
</code></pre>
<p>The removed file remains in your Git repo although you do not have it.</p>
<p>My old Git complained me that you cann... | <p>What about using:</p>
<pre><code>$ git commit -a
</code></pre>
<p>From <a href="http://kernel.org/pub/software/scm/git/docs/v1.5.0.7/git-commit.html" rel="nofollow">git commit manual</a> page:</p>
<blockquote>
<p>The command <code>git commit -a</code> first looks at your working tree, notices that you have modi... |
Embedding multiple, identically named resource (RC) files in a native DLL <p>For my application (an MMC snap-in) I need to create a single native DLL containing strings that are localized into different languages. In other words, if you were to inspect this DLL with Visual Studio, you would see multiple string tables, ... | <p>Yes. And No.
If you want multiple RC files you are going to have to leverage off the Operating systems support to have multiple resources in one file. In the resource editor, for each resource, you can set its locale AND the resource editor will allow you to have multiple resources with the same ID, as long as their... |
WPF ListBox Width / MaxWidth <p>I have a databound ListBox with a DataTemplate setup. The DataTemplate contains a Grid control with two column widths of Auto and *. I would like this column to always fill the ListBoxItem and never extend past the LisBox control to make the horizontal scrollbar visible.</p>
<p>I am a... | <p>You want to avoid binding to ActualWidth and ActualHeight when possible for efficiency sake. 90% of the time you are overlooking built in functionality if you find yourself binding to either of these properties (though there are rare exceptions where it makes sense).</p>
<p>To accomplish what you want you simply ne... |
ANSI standard of UNIX_TIMESTAMP() <p>UNIX_TIMESTAMP() isn't an ANSI standard keyword but an addition to the MySQL syntax. However, since I'm supporting multiple DB's, is there an ANSI standard way to write UNIX_TIMESTAMP();</p>
<p>Thanks</p>
| <p>As far as I know, no.</p>
<p>Every database handles this differently.</p>
<p>For example, in Oracle, you have to manually generate the timestamp with something like:</p>
<pre><code>SELECT (sysdateColumn - to_date('01-JAN-1970','DD-MON-YYYY')) * (86400) AS alias FROM tableName;
</code></pre>
<p>In MSSSQL:</p>
<p... |
objective-c question regarding NSString NSInteger and method calls <p>I like to create an instance of a custom class by passing it a value that upon init will help set it up. I've overridden init and actually changed it to:</p>
<pre><code>- (id)initWithValue:(NSInteger *)initialValue;
</code></pre>
<p>i'd like to sto... | <p>Your init method looks fine, and if you're only dealing with integer values, you do want to use NSInteger as opposed to NSString or even NSNumber. The one thing you might want to change is the parameter you're passing should be <code>(NSInteger)</code>, not <code>(NSInteger *)</code> - an NSInteger is not an object,... |
Is Reflection in a base class a bad design idea? <p>In general reflection in a base class can be put to some good and useful ends, but I have a case here where I'm between a rock and a hard place... Use Reflection, or expose public Factory classes when they really should be private semantically speaking (ie. not just a... | <p>When dealing with generics, you frequently have to use reflection. In that regard I think you're fine.</p>
<p>That said, I see two forms of code smell here. They may be due to code sanitation, however, so I'll just comment on them:</p>
<p>First, your static property is of a generic item. I'm 99.999% sure this will... |
Trouble iterating Generic list with custom object <p>Here's the code:</p>
<pre><code> ProductList products = xxx.GetCarProducts(productCount);
List<CarImageList> imageList = new List<CarImageList>();
foreach(Product p in products)
{
string imageTag = HttpUtility.HtmlEncode(string.F... | <p>I think your <code>xxx.GetCarProducts(productCount);</code> may be returning a reference to <code>List<Product></code> which is less defined than your <code>ProductList</code> class, meaning in your GetCarProducts method you probably do new <code>List<Product></code> instead of <code>new ProductList()</c... |
Form problems with php. dynamically selected options and check box <p>I'm pulling a list of client names out of one MySQL table to serve as a drop down selection. The data is to be stored on a separate table. I would like the option to come up as selected if there already is a client assigned to the field in the second... | <ul>
<li><p>Your <code>if(isset($_POST['client']))</code> condition doesn't reference <code>$row</code> at all, so it's going to either be true for all options or false for all options. I presume you want to compare <code>$_POST['client']</code> to <code>$clientlist</code> in that statement:</p>
<pre><code>if ($_POST[... |
Internet browser keep loading old swf files? <p>i have an swf file, uploaded in server. But whenever I make changes to the files, uploaded and replace the old one, I go to browser, clear cache and everything, refresh the page, but it still load the old swf file. (Do you know what I mean?)</p>
<p>But after 10 - 20 hour... | <p>Looks like you need to add some extra stuff to the URL that points to the SWF. Write a function like this (PHP)...</p>
<pre><code><?php
function swfURL($url2swf){
return $url2swf . "?random_number=" . rand(1,9999);
}
?>
</code></pre>
<p>Or do something similar with javascript. The random nu... |
Loading Animation Freezing when web service call returns <p>I have a Silverlight 2 application that has a "Loading Data..." message that contains an animation. When the web service returns the data and the data is loading in to an observable collection -- the animation freezes (this can be for for several seconds while... | <p>I don't know if you got the answer for this or not but here i go. </p>
<p>Try using a BackgroudWorker to put the heavy duty instructions in there.</p>
<p>Here is a very good example: <a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.aspx" rel="nofollow">http://msdn.microsoft.c... |
jquery click on anchor element forces scroll to top? <p><a href="http://stackoverflow.com/questions/720970/jquery-hyperlinks-href-value">http://stackoverflow.com/questions/720970/jquery-hyperlinks-href-value</a>[link text][1]</p>
<p>I am running in to a problem using jquery and a click event attached to an anchor elem... | <p>That should work, can you clarify what you mean by "before"? Are you doing this?</p>
<pre><code>jQuery("#id_of_anchor").click(function(event) {
event.preventDefault();
Function_that_does_ajax();
});
</code></pre>
<p>Because that <strong>should</strong> work in the sense that if it's not working YOU are doi... |
KenKen puzzle addends: REDUX A (corrected) non-recursive algorithm <p>This question relates to those parts of the KenKen Latin Square puzzles which ask you to find all possible combinations of ncells numbers with values x such that 1 <= x <= maxval and x(1) + ... + x(ncells) = targetsum. Having tested several of... | <p>Your algorithm seems pretty good at first blush, and I don't think OO or another language would improve the code. I can't say if recursion would have helped but I admire the non-recursive approach. I bet it was harder to get working and it's harder to read but it likely is more efficient and it's definitely quite cl... |
Linqtosql sync with the database <p>I am about to use linqtosql in my first asp.net mvc application.
I have come up with a database schema. But the problem is that I may change few of the tables in future. So keeping the model classes in sync with database will be a issue. </p>
<p>I got this link which states the simi... | <p>The "official" approach is to simply delete any out of date tables from the designer then drag the updated table from your Server Navigator back on again. I've been using this method for well over a year now and so long as you make your data context changes at the same time you're updating the database you should b... |
How should I go about writing a Joomla! template? <p>I am using Joomla! CMS to develop a website. In the not-so-distant past I customized a template to schlep up a website. It was fun and interesting to tear apart the code to de-joomla!-fy the template. So interesting that in fact, I am flirting with the idea of <em>ma... | <p>Create a HTML page with the layout you want, inclusive of stylesheets and Javascript<br>
(1.5/2.5 is Mootools based)<br>
(Joomla 3.x is jQuery based)<br>
<a href="http://docs.joomla.org/Adding_JavaScript" rel="nofollow">Adding Javascript</a></p>
<p>Keep the template initially very basic.<br>
Save this page as index... |
Any hints on getting Sitefinity CMS to work on medium trust? <p>We have been using Mosso / The Rackspace Cloud until very recently, but they have suddenly switched to a medium trust model for .NET for newly added sites and will be migrating existing server farms to medium trust shortly</p>
<p>We can't get our Sitefini... | <p>Slavo here from the team working on Sitefinity.</p>
<p>Someone from the team will reply to the support ticket you have submitted, but in the interest of anyone else that may have issues similar to yours, I wanted to write to you here as well. It doesn't become clear what problems exactly you have in your scenario, ... |
Adding Cookie to SOAPpy Request <p>I'm trying to send a SOAP request using SOAPpy as the client. I've found some documentation stating how to add a cookie by extending SOAPpy.HTTPTransport, but I can't seem to get it to work.</p>
<p>I tried to use the example <a href="http://code.activestate.com/recipes/444758/" rel="... | <p>Error 415 is because of incorrect content-type header.</p>
<p>Install httpfox for firefox or whatever tool (wireshark, Charles or Fiddler) to track what headers are you sending. Try Content-Type: application/xml.</p>
<pre><code>...
t = 'application/xml';
if encoding != None:
t += '; charset="%s"' % encoding
...
... |
If i use a separated ASP.NET Membership database how should i handle the relations to the user tables? <p>If i use a separated ASP.NET Membership database what is the correct way to define the relations between the user tables and application data tables?. Should i create copies of the user tables and sync? or is ok to... | <p>I'm not sure I fully understand the question... Do you mean have the asp.net membership in it's own database .... IMO it's easier to integrate the database in the application database</p>
<p>Use the GUID PK from aspnet_membership as your FK in your related application table </p>
|
PHP ZIP files on the fly <p>What's the easiest way to zip, say 2 files, from a folder on the server and force download? Without saving the "zip" to the server.</p>
<pre><code> $zip = new ZipArchive();
//the string "file1" is the name we're assigning the file in the archive
$zip->addFile(file_get_contents($fi... | <p>Unfortunately w/ PHP 5.3.4-dev and Zend Engine v2.3.0 on CentOS 5.x I couldn't get the code above to work. An "<em>Invalid or unitialized Zip object</em>" error message was all I could get. So, in order to make it work, I had to use following snippet (taken from the example by Jonathan Baltazar on PHP.net manual, a... |
Regarding Multitasking in Android application <p>I want to launch more than one application at the same time.Like one application should run in the background when a new application is started,and i have to switch between those two application.If anyone having the code to do this please help me.Give some website links ... | <p>If you want to run something in the background, you have to use a <a href="http://developer.android.com/reference/android/app/Service.html" rel="nofollow">Service</a>. Services are not killed except in extreme memory situations. Read the <a href="http://developer.android.com/guide/topics/fundamentals.html" rel="nofo... |
problem when exporting to excel with JSF <p>I'm using JSF/ICEFaces. The page is ICEFaces however I'm using the JSF datatable because ICEFaces had slow performance for some reason. Anyway, unlike the ICEFaces datatable, the JSF table doesn't come with export to excel so I'm writing my own. I decided to use Apache POI as... | <p>I'd suggest you pull this code into its own servlet. You're trying to short circuit JSF's usual life-cycle and while you might be able to find a way to do it, it would probably be simpler and possibly even cleaner to simply make a new servlet which handles this XLS file and let it do its own thing. You can place the... |
MYSQL select statement - 5 results from each user <p>I'm trying to do a select statement and it works except that it's not limiting the number of results for each user (U.id) to 5.</p>
<pre><code>SELECT F.id,F.created,U.username,U.fullname,U.id,I.id,I.cached_image
FROM favorites AS F
INNER JOIN users AS U
ON F.fave... | <p>Instead of <code>HAVING</code>, can you slap a <code>LIMIT 5</code> in there?</p>
<p><strong>Edit:</strong> OP cannot <code>LIMIT</code> entire query, <br />
and, AFAIK, MySQL <strong>does not support</strong> <code>LIMIT</code> in subqueries, <br />
so you can create a temporary table with your five (5) user ids:... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.