Charts for Mobiles
Its a great feature that Adobe has given support for Flex charts on mobiles
All the MX charting components can be used in mobile development. Just need to make sure that you don’t use too much of animations in your project.
Best practice to have good performance is not to use animations.
All the best for your Mobile Projects…
Have a nice Dev Time
SQL Database Connection with Flex Air
Just create simple air application in Flex.
Using the below code you can able to connect to database.
<?xml version=“1.0″ encoding=“utf-8″?>
<mx:WindowedApplication xmlns:mx=“http://www.adobe.com/2006/mxml”
layout=“absolute” creationComplete=“init()”>
<mx:Script>
<![CDATA[
import mx.controls.Alert;
private var dbConn:SQLConnection;
private var dbFile:File;
private function init():void
{
dbFile = File.applicationStorageDirectory.resolvePath("flashallys.db");
dbConn = new SQLConnection();
try
{
dbConn.open(dbFile, SQLMode.CREATE);
}
catch(e:SQLError)
{
Alert.show("SQL Error Occured: ", e.message);
}
}
]]>
</mx:Script>
</mx:WindowedApplication>
Here goes the explanation
These two lines are mandatory to declare the SQL connection and to declare db file.
private var dbConn:SQLConnection; private var dbFile:File;
We apply init funtion for this to dish out the file storage and to establish SQL connection.
private function init():void
{
dbFile = File.applicationStorageDirectory.resolvePath(“flashallys.db”);
dbConn = new SQLConnection();
This part of the code figures out if the output is productive and connects to the database.
try
{
dbConn.open(dbFile, SQLMode.CREATE);
}
Or else,this turns out to display the occurence of an error.
catch(e:SQLError)
{
Alert.show(“SQL Error Occured: “, e.message);
}
}
How to Change Font Size onClick using JavaScript
add this script in your header:
<script type="text/javascript">
function textResize(text) {
if (document.body.style.fontSize == "") {
document.body.style.fontSize = "1.0em";
}
document.body.style.fontSize = parseFloat(document.body.style.fontSize) + (text * 0.2) + "em";
}</script>
Then add this code anywhere in your body:
<a href="javascript:void(0);" onclick="textResize(1)">Make text bigger</a> | <a href="javascript:void(0);" onclick="resizeText(-1)">Make text smaller</a>
Detect Ipad, Iphone and Desktop using PHP
if(strstr($_SERVER['HTTP_USER_AGENT'],'iPad')){
echo "Opened in IPad";
}else if(strstr($_SERVER['HTTP_USER_AGENT'],'iPod')){
echo "Opened in IPhone";
}else{
echo "Opened in Desktop";
}
Here comes the clear account of the code:
['HTTP_USER_AGENT']
This is the key in the server variable used in the code,serves the purpose of tracing out the gadget user has been utilizing.
It can be accessed from the server variable $_SERVER.
The code further follows up checking the gadget by simple If-Else loops and display the appropriate content.
Image Editing in Firefox-easy screen shot editor
Just came across this simple and powerfull tool which is easy to use.
Image editing is a common requirement which come across in your daily need while working.
Her is the tool for it “Aviary Screen Capture”
This tool enables us to simply take screen shots from the firefox and edit the with ease.
we have many features like crop, rotate, resize adding new arrows, draw boxes, draw rectangles etc.
This is simple like a mini photoshop.
Try yourself.
All the best.
CS4, CS3 caretIndex Word
The code also works with flash cs3
import fl.controls.TextInput;
import fl.controls.Label;
var myLabel:Label = new Label();
myLabel.text = "Caret Index Word";
myLabel.x = 5;
myLabel.y = 0;
addChild(myLabel);
var textInput:TextInput = new TextInput();
textInput.x = 100;
textInput.y = 10;
addChild(textInput);
var t:Timer = new Timer(100);
t.addEventListener(TimerEvent.TIMER, caretindex);
function caretindex(e:TimerEvent):void {
var caretIndex:Number = textfield.getCharIndexAtPoint(textfield.mouseX, textfield.mouseY)
if(caretIndex == -1) {
return;
}
var str:String = textfield.text;
var words:Array = str.split(' ');
var n:Number = 0;
while(n<=words.length){
var subset:Array = words.slice(0, n);
var sliceString:String = subset.join(' ');
if(sliceString.length>caretIndex) {
textInput.text = String(subset[n-1]);
break
}
n++;
}
}
t.start();
How to Increase File Upload Size in WordPress
There are three methods to increase the file upload size.
1. functions.php in the Theme Folder
There are cases where we have seen that just by adding the following code in the theme function’s file, you can increase the upload size:
@ini_set('upload_max_size', '64M');
@ini_set('post_max_size','64M');
@ini_set('max_execution_time','300');
2. Create or Edit php.ini File
In most cases if you are on a shared host, you will not see a php.ini file in your directory. If you do not see one, then create a file called php.ini and upload it in the root folder. In that file add the following code:
upload_max_filesize = 64M post_max_size = 64M max_execution_time = 300
3. In .htaccess file
Add the below lines in .htaccess filein the root folder and add the following code:
php_value upload_max_filesize 64M php_value post_max_size 64M php_value max_execution_time 300 php_value max_input_time 300