input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
What is the CS definition of a Php Array? <p>From a strictly implementation and computer science point of view how would you classify the Php array datastructure? Is it an associative array? a hash? a dictionary? ... ?</p>
| <p>From the <a href="http://uk3.php.net/manual/en/language.types.array.php" rel="nofollow">PHP manual</a>:</p>
<blockquote>
<p>An array in PHP is actually an ordered
map. A map is a type that associates
values to keys. This type is optimized
for several different uses; it can be
treated as an array, list (ve... |
How to write a code generator given a custom IDL? <p>If you have a simple enough schema with basic boolean string fields, how to go about writing a code generator in C++.
If you ever wrote , how did you start. Articles/recommendation welcome.</p>
<p>EDIT: Note that this is not the standard CORBA idl.</p>
| <p>In summary:</p>
<ol>
<li>Convert something by hand, </li>
<li>copy that output into a string literal and then </li>
<li>generalise with loops and variables instead of fixed names.</li>
</ol>
<p>This is a particularly good problem to tackle with TDD - start by setting up a framework such as CPPUnit (or <a href="htt... |
Can you tell on runtime if you're running java from within a jar? <p>I have an application that some of my users run from Eclipse, and others run it by using a jar file.</p>
<p>I want some actions to be done when running from within the jar, but I don't want them to be done when running from Eclipse.</p>
<p>Is there ... | <p>Well, you can tell whether or not a class has been loaded from a jar - use <code>Foo.class.getResource("Foo.class")</code> and see whether the returned URL begins with "jar:"</p>
<p>For example, take this program:</p>
<p>package com.whatever;</p>
<pre><code>public class Foo
{
public static void main(String[] ... |
What's the best way to pass configuration to application agnostic modules? <p>I am working on an application that consists of several modules which in turn will be used in other applications as well. Each of these modules needs some configuration options, but should not be aware of the options of other modules, and als... | <p>I would probably create a generic configuration class, and have each module depend on one or several concrete configuration classes that are singletons. A module depends on a configuration class instance with settings that are significant for that module only, and optionally on one or more other configuration class ... |
How to hilight a section of a TableView cell as part of the filtering process? <p>The backstory: I am applying a filter to a TableView. It's a simple 'find the rows with this string' filter.</p>
<p>The requirement: I wish to hilight instances of the search term where they occur. </p>
<p>Thus far I can see no means of... | <p>Looks like the <code>highlighting</code> method is for you</p>
<p>Since <a href="http://update.eclipse.org/downloads/drops/S-3.5M4-200812111908/eclipse-news-M4.html" rel="nofollow">3.5M4</a>, the existing owner draw support for JFace TableViewer and TreeViewer has been extended to allow multiple fonts within cells.... |
Video shooting in iPhone <p>Is there a way to capture video from iPhone?</p>
| <p>Officially, no. Its not currently available via Apple, nor do they provide an API.</p>
<p>However if you Jailbreak the phone you can install unofficial applications that will let you do this. Or write your own of course!</p>
|
C# - Calling methods from inside class <p>How do you call a client codes methods from inside a class defined in the client code?</p>
<p>For example, I have a memory reading class, that can read values from the memory of a process at a certain address. I also have classes for managing the type of data that is read from... | <p>How about referencing 'this' in the constructor:-</p>
<pre><code>class ObjectManager : Memory
{
ObjectManager()
{
LocalPlayer = new LocalCharacter(this);
}
LocalCharacter LocalPlayer;
// other things omitted
}
</code></pre>
|
Group Box in WinForms <p>I have a question about design winforms.</p>
<p>Should I use, or not, group boxes in my forms? Is it good to the user? Give me some advantages, or disadvantages?</p>
<p>Some people think thar it's not goog enough to use.</p>
<p>What do you think about it?</p>
| <p>One reason is to group RadioButtons. </p>
<p>For every element you add to your UI you should ask yourself a few questions:</p>
<ul>
<li>Why do I add the element?</li>
<li>Why is it located in this position?</li>
<li>Why is it this color?</li>
<li>Why am I not using a standard control/color/font/...</li>
<li>etc.</... |
Canon Remote SDK Alternative? <p>Is there any Solution from another vendor? (With another Camera?)
Canon does not want to support the SDK anylonger.</p>
<p>The Solution shoul contain live preview, zooming and configurable Flash. A c# interface would be fine. </p>
<p>I know, the WIA interface but it isnt powerful enou... | <p>Have you looked into <a href="http://www.gphoto.org/" rel="nofollow">gphoto2</a>? This only runs under Unix-like systems (Linux, BSD, and probably MacOS), so it may not help under Windows.</p>
|
How can I tell when another process has stopped writing to a file in Perl? <p>I have a system which is writing files to a folder using FTP. I need to copy those files, but only when they FTP system has finished. How do I tell when the first process has finished writing.</p>
| <p>Another possibility is to have the process which uploads the files upload them under a temporary name and then rename them.</p>
<p>Renames happen atomically so there would be no case where the file was incomplete under its final name.</p>
<p>The copying process could ignore the temporary named files.</p>
|
Implementing and using the ICommand interface, MVVM <p>Although I deeply fell in love with the MVVM pattern there seem to be a lot of problems I cannot (yet) figure out for myself.</p>
<p>I wonder what the parameters of the methods of the IComamnd interface are good for</p>
<p>e.g. <code>void Execute(object parameter... | <p>You can add CommandParameter="" to pass a parameter. Usually you'll pass in the binding, or an id that's part of the binding, so the command knows what record to work with.</p>
|
Why is this query returning unwanted results? <p>Good morning,</p>
<p>I have a problem with this query:</p>
<pre><code>SELECT
P.txt_nome AS Pergunta,
IP.nome AS Resposta,
COUNT(*) AS Qtd
FROM
tb_resposta_formulario RF
INNER JOIN formularios F ON
F.id_formulario = RF.id_fo... | <p>The "obvious" answer is: because the query is incorrect. We really know nothing about the table structure and what you're trying to achieve. </p>
<p>Concerning at least one very basic problem in your query: you're expecting the columns <code>|Produto | Região |Qtd|</code> in your response, yet the query unambiguou... |
Easiest way to derive subset array of highest 10 values? <p>In javascript I have an array as follows: </p>
<pre><code>var foo = [2, 2, 4, 4, 128, 2, 2, 1, 4, 18, 27, 16, 2, 1, 18, 21, 5, 1, 128, 1, 2, 2, 1, 18, 12, 60, 2, 28, 1, 17, 2, 3, 4, 2, 2, 2, 1, 27, 2, 17, 7, 2, 2, 2, 5, 1, 2, 4, 7, 1, 2, 1, 1, 1, 2, 1, 5, 7, ... | <p>My previous answer used a reverse index table, but contained some bugs - which are now fixed - and was harder to understand than the following code.</p>
<p>This is actually the slowest of all solutions given in the answers - for maximum performance, check my other answer.</p>
<pre><code>var foo = [2, 2, 4, 4, 128,... |
How to mount from command line like the Nautilus does? <p>On my Ubuntu linux box I can easily mount USB connected drives or CDROM clicking on devices icons that I can found on the Desktop.</p>
<p>For example if I click on a USB connected drive icon the following things happen:</p>
<ul>
<li>a /media/LABEL directory is... | <p>i guess what you are looking for is "gfvs-mount" (it recently replaced the "gnome-mount" most people talk about; both gnome-mount and pmount rely on HAL which is being phased out).</p>
<p>there's no man page so just type "gvfs-mount --help" for the details, or read here: <a href="http://omegamormegil.wordpress.com/... |
YUV/PCM Visualizer to measure Lip Sync <p>I have a two dump files of raw video and raw audio from an encoder and I want to be able to measure the "Lip-sync". Imagine a video of a hammer striking an anvil. I want to go frame by frame and see that when the hammer finally hits the anvil, there is a spike in amplitude on t... | <p>If you are concerned about validating a decoder then generally from a validation perspective the goal is to check Audio and Video PTS values against a common real time clock.</p>
<p>Raw YUV and PCM files do not include timestamps. <strong>If</strong> you know the frame-rate and sample-rate you can use a raw yuv fil... |
When should I opt for IsolatedStorage versus AppData file storage? <p>I've recently discovered the <code>IsolatedStorage</code> facilities in .net, and I'm wondering when I should use them for my application data versus when I should use (e.g.) <code>Application.LocalUserAppDataPath</code>.</p>
<p>One thing that I've ... | <p>IsolatedStorage has a couple interesting features that might make you opt for it: </p>
<ul>
<li><p>Even very low trusted applications (such as click-once) can access isolated storage. Not all applications can have access to AppData. Depending on the security policy imposed on the application, IsolatedStorage can al... |
How to calculate permutations in linear time, with a twist <p>I have a resource scheduling issue in Java where things need to be sequenced, but there are restrictions on what resources can be next to each other. A good analogy is a string of "digits", where only certain digits can be next to each other. My solution w... | <p>If you just want the number of strings of a certain length, you could just multiply the compatibility matrix with itself a few times, and sum it's values.</p>
<blockquote>
<p><em>n</em> = <em>length of string</em><br>
<em>A</em> = <em>compatibility matrix</em><br>
<em>number of possible strings</em> = sum of ... |
Examples of using F# to query Entity Framework <p>I'm looking all over Google to find an example or tutorial about using F# to query an Entity data source.</p>
<p>Honestly I haven't found much. Have any of you had any luck ? </p>
| <p>The following is an example I was able to pieces together from what i found on this <a href="http://bloggemdano.blogspot.com/2008/11/linq-to-sql-in-f.html">blog</a></p>
<pre><code>open Microsoft.FSharp.Linq.QuotationEvaluation
open Microsoft.FSharp.Linq
let IsPermited (serviceName:string) =
//Instantiate the Ent... |
Oracle9i: Filter Expression Fails to Exclude Data at Runtime <p>I have a relatively simple select statement in a VB6 program that I have to maintain. (Suppress your natural tendency to shudder; I inherited the thing, I didn't write it.)</p>
<p>The statement is straightforward (reformatted for clarity):</p>
<pre><code... | <p>Some random ideas:</p>
<ul>
<li><p>Are you sure you committed the changes that invalidate the ip-address? Can someone else (using another db connection / user) see the changed code_status?</p></li>
<li><p>Are you sure that the results are not modified after they are returned from the database?</p></li>
<li><p>Are y... |
getting a property of a java bean of unknown class <p>I'd like to be able to call "getProgram" on objects which have that method, without knowing which class they belong to. I know I should use an interface here, but I'm working with someone else's code and can't redesign the classes I'm working with. I thought BeanUti... | <p>Use PropertyUtils (from apache commons-beanutils) instead of BeanUtils.</p>
<p>It has a getProperty(Object bean, String name) method that returns an Object instead of a String.</p>
<p>See the <a href="http://commons.apache.org/beanutils/api/org/apache/commons/beanutils/PropertyUtils.html">JavaDoc</a> for more info... |
Swapping two rows in MS SQLServer retaining the original primary key and without manual update <p>I have the following problem : I have rows like </p>
<pre><code>ID CODE NAME .........
1 h1100h1 Cool example1 .........
2 h654441 Another cool1 .........
</code></pre>
<p>I would like to swa... | <p>I haven't tested this, but I think it will work. I'm assuming that id is a single-column Primary Key. If that's not the case then you will need to adjust this code slightly to handle the PK.</p>
<pre><code>UPDATE
T1
SET
column_1 = T2.column_1,
column_2 = T2.column_2,
...
FROM
dbo.My_Table T... |
Why is System.Object not abstract in .NET? <p>I know it is commonly used as a lock object, but is that really sufficient reason?
What is the meaning of</p>
<pre><code>object o = new object();
</code></pre>
<p>An non-abstract class is something that represents actual objects. "asdasdf" is a string. What actual instanc... | <p>The easiest way to answer that question is to ask another one: is there any reason for the Object class to be abstract? Since there is no reason for it to be abstract, it's not.</p>
|
Is it possible to achieve the "Aero Glass" look on XP? <p>Does anyone know any kind of framework that enables (not exactly the same, but) Vista's Aero Glass on XP?</p>
<p>I need to develop a little desktop application with WPF, which has a Vista-like UI on XP. I don't need exactly the Aero Glass, some UI like "Windows... | <p>If you really mean Aero <strong>Glass</strong> then I think you're out of luck. The hardware acceleration required to create this effect is only supported via Vista's new DWM (Desktop Window Manager), which works by compositing multiple windows together into one rendered layer. </p>
<p>If you just want transparency... |
getting the list of all functions executed like call stack in asp.net <p>I am having trouble with debugging one of the problems that I am having in our website. This is the problem. I have a webpage that contains the photo of an employee and information related to the employee. When the user logins to our website, we a... | <p>There's no built-in facility in .NET to list all functions called, although you can print the call-stack at a specific point (like exceptions do).</p>
<p>I'd suggest looking for a code-coverage profiler if this is the route you want to take. </p>
|
calling methods on an instance with getattr [ python ] <p>I was trying to write some code that would check if an item has some attributes , and to call them . I tried to do that with getattr , but the modifications wouldn't be permanent . I made a "dummy" class to check upon this .
Here is the code I used for the class... | <p>You need to do something like</p>
<pre><code>class X:
def __init__(self):
self._value = 90
def _get(self):
return self._value
def _set(self, value):
self._value = value
value = property(_get, _set)
</code></pre>
<p>Note that the "interna... |
how to select only the background in jQuery <p>I would like to add two events to my items.</p>
<p>One for the "background" of the document: <code>$(document).click(function() {do()});</code></p>
<p>One for the divs in the document: <code>$("div").click(function() {do2()});</code></p>
<p>The problem is that when I cl... | <p>The terms you're looking for here are Event Propagation or Event Bubbling.</p>
<p>The event handling in "modern" browsers (which is the model most libraries hook into) works by bubbling up the document tree. What that means is if you have html document structure like this</p>
<pre><code><body>
<div>
... |
Linux Socket Buffer Imbalance <p>I have a simple scenario, where two servers are connected through a gigabit link.
I run iperf on both sides to measure the throughput.</p>
<p>What surprises me, whenever I run the traffic bidirectionally, it always favor one side only (eg. ~900Mbps vs. ~100Mbps). If I run the traffic u... | <p>Suggestions:</p>
<ul>
<li>Take a look at the actual settings on your Ethernet interfaces. "ethtool" is one way to get a thorough look. "ifconfig" tells you something, though less. (Both probably in /usr/sbin/.) Finding kernel messages with "dmesg" might tell you something. Looking at link error rates might rev... |
UpdatePanelAnimationExtender: No animation when certain button clicked <p>I have a GridView inside an UpdatePanel that is populated when a search is performed on the page. When it is populated or the page changed, it performs a fade animation. There are other operations that I want to perform that update the UpdatePane... | <p>Nick,</p>
<p>Is it possbile to consider using JQuery to do the animations? May give you more control on the elements than just the use of the UpdatePanelAnimationExtender.</p>
<p><a href="http://jquery.com/" rel="nofollow">http://jquery.com/</a></p>
<p><a href="http://docs.jquery.com/UI/Effects" rel="nofollow">h... |
Facebook authorization problem <p>I'm working on a facebook app and there's something I'm just not understanding about how their authorization system works.</p>
<p>Our basic setup is this</p>
<p>canvas URL = domain.com/facebook</p>
<p>This is a simple page with an FBML Iframe element that points to domain.com/facebo... | <p>Ok, I figured it out.</p>
<p>As it turns out, Flash already follows the redirects - all I needed to do was detect (at the canvas URL) when there was an authorization request (noted by the presence of <strong>auth_token</strong> and <strong>next</strong>) and <em>include</em> the auth_token as a GET parameter when I... |
Editing shortcut (.lnk) properties with Powershell <p>I've found a nasty VBS way to do this, but I'm looking for a native PoSh procedure to edit the properties of a .LNK file. The goal is to reach out to remote machines, duplicate an existing shortcut with most of the correct properties, and edit a couple of them.</p>... | <pre><code>Copy-Item $sourcepath $destination ## Get the lnk we want to use as a template
$shell = New-Object -COM WScript.Shell
$shortcut = $shell.CreateShortcut($destination) ## Open the lnk
$shortcut.TargetPath = "C:\path\to\new\exe.exe" ## Make changes
$shortcut.Description = "Our new link" ## This is the "Comm... |
Discrimanant taskkill.exe for excel.exe <p>I have to run Excel on a server and to kill the excel.exe process I am using taskkill.exe:</p>
<p>System.Diagnostics.Process.Start("taskkill.exe", "-im excel.exe /f");</p>
<p>My only problem is that if there is someone who is also using the server who is working on excel (It... | <p>Keep track of the PID of the processes you launch and kill them with taskkill.exe /pid NUMBER</p>
|
OpenGL performance difference on Linux and WindowsXP <p>I've noticed that a OpenGL app I've been working on has significant performance difference when run on Linux vs WindowsXP. </p>
<p>Granted, there are a lot of textures and shadow buffers but I would estimate that the app runs about 10x <strong>slower</strong> on ... | <p>Comparing the Quadro to a GeForce is a big mistake. They may both be "graphics" cards but that is where the similarity ends.</p>
<p>The Quadro is designed for high end rendering and not games. From the wikipedia article on the Quadro:</p>
<blockquote>
<p>Their designers aimed to accelerate CAD (Computer-Aided De... |
What language has the easiest and most robust date parsing? <p>I know java has the SimpleDateFormat which seems fairly powerful, but you need to know the format ahead of time to use it correctly.<br />
TCL's clock scan function seems to be the easiest and most powerful I've seen.</p>
<p>e.g. clock scan "1/08/2009 12:3... | <p>Perl's Date::Parse module (I don't know that it can be considered builtin to the language, but it's a CPAN module so that's good enough for me) has saved me countless hours on data conversion projects. From the documentation (<a href="http://metacpan.org/pod/Date::Parse" rel="nofollow">http://metacpan.org/pod/Date:... |
Converting serial port data to TCP/IP in a linux environment <p>I need to get data from the serial port of a Linux system and convert it to TCP/IP to send to a server. Is this difficult to do? I have some basic programming experience but not much experience with Linux. Are there any open source applications that do thi... | <p>You don't need to write a program to do this in Linux. Just <a href="http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO-4.html">pipe</a> the serial port through <a href="http://netcat.sourceforge.net/">netcat</a>.</p>
<pre><code>netcat www.example.com port < /dev/ttyS0
</code></pre>
<p>Just replace the address and por... |
Restoring MySQL database from physical files <p>Is it possible to restore a MySQL database from the physical database files. I have a directory that has the following file types:</p>
<p>client.frm<br />
client.MYD<br />
client.MYI </p>
<p>but for about 20 more tables.</p>
<p>I usually use mysqldump or a similar too... | <p>A MySQL MyISAM table is the combination of three files:</p>
<ul>
<li>The FRM file is the table definition.</li>
<li>The MYD file is where the actual data is stored.</li>
<li>The MYI file is where the indexes created on the table are stored.</li>
</ul>
<p>You should be able to restore by copying them in your databa... |
Visual Studio: How to figure out where this type is defined? <p>i have an interface - one of whose members returns a variable of type**Object**.</p>
<p>In my attempts to try to use this returned variable, i discovered that it isn't just an "<strong>Object</strong>", but is actually a "<strong>mshtml.HTMLDocumentClass<... | <p>A quick search on MSDN gets me to this page which describes how to get the document interface:
<a href="http://msdn.microsoft.com/en-us/library/bb508515(VS.85).aspx" rel="nofollow">About MSHTML</a><br/>
Note: I cannot try any of this as I am stuck with VS.80</p>
|
MSTest.exe not finding app.config <p>I'm currently trying to run MSTest.exe from NCover, but I believe the question could apply generally to running MSTest.exe from the command line.</p>
<p>If I have the "/noisolation" argument, then MSTest.exe appears to find and use the app.config as expected. Without it, NCover do... | <p>From Craig Stuntz in a comment at <a href="http://devlicio.us/blogs/derik_whittaker/archive/2008/07/23/mstest-why-i-hate-you-you-cause-me-too-much-friction.aspx">link text</a></p>
<p>How to do this with MSTest.</p>
<ol>
<li><p>In Solution Explorer, right-click the Solution (not the Project).</p></li>
<li><p>Click ... |
Are There Any Good Ruby, Rails or .Net Libraries for Working with Barcodes? <p>Does anyone know any good Ruby, Rails or .Net specific libraries for working with barcodes?</p>
| <p>for ruby there's the barby gem and redux for rails</p>
|
How would you determine where each property and method of a Python class is defined? <p>Given an instance of some class in Python, it would be useful to be able to determine which line of source code <em>defined</em> each method and property (e.g. to implement [1]). For example, given a module ab.py</p>
<pre><code>cla... | <p>This is more-or-less impossible without static analysis, and even then, it won't always work. You can get the line where a function was defined and in which file by examining its code object, but beyond that, there's not much you can do. The <code>inspect</code> module can help with this. So:</p>
<pre><code>import ... |
Achieving emailing between website users without "Mailing Server" configuring? <p>I have requirement like, each user of the site
will be mailing any other user and I have rules for that communication
(let them aside for now). So user1 will be picking an email id like:
mypickeduser1n...@sitedomain.com and will be sendin... | <p>You need a mail server. Even if local email is just directly deposited into a mail directory or database somewhere, something has to be responsible for accepting email from the outside world. I recommend postfix - it's powerful but easy to set up, and the config files don't look like Klingon.</p>
|
Calling a remote COM+ ServicedComponent from a C# client <p>I have a serviced component installed in a COM+ server application. I want to create an instance from a remote client. The client needs to be able to specify the server machine's name dynamically. How do I do this?</p>
<p>I tried using Activator:</p>
<pre><c... | <p>Eureka! This works:</p>
<pre><code>string serverName = serverTextBox.Text;
Type remote = Type.GetTypeFromProgID("XSLTransComponent.XSLTransformer", serverName);
return (XSLTransComponent.XSLTransformer)Activator.CreateInstance(remote);
</code></pre>
<p>Thanks to <a href="http://social.msdn.microsoft.com/forums/en-... |
Entity Framework AddTo function inconsistency? <p>Let me describe the behavior I get:</p>
<ul>
<li>Load a user from the database: this means the user is attached to the context</li>
<li>Create a new Object C:
<ul>
<li>C tempC = new C();</li>
<li>tempC.User = previously loaded user;</li>
<li>Context.AddToCSet( tempC );... | <p>Assuming that there is a 1 to Many relationship between <code>User</code> and <code>C</code>, you may want to use a different syntax to add a <code>C</code> to the parent <code>User</code>. Instead of <code>tempC.User = previously loaded user;</code> you probably want to add the <code>tempC</code> as a child of <co... |
How can I parse Serv-U FTP logs with SSIS? <p>A while back I needed to parse a bunch of Serve-U FTP log files and store them in a database so people could report on them. I ended up developing a small C# app to do the following:</p>
<ol>
<li><p>Look for all files in a dir that have not been loaded into the db (there i... | <p>I have to do something similar with Exchange logs. I have yet to find an easier solution utilizing an all SSIS solution. Having said that, here is what I do:</p>
<p>First I use logparser from Microsoft and the bulk copy functionality of sql2005</p>
<p>I copy the log files to a directory that I can work with them... |
Will Emacs make me a better programmer? <p>Steve Yegge wrote <a href="http://steve.yegge.googlepages.com/tour-de-babel">a comment on his blog</a>:</p>
<blockquote>
<p>All of the greatest engineers in the
world use Emacs. The world-changer
types. Not the great gal in the cube
next to you. Not Fred, the amazing ... | <p>First let me say, I am a self professed true believer in the cult of Emacs. </p>
<p>That said, the blogger is nuts. You write in what you find useful. I find that Emacs helps me, mainly because I spent my college years pre-paying the start-up cost of learning how to modify it to suit my needs, and modifying myself ... |
WinDbg -- TraceListener and Saturated ThreadPool <p>I have a multithreaded .NET Windows Service that hangs intermittently -- maybe once every two weeks of 24/7 operation. When the hangs occurs the threadpool is completely saturated because calls to our custom tracelistener start blocking for some reason. There aren't a... | <p>Hey, <p>
Not really an answer, but something to check... <p>
Make sure that you do not still have the DefaultTraceListener registered in your trace source.
If you don't explicitly <strong>clear</strong> or <strong>remove</strong> the <strong>DefaultTraceListener</strong> it still may be there. The <strong>DefaultTr... |
ASP.NET - temporarily impersonate the app pool service ID when default it to impersonate the user? <p>I have to call some code in a SharePoint site that runs under the same service ID that the web application is running under. By default, SharePoint impersonates the user viewing the web page, and the users don't have ... | <p><a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spsecurity.runwithelevatedprivileges.aspx" rel="nofollow">SPSecurity.RunWithElevatedPrivileges</a></p>
|
Accessing Word documents in a Rails app <p>I have a number of documents (mainly Word and Excel) that I'd like to make available to users of my Rails app. However, I've never tried something like this before and was wondering what the best way to do this was? Seeing as there will only be a small number of Word documents... | <p>I would do as you suggested and put them in public/docs. If you are planning on making an overview/index page for the files and link directly to them it would be easier if they were stored locally instead of a remote FTP server. However, since you are the one who will be uploading and maintaining these files, I thin... |
C++ Tokenizing using iterators in an eof() cycle <p>I'm trying to adapt this answer </p>
<p><a href="http://stackoverflow.com/questions/53849/how-do-i-tokenize-a-string-in-c#53921">http://stackoverflow.com/questions/53849/how-do-i-tokenize-a-string-in-c#53921</a></p>
<p>to my current string problem which involves rea... | <p>Using a <code>while (!â¦.eof())</code> loop in C++ is broken because the loop will never be exited when the stream goes into an error state!</p>
<p>Rather, you should test the stream's state directly. Adapted to your code, this could look like this:</p>
<pre><code>while (getline(streamOfText, readTextLine)) {
... |
Different performance between Java and c# code when testing URL <p>When running the following Java code, I get very accurate and consistent results in determining if the web page I'm testing is up.</p>
<pre><code>protected synchronized boolean checkUrl(HttpURLConnection connection){
boolean error = false;
//HttpURLC... | <p>I believe this is because you're not closing any of the request objects.</p>
|
Highest Performance Database Storage Mechanism <p>I need ideas to implement a (really) high performance in-memory Database/Storage Mechanism. In the range of storing 20,000+ objects, with each object updated every 5 or so seconds. <strong>I would like a FOSS solution</strong>.</p>
<p>What is my best option? What are ... | <p><a href="http://sqlite.org/" rel="nofollow">SQLite</a> is an open-source self-contained database that supports in-memory databases (just connect to <code>:memory:</code>). It has bindings for many popular programming languages. It's a traditional SQL-based relational database, but you don't run a separate server â... |
Why isn't the SelectedIndexChanged event firing from a dropdownlist in a GridView? <p>I cannot get my SelectedIndexChanged of my dropdownlist to fire. I have the following:</p>
<pre><code><form id="form1" runat="server">
<div>
<asp:GridView id="grdPoll" runat="server" AutoGenerateColumns="false">
... | <p>Well, this question was asked more than a month ago and may be irrelevant now, but @LFSR was kind enough to edit it recently, it's in the "Active questions" list. </p>
<p>Since it remains unanswered (224 views!), I thought I should give it a go:</p>
<p><hr /></p>
<p>The problem is that in the context of a GridVie... |
Castle Windsor: So what DOES ActAs do? <p>I noticed that the castle windsor fluent component registration interface has the rather confusing ActAs() method.</p>
<p>Googling around for it the only reference I found was at their wiki <a href="http://using.castleproject.org/display/IoC/Fluent+Registration+API" rel="nofol... | <p>It <a href="http://fisheye2.atlassian.com/changelog/castleproject?cs=4961" rel="nofollow">adds custom dependencies (tags)</a> to the component being registered. The <a href="http://www.castleproject.org/container/facilities/trunk/wcf/index.html" rel="nofollow">WcfFacility</a>, for example, <a href="http://fisheye2.a... |
Controllers in Grails <p>I'm writing a small webapp in Grails and I have the following question regarding best practices for controller design and using GORM:</p>
<p>I'm storing the user object in session.user. Currently all my action methods start with the following code to make sure a valid user is logged in and tha... | <p>Use a <a href="http://grails.org/doc/1.0.x/guide/6.%20The%20Web%20Layer.html#6.6%20Filters">filter</a>, that way you can put that same repeated code in the filter and keep your controllers focussed on the real action.</p>
|
How could I implement autocompletion using Swing? <p>I'm interested in providing an autocompletion box in a JFrame. The triggering mechanism will be based on mnemonics (I think), but I'm not really sure what to use for the "autocompletion box" (I would like results to be filtered as the user presses keys).</p>
<p>How ... | <p>You might want to try the free AutoComplete component over at SwingLabs.</p>
<p><a href="http://swinglabs.org" rel="nofollow">http://swinglabs.org</a></p>
<p>Edit: This site seems to have moved <a href="http://java.net/projects/swinglabs" rel="nofollow">http://java.net/projects/swinglabs</a></p>
<p>There is an ex... |
Portable / Interoperable WCF Contracts <p>I was wondering if anybody out there had some good tips/dos and don'ts for designing WCF contracts with a mind for web-service interoperability, both in terms of older Microsoft web service technologies (e.g. WSE) and non-Microsoft technologies such as Java calling WCF web ser... | <h2>WCF DateTime woes</h2>
<p>Regarding your DateTime question, you are right to be concerned about passing around DateTime via WCF. This is just one link of many that gripe about the difficulties...
<a href="http://daveonsoftware.blogspot.com/2008/07/wcf-datetime-field-adjusted.html">http://daveonsoftware.blogspot.c... |
OleDbPermission in .NET Framework 3.5 <p>I have a windows program in .net framework 3.5 to update an access database, I need to set the permission to full trust level. the client don't have the framework configuration tools installed on their server, so is there any other place that I can make this change?</p>
| <p>You can configure the trust levels with the notepad:</p>
<p><a href="http://msdn.microsoft.com/en-us/library/ff648344.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/ff648344.aspx</a></p>
|
Keys / Values Functionality to Iterators in C++ <p>I know this questions has come up in various guises before, but this is slightly different.</p>
<p>I have a class which contains a std::map. Although I wish to use the map for other purposes inside the class, externally I want to expose an iterator adapter to just the... | <p>Have a look at Boost's <a href="http://www.boost.org/doc/libs/1_37_0/libs/iterator/doc/transform_iterator.html"><code>transform_iterator</code></a> which provides exactly this kind of functionality:</p>
<pre><code>template <typename K, typename V>
struct get_value {
const V& operator ()(std::pair<K... |
Algorithm for drawing an anti-aliased circle? <p>What's a good algorithm for drawing anti-aliased circles? (Filled and not filled.)</p>
| <p>Bresenham (of the line algorithm fame) also had a circle algorithm.</p>
<p>Xiaolin Wu adapted the line algorithm for anti-aliasing, and likewise did the same to the circle algorithm.</p>
<p><a href="http://en.wikipedia.org/wiki/Xiaolin_Wu%27s_line_algorithm">http://en.wikipedia.org/wiki/Xiaolin_Wu%27s_line_algorit... |
Why would my java program send multicast packets with a TTL of 1? <p>I have a java client program that uses mdns with service discovery to find its associated server. After much testing on a single network with Windows, Fedora 10, and Ubuntu 8.10, we delivered a test build to a customer. They report that the client a... | <p>Did you check out the answer to <a href="http://stackoverflow.com/questions/139909/java-multicast-time-to-live-is-always-0">Java Multicast Time To Live is always 0</a>? This may fix your problem as well. The answer there references the answerer's <a href="http://www.peterfranza.com/2008/09/25/setting-multicast-tim... |
ASP.NET MVC RC1 - Custom View Engine for Areas - FindView override not firing <p>I have a custom view engine in ASP.NET MVC and since upgrading to RC1 my custom view engine that implements Areas <a href="http://haacked.com/archive/2008/11/04/areas-in-aspnetmvc.aspx" rel="nofollow">as in this post by Phil Haack</a> does... | <p>They have added a parameter to the FindView Method. You can now specify to usecache on both FindView and FindPartialView.</p>
|
K&R exercise: Multidimensional array into pointer array <p>Exercise (5-9):
Rewrite the routines <code>day_of_year</code> with pointers instead of indexing.</p>
<pre><code>static char daytab[2][13] = {
{0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31},
{0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}
};... | <p>There are two ways of handling this:</p>
<p>The first is to emulate the way that C actually handles multidimensional arrays, which is to say not at all. char[4][4] is really just syntactical sugar around char[16]. You can create a pointer to an array of 16 bytes (in this case) and you've got the same thing.</p>
... |
Logic first, WCF security later? <p>I'm working on a WCF service that will be communicating over net.tcp to n instances of a client app (that is being developed by another programmer in my office). </p>
<p>At the moment I am using net.tcp without any security as I felt setting this up at this stage wasn't necessary, a... | <p>While your overall design should consider security from the very beginning, I don't think it's a good idea to couple your components to any particular security strategy. You may very well want to use some of your components in a non-secure manner or across a different protocol which offers different security optio... |
Is there still a place for MDI? <p>Even though MDI is <a href="http://pixelcentric.net/article-art=docs.html" rel="nofollow">considered harmful</a>, several applications (even MS Office, Adobe apps) still use it either in its pure form or some as a hybrid with a tabbed/IDE-like interface.</p>
<p><strong>Is an MDI inte... | <p>The disadvantages of MDI are the following:</p>
<ul>
<li><p>It generally requires the user to learn and understand a more complicate set of window relations.</p></li>
<li><p>Many simple actions can require a two-step process. For example, bringing a desired window to the foreground can require that the user first b... |
What is the proper way to update Delphi 2009's default installation of Indy 10? <p>Since Indy is now built-into the install process of Delphi 2009... is there a proper way to 'remove' it so it can be upgraded to the latest from the SVN repo? There isn't an automated option to remove it as far as I'm aware.</p>
| <p>The <em>dcu</em> files for Indy are stored separately from the other Delphi units. To stop using them, simply remove that directory from the search path, library path, etc., and remove the source files from the browse path.</p>
<p>You can remove the design-time packages the same as any other design-time packages. R... |
Delphi 2009 and Synapse - tested and ready for Unicode support? <p>Is Synapse ready for a Delphi 2009 production applications? Their website doesn't look like it's been updated in a while: <a href="http://www.ararat.cz/synapse/doku.php" rel="nofollow">http://www.ararat.cz/synapse/doku.php</a> Is the project dead?</... | <p>I have been using the latest version from the SVN repository without any problems in a commercial application compiled with Delphi 2009.</p>
|
What's the most efficient way to check the presence of a row in a table? <p>Say I want to check if a record in a MySQL table exists. I'd run a query, check the number of rows returned. If 0 rows do this, otherwise do that.</p>
<pre><code>SELECT * FROM table WHERE id=5
SELECT id FROM table WHERE id=5
</code></pre>
<p>... | <p>Optimizers are pretty smart (generally). They typically only grab what they need so I'd go with:</p>
<pre><code>SELECT COUNT(1) FROM mytable WHERE id = 5
</code></pre>
|
hiding grids using ESC key <p>I'm new to WPF.
I have like 15 grids on my Window and I have a small menu on which I can click and choose which grid to show up or hide. One grid at a time only. I would like that grid to hode (fade out) when I hit <kbd>Esc</kbd>. I have all the animations already, I just need to know what... | <p>By active, I assume that means the one that has keyboard focus. If so, the following will return the control that currently has keyboard input focus:</p>
<pre><code>System.Windows.Input.Keyboard.FocusedElement
</code></pre>
<p>You could use it like this:</p>
<pre><code>if (e.Key == System.Windows.Input.Key.Escape... |
Caching with multiple server <p>I'm building an application with multiple server involved. (4 servers where each one has a database and a webserver. 1 master database and 3 slaves + one load balancer)</p>
<p>There is several approach to enable caching. Right now it's fairly simple and not efficient at all.
All the cac... | <p><a href="http://www.danga.com/memcached/" rel="nofollow">http://www.danga.com/memcached/</a></p>
<p>Memcached covers most of the requirements you lay out - message-based read, commit and invalidation. High availability and high speed, but very little atomic reliability (sacrificed for performance).</p>
<p>(Also, m... |
Uses for both static strong typed languages like Haskell and dynamic (strong) languages like Common LIsp <p>I was working with a Lisp dialect but also learning some Haskell as well. They share some similarities but the main difference in Common Lisp seems to be that you don't have to define a type for each function, a... | <p>Programming languages are tools for thinking with. You can express any program in any language, if you're willing to work hard enough. The chief value provided by one programming language over another is how much support it gives you for thinking about problems in different ways. </p>
<p>For example, Haskell is a l... |
Problem with windows Batch file on windows 7 <p>I have a batch file to compile and link all of my code. It contains the following:</p>
<pre><code>@echo off
nasm -f aout -o start.o start.asm
gcc -Wall -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -I./include -c -o main.o main.c
gcc... | <p>Are you running from a command line or by double-clicking in Explorer?</p>
<p>Maybe you have the <i>Edit</i> action set as the default?</p>
<p>Try right-clicking and selecting <i>Open</i>.</p>
<p>EDIT: Maybe your line terminators are messed up. Windows expects CRLF.</p>
<p>In Notepad++:</p>
<ul>
<li>Click View-... |
Different Log File For Specific Controller <p>I currently have a controller were I would like to keep track of logging in a separate log file, like: tracker.log. I currently get about 100,000 hits a day with this, and I would like to separate the log from all the other controllers so I can easily debug those as well as... | <p>AFAIK rails can't maintain two separate log file simultaneously. I'd recommend doing your own logging in the controller in question. </p>
<p>In similar situations I've used <a href="http://log4r.sourceforge.net/" rel="nofollow">log4r</a>. It's very <a href="http://log4r.sourceforge.net/manual.html#outofbox" rel=... |
Convert existing snippet of code to use Array.ForEach <p>We know that if you have:</p>
<pre><code>var aa = new [] { 1, 2, 3, 4, 5 };
for (int i = 0; i < aa.length; ++i)
{
aa[i] = aa[i] + 1;
}
</code></pre>
<p>it's really</p>
<pre><code>var aa = new [] { 1, 2, 3, 4, 5 };
Arrary.ForEach(aa, a => a + 1);
</co... | <p>How about:</p>
<pre><code>aa = ab.ConvertAll(x => x+1);
</code></pre>
|
How to serialize an Exception object in C#? <p>I am trying to serialize an Exception object in C#. However, it appears that it is impossible since the Exception class is not marked as <a href="https://msdn.microsoft.com/en-us/library/system.serializableattribute"><code>[Serializable]</code></a>. Is there a way to work ... | <p>Create a custom Exception class with the <strong>[Serializable()]</strong> attribute. Here's an example taken from the <a href="http://msdn.microsoft.com/en-us/library/ms173163.aspx">MSDN</a>:</p>
<pre><code>[Serializable()]
public class InvalidDepartmentException : System.Exception
{
public InvalidDepartmentEx... |
Python shelve module question <p>Does the Python shelve module have any protection built in to make sure two processes aren't writing to a file at the same time?</p>
| <p>The shelve module uses an underlying database package (such as dbm, <a href="http://docs.python.org/library/gdbm.html#module-gdbm" rel="nofollow">gdbm</a> or bsddb) .</p>
<p>The <a href="http://docs.python.org/library/shelve.html#restrictions" rel="nofollow"><em>restrictions</em> pragraph</a> says (my emphasis):</p... |
Display different header depending on page selected <p>I have an asp.net website with 5 items (home, products, news, about, contact) on the main horizontal navigation.</p>
<p>The site uses a master page which splits the page into a header, body and footer using </p>
<p>I want to be able to display a different header ... | <p>I'd probably create a base CSS class that they'd all use, and then create 5 different themes in the app_themes directory (create one if you don't have one), one for each nav option; in there, you can override the base CSS with more specific options to change the background images / colors. If you're using Asp:Images... |
Why does C# designer-generated code (like Form1.designer.cs) play havoc with Subversion? <p>My workshop has recently switched to Subversion from SourceSafe, freeing us from automatic locks. This led to concurrent editing of the Forms, which is wonderful. But when multiple developers commit their changes, the code files... | <p>Here are some things to try:</p>
<ul>
<li>Make things more modular. Use components like User Controls etc. to split forms into multiple, smaller physical files.</li>
<li>Use presentation layer design patterns like MVP to move code out of views and into standard POCO classes.</li>
<li>Recent versions of SVN allow yo... |
Regarding how best to expose programming to a foreign audience <p>I'm writing a novel at the moment and, while programming will not be receiving a great deal of focus, I do want to at least get it into the reader's head that a character's coding background could cause them to be the way there are about various things.<... | <p>Talk about emotions, about what the programmer feels when working at its craft. Talk about his moments of doubt, his moments of pride.</p>
<p>Talk about his relations with his manager, his colleages, his friends and family.</p>
<p>If you want the reader get empathy with your character, talk about what is universal... |
Help with Regex patterns <p>I need some help with regex.</p>
<ol>
<li><p>I have a pattern AB.* , this pattern should match for strings
like AB.CD AB.CDX (AB.whatever).and
so on..But it should NOT match
strings like AB,AB.CD.CD ,AB.CD.
AB.CD.CD that is ,if it encounters a
second dot in the string. whats the
regex for ... | <p>Looks like you've got globs not regular expressions. Dot matches any char, and * makes the previous element match any 0+ times.</p>
<p>1) <code>AB\.[^.]*</code>
Escape the first dot so it matches a literal dot, and then match any character other than a dot, any number of times. </p>
<p>2) <code>"^(AB)|(AB\.[^.]*\.... |
LR1 Parser and Epsilon <p>I'm trying to understand how LR1 Parsers work but I came up with a strange problem: What if the grammar contains Epsilons? For instance: if I have the grammar:</p>
<pre><code>S -> A
A -> a A | B
B -> a
</code></pre>
<p>It's clear how to start:</p>
<pre><code>S -> .A
A -> .a A... | <p>Yes, exactly (think of the epsilon as empty space, where there aren't two places for the dot at the sides).</p>
<p>In an LR(0) automaton, you would make the state accepting and reduce to A. However, due to the <code>A->a A a</code> production, there'd be a shift/reduce conflict.</p>
<p>In a LR(1) automaton, you... |
reporting services virtual directory <p>i have iis7 i had build the report using business intelligence studio but i cant able to deploy the reports.it has given the error that "you are not attached to the server" but i install the reporting services in my admin account only </p>
| <p>Can you log into the management website using your browser: <a href="http://localhost/reports" rel="nofollow">http://localhost/reports</a> ???</p>
|
Why is my Access database not up-to-date when I read it from another process? <p>In my application I do the follwing things:</p>
<ol>
<li>Open a Access database (.mdb) using Jet/ADO and VB6</li>
<li>Clear and re-fill a table with new data </li>
<li>Close the database</li>
<li>Start another process which does something... | <p>Just a guess but I might be due to the fact that the Jet engine features a read cache and lazy writes:</p>
<p><a href="http://support.microsoft.com/kb/240317/en-us" rel="nofollow">How To Implement Multiuser Custom Counters in Jet 4.0 and ADO 2.1</a></p>
<p>"Microsoft Jet has a read-cache that is updated every Page... |
UML state of the art <p>I'm a fan of UML and use Fowlers <a href="http://rads.stackoverflow.com/amzn/click/0321193687" rel="nofollow" title="UML Distilled">UML distilled</a> book as a reference.</p>
<p>My question is : have things moved on in UML, what is the current 'state of the art'.
Is there a better reference boo... | <p>Tool support for version 2.0 is good and practice is to use them, so if you've got the third edition then you've got a good introduction.</p>
<p>The 'state of the art' depends what arena your working in.</p>
<p>For companies which have been using DOORS for ever, UML tools (Sparx Systems Enterprise Architect) inclu... |
SVN for Delphi Developers <p>I have posted a question before, <a href="http://stackoverflow.com/questions/225115/delphi-moving-away-from-vss">Moving away from VSS</a>, in which I asked about the best VCS control for Delphi developers who were using VSS. Most developers seem to use svn with TortoiseSVN. I tried this f... | <ol>
<li>Yes, you could still lock files, but it's not recommended. You have to set the svn:needs-lock property on all the files you might want to lock so they get the readonly flag set when you check out. But again, that's not the recommended work flow for text files. Just give the modify-merge work flow a try!</li>
<... |
What's the right way, for testability, to add functionality to a ComboBox? <p>The desired functionality of the 'enhanced' combo box is a quick find method. Each item in the combobox has a ToString() method, such that they can be displayed in the drop down list. On clicking an item in the drop down list, the combobox's ... | <p>As with the post you references: seperating the logic from the gui elements is also the solution here.</p>
<p>You should consider using a controller-like class which exposes a list of items which you can databind to your ComboBox' DataSource. The controller itself is responsible for maintaining this list.</p>
<p>S... |
UIView Clipped By Statusbar until Autorotate <p>Ive created a multiview application that uses multiple controllers to display and control views. The problem Im having is, when the simulator initially loads the view the header is partially covered by the bar at top of screen and the tool bar at the base is not touching ... | <p>I grappled with this issue for days and days--no amount of fiddling in IB worked.</p>
<p>Ultimately I got it to work by adding this line: </p>
<pre><code>mainViewController.view.frame = window.screen.applicationFrame;
</code></pre>
<p>to the application:didFinishLaunchingWithOptions: method. (Where mainViewContr... |
Serving favicon.ico in ASP.NET MVC <p>What is the final/best recommendation for how to serve favicon.ico in ASP.NET MVC?</p>
<p>I am currently doing the following :</p>
<ul>
<li><p>Adding an entry to the <strong>very beginning</strong> of my RegisterRoutes method :</p>
<pre><code>routes.IgnoreRoute("favicon.ico");
<... | <p>Placing favicon.ico in the root of your domain only really affects IE5, IIRC. For more modern browsers you should be able to include a link tag to point to another directory:</p>
<pre><code><link rel="SHORTCUT ICON" href="http://www.mydomain.com/content/favicon.ico"/>
</code></pre>
<p>You can also use non-ic... |
Delphi PDF generation <p>We're using Fast Reports to create reports but we're not very happy with the quality of the PDFs it creates. I know we can plug in other PDF components instead of the one that comes with FastReports so my question is</p>
<p>What good PDF components are there out there (Free or Commercial) for ... | <p>We are using Gnostice and are very pleased with it. It allows us to print our ReportBuilder reports to PDF, HTML, XML, Excel, Gif, ...</p>
<p><hr /></p>
<p>Some minor issues we have come accross working with the component</p>
<ol>
<li>Somewhere deep in the bowels of the component, Application.Processmessages get'... |
Shut down a ATL application cleanly <p>I have developed a console ATL application and want to trap the close?, exit?, terminate? event so that I can close log files and perform a general clean-up on exit.</p>
<p>How can I trap the 'terminate' event that would result from someone ending the .exe in the task manager?</p... | <p>You can't trap "End Process" from the Processes tab in Task Manager. If a program could trap it, how would you kill it?</p>
<p>To respond to "End Process" on the Applications tab in Task Manager, handle the WM_CLOSE message in your main window.</p>
<p>This assumes that your ATL app is a Windows GUI application. If... |
Log analyzer for non-web-applications <p>I have been searching for some kind of tool to analyse log files that are in custom format (my own format for my own program for example). There are many tools that are designed for web-traffic log analysing, but I haven't found suitable tools for custom log files. I'd be happy ... | <p>With <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=890cd06b-abf8-4c25-91b2-f8d975cf8c07&displaylang=en" rel="nofollow">Log Parser</a> you get info by simple sql query.</p>
<p>At cmd line for text file use like that:</p>
<pre><code>LogParser -i:textline "select * from 'c:\path\*.txt' where t... |
Validate inputs that are not inside a form with jQuery Validation plugin <p>How can I validate some inputs that are not inside a form tag?</p>
<p>All the samples I found have a form tag, but I want to validate some inputs that are not inside a form.</p>
| <p><a href="http://stackoverflow.com/a/487690/594235">The previously accepted answer (since deleted)</a> was linking to <a href="http://code.google.com/p/jquery-validator/" rel="nofollow">a plugin</a> that was last updated in January 2009. This obsolete plugin is very different than <a href="http://jqueryvalidation.or... |
Best Practice for Using Java System Properties <p>Our code uses a lot of system properties eg, 'java.io.tmpdir', 'user.home', 'user.name' etc. We do not have any constants defined for these anywhere (and neither does java I think) or any other clever thing for dealing with them so they are in plain text littered throug... | <p>I would treat this just as any other String constant you have scattered throughout your code and define a constant variable for it. Granted, in this case "java.io.tmpdir" is unlikely to change, but you never know. (I don't mean that Sun might change the meaning of "java.io.tmpdir", or what system property it points... |
Automated code sanity check tools for Ruby <p>What tools do you use for automated code sanity checks and adhering to the coding conventions in your Ruby apps? How do you incorporate them into your process? (I mean tools like roodi, reek, heckle, rcov, dcov, etc.)</p>
| <p>I'd suggest taking a look at <a href="https://github.com/bbatsov/rubocop" rel="nofollow">RuboCop</a>. It is a Ruby code style checker based on the <a href="https://github.com/bbatsov/rubocop" rel="nofollow">Ruby Style Guide</a>. It's maintained pretty actively and it's based on standard Ruby tooling (like the <code>... |
Web usability - datalists and operations on rows of data <p>Where you have a databound list of items and for each item you may want to provide users the ability to (for example):</p>
<ul>
<li>Delete</li>
<li>Download</li>
<li>View Detail</li>
<li>or 'mark' in some way</li>
</ul>
<p>You have a few options:</p>
<ul>
<... | <p>My opinion : It depends on the data displayed in this table.</p>
<p>If I really need to execute one operation on several elements, for example to delete 10 elements, I would expect to have the checkbox with a global button option. It is really user unfriendly to click 10 times on a link to execute this operation.</... |
SQL CASE Statement Versus Conditional Statements In Programming Language <p>I'm going through some old stored procedures at work and constantly come across</p>
<pre><code>CASE MyColumn WHEN 'Y' THEN 'Yes' WHEN 'N' THEN 'No' ELSE 'Unknown' END
</code></pre>
<p>It gets even worse when this is tied not to a word, but in... | <p>When speed is of the essence, the SQL case statements might even be the fastest (I'll run a test) but for maintainability, returning the plain values to the presentation layer (or some business layer thingy) is the best option. </p>
<p>[update] ran some quick and dirty tests (code below) and found the C# code varia... |
navigation for limiting sql records <p>I want to write a page that will show all the records from a database, and have it limited using the SQL LIMIT syntax. </p>
<p>My question is how would I use PHP to automatically generate the links? Would I have a variable that would automatically increase somehow, hardcode the l... | <p>This is <a href="http://php.about.com/od/phpwithmysql/ss/php_pagination.htm" rel="nofollow">standard pagination</a> it sounds like. Basically you will use the <a href="http://php.about.com/od/mysqlcommands/g/Limit_sql.htm" rel="nofollow">LIMIT</a> functionality in MySQL, set amount of records per page, and finally t... |
How can I get interactive Python to avoid using readline while allowing utf-8 input? <p>I use a terminal (9term) that does command-line editing itself - programs that use readline just get in its way. It's fully utf-8 aware. How can I make an interactive python session disable readline while retaining utf-8 input and o... | <p>In the past, I've disabled Python readline by rebuilding it from source: <code>configure --disable-readline</code></p>
<p>This might be overkill, though, for your situation.</p>
|
Error with Html.RouteLink in ASP.NET MVC RC <p>I was using Html.RouteLink("LINKTEXT","RouteName",new RouteValueDictionary()) in asp.net MVC beta without problem, today I upgrade to ASP.NET MVC RC and this does no create the link anymore. The route still works because I type in the browser and I go to the Page I want.... | <p>It's bug in RC. Workaround for now is to put your controller and action names in RouteLink. </p>
<p>For example: </p>
<pre><code><%= Html.RouteLink(cat.Name, "Category", new { id = cat.id, controller = "Home", action = "Category" })%>
</code></pre>
<p>I also found one more issue with publishing web to sha... |
Allow user to sort columns from a LINQ query in a DataGridView <p>I can't quite work out how to allow a DataGridView populated at runtime to sort (when users click on the column headers) where a LINQ from XML query is the DataSource, via a BindingSource.</p>
<pre><code> Dim QueryReOrder = From Q In Query _
... | <p>You need to get the results of the LINQ query into something supports sorting functionality. This is typically done by deriving a class from BindingList and implementing the Sorting Core functionality in the derived class. </p>
<p>There are many examples of implementations out there to choose from and it is a pre... |
WinForms AcceptButton not working? <p>Ok, this is bugging me, and I just can't figure out what is wrong...</p>
<p>I have made two forms. First form just has a simple button on it, which opens the other as a dialog like so:</p>
<pre><code>using (Form2 f = new Form2())
{
if (f.ShowDialog() != DialogResult.OK)
... | <p>Just setting the AcceptButton/CancelButton is not enough. This just tells which button should be invoked on <kbd>Enter</kbd>/<kbd>Esc</kbd>. You have to set the DialogResult in the Button handler.</p>
|
phpMyAdmin - Did the Config files change? <p>I have just installed phpMyAdmin on my new Fedora Core 10 dedicated server.</p>
<p>I downloaded the phpMyAdmin-3.1.2-english.tar.gz. I extracted it and placed it in this folder /opt/phpMyAdmin-3.1.2-english and i created a symbolic link in the /var/www/html directory so tha... | <p>Would setting </p>
<pre><code>$cfg['Servers'][$i]['auth_type'] = 'config';
</code></pre>
<p>instead of </p>
<pre><code>$cfg['Servers'][$i]['auth_type'] = âhttpâ;
</code></pre>
<p>help?</p>
<p>See <a href="http://www.un4given.nl/phpMyAdmin/Documentation.html#config" rel="nofollow">http://www.un4given.nl/phpM... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.