Changing coordinate system using rotation 2D from canonical base UPDATE

Some weeks ago I wrote a C code for a particular case of changing coordinateas using rotation matrix and today I rewrote it for a general use:
CODE:

 1 #include<stdio.h>
2 #include<math.h>
3 #define PI 3.14159265
4 double a[2][2],b[2],c[2],x;
5 int i,j;
6 /*initializare matrice rotatie*/
7 void matrice_rotatie(double a[2][2],double x)
8 {a[0][0]=a[1][1]=cos(x*2*PI/360);
9 a[0][1]=-sin(x);
10 a[1][0]=sin(x);
11 }
12 /*rotatie*/
13 void rotatie(double b[2],double c[2],double a[2][2])
14 {
15 for(i=0;i<2;i++)
16 for(j=0;j<2;j++)
17 c[i]+=a[i][j]*b[i];
18 }
19 /*afisare_matrice*/
20 void afis_matrice(double a[2][2]){
21 for (i = 0; i < 2; i++) {
22 for (j = 0; j < 2; j++)
23 printf("%.2lf ", a[i][j]);
24 printf("
"
);
25 }
26 }
27 int main(){
28 printf("Coordonatele punctului:");scanf("%lf %lf",&b[0],&b[1]);
29 printf("Unghiul de rotatie:");scanf("%lf",&x);
30 matrice_rotatie(a,x);
31 rotatie(b,c,a);
32 printf("coordonatele noi sunt:%.2lf si %.2lf
"
,c[0],c[1]);
33 return 0;
34 }
Read More..

Different case in lifecycle of Activity and Fragment

Its part of the articles of lifecycle: start reading from Understand lifecycle of Activity and Fragment, Introduction.


I try to show the different case in lifecycle of Activity and Fragment in this post. Before I show the code, I show what found in my trial experiment.

case 1:
    Close app by HOME, become invisible:
  • MainActivity.onPause
  • MyFragment1.onPause
  • MainActivity.onStop
  • MyFragment1.onStop

  • back from closed app:
  • MainActivity.onRestart
  • MainActivity.onStart
  • MyFragment1.onStart
  • MainActivity.onResume
  • MyFragment1.onResume



case 2:
    Finished by calling finish() method (press the finish button):
  • MainActivity.onPause
  • MyFragment1.onPause
  • MainActivity.onStop
  • MyFragment1.onStop
  • MainActivity.onDestroy
  • MyFragment1.onDestroyView
  • MyFragment1.onDestroy
  • MyFragment1.onDetach

  • back from finished:
  • MainActivity.onCreate
  • MainActivity.onCreate / savedInstanceState == null
  • MainActivity.onStart
  • MyFragment1.onAttach
  • MyFragment1.onCreate
  • MyFragment1.onCreateView
  • MyFragment1.onActivityCreated
  • MyFragment1.onStart
  • MainActivity.onResume
  • MyFragment1.onResume

case 3:
    Orientation changed:
  • MainActivity.onPause
  • MyFragment1.onPause
  • MainActivity.onStop
  • MyFragment1.onStop
  • MainActivity.onDestroy
  • MyFragment1.onDestroyView
  • MyFragment1.onDestroy
  • MyFragment1.onDetach
  • MainActivity.onCreate
  • MyFragment1.onAttach
  • MyFragment1.onCreate
  • MainActivity.onCreate / savedInstanceState != null
  • MainActivity.onStart
  • MyFragment1.onCreateView
  • MyFragment1.onActivityCreated
  • MyFragment1.onStart
  • MainActivity.onResume
  • MyFragment1.onResume

case 3:
    Kill by system
    (refer this post to simulate activity killed by system)
  • MainActivity.onPause
  • MyFragment1.onPause
  • MainActivity.onStop
  • MyFragment1.onStop
  • MainActivity.onDestroy
  • MyFragment1.onDestroyView
  • MyFragment1.onDestroy
  • MyFragment1.onDetach

  • back from killed
  • MainActivity.onCreate
  • MyFragment1.onAttach
  • MyFragment1.onCreate
  • MainActivity.onCreate / savedInstanceState != null
  • MainActivity.onStart
  • MyFragment1.onCreateView
  • MyFragment1.onActivityCreated
  • MyFragment1.onStart
  • MainActivity.onResume
  • MyFragment1.onResume




The test code is modified version from the post "Understand lifecycle of Activity and Fragment". To make the main code clear, custom Activity (MyFragmentActivity extends FragmentActivity) and Fragment (MyFragment extends Fragment) were implemented to display status of lifecycle on Toast and log in LogCat.

MyFragmentActivity.java
package com.example.androidfragmenttest;

import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.util.Log;
import android.widget.Toast;

public class MyFragmentActivity extends FragmentActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
recLifeCycle();
super.onCreate(savedInstanceState);
}

@Override
protected void onStart() {
recLifeCycle();
super.onStart();
}

@Override
protected void onRestart() {
recLifeCycle();
super.onRestart();
}

@Override
protected void onResume() {
recLifeCycle();
super.onResume();
}

@Override
protected void onPause() {
recLifeCycle();
super.onPause();
}

@Override
protected void onStop() {
recLifeCycle();
super.onStop();
}

@Override
protected void onDestroy() {
recLifeCycle();
super.onDestroy();
}

public void recLifeCycle(){

String className = getClass().getSimpleName();
StackTraceElement[] s = Thread.currentThread().getStackTrace();
String methodName = s[3].getMethodName();

Toast.makeText(getApplicationContext(),
className + "." + methodName, Toast.LENGTH_SHORT).show();
Log.i("MYTAG", className + "." + methodName);

}

public void recLifeCycle(String note){
String className = getClass().getSimpleName();
StackTraceElement[] s = Thread.currentThread().getStackTrace();
String methodName = s[3].getMethodName();

Toast.makeText(getApplicationContext(),
className + "." + methodName, Toast.LENGTH_SHORT).show();
Log.i("MYTAG", className + "." + methodName + " / " + note);
}

}


MyFragment.java
package com.example.androidfragmenttest;

import android.app.Activity;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;

public class MyFragment extends Fragment {

@Override
public void onAttach(Activity activity) {
recLifeCycle();
super.onAttach(activity);
}

@Override
public void onCreate(Bundle savedInstanceState) {
recLifeCycle();
super.onCreate(savedInstanceState);
}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
recLifeCycle();
return super.onCreateView(inflater, container, savedInstanceState);
}

@Override
public void onActivityCreated(Bundle savedInstanceState) {
recLifeCycle();
super.onActivityCreated(savedInstanceState);
}

@Override
public void onStart() {
recLifeCycle();
super.onStart();
}

@Override
public void onResume() {
recLifeCycle();
super.onResume();
}

@Override
public void onPause() {
recLifeCycle();
super.onPause();
}

@Override
public void onStop() {
recLifeCycle();
super.onStop();
}

@Override
public void onDestroyView() {
recLifeCycle();
super.onDestroyView();
}

@Override
public void onDestroy() {
recLifeCycle();
super.onDestroy();
}

@Override
public void onDetach() {
recLifeCycle();
super.onDetach();
}

public void recLifeCycle(){

String className = getClass().getSimpleName();
StackTraceElement[] s = Thread.currentThread().getStackTrace();
String methodName = s[3].getMethodName();

Toast.makeText(getActivity(),
className + "." + methodName, Toast.LENGTH_SHORT).show();
Log.i("MYTAG", className + "." + methodName);
}

public void recLifeCycle(String note){

String className = getClass().getSimpleName();
StackTraceElement[] s = Thread.currentThread().getStackTrace();
String methodName = s[3].getMethodName();

Toast.makeText(getActivity(),
className + "." + methodName, Toast.LENGTH_SHORT).show();
Log.i("MYTAG", className + "." + methodName + " / " + note);
}

}


MainActivity.java
package com.example.androidfragmenttest;

import android.os.Bundle;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.FrameLayout;

public class MainActivity extends MyFragmentActivity {

static public class MyFragment1 extends MyFragment {

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
View view = inflater.inflate(R.layout.fragment_layout1, null);
return view;
}

}

FrameLayout fragmentContainer;
Button buttonFinish;

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

buttonFinish = (Button)findViewById(R.id.finish);
buttonFinish.setOnClickListener(new OnClickListener(){

@Override
public void onClick(View arg0) {
finish();
}});

