background preloader

PROGRAMMING

Facebook Twitter

IYOCGwP, Chapter 6 - Dragon Realm. Topics Covered In This Chapter: The time module.The time.sleep() function.The return keyword.Creating our own functions with the def keyword.The and and or and not Boolean operators.Truth tablesVariable scope (Global and Local)Parameters and ArgumentsFlow charts Introducing Functions We've already used two functions in our previous programs: input() and print().

In our previous programs, we have called these functions to execute the code that is inside these functions. In this chapter, we will write our own functions for our programs to call. The game we will create to introduce functions is called "Dragon Realm", and lets the player make a guess between two caves which randomly hold treasure or certain doom. How to Play "Dragon Realm" In this game, the player is in a land full of dragons.

Open a new file editor window by clicking on the menu, then click on . Sample Run of Dragon Realm You are in a land full of dragons. Which cave will you go into? Gobbles you down in one bite! While cave ! Gestion des événements. Accueil Evénements du classeur Workbook_Open() Cet événement est activé à l’ouverture du classeur. Chaque utilisateur ne voit que l’onglet qui le concerne A la sauvegarde du classeur, on masque toutes les feuilles. A l'ouverture du classeur, on affiche seulement celle de l'utilisateur ProtectionOngletSimple Private Sub Workbook_Open() On Error Resume Next Sheets(Environ("username")).Visible = True End Sub Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) For s = 2 To Sheets.Count ' on masque les feuilles Sheets(s).Visible = xlVeryHidden Next s End Sub Une macro auto_open() dans un module du classeur est également exécutée à l'ouverture du classeur.

Crée une liste perso sur le poste de l’utilisateur à l’ouverture du classeur Sub auto_open() Application.AddCustomList _ ListArray:=Array("France", "Italie", "Espagne", "Grèce", "Allemagne", "Potugal") End Sub Workbook_BeforeSave() Cet événement est declenché avant la sauvegarde du classeur. -EnregistreNomUtilisateur - TriMenu. SS64. Mobile Computing with iPhone and Android. Understanding VBA Functions and Their Uses.

A function performs a calculation and returns a single value. The SUM function adds the sum of a range of values. The same holds true for functions used in your VBA expressions: Each function does its thing and returns a single value. The functions you use in VBA can come from three sources: Built-in functions provided by VBAWorksheet functions provided by ExcelCustom functions that you (or someone else) write, using VBA VBA provides numerous built-in functions. VBA function examples Here are a few examples of using VBA functions in code.

Displaying the system date The first example uses VBA's Date function to display the current system date in a message box: Sub ShowDate() MsgBox DateEnd Sub Notice that the Date function doesn't use an argument. To get the system date and time, use the Now function instead of the Date function. Finding a string length The following procedure uses the VBA Len function, which returns the length of a string. Displaying the integer part of a number. All The Cheat Sheets That A Web Developer Needs. 30 free programming eBooks - citizen428.blog() Since this post got quite popular I decided to incorporate some of the excellent suggestions posted in the comments, so this list now has more than 50 books in it. BTW: I’m not very strict on the definition of “ebook”, some of them are really just HTML versions of books.

