Thursday, 30 June 2011

Simple Android Developer Mistakes

I would really like to write more tips, tricks, and tutorial posts relating to Android, but I’ve been extremely busy on apps both professionally and personally, and I am also doing technical review on an Android dev book due out later this year. So, while I don’t have time to go in the level of depth I’d like to, I thought I could work on a post with a bunch of short pieces that could be written when I have a few free minutes here and there and save the longer posts that require a greater chunk of continuous focus for later. This post talks about some challenges that you may run into early in your foray into Android development. There isn’t really any sense of order to these; they’re more-or-less a brain dump of issues I’ve experienced or seen that take seconds to solve if you know what...

It’s very easy to send email via an Android intent. Here’s an example where we already have the subject and body prepared but want to let the user decide on the recipient: (It’s important to note that this should be attempted on a real device.) I ran into some trouble with sending HTML in an email because it was being interpreted as plain text both in the user’s email client and in the recipient’s. Simply changing the MIME type didn’t help, but I eventually came across the solution: Note that both the MIME type is changed and the EXTRA_TEXT is now set as Html.fromHtml(body) instead of just being passed a string with HTML in it. As long as the mail app that is selected is able to properly handle the Intent (e.g., the Gmail app can, the default mail app cannot), then HTML email can be se...

Upload a File to a Remote Server with Phonegap

I recently started looking at PhoneGap as a way to build native smartphone applications without having to learn another programming language. The process, so far, has been going very well. I’ve been able to build a basic application with very little trouble. I did, however, hit a big hiccup in development when I decided to try and upload a file from a phone to a remote location. The unfortunate part of this hiccup was that I think its primary cause is rooted in poor documentation.In this post, I want to explain how I was able to upload a photo from a phone, using PhoneGap (and PHP on the remote server), to a remote server. I am going to assume that you have some knowledge of PhoneGap and already have a method, either the Android SDK or the iPhone SDK, to test your native application. The...

PHP Send Email Using Authenticated SMTP Mail Server In Real Time

PHP has mail() function to send an email to users. However this mail() will not work:=> If sendmail (or compatible binary) is not installed=> If Apache Web server / Lighttpd running in chrooted jail=> And your smtp server needs an authentication before sending an email=> Or you just need to send email using PHP PEARIn all these cases you need to use PHP PEAR's Mail:: interface. It defines the interface for implementing mailers under the PEAR hierarchy, and provides supporting functions which are useful in multiple mailer backends. In this tip you will learn about how to send an e-mail directly to client smtp server in real time.PHP Pear's Mail.php is located in /usr/share/pear/ directory. Following is sample code to send an email via authenticated smtp server. PHP send email...

Re: [PhoneGap] how to add get applicationDidBecomeActive and didFinishLaunchingWithOptions methods in Phonegap

Use the latest 0.9.6.applicationdidFinishLaunchingWithOptions is there,applicationDidBecomeActive is there but in the subclass PhoneGapDelegate. For active/inactive events, use the "pause" and "resume" events in javascript instead to handle that event:http://docs.phonegap.com/phonegap_events_events.md.html On 2011-06-29, at 3:00 AM, Abhi wrote:> Hi,>> Native apps on IOS have the following methods> - (BOOL)application:(UIApplication *)application> didFinishLaunchingWithOptions: (NSDictionary *)launchOptions> - (void)applicationDidBecomeActive:(UIApplication *)application> > but Phonegap.0.9.4 has> - (void)applicationDidFinishLaunching:(UIApplication *)application> - (void)webViewDidFinishLoad:(UIWebView *)theWebView //this does not> trigger when app comes...

[nodejs] Joey Guerra wants to chat

-----------------------------------------------------------------------Joey Guerra wants to stay in better touch using some of Google's coolest newproducts.If you already have Gmail or Google Talk, visit:http://mail.google.com/mail/b-5c0a4ac672-e0278c1b8b-i0wmic9xVGZ7nAXpPY-Z5P-OqsUYou'll need to click this link to be able to chat with Joey Guerra.To get Gmail - a free email account from Google with over 2,800 megabytes ofstorage - and chat with Joey Guerra, visit:http://mail.google.com/mail/a-5c0a4ac672-e0278c1b8b-i0wmic9xVGZ7nAXpPY-Z5P-OqsUGmail offers:- Instant messaging right inside Gmail- Powerful spam protection- Built-in search for finding your messages and a helpful way of organizingemails into "conversations"- No pop-up ads or untargeted banners - just text ads and related informationthat...

