IT tasks: F# script vs Powershell script [closed] - powershell

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 12 years ago.
I know that Powershell is generally considered the IT management language for windows, but why/when would you choose F# instead, which is strongly typed and 'intellisensed' ?

I'd choose F# when it was a better fit for the company I was working for, the team who'll be using it, and the task at hand. Otherwise I'd choose something else.
I can't be more specific than that without more details, but I can suggest a few questions you should ask:
What is the problem you're solving?
In which language is it easier to express the solution to the problem?
Are existing staff F# developers themselves (i.e. consider the learning curve involved)?
Will the people maintaining this code be administrators (who are usually quite familiar with Powershell, & not at all familiar with F#)?
A related hint: don't allow a profusion of languages to develop in your production code and infrastructure.
By all means experiment to find the best language to solve the problem you're having, but if you find in five years time that someone has written a core component of your solution in a language that is no longer understood by anyone in the company, you may have a serious problem on your hands.
My personal rule of thumb (of course there are exceptions) is that a project should have a core language and a scripting language to hold it all together, & that those languages should be chosen first to fit the problem domain, and secondly to maximise proficiency across the team. 'Pet languages' should be strongly discouraged in production code or infrastructure.

It depends on your problem and on who will maintain the scripts.
PowerShell is very strong in administration areas (working with files, active directory, csv/xml, computers, etc.), but it's programming abilities are quite limited (e.g. case of generics). Threading in PowerShell is not as easy as it could be. But nobody expects from administrators that they will use threads. Instead there are background jobs that satifisfy administrator's needs.
On the other hand, F# is real programming language, which means it is quite low level and therefore verbose (compared to PowerShell). Some tasks written in PowerShell are one-liners, whereas in F# you would write a lot of code. Besides that - how would you achieve running command on remote computers (Invoke-Command -computer myserver ...)?
As you see, it depends on your problem.
Very important is also who will maintain the scripts. You might be on holiday and your colleagues will need to edit the scripts. Both languages need some time to learn. IMHO it is easier to learn PowerShell; thinking in functional style needs to bend your head.

It is probably a bad idea, at this point in time, to choose to write scripts in F# if they might be needed by anyone other than yourself ...
The cadre of F# speaking people is very small, so you're creating scripts which very few people can read or edit.
The fsi executable doesn't come with the .Net Framework, nor is it part of the F# runtime redistribution package (as far as I can tell). This means the scripts can only be executed where Visual Studio with F# tools have been installed.
The obvious exception, of course, is if you're a developer working on a project where F# is a primary language, since that will mean that everyone that matters will be able to run and edit your scripts.
However, I have to say that I think even in this ideal/exceptional case, it would probably be more work to use F# if your scripting task involves tasks for which there are pre-existing cmdlets in PowerShell (ie: filesystem tasks, registry, database maintenance, active directory, exchange, the list goes on and on). Of course, you might still choose to do it if you're using these scripts as an opportunity to learn the language, but bear in mind points 1 & 2 ;-)

Related

Perl screencast? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
I need to learn Perl for an academic research I am doing. I need to go through a lot of older perl scripts and run them, tweak some perl scripts from open source tools for my use and of course make some of my own.
I have a tight schedule so I needed to be comfortable with a perl code pretty quickly. I have previous coding experience from C and Java but not with any scripting languages as such. I found Perl to be quite difficult to get used to from the beginner tutorials I have gone across. I am more comfortable learning through screencasts rather than go through books when I start learning languages. Of course one always needs a good reference book or user manual but videos are more intuitive when learning something first especially because I can see the expert actually code stuff and explain it at the same time.
I've heard from other friends that there are great screencasts for other scripting languages like Ruby and Python. I was wondering is there any really good quality screencast for Perl out there. So, I ask for help from people who have good experience with Perl to point me to a good resource.
I don't think that screencasts are really that valuable in terms of learning fast and deep. There are some nice Perl 6 screencasts, but for Perl 5 I still think perldoc is the best thing you can find. Comprehensive and readable.
Also, Perl is a pretty big language, similar to natural languages in many cases: easy to get comfortable with simple things, and requiring more experience to get around the difficult/sophisticated syntax/concepts. Mastering Perl takes time, especially when you'll need to work with old Perl (it's pretty different to Modern Perl, written today).
This may not work for everyone,but personally, I find taking on small projects (or inventing my own) to be the only sufficient way of learning a language quickly.
One trick I use for high-speed, is to take stuff I've already written in other languages, and port it to the new one. I moved from Rexx to Perl this way a few years ago, then from Perl to Python recently, and now I'm moving from Python to Ruby in the same way. So, you could try taking something you've written in C, and porting it to Perl.
Frankly, being given a big pile of old code to comb through is a huge gift. You could try plugging the classes and functions into new short projects, to see how they behave. You could also try writing unit tests exercising them, to give you both familiarity with coding in Perl, and familiarity with the functionality of the codebase you're familiarizing yourself with.
One of the best ways of learning is:
Learn Perl debugger. If you are familiar with gdb, it should be a breeze
Run a few of those older scripts, and try to grok them, by looking up sercheable references on perldoc web site, tweaking/messing with them, and importantly, debugging them.
Whenever you run into some piece that you just don't get (especially feature/functionality that's not easily searcheable for like a keyword/built in function would be), come to SO with that specific thing and you'll get fairly reliably comprehensive answers.
Go through a decent set of books. O'Reilly are the best for Perl (Camel would be my recommendation) - they are actuially VERY quick/easy to skim through to get the main points of someone who already has C and Java experience. Couple that with the main perldoc tutorials (data structures, modules and OOP)
For doing new work of your own, get a hold of Perl Cookbook in addition to the above.

