Search Results

Search found 7380 results on 296 pages for 'scripting languages'.

Page 86/296 | < Previous Page | 82 83 84 85 86 87 88 89 90 91 92 93  | Next Page >

  • Programming style question on how to code functions

    - by shawnjan
    Hey all! So, I was just coding a bit today, and I realized that I don't have much consistency when it comes to a coding style when programming functions. One of my main concerns is whether or not its proper to code it so that you check that the input of the user is valid OUTSIDE of the function, or just throw the values passed by the user into the function and check if the values are valid in there. Let me sketch an example: I have a function that lists hosts based on an environment, and I want to be able to split the environment into chunks of hosts. So an example of the usage is this: listhosts -e testenv -s 2 1 This will get all the hosts from the "testenv", split it up into two parts, and it is displaying part one. In my code, I have a function that you pass it in a list, and it returns a list of lists based on you parameters for splitting. BUT, before I pass it a list, I first verify the parameters in my MAIN during the getops process, so in the main I check to make sure there are no negatives passed by the user, I make sure the user didnt request to split into say, 4 parts, but asking to display part 5 (which would not be valid), etc. tl;dr: Would you check the validity of a users input the flow of you're MAIN class, or would you do a check in your function itself, and either return a valid response in the case of valid input, or return NULL in the case of invalid input? Obviously both methods work, I'm just interested to hear from experts as to which approach is better :) Thanks for any comments and suggestions you guys have!

    Read the article

  • Where/When do C# and the .NET Framework fail to be the right tool?

    - by Nate Bross
    In my non-programming life, I always attempt to use the appropriate tool for the job, and I feel that I do the same in my programming life, but I find that I am choosing C# and .NET for almost everything. I'm finding it hard to come up with (realistic business) needs that cannot be met by .NET and C#. Obviously embedded systems might require something less bloated than the .NET Micro Framework, but I'm really looking for line of business type situations where .NET is not the best tool. I'm primarly a C# and .NET guy since its what I'm the most comfertable in, but I know a fair amount of C++, php, VB, PowerShell, batch files, and Java, as well as being versed in the web technologes (JavaScript, HTML, and CSS). But I'm open minded about it my skill set and I'm looking for cases where C# and .NET are not the right tool for the job. I choose .NET and C# because I'm comfortable with it, but I'm looking for cases where it isn't appropriate.

    Read the article

  • Writing a VM - well formed bytecode?

    - by David Titarenco
    Hi, I'm writing a virtual machine in C just for fun. Lame, I know, but luckily I'm on SO so hopefully no one will make fun :) I wrote a really quick'n'dirty VM that reads lines of (my own) ASM and does stuff. Right now, I only have 3 instructions: add, jmp, end. All is well and it's actually pretty cool being able to feed lines (doing it something like write_line(&prog[1], "jmp", regA, regB, 0); and then running the program: while (machine.code_pointer <= BOUNDS && DONE != true) { run_line(&prog[machine.cp]); } I'm using an opcode lookup table (which may not be efficient but it's elegant) in C and everything seems to be working OK. My question is more of a "best practices" question but I do think there's a correct answer to it. I'm making the VM able to read binary files (storing bytes in unsigned char[]) and execute bytecode. My question is: is it the VM's job to make sure the bytecode is well formed or is it just the compiler's job to make sure the binary file it spits out is well formed? I only ask this because what would happen if someone would edit a binary file and screw stuff up (delete arbitrary parts of it, etc). Clearly, the program would be buggy and probably not functional. Is this even the VM's problem? I'm sure that people much smarter than me have figured out solutions to these problems, I'm just curious what they are!

    Read the article

  • Portable Programming IDE

    - by Click Ok
    Frequently I'm brainstormed with programming ideas that I would like to directly code. More or less like "Wow, that algorithm will rock! I need to write it now!". For this kind of "impulse" to write, I use http://www.jarte.com/ that is a cool portable text editor. If I'm near a cybecafe or a friend computer, I just plug the usb pen drive and start to write... So, I would like: 1) a portable minimalist IDE 2) with minimal OS requirement (ie.: I want run from XP, Vista, etc...) 3) any modern language (I can learn a new language if needed. I just want write/test the algoritm) 4) Syntax Highlight/intellisense is good, but not required 5) Free Is there something like this?

    Read the article

  • Language to learn metaprogramming

    - by Erup
    What's the best language (in terms of simplicity, readability and code elegancy) in your opinion, to learn and work with metaprogramming? I think metaprogramming is the "future of coding". Not saying that code will extinct, but we can see this scenario coming on new technologies.

    Read the article

  • Why is Visual Basic bad?

    - by Mike
    Why do programmers consider Visual Basic a bad language? Putting aside any gripes with Microsoft or with proprietary/non-free software in general, and looking the language itself. Syntax, style, etc. I have just started using it, and find the syntax rather terrible. But I'm wondering what are the most common specific problems.

    Read the article

  • Natural problems to solve using closures

    - by m.u.sheikh
    I have read quite a few articles on closures, and, embarassingly enough, I still don't understand this concept! Articles explain how to create a closure with a few examples, but I don't see any point in paying much attention to them, as they largely look contrived examples. I am not saying all of them are contrived, just that the ones I found looked contrived, and I dint see how even after understanding them, I will be able to use them. So in order to understand closures, I am looking at a few real problems, that can be solved very naturally using closures. For instance, a natural way to explain recursion to a person could be to explain the computation of n!. It is very natural to understand a problem like computing the factorial of a number using recursion. Similarly, it is almost a no-brainer to find an element in an unsorted array by reading each element, and comparing with the number in question. Also, at a different level, doing Object-oriented programming also makes sense. So I am trying to find a number of problems that could be solved with or without closures, but using closures makes thinking about them and solving them easier. Also, there are two types to closures, where each call to a closure can create a copy of the environment variables, or reference the same variables. So what sort of problems can be solved more naturally in which of the closure implementations?

    Read the article

  • Is PHP still basically Procedural Overall?

    - by coffeeaddict
    I know PHP 5 has some object oriented similarities but it's not a true OOP environment still right? Also does it have a true compiler? I see compiling of scripts which still means procedural. I assume it's not a real compiler in that any PHP compilers out there do not create assemblies?

    Read the article

  • What are the limitations of assembler? (NASM)

    - by citronas
    Is there a technical limitation of what kind of programs I can write with assembler (NASM)? For now I've only seem some program that do arithmetic operations, like adding two numbers. Is it possible to write complex assembler programs, that provide a GUI, access the file system, plays sounds et cetera? I know I wouldn't write such programs, but I'm curious, if there are technical limitations on what kind of programs I can write with assembler.

    Read the article

  • F# - core benefits

    - by David Neale
    Since the release of VS 2010 I've seen F# more strongly advertised by Microsoft. What are the core benefits of using this language? What problems does it most naturally lend itself to? What is the learning curve like?

    Read the article

  • What is the most useful programming language that no one is using?

    - by dbyrne
    What language do you find incredibly useful that no one else seems to care about? I am not looking for the language with the coolest features, but the language that makes you the most productive. I realize that a productive language that no one uses is a bit of an oxymoron. My personal choice would probably be ruby without rails, but I am sure others can come up with some better answers.

    Read the article

  • Has anyone "learned how to program in 21 days?"

    - by Sheehan Alam
    I'm not a fan of these learn how to program in X amount of days books. Some even boast, learn how to program in 24 hours. This is a joke and an insult to me as a software engineer who went through a rigorous discipline in computer science and mathematics. So a question to the community, have you benefited from these become a programmer quick books?

    Read the article

  • Which design is better (OO Design)?

    - by Tattat
    I have an "Enemy" object, that have many "gun" . Each "gun" can fire "bullet". Storing "gun" is using an array. when the "gun" is fired, the "bullet" will be created. And the enemy object will have an array to store the "bullet". So, I am thinking about the fire method. I am think making a firebulletFromGun in the "enemy". It need have a parameter: "gun". while this method is called. The "enemy" 's bullet will be added in the Array. Another design is writing the fire method in the "gun". The "enemy" use the "gun"'s fire method. And the "gun" will return a "bullet" object, and it will be added in the Array of "enemy". Both method can work, but which way is better? or they are similar the same? plx drop ur ideas/suggestions. thz.

    Read the article

  • Simple IF statement question

    - by JGreig
    How can I simply the below if statements? if ( isset(var1) & isset(var2) ) { if ( (var1 != something1) || (var2 != something2) ) { // ... code ... } } Seems like this could be condensed to only one IF statement but am not certain if I'd use an AND or OR

    Read the article

  • .NET / WPF Alternative

    - by eWolf
    I know the .NET framework and WPF pretty well, but I think the whole thing has gotten too blown up, especially for small apps as the whole .NET framework 3.5 weighs 197 MB by now. I am looking for a language/framework/library that provides functionality similar to that of WPF (animations, gradients, a.s.o.) and the .NET framework (of course not everything, but the basic features) and which is faster and more lightweight than the .NET framework and creates smaller and faster applications than the ones using .NET. Do you have any suggestions?

    Read the article

  • How do game companies handle programming for multiple platforms?

    - by stormist
    You often see that a new game will be released on Xbox 360, PS3 and Windows PC. How do gaming companies do this? Is it a common source code compiled using different compilers? Are actual different source codes required? example news article announcing this: http://www.gameranx.com/updates/id/502/article/dungeon-siege-3-announced-to-be-developed-by-obsidian/

    Read the article

  • Help me write my LISP :) LISP environments, Ruby Hashes...

    - by MikeC8
    I'm implementing a rudimentary version of LISP in Ruby just in order to familiarize myself with some concepts. I'm basing my implementation off of Peter Norvig's Lispy (http://norvig.com/lispy.html). There's something I'm missing here though, and I'd appreciate some help... He subclasses Python's dict as follows: class Env(dict): "An environment: a dict of {'var':val} pairs, with an outer Env." def __init__(self, parms=(), args=(), outer=None): self.update(zip(parms,args)) self.outer = outer def find(self, var): "Find the innermost Env where var appears." return self if var in self else self.outer.find(var) He then goes on to explain why he does this rather than just using a dict. However, for some reason, his explanation keeps passing in through my eyes and out through the back of my head. Why not use a dict, and then inside the eval function, when a new "sub-environment" needs to be created, just take the existing dict and update the key/value pairs that need to be updated, and pass that new dict into the next eval? Won't the Python interpreter keep track of the previous "outer" envs? And won't the nature of the recursion ensure that the values are pulled out from "inner" to "outer"? I'm using Ruby, and I tried to implement things this way. Something's not working though, and it might be because of this, or perhaps not. Here's my eval function, env being a regular Hash: def eval(x, env = $global_env) ........ elsif x[0] == "lambda" then ->(*args) { eval(x[2], env.merge(Hash[*x[1].zip(args).flatten(1)])) } ........ end The line that matters of course is the "lambda" one. If there is a difference, what's importantly different between what I'm doing here and what Norvig did with his Env class? If there's no difference, then perhaps someone can enlighten me as to why Norvig uses the Env class. Thanks :)

    Read the article

  • Call a function from another Class - Obj C

    - by AndrewDK
    I'm trying to figure out how I can call a function from another one of my classes. I'm using a RootViewController to setup one of my views as lets say AnotherViewController So in my AnotherViewController im going to add in on the .h file @class RootViewController And in the .m file im going to import the View #import "RootViewController.h" I have a function called: -(void)toggleView { //do something } And then in my AnotherViewController I have a button assigned out as: -(void)buttonAction { //} In the buttonAction I would like to be able to call the function toggleView in my RootViewController. Can someone clarify on how I do this. I've tried adding this is my buttonAction: RootViewController * returnRootObject = [[RootViewController alloc] init]; [returnRootObject toggleView]; But I dont think that's right. Thanks in advanced.

    Read the article

< Previous Page | 82 83 84 85 86 87 88 89 90 91 92 93  | Next Page >