fragmentContainer = (FrameLayout) findViewById(R.id.container);
if (savedInstanceState == null) {
// ifs the first time created
recLifeCycle("savedInstanceState == null");

MyFragment1 myListFragment1 = new MyFragment1();
FragmentManager supportFragmentManager = getSupportFragmentManager();
FragmentTransaction fragmentTransaction = supportFragmentManager
.beginTransaction();
fragmentTransaction.add(R.id.container, myListFragment1);
fragmentTransaction.commit();


}else{
recLifeCycle("savedInstanceState != null");
}
}

}


/res/layout/activity_main.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:orientation="vertical"
tools:context=".MainActivity" >

<Button
android:id="@+id/finish"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="finish()"/>
<FrameLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</FrameLayout>

</LinearLayout>


/res/layout/fragment_layout1.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:orientation="vertical"
tools:context=".MainActivity" >

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Fragment 1"/>

</LinearLayout>


Test different case in lifecycle of Activity and Fragment


download filesDownload the files.

* the original chart of lifecycle is taken here.

Read More..

Anti Mosquito Sonic Repeller v1 5 APK Android FULL VERSION

Anti Mosquito - Sonic Repeller v1.5 APK Android FULL VERSION

Anti Mosquito - Sonic Repeller v1.5 APK Android FULL VERSION
Req: Android 1.6+ Android Apk Free


Anti Mosquito - Sonic Repeller v1.5 APK Full version new release! This Mosquito Repeller prevents you from getting bitten by mosquitoes.

Each year there are more than 225 million cases of malaria, killing around 781,000 people.

The application emit a very unique high frequency sound (ultra sound) that the insects dislike. The pitch of the sound is so high that most humans will not notice anything.

Keep the application close to you and enjoy the outdoors without bites.... say no to MOSQUITO!

GET NOW!

Download Anti Mosquito - Sonic Repeller v1.5 APK Android FULL VERSION
Read More..

Brain Puzzle Block Rogue 1 3 Android

Block Rogue 1.3 (Android)
Requirements: Android 2.2

Block Rogue 1.3 (Android) Overview: A massive, labyrinthine dungeon, hundreds of mind-bending puzzles, and a dark mystery waiting to be solved. Prepare yourself: Block Rogue is the biggest mobile puzzle adventure game ever made.
Think you’re good at solving puzzles? I hope so, because little Ilbin really needs your help. He’s lost in this dungeon, you see, and seems to be suffering from a bit of memory loss. And the only things keeping him company are a bunch of talking mirrors, magic orbs, and a torn-up book of secrets.
Help Ilbin puzzle his way through, and we’ll figure out what’s up with this crazy dungeon!

Block Rogue 1.3 (Android) features:

  • - Winner of Microsoft-sponsored "Dr. Dobbs Challenge Deuce" competition
  • - Slide to Play says: "Sokoban has never been as addictive as it is in Block Rogue"
  • - Recipient of "The Gamers Temple Award of Excellence"
  • - Featured as Edge magazines "Friday Game"
  • - Featured in Cult of Macs "Must-Have iOS Games of the Week"
  • - Featured in GameFronts "Notable Mobiles"
  • - Block Rogue is a puzzle game where each solution brings you one step closer to discovering the truth!
  • - Progress is automatically saved! Jump in and jump out at your leisure.
  • - Puzzle rooms are randomly-generated using ingenious and sinister algorithms for endless replay value!
  • - Mind-bending room configurations, from standard push-block puzzles to complex amalgamations of roller-balls, switches, death-rays, and more!
  • - Shockingly-deep lore with secret stories hidden throughout the game!


Block Rogue 1.3 (Android) screenshot:
Block Rogue 1.3 (Android)Block Rogue 1.3 (Android)

Block Rogue 1.3 (Android)

Code:
https://play.google.com/store/apps/details?id=com.buzzmonkey.BlockRogue 

Download Block Rogue 1.3 (Android)
Code:
http://rapidgator.net/file/6215552/Block.Rogue.1.3.Android.zip.html 
http://bitshare.com/files/08ycs0ao/Block.Rogue.1.3.Android.zip.html 
http://ifile.it/kd5ce3u/Block.Rogue.1.3.Android.zip 
Read More..

Farm Story™

Farm Story™ 1.3.0

Farm Story: grow fruits, raise animals and decorate beautiful farm with friends!
Welcome to Farm Story™ where you and your friends can grow fruits, raise farm animals, and decorate the most beautiful farms!
Farm Story™ includes FREE updates with new fruits, decorations, animals, and more every week!

