Home » Search results for 'javascript array'

Converting Variable Types in Python, Howto, With Examples

Python Type Conversion

This article will show you how to use Python’s built-in variable conversion functions, with examples. A variable’s type determines what kind of data it can store and what can be done with it. For example, string typed variables contain sequences of characters that can be joined and split (think words and sentences). In contrast, numeric typed variables contain numeric values intended to be used in calculations. Being able to convert a variable’s type allows data to be used in different ways. Converting a Variable to a … Read more

Home » Search results for 'javascript array'

Linked Lists in Python – How to Use Them, With Examples

Python Linked Lists

This article will explain in simple terms what linked lists are, why they’re useful, and how to use them in the Python programming language. Lists In Python, a list is an array of data – a simple list of values where each item has a value and a position in the list. Lists are indexed (so the positions start counting at position 0, not 1). For more information on lists in Python, check out these LinuxScrew articles: Python List ‘sort()’ Method – Sorting Lists in Python Easily … Read more

Home » Search results for 'javascript array'

Using the Python ‘accumulate()’ Function to Aggregate Data, With Examples

Python accumulate()

This article will detail how to use the ‘accumulate()’ function in Python and provide some easy-to-follow example code. The accumulate() function in Python will process an iterable (iterables are things like lists, dictionaries, sets, or tuples – collections containing items which can be looped over) – returning the accumulated sum of the value of each item or running a given function on each item. The value of the accumulated value is stored for each step and returned with the result. The syntax and code in this article are written for … Read more

Home » Search results for 'javascript array'

PHP var_dump() Function [With Examples]

PHP var dump Function

The PHP programming language includes various built-in variable types and allows you to create your own complex object classes. Third-party packages also come with their own object classes. So it’s useful to find out what type of variable a variable is, its value, and the type/value of any properties or values the variable may contain. The PHP var_dump() function returns a given variable or value’s properties, including the value and type. It works through the variable’s properties or value recursively doing the same. Read on to learn … Read more

Categories PHP

Home » Search results for 'javascript array'

Python range Function – How to Use It [With Examples]

Python range Function

The Python range() function returns an immutable sequence of integers between a given start and endpoint, incrementing by a given amount. Python range Syntax Here’s the syntax for the Python range() function: range(start, stop, step) Note that: start is the integer to start incrementing from – it will be included in the range If it is not supplied, it will be assumed to be 0 stop is the integer to end the range at – it will NOT be included in the range – the range will end before the stop value If start and stop are the same, an empty … Read more

Home » Search results for 'javascript array'

Bash For Loop [With Examples]

Bash For Loop

The for loop is a handy tool when writing Bash scripts for repeating a task for a number of files, records, or other values. The for statement will iterate over a list of values, performing tasks on each one until all items have been processed. Usage cases include looping over the files in a directory, the lines in a text file, or the output of a database query. Bash For Loop Syntax for VARIABLE in LIST do COMMANDS done Where: VARIABLE is the variable name that will … Read more

Home » Search results for 'javascript array'

How To Remove Items From A List in Python (With Examples)

python remove items from list

Python is widely used for both scripting and automation on Linux, as well as building web and standalone applications. Python is designed to be easy to learn, easy to write, and easy to read. It’s a great multi-purpose programming language. Python has several different types of arrays for storing data. Lists are arrays which allow you to store items. Items in lists can be altered, and are stored in a specific order. Syntax and Examples There are several methods you can use to remove an … Read more

Home » Search results for 'javascript array'

Tiny bash scripts: check Internet connection availability

Sometimes it is necessary to check whether server you want to run some big bash script is connected to Internet. Usually it makes sense while running scripts periodically using cron.  Below is the tiny bash script for this purpose: #!/bin/bash WGET=”/usr/bin/wget” $WGET -q –tries=10 –timeout=5 http://www.google.com -O /tmp/index.google &> /dev/null if [ ! -s /tmp/index.google ];then echo “no” else echo “yes” fi As you see it tries to download google’s index page, if it’s not empty script returns “yes”, if there is not Internet connection … Read more

Home » Search results for 'javascript array'

Fun: Linux, Unix, Windows, OS X and DOS airlines

What would be if below mentioned operating systems ran airlines? Different operating systems. Different styles. This humorous analogy, applying operating system philosophies as if they were airlines, is a long-standing much-circulated amusing story!

Categories Fun

Home » Search results for 'javascript array'

How to create custom linux ISO image?

It’s rather trivial task to make some changes into already burned installation or live CD. It may be performed to add some files to this CD or edit files on it. In any case it’s impossible to loop mount .iso file and then save it as iso9660 filesystem is read-only. So, just mount your CD or iso image to some directory by commands: sudo mkdir /mnt/image sudo mount /dev/cdrom /mnt/image or sudo mount /path/to/your.iso /mnt/image -o loop then copy it’s contents to some directory: mkdir … Read more