NASM, or The Netwide Assembler, is an x86 compiler that allows us to turn Assembly code in to machine code object files. Once we have an object file, we can link it and create the final executable. This example is meant for Unix systems or Windows with MinGW toolchain installed. On Debian systems, it can be installed with the nasm package. Put the code below in to hello.asm
Scala programs can accept run-time variables as command line arguments. Here is an example of how to access the variables.
Scala provides some of its own libraries for IO, but we can also make use of the Java library. The example of reading a file uses Scala's IO package, but the file writing example uses the Java IO package.
Scala is a an object oriented functional language built on top of the Java Virtual Machine. (JVM). Because it is an extension of Java, you still have everything available to you as you normally would in Java. Check out this Hello World example.
Control structures like if/else statements, for loops, and switch cases are vital to writing program logic. These code snippets will serve as easy references for these control structures when writing with the Tcl programming language
There are many situations where it is useful to ask the user for some information while a program is running. Tcl makes this a breeze. Check out these code snippets that demonstrate how to interact with the user and manipulate input.
Tcl programs can accept command line arguments to pass runtime variables. These code examples show how to make use of these arguments.
Tcl provides an easy way to open and read the lines of a file. Check out these code snippets that demonstrate how to read and write files with Tcl programming language.
Tcl is a language similar Bash because every line is a command and it can be scripted similar to shell scripts. Tcl can be used by itself but it typically embedded inside larger applications. Tcl with Tk toolkit allows you to create GUI applications. Once nice thing about Tcl/Tk is that it is widely available and works on multiple platforms. It does not create the nicest looking GUIs because it does not use native windows, but they are effective. Let's look at the most basic Hello World program. Let's name it hello.tcl.
Writing a Chrome extension is incredibly easy! You don't need any special tools either, just a text editor and Chrome. Create a folder and make a manifest.json and an index.html file. Fill them in with the information below and you are ready to go!
It is possible to write GTK2 application using PHP. It is a little work to get it compiled and installed, but once configured it is easy to write programs with GTK2. As of June 22, 2015 a development branch has been created for GTK3. Follow these installation instructions first. Then try out the code samples below. Load the php-gtk2 module in your php.ini as well.
PHP Simple HTML DOM is a one-file library that lets you traverse the elements of an HTML and search for specific elements. The examples below show how to use this library. To learn how to crawl (or spider) websites in order to get many pages to process see this post on How to Crawl Web Pages with PHP
Uwe Hunfeld provides an object oriented library called PHPCrawl available at http://phpcrawl.cuab.de. This class can be used to crawl web pages with many different parameters. It also allows you to process each page and do what manipulation or scraping you need to do. You accomplish this by overriding the base class and implementing your own functionality in the handleDocumentInfo() and handleHeaderInfo() functions. Use the code below as an example of how to create your own web crawler. If you want to learn how to parse the HTML DOM and extract things like links and headings, check out the post on How to Parse HTML DOM with PHP.
PHP/TK implements object oriented bindings for TCL/TK that can be used to create GUI applications. It only works on Unix systems. PHP must be configured to allow dynamic linking with enable_dl = On in the php.ini. The shared object file (tk.so) can be downloaded manually from PECL. The shared object file goes inside your php modules folder which is typically something like /usr/lib/php/modules. Look for the folder with other .so files or refer to your particular distribution documentation.
SQLite is a relational database that stores data in memory or in a single portable file. These code snippets demonstrate how to use SQLite with PHP. One thing to note about exec verus query: the first executes a result-less query, and the latter performs a query that returns results. It is better to use a prepared statement than a query though. It is easier, safer, and will use less memory.
This code will allow you to tail a file in PHP. It is cheating a little bit though because it is actually making a system call to tail, so you have to have tail installed. It is meant for Linux machines not Windows.
cURL is a great library for transferring data over a number of network protocols. Unfortunately, it can be a little overwhelming to use for the first time in PHP and there are lots of options available. Here is an easy reference for using cURL in PHP.
In PHP, all command line arguments, including the script name itself are stored in a special array named $argv. The first element, zero, is the name of the script being run. For example:
SSL sockets are perfect for sending secure data. With certificates, you can verify the identify of the host, the client, or both. Signed certificates cost money but you can create and self-sign a certificate. Check out the code samples below to see how to generate SSL certificates and create SSL clients and servers. Examples include raw socket communication as well as the common HTTPS protocol.