instruction
stringlengths
0
30k
|hadoop|hbase|hive|
I'm interested in finding out how the recently-released (http://mirror.facebook.com/facebook/hive/hadoop-0.17/) Hive compares to HBase in terms of performance. The SQL-like interface used by Hive is very much preferable to the HBase API we have implemented.
> is it good system architecture if you > let connect 1000 desktops directly to > database? No it's obviously not, it's maybe a poor example but I think the point I was trying to make is clear, your DBA looks after your database infrastructure this is were their expertise is, stuffing SQL in code locks the door to them and their expertise.
I realise that this doesn't apply to the asker but it it is relevent to the question. Any <b>student developers</b> out there try [Microsfts Dream Spark scheme][1]. Visual Studio, Expression Studio, XNA and Server 2003 for free! Office is also available to students for less than 60 bucks in [Microsfts `Ultimate Steal'][2] [1]: https://downloads.channel8.msdn.com/ [2]: http://www.microsoft.com/student/discounts/theultimatesteal-us/default.aspx
Use a single formatted text column[1] for storing the tags and use a capable full text search engine to index this. Else you will run into scaling problems when trying to implement boolean queries. If you need details about the tags you have, you can either keep track of it in a incrementally maintained table or run a batch job to extract the information. [1] Some RDBMS even provide a native array type which might be even better suited for storage by not needing a parsing step, but might cause problems with the full text search.
I would recommend two resources for the data structures you mention: First, there is the .NET Framework Source Code (information can be found on ScottGu's blog [here][1]). Another useful resource is the Wintellect's Power Collections found on Codeplex [here][2]. Hope this helps! [1]: http://weblogs.asp.net/scottgu/archive/2008/01/16/net-framework-library-source-code-now-available.aspx [2]: http://www.codeplex.com/PowerCollections
Take a close look at catched exception. Was it FaultException< FooFault> or FaultException ? There are 2 version of FaultException class: [generic][1] and [non-generic][2] [1]: http://msdn.microsoft.com/en-us/library/ms576199.aspx [2]: http://msdn.microsoft.com/en-us/library/ms576199.aspx
Take a closer look at catched exception. Was it FaultException< FooFault> or FaultException ? There are 2 version of FaultException class: [generic][1] and [non-generic][2] [1]: http://msdn.microsoft.com/en-us/library/ms576199.aspx [2]: http://msdn.microsoft.com/en-us/library/ms576199.aspx
you can't rely on object being garbage collected in C# (i assume you're using c#, based on tagging) if it holds resources like being bound to the network resource like in your example, or holding some other kind of stream, a file stream would be a common example. you have to assure to release the resources that the object is holding, so that it can be garbage collected. otherwise it won't be garbage collected, but remain living somewhere in the memory. your pseudocode example doesn't provide that you're doing the resources releasing, you just state that the object gets (should get) garbage collected.
Is tagging organizationally superior to discrete subforums?
|tags|
I am interested in choosing a good structure for an online message board-type application. I will use SO as an example, as I think it's an example that we are all familiar with, but my question is more general; it is about how to achieve the right balance between organization and flexibility in online message boards. The questions page is a load of random stuff. It moves quickly (some might say, too quickly) and contains a huge number of questions that I'm not interested in. The idea, I imagine, is that we can use tags to find questions that we're interested in. However, I'm not sure that this works: you can't use tags negatively. I'm _not_ interested in PHP or perl or web development. I want to _exclude_ such posts. But with the tags, I can't. Although discrete subforums are in a sense less flexible, as they generally force you to pick a category even if a question might fit into two (if SO had, say, areas for "Web Development", "Games development", "Computer Science", "Systems Programming", "Databases", etc. then sure, some people might want to post about developing of web-based games, for example) is it worth sacrificing some of that flexibility in order to make it easier to find the content that you are interested in, and hide the content that you are not interested in? Is there any way with a pure tagging system to achieve the greater ease of use that subforums provide?
|templates|wordpress|
I am looking at using a custom template for a set of categories. Is it possible to use a category template (like category-4.php) on a parent category and have the children use that template as well? So based on the answer so far, is there a way to accomplish this? I want to add text and images to all categories within a parent category.
Well, following that idea I created a dummy function with the postbackreference, and it works... it still is weird though, because of it rendering correctly the first time this.Page.RegisterClientScriptBlock("DUMMY", "<script language='javascript'>function dummy() { " + this.Page.GetPostBackEventReference(this) + "; } </script>");
The finally block is in the same scope as the try/catch, so you will have access to all the variables defined inside. Imagine you have a file handler, this is the difference in how it would be written. try { StreamReader stream = new StreamReader("foo.bar"); stream.write("foo"); } catch(Exception e) { } // ignore for now finally { stream.close(); } compared to StreamReader stream = null; try { stream = new StreamReader("foo.bar"); stream.write("foo"); } catch(Exception e) {} // ignore if (stream != null) stream.close(); Remember though that anything inside finally isn't guaranteed to run. Imagine that you get an abort signal, windows crashes or the power is gone. Relying on finally for business critical code is bad.
The filesystem backend is only worth looking at if you're not going to use a database for any other part of your system. If you are using a database then the filesystem backend has nothing to recommend it. The memcache backend is much quicker than the database backend, but you run the risk of a session being purged and some of your session data being lost. If you're a really, really high traffic website and code carefully so you can cope with losing a session then use memcache. If you're not using a database use the file system cache, but the default database backend is the best, safest and simplest option in almost all cases.
Java web applications support internationalization using the java standard tag library. You've really got 2 problems. Static content and dynamic content. for static content you can use [jstl][1]. It uses java [ResourceBundle][2]s to accomplish this. I managed to get a [Databased backed bundle][3] working with the help of this site. The second problem is dynamic content. To solve this problem you'll need to store the data so that you can retrieve different translations based on the user's Locale. (Locale includes Country and Language). It's not trivial, but it is something you can do with a little planning up front. [1]: http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JSTL6.html [2]: http://java.sun.com/j2se/1.4.2/docs/api/java/util/ResourceBundle.html [3]: http://stackoverflow.com/questions/19295/database-backed-i18n-for-java-web-app
Found it and [blogged about it][1]. Basically, the EndRequestHandler and the args.set_errorHandled are our friends here. <script type="text/javascript" language="javascript"> var prm = Sys.WebForms.PageRequestManager.getInstance(); prm.add_endRequest(EndRequestHandler); function EndRequestHandler(sender, args) { if (args.get_error() != undefined) { var errorMessage; if (args.get_response().get_statusCode() == '200') { errorMessage = args.get_error().message; } else { // Error occurred somewhere other than the server page. errorMessage = 'An unspecified error occurred. '; } args.set_errorHandled(true); $get('<%= this.newsletterLabel.ClientID %>').innerHTML = errorMessage; } } </script> [1]: http://www.stum.de/2008/09/08/gracefully-handling-httprequestvalidationexception-with-aspnet-ajax/
Good way to use table alias in Update statement?
|sql-server|
Using SqlServer, and trying to update rows from within the same table. I want to use a table alias for readability. This is the way I am doing it at the moment: <code><br /> UPDATE ra <br /> SET ra.ItemValue = rb.ItemValue<br /> FROM dbo.Rates ra, dbo.Rates rb<br /> WHERE ra.ResourceID = rb.ResourceID<br /> AND ra.PriceSched = 't8'<br /> AND rb.PriceSched = 't9' </code> Are there easier / better ways?
Use threads in python if the individual workers are doing I/O bound operations. If you are trying to scale across multiple cores on a machine either find a good [IPC](http://www.python.org/dev/peps/pep-0371/) framework for python or pick a different language.
Those differences are not really important according to the XHTML standard. In other words, they are exactly the same thing. Also, if you replace double quotes with single quotes would be the same. The typical way of 'normalizing' an xml document is to pare it using some API that treats the document as its Infoset representation. Both DOM and SAX style APIs work that way. If you want to parse them by hand you have to replicate all those things in your code and, in my opinion, that's not practical.
Those differences are not really important according to the XHTML standard. In other words, they are exactly the same thing. Also, if you replace double quotes with single quotes would be the same. The typical way of 'normalizing' an xml document is to pare it using some API that treats the document as its Infoset representation. Both DOM and SAX style APIs work that way. If you want to parse them by hand (or with a RegEx) you have to replicate all those things in your code and, in my opinion, that's not practical.
If there aren't too many properties in the bean, you might just create a new instance and set all of its properties manually from the persisted bean. This could be implemented as a copy constructor, for example: public Thing(Thing oldBean) { this.setPropertyOne(oldBean.getPropertyOne()); // and so on } Then: Thing newBean = new Thing(oldBean);
Any thoughts on DevExpress XPO ORM Package?
|c#|windows|orm|devexpress|
[XPO](http://www.devexpress.com/Products/NET/ORM/) is the object relational mapper of choice at my company. Any thoughts on the pros and cons?
You could just create all the certs using openssl.. This is a great guide if you want to do just that. <http://riseuplabs.org/grimoire/web-server/self-signed-certs/> Alternatively I have at my site, created a shell scripts that is basicly goes through the steps described in the tutorial. Saves you the trouble of going through each of the steps. <http://thetechmind.com/articles/a-shell-script-for-creating-a-selfsigned-cert>
Best way to fetch an "unstandard" HTML tag
Maybe I'm not understanding the complexity of what you're asking but... shouldn't this do? SELECT groupname, SUM(value) FROM items WHERE groupname IN ('a', 'b') GROUP BY groupname And if you don't care which of a or b the item belongs to then this will do: SELECT SUM(value) FROM items WHERE groupname IN ('a', 'b')
You want something like SELECT column,SUM( column ) FROM table GROUP BY column
I think the problem is that you're doing a scan line-based resize, which is going to lead to jaggies no matter how hard you tweak it. Good image resize quality requires you to do some more work to figure out the average color of the pre-resized pixels that your resized pixel covers. The guy who runs this website has a blog post that discusses a few image resizing algorithms. You probably want a bicubic image scaling algorithm. <a href="http://www.codinghorror.com/blog/archives/000903.html">Better Image Resizing</a>
This is a basic resize function I've used for a few of my applications that leverages GDI+ /// <summary> /// Resize image with GDI+ so that image is nice and clear with required size. /// </summary> /// <param name="SourceImage">Image to resize</param> /// <param name="NewHeight">New height to resize to.</param> /// <param name="NewWidth">New width to resize to.</param> /// <returns>Image object resized to new dimensions.</returns> /// <remarks></remarks> public static Image ImageResize(Image SourceImage, Int32 NewHeight, Int32 NewWidth) { System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(NewWidth, NewHeight, SourceImage.PixelFormat); if (bitmap.PixelFormat == Drawing.Imaging.PixelFormat.Format1bppIndexed | bitmap.PixelFormat == Drawing.Imaging.PixelFormat.Format4bppIndexed | bitmap.PixelFormat == Drawing.Imaging.PixelFormat.Format8bppIndexed | bitmap.PixelFormat == Drawing.Imaging.PixelFormat.Undefined | bitmap.PixelFormat == Drawing.Imaging.PixelFormat.DontCare | bitmap.PixelFormat == Drawing.Imaging.PixelFormat.Format16bppArgb1555 | bitmap.PixelFormat == Drawing.Imaging.PixelFormat.Format16bppGrayScale) { throw new NotSupportedException("Pixel format of the image is not supported."); } System.Drawing.Graphics graphicsImage = System.Drawing.Graphics.FromImage(bitmap); graphicsImage.SmoothingMode = Drawing.Drawing2D.SmoothingMode.HighQuality; graphicsImage.InterpolationMode = Drawing.Drawing2D.InterpolationMode.HighQualityBicubic; graphicsImage.DrawImage(SourceImage, 0, 0, bitmap.Width, bitmap.Height); graphicsImage.Dispose(); return bitmap; } I don't remember off the top of my head if it will work with GIFs, but you can give it a try. Note: I can't take full credit for this function. I pieced a few things together from some other samples online and made it work to my needs 8^D
Is that (Tyler's answer) what the question meant, or is it simply this; SELECT sum(item), groupingField FROM someTable GROUP BY groupingField or even: SELECT count(*), item FROM someTable GROUP BY item which will produce results like this: sum(item) | groupingField -------------+----------------------- 71 | A 82 | B Questioner, perhaps you could clarify which you meant or if I'm oversimplifying?
I've done something like that in the past, and it was a waste of time. For instance, you basically have to write wrappers for everything you can already with HTML and you WILL forget some things. When you need to change something in the layout you will think "Shoot, I forgot about that..now I gotta code another method or add another parameter". Ultimately, you will have a huge collection of functions/classes that generate HTML which nobody will know or remember how to use months from now. New developers will curse you for using this system, since they will have to learn it before changing anything. In contrast, more people probably know HTML than your abstract HTML drawing classes...and sometimes you just gotta get your hands dirty with pure HTML!
Untested, but should work: select * from users where points in (select distinct top 3 points from users order by points desc)
@bosnic, I don't think that will work as requested, I'm not that familiar with MS SQL but I would expect it to return only 3 rows, and ignore the fact that 3 users are tied for 3rd place. Something like this should work: select userid, points from scores where points in (select top 3 points from scores order by points desc) order by points desc
When using Hibernate filters you need to be aware that the additional restrictions will not be applied to SQL statements generted by the <code>load()</code> or <code>get()</code> methods.
It looks pretty verbose and hard to follow to be honest and some of the code looks like it is very much layout information. We always try to split the logic from the output as much as possible. However, it is often the case that the view and data are very tightly linked with both part dictating how the other should be (eg, in a simple e-commerce site, you may decide you want to start showing stock levels next to each product, which would obviously involve changing the view to add appropriate html for this, and the business logic to go and figure out a value for the stock). If the thought of maintaining 2 files to do this is too much to handle, try splitting things into a "Gather data" part and a "Display View" part, getting you most of the benefits without increasing the number of files you need to manage.
A simple version that will work for the format mentioned, but not all the others as per @Espos: (\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2})
What is the regex pattern for datetime (2008-09-01 12:35:45 ) ?
|regex|patterns|date|
Dont have any additional information. Just what is the regex pattern for datetime (2008-09-01 12:35:45 ) ?
Dont have any additional information. Just what is the regex pattern for datetime (2008-09-01 12:35:45 ) ? @Espo I get this error : No ending delimiter '^' found
|regex|date|patterns|
Dont have any additional information. Just what is the regex pattern for datetime (2008-09-01 12:35:45 ) ? @Espo : I get this error : No ending delimiter '^' found using: preg_match('(?n:^(?=\d)((?<day>31(?!(.0?[2469]|11))|30(?!.0?2)|29(?(.0?2)(?=.{3,4}(1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|(16|[2468][048]|[3579][26])00))|0?[1-9]|1\d|2[0-8])(?<sep>[/.-])(?<month>0?[1-9]|1[012])\2(?<year>(1[6-9]|[2-9]\d)\d{2})(?:(?=\x20\d)\x20|$))?(?<time>((0?[1-9]|1[012])(:[0-5]\d){0,2}(?i:\ [AP]M))|([01]\d|2[0-3])(:[0-5]\d){1,2})?$)', '2008-09-01 12:35:45'); gives this error : Warning: preg_match() [function.preg-match]: Compilation failed: nothing to repeat at offset 0 in E:\www\index.php on line 19
Any code in the finally is ran in the even in the event of an unhandled exception. Typically the finally code is used to clean up local declarations of unmanaged code using .dispose().
Pascal! Close enough syntax, still requires you to do some memory management, but not as rough for beginners.
This is my generic implementation of the comparison method (in C#): /// <summary> /// Represents a service used to compare two collections for equality. /// </summary> /// <typeparam name="T">The type of the items in the collections.</typeparam> public class CollectionComparer<T> { /// <summary> /// Compares the content of two collections for equality. /// </summary> /// <param name="foo">The first collection.</param> /// <param name="bar">The second collection.</param> /// <returns>True if both collections have the same content, false otherwise.</returns> public bool Execute(ICollection<T> foo, ICollection<T> bar) { // Declare a dictionary to count the occurence of the items in the collection Dictionary<T, int> itemCounts = new Dictionary<T,int>(); // Increase the count for each occurence of the item in the first collection foreach (T item in foo) { if (itemCounts.ContainsKey(item)) { itemCounts[item]++; } else { itemCounts[item] = 1; } } // Wrap the keys in a searchable list List<T> keys = new List<T>(itemCounts.Keys); // Decrease the count for each occurence of the item in the second collection foreach (T item in bar) { // Try to find a key for the item T key = keys.Find( delegate(T listKey) { return listKey.Equals(item); }); // Check if a key was found if(key != null) { itemCounts[key]--; } else { // There was no occurence of this item in the first collection, thus the collections are not equal return false; } } // The count of each item should be 0 if the contents of the collections are equal foreach (int value in itemCounts.Values) { if (value != 0) { return false; } } // The collections are equal return true; } }
This is my (heavily influenced by D.Jennings) generic implementation of the comparison method (in C#): /// <summary> /// Represents a service used to compare two collections for equality. /// </summary> /// <typeparam name="T">The type of the items in the collections.</typeparam> public class CollectionComparer<T> { /// <summary> /// Compares the content of two collections for equality. /// </summary> /// <param name="foo">The first collection.</param> /// <param name="bar">The second collection.</param> /// <returns>True if both collections have the same content, false otherwise.</returns> public bool Execute(ICollection<T> foo, ICollection<T> bar) { // Declare a dictionary to count the occurence of the items in the collection Dictionary<T, int> itemCounts = new Dictionary<T,int>(); // Increase the count for each occurence of the item in the first collection foreach (T item in foo) { if (itemCounts.ContainsKey(item)) { itemCounts[item]++; } else { itemCounts[item] = 1; } } // Wrap the keys in a searchable list List<T> keys = new List<T>(itemCounts.Keys); // Decrease the count for each occurence of the item in the second collection foreach (T item in bar) { // Try to find a key for the item T key = keys.Find( delegate(T listKey) { return listKey.Equals(item); }); // Check if a key was found if(key != null) { itemCounts[key]--; } else { // There was no occurence of this item in the first collection, thus the collections are not equal return false; } } // The count of each item should be 0 if the contents of the collections are equal foreach (int value in itemCounts.Values) { if (value != 0) { return false; } } // The collections are equal return true; } }
Though I think that tagging is supperior to grouping, people tend to think hierarchically. In general it depends on the target group for the forum. Maybe you can go with a mixture: use tagging and later use tag groups to order to posts. Delicious uses this, for example, and I find it rather helpful.
If you're worried about the divide between specific forums and open tag-based systems, like Stack Overflow, consider making a query system that allows you to do a bit more complex queries than just the AND operator, like here on Stack Overflow. I cannot make a query here that will give me all questions in .NET, SQL or C#, combined, and that is the biggest irritation I have with the tags. With such a query system, you can create virtual forums at least. Other than that, I don't really have a good opinion. I like both, and I haven't yet decided which one is best.
This is fairly simple if you want to embed the WMP you can use all the controls via JavaScript. There is a great MSDN section on it but I cant seem to find it now.
This is fairly simple if you want to embed the WMP you can use all the controls via JavaScript. There is a great MSDN section on it but I cant seem to find it now.<br /><br />Edit: I found [this][1] on MSDN it contains the properties that an embeded WMP will accept then all you have to do is call the methods via javascript. <OBJECT id="VIDEO" width="320" height="240" style="position:absolute; left:0;top:0;" CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" type="application/x-oleobject"> <PARAM NAME="URL" VALUE="your file or url"> <PARAM NAME="SendPlayStateChangeEvents" VALUE="True"> <PARAM NAME="AutoStart" VALUE="True"> <PARAM name="uiMode" value="none"> <PARAM name="PlayCount" value="9999"> </OBJECT> Then for the javascript <script type="javascript"> obj = document.getElementById("VIDEO"); //Where video is the id of the object above. obj.URL="filename"; //You can use this to both start and change the current file. obj.controls.stop(); //Will stop obj.controls.Pause(); //Pause </script> Somewhere around here I have code to even control the volume.<br /> A while ago I built a custom (looking) player for a client purely in HTML and JavaScript. [1]: http://msdn.microsoft.com/en-us/library/ms909930.aspx
Read and understand this [MSDN example][1]. The main point is to actually call <code>Socket.Close()</code>, which won't happen if you wait for the GC to clean up. See also [IDisposable][2], which you should implement on your ClassA to use it like this: using (ClassA a = new ClassA()) { // code goes here } // 'a' is now disposed [1]: http://msdn.microsoft.com/en-us/library/fx6588te.aspx [2]: http://msdn.microsoft.com/en-us/library/system.idisposable.aspx
The garbage collector doesn't guarantee you that the socket will ever be closed. For a complete example read this [MSDN example][1]. The main point is to actually call <code>Socket.Close()</code> as soon as possible. For example, ClassA could implement [IDisposable][2] and use it like this: using (ClassA a = new ClassA()) { // code goes here } // 'a' is now disposed and the socket is closed [1]: http://msdn.microsoft.com/en-us/library/fx6588te.aspx [2]: http://msdn.microsoft.com/en-us/library/system.idisposable.aspx
|regex|html|
I'm trying to fetch some HTML from various blogs and I've noticed that different providers use the same tag in different ways. For example, here are two major providers that use the Generator differently: Blogger: `<meta content='blogger' name='generator'/>` (content first, name later and, yes, single quotes!) Wordpress: `<meta name="generator" content="WordPress.com" />` (name first, content later) Is there a way to extract the value of content for all cases? (single/double quotes, first/last in the row) Thank you. P.S. Although I'm using Java, the answer would probably help more people if it where for Regular Expressions generally
|html|language-agnostic|regex|
And if the Scott Ambler paper whets your appetite I can recommend his book with Pramod J Sadolage called 'Refactoring Databases' - <http://www.ambysoft.com/books/refactoringDatabases.html> There is also a lot of useful advice and information at the Agile Database group at Yahoo - <http://tech.groups.yahoo.com/group/agileDatabases/>
One consideration would be whether video playback is via progressive download or streaming. If it's progressive download, then I would say use Flash because you get a wider audience reach. For streaming wmv, it is out of the box functionality provided by Windows Media Services <http://www.microsoft.com/windows/windowsmedia/forpros/server/server.aspx> For streaming flash, you will have to install a streaming server on your Windows box. Some options are: * Adobe Flash Media Server (Commercial) - <http://www.adobe.com/products/flashmediaserver/> * Wowza Media Server (Free/Commercial) - <http://www.wowzamedia.com/products.html> * Red5 Flash Server (Open Source) - <http://osflash.org/red5>
One consideration would be whether video playback is via progressive download or streaming. If it's progressive download, then I would say use Flash because you get a wider audience reach. For streaming wmv, it is out of the box functionality provided by Windows Media Services <http://www.microsoft.com/windows/windowsmedia/forpros/server/server.aspx> For streaming flash, you will have to install a streaming server on your Windows box. Some options are: * <a href="http://www.adobe.com/products/flashmediaserver">Adobe Flash Media Server</a> (Commercial) * <a href="http://www.wowzamedia.com/products.html">Wowza Media Server</a> (Free/Commercial) * <a href="http://osflash.org/red5">Red5 Flash Server</a> (Open Source)
How do I handle page flow in MVC (particularly asp.net)
|mvc|asp.net-mvc|
If you had to provide a wizard like form entry experience in mvc how would you abstract the page flow? Thanks
|asp.net|asp.net-mvc|mvc|
What do I need to do to implement an "out of proc" COM server in C#?
|c#|com|interop|
I am trying to implement an "out of proc" COM server written in C#. How do I do this?
Using Interop with C#, Excel Save changing original. How to negate this?
|c#|excel|
The problem: Loading an excel spreadsheet template. Using the Save command with a different filename and then quitting the interop object. This ends up saving the original template file. Not the result that is liked. public void saveAndExit(string filename) { excelApplication.Save(filename); excelApplication.Quit(); } Original file opened is c:\testing\template.xls The file name that is passed in is c:\testing\7777 (date).xls Does anyone have an answer?
The problem: Loading an excel spreadsheet template. Using the Save command with a different filename and then quitting the interop object. This ends up saving the original template file. Not the result that is liked. public void saveAndExit(string filename) { excelApplication.Save(filename); excelApplication.Quit(); } Original file opened is c:\testing\template.xls The file name that is passed in is c:\testing\7777 (date).xls Does anyone have an answer? (The answer I chose was the most correct and thorough though the wbk.Close() requires parameters passed to it. Thanks.)
`$item` is a hashref that looks like this: $item = { 'RunningTime' => {'content' => '90', 'Units' => 'minutes'}, 'ProductGroup' => 'DVD' }; Therefore you can get the running time like this: $RunningTime = $item->{RunningTime}->{content}
[fish][1] is a Unix shell that focuses on user-friendliness, such as by providing colored highlighting and extensive tab completion. For a different kind of blend of textual and graphical interface, there's [Quicksilver][2], as well as similar/inspired tools like Launchy, GNOME Do and ENSO. [1]: http://fishshell.org/ [2]: http://www.43folders.com/topics/quicksilver
Are you possibly depending on development versions that obviously change a lot during development? Instead of incrementing the version of development releases, you could just use a snapshot version that you overwrite when necessary, which means you wouldn't have to change the version tag on every minor change. Something like 1.0-SNAPSHOT... But maybe you are trying to achieve something else ;)
Not sure I entirely understand your question, but can't you simply build and install a 64 bit version and then create symbolic links so that /Library/Python/2.5 and below point to your freshly built version of python?
Is it possible to find code coverage in ColdFusion?
|unit-testing|coldfusion|
I am trying to be a "good" programmer and have unit tests for my ColdFusion application but haven't been able to find a code coverage tool that can tie into the test that I'm using. For those of you who do unit tests on your ColdFusion code, how have you approached this problem?
If your data can be laid out in a two-dimensional grid, use `<table>`. If it can't, don't. Using `<table>` for anything else is a hack (though frequently not one with proper alternatives, especially when it comes to compatibility with older browsers). *Not* using `<table>` *for* something that clearly should be one is equally bad. `<div>` and `<span>` aren't for everything; in fact, being completely meaningless on a semantic level, they are to be avoided at all costs in favor of more semantic alternatives.
The first thing that jumps to mind is the possibility of your git history having a nonlinear history. You might have difficulty determining a sensible sequence of commits. Having said that, it seems like you could keep a log of commit ids and the corresponding lines of code in that commit. In a post-commit hook, starting from the HEAD revision, work backwards (branching to multiple parents if necessary) until all paths reach a commit that you've already seen before. That should give you the total lines of code for each commit id. Does that help any? I have a feeling that I've misunderstood something about your question.
You have the Microsoft Empower for ISV program, see https://partner.microsoft.com/40011351 Gives you a full msdn pro subscription for two years.
set based is done in one operation cursor as many operations as the rowset of the cursor
I recall that in previous versions of VS, there was a way to add custom build steps to the build process. I used that a lot to do exactly the kind of automated code generation you describe. I imagine the custom build step feature is still there in 2008.
Set a short timeout?
Set a short timeout? Does `isOutputShutdown()` not get you what you want? You could always build a `SocketWatcher` class that spins up in its own `Thread` and repeatedly tries to write empty strings to the `Socket` until that raises a `SocketClosedException`.
If you're using C#, and can use [PostSharp](http://www.postsharp.org/), here's a simple memoization aspect for your code: [Serializable] public class MemoizeAttribute : PostSharp.Laos.OnMethodBoundaryAspect, IEqualityComparer<Object[]> { private Dictionary<Object[], Object> _Cache; public MemoizeAttribute() { _Cache = new Dictionary<object[], object>(this); } public override void OnEntry(PostSharp.Laos.MethodExecutionEventArgs eventArgs) { Object[] arguments = eventArgs.GetReadOnlyArgumentArray(); if (_Cache.ContainsKey(arguments)) { eventArgs.ReturnValue = _Cache[arguments]; eventArgs.FlowBehavior = FlowBehavior.Return; } } public override void OnExit(MethodExecutionEventArgs eventArgs) { if (eventArgs.Exception != null) return; _Cache[eventArgs.GetReadOnlyArgumentArray()] = eventArgs.ReturnValue; } #region IEqualityComparer<object[]> Members public bool Equals(object[] x, object[] y) { if (Object.ReferenceEquals(x, y)) return true; if (x == null || y == null) return false; if (x.Length != y.Length) return false; for (Int32 index = 0, len = x.Length; index < len; index++) if (Comparer.Default.Compare(x[index], y[index]) != 0) return false; return true; } public int GetHashCode(object[] obj) { Int32 hash = 23; foreach (Object o in obj) { hash *= 37; if (o != null) hash += o.GetHashCode(); } return hash; } #endregion } Here's a sample Fibonacci implementation using it: [Memoize] private Int32 Fibonacci(Int32 n) { if (n <= 1) return 1; else return Fibonacci(n - 2) + Fibonacci(n - 1); }
Can't Re-bind a socket to an existing IP/Port Combination
|networking|c#|sockets|.net|
Greetings, I'm trying to find a way to 'unbind' a socket from a particular IP/Port combination. My pseudocode looks like this: ClassA a = new ClassA(); //(class A instantiates socket and binds it to 127.0.0.1:4567) //do something //...much later, a has been garbage-collected away. ClassA aa = new ClassA(); //crash here. At this point, .Net informs me that I've already got a socket bound to 127.0.0.1:4567, which is technically true. But no matter what code I put in ClassA's destructor, or no matter what functions I call on the socket (I've tried .Close() and .Disconnect(true)), the socket remains proudly bound to 127.0.0.1:4567. What do I do to be able to 'un-bind' the socket? Any help would be appreciated!
|c#|.net|networking|sockets|
Greetings, I'm trying to find a way to 'unbind' a socket from a particular IP/Port combination. My pseudocode looks like this: ClassA a = new ClassA(); //(class A instantiates socket and binds it to 127.0.0.1:4567) //do something //...much later, a has been garbage-collected away. ClassA aa = new ClassA(); //crash here. At this point, .Net informs me that I've already got a socket bound to 127.0.0.1:4567, which is technically true. But no matter what code I put in ClassA's destructor, or no matter what functions I call on the socket (I've tried .Close() and .Disconnect(true)), the socket remains proudly bound to 127.0.0.1:4567. What do I do to be able to 'un-bind' the socket? ---- EDIT: I'm not relying solely on garbage collection (though I tried that approach as well). I tried calling a.Close() or a.Disconnect() and only then instantiating aa; this doesn't solve the problem. ---- EDIT: I've also tried implementing IDisposable, but the code never got there without my calling the method (which was the equivalent of earlier attempts, as the method would simply try .Close and .Disconnect). Let me try calling .Dispose directly and get back to you. Any help would be appreciated!
Greetings, I'm trying to find a way to 'unbind' a socket from a particular IP/Port combination. My pseudocode looks like this: ClassA a = new ClassA(); //(class A instantiates socket and binds it to 127.0.0.1:4567) //do something //...much later, a has been garbage-collected away. ClassA aa = new ClassA(); //crash here. At this point, .Net informs me that I've already got a socket bound to 127.0.0.1:4567, which is technically true. But no matter what code I put in ClassA's destructor, or no matter what functions I call on the socket (I've tried .Close() and .Disconnect(true)), the socket remains proudly bound to 127.0.0.1:4567. What do I do to be able to 'un-bind' the socket? ---- EDIT: I'm not relying solely on garbage collection (though I tried that approach as well). I tried calling a.Close() or a.Disconnect() and only then instantiating aa; this doesn't solve the problem. ---- EDIT: I've also tried implementing IDisposable, but the code never got there without my calling the method (which was the equivalent of earlier attempts, as the method would simply try .Close and .Disconnect). Let me try calling .Dispose directly and get back to you. ---- EDIT (lots of edits, apologies): Implementing IDisposable and calling a.Dispose() from where 'a' loses scope doesn't work - my Dispose implementation still has to call either .Close or .Disconnect(true) (or .Shutdown(Both)) but none of those unbind the socket. Any help would be appreciated!
This is my (heavily influenced by D.Jennings) generic implementation of the comparison method (in C#): /// <summary> /// Represents a service used to compare two collections for equality. /// </summary> /// <typeparam name="T">The type of the items in the collections.</typeparam> public class CollectionComparer<T> { /// <summary> /// Compares the content of two collections for equality. /// </summary> /// <param name="foo">The first collection.</param> /// <param name="bar">The second collection.</param> /// <returns>True if both collections have the same content, false otherwise.</returns> public bool Execute(ICollection<T> foo, ICollection<T> bar) { // Declare a dictionary to count the occurence of the items in the collection Dictionary<T, int> itemCounts = new Dictionary<T,int>(); // Increase the count for each occurence of the item in the first collection foreach (T item in foo) { if (itemCounts.ContainsKey(item)) { itemCounts[item]++; } else { itemCounts[item] = 1; } } // Wrap the keys in a searchable list List<T> keys = new List<T>(itemCounts.Keys); // Decrease the count for each occurence of the item in the second collection foreach (T item in bar) { // Try to find a key for the item // The keys of a dictionary are compared by reference, so we have to // find the original key that is equivalent to the "item" // You may want to override ".Equals" to define what it means for // two "T" objects to be equal T key = keys.Find( delegate(T listKey) { return listKey.Equals(item); }); // Check if a key was found if(key != null) { itemCounts[key]--; } else { // There was no occurence of this item in the first collection, thus the collections are not equal return false; } } // The count of each item should be 0 if the contents of the collections are equal foreach (int value in itemCounts.Values) { if (value != 0) { return false; } } // The collections are equal return true; } }
If you do not want to rewrite hadle it as an [Inter-process communication][1] and choose one of following: - Named pipes - Sockets - SOAP [1]: http://en.wikipedia.org/wiki/Inter-process_communication
How do I in Python get the path and name of the file that is currently executing?
|python|scripting|file|