How to create a temporary file to store data

Print Friendly, PDF & Email

Your application has to write data out in a temporary file to reprocess them before rendering to users. The file will be created temporarily and swept our when the application…

Fastest way to get the first n elements of a List or an Array

Print Friendly, PDF & Email

Which is the fastest way to get the first n elements of a List or an Array? Let’s give a context where we want to extract some first elements from…

Checking existence of an element in an array with JavaScript

Print Friendly, PDF & Email

JavaScript is a loosely typed or a dynamic language. Variables in JavaScript are not directly associated with any particular value type, and any variable can be assigned (and reassigned) values…

How to find the mime type of a file in Python

Print Friendly, PDF & Email

A media type (also known as a Multipurpose Internet Mail Extensions or MIME type) is a standard that indicates the nature and format of a document, file, or assortment of bytes. It is defined…

Read and write with file CSV in Python

Print Friendly, PDF & Email

[dropcap]I[/dropcap]t is possible to read and write CSV (comma separated values) files using Python 2.4 Distribution. Like most languages, file operations can be done with Python. Writing a CSV file with Python can be…

How to loop a dictionary in Python

Print Friendly, PDF & Email

Dictionary is one of the most widely used data structures in programming, especially with Python. To understand how to loop on it, extract its keys as well as retrieve all…

ArrayList in Java

Print Friendly, PDF & Email

ArrayList class implements List interface and it is based on Array data structure. It is widely used because of the functionality and flexibility that it offers. Most of the developers…

How to implement an array with string index

Print Friendly, PDF & Email

I had shown you how to implement an array with string based index in Python programming language in the previous post. In this post, I will explain the same problem…

Array, List, etc. with String Indices

Print Friendly, PDF & Email

(Tiếng Việt) Trong lập trình, chúng ta cũng hay gặp nhiều trường hợp phải tạo một danh mục mà index của nó là các chuỗi kí tự. Có một khái niệm để mô tả loại đối tượng này, thường gọi là HashMap hay HashTable.

Counting how many times each string appears in a list

Print Friendly, PDF & Email

To count how many times a word appearing in a list of words, we can do as follows: