March 20, 2015

How to install PYGAME in Mac OSX 10.10 Yosemite

Download and install MacPorts 

https://www.macports.org/install.php 
Open Terminal: 


pippo:folder$ sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/
System/Library/Frameworks/Tk.framework/Versions/8.5/Headers/X11 /usr/local/include/X11 

pippo:folder$ sudo pip install hg+http://bitbucket.org/pygame/pygame 

pippo:folder$ python
>> import pygame 

 enjoy it ;)

April 10, 2014

Spilled water bottle in a mac book air

This is not a test. It's only a story about what happened today to my mac book air.
Spilled bottle water on my macbook air.
No hard damage, it seemed. But the internal speakers don't work.Recommendation



  1. Do not keep water bottles and pc in the same bag
  2. Do not TURN on YOUR COMPUTER before driyng the water.Dry well, maybe with a hairdryer (in distance and ambient air), put the computer in a ventilated place and wait a few hours.
  3. Use keyboard protective films and neoprene covers. Neoprene is not waterproof but prevent the direct water contact


If your computer is on standby:

  • Dry the pc from drops of water. 
  • Check that there were no damages related to hardware fault (just like warnings or system alerts)
  • Turn on pc.
  • Check your system functions. Keys, screen video audio (jack and internal speakers). 

What happened to me:

  • The internal speakers did not work. Reason? Perhaps a few drops of water inside of the jack prevented the system to tell if earphones jack were inserted or not.
  • I cleaned with a cotton-bud the jack.
  • I opened video editing and conversion programs to increase the processor temperature and activate the cooling fans, hoping that this could dry the residual drops.
  • Rebooted, audio was ok. 

Good luck.

March 17, 2014

How To Update Arduino WiFi Shield (Windows)

Yes, I used Windows because strangely I got problems with my mac...
Ok, FORGOT all the procedures you read in internet.
Take note of these sites:

Procedure: (just follow the instructions in monkey-mode ;) )


0. Get a PC with Windows... 7 is better (yes... :( ) 
1. Install AVR-tool-chain 
2. Install AVR32 Studio 2.6 (2.6 is a must ,2.5 doesnt work with the AVR toolchain)
3. Install Flip 3.4.7
4. Connect your Arduino Wifi Shield with the jumper fixed on it (DFU programming) with the mini USB  Note: "Remove all connections from the pins" 
5. Go to Device manager->Other Devices->AT32UC3A DFU->Properties->Driver->Update Driver
6. Browse my computer for driver software->C:\Program Files (x86)\Atmel\Flip 3.4.7-> install it
7. Download the new firmware from official Arduino WiFi shield GitHub
8. Open AVR32 Studio 2.6 (WiFi shield should be connected)
9. Close welcome window -> Under the AVR targets -> create new target
10. under the Properties -> General tab -> Set the Name: AT32UC3 DFU
11. under Details tab -> Choose Debugger/programmer:USB DFU ->Device:AT32UC3A1256 -> Clock source: Internal RC oscillator ->Board: STK600
12. right click on the new target "AT32UC3 DFU"-> select "Program"
13. under the new window select the target path of the downloaded file from the GitHub
13a. optionally (this is the only mode worked for me) try to take the drivers from the arduino folder ARDUINO_DIR/hardware/firmwares/wifi-shield
14. Select the folder or the HEX file before pressing "OK"
      a)verify memory after programming
      b)Start executing after programming
      c)Erase flash before programming also
15. Program reporting can be viewed from the "Console" (lower left corner of the AVR32 Studio 2.6)

July 14, 2013

Raspberry Pi + Python + Tornado + NGinx + MongoDB

Do you need a simple web server at home? If you have a low budget, you don't need a supercomputer and you don't want to buy a cloud virtual server account, this is the solution that's right for you.

A super combo webserver combination of instruments:

1. Prepare your Rapberry Pi (with SD card 16GB class10 or greater)


Download the raspberry pi OS following this guide here:

IMPORTANT: prevent the Raspberry pi SHOCK overheating by installing a heat sink cooler and a 5v fan. 

Install the raspbian os (easier and faster than the others). Connect keyboard, ethernet (or wifi), mouse and monitor. Expand the partition and set the current location for the timezone from the raspconfig menu, and startx (if you want to go in windows style). 
Open terminal window and make a:
  • sudo apt-get update 
  • sudo apt-get upgrade
Install SSH package to take control from remote (if not present): 
  • sudo apt-get install ssh
You should now access to the raspberry from your pc via ssh. For windows bash link command-console you can use putty.exe 
Create a user with the adduser command or use pi default user: pi@raspberry



2. Check Python in your rasp


type   python in your shell.  If you get:

Python 2.7.3 (default, Jan 13 2013, 11:20:46)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.

>>>


it's ok, and go to the step 3.  Otherwise install python 2.7 with sudo apt-get install python. Check python after installation and go to the step 3.





3. Install Tornado Web Server




Here the setup part:

First things first, install Tornado on your Raspberry Pi:1.  Good thing to do before every install – update agt-get and installed packages
sudo apt-get update
sudo apt-get upgrade
2.  Install easy_install and pip (which are Python package managers)
sudo apt-get install python-pip python2.7-dev
3.  Update your easy_install (and pip) package definitions
sudo easy_install -U distribute
4.  Now install Tornado using pip
sudo pip install tornado

To make sure everything works, create a file named “server.py” containing the following code (taken from Tornado’s site), and run it from terminal using the command “python server.py”










import tornado.ioloop
import tornado.web
 
class MainHandler(tornado.web.RequestHandler):
    def get(self):
        self.write("Hello, world")
 
application = tornado.web.Application([
    (r"/", MainHandler),
])
 
if __name__ == "__main__":
    application.listen(8080)
    tornado.ioloop.IOLoop.instance().start()
Now on a separate computer on the same network, navigate your browser to http://raspberrypi:8080 (or use the IP address for example 192.168.1.7:8080).  You should see “Hello, world” if everything goes right.




4. Install NGinx (optional - increase performances)


Open a terminal and execute:
sudo apt-get install nginx
setup nginx... (coming soon..).




Raspberry: How to Backup Raspberry PI SD card

 Step 1: Startup the "Win32DiskImager" program, 
http://sourceforge.net/projects/win32diskimager/



Here's the opening screen: Notice you will need to select which drive is your SDcard. in this case my SDcard is E:\ then click the NAVIGATE icon just next to the E:\ pulldown box, this will open a file-explorer window. (Also note that the "read" button is not available to use just yet).

Step 1a:  insert the SD card destination and write the copied image. If you have an error about the destination blocks number (or sd size even it is the same size) go to the STEP 2.

Step 2: Use DD (windows version here: http://www.chrysocome.net/dd)



Use DD to resize img win32diskimager partition just like the screenshot above.

Step 3: Use Win32DiskImager to copy the DD image in the new sd card.


Realtek Network Controller was not found. ERROR


First try to update your lan driver.
If you get this message when installing lan driver:

"The Realtek Network Controller was not found.
If Deep Sleep Mode is enabled Please Plug the Cable."


you probably need to update your BIOS.

I solved this problem on my HP DV6 2135sl notebook with Windows 7 x64.
Drivers:
http://h10025.www1.hp.com/ewfrf/wc/softwareList?os=4063&lc=it&dlc=it&cc=it&lang=it&product=4106866#