Simulating finger touch on screen - Attempt 1 (failed)

This is a project I try to find a way to simulate touch on iPhone touch screen without human finger, and also able to switch that touch on/off.

This Cookie Run game makes me wonder if I can send simulated human touch to the screen. That’s why I came up with this. To create a bot for the game lol. (and a great excuse to pause my freelance work! :P)

So I did some research. There’s UIAnimation framework that can do this. But it only works with app built from Xcode. You can send the app to background but still no touch can be sent outside the app :(

Seems like I can really do this with a software approach without jailbreaking my device. So I moved on to a hardware approach. Which is harder, literally.

I assume that the touch has to be large enough for the screen to recognize. That’s where the coin comes in. And here is my hypothesis…

If I pass some current to a coin that sits on the screen. It will work like a human touch!

…but how much current???

From here I found this quote…
"Some reports I read said the human finger is about 15pF but it was dependent on finger size and glass and level of iron in your blood. Try a capacitor about that size with one lead electronically connected to the screen and the other grounded…. maybe you could ground it to the dock connector.”

15pF sounds pretty small! If I just pass a low humble amount of current (or voltage? not sure what term I should use here) to it, then it should work. Sweet!

I tried putting a anode (flat) side of a typical AA 1.5V battery on the screen. It works. But then I tried again without using my hand to touch the battery directly. It didn’t work.

Next I hooked up my old dusty Raspberry Pi to the coin! And tried turning a GPIO port connect to that coin on/off. (see how to ssh and control GPIO here) It turns out touches showed up even before I actually close the circuit. Just strange.

Which can only mean that the magnetic field from my running Raspberry Pi got transferred via the wire to the screen. And that means turning GPIO on/off can’t trigger the touch on the screen. It just stays touched. And after about 7 seconds it’s unregistered.

As a conclusion, it’s not the current flow that works. It’s the magnetic field of the object that touches the screen. I’ll have to find some other way to do this. (e.g. using a capacitor)

That’s it. I’m off to do the annual boring tax documents. *sigh*…

View text
  • #simtouch #ios #touchscreen
  • 1 month ago

A lightweight HTTP request class for iOS [1/2]


Part 1 | Part 2


Check out SMWebRequest on Github.

Let’s say you’re writing an app, either on iOS or the desktop, and you want to download some JSON data from a web service.

With JavaScript and jQuery, this is a one-liner:


Sigh, if only.

Well, technically you could do this in one line:


But if you do that, you’ll block the main thread until it completes, after which I will come over to your house and stab you in the face.

To perform asynchronous, cancellable HTTP requests in Cocoa, we have NSURLConnection. Now, this is a pretty nice class. It gives you a great degree of control over the lifetime of the request and for managing the incoming response data. It also handles caching and system proxy settings and global request pooling and other useful things. So we want to use it.

Read More

View text
  • #ios #http
  • 1 year ago
  • 65

Debugging Primer

Things you may need to look for when encountering unknown bugs

  • Package manager version (npm version in package.json file, Heroku Node.js app)
  • File generator version (e.g. texture packer .pvr.ccz)
  • Data synchronization (calling [NSUserDefaults synchronize];)
View text
  • 1 year ago

How to: Get Dropbox free 5GB bonus space!

For anyone that don’t know what Dropbox is, it’s a free and awesome cloud file sync/backup service. You’ll get an initial 2GB of space and more 250MB if you completed the get started quest, or invite your friends to use Dropbox. It is great for storing files across computers. You and your friends will be able to see the files just like it is in a local folder.

The good news is, according to this forum post, Dropbox is recently launching a beta test version which will test the camera upload feature, which anyone can join and upload their photos,videos. For every 500MB you uploaded, you get 500MB of bonus space! - up to 5GB.

I think the forum doesn’t have a good example of how this whole process works, so I want to create this post to explain it.

Alright, here are the steps:

  1. Download and install Dropbox 1.3.15 here…
    Mac OS X:
    Linux x86_64:
    Linux x86: Dropbox auto-import popup
  2. After install and launch, a popup will ask you if Dropbox should automatically start importing files when a device is connected. Choose “Start Import”. Don’t worry if you miss this step, just go to Dropbox Preference and enable it.

  3. Connect your device (camera, iPhone, or SD card). If they have photo or video contents, Dropbox will import them automatically.
  4. After import, you can unplug your device and wait for sync to finish. (UPDATE: or you can delete the files right away. You will still get the bonus space.)

In this case, “Import” means Dropbox will create a folder named "Camera Uploads" and it will copy all photos and videos into this folder. Syncing will start afterwards. Only files auto-imported from device to ”Camera Uploads” folder and uploaded successfully will count for bonus.

After files are imported (copied) to your computer. You can unplug your device and pause the sync. Then, you can later do it whenever you want, like during bed time or after work if you use your office’s internet.

Here are some snapshots of my increased bonus, I first have 2.2GB…

Then after uploading about 1.5GB, now I have 3.8GB!!! Pretty sweet eh? :D (The usage % is lower because I deleted some synced files.)


UPDATE! This is kind of awkward after I have taken time explain all these steps. But it turns out you don’t really need to upload all the files. Just import 5GB worth of files and then delete them right away during sync will to do the trick, even though they haven’t finished uploading yet. I thought Dropbox has already fix this hole but it appears that it still works. I realize this while uploading a 2GB file, I thought the file was too big and deleted it to stop its sync in order to start syncing new smaller files. That’s when a popup comes up and tells me I got the 2GB extra space O_o!!!


Now someone might have a nifty idea of throwing a DVD iso into Dropbox. But sorry, I tried and it didn’t work :P. Duplicating existing files won’t work either because Dropbox is smart enough to check that.

So, if you regularly take pictures/shoot videos with your phone of have a SD card full of vacation images, you should have no trouble finding files to upload. I am bit short of 5GB so I shoot some blank videos and upload those (lol). You can safely delete files that are already synced (files with green tick). It will not affect the bonus.

Lastly, try to not make the file too large as you get bonus after a file has finished uploading. If you upload 2GB files, you can end up waiting forever or even run out of space before getting bonus space! Anyway, this should be totally legit since the whole point of Dropbox for this beta is to test the auto-import-and-sync feature.

Have fun with your 7.25GB+ Dropbox space!

 === Reference ===

FAQ on the Photo Upload feature.

Why didn’t I get my free space for beta testing the latest forum build?

Can I manage files after they have been uploaded into my Camera Uploads folder? 

View text
  • #dropbox #how to
  • 2 years ago
  • 1
View photo
  • #ios #coreplot
  • 2 years ago
  • 1

Japan Expo 2010

« Click Here!

07.3 JapanExpo

LOCATION: Parc Des Exposition, France
CAMERA: Canon IXUS 95IS (Orange :)
DATE: 3 July 2010

A picture album of me visiting Japan Expo. There were so many cosplayers! เสียดายมัวแต่เดินดูร้านขายของด้านนอก ไม่ได้เข้าไปดูโชว์ในฮอล T T คนเยอะมากก ตอนกลับนี่แทบจะเหยียบกันขึ้นรถไฟกลับเลย =*= แต่ก็แซงคิวไปมิใช่น้อย ฮาๆ


1. Sorry many pictures are blur. Blame my compact camera XD
2. Sorry for late post :)

