phonegap

This top turns see-through if you leave personal data exposed

Clothing reveals how much wearer is revealing.

by Liat Clark, wired.co.uk June 17 2014, 9:45am CST

A Brooklyn-based designer has created a 3D-printed sculptural boob tube to spark social commentary on the state of privacy in a data-driven world—by making the top gradually more sheer.

X.pose’s striking black webbed rubber structure was engineered using a Stratasys printer, molded to the body to ensure comfort and very much inspired by creator Xuedi Chen’s previous work, Invasive Growth (moss-grown jewelry based on the parasitic cordyceps fungus). But underneath, its layers tell another story about our lack of control and veritable vulnerability when it comes to who uses our data, what for, and how much they take.

This story originally appeared on Wired UK.

Watch on fzeeb.tumblr.com
모바일 사파리(uiwebview) 원격 디버깅 하기

PhoneGap 등으로 iOS 용 app 을 개발하다보면 javascript debugging 이 상당히 불편하다. 오늘 블로그 서핑중 발견한 유용한 팁은 iOS simulator 에 표시되는 html(javascript)를 원격에서 debugging 하는 방법이다.

우선 AppDelegate 에 아래 코드를 추가한다.

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{    
    // 어쩌구 저쩌구 ....
    [NSClassFromString(@"WebView") _enableRemoteInspector];
    // 어쩌구 저저구 ....
    
}
app 을 실행시키고 safari 브라우저를 열어서 주소창에 http://localhost:9999/ 를 입력하면 디버깅 할 수 있다. 주의! 이 방법은 iOS 5.0 이상 시뮬레이터에서 실행 했을경우 가능하다.

원문은 여기에 http://atnan.com/blog/2011/11/17/enabling-remote-debugging-via-private-apis-in-mobile-safari/
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Uncomment to enable remote debugging
[NSClassFromString(@“WebView”) _enableRemoteInspector];
….
— 

“a private API in iOS5 that will allow you to debug your UIWebViews right inside desktop Safari using the Web Inspector”

From: Debugging iOS Apps Using Safari Web Inspector

I haven’t tried this yet, but cool if it works.

Darf ich vorstellen: phonegap

Wer schon immer einmal eine App für ein Smartphone schreiben wollte, muss dank phonegap keine komplexe Programmiersprache mehr lernen.

Statt dessen ermöglicht es diese kleine (unter offener Lizenz stehende) Lösung auch komplexe WebApps (mit HTML5, CSS3und JavaScript, also auch jquery etc.) in eine “vermarktungsfähige” Form zu giessen.

Programmiert wird wie gewohnt in JavaScript. Abschließend kann das Projekt dann aber in den verschiedenen AppStores dieser (Smartphone-)Welt zum Kauf angeboten werden. So lassen sich nun auch WebApps verkaufen.

Wer sowieso schon Erfahrung in Webdesign hat, erschliesst sich so einen weiteren Markt - wer jedoch näher am Gerät programmieren möchte und auch spezielle (z.B. 3D-Features) angewiesen ist, der sollte auch weiterhin direkt für das entsprechende Gerät entwickeln.

Phonegap Core Team Introduced Phonegap For The Enterprise

The core team of PhoneGap has announced a new offering PhoneGap Enterprise at Adobe Summit. The team came to know about their need for more advanced and robust set of tools through the conversations with enterprise PhoneGap developers as these tools help in developing mobile apps and work together with business stakeholders.

Read More

Learn PhoneGap & Sencha

I was pretty motivated by Nick Batlestra blog post this week “Bulding an iphone app using brush and glue”, a quirky blog title for an even quirkier app, yet it managed to move me take another look at PhoneGap. For the next few hours I stayed up to read and experimenting with PhoneGap, slowly mocking up the UI for a project I’m to work on this summer.

Today, I spent another hour reading up on Sencha Touch, Sencha Touch helps you build rich web apps for Apple iOS and Android devices in tandem with the PhoneGap API. What I’m impressed about was the Model View Controller with CRUD, this summer will be even more exciting that I initially thought.

iCloud

It seems that Apple is leaving me behind with iCloud as I don’t want to double my mobile phone plan spend (now using a 3G at £20, need to go £41 to get a ‘FREE’ iPhone 4) to get an iPhone that supports iOS 5.  

It looks like iCloud is replacing MobileMe, so that causes real problems for me as I use MobileMe to synch my contacts and calendar with my phone. I can keep my MobileMe account until June next year, maybe I’ll be able to justify a phone upgrade then, or maybe I will have found another solution like Funambol instead.

OS X Lion

I don’t really want to spend £21 to upgrade my MacBook Pro to OS X Lion either but it looks like I have to if I want to continue to develop software for for the current range or iOS devices. There is an alternative, which is solutions like Sencha Touch and Phone Gap which look like they are getting close to native app speed.  

Conclusion

It is starting to feel like Apple is falling into the same modus operandi that companies like Microsoft used with great success to screw every last penny out of their customers, let’s hope they realise the error of their ways before they start on the downward slope that Microsoft has been on for a while now.   

Scala: A Better Java for Android

Stop writing Java for your Android apps!

There are a slew of ways to build Android apps. The original Java way reigns supreme but some alternatives are C++, Mirah, Python, Titanium Appcelerator, Corona, and so on.

And there’s Scala.

Scala can be thought of as a better Java. To start with, you don’t need as many semicolons. But Scala gives you the power of modern abstractions. Traits, implicits, type-checked null, blocks–everything you really need to get some solid coding done.

(Briefly, the magic Android sauce is the scalaforandroid project.)

As an example of what Scala can do for your app, take this simple project: a button which, when pressed, shows a toast:

package com.thoughtbot.helloscala

