input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
inline function linker error <p>I am trying to use inline member functions of a particular class. For example the function declaration and implementation without inlining is as such:</p>
<p>in the header file:</p>
<pre><code>int GetTplLSize();
</code></pre>
<p>in the .cpp file:</p>
<pre><code>int NeedleUSsim::GetTp... | <p>You need to put function definition into the header then. The simplest way to hint the compiler to inline is to include method body in the class declaration like:</p>
<pre><code>
class NeedleUSsim
{
// ...
int GetTplLSize() const { return sampleDim[1]; }
// ...
};
</code></pre>
<p>or, if you insist on separa... |
Can I have Hibernate create an object through factory method? <p>Is there a way to map a factory method in Hibernate (as opposed to having Hibernate call a default constructor and reflectively set properties or fields)?</p>
<p>And if it can't be mapped, does Hibernate provide a hook for custom object creation on a cla... | <p>This is doable using either:</p>
<ul>
<li>a custom <a href="http://docs.jboss.org/hibernate/stable/core/api/org/hibernate/persister/entity/EntityPersister.html"><code>EntityPersister</code></a> implementation (that you can <a href="http://grails.1312388.n4.nabble.com/GROM-mapping-and-EntityPersister-tp2134133p21343... |
ASP.Net MVC DefaultModelBinder not binding properties on POST <p>I'm facing a really strange problem that has me smoked. </p>
<p>I have a fairly simple scenario where I have a strongly typed view that is correctly populated from the controller on the GET, but then when it POSTS the form to the controller, the Reqeust... | <p>A very similar scenario - that the DefaultModelBinder is - essentially - not binding to your model, arrise if you would give your bound model object the same name as one of its properties:</p>
<p><strong>Model</strong></p>
<pre><code>Public Property ArbitraryName1 As Integer
Public Property Answer As String
Public... |
Flex(DataGrid), How to change the visible state of certain cell while mouse over the row <p>I have three columns and the default visible state of last column is false.My problem is how can I change the visible state of the certain cell while the mouse over any part of the row.</p>
<p>English is not my native language,... | <p>You can easily toggle the visibility of the whole column when rolling over items in column1 that way:</p>
<pre><code><mx:DataGrid dataProvider="{[{c1:'a1', c2:'b1', c3:'c1'}]}">
<mx:columns>
<mx:DataGridColumn headerText="Column 1" dataField="c1">
<mx:itemRenderer>
<... |
How to store related data <p>In my program (a program that assists with pathfinding), i need to store a list that contains entries consisting of a start node and an end node. A dictionary won't work as i cannot guarantee that the "key" (a node of course) will be unique. What is the best way to store this manner of data... | <p>You might be better off simply using an array of structs. Or a vector of structs. This allows for non-unique nodes in your list. Vectors are a standard template in C++, but if C# doesn't support it, then an array should work fine.</p>
|
PHP - how to translate a website into multiple languages? <p>I have a website that's currently in English; I want to be able to switch to a different language when a user clicks on a different language (there are little country flag icons on the site). The way I'm currently trying is with arrays, e.g.:</p>
<pre><code>... | <p>Given that you are looking for full i18n support which will eventually lead to l10n support, I would suggest writing your page in a PHP framework that supports these things out of the box.</p>
<p>Personally I've only done translations with the Symfony framework. They use a combination of i18n table extension in th... |
Need a Java and Javascript diff tool written in Java <p>We need an accurate diff utility for Java and Javascript files, written in Java. It should be invokable from within an Eclipse (version 3.2 or 3.3) application. Preferably we need the Java source code for this utility also.</p>
<p>The utility should be able to co... | <p>Eclipse has a very good diff/compare plugin installed by default. Have you looked into using and/or extending that (it's opensource)? I would not think that adding some statistics reporting to the existing plug-in would be all that difficult, though sometimes plug-in development (even just simple extension) can be d... |
How can I make auto-complete display a list in Xcode <p>How can I use auto-complete in Xcode like I can in Visual Studio and Eclipse? Specifically in VS and Eclipse auto-complete displays a list of choices... while Xcode just displays a single choice. </p>
<p>For example Xcode might suggest "myVariable" when I type ... | <p>Press the escape key when auto-complete makes the first suggestion. This will display the list.</p>
|
Getting object's parent namespace in python? <p>In python it's possible to use '.' in order to access object's dictionary items. For example:</p>
<pre><code>class test( object ) :
def __init__( self ) :
self.b = 1
def foo( self ) :
pass
obj = test()
a = obj.foo
</code></pre>
<p>From above example, having ... | <p>On bound methods, you can use three special read-only parameters:</p>
<ul>
<li><strong>im_func</strong> which returns the (unbound) function object</li>
<li><strong>im_self</strong> which returns the object the function is bound to (class instance)</li>
<li><strong>im_class</strong> which returns the class of <em>i... |
Javascript function call not behaving the way I expect <p>here is the html:</p>
<pre><code><table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
<tr align="center" valign="middle">
<td width="10" class="pagestyle" onClick="pageNo(-1);" align="right">&laquo;</... | <p>What is total number of pages?
Are you enumerate them from one to six or from zero to five?</p>
<p>Change your js function accordingly and simplify the js expression (mentioned you have pages from zero to five):</p>
<pre><code>var page = 0;
var number_of_pages = 6;
function pageNo(off) {
page = (page + off +... |
WPF ControlTemplate Style GradientStop in Trigger <p>Here is my XAML for a TabItem. I want to be able to set the Color of a single gradient stop in a trigger. I know that I can re-define the gradient completely in the trigger's setter, but I want to access a specific property on the background so I can animate it in th... | <p>You can animate it, like in the example <a href="http://msdn.microsoft.com/en-us/library/ms748815.aspx" rel="nofollow">here</a>.</p>
<p>You also could use a slight hack to set it, though I always prefer creating multiple brushes as resources and swapping them or re-creating a brush in the as you mentioned.</p>
<p... |
echo nested quotation marks in tcsh <p>I have a tcsh script that generates a text file. One of the lines in the text file is:</p>
<pre><code>bla bla bla 'foo foo foo "bar bar bar"': etc etc;
</code></pre>
<p>Note the nested <code>'</code> and <code>"</code> and also the <code>:</code> and <code>;</code> that must be... | <pre><code>echo "bla bla bla 'foo foo foo "\""bar bar bar"\""': etc etc;"
</code></pre>
<p>or this:</p>
<pre><code>echo "bla bla bla 'foo foo foo "\"bar bar bar\""': etc etc;"
</code></pre>
<p>These should work for the simple example you gave, but may not help for what you're actually trying to do... Quoting in tcs... |
Serving Large Files Through Nginx via Rails 2.3 Using x-sendfile <p>Let's say I have a Rails 2.3.2 application fronted by nginx and served by mongrel in which I need to serve a large static file through Rails (to control access to it). I want the Rails app to delegate the transfer of the file to nginx, to avoid blockin... | <p>The main idea: all your controller does is to set the nginx <a href="http://wiki.nginx.org/NginxXSendfile">x-accel-redirect</a> header. Once your controller method returns (which will be very fast), nginx will look at the header your Rails app set. If x-accel-redirect is set, then nginx serves the static file.</p>
... |
AutoMapper: "Ignore the rest"? <p>Is there a way to tell AutoMapper to ignore all of the properties except the ones which are mapped explicitly? </p>
<p>I have external DTO classes which are likely to change from the outside and I want to avoid specifying each property to be ignored explicitly, since adding new proper... | <p>I've updated Can Gencer's extension to not overwrite any existing maps.</p>
<pre><code>public static IMappingExpression<TSource, TDestination>
IgnoreAllNonExisting<TSource, TDestination>(this IMappingExpression<TSource, TDestination> expression)
{
var sourceType = typeof (TSource);
va... |
Does this Scala actor block when creating new actor in a handler? <p>I have the following piece of code:</p>
<pre><code>actor {
loop {
react {
case SomeEvent =>
//I want to submit a piece of work to a queue and then send a response
//when that is finished. However, I don't want *thi... | <p>Yes, that is correct. Your outer actor will simply create an actor and suspend (wait for its next message). However, be very careful of this kind of thing. The inner actor is started automatically on the scheduler, to be handled by a thread. That thread <strong>will block</strong> on that Future (that looks like a j... |
How does git handle symbolic links? <p>If I have a file or directory that is a symbolic link and I commit it to a git repo what happens to it?</p>
<p>I would assume that it leaves it as a symbolic link until the file is deleted and then if you pull the file back from an old version it just creates a normal file.</p>
... | <p>git just stores the contents of the link (i.e. the path of the file system object that it links to) in a 'blob' just like it would for a normal file. It then stores the name, mode and type (including the fact that it is a symlink) in the tree object that represents its containing directory.</p>
<p>When you checkout... |
Definition of 'clean code' <p>Robert C. Martin offers in the fist chapter of his book '<a href="http://rads.stackoverflow.com/amzn/click/0132350882">Clean Code</a>' several definitions of 'clean code' from differen well known software experts. How do you define clean code?</p>
| <ul>
<li>Easy to understand.</li>
<li>Easy to modify.</li>
<li>Easy to test.</li>
<li>Works correctly (Kent Beck's suggestion - very right).</li>
</ul>
<p>These are the things that are important to me.</p>
|
Recommendations for good SQL Server Integration Services (SSIS) examples/samples for ETL? <p>I'm looking for some decent examples/samples using SSIS to do some ETL from one SQL Server database to another not necessarily within the same instance.</p>
<p>The idea is to migrate rows of data with their heirarchies (relati... | <p>There are Microsoft Tutiorials on how to use each Task Component and concept available here:
<a href="http://msdn.microsoft.com/en-us/library/ms141767.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/ms141767.aspx</a></p>
<p>You will likely need to review several tutorials in order to aquire the knowled... |
When I launch an web start application i am geteng the following error. Please help me <p>am geeting the following error while launching the application.
Exception in thread "javaWSApplicationMain" java.lang.NoClassDefFoundError:SimpleSerail.</p>
<p>The java code that i am using is as follows:</p>
<p>Aeon_PManager.ja... | <ul>
<li>Locate which jar file has the class SimpleSerial. </li>
<li>Ensure that it's in your classpath when your run your program</li>
</ul>
|
One view vs. "composite" views <p>I am in doubt how to construct my views and viewmodels... Lets see a (simplified) situation. I have a registration view with two variations: openid and strandard username/password. I see two ways how to </p>
<p>implement this:</p>
<p><strong>1.) First way: one view model and one view... | <p>I use the second option:</p>
<ul>
<li>I can us the ascx on other views </li>
<li>If I
use Ajax I can have one ascx loaded
asynchronously if javascript is
enabled or load the full page if not.
That makes it easier to implement
both: an Ajax and non-Ajax version</li>
</ul>
<p>I would only pass the required Model int... |
Find out FILESTREAM share name in T-SQL <p>Real quick question - I must be blind or something.</p>
<p>In SQL Server Mgmt Studio, I can check for the level of filestream support currently enabled by </p>
<pre><code>EXEC sp_configure filestream_access_level
</code></pre>
<p>Great, works. But how can I find the Windows... | <p>Run the following query:
SELECT SERVERPROPERTY ('FILESTREAMShareName')</p>
|
Parse VCALENDAR (ics) with Objective-C <p>I'm looking for an easy way to parse VCALENDAR data with objective-c. Specifically all I am concerned with is the FREEBUSY data (See below):</p>
<pre><code>BEGIN:VCALENDAR
VERSION:2.0
METHOD:REPLY
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
BEGIN:VFREEBUSY
UID:XYZ-DON... | <p>The <code>\n</code> in the middle of FREEBUSY data is a part of the iCalendar spec; according to <a href="http://tools.ietf.org/html/rfc2445#section-4.1">RFC 2445</a>, the newline followed by a space is the correct way to split long lines, so you'll probably see a lot of this in scanning FREEBUSY data.</p>
<p>As Na... |
Groovy: parametrized link tag <p>I have the following gsp page:</p>
<pre><code><g:def var="incidentMngmntId" value="${incidentMngmntInstance?.id}"/>
<g:link controller="ticketMngmnt"
action="list" params="[incidentMngmntId : incidentMngmntId]"
id="${incidentMngmntInstance?.id}"> Tickets
&l... | <p>The posted code is correct as it is.
I just restarted the server and that was.</p>
<p>The only think to be changed is the unnecessary id at the link</p>
<pre><code><g:def var="incidentMngmntId" value="${incidentMngmntInstance?.id}"/>
<g:link controller="ticketMngmnt"
action="list" params="[incidentMn... |
How do I restart a COM+ application on a remote server from .NET? <p>How do I programmatically restart a COM+ application running on a remote server from code in .NET?</p>
| <p>You have to use the ComAdmin API through COM interop.</p>
<p>Put a reference on Windows\System32\Com\ComAdmin.dll, then:</p>
<pre><code>COMAdmin.COMAdminCatalog catalog = new COMAdmin.COMAdminCatalogClass();
catalog.Connect(servername);
catalog.ShutdownApplication(AppNameOrAppID);
</code></pre>
<p>You can find th... |
How to run a PHP script from the command line with MAMP? <p>I have MAMP installed. Now I am trying to run a script from the command line, but I can't seem to get it to work.</p>
<p>How should I set up my environment so that I can run a script from the command line and use the PHP version I installed with MAMP?</p>
<p... | <p>Please note that with version 2.0.5 of MAMP, the path has changed. It is now one of the following:</p>
<pre><code>/Applications/MAMP/bin/php/php5.2.17/bin/
/Applications/MAMP/bin/php/php5.3.6/bin/
</code></pre>
<p>Therefore the command to add MAMP's php command should probably look like this:</p>
<pre><code>expor... |
How do I use a Python library in my Java application? <p>What are the basic nuts and bolts of calling (running? interpreting? what can you do?) Python code from a Java program? Are there many ways to do it?</p>
| <p>You can <a href="http://www.jython.org/docs/embedding.html" rel="nofollow">embed Jython</a> within your Java application, rather than spawning off a separate process. Provided your library is <a href="http://www.jython.org/docs/differences.html" rel="nofollow">compatible</a> with Jython, that would seem the most log... |
Disable control in .aspx from Masterpage conditionally <p>Ok, this might be a bit weird, so I'll start with explaining what I'm trying to do. I have several masterpages for my site, and in they inherit each other. In the second of them (4 in total) I have a background image. Here comes the trick, I'd like to override t... | <p>i've managed to access controls on a master page like this:</p>
<pre><code> Control control = Master.FindControl("ControlID");
if (control is ControlType)
{
ControlType menu = control as ControlType;
menu.Visible = false;
}
</code></pre>
<p>not sure if that wi... |
VB6 .NET interop issue in Vista <p>I wrote an assembly in C# and I needed to invoke a method on the DLL from a VB6.0 application.
I made the DLL COM compliant and registered the DLL accordingly. From my VB application I would then instantiate the class in the .NET assembly using the VB6.0 <code>CreateObject</code> meth... | <p>It sounds like maybe the COM component is only registered for the <em>user</em> - so when the admin tries it, the clsid is unknown. Try running your isntallation/registration process for the admin.</p>
<p>(does vista put clsids in HKCU? or just HKLM?)</p>
<p>A quick search seems to indicate that it relates to whet... |
Remove CSS from a Div using JQuery <p>I'm new to JQuery. In my App I have the following:</p>
<pre><code>$("#displayPanel div").live("click", function(){
$(this).css({'background-color' : 'pink', 'font-weight' : 'bolder'});
});
</code></pre>
<p>When I click on a Div, the color of that Div is changed. Within that Cli... | <p>You can remove specific css that is on the element like this:</p>
<pre><code>$(this).css({'background-color' : '', 'font-weight' : ''});
</code></pre>
<p>Although I agree with karim that you should probably be using CSS classes.</p>
|
ado.net data service advantages/disadvantages over WCF service <p>For me I have a WCF service which acts as DAL and does all the CRUD operations</p>
<p>I just came to know regarding the new ADO.Net Data Service, just read somewhat but not actually sure when & where to use it?</p>
<p>Just to add more, my new proje... | <p>First, my advice would be to write your MVC code so that it is oblivious to what the back-end data model is. Abstract away any dependencies right from the beginning. </p>
<p>As for deciding whether or not to use WCF, I'd suggest that you decide whether or not you'll want to reuse the data component that you write... |
Similarity String Comparison in Java <p>I want to compare several strings to each other, and find the ones that are the most similar. I was wondering if there is any library, method or best practice that would return me which strings are more similar to other strings. For example:</p>
<ul>
<li>"The quick fox jumped"... | <p>The common way of <strong>calculating the similarity between two strings in a 0%-100% fashion</strong>, as used in many libraries, is to measure how much (in %) you'd have to change the longer string to turn it into the shorter:</p>
<pre><code>/**
* Calculates the similarity (a number within 0 and 1) between two s... |
Hacking session variables in Asp.NET <p>Is it possible to hack someone's session variables and create a new shadow user?</p>
<p>What are the common ways of avoiding such surprizes? </p>
<p>SSL certificate installation or ....?</p>
| <p>Short answer... it depends.</p>
<p>Session in ASP.NET can be stored in a variety of ways (InProc / SQL Server / State Server) etc... another thing to note is how the client session is maintained (query string value, cookies etc...)</p>
<p>As the poster in this answer suggests</p>
<p><a href="http://stackoverflow.... |
Liferay 4.2 to 5.2 upgrade question: How to predeploy portlets in Liferay 5.2 <p>We are upgrading from Liferay 4.2 to Liferay 5.2.2. We are using the EXT environment. Previously, in 4.2 there was a directory called /ext/portlets. According for 4.2 doc, </p>
<p>"Portlets placed in this directory will be automatically d... | <p>If your portlets are bundled as war, and are not required to run in the same webapp as Liferay, just put your wars in the liferay deploy dir. This directory is defined in your portal-ext.properties file, and overrides the bundled portal.properties file definition of </p>
<pre><code>auto.deploy.deploy.dir=${liferay.... |
C# difference between casting and as? <blockquote>
<p><strong>Possible Duplicate:</strong><br />
<a href="http://stackoverflow.com/questions/702234/what-is-the-difference-between-the-following-casts-in-c">What is the difference between the following casts in c#?</a> </p>
</blockquote>
<p>In C#, is a there differe... | <p><code>as</code> will never throw a <code>InvalidCastException</code>. Instead, it returns null if the cast fails (which would give you a <code>NullReferenceException</code> if <code>obj</code> in your example were not a <code>string</code>).</p>
|
group image resources <p>I have a list 2 categories (cars and boats) and want to have an image for each item. Is there an easy way that I can appoint an image to the cargroup or boatgroup in resources? </p>
<p>regards</p>
| <p>i have solved this by creating multiple resource files. fairly easy solution thus!</p>
|
How do Linux binary installers (.bin, .sh) work? <p>Some software (for ex. the <a href="http://www.netbeans.org">NetBeans IDE</a>) ship the Linux installers in .sh files. Curious about how exactly they 'package' a whole IDE into a 'shell script', I opened the file in an editor. I saw some plain text shell scripting cod... | <p>Basically, it's a shell script prepended to a compressed archive of some sort, such as a tar archive. You use the <code>tail</code> or <code>sed</code> command on yourself (the <code>$0</code> variable in Bourne shell) to strip off the shell script at the front and pass the rest to your unarchiver.</p>
<p>For examp... |
jquery-problem using val() in IE6 <p>I'm trying to get a textarea's value to update using jquery as outlined in the below code:</p>
<pre><code><button type="button" onclick="setLine();">Set</button>
<button type="button" onclick="showLine();">fire!</button><p></p>
<textarea i... | <p>you should call val() inside the document.ready event:</p>
<pre><code>$(document).ready(function() {
$('#hello').val("hi there");
});
</code></pre>
<p>Just to make things clear: I'm only talking about the first (global) call to val(). The function declarations shouldn't be inside the document.ready function.... |
How to find average loading time for website? <p>How to write a code (in any programming language, preferably in java), which calculates the average loading time of any website (including all embedded elements such as images, Javascript, CSS, etc.) ? </p>
| <p>I'd just use <a href="http://developer.yahoo.com/yslow/" rel="nofollow">YSlow</a></p>
|
Margins to shift boxes evenly <p>I have this code:</p>
<pre><code><style type="text/css">
body > div { height: 260px; overflow: hidden; }
div div { float: left; height: 250px; width: 250px; margin: 1px; background: #ccc; }
</style>
<div>
<div>first 1</div>
<div>f... | <p>Since the width of the container is unknown, and the width of the divs is fixed in pixels (ruling out a percentage based system) - you can't do this with CSS.</p>
<p>You could centre them using the technique described at <a href="http://matthewjamestaylor.com/blog/beautiful-css-centered-menus-no-hacks-full-cross-br... |
What's wrong with Collections.sort? <p>I have these strings in an ArrayList of String in no particular order but when I invoke Collections.sort(listReference), the sorted result is incorrect, why do 10 and 11 (the last 2 characters) come before 07, 08, 09?</p>
<pre><code>12880 20090506054200001
12880 200905060542000... | <p>It works fine for me:</p>
<pre><code>import java.util.*;
public class Test {
public static void main(String[] args) {
ArrayList<String> list = new ArrayList<String>();
list.add("12880 20090506054200001");
list.add("12880 20090506054200002");
list.add("12880 200... |
How do I update version number of dll generated by VS2005 web deployment project using NAnt <p>I have a NAnt script that compiles our web application, but would like to programatically update the version number of the assembly it generates. I have sourced the version numbers already and you can assume they have been st... | <p>You have to write the version number into the web deployment project file itself. This NAnt task should do it:</p>
<pre><code> <target name="setAssemblyVersion" description="Increments/Sets the AssemblyVersion value" depends="getAssemblyVersion">
<foreach item="File" property="filename">
<... |
a Good Example of ant best practices <p>I have read lots of articles on Ant that explain all sorts of options, and I've read much of the documentation for Ant, but I don't really know the "right" way to do many things. Can anyone recommend a Good Example illustrating how to use Ant? Something that is not too complicate... | <p>You might want to also look at the <a href="http://wiki.apache.org/ant/AntUsageGuides">Ant Usage Guides</a> from the <a href="http://wiki.apache.org/ant/FrontPage">Ant Wiki.</a></p>
|
how to use gzip for a css/js file in PHP? <p>Now I'm not making use of any compression method,just put the below between the body tag:</p>
<pre><code><link rel="stylesheet" type="text/css" href="Client/Css/all.css" />
</code></pre>
<p>Is it possible to use ob_start("ob_gzhandler") in PHP to compress this css fi... | <p>this is not generally done programmatically, it is handled by the web server</p>
<p>For apache, there's a <a href="http://www.sitepoint.com/article/web-output-mod%5Fgzip-apache/" rel="nofollow">mod_gzip</a> or <a href="http://httpd.apache.org/docs/2.2/mod/mod%5Fdeflate.html" rel="nofollow">mod_deflate</a> module th... |
ADO showing "hidden columns" with SQL Native Client <p>I'm working on a legacy application using VB6 and Classic ASP. We're using disconnected ADO recordsets to pass data back and forth. Normally this works. But what has started happening recently is for any inner/outer join, ADO is including these in the available ... | <blockquote>
<p>this occurs on for any query (stored procedures if it matters) </p>
</blockquote>
<p>It's not <a href="http://social.msdn.microsoft.com/forums/en-US/sqldataaccess/thread/435a997b-339b-43b7-bab9-94f643fb1350/" rel="nofollow">the issue described here</a> is it? :</p>
<blockquote>
<p>If a change in t... |
How to edit default.aspx on SharePoint site without SharePoint Designer <p>On several occations, I have faced the situation that the default.aspx page on a Site doesn't work. More specifically, a reference to a WebPart and/or Control is throwing a error because the assembly is not found.
Fine, you just fire up the dre... | <p>Go to view all content of the site (<a href="http://yourdmain.sharepoint/sitename/%5Flayouts/viewlsts.aspx">http://yourdmain.sharepoint/sitename/%5Flayouts/viewlsts.aspx</a>). Select the document library "Pages" (the "Pages" library are named based on the language you created the site in. I.E. in norwegian the libra... |
Searching for text in sql server stored procedures <p>I have created a program that allows me to search for keywords inside the code of stored procedures, functions, tables etc. in SQL Server generated text files. I am looking for a way to find out where a search term (i.e "ADMIN.TABLE) is being referenced in all the c... | <p>I think you may be reinventing the wheel a bit. Have you looked at sp_depends? I will list all of the objects which depend on a specified table.</p>
<p>I realize that you're working with text files, but if you could generate the sp_depends results along with the scripts, that might solve your problem. </p>
|
C# Console App - OO Math/Thought Problem <p>I am programming a simple C# console application.</p>
<p>The spec is:</p>
<p>A game consists of ten frames, which start with a full rack of ten pins. In each frame, you have two deliveries of your ball, in which to knock down as many of the ten pins as you can. If you knock... | <p>In bowling, strikes and spares are called "marks." Use this!</p>
<pre><code>enum Marks { Open, Spare, Strike };
</code></pre>
<p>This way, you can determine what type of mark you have per frame. After a ball is thrown, check the last two frames, and update their scores. Then add up the scores.</p>
<p>Another no... |
eliminating the inter-compiler incompatibility issue with C++ dynamic libraries <p>..., a follow up to <a href="http://stackoverflow.com/questions/927063/building-c-source-code-as-a-library-where-to-start">this</a>.</p>
<p>From the answers I've been given to my referenced question I've learned that:</p>
<ul>
<li>diff... | <p>I think your approach is right. I'd put it this way:</p>
<ul>
<li>For a dll to be usable by different compilers, it must contain only C functions (they can be compiled using a C++ compiler using <code>extern C</code>)</li>
<li>As usual with dlls, a static import library can be used so that functions in the dll can ... |
SQL Compact To SQL Express Real-Time Merging/Syncing <p>I have an application that currently uses SQL Compact Edition as its database for capturing realtime data. Some of my users would like to write their own applications to query and report against this data while it's being captured by my application. However, SQL... | <p>If you're going to have your users install SQLExpress on the machine that is already running SQL CE, why not get your "real time" application to write directly into SQLExpress? Surely it's only a change to a connection string?</p>
|
SQL Server: Terminate SQL From Running <p>Is there away to cause a script to prevent running if an if statement is true even with "GO"'s?</p>
<p>For example I want to do something similar to the following:</p>
<pre><code>insert into table1 (col1, col2) value ('1', '2')
GO
if exists(select * from table1 where col1 = '... | <p>GO is not a transact-sql keyword - it's actually a batch terminator understood by common SQL Server tools. If you use it in your application, your app wil fail.</p>
<p>Why wouldn't you do something like this?</p>
<pre><code>IF NOT EXISTS (select * from table1 where col1 = '1')
BEGIN
--Do Some Stuff
END
</cod... |
multiple sql statement in a batch for mysql <p>i have to run multiple SQL statement in a batch
if i store those sql in a file
and can i run that file for those sqls</p>
<p>thanks
J</p>
| <p>Yes! <a href="http://dev.mysql.com/doc/refman/5.0/en/batch-mode.html" rel="nofollow">Using MySQL in batch mode</a></p>
|
How can I prevent IE Caching from causing duplicate Ajax requests? <p>We are using the Dynamic Script Tag with JsonP mechanism to achieve cross-domain Ajax calls. The front end widget is very simple. It just calls a search web service, passing search criteria supplied by the user and receiving and dynamically rendering... | <p>I just wrote an article on how to <a href="http://codecube.net/2009/05/avoid-caching-of-ajax-requests/" rel="nofollow">avoid caching of ajax requests</a> :-)</p>
<p>It basically involves adding the no cache headers to any ajax request that comes in</p>
<pre><code>public abstract class MyWebApplication : HttpApplic... |
SQL Server 2008: How to load/parse a SQL script from within TSQL? <p>Been working with SQL Server since it was Sybase (early 90s for the greenies) and I'm a bit stumped on this one. </p>
<p>In Oracle and DB2, you can pass a SQL batch or script to a stored procedure to test if it can be parsed, then execute conditional... | <p>The general hacky way to do this in any technology that does a full parse/compile before execution is to prepend the code in question with something that causes execution to stop. For example, to check if a vbscript passes syntax checking without actually running it, I prepend:</p>
<pre><code>Wscript.exit(1)
</code... |
Search a sentence in a string (C#) <p>My question has two parts:</p>
<p>1) How can I search for a sentence (e.g., <code>Dell Canada</code>) in a string (e.g., <code>I am working in Dell Canada</code>, and I found it...) .</p>
<p>2)The second part is my string is text in a RichTextBox, so I would like to find the Text... | <p>Give this a whirl, it will set it to bold. There are many Selection... properties on the RichTextBox that you can use, also note that it is a case insensitive search:</p>
<pre><code> string textToSearchFor = "Dell Canada";
int index = richTextBox1.Text.IndexOf(textToSearchFor, StringComparison.OrdinalIgnoreC... |
Error Viewing ASP.NET applications After Installing IIS7.5 <p>I get the following error when I try to access a asp.net application on my local machine. Anyone have any ideas?</p>
<blockquote>
<p>HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data f... | <p>please check if you deployed your application properly : <a href="http://technet.microsoft.com/en-us/library/cc731252%28WS.10%29.aspx" rel="nofollow">Deploying an ASP.NET Server (IIS 7)</a></p>
|
Linux c++ error: undefined reference to 'dlopen' <p>I work in Linux with C++ (Eclipse), and want to use a library.
Eclipse shows me an error:</p>
<pre><code>undefined reference to 'dlopen'
</code></pre>
<p>Do you know a solution? </p>
<p>Here is my code: </p>
<pre><code>#include <stdlib.h>
#include <stdio... | <p>You have to link against libdl, add</p>
<blockquote>
<p>-ldl</p>
</blockquote>
<p>to your linker options</p>
|
Drop shadows on iPhone Clock App "Alarm" tab <p>In the clock app that comes with the iPhone there is a tab view for setting alarms. In that view each of the UITableViewCell instances have a drop shadow around them. Does anyone know how to achieve the same effect?</p>
<p>Also it looks like the tab bar at the very botto... | <p>I was wondering how to do that and it just occurred to me to use the UITableView's footer view:</p>
<pre><code>myTableView.tableFooterView = myCustomViewWithDropShadowImage;
</code></pre>
|
Strong name, Manifest, and Code Signing <p>What order should these be done in? I'm doing this from the command prompt for a .Net app. I was able to do just strong name and code signing successfully, but when I tried all three, it doesn't look like it worked (==> Vista still trying to run the app with elevated privile... | <p>Brian,</p>
<p>"Vista still trying to run the app with elevated privileges resulting in a prompt" </p>
<p>I think the prompt for running with higher privileges cannot be avoided by code signing, the only thing you avoid with code signing is the warning "application from unkown editor".</p>
|
How best to convince people to upgrade IE? <p><em>I recently asked <a href="http://stackoverflow.com/questions/941759/how-can-we-get-rid-of-ie6-once-and-for-all">a question</a> that got shot down for being too strongly worded. I'm having another go today because it's something I really am concerned about and I really d... | <p>Ignoring installations where IE6 is mandated, consider segmenting your application, with basic (though non-buggy and usable) functionality available to IE6 users, and advanced functionality available only to newer browsers. Draw users to newer browsers with the promise of cool stuff.</p>
|
Python open raw audio data file <p>I have these files with the extension ".adc". They are simply raw data files. I can open them with Audacity using File->Import->Raw data with encoding "Signed 16 bit" and sample rate "16000 Khz". </p>
<p>I would like to do the same with python. I think that audioop module is what I n... | <p>For opening the file, you just need <code>file()</code>.
For finding a location, you don't need audioop: you just need to convert seconds to bytes and get the required bytes of the file. For instance, if your file is 16 kHz 16bit mono, each second is 32,000 bytes of data. So the 10th second is 320kB into the file. J... |
Enumerate files with case sensitivity in VBScript? <p>I am using the following VBScript code snippet to enumerate all files in my c:\Scripts\ folder:</p>
<pre><code>strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set c... | <p>If you use the FileSystemObject, you will get back names with the case preserved</p>
<p><a href="http://msdn.microsoft.com/en-us/library/wz72a8c0%28VS.85%29.aspx#Mtps%5FDropDownFilterText" rel="nofollow">Files Collection (MSDN)</a></p>
<pre><code>dim objFSO, path, fldr, f, msg
Set objFSO = CreateObject("Scripting.... |
Iterating through large lists with potential conditions in Python <p>I have large chunks of data, normally at around 2000+ entries, but in this report we have the ability to look as far as we want so it could be up to 10,000 records</p>
<p>The report is split up into: Two categories and then within each Category, we s... | <p>You could define a little inline function:</p>
<pre><code>def EntryMatches(e):
if use_currency and not (e.currency == currency):
return False
if use_category and not (e.category == category):
return False
return True
</code></pre>
<p>then</p>
<pre><code>totals['quantity'] = sum([e.quantity for e in ... |
Using ChangeDisplaySettingsEx in Delphi to set primary monitor <p>I'm trying to use ChangeDisplaySettingsEx in Delphi 7 to set a specific monitor as Primary.
In Windows.pas, it is defined as </p>
<pre><code>function ChangeDisplaySettingsEx(lpszDeviceName: PChar; var lpDevMode: TDeviceMode;
wnd: HWND; dwFlags:... | <p>You could try</p>
<pre><code>ChangeDisplaySettingsEx(devicename, PDeviceMode(0)^, my_hwnd, CDS_SET_PRIMARY,
lparam);
</code></pre>
<p>it does at least compile on Delphi 2009. I can't test it though.</p>
<p><strong>Edit:</strong></p>
<p>According to the scarce information on the net (<a href="http://article.gma... |
Code cleanup in netbeans <p>Is there something similar to the Eclipse cleanup rules (Preferences > Java > Code Style > Clean Up) in NetBeans?</p>
<p>The cleanup rules in eclipse will allow you to clean things up like organizing imports, removing unnecessary casts, adding missing override annotations etc.</p>
<p>Also ... | <h1><code>Refactor</code> > <code>Inspect and Transform</code></h1>
<blockquote>
<p>Is there something similar to the
Eclipse cleanup rules ((Preferences >
Java > Code Style > Clean Up) in
NetBeans?</p>
</blockquote>
<p>In NetBeans 8.0, the powerful batch tool is <code>Refactor</code> > <code>Inspect and Tran... |
How do I reference a PIA so my build works ona build server <p>I'm working on some stuff I've inherited that has a slightly untidy project structure. Some of the projects reference a Primary Interop Assembly (PIA) that it expects to be installed in the GAC. There is a note in the solution folder that says (in summary) ... | <p>I would simply add a build step that installs X, Y, and Z to the GAC, and then finishes the build, runs unit tests, etc.</p>
<p>After that is complete, it uninstalls from the GAC. </p>
<p>The only way to have your build be 'self-contained' - is to stop depending on GAC installed assemblies. This isn't a build se... |
What happened to my TableAdapter's Update and Delete commands? <p>I am fighting a recalcitrant VS2008 DataSet designer, it seems. I have been trying to do what seems to be a simple 2-table dataset solution, where one table is simply the textual meaning for an integer value stored in the other table. Basic data design... | <p>could it be that there is no unique primary key defined for the table?</p>
|
Writing a c# client/server <p>I would like to write a c# server that will act roughly as a chat server ( clients are connected for a while, same message could be dispatched to many clients , .... ). </p>
<p>I was wondering if you can give me some hints to start (what kind of architecture ( threads by clients / iocp / ... | <p>Here is a tutorial that will get you off to a good start. </p>
<p>Looks like it uses a threaded implementation so it should scale well.</p>
<p><a href="http://www.geekpedia.com/tutorial239%5FCsharp-Chat-Part-1---Building-the-Chat-Client.html" rel="nofollow">Building a Chat Server and a Chat Client </a></p>
|
Accessing parent view controller (custom) properties <p>I have written a <code>UITabBarController</code> subclass (called <code>MainViewController</code>) and added a few instance variables, specifically a venue of type Venue. Each tab of the <code>MainViewController</code> needs to access the venue variable of the <co... | <p>You're doing something completely wrong. <code>parentViewController</code> is declared as a <code>UIViewController</code>. <code>NSLog</code>ing it outputs its real type due to the wonders of polymorphism.</p>
<p><code>UIViewController</code> doesn't have a <code>Venue</code> member. Your <code>MainViewControlle... |
Runtime exception when calling dll function with parameter in Inno Setup <p>I am successfully calling a function in a DLL from Inno Setup, however upon returning I get a Runtime Error...Exception: Access violation at address XXXXXXX. Write of address XXXXXX.</p>
<p>The function is declared as:</p>
<pre><code>functio... | <p>You have a mismatch of the calling conventions. Either make the DLL function use <code>stdcall</code> as well:</p>
<pre><code>__declspec(dllexport) __stdcall int CompleteInstall(char* szInstallPath)
{
//AfxMessageBox ("Got here" /*szInstallPath*/, MB_OK);
return 1;
}
</code></pre>
<p>or change the function... |
Linq To SQL DAL and lookup data source <p>I am learning linq to sql and I am trying to setup a lookup combo box in my web page. I was using a linq data source but I then moved my linqtosql code to it's own class library for my DAL dll (took out of app_code folder). So, I am converting the page code to be able to stil... | <p>I'll answer in reverse order:</p>
<ol>
<li>I wouldn't use IQueryable outside of your repos / DAL for the simple reason that since execution is deferred, you lose control of what exactly is executed (i.e., an aribtrary function could be assigned as a delegate for WHERE), making maintenance and testing much harder. I... |
suggestions on a project in C++ / distributed systems / networks <p>I'd like to work on a 2-3 month long project (full time) that involves coding in C++ and is related to networks (protocol stacks). I was considering writing my own network stack but that doesn't seem as interesting. It would be great to find an idea to... | <p>If you are specifically interested in doing network programming with an emphasis on distribution and GPU/graphics stuff, you may want to check out the open source (GPL) <a href="http://cigi.sourceforge.net/index.php" rel="nofollow">CIGI project</a> (<a href="http://sourceforge.net/projects/cigi/" rel="nofollow">sour... |
Need good way to choose and adjust a "learning rate" <p>In the picture below you can see a learning algorithm trying to learn to produce a desired output (the red line). The learning algorithm is similar to a backward error propagation neural network.</p>
<p>The "learning rate" is a value that controls the size of th... | <p>Sometimes the process of decreasing the learning rate over time is called "annealing" the learning rate.</p>
<p>There are many possible "annealing schedules", like having the learning rate be a linear function of time:</p>
<pre><code>u(t) = c / t
</code></pre>
<p>...where <code>c</code> is some constant. Or ther... |
How can I reorder the columns in GridView and Rename them? <p>When I display the rows from DB using GridView, the columns appear without order. Like:</p>
<blockquote>
<p>Class Course Name ID</p>
</blockquote>
<p>and I want to display them in order like:</p>
<blockquote>
<p>ID Name Class Course</p>
</blockquote>
... | <p>the simplest solution is NOT to use </p>
<p><code>SELECT *</code></p>
<p>instead specify your columns in the order you want.</p>
<p><code>SELECT ID, Name, Class, Course FROM....</code></p>
<p>as far as Renaming your column, that can be accomplished in SQL as well.</p>
<p><code>SELECT ID as A, Name as B, Class a... |
How to strip out robo-comments and #region from C#? <p>I've got some code I'm maintaining that has a good deal of machine generated comments and machine generated regions. (or created by a particularly misled developer) </p>
<p>These are comments exclusively repeating the method metadata and space expansions of pasc... | <p>Why not use the regex find & replace in Visual Studio?</p>
<p>For triple slash comments:</p>
<pre> ///.*
</pre>
<p>For region tags:</p>
<pre> [#]region.*
[#]endregion
</pre>
|
Where can I find a simple spreadsheet or grid control for VB.NET? <p>Can someone recommend a spreadsheet control other than the OWC webcomponents with very simple functionality? I just need a 2x100 matrix and the ability for user input. I need this for VB.NET and I need it to be compatible with both 32bit and 64bit sys... | <p>Never used <a href="http://www.farpointspread.com/spread/?gclid=CN30z%5FDl85oCFQVfFQodVyxZdw" rel="nofollow">this</a> - but looks good.</p>
|
Simple and persistent CGI interface <p>I like the simplicity of CGI with Apache, but would like to be able to just leave my code running between CGI requests. mod_perl keeps coming up in this context, except that I'm not writing in Perl.</p>
<p>I'm aware of FastCGI, but am looking for something much simpler - somethi... | <p>Use a script-based mini web server such as:</p>
<ul>
<li><p><a href="http://www.dartmouth.edu/~rc/classes/ksh/sh-httpd.html" rel="nofollow">shell httpd</a></p></li>
<li><p><a href="http://www.acme.com/software/micro_httpd/" rel="nofollow">micro_httpd</a>, </p></li>
<li><p><a href="https://github.com/nmmmnu/Micro-HT... |
Use gmail domain account with IMAP authentication with SAML authentication not working <p>I have a python script that interfaces gmail accounts and allows searches, etc. This works on normal emails (ending on @gmail.com) but not on domain accounts. In this case authentication is done via SAML, and IMAP is enabled on th... | <p>RTFM:</p>
<p><a href="http://mail.google.com/support/bin/answer.py?hl=en&answer=77654" rel="nofollow">http://mail.google.com/support/bin/answer.py?hl=en&answer=77654</a></p>
<p>It should work with:</p>
<pre><code>username = username@domain.com
password = password
</code></pre>
|
Handling DST in 24H Application <p>I'm working on an application that needs to run 24H a day, and am working on correctly implementing support for DST. All times are currently stored in UTC, but I'm having issues when I try to display in local time. Right now I'm using <code>savedDate.ToLocalTime()</code> to convert ... | <p>I remember reading, perhaps regarding the Compact Framework, about .NET not being the most reliable when it comes to reporting about DST. More reliable was getting the current time in local time and UTC, and then determining (and using in future adjustments) the difference yourself. That seems like a horrible rout... |
How to set the java.library.path from Eclipse <p>How can I set the java.library.path for a whole Eclipse Project? I'm using a Java library that relies on OS specific files and need to find a .dll/.so/.jnilib. But the Application always exits with an error message that those files are not found on the library path. </p>... | <p>Don't mess with the library path! Eclipse builds it itself!</p>
<p>Instead, go into the library settings for your projects and, for each jar/etc that requires a native library, expand it in the <em>Libraries</em> tab. In the tree view there, each library has items for source/javadoc and native library locations.<... |
How to keep RMS after installing a new version? <p>I have an j2me application installed on a Nokia S40. Some configuration data is stored in the RMS. Is it possible to overwrite the installed app with a new version? How to keep RMS in the new version?</p>
<p>If it is possible can it be set as a default operation when ... | <p>If your phone automatically deletes the RMS database without asking the user, it's a huge bug that goes against the MIDP specifications.</p>
<p>I assume you are using a retail phone, not a prototype.</p>
<p>It's always worth checking if the firmware can be upgraded with nokia PC tool.</p>
<p>If the upgrade proces... |
Auto- Property Initialization or Service-Oriented assignments? <p>If my objects are for the most part simply holding data that will be sent to the View, does it make sense to implement a separate Service class to initialize object, retirve data and make assignments? Instead, shouldnt the object 'know' what it has to do... | <p>like active record? I think that DTO + DAO or domain object + repository is a better design most of times </p>
|
UI responsiveness and javascript <p>I have a large set of data to be plotted on google map. Because of the data set size, google map always freezes for a few seconds before all the points are plotted. I used an animated spinning circle during the loading time to show it's in progress. But end users prefer to see action... | <p>Javascript engine executes functions one by one by taking them from sort of a queue. Functions can be put there either by your script or as result of user's actions (event handlers). So idea is to split long-running task into small short-running subtasks and feed them into this 'queue' in the manner so they can be m... |
How to whitelist/blacklist child object fields in the ModelBinder/UpdateModel method? <p>I have a question regarding how to get the white- and black-listing feature of the MVC controller's UpdateModel/TryUpdateModel to work on individual properties of child objects. For example, lets say I have a questionnaire collecti... | <p>I have worked around this problem by making the action accepting two objects (the parent and the child object) </p>
<p>Example:<br />
Suppose we have the following model: </p>
<pre><code> public class Employee
{
public string Name { get; set; }
public int Age { get; set; }
public Comp... |
How to convert a .WAV audio data sample into an double type? <p>I'm working on an application that processes audio data.
I'm using java (I've added MP3SPI, Jlayer, and Tritonus). I'm extracting the audio data from a .wav file to a byte array. The audio data samples I'm working with are 16 bits stereo. </p>
<p>Accordi... | <p>When you use the ByteBuffer (<a href="http://java.sun.com/javase/7/docs/api/" rel="nofollow">java.nio.ByteBuffer</a>) you can use the method order;</p>
<p>[order]</p>
<p>public final ByteBuffer order(ByteOrder bo)</p>
<pre><code>Modifies this buffer's byte order.
Parameters:
bo - The new byte order, either B... |
How can I intercept errors from gzip so cron doesn't see them? <p>So, OK, the job runs in cron: it fetches compressed files and processes them. If the files are corrupted, it deletes them. Sometimes they are bad on the remote server, in which case they will be downloaded and deleted each time.</p>
<p>My cron logs exte... | <p>You might like to consider using <a href="http://search.cpan.org/perldoc?IO::Uncompress::Gunzip" rel="nofollow" title="IO::Uncompress::Gunzip">IO::Uncompress::Gunzip</a> which has better error control and handling. Here is a snippet that might help:</p>
<pre><code>use IO::Uncompress::Gunzip qw(gunzip $GunzipError);... |
What is AJAX, really? <p>I have to start using AJAX in a project and I don't know where to start. Can someone please help?</p>
| <p><strong>A</strong>synchronous <strong>J</strong>avaScript <strong>A</strong>nd <strong>X</strong>ml. A technique for achieving bi-directional, script-driven communications between Web browsers and servers via HTTP. </p>
<h3>See also:</h3>
<ul>
<li><a href="http://en.wikipedia.org/wiki/Ajax%5F%28programming%29" rel... |
Is it more efficient to include a "check location" function in a "move function" for a game, or outside as an external function? <p>I'm creating a game in C++ (speaking of which, does the code I use matter?), which coudl be loosely described as a board game, and I'm wondering which of these two "check if character is o... | <p>The latter is faster (Not doing AND undoing). I would also think that it is the cleaner, but that's a matter of opinion.</p>
|
How can I make a primary key as AUTOINCREMENT <p>I have table in Database and the primry key is 'ID', Just I want to ask how can I make it AUTOINCREMENT</p>
<p>I know that's esay Q, but I dont know how can I do it.</p>
<p>thanks</p>
| <p>There is a property "Identity Specification". Expand that one, you can chose Increment value, and Increment Seed</p>
|
How do I prevent CSS inheritance? <p>I have a hierarchical navigation menu in my sidebar that uses nested lists (<ul> and <li> tags). I am using a pre-made theme which already has styles for list items, but I want to alter the style for the top-level items but NOT have it apply to the sub-items. Is there an... |
<p>You either use the child selector</p>
<p>So using</p>
<pre class="lang-css prettyprint-override"><code>#parent > child
</code></pre>
<p>Will make only the first level children to have the styles applied. Unfortunately IE6 doesn't support the child selector.</p>
<p>Otherwise you can use </p>
<pre class="lan... |
Filling a form with C# <p>I am researching filling out a form programatically. I have seen <a href="http://stackoverflow.com/questions/557480/populate-a-form-and-print-out-document">this question</a> which is pretty similar to what we want to do. But I have a few other questions.</p>
<ol>
<li>Is there any examples of ... | <p>I've used ABC PDF with some success : <a href="http://www.websupergoo.com/abcpdf-1.htm" rel="nofollow">http://www.websupergoo.com/abcpdf-1.htm</a></p>
|
How can I use linq to sort by multiple fields? <p>I'm creating a mock data source that I want to be able to pass in a list of SortExpressions on.</p>
<pre><code>public SortExpression(string name, SortDirection direction)
{
this.name = name;
this.direction = direction;
}
</code></pre>
<p><strong>Update</stro... | <p>There are two problems. The first is the one others have alluded to - you need to use the value returned by <code>OrderBy</code> etc. The second is that each time you call <code>OrderBy</code>, that's adding a new "primary" ordering. You really want <code>ThenBy</code> after the first ordering has been applied. That... |
Appending URL parameters to URLs in ActionScript <p>I'm trying to add a URL parameter to an URL string in ActionScript. Currently I'm checking the existing URL to see if it explicitly has a "?" to determine if there are any existing parameters to determine if my parameter delimiter should be "?" or "&". Is there a ... | <p>Take a look at <a href="http://livedocs.adobe.com/flex/3/langref/index.html?flash/net/URLVariables.html&flash/net/class-list.html" rel="nofollow">URLVariables</a> and <a href="http://livedocs.adobe.com/flex/3/langref/index.html?flash/net/URLLoader.html&flash/net/class-list.html" rel="nofollow">URLLoader</a> ... |
Supporting Single sign-on changing domain of JSESSIONID session cookie domain on Jetty <p>I'm trying to support single sign-on with JETTY and we have 2 subdomains running webservers that will support single sign-on through <a href="http://jetty.mortbay.org/jetty5/faq/faq%5Fs%5F400-Security%5Ft%5Fsso.html" rel="nofollow... | <p>I do not know anything about Jetty or how JSESSIONIDs work but it sounds like you want to tie the validity of JSESSIONID to a specific SSOSession cookie.</p>
<p>One possibility - when creating a new session on app.test.com, apart from new JSESSIONID, set a new cookie say SSOSig = MD5(JSESSIONID + SSOSessionCookie ... |
Hibernate Table per Hierarchy How to <p>I would like to use hibernate to contain a hierarchy of objects, however the discriminator column is a foreign key to another table that contains the CODE defining the subclass type. </p>
<p>Is it possible to specify the code from the joined table as the discriminator, or do I h... | <p>A quick test shows that you could do this:</p>
<pre><code><?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping default-access="field">
<class name="Shape"... |
How do you URL-encode the @ symbol in the iPhone SDK? <p>Using stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding to URL-encode an NSString isn't encoding the @ symbol. What's the proper way to resolve this? Thanks.</p>
| <p>Add this after the line of code you already have (and change the receiver, etc. to your own variables): </p>
<pre><code>[escaped replaceOccurrencesOfString:@"@" withString:@"%40" options:NSCaseInsensitiveSearch range:wholeString];
</code></pre>
<p>If you want to make sure that everything is encoded, here is the ... |
How do I disable the update software message box with Tortoise SVN client <p>When using Tortoise SVN for the first time since a reboot, if the software has a new version, a message box appears asking to visit the website to get the new version. Does anyone know of a way to disable this?</p>
| <p>Go to the settings and disable the "Check for newer versions every week" checkbox.</p>
|
Base64 encoding/decoding when serializing an attribute to/from the database <p>When rails serializes an object to store in the database it uses YAML. I want to also use
Base64 encoding/decoding when doing this so the YAML will be much more compact on INSERT and UPDATE statements. The objects I am serializing are rather... | <p>You're looking for ActiveRecord::Base#serialize. I had a similar problem - I wanted to save a large object into a session, but then decided to create a table and proper class for it instead. Much, much cleaner.</p>
|
Creating a assertClass() method in JUnit <p>I'm creating a test platform for a protocol project based on Apache MINA. In MINA when you receive packets the <code>messageReceived()</code> method gets an Object. Ideally I'd like to use a JUnit method <code>assertClass()</code>, however it doesn't exist. I'm playing around... | <p>Take a look at the Hamcrest matchers, now included in JUnit. What you want is something like:</p>
<pre><code>import static org.junit.Assert.assertThat;
import static org.hamcrest.CoreMatchers.instanceOf;
assertThat(receivedPacket, instanceOf(SomePacket.class));
</code></pre>
<p>That does everything you need, incl... |
What is the best way to handle multiple database connections in C# <p>If say I need to run two separate SQL statements against two separate databases. Right now I do (pseudocode):</p>
<pre><code>Try{
declare variable connectionA to DatabaseA
declare variable connectionB to DatabaseB
connectionA.open()
connectionB.... | <p>Instead of adding variables, why not make a class?</p>
<pre><code>public class MyDatabaseConnection {
public MyDatabaseConnection(string connectionString) {
this.connectionString = connectionString;
// create a database connection perhaps
}
// some methods for querying a database
pub... |
Displaying a new view when selecting a row in a UITableView <p>I have an application with multiple views. I can click on different buttons to select different views, one of which displays a table. When I select a cell on that row, I want to display a new view. I see a log line indicating that view was loaded, but th... | <p>What happens if you try to present your details controller using [self presentModalViewController: detailsController animated:YES] instead of the navigation controller's pushViewController? Also, adding the view to the window shouldn't be necessary. Pushing the view controller should be sufficient.</p>
<p>Try addin... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.