input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
Rails Active Record find(:all, :order => ) issue <p>I seem to be unable to use the ActiveRecord::Base.find option :order for more than one column at a time. </p>
<p>For example, I have a "Show" model with date and attending columns.</p>
<p>If I run the following code:</p>
<pre><code>@shows = Show.find(:all, :order =... | <p><strong>Could be two things. First,</strong></p>
<p>This code is deprecated:</p>
<pre><code>Model.find(:all, :order => ...)
</code></pre>
<p>should be:</p>
<pre><code>Model.order(...).all
</code></pre>
<p>Find is no longer supported with the :all, :order, and many other options.</p>
<p><strong>Second,</stro... |
Encoding PHP Tags for Security? <p><a href="http://docs.kohanaphp.com/helpers/security#encode%5Fphp%5Ftags" rel="nofollow">Kohana</a> and <a href="http://codeigniter.com/user%5Fguide/helpers/security%5Fhelper.html" rel="nofollow">Codeigniter</a> both have <code>encode_php_tags()</code>. I understand XSS cleaning (for J... | <p>A smart fellow on the #kohana forum suggested that it is there because Expression Engine uses eval() for templates. If someone were to embed PHP in a string it is possible it would be eval()'d and executed. Since Kohana does not use eval() for templates it is possible that it is just left over from Codeigniter day... |
Clone isn't cloning select values <p>I didn't expect it but the following test fails on the cloned value check:</p>
<pre><code>test("clone should retain values of select", function() {
var select = $("<select>").append($("<option>")
.val("1"))
... | <p>After further research I found this ticket in the JQuery bug tracker system which explains the bug and provides a work around. Apparently, it is too expensive to clone the select values so they won't fix it. </p>
<p><a href="http://dev.jquery.com/ticket/1294">http://dev.jquery.com/ticket/1294</a></p>
<p>My use o... |
Background image positioning problem <p>I have this as my CSS styling. My <code>#pg_wrap</code> is not centering with the background image when the browser window is resized. The screen shot I have is when you reduce the browser window less than 1344px than the <code>#pg_wrap</code> width (the width doesn't have to b... | <p>The difference is because the browsers handle incorrect css in different ways.</p>
<p>Change</p>
<pre><code>background-attachment:fixed
</code></pre>
<p>to</p>
<pre><code>background-attachment:fixed;
</code></pre>
|
A strange Problem about gdi+ bitmap! <p>I am using the following code to get a Bitmap point, </p>
<p>(width = 800, height = 600);</p>
<pre><code>Bitmap* m_BitmapCanvasCore = new Bitmap(width, height, PixelFormat32bppARGB);
</code></pre>
<p>but the m_BitmapCanvasCore always is NULL...
Is there any thing wrong about g... | <p>Did you call <a href="http://msdn.microsoft.com/en-us/library/ms534077(VS.85).aspx" rel="nofollow">GdiplusStartup</a> before creating the Bitmap?</p>
|
Which initializer(s) to override for UITableViewController subclass <p>I have a <code>UITableViewController</code> subclass that's instantiated, depending on where it's used, in a NIB or via code. In both cases I want to do customization in the initializer method. Does that mean I need to implement both <code>initWit... | <p>My confusion was based on the mistaken belief that each class should have a single designated initializer. This is not true, and in the case of <code>UITableViewController</code> there are 3 designated initializers (as far as I can tell):</p>
<ol>
<li><code>initWithStyle:</code> declared locally</li>
<li><code>ini... |
Input still existing when removed <p>i append a text input into form by using javascript, after i removed it by removeNode, it disappear, document.forms["form"].length = 0, but i can still get it's obj by using document.forms["form"]["inputname"] (not return null)</p>
<p>why?</p>
| <p>I think you are having trouble with firefox. In IE your code seems to work without any problem.</p>
<p>For removeNode to work in both IE and FF you can write like this</p>
<p>var objectToRemove = document.getElementByID ( "your object to remove" ); </p>
<p>var parentNode = objectToRemove .parentNode; </p>
<p>par... |
What's a good guide to WPF Panels & layout in general? <p>Is there a good, concise guide to the various behaviors of the controls that inherit from System.Windows.Controls.Panel? Or just a WPF layout guide in general?</p>
<p>In particular, I'm interested in how the panels handle child objects that have width or height... | <p>See <a href="http://msdn.microsoft.com/en-us/library/ms754152.aspx">http://msdn.microsoft.com/en-us/library/ms754152.aspx</a> for a start... it sounds like you may be particularly interested in the table in the "User Interface Panels" section.</p>
|
How do I get the current hour using Cocoa? <p>How do I get the current hour in Cocoa using Objective-C?</p>
| <p>To start off, you should read <a href="http://developer.apple.com/documentation/Cocoa/Conceptual/DatesAndTimes/DatesAndTimes.html#//apple%5Fref/doc/uid/10000039">Dates and Times Programming Topics for Cocoa</a>. That will give you a good understanding of using the various date/time/calendar objects that are provided... |
How to prevent vim from creating (and leaving) temporary files? <p>Why does vim create <code><filename>~</code> files? Is there a way to disable that? </p>
<p>If it's for backup (or something), I use git for that.</p>
<p>Also, these <code>.<filename.with.path.hints>.swp</code> files too.</p>
<p>How do I ... | <p>I'd strongly recommend to keep working with swap files (in case Vim crashes).</p>
<p>You can set the directory where the swap files are stored, so they don't clutter your normal directories:</p>
<pre><code>set swapfile
set dir=~/tmp
</code></pre>
<p>See also</p>
<pre><code>:help swap-file
</code></pre>
|
Issue with streaming AVI files <p>I am writing a video streaming server application. I have an AVI file and I have put it on IIS 7 for streaming. I found that client cannot jump to an arbitrary location of the media, if the media is not buffered already. I think some meta-data is missing during recording?</p>
<p>After... | <p>As you already discovered yourself, index is written at the end of avi containers. That's why avi format is not good for streaming. </p>
<p>You should convert your video to some other format which has the indexing information at the beginning. For example, flv, wmv, ogg/theora, etc.</p>
|
A way to add pictures to Excel sheet programmtically but not from file <p>I work on a product that loads a file into the Excel worksheet. The file contains data that is converted to a picture (using some WebService) and then displayed on the worksheet.</p>
<p>Lately, I was thinking of avoiding the file IO in this load... | <p>Yes, you can put your picture in the clipboard and paste it.</p>
<p>This, however, has a disadvantage of wiping off user's stuff from the clipboard which is not a good thing to do.</p>
|
Exceptions over remote methods <p>What are the best practices for exceptions over remote methods?</p>
<p>I'm sure that you need to handle all exceptions at the level of a remote method implementation, because you need to log it on the server side. But what should you do afterwards?</p>
<p>Should you wrap the exceptio... | <p>It seems like you want to be able to differentiate if the failure was due to a system failure (e.g. a service or machine is down) or a business logic failure (e.g. the user does not exist).</p>
<p>I'd recommend wrapping all system exceptions from the RMI call with your own custom exception. You can still maintain t... |
Transaction timeout expired while using Linq2Sql DataContext.SubmitChanges() <p>please help me resolve this problem:</p>
<p>There is an ambient MSMQ transaction. I'm trying to use new transaction for logging, but get next error while attempt to submit changes - "Timeout expired. The timeout period elapsed prior to co... | <p>You could consider increasing the timeout or eliminating it all together.</p>
<p>Something like:</p>
<pre><code>using(TransactionLogDataContext transactionDC = new TransactionLogDataContext())
{
transactionDC.CommandTimeout = 0; // No timeout.
}
</code></pre>
<p>Be careful</p>
|
Google geomap with jquery fails in IE <p>I faced with problem that geomap by google fails with JQuery together in Internet explorer.</p>
<p>Otherwise in Firefox it looks like this:</p>
<p><img src="http://clip2net.com/clip/m0/1239617014-clip-11kb.jpg" alt="1239617014-clip-11kb"/></p>
<p>Here comes js references </p... | <p>It's hard to debug javascript in IE, but it's even harder to debug without the actual url, or when using minified javascript. You might want to switch to the full non-minified version of jquery temporarily, so that you can find the line where the error occurs and see what's going on.</p>
<p>Also, in firefox you ca... |
Page Refresh Causes Duplicate POST in ASP.NET Applications <p>i have an application in which i am adding a new record and the record is added two times if i am pressing refresh button.</p>
<p>I am clearing the cache but i am having the same problem.
what to do?</p>
| <p>Once you have handled a post back to a page, best practice is to then redirect so that you can't have the data posted a second time using the "refresh" button. This is common to all web develoment, not just ASP.NET.</p>
|
making joomla search page search engine friendly <p>I want to add some seo features to a joomla search component, such as meta and integrated title page. What should i hack in the file ?
Thanks
joomla verion 1.0.15</p>
| <p>I'd suggest hacking directly at the Joomla! search module. this should <code>modules/mod_search.php</code> file and go from there to add your functionality. I'm not too familiar with the topics of SEO optimization.</p>
|
Exchange data between programs written in various languages <p>I'm writing a small browser game and as I'm not a good designer, I wanted to start with the technical part first and add the user interface later, so I wanted to have the first version include bot support, so everyone could write their own bot and have it p... | <p>If you're going to be making a browser based game, then the people that will be playing it will be making use of http requests and visiting certain URLs. It makes sense to me to keep your API for the bots similiar to this, rather than duplicating work for yourself. So why not expose your game's functionality through... |
ASP.NET MVC Default Parameters <p>I have created a new route like the following:</p>
<pre><code> routes.MapRoute(
"BlogYMD",
"blog/date/{year}/{month}/{day}",
new { controller = "Blog", action = "Date", year = "2009", month="01", day="01" });
</code></pre>
<p>The view simply returns a concatenation o... | <p>You don't show the rest of your routes, but I suspect you have another route above this one in your global.asax.CS (for example, the default route) which matches the second URL.</p>
|
how to have a Hover details box in flex 3 similar to ones present in google geomap visualization examples <p>i want to know if there is a already available hover details component similar to the one shown in <a href="http://code.google.com/apis/visualization/documentation/gallery/geomap.html" rel="nofollow">google geom... | <p>You could conceivably do this with the Flex framework's own ToolTip class. All standard Flex components (derived from UIComponent) have a toolTip property that's used to create tooltips. The standard tooltip style is black text on a yellow-ish background, but this is easily changed using CSS. For some more elaborate... |
How to automate tests for reports in SSRS <p>My current project uses SSRS as the reporting engine. I have the report executing a text command with about 10 variables passed to it. I have been looking for a solution on how to unit test (acceptance or integration, whatever, just some automation) to an SSRS report proje... | <p>Do acceptance/smoke tests with <strong><a href="http://watin.sourceforge.net/" rel="nofollow">watin</a></strong> or <strong><a href="http://seleniumhq.org/projects/remote-control/" rel="nofollow">selenium rc</a></strong> with your favorite unit testing framework.</p>
|
PHP/MySQL: Convert from YYYY-MM-DD to DD Month, YYYY? <p>I have in a MySQL table a DATE column that represents the date in this format: YYYY-MM-DD.</p>
<p>I wanto to retrieve the date from the database using PHP but display it like this: DD Month, YYYY.</p>
<p>From '2009-04-13' to '13 April, 2009' for example.</p>
<... | <p>Refer to <a href="http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function%5Fdate-format">DATE_FORMAT()</a> function in MySQL. I guess that's the best way for you to do it.</p>
<p>Also, you can make this:</p>
<ul>
<li>Fetch your date from DB</li>
<li>Use <a href="http://www.php.net/strtotime">s... |
How can I disable the security warning when viewing XML in IE? <p>When I view XML files in Internet Explorer, it does syntax highlighting and provides clickable expand/collapse controls. But for every file I open, I get a yellow
warning bar that takes three clicks to dismiss. These are local files, so the security war... | <p>The previous suggestions on this page didn't work for me. I found the answer on <a href="http://www.leonmeijer.nl/archive/2008/04/27/106.aspx">this page</a></p>
<p>To summarise, go into Internet Options > Advanced then down to the Security section, and tick the box for "Allow active content to run in files on My Co... |
CEdit numeric validation event C++ MFC <p><br />
I have a CEdit text box which is a part of a property pane and only allows numeric values (positive integers). The box works fine when people enter non-numeric values, but when they delete the value in the box a dialog pops up saying:
"Please enter a positive integer."<... | <p>The message you are receiving is coming from the data validation routines, not the data exchange routines. There is probably a call like this in DoDataExchange():</p>
<pre><code>void MyPropertyPane::DoDataExchange(CDataExchange* pDX)
{
DDX_Control(pDX, IDC_NUMERIC_BOX, m_NumericBox);
DDX_Text(pDX, IDC_NUME... |
Nhibernate error: NO row with given identifier found error <p>I know that this question is repeated one.
But no one could answer briefly enough to answer corrctly.
I am getting Nhibernate error " No row with given identiifer found error" when im trying to use the guid to give me the record from the table.
I am using N... | <p>From the <a href="http://www.hibernate.org/hib%5Fdocs/nhibernate/1.2/reference/en/html%5Fsingle/#manipulatingdata-loading" rel="nofollow">documentation</a>, </p>
<blockquote>
<p>Note that Load() will throw an unrecoverable exception if there is no matching database row.</p>
</blockquote>
<p>If you want to query ... |
Help me find the best of WPF <p>I would like to find what people got the most out of using WPF, in particular:</p>
<ul>
<li>The best and stunning UI examples out there </li>
<li>Dark corners that no other UI can implement with ease and style (say MFC or GTK)</li>
<li>Professional examples with code </li>
</ul>
<p>Sug... | <p>Here's some of my favorites:</p>
<ul>
<li><p><a href="http://www.vertigo.com/familyshow.aspx" rel="nofollow">Family.Show</a> - An genealogy application (with code)
<img src="http://blogcasts.de/dwalzen/blog/FamilyShow.png" alt="Family.Show" /></p></li>
<li><p><a href="http://www.photosuru.com/" rel="nofollow">Photo... |
How to insert single quotes on a databound asp:hyperlink field in asp.net? <p>I am trying to bind an ASP.NET hyperlink to the "Handle" column of my dataset like this:</p>
<pre><code><ItemTemplate>
<asp:HyperLink ID="idTracking" runat="server" NavigateUrl='<%# "javascript:SendPath(" + Eval( "Handle", "... | <p>As far as I know the text property of the hyperlink control automatically encodes, I've always has to simply do it as a standard html anchor tag.</p>
<p>So something like this.</p>
<pre><code><a href='<%# "javascript:SendPath(" + Eval( "Handle", "{0}") + ")" %>'>Your Link</a>
</code></pre>
|
How can I separate Visual State Managment from Custom Control template? <p>How can I separate Visual State Management from a Custom Control template?</p>
<p>I have one Custom Control, but with several different faces placed in templates.
All templates must have same state-based visualisation.
Is there any way to set m... | <p>Re-templating often leads to duplicate code, especially for VSM code. There isn't an easy way to abstract out that code today, unfortunately.</p>
|
Turning off auto-complete for text fields in Firefox <p>Am supposed to be learning French at the moment, but rather than learning any vocab, I've been mucking around with a rails app that tests vocab - so it displays a word, and I have to type its translation.</p>
<p>Unfortunately, Firefox remembers everything I've al... | <p>So it turns out it's pretty simple. Rather than</p>
<pre><code><%= f.text_field :fieldname %>
</code></pre>
<p>put</p>
<pre><code><%= f.text_field :fieldname, :autocomplete => :off %>
</code></pre>
|
How to change Entity type in JPA? <p>In my specific case, I am making use of a discriminator column strategy. This means that my JPA implementation (Hibernate) creates a <em>users</em> table with a special <em>DTYPE</em> column. This column contains the class name of the entity. For example, my <em>users</em> table can... | <p>Do you really need to represent the subscription level in the User type? Why don't you add a Subscription type in your system?</p>
<p>The relation would then be expressed as: a User has one Subscription. It could also be modeled as a one-to-many relationship if you wish to keep an history of subscriptions.</p>
<p>... |
TripleDES: Specified key is a known weak key for 'TripleDES' and cannot be used <p>I'm using the .NET 3.0 class <code>System.Security.Cryptography.MACTripleDES</code> class to generate a MAC value. Unfortunately, I am working with a hardware device that uses "<code>1111111111111111</code>" (as hex) as a single-length ... | <p>I wouldn't really recommend it, but you should be able to modify the IL-code that checks for weak keys using <a href="http://sebastien.lebreton.free.fr/reflexil/" rel="nofollow">Reflector</a> and the Add-in <a href="http://www.red-gate.com/products/reflector/" rel="nofollow">ReflexIL</a></p>
<p>edit:</p>
<p>Sorry,... |
Lucene SpanQuery - what is it good for? <p>Can someone explain or provide a link to an explanation of what a SpanQuery is, and what are typical use cases for it?</p>
<p>The <a href="http://lucene.apache.org/java/2%5F4%5F1/api/org/apache/lucene/search/spans/SpanQuery.html">javadoc</a> is very laconic, and keeps mention... | <p>Spans provide a <a href="https://lucene.apache.org/core/4_10_0/core/org/apache/lucene/search/spans/package-summary.html#package_description" rel="nofollow">proximity search</a> feature to Lucene. They are used to find multiple terms near each other, without requiring the terms to appear in a specified order. You can... |
Sandcastle Help File Builder and VS 2008 <p>how to add a sandcastle help file builder project (.shfbproj) to a visual studio 2008 solution?</p>
| <p>Yes, there is a way to create Sandcastle docs inside Visual Studio: <a href="http://www.codeplex.com/DocProject" rel="nofollow">DocProject</a></p>
<p>To quote the project web site:</p>
<blockquote>
<p>DocProject drives the Sandcastle help
generation tools using the power of
Visual Studio 2005/2008 and MSBuil... |
Converting Ruby to C# <p>Need to convert the following code from Ruby to C#. However I'm kind of puzzled by the use of the yield keyword and the general syntax of Ruby. Can anyone that knows a little bit Ruby please help out and convert the code </p>
<pre><code>class < < Cache
STALE_REFRESH = 1
STALE_CREATED = 2... | <p>I don't know C# at all, so anything I say about C# should be taken with a grain of salt. However, I will try to explain what goes on in that piece of Ruby code.</p>
<pre><code>class << Cache
</code></pre>
<p>Ruby has something called <em>singleton methods</em>. These have nothing to do with the Singleton Sof... |
iPhone SDK: How can I determine the last active tab in a TabBarController? <p>One of the tab bar controller tabs in my iPhone app changes what it displays based on where the user arrived from (which other tabs). For example, if the tabs are A, B, C and D, the C tab will display a picture if the user was previously on ... | <p>Instead of subclass <code>UITabBarController</code> you can set a delegate and keep track of the last selected view controller via </p>
<pre><code>- (void)tabBarController:(UITabBarController *)tabBarController
didSelectViewController:(UIViewController *)viewController;
</code></pre>
|
Converting a C++ .exe project to a dll <p>Microsoft provides the source code of vshadow to manipulate VSS (Volume Shadow Service [shadow copy]), and I've modified it a bit but I want to make it into a dll so I can use it in my C# projects. I don't know exactly how to go about doing that, the source code is fairly simpl... | <p>You will need to change your project settings in Visual Studio to create a DLL. In addition you will need to define dll entry points.</p>
<p><strike>However, the VSS is a set of COM API's, so you can call them directly from C# with pinvoke, instead of using this wrapper C++ executable. </strike></p>
<p>Since the S... |
Does it make sense to integrate scripting languages to C# apps? <p>I have been thinking about integrating Ruby into my app, but some of my friends at work told me that C# is already very high level. But to me it seems like it has more baggage for doing very quick things.</p>
<p>What do you guys think?</p>
<p>Also if ... | <p>I've integrated (lua) scripting into applications, and I've also used c# itself as a "scripting language", by compiling dynamic assemblies on-the-fly from code provided by the user. I've also implemented "plug-in" systems using user-provided assemblies that conform to specific interfaces or base classes.</p>
<p>The... |
Linq to SQL - Update a calculated field (like "subtotal") on parent object when child objects change <p>I have a L2S SalesOrder entity with a child set of LineItems. Using winforms, on my Sales Order form I have a datagridview bound to the LineItems and it works like a dream. If the user changes a LineItem quantity (fo... | <p>You might want to check out <a href="http://www.codeplex.com/bindablelinq" rel="nofollow">Bindable LINQ</a>:</p>
<blockquote>
<p>Bindable LINQ is a set of extensions
to LINQ that add data binding and
change propagation capabilities to
standard LINQ queries.</p>
</blockquote>
|
SharePoint deployment failure using VS2008 on the comannd line <p>I am trying to implement a nightly build environment for our SharePoint solution that includes VS 2008 and VS 2008 extensions for Windows SharePoint Services 3.0 (version 1.2).
When I deploy via the VS 2008 GUI it works fine.
When I use the command line... | <p>VSeWSS 1.2 doesn't support command line builds. I would either try the <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=FB9D4B85-DA2A-432E-91FB-D505199C49F6&displaylang=en" rel="nofollow">CTP for VSeWSS 1.3</a> or a community tool like <a href="http://stsdev.codeplex.com/" rel="nofollow">STSDev<... |
How can you change an age-mismatched PDB to match properly? <p>Our nightly build process was broken for a long time, such that it generated PDB files that were a few hours different in age than the corresponding image files. I have since fixed the problem.</p>
<p>However, I would like to start using a symbol server... | <p>the windbg will not modify pdb's age - it only looks it up to match that of executable - the compiler does when it (re)generates executable and debug files.
<p>now, based on the debuginfo.com article, it is not too difficult to arrive at the proper debug directory (of type codeview), match it against PDB7 signature ... |
How can I improve this Rails code? <p>I'm writing a little browser game as a project to learn RoR with and I'm quite new to it.</p>
<p>This is a little method that's called regularly by a cronjob.</p>
<p>I'm guessing there should be some way of adding elements to the potions array and then doing a bulk save at the en... | <p>I'm not sure I'm understanding your question. Are you looking for something like this?</p>
<pre><code>def self.restock_energy_potions
market = find_or_create_market
potions = EnergyPotion.find_all_by_user_id(market.id)
(potions.size...5).each {EnergyPotion.new(:user_id => market.id).save }
end
en... |
Working with jQuery Slider - positions <p>I have been working with the slider and am using the following code:</p>
<pre><code> $(function(){
$('#slider').slider({
animate: true,
step: 1,
min: 0,
max: 10,
orientation: 'vertical',
start: function(event, ui){
$('#current_value').empty();
$('#c... | <p>replace your CHANGE event with SLIDE ... i've asked <a href="http://stackoverflow.com/questions/621147/jquery-ui-slider-cant-slide-to-0">similar question</a> a while ago.</p>
<p>you might want to add STOP event as well ... move your logic from START to SLIDE and STOP</p>
|
Hide mouse cursor after an idle time <p>I want to hide my mouse cursor after an idle time and it will be showed up when I move the mouse. I tried to use a timer but it didn't work well. Can anybody help me? Please!</p>
| <p>If you are using WinForms and will only deploy on Windows machines then it's quite easy to use <a href="http://msdn.microsoft.com/en-us/library/ms646302.aspx"><code>user32 GetLastInputInfo</code></a> to handle both mouse and keyboard idling.</p>
<pre><code>public static class User32Interop
{
public static TimeSpa... |
Best way to reload web assemblies without IISReset <p>What's the best way to reload assemblies after you do a publish to a website and or gac some assemblies.</p>
<p>An easy trick I've learned is to touch the web.config and it reloads the app domain. </p>
<p>What are the best practices related to this?</p>
<p>Is it... | <p>you can run </p>
<blockquote>
<p>iisapp.vbs /a "App Pool Name" /r</p>
</blockquote>
<p>This will restart the app pool and leave the rest of the app pools untouched. No IIS Services are stopped or started.</p>
|
convert sql to linq <pre><code>select m.messageID,m.[addeddate],m.message,count(*) as Comments
from intranet.dbo.Blog_Messages AS m inner join
intranet.dbo.Blog_Comments AS c on c.messageid = m.messageid
group by m.messageID,m.[addeddate],m.message
</code></pre>
<p>need help converting this to linq to sql</p>
| <pre><code>from m in context.Blog_Messages
select new
{
MessageId = m.MessageID,
AddedDate = m.AddedDate,
Message = m.Message,
Comments = m.Blog_Comments.Count()
}
</code></pre>
<p>It isn't a direct conversion, but I think that is what you are after.</p>
|
Using JQuery hover with HTML image map <p>I have a complicated background image with a lot of small regions that need rollover illustration highlights, along with additional text display and associated links for each one. The final illustration stacks several static images with transparency using z-index, and the highl... | <p>You should check out this plugin:</p>
<p><a href="https://github.com/kemayo/maphilight">https://github.com/kemayo/maphilight</a></p>
<p>and the demo:</p>
<p><a href="http://davidlynch.org/js/maphilight/docs/demo_usa.html">http://davidlynch.org/js/maphilight/docs/demo_usa.html</a></p>
<p>if anything, you might be... |
How to determine UIWebView height based on content, within a variable height UITableView? <p>I am trying to create a <code>UITableView</code> with variable height rows as explained in the answer to <a href="http://stackoverflow.com/questions/272584/is-there-a-better-way-to-determine-the-right-size-for-a-uitableviewcell... | <p>This code is probably too slow for table view use, but does the trick. It doesn't look like there's any alternative, as UIWebView offers no direct access to the DOM.</p>
<p>In a view controller's <code>viewDidLoad</code> I load some HTML in a webview and when the load is finished run some javascript to return the e... |
What is a good SQL Server 2008 solution for handling massive writes so that they don't slow down reads for users of the database? <p>We have large SQL Server 2008 databases. Very often we'll have to run massive data imports into the databases that take a couple hours. During that time everyone else's read and small wri... | <p>Paul. There's two parts to your question.</p>
<p><strong>First, why are writes slow?</strong></p>
<p>When you say you have large databases, you may want to clarify that with some numbers. The Microsoft teams have demonstrated multi-terabyte loads in less than an hour, but of course they're using high-end gear and... |
c# sizeof decimal? <p>Unclear on the sizeof for decimal types. Does the size in bytes vary by precision as in sql server? Is the precision variable for the c# type 'decimal'?</p>
<p>I don't want to turn on unsafe code to just call sizeof on a decimal type. How would you approach this?</p>
| <blockquote>
<p>The decimal keyword indicates a 128-bit data type.</p>
</blockquote>
<p>Source: <a href="http://msdn.microsoft.com/en-us/library/364x0z75%28loband%29.aspx">MSDN</a></p>
|
matrix text style in action script <p>I am working in AS3, and I was wondering if anyone knew how to create a matrix effect (the moving green text lines in the movie) in action script. I have found a few examples online, but none of them seem to work.</p>
<p>Thanks.</p>
| <p>There is a great effect with source code:</p>
<p><a href="http://www.bherholz.com/experiments/matrix/" rel="nofollow">http://www.bherholz.com/experiments/matrix/</a></p>
|
Does setting the max memory of a Java program affect the GC? <p>Does adding -Xmx argument when running a Java program cause the garbage collector to act differently or occur less often?</p>
| <p>Yes, most Java garbage collectors only run as needed, as opposed to running on a schedule whether needed or not. So, in general, more memory causes less frequent, longer garbage collections.</p>
<p>The generational garbage collectors have <a href="http://java.sun.com/docs/hotspot/gc5.0/gc%5Ftuning%5F5.html#1.1.Sizi... |
How does For loop work in VB.NET? <p>I though that I know this one... I had no clue.</p>
<p>This simple For loop:</p>
<pre><code>Dim i As Integer
Dim n As Integer = 10
Dim s As Integer = 1
For i = 0 To n Step s
Console.WriteLine(i)
Next
</code></pre>
<p>compiles into this (I put it through Refelctor, so it's ea... | <p>Probably because it's the "generic way" to cover all cases. Remember that for/step/next can go in any direction with any sign on the increment.</p>
<p>You used parameters on both the increment and the end-bound. The compiler has no way to know if you are going to count up or down, and if th end-bound is higher or l... |
ASPX That Returns An Image - Output Cache-able? <p>Greetings!</p>
<p>I've created an APSX web form that returns a remote image based on some supplied parameters. It can be used like this:</p>
<pre><code><img src="/ImageGetter.aspx?param1=abc&param2=123" />
</code></pre>
<p>ImageGetter.aspx's markup and co... | <p>Try dropping the Response.End() as this will terminate the thread prematurely and prevent output caching from taking place.</p>
<p>See: <a href="http://bytes.com/groups/net-asp/323363-cache-varybyparam-doesnt-work">http://bytes.com/groups/net-asp/323363-cache-varybyparam-doesnt-work</a></p>
<p>You <i>may</i> wish ... |
Gem Loading Error, installed from Github <p><strong>Update</strong>: This gem DOES install with sudo rake gems:install. The problem is with loading. For instance, when I run script/console, it throws:</p>
<pre><code>no such file to load -- outoftime-noaa ...
</code></pre>
<p>Even though sudo rake gems:install just... | <p>Try </p>
<pre><code>config.gem "outoftime-noaa", :lib => "noaa", :source => "http://gems.github.com"
</code></pre>
<p>Most github gems need the lib specified. </p>
|
Installing Exuberant Ctags on Windows (Vista and XP) <p>I want to use Exuberant Ctags on Vista (and probably the XP laptop) at work; no choice about the OS. I'm use GVim instead of the Flex Builder recommended by my co-worker, because the FB is buggy and doesn't do what GVim does, anyway. I got the zip file <a href="ht... | <p>The exuberant ctags binary is pre-built and available for download at <a href="http://ctags.sourceforge.net/">http://ctags.sourceforge.net/</a></p>
<ol>
<li>Unzip the file contents to somewhere like C:\Program Files\ctags</li>
<li>Then add the ctags.exe path to your PATH environment variable.
<ol>
<li>In XP, right ... |
How do you escape a file system path for the iPhone? <p>Is there a system library for escaping a file system path for iPhone development? I have to read and write files where the file name is based on 3rd party values so I want to make sure the paths I'm actually writing to are nice and safe.</p>
<p>I would have thoug... | <p>You can try NSString's <code>- (NSString *)stringByStandardizingPath</code></p>
|
semantic markup for Python's difflib.HtmlDiff <p>It appears Python's <code>difflib.HtmlDiff</code>, rather than using <code>INS</code> and <code>DEL</code>, uses <code>SPAN</code> elements with custom classes:</p>
<pre><code>python -c 'import difflib; txt1 = "lorem ipsum\ndolor sit amet".splitlines(); txt2 = "lorem fo... | <p><a href="http://www.aaronsw.com/2002/diff/" rel="nofollow">This script</a> by Aaron Swartz uses difflib to output <code>ins</code>/<code>del</code>.</p>
|
How to disable subsampling with .NET / GDI+? <p>I am trying to save a JPEG image using the Bitmap class. I noticed that sharp edges were always blury regardless of the quality level that I specify. I figured out that it is due to subsampling of one or more of the channels. How do I disable subsampling when saving the i... | <p>JPEG is an image format which uses <a href="http://en.wikipedia.org/wiki/Lossy%5Fcompression" rel="nofollow">lossy compression</a>. It will cause degredation of your image, no matter what quality setting you choose. </p>
<p>Try using a better format for this, such as .PNG. Since .PNG files use a lossless compres... |
How can you make a recursive symlink for folders/files in Ubuntu? <p><strong>My folder Structure</strong></p>
<pre><code>/UNIX
/Find
/Grep
/Find-Grep
</code></pre>
<p>I made a symlink to the UNIX folders unsuccessfully by</p>
<pre><code>ln -s /I/Unix path/Dropbox/myFriend
</code></pre>
<p>I removed a .t... | <p>I was going to suggest remounting the directory bind,ro</p>
<pre><code>mount -o bind,ro /I/Unix /Dropbox/myFriend
</code></pre>
<p>but it seems that functionality isn't in the kernel yet. Might be in yours, but not in my ubuntu box. So, alternately (instead of changing the permissions on all of your files) you co... |
In explicit LINQ-to-SQL (C#) does order matter? <p>I know Linq-to-SQL is dead, but anyway, I think this is really basic, I'm just confused about what magic Linq-to-SQL does and doesn't do with regards to the SQL it generates.</p>
<p>If I have built up an Expression tree as "myPredicate", and have something like this:<... | <p>You've got the same query there, LINQ to SQL won't evaluate and generate the T-SQL until after you've done something to execute the query (such as a .ToList() for example. The ordering doesn't matter. </p>
<p>In fact, you can even add OrderBy and Where clauses after the assignment of the initial query.</p>
<p>e.... |
Reasons why PHP mail might not be working <p>I'm using the PHP <code>mail()</code> function to send email from a contact form. The function returns <code>true</code> so should be fine. But I'm not receiving the email.</p>
<p>I've seen posts that say you should always use the <em>From</em> and <em>Reply-To</em> headers... | <p>If you are on windows you will need to install an SMTP server.</p>
<p>If you are on linux you will need to enable sendmail and ensure the user account PHP is installed on has access to the sendmail binary.</p>
<p>Ask your host if your account has sufficient permissions to access the binary.</p>
<p>Posting your co... |
What's the fastest way to select a large amount of checkboxes and de/select them? <p>Since I use jQuery 1.3+ all except one timed test is using that. The other is plain javascript I found from back in 2000. I stopped going that route as it was taking around 150 seconds to run the test. I've read quite a few jQuery o... | <p><strong>input[name=chkbox]</strong> is coming in as the fastest jQuery selector on my machine under IE7.</p>
<pre><code>Unchecking Took 2453ms
Checking Took 2438ms
Unchecking Took 2438ms
Checking Took 2437ms
Unchecking Took 2453ms
Checking Took 2438ms
</code></pre>
<p><strong>input.chkbox</strong> and...</p>
<pre... |
Does Scaleform now support AS3? <p>Does Scaleform now support AS3?</p>
| <p>Supposedly they're working on AS3 now and will have it available by the end of the year. They also claim to be optimizing the rendering engine to fully support Flash 9/10 effects in hardware, which will be super cool.</p>
<p>Their new CLIK Flash UI components were made by the same guy that made Adobe's Flash 9 com... |
Firefox plugin to capture signature (via stylus/tablet) <p>I am wondering if anyone has any experience capturing signatures with a tablet/stylus over the internet.<br />
How would you write a plug-in that uses an ActiveX control and can securely post the signature over the web?</p>
<p>Or maybe you've got a better idea... | <p>I would somehow use flash that would draw to a bitmap, then encode them as an image then upload them to your server.</p>
<p>After a few minutes of googling, i found this.</p>
<p><a href="http://www.kirupa.com/developer/actionscript/drawingboard.htm" rel="nofollow">http://www.kirupa.com/developer/actionscript/drawi... |
Iterating through a list of commands in a file in Shell Programming <p>I have a file containing a list of unix commands like "ls -la /etc/passwd". I want to iterate through this list of commands, and take appropriate action. </p>
<p>Currently, my code is something like:</p>
<pre><code>#!/bin/bash
clear
for cmds in `c... | <p>Add this before your for loop:</p>
<pre><code>IFS='
'
</code></pre>
<p>Or in Bash:</p>
<pre><code>IFS=$'\n'
</code></pre>
<p><a href="http://www.gnu.org/software/bash/manual/bashref.html#Bourne-Shell-Variables" rel="nofollow"><code>IFS</code></a> contains a list of characters which are used to split input into f... |
Does each authenticated WCF client connection need a CAL? <p>Just like the title says. Does each authenticated WCF client connection to a WCF server that you have developed need a windows CAL?</p>
<p><a href="http://www.microsoft.com/windowsserver2008/en/us/client-licensing.aspx" rel="nofollow">http://www.microsoft.c... | <p><strong>Yes</strong>, the answer is, you need a CAL or an external connector. If you have client systems or apps that access Windows Servers in an authenticated manner, then the clients need to be authorized either via a user-specific CAL, a device-specific CAL, or an external connector. </p>
<p>The CAL is appropr... |
Issues with C++ 'new' operator? <p>I've recently come across <a href="http://www.scs.stanford.edu/~dm/home/papers/c++-new.html" rel="nofollow">this rant</a>.</p>
<p>I don't quite understand a few of the points mentioned in the article:</p>
<ul>
<li>The author mentions the small annoyance of <code>delete</code> vs <co... | <p>Well, the <em>ideal</em> would probably be to not need delete of any kind. Have a garbage-collected environment, let the programmer avoid the whole problem.</p>
<p>The complaints in the rant seem to come down to</p>
<ol>
<li>"I liked the way malloc does it"</li>
<li>"I don't like being forced to explicitly create... |
Realistic usage of the C99 'restrict' keyword? <p>I was browsing through some documentation and questions/answers and saw it mentioned. I read a brief description, stating that it would be basically a promise from the programmer that the pointer won't be used to point somewhere else. </p>
<p>Can anyone offer some real... | <p><code>restrict</code> says that the pointer is the only thing that accesses the underlying object. It eliminates the potential for pointer aliasing, enabling better optimization by the compiler.</p>
<p>For instance, suppose I have a machine with specialized instructions that can multiply vectors of numbers in memo... |
How do I bind to a List<T> using DataContext? <p>I'm self-learning C#, OOP, and WPF so the potential for stuff ups is staggering.</p>
<p>So given that, can someone please explain why after clicking the button in my tiny test example the Name property appears in the TextBox but the ListBox shows nothing?</p>
<h2><stro... | <p>Part of me wonders whether it's something to do with the fact that "MyIntegers" is a public field rather than a property. Can you refactor you class to look like this and try it?</p>
<pre><code>public class AClass
{
private List<int> _ints = new List<int>();
public string Name { get; set; }
... |
C - GLFW window doesn't open on Debian <p>I'm trying to get started with GLFW on Debian, I've tried compiling and running an example program but it refuses to run. With the help of a couple of printf statements I've found that when the program tries to open a GLFW window it fails, then exits - but I don't know why. Any... | <p>You're sure it's glfwOpenWindow that's failing? I don't know why that might be, perhaps you're using too many bits for your z-buffer? That's the only thing I can think of. </p>
<p>Try this</p>
<pre><code>GLFWvidmode dvm;
glfwGetDesktopMode(&dvm);
glfwOpenWindow(winWidth, winHeight, dvm.RedBits, dvm.GreenBits,... |
ASP.NET: Scroll to control <p>I've got a particularly large form in an page. When the form is validated and a field is invalid, I want to scroll the window to that control. Calling the control's Focus() doesn't seem to do this. I've found a JavaScript workaround to scroll the window to the control, but is there anythin... | <p>Are you using a Validation Summary on your page?</p>
<p>If so, ASP.NET <a href="http://stackoverflow.com/questions/699171/asp-net-validation-summary-causes-page-to-jump-to-top">renders some javascript to automatically scroll to the top of the page</a> which may well override the automatic behaviour of the client si... |
Undo SVN delete ./* --force <p>I didn't realize <code>svn delete</code> would delete my local copy, I just wanted it out of the repository. Now all my files are gone, and they aren't in the trash bin either. Is there any way I can recover them?</p>
<hr>
<p>I should clarify, these files <em>never</em> made it into th... | <p><strong>Nope.</strong></p>
<p>Not unless they're still in use by some other application, sorry.</p>
|
Silverlight 3: ListBox DataTemplate HorizontalAlignment <p>I have a ListBox with it's ItemTemplate bound to a DataTemplate. My problem is I cannot get the elements in the template to stretch to the full width of the ListBox.</p>
<pre><code><ListBox x:Name="listPeople" VerticalAlignment="Stretch" HorizontalAlignment... | <p>I spent an hour trying to resolve this one. Very very frustrasting. You <strong>don't</strong> have to override the entire default style for the ListBoxItem. I couldn't get this to work. In the end I resolved the issue by simply overriding just the <strong>HorizontalContentAlignment</strong> property in my <stro... |
How to add these object with name to the array by this order? <p>I have some object with name , just like <code>button 1 , button 2 , button 11 ,button 111</code> , I want to add this object to a array by this order: <code>button 1 ,button 2 , button 11 , button 111</code> ,but I found that these object can add the arr... | <p>Use <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString%5FClass/Reference/NSString.html#//apple%5Fref/doc/c%5Fref/NSNumericSearch" rel="nofollow">the <code>NSNumericSearch</code> option</a> in your sort comparison.</p>
|
Copy constructors - c++ <p>Can I write a copy constructor by just passing in a pointer instead of the const reference? (Would it be ok if I make sure that I am not going to change any values though?)</p>
<p>Like so:</p>
<pre><code>SampleClass::SampleClass(SampleClass* p)
{
//do the necessary copy functionality
}
<... | <p>Yes, you can write a constructor that takes a pointer to the object. However, it cannot be called a copy constructor. The very <em>definition</em> of a copy constructor requires you to pass an object of the same class. If you are passing anything else, yes, it's a constructor alright, but not a copy constructor.</p>... |
Where do I save partial (views) in Zend Framework, to be accessible for all Views in my App? <p>I have several view Partials (like paginator partial) which I want them to be available
To all view scripts in my application.<br />
Is there a directory I can put partial vies in, and they will be available to all?<br />
Or... | <p>You can create a folder in the views folder with any name and from your views you would call a partial using the following code and as the second argument pass an array of values which would be used within the partial.</p>
<pre><code>$this->partial('your-partial-dir/your-partial.phtml', array('var'=>$myVar));... |
Is ruby on rails plugin, acts_as_ferret, very buggy? <p>I am doing a very simple search on my DB using acts_as_ferret. I put this in my "Venue" model:</p>
<pre><code>acts_as_ferret :fields => [:name, :city]
</code></pre>
<p>And this is in my controller search action:</p>
<pre><code>@t = Venue.find_by_contents(pa... | <p>Yes, Ferret has been very well known for corrupting indexes.</p>
<p>I recommend switching over to another searching plugin like <a href="http://ts.freelancing-gods.com/" rel="nofollow">Thinking Sphinx</a>. You can <a href="http://railscasts.com/episodes/120-thinking-sphinx" rel="nofollow">watch the Railscast about ... |
How to overcome same type in two namespaces, System.Linq.Expressions.Expression<TDelegate>? <p>I am defining some Expression variables in my app and need to have a reference to Microsoft.Scripting.Core. That assembly includes the same namespace as the System.Core assembly from the main .Net framework.</p>
<p>I want to... | <p>If they are the same namespace but different assemblies, then you may need to look at "extern alias", but that gets very messy very quickly.</p>
<p>If they are different namespaces, then simply use different <code>using</code> directives; you can also use <code>using</code> aliasing. However, lambdas will always (A... |
Filtering fiddler to only capture requests for a certain domain <p>I'm not sure how to modify the CustomRules.js file to only show requests for a certain domain.</p>
<p>Does anyone know how to accomplish this?</p>
| <p>This is easy to do.
On the filters tab, click "show only if the filter contains, and then key in your domain.</p>
<p><img src="http://i.stack.imgur.com/HRoUS.png" alt="enter image description here"></p>
|
Data Binding Is More Complicated Than I'd Like <p>I have a form that will be populated by a bunch of information from a template, and then handed over to the user to fill out the rest. The thing is, the template and the object that holds the eventual result are DataRows, because it's all going into and out of a databas... | <p>I expect that for that to work, you'd need to use a <code>DataRowView</code>, not a <code>DataRow</code>; try getting this from the <code>DataView</code> rather than the <code>DataTable</code>. The default view is <code>table.DefaultView</code>.</p>
<p>For info; the reason it works when you use a <code>DataTable</c... |
How to lose margin/padding in UITextView? <p>I have a <code>UITextView</code> in my iOS Application, which displays a large amount of text. I am then paging this text by using the offset margin parameter of the <code>UITextView</code>. My problem is that the padding of the <code>UITextView</code> is confusing my calcul... | <p>For iOS 7.0, I've found that the contentInset trick no longer works. This is the code I used to get rid of the margin/padding in iOS 7.</p>
<p>This brings the left edge of the text to the left edge of the container:</p>
<pre><code>self.textView.textContainer.lineFragmentPadding = 0;
</code></pre>
<p>This causes t... |
I have 15 minutes to present ASP.NET MVC to my colleagues. What topics should I focus on? <p>I've been using ASP.NET MVC for personal projects since before it hit RTM.</p>
<p>I am preparing a presentation for my colleagues to introduce them to basic concepts of ASP.NET MVC and show them how it could be used in our env... | <p>You only have time for 2 or 3 main points.</p>
<p>The most important concept to grasp is that requests arrive at controllers then the controller <strong>chooses</strong> what view to present the results the <strong>controller</strong> has generated.</p>
<p>The next important concept is that MVC has its big win ove... |
jQuery UI, sortables and Cookie plugin with multiple lists <p>I'm using jQuery UI sortable plugin with the cookie plugin to set and get the list of two sortable lists.</p>
<p>I found this piece of code to set and get a cookie: <a href="http://www.shopdev.co.uk/blog/sortable-lists-using-jquery-ui/#comment-6441" rel="no... | <p>_http://code.google.com/p/cookies/</p>
<p>_http://noteskeeper.ru/article/save-state-jquery-ui-sortable/</p>
<pre><code> root = $("#sidebar");
$('> *', root).each(function (index) {
this.id = 'block-' + index;
});
root.sortable({
cursor: 'move',
revert: true,
placeholder:... |
FormsAuthentication.RedirectFromLoginPage is not working <p>I am working on a LoginPage.Everything related to database or C# code is working fine but after successul login I am unable to redirect to Home.aspx,am I missing Something? Pls help.
<strong>Code:</strong></p>
<p><strong>Web.Config:</strong></p>
<p>
... | <p>It should be <code><deny users="?"/></code></p>
<pre><code>* means all
? means unauthenticated
</code></pre>
|
Asp .Net File Caching <p>is any way to cache a whole folder with resources in ASP.NET without write own HttpModule?
e.g.: folder with Wysiwyg editor javascript and styles</p>
| <p>The purpose of ASP.NET caching is so that the requests no longer need to be processed in full, meaning that the database doesn't have to be queried, the content doesn't have to be produced, templates instantiated, event handlers called, and so forth.</p>
<p>Caching static objects this way yields no performance impr... |
Exporting Data Or Code To A .png <p>How Do you Export Code To A .png In Order To Make It Animated?
I Am Using VB.Net 2008 Express Edition.</p>
| <p>Create a page like "myimage.aspx" and in the codebehind (sorry, this is C#)</p>
<pre><code>Bitmap bmp = new Bitmap(width, height);
Graphics gfx = Graphics.FromImage(bmp);
gfx.FillRectangle(Brushes.White, 0, 0, bmp.Width, bmp.Height);
</code></pre>
<p>Use the gfx to draw on the image (see it's methods).
Then return... |
Getting number of certain days-of-the-week (weekend) from interval in PostgreSQL <p>Given 2 timestamps in postgres, how do you calculate the time difference without counting whole Saturdays and Sundays?</p>
<p>OR</p>
<p>How do you count the number of Saturdays and Sundays in a given time interval?</p>
| <p>The following function is returning the number of full weekend days between two dates. As you need full days, you can cast the timestamps to dates before calling the function. It returns 0 in case the first date is not strictly before the second.</p>
<pre><code>CREATE FUNCTION count_full_weekend_days(date, date)
... |
Bluetooth obex reception on 3rd edition device fails <p>I have got a mix of 2nd edition and 3rd edition s60 phones. I start custom obex listener on both phones using Python and try to send files to them. Though I can send files to 2nd edition phone; I can't send files to 3rd edition phone and the error being "Broken pi... | <p>At least in Symbian C++ SDK the API of Bluetooth was changed between 2nd to 3rd edition phones.
It probably affects also Python.</p>
|
How to manage process for single man project <p>We have a single developer working on 3 different projects. He used to work on bug fixes, maintenance and few feature implementation. In one specific project, he works with one more junior developer.</p>
<p>Our company wants to implement scrum for all the projects.. What... | <p>I agree it should be kept Simple Stupid, but most of the Scrum framework can be used here.</p>
<p>I had several people working in this fashion both on projects as well as on maintenance/operational work. </p>
<p>Product Owner/Backlog - There's still an owner thats in charge of defining the business value and prior... |
Accessing links from JS in a WebBrowser object <p>I need to automate some tasks on a website that does not have an API, and uses a substantial amount of JavaScript, without any graceful fall-back, so is it possible to parse over content added to a page via JS, with C#, I assumed that this would be done with a WebBrowse... | <p>Try <a href="http://sourceforge.net/projects/ulti-swat" rel="nofollow">SWAT</a> or <a href="http://watin.sourceforge.net/" rel="nofollow">WatiN</a></p>
<p>Both are unit testing frameworks for automating web site front end testing, but can easily be used to traverse the DOM on a website as you want to do.</p>
|
Accessing a WPF GroupItem text for conversion in a template <p>I'm customising the appearance of grouping in a <code>ListBox</code>. In <code>ListBox.Resources</code>, I have declared something like (formatting removed):</p>
<pre><code><Style TargetType="{x:Type GroupItem}">
<Setter Property="Template">... | <p>Well isn't that just typical. I found the answer shortly after posting...</p>
<pre><code><TextBlock Text="{Binding Path=Content.Name,
RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=GroupItem},
Converter={StaticResource MyConverter}}"/>
</code></pre>
<p>Sometimes just the process of actua... |
What's wrong with calling Invoke, regardless of InvokeRequired? <p>I've seen the common setup for cross threading access to a GUI control, such as discussed here:
<a href="http://stackoverflow.com/questions/571706/shortest-way-to-write-a-thread-safe-access-method-to-a-windows-forms-control">http://stackoverflow.com/que... | <p>From non-UI threads we can't touch the UI - very bad things can happen, since controls have thread affinity. So from a non-UI thread we must (at a minumum) call <code>Invoke</code> or <code>BeginInvoke</code>.</p>
<p>For UI-threads, however - we <em>don't</em> want to call <code>Invoke</code> lots of time; the issu... |
Rails validation and 'fieldWithErrors' wrapping select tags <p>Is it normal behaviour to not get the <code><div class="fieldWithErrors"></code> wrapped arround select tags that have validation errors? I personally see no reason why the select tags should be treated differently than other form tags (input, textare... | <p>The problem (for me at least) was that my <code>f.select :whatever_id</code> was looking in the <code>object.errors</code> object for a key of <code>:whatever_id</code> when my validation was actually on <code>:whatever</code>, not <code>:whatever_id</code>.</p>
<p>I worked around this annoying problem by changing<... |
Debugging on Linux for Windows Developer <p>Primarily I've done basic (novice level) software development on a Windows machine, but I've always had MS Visual Studio to help me step through the process of debugging. </p>
<p>Now, however, it looks like I will be on Linux, so in order to get ready for the jump I want to... | <blockquote>
<p>Good question, of course, but its been
done before:</p>
<ul>
<li><a href="http://stackoverflow.com/questions/408418/what-editor-ide-do-you-use-for-c-programming-on-linux-and-why-closed">http://stackoverflow.com/questions/408418/what-editor-ide-do-you-use-for-c-programming-on-linux-and-why-clo... |
Differences between JVM implementations <p>Where do JVM Implementations differ (except licensing)?
Does every JVM implement Type Erasure for the Generic handling?</p>
<p>Where are the differences between:</p>
<ul>
<li>JRockit</li>
<li>IBM JVM</li>
<li>SUN JVM</li>
<li>Open JDK</li>
<li>Blackdown </li>
<li>Kaffe</li>
... | <p>JVM implementations can differ in the way they implement JIT compiling, optimizations, garbage collection, platforms supported, version of Java supported, etc. They all must meet set of features and behaviors so that it will execute your Java bytecodes correctly.</p>
<p>As you've pointed out, the major difference ... |
Refer to other SQL SELECT statements aliased as tables in FROM clause <p>I have a very large query that follows the format below:</p>
<pre><code>select ...
from ( select field1,
field2
from some_table ) table1,
( select field1,
field3
from other_table ) ta... | <pre><code>WITH
table1 AS
(
SELECT field1, field2
FROM some_table
),
table2 AS
(
SELECT field1, field2
FROM other_table, table1
)
SELECT *
FROM table2
</code></pre>
|
TypeDef as an overridable class feature <p>If I have a class that contains a number of <code>typedef</code>'d variables, like so:</p>
<pre><code>class X {
typedef token TokenType;
bool doStuff()
{
TokenType data;
fillData(&data);
return true;
}
};
</code></pre>
<p>Is there any way to override the <code>typedef... | <p>What you can do is shadow, but not override. That is: you can define a derived class Y with its own typedefs for TokenType, but that will only come into play if somebody references Y::TokenType directly or via an object statically typed as Y. Any code that references X::TokenType statically will do so even for objec... |
Building an API library package? <p>What do you guys use to build package (zip library, documentation example) of some API written in .NET? Right now I do it manually, building in vs , sandcastle and then zipping it together...</p>
| <p>I use <a href="http://nant.sourceforge.net" rel="nofollow">Nant</a> as a build tool, not only for libraries, but also for executables (installer and stuff).</p>
<p>Others use batch files as post-build events in Visual Studio (in a special configuration so that is not built every time you comile).</p>
|
What is the meaning of numeric_limits<double>::digits10 <p>What is the precise meaning of numeric_limits::digits10?
Some other related questions in stackoverflow made me think it is the maximum precision of a double, but </p>
<ul>
<li>The following prototype starts working (sucess is true) when precision is greater th... | <p><code>numeric_limits::digits10</code> is the number of decimal digits that can be held without loss.</p>
<p>For example <code>numeric_limits<unsigned char>::digits10</code> is 2. This means that an unsigned char can hold 0..99 without loss. <strong><em>If</em></strong> it were 3 it could hold 0..999, but as w... |
selecting a log file <p>We have multiple log files like database log, weblog, quartzlog in our application.</p>
<p>Any log from files under package /app/database will go to database log.
Any log from files under package /app/offline will go to quartzlog log.</p>
<p>What we need now is - want to direct the log stament... | <p>You need to define the appropriate appender that logs in the desired file. Read <a href="http://logging.apache.org/log4j/1.2/manual.html" rel="nofollow">this short introduction</a> to see how you can do it.</p>
<p>Then in the configuration file, you can instruct all messages from a specific package to go in the sel... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.