import _root_.android.app.Activity
import _root_.android.os.Bundle
import _root_.android.widget.Toast
import _root_.android.view.View
import _root_.android.view.View.OnClickListener
import _root_.android.widget.Button

class HelloActivity extends Activity {
  override def onCreate(savedInstanceState : Bundle) {
    super.onCreate(savedInstanceState)
    setContentView(R.layout.main)

    val button = findViewById(R.id.button).asInstanceOf[Button]
    button.setOnClickListener(new View.OnClickListener() {
      def onClick(v : View) {
        Toast.makeText(this, "You have clicked the button", 
        Toast.LENGTH_LONG).show()
      }
    })
  }
}

This is basically the Java version without semicolons. But we can spruce it up with a trait and an implicit:

package com.thoughtbot.helloscala

import _root_.android.app.Activity
import _root_.android.view.View
import _root_.android.view.View.OnClickListener

trait FindView extends Activity {
  def findView [WidgetType] (id : Int) : WidgetType = {
    findViewById(id).asInstanceOf[WidgetType]
  }
}

class ViewWithOnClick(view : View) {
  def onClick(action : View => Any) = {
    view.setOnClickListener(new View.OnClickListener() {
      def onClick(v : View) { action(v) }
    })
  }
}

object FindView extends Activity {
  implicit def addOnClickToViews(view : View) = 
    new ViewWithOnClick(view)
}

This adds an onClick method to Views and a findView method for Activities. Life just got a little more functional:

package com.thoughtbot.helloscala

import _root_.android.app.Activity
import _root_.android.os.Bundle
import _root_.android.widget.Toast
import _root_.android.view.View
import _root_.android.widget.Button
import FindView._

class HelloActivity extends Activity with FindView {
  override def onCreate(savedInstanceState : Bundle) {
    super.onCreate(savedInstanceState)
    setContentView(R.layout.main)

     findView[Button](R.id.button).onClick { view : View =>
        Toast.makeText(this, "You have clicked the button", Toast.LENGTH_LONG).show()
    }
  }
}

Take this concept as far as you need: a doInBackground method for functions, a withState-like function for PreferenceManager, a caching wrapper for URLs–the sky is the limit here.

So what’s stopping you from using Scala for your Android app?

If you’re interested in learning more about Android development, sign up to be notified the next time we run our Android workshop.

Titanium vs PhoneGap - SQL Database

This post isn’t going to be about the usual differences between Titanium and PhoneGap. For that, click here. No, this is more about how you can store data in both the frameworks, especially with respect to SQL Databases.

TL;DR: PhoneGap uses WebSQL and Titanium uses SQLite. WebSQL doesn’t scale well with data sets more than 1000, while SQLite can easily go over 100,000. Also, a little discussion about where your data is expected to be generated.

The Problem

I am building a simple HTML/JS based mobile application. I expect it to run on mobile OS like a native application, even though they really aren’t (well atleast in the case for PhoneGap). At the moment Titanium and PhoneGap are the two choices. However, my problem is that my Application needs to be loaded with a 7MB database (more about the size later in this post), which my application use to read stored data. The application is a simple Bible application in my language.

Databases in the Frameworks

I think it is fair to call Titanium and PhoneGap as frameworks. That being said, PhoneGap is a framework that works around the browser, so HTML5 data stores are available to use. This means that you can use WebDB (or WebSQL Database). Don’t confuse this with SQLite, which Titanium comes with.

Titanium lets you bundle a SQLite database with your application at the time of compilation, and lets you put it on the AppStore/Marketplace with your SQLite database (click here for more info)

PhoneGap, on the other hand, since it uses a WebSQL database, which runs inside the browser (or WebView) that your application is wrapped under. This means that you can’t package a database when you deploy your application. You can, however, write a JS function that contains all your CREATE, and INSERT statements that is run to create the database. Thats right, you’re packaging all your INSERT statements into 1 JS file, and the JS file will do something like this to load the values to the database: http://pastebin.com/APUthCbh

And this script will get called right after your database gets called. THAT’S RIGHT! There is now way to check if your tables already exist. In fact, PhoneGap’s API doesn’t mention anytime about trying to check if your tables exist, and not call this function in the first place. (Click here for more info)

Now, keep in mind, your phone’s memory is limited. The SQLite database for Titanium was 7MB. I separated out the setup_js method to its own file, which ended up being 16MB. More than 2x the size of the SQLite database (which is expected). Now, try loading this 16MB into memory via WebView. You can kiss the performance of your application goodbye.

Lessons

So, there is a lesson to be learnt, although I’m angry at myself for wasting 2 evenings without realizing that this could be a potential problem.

Lesson 1

The lesson is that, PhoneGap is really useful for light-weight applications, where the algorithms are simple enough to run in a phone’s browser, and (equally important) the data store is expected to be small. Titanium would do well for larger databases, using SQLite.

Now, I realize that going to either Titanium or PhoneGap means that you’d need to sacrifice some performance for the sake of quickly launching your app, and having a single code base (well almost single), and thats where these two shine.

Lesson 2

Oh, and there were 31182 lines of SQL statements that was supposed to be executed in PhoneGap each time the app started. This clearly means I should go to Titanium. This brings me to the 2nd lesson. One more thing that separates PhoneGap from Titanium is that PhoneGap expects its datasource to be generated by its user, or from a small remote source on the internet, like a RSS feed or a Flickr feed. The data comes from an external source and is expected to be stored in the database temporarily and perhaps erased at a later time.

Titanium, with the use of SQLite, can work with larger datasets that aren’t really coming from external sources (although you can use it for that). Titanium gives you a huge advantage of letting pre-package a large database and it lets you collect large amount of data.