Tumblelog by Soup.io
Newer posts are loading.
You are at the newest post.
Click here to check if anything new just came in.

March 09 2017

March 02 2017

Android build automation using ant

Problem I was suffering was – I have a single library project and I built multiple apps by just changing skin/theme of project. Sometimes I have to create 10 android releases at a time.  Then I created a batch script using ant for each project. When I want to release the project I just go and click on batch file. That’s it!!

First thing first – I am on Windows

Step 1 – Install ant and make sure it is in your executable PATH. I,e add “c:\ant\bin” to system variable ‘path’ in  ‘Environment Variables’

Step 2 – Make sure you have added android in your executable PATH. I,e add “E:\android sdk path\tools” to system variable ‘path’ in  ‘Environment Variables’

Step 3 – create a keystore for your app. Please follow instructions here to create keystore- http://developer.android.com/tools/publishing/app-signing.html

Step 4 – create file ant.properties. It should contain code below –

key.store=my.keystore     -> path of keystore file

key.alias=mykey                 -> keystore alias

key.store.password=my123!@#    -> keystore password

key.alias.password=my123!@#     -> keystore alias password

Step 5 – put both files “my.keystore” and “ant.properties” in root of your workspace. (If you have multiple keystores store them inside project)

Step 6 – Create batch file for project – myProject.sh having code below

   SET projectpath=”D:\workspace\project”
   SET destpath=”C:\Dropbox\release”
   xcopy ” D:\workspace\ant.properties” %projectpath% /Y
   xcopy ” D:\workspace\my.keystore” %projectpath% /Y
   pushd %projectpath%
   call ant clean
   call android update project -p %projectpath%
   call ant release
   pushd %projectpath%”\bin” rename “Main-release.apk” “project name.apk”
   xcopy %projectpath%”\bin\project name.apk” %destpath% /Y

Little explanation –

   Set your project path in variable projectpath
   Set path where you want to store your apk in variable destpath
   Copy file ant.properties inside project (in my case from workspace to project)
   Copy keystore inside project (in my case from workspace to project)
   Go inside your project folder
   Clean your android project
   Update your android project
   This command will create a android market ready release/apk inside ‘bin’ folder of your project
   Go inside bin folder of your android project and rename project apk
   Copy apk from inside bin folder to destpath you have set on line 2

Now you can create as many batch files as you want. When you want to release app to market just run the batch file. This is very use full when you have multiple projects using a single library

Facebook Graph api tutorial em php

In today’s social web ecosystem every website, mobile application or desktop application needs to offer more personalized social experience to its users. Facebook is leading social network with its more that 500 million user base. Your website at the some point will require to make use of the features made avaialbe by Facebook platform. Facebook leverages Single sign on, login to your website using user’s Facebook credentials, fetching user’s data from facebook to your database, creating interactive facebook application for immersive or promotional purposes.



In this first post we will cover:

  • Core concepts of the Facebook platform
  • Facebook authentication process using Oauth 2.0 protocol
  • Use official PHP sdk to access user’s public data
  • User ‘extended permissions’ feature to access user’s private data

Core concepts of the Facebook platform:

Social Graph:

At the core of Facebook platform is social graph. A graph consists of interconnected nodes. Facebook users, their photos, videos, events created by these users, Facebook pages created by organizations – all these objects are nodes of the social graph. These objects are connected to each other via relationships. Facebook uses a term called ‘connections’ for these relationships.

Let’s see some examples to explain this:

  1. 1. Kiran(object) likes (connection) movie A beautiful Mind(another object)
  2. 2. Swapnil(object)  is friends(connection)  with Neeraj, Sayali and Nikhil (another object).
  3. 3. Neeraj(object) is attending(connection) Mobile Development Workshop(an event object created by Kiran).

Graph API:

Now that we understand social graph, lets discuss how do we interact with the facebook platform to fetch and manage user data. First and foremost you need to set up an application with Facebook by clicking <link>here. Once you have the APP ID and APP SECRET from facebook, you can use that to authenticate the application with Facebook.

At the heart of Graph API is the request url. To fetch or add data of a particular user, a proper url is constructed and sent to the Facebook. The url looks like:


for example:

<a href="http://graph.facebook.com/kiran.aghor">http://graph.facebook.com/kiran.aghor</a>

this will give back:

  "id": "655556058",
  "name": "Kiran Aghor",
  "first_name": "Kiran",
  "last_name": "Aghor",
  "link": "http://www.facebook.com/kiran.aghor",
  "gender": "male",
  "locale": "en_US"

Objects can also be requested by using username as shown in above example. In most of the cases we will use a unique ID associated with the object.

For example, an event’s url will look like :


