input
stringlengths
51
42.3k
output
stringlengths
18
55k
Helper library for distributed algorithms programming? <p>When you code a distributed algorithm, do you use any library to model abstract things like processor, register, message, link, etc.? Is there any library that does that?</p> <p>I'm thinking about e.g. self-stabilizing algorithms, like self-stabilizing minimum ...
<p>There's a <a href="http://www.keldysh.ru/dvm/" rel="nofollow">DVM system</a> that can be used for implementing different distributed algorithms. It works on top of <a href="http://www.mpi-forum.org/" rel="nofollow">MPI</a>.</p> <p>However it is more for matrix-oriented scientific algorithms where distribution is do...
Retrieving auto-incremented column value from table where multiple insert/selects in single stored procedure <p>I have a stored procedure with multiple insert/select statements. Let's say I'm using the first insert to populate a "Manager" table. On insert, a ManagerId (incremented automatically) is added, but not ref...
<p>use scope_identity() after your insert to capture the most recent single identity value from within your current scope:</p> <pre><code>DECLARE @ID int INSERT ...... SELECT @ID=scope_identity() </code></pre> <p>use @ID wherever you need it</p> <p>note: SCOPE_IDENTITY() is preferred over the older @@IDENTITY ...
call different child function from same parent function <p>Im looking to have a common parent function like so</p> <pre><code>void main (param 1, param 2) { &lt;stuff to do&gt; param1(); print("The function %s was called", param 2); &lt;more stuff to do&gt; } </code></pre> <p>Where param 1 will be the...
<p>What you actually want to pass for param 1 is a function pointer to the function you would like to call, as opposed to that function's name.</p> <p>Have a look at this <a href="http://www.newty.de/fpt/index.html" rel="nofollow">tutorial</a> about function pointers.</p>
how can I tell if someone printed from printPreview? <pre><code>Using printPreview As New PrintPreviewDialog() ' Dim x As New Printing.PrintDocument() ' AddHandler x.PrintPage, AddressOf PrintData printPreview.Document = Me.CurrentDocument If ShowPrinterSetup Then Dim x As Ne...
<p>You can get the result of the print job from the CurrentDocument EndPrint event</p> <pre><code>Private WithEvents CurrentDocument As New PrintDocument Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Using printPreview As New PrintPreviewDialog() ...
Inline img with <a> causes weird issue in IE <p>Doctype:</p> <pre><code>&lt;?xml version="1.0" encoding="iso-8859-1"?&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; </code></pre> <p>HTML:</p> <p...
<p>Using the following HTML, I was able to reproduce your problem:</p> <pre><code>&lt;?xml version="1.0" encoding="iso-8859-1"?&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;...
Alternatives to use polymorphism in Ruby on Rails <p>I'm currently writing some intranet web application where people could submit to admins requests for adding different resources. The example requests would be:</p> <ul> <li>installing programs, in this case user will select which program he wants installed</li> <li...
<p>Single Table Inheritance! This way you can have each type of request have custom validations, while still having every request live in the same table.</p> <pre><code>class CreateUserRequests &lt; ActiveRecord::Migration def self.up create_table :user_requests do |t| t.string :string_data, :type t...
Entity Framework ( Entity travelled from EntityObject to DTO and then again to EntityObject ) is it possible to easily update it in db at this point? <p>i think my whole questions is inside title bar =] but i'll explain little more.</p> <p>i've got 2 related tables in database ( Customers and Orders ) and wcf service ...
<p>Here's an <a href="http://msdn.microsoft.com/en-us/magazine/cc700340.aspx" rel="nofollow" title="The Entity Framework In Layered Architectures">article with downloadable code sample</a> on using EF and WCF together, including updates. You can also look at <a href="http://download.microsoft.com/download/F/B/8/FB8CA63...
WPF binding not notifying of changes <p>I have a WPF sorting/binding issue. (Disclaimer: I am very new to WPF and databinding so apologise if I am asking a really dumb question :-))</p> <p>Firstly, I have a linqToSql entity class <code>Contact</code> with an <code>EntitySet&lt;Booking&gt;</code> property Bookings on i...
<p>You should bind to a <a href="http://msdn.microsoft.com/en-us/library/system.windows.data.collectionview.aspx" rel="nofollow"><code>CollectionView</code></a> rather than the collection itself. That will allow you to specify whatever sorting criteria you require. Example:</p> <pre><code>var collectionView = new List...
How can I deliberately slow Windows? <p>How do I reversably slow a PC with XP?</p> <p>I want to achieve this without using visible CPU-cycles, so I'm guessing some hardware settings might do.</p> <p>I don't want my app to run slow, I want the whole OS to be slow. I know some network lookups especially out of a truste...
<p>We use a 'crippled' server we call doofus for load testing. it is an old P3/500 box with limited RAM.</p> <p>Another option is setting up a VM with very limited resources.</p>
How can I covert a binary file into a set of ascii charecters <p>I want to convert a binary file into an array of ascii charcters . how can I do that . thank you .</p>
<p>It depends on what you want to do with it. Ascii is supposed to be 7bits (0-127 are well defined, the other characters are codepage dependant). So plain ASCII encoding can lead to nasty surprises (among which are non printables characters as nulls...)</p> <p>If you want to have something printable out of your byte ...
Find text string using jQuery? <p>Say a web page has a string such as "I am a simple string" that I want to find. How would I go about this using JQuery?</p>
<p>jQuery has the contains method. Here's a snippet for you:</p> <pre><code>&lt;script type="text/javascript"&gt; $(function() { var foundin = $('*:contains("I am a simple string")'); }); &lt;/script&gt; </code></pre> <p>The selector above selects any element that contains the target string. The foundin will be...
USB Hierarchy Driver <p>Is it possible to create a driver (windows/mac) for a custom usb hub such that it appears as one device in My Computer / Finder and the attached usb card readers each show up as a sub-folder within that device? Any pointers to the right direction to look at would be appreciated.</p>
<p>It is <em>possible</em>, but unholy amounts of difficult. You really don't want to do this. Really. You'll basically be reimplementing USBHub.sys from scratch, as well as breaking the standard paradigm of drives in Windows (i.e. drives appear in My Computer).</p>
Extending Android's Default Gmail/Email Applications <p>I would like to extend the Android platform's default Gmail/Email applications either by plugging into their ContentProvider or by using intent filters. Essentially, I want to be able to scan incoming emails for special rules that will trigger events in my Android...
<blockquote> <p>Does the Gmail/Email applications allow you to extend them in this way?</p> </blockquote> <p>Gmail is closed source, and so it is difficult to know what it does or does not support.</p> <p>The Email application is not part of the public SDK, so trying to rely upon any ContentProvider it may have (an...
I am having trouble changing my images on click event with Jquery <p>I am trying to swap image when an image is clicked...here is my jquery so far and it's not working.</p> <pre><code>$(document).ready(function(){ imgFldr = '../../App_Themes/Default/Images/'; $('#smallImg1').click(function(){ $('#smallImg1')...
<p>I would have written it like this:</p> <pre><code>$(function() { var imageFolder = '../../App_Themes/Default/Images/'; $('#smallImg1').click(function(){ $(this).attr('src', imageFolder + "belkinSmall4.png"); }); }); </code></pre> <ul> <li><code>$(function() { ... })</code> is shorthand for <code>$(docume...
Find the original implementation of a virtual method <p>I am trying to use reflection to determine which methods a derived class overrides from a base class. It is fairly easy to determine if the method is <em>not</em> overridden, but trying to determine if a method is overridden in a base class, or simply created as ...
<p>Is <a href="http://msdn.microsoft.com/en-us/library/system.reflection.methodinfo.getbasedefinition.aspx"><code>GetBaseDefinition</code></a> what you're after?</p> <p>Basically </p> <pre><code>if (method.GetBaseDefinition() == method) { // Method was declared in this class } </code></pre> <p>Here's an example ...
How can I get the users network login name? <p>I'm building a C# application, and I want to identify users by their username. For example, if I logged onto the domain mydomain as the user myusername I'd want to get the mydomain\myusername so I can identify the user.</p> <p>How can I do this with C#?</p>
<p>It's very simple indeed:</p> <pre><code>Environment.UserName </code></pre> <p>From the <a href="http://msdn.microsoft.com/en-us/library/system.environment.username.aspx">MSDN page</a>:</p> <blockquote> <p>The UserName property provides part of the credentials associated with computer domain names, as return...
DB2 Temp Tables: Not storing or not retrieving information <p>I'm an MSSQL guy, but I'm working on a DB2 query that needs to create a temp table, insert into it, and do stuff with it. As a much-shortened test, I'm using the following query, which is providing the same result.. </p> <pre><code>declare global temporary...
<p>Try:</p> <pre><code>declare global temporary table tt_testingSyntax (id int) ON COMMIT PRESERVE ROWS NOT LOGGED; insert into session.tt_testingSyntax (id) values (1); insert into session.tt_testingSyntax (id) values (2); insert into session.tt_testingSyntax (id) values (3); insert into session.tt_testingSyntax (i...
Nokia N95 and PyS60 with the sensor and xprofile modules <p>I've made a python script which should modify the profile of the phone based on the phone position. Runned under ScriptShell it works great.</p> <p>The problem is that it hangs, both with the "sis" script runned upon "boot up", as well as without it.</p> <p>...
<p>I often use something like that at the top of my scripts:</p> <pre><code>import os.path, sys PY_PATH = None for p in ['c:\\Data\\Python', 'e:\\Data\\Python','c:\\Python','e:\\Python']: if os.path.exists(p): PY_PATH = p break if PY_PATH and PY_PATH not in sys.path: sys.path.append(PY_PATH) </cod...
Using ObjectDataProvider in XAML to bind property crashes VS <p>Sorry for a very specific question, bot why VS2008 and VS2010 crashes with this code? I though it's a common to use ObjectDataProvider to bind property. I seen examples in many places on the web, but werether I try to use it I get exception and my VS close...
<p>From your code sample it looks like you're trying to create an instance of <code>Window1</code> from within the XAML of <code>Window1</code>. Given that would result in an infinite loop, I could see that crashing the app or Visual Studio.</p> <p>If you want to bind the members of the collection to the <code>TreeVie...
LINQ to XML Newbie: Moving Nodes From One Node To Another <p>Greetings!</p> <p>I have an XElement object that contains the following:</p> <pre><code>&lt;Root&gt; &lt;SubSections&gt; &lt;SubSection id="A"&gt; &lt;Foo id="1"&gt; &lt;Bar /&gt; &lt;Bar /&gt; ...
<p>You need to get Foo sections 2 and 3 with a query like:</p> <pre><code>var foos = from xelem in root.Descendants("Foo") where xelem.Attribute("id").Value == "2" || xelem.Attribute("id").Value == "3" select xelem; </code></pre> <p>And then iterate that list and remove them from their parents w...
DB2 Bulk Load from .Net (C#)? <p>Is there an API for loading a large # of non-transactional rows directly into a DB2 table?</p> <p>I know there are some CLI commands for doing this, but it isn't clear what is directly supported from the .Net APIs.</p>
<p>Take a look at the ADMIN_CMD stored procedure, which gives SQL applications access to the LOAD utility and many other administrative commands. Here's the relevant info for DB2 9.5: <a href="http://publib.boulder.ibm.com/infocenter/db2luw/v9r5/topic/com.ibm.db2.luw.sql.rtn.doc/doc/r0023577.html" rel="nofollow">http:/...
How should I modify my Queue class to allow users to create empty queues of unspecified type in F#? <p>I have created an immutable <code>Queue</code> in F# as follows: </p> <pre><code>type Queue&lt;'a&gt;(f : 'a list, r : 'a list) = let check = function | [], r -&gt; Queue(List.rev r, []) | f,...
<p>You need to use GeneralizableValueAttribute, a la:</p> <pre><code>type Queue&lt;'a&gt;(f : 'a list, r : 'a list) = // ' let check = function | [], r -&gt; Queue(List.rev r, []) | f, r -&gt; Queue(f, r) member this.hd = match f with | [] -&gt; failwith "empty" | hd :...
Checking Page.IsPostBack in user controls <p>Is it recommended to check the Page.IsPostBack in a user control Page_Load Event like</p> <pre><code> protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { } } </code></pre> <p>I am getting wierd results</p> ...
<p>Just checking it for no reason? Absolutely not. If you should do something only on first load and not on subsequent post backs then it's the pattern that should be used.</p>
How can I share message classes across applications when using NServiceBus? <p>So I have two separate applications that I want to send messages between. I happen to be using NServiceBus, but that shouldn't really matter. How do I send a message from application A to application B and have them both be aware of the same...
<p>It may not be the answer you want but there are very few silver bullets here.</p> <p>You've really only got a few choices, and as such then depends on the level of functionality and type-hardening you want in your message classes:</p> <ol> <li>Shared DLL's - benefit that it can be code + structure e.g. useful cons...
In source control is it better to have one big repos or a repos per project? <blockquote> <p><strong>Possible Duplicate:</strong><br /> <a href="http://stackoverflow.com/questions/252459/one-svn-repository-or-many">One SVN repository or many?</a> </p> </blockquote> <p>Self explanatory I feel. I got a list of rela...
<p>This is a debated topic and many similar questions have been asked on SO previously:</p> <ul> <li><a href="http://stackoverflow.com/questions/252459/one-svn-repository-or-many">http://stackoverflow.com/questions/252459/one-svn-repository-or-many</a></li> <li><a href="http://stackoverflow.com/questions/15674/subvers...
How do I jump to the first line of shell output? (shell equivalent of emacs comint-show-output) <p>I recently discovered 'comint-show-output' in emacs shell mode, which jumps to the first line of shell output, which I find incredibly handy when looking at shell output that exceeds a screen length. The advantages of th...
<p>The way I do this sort of thing is by sending my output to a file and then watching the file as it is written. You still get the results of the command dumped to terminal history in real time and can still inspect the output's actual contents further after the fact (or in another terminal, etc...)</p> <pre><code>co...
Openquery works much faster than a query straight to a linked table <p>Trying to figure out why there is such a significant difference between </p> <p><code>select * from linkedserver..tablename</code> </p> <p>and </p> <p><code>select * from openquery(linkedserver, select * from tablename)</code>. </p> <p>4 minute...
<p>OPENQUERY connects to the destination server and runs the query on that server and returns the resultset. Whereas, I believe the Linked Server query is executed on the local server and runs across the connection.</p> <p>Hope this helps.</p>
What Hibernate interview questions do you ask? <p>We are interviewing new developers looking for someone with some hibernate experience. We are trying to put together a list of questions to test an interviewee’s hibernate knowledge. We’re basically using the test to verify that someone has a good grasp of how Hiber...
<p>Here are three quiz on hibernate which will help you in screening the candidates</p> <p><a href="http://www.skill-guru.com/skill/login/fetchRelatedTestsPosts.faces?tag=hibernate" rel="nofollow">Hibernate Interview Questions</a></p>
Scaffolding Web Services in Grails <p>I need to implement a web app, but instead of using relational database I need to use different SOAP Web Services as a back-end. An important part of application only calls web services and displays the result. Since Web Services are clearly defined in form of Operation: In paramet...
<p>Probably the easiest approach is to use wsimport on the WSDL files to generate the client-side stubs. Then you can call methods in the stubs from Groovy just as you would have called them from Java.</p> <p>For example, consider the WSDL file for Microsoft's TerraServer, located at <a href="http://terraservice.net/...
How can I commit a file to SVN that I forgot to commit a while ago, (tweaking it's revision number) <p>So I've been happily using subversion to regularly commit files in my stack of projects related to my massive Visual Studio solution.</p> <p>I decide to do a svn export one day, and, decided I needed to see how my pr...
<p>Not really. Subversion revision numbers apply to the entire tree of source code. If you were able to make changes to a commited revision, that would destroy the idea of change management.</p> <p>What you can do is create a branch off of revision 37, and make changes to that. This will create a new revision, say ...
Parsing really big log files (>1Gb, <5Gb) <p>I need to parse very large log files (>1Gb, &lt;5Gb) - actually I need to strip the data into objects so I can store them in a DB. The log file is sequential (no line breaks), like:</p> <p>TIMESTAMP=20090101000000;PARAM1=Value11;PARAM2=Value21;PARAM3=Value31;TIMESTAMP=20090...
<p>Write a prototype in Perl and compare its performance against how fast you can read data off of the storage medium. My guess is that you'll be I/O bound, which means that using C won't offer a performance boost.</p>
Why won't this jQuery function perform properly? <p>I'm a total noob when it comes to jQuery but I am trying to learn. What in tarnation am I doing wrong here?</p> <pre><code>function MakeCall(url) { var result; $.ajax({ url: url, dataType: "text", success: function(txt) { result = txt; re...
<pre><code> result == txt; </code></pre> <p>Should be</p> <pre><code> result = txt; </code></pre> <p><hr /></p> <p>Your second problem is that ajax calls are asynchronous. i.e. the alert(result) statement will probably be executed before the success callback function.</p> <p>You are asking how to prevent thi...
How to interview dev / hosting shops? <p>We're looking at starting a new, specialized (customer facing) web app; there are a few paths we can take -- we can code and host in house, we can code in-house and host externally, we can have someone else do the coding and hosting, COTS, etc.</p> <p>Let's assume I've reasonab...
<p>The last question on your list, <em>"How many customers do you have? Can I talk with some of them?"</em> should also translate to the viewing of a portfolio of existing products. Then do research on those particular 'products' (sites, applications, what-not). </p> <p>That alone (but shouldn't be the only thing) sho...
CSS Layout with Pixel And Percents <p>I have a div which contains two nested divs, one that specifies a height of 65 pixels (header), the other which specifies the height as 100% (content) and it is supposed to take the rest of the space veritically. When the page renders, there is a scrollbar on the right because of t...
<p>Try reading <a href="http://www.alistapart.com/articles/conflictingabsolutepositions" rel="nofollow">this article</a> first... it is about <strong>Conflicting Absolute Positions</strong> in a CSS template and somehow it addresses the kind of problem you are talking about.</p>
Custom Namespace on .NET web app <p>So I wrote some custom classes and put them all in a namespace, call it "Sphere".</p> <p>On my aspx.cs codebehind file, I have "using Sphere;" written. I know that this works because it's always worked until I copied this project to a new folder. Also, even when I click "view in web...
<p>Are your custom classes in a separate project? If so, you might need to add a reference to that project. If you have copied the project to a new folder, the path to your Sphere DLL/project in VS2008 might be broken.</p>
Show DNN stack trace? <p>I have a legacy DNN site, and an error shows up at the top of the page telling me that one of the modules failed to load. That's <i>wonderful</i>, but that doesn't tell me a damned thing about why the module didn't load. Does anyone unfortunate enough to work with DotNetNuke know how to view ...
<p>When you aren't logged in, that's the only message you're going to see. I think you need to be a host user to see the error message in-line, in place of the module, but as an admin user you can go to the Event Viewer (or Log Viewer, depending on your version of DNN) page in the Admin menu.</p> <p>However, since yo...
Does garbage collector clear objects subscribed to events? <p>If I do the following:</p> <pre><code>public class Test { public static void Main() { List&lt;Person&gt; persons = new List&lt;Person&gt; { new Person() }; persons[0].Sneezing += new EventHandler(Person_Sneezing); persons = null; } public stati...
<p>This will be collected by the GC. To be kept in memory an object must be referenced directly or indirectly by ...</p> <ol> <li>A value on the stack</li> <li>A value rooted in a strong GC handle</li> <li>A corner case or two I'm not thinking of at the moment</li> </ol> <p>This is not true for the object at persons...
Formatting the output of a key from a dictionary <p>I have a dictionary which store a string as the key, and an integer as the value. In my output I would like to have the key displayed as a string without parenthesis or commas. How would I do this?</p> <pre><code>for f_name,f_loc in dict_func.items(): print (...
<p>I don't have Python 3 so I can't test this, but the output of f_name makes it look like it is a tuple with one element in it. So you would change <code>.format(f_name, f_loc)</code> to <code>.format(f_name[0], f_loc)</code></p> <p><strong>EDIT</strong>:</p> <p>In response to your edit, try using <a href="http://do...
How to make a TreeView's and ListBox's SelectedItem stay in sync? <p>I'm certain this has come up before, but I haven't been able to find the answer.</p> <p>I made a basic ViewModel that contains a list of People (an array of Person) with a property called SelectedPerson, which naturally points to the currently select...
<p>You can Use Selector.IsSyncronizedWithCurrentItem.</p> <p>You can bind both thye listbox and treeview to the same datasource and make sure that the IsSyncronized parameter is set to true. Then any changes to the current item in one will be reflected in the other.</p> <p>More information can be found here:</p> <p>...
Is there a way to for CVS (using Windows ) to Commit all subtending folders in different projects? <p>I've got several projects:</p> <p>P:\Projects\Common P:\Projects\App1</p> <p>I originally added each of the folders (and their sub folders) to CVS (using Tortoise).</p> <p>Now I want to be able to just right clock P...
<p>You could either make a new CVS module that is a parent to all of your other directories or look into <a href="http://www.network-theory.co.uk/docs/cvsmanual/Aliasmodules.html" rel="nofollow">alias modules</a>.</p> <p>I have used alias modules to bring together multiple components into a single checkout (and theref...
Why would two mysql files (same table, same contents) be different in size? <p>I took an existing MySQL database, and set up a copy on a new host.</p> <p>The file size for some tables on the new host are 1-3% smaller than their counterpart files on the old host.</p> <p>I am curious why that is.</p> <p>My guess is, t...
<p>From what i understand of mysql It has a growth algo as it approaches capacity, when mounted it chose a different size, prolly trimming excess storage</p>
Tkinter: Changing a variable within a function <p>I know this kind of question gets asked all the time but either i've been unable to come across the answer i need, or i've been unable to understand it when i did.</p> <p>I want to be able to do something like:</p> <pre><code>spam = StringVar() spam.set(aValue) class ...
<p>Please give this a shot.</p> <p>Lots of example code out there generously uses globals, like your "var" variable.</p> <p>I have used your var argument to act as a pointer back to the original spam object; assigned to self.var_pointer within the MyScale class.</p> <p>The code below will change the value of 'spam' ...
Seting up NHibernate Validator with Spring.net <p>How can I setup NHibernate Validator with Spring.net as IoC?</p> <p>I am already using Spring.net integration with NHibernate and can't get AutoRegisterListeners to work. </p> <p>What I need is to setup NHV to validate entities automatically upon Update/Save instead o...
<p>After looking around a lot I found this one: <a href="http://forum.springframework.net/showthread.php?t=5286" rel="nofollow">http://forum.springframework.net/showthread.php?t=5286</a></p> <p>I'm repeating it here for others to find it easier that I did!:</p> <pre><code>&lt;object id="sessionFactory" type="Spring.D...
tableViewHeader rejecting multiple sub-views <p>The tableViewHeader property of UITableView is a UIView so I thought I would be able to add multiple sub-views to it. However, when I added the code for the segmented control the UILabel a few lines before it doesn't draw. Rects <em>shouldn't</em> be overlaping each other...
<p>Should have updated this earlier...I had autoreleased AND released the same object. silly me...</p>
What is the best AI language/framework for .NET? <p>I'm building an academic work that consists in a turn-based strategy game. I'm using XNA 3 for the graphics but didn't decide what to use for AI.</p> <p>I was considering to use P#, a Prolog interpreter for .NET but i found it a bit poor. Do you anything better for g...
<p>Are you using Prolog because it's declarative? When I was working in AI, I split my work between Prolog and <a href="http://en.wikipedia.org/wiki/Scheme%5Fprogramming%5Flanguage" rel="nofollow">Scheme</a>. </p> <p>If you're interested in a functional language (ala Scheme) rather than OO, I suspect you'll get quit...
Jeditable setting default selected value after change <p>My app allows the user to update a field via a drop down box using jeditable. When the program is loaded i created this function to get the selected value and set it as the selected value in jeditable.</p> <p>But after i change the value, the selected tag stays ...
<p>I've had the same issue. The answers given here are not to the point.</p> <p>Anyway, I solved it with a pretty simple and neat solution:</p> <p>Just don't add the 'selected' key and value.</p> <p>Every time you open the select box it's automatically on the value of the cell...</p> <p>Hope this helps.</p>
How to simulate a DB for testing (Java)? <p>I'm programming in Java and my applications are making a lot of use of DB. Hence, it is important for me to be able to test my DB usage easily.<br /> What DB tests are all about? For me, they should supply two simple requirements: </p> <ol> <li>Verify SQL syntax.</li> <li>M...
<p>Java comes with <a href="http://www.oracle.com/technetwork/java/javadb/overview/index.html" rel="nofollow">Java DB</a>.</p> <p>That said, I would advise against using a different type of DB than what you use in production unless you go through an ORM layer. Otherwise, your SQL might not be as cross-platform as you ...
domain forwarding and seo <p>I want <a href="http://mynewdomain.com" rel="nofollow">http://mynewdomain.com</a> to forward with masking to <a href="http://mysecretdomain.com/mynewsite" rel="nofollow">http://mysecretdomain.com/mynewsite</a>. When a user types in <a href="http://mynewdomain.com/aboutus.html" rel="nofollow...
<p>Why not just map your secret domain to the ~/www directory on your host, and the new domain to ~/www/newdomain? Then when you go to mysecretdomain.com/newdomain/ it looks in ~/www/newdomain/... exactly what you described, with no redirects.</p> <p>Maybe I don't understand your goal here.</p>
how to solve deadlock problem? <p>i have read this dead lock problem When database tables start accumulating thousands of rows and many users start working on the same table concurrently, SELECT queries on the tables start producing lock contentions and transaction deadlocks. </p> <p>Is this deadlock problem related w...
<p>Deadlocks can occur for many reasons and sometimes troubleshooting deadlocks can be more of an art than a science. </p> <p>What I use to find and get rid of deadlocks, outside of plain SQL Profiler, is a lightweight tool that gives a graphical depiction of deadlocks as they occur. When you see a deadlock, you can...
In a .NET C# program, is it easy to transition from FTP to SFTP? <p>In a .NET C# program, is it easy to transition from FTP to SFTP? I'm trying to get a sense of how muh time it would take the contractor to make the transition. My personal experience is mostly with PHP, so I have no idea.</p> <p>Basically, what I'm ta...
<p>This is a pretty vague question. You haven't told us what the C# program is doing with FTP. Is it a server, is it a client, is it doing directory listings, is it uploading 100 GB files? What library is it using?</p> <p>According to <a href="http://social.msdn.microsoft.com/forums/en-US/netfxnetcom/thread/136ad4c...
How to load jquery "Modal Window" Before Page load? <p>I'm making a site in two language ,I want to give a "jquery Modal Window" before English page load to give a option to choose another language link (on a modal window).If user will click on Second language link he will go for that page and if he want to stay with e...
<p>If you want the user to pick a language before using a site, and your current plan is to present them with a "modal" jquery dialog...then a more usable, user-friendly approach would be to create a language-selection landing page that users will be presented upon entering your site. A landing page like this, for all ...
Tips and Tricks for making beautiful designed views on the iPhone / Objective-C <p>What programming tips / tricks have you learned for styling views on the iPhone?</p> <p>As an example, you can set the background color of a view to an image:</p> <p>[myView setBackgroundColor:[UIColor colorWithPatternImage: [UIImage i...
<p>I've created a bunch of custom views on the iPhone, and I generally design them in Adobe Fireworks before trying to create them in IB or XCode. Firework's native format is PNG, so it's easy to jump between the images and the simulator, and adjust them to make the view look good. </p> <p>As far as creating the actua...
Looping over a Python / IronPython Object Methods <p>What is the proper way to loop over a Python object's methods and call them?</p> <p>Given the object:</p> <pre><code>class SomeTest(): def something1(self): print "something 1" def something2(self): print "something 2" </code></pre>
<p>You can use the inspect module to get class (or instance) members:</p> <pre><code>&gt;&gt;&gt; class C(object): ... a = 'blah' ... def b(self): ... pass ... ... &gt;&gt;&gt; c = C() &gt;&gt;&gt; inspect.getmembers(c, inspect.ismethod) [('b', &lt;bound method C.b of &lt;__main__.C object at 0x10...
What reporting tools can I use for an XML datasource? <p>I'm looking for a reporting tool that I can use with an XML datasource. The XML files would be small, approximately 50-60K but may be as large as 200K. The goal of our project is to generate reports based on data submitted in the XML file.</p> <p>I understand I ...
<p>Sql server reporting services (sSRS)</p>
SQL: Select the highest conditional sum on a table <p>I have an OrdersProducts tables with <code>order_id</code>, <code>product_id</code>, and quantity fields. I'd like to know the most popular products, so how can I sum the quantity field for each product_id separately and then order the sums? Any pointers would be ap...
<p>Not 100% sure MySQL will like this - but its pretty standard SQL</p> <pre><code>SELECT product_id, sum(quantity) FROM OrdersProducts GROUP BY product_id ORDER BY sum(quantity) DESC </code></pre>
WebPage Problem <p>How to Get body of content from webpage ?... i want get only text from the body tag all other tags in body should be remove...</p> <p>can any one help me? Thanks in advance....</p>
<p>First find out what position in the string the body tags are located. Then remove everything before the opening tag and everything after the closing tag using NSString methods.</p> <p>After that, here's how to strip the HTML tags from your body content:</p> <p><a href="http://www.objectpark.net/StrippingHTML.html"...
Search Open Directory (LDAP) With Objective-C <p>Does anyone have any sample code in Objective C for connecting to an external Open Directory server and searching a specific node like /Users/?</p> <p>I looked through the OD guide on Apple and I couldn't figure it out. </p>
<p>Is <a href="http://developer.apple.com/documentation/Networking/Conceptual/Open%5FDirectory/Introduction/Introduction.html" rel="nofollow">this</a> the "OD guide" you looked through? Seems to come with pretty rich and extensive code examples -- which of those examples are you finding yourself stumped at?</p>
e-commerce webapp integration via Web Services with MS Dynamics (Navision 2009) <p>Has anyone tried to build an e-commerce site atop MS Dynamics, using the new Web Services introduced in Nav 2009 ? I'd like to know what kind of load these web services can take, and what kind of resources can be read/written, and any ot...
<p>Web services in NAV 2009 can call either CodeUnit or Page objects. Pages allow you to create, read, update and delete rows from their source table. CodeUnits offer greater flexibility, allowing you to invoke any action you can implement in C/AL. I think CodeUnit trigger arguements are limited to primitive types and ...
How to get to the top of C#? <p>How can I become an expert in C# and any language I learn?</p> <p>Also, what are some recommended books....?</p>
<p>Is really easy. <a href="http://www.youtube.com/watch?v=tNfGyIW7aHM" rel="nofollow">Learn all features of the language, then study the framework and read when to apply each feature</a>.</p>
Performance of ASP.NET in Mono(Linux) vs IIS(Window) <p>Is there any performance different between hosting your asp.net in mono on linux and iis on window server?</p>
<p>Of course there is a difference, just like there is a performance difference between Java and .Net. However, it is going to vary widely based on what the application is doing.</p> <p>There are things where .Net is much faster than Mono. There are things where Mono is much faster than .Net. There are things where...
ASP.NET: How to apply CSS class for a Table generated in C# codebehind <p>I have an ASP.NET page and I am generating an HTML table in my server side code (codebehind file )as follows.</p> <pre><code> HtmlTable iTblCart = new HtmlTable(); HtmlTableRow iRowHeader = new HtmlTableRow(); HtmlTableCell iCellHead1 = new Ht...
<p>Yes I got the answer.Here it is</p> <pre><code>iTblCart.Attributes.Add("Class", "clsTradeInCart"); </code></pre> <p>and clsTradeInCart is my CSS class name</p>
How to properly set Firefox as External Web Browser of Eclipse on Mac OS X <p>The default setting "/Applications/Firefox.app/Contents/MacOS/firefox-bin" tries to start a new instance of Firefox every time, which is refused blatantly by Firefox if there is already one.</p> <p>Then I tried to use the "open" magic and se...
<pre>Name: Firefox Location: /usr/bin/open Parameters: -a Firefox.app %URL%</pre> <p>Source: <a href="http://support.mozilla.com/en-US/questions/666771">http://support.mozilla.com/en-US/questions/666771</a>.</p>
Is there a painless way to build a Windows UI in C? <h1>edit</h1> <p>alright, I guess C is painful in nature--Just, this part, is particularly painful.<br /> Also, there isn't a <em>real</em> reason I'm only writing in C, other than, that's the language I want to write in, and be proficient in, for now. I know moving ...
<p>Speaking as an ex-instructor in C Windows programming, I can safely say that there is no easy way to build a GUI using C - the language is not well suited to the task. Almost anything else would be a better choice - my own favourite for GUI development is Delphi.</p>
directly embedded subreport in JasperReports <p>I am so close to having this work, I am trying to directly embed one jasper subreport into the main report xml of the other. You'd think this would be easy, but I can't find a single example on doing it. Everyone seems to use files or resources or whatever. I have one ...
<p>The only way I know of to do this with JasperReports is to use a separate .jrxml file for the subreport, and include it in the main report using the <code>subreport</code> command.</p> <p>Another option you have for any embedded reports is to use subdatasets, but as far as I know they're only useful for graphs.</p>...
[GWT]Block the event of the browser in the case of link <p>I want to handle the event in the case of link by my own event listener.If we click on a link in browser, browser will open the address given in the link but i want to call my own event listener. I tried to do it in GWT by removing the attribute of the anchor t...
<p>In GWT <strong>1.6</strong> the correct code is:</p> <pre><code>ClickHandler foo = new ClickHandler() { public void onClick(ClickEvent event) { /// do your stuff event.stopPropagation(); // stops the event from bubbling to parent event.preventDefault(); // prevents the browsers defa...
How to make a Java PlugIn? <p>I need to make my Java program as a PlugIn to OME - an Image processing web based s/w having Java API </p> <p>www.openmicroscopy</p>
<p><a href="http://trac.openmicroscopy.org.uk/omero/wiki/OmeroJava" rel="nofollow">OmeroJava</a> is the appropriate API for the latest version of OME (OMERO 4.2), if you are writing a client. If you would like to embed your code inside of Insight (the OMERO Java client), then you should start with <a href="https://trac...
What are best practices for multi-language database design? <p>What is the best way to create multi-language database? To create localized table for every table is making design and querying complex, in other case to add column for each language is simple but not dynamic, please help me to understand what is the best c...
<p>What we do, is to create two tables for each multilingual object.</p> <p>E.g. the first table contains only language-neutral data (primary key, etc.) and the second table contains one record per language, containing the localized data plus the ISO code of the language.</p> <p>In some cases we add a DefaultLanguage...
Get string representation of a sql DateTime day <p>Let's say i have a sql datetime of '1 May 2009' or '12 May 2009'. Is there any built in sql function / operation i can perform on the dates above to return the string representation of the DAY of the date?</p> <p>So for '1 May 2009' i'll get "Friday" as the answer (ca...
<p><a href="http://msdn.microsoft.com/en-us/library/ms174395.aspx">DATENAME</a></p> <pre><code>SELECT DATENAME(weekday, '1 May 2009') </code></pre> <p>Edit: For MS SQL Server</p>
assembly x86 implementation of stack <p>i need to implement a stack in x86 assembly so i wrote this:</p> <pre><code>section .bss my_stack: resb 5 </code></pre> <p>but the data inside this address disappear after i continuing with my program </p> <p>there is a better way i can implement the stack?????</p>
<p>I'm not sure what you want, but as the x86 assembly language provides it's own stack, why not use it?</p> <pre><code>push reg ; push register reg to the stack pop reg ; pop register reg from the stack ; actual stack pointer = sp </code></pre> <p>By the way, your code only reserves 5 bytes of space for va...
What does O(log(log(n))))-competitive mean? <p>I was going through some data structures and I noticed this as a time complexity: <strong>O(log(log(n))))-competitive</strong>.</p> <p>I read that constant-competitive was the ratio of the expected time/optimal time. But what does it mean to have a set-competitive?</p...
<p>Online algorithm is one which does not know its inputs in advance, and must "react" (in a sense) to unpredictable inputs. In contrast, offline algorithms are those which know all its inputs in advance. </p> <p>Competitive analysis compares the performance of an optimal online algorithm to an optimal offline algorit...
Can spawned Postgresql process be controlled by the spawner PHP script? <p>I have a PHP CLI script, that processes a csv file, inserting it's content to a table in Postgresql database. This is on an Ubuntu server. I use schedtool to control the affinity of the whole script. Schedtool is used to launch the script itself...
<p>No.</p> <p>Postgres backend is always spawned from postmaster process, so there is no way to pass affinity (whatever that would be) options from php script to postgres backend.</p> <p>On the other hand - if you'd describe what affinity is, and what kind of options you want to setup/pass, maybe there is a solution ...
want to add dynamic content on jsp page <p>I am using Struts2 tags for my designing page at front end side.</p> <p>Now i have a requirement for in my jsp page that i have put 3 simple fields &amp; on some add link i want to so repetitively some another 3 or 4 field at same form dynamically.</p> <p>For example if user...
<p>Your best approach would be to use <a href="http://docs.jquery.com/Downloading%5FjQuery" rel="nofollow">jquery</a> to simplify the javascript. This simple html page demonstrates the approach:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;script type="text/javascript" src="js/jquery-1.3.2.min.js"/&gt; &lt;/h...
How can Virtual Treeview control be made to always scroll by lines? <p>The Virtual Treeview scrolls vertically by pixels, unlike the way the standard Delphi grids, <code>TListView</code> and <code>TTreeView</code> (or most of the other such controls that I am aware of) scroll by line and keep a full line visible at the...
<p>You could intercept the TBaseVirtualTree.OnScroll event and use the virtual treeview's canvas's return value for textheight('M') as the amount to change TBaseVirtualTree.offsety in order to increment (scroll up) or decrement (scroll down). Could also test to ensure that pre-scroll position modulus textheight('M') i...
Find the element before and after a specific element <p>I have a list with links I use with tabs. It looks like this:</p> <pre><code>&lt;ul&gt; &lt;li&gt;&lt;a href="#"&gt;First tab&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Second tab&lt;/a&gt;&lt;/li&gt; &lt;li class="active"&gt;&lt;a href="#"&gt;A...
<pre><code>$("li.active").next(); </code></pre> <p>and</p> <pre><code>$("li.active").prev(); </code></pre>
TLS/SSL in .net <p>Is there any (hopefully free/open source) code available that does native TLS/SSL communication? I do not speak about the HTTPListener/Client and WebRequest classes. I'd like to do raw TLS communication in my C# code.</p> <p>Thanks in advance, Max</p>
<p><a href="http://www.codeproject.com/KB/IP/sslclasses.aspx">Here's an article on codeproject</a>, it also includes code for using OpenSSL.</p> <p>Do you mind if I ask what you're trying to achieve? Just curious really; there's lots of high-level wrapper classes for this kind of thing so you don't normally need to wo...
Unreproducible string comparison, forces elsif failure <p>In answering <a href="http://stackoverflow.com/questions/928563/code-golf-evaluating-mathematical-expressions">this code golf question</a>, I ran across a problem in my answer.</p> <p>I've been testing this and I cannot even get these two comparisons to work in...
<p>You have:</p> <pre><code>if (s + n).match(/^(-?)[.\d]+$/) || (!chars[0].nil? &amp;&amp; chars[0] != ' ' &amp;&amp; n == '-') s += n elsif (chars[0] == '(' &amp;&amp; n[0] == '-') || n == '(' </code></pre> <p>As <code>n</code> is always a one-character string, if <code>(chars[0] == '(' &amp;&amp; n[0] == '-')...
Xcode : Recover complete project from snapshot? <p>today I am playing a bit with the Xcode snapshot feature and I wonder if I could recreate a complete project from a snapshot if all code is lost.</p> <p>It seems to me in the Snapshot-Manager I can only see snapshots of the current project, not of all projects. So if ...
<p>Go to the "Projects" tab in the Xcode Organizer and select your project. You should see all the snapshots that have been made. Select the snapshot you want to restore to and select "Export Snapshot" to save it somewhere to disk. What you export to disk is your "recovered" version of your project.</p> <p>I agree sys...
Pseudo-multiple-inheritance with extension methods on interfaces in C#? <p><a href="http://stackoverflow.com/questions/8042/extension-interface-patterns">Similar question but not quite the same thing</a></p> <p>I was thinking that with extension methods in the same namespace as the interface you could get a similar ef...
<p>The problem that I see with building interface capability via extension methods is that you are no longer actually implementing the interface and so can't use the object as the interface type.</p> <p>Say I have a method that takes an object of type IBar. If I implement the IBar interface on class Foo via extension...
Modulo in JavaScript - large number <p>I try to calculate with JS' modulo function, but don't get the right result (which should be 1). Here is a hardcoded piece of code.</p> <pre><code>var checkSum = 210501700012345678131468; alert(checkSum % 97); Result: 66 </code></pre> <p>Whats the problem here?</p> <p>Regards,...
<p>A bunch of improvements to Benedikt's version: "cRest += '' + cDivident;" is a bugfix; parseInt(divisor) makes it possible to pass both arguments as strings; check for empty string at the end makes it always return numerical values; added var statements so it's not using global variables; converted foreach to old-st...
Is there a plugin to get jQuery.ajax to submit multipart/form-data? <p>I need this so I can submit a subset of form controls that contain non-ASCII text.</p> <p>The solution with an iframe element won't work for me because it submits the entire form; I only want to submit a subset of the controls.</p> <p>I know that ...
<p>I would recommend using jQuery and the Form plugin: <a href="http://malsup.com/jquery/form/#api" rel="nofollow">http://malsup.com/jquery/form/#api</a></p> <p>You can use the <code>fieldSerialize()</code> method to submit only a subset of the form and <code>iframe:true</code> option to make it work with submitting f...
Compiling J2ME from command prompt <p>I'm trying to compile the J2ME java files from command line from 2 week ago !at now I can compile project successfully and also create JAR and JAD files . The files that I compile work equivocal, this means if I use basic class the same as TextField or Form or others this work succ...
<p>I do not know what 'compiling from command prompt' means, but You should really take a look at <a href="http://ant.apache.org/" rel="nofollow">Ant</a> and it's extension <a href="http://antenna.sourceforge.net/" rel="nofollow">Antenna</a> for J2ME apps building.</p> <p>Antenna should be really easy one for starting...
ASP.NET won't send email and no error message, weird! <p>I tried to send an email using this class below, but no success, no error message, the page just executed very fast, any problem with this class?</p> <pre><code>public bool mailSender(string strSubject, string strFrom, string strFromName, string strTo, string st...
<p>Your try/catch block is deliberately throwning away any error message. Remove that and see what you get.</p>
"protected" methods in C#? <p>What are the benefits to defining methods as "protected" in C#? like :</p> <pre><code>protected void KeyDemo_KeyPress( object sender, KeyPressEventArgs e ) { // some code } </code></pre> <p>As compared to something like this:</p> <pre><code>private void FormName_Click( object sende...
<p><strong>Protected methods can be called from derived classes. Private methods can't.</strong></p> <p>That's the one and only difference between private and protected methods.</p>
Which Version Control system to use? <blockquote> <p><strong>Possible Duplicate:</strong><br /> <a href="http://stackoverflow.com/questions/3859/what-is-the-difference-between-all-the-different-types-of-version-control">What is the difference between all the different types of version control?</a> </p> </blockquot...
<p>No, I don't think they're the same. The centralized (e.g., SVN, CVS, etc.) versus distributed (Git, Mercurial, etc.) repository is a fundamental difference that reflects the way your development team operates.</p> <p>I use SVN. I think that my organization's collective heads would explode if a distributed SCM sys...
splitting a string into a list in specman <p>Supposing I have a string:</p> <pre><code>str = “ab,cd,ef” </code></pre> <p>and I want to split it into a list</p> <pre><code>lst = [“ab”,”cd”,ef”] </code></pre> <p>How can I do it best, assuming that I don’t know ahead of time how many items are in the s...
<p>str_split is what you want.</p> <p>From Specman 6.1 docs:</p> <pre><code>str_split(str: string, regular-exp: string): list of string </code></pre> <p>Syntax Example</p> <pre><code>var s: list of string = str_split("first-second-third", "-"); </code></pre>
creating a gif animated file in delphi 2009? <pre><code>gif := TgifImage.Create; gif.Width := 100; gif.Height := 100; gif.AnimationSpeed := 500; gif.Animate := true; gif.add(image1.Picture.Bitmap); gif.add(image2.Picture.Bitmap); gif.add(image3.Picture.Bitmap); gif.SaveToFile('gif.gif'); </code></pre> <p>This loops ju...
<p>Anders Melander, who wrote the original <a href="http://melander.dk/delphi/gifimage/">TGIFImage</a>, has the following <a href="http://melander.dk/delphi/gifimage/#faq%5F5">answer</a>.</p> <blockquote> <p>You need to add a “Netscape Loop” extension block to the first frame of your GIF. The loop block must b...
What use has RoutedCommand' class constructor ownertype argument? <p>The constructor of the RoutedCommand has "owner type" as a last argument. What is its significance? When it is used? </p> <p>MSDN documentation gives completely no clue about why it's needed and whether I could use one type for all commands</p> <p>Q...
<p>The source for RoutedCommand shows that the type becomes the OwnerType property. This property is queried ultimately by the following private method when getting InputGestures. So it looks as though this type is being used to lookup a (hard-coded) set of Commands based on the type that created the RoutedCommand.</p>...
How to refresh a WPF DataGrid? <p>I have a WPF DataGrid with some data. You can add rows through a separate window. The DataContext is the same, a LINQ-to-SQL object. Binding is also the same, I bind the "ItemsSource" property to a table.</p> <p>In the other window, when the user clicks on "Save", I create a row progr...
<p>try datagrid.Items.Refresh() from here <a href="http://programmer.wrighton.org/2009/01/wpf-datagrid-items-refresh.html">http://programmer.wrighton.org/2009/01/wpf-datagrid-items-refresh.html</a></p>
Where should I include JS files <p>I have a PHP application in which there is a div container which includes the app which has been <code>$_GET</code> from the URL string.</p> <p>Currently, there are two applications which require TinyMCE, and one application which requires jQuery and jQuery UI. </p> <p><strong>Quest...
<p>The <a href="http://developer.yahoo.com/performance/" rel="nofollow">Yahoo! Exceptional Performance team</a> recommends to <a href="http://developer.yahoo.com/performance/rules.html#js%5Fbottom" rel="nofollow">put the <code>script</code> elements at the end of the <code>body</code> element</a>.</p>
.htaccess Question <p>I have a login script using PHP. The variables for login in and out are</p> <p>log.php?do=in and log.php?do=out</p> <p>I would like to change this to log/in and log/out if possible.</p> <p>Im really struggling to understand .htaccess and the rewriting at the moment ^^</p>
<p>Try this:</p> <pre><code>RewriteEngine on RewriteRule ^log/(in|out)$ log.php?do=$1 [L] </code></pre>
Pass SelectList "SelectedValue" to Controller Action Method <p>I have a registration form which displays a users Name (textbox), Email (textbox) and Division (SelectList). The Name and Email are pre-populated (I'm using Windows Authentication, Intranet app), and I want to send the SelectedValue from the DropDown to my...
<p>The <strong>RegistrationViewModel</strong> type should contain a simple-typed property such as:</p> <pre><code>public string DivisionValue { get; set; } </code></pre> <p>Or change the type to int, DateTime, or whatever the appropriate type is.</p> <p>In HTML and HTTP the only thing that gets posted back for a dro...
Easy Questions for Teaching Pascal to a kid <p>I've been asked to tutor Pascal to a kid. Despite never seen Pascal before I did manage to get a tutorial and I now know enough to teach him.</p> <p>I am writing you guys to see if anyone can point me out some basic exercises that involve simple algorithms, Something like...
<p>Here is a list of <a href="http://www.freelancingjob.com/articles/article%5Fdescription.php?art%5Fid=96" rel="nofollow">15 Exercises for Learning a new Programming Language</a> from freelance that expands on basic techniques used in many languages and can give him a feel of the new lanaguage he's learning</p>
Python & parsing IRC messages <p>What's the best way to parse messages received from an IRC server with Python according to the RFC? I simply want some kind of list/whatever, for example:</p> <pre><code>:test!~test@test.com PRIVMSG #channel :Hi! </code></pre> <p>becomes this:</p> <pre><code>{ "sender" : "test!~test@...
<p>Look at Twisted's implementation <a href="http://twistedmatrix.com/">http://twistedmatrix.com/</a></p> <p>Unfortunately I'm out of time, maybe someone else can paste it here for you.</p> <h3>Edit</h3> <p>Well I'm back, and strangely no one has pasted it yet so here it is:</p> <p><a href="http://twistedmatrix.com...
How Do I Clone A JAXB Object <p>I have some jaxb objects (instantiated from code generated from xsd by jaxb) that I need to clone. The Jaxb class does not appear to provide an interface for doing this easily. I can not hand edit the class and can not extend it - so I need to create a helper/utility method to do this. W...
<p>Given the purpose of JAXB, I think the easiest way would be to marshall your object to XML and unmarshall it back.</p> <p>Lots more discussions on <a href="http://www.google.com/search?q=jaxb%2Bclone">Google</a>.</p> <p>JAXB FAQ <a href="https://jaxb.dev.java.net/guide/Working%5Fwith%5Fgenerated%5Fcode%5Fin%5Fmemo...
Usability feedback needed - Dark on the sides bright in the middle <p>I wanted to get a feedback from you guys (and hopefully some references to related information) on a website design/layout.</p> <p><img src="http://62.128.51.43/design/layout.png" alt="Layout" /></p> <p>Here is a link to the full size image: <a hre...
<p>The white-on-dark look makes the content look boxed to me. Maybe you could use another color, but not have as much contrast between the two.</p> <p>Honestly your users will probably care more about the quality of your service than the colors you choose as your background. If your service is compelling it won't ma...
How to set time zone of mysql? <p>on one server,when I run:</p> <pre><code>mysql&gt; select now(); +---------------------+ | now() | +---------------------+ | 2009-05-30 16:54:29 | +---------------------+ 1 row in set (0.00 sec) </code></pre> <p>on another server:</p> <pre><code>mysql&gt; select now()...
<p>I thought this might be useful</p> <h1>There are 3 places where the timezone might be set in MySQL:</h1> <h2>in the file "my.cnf" in the [mysqld] section</h2> <pre><code>default-time-zone='+00:00' </code></pre> <h2>@@global.time_zone variable</h2> <p>To see what value they are set to</p> <pre><code>SELECT @@gl...
Library for Image Recognition in Obj-C? <p>I'm looking for some library that will allow me to identify black dots on a white background. Preferably in C or objective-c.</p> <p>Also, what keywords can I use in my search for such algorithms? I've found a lot of stuff about image recognition but nothing that ressembles w...
<p>I think there is a possibility to use OpenCV in obj-c </p> <p>The general API can be found at: <a href="http://opencv.willowgarage.com/wiki/Welcome" rel="nofollow">http://opencv.willowgarage.com/</a> </p>
Easiest way to sell stuff and track inventory <p>on my website I sell unique items. I have programmed it so that on the selling page, users can select any amount of these items, and it calculates the cost. The key is that I only have 1 of each of these items. So I need the shopping cart system to not allow the payment ...
<p>I was thinking about it more, and I think the problem is that once the user gets to the paypal payment screen, I have no control. I guess I could do something like they click the buy it now link, a php script updates it to sold, then they go to the paypal screen, but then they might not continue the purchase...</p>
How can I use jscript assertion to filter exception types in Elmah 1.1 RC? <p>The first binding against 404 works so I got the ErrorFilterModule set up properly, but the jscript section does not seems to work at all. HttpRequestValidationException is still being send in the report mail.</p> <pre><code>&lt;errorFilter&...
<p>When you have more than one condition, the way you have it in your example (<code>&lt;equal&gt;</code> then <code>&lt;jscript&gt;</code>), you need to tell ELMAH to either AND them or OR them. The solution is to use <code>&lt;and&gt;</code> or <code>&lt;or&gt;</code>, depending on how you want to logically combine t...
Where's _WIN64 defined in C++/CLI project compiled as x64? <p>It seems to be added automagically in every project I create and I compile for x64 but it doesn't even appear in the project's Configuration Properties/(C/C++)/Preprocessor when selecting the x64 configuration.</p>
<p>_WIN64 is automatically defined by Visual Studio. See the list of <a href="http://msdn.microsoft.com/en-us/library/b0084kay.aspx">Predefined Macros</a>.</p>