What should I do when something I know is dead ? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
I recently came into some blogs saying that Linq to Sql is dead. and a few days ago I saw a discussion with some people saying that Silverlight maybe will take ASP.net place! ...I don't want to ask if they are true or not but it is so annoying when you wake up and found your languages and informations in the casket! (I think that Microsoft languages have the big part of this words). So what should I do in this case ? drop every thing back and start again with the new techniques or keep using the old stuff or what ?
A platform isn't dead because someone says it's dead. It's dead when it's no longer used, and in that case, it's obvious you shouldn't be using it either. Unless, of course, you're employed by a big company that has a big legacy system that needs further development using that "dead" technology.
Nothing ever really dies. Especially Microsoft stuff. I thought I had wasted 10 years as a FoxPro dev (not even VFP!), but this helped me get jobs, even in related technologies like dBASE and Clipper, since those skills are harder to find.
Having said that, by all means keep up with the mainstream. Continuous learning is expected in this field.
In any case, neither of those claims (re Linq to Sql and Silverlight) is true.
First off, dont immediately jump to the assumption that what you read in a blog or in a tech magazine is true. If the 'old stuff' still works, whats the compelling reason to change? Basically its just keeping up with fashion. Use what you want to use. If you understand the basics of programming, you can adapt as needed when presented with new technologies.
Neither ASP.NET or Linq-to-SQL appear to be vanishing any time soon; however, this advice always applies:
Put pressure on Microsoft (or any other vendor, for that matter) to support products your business depends on.
If your business regularly purchases upgrades to its Microsoft stack, MS will want to make you happy. Get involved at Microsoft Connect, contact your MS representative, and be involved. The safest path to maintaining support from MS is by participating in their process. (It's why Windows XP remained supported long after MS announced support would end.)
Simple answer: Be sufficiently broad in your technical abilities.
As a hiring manager, I'm more concerned that you know how to write good programs and that you know how to get answers to your questions, than I am that you spent 10 years focusing on a specific technology.
For example: If I'm hiring for an MVC2 position, I would gladly take a seasoned Microsoft web developer with webforms experience and some MVC2 exposure over an unseasoned and unskilled programmer that's been working in MVC2 since it came out.
Many programmers are keen to try out new things. The statement "Technique X is dead", means just that someone tries to convince himself or a group, that investing more time into something else seems worthwhile.
To really kill a technology you would need to remove all related downloads and available knowledge or relicense the software in some form that makes usage impossible.
When a group of people shout that X is dead, they are just moving to Y. If you can still hire X programmers, you are not in big trouble.
Don Box once said "If your this kind of people that start working with a technology when it's dead, it time for you to start using COM". He said that to introduced .net an confirm that way that COM won't be further improved. See ? "Dead" means it won't evolve as much as other anymore but definitely not that we should't use anymore.
Don't jump to conclusions based on (non-authoritative) blogs. People have opinions, and that's all they are. Until the vendors of the technologies you're using come out and say it, proceed with caution.
I'm not a .Net expert by any means but I think there's a reason for not using Linq for SQL queries since a dedicated ORM approach will most likely be faster and more configurable. As far as Silverlight, it's just a subset of WPF which is a GUI framework. They possibly wish that silverlight would take over some processing from the server side but I doubt they'll get that sort of market penetration.
That's life on the cutting edge... You got into this business because you liked the latest technology, right? Well, don't look back, look forward. Before your favorite technology even has the sniffles, you should be looking at what's going up. If you study up on the latest technology, you won't even notice when the old stuff go away.
Software development is all about learning things so that you can build things that will be thrown away and replaced with newer things some day! If you don't want to commit to continuous change, you're in the wrong field! :-)

