input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
Inheriting a .net class <p>Ok here's what I'm trying to do I want to write a class that inherits everything from the class ListItem</p>
<pre><code>class RealListItem : ListItem
{
public string anExtraStringINeed;
}
</code></pre>
<p>For some reason or another .net is treating all the members like they are private ... | <p>The System.Web.UI.Controls.ListItem class is "sealed"... That means you cannot inherit from it... </p>
|
Is there a JavaScript alert that doesn't pause the script? <p>I'm looking for something like <code>alert()</code>, but that doesn't "pause" the script.</p>
<p>I want to display an alert and allow the next command, a form <code>submit()</code>, to continue. So the page will be changing after the alert is displayed, but... | <p>You could do the alert in a setTimeout (which a very short timeout) as setTimeout is asynchronous:</p>
<pre><code>setTimeout("alert('hello world');", 1);
</code></pre>
<p>Or to do it properly you really show use a method rather than a string into your setTimeout:</p>
<pre><code>setTimeout(function() { alert('hell... |
What are use-cases for a coroutine? <p>The concept of a <a href="http://en.wikipedia.org/wiki/Coroutine">coroutine</a> sounds very interesting, but I don't know, if it makes sense in a real productive environment? What are use-cases for coroutines, that can be solved more elegant, simpler or more efficient as with othe... | <p>Some good answers describing what coroutines are.</p>
<p>But for an actual use-case. Take a web server. It has multiple simultaneous connections, and it wants to schedule reading and writing all of them.</p>
<p>This can be implemented using coroutines. Each connection is a coroutine that reads/writes a small amoun... |
Variable (dynamic) OPTION lists in HTML SELECT using IE <p>I'm trying to implement a dynamic OPTION list in JavaScript. Depending on other selections in the web form, some of the OPTIONS in a specific SELECT are not valid. Things I've tried that don't work in IE are: </p>
<ul>
<li>populate all options, then set the ... | <p><a href="http://webbugtrack.blogspot.com/2007/11/bug-293-cant-disable-options-in-ie.html" rel="nofollow">IE doesn't support the disabled attribute on options</a>, and worse yet, <a href="http://webbugtrack.blogspot.com/2007/11/bug-280-lack-of-events-for-options.html" rel="nofollow">IE doesn't support events on optio... |
what's the best way to parse a body of text against multiple (15+) regexes on each line? <p>I have a body of text that I have to scan and each line contains at least 2 and sometimes four parts of information. The problem is that each line can be 1 out of 15-20 different actions.</p>
<p>in ruby the current code looks s... | <p>I would suggest </p>
<ul>
<li><a href="http://spirit.sourceforge.net/" rel="nofollow">Boost Spirit</a> or </li>
<li><a href="http://www.antlr.org/" rel="nofollow">Antlr</a> if the grammar is complex; </li>
<li><a href="http://www.boost.org/doc/libs/1_37_0/doc/html/xpressive.html" rel="nofollow">Xpressive</a> if it'... |
In SQL*Plus, how do I change the prompt to show the connected user and database? <p>To show, for example....</p>
<pre><code>USER@SID >
</code></pre>
<p>I thought this was potentially helpful to a few people so I'm going to answer it too!</p>
| <p>Amend your $ORACLE_HOME\sqlplus\admin\glogin.sql script - add:</p>
<pre><code>set sqlprompt "_user '@' _connect_identifier > "
</code></pre>
<p>to the end of the file.</p>
<p>In Oracle 10g this will change correctly each time you issue a "conn". For clients before 10g it won't change when you do a "conn" but ... |
How do I select multiple sets of attributes within an XML document using XPath? <p>I am having trouble constructing a single XPath statement to return two different sets of attributes. </p>
<p>For example take the following XML document:</p>
<pre><code><root>
<line name="one" alpha="a1" beta="b1"/>
<... | <p>By using the <code>|</code> operator in an XPath expression you can select several paths:</p>
<pre><code>//@alpha | //@beta
</code></pre>
|
Mutli-threaded application hanging on _dl_sysinfo_int80 <p>I have a multi-threaded application that is hanging on a call to _dl_sysinfo_int80(). According to gdb, all threads are stuck in this call.</p>
<p>The top of the stack trace looks like:</p>
<pre><code>#0 0x002727a2 in _dl_sysinfo_int80 () from /lib/ld-linux... | <p>int 80 is the software interrupt to make a kernel level system call. My guess is that pthread is doing a call in to the kernel that is hanging. There could be any number of reasons for why all of your threads would hang on a mutex like this:<br>
- The mutex is locked by another thread that exited without releasi... |
Is there a way to send optional parameters to an action? <p>Can I send optional parameters (empty strings, null int?'s etc) to an action through a GET request in asp.net mvc? (one sentence question!)</p>
| <p>You can do optional parameters with the routing table fairly easily, just specify the defaults in the route of the global.cs file.</p>
<p>So for a search page with an optional query and page you would have something like</p>
<pre><code>RouteTable.Routes.Add(new Route
{
Url = "Search/[query]/[page]",
Defaul... |
RegDelete cannot delete Registry key in WSH 5.7 <p>Based on the advice provided at <a href="http://www.tweakguides.com/VA_4.html" rel="nofollow">http://www.tweakguides.com/VA_4.html</a> to prevent Windows Vista from "intelligently" rearranging column formats in Windows Explorer, I have written a script to automate the ... | <p>Does your registry setting have subkeys? I think you have to delete those before you can delete the key.</p>
|
Vector or diagram drawing webservice <p>I have a webapp from which I'd like to insert diagrams and images quickly and easily. I expect there is, somewhere out there, a webservice which will take a URL with a parameter that describes the vector graphics or diagram and returns an image.</p>
<p>No unlike what google cha... | <p>Check out <a href="http://raphaeljs.com/" rel="nofollow">Raphael</a>. Done by a bloke here in Australia.</p>
|
How to dynamically call child class methods in PHP 5? <pre><code><?php
class foo
{
//this class is always etended, and has some other methods that do utility work
//and are never overrided
public function init()
{
//what do to here to call bar->doSomething or baz->doSomething
//depen... | <p>You just have to call $this->doSomething(); in your init() method.</p>
<p>Due to polymorphism, the correct method of the child object will be called at runtime depending on the class of the child.</p>
|
How to pass a parameter to a dynamically set Javascript function? <p>Ok, I have one Javascript that creates rows in a table like this:</p>
<pre><code> function AddRow(text,rowID)
{
var tbl = document.getElementById('tblNotePanel');
var row = tbl.insertRow(tbl.rows.length);
var cell = row.insertCell();... | <p>Try this:</p>
<pre><code>cell.onclick = function() { clickTest(rowID); };
</code></pre>
<p>The idea is that you are binding the onclick handler to the anonymous function. The anonymous function calls clickTest with rowID as the parameter.</p>
|
Why does ASP.NET webforms need the Runat="Server" attribute? <p>Why do I have to specify <code>runat="server"</code> on all my ASP.NET controls when it is a mandatory attribute and <code>server</code> is the only option available in my limited knowledge of ASP.NET, and I get an error if I don't use it?</p>
<p>I do und... | <p>I've always believed it was there more for the understanding that you can mix ASP.NET tags and HTML Tags, and HTML Tags have the option of either being <code>runat="server"</code> or not. It doesn't hurt anything to leave the tag in, and it causes a compiler error to take it out. The more things you imply about we... |
What is the best way of converting a Microsoft Word document into XHTML? <p>I would like to programatically convert a Microsoft Word document into XHTML. The language of choice is PHP, so I would appreciate any suggestions with PHP.</p>
<p>The initial idea is trying to convert the doc file into odt, and then use the <... | <p>If you're running Linux one way to go would be to install OpenOffice on the server.</p>
<p>Example instructions for a 'headless' (i.e. no UI) install can be found <a href="http://www.oooforum.org/forum/viewtopic.phtml?t=6691">here</a>.</p>
<p>You could then use a nice CLI app like <a href="http://dag.wieers.com/ho... |
SQL DataReader missing a row in loop <p>When running the following code it leaves out one row. When I do a files.Count it says there are 4 rows but there is no data stored for the 4th row. When I run the stored procedure from within SQL Manager it returns all 4 rows and all the data. Any help?</p>
<pre><code> ... | <p>If you are saying your files collection has 4 items, but the 4 item contains no value, what do you mean by that? Is it null, does the object have no data, or does it throw an index out of range exception?</p>
<p>Are you doing a files[4] or something like the following?</p>
<pre><code>for(int x = 1; x < files.le... |
problem with cross-domain ajax calls <p>i have two servers a main site and a static server.
i want to get a file's content from ajax in runtime, which is stored in static server.
obviously cross domain problem will occur.</p>
<p>so what i am trying to do is storing that ajax .js in the static server, so that calling ... | <p>n't use X domain Ajax Requests. Create a "proxy" on your own server (domain) then forward the call to the other domain, cache it, check for security issues and send it back to client again...</p>
|
Spin Control in Delphi <p>I want to use a "spin button control" (also known as an up-down control) in my Delphi Win 32 application (I'm using Delphi 2007). </p>
<p>The aim is to have a control that looks like in Microsoft Office:</p>
<p></p>
<p>I found this on the Microsoft website: <a href="http://msdn.microsoft.co... | <p>Have a look at TUpDown. It wraps the Win32 control.</p>
|
Linq to SQL update not working using Repository pattern <p>I am using asp.net mvc for an application. I've taken some guidance from Rob Conery's series on the MVC storefront. I am using a very similar data access pattern to the one that he used in the storefront.</p>
<p>However, I have added a small difference to th... | <p>In your SaveOrder method you are always creating a new ORDER object. You need to change this so that if order.IsNew is false, it retrieves the existing one from the DB and updates it instead.</p>
<pre><code>public void SaveOrder(Order order)
{
ORDER dbOrder;
if (order.IsNew)
{
dbOrder = new ORD... |
Have you ever used a genetic algorithm in real-world applications? <p>I was wondering how common it is to find genetic algorithm approaches in commercial code.</p>
<p>It always seemed to me that some kinds of schedulers could benefit from a GA engine, as a supplement to the main algorithm.</p>
| <p>Genetic Algorithms have been widely used commercially. Optimizing train routing was an early application. More recently fighter planes have used GAs to optimize wing designs. I have used GAs extensively at work to generate solutions to problems that have an extremely large search space.</p>
<p>Many problems are unl... |
How to make Oracle procedure return result sets <p>SQL Server procedure can return result sets. I have a table <strong>emp(emp__id, emp__name, ...)</strong>. The procedure below will return a list of employees that matched with the name provided.</p>
<pre><code>CREATE OR REPLACE PROCEDURE get_employee_by_name ( @name ... | <p>Use a Ref cursor for the Stored Procedure:<br />
<a href="http://www.oradev.com/ref_cursor.jsp" rel="nofollow">http://www.oradev.com/ref_cursor.jsp</a> </p>
<p>For the client part use the Oracle Data Provider. You can download it from Oracle and the syntax is similar to the SQLDataAdapter. Something like this:</p>... |
Can I store the generics attribute into an object's field <p>Assuming the following class stub:</p>
<pre><code>public class Foo<T> {
private Class<T> type;
public Foo<T> () {}
}
</code></pre>
<p>Can I store the generic type <code>T</code> into the field <code>type</code> in the constructor, wit... | <p>No - type erasure means that you have to provide <em>something</em> at execution time. You could provide either an instance of <code>T</code> or <code>Class<T></code> but the class itself will just have every occurrence of T replaced with <code>Object</code>.</p>
<p>This kind of thing is one of the biggest di... |
Does the CLR automatically detect if the garbage collector should be run in server mode? <p>From a previous question I have seen that the CLR has workstation and server modes for its garbage collector. I know that these can be set from configuration using the <a href="http://msdn.microsoft.com/en-us/library/ms229357.a... | <p>Certainly not. The CLR runs in concurrent mode unless you explicitly tell it to do otherwise.</p>
|
How can I access the bookmarks toolbar using only shortcuts in Firefox 3 <p>I am not interested in accessing the bookmarks menu or sidebar. The specific goal that I'm trying to accomplish is to be able to easily navigate (using only the keyboard) through the live bookmarks loaded from stack overflow by means of a feed ... | <p>Try this:
Get the incompatible Bookmarkkey extension file (disable JS then you should copy link location on the download button), open it with your favorite archive manager (holly cow, it's a zip after all:o), then edit the .RDF file, which is vanilla xml (mozilla folks loves file extension renaming!):</p>
<p>and ... |
Does using delegates slow down my .NET programs? <p>Does using delegates slow down my programs? </p>
<p>I've been avoiding them because I really have no clue if they make my programs any slower. I know if I cause a (catch) exception, that uses quite a bit of CPU power but I don't know about Delegates and Events and ... | <p>Delegates are very, very fast. Not quite as fast as direct method calls, but not far off. The chances of them becoming a bottleneck are miniscule.</p>
<p>(Likewise exceptions, when used properly, <a href="http://stackoverflow.com/questions/161942/how-slow-are-net-exceptions">rarely actually cause a performance issu... |
Is there a free (LGPL, BSD, etc) implementation of XML editor swing component <p>I need a JComponent thad enables editing xml documents so I can embed it in my application.</p>
<p>It doesnt need to bee fancy.</p>
<p>Plain text editing and highlighting would bee enough.</p>
<p>Thank in advance</p>
| <p>Maybe this <a href="http://darwin-it.blogspot.com/2008/09/java-swing-xml-editor-and-tester.html" rel="nofollow">Xml Editor</a> would do:</p>
<blockquote>
<p>I had to enhance and restructure my XML Editor to make it a "plugable" JPanel.</p>
</blockquote>
<p>Otherwise, you still have the <a href="http://www.xmlmin... |
Enabling Auditing feature in SQLServer 2005 <p>Did you ever use SQL Server auditing features on a production db?</p>
<p>How did that impact on performances, and are there differences you noticed between different versions of SQL Server.</p>
<p>Also how we need to enable the audit features.</p>
| <p>The C2 audit mode suffers from a variety of problems, and your question touched on only one of them - performance. C2 auditing has a tremendous performance impact, very high.</p>
<p>Setting the performance issue aside, it's very difficult to manage. It's not a set-it-and-forget-it configuration switch. You have ... |
Boost Spirit crash when used in DLLs <p>I am experiencing a crash while using the Boost.Spirit and Boost.Thread
libraries in my application. This only happens if I have used the Spirit
parser during the lifetime of the process from the main thread.</p>
<p>The crash happens at exit and appears to be related to the cl... | <p>Well I found a workaround. </p>
<p>Every place I use the boost::spirit::parse call, I basically spawn a workerthread to run it, while the calling thread is blocking on a join call with the workerthread. Not ideal, but it appears to be working without any sideeffects so far.</p>
<p>Still interested in any alternati... |
Which Triplestore for rapid semantic web development? <p>Ease of installation/use is the most important factor here - not performance.</p>
<p>Small is OK as large datasets are not expected.</p>
| <p>I'd also recommend <a href="http://www.openrdf.org" rel="nofollow">sesame</a>, its lightweight, pretty easy to install, and provides good performance for small datasets. Query performance is far better with Sesame 1.2.x than Sesame 2.x because of the addition of context support to the 2.x series.</p>
<p>I've teste... |
How to choose returned column name in a SELECT FOR XML query? <p>MS SQL has a convenient workaround for concatenating a column value from multiple rows into one value:</p>
<pre><code>SELECT col1
FROM table1
WHERE col2 = 'x'
ORDER by col3
FOR XML path('')
</code></pre>
<p>and that returns a nice recordset:</p>
<p... | <p>That should do:</p>
<pre><code>select(
SELECT col1
FROM table1
WHERE col2 = 'x'
ORDER by col3
FOR XML path('')
) as myName
</code></pre>
<p>Not pretty but should give the result that you need</p>
|
Detecting if an Oracle Database is Installed <p>I was wondering if there was a way to tell if an instance of Oracle on a system has a database installed or not?</p>
<p>This is for an installation script, and I need to verify that there is an actual database in place before proceeding with the loading of my own tablesp... | <p>Check for the existence of an ORACLE_HOME. It's also reasonable to expect that this environment should be configured for the installation, so testing the environment variables and exiting with a sensible diagnostic (possibly suggesting they run oraenv) is a good first start. If you have an ORACLE_HOME, ORACLE_SID ... |
Base64ing Unicode characters <p>Can <a href="http://en.wikipedia.org/wiki/Unicode">Unicode</a> characters be encoded and decoded with <a href="http://en.wikipedia.org/wiki/Base64">Base64</a>?</p>
<p>I have attempted to encode the string 'اÙÙÙ', but when I decoded it all I got was '????'.</p>
| <p>Base64 converts <em>binary</em> to text. If you want to convert text to a base64 format, you'll need to convert the text to binary using some appropriate encoding (e.g. UTF-8, UTF-16) first.</p>
|
WPF: Can I restyle a checkbox template, so that the checkindicator is a red cross instead <p>I can´t find a way to restyle the IsChecked indicator of a checkbox. As I can see from the checkbox template there´s no possibilities to restyle the indicator, just the "box" of the checkbox. Does anyone knows if it´s possib... | <p>You will have to replace the entire CheckBox control template.</p>
<p>Start with the ChekcBox ControlTemplate MSDN example at <a href="http://msdn.microsoft.com/en-us/library/ms752319.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/ms752319.aspx</a></p>
<p>In the example you'll see this element:</p>
... |
Which is the best Maven Eclipse plugin? <p>There is two available Eclipse plugins for Maven :</p>
<ul>
<li><a href="http://www.eclipse.org/proposals/iam/">Eclipse IAM</a> (old name is Q4E)</li>
<li><a href="http://m2eclipse.codehaus.org/">m2eclipse</a></li>
</ul>
<p>m2eclipse seems to be the oldest but the more robus... | <p>I choose <strong>m2eclipse</strong> since it is stable and have all that I need. Especially ability to resolve dependencies inside workspace.</p>
<p>I tried the other one some time ago and didn't like it. It was to buggy so I gave up quickly.</p>
|
From AS2 to AS3 what is the equvalent of _root? <p>I'm trying to learn Actionscript 2 or 3, with AS2 I eventually figured by trial and error that I could get any named instance and modify it using a string with its name using</p>
<pre><code>var theinstance = "titletext"; // actually exctracted from an array
_root[thei... | <p>Just use either "root" (no underscore) or "stage" depending on exactly what you want to do.</p>
<p>However - Why not just store a reference to the textField in the array instead of a string?</p>
|
What do you call a chart that illustrates class hierarchy? <p>So I have a UML type chart that documents the classes and the hierarchy of a development. Just don't know what you'd call it?</p>
<p>Any suggestions?</p>
| <p><a href="http://www.developer.com/design/article.php/2206791" rel="nofollow">Class diagram</a> is a nice start ;-).</p>
|
How to determine if a string is a number in C# <p>I am working on a tool where I need to convert string values to their proper object types. E.g. convert a string like <code>"2008-11-20T16:33:21Z"</code> to a <code>DateTime</code> value. Numeric values like <code>"42"</code> and <code>"42.42"</code> must be converted t... | <p><code>Int.TryParse</code> and <code>Double.TryParse</code> have the benefit of actually returning the number.</p>
<p>Something like <code>Regex.IsMatch("^\d+$")</code> has the drawback that you still have to parse the string again to get the value out.</p>
|
Avg on datetime in Access <p>I am porting some queries from Access to T-SQL and those who wrote the queries used the Avg aggregate function on datetime columns. This is not supported in T-SQL and I can understand why - it doesn't make sense. What is getting averaged?</p>
<p>So I was about to start reverse engineerin... | <p>I'd imagine that Access is averaging the numeric representation of the dates. You could do similar in T-SQL with the following...</p>
<pre><code>select AverageDate = cast(avg(cast(MyDateColumn as decimal(20, 10))) as datetime)
from MyTable
</code></pre>
|
Why bundle version control plugin with IDE? <p>I was always wandering why it is a big deal having version control support inside an IDE. </p>
<p>I always preferred to use commandline/standalone version of version control of choice, and never found IDE integration helpful.</p>
<p>I know it can be helpfull sometimes, f... | <p>Integrated Source Control also helps to only keep the important files under Source control. For example, when I add a new File in Visual Studio, the Plugin (visualSVN) will allow me to add it easily without me having to remember to go outside of my IDE and run the command to add it to the repository. On the other ha... |
What is Cassini's (aka VS Dev Server) stack limit? <p>I'm running into a StackOverflowException (please don't ask, it's not my fault) in IIS6/2k3 which has a limit of 256k, but the exception <em>doesn't happen</em> in the VS debugger. </p>
<p>As a matter of understanding I'd love to know, but have failed to google wha... | <p>Have you tried stack-overflowing Cassini on purpose to see at what point it crashes? I'd imagine the stack is immense, though I would expect Cassini to replicate IIS as closely as possible. It's surprising that something that runs in VS wouldn't run in IIS, and I'd even consider <a href="http://blogs.msdn.com/astebn... |
How would you construct and interact with a grid like a Sudoku board? <p>What do you think is the best way to implement an interactive grid similar to a Sudoku board for a native iPhone application? I did not see an object to fill this need in the SDK.</p>
<p>Should I make a custom control for an individual cell, the... | <p>For such a completely uniform grid, I would create a subclass of <code>UIView</code> and have it determine which row and column the user has touched using a simple calculation:</p>
<pre>int touchedRow = 9 * touch.x / [self bounds].width;
int touchedCol = 9 * touch.y / [self bounds].width;</pre>
<p>I don't see much... |
Accessing Environment Variables from Windows Services <p>I am attempting to write a Windows Service in C#. I need to find the path to a certain file, which is stored in an environment variable. In a regular C# console application, I can achieve that with the following line:</p>
<pre><code>string t = System.Environme... | <p>I've no idea if this is useful, but I've found that for every service, there is an option to add environment variables directly to a service.</p>
<p>It is done via the registry.</p>
<p>Say the key to your service is ...</p>
<p>HKLM\SYSTEM\CurrentControlSet\Services\YourService</p>
<p>Create a REG_MULTI_SZ called... |
Hibernate Annotation Placement Question <p>I've got what I think is a simple question. I've seen examples both ways. The question is - "why can't I place my annotations on the field?". Let me give you an example....</p>
<pre><code>@Entity
@Table(name="widget")
public class Widget {
private Integer id;
@Id
@Gene... | <p>From a performance and design perspective, using annotations on getters is a better idea than member variables, because the getter setters are called using reflection if placed on the field, than a method. Also if you plan to use validation and other features of hibernate, you'll have all the annotations at one plac... |
What is the optimal productivity stack for developers? <p>What is the optimal <a href="http://www.blog.stackingit.com/2008/11/productivity-stack-is-not-about.html" rel="nofollow">productivity stack</a> for developers?</p>
<p>When deciding what to include in your personal productivity stack, what criteria do you use?</... | <p>I haven't ever thought about this so much formally. Mine includes:</p>
<ul>
<li>Fast typing.</li>
<li>IDLE for Python. DrScheme for scheme. </li>
<li>For other code: TextPad on Windows, gedit on linux. I don't like vi or emacs. I just like an editor that I can use shift to highlight things. </li>
<li>Command line o... |
Windows 2008 concurrent TCPIP connections <p>In Windows XP, Microsoft took the decision to limit the number of half open connections in later service packs. Patching tcpip.sys was rumoured to fix this. Does such a limit exist in Windows 2008, and if so, is it configurable?</p>
| <p>When Vista SP1 shipped, there was some article about the alignment with Windows Server 2008, and their example was the networking subsystem, and they said something like that it is designed to handle thousands of connections. So I guess, no, they won't limit it to 10 :)</p>
<p>I think it was <a href="http://technet... |
Installing Capicom without SelfReg: Wix Custom Actions Not Found (Err 2721) <p>After following the advice in <a href="http://stackoverflow.com/questions/302560/wix-custom-actions-with-wixuiminimal">this question</a> successfully, I added a couple additional lines of code for another custom action. This one is intended... | <p>The Right way:</p>
<ul>
<li><p>c:\Program Files\Microsoft Visual Studio .NET 2003\Common7\Tools\Deployment\regcap.exe" /O capicom.reg capicom.dll</p></li>
<li><p>Run program from Adam Tengen's <a href="http://stackoverflow.com/questions/269423/how-to-generate-wix-xml-from-a-reg-file">post here</a>.</p></li>
</ul>
... |
ASP.NET Membership: Login Controls Source Code <p>Is the source code for the common login controls available?</p>
<p>Those are the controls which are available under Login section in Toolbox: </p>
<ul>
<li>Login, </li>
<li>LoginView, </li>
<li>PasswordRecovery,</li>
<li>LoginStatus, </li>
<li>LoginName,</li>
<li>Cre... | <p>"the entire framework is available" is not true. :)</p>
|
Python decorator makes function forget that it belongs to a class <p>I am trying to write a decorator to do logging:</p>
<pre><code>def logger(myFunc):
def new(*args, **keyargs):
print 'Entering %s.%s' % (myFunc.im_class.__name__, myFunc.__name__)
return myFunc(*args, **keyargs)
return new
cl... | <p>Claudiu's answer is correct, but you can also cheat by getting the class name off of the <code>self</code> argument. This will give misleading log statements in cases of inheritance, but will tell you the class of the object whose method is being called. For example:</p>
<pre><code>from functools import wraps # ... |
How to boost productivity in my Flex/Java stack? <p>I am embarking on a new RIA project with Java on the backend. I'm the only developer, and the app is a line-of-business application. My current stack looks like this:</p>
<p>MySQL || Spring(JdbcTemplate for data access) || BlazeDS (remoting) || Flex(Cairngorm)</p>
<... | <p><em>Manually coding SQL</em></p>
<p><a href="http://www.hibernate.org/" rel="nofollow">Hibernate</a> is an option to cut this out.</p>
<p>One thing that may be of interest is Grails with the available Flex Plugin. It's built on Spring, Hibernate and BlazeDS, so it's all there for you. It was unbelieveably easy to ... |
How do I randomly select an item from a list using Python? <p>Assume I have the following list:</p>
<pre><code>foo = ['a', 'b', 'c', 'd', 'e']
</code></pre>
<p>What is the simplest way to retrieve an item at random from this list?</p>
| <p>Use <a href="https://docs.python.org/2/library/random.html#random.choice"><code>random.choice</code></a>:</p>
<pre><code>import random
foo = ['a', 'b', 'c', 'd', 'e']
print(random.choice(foo))
</code></pre>
|
Accessing parent elements in an object model efficiently <p>I have a following object model:</p>
<pre>
- Book
-- Chapter 1
--- Page 1
---- Image 1
---- Image 2
---- Text 1
--- Page 2
...
</pre>
<p>Resources are way down at the page level. But, I need to know the full path to resources, from the resources' point of... | <p>I'd suggest a tree structure, whereas each of your classes inherits from a tree node.</p>
<p>Example in c#:</p>
<pre><code>class TreeNode {
public TreeNode Parent { get; set; }
public List<TreeNode> Children { get; set; }
}
class Book : TreeNode {
... book attributes ...
}
... other classes ...
</code><... |
How do I create a web application where I do not have access to the data? <p><em>Premise</em>: The requirements for an upcoming project include the fact that no one except for authorized users have access to certain data. This is usually fine, but this circumstance is not usual. The requirements state that there be no ... | <p>If you can have javascript on the page, then I don't think there's anything you can do. If you can see it in a browser, then that means it's in the DOM, which means you can write a script to get it and send it to you after it has been decrypted.</p>
<p>Aren't these problems usually solved via controls:</p>
<ol>
<... |
Create a makefile for multiple OSes, this make (ext?) doesn't work? <p>I have a working makefile that builds with mingw32. Now i renamed that makefile to Makefile.w32 (source -> <a href="http://pastie.org/319964" rel="nofollow">http://pastie.org/319964</a>)</p>
<p>Now i have a Makefile with the following. The problem ... | <p>"make Makefile.w32" is looking for a <strong>target</strong> named Makefile.w32, not a make file by that name. To run make and tell it to read the make file "Makefile.w32", use the -f switch:</p>
<pre><code>make -f Makefile.w32
</code></pre>
<p><strong>Edit</strong>: Incidentally, why do you launch a separate inst... |
Search for a regexp in a java arraylist <pre><code>ArrayList <String> list = new ArrayList();
list.add("behold");
list.add("bend");
list.add("bet");
list.add("bear");
list.add("beat");
list.add("become");
list.add("begin");
</code></pre>
<p>There is a way to search for the regexp bea.* and get the indexes like ... | <p>Herms got the basics right. If you want the Strings and not the indexes then you can improve by using the Java 5 foreach loop:</p>
<pre><code>import java.util.regex.Pattern;
import java.util.ListIterator;
import java.util.ArrayList;
/**
* Finds the index of all entries in the list that matches the regex
* @param... |
ASP.net 2.0 Gridview with Expanding Panel Rows -- How to build Panel "on the fly" <p>I'm currently building a Gridview that has expandable rows. Each row contains a dynamically created Panel of Form elements. Right now, I have a javascript function that expands (or in my case, makes visible) the panel when an Image is ... | <p>Actually, it isn't performing badly since my original SQL query can populate every single row and I have enabled paging on the Gridview. I'm just wondering if they can be built on the fly using PageMethods or some sort of JSON/AJAX solution. I haven't seen anything, but... worth a try in searching for it.</p>
|
Vector Shape on Stage Appears Over Dynamic Textfield <p>The subject pretty much explains it all. I start on frame one of a MovieClip with just a Bitmap covering the whole stage.</p>
<p>Then when a user clicks a button, it goes to frame two and a vector shape is on the stage covering part of the image. At the same time... | <p>Put the vector shape inside a movieclip. Then call:</p>
<pre><code>setChildIndex(myTextField, numChildren - 1);
</code></pre>
|
makefile calling makefile error <p>I have a working make, I have platform code and like several makes for each os in the folder. Right now I have one makefile which works. I renamed it to Makefile.ws and wrote this in Makefile</p>
<pre><code>all:
make -f Makefile.w32
clean:
make -f Makefile.w32 clean
</code><... | <p>First, what make are you running? Cygwin or MinGW, or something else? </p>
<pre><code>make -f Makefile.w32
make[1]: Entering directory `/c/nightly/test'
make -f Makefile.w32
make[3]: Makefile.w32: No such file or directory
</code></pre>
<p>"Entering directory" is a hint. Why is it entering /c/nightly/test? Is the... |
What is the purpose of allocating pages in the pagefile with CreateFileMapping? <p>The function <a href="http://msdn.microsoft.com/en-us/library/aa366537(VS.85).aspx" rel="nofollow">CreateFileMapping</a> can be used to allocate space in the pagefile (if the first argument is <code>INVALID_HANDLE_VALUE</code>). The all... | <p>From the CreateFileMappingFunction:</p>
<pre><code>A single file mapping object can be shared by multiple processes.
</code></pre>
<p>Can the Virtual memory be shared across multiple processes?</p>
|
How do you spawn a child process in Ruby? <p>I want to offload a block of code in my main process to child process to make it run concurrently. I also want to have the PID of the spawned child process so I can monitor and kill it if necessary.</p>
| <p>In addition to Chris' great answer, remember to call <code>Process.wait</code> from your master in order to reap your child process, else you'll leave zombies behind.</p>
<p>Example as requested in comments:</p>
<pre><code>pid = Process.fork do
puts "child, pid #{Process.pid} sleeping..."
sleep 5
puts "child... |
How to I export a system scope environment variable in bash <p>I need to set a system environment variable from a bash script that would be available outside of the current scope. So you would normally export environment variables like this: </p>
<blockquote>
<p>export MY_VAR=/opt/my_var</p>
</blockquote>
<p>But I... | <p>Not really - once you're running in a subprocess you can't affect your parent.</p>
<p>There two possibilities:</p>
<p>1) Source the script rather than run it (see <a href="http://www.gnu.org/software/bash/manual/bashref.html#Bourne-Shell-Builtins">source .</a>):</p>
<pre>
source {script}
</pre>
<p>2) Have th... |
maintaining ids in database that match client software enumerations <p>Lets say I have a table in a sql server 2000 database called TransactionType:</p>
<pre><code>CREATE TABLE [dbo].[TransactionType](
[ID] [int] NOT NULL,
[Description] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
CONSTRAINT [... | <p>You might consider using a coding system that's loosely tied (not enforced) to the child table. Lets say it's a color, your child table can look like the following.</p>
<pre><code>ID | Name
------------
GRN | Green
PURP| Purple
YELL| Yellow
RED | Red
</code></pre>
<p>Now you have an ID that if you displayed with... |
PHP function which does syntax color parsing for multiple languages? <p>I'm doing a PHP site which displays code examples in various languages (C#, PHP, Perl, Ruby, etc.). Are there any PHP functions which add syntax coloring for these and other languages? </p>
<p>If not, I would at least like to find that one built-i... | <p>Why not do the syntax coloration in the client side?</p>
<p>Use <a href="http://code.google.com/p/google-code-prettify/" rel="nofollow">prettify.js</a>, its really versatile, Google Code and StackOverflow use it!</p>
<p>Check the <a href="http://google-code-prettify.googlecode.com/svn/trunk/tests/prettify_test.htm... |
How do I imitate the ASP.NET AjaxOptions delegate functions? <p>When using the <code>Ajax.BeginForm()</code> helper in <code>ASP.Net MVC</code>, I can pass options with names of different functions, for example one to run <code>OnBegin</code>, one for <code>OnSuccess</code> etc. How do these work "under the hood"?</p>
... | <p>I found the answer to my problem:</p>
<p>What it really boiled down to, was executing a line of code contained in a string variable. This can easily be done using the 'eval(x)' syntax. The following example works for the onSuccess property:</p>
<pre>eval(settings.onSuccess)</pre>
<p>Sometimes you just need to thi... |
How can I reformat form input before POST using Javascript (or Rails)? <p>I have a field in my form labeled "Name" that will contain both the First & Last name.</p>
<p>Our existing dynamic server (to which the form is being POSTed to), expects two separate fields (first name, last name). </p>
<p>Can I use Javascr... | <p>You should not rely on client side parsing whenever possible. If you are sending this form to an app you can't modify, use the Javascript method mentioned above because you have no control over it (but then why not just have a first and last name field). But if you are controller the backend app, perform all your ... |
How do I improve performance of DataSet.ReadXml if I'm using a schema? <p>I'm have a ADO DataSet that I'm loading from its XML file via ReadXml. The data and the schema are in separate files.</p>
<p>Right now, it takes close to 13 seconds to load this DataSet. I can cut this to 700 milliseconds if I don't read the D... | <p>I will try to give you a performance comparison between storing data in text plain files and xml files.</p>
<p>The first function creates two files: one file with 1000000 records in plain text and one file with 1000000 (same data) records in xml. First you have to notice the difference in file size: ~64MB(plain tex... |
Emulate IDispatchEx in C# <p>C# 3.0 Extension methods add extensions to the base Type making calling that method on all <em>instances</em> of that Type legal.</p>
<p>Now, JavaScript I know implements IDispatchEx through which it's possible to add methods to a specific instance.</p>
<p>So how do I add a set of methods... | <p>Well, you could create a DynamicMethod instance for your "new" methods, but statically attaching them to an existing instance at runtime wouldn't work due to the fact it plain wouldn't compile. </p>
<p>You <em>might</em> (I haven't tried this) be able to emit the opcodes into an in-memory assembly, but that's about... |
How do I select a single element in jQuery? <p>I have a table structure that looks like:</p>
<pre><code><table>
<tr id="row1">
<td>
<div>row 1 content1</div>
</td>
<td>
<div>row 1 content2</div>
</td>
<td>
<div>row 1... | <p>jQuery always returns a set of elements. Sometimes, the set is empty. Sometimes, it contains only one element. The beauty of this is that you can write code to work the same way regardless of how many elements are matched:</p>
<pre><code>$("selector").each(function()
{
this.style.backgroundColor = "red";
});
</c... |
Tips on making good documentation for developers <p>I'm preparing documentation for an open source project. My target audience are developers.</p>
<p>Right now, I'm working on the API, porting and code design sections.</p>
<p>Anyone has any tips on making documentation for developers?</p>
| <p>Include simple examples that illustrates the intent of the API call in question. Very often, being able to look at code explains things much better then prose can (because of differences in culture, language ability etc).</p>
|
How do exceptions work (behind the scenes) in c++ <p>I keep seeing people say that exceptions are slow but I never see any proof. So instead of asking if they are I will ask how do exceptions work behind the scene so I can make a decisions of when to use them and if they are slow.</p>
<p>From what I know exceptions ar... | <p>Instead of guessing, I decided to actually look at the generated code with a small piece of C++ code and a somewhat old Linux install.</p>
<pre><code>class MyException
{
public:
MyException() { }
~MyException() { }
};
void my_throwing_function(bool throwit)
{
if (throwit)
throw MyException();
}
v... |
Easiest way to extract SharePoint list data to a separate SQL Server table? <p><strong>Edited:</strong>
What is the easiest way to <s>scrape</s> extract SharePoint list data to a separate SQL Server table? One condition: you're in a work environment where you don't control the SQL Server behind the SharePoint Server, s... | <p>There is a SSIS SharePoint task you can use to grab the data info a regular dataflow:
<a href="http://www.codeplex.com/SQLSrvIntegrationSrv">http://www.codeplex.com/SQLSrvIntegrationSrv</a></p>
|
How to remove duplicate values from an array in PHP <p>How can I remove duplicate values from an array in PHP?</p>
| <p>Use <a href="http://php.net/array_unique">array_unique()</a>.</p>
<p>Example:</p>
<pre><code>$array = array(1, 2, 2, 3);
$array = array_unique($array); // Array is now (1, 2, 3)
</code></pre>
|
In MVC, when do you use <%= %> and <% %>? <p>In asp.net mvc, when do we use:</p>
<p><%= %></p>
<p>and</p>
<p><% %></p>
<p>Do we ever need to put a ; (colon) ?</p>
| <p><code><%= %></code> renders the output (string) of the contained command to the response. <code><% %></code> wraps executable statements (logic) in the view to control what gets executed. You don't use semicolons in the <code><%= %></code> blocks, but may in the <code><% %></code> depending... |
Can I force a display font from inside a formula in Crystal Reports? <p>I have a report with a lot of formulas that translate the word "TRUE" into an "X" and "FALSE" into a blank space.</p>
<p>I use these to put an "X" in a checkbox.</p>
<p>Sometimes there is text after my checkbox. To avoid slight shifts to the lef... | <p>No, this is not possible. The context of a formula is the property for which the formula is set only. You cannot access properties of the whole object e.g. a field. Perhaps you could think about using two images suppressed by a formula depending on the value of your field. Then you would get rid of the font problem.... |
Complex builds in Visual Studio <p>I have a few things that I cannot find a good way to perform in Visual Studio:</p>
<ol>
<li><p>Pre-build step invokes a code generator that generates some source files which are later compiled. This can be solved to a limited extent by adding blank files to the project (which are lat... | <ol>
<li><p>If you need make behavior and are used to it, you can create <a href="http://msdn.microsoft.com/en-us/library/txcwa2xx(VS.80).aspx">visual studio makefile projects</a> and include them in your project.</p></li>
<li><p>If you want less clunky, you can write visual studio <a href="http://visualstudiohacks.com... |
Passing data to .NET C# WPF applications/DLLs <p>I have a .NET C# WPF application that I am trying to make into a single-instance application using a Mutex. </p>
<p>This .NET application is called by a C++-based DLL using CreateProcessAsUser() and is given parameters via environment variables. </p>
<p>Subsequent inst... | <p><em>The simplest I can think of is to export a function from the .NET application and then the subsequent instances can just call this function and pass the parameters to it.</em></p>
<p>This is not how this works. You'll load the .NET assembly in the calling process, not magically cross the process boundary and ta... |
Showing processing message in Python <p>I want to show the processing information or log in the original page when the submitted request is being served until it completes the execution. I thought it would be meaningful to the user to know what is happening behind the request.</p>
<p>I don't find a clue to do so thoug... | <p>there are two ways i could imagine handling this:</p>
<ol>
<li><p>have your backend script (python) output the information of a long process to a log of some sort (text file, database, session, etc...) and then have javascript grab the information via ajax and update the current page.</p></li>
<li><p>same deal, but... |
Procedure to submit iPhone application to App Store? <p>Is it necessary to pay $99 before I can watch the video to submit an iPhone application to the App Store, or it is available free of cost anywhere?</p>
| <p>You can join the developer program and watch the video without paying. It's on the home page of the iPhone Dev Centre after you've logged in. <a href="https://deimos.apple.com/WebObjects/Core.woa/BrowsePrivately/adc.apple.com.1579102445.01579102451.1580085281?i=2050284209" rel="nofollow">Direct link</a>.</p>
<p>Wha... |
Good library/libraries for datastructures in assembler <p>Are there any good libraries (preferably with commented source) for standard datastructures (Linked list, array list, queue, stack etc.) for x86 (or others)
in Assembler ?
I don't like to reinvent (and debug !) the wheel....</p>
| <p>Why not just find a good C library and call it from your asm?</p>
<p>Or if you need "inline" functionality:</p>
<ul>
<li>Compile the functions you want to use into a Hello World program.</li>
<li>Disassemble the program.</li>
<li>Rewrite the assembly as asm/pre-processor macros.</li>
</ul>
|
Convert a string to a date in C++ <p>I know this may be simple but being C++ I doubt it will be. How do I convert a string in the form 01/01/2008 to a date so I can manipulate it? I am happy to break the string into the day month year constituents. Also happy if solution is Windows only.</p>
| <pre><code>#include <time.h>
char *strptime(const char *buf, const char *format, struct tm *tm);
</code></pre>
|
Netbeans or Eclipse for C++? <p>I'm currently working on a pet project and need to do C++ development on Windows, Mac, Linux, and Solaris, and I've narrowed it down to Netbeans and Eclipse, so I was wonderig which is more solid as a C++ editor. I just need solid editing, good autocompletion for templated code ad extern... | <p>I haven't used NetBeans, but Eclipse CDT (C Developer Tools, which includes C++), especially with the latest version, is really quite excellent:</p>
<ul>
<li>Syntax checking and spell checking</li>
<li>Syntax highlighting that distinguishes between library calls and your function calls and between local and member ... |
Do you use Template Method Pattern in programming languages with closures/delegates/function pointers? <p>I have been going back and forth between C# and Java for the last 8 years. </p>
<p>One thing that strikes me is that I have completely stopped using the "Template Method" design pattern in C#. Actually, in C# I Ha... | <p>When I used Java, yes. But for languages with "closures/delegates/function", Lua in my case, no I don't anymore, instead I've been leaning more and more towards <a href="http://en.wikipedia.org/wiki/Decorator_pattern" rel="nofollow">decoration pattern</a> for most of my needs.</p>
|
How do I make a thread dump in JBoss 4.0.5 on Windows <p><br />
I'm running JBoss 4.0.5 on Windows 2003 x64 and wonder if there is any way to get a dump of all threads? </p>
<ul>
<li><p>It's stared with FireDaemon so I don't have a console windows in which to ctrl-break.</p></li>
<li><p>It's running under java 1.5 so... | <p>I actually found a better way than what <a href="http://stackoverflow.com/users/3253/gowri">Gowri</a>
suggested (after starting to implementing the jsp).</p>
<p>There is actually a way to dump the threads from the jmx-console in the Server Info MBean, see <a href="http://www.jboss.org/community/docs/DOC-9804" rel="... |
LINQ To SQL Weird Join Issue <p>I have a simple database with two tables. Users and Configurations. A user has a foreign key to link it to a particular configuration.</p>
<p>I am having a strange problem where the following query always causes an inner join to the Configuration table regardless of the second parameter... | <p>I dont think it will work like that.</p>
<p>I suggest splitting it into 2 distinct queries. </p>
<p>There are probably better ways, but it would require more 'plumbling'.</p>
|
Select X Most Recent Non-Consecutive Days Worth of Data <p>Anyone got any insight as to select x number of non-consecutive days worth of data? Dates are standard sql datetime. So for example I'd like to select 5 most recent days worth of data, but there could be many days gap between records, so just selecting records ... | <p>Following the approach <a href="http://stackoverflow.com/questions/308650/select-x-most-recent-non-consecutive-days-worth-of-data#308670">Tony Andrews</a> suggested, here is a way of doing it in T-SQL:</p>
<pre><code>SELECT
Value,
ValueDate
FROM
Data
WHERE
ValueDate >=
(
SELECT
CONVERT(DATE... |
Does PageRank mean anything? <p>Is it a measure of anything that a developer or even manager can look at and get meaning from? I know at one time, it was all about the 7, 8, 9, and 10 PageRank. But is it still a valid measure of anything? If so, what can you learn from a PageRank?</p>
<p>Note that I'm assuming that yo... | <p>PageRank is specific to <strong>Google</strong> and is a trademarked proprietary algorithm. </p>
<p>There are many variables in the formulas used by Google, but PageRank is primarily affected by the number of links pointing to the page, the number of internal links pointing to the page within the site and the numbe... |
.net webservice publishing process question <p>I have a webservice that exists in an asp.net website. When I publish the site to a test server I have to go into the bin folder and into the .svc file for the service and manually change the URL to correctly reflect the test server URL. Is there a better way to handle s... | <p>You could always run a build tool to automatically do this for you.</p>
|
Rewritepath and IIS Integrated Mode <p>I have big issue with url-rewriting for IIS 7.0.</p>
<p>I've written simple module for rewriting for my NET3.5/IIS7 web application. Here is a part of the code.</p>
<pre><code> public void Init(HttpApplication context)
{
context.BeginRequest += new EventHandler(co... | <p>Just a guess: Qualify your type with the assembly name (type="MyModule,MyAssembly")</p>
|
dotnet: How do you get average character width for a font? <p>Windows Forms:</p>
<p>For <code>System.Drawing</code> there is a way to get the font height. </p>
<pre><code>Font font = new Font("Arial", 10 , FontStyle.Regular);
float fontHeight = font.GetHeight();
</code></pre>
<p>But how do you get the other text me... | <p>Use Graphics.MeasureString Method</p>
<pre><code>private void MeasureStringMin(PaintEventArgs e)
{
// Set up string.
string measureString = "Measure String";
Font stringFont = new Font("Arial", 16);
// Measure string.
SizeF stringSize = new SizeF();
stringSize = e.Graphics.MeasureString(me... |
hibernate auto-discovery and generation of of database mappings to POJOs <p>Are there any tools that auto-generate the hibernate POJOs by gathering information from the database?</p>
<p>I made a perl script to do this after the schema got changed for the third or fourth time in a project i'm working with and just wond... | <p>See <a href="https://docs.jboss.org/tools/latest/en/hibernatetools/html/reverseengineering.html" rel="nofollow">hibernate reverse engineering</a></p>
|
Editing documents seamlessly in a Web Application <p>We have a web application, which involves a lot of documents. In a typical use case, a document will be generated from our web application. The user download the generated document to the local file system and modify it. After this work, the user upload the modified ... | <p>I don't think this is possible without a plugin. I've used activex in the past, maybe it would be possible to write a cross-platform java applet?</p>
|
Installing SVN username password issue <p>I'm installing SVN with Apache 2.2 on windows 2003 everything seems good but when I try to login no username/password works</p>
<p>Here is some info<br>
I load this module in httpd.conf<br>
LoadModule auth_basic_module modules/mod_auth_basic.so<br>
<br>
and in svnserv.conf i h... | <p>I think the problem might be that you need to generate the password file using <a href="http://httpd.apache.org/docs/1.3/programs/htpasswd.html" rel="nofollow">htpasswd</a>. Storing unencrypted passwords isn't a good thing!</p>
|
Problem running a Jar file <p>I've compiled a java project into a Jar file, and am having issues running it.</p>
<p>When I run:</p>
<pre><code>java -jar myJar.jar
</code></pre>
<p>I get the following error</p>
<pre><code>Could not find the main class: myClass
</code></pre>
<p>The class file is not in the root dire... | <p>In your manifest file, make sure you have the attribute <code>Main-Class</code> set to the name of the class containing your <code>main()</code> method. For example, if the package-qualified name of the class is <code>my.cool.Class</code>, then, in your JAR manifest, <code>Main-Class</code> should be set to <code>my... |
nVidia SLI Tricks <p>I'm optimizing a directx graphics application to take advantage of nVidia's SLI technology. I'm currently investigating some of the techniques mentioned in their 'Best Practices' web page, but wanted to know what advice/experience any of you have had with this? </p>
<p>Thanks!</p>
| <p>This is not really an answer to you question, more of a comment on SLI. </p>
<p>My understanding is that SLI is only really a cost-effective means of gaining performance when you buy two cards right away, which few people actually do. Many people buy an SLI motherboard and card thinking it will give them a better u... |
PCL raster color graphics distorted. Code included: what am I missing? <p>The function below prints a color raster image to a PCL-5 printer. The function was adapted from a 2-color (1bpp) printing function we had that worked perfectly, except for the grainy 2-color printing. The problem is that the image comes out wi... | <p>There are a few problems with your code. First off your cursor position code is incorrect, it should read:</p>
<pre><code>"\u001b*p{0:d}x1:d}Y", 1000, 1000
</code></pre>
<p>This equates to:</p>
<pre><code><esc>*p1000x1000Y
</code></pre>
<p>you had:</p>
<pre><code><esc>*p1000x*p1000Y
</code></pre>
... |
Lisp In A Box - Why is it starting a server? <p>I've decided to get back into LISP (haven't used it since my AI classes) to get more comfortable with functional programming in general, so I downloaded Lisp In A Box (which we actually used in a previous class) which comes with CLISP and Emacs.</p>
<p>When I run it, it ... | <p>The purpose is so that Lisp will be running in parallel.</p>
<p>Slime connects to the session and then you can have the same environment, definitions, etc from many different windows (or machines even). This means that you can start up your application and debug it on the fly, for instance.</p>
<p>For further info... |
How to Establish Inheritance Between Objects in JavaScript? <p>I have the following code that creates two objects (ProfileManager and EmployerManager) where the object EmployerManager is supposed to inherit from the object ProfileManager.
However, when I do alert(pm instanceof ProfileManager); it returns false.</p>
<... | <p>I've been using something similar to Dean Edward's Base.js model.
<a href="http://dean.edwards.name/weblog/2006/03/base/" rel="nofollow">http://dean.edwards.name/weblog/2006/03/base/</a></p>
|
Communicating from website to desktop application (not vice-versa) <p>I am designing an application that will have to react to certain website actions, mostly in the same way as the Last.FM client does.</p>
<p>The way the Last.FM client works is that it first registers a custom protocol in Windows (<code>lastfm://</co... | <p>I've often wanted to see more applications that do this because the integration between web and local makes for a great experience (if you ignore any spammy related qualms)</p>
|
inheritance from two parent classes <p>I read about this ages ago but never tried it now I can't remember if this is possible or not. Is it possible to extend a class from two parents on php5 e.g.</p>
<p>class_d extends class_c and class_b</p>
<p>moreover can you do this if class_c and class_b are themselves extended... | <p>multiple inheritance (what you are looking for) is not supported in PHP. </p>
<p>You may want to check out <a href="http://www.devshed.com/c/a/PHP/Object-Interaction-in-PHP-Introduction-to-Composition/" rel="nofollow">composition</a> (where one class contains an instance of the parent) or even <a href="http://us.ph... |
Declare-and-throw vs. throw-without-being-declared exceptions <p>In Java, what is the difference between the twin methods?</p>
<pre><code>public void methodA() throws AnException {
//do something
throw new AnException();
}
public void methodA() {
//do the same thing
throw new AnException();
}
</code><... | <p>If AnException is a checked exception (in other words, if it doesn't extend RuntimeException) then methodA won't compile. Checked exceptions must always be declated.</p>
<p>If AnException is an unchecked exception (if it does extend RuntimeException), then either is allowed by the java compiler, and either is inte... |
Mapping a class with multiple collection properties containing the same object type <p>Our system generates emails with user-chosen lists of To / CC / BCC contacts. I wanted to store them as follows in our SQL Server database, here's the simplified database table structure:</p>
<pre><code>CREATE TABLE [Contact] (
... | <p>According to the article you cite by Billy McCafferty:</p>
<blockquote>
<p>At first glance, this might imply that you'd have to create a CustomerAddress object in your domain model to reflect this relationship table in the DB; that's not the case with NHibernate. Instead, you'd simply add a many-to-many associat... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.