instruction
stringlengths
0
30k
|flash|actionscript-3|
My question is pertaining to the best practice for accessing a child object's parent. So let's say a class instantiates another class, that class instance is now referenced with an object. From that child object, what is the best way to reference back to the parent object? Currently I know of a couple ways that I use o...
Using NetCDF in C#
|.net|data|file|
I am currently working on (or at least planning) a couple of projects that work with large amounts of repetitive data. The kind of data that works well in a spreadsheet or database, but is nasty in XML. :) NetCDF seems like a great option for a file format. However, my work is in C# and there is no "official" NetCDF...
C# NetCDF Library
|.net|file|data|
I don't think there's a way to do it with any built-in commands. I would suggest you download something like [Gnuwin32][1] or [UnxUtils][2] and use the `sed` command: sed -c s/FOO/BAR/g filename [1]: http://gnuwin32.sourceforge.net/ [2]: http://unxutils.sourceforge.net/
SQL Server best way to calculate datediff between current row and next row?
|sql-server|datediff|
I've got the following rough structure: Object -> Object Revisions -> Data The Data can be shared between several Objects. What I'm trying to do is clean out old Object Revisions. I want to keep the first, active, and a spread of revisions so that the last change for a time period is kept. The Data might be ch...
How do I draw text using OpenGL, SDL and C++?
|c++|opengl|sdl|
I heard about SDL_TFF which I read about [here][1] but I don't understand how am I supposed to connect the TrueType2 library. Maybe there is something better out there? [1]: http://www.gamedev.net/reference/articles/article1953.asp
If there isn't one, it would be pretty easy to loop through all the strings in a resource a compare them to the international resources. You could probably do this with a simple grid.
I added the port number for the mail server and it started working sporadically, it seems that it was a problem with the server and a delay in sending the messages. Thanks for your answers, they were all helpful!
I've had amazingly good results with a simple "Leave this field blank:" field. Bots seem to fill in everything, particularly if you name the field something like "URL". Combined with strict referrer checking, I've not had a bot get past it yet. Please don't forget about accessibility here. Captchas are notoriou...
- Boolean Algebra - Set Theory - Discrete Math
Ignore SVN ignore... possible?
|svn|ignore|
So I have some files I want to ignore in a subversion repository, but I don't want my ignore patterns for this to be propagated to the repository. In other words, I added some private files in my checkout that I want to keep, but they only exist for me and wouldn't make sense to be ignored for everyone, so if I use ...
PHP's [split function][1] is similar to the explode function, except that it allows you to enter a regex pattern as the delimiter. [1]: http://us2.php.net/manual/en/function.split.php
PHP's [split function][1] is similar to the explode function, except that it allows you to enter a regex pattern as the delimiter. Something to the effect of: $exploded_arr = split('/\/+/', '1/2//3/'); [1]: http://us2.php.net/manual/en/function.split.php
Are you creating a stand alone GUI app (i.e. Swing)? If so, you should consider how you are providing options to your users how to exit the application. Namely, if there is going to be a File menu, I would expect that there will be an "Exit" menu item. Also, if the user closes the last window in the app, I would a...
You have twice stated that the algorithm cannot be recursive, yet that is the natural solution to this problem. One way or another, you will need to perform a search to solve this problem. If recursion is out, you will need to backtrack manually. Pick the largest currency value below the target value. If it's match,...
I like an old version of [feedreader][1] for that kind of use, where the icon in the system tray started spinning when new stuff came in (the new version goes from grey to yellow instead). it's also possible to be alerted for each new message. [1]: http://www.feedreader.com/
No, if you want to build good and maintainable software, and to achieve loose coupling.
That's a problem that can be solved by an approach known as dynamic programming. The lecture notes I have are too focused on bioinformatics, unfortunately, so you'll have to google for it yourself.
Error handling in BASH
|bash|error-handling|error-logging|
What is your favorite method to handle errors in BASH? The best example of handling errors in BASH I have found on the web was written by William Shotts, Jr at <http://www.linuxcommand.org>. William Shotts, Jr suggests using the following function for error handling in BASH: #!/bin/bash # A slic...
Try using a Socket for your client instead of the TcpClient Class. Then you can use Socket.Bind to target your local network adapter int port = 1234; IPHostEntry entry = Dns.GetHostEntry(Dns.GetHostName()); //find ip address for your adapter here IPAddress localAddres...
Make it a `<p>` with `text-align: justify` ?
Make it a `<p>` with `text-align: justify` ? **Update**: Nevermind. That doesn't work at all as I'd thought.
Make it a `<p>` with `text-align: justify` ? **Update**: Nevermind. That doesn't work at all as I'd thought. **Update 2**: Doesn't work in any browsers other than IE right now, but CSS3 has support for this in the form of [`text-align-last`][1] [1]: http://www.w3.org/TR/css3-text/#text-align-last
The RFC for [HTTP 1.1][1] says the proper method is to add an HTTP Header for: Cache-Control: no-cache Older browsers may ignore this if they are not properly compliant to HTTP 1.1. For those you can try the header: Pragma: no-cache This is also supposed to work for HTTP 1.1 browsers. [1]: http://www.w...
LINQ and Database Permissions
|linq-to-sql|permissions|
I'm still trying to get my head around LINQ and accessing a SQL Database. I was always taught that you should only have execute permissions of stored procedures to your data. You should never have select / insert / update / delete. (This is because of performance and security) To get the data out of LINQ yo...
Try this (provided you only need the latest *price*, not the identifier or datetime of that price) SELECT ThingID, (SELECT TOP 1 Price FROM Thing WHERE ThingID = T.ThingID ORDER BY PriceDateTime DESC) Price FROM Thing T WHERE ThingID IN (1,2,3,4) AND PriceDate >= DATEADD(D, 0, DATEDIFF(D, 0, GETDATE())...
Try this (provided you only need the latest *price*, not the identifier or datetime of that price) SELECT ThingID, (SELECT TOP 1 Price FROM Thing WHERE ThingID = T.ThingID ORDER BY PriceDateTime DESC) Price FROM Thing T WHERE ThingID IN (1,2,3,4) AND DATEDIFF(D, PriceDateTime, GETDATE()) = 0 GROUP...
I've seen some problems in VS2005 with this. They were mostly due to problems with construction of the forms-objects in the designer. There were issues with code that tried to access the database from the form-constructors etc. You can debug issues like this by starting a second instance of visual studio and loading...
dlamblin,let me see if I get this correctly: You want to make a prefix-based query, and then sort the results by population, and maybe combine the sort order with preference for exact matches. I suggest you separate the search from the sort and use a CustomSorter for the sorting: Here's [a blog entry describing a cus...
There's lots of useful information here: <http://www.flounder.com/mvp_tips.htm>
I use jQuery's <a href="http://docs.jquery.com/Attributes/html">.html()</a> to get a consistent result across browsers.
Redirecting users from edit page back to calling page
|asp.net|
I am working on a project management web application. The user has a variety of ways to display a list of tasks. When viewing a list page, they click on task and are redirected to the task edit page. Since they are coming from a variety of ways, I am just curious as to the **best** way to **redirect** the user b...
I am working on a project management web application. The user has a variety of ways to display a list of tasks. When viewing a list page, they click on task and are redirected to the task edit page. Since they are coming from a variety of ways, I am just curious as to the **best** way to **redirect** the user b...
|asp.net|http-redirect|
Currently I use [Object::InsideOut][1] whenever I want objects, its quite nice and will give you a lot of features over standard blessed hash objects. Having said that, if I was starting a new project I would seriously look at Moose. While it is good to read the official PERL documentation, I would **NOT** recommend...
Have you considered using a UI functional testing tool? You could check out [HP's QuickTest Professional][1] which covers a wide varieties of UI technologies. [1]: https://h10078.www1.hp.com/cda/hpms/display/main/hpms_content.jsp?zn=bto&cp=1-11-127-24^1352_4000_100__
I agree with "rmbarnes.myopenid.com" regarding this issue as being platform independent. I would store the calling page URL in the QueryString or in a hidden field (for example in ViewState for ASP.NET). If you will store it outside of the page scope (such as Session, global variable - Application State and so on) ...
If you want to get at the key (read: index) then you'd have to use a for loop. If you actually want to have a collection that holds keys/values then I'd consider using a HashTable or a Dictionary (if you want to use Generics). Dictionary<int, string> items = new Dictionary<int, string>(); foreach (in...
Without knowing your application, I can't offer specific advice. That said, it's common in these sorts of systems to have a level of severity. You could have a query string parameter that you tack on to the end of the URL that specifies the severity. If set to "DEBUG" you would see every event, no matter how trivia...
Actually you should use classic for (;;) loop if you want to loop through an array. But the similar functionality that you have achieved with your PHP code can be achieved in C# like this with a Dictionary: Dictionary<int, int> values = new Dictionary<int, int>(); values[0] = 5; values[1] = 14; va...
Some parsing may be required, and it's not 100% complete, but you can use [wikipedia](http://en.wikipedia.org/wiki/List_of_holidays_by_country).
Also, you can use: $.ajax({ url:"/url/file/", dataType:"json" data:{ 'id' : object.id } error:function(request){alert(request.statusText)} success:successFunction })
You can use: $.ajax({ url:"/url/file/", dataType:"json" data:{ 'id' : object.id } error:function(request){alert(request.statusText)} success:successFunction })
You are wasting your time going down that path. If you have code that you don't want anyone to see, you need to keep it behind closed doors. For example, only execute that code on your own server using a web service interface. Obfuscating your code only deters the most casual of people. As the video game industry le...
If you are on Windows version that supports .Net 2.0, I would replace your shell. [PowerShell][1] gives you the full power of .Net from the command line. There are many commandlets built in as well. The example below will solve your question. I'm using the full names of the commands, there are shorter aliases, but ...
[oXygen][1] has good XML diff (and merge) support. [1]: http://www.oxygenxml.com/xml_diff_and_merge.html
You say you've tried double buffering, but then you say drawing to an Image first and blitting that. Have you tried setting DoubleBuffered = true in the constructor rather than doing it yourself with an Image?
If you are building a system with notifications that must not be missed, then a pub-sub mechanism (using XMPP, one of the other protocols supported by ApacheMQ, or something similar) will be more suitable that a syndication mechanism. You need some measure of coupling between the system that is generating the notificat...
Fetching all may be expensive. Try lazy init, fetch only request data and then store it in the cache variable.
Read this line and do what it says.
Read this line, and do what it says **twice**.
Have you tried adding the following code in your CSS file? li { background-image: URL('custom.png'); background-repeat: no-repeat; background-position: center; }
A while back I was working on a project with Microsoft when we had a visit from someone on the Microsoft .net CLR product team. This person coded examples and when he defined his variables he used “Int32” vs. “int” and “String” vs. “string”. I had remembered seeing this style in other example code from Microsoft. So...
Find the directory for the version of .Net you want, for example; C:\Windows\Microsoft.NET\Framework\v2.0.50727 Get a cmd prompt there and then run aspnet_regiis -i. Further info @ http://weblogs.asp.net/owscott/archive/2006/05/30/ASPNet_5F00_regiis.exe-tool_2C00_-setting-the-default-version-without-forcing-an-upgra...
Pretty much any shell: sh $0 (5 characters, only works if run from file)
None, I suppose. You've rejected the compiler's work in favor of your own. You might as well throw out the function you wrote in the compiled language, because now all you have is your assembler in that platform. I would highly advise against engaging in this kind of optimization because unless you're sure, via pr...
|svn|version-control|project-management|ignore|
Start off simple, and work your way from there. Since this is your first experience working with this, use a word document with bullet points. Write it, re-read it and provide enough detail that it makes sense. For technical specifications, you may want to lead the developer toward a solution, but for functional spe...
Do you know of a good program for editing/translating resource (.rc) files?
|c++|mfc|
I'm building a C++/MFC program in a multilingual environment. I have one main (national) language and three international languages. Every time I add a feature to the program I have to keep the international languages up-to-date with the national one. The resource editor in Visual Studio is not very helpful because I f...
|c++|windows|visual-studio|mfc|internationalization|
If you're using C# 3.0 (.NET 3.5) then you can use collection initializers. They're not quite as terse as in Ruby but still an improvement. This example is based on the [MSDN Example][1] var students = new Dictionary<int, StudentName>() { { 111, new StudentName {FirstName="Sachin", LastName="Kar...
I would suggest to have a look at the Roberston's Volere template [here][1]. They are part of the Atlantic Systmes Guild, together with people like Tom DeMAarco and Timothy Lister of "Peopleware" fame. [1]: http://systemsguild.com/GuildSite/Robs/Template.html
Switching form VSS to CVS: what features are lost in Visual Studio?
|visual-studio|cvs|visual-sourcesafe|
My company using VSS and Visual Studio 2005 (soon 2008). They want to switch to CVS but the developers don't want to loose the integration we get with VSS and Visual Studio. I know there are CVS plug ins but what functional, if any, is lost with CVS?
IQuery NHibernate - does it HAVE to be a list?
|c#|.net|nhibernate|
Can I return it as an object if I'm doing a Select OneItem from Table Where OtherItem = "blah"? Is there a better way to do this? I'm building a constructor to return an object based on its name rather than its ID
you could write a small webapp that hooks up to the Weblogic JMX and displays the list of deployed webapps and deploy that one at '/'
The SQL script was originally created on a Windows OS. The '^M' characters are a result of Windows and Unix having different ideas about what to use for an end-of-line character. You can use perl at the command line to fix this. perl -pie 's/\r//g' filename.txt
Why aren't my breakpoints working in Xcode?
|mac|xcode|breakpoints|
I have breakpoints set but Xcode appears to ignore them.
The only possible answer is: make a prototype and measure for yourself. If my experience is of any interest, Java and C# were always much slower than C++ for the kind of work I was doing - I believe mostly because of the high memory consumption. Of course, you can come to a completely different conclusion.
In vi, do a :%s/^M//g To get the ^M hold the control key, press V then M (Both while holding the control key) and the ^M will appear. This will find all occurances and replace them with nothing.
I usually wrap it in a call to [array_filter][1], e.g. var_dump(array_filter(explode('/', '1/2//3/')) => array(3) { [0]=> string(1) "1" [1]=> string(1) "2" [3]=> string(1) "3" } Be aware, of course, that array keys are maintained; if you *don't* want th...
I usually wrap it in a call to [array_filter][1], e.g. var_dump(array_filter(explode('/', '1/2//3/')) => array(3) { [0]=> string(1) "1" [1]=> string(1) "2" [3]=> string(1) "3" } Be aware, of course, that array keys are maintained; if you *don't* want th...
Go to the Xcode Debugging preferences. Make sure that "Load Symbols lazily" is NOT selected.
cout << "Player" << i ;
cout << text << i;
cout << text << i; (The << operator for ostream returns a reference to the ostream, so you can just keep chaining the << operations. That is, the above is basically the same as: cout << text; cout << i; )
The cause is the difference between how a Windows-based based OS and a Unix based OS store the end-of-line markers. Windows based operating systems, thanks to their DOS heritage, store an end-of-line as a pair of characters - 0x0A0D. Unix based operating systems just use 0x0A. The ^M you're seeing is a visual repres...