[PhoneGap] Re: iOS UIWebview - make it faster for PhoneGap!

+1 more to the pile :DOn Jun 29, 6:50 am, Shazron Abdullah wrote:> Every-time there's a duplicate issue in Apple's Bug Reporter (kinda like voting for it), the more likely it will be implemented next time (we hope). Mine was duped. So please file an issue, it will only take 5 mins :)>> File an issue athttp://bugreporter.apple.comand login with your Apple ID. Click on "New Problem">> Title: > UIWebview: should support Nitro Javascript>> Product:> iPhone SDK>> Classification:> Feature (New)>> Description:> Enable Nitro Javascript for the UIWebview component, like Mobile Safari and home-screen web-apps.-- You received this message because you are subscribed to the GoogleGroups "phonegap" group.To post to this group, send email to phonegap@googlegroups.com...

Re: [nodejs] Joey Guerra wants to chat

WAT?!On Wed, Jun 29, 2011 at 9:49 PM, Joey Guerra wrote: ----------------------------------------------------------------------- Joey Guerra wants to stay in better touch using some of Google's coolest new products. If you already have Gmail or Google Talk, visit: http://mail.google.com/mail/b-5c0a4ac672-e0278c1b8b-i0wmic9xVGZ7nAXpPY-Z5P-OqsU You'll need to click this link to be able to chat with Joey Guerra. To get Gmail - a free email account from Google with over 2,800 megabytes of storage - and chat with Joey Guerra, visit: http://mail.google.com/mail/a-5c0a4ac672-e0278c1b8b-i0wmic9xVGZ7nAXpPY-Z5P-OqsU Gmail offers: - Instant messaging right inside Gmail - Powerful spam protection - Built-in search for finding your messages and a helpful way of organizing...

[PhoneGap] Re: Calling plugin method synchronously

Here is my correspondence with ShazronYou can use static libraries only, no third-party dynamic librariesare allowed. Apple's dynamic libraries are allowed of course (thingslike UIKit, etc that are part of the SDK) but not your own.- Hide quoted text -On Tue, Jun 28, 2011 at 5:01 AM, Sumedh wrote:> Hi Shazron,>> I wanted to know whether i can use shared libraries with phonegap plugins.>> What about Dynamic link Libraries, are they allowed as part of an iphone> app. I am not getting appropriate information about this.>> thanks.>> On Mon, Jun 27, 2011 at 6:03 PM, Sumedh wrote:>>>> Thanks sir.>>>>>> On Mon, Jun 27, 2011 at 5:31 PM, Shazron Abdullah>> wrote:>>>>>> Also i see PhoneGap uses UIWebvVew, so there are...

Re: [PhoneGap] Coverage Into using Phonegap.

Hey Drew,You are right. I didn't execute "document.addEventListener("deviceready", onDeviceReady, false);" in the HTML file. Rather this was called in another file. Now I got it working. Thanks for all your time :)-- You received this message because you are subscribed to the GoogleGroups "phonegap" group. To post to this group, send email to phonegap@googlegroups.com To unsubscribe from this group, send email tophonegap+unsubscribe@googlegroups.com For more options, visit this group athttp://groups.google.com/group/phonegap?hl=en?hl=en For more info on PhoneGap or to download the code go to www.phonegap....

[PhoneGap] Re: BlackBerry WebWorks - eclipse Issues

Hi,1. I'm using blackberry.app.exit() in my BB-Webworks App. and it is working for me.2. Here is the sample code for JS-WSDL communication. function wssample(){try{var oXmlHttp = new XMLHttpRequest(); // Create a function that will receive data sent from the serveroXmlHttp.onreadystatechange = function(){if(oXmlHttp.readyState == 4){alert(oXmlHttp.responseText);}};oXmlHttp.open("POST", "http://10.55.55.55/AuthenticationService.svc", false); oXmlHttp.setRequestHeader("Content-Type", "text/xml"); oXmlHttp.setRequestHeader("SOAPAction", "http://tempuri.org/IAuthenticationService/AuthenticateUser"); var str=" \ \ \ \ adminadmin \ admin \ \ \ \"; oXmlHttp.send(str); }catch(e){document.getElementById("ex").innerHTML = "Exception- "+e.toString();...

