Archive

Archive for January, 2013

Adaptor TQFP100 pentru PIC24FJ256DA210

January 31st, 2013 1 comment

Adaptor TQFP100 pentru PIC24FJ256DA210

A QFP or Quad Flat Package is a surface mount integrated circuit package with “gull wing” leads extending from each of the four sides.[1] Socketing such packages is rare and through-hole mounting is not possible. Versions ranging from 32 to 304 pins with a pitch ranging from 0.4 to 1.0 mm are common. Other special variants include low profile QFP and thin QFP.[2]

The QFP component package type became common in Europe and United States during the early nineties, even though it has been used in Japanese consumer electronics since the seventies. It is often mixed with hole mounted, and sometimes socketed, components on the same printed circuit board.

A package related to QFP is PLCC which is similar but has pins with larger pitch, 1.27 mm (or 1/20 inch), curved up underneath a thicker body to simplify socketing (soldering is also possible). It is commonly used for NOR Flash memories and other programmable components.

footprint PIC24FJ256DA210

footprint pentru LTQFP PIC24FJ256DA210

John Conway’s Game of Life for Arduino GLCD

January 27th, 2013 No comments

John Conway’s Game of Life for Arduino GLCD

The Game of Life, also known simply as Life, is a cellular automaton devised by the British mathematician John Horton Conway in 1970.[1]

The “game” is a zero-player game, meaning that its evolution is determined by its initial state, requiring no further input. One interacts with the Game of Life by creating an initial configuration and observing how it evolves.

John Conway’s Game of Life for Arduino GLCD

Codul sursa pentru arduino (atmega328):

CODE John Conway’s Game of Life for Arduino GLCD

A single Gosper's Glider Gun creating "gliders"

A single Gosper’s Glider Gun creating “gliders”

Rules:

The universe of the Game of Life is an infinite two-dimensional orthogonal grid of square cells, each of which is in one of two possible states, alive or dead. Every cell interacts with its eight neighbours, which are the cells that are horizontally, vertically, or diagonally adjacent. At each step in time, the following transitions occur:

  1. Any live cell with fewer than two live neighbours dies, as if caused by under-population.
  2. Any live cell with two or three live neighbours lives on to the next generation.
  3. Any live cell with more than three live neighbours dies, as if by overcrowding.
  4. Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction.

The initial pattern constitutes the seed of the system. The first generation is created by applying the above rules simultaneously to every cell in the seed—births and deaths occur simultaneously, and the discrete moment at which this happens is sometimes called a tick (in other words, each generation is a pure function of the preceding one). The rules continue to be applied repeatedly to create further generations.

Origins

Conway was interested in a problem presented in the 1940s by mathematician John von Neumann, who attempted to find a hypothetical machine that could build copies of itself and succeeded when he found a mathematical model for such a machine with very complicated rules on a rectangular grid. The Game of Life emerged as Conway’s successful attempt to drastically simplify von Neumann’s ideas. The game made its first public appearance in the October 1970 issue of Scientific American, in Martin Gardner‘s “Mathematical Games” column. From a theoretical point of view, it is interesting because it has the power of a universal Turing machine: that is, anything that can be computed algorithmically can be computed within Conway’s Game of Life.[2][3] Gardner wrote:

The game made Conway instantly famous, but it also opened up a whole new field of mathematical research, the field of cellular automata … Because of Life’s analogies with the rise, fall and alterations of a society of living organisms, it belongs to a growing class of what are called “simulation games” (games that resemble real life processes).

Ever since its publication, Conway’s Game of Life has attracted much interest, because of the surprising ways in which the patterns can evolve. Life provides an example of emergence and self-organization. It is interesting for computer scientists, physicists, biologists, biochemists, economists, mathematicians, philosophers, generative scientists and others to observe the way that complex patterns can emerge from the implementation of very simple rules. The game can also serve as a didactic analogy, used to convey the somewhat counter-intuitive notion that “design” and “organization” can spontaneously emerge in the absence of a designer. For example, philosopher and cognitive scientist Daniel Dennett has used the analogue of Conway’s Life “universe” extensively to illustrate the possible evolution of complex philosophical constructs, such as consciousness and free will, from the relatively simple set of deterministic physical laws governing our own universe.[4][5][6]

The popularity of Conway’s Game of Life was helped by its coming into being just in time for a new generation of inexpensive minicomputers which were being released into the market. The game could be run for hours on these machines, which would otherwise have remained unused at night. In this respect, it foreshadowed the later popularity of computer-generated fractals. For many, Life was simply a programming challenge; a fun way to use otherwise wasted CPU cycles. For some, however, Life had more philosophical connotations. It developed a cult following through the 1970s and beyond; current developments have gone so far as to create theoretic emulations of computer systems within the confines of a Life board.[7][8]

Conway chose his rules carefully, after considerable experimentation, to meet these criteria:

  1. There should be no explosive growth.
  2. There should exist small initial patterns with chaotic, unpredictable outcomes.
  3. There should be potential for von Neumann universal constructors.
  4. The rules should be as simple as possible, whilst adhering to the above constraints.[9]

“Warning: Missing argument 2 for wpdb”

January 6th, 2013 No comments

“Warning: Missing argument 2 for wpdb”

Dupa ce am facut update-ul la Wordpres 3.5 m-am trezit cu o eroare in footer-ul blogului (footer.php) ce returna urmatorul mesaj:

Warning: Missing argument 2 for wpdb::prepare(), called in /wp-content/themes/inove/footer.php on line 50 and defined in /wp-includes/wp-db.php on line 990

Dupa cateva minute de cautari am gasit o solutia, pe care am adaptat-o, si fost aceea de a inlocui linia 50 din footer.php (/wp-content/themes/inove/footer.php):

$post_datetimes = $wpdb->get_row($wpdb->prepare(“SELECT YEAR(min(post_date_gmt)) AS firstyear, YEAR(max(post_date_gmt)) AS lastyear FROM $wpdb->posts WHERE post_date_gmt > 1970”));

cu urmatoarea linie:

$post_datetimes = $wpdb->get_row($wpdb->prepare(“SELECT YEAR(min(post_date_gmt)) AS firstyear, YEAR(max(post_date_gmt)) AS lastyear FROM $wpdb->posts WHERE post_date_gmt > %d”, ‘1970’));

Thanks: http://mintthemes.com/wordpress-3-5-and-wpdb-prepare/