FEATURES:
- Plant over 150 varieties of delicious fruits, veggies, and beautiful flowers.
- Design and decorate your farm with trees, fences, and buildings.
- Visit real neighbors to watch their crops grow.
- Simple and easy-to-use tap interface.
- FREE updates with new fruits, flowers, trees, buildings, decorations, animals, fish, and more every week!
- It's FREE!

PLEASE NOTE:
- This is an online game only.
Read more »
Read More..

Handcent SMS v3 9 7 Android apk app


Requirements: for all Android versions
Overview: Handcent fully unleashes the messaging power for android phones, fully customizable and more features than the stock android messaging app.

  > Support All types for andorid phone,from android 1.5 to newest 2.3

> Full SMS/MMS support

> Support 20+ languges

> Group sending options,batch send

> SMS Popup with quick text

> Customize look with theme supports, include iphone look ,hero look, and support for downloading more skins and themes

> Individual contact notification,custom look (background,buble style) for different friends

> Security lock options, password protect handcent and your stock messaing application

> Backup/restore SMS /MMS, Handcent settings online and restore with one click

> My Handcent online services

> Built in spell checker

> Hundreds of handcent online themes, download them free and adding new themes everyday

> 20+ languages supported and will add more language support

> Better Mms support (better picture resize feature,help you download high resolution picture for UK carriers,settings Maximum Mms size)

> Handcent Mms Plus service, helps you send high resolution pictures and videos to your friends

> Additional smileys package add-on, you can download more smileys for handcent from android market

> Support local messaging protocol for different countries

> Split 160 feature support auto split message for CDMA network (for example: Verizon)

> Support for additional font packs, also can display sms message with many beautiful & stylish fonts

> Many plugins (Location,smileys,fontpack...)

> Built in Blacklist with the ability to make incoming mms/sms private per individual sender and help you block spam message.

> Supports manage drafts and undelivery messages

> Added vCard capacity for your android phone ,you can send/receive/import vCards from handcent

>Added Emoji capacity for your android phone,you can send cool/funny emoji icons to iphone and the android phones that installed handcent & handcent emoji plugin

>Handcent greetings include many holidays animated greetings ,you can choose the beatiful greeting and send to your friends.

>Handcent privacy box can help you hide & password protect threads/conversation, private conversations wont be read(or be made visible) by other messaging apps(stock, 3rd party, etc.)

>Support Schedule SMS & MMS messages,you can setup schedule task by daily ,monthly ,weekly ...,powerful

Visit http://www.handcent.com for more introduction & visit http://faq.handcent.com for frequently asked question

Whats in this version:
#3.9.7
> Fix force close at some ASUS phone type
> Improve display timestamp that recipient sent message
# 3.9.6
> Improve group sms feature,now it is fast to send 100+ group sms
>New 2.0 version of hadncent online website
>Support display timestamp of people sent the message now (classic android only include the timestamp that you received message normally)
>Add spell check feature to full editor window
>Add Serbian language support
>Fix Android 1.5 support and some known issues


Download Instructions:
http://www.filesonic.com/file/1496205071

Mirror:
http://www.filefat.com/e1ugevmospni
http://www.multiupload.com/RAXIVTA4AH
Read More..

Fast Burst Camera 2 0 1 v2 0 1 Android Apk App

Fast Burst Camera v2.0.1
Requirements: Android OS 2.2 - 2.3
Overview: Take 5 to 10 pictures per second with this high-speed camera application

Fast Burst Camera is capable of taking 5 to 10 photos per second. Hold shoot button for continuous burst, or tap for fast single shots
Supports flash, focus and zoom. Shutter sound can be turned of.

Great for
- sports shots
- pictures of kids or pets
- party camera
- taking a burst of pictures in an important situation, and pick the best later
- analyse your golf swing frame-by-frame

Tips for good burst photos
- get as much light as possible - especially when capturing things or people in motion
- keep the camera steady
- hold the shoot button for continuous bursts, and pick the good shots later

Whats in this version:
MAJOR improvement in burst size - now up to 100 pictures in a burst!
You can test this by selecting "All Available" in the Memory Buffer Size preference.
Please email support@spritefish.com if you experience issues with this.

Download Instructions:
http://www.filesonic.com/file/1819116324

Mirror:
http://www.wupload.com/file/130862572
http://www.multiupload.com/W3RNYBXYKB
<input name="IL_RELATED_TAGS" type="hidden" value="1">/></input>

Read More..