And it will return:

  "id": "183061051717336",
  "owner": {
     "name": "Niraj Narkhede",
     "id": "850040183"
  "name": "Mobile Application Development Workshop",
  "description": "Our core objective is to make aware the audience about mobile application development (iPhone & Android) and opportunities in this exciting field.\n\nWe will lead beginners through the essential facets of iPhone and Android application development. After completing the workshop, attendees will have the confidence to get into the mobile development field. The confidence comes from our emphasis on building applications while learning the necessary programming concepts.\n\nTake Learning Development Kit Home with Internship Certificates.",
  "start_time": "2011-01-27T09:00:00",
  "end_time": "2011-01-28T19:00:00",
  "location": "PVG's COET, Pune (AUDITORIUM)",
  "privacy": "OPEN",
  "updated_time": "2011-01-22T05:07:16+0000"

Authentication and Oauth:

So far in our examples we were able to access user’s data without needing to login to Facebook or without using users login credentials. The data we were accessing is called public data of a user. Facebook does not provide user’s private data to other applications without user’s explicit permissions. Using graph API application can ask for specific permission such as — from a user.

Key components of the Oauth:

  1. Service Provider: Facebook platform
  2. User: the one whose data we are interested in
  3. Consumer: our website and the application we set up with Facebook are willing to consume the user’s data
  4. Resources: The specific data that we want from user. Photos, friends, events, messages etc

Oauth Flow

  1. When user first visits your web application, a facebook login button will be shown to the users. Clicking on it will redirect the user to Facebook’s OAuth Dialog.


  1. Request token: When the app is authorized, the OAuth Dialog will redirect the user’s browser to the URL you passed in the redirect_uri parameter with an authorization code. In oauth terminology this ‘code’  is called ‘request token’.
  2. App authentication:  In order to authenticate your app, you      must pass the authorization code(Request token) and your app secret to the      Graph API token endpoint /oauth/access_token?app_id&secret&code.
  3. Access Token:  If      your app is successfully authenticated and the authorization code from the      user is valid, the authorization server will return the access token. Access      token is a random string contain alphanumeric values. Now we can use this      access_token to interact with the Graph API.
  1. User authentication: If the user is not logged in, they are prompted to enter their credentials( Facebook username and password).
  2. App authorization:  After the user is  successfully authenticated, the OAuth Dialog will prompt the user to authorize the app.

Extended Permissions:

By default only basic info of user is returned to our site. To get more info of a user and its connections we need to ask for that info explicitly through our graph authentication url. A parameter called ‘scope’ is used the request url to get these extended permissions.

Offline Access:

If we want to manage Facebook activities (post on user’s wall, create event, upload photos) without asking user for login each time, we can do this from our website if we get the permission – ‘offline_access’ from user.

Lets Dive In and start coding

php securyti

Securing file uploads in PHP

In: PHP Security27Jan2014

The most ignored topic in PHP world is securing file uploads. Most of the beginners do not even know that file upload code that is being used is the most fatal way of compromising the application security. In this blog post I want to address some of the issues and solution I have come across.File type validation: Never trust $_FILES[“file”][“type”]
It is common practice to verfiy the MIME type of the uploaded file comparing value present in $_FILES[“file”][“type”] . Well, this is user submitted data and PHP does not validate this on server side. It is possible to to fake it on client side. For instance a .php or .htaccess file will be uploaded with MIME type of ‘png’ or ‘jpeg’ and server code will simply accept it. Once the file gets added to the server it may cause havoc.Better way to validate MIME type can be:

For php version >= 5.3 Use finfo_file() function.

PHP has a deprecated mime_content_type() function. It returns string containing MIME type of the file.

If shell access is allowed on server, following will give you the MIME type:

$mime = shell_exec(“file -bi ” . $file);

If you are working with Images only, then quickest way is to use:$file = ‘path/to/image.jpg’;
$image_mime = image_type_to_mime_type(exif_imagetype($file));

Following function combines the techniques from first 3 points above:function get_mime($file) {
 if (function_exists(“finfo_file”)) {
   $finfo = finfo_open(FILEINFO_MIME_TYPE); // return mime type ala mimetype extension
   $mime = finfo_file($finfo, $file);
   return $mime;
 } else if (function_exists(“mime_content_type”)) {
   return mime_content_type($file);
 } else if (!stristr(ini_get(“disable_functions”), “shell_exec”)) {
   // http://stackoverflow.com/a/134930/1593459
   $file = escapeshellarg($file);
   $mime = shell_exec(“file -bi ” . $file);
   return $mime;
 } else {
   return false;

No related posts.Wild symbolsJuly 9th, 2014 at 6:08 pm

Appreciate this post. Will try it out.Comment FormAbout this blog

We are web development professionals primarily working on PHP, Mysql, Codeigniter, WordPress, Laravel and Jquery and making all these technologies work on mobile devices. Read more..PhotostreamCategoriesArchiveshtml5video-galleryphotogalleryswipe-galleryRecent PostsRecent CommentsArchivesCategories

Copyright © 2007 - PHP Karma -  is proudly powered by WordPress | Log in

Compositio Theme is created by: Design Disease brought to you by PremiumThemes.com

Curso PHP do Zero ao Profissional Funciona?

 Quais São os Módulos do Curso PHP do Zero ao Profissional?

O curso é um dos mais completos da atualidade, e é composto por 12 módulos e mais de 220 aulas.Além de todo o curso você é convidado semanalmente para uma aula especial de tira dúvidas, entre todos os alunos do método.

Módulo #1 – Introdução
Uma introdução ao que você precisa saber para começar, como por exemplo, como um site é construído, como o php funciona, as definições de termos importantes na programação e os principais editores, etc.

Módulo #2 – Configurando servidor
Neste módulo você vai ver várias aulas sobre como configurar um servidor interno e externo, passo a passo. Incluindo todas as possíveis variações e seus porquês… Aqui é a preparação do ambiente pra começarmos a meter a mão na massa!

Módulo #3 – Lógica de programação
Aqui você será introduzido a todos os conceitos que envolvem a programação, bem como entender detalhadamente como é que funciona a lógica e forma de pensar para se programar com eficiência. Várias técnicas e exemplos são mostrados nessas aulas

Módulo #4 – PHP Básico
Finalmente você será introduzido ao PHP e todos seus passos mais básicos, como definição de variável, uso dos condicionadores, variáveis escaláveis, dentre outros…

Módulo #5 – PHP Intermediário
Aqui você será apresentado à alguns conceitos mais sofisticados do PHP, que são necessários para o desenvolvimento de alguns tipos de sistemas e sites. Coisas como o uso de loops, funções de manipulação, conexão com banco de dados e gerenciamento de excessões.

Módulo #6 – PHP Avançado
Aqui você será introduzido ao conceito de orientação a objetos, bem como outras técnicas mais avançadas de programação, incluindo a biblioteca GD, criando classes com abstração e herança e introdução ao MVC.

Módulo #7 – PHP Super Avançado
Aqui você será imergido no conceito de arquitetura de software avançada, que é o “santo graal” do PHP. É onde você desenvolve os sitemas mais avançados e complexos. Nós vamos criar juntos, passo a passo, sistemas utilizando a estrutura MVC, HMVC, Singleton e diversas outras. Inclusive o uso de cache avançado, versionamento e sistemas multitenancy.

Módulo #8 – Aplicações Práticas
Você irá acompanhar um passo a passo explicativo de como utilizar as técnicas que aprendeu nos módulos anteriores, na prática. Então, iremos recriar vários tipos de sistemas famosos do zero, como Facebook, Twitter, UOL, ContaAzul, sites, micro-frameworks, CMS e um bônus secreto.

Módulo #9 – WebServices
Você será introduzido ao conceito e aplicação de webservices, que são intermediadores dos acessos entre uma plataforma e o servidor. Várias exemplificações práticas serão mostradas nessas aulas.

Módulo #10 – Frameworks
Nós iremos te explicar o ápice do desenvolvimento web, que são os frameworks, ou seja, conjunto de bibliotecas e ferramentas capazes de agilizar e facilitar o desenvolvimento de sistemas e sites complexos. Vamos abordar as principais técnicas e exemplificá-las!

Módulo #11 – Técnicas De Venda
De que adianta você ser o melhor programador do mundo se ninguém te paga nada? Nesse módulo você vai aprender as melhores técnicas de vendas para programadores. Técnicas usadas por mim há anos. Aprenderá a vender de forma tão natural que até você ficará surpreso!

Módulo #12 – Produtividade
Por definir seu próprio tempo, muitas pessoas começam a entrar em uma onda de procrastinação muito grande. Você vai aprender a organizar seu tempo ao máximo através de várias técnicas, como a Pomodoro e outras.

Confira: http://phpdozeroaoprofissionalfunciona.com/

February 27 2017

Aqui está um convite para [RPG] Kawaii School

Aqui está um convite exclusivo para a minha comunidade -[RPG] Kawaii School

no link para instruções sobre como entrar. Vejo você lá!

Aqui está um convite para [RPG] Kawaii School

Aqui está um convite exclusivo para a minha comunidade -[RPG] Kawaii School

no link para instruções sobre como entrar. Vejo você lá!


Confira esta postagem no Amino

July 30 2011

8109 9d54 500


Anyone want to try and hack into the Homeland Security wifi?

1677 f9f9 500

July 11 2011

8512 b6e5

July 08 2011

6582 2d28


Found on LINK

Reposted bysavatage savatage

July 04 2011

4524 27d8
Reposted byeirena eirena

June 26 2011

4102 bfd8 500

June 25 2011

1776 ad7d



Twitter / きぃ: 自分と気の合う人としか付き合わないというのは、常に高 … (via sryuuki) (via ssbt) (via hsmt) (via uessai-text) (via yasunao) (via usaginobike) (via nemoi) (via pjmix) (via mania1964) (via mcsgsym)
2009-09-28 (via gkojay) (via joker1007)
マクドナルドのことを、オレは関西出身だから「マクド」、嫁は関東 だから「マック」と呼ぶ我が家で、3歳の娘は何と呼ぶようになるんだろうと思っていたら、今日、オレと話す時は「マクド」、嫁との時は「マック」と言っい て、ちょっとしたバイリンガルだということが判明した。
Twitter / @dandori (via ajinotatakinamennna)
Older posts are this way If this message doesn't go away, click anywhere on the page to continue loading posts.
Could not load more posts
Maybe Soup is currently being updated? I'll try again automatically in a few seconds...
Just a second, loading more posts...
You've reached the end.

Don't be the product, buy the product!