instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>We're trying to send an image of a large SWF file to a server to have it mailed out and we're having a bit of trouble with transmission time. </p> <p>The SWF is about 900px x 600px and restricted to AS2 so we've been using this Bitmap Exporter class. We've tried using several different ways to transmit the data; ba...
<p>The reason you get such long upload times is that the image is barely compressed (or not at all depending on how the class is implemented). 900 by 600 pixels at 16 bpp (or whatever it now is flash uses) amounts to something like 1.5mb of raw data. </p> <p>I'm doubtful that there are any useful compression libraries...
<p>You could also try using amfphp because it allows for binary serialization when sending data to server. </p>
38,392
<p>I am working on a robot automation project and I have run into a road block. To control the robot, one needs to connect with it wirelessly via telnet and send commands through the tcp/ip protocol. (ex. The 'Mabc' command moves it forward based on the left wheel speed (a), the right wheel speed (b) and time (c)). Wha...
<p>You are looking for sockets. <a href="http://www.beej.us/guide/bgnet/" rel="noreferrer">This is a comprehensive guide to socket programming in C.</a> Telnet is also a well defined protocol, although I don't know if this robot would use telnet or not (it's extra processing overhead for a protocol that wouldn't have m...
<p>I would be:</p> <ul> <li>writing some simple shell scripts containing the telnet interractions written as here documents.</li> <li>using a .telnetrc file in your home directory to control aspects of your telnet session, e.g. crmod</li> <li>calling the script using system calls.</li> </ul> <p>This way your turnarou...
24,811
<p>What is WCF performance like compared to other solutions such as ASMX or even a custom module? </p> <p>Example: An online multi-player video game based on AJAX with JSON with data always going back and forth with the browser and server with hundreds of thousands to millions of users.</p>
<p>if you want to compare ASMX against WCF, <a href="https://stackoverflow.com/questions/216931/what-is-the-difference-between-an-aspnet-web-method-and-a-wcf-service">there are several posts about it</a>...</p>
<p><a href="http://download.microsoft.com/download/4/8/6/486b4b4f-5a87-4b5c-beec-455290f83274/TradeBenchmark_WinServer2008.pdf" rel="nofollow noreferrer">WCF vs. WebSphere</a>. This is a good detailed performance test based on the <a href="http://msdn.microsoft.com/en-us/netframework/bb499684.aspx" rel="nofollow norefe...
37,611
<p>I am currently building an Excel 2007 Add-in using VSTO (latest version + sp1) and .Net 3.5</p> <p>The code simply takes the position a chart using the Top and Left properties and stores it in an XML file.</p> <p>The problem im facing is that when the xml is generated using a Vista Ultimate + Excel 2007 + English ...
<p>I'm not sure if this will help or not, but you may want to check out the System.Xml.XmlConvert class. This class will allow you to serialize data types to a string value that is locale independent. When you extract the xml on another machine you can convert the value back into the appropriate data type using this ...
<p>You need to post more info about exactly what you are doing and what error you are seeing. Probably you need to be formatting / parsing the numeric values using CultureInfo.InvariantCulture rather than the default CultureInfo.CurrentCulture.</p>
20,083
<p>When I make a query, I often wonder about this:</p> <blockquote> <p>Is it better to add extra field(s) to the table, or just get the values and calculate in your server side language?</p> </blockquote> <p>For example, table Student contains Student.score field. I want to get the grades.</p> <blockquote> <p>Do I get ...
<p>Your DB is a lot more powerful than you give it credit for.</p> <p>A lot of this depends on your DB type and versions but there are procedures and functions you can use to make your scripts more efficient. These methods can be simple quick calls compared to the multi-line solutions server-side languages present. Wh...
<p>When you add the extra field, you also need to consider that the extra fields will also need to be updated whenever the field it depends on is updated. Is it possible to move the calculation into the SQL instead of looping through the record set and doing it in the server-side code?</p>
31,999
<p>I need to make a pop-up window for users to log-in to my website from other websites.</p> <p>I need to use a pop-up window to show the user the address bar so that they know it is a secure login, and not a spoof. For example, if I used a floating iframe, websites could spoof my login window and record the user's l...
<p>Take a look at <a href="http://www.quirksmode.org/js/popup.html" rel="nofollow noreferrer">this site.</a></p> <p>Some code copied from it:</p> <pre><code>&lt;script language="javascript" type="text/javascript"&gt; &lt;!-- function popitup(url) { newwindow=window.open(url,'name','height=200,width=150'); i...
<p>If your users are using IE, and your site is in the trusted sites, the popup blocker will be deactivated.</p> <p>Does that help?</p>
45,768
<p>Suppose, objects of type <i>A</i> are stored in DB. Here's the way I load specific one from DB using hibernate:</p> <pre><code>org.hibernate.Session session = ...; long id = 1; A obj = session.load(A.class, id); </code></pre> <p>If object with id=1 doesn't exist I will get <i>ObjectNotFoundException</i>. But is th...
<p>You can use <code>session.get</code>:</p> <pre><code>public Object get(Class clazz, Serializable id) throws HibernateException </code></pre> <p>It will return null if the object does not exist in the database. You can find more information in <a href="http://www.hibernate.org/hib_docs/...
<p>A bit simplified method of @Journeycorner</p> <pre><code>public boolean exists(Class&lt;?&gt; clazz, Object idValue) { return getSession().createCriteria(clazz) .add(Restrictions.idEq(idValue)) .setProjection(Projections.id()) .uniqueResult() != null; } </code></pre> <p>A be...
27,306
<p>I'm taking on the re-architecting of a pair of applications which use <a href="http://www.hibernate.org/" rel="nofollow noreferrer">Hibernate</a> in one case, and a combination of Hibernate and a Java <a href="http://en.wikipedia.org/wiki/Content_repository_API_for_Java" rel="nofollow noreferrer">Content Repository<...
<p>There are DBA's and there are DBA's. Some DBA's are administrators -- backup, restore, grant, revoke -- kind of people. Keep The Lights On. Foundational.</p> <p>Other DBA's are architect/designers. "Fixing this will involve data modeling" That's what this second tier of DBA's <em>should</em> be doing.</p> <p>...
<p>I'd say it depends on your app - you can still do native queries with Hibernate - so it depends whether there are any of those that might be present and need tuning. Similarly it depends on performance required - if there is any performance critical sections, you may need support in identifying what is slowing that...
22,661
<p>I want to do some basic filtering on a file. Read it, do processing, write it back. </p> <p>I'm not looking for "golfing", but want the simplest and most elegant method to achieve this. I came up with:</p> <pre><code>from __future__ import with_statement filename = "..." # or sys.argv... with open(filename) as f...
<p>Actually an easier way using fileinput is to use the inplace parameter:</p> <pre><code>import fileinput for line in fileinput.input (filenameToProcess, inplace=1): process (line) </code></pre> <p>If you use the inplace parameter it will redirect stdout to your file, so that if you do a print it will write back...
<p>My ugly (but short as stated in the question) solution with <a href="http://www.python.org/doc/2.5.2/ref/genexpr.html" rel="nofollow noreferrer">generator expressions</a>;</p> <pre><code># Some setup first file('test.txt', 'w').write('\n'.join('%05d' % i for i in range(100))) # This is the filter function def f(i...
28,148
<p>I have an already large table that my clients are asking for me to extend the length of the notes field. The notes field is already an NVARCHAR(1000) and I am being asked to expand it to 3000. The long term solution is to move notes out of the table and create a notes table that uses an NVARCHAR(max) field that is...
<p>text and ntext are deprecated in favor of varchar(max) and nvarchar(max). So nvarchar(3000) should be fine.</p>
<p>You may also experience more slowness as your data pages may get split up to accomodate the larger field. You can create a structure that allows a record of more than 8060 bytes by doing this but be aware if you try to add a data record that actually contains more than that you will have a problem.</p>
39,323
<p>I often find myself using Integers to represent values in different "spaces". For example...</p> <pre><code>int arrayIndex; int usersAge; int daysToChristmas; </code></pre> <p>Ideally, I'd like to have separate classes for each of these types "Index","Years" and "Days", which should prevent me accidentally mixing ...
<p>You could try BOOST_STRONG_TYPEDEF. From <code>boost/strong_typedef.hpp</code>:</p> <pre><code>// macro used to implement a strong typedef. strong typedef // guarentees that two types are distinguised even though the // share the same underlying implementation. typedef does not create // a new type. BOOST_STRONG...
<pre><code>int arrayIndex; </code></pre> <p>This is what <code>std::size_t</code> is for.</p> <pre><code>int usersAge; </code></pre> <p>People can't have negative ages and it is not useful/easy to set a fixed upper bound for ages. So here you should just use <code>unsigned int</code>. </p> <pre><code>int daysToChri...
45,875
<p>FreeMarker templates support an if-statement with the following syntax</p> <pre><code>&lt;#if hot&gt; It's hot. &lt;/#if&gt; </code></pre> <p>I've looked in the documentation and can't find any support for an if-else statement. Of course, I could achieve the same result with:</p> <pre><code>&lt;#if hot&gt; ...
<p>Yes, you can write:</p> <pre><code>&lt;#if hot&gt; it's hot &lt;#else&gt; it's not &lt;/#if&gt; </code></pre> <p>And if you're doing lots of freemarker, I really can recommend IntelliJ IDEA 8, its freemarker support really helps...</p>
<p><em>iberck</em> had already pointed out the docs. But here is the exact documentation about <a href="http://freemarker.sourceforge.net/docs/ref_directive_if.html" rel="nofollow noreferrer">if-else in FreeMarker</a>. </p>
37,929
<p>I have just started reading DDD. I am unable to completely grasp the concept of Entity vs Value objects.. Can someone please explain the problems (maintainability, performance.. etc) a system could face when a Value object is designed as a Entity object? Example would be great...</p>
<p>Reduced to the essential distinction, identity matters for entities, but does not matter for value objects. For example, someone's Name is a value object. A Customer entity might be composed of a customer Name (value object), List&lt;Order&gt; OrderHistory (List of entities), and perhaps a default Address (typically...
<p>Consider the following examples from <em><strong>Wikipedia</strong></em>, in order to better understand the difference between Value Objects and Entities:</p> <p><strong>Value Object:</strong> When people exchange dollar bills, they generally do not distinguish between each unique bill; they only are concerned about...
10,107
<p>I'm using gvim on Windows.</p> <p>In my _vimrc I've added:</p> <pre><code>set shell=powershell.exe set shellcmdflag=-c set shellpipe=&gt; set shellredir=&gt; function! Test() echo system("dir -name") endfunction command! -nargs=0 Test :call Test() </code></pre> <p>If I execute this function (:Test) I see nons...
<p>It is a bit of a hack, but the following works in Vim 7.2. Notice, I am running Powershell within a CMD session.</p> <pre><code>if has("win32") set shell=cmd.exe set shellcmdflag=/c\ powershell.exe\ -NoLogo\ -NoProfile\ -NonInteractive\ -ExecutionPolicy\ RemoteSigned set shellpipe=| set shellredir=&...
<p>I don't use VIM but Powershell's default output is Unicode. Notepad can read unicode, you could use it to see if you are getting the output you expect.</p>
12,002
<p>I'm having trouble writing a regular expression that matches valid IPv6 addresses, including those in their compressed form (with <code>::</code> or leading zeros omitted from each byte pair). </p> <p>Can someone suggest a regular expression that would fulfill the requirement?</p> <p>I'm considering expanding eac...
<p>I was unable to get @Factor Mystic's answer to work with POSIX regular expressions, so I wrote one that works with POSIX regular expressions and PERL regular expressions.</p> <p>It should match:</p> <ul> <li>IPv6 addresses</li> <li>zero compressed IPv6 addresses (<a href="https://www.rfc-editor.org/rfc/rfc5952#secti...
<p>The regex allows the use of leading zeros in the IPv4 parts.</p> <p>Some Unix and Mac distros convert those segments into octals.</p> <p>I suggest using <code>25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d</code> as an IPv4 segment.</p>
7,698
<p>I have an external program that will generate an xml document out from the db and pass it to BizTalk. Is it possible to create a transaction id or something(the id the message as in the DB) so I can keep track of the message in BizTalk, and store information in a BizTalk custom Pipeline to the database with the give...
<p>From an architectural point of view, as is often the case, there are several ways to achieve what you want, and how the solution would look like will vary greatly depending on your exact scenario. </p> <p>Within BizTalk, the best way to track a flow initiated by a particular message is the interchange id. </p> <p>...
<p>If you post a message to BizTalk, it returns to you by default the SubmissionHandle. This is a Context property available to you from the receive port. It can then be captured in an orchestration and used to correlate errors back to the original submission.</p> <p>Optionally, you can use a two way receive HTTP po...
43,792
<p>I've been wondering if it's possible to have Fluent-NHibernate communicate with stored procedures that already exist and assign mapping from the result set to my own domain objects.</p> <p>Also is Fluent-NHibernate able to directly execute procedures with no result set returned?</p> <p>Basically I've been consider...
<p>Just to answer my own question, the answer is no other than you can write xml mapppings for NHibernate and combine them with Fluent-NHibernate mappings. SP mapping for FNH will most likely be added later.</p>
<p>Just to answer my own question, the answer is no other than you can write xml mapppings for NHibernate and combine them with Fluent-NHibernate mappings. SP mapping for FNH will most likely be added later.</p>
37,945
<p>As a general rule, I prefer using value rather than pointer semantics in C++ (ie using <code>vector&lt;Class&gt;</code> instead of <code>vector&lt;Class*&gt;</code>). Usually the slight loss in performance is more than made up for by not having to remember to delete dynamically allocated objects.</p> <p>Unfortunate...
<p>Since the objects of different classes will have different sizes, you would end up running into the slicing problem if you store them as values.</p> <p>One reasonable solution is to store container safe smart pointers. I normally use boost::shared_ptr which is safe to store in a container. Note that std::auto_ptr i...
<p>I'm using my own templated collection class with exposed value type semantics, but internally it stores pointers. It's using a custom iterator class that when dereferenced gets a value reference instead of a pointer. Copying the collection makes deep item copies, instead of duplicated pointers, and this is where mos...
6,234
<p>I am an intermediate C programmer. If you have made any coding mistake that you came to know later that it was the most hazardous / harmful to the total application please share that code or description. I want to know this because in future I may come across such situations and I want to have your advice to avoid s...
<pre><code>if (c = 1) // insert code here </code></pre>
<p>One thing to look after are array bounds. If you go out of bounds, with bad luck you may end up overwriting memory that is used for other data.</p> <p>One nasty bug related to this was going out of bounds for a static array variable in a function. That ended up as a function changing values of the local variables o...
35,890
<p>Is there a way to Minimize an external application that I don't have control over from with-in my Delphi application?</p> <p>for example notepad.exe, except the application I want to minimize will only ever have one instance.</p>
<p>You can use <strong>FindWindow</strong> to find the application handle and <strong>ShowWindow</strong> to minimize it. </p> <pre><code>var Indicador :Integer; begin // Find the window by Classname Indicador := FindWindow(PChar('notepad'), nil); // if finded if (Indicador &lt;&gt; 0) then begin // ...
<p>I guess FindWindow(PChar('notepad'), nil) should be FindWindow(nil, PChar('notepad')) to find the window by title.</p>
16,140
<p>I want to add the current month, and the previous two months to a prompt, for a user to select. </p> <p>e.g. if this month is <code>2008 Nov</code>, <code>ddlbox</code> should show the following:</p> <pre><code>112008 102008 092008 </code></pre> <p>How can I do this? </p>
<pre><code>&lt;asp:DropDownList ID="DropDownList1" runat="server"&gt; &lt;/asp:DropDownList&gt; for (int i = 0; i &lt; 3; i++) { ListItem item = new ListItem(string.Format("{0: MM/yyyy}", DateTime.Now.AddMonths(-i))); DropDownList1.Items.Add(item); } </code></pre> <p>Try this :)</p>
<p>You could also create a query subject with SQL like this Oracle example:</p> <pre><code>SELECT to_char(add_months(SYSDATE, -1 * LEVEL + 1), 'MMYYYY') AS mon FROM dual CONNECT BY rownum &lt; 4 </code></pre>
41,576
<p>I'm trying to access a data source that is defined within a web container (JBoss) from a fat client outside the container.</p> <p>I've decided to look up the data source through JNDI. Actually, my persistence framework (Ibatis) does this.</p> <p>When performing queries I always end up getting this error:</p> <pre...
<p>Not sure if this is the same issue?</p> <p><a href="http://www.redhat.com/docs/manuals/jboss/jboss-eap-4.2/doc/Server_Configuration_Guide/Connectors_on_JBoss-Configuring_JDBC_DataSources.html" rel="nofollow noreferrer">JBoss DataSource config</a></p> <blockquote> <p>DataSource wrappers are not usable outside of ...
<p>I think the exception indicates that the SQLConnection object you're trying to retrieve doesn't implement the Serializable interface, so it can't be passed to you the way you asked for it.</p> <p>From the limited work I've done with JDNI, if you're asking for an object via JNDI it must be serializable. As far as I ...
6,006
<p>Browsing to a dynamic web page built using Grails version 1.0.3 the console log shows the following errors for each page request:</p> <pre><code>[Fatal Error] :-1:-1: Premature end of file. </code></pre> <p>How do I stop this error from appearing for each request?</p>
<p>This bug was already fixed: <a href="http://jira.codehaus.org/browse/GRAILS-3088" rel="nofollow noreferrer">http://jira.codehaus.org/browse/GRAILS-3088</a></p> <blockquote> <p>Premature end of file</p> <p>Affects Version/s: 1.0.3<br> Fix Version/s: <a href="http://web.archive.org/web/20080914033743/http:...
<p>Upgrading to a 1.0.4 snapshot is probably the best way to deal with this issue. Check out the instructions under "Grails Development Builds" at <a href="http://grails.org/Download" rel="nofollow noreferrer">the Grails Download page</a>.</p> <p>It can also be ignored without too much difficulty.</p>
16,475
<p>Everyday I receive thousands of emails and I want to parse the content/body of these emails to load them into a database.</p> <p>My problem is that nowadays I am parsing the email body manually and I would like to change the logic to a <strong>Regular Expression in C#.</strong></p> <p>Here is the body of the email...
<p>Read <a href="http://www.amazon.ca/Mastering-Regular-Expressions-Jeffrey-Friedl/dp/0596528124/ref=pd_bbs_sr_1?ie=UTF8&amp;s=books&amp;qid=1229190700&amp;sr=8-1" rel="nofollow noreferrer">Mastering Regular Expressions</a>. It will teach you everything you need to know to complete this and other similar regex problem...
<p>We found that for spam filtering and other high-volume applications, <strong>regular expressions are a bit slow</strong> for parsing MIME headers, which is what you want to do. The code is somewhat specialized, but I wrote a <a href="http://www.cs.tufts.edu/~nr/drop/fastmime.c" rel="nofollow noreferrer">C state mac...
47,718
<p>Assuming a variable contains spaces, newlines, and tabs followed by some text, why does this:</p> <pre><code>${var#"${var%%[![:space:]]*}"} # strip var of everything # but whitespace # then remove what's left # (i.e. ...
<p>If I set <code>var=" This is a test "</code>, both your suggestions do not work; just the leading stuff is removed. Why not use the replace functionality that removes all occurrences of whitespace and not just the first:</p> <pre><code> ${var//[[:space:]]} </code></pre>
<p>What about $(echo $var)</p> <pre><code>&gt; a=" 123 456 " ; a2="$(echo $a)" ; echo "a=\"${a}\" a2=\"${a2}\"" a=" 123 456 " a2="123 456" </code></pre>
41,975
<p>Are there any programs or IDEs that support refactoring for Ruby or RoR?</p>
<p>The best refactoring tool is good test coverage. If your tests cover your code and they all past you can just make whatever changes you want and the tests will find any dependencies you have broken. This is the main reason why IDE-based refactoring tools are less prevalent in Ruby than elsewhere.</p>
<p>There's also <a href="http://www.codegear.com/products/3rdrail" rel="nofollow noreferrer">3rdRail</a> from CodeGear (from Delphi fame). The only catch is that it's not free.</p>
9,848
<p>I have a list of items in a hierarchy, and I'm attempting to parse this list out into an actual hierarchy of objects. I'm using <a href="http://www.sitepoint.com/article/hierarchical-data-database/2/" rel="noreferrer">modified pre-order tree traversal</a> to store/iterate through this list, and so what I have is a s...
<p>Here's the function I ended up writing. I'm using MPTT to store objects, so the list is in order of the 'left' value, which basically means the parent always comes before any given item in the list. In other words, the item referenced by item.ParentID has always already been added (except in the case of top-level or...
<p>Here is an example, hope this helps</p> <pre><code>class Program { static void Main(string[] args) { TreeObject a = new TreeObject() { Name = "Item A" }; a.Children.Add( new TreeObject() { Name = "Item A.1" }); a.Children.Add( new TreeObject() { Name = "Item A.2" }); TreeOb...
41,252
<p>What WPF book covers ItemsControl.GetContainerForItemOverride and related in detail? Additionally I would like to read about why TreeView overrides it and how IsItemItsOwnContainerOverride is related to it.</p>
<p>I'm not sure what books are out there, but here is some required reading on how ItemsControls work:</p> <ul> <li><a href="http://drwpf.com/blog/ItemsControlSeries/tabid/59/Default.aspx" rel="nofollow noreferrer">Dr, WPF - Items Control A- Z</a></li> <li><a href="http://www.codeproject.com/KB/WPF/TreeViewWithViewMod...
<p>Here's a real world example of where this override is used in relation to a TreeView control: <a href="http://blogs.msdn.com/jpricket/archive/2008/08/05/wpf-a-stretching-treeview.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/jpricket/archive/2008/08/05/wpf-a-stretching-treeview.aspx</a></p> <p>I hope this h...
47,525
<p>How can an object be loaded via Hibernate based on a field value of a member object? For example, suppose the following classes existed, with a one-to-one relationship between bar and foo:</p> <pre><code>Foo { Long id; } Bar { Long id; Foo aMember; } </code></pre> <p>How could one use Hibernate Criter...
<p>You can absolutely use Criteria in an efficient manner to accomplish this:</p> <pre><code>session.createCriteria(Bar.class). createAlias("aMember", "a"). add(Restrictions.eq("a.id", fooId)); </code></pre> <p>ought to do the trick.</p>
<p>You can use Criteria or HQL.</p> <p>HQL example:</p> <p>Query query = session.createQuery("from Bar as bar where bar.aMember.id = :fooId");</p> <p>query.setParameter("fooId", fooId);</p> <p>List result = query.list();</p>
18,195
<p>I am trying to create some HTML which shows me if my server is available from the internet, green light OK red light unavailable. This I can do for a remote site but not for my home, my router seems to prevent me from returning to home via my static IP address. I want to create some HTML so that I see how I look fro...
<p>You are attacking the problem on the wrong angle.</p> <p>Any code in a page is going to be executed client side, by definition.</p> <p>If you need something executed somewhere else, you need an external server at that other place. That can be a very simple http server that you could query with XMLHttpRequest on yo...
<p>Symptom: "Other people can reach my server, but I can't view it locally."</p> <p>Problem: You have a <a href="http://www.dyndns.com/support/kb/loopback_connections.html" rel="nofollow noreferrer">Loopback Connection Error</a>.</p> <p>Read the link and their solution. See if that helps.</p>
38,999
<p>On large tables in MSSQL; selecting specific columns results in greater speed of the query. Does the same apply to Linq to SQL?</p> <p>Would this:</p> <pre><code>var person = from p in [DataContextObject].Persons where p.PersonsID == 1 select new { p.PersonsID, p.PersonsAdress, p.PersonsZ...
<p>I highly recommend <a href="http://linqpad.net/" rel="nofollow noreferrer">LinqPad</a>. It is free and lets you run LINQ queries dynamically. When you can also look at the SQL that is generated.</p> <p>What you will see is that the LINQ query will translate the first query into selecting only those columns. So i...
<p>I think the same applies, because LINQ to SQL translates the Linq query operations to SQL commands.</p>
24,634
<p>We have an Access DB which has a set of local tables and input forms etc. in which a user maintains their data.</p> <p>We also have a SQL DB with the same tables which is used to displays the data in a web search form.</p> <p>What is the best way to allow the user to udate his changes to the SQL db while keeping t...
<p>Often your operating system will help you with these things, at least in (most distributions of) Linux. As soon as a piece of software is available as an installable package, and installed, your package management system will keep track of it and it will be possible to find out that a new version is available.</p> ...
<p>On Windows, many installers handle this for you, for example the InstallShield update manager. Personally, I disable most of these until I need the new functionality or something goes wrong. Reason being that if my existing setup is working well, an update is more likely to break it and cause me pain than adding v...
25,964
<p>In my ActionScript3 class, can I have a property with a getter and setter?</p>
<p>Ok, well you can just use the basic getter/setter syntax for any property of your AS3 class. For example</p> <pre><code>package { public class PropEG { private var _prop:String; public function get prop():String { return _prop; } public function set prop(value:St...
<p>A getter is a function with a return value depending on what we return. A setter has always one parameter, since we give a variable a new value through the parameter.</p> <p>We first create an instance of the class containing the getter and setter, in our case it is "a". Then we call the setter, if we want to chang...
18,203
<p>I'm creating a list of the Slices in my Merb app, like this:</p> <blockquote> <p>Merb::Slices.each_slice do |slice|</p> </blockquote> <p>I'd like to get the list of dependencies for each of this slice, any idea how to access it?</p> <p>I'm still reading merb code, solution might come soon ;)</p>
<p>Seems impossible to get list of dependencies for a particular slice.</p> <p>The next solution is to parse the slice init.rb</p> <p>Something interesting found in the quest, the global list of dependencies:</p> <blockquote> <p>Merb::BootLoader::Dependencies.dependencies</p> </blockquote>
<p>I haven't used slices yet, but from my understanding they are like a mini merb app in themself, therefore wouldn't each slice have a <code>/config/dependencies.rb</code>? Maybe this gets parsed into the program and is available somewhere.</p> <p>There may be something <a href="http://merbivore.com/documentation/1.1...
40,027
<p>How do you ensure that the project will be build with "good" design decisions enabling a flexible software architecture?</p> <p>How do you balance between completely leaving the architecture to the teams on one side, and let all architecture control to a few individuals on the other side?</p> <p>Do you have an "ar...
<p>A prerequisite for Agile approaches is an architecture you already know how to use.</p> <p>If the architecture is not well-defined and completely understood, you can't really take an Agile approach.</p> <p>You need to have some technical spikes that show how the architecture works, and how the various pieces will ...
<p>I handle this by doing some planning up front -- generally, I have some prior experience with a similar application to help with this. If not, I'll do some exploration in the space to get an idea. Once a basic architecture is laid out, I'll start developing with it in mind based on my prioritized stories. Then, I...
24,526
<p>I am writing a fairly basic script using jQuery. However, the script behaves differently depending on whether I am running it on my local Web server (localhost) or on a production server.</p> <p>On development, the following code returns the HTML I'm expecting: </p> <pre><code>$('#objID').siblings('.mAddress').h...
<p>Given that you have different behaviour, it's reasonable to assume that <em>something</em> is different between the two pages, so my suggestion is to reduce both pages to the minimum that keeps the current behaviour and then see what is different.</p>
<p><del>I don't regularly use jQuery but my first suspicion is that your libraries are out of sync.</del></p>
21,184
<p>We have built a custom application, for internal use, that accesses TFS. We use the Microsoft libraries for this (e.g Microsoft.TeamFoundation.dll).</p> <p>When this application is deployed to PCs that already have Team Explorer or VS installed, everything is fine. When it’s deployed to PCs that don’t have this i...
<p>The "officially supported" way of writing an application that uses the TFS Object Model is to have Team Explorer installed on the machine. This is especially important for servicing purposes - i.e. making sure that when a service pack for VSTS is applied to the client machine then the TFS API's get upgraded as well....
<p>Try this list:</p> <p><a href="https://web.archive.org/web/20160829113142/http://geekswithblogs.net/jjulian/archive/2007/06/14/113228.aspx" rel="nofollow noreferrer">http://geekswithblogs.net/jjulian/archive/2007/06/14/113228.aspx</a></p> <p>And also trying putting them in the GAC. It may be a security trust issue -...
18,279
<p>Has anyone used both FogBugz and Axosoft's OnTime and care to offer an opinion? AxoSoft has a big <a href="http://web.archive.org/web/20090522134148/http://www.axosoft.com:80/products/ontime_competition.aspx" rel="nofollow noreferrer">feature comparison chart</a> but I'm also interested in more subjective thoughts ...
<p>I actually encouraged the company I work for to begin tracking bugs with software (specifically FogBugz) and have been very pleased with FogBugz. </p> <p>We blindly let our customers send bug requests into FogBugz through email, which has it's advantages and disadvantages. But we really haven't had any problems in...
<p>I haven't worked with FogBugz, although I recently recommended our company goes with that. OnTime is what the company decided to use and I personally don't like OnTime because of slowness and badly organized GUI. We opted to host it ourselves, but I don't think the machine is slow. The web app doesn't really look li...
3,059
<p>I am using Java API and XPath to parse my XML. I have XML like this:</p> <pre><code>&lt;animals&gt; &lt;dog&gt; &lt;looks&gt;dangerous &lt;/looks&gt; &lt;bites&gt; hard &lt;/bites&gt; &lt;growls&gt; yes &lt;/growls&gt; &lt;/dog&gt; &lt;cat&gt;nothing special&lt;/cat&gt; &lt;/animals&gt; </code>...
<p>If you use /animals/dog you will get back the 'dog' node with all the child nodes. Printing the inner xml of that node should give you what you need.</p>
<p>Demonstration of rslite's method, with the command-line tool <a href="http://www.xml.com/pub/a/2002/04/17/perl-xml.html" rel="nofollow noreferrer">xpath</a> (written in Perl but it is standard Xpath, it should work everywhere):</p> <pre><code>% xpath -e /animals/dog animals.xml Found 1 nodes in animals.xml: -- NOD...
24,945
<p>I've spent far too much time trying to figure this out. This should be the simplest thing and everyone who distributes Java applications in jars must have to deal with it.</p> <p>I just want to know the proper way to add versioning to my Java app so that I can access the version information when I'm testing, e.g. ...
<p>You can get the manifest for an arbitrary class in an arbitrary jar without parsing the class url (which could be brittle). Just locate a resource that you know is in the jar you want, and then cast the connection to JarURLConnection. </p> <p>If you want the code to work when the class is not bundled in a jar, add ...
<p>Just don't use the manifest. Create a foo.properties.original file, with a content such as version=@VERSION@</p> <p>And in ther same task you are jaring you can do a copy to copu foo.properties.original and then </p>
11,007
<p>I'm working on a internal web based tool for my company. Part of this tool is another application (The Cruise Control Dashboard) that runs in its own Virtual Directory under my root application.</p> <p>I wanted to limit access to this internal application by setting up Forms Authentication on it, and having a login...
<blockquote> <p>You might also need to put path="/" in the </blockquote> <p>That was it!</p> <p>So, Summary, inorder todo this;</p> <p>In root web.config add:</p> <pre><code>&lt;machineKey validationKey="AutoGenerate" decryptionKey="AutoGenerate" validation="SHA1" /&gt; </code></pre> <p>This must be done becaus...
<p>you are allowing all unauthenticated. You might be looking for something like this</p> <pre><code>&lt;deny users="?"/&gt; </code></pre>
3,969
<p>I've built a small application which has User Management, a frontend console to enter data and a backend console to control parts of the frontend. The frontend adds rows to a MySQL database which are timestamped. The backend needs to be able to select rows from the database between X and Y dates.</p> <p>Everything ...
<p>MySQL datetime should be formatted with dashes:</p> <p>YYYY-MM-DD HH:MM:SS</p> <p><a href="http://dev.mysql.com/doc/refman/5.0/en/datetime.html" rel="nofollow noreferrer">http://dev.mysql.com/doc/refman/5.0/en/datetime.html</a></p> <p>Then you can query for date ranges a couple of ways:</p> <pre><code>select * f...
<p>You are correct. I can confirm that the Database has "YYYY-MM-DD HH:MM:SS" - I am using SQLWave editor for browsing the DB quickly, it auto-formats the DATETIME column. </p> <pre><code>// Initial questions still stand :) </code></pre> <p>Or not, just noticed you updated the answer - thank you very much! I had actu...
43,276
<p>I am trying to send an anonymous object over a web service. Is there anyway I can do this without manually creating a class and casting it to that class? Currently its throwing an exception saying Anonymous object could not be serialized.</p> <pre><code>// Some code has been removed here to simplify the example. [W...
<p>Anonymous type are meant to be used for simple projections of very loosely coupled data, used only within a method. If it makes sense for a web method to return data of a type, it really should be decently encapsulated. In other words, even if you <em>can</em> find a way to return an instance of an anonymous type fr...
<p>Here is the code I wound up using.</p> <pre><code>[WebMethod(EnableSession = true)] public PatientsResult GetPatientList(bool returnInactivePatients) { if (!IsLoggedIn()) { return new PatientsResult() { Success = false, LoggedIn = false, Message = "Not logged in" ...
43,771
<p>I'm experimenting with internationalization by making a Hello World program that uses properties files + ResourceBundle to get different strings.</p> <p>Specifically, I have a file "messages_en_US.properties" that stores "hello.world=Hello World!", which works fine of course.</p> <p>I then have a file "messages_ja...
<p>I realized that native2ascii was assuming (surprise) that it was converting from my operating system's default encoding each time, and as such not producing the correct escaped Unicode string.</p> <p>Running native2ascii with the "-encoding <em>encoding_name</em>" option where <em>encoding_name</em> was the name of...
<p>An alternative way to handle the properties files is: <a href="http://www.unipad.org/main/" rel="nofollow noreferrer">http://www.unipad.org/main/</a></p> <p>This is an editor which can read/write files in \u unicode escape format, this is the format native2ascii creates.</p> <p>It don't know how well it works with...
23,623
<p>I've heard I should store filament in sealed container, preferably with a desiccant. </p> <p>But let's say I let a spool get a little old on the printer, or I purchased a filament spool that was old or improperly packaged. How would I know? How would this impact prints (what kind of symptoms would I see)? What thin...
<p>The primary issue with long-term exposure of filament to the environment is that it will absorb water moisture from the air. When a filament that has absorbed water is passing though the hot end of a printer, the water will turn to steam and cause problems with extrusion:</p> <ul> <li>Small bubbles of steam can for...
<p>Moisture creeps into the filament when PLA is exposed for a long time to a humid environment. This is audible like popping bubbles when heated in the hotend and does worsen the print quality. The moisture causes a noticeable property as it breaks the long molecular chains of the thermoplastic material. Once this has...
1,022
<p>I'm using the following code to try to read the results of a <code>df</code> command in Linux using <code>popen</code>.</p> <pre><code>#include &lt;iostream&gt; // file and std I/O functions int main(int argc, char** argv) { FILE* fp; char * buffer; long bufSize; size_t ret_code; fp = popen("d...
<p>Why would <code>std::malloc()</code> fail?</p> <p>The obvious reason is "because <code>std::ftell()</code> returned a negative signed number, which was then treated as a huge unsigned number".</p> <p>According to <a href="http://en.cppreference.com/w/cpp/io/c/ftell" rel="nofollow noreferrer">the documentation</a>,...
<p>check your bufSize. <code>ftell</code> can return -1 on error, and this can lead to nonallocation by malloc with buffer having a NULL value.</p> <p>The reason for the <code>ftell</code> to fail is, because of the popen. You cant search pipes.</p>
39,870
<p>I just got a dedicated server from a hosting company, and for some reason, it didn't have IIS installed. It did have .Net 2.0, though.</p> <p>So I installed IIS, but now my ASP.net websites won't work. I just get a 404, no event log entries, nothing...</p> <p>I noticed in the redistributable package information th...
<p>run from the command line</p> <pre><code>aspnet_regiis -i </code></pre> <p>You may have to navigate to the folder it was installed. Mine and the default is</p> <pre><code>C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727 </code></pre>
<p>Be sure that you have enabled the extensions for asp and aspx in IIS. They are disabled by default. I'd do this before you go about uninstall more components.</p>
23,091
<p>I have been asked to lend a hand on a hobby project that a couple friends are working on, they are using SharpDevelop 3.0 (Beta 2 I think, but it might be Beta 1) is there any hassle for me to install and use this IDE given that I have Visual Studio 2008 installed?</p>
<p>I've had no problems at all, in fact some of the tools in sharpdevelop (like the vb.net -> c# converter) are very nice to have.</p> <p>In addition, there are some good libraries included with sharpdevelop that are also handy (like sharpziplib for zip files)</p> <p>I actually have VS2005, VS2008, SharpDevelop and V...
<p>I haven't had SharpDevelop installed for a while but when I did the only problem I ran in to was that I couldn't easily share the solution file. If you don't mind having two different solutions there should be no problems.</p>
11,424
<p>What's the difference between the Enabled and the ReadOnly-properties of an asp:TextBox control?</p>
<p>If a control is <code>disabled</code> it cannot be edited <strong>and</strong> its content is excluded when the form is submitted.</p> <p>If a control is <code>readonly</code> it cannot be edited, but its content (if any) is still included with the submission.</p>
<p>I have a child aspx form that does an address lookup server side. The values from the child aspx page are then passed back to the parent textboxes via javascript client side.</p> <p>Although you can see the textboxes have been changed neither ReadOnly or Enabled would allow the values to be posted back in the paren...
21,003
<p>Am I doing something wrong or is it not possible to specify a generic class as a constraint to a generic method?</p> <p>I have been playing around with generics and <a href="http://developer.db4o.com/" rel="nofollow noreferrer">db4o</a> (open source object database) and am writing a test program (see code below) to...
<p>Just follow the T:</p> <pre><code> // ... { //... MyCollection1 collection3 = GetCollectionFromDb&lt;MyCollection1&gt;(Collection1Name); } private static T GetCollectionFromDb&lt;T&gt;(string pCollectionName) where T : MyCollectionBase&lt;T&gt; { IList&lt;T&gt; queryResult...
<p>Just follow the T:</p> <pre><code> // ... { //... MyCollection1 collection3 = GetCollectionFromDb&lt;MyCollection1&gt;(Collection1Name); } private static T GetCollectionFromDb&lt;T&gt;(string pCollectionName) where T : MyCollectionBase&lt;T&gt; { IList&lt;T&gt; queryResult...
40,349
<p>In the context of creating a custom Eclipse distribution for a development team.</p> <p>How would I go about building a custom Eclipse distribution containing a specific set of plugins? Would it be difficult to also add a kind of update site to put specific versions of the plug-ins from which the customized eclipse...
<p>Eclipse is not one of those applications that need to be "installed" since it can just be copied into a directory structure and have shortcuts set up for running it (a la the BIRT all-in-one distributions).</p> <p>I would suggest installing it on one machine, getting all the plug-ins installed, then just zip up the...
<p>Just zip up the C:\eclipse\plugins directory and distribute.</p> <p>Just ensure that developers start Eclipse with the "-clean" option to ensure that any changes are incorporated. </p>
45,745
<p>The list <code>sort()</code> method is a modifier function that returns <code>None</code>.</p> <p>So if I want to iterate through all of the keys in a dictionary I cannot do:</p> <pre><code>for k in somedictionary.keys().sort(): dosomething() </code></pre> <p>Instead, I must:</p> <pre><code>keys = somedictio...
<pre><code>for k in sorted(somedictionary.keys()): doSomething(k) </code></pre> <p>Note that you can also get all of the keys and values sorted by keys like this:</p> <pre><code>for k, v in sorted(somedictionary.iteritems()): doSomething(k, v) </code></pre>
<p>Can I answer my own question?</p> <p>I have just discovered the handy function "sorted" which does exactly what I was looking for.</p> <pre> for k in sorted(somedictionary.keys()): dosomething() </pre> <p>It shows up in <a href="https://stackoverflow.com/questions/157424/python-25-dictionary-2-key-sort">Pytho...
42,393
<p>Is it possible to catch an error when using JSONP with jQuery? I've tried both the $.getJSON and $.ajax methods but neither will catch the 404 error I'm testing. Here is what I've tried (keep in mind that these all work successfully, but I want to handle the case when it fails):</p> <pre><code>jQuery.ajax({ typ...
<p>It seems that JSONP requests that don't return a successful result never trigger any event, success or failure, and for better or worse that's apparently by design.</p> <p>After searching their bug tracker, there's <a href="http://dev.jquery.com/attachment/ticket/3442/jsonabort.patch" rel="noreferrer">a patch</a> w...
<p>Mayby this works?</p> <pre><code>.complete(function(response, status) { if (response.status == "404") alert("404 Error"); else{ //Do something } if(status == "error") alert("Error"); else{ //Do something } }); </code></pre> <p>I dont know whenever the stat...
39,936
<p>For months now I've been trying to find a code syntax formatting extension that works for BlogEngine.Net. I'm not fond of the behavior of the default formatting extension, and have tried a couple of others (manoli is among them), but they always seem to interact badly with the TinyMCE editor. Does anyone know of a...
<p>Thanks, Rafe. Thanks to <a href="http://www.hanselman.com/blog/BestCodeSyntaxHighlighterForSnippetsInYourBlog.aspx" rel="nofollow noreferrer">this post</a> that Hanselman put up the day after I asked the question, I downloaded WLW and am now using it. As far as getting prettily formatted code, I'm using cut-and-pa...
<p>Check out SyntaxHighlighter.. Works excellent. For easy integration into BlogEngine have a look at <a href="http://www.dscoduc.com/post/2008/09/25/More-Efficient-SyntaxHighlighter.aspx" rel="nofollow noreferrer">my blog post</a>.</p>
42,255
<p>Is there a way to prevent packages in Delphi to implicitly import units that are not listed in the "Contains" list? I'm looking for a compiler directive that makes the build to fail if it tries to do an implicit import.</p> <p>Problems occur when you install a package into the IDE that implicitly imports unit A and...
<p>Delphi 2009 has the option to make warnings into failures. That would do what you want to do as far as making it fail.</p> <p>To prevent the implicit importing you need to import it explicitly, or remove the unit that is implicitly importing it.</p>
<p>There is no way to make that warning into an error. In Delphi 2009 you can make treat all warnings as errors.</p> <p>PS: It is an error in Delphi for .Net</p>
10,727
<p>For an ecommerce website how do you measure if a change to your site actually improved usability? What kind of measurements should you gather and how would you set up a framework for making this testing part of development?</p>
<p><a href="http://en.wikipedia.org/wiki/Multivariate_testing" rel="nofollow noreferrer">Multivariate testing</a> and reporting is a great way to actually measure these kind of things. </p> <p>It allows you to test what combination of page elements has the greatest conversion rate, providing continual improvement on ...
<p>The first way can be fully subjective or partly quantified: user complaints and positive feedbacks. The problem with this is that you may have some strong biases when it comes to filter those feedbacks, so you better make as quantitative as possible. Having some ticketing system to file every report from the users a...
18,892
<p>My list (@degree) is built from a SQL command. The NVL command in the SQL isn't working, neither are tests such as:</p> <pre><code>if (@degree[$i] == "") if (@degree[$i] == " ") if (@degree[$i] == '') if (@degree[$i] == -1) if (@degree[$i] == 0) if (@degree[$i] == ()) if (@degree[$i] == undef) </code></pre> <p>$i ...
<p>First of all, the ith element in an array is $degree[$i], not @degree[$i]. Second, "==" is for numerical comparisons - use "eq" for lexical comparisons. Third of all, try <code>if (defined($degree[$i]))</code></p>
<p>If its actually a null in the database, try <code>COALESCE</code></p> <pre><code>SELECT COALESCE(column, 'no value') AS column FROM whatever ... </code></pre> <p>That's the SQL-standard way to do it.</p>
43,009
<p>When you limit the number of rows to be returned by a SQL query, usually used in paging, there are two methods to determine the total number of records:</p> <h3>Method 1</h3> <p>Include the <code>SQL_CALC_FOUND_ROWS</code> option in the original <code>SELECT</code>, and then get the total number of rows by running...
<p>It depends. See the MySQL Performance Blog post on this subject: <a href="https://www.percona.com/blog/2007/08/28/to-sql_calc_found_rows-or-not-to-sql_calc_found_rows/" rel="noreferrer">To <code>SQL_CALC_FOUND_ROWS</code> or not to <code>SQL_CALC_FOUND_ROWS</code>?</a></p> <p>Just a quick summary: Peter says that ...
<p>Simple example on table with 2.000.000 rows and query like this :</p> <pre><code>select fieldname from table_add where descryption_per like '%marihuana%' or addiction_per like '%alkohol%'; </code></pre> <p>it is a full table scan every query - so it take time x 2. I mean &quot;select count(*) from .....</p>
22,581
<p>An important part of mobile development, especially when you are talking about mobile games, is dealing with the application size restrictions. Some devices enforce their own size limits, while all the carriers have their own size requirements for applications to be released in their deck space.</p> <p>My question ...
<p>I also prefer ProGuard for both it's size reduction and breadth of obfuscation - see <a href="http://proguard.sourceforge.net/" rel="nofollow noreferrer">http://proguard.sourceforge.net/</a>. I don't necessarily have size constraints other than download speeds, but haven't found anything that shrinks further.</p>
<p>Strange that no one remembered that ProGuard can not just shrink and obfuscate the code, but optimize as well. The last versions allow to specify several passes for optimization (by default there is a single pass), I may specify, say, 9 passes.</p> <p>After I decompile my classes I can hardly recognise them, ProGua...
11,881
<p>I am writing a program that requires the use of XMODEM to transfer data from a sensor device. I'd like to avoid having to write my own XMODEM code, so I was wondering if anyone knew if there was a python XMODEM module available anywhere?</p>
<pre><code>def xmodem_send(serial, file): t, anim = 0, '|/-\\' serial.setTimeout(1) while 1: if serial.read(1) != NAK: t = t + 1 print anim[t%len(anim)],'\r', if t == 60 : return False else: break p = 1 s = file.read(128) while s: s = s + '\xFF'*(128 - len(s)) chk = 0 ...
<p>You can try using <a href="http://www.swig.org/" rel="nofollow noreferrer">SWIG</a> to create Python bindings for the C libraries linked above (or any other C/C++ libraries you find online). That will allow you to use the same C API directly from Python.</p> <p>The actual implementation will of course still be in ...
46,747
<p>Is it at all possible to do database-agnostic table dumps/hydrates? I don't have any complicated constraints. I would also settle for db-specific ways, but the more pure jdbc it is the better (I don't want to resort to impdp/expdp).</p>
<p>Have a look at <a href="http://dbunit.sourceforge.net/" rel="nofollow noreferrer">DBUnit</a>. DBUnit support exporting to a xml file, and importing from a xml file. Their <a href="http://dbunit.sourceforge.net/faq.html#streaming" rel="nofollow noreferrer">faq</a> has some advice on how to make the export / imports...
<p>DBUnit looks good, however you probably are not going to beat the vendor tools for import/export. If you are going to be importing or exporting 100,000+ rows it's probably best to use impdp/expdp.</p> <p>I've also done strange things like building an insert statement from a sql query and then using sqlplus to proce...
27,097
<p>I need to build a high performance winforms data grid using Visual Studio 2005, and I'm at a loss with where to start. I've build plenty of data grid applications, but none of those were very good when the data was constantly refreshing.</p> <p>The grid is going to be roughly 100 rows by 40 columns, and each cell i...
<p>I would recommend the following approach if you have many cells that are updating at different rates. Rather than try to invalidate each cell each time the value changes you would be better off by limiting the refresh rate. </p> <p>Have a timer that fires at a predefined rate, such as 4 times per second, and then e...
<p>We use the Syncfusion grid control and from what I've seen it's pretty flexible if you take the time to modify it. I don't work with the control myself, one of my co-workers does all of the grid work but we've extended it to our needs pretty well including custom painting. </p> <p>I know this isn't exactly answer...
20,463
<p>I have a tree structure in memory that I would like to render in HTML using a Django template. </p> <pre><code>class Node(): name = "node name" children = [] </code></pre> <p>There will be some object <code>root</code> that is a <code>Node</code>, and <code>children</code> is a list of <code>Node</code>s. <cod...
<p>I think the canonical answer is: "Don't".</p> <p>What you should probably do instead is unravel the thing in your <em>view</em> code, so it's just a matter of iterating over (in|de)dents in the template. I think I'd do it by appending indents and dedents to a list while recursing through the tree and then sending t...
<p>I had a similar issue, however I had first implemented the solution using JavaScript, and just afterwards considered how I would have done the same thing in django templates.</p> <p>I used the serializer utility to turn a list off models into json, and used the json data as a basis for my hierarchy.</p>
5,200
<p>I have a ASP.NET application that we've written our own logging module for.</p> <p>My question is, where is the standard place to write a log file to? I.e. the website will be running as the anonymous user identity (e.g. IUSR on IIS7) and I need a place where I know it'll have permission to write to.</p> <p>Cheers...
<p>App_Data folder on the root of the project. It isn't served to web requests; so other people can't snoop for it.</p>
<p>I'm not in a position to modify the permissions on folders (especially outside of the virtual directory home folder), and don't already have an App_Data folder, so am a bit hesitant to go with that. </p> <p>So for the moment I'm going with the CommonApplicationData Folder. </p> <ul> <li>On Vista/Server 2008 this i...
2,825
<p>The following seems strange.. Basically, the somedata attribute seems shared between all the classes that inherited from <code>the_base_class</code>.</p> <pre><code>class the_base_class: somedata = {} somedata['was_false_in_base'] = False class subclassthing(the_base_class): def __init__(self): ...
<p>You are right, <code>somedata</code> is shared between all instances of the class and it's subclasses, because it is created at class <em>definition</em> time. The lines </p> <pre><code>somedata = {} somedata['was_false_in_base'] = False </code></pre> <p>are executed when the class is defined, i.e. when the interp...
<p>I think the easiest way to understand this (so that you can predict behavior) is to realize that your <code>somedata</code> is an attribute of the class and not the instance of that class if you define it that way.</p> <p>There is really only one <code>somedata</code> at all times because in your example you didn't...
25,325
<p>Does anyone has a good solution for a C# version of the C++ __FUNCTION__ macro? The compiler does not seem to like it.</p>
<p>Try using this instead. </p> <pre><code>System.Reflection.MethodBase.GetCurrentMethod().Name </code></pre> <p>C# doesn't have <code>__LINE__</code> or <code>__FUNCTION__</code> macros like C++ but there are equivalents</p>
<p>I use this:</p> <pre><code>public static string CallerName([CallerMemberName] string callerName = "") { return callerName; } </code></pre> <p>Usage example: </p> <pre><code>s_log.DebugFormat("{0}", CallerName()); </code></pre> <p>The down side of using it is that every time you want to print the caller name,...
32,428
<p>Can you get the distinct combination of 2 different fields in a database table? if so, can you provide the SQL example.</p>
<p>How about simply:</p> <pre><code>select distinct c1, c2 from t </code></pre> <p>or</p> <pre><code>select c1, c2, count(*) from t group by c1, c2 </code></pre>
<p>Share my stupid thought: </p> <p>Maybe I can select distinct only on c1 but not on c2, so the syntax may be <code>select ([distinct] col)+</code> where <code>distinct</code> is a qualifier for each column. </p> <p>But after thought, I find that <strong>distinct on only one column is nonsense</strong>. Take the fo...
23,446
<p>Spring DA helps in writing DAOs. When using iBATIS as the persistence framework, and extending SqlMapClientDaoSupport, a SqlMapClient mock should be set for the DAO, but I can't do it. SqlMapClientTemplate is not an interface and EasyMock cannot creates a mock for it.</p>
<p>DAO and unit tests do not get along well ! That does not make sense to mock anything in a component that does not hold any business logic and is focused on database access. You should try instead to write an integration test. Take a look at the spring reference documentation, chapter 8.3 : <a href="http://static.spr...
<p>Try <a href="http://code.google.com/p/mockito/" rel="nofollow noreferrer">Mockito</a>. It lets mock classes, not only interfaces.</p>
13,586
<p>I'd like to populate an arraylist by specifying a list of values just like I would an integer array, but am unsure of how to do so without repeated calls to the "add" method.</p> <p>For example, I want to assign { 1, 2, 3, "string1", "string2" } to an arraylist. I know for other arrays you can make the assignment...
<p>Array list has ctor which accepts ICollection, which is implemented by the Array class.</p> <pre><code>object[] myArray = new object[] {1,2,3,"string1","string2"}; ArrayList myArrayList = new ArrayList(myArray); </code></pre>
<p>I assume you're not using C# 3.0, which has collection initializers. If you're not bothered about the overhead of creating a temp array, you could do it like this in 1.1/2.0:</p> <pre><code>ArrayList list = new ArrayList(new object[] { 1, 2, 3, "string1", "string2"}); </code></pre>
11,361
<p>If I put a DateTime value into an Excel cell using <code>Range.set_value</code> through .Net COM Interop, and then retrieve the value of that same cell using <code>Range.get_value</code>, the Millisecond part of the value is not returned, though everything else is correct.</p> <p>Is this a bug?</p> <p>What is the ...
<p>As <a href="https://stackoverflow.com/questions/298458/milliseconds-missing-when-getting-a-datatime-value-from-excel-using-net-interop#298467">Jon suggested</a>, converting the DateTime to a double using DateTime.ToOADate (then back again using DateTime.FromOADate) works if you set the value using the Range.Value2 p...
<p>If you set a date/time with a millisecond value in Excel manually, does it maintain it? I don't know about the Excel internal object model, but it's conceivable that it just doesn't support milliseconds.</p> <p>EDIT: Okay, now we know that the set fails (the get may also fail, of course)... you could try setting it...
38,205
<p>I have an <code>input type="image"</code>. This acts like the cell notes in Microsoft Excel. If someone enters a number into the text box that this <code>input-image</code> is paired with, I setup an event handler for the <code>input-image</code>. Then when the user clicks the <code>image</code>, they get a little p...
<h2>jQuery ≥ 1.7</h2> <p>With jQuery 1.7 onward the event API has been updated, <code>.bind()</code>/<code>.unbind()</code> are still available for backwards compatibility, but the preferred method is using the <a href="http://api.jquery.com/on/" rel="noreferrer">on()</a>/<a href="http://api.jquery.com/off/" rel="nore...
<p>All the approaches described did not work for me because I was adding the click event with <code>on()</code> to the document where the element was created at run-time:</p> <pre><code>$(document).on("click", ".button", function() { doSomething(); }); </code></pre> <p><br />My workaround: </p> <p>As I could not...
25,647
<p>So in C#, I can treat a <code>string[]</code> as an <code>IEnumerable&lt;string&gt;</code>.</p> <p>Is there a Java equivalent?</p>
<p><code>Iterable&lt;String&gt;</code> is the equivalent of <code>IEnumerable&lt;string&gt;</code>.</p> <p>It would be an odditity in the type system if arrays implemented <code>Iterable</code>. <code>String[]</code> is an instance of <code>Object[]</code>, but <code>Iterable&lt;String&gt;</code> is not an <code>Itera...
<p><code>Iterable&lt;T&gt;</code> is OK, but there is a small problem. It cannot be used easily in <code>stream()</code> i.e lambda expressions.</p> <p>If you want so, you should get it's spliterator, and use the class <code>StreamSupport()</code>. </p>
47,291
<p>I understand that using the "===" compares type, so running the following code results in "not equal" because it's comparing a number type to a string type.</p> <pre><code>var a = 20; var b = "20"; if (a === b) { alert("They are equal"); } else { alert("They are not equal"); } </code></pre> ...
<p>The <code>==</code> operator compares only the values of the variables. If the types are different, a conversion is operated. So the number 20 is converted to the string "20" and the result is compared. </p> <p>The <code>===</code> operator compares not only the values, but also the types, so no cast is operated. I...
<p>As far as I know JavaScript does automatic data type conversion on the fly - so maybe the variables are casted to equivalent types automatically.</p>
32,076
<p>It is a bit of a "chicken or egg" kind of query, but can someone dreamup a query that can return the name of the current database instance in which the query executes? Believe me when I say I understand the paradox: why do you need to know the name of the database instance if you're already connected to execute the ...
<pre><code>SELECT DB_NAME() </code></pre> <p>Returns the database name.</p>
<p>You can get <strong>the instance name</strong> of <strong>your current database</strong> as shown below:</p> <pre class="lang-sql prettyprint-override"><code>SELECT @@SERVICENAME -- SQLEXPRESS SELECT SERVERPROPERTY ('InstanceName') -- SQLEXPRESS </code></pre>
15,772
<p>I would like to automatically align lines of python variable assignments in vim.</p> <p>For example I would like to change this:</p> <pre><code>a = 1 banana = 2 </code></pre> <p>into this</p> <pre><code>a = 1 banana = 2 </code></pre> <p>automatically in vim.</p> <p>Is there a way to do this?</p>
<p>You are probably looking for the Align plugin for vim:</p> <p><a href="http://www.vim.org/scripts/script.php?script_id=294" rel="nofollow noreferrer">http://www.vim.org/scripts/script.php?script_id=294</a></p> <p>Once installed, you simply select the text you want to align (Shift V) and type:</p> <p>:Align =</p> ...
<p>this will do the work :</p> <pre><code>vap :!column -t </code></pre>
46,662
<p>I have a Template Column under which I have Placed a Dropdownlist. Now I would Like to get the selectedRow of the datagrid on selectedIndeChanged event of the dropdownlist that's inside the template Column</p>
<p>You can get the index of the item in the datagrid, by looking at the DataGridItem your dropdownlist is contained within.</p> <p>Assuming your DropDownList is directly in the TemplateColumn and is not wrapped by other elements, then the following example shows how to do this:</p> <pre><code> protected void DropD...
<p>Does DataGrid1.SelectedIndex help?</p> <p>DataGrid1 = Name of the variable that is the name of the DataGrid control on the page.</p>
47,258
<p>I'm trying to setup an alert to let me know via email (SMTP) when free disk space on one of my servers is less than a specified value. To do this I'm using PerfMon alerts, as described at <a href="http://support.microsoft.com/kb/324796" rel="nofollow noreferrer">MSFT Technet</a>. I have the alert working and writing...
<p>Add <code>autocomplete="off"</code> into the form element on the page. The downside is that this isn't valid XHTML, but it fixes the issue without any convoluted javascript.</p>
<p>or instead of f5 press enter on address bar :)</p>
38,427
<p>Seeing as Java doesn't have nullable types, nor does it have a TryParse(), how do you handle input validation without throwing an exceptions?</p> <p>The usual way:</p> <pre><code>String userdata = /*value from gui*/ int val; try { val = Integer.parseInt(userdata); } catch (NumberFormatException nfe) { // bad...
<p>That's pretty much it, although returning MIN_VALUE is kind of questionable, unless you're sure it's the right thing to use for what you're essentially using as an error code. At the very least I'd document the error code behavior, though.</p> <p>Might also be useful (depending on the application) to log the bad in...
<p>Put some if statements in front of it. if (null != userdata )</p>
21,033
<p>I'm trying to figure out how to detect the type of credit card based purely on its number. Does anyone know of a definitive, reliable way to find this?</p>
<p>The credit/debit card number is referred to as a <strong>PAN</strong>, or <em>Primary Account Number</em>. The first six digits of the PAN are taken from the <strong>IIN</strong>, or <em>Issuer Identification Number</em>, belonging to the issuing bank (IINs were previously known as BIN — Bank Identification Numbers...
<p>The regular expression rules that match the <a href="http://www.techrecite.com/credit-card-validation-regex-script-in-php-using-luhn-algorithm/" rel="nofollow">respective card vendors</a>:</p> <ul> <li><code>(4\d{12}(?:\d{3})?)</code> for VISA.</li> <li><code>(5[1-5]\d{14})</code> for MasterCard.</li> <li><code>(3[...
9,836
<p>Why are SQL distributions so non-standard despite an ANSI standard existing for SQL? Are there really that many meaningful differences in the way SQL databases work or is it just the two databases with which I have been working: MS-SQL and PostgreSQL? Why do these differences arise?</p>
<p>It's a form of "Stealth lock-in". Joel goes into great detail here:</p> <ul> <li><a href="http://www.joelonsoftware.com/articles/fog0000000056.html" rel="nofollow noreferrer">http://www.joelonsoftware.com/articles/fog0000000056.html</a></li> <li><a href="http://www.joelonsoftware.com/articles/fog0000000052.html" re...
<p>It's certainly effective lock-in, as 1800 says. But in fairness to the database vendors, the SQL standard is always playing catch-up to current databases' feature sets. Most databases we have today are of pretty ancient lineages. If you trace Microsoft SQL Server back to its roots, I think you'll find Ingres - one o...
5,811
<p>I wrote a utility for photographers that I plan to sell online pretty cheap ($10). I'd like to allow the user to try the software out for a week or so before asking for a license. Since this is a personal project and the software is not very expensive, I don't think that purchasing the services of professional licen...
<p>EDIT: You can make your current licensing scheme considerable more difficult to crack by storing the registry information in the Local Security Authority (LSA). Most users will not be able to remove your key information from there. A search for LSA on MSDN should give you the information you need.</p> <p>Opinions o...
<p>In these sort of circumstances, I don't really think it matters what you do. If you have some kind of protection it will stop 90% of your users. The other 10% - if they don't want to pay for your software they'll pretty much find a way around protection no matter what you do.</p> <p>If you want something a little l...
12,985
<p>I recently started using Eclipse at work for my Java servlet projects. I've been using jEdit for years, which is a uber-powerful text editor. It has syntax highlighting, but it doesn't have any language-specific features like code completion and intelligent refactoring. I'm finding that's hindering my productivit...
<p>Try <a href="http://www.netbeans.org/" rel="noreferrer">NetBeans</a></p> <blockquote> <p>A free, open-source Integrated Development Environment for software developers. You get all the tools you need to create professional desktop, enterprise, web, and mobile applications with the Java language, C/C++...
<p>Partial, hopefully helpful answer to</p> <blockquote> <p>4<code></code>. I find it a huge hassle that the workspace is in a different place than my source code. I have other files I need to edit (xml files, etc), and for each directory I want to edit files in, I need to set up a special entry, and it doesn't even...
10,545
<p>I'm starting to develop a browser-based game (and by this I mean text-based, no Flash or similar stuff on it) and I'm struggling to decide on which development framework to use.</p> <p>As far as requirements are concerned, the most important thing that I can think of right now is the ability to translate it to seve...
<blockquote> <p>I would reccomend sticking to what you know - PHP is more than capable.</p> </blockquote> <p>That's true of course, but:</p> <blockquote> <p>I don't mind, and I would even like to use this as an excuse, learning some new thing like Python or Ruby.</p> </blockquote> <p>Then writing a browser game ...
<p>I would reccomend sticking to what you know - PHP is more than capable.</p> <p>I used to play a game called <a href="http://www.hyperiums.com/" rel="nofollow noreferrer">Hyperiums</a> - a text based browser game like yours - which is created using Java (it's web-based quivalent is JSP?) and servlets. It works fairl...
4,563
<p>Consider the following ruby code</p> <p>test.rb:</p> <pre><code>begin puts thisFunctionDoesNotExist x = 1+1 rescue Exception =&gt; e p e end </code></pre> <p>For debugging purposes, I would like the rescue block to know that the error occurred in line 4 of this file. Is there a clean way of doing that?<...
<pre><code>p e.backtrace </code></pre> <p>I ran it on an IRB session which has no source and it still gave relevant info.</p> <pre><code>=&gt; ["(irb):11:in `foo'", "(irb):17:in `irb_binding'", "/usr/lib64/ruby/1.8/irb/workspace.rb:52:in `irb_binding'", "/usr/lib64/ruby/1.8/irb/workspace.rb:52"] </c...
<p>It is possible that in Ruby 1.9.3 you will be able to get access to not only this information in a more structured, reliable, and simpler way without using regular expressions to cut strings. </p> <p>The basic idea is to introduce a call frame object which gives access to information about the call stack.</p> <p>S...
14,509
<p>I’m using SSIS to synchronize data between two databases. I’ve used SSIS and DTS in the past, but I generally write an application for things of this nature (I’m coder and it just comes easier to me).</p> <p>In my package I use a SQL Task that returns about 15,000 rows. I’ve hooked that up to a Foreach Container, a...
<p>SSIS control flow and loops are not very high performance, and not designed for processing these amounts of data. Especially during the debugging - before and after each task execution, debugger sends notifications to designer process, which updates colors of the shapes and this could be slow.</p> <p>You could get ...
<p>I have noticed this is the behavior, I had an SSIS package for moves, that did somewhere in the neighborhood of 3 million entries, it was not possible to debug as it would run for about 3-4 days.</p> <p>SSIS is still the way I did it, I just don't "debug" with SSIS, I run them when working with the full datasets. ...
31,646
<p>How to disable the Minimize button of FireFox Browser or How to hide titlebar of FireFox Browser. I am using Window.Open to Open Window in fullscreen Mode using javascript</p>
<p>I am afraid this is impossible to do, and rightly so. I would be pretty annoyed if a webpage tried disable the minimize button of my browser.</p>
<p>try the experimental add-on "Hide Caption"</p>
23,137
<p>I've been working with sessions, MVC design and object oriented PHP. Where should I save or retrieve data from a session? I would like to retrieve it from within methods so I don't have to pass the data to the methods. Whats the best practice?</p>
<p>I typically put this inside the controller. It just makes sense.. The controller decides what happens and why not let it decide if people are allowed to do the requested actions. Typically you have multiple controllers in a MVC system. Eg. BaseController (abstract - common), NonSessionController extends BaseContro...
<p>I think it is depend on the scope of where the retrived data will be used, if it is only used inside a method then why you should retrive it outside, and session is always available in superglobal variables it is better to localize it only when needed.</p>
20,595
<p>Part of our java application needs to run javascript that is written by non-developers. These non-developers are using javascript for data formatting. (Simple logic and string concatenation mostly).</p> <p>My question is how can I setup the execution of these scripts to make sure scripting errors don't have a majo...
<p>To guard against infinite loops, you'd need to put it in a separate process so that it could be killed.</p> <p>To guard against creating threads, you'd need to extend SecurityManager (the default implementation allows untrusted code to access non-root thread groups).</p> <p>Java security does allow you to prevent ...
<p>Javascript is single-threaded and can't access the filesystem, so I don't think you have to worry about those. I'm not sure if there's a way to set a timeout to guard against infinite loops, but you could always spawn a (Java) thread that executes the script, and then kill the thread after so much time.</p>
11,954
<p>I've read that Lambda Expressions are an incredibly powerful addition to C#, yet I find myself mystified by them. How can they improve my life or make my code better? Can anyone point to a good resource for learning such expressions?</p> <p>They seem cool as hell, but how do they relate to my day-to-day life as an ...
<blockquote> <p>: are lambda expressions useful for anything other than querying</p> </blockquote> <p>Lamba expressions are nothing much other than a convenient way of writing a function 'in-line'.</p> <p>So they're useful any place you wanted a bit of code which can be called as though it's a separate function but...
<p>Lambdas bring functional programing to C#. They are anonymous functions that can be passed as values to certain other functions. Used most in LINQ.</p> <p>Here is a contrived example:</p> <pre><code>List&lt;int&gt; myInts = GetAll(); IEnumerable&lt;int&gt; evenNumbers = myInts.Where(x =&gt; x % 2 == 0); </code></...
4,503
<p>What is the best way to access an ASP.NET HiddenField control that is embedded in an ASP.NET PlaceHolder control through JavaScript? The Visible attribute is set to false in the initial page load and can changed via an AJAX callback.</p> <p>Here is my current source code:</p> <pre><code>&lt;script language="javas...
<p>My understanding is if you set controls.Visible = false during initial page load, it doesn't get rendered in the client response. My suggestion to solve your problem is</p> <ol> <li>Don't use placeholder, judging from the scenario, you don't really need a placeholder, unless you need to dynamically add controls on ...
<p>Visible doesn't actually make it visible, you can leave it default. Just runat="server" and use its .Value.</p>
31,423
<p>I'm using a 3rd party DLL written in unmanaged C++ that controls some hardware we have.</p> <p>Unfortunately this DLL crashes now and then and I've been tasked to make it "reload" automagically. I'm not too sure about how to proceed to get best results.</p> <p>My project uses C++.Net 2.0 (2005). I'm wrapping the 3...
<p>The most effective approach will be to not load that DLL in your application's process at all. Instead, create a second process whose only job is to use that DLL on behalf of your application. You can use a shared memory region, local socket, or other IPC mechanism to control the proxy process.</p> <p>This way, w...
<p>LoadLibrary and FreeLibrary are the start, but you then need to wrap all calls into the DLL in SEH (structured exception handling) __try / __catch blocks if you want to be able to ride out a crash within the DLL. N.B. this is quite different from C++ exceptions and try/catch blocks. See MSDN for more information.</p...
46,670
<p>I am trying to center a form in VB.net. Instead of centering the form, it ends up about halfway between center and 0,0(upper left). </p> <p>I am using the code</p> <p>Me.StartPosition = FormStartPosition.CenterScreen</p> <p>Which is called from the IntializeDisplay Method, which in turn is called from the Form Lo...
<p>I think you're setting the value of StartPosition too late in the flow - by the time Form.Load is called, Loading has already completed and the form has an assigned position.</p> <p>Set a breakpoint on the line of code quoted in your question, and look at the forms position - it will already be in the location it a...
<p>Do you have any form resizing/positioning logic implemented? If so, comment it out and try again. </p> <p>Try setting the <code>Form.StartPosition</code> in the designer (which will set it in <code>InitializeComponent()</code>) instead of in the Load event. </p> <p>Try resetting the <code>Form.Location</code> an...
41,559
<p>I have a Dictionary where I hold data for movieclips, and I want the data to be garbage collected if I stop using the movieclips. I'm using the weak keys parameters, and it works perfectly with other data, however I've run into a problem. </p> <p>This code works great:</p> <pre><code>var mc = new MovieClip(); var ...
<p>I believe that the problem is one of timing. I think that when you call remove child, the reference count isn't getting updated until later in the "frame". (I think this is what is happening anyway.)</p> <p>The code below demonstrates why I think this is true. (I'm using flex, but it appears to reproduce your issue...
<p>In you're example code here you're never adding the movieclip to the dictionary, but the int 12 instead? Probably a typo.</p> <p>If you want the dictionary to have a list of what's currently on the stage, why not have i as a util class instead that listens to Event.ADDED_TO_STAGE and Event.REMOVED_FROM_STAGE and mo...
26,225
<p>How do i represent CRLF using Hex in C#?</p>
<p>Since no one has actually given the answer requested, here it is:</p> <pre><code> "\x0d\x0a" </code></pre>
<p>Not sure why, but it's 0x0d, 0x0a, aka "\r\n".</p>
11,274
<p>I'm developing an application that manages network interfaces on behalf of the user and it calls out to several external programs (such as ifconfig) that requires root to make changes. (Specifically, changing the IP address of a local interface, etc.) During development, I have been running the IDE as root (ugh) and...
<p>Your idea about the daemon has much merit, despite the complexity it introduces. As long as the actions don't require some user interface interaction <em>as root</em>, a daemon allows you to control what operations are allowed and disallowed.</p> <p>However, you can use SUDO to create a controlled compromise betwee...
<p>There's no single user that is halfway between a "normal" user and root. You have root, and then you have users; users can have differing levels of capabilities. If you want something that's more powerful than a "normal" user but not as powerful as root, you just create a new user with the capabilities you want, but...
30,911
<p>I just downloaded the ASP.NET MVC beta and the templates are not StyleCop compliant. </p> <p><strong>Why is new .NET code coming from Microsoft not StyleCop compliant?</strong></p>
<p>StyleCop checks conformance to the Microsoft Framework Design Guidelines. </p> <p>The guidelines are <em>enforced</em> only on the code that makes up the .NET Framework proper, and even in the framework proper, occasional lapses exist. Elsewhere, the guidelines are recommendations only.</p> <p>The framework design...
<p>Most if not all Microsoft templates, in Visual Studio, are not Style copy complaint.</p>
26,397
<p>Has anyone got experience with the white framework?</p> <p><a href="http://www.codeplex.com/white" rel="noreferrer">www.codeplex.com/white</a> ?</p> <p>I'm thinking about using it for the next project for basic smoke tests of our windows client. I'd like some advice on articles or your own experiences. Thanks.</p>...
<p>I recently used white to build a few (20+) UI tests for a fairly complex WinForms app with plenty of UserControls, dynamically created and 3rd-party controls.</p> <p>Here are my impressions:</p> <ul> <li>Very easy and intuitive to work with.</li> <li>Little or no quality issues.</li> <li>It's a young project so th...
<p>I evaluated it recently, but had to reject it because it would not support the third party controls (janus grid) we were using.</p>
9,727
<p>I am currently suffering a brain fart. I've done this before but I can't remember the exact syntax and I can't look at the code I wrote because I was working at another company at the time. I have this arrangement:</p> <pre><code>class P { // stuff }; class PW : public P { // more stuff }; class PR : public P { /...
<p>If you want to get this part to compile:</p> <pre><code> // ... P p = c.GetP( ); // valid PW p = c.GetP( ); // invalid PR p = c.GetP( ); // invalid // ... </code></pre> <p>You need to be able to construct/convert a P into a PW or a PR. You need to do something like this:</p> <pre><code> class PW : p...
<p>Use a reference or pointer to P rather than an object:</p> <pre><code>class C { public: P* GetP() const { return p; } private: P* p; }; </code></pre> <p>This will allow a PW* or a PR* to be bound to C.p. However, if you need to go from a P to a PW or PR, you need to use dynamic_cast&lt;PW*&gt;(p), which will...
14,824
<p>Can anyone recommend some decent resources for a .NET developer who wishes to get a high level overview of the Delphi language?</p> <p>We are about acquire a small business whose main product is developed in Delphi and I am wanting to build up enough knowledge to be able to talk the talk with them.</p> <p>Books, w...
<ul> <li><a href="http://www.delphibasics.co.uk" rel="nofollow noreferrer">DelphiBasics</a> gives a good overview of basic syntax, library functions etc.</li> <li><a href="http://www.marcocantu.com/edelphi/default.htm" rel="nofollow noreferrer">Essential Delphi</a> is a free e-book by Marco Cantu that should give a goo...
<p>@Martin there is a free version.</p> <p><a href="http://www.turboexplorer.com/" rel="nofollow noreferrer">Turbo Delphi</a></p> <p>If you are comfortable with c# you will see many similarities with Delphi.</p> <p>I also found the community surrounding the newsgroups to be active and helpful. They have a smilar con...
3,411
<p>I have a web application that allows a user to search on some criteria, select an object, edit it and then return to the previous search. All the editing takes place on a separate page linked to the datagrid of returned results. I was wondering what is the best way to store the previous search parameters so that w...
<p>In our app, we have dozens of lists with search fields. We've designed a simple utility class that generates a unique string based on the current Page and stores it in the session.</p> <pre><code> public static string GenerateSessionKeyFromPage(Page page) { return "__" + page.Request.Path; } </co...
<p>In our app, we have dozens of lists with search fields. We've designed a simple utility class that generates a unique string based on the current Page and stores it in the session.</p> <pre><code> public static string GenerateSessionKeyFromPage(Page page) { return "__" + page.Request.Path; } </co...
31,625