View text
  • 3 years ago

Measure real-time microphone input volume in Python


- Python 2.6

- SWMixer with following…
PyAudio 0.2.0 (or more recent)
NumPy 1.0 (or more recent)

- (Optional) OpenCV - used in example for cv.WaitKey() It has nothing to do with the program but it is for making quiting application easier.

Platform: Windows 7

Description: This uses SWMixer to get microphone input and measure its max data, or the volume of the sound at real-time. It detects sharp increase of volume and trigger the sound as a tap on the table or a snap of fingers.

import sys
import swmixer
import numpy
import cv

swmixer.init(samplerate=44100, chunksize=1024, stereo=False, microphone=True)

micdata = []
micsnd = None
vol = 0
prev_vol = 0
frame = 0

cv.NamedWindow('ESC receiver')
print 'Tap the table or snap finger near the microphone'
print 'Press ESC or Ctrl-C to stop'
while True:
micdata = swmixer.get_microphone()
micsnd = swmixer.Sound(data=micdata)
vol = #max 32767
if vol > 12000 and prev_vol < 4000 and prev_vol != 0:
print vol, prev_vol
vol = 0
prev_vol = vol
if cv.WaitKey(1) == 0x1b:
except KeyboardInterrupt:
View text
  • #python #swmixer #microphone
  • 3 years ago
  • 1

5/15 Installing OpenCV2.1 in Python 2.6.5 (Windows7)

ขอลงวิธี install opencv นิดนึง เพราะตอนนี้มันยังไม่สามารถทำงานร่วมกันได้ จากการ install ธรรมดา หวังว่าจะช่วยให้หลายๆคนไม่ต้องไปขุด readme มานั่งอ่าน

เริ่มแรกก็โหลดโปรแกรมมาซะก่อน …(ขอบคุณที่บอก -*-x) อย่าเพิ่ง install น่อ
- Python 2.6.5 Windows installer (Windows binary — does not include source)

- Visual C++ 2010 Express (จาก
Note: MS Visual C++ 2008 (ไม่ต้องลง sql, ใช้เป็นแบบเต็มหรือ express ก็ได้) โหลดจาก Microsoft ได้ฟรี รู้สึกว่าจะใช้ version 2005 ได้เหมือนกัน แต่ต้องโหลด opencv ที่เป็น OpenCV-2.1.0-win32-vs2005 มาเอง (ที่แปะไว้ข้างล่างเป็น vs2008)

- OpenCV 2.1.0 Windows installer from SourceForge - “OpenCV-2.1.0-win32-vs2008.exe”.
Note: OpenCV2.1 Install (แบบที่เป็นตัว install และคอมไพล์มาจาก vs2008)

1. ลง Python 2.6
2. ลง Visual C++ 2008 (Original/Express) (ต้องลงก่อน OpenCV)
3. ลง OpenCV 2.1

4. Copy ไฟล์ cv.lib,cv.pyd จาก “C:\OpenCV2.1\Python2.6\Lib\site-packages”
มาแปะที่ “C:\Python26\Lib\site-packages”
5. บางเครื่อง ตอน install มันจะไม่add pathให้ ถึงแม้จะเลือกให้มันทำแล้วก็ตาม (ไม่รู้ทำไม) ทำเองไว้กันเหนียว โดย
   5.1 เข้า Advanced system settings > “Environment Variables…”
   5.2 กด “Edit…” แก้PATH โดยเติม C:\OpenCV2.1\bin\; ลงไปด้านท้าย (อย่าลืม ; กั้น)
6. ทดสอบโดย รันไฟล์ที่อยู๋ใน C:\OpenCV2.1\samples\python สักไฟล์ อันไหนก็ได้ //หรือ// สร้าง text ไฟล์ที่มีข้อความว่า “import cv” (ไม่มี quotes) เซฟเป็น .py แล้วเปิดด้วย IDLE (Python GUI) กด F5 เพื่อรัน ถ้ารันผ่าน ไม่มี error สีแดงๆก็เป็นอันใช้ได้
7. ถ้ารันไม่ได้ก็ Relog หรือ Restart ใหม่ แล้วลองอีกที —-it should though

View text
  • #python 2.6 #opencv 2.1 #windows7 #install
  • 3 years ago
  • 1