jQuery Mobile Issues

$(”).click() fires twice with using alert().

I found out that in my case the addition of data-role="page" to my page container prevented tap events from being fired twice.

meta size for android is not working

Its seems that width=device-width and user-scalable=yes needs to be on its own line

    <meta name="viewport" content="width=device-width;

sample code:

<!DOCTYPE html> 
    <title>Page Title</title> 
    <!--Don't format this meta because it has to be in lines for it to work, to zoom change the value in initial-scale-->
    <meta name="viewport" content="width=device-width;
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.1.1/jquery.mobile-1.1.1.min.css" />
    <script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
    <script src="http://code.jquery.com/mobile/1.1.1/jquery.mobile-1.1.1.min.js"></script>

<div data-role="page">
    <div data-role="header">
        <h1>Page Title</h1>
    </div><!-- /header -->

    <div data-role="content">   
        <p>Page content goes heasdfre.</p>      
    </div><!-- /content -->

    <div data-role="footer">
        <h4>Page Footer</h4>
    </div><!-- /footer -->
</div><!-- /page -->

    alert('header tag');


Phonegap jQuery Mobile error – same origin policy

I’m developing an android application thru phonegap and I like to test my application in Chrome However jquery mobile was causing this error->

XMLHttpRequest cannot load file:///home/sock/Desktop/phonegap-2.7.0/lib/android/example/assets/www/js/jquery.js?_=1369249074564. Origin null is not allowed by Access-Control-Allow-Origin. jquery.js:8416
XMLHttpRequest cannot load file:///home/sock/Desktop/phonegap-2.7.0/lib/android/example/assets/www/js/jquery.mobile-1.2.0.js?_=1369249074596. Origin null is not allowed by Access-Control-Allow-Origin.

The way around this is to close all chrome browsers and run this is the command line (I’m using ubuntu)

$ chromium-browser --allow-file-access-from-files


$ chromium-browser --disable-web-security --user-data-dir

Chrome will open again and now you will not get this error when you run your page.

I was receiving the error when doing ajay request:

XMLHttpRequest cannot load file:///home/example/assets/www/delete.txt. Origin null is not allowed by Access-Control-Allow-Origin.

this error occurs in chrome but doesnt occur in the app when deployed so I disable this warning for developing purpose by running

$ chromium-browser --disable-web-security

cross origin

Setting Up Linksys Router

Open the router settings by inserting in the browser

It will ask for a username and password, put that in.

Under Setup->Mac Address Clone select Enable and click on Clone Your PC’s MAC

Under Wireless->Basic Wireless Settings in Wireless Network Name (SSID): text box you can write the name for your internet.

For creating internet security:
Under Wireless->Wireless Security select Security Mode: as WEP.
Then write a Paraphrase and a Key 1 (password)

Setting up Android Emulator or physical device

Android Emulator

Its really slow to boot up but once its reaches the home screen its good enough, don’t close the emulator or you’re going to wait for the whole booting process again. In eclipse, to run you current app just click on “Run example as” (the green arrow) and choose the emulator. However if you want to be faster and you already have an android device. Just plug your android to the computer (USB). When you click on “Run example as” your device should show. To check if eclipse is reading you device go to the DDMS tab and see the device listed and yours should be there if plugged in.

Also there may also need to install specific packages in the Android SDK Manager for this to work. I’m not sure, I did a lot of installing following a lot of tutorials in the past day trying to get this to work.

phonegap installation example using Windows

How to create your first phonegap android application using Windows


ATtiny Arduino

Used the MIT instructions

Initially I was using the barebones arduino I built as a programmer but was getting error such as

arduino avrdude: please define PAGEL and BS2 signals in the configuration file for part ATtiny45 
avrdude: stk500_initialize(): programmer not in sync, resp=0x15 
avrdude: please define PAGEL and BS2 signals in the configuration file for part ATtiny45 
avrdude: verification error, first mismatch at byte 0x0000          0x26 != 0x00 
avrdude: verification error; content mismatch

The barebones arduino I created is not currently meant to do this kind of stuff so I used a regular arduino board and followed the intructions and it worked however there a were few errors on the upload such as

arduino avrdude: please define PAGEL and BS2 signals in the configuration file for part ATtiny45 

I used the attiny45-20pu

In the arduino IDE under Tools->Board
I selected ATtiny45(internal clock 1MHZ clock) because the other speeds worked but the blinking led time was off.

I created an ATtiny programmer arduino breakout board off this project which can be purchase here on this site or on ebay.

attiny13a chip tutorial