[UPDATED: 2012-01-18] Learning a new programming language always is fun and there are many great books legally available for free online. Here’s a selection of 30 of them: Lisp/Scheme:Common Lisp: A Gentle Introduction to Symbolic ComputationHow to Design ProgramsInterpreting Lisp (PDF, suggested by Gary Knott)Let Over LambdaOn LispPractical Common LispProgramming in Emacs LispProgramming Languages. Application and Interpretation (suggested by Alex Ott)Simply Scheme: Introducing Computer Science (suggested by Peter AronoffSuccessful Lisp: How to Understand and Use Common Lisp (suggested by Juanito)Structure and Interpretation of Computer ProgramsTeach Yourself Scheme in Fixnum Days.

Bret Victor, beast of burden. How encryption works in your web browser. Labs. Become a Programmer, Motherfucker. If you don't know how to code, then you can learn even if you think you can't. Thousands of people have learned programming from these fine books: Learn Python The Hard Way Learn Ruby The Hard Way Learn Code The Hard Way I'm also working on a whole series of programming education books at learncodethehardway.org. These are works in progress, and feedback is welcome. Learn C The Hard Way Learn SQL The Hard Way Learn Regex The Hard Way Graphics Programming Language Agnostic NerdDinner Walkthrough Assembly Language Bash Clojure Clojure Programming ColdFusion CFML In 100 Minutes Delphi / Pascal Django Djangobook.com Erlang Learn You Some Erlang For Great Good Flex Getting started with Adobe Flex (PDF) Forth Git Grails Getting Start with Grails Haskell Java JavaScript JavaScript (Node.js specific) Latex The Not So Short Introduction to LATEX (perfect for beginners) Linux Advanced Linux Programming Lisp Lua Maven Mercurial Nemerle Nemerle NoSQL Oberon Programming in Oberon (PDF) Objective-C The Objective-C Programming Language OCaml Perl.

Your First Perl Program - Perl. And now that you've got Perl installed and configured, how about actually doing something with it? Use your favourite text editor to type the following lines of code: #! /usr/bin/perl # Perl 101 print ("Groovy, baby! \n"); Save this file as "groovy.pl". Next, you need to tell the system that the file is executable. . $ chmod +x groovy.pl And now run the script - in UNIX, try $ .

On a Windows system, you need to pass the name of the script to the Perl executable as a parameter, like this: > perl groovy.pl or In both cases, the script should return Austin Powers' trademark line. In case things don't work as they should, it usually means that the system was unable to locate the Perl binary. . #! Is used to indicate the location of the Perl binary. Next up, we have a comment. # Perl 101 Comments in Perl are preceded by a hash [#] mark. And finally, the meat of the script: print ("Groovy, baby! In Perl, a line of code like the one above is called a "statement" . #! Every Perl statement ends with a semi-colon. . #! Setting up Code::Blocks and MINGW, A Free C and C++ Compiler, on Windows.

By Thomas Carriero This tutorial gives you easy-to-follow instructions, with screenshots, for setting up a compiler (the MINGW compiler), a tool that will let you turn the code that you write into programs, and Code::Blocks, a free development environment for C and C++. This tutorial explains how to install Code::Blocks on Windows 2000, XP, Vista or Windows 7. Note: if you're running Linux, go here to learn how to use GCC; if you're on OS X, go here to get set up using Apple XCode.

Step 1: Download Code::Blocks Go to this website: Follow the link to "Download the binary release" (direct link) Go to the Windows 2000 / XP / Vista / 7 section Look for the file that includes mingw in the name. Step 2: Install Code::Blocks Double click the installer. Step 3: Running in Code::Blocks You will be prompted with a Compilers auto-detection window: When you get the compiler auto-detection window, just hit OK. The following window will come up: Troubleshooting. C programming.com - Learn C and C++ Programming.

The 50 Best Registry Hacks that Make Windows Better. We’re big fans of hacking the Windows Registry around here, and we’ve got one of the biggest collections of registry hacks you’ll find. Don’t believe us? Here’s a list of the top 50 registry hacks that we’ve covered. It’s important to note that you should never hack the registry if you don’t know what you’re doing, because your computer will light on fire and some squirrels may be injured.

Also, you should create a System Restore point before doing so. Otherwise, keep reading. Prevent Windows Update from Forcibly Rebooting Your Computer We’ve all been at our computer when the Windows Update dialog pops up and tells us to reboot our computer. There’s a couple of ways that we can disable this behavior, however. Prevent Windows Update from Forcibly Rebooting Your Computer How to Clean Up Your Messy Windows Context Menu One of the most irritating things about Windows is the context menu clutter that you have to deal with once you install a bunch of applications.

Disable Aero Shake in Windows 7. CSSDesk - Online CSS Sandbox. "Perl for Newbies" - Part 1 - The Perl Beginners' Site. Strings and data structures that are unlimited in size, nested to any depth. Powerful syntax and built-in functions. Extended, built-in support for regular expressions. Support for namespaces, classes, and objects. Functional Programming capabilities such as closures and continuations. CPAN - a comprehensive on-line archive of easily installable and re-usable modules.

Perl was introduced in 1987 (4 years before Linux itself), when the author, Larry Wall, released version 1.000 of it. Since then, perl has seen several versions, each adding additional functionality. perl version 5, which was released in 1994, was a complete re-write of the perl interpreter, and introduced such things as hard references, modules, objects and lexical scoping. Perl became especially popular as a language for writing server-side scripts for web-servers. Links: Perl is interpreted, so no compilation is needed. At the command line (and press Enter). The neophyte "Hello World! " and a ** b a . b a % b Example: Perl Basics In Pictures: Working with Numbers. The Basics of C Programming". The previous discussion becomes a little clearer if you understand how memory addresses work in a computer's hardware. If you have not read it already, now would be a good time to read How Bits and Bytes Work to fully understand bits, bytes and words.

All computers have memory, also known as RAM (random access memory). For example, your computer might have 16 or 32 or 64 megabytes of RAM installed right now. RAM holds the programs that your computer is currently running along with the data they are currently manipulating (their variables and data structures). Float f; This statement says, "Declare a location named f that can hold one floating point value. " While you think of the variable f, the computer thinks of a specific address in memory (for example, 248,440). F = 3.14; The compiler might translate that into, "Load the value 3.14 into memory location 248,440.

" There are, by the way, several interesting side effects to the way your computer treats memory. S:t 1:5 2:2 3:3 4:4 5:5 u = 5. How to be a Programmer: A Short, Comprehensive, and Personal Summary. Debugging is the cornerstone of being a programmer. The first meaning of the verb to debug is to remove errors, but the meaning that really matters is to see into the execution of a program by examining it. A programmer that cannot debug effectively is blind. Idealists that think design, or analysis, or complexity theory, or whatnot, are more fundamental are not working programmers. The working programmer does not live in an ideal world. Even if you are perfect, your are surrounded by and must interact with code written by major software companies, organizations like GNU, and your colleagues. Debugging is about the running of programs, not programs themselves. To get visibility into the execution of a program you must be able to execute the code and observe something about it.

The common ways of looking into the ‘innards’ of an executing program can be categorized as: Some beginners fear debugging when it requires modifying code. How to Debug by Splitting the Problem Space. Tutorial - Controlling The Real World With Computers. Binary - it's digitalicious! C++ Programming/Exercises/Iterations. Iterations[edit] Solutions requirements Solutions must: Use only standard C++.Be compilable.Be in accordance to general coding practices. (no esoteric demonstrations are required) and should: Handle error situations, even if behavior is not defined.

Please do not add solutions that are 99% similar to another that is already present, if it is an improvement just add it to the existing solution. EXERCISE 1[edit] Write a program that asks the user to type an integer and writes "YOU WIN" if the value is between 56 and 78 (both included). Int main() {int i; cout << "Type all numbers between 58 and 73: " << endl; cin>>i; if (i>=58 && i<=78) { cout << "YOU WIN" << i << endl; else cout<<"YOU LOSE!

" EXERCISE 2[edit] Write a program that asks the user to type all the integers between 8 and 23 (both included) using a for loop. Solution Alternative solution by Bartosz Radwanski Alternate solution Solution in C Another alternate solution Failed solutions (correct them as an extra exercise) EXERCISE 3[edit] Perl Programming.