What is the best language in which to write an expert system? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Is LISP or something like Jess the best choice? I'm interested in writing a program that makes a suggestion based on users' answers. Computational considerations are not really a factor this is pretty much a pattern matching engine. Also I would like to make an app for this and put it up on the web.
UPDATE: I would like to put this up on a blog or website and let people use it from there. I guess my question then is there a particular inference engine that works with the .NET family, or PHP, or something to that effect? What are some of the pros and cons of each options etc.
Step 1. Pick an inference engine. There are many choices. Here's a list: http://en.wikipedia.org/wiki/Expert_system#Shells_or_Inference_Engine
Step 2. Use the language that interfaces with the inference engine.
You'll be much happier leveraging an inference engine for expert systems work.
I would like to put this up on a blog or website and let people use it from there
Trivial.
is there a particular inference engine that works with the .NET family, or PHP, or something to that effect?
Doesn't matter.
Here's the confusion. Your "web site" and your "inference application" have NOTHING to do with each other. Nothing.
Your web site can be done in any tool set you can find. It doesn't matter.
Your inference application can be done in any tool set you can find. It doesn't matter.
Your web site will invoke the inference application through any API that makes sense. The lowest common denominator in API's (the reason that none of these choices matter) is to do this.
Write your inference application as a stand-alone command line tool.
Write your web application to run the stand-alone tool, collect the output and turn the output into an HTML page.
Note that this multi-porocess implementation may be faster and make better use of multi-core processors. It forces the OS to manage the web server (Apache HTTPD, for example), the web application and the expert system as potentially three, separate, parallel processes.
You can also take a look at Prolog. SWI-Prolog (http://www.swi-prolog.org) is very complete and has an HTTP support library included (http://www.swi-prolog.org/pldoc/package/http.html). This paper might be helpful in using SWI-Prolog on the web ("SWI-Prolog and the web" http://dare.uva.nl/record/285350)
And, you can find a tutorial on building expert systems with prolog at: http://www.amzi.com/ExpertSystemsInProlog/
You will hear a lot of subjective opinions here, since few people have experience in more than one language writing expert systems.
I can recommend Common Lisp, as there is quite some literature and existing code available in this language, and it is a very powerful language and not too difficult to learn (read "Practical Common Lisp" by Peter Seibel). Of course, any new high level language requires some effort to learn. For the web application, you can use, e.g., Hunchentoot and CL-WHO, and there are a lot of database bindings (I like Postmodern and CL-SQLite).
I would suggest CLIPS and its .net port clipsnet
http://sourceforge.net/projects/clipsnet/

Modeling and Simulation Programming Language [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I work with many different models and simulations. Some of the older models and simulations are written in FORTRAN. Some of those models have been converted to C++, but the current trend is to create these models using MATLAB/SIMULINK. From a computer science perspective I have always felt MATLAB/SIMULINK was not a good solution. What language do you use to create models and simulations and why?
I would always try to use the language that is provided by the best modeling and simulation tool (or library, if you like) to do the job for me.
And this question can really only be answered by taking into account what kinds of models you want to implement. Continuous (e.g. ODEs), discrete (e.g. StateCharts, Petri Nets), or a combination (i.e. a hybrid model, as can be implemented with Simulink+StateFlow)? There are various tools for each kind of model.
Another important aspect would be the domain in which you are working. Simulink has pretty extensive libraries for electrical engineering, finance, or computational biology (most of them are included in additional packages, though) - if you work in one of those fields, there might simply be no better (i.e. complete, valid) component library. The same goes for other commercial simulation packages, such as AnyLogic, Arena, etc. There might also be some open-source simulation tools, depending on your modeling problem.
Finally, you might prefer a specific programming language over another, and you might have additional requirements, e.g. support for
Optimization (of model parameters)
Validation
Output analysis (statistics, plots, statistical tests)
Support for parallel and distributed simulation
Model checking
...
So I'm currently working with Java with the well-known advantages - reasonably fast, good support for multi-threading, relatively simple to use etc. But if 'reasonably fast' is not fast enough, there might be no option but going down one level of abstraction :-)
I also work with a lot of legacy code, most of it in Fortran. I really don't mind using Fortran - all the modern compilers allow variable names greater than the old and silly 6 character limit. Also, with Fortran 95, you can even do OOP if you feel that your modifications to the existing codebase would benefit.
Also, there are very good code editors for Fortran, which isn't always the case for more specialized script languages.
C++ has the great disadvantage of memory considerations. I have been programming C/C++ for 20+ years now, and I still forget to delete objects and properly fill in destructors.
On a final note, if you're using Windows, there is a Fortran.NET compiler (I think from Lahey-Fujitsu?) if you want to move your Fortran to a managed environment.
Good luck!
SIMULA of course !! :-)
What I've gotten out of MATLAB is it's ability to let me quickly prototype an algorithm. I can really get a good feel for the data by plotting it and using the built in statistics functions. When trying something new out, I can do something quick and dirty to get some initial results, then go back and clean things up to refine my results. With compiled languages, there's a lot more I have to do just to get the simulation to run. With MATLAB, I spend more time thinking about the real problem, and less about compiling, linking, memory management, etc.
However, there are many problems that MATLAB is just ill-equipped to solve. For large data sets, a compiled language with user defined data structures is almost certainly necessary.
Particle physics has been moving to C++ and python. This is not universal, and probably wouldn't even be close were it not for the ubiquity of ROOT.
Root's use of cint means you needed bother with memory management when you're dinking around with a new idea, it's capacity to run compiled allows you to have speed, the ability to mix the modes is very helpful, and the bindings for python and other RAD languages allow for great flexibility.
In a very real sense, this comes down to an endorsement of roland's point.
you can use s-funcuin block for linking fortran(c,c++) with matlab.

What programming language would be best for creating a roguelike game? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
With the interest of creating a roguelike RPG (such as Nethack, Rogue, and ADOM), which programming language would be most suitable and why?
With the language that you choose, be sure to list any libraries or facets of the language that make it particularly well-suited.
Way back in the day I tried to write Roguelike games using QuickBASIC out of all things (it was 1988.) Not the recommended approach...
There are still some development circles out there. Here's an FAQ on Roguelike Development and also a blog dedicated to the same.
My language of use (I'm trying to create roguelike too) is Python, because:
It's high level programming language, I don't need to think about memory allocation all the time, etc, but keep my mind on algorithms.
There's tons of useful libraries for almost everything. Recently I've found TDL/libtcod which can be useful for roguelike development.
With bindings you can easily use C/C++ libraries or even write few critical functions in C/C++, and use them.
It's the most readable programming language I've ever seen.
While programming in Python I've learned to use internal documentation. It's very helpful thing, I just read my code few months later and I still know what it's doing.
That's a very personal choice as always :-)
I wrote my Roguelike game (Tyrant) in Java for the following reasons:
Very portable (even with graphics)
Garbage collection / memory management
Lots of good free / open source libraries available (helpful for algorithms, data structures and manipulating save game files etc.)
It's a statically typed language - this has performance and robustness benefits which I judged to be worth the additional coding complexity
I wanted to hone my Java skills more generally for use in other projects
EDIT: For those interested it is open source, all code is available at SourceForge
Well I've made a couple roguelikes in C, spending a fair amount of time at roguebasin, which is a great site for anything related to roguelike development.
As for what language you should use, I don't really see it making a huge difference. I pick C because of the portability, and a lot of libraries work well with it.. But an object oriented language can clean up some things that you may not want to keep track of.
There aren't any languages that I would consider to be specifically greater than the rest for roguelikes. If you're making it graphical, you may prefer something that has that built-in, such as flash / silverlight. But even then there are libraries for any other languages that bring them to about the same degree of difficulty in that regard.
So I'd say take a language you know and like, or that you don't know and want to learn..
Most of these answers are great, but there's something to be said for the combined power of object-oriented stuff and low-level commands that can be abused in C++. If you're looking for some inspiration, the C sourcecode to NetHack is widely available and documented well enough that you can certainly poke around to learn some things. That said, it's a huge project that's been growing for decades, and not everything is as clean as you're going to want things for your own project - don't get roped into making poor design choices based off of what you find in NetHack.
Honestly, though, in terms of what you use it probably doesn't matter at all - though I'd highly recommend using an OO language. There's so much crap to handle in a roguelike (heck, any CRPG really) that OOP is the easiest way of staying sane.
The original nethack was written in C, and the source is available if you want to get some ideas about how it was written, and the challenges you may find which might be a good way to start deciding on a language.
My first question would be whether the game is going to have a web based UI or be some kind of console/window affair like the original Rogue-like games? If the former I would say that any language you're comfortable with would be a good choice. Ruby on Rails, Python/Django, PHP/CakePHP, etc. would all be great.
But if the answer is the latter, this is a game that you want people to be able to download and install locally, I'm going to go with Java. It's a great language with no memory management for you to deal with. It achieves very high performance thanks to just-in-time compilation and optimization, and it has an extremely rich library to help you with data structures, Swing makes for some really beautiful UIs, and the 2D library allows for the most rich cross-platform rendering outside of PostScript. It also has the availability across Windows, Mac OS X, and Linux that you're not going to get from some other choices.
Finally, distribution of your application is easy via Java Web Start as well, so people can download and install the game with just a couple of clicks once they have Java and keep it on their machine to run as long as they like.
For making any game, any language will be right if :
you can use it (you are able to use it, by knowledge or if it's easy enough to learn right now for you or your team)
it produce applications that runs on your client's computer
it can easily produce applications that runs fast enough for your game's needs.
I think that for a Rogue-Like, any language you know will be right as far as it runs on you target. Performances are not really a problem in this kind of game. World generation can require high performance if your world generation is really complex though...
just go with something that will handle the low-level details for you. whatever you know should work.
hey, they can write one in javascript.
I recommend Actionscript for those games.
You could consider Silverlight.
It sits on top of C# and .Net so theres not much need to worry about memory management. With SL you'll get built in support for scene graph type rendering - culling of things not on screen, Key board, mouse events, clicks on objects etc.
There's an initial learning curve, but I find it's a great environment to work in.