[PhoneGap] Re: how to add get applicationDidBecomeActive and didFinishLaunchingWithOptions methods in Phonegap

cd ~/Documents/phonegap-iphone/git remote updategit merge origin/mastermake, reinstall the pkg, reload, clean & rebuildOn Jun 30, 10:40 am, Abhilash Vijayakumar wrote:> Ok thank you. Any recommended way to convert an existing Phonegap.0.9.4 app> to Phonegap.0.9.6 app> Can Phonegap0.9.4 and 0.9.6 templates co-exist in xcode3.2.6 ?> Pls advice> Regards> Abhilash Vijayakumar>> On Wed, Jun 29, 2011 at 6:17 PM, Shazron Abdullah <>>>> shazron.abdul...@nitobi.com> wrote:> > Use the latest 0.9.6.> > applicationdidFinishLaunchingWithOptions is there,> > applicationDidBecomeActive is there but in the subclass PhoneGapDelegate.>> > For active/inactive events, use the "pause" and "resume" events in> > javascript instead to...

[PhoneGap] Re: emailComposer plugin

On Nov 2, 7:18 pm, Nick McCloud wrote:> You will need to add MessageUI.framework to your project if it is not> already included.>> Just add the .m.h files to your project ( you can add them directly to> your own project, you don't need to put them in phonegap lib ).>> Place the .js file in your app root, and include it from your html.>> This is intended to also demonstrate how to pass arguments to native> code using the options/map object. Please review the js file to> understand the interface you can call, and reply with any questions.>> On Nov 2, 4:45 pm, jamie_mcdonnell wrote:>>>> > Hi there,>> > can anyone please post a simple example for implementing the> > emailComposrer plugin?>> > It would really help...

Wednesday, 29 June 2011

jquery basics

This is a basic tutorial, designed to help you get started using jQuery. If you don't have a test page setup yet, start by creating a new HTML page with the following contents: !-- Demo jQuery --> Edit the src attribute in the script tag to point to your copy of jquery.js. For example, if jquery.js is in the same directory as your HTML file, you can use: You can download your own copy of jQuery from the Downloading jQuery page [edit] Launching Code on Document Ready The first thing that most Javascript programmers end up doing is adding some code to their program, similar to this: window.onload = function(){ alert("welcome"); } Inside of which is the code that you want to run right when the page is loaded. Problematically, however, the Javascript code...

jquery tutorial

English Tutorials jQuery Plugin Authoring Learn how to develop a jQuery plugin. jQuery Beginner Tutorial in 18 minutes Learn to build jQuery plugins from scratch - an 18 minute tutorial. [edit]General TutorialsThese tutorials cover the fundamentals of the jQuery library - covering a diverse number of topics. How jQuery Works by John Resig. A basic introduction to jQuery and the concepts that you need to know to use it. Tags: jQuery Core, Selectors, CSS, Traversing, Manipulation, Events, Effects Getting Started with jQuery by Jörn Zaefferer Goes through the basics of jQuery, all the way up to building plugins. Tags: jQuery Core, Selectors, Attributes, Traversing, Manipulation, Events, Effects, Ajax, Plugins jQuery For Designers by Mark Panay Examples of writing Unobtrusive...

SQL Subquery

Subquery or Inner query or Nested query is a query in a query. A subquery is usually added in the WHERE Clause of the sql statement. Most of the time, a subquery is used when you know how to search for a value using a SELECT statement, but do not know the exact value.Subqueries are an alternate way of returning data from multiple tables.Subqueries can be used with the following sql statements along with the comparision operators like =, <, >, >=, <= etc. SELECT INSERT UPDATE DELETEFor Example:1) Usually, a subquery should return only one record, but sometimes it can also return multiple records when used with operators like IN, NOT IN in the where clause. The query would be like,SELECT first_name, last_name, subjectFROM student_detailsWHERE games NOT IN ('Cricket',...

Basic sql injection for beginner with a live example

NOTE : This tutorial is to make you familiar with how the SQL Injection actually works, Hope you don’t use this tutorial for Offensive porpose. If anybody misuses I am not responsible for that.Website Used for Practical here : http://www.shangproperties.com/news_archive.php?id=6We will check it’s vulnerability by adding magic qoute (‘) at the end of the url.3.So the url will be like this: http://www.shangproperties.com/news_archive.php?id=6′And we hit enter and we got this result. Database error: Invalid SQL: SELECT * FROM NewsArticle WHERE NewsID=6\’;mySQL Error: 1064 (You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘\” at line 1) Database error: next_record called with no query pending.mySQL Error:...

The best Web 2 jQuery javascript plugins

We developers here at Wiliam are always looking for programming solutions that are robust, standards compliant, extensible and keep our sites loading fast. One such solution that has been gaining popularity among our development team is jQuery.jQuery is a Javascript library that aims to greatly simplify the often tedious and buggy task of writing client-side JavaScript code to for modern Web 2.0 web sites.At Wiliam, JQuery is helping pave the way for our new generation of sites, and I personally have found that its extensible, modular platform has helped me do away with much of our old Javascript code and have all our sites work in a standardised, consistent way with fewer bugs. And best of all, it's free.I'd like to share with you four of the best JQuery plugins that I've been working with...

Tuesday, 28 June 2011

How to create and read JSON strings in PHP

JSON logo and PHPPHP, like JavaScript, has functions that can convert variables to JSON strings and vice-versa. Let's take a look at them.Creating a JSON string from a PHP variablejson_encode() takes a PHP variable and returns a JSON string representing the variable. Here's our shopping cart example written in PHP:!-- /* 12345, "shopperName" => "John Smith", "shopperEmail" => "johnsmith@example.com", "contents" => array( array( "productID" => 34, "productName" => "SuperWidget", "quantity" => 1 ), array( "productID" => 56, "productName" => "WonderWidget", "quantity" => 3 ) ), "orderCompleted" => true); echo json_encode( $cart );?>*/-->This produces exactly the same output as our JavaScript example — a valid JSON string representing the variable's...

How to create and read JSON strings in JavaScript

JSON logo and JavaScriptJSON might be a simple format, but it's obviously fairly tedious to write JSON strings by hand. What's more, you often need to be able to take a JSON string, and convert its contents into a variable that can be used by your code. Fortunately, most programming languages give you tools that can easily turn variables into JSON strings, and vice-versa. The basic idea is as follows: To create a JSON string, you start with a variable containing some data, then pass it through a function to turn that data into a JSON string. To read a JSON string, you start with a JSON string representing some data, then pass it through a function to create a variable containing the data.Let's take a look at how to create and read JSON strings in JavaScript. Creating a JSON...

Form Validation with JavaScript

This tutorial will show you how to create a JavaScript-enabled form that checks whether a user has filled in the form correctly before it's sent to the server. This is called form validation. First we'll explain why form validation is a useful thing, and then build up a simple example form, explaining things as we go along. At the end, there's a little exercise to keep you busy too!What is form validation?Form validation is the process of checking that a form has been filled in correctly before it is processed. For example, if your form has a box for the user to type their email address, you might want your form handler to check that they've filled in their address before you deal with the rest of the form.There are two main methods for validating forms: server-side (using CGI scripts, ASP,...

Using Camera API with only Embedded Visual C++ 4.0 (evc4): Sample code and EVC4 workspace download

Using Camera API with only Embedded Visual C++ 4.0 (evc4): Sample code and EVC4 workspace downloadIn my previous post, I talked about how to use the new Camera API in Windows Mobile 5.0 SDK with only Embedded Visual C++ 4.0 (evc4).You can download the EVC4 workspace here. The source code is written based on the MSDN documentation on SHCameraCapture, which states: Application writers should be aware that SHCameraCapture function can cause the calling application to stop responding in cases where the calling application is minimized and then reactivated while the call to SHCameraCapture function is still blocking.The sample code is written by copying the snippets in that MSDN documentation, although I do not really find such "stop responding" mischief using the "possible sequence of events"....

Page 1 of 3612345Next
Twitter Delicious Facebook Digg Stumbleupon Favorites More