
Ten Tips for New Raspberry Pi Owners Merry Christmas, makers! We’re guessing a lot of you found Raspberry Pis under the tree this morning and are eager to start hacking around with it. Getting Started with Raspberry Pi, which I co-authored with Shawn Wallace, will be shipping very soon and is available for pre-order now. In the meantime, we’ve compiled a list of a few of our favorite quick tips that may come in handy as you explore the platform. Some of these might be old hat to experienced Linux users, but who knows, you might also learn something new. Command line completion You don’t have to laboriously type out long paths, filenames, and commands. Command history Bash also keeps a history of the commands you type. Jumping to the beginning or end of a command If you want to jump to the beginning of a command you’ve typed (for instance, if you’ve miskeyed something), type Control-A. Switch screens with ALT+[F1 though F6] keys When you’re not in the graphical desktop environment, you can still multitask. sudo !! Related
RPi VerifiedPeripherals Back to the Hub. Hardware & Peripherals: Hardware and Hardware History. Low-level Peripherals and Expansion Boards. Screens, Cases and Other Peripherals. A note about this page: For USB devices, please specify if they required a powered hub Notes 19-Apr-2012: Now that the Model B board is shipping, details added should relate to this board and the default Debian distribution unless stated otherwise. (A) - Relates to model A production board (B) - Relates to model B production board (!) Discuss: If you are adding to a product list it would help clarity if entries are kept/added in alphabetical order. Power Usage Notes Model B Hardware Revisions and USB Power limitsHardware Revision 1.0 The original Model B board had current limiting polyfuses which limited the power output of each USB port to approximately 100 mA. Linux Driver Issues Powered USB Hubs This section has been moved to a separate page. USB Remotes USB Keyboards USB Mouse devices USB Real Time Clocks
Understanding C by learning assembly Last time, Alan showed how to use GDB as a tool to learn C. Today I want to go one step further and use GDB to help us understand assembly as well. Abstraction layers are great tools for building things, but they can sometimes get in the way of learning. My goal in this post is to convince you that in order to rigorously understand C, we must also understand the assembly that our C compiler generates. I'll do this by showing you how to disassemble and read a simple program with GDB, and then we'll use GDB and our knowledge of assembly to understand how static local variables work in C. Note: All the code in this post was compiled on an x86_64 CPU running Mac OS X 10.8.1 using Clang 4.0 with optimizations disabled (-O0*) Learning assembly with GDB Let's start by disassembling a program with GDB and learning how to read the output. int main() { int a = 5; int b = a + 6; return 0; } Now compile it with debugging symbols and no optimizations and then run GDB: Registers Back to the code Conclusion
A dozen things to do with a Raspberry Pi In a world of polished computers, the Raspberry Pi has arrived to remind us that, with nothing more than time, patience and an exposed circuit board, you can create almost anything. Here are a few of the projects RPi pioneers have devised over the past year. You will need an RPi and SD card, a self-assembly Nixie Clock kit (or digital clock capable of accepting GPS or microcontroller data), a Wi-Fi dongle or ethernet cable. Nixie tube clocks, with their neon digits, are popular with nostalgic electronics fans. One such enthusiast, Martin Oldfield, has built a clock that receives Network Time Protocol data from the internet via the RPi, and is accurate to ten-thousandths of a second. Difficulty: 4 Robots are a talking point across the RPi forums. Difficulty 8-10 You will need an RPi and SD card, a home weather-station, a monitor and a USB cable. Difficulty 3 You will need an RPi and SD card, a powered USB hub, a USB rocket launcher. Difficulty 4 Difficulty 2-7 Difficulty 7 Difficulty 6
About Raspbmc is a minimal Linux distribution based on Debian that brings XBMC to your Raspberry Pi. This device has an excellent form factor and enough power to handle media playback, making it an ideal component in a low HTPC setup, yet delivering the same XBMC experience that can be enjoyed on much more costly platforms. Raspbmc is brought to you by the developer of the Crystalbuntu Linux Distribution, which brings XBMC and 1080p decoding to the 1st generation Apple TV. Here’s why you might like Raspbmc: Free and open source.Supports both wired and WiFi out of the box! Here’s some more ‘advanced’ features: 1080p DTS decoding in software.USB sound card supportCan be installed to SD card, USB drive, or run off an NFS share.Wake on LAN support for remote systemsHas the following services embedded: Samba serverTVHeadend serverFTP serverSSH serversabNZBD serverSecure out of the box – iptables restricts network to LAN only by default.HTML 5 web browser
Learning C with GDB Coming from a background in higher-level languages like Ruby, Scheme, or Haskell, learning C can be challenging. In addition to having to wrestle with C's lower-level features like manual memory management and pointers, you have to make do without a REPL. Once you get used to exploratory programming in a REPL, having to deal with the write-compile-run loop is a bit of a bummer. It occurred to me recently that I could use gdb as a pseudo-REPL for C. I've been experimenting with using gdb as a tool for learning C, rather than merely debugging C, and it's a lot of fun. My goal in this post is to show you that gdb is a great tool for learning C. An introduction to gdb Start by creating the following little C program, minimal.c: int main() { int i = 1337; return 0; } Note that the program does nothing and has not a single printf statement. Compile it with the -g flag so that gdb has debug information to work with, and then feed it to gdb: $ gcc -g minimal.c -o minimal $ gdb minimal Amazing!
Quick start guide What you will need Required SD CardWe recommend an 8GB class 4 SD card – ideally preinstalled with NOOBS. Not essential but helpful to have Internet connectionTo update or download software, we recommend that you connect your Raspberry Pi to the internet either via and ethernet cable or a wifi adapter.HeadphonesHeadphones or earphones with a 3.5mm jack will work with your Raspberry Pi. Plugging in your Raspberry Pi Before you plug anything into your Raspberry Pi, make sure that you have all the equipment listed above to hand. Begin by slotting your SD card into the SD card slot on the Raspberry Pi, which will only fit one way.Next, plug in your USB keyboard and Mouse into the USB slots on the Raspberry Pi.Make sure that your monitor or TV is turned on, and that you have selected the right input (e.g. Logging into your Raspberry Pi Once your Raspberry Pi has completed the boot process, a login prompt will appear. Read more in our documentation.
Online Python Tutor - Learn programming by visualizing code execution Binary Trees by Nick Parlante This article introduces the basic concepts of binary trees, and then works through a series of practice problems with solution code in C/C++ and Java. Binary trees have an elegant recursive pointer structure, so they are a good way to learn recursive pointer algorithms. Contents Section 1. Stanford CS Education Library -- #110 This is article #110 in the Stanford CS Education Library. Related CSLibrary Articles Linked List Problems ( -- a large collection of linked list problems using various pointer techniques (while this binary tree article concentrates on recursion) Pointer and Memory ( -- basic concepts of pointers and memory The Great Tree-List Problem ( -- a great pointer recursion problem that uses both trees and lists Section 1 -- Introduction To Binary Trees Binary Search Tree Niche Basically, binary search trees are fast at insert and lookup. Strategy Lookup() 1.
The “static” Keyword in Java Class Variable vs Instance Variable “static” Keyword = Class Variables Variables can be declared with the “static” keyword. Example: static int y = 0; When a variable is declared with the keyword “static”, its called a “class variable”. No “static” Keyword = Instance Variables Without the “static” keyword, it's called “instance variable”, and each instance of the class has its own copy of the variable. In the following code, the class “T2” has two variables x and y. class T2 { int x = 0; static int y = 0; void setX (int n) { x = n;} void setY (int n) { y = n;} int getX () { return x;} int getY () { return y;} } class T1 { public static void main(String[] arg) { T2 b1 = new T2(); T2 b2 = new T2(); b1.setX(9); b2.setX(10); System.out.println( b1.getX() ); System.out.println( b2.getX() ); System.out.println( T2.y ); T2.y = 7; System.out.println( T2.y ); b1.setY(T2.y+1); System.out.println( b1.getY() ); } } Instance Method vs Class Methods Methods can also be declared with the keyword “static”.
Exotic Data Structures A few basic data structures: Dynamic arrays Linked lists Unordered maps Ordered maps Ordered maps (over finite keys) Fully persistent ordered maps Fully persistent ordered sets Heaps 1. An indexable deque which is optimal in space and time [1]. This is simply a O(sqrtN) array of O(sqrtN) sub-arrays. Two lists of arrays are maintained, small and big (twice bigger) Also, pointers to head/tail indexes, and the big/small separation are maintained. Conceptually, the virtual array is the concatenation of all small sub-arrays followed by the big sub-arrays, and indexed between head/tail. All operations are straightforward. Asymptotic complexity: O(1) worst case queries (get/set) O(1) amortized, O(sqrtN) worst case update (push/pop) at both ends N + O(sqrtN) records of space Variant: Compact integer arrays This is implemented by growing the integer range of sub-arrays dynamically when an update overflows. 2. Monolithic lists Succinct lists Thus at least lg(N!) 3. 4. B+ trees Adaptive packed memory arrays
Leasing a Car Overview" Some of the sweetest car lease deals have dried up -- especially since automakers began offering zero-percent and low-rate financing to entice buyers. Even so, leasing remains an attractive alternative to buying a new vehicle for many motorists. Half of all luxury cars are still leased, as are more than 20 percent of vehicles in general. For most consumers, leasing a new vehicle every two or three years would be more expensive than buying one and keeping it after the final payment. Leasing has two principal benefits: (1) You can drive a newer vehicle that is always under warranty and seldom needs more than routine maintenance, and (2) you can often get a larger, more luxurious, better-equipped car. In this article, we'll help you get a better understanding of this alternative to buying, making it easier to decide whether leasing makes sense for you. Should You Buy or Lease a Car?
How To Reverse a Linked List (3 Different Ways) Introduction There are a couple of ways to reverse a linked list. One of them requires knowledge of pointers and one of them is pretty straight forward. In this article, 3 different methods of reversing a linked list are demonstrated. All the linked list reversing algorithms assume that the given linked list is a double linked list. Technique 1 In this way, a new linked list will be created and all the items of the first linked list will be added to the new linked list in reverse order. public void ReverseLinkedList (LinkedList linkedList) { LinkedList copyList = new LinkedList(); LinkedListNode start = linkedList.Tail; while (start ! This way is probably the most inefficient among the three. Technique 2 In this method, we will swap linked list node objects (references to the data). Assuming we have N nodes in the link list: Swap: 1st node’s object with Nth node’s object Swap: 2nd node’s object with (N-1)th node’s object Swap: 3rd node’s object with (N-2)th node’s object After swapping:
language agnostic - What's your most controversial programming opinion