Search Results

Search found 243 results on 10 pages for 'imho'.

Page 6/10 | < Previous Page | 2 3 4 5 6 7 8 9 10  | Next Page >

  • ngModel and component with isolated scope

    - by Artem Andreev
    I am creating simple ui-datetime directive. It splits javascript Date object into _date, _hours and _minutes parts. _date uses jquery ui datepicker, _hours and _minutes - number inputs. See example: http://jsfiddle.net/andreev_artem/nWsZp/3/ On github: https://github.com/andreev-artem/angular_experiments/tree/master/ui-datetime As far as I understand - best practice when you create a new component is to use isolated scope. When I tried to use isolated scope - nothing works. ngModel.$viewValue === undefined. When I tried to use new scope (my example, not so good variant imho) - ngModel uses value on newly created scope. Of course I can create directive with isolated scope and work with ngModel value through "=expression" (example). But I think that working with ngModelController is a better practice. My questions: Can I use ngModelController with isolated scope? If it is not possible which solution is better for creating such component?

    Read the article

  • Improve responsiveness of $(...).click on touch interface

    - by Bram W.
    I need access to a web-based on screen keyboard which will be used on a touch interface. This example looks nice and functional, however when I try it on an iPad, the responsiveness it very low IMHO. It's not comfortable to use and sometimes whole words are misspelled due to slow response. Is there a way to improve the experience on this type of on screen keyboard? This implementation uses the $('#id').click(...); function to process the events. Is there a better way to achieve the goal of typing on the screen? Are there better plugins out there? Note: The final application will run on different types of devices. For several reasons, native on screen keyboards are no option.

    Read the article

  • Stack trace for C++ using gcc

    - by dimba
    We use stack traces in proprietary assert like macro to catch developer mistakes - when error is caught, stack trace is printed. I find gcc's pair backtrace()/backtrace_symbols() methods insufficient: Names are mangled No line information 1st problem can be resolved by abi::__cxa_demangle. However 2nd problem s more tough. I found replacement for backtrace_symbols(). This is better than gcc's backtrace_symbols(), since it can retrieve line numbers (if compiled with -g) and you don't need to compile with -rdynamic. Hoverer the code is GNU licenced, so IMHO I can't use it in commercial code. Any proposals?

    Read the article

  • When/Why ( if ever ) should i think about doing Generic Programming/Meta Programming

    - by hotadvice
    Hi there IMHO to me OOPS, design patterns make sense and i have been able to apply them practically. But when it comes to "generic programming /meta programming" of the Modern C++ kind, i am left confused. -- Is it a new programming/design paradigm ? -- Is it just limited to "library development"? If not, What design/coding situations call for using meta programming/generic programming. -- Does using templates mean i am doing generic programming? I have googled a lot on this topic but do not grasp the BIG PICTURE fully. Also see this post. After reading dicussions here under, up till now, I am sure ( might still not be correct): a) Generic programming and meta programming are two different concepts.

    Read the article

  • PHP: friend classes and ungreedy caller function/class

    - by avetis.kazarian
    Is there any way to get the caller function with something else than debug_backtrace()? I'm looking for a less greedy way to simulate scopes like friend or internal. Let's say I have a class A and a class B. Until now, I've been using debug_backtrace(), which is too greedy (IMHO). I thought of something like this: <?php class A { public function __construct(B $callerObj) {} } class B { public function someMethod() { $obj = new A($this); } } ?> It might be OK if you want to limit it to one specific class, but let's say I have 300 classes, and I want to limit it to 25 of them? One way could be using an interface to aggregate: public function __construct(CallerInterface $callerObj) But it's still an ugly code. Moreover, you can't use that trick with static classes. Have any better idea?

    Read the article

  • How do I temporarily monkey with a global module constant?

    - by Daniel
    Greetings, I want to tinker with the global memcache object, and I found the following problems. Cache is a constant Cache is a module I only want to modify the behavior of Cache globally for a small section of code for a possible major performance gain. Since Cache is a module, I can't re-assign it, or encapsulate it. I Would Like To Do This: Deep in a controller method... code code code... old_cache = Cache Cache = MyCache.new code code code... Cache = old_cache code code code... However, since Cache is a constant I'm forbidden to change it. Threading is not an issue at the moment. :) Would it be "good manners" for me to just alias_method the special code I need just for a small section of code and then later unalias it again? That doesn't pass the smell test IMHO. Does anyone have any ideas? TIA, -daniel

    Read the article

  • Working with the Grails g:timeZoneSelect tag?

    - by tinny
    I am wanting to use the g:timeZoneSelect tag within my application, problem is im finding the resulting html select to be quite overwhelming. Over 600 options are being displayed, IMHO this is to much to display to the user. Maybe someone could point me to an example of a much more manageable list of timezones? Maybe you have seen a site that does timezone selection well? Im sure over 600 option is "technically" correct, but this will just look like noise to the user. The display value of the timezone is to long. E.g. "CST, Central Standard Time (South Australia/New South Wales) 9.5:30.0" Just "CST, Central Standard Time" or "Australia/Broken_Hill" would be better Is there a way to address these issues via tag attributes of some sort (cant find any in the docs) or config that I am unaware of? Or, is my best bet to wrap an html select within a custom tag lib and "roll my own" solution (Id prefer not to). Thanks

    Read the article

  • WiX, how to prevent files from uninstalling though we forgot to set Permanent="yes"

    - by Doc Brown
    We have a product installer created with Wix, containing a program package ("V1") and some configuration files. Now, we are going to make a major upgrade with a new product code, where the old version of the product is uninstalled and "V2" is installed. What we want is to save one of the configuration files from uninstalling, since it is needed for the V2, too. Unfortunately, we forgot to set the Permanent="yes" option when we delivered V1 (read this question for more information). Here comes the question: is there an easy way of preventing the uninstall of the file anyhow? Of course, we could add a custom action to the script to backup the file before uninstallation, and another custom action to restore it afterwards, but IMHO that seems to be overkill for this task, and might interfere with other parts of the MSI registration process.

    Read the article

  • Magento Design Patterns

    - by JonB
    Magento, IMHO, represents a PHP system that is built on well thought-out coding principles - reuseable design patterns being one of them. In terms of an example of a PHP system, I think it can be considered pretty cutting edge and therefore worth considering from an architectural point of view. As I understand it, there are many design patterns that are available to the OOP developer. Seeing such patterns being put to use in an open-source system such as Magento allows a developer to view examples of such patterns in real use and in situ, rather than in examples that can sometimes be rather achedemic, and even a little misleading. As such, I am wondering what patterns, other than the ones I have listed below, Magento programmers have used when developing for Magento. As a note, I understand that some of these patterns are in place as a consequence of being built on the Zend Framework, MVC / Front Controller being a couple of them, The obvious ones are: Factory: $product = Mage::getModel('catalog/product'); Singleton: $category = Mage::getSingleton('catalog/session'); Registry: $currentCategory = Mage::registry('current_category');

    Read the article

  • C# compile finalize method's on runtime?

    - by Royi Namir
    As im reading through 3 books about GC , ive notice some strange fact : C# via CLR CriticalFinalizerObject : the CLR treats this class and classes derived from it in a very special manner what ??? "not find enough memory to COMPILE a method? " IMHO - the code should be already compiled... no ? when Im writing c# code - the whole code is compiled to IL before its running... no? but according to the text - at RUNTIME - he MAY find insufficient memory for compile... Help ?

    Read the article

  • Padding a string in Postgresql with rpad without truncating it

    - by dmoebius
    Using Postgresql 8.4, how can I right-pad a string with blanks without truncating it when it's too long? The problem is that rpad truncates the string when it is actually longer than number of characters to pad. Example: SELECT rpad('foo', 5); ==> 'foo ' -- fine SELECT rpad('foo', 2); ==> 'fo' -- not good, I want 'foo' instead. The shortest solution I found doesn't involve rpad at all: SELECT 'foo' || repeat(' ', 5-length('foo')); ==> 'foo ' -- fine SELECT 'foo' || repeat(' ', 2-length('foo')); ==> 'foo' -- fine, too but this looks ugly IMHO. Note that I don't actually select the string 'foo' of course, instead I select from a column: SELECT colname || repeat(' ', 30-length(colname)) FROM mytable WHERE ... Is there a more elegant solution?

    Read the article

  • C#: why Base class is allowed to implement an interface contract without inheriting from it?

    - by etarassov
    I've stumbled upon this "feature" of C# - the base class that implements interface methods does not have to derive from it. Example: public interface IContract { void Func(); } // Note that Base does **not** derive from IContract public abstract class Base { public void Func() { Console.WriteLine("Base.Func"); } } // Note that Derived does *not* provide implementation for IContract public class Derived : Base, IContract { } What happens is that Derived magically picks-up a public method Base.Func and decides that it will implement IContract.Func. What is the reason behind this magic? IMHO: this "quasi-implementation" feature is very-unintuitive and make code-inspection much harder. What do you think?

    Read the article

  • How do I *really* justify a horizontal menu in HTML+CSS?

    - by flight
    You find plenty of tutorials on menu bars in HTML, but for this specific (though IMHO generic) case, I haven't found any decent solution: # THE MENU ITEMS SHOULD BE JUSTIFIED JUST AS PLAIN TEXT WOULD BE # # ^ ^ # # There's an varying number of text-only menu items and the page layout is fluid. # # The first menu item should be left-aligned, the last menu item should be right- # # aligned. The remaining items should be spread optimal on the menu bar. # # # # The number is varying,so there's no chance to pre-calculate the optimal widths. # # # # Note that a TABLE won't work here as well: # # - If you center all TDs, the first and the last item aren't aligned correctly. # # - If you left-align and right-align the first resp. the last items, the spacing # # will be sub-optimal. # Isn't it strange that there is no obvious way to implement this in a clean way by using HTML+CSS?

    Read the article

  • How to invoke static method in C#4.0 with dynamic type?

    - by Morgan Cheng
    In C#4.0, we have dynamic type, but how to invoke static method of dynamic type object? Below code will generate exception at run time. class Foo { public static int Sum(int x, int y) { return x + y; } } class Program { static void Main(string[] args) { dynamic d = new Foo(); Console.WriteLine(d.Sum(1, 3)); } } IMHO, dynamic is invented to bridge C# and other programming language. There is some other language (e.g. Java) allows to invoke static method through object instead of type. BTW, The introduction of C#4.0 is not so impressive compared to C#3.0.

    Read the article

  • Free icons for mobile applications. Where?

    - by Geltrude
    I know that in the sdk folders I can find some (not very well grouped, imho) icon. But, there is a site online specialized that let you download free icons useful for mobile app? Ie world flags, up, down... save, revert..., next..., play, stop..., etc. It would be more appriciated also if you can find these sets in many different colors, and in 2 or 3 sizes (32x32, 64x64, etc.). Have a nice day (ot. Especially my mom - her 62 birthday :-) Edit: those are all good sites, but to green-check the answer I need a small set with the common icons (I think moreabout 50-70 icons), in many different colors and in 2 or 3 different sizes (for lo-mid-hi definition devices). - If a so done site exists for free :-)

    Read the article

  • Question about r-value in C++0x

    - by Goofy
    Rvalues IMHO are great improvement in C++, but at the beginning the're seems quite. Please look at code below: #include <string> std::string && foo (void) { std::string message ("Hello!"); return std::move (message); } void bar (const std::string &message2) { if (message == "Bye Bye!") return; } int main () { bar (foo ()); } Reference message2 is last owner of original message object returned by foo(), right?

    Read the article

  • What are my alternatives to manage Python packages for clients?

    - by c00kiemonster
    So the setup is a slew of proprietary server/client Python applications running on one Linux box (the server) and a set of Windows 7 workstations (the clients). Everything is running smoothly until any of the proprietary Python packages needs updating. For now I am using distutils eggs which are very easily updated with easy_install, but it is still a manual process which quickly becomes tedious as the number of applications and client workstations grow. The ideal setup IMHO is to have the Python packages on the server so when a client application is launched on a workstation the client application can check to see whether its current Python packages are up-to-date. If not, the client application should download the newer Python package from the server, install it, and then launch as per normal. Does this sounds familiar to anyone? I have tried to find alternatives myself, but as far as I can see there is no Python module offering this functionality. Does anyone have any home made solutions for this?

    Read the article

  • Why is this consider bad practice? or is it? (ASP.Net)

    - by user318573
    Would this code be considered bad practice: <div id="sidebar"> <% =DisplayMeetings(12) %> </div> This is a snippet of code from the default.aspx of a small web app I have worked on. It works perfectly well, runs very fast, but as always, I am aware of the fact that just because it works, doesn't mean it is OK. Basically, the DisplayMeetings subroutine outputs a bunch of formatted HTML (an unordered list actually), with no formatting, just the requisite html, and then my CSS performs all the necessary formatting. The data for generating the list comes from an SQL server database (the parameter controls how many rows to return) and I am using stored procedures and datareader for fast access. This keeps my front-end extraordinary simple and clean, imho, and lets me do all the work in VB or C# in a separate module. I could of course use a databound repeater (and probably 6 or more other methods) of accomplishing the same thing, but are they any better? Other than loosing the design-time features of VS2010?

    Read the article

  • Python: get windows OS version and architecture

    - by Thorfin
    First of all, I don't think this question is a duplicate of http://stackoverflow.com/questions/2208828/detect-64bit-os-windows-in-python because imho it has not been thoroughly answered. The only approaching answer is: Use sys.getwindowsversion() or the existence of PROGRAMFILES(X86) (if 'PROGRAMFILES(X86)' in os.environ) But: Can we completely rely on the windows environment variable PROGRAMFILES(X86)? I fear that anyone can create it, even if it's not present on the system. How can we use sys.getwindowsversion() to get the architecture? Regarding sys.getwindowsversion(): The link http://docs.python.org/library/sys.html#sys.getwindowsversion leads us to http://msdn.microsoft.com/en-us/library/ms724451%28VS.85%29.aspx but I don't see anything related to the architecture (32bit/64bit). Moreover, the platform element if the returned tuple seems to be independent of the architecture. One last note, I'm using python 2.5. Thanks!

    Read the article

  • String formatting [str.format()] with a dictionary having a key which is a str() of a number

    - by decimus phostle
    Python neophyte here. I was wondering if someone could help with the KeyError I am getting when using a dictionary for string interpolation in str.format. dictionary = {'key1': 'val1', '1': 'val2'} string1 = 'Interpolating {0[key1]}'.format(dictionary) print string1 The above works fine and yields: Interpolating val1 However doing the following: dictionary = {'key1': 'val1', '1': 'val2'} string2 = 'Interpolating {0[1]}'.format(dictionary) print string2 results in: Traceback (most recent call last): File "test.py", line 3, in <module> string2 = 'Interpolating {0[1]}'.format(dictionary) KeyError: 1L So the problem seems to be in the interpretation of the numeric key as a list index, IMHO. Is there any way to work around this? (i.e. convey that this is instead a dictionary key) TIA and apologies if this question has been asked before(couldn't find anything relevant with my search-fu).

    Read the article

  • The right way of using index.html

    - by Jeyekomon
    I have quite a lot of issues I'd like to hear your opinion on, so I hope I'll manage to explain it well enough. I should also note that I'm beginner equipped only with the knowledge of HTML and CSS so although I'm almost sure that there is a simple solution using powerful PHP, it won't help me. Let's say that I have my personal blog on the address example.com/blog.html and there are links to several sub-blogs example.com/blog/math.html, example.com/blog/coding.html etc. So my root folder contains blog.html and blog folder, the blog folder itself contains files math.html and coding.html. First of all, I learned (from Google Webmasters Tools) that for SEO and aesthetical purposes it's good to unify example.com.com and example.com/index.html by adding _rel="canonical"_ attribute into the source of the index.html. Using a couple of other tricks (like linking to ../ and ./) I got rid of the ugly index.html appearing in my web addresses. And now I wonder if this trick can be used not only for the root folder but for any folder? I mean, I would move my blog.html into the blog folder, rename it into the index.html and add rel="canonical" to unify example.com/blog/index.html with example.com/blog/. This trick would change the address of my blog from example.com/blog.html into example.com/blog/. Not finished! I'm also experiencing problems with the google robot indexing my folders. So when I type site:example.com/ into the google search, the link to my folder example.com/blog/ with raw files, icons etc. appears among the other results. I guess there are also other ways how to fix it, but IMHO the change mentioned above would do the trick too - the index.html in the blog folder would preserve the user from viewing the actual raw content of that folder, there would appear only the right link example.com/blog/ in the google search and (I hope that) _rel="canonical"_ would make the second, unwanted link example.com/blog/index.html not to appear in the search results. So my questions are: Is it a good practice to have the index.html file in every subfolder or is it intended to be only in the root folder? Are there any disadvantages or problems that may occur when using the second, "index in every folder" method? Which one of the two ways of structuring the website described above would you prefer?

    Read the article

  • SnagIt Live Writer Plug-in updated

    - by Rick Strahl
    I've updated my free SnagIt Live Writer plug-in again as there have been a few issues with the new release of SnagIt 11. It appears that TechSmith has trimmed the COM object and removed a bunch of redundant functionality which has broken the older plug-in. I also updated the layout and added SnagIt's latest icons to the form. Finally I've moved the source code to Github for easier browsing and downloading for anybody interested and easier updating for me. This plug-in is not new - I created it a number of years back, but I use the hell out it both for my blogging and for a few internal apps that with MetaWebLogApi to update online content. The plug-in makes it super easy to add captured image content directly into a post and upload it to the server. What does it do? Once installed the plug-in shows up in the list of plug-ins. When you click it launches a SnagIt Capture Dialog: Typically you set the capture settings once, and then save your settings. After that a single click or ENTER press gets you off capturing. If you choose the Show in SnagIt preview window option, the image you capture is is displayed in the preview editor to mark up images, which is one of SnagIt's great strengths IMHO. The image editor has a bunch of really nice effects for framing and marking up and highlighting of images that is really sweet. Here's a capture from a previous image in the SnagIt editor where I applied the saw tooth cutout effect: Images are saved to disk and can optionally be deleted immediately, since Live Writer creates copies of original images in its own folders before uploading the files. No need to keep the originals around typically. The plug-in works with SnagIt Versions 7 and later. It's a simple thing of course - nothing magic here, but incredibly useful at least to me. If you're using Live Writer and you own a copy of SnagIt do yourself a favor and grab this and install it as a plug-in. Resources: SnagIt Windows Live Writer Plug-in Installer Source Code on GitHub Buy SnagIt© Rick Strahl, West Wind Technologies, 2005-2012 Tweet !function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs"); (function() { var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true; po.src = 'https://apis.google.com/js/plusone.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s); })();

    Read the article

  • Autoscaling in a modern world&hellip;. Part 3

    - by Steve Loethen
    The Wasabi Hands on Labs give you a good look at the basic mechanics, but I don’t find the setup too practical.  Using a local console application to host the Autoscaler and rules files is probably the (IMHO) least likely architecture.  Far more common would be hosting in a service on premise (if you want to have the Autoscaler local) or most likely, host it in a Azure role of it’s own.  I chose to go the Azure route. First step was to get the rules.xml and the services.xml files into the cloud.  I tend to be a “one step at a time” sort of guy, so running the console application with the rules sitting in a Azure hosted set of blobs seemed to be the logical first step.  Here are the steps: 1) Create a container in the storage account you wish to use.  Name does not matter, you will get a chance to set the container name (as well as the file names) in the app.config 2) Copy the two files from where you created them to your  container.  I used the same files I had locally.  I made the container public to eliminate security issues, but in the final application, a bit of security needs to be applied (one problem at a time).  The content type was set to text/xml.  I found one reference claiming the importance of this step, and it makes sense. 3) Adjust the app.config to set the location of the files.  This will let you set all the storage account and key information needed to reach into the cloud form your console application.  The sections of your app.config will look like this: <rulesStores> <add name="Blob Rules Store" type="Microsoft.Practices.EnterpriseLibrary.WindowsAzure.Autoscaling.Rules.Configuration.BlobXmlFileRulesStore, Microsoft.Practices.EnterpriseLibrary.WindowsAzure.Autoscaling, Version=5.0.1118.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" blobContainerName="[ContainerName]" blobName="rules.xml" storageAccount="DefaultEndpointsProtocol=https;AccountName=[StorageAccount];AccountKey=[AccountKey]" monitoringRate="00:00:30" certificateThumbprint="" certificateStoreLocation="LocalMachine" checkCertificateValidity="false" /> </rulesStores> <serviceInformationStores> <add name="Blob Service Information Store" type="Microsoft.Practices.EnterpriseLibrary.WindowsAzure.Autoscaling.ServiceModel.Configuration.BlobXmlFileServiceInformationStore, Microsoft.Practices.EnterpriseLibrary.WindowsAzure.Autoscaling, Version=5.0.1118.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" blobContainerName="[ContainerName]" blobName="services.xml" storageAccount="DefaultEndpointsProtocol=https;AccountName=[StorageAccount];AccountKey=[AccountKey]" monitoringRate="00:00:30" certificateThumbprint="" certificateStoreLocation="LocalMachine" checkCertificateValidity="false" /> </serviceInformationStores> Once I had the files up in the sky, I renamed the local copies to just to make my self feel better about the application using the correct set of rules and services.  Deploy the web role to the cloud.  Once it is up and running, start the console application.  You should find the application scales up and down in response to the buttons on the web site.  Tune in next time for moving the hosting of the Autoscaler to a worker role, discussions on getting the logging information into diagnostics into storage, and a set of discussions about certs and how they play a role.

    Read the article

  • Mini Book Review of IronRuby Unleashed by Shay Friedman

    - by Eric Nelson
    When I get some time (and hell starts to look a little chilly) I would love to do a more detailed review. But I wanted to get something “out there” as I really like this book and reviews of it seem a little thin on the ground. In brief: Is it a good book? Yes Would I recommend this book to a .NET developer who was new to Ruby? Yes (This is me by the way) Would I recommend this book to a Ruby developer who was new to .NET ? Yes Would I recommend this book to a developer who sometimes does Ruby and sometimes does .NET? Yes Would I recommend this book to a developer new to .NET and new to Ruby? Yes The above demonstrates how well balanced this book is (IMHO). What I like about it: Its assumes pretty much no knowledge of IronRuby or .NET. All it asks is that you are a developer interested in IronRuby. Yet it manages to cover off the topics in a good degree of detail. If you are a Ruby developer you skip Part 2, if you are a .NET developer you skip some of Part 1 and whizz through the short intros to the individual technologies such as WPF. It is definitely not a “lets makes the manual look pretty” book – this is original content thoughtfully written and presented. It is pretty comprehensive – in 500 pages it packs in  Intro to IronRuby Intro to .NET Intro to Ruby Using IronRuby with Windows Forms, ASP.NET, WPF, Silverlight etc Getting Rails working with IronRuby Unit testing with IronRuby – which I think is an excellent way for a .NET developer to start using IronRuby Embedding IronRuby in a .NET app  - another interesting “first step” for a .NET developer What I didn’t like: Err… nothing yet. Ok, If I am being picky then the start of chapter 2 irked me a little as it went through the history of .NET. “The first version [of the .NET Framework] wasn’t that great”.  Felt pretty good to me compared to Java and C++ development at the time :-) Buy on Amazon UK | Buy on Amazon USA Related Links: Posts from the author Shay Friedman on IronRuby Guest Post: What's IronRuby, and how do I put it on Rails? Guest Post: Using IronRuby and .NET to produce the ‘Hello World of WPF’ Getting PhP and Ruby working on Windows Azure and SQL Azure

    Read the article

  • Playing with F#

    - by mroberts
    Project Euler is a awesome site.   When working with a new language it can be tricky to find problems that need solving, that are more complex than "Hello World" and simpler than a full blown application. Project Euler gives use just that, cool and thought provoking problems that usually don't take days to solve.  I've solved a number of questions with C# and some with Java.  BTW, I used Java because it had BigInteger support before .Net. A couple weeks ago, back when winter had a firm grip on Columbus, OH, I began playing (researching) with F#.  I began with Problem #1 from Project Euler.  I started by looking at my solution in C#. Here is my solution in C#. 1: using System; 2: using System.Collections.Generic; 3:   4: namespace Problem001 5: { 6: class Program 7: { 8: static void Main(string[] args) 9: { 10: List<int> values = new List<int>(); 11:   12: for (int i = 1; i < 1000; i++) 13: { 14: if (i % 3 == 0 || i % 5 == 0) 15: values.Add(i); 16: } 17: int total = 0; 18:   19: values.ForEach(v => total += v); 20:   21: Console.WriteLine(total); 22: Console.ReadKey(); 23: } 24: } 25: }   Now, after much tweaking and learning, here is my solution in F#.   1: open System 2:   3: let calc n = 4: [1..n] 5: |> List.map (fun x -> if (x % 3 = 0 || x % 5 = 0) then x else 0) 6: |> List.sum 7:   8: let main() = 9: calc 999 10: |> printfn "result = %d" 11: Console.ReadKey(true) |> ignore 12:   13: main() Just this little example highlights some cool things about F#. Type inference. F# infers the type of a value.  In the C# code above we declare a number of variables, the list, and a couple ints.  F# does not require this, it infers the calc (a function) accepts a int and returns a int. Great built in functionality for Lists.  List.map for example. BTW, I don’t think I’m spilling the beans by giving away the code for Problem 1.  It by far is the easiest question, IMHO, solved by 92,000+ people. Next I’ll look into writing a class library with F#.

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9 10  | Next Page >