Search Results

Search found 20869 results on 835 pages for 'things i hate'.

Page 107/835 | < Previous Page | 103 104 105 106 107 108 109 110 111 112 113 114  | Next Page >

  • More Fun with C# Iterators and Generators

    - by James Michael Hare
    In my last post, I talked quite a bit about iterators and how they can be really powerful tools for filtering a list of items down to a subset of items.  This had both pros and cons over returning a full collection, which, in summary, were:   Pros: If traversal is only partial, does not have to visit rest of collection. If evaluation method is costly, only incurs that cost on elements visited. Adds little to no garbage collection pressure.    Cons: Very slight performance impact if you know caller will always consume all items in collection. And as we saw in the last post, that con for the cost was very, very small and only really became evident on very tight loops consuming very large lists completely.    One of the key items to note, though, is the garbage!  In the traditional (return a new collection) method, if you have a 1,000,000 element collection, and wish to transform or filter it in some way, you have to allocate space for that copy of the collection.  That is, say you have a collection of 1,000,000 items and you want to double every item in the collection.  Well, that means you have to allocate a collection to hold those 1,000,000 items to return, which is a lot especially if you are just going to use it once and toss it.   Iterators, though, don't have this problem.  Each time you visit the node, it would return the doubled value of the node (in this example) and not allocate a second collection of 1,000,000 doubled items.  Do you see the distinction?  In both cases, we're consuming 1,000,000 items.  But in one case we pass back each doubled item which is just an int (for example's sake) on the stack and in the other case, we allocate a list containing 1,000,000 items which then must be garbage collected.   So iterators in C# are pretty cool, eh?  Well, here's one more thing a C# iterator can do that a traditional "return a new collection" transformation can't!   It can return **unbounded** collections!   I know, I know, that smells a lot like an infinite loop, eh?  Yes and no.  Basically, you're relying on the caller to put the bounds on the list, and as long as the caller doesn't you keep going.  Consider this example:   public static class Fibonacci {     // returns the infinite fibonacci sequence     public static IEnumerable<int> Sequence()     {         int iteration = 0;         int first = 1;         int second = 1;         int current = 0;         while (true)         {             if (iteration++ < 2)             {                 current = 1;             }             else             {                 current = first + second;                 second = first;                 first = current;             }             yield return current;         }     } }   Whoa, you say!  Yes, that's an infinite loop!  What the heck is going on there?  Yes, that was intentional.  Would it be better to have a fibonacci sequence that returns only a specific number of items?  Perhaps, but that wouldn't give you the power to defer the execution to the caller.   The beauty of this function is it is as infinite as the sequence itself!  The fibonacci sequence is unbounded, and so is this method.  It will continue to return fibonacci numbers for as long as you ask for them.  Now that's not something you can do with a traditional method that would return a collection of ints representing each number.  In that case you would eventually run out of memory as you got to higher and higher numbers.  This method, though, never runs out of memory.   Now, that said, you do have to know when you use it that it is an infinite collection and bound it appropriately.  Fortunately, Linq provides a lot of these extension methods for you!   Let's say you only want the first 10 fibonacci numbers:       foreach(var fib in Fibonacci.Sequence().Take(10))     {         Console.WriteLine(fib);     }   Or let's say you only want the fibonacci numbers that are less than 100:       foreach(var fib in Fibonacci.Sequence().TakeWhile(f => f < 100))     {         Console.WriteLine(fib);     }   So, you see, one of the nice things about iterators is their power to work with virtually any size (even infinite) collections without adding the garbage collection overhead of making new collections.    You can also do fun things like this to make a more "fluent" interface for for loops:   // A set of integer generator extension methods public static class IntExtensions {     // Begins counting to inifity, use To() to range this.     public static IEnumerable<int> Every(this int start)     {         // deliberately avoiding condition because keeps going         // to infinity for as long as values are pulled.         for (var i = start; ; ++i)         {             yield return i;         }     }     // Begins counting to infinity by the given step value, use To() to     public static IEnumerable<int> Every(this int start, int byEvery)     {         // deliberately avoiding condition because keeps going         // to infinity for as long as values are pulled.         for (var i = start; ; i += byEvery)         {             yield return i;         }     }     // Begins counting to inifity, use To() to range this.     public static IEnumerable<int> To(this int start, int end)     {         for (var i = start; i <= end; ++i)         {             yield return i;         }     }     // Ranges the count by specifying the upper range of the count.     public static IEnumerable<int> To(this IEnumerable<int> collection, int end)     {         return collection.TakeWhile(item => item <= end);     } }   Note that there are two versions of each method.  One that starts with an int and one that starts with an IEnumerable<int>.  This is to allow more power in chaining from either an existing collection or from an int.  This lets you do things like:   // count from 1 to 30 foreach(var i in 1.To(30)) {     Console.WriteLine(i); }     // count from 1 to 10 by 2s foreach(var i in 0.Every(2).To(10)) {     Console.WriteLine(i); }     // or, if you want an infinite sequence counting by 5s until something inside breaks you out... foreach(var i in 0.Every(5)) {     if (someCondition)     {         break;     }     ... }     Yes, those are kinda play functions and not particularly useful, but they show some of the power of generators and extension methods to form a fluid interface.   So what do you think?  What are some of your favorite generators and iterators?

    Read the article

  • Improving Your Page Load Time - Tips and Tricks to Optimise Your Pages

    With the latest announcement that page loading times would soon be a factor in site ranking, it is now more important than ever to make sure that your website loads quickly, efficiently and doesn't hang on various problems that make not only Google but the visitor waiting for ever. By looking at a few things, you can really help to increase your page load times, keeping the engines and your visitors happy.

    Read the article

  • How do I publicize a cool bookmarklet?

    - by Malvolio
    I wrote a really cool bookmarklet and now I want to tell everyone. I have absolutely no idea where to go, is there some sort of exchange for these things? In case anyone is curious: I was tired of having to retype URLs from my desktop browser on to my phone browser, with its itsy-bitsy keyboard, so I wrote a bookmarklet that converts the current URL to a QR code, which I can scan in a few seconds. javascript:window.location="http://chart.apis.google.com/chart?chs=250x250&cht=qr&chl="+escape(window.location)

    Read the article

  • What is your favourite/ideal development environment?

    - by Nico Huysamen
    If you could describe your ideal development environment, what would it be? There are numerous things to take into consideration, including but not limited to: Hardware Software (Operating System of Choice, Paid vs. Free Software, ...) Physical Environment (lighting, open-plan, location, ...) An endless supply of coffee... ... In other words, if you could tell your company what they could do to make your development experience there better, what would it be?

    Read the article

  • Guaranteed Ways to Improve Page Ranking

    Getting ranked highly by Google for web pages is every Internet marketer's dream. There are things you can do to improve page ranking in the eyes of Google and other search engines. If your goal is to generate more traffic from search engines you will be interested in how you can improve the rank of your pages in this article.

    Read the article

  • Have You Heard About Project Lucy?

    - by KKline
    Lucy, You Got Some 'Splainin to Do!' Quest Software's latest community initiative, Windows Azure-based Project Lucy, has debuted! Project Lucy is part infrastructure analytics, part social media experiment, and part performance data warehouse. The best things about Project Lucy include: It’s Free - just like our SQLServerPedia website, Project Lucy is free to anyone who wants to upload a trace file It’s 1oo% web-based - you don’t have to download or maintain anything and updates roll out seamlessly,...(read more)

    Read the article

  • A new blog is born

    - by robertphyatt
    Hello! I have decided to start a blog of my adventures learning how to solve problems coding things with the intent that what I put out there might be of some use to some down-trodden developer out there that is trying to solve a problem that I have already figured out.

    Read the article

  • Understanding and Benefiting from Code Contracts in .NET 4.0

    One of the fundamental programming challenges is managing state. Chances are you have written dozens and dozens of methods that at the beginning check that certain conditions are met, and that another set of conditions is met when the method returns. With Code Contracts in .NET 4.0, you can make things considerably easier. Read on to learn how.

    Read the article

  • Do game studios hire people based on their math knowledge alone?

    - by Brent Horvath
    I have very little programming skills outside of very basic levels of Java, but I have excellent math and science knowledge. I was wondering what I could offer any potential team if I were to go into video game development? Do people hire people based on their math knowledge alone? I like to do other things such as writing or drawing, but math and science are the only skills in which I really excel in.

    Read the article

  • Back from the OData Roadshow

    - by Fabrice Marguerie
    I'm just back from the OData Roadshow with Douglas Purdy and Jonathan Carter. Paris was the last location of seven cities around the world.If there was something you wanted to know about OData, that was the place to be!These guys gave a great tour around OData. I learned things I didn't know about OData and I was able to give a demo of Sesame to the audience.More ideas and use cases popping-up!

    Read the article

  • Ubuntu - Install Mate Desktop - Themes missing?

    - by wegsehen
    I just installed Mate on top of Ubuntu by the following commands: sudo add-apt-repository "deb http://packages.mate-desktop.org/repo/ubuntu oneiric main" sudo apt-get update sudo apt-get install mate-archive-keyring sudo apt-get update sudo apt-get install mate-core sudo apt-get install mate-desktop-environment Which caused no problems, but many things (window theme, Mint menu, ...) are missing. It looks like: But it should look like: How can I install the missing packages?

    Read the article

  • SEO Meta Keywords - How to Learn SEO

    Every Internet business and Internet marketer has Search Engine Results Pages (also known as SERP or SERPS) constantly on their minds - they are one of the most important things to think about. Read to get started learning some of the basics to drive that free traffic to your websites.

    Read the article

  • 15 Stylish Navigation Menus For Inspiration

    - by Jyoti
    A site’s navigation menu is one of the most prominent things that users see when they first visit. There are many ways to design a navigation menu  and since almost all websites have some form of navigation designers have to push their creative limits to build one that’s remarkable and outstanding. In this article, you’ll find a showcase of beautiful, creative, and stylish navigation menus for your inspiration. Tennessee Vacation: Alpine Meadows: White House: The Hole In Our Gospel: Navigant Consulting: The Lippincott: Torrance Web Design: Viget Extend: David Hellmann: Candes: Brad Colbow: Cheesetique : Satsu Design: Blue Moon: Africa Oasis Project

    Read the article

  • Looking for Application Framework Features Lists, Comparisons and Guides [closed]

    - by Blah McBlah
    I am looking for lists of the things that application frameworks can do and for websites that have matrices, marketing content, blog articles and whatnot for comparing application frameworks to each other or just selling a framework. I'm talking generally, so regardless of coded language or operating system or client device. I want it all. I've found a few online, and would appreciate whatever sources I can glean from this site too.

    Read the article

  • eFX on NetBeans Platform at Silicon Valley JavaFX User Group

    - by Geertjan
    Below you can watch (in addition to seeing Steve Chin and Ben Evans) Sven Reimers presenting eFX, a JavaFX application framework on the NetBeans Platform, yesterday at the Silicon Valley JavaFX User Group. While watching, you'll learn quite a few things about the NetBeans Platform, at the same time. In the end, you see a VisualVM clone written in JavaFX on the NetBeans Platform. Sven will also talk on this topic at NetBeans Day and during his sessions at JavaOne.

    Read the article

  • This Wed, Reading - Service Broker, Indexing, Normalisation, Sets, RI and Locking, Surrogate Keys

    - by tonyrogerson
    Registration is a must so we know numbers and for security, register here: http://sqlserverfaq.com/events/213/Service-Broker-Intro-Guidance-Indexing-Selection-Usage-Fragmentation-etc-Normalisation-Surrogate-Keys-Locking-considerations.aspx Network, learn, ask a question, meet other folk, get fed - these are all things that happen at user group events. These events are a really great opportunity to socialise in an informal learning experience - if you want your own exposure then come and do a 1 -...(read more)

    Read the article

  • SEO - Which One to Choose?

    When it comes to choosing an SEO firm that will make your website appear on the top search engine result pages there are many things to consider. If you open Google and type in Charlotte SEO you will find a lot of results, but the question is which one to go for?

    Read the article

  • Revision Methodology for Developer Post as Entry Level

    - by Demla Pawan
    I had revised all basic concepts of my computer science ciriculum like: Core Java(basics),SQL(basics),C++(basics),XHTML,PHP(basics),Datastructures(basics) and what I need to do,and How to do, as their may be fault in my preparation methods for revision session's, So can Anybody suggest Methodology to revise those technical things,to which you are not in touch at present, but you can write basic programs or have used 1-2 years ago. And also can U suggest some Quick revision links on Net for various technologies mentioned above.

    Read the article

  • Do you have Standard Operating Procedures in place for SQL?

    - by Jonathan Kehayias
    The last two weeks, I have been Active Duty for the Army completing the last phase of BNCOC (Basic Non-Commissioned Officers Course) for my MOS (Military Occupational Specialty).  While attending this course a number of things stood out to me that have practical application in the civilian sector as well as in the military.  One of these is the necessity and purpose behind Standard Operating Procedures, or as we refer to them SOPs.  In the Army we have official doctrines, often in...(read more)

    Read the article

  • Running Multiple Queries in Oracle SQL Developer

    - by thatjeffsmith
    There are two methods for running queries in SQL Developer: Run Statement Run Statement, Shift+Enter, F9, or this button Run Script No grids, just script (SQL*Plus like) ouput is fine, thank you very much! What’s the Difference? There are some obvious differences between the two features, the most obvious being the format of the output delivered. But there are some other, more subtle differences here, primarily around fetching. What is Fetch? After you run send your query to Oracle, it has to do 3 things: Parse Execute Fetch Technically it has to do at least 2 things, and sometimes only 1. But, to get the data back to the user, the fetch must occur. If you have a 10 row query or a 1,000,000 row query, this can mean 1 or many fetches in groups of records. Ok, before I went on the Fetch tangent, I said there were two ways to run statements in SQL Developer: Run Statement Run statement brings your query results to a grid with a single fetch. The user sees 50, 100, 500, etc rows come back, but SQL Developer and the database know that there are more rows waiting to be retrieved. The process on the server that was used to execute the query is still hanging around too. To alleviate this, increase your fetch size to 500. Every query ran will come back with the first 500 rows, and rows will be continued to be fetched in 500 row increments. You’ll then see most of your ad hoc queries complete with a single fetch. Scroll down, or hit Ctrl+End to force a full fetch and get all your rows back. Run Script Run Script runs the contents of the worksheet (or what’s highlighted) as a ‘script.’ What does that mean exactly? Think of this as being equivalent to running this in SQL*Plus: @my_script.sql; Each statement is executed. Also, ALL rows are fetched. So once it’s finished executing, there are no open cursors left around. The more obvious difference here is that the output comes back formatted as plain old text. Run one or more commands plus SQL*Plus commands like SET and SPOOL The Trick: Run Statement Works With Multiple Statements! It says ‘run statement,’ but if you select more than one with your mouse and hit the button – it will run each and throw the results to 1 grid for each statement. If you mouse hover over the Query Result panel tab, SQL Developer will tell you the query used to populate that grid. This will work regardless of what you have this preference set to: DATABASE – WORKSHEET – SHOW QUERY RESULTS IN NEW TABS Mind the fetch though! Close those cursors by bring back all the records or closing the grids when you’re done with them.

    Read the article

  • It's called College.

    - by jeffreyabecker
    Today I saw yet another 'GUID vs int as your primary key' article. Like most of the ones I've read this was filled with technical misrepresentations and out-right fallices. Chef's famous line that "There's a time and a place for everything children" applies here. GUIDs have distinct advantages and disadvantages which should be considered when choosing a data type for the primary key. Fallacy 1: "Its easier" An integer data type(tinyint, smallint, int, bigint) is a better artifical key than a GUID because its easier to remember. I'm a firm believer that your artifical primary keys should be opaque gibberish. PK's are an implementation detail which should never be exposed to the user or relied on for business logic. If you want things to come back in an order, add and ORDER BY clause and SortOrder fields. If you want a human-usable look-up add a business key with a unique constraint. If you want to know what order things were inserted into a table add a timestamp. Fallacy 2: "Size Matters" For many applications, the size of the artifical primary key is going to be irrelevant. The particular article which kicked this post off stated repeatedly that joining against an int has better performance than joining against a GUID. In computer science the performance of your algorithm is always a function of the number of data points. This still holds true for databases. Unless your table is very large, the performance difference between an int and a guid probably isnt going to be mesurable let alone noticeable. My personal experience is that the performance becomes an issue when you start having billions of rows in the table. At this point, you should probably start looking to move from int to bigint so the effective space/performance gain isnt as much as you'd think. GUID Advantages: Insert-ability / Mergeability: You can reliably insert guids into tables without key collisions. Database Independence: Saving entities to the database often requires knowing ids. With identity based ids the id must be selected back after every insert. GUIDs can be generated application-side allowing much faster inserts. GUID Disadvantages: Generatability: You can calculate the next id for an integer pk pretty easily in your head but will need a program to generate GUIDs. Solution: "Select top 100 newid() from sysobjects" Fragmentation: most GUID generation algorithms generate pseudo random GUIDs. This can cause inserts into the middle of your clustered index. Solutions: add a default of newsequentialid() or use GuidComb in NHibernate.

    Read the article

  • What are the basic features of an email module in a common web application?

    - by Coral Doe
    When developing an email module, what are the features to have in mind, besides actual email sending? I am talking about an email module that notifies users of events and periodically sends reports. The only other feature I have in mind is maintaining grey/black lists for users that do illegal operations in the system or any other things that may lead to email/domain/IP banning. Is there an etiquette for developing email modules? Are there some references of requirements for such modules?

    Read the article

  • Book Review (Book 11) - Applied Architecture Patterns on the Microsoft Platform

    - by BuckWoody
    This is a continuation of the books I challenged myself to read to help my career - one a month, for year. You can read my first book review here, and the entire list is here. The book I chose for April 2012 was: Applied Architecture Patterns on the Microsoft Platform. I was traveling at the end of last month so I’m a bit late posting this review here. Why I chose this book: I actually know a few of the authors on this book, so when they told me about it I wanted to check it out. The premise of the book is exactly as it states in the title - to learn how to solve a problem using products from Microsoft. What I learned: I liked the book - a lot. They've arranged the content in a "Solution Decision Framework", that presents a few elements to help you identify a need and then propose alternate solutions to solve them, and then the rationale for the choice. But the payoff is that the authors then walk through the solution they implement and what they ran into doing it. I really liked this approach. It's not a huge book, but one I've referred to again since I've read it. It's fairly comprehensive, and includes server-oriented products, not things like Microsoft Office or other client-side tools. In fact, I would LOVE to have a work like this for Open Source and other vendors as well - would make for a great library for a Systems Architect. This one is unashamedly aimed at the Microsoft products, and even if I didn't work here, I'd be fine with that. As I said, it would be interesting to see some books on other platforms like this, but I haven't run across something that presents other systems in quite this way. And that brings up an interesting point - This book is aimed at folks who create solutions within an organization. It's not aimed at Administrators, DBA's, Developers or the like, although I think all of those audiences could benefit from reading it. The solutions are made up, and not to a huge level of depth - nor should they be. It's a great exercise in thinking these kinds of things through in a structured way. The information is a bit dated, especially for Windows and SQL Azure. While the general concepts hold, the cloud platform from Microsoft is evolving so quickly that any printed book finds it hard to keep up with the improvements. I do have one quibble with the text - the chapters are a bit uneven. This is always a danger with multiple authors, but it shows up in a couple of chapters. I winced at one of the chapters that tried to take a more conversational, humorous style. This kind of academic work doesn't lend itself to that style. I recommend you get the book - and use it. I hope they keep it updated - I'll be a frequent customer. :)  

    Read the article

< Previous Page | 103 104 105 106 107 108 109 110 111 112 113 114  | Next Page >