إعلان

  • خيانة الفيس بوك لبيانات اعضاءها - نقاش وتحليل-- Traitor facbook
    الكثير ما نسمع عن التحذيرات من الفيس بوك وبعد عمليه طويله وفضائح انتشرت تبين ان البيانات يتم الوصول عليها عن طريق الاستخبارات الأوربية والإسرائيلية و أمريكيا

    وهل تعلمون تم الوصول عليها عربيه ؟؟؟؟؟؟؟؟؟


    في مصر أيام حركه الفيس بوك للشباب طالبت الاستخبارات المصرية إدارة الفيس بوك في استفسار عن بيانات عدت ناشطين وعن طريق الجهود السياسية وما سمي الانتر بول حصلوا على هذه البيانات


    وسبب هذا الشيء أيامها انزعاج كبير بعد فضح مجموعات عن هذه العملية من هكرز وغيرها

    واسقط الفيس بوك الذي لازم الجميع لم يبقى احد فينا ما سجل وسلم نفسه للموقع المزعوم

    كما أنا نفسي لدي حسابين للموقع ولي الشخصي وبإذن الله راح اغلق الشخصي عند تدشين خدمة بلاس من قوقل بشكل رسمي حيث أنها إلى الآن تجريبيه .

    السلطة السورية كنظيرتها المصرية طالبت في بيانات عدت صفحات ومرتاد ينها

    لاكن رفضت أدارة الفيس بوك هذا الطلب والسبب للرفض حللوه بعض متصدرين هذه الأخبار أن العيون كلها على الفيس بوك من مجموعات تهتم لحقوق الآنسان واخرى حقوقيه حتى الهكرز لم تسلم منهم

    وكتابتي لهذا الموضوع تحذير السياسيين من دمج الحسابات في أيميلك الشخصي اجعل أيميل خاص وشخصيه مختلفه ولا تربط بينهما ويفضل وحده في بروكسي والثانية من غير بروكسي أو حتى لو تفرق بينهم في المتصفحات مثل موزيلا وكروم وغيره

    والحذر واجب شيء مزعج أذا عرفت انك مباح ولا توجد سريه لديك.

    طبعا المصدر نحن بعد عدت دراسات ومتابعه أشخاص حقوقيه توصلنا لهذه النتيجة ولله الحمد والدراسة تمت في الخفاء
    وصح ينقص الموضوع المصدر واحب أوضخ المصدر هم مجموعة
    Anonymous

  • computing Laptops & Netbook PCs
    New Product

    HP 2000z series

    5.0 out of 5  5.0 out of 5 stars (1 reviews)
    For everyday tasks, this 15" (diagonal) laptop delivers classic style and great features at a budget-friendly price
    • Genuine Windows 7 Home Premium 64-bit
    • AMD Dual-Core C-50 (1.0GHz, 1MB L2 Cache) + AMD Radeon(TM) HD 6250M Discrete-Class Graphics
    • 2GB DDR3 System Memory (1 Dimm)
    • FREE Upgrade to 320GB 5400RPM Hard Drive
    • 802.11b/g/n WLAN
    • Up to 5.50 hours of battery life (6 cell)+++

  • Microsoft BlueHat Prize

    WHY ARE WE DOING THIS?

    The Microsoft BlueHat Prize contest is designed to generate new ideas for defensive approaches to support computer security. As part of our commitment to a more secure computing experience, we hope to inspire security researchers to develop innovative solutions intended to address serious security threats.
    bar

    WHAT IS THE CONTEST?

    The inaugural Microsoft BlueHat Prize contest challenges security researchers to design a novel runtime mitigation technology designed to prevent the exploitation of memory safety vulnerabilities. The solution considered to be the most innovative by the Microsoft BlueHat Prize board will be presented the grand prize of US $200,000. Important information:
    • Entries will be accepted and must be received by email to bluehatprize@microsoft.com between August 3, 2011 to midnight Pacific Time on April 1, 2012.
    • The winning entry will be announced at Black Hat USA 2012.
    • Submitters retain all rights to the intellectual property in the content they submit and Microsoft has the right to license that content.
    • For full details, see rules and regulations.
    bar

    YOU COULD WIN

    First prize: $200,000 (USD)
    Second prize: $50,000 (USD)
    Third prize: MSDN Universal subscription valued at $10,000 (USD)
    bar

    HOW TO ENTER?

    To enter, send an email to bluehatprize@microsoft.com
    include your technical description and prototype as outlined in the official rules.
    The Microsoft BlueHat Prize board will reply with additional information applicants will need to submit a complete entry

    http://www.microsoft.com/security/bluehatprize/.

  • Comment faire reduire le Ping dans Cs 1.6 ?

    Comment faire reduire le Ping dans Cs 1.6 ?

    Bonjour les Amis ! :P

    la , je vais vous informer , comment faire éliminer le problém d Ping dans Cs !

    1- Créer un Fichier Text  utilisant NOTEPAD !
    2- Ouvre le , et tapez les code ci-dessu !

    fps_max 100

    fps_modem 100
    cl_cmdrate 100
    cl_updaterate 100
    rate 15000

    3- enregitrez le fichier sous " ping.cfg " , dans le dossier "cstrike" !

    entrer dans le jeux , en ouvrant le console par " ² " , et tapez le code ci dessu !

    exec ping.cfg


    --------------
    et voila , c fini ! :D

  • Introduction à PHP

    Introduction à PHP

    PHP est un langage interprété (un langage de script) exécuté du côté serveur (comme les scripts CGI, ASP, ...) et non du côté client (un script écrit en Javascript ou une applet Java s'exécute sur votre ordinateur...). La syntaxe du langage provient de celles du langage C, du Perl et de Java. Ses principaux atouts sont :
    • Une grande communauté de développeurs partageant des centaines de milliers d'exemples de script PHP ;
    • La gratuité et la disponibilité du code source (PHP est distribué sous licence GNU GPL) ;
    • La simplicité d'écriture de scripts ;
    • La possibilité d'inclure le script PHP au sein d'une page HTML (contrairement aux scripts CGi, pour lesquels il faut écrire des lignes de code pour afficher chaque ligne en langage HTML) ;
    • La simplicité d'interfaçage avec des bases de données (de nombreux SGBD sont supportés, mais le plus utilisé avec ce langage est MySQL, un SGBD gratuit disponible sur de nombreuses plateformes : Unix, Linux, Windows, MacOs X, Solaris, etc...) ;
    • L'intégration au sein de nombreux serveurs web (Apache, Microsoft IIS, etc.).

  • APOCALYPSE !

    APOCALYPSE !


    L’Apocalypse est le dernier livre de la Bible. Une tradition, discutée depuis le iie siècle, attribue sa composition à saint Jean l'Évangéliste.
    Étymologiquement, le mot « apocalypse » est la transcription d’un terme grec (ἀποκάλυψις / apokalupsis) signifiant mise à nuenlèvement du voile ou révélation. Le livre commence en effet par les mots « Révélation de Jésus-Christ » (Ap 1,1). C'est en ce sens que le texte présentera la personne de Jésus-Christ à son retour sur terre et les événements l'entourant.
    Le livre décrit une vision allégorique qui prophétise sur ce qui doit arriver à la fin des Temps : « Écris donc ce que tu as vu, ce qui est, et ce qui doit arriver ensuite » (Apocalypse chapitre 1, verset 19).

  • La Langue C++

    La Langue C++

    Le C++ est un langage de programmation permettant la programmation sous de multiples paradigmes comme la programmation procédurale, la programmation orientée objet et la programmation générique. C++ est actuellement le 3e langage le plus utilisé au monde2. Le langage C++ n'appartient à personne et par conséquent n'importe qui peut l'utiliser sans besoin d'une autorisation ou obligation de payer pour avoir le droit d'utilisation.

  • A DELPHI PROGRAM LAUNCHPAD

    A DELPHI PROGRAM LAUNCHPAD


    A DELPHI PROGRAM LAUNCHPAD #1
    Sick of the Windows Start menu? Follow Huw Collingbourne’s directions to create an alternative application launchpad.
    Requirements: Borland's Delphi 7 or Delphi 2005 (tested); or earlier versions of Delphi (untested)
    Download The Source Code:
    lpad1.zip

    See also Part Two
    There are many times when you may need to find and run some external application from one of your programs. That’s easy to do. But what if you want to display the icons associated with programs, or documents, and launch them by clicking a button? This would give you the ability to create your own ‘program manager’ tool or, with a bit more effort, an alternative to the Windows Start Menu. This month I’ll show you the basic techniques you’ll need to do these tasks. In the months ahead, I shall be developing more powerful variations of this program to show you how you might create all kinds of other file handling applications.

    The finished launchpad is shown towards the top of the screen here. I have populated it with buttons simply by dragging programs and documents straight out of the Windows Explorer and dropping them onto the Launchpad itself. A new button is created for each item dropped and an appropriate icon is added automatically. Clicking a button launches the associated file. Here I have clicked a button for a JPeg graphic and the file is immediately loaded into the associated application - which, on my PC, happens to be the Microsoft Office Picture Manager
    Out To Launch
    First I’ll need to write some functions to return the paths to various important subdirectories. Open theFileInfo.dpr project (or FileInfo.bdsproj) and view the filestuff unit. My functions are simple Delphi wrappers around Windows API routines. By making use of these functions, any code will be able to avoid the need to declare variables such as the character arrays and the strings needed by the API functions. For example, this is my windir() function:
    function windir : string;
    var
      winpath : CHARARRAY;
    begin
        GetWindowsDirectory(winpath,MAX_PATH);
        result := winpath;
    end;
    It supplies the  character array variable, winpath, to the API’s GetWindowsDirectory(). The second argument defines the size of the directory buffer. Here, MAX_PATH is a constant in Windows.pas and it is currently defined to be 260. The winpath array of characters is assigned by theGetWindowsDirectory() function and it is returned by my windir() function as a string. If the Windows directory is \WINNT on the C:\ drive, the string returned by this function will be ‘C:\WINNT’.
    Directory Enquiries
    My currdir() function is similar, but uses the API’s GetCurrentDirectory() routine. This returns the path of the currently active subdirectory. When you run the program, you can change the current directory by clicking the ‘Browse’ button to open a file in another directory. Finally, my appdir() function returns the home directory of the FileInfo application itself. This function does not use an API routine. Instead it uses the Application object’s ExeName property to retrieve a fully qualified path to theFileInfo.exe program file. This might be, for example, ‘C:\Delphi\Test\FileInfo.exe’. It then removes the file name itself using Delphi’s ExtractFileDir() function, which returns‘C:\Delphi\Test\’.
    The ExecuteFile() function wraps up the complexities of the API’s ShellExecute() function which you will find documented in Delphi’s Windows SDK help system. It lets you run a program or launch a file into its associated application. This is the ShellExecute() function as documented in the help system:
    HINSTANCE ShellExecute(
        HWND hwnd,
        LPCTSTR lpOperation,
        LPCTSTR lpFile,
        LPCTSTR lpParameters,
        LPCTSTR lpDirectory,
        INT nShowCmd
       );
    Now compare this with the code of my ExecuteFile() function:
    Result :=
      ShellExecute(Application.MainForm.Handle, // hwnd
      nil,                                      // lpOperation
      StrPCopy(ntFileName, FileName),           // lpFile
      nil,                                      // lpParameters
      StrPCopy(ntDir,Dir),                      // lpDirectory
      LAUNCHSTYLE);                             // nShowCmd
    Note that the ShellExecute() function returns something called a HINSTANCE or ‘instance handle’. This is a 32-bit value that identifies a Windows resource. If this function succeeds, it returns a handle to the application that was run. The first argument to the function is the handle of the window that calls the function. In my code this will be the handle of the main form of the FileInfo program. You can use the MainForm property of Delphi’s Application object in order to access this handle:
    Application.MainForm.Handle
    The ShellExecute() function now takes four LPCTSTR arguments. These are pointers to null-terminated strings. A null-terminated string is equivalent to Delphi’s PChar data type or an array of chars. Notice that, in my ExecuteFile() function I declare two variables, ntFileName and ntDir of the type CHARARRAY. This is required since you can’t use Delphi’s native string type when calling Windows API functions. This is because API functions work with C-style null-terminated strings.
    null-terminated string is, in essence, an array of characters with a null character stuck on the end. This type of string is accessed by the address of the start of the array. The PChar (pointer to char) data type is equivalent in Delphi and you can also create a compatible data type as an array of char. This is how I have defined the CHARARRAY type:
        CHARARRAY = array[0..MAX_PATH] of char;
    You can convert ordinary Delphi strings to PChars using the StrPCopy() function. A string is passed as the second argument to StrPCopy(), a PChar variable is passed as the first argument. The StrPCopy() function returns a pointer to the PChar which is what we need for the LPCTSTR arguments in ShellExecute().
    The first of the four LPCTSTR arguments required by ShellExecute() is lpOperation. This points to a string that specifies the operation to perform and this can be “open”, “print”, “explore” or NULL (nil in Delphi). If it is NULL, then the default operation, to Open the file, is performed. This is why my code usesnil. Next, lpFile points to the file name. The lpParameters argument optionally specifies one or more parameters to be passed to the application. Again, I leave this as nil. Next lpDirectoryspecifies the default directory. Finally, the INT argument, nShowCmd, specifies how the application is shown when it is opened. The API defines numerous constants that can be used here to display the application in a normal, maximised or minimised window amongst other possibilities.
    To see how my ExecuteFile() function can be called, turn to the Fileinfo unit and locate theLaunchBtnClick() method. This contains this piece of code:
    ExecuteFile( FNAME, DIRNAME, LAUNCHSTYLE );
    Here, FNAME is defined at the top of the unit as 'Notepad.exe'. DIRNAME is assigned in theFormCreate() method as windir+'\' where windir is the name of my function, described earlier, which returns the path to the Windows directory. Finally, LAUNCHSTYLE is one of the possible pre-defined API constants: SW_SHOWMAXIMIZEDSW_SHOWMINIMIZED or SW_SHOW.
    Anything Icon Do
    Another thing we’ll want to do is to display the appropriate icon for each application or document on its launch button. The DrawIcon() procedure in the filestuff unit does this. This takes two arguments, the icon and the glyph. The Glyph is a bitmap and it will be supplied by a BitBtn control. The icon is a TIcon object. The size of the Glyph is defined to be a 32 pixel square and the Icon is displayed on the Glyph’s drawing area or Canvas, using the Draw() method.
    To see how to use the DrawIcon() procedure turn to the Fileinfo unit and find theTForm1.BitBtnClick() method. This obtains a TSHFileInfo record (which matches the SHFILEINFOstructure documented in the SDK help) by calling GetFileInfo() in the filestuff unit. It uses a combination of predefined constants to obtain the icon associated with the specified file. The available constants are listed in the SHGetFileInfo entry of the SDK help. An icon handle is obtained and this is passed, with the BitBtn’s glyph to my DrawIcon() procedure:
    fi := GetFileInfo(DIRNAME+FNAME, SHGFI_ICON or SHGFI_LARGEICON);
    Icon.Handle := fi.hIcon;
    DrawIcon( icon, BitBtn.glyph );
    Displaying Icons, Launching Files...

    Our FileInfo program demonstrates how to dispay the large or small icon of an application and launch it in a normal, maximized or minimized window. Notepad.exe is the default application...

    Use the Browse button to select a different application or document. Here I've checked the Small Icon box and clicked More Info to display information on the type of the file which is selected.
    Now let’s see how we can put some of these features to good effect in a real-world application - namely, a drag and drop launchpad. This contains a set of buttons that are used to run programs. Each button contains the name of the source file and an appropriate icon. The buttons can be created on the fly by dragging programs or documents out of the Windows Explorer and dropping them onto the launchpad. It also lets the user delete selected buttons.
    Parental Responsibilities
    Before explaining how it works, take time to try it out. Run the LPad.dpr (or LPad.bdsproj) program. A message will tell you that no configuration file was found. This is because this is the first time you have used the program so no configuration details have yet been saved to disk. Close the dialog.

    On launching, the launchpad is not much more than an empty form...
    Now let’s add some buttons. Open the Windows Explorer and browse to find some programs or documents to add. For example, you might find Notepad.exe in the Windows directory. Select it in the Explorer then drag it and drop it onto the launchpad. If the launchpad is not visible, drag onto its button in the Windows taskbar until the launchpad pops up, then drag onto the launchpad.

    Here I've found Notepad.exe in the Windows Explorer and dragged it right onto the launchpad with my mouse. This causes a new button to be added to the launchpad, displaying both the application's name and icon
    Carry on adding more application or document files. If you want you can even mark off several files at once in Explorer and drop them simultaneously onto the launchpad.

    Note that a scrollbar appears when there are more buttons than can be displayed all at once
    Each time you drop a file a button should appear containing the file name and an icon. To launch a file, click its button on the launchpad. To display information about a file, right-click its button and click ‘File Info’. To remove the launch button, right-click and selected ‘Delete’. To save an icon bar for later use, click File, Save Current IconBar. To clear the launchpad, select File, Clear All. To reload the saved bar, select File, Reload Saved IconBar. The saved configuration will be automatically loaded when you next run this application.

    Use the File menu to save the buttons and reload them later
    I won’t go into the inner details of the drag-and-drop mechanism here. If this is of interest, you can examine the code at your leisure. Look at TForm1.FormCreate () where I use the API functionDragAcceptFiles() and I delegate message-handling to my RespondToMessage() method. You will find the essential drop-handling code in RespondToMessage().
    At the moment, the line that interests us is the call to the AddBtn() method. Find that method now. As you can see this makes use of routines in my filestuff unit to get and draw the icon based on the filename argument that’s passed to the method. It creates a graphic TBitBtn button and adds it to a TStringList object called ButtonList (you will find this declared in the private section of the Form definition). This is the internal, non-visual structure, that maintains the list of buttons. To make the button visible on the form, I have to make the Form1 object its Parent:
    Parent := Form1;
    Now I need to delegate the button’s OnClick event-handling to a specific method so that each button is assigned this event-handler when it is created. I also want to assign a popup menu to each button. This is how I do this:
    OnClick := BtnClick;   
    PopupMenu := PopupMenu1;
    This covers all the techniques needed to create a drag-and-drop program (or document) launching tool. There is, of course, no reason why you should use such a plain user interface in your own programs. You might prefer, for example, to add program-launch icons to a menu system, similar to the Windows Start Menu or to a drop-down combo box. You could even create a nested windows system similar to the good old Program Manager from Windows 3.1. I’ll be considering some of these possibilities in the months ahead. Whichever user interface you choose, however, you are going to need to create controls, with their own OnClick event-handlers, on the fly. The essential details of this process are given below…

    Creating Controls At Runtime
    Simple techniques for adding, deleting and maintaining controls on the fly.
    In my launchpad application, I use a TStringList called ButtonList to maintain the list of TBitBtn objects. At first sight it might seem odd to use a TStringList for this purpose. If you look up its help entry you’ll see that a TStringList stores and manipulates a list of strings, not buttons! In fact, each item in a string list can also store a reference to an object of any type. The items in my ButtonList are pairs of strings and TBitBtn objects. The string is the fully qualified file name, the object is the button that will be used to run that file. So, in the AddBtn() method, this is how I add a new file name and TBitBtn to ButtonList:
    ButtonList.AddObject(fname, TBitBtn.Create(Self));
    Since the buttons are created anonymously, with no variables to identify them, I must subsequently access each by its index in ButtonList. The most recently added button is at positionButtonList.Count-1 and is referenced thus:
    TBitBtn(ButtonList.Objects[ButtonList.Count-1])
    I can iterate through all the objects from 0 to ButtonList.Count-1, using an array indexer into the Objects property. You will find an example of this in the SetLargeIcons() and SetSmallIcons()methods which apply large and small icons to each button:
    TBitBtn(ButtonList.Objects[i])
    When I use the popup menu, I need to know which of the buttons is currently active. For example, look at the DeleteMIClick() event-handler which responds to the Delete item of the popup menu. This method is executed for every button on the form. The Sender parameter is no help as this identifies the menu item, not the active button. In order to find which button the popup menu belongs to, I need to use the menu’s PopupComponent property like this:
    ButtonList.Delete(ButtonList.IndexOfObject(PopupMenu1.PopupComponent));
    Remember that this only deletes the button from the non-visual ButtonList object. You must always be sure to remove its visual display from the form by setting its Parent property to nil. If you forget to do this the button will still appear on a form and an error will occur if you click it.
    Creating Menus At Runtime
    You can also add items to a menu at runtime. Try this, for example. Create a new application (VCL Forms for Win32) and drop a PopupMenu onto the form. Use the Object Inspector to set the Form1 PopupMenu property to PopupMenu1.

    With the Form selected, use the Object Inspector to set the PopupMenu property to the popup menu control, PopupMenu1
    Now double-click the form and edit the FormCreate() method to match the following:
    procedure TForm1.FormCreate(Sender: TObject);
    var
      i : Integer;
      MI : TMenuItem;
    begin
      for i := 0 to 10 do
      begin
        MI := TMenuItem.Create(PopupMenu1);
        PopupMenu1.Items.Add(MI);
        MI.Caption := 'Menu Item ' + IntToStr(i);
        MI.Tag := i;
        MI.OnClick := PopupClick; // assign an event-handler method
      end;
    end;
    Note that if the references to menu items are underlined in red in the Delphi editor, you will need to add a refernce to the Menus unit in the uses section at the top of the file. Just add it at the end, like this:
    uses
       Windows, Messages, SysUtils, Variants, Classes, Graphics,
      Controls, Forms, Dialogs, Menus;

    Notice that each menu item has been assigned a method called PopupClick() as its OnClick event-handler. We need to define this method. Add this code just above TForm1.FormCreate():
    procedure TForm1.PopupClick(Sender: TObject);
    // the event-handler method we assigned to the menu items
    begin
      ShowMessage('Item: ' + IntToStr(TMenuItem(Sender).Tag));
    end;
    Finally, in the public section of the TForm1 type definition at the top of the unit, add this:
    procedure PopupClick(Sender: TObject);
    Now run the program, right-click the form and select a menu item. It’s as simple as that!

  • Introduction to programming languages

    Introduction to programming languages


    Todays computers are incredibly fast, and getting faster all the time. Yet with this speed comes some significant constraints. Computers only natively understand a very limited set of instructions, and must be told exactly what to do. The set of instructions that tells a computer what to do is known as software. The computer machinery that executes the instructions is the hardware.
    A computer’s CPU is incapable of speaking C++. The very limited set of instructions that a CPU natively understands is called machine code, ormachine language, or an instruction set. How these instructions are organized is beyond the scope of this introduction, but it is interesting to note two things. First, each instruction is composed of a number of binary digits, each of which can only be a 0 or a 1. These binary numbers are often called bits (short for binary digit). For example, the MIPS architecture instruction set always has instructions that are 32 bits long. Other architectures (such as the x86, which you are likely using) have instructions that can be a variable length.
    For example, here is a x86 machine language instruction: 10110000 01100001
    Second, each set of binary digits is translated by the CPU into an instruction that tells it to do a very specific job, such as compare these two numbers, or put this number in that memory location. Different types of CPUs will typically have different instruction sets, so instructions that would run on a Pentium 4 would not run on a Macintosh PowerPC based computer. Back when computers were first invented, programmers had to write programs directly in machine language, which was a very difficult and time consuming thing to do.
    Because machine language is so hard to program with, assembly language was invented. In an assembly language, each instruction is identified by a short name (rather than a set of bits), and variables can be identified by names rather than numbers. This makes them much easier to read and write. However, the CPU can not understand assembly language directly. Instead, it must be translated into machine language by using an assembler. Assembly languages tend to be very fast, and assembly is still used today when speed is critical. However, the reason assembly language is so fast is because assembly language is tailored to a particular CPU. Assembly programs written for one CPU will not run on another CPU. Furthermore, assembly languages still require a lot of instructions to do even simple tasks, and are not very human readable.
    Here is the same instruction as above in assembly language: mov al, 061h
    To address these concerns, high-level programming languages were developed. C, C++, Pascal, Ada, Java, Javascript, and Perl, are all high level languages. Programs written in high level languages must be translated into a form that the CPU can understand before they can be executed. There are two primary ways this is done: compiling and interpreting.
    A compiler is a program that reads code and produces a stand-alone executable that the CPU can understand directly. Once your code has been turned into an executable, you do not need the compiler to run the program. Although it may intuitively seem like high-level languages would be significantly less efficient than assembly languages, modern compilers do an excellent job of converting high-level languages into fast executables. Sometimes, they even do a better job than human coders can do in assembly language!
    Here is a simplified representation of the compiling process:
    Example of compiling
    An interpreter is a program that reads code and essentially compiles and executes (interprets) your program as it is run. One advantage of interpreters is that they are much easier to write than compilers, because they can be written in a high-level language themselves. However, they tend to be less efficient when running programs because the compiling needs to be done every time the program is run. Furthermore, the interpreter is needed every time the program is run.
    Here is a simplified representation of the interpretation process:
    Example of compiling
    Any language can be compiled or interpreted, however, traditionally languages like C, C++, and Pascal are compiled, whereas “scripting” languages like Perl and Javascript are interpreted. Some languages, like Java, use a mix of the two.
    High level languages have several desirable properties. First, high level languages are much easier to read and write.
    Here is the same instruction as above in C/C++: a = 97;
    Second, they require less instructions to perform the same task as lower level languages. In C++ you can do something like a = b * 2 + 5; in one line. In assembly language, this would take 5 or 6 different instructions.
    Third, you don’t have to concern yourself with details such as loading variables into CPU registers. The compiler or interpreter takes care of all those details for you.
    And fourth, they are portable to different architectures, with one major exception, which we will discuss in a moment.
    Example of portability
    The exception to portability is that many platforms, such as Microsoft Windows, contain platform-specific functions that you can use in your code. These can make it much easier to write a program for a specific platform, but at the expense of portability. In these tutorials, we will explicitly point out whenever we show you anything that is platform specific.

  • Introduction to C/C++

    Introduction to C/C++


    The C language was developed in 1972 by Dennis Richie at Bell Telephone laboratories, primarily as a systems programming language. That is, a language to write operating systems with. Richie’s primary goals were to produce a minimalistic language that was easy to compile, allowed efficient access to memory, produced efficient code, and did not need extensive run-time support. Despite being a fairly low-level high-level language, it was designed to encourage machine and platform independent programming.
    C ended up being so efficient and flexible that in 1973, Ritchie and Ken Thompson rewrote most of the UNIX operating system using C. Many previous operating systems had been written in assembly. Unlike assembly, which ties a program to a specific CPU, C’s excellent portability allowed UNIX to be recompiled on many different types of computers, speeding it’s adoption. C and Unix had their fortunes tied together, and C’s popularity was in part tied to the success of UNIX as an operating system.
    In 1978, Brian Kernighan and Dennis Ritchie published a book called “The C Programming Language”. This book, which was commonly known as K&R (after the author’s last names), provided an informal specification for the language and became a de facto standard. When maximum portability was needed, programmers would stick to the recommendations in K&R, because most compilers at the time were implemented to K&R standards.
    In 1983, the American National Standards Institute (ANSI) formed a committee to establish a formal standard for C. In 1989 (committees take forever to do anything), they finished, and released the C89 standard, more commonly known as ANSI C. In 1990 the International Organization for Standardization adopted ANSI C (with a few minor modifications). This version of C became known as C90. Compilers eventually became ANSI C/C90 compliant, and programs desiring maximum portability were coded to this standard.
    In 1999, the ANSI committee released a new version of C called C99. It adopted many features which had already made their way into compilers as extensions, or had been implemented in C++.
    C++ (pronounced see plus plus) was developed by Bjarne Stroustrup at Bell Labs as an extension to C, starting in 1979. C++ was ratified in 1998 by the ISO committee, and again in 2003. A new version of the standard, known as C++0x (implying it will come out before 2010) is being developed as this is written.
    The underlying design philosophy of C and C++ can be summed up as “trust the programmer” — which is both wonderful, because the compiler will not stand in your way if you try to do something unorthodox that makes sense, but also dangerous, because the compiler will not stand in your way if you try to do something that could produce unexpected results. That is one of the primary reasons why knowing how NOT to code C/C++ is important — because there are quite a few pitfalls that new programmers are likely to fall into if caught unaware.
    C++ adds many new features to the C language, and is perhaps best thought of as a superset of C, though this is not strictly true as C99 introduced a few features that do not exist in C++. C++’s claim to fame results primarily from the fact that it is an object-oriented language. As for what an object is and how it differs from traditional programming methods, well, we’ll cover that in just a few sections.

  • Structure of a program

    Structure of a program


    A computer program is a sequence of instructions that tell the computer what to do.
    Statements and expressions
    The most common type of instruction in a program is the statement. A statement in C++ is the smallest independent unit in the language. In human language, it is analogous to a sentence. We write sentences in order to convey an idea. In C++, we write statements in order to convey to the compiler that we want to perform a task. Statements in C++ are terminated by a semicolon.
    There are many different kinds of statements in C++. The following are some of the most common types of simple statements:
    1int x;
    2x = 5;
    3cout << x;
    int x is a declaration statement. It tells the compiler that x is a variable. All variables in a program must be declared before they are used. We will talk more about variables shortly.
    x = 5 is an assignment statement. It assigns a value (5) to a variable (x).
    cout << x; is an output statement. It outputs the value of x (which we set to 5 in the previous statement) to the screen.
    The compiler is also capable of resolving expressions. An expression is an mathematical entity that evaluates to a value. For example, in math, the expression 2+3 evaluates to the value 5. Expressions can involve values (such as 2), variables (such as x), operators (such as +) and functions (which return an output value based on some input value). They can be singular (such as 2, or x), or compound (such as 2+3, 2+x, x+y, or (2+x)*(y-3)).
    For example, the statement x = 2 + 3; is a valid assignment statement. The expression 2+3 evaluates to the value of 5. This value of 5 is then assigned to x.
    Functions
    In C++, statements are typically grouped into units called functions. A functionis a collection of statements that executes sequentially. Every C++ program must contain a special function called main(). When the C++ program is run, execution starts with the first statement inside of main(). Functions are typically written to do a very specific job. For example, a function named Max() might contain statements that figures out which of two numbers is larger. A function named CalculateGrade() might calculate a student’s grade. We will talk more about functions later.
    Libraries
    Libraries are groups of functions that have been “packaged up” for reuse in many different programs. The core C++ language is actually very small and minimalistic — however, C++ comes with a bunch of libraries, known as the C++ standard libraries, that provide programmers with lots of extra functionality. For example, the iostream library contains functions for doing input and output. During the link stage of the compilation process, the libraries from the C++ standard library are the runtime support libraries that are linked into the program (this will be discussed further in lesson 1.4).
    Taking a look at a sample program
    Now that you have a brief understanding of what statements, functions, and libraries are, let’s look at a simple hello world program.
    Consider our hello world program:
    1#include <iostream>
    2 
    3int main()
    4{
    5   using namespace std;
    6   cout << "Hello world!" << endl;
    7   return 0;
    8}
    Line 1 is a special type of statement called a preprocessor directive. Preprocessor directives tell the compiler to perform a special task. In this case, we are telling the compiler that we would like to use the iostream library. The iostream library contains code that tells the compiler what cout and endl do. In other words, we need to include the iostream library in order to write to the screen.
    Line 3 declares the main() function, which as you learned above, is mandatory. Every program must have a main() function.
    Lines 4 and 8 tell the compiler which lines are part of the main function. Everything between the opening curly brace on line 4 and the closing curly brace on line 8 is considered part of the main() function.
    Line 5 is our first statement (you can tell it’s a statement because it ends with a semicolon). As you learned in the explanation for line 1, cout and endl live inside the iostream library. However, within iostream, they live inside a special compartment named std (short for standard). This using statement tells the compiler to look inside a compartment named std if it can’t find cout or endl defined anywhere else. In other words, this statement is also necessary so the compiler can find cout and endl, which we use on line 6.
    Line 6 is our output statement. Cout is a special object that represents the console/screen. The << symbol is an operator (much like + is an operator) called the output operator. Cout understands that anything sent to it via the << operator should be printed on the screen. Endl is a special symbol that moves the cursor to the next line.
    Line 7 is a new type of statement, called a return statement. When an executable program finishes running, it sends a value to the operating system that indicates whether it was run successfully or not. The return value of main() is used for this purpose. This particular return statement returns the value of 0 to the operating system, which means “everything went okay!”. Non-zero numbers are typically used to indicate that something went wrong, and the program had to abort. We will discuss return statements in more detail when we discuss functions.
    Conclusion
    All of the programs we write will follow this template, or a variation on it. We will discuss each of the lines above in more detail in the upcoming sections.

افتتاحية

صورة اليوم