Thursday, May 29, 2014

Rackspace: How to update router routes for old server

go through:

http://www.rackspace.com/knowledge_center/article/updating-servicenet-routes-on-cloud-servers-created-before-june-3-2013

wget http://7c1f6a0506404b3af970-42fdda7fdbf4103081a78c20ac1c54cb.r51.cf1.rackcdn.com/add_2013_cloud_routes_v1.0.4.sh


bash add_2013_cloud_routes_v1.0.4.sh 

bash add_2013_cloud_routes_v1.0.4.sh --check

sudo bash add_2013_cloud_routes_v1.0.4.sh --add-route


Tuesday, May 27, 2014

In app purchase android: signature verification error

Use below tips to resolve it:

If you have used the android.test.purchased then one way to get rid of the error is to do the following:-
  1. Edit Security.java and change the "return false" line in the verifyPurchase to "return true" - this is temporary, we'll be putting it back in a minute.
  2. In your QueryInventoryFinishedListener, after the "if (result.isFailure()) {...}" lines add the following to consume and get rid of your never ending android.test.purchased item:-
    if (inventory.hasPurchase(SKU_ANDROID_TEST_PURCHASE_GOOD)) {
    mHelper.consumeAsync(inventory.getPurchase(SKU_ANDROID_TEST_PURCHASE_GOOD),null); }
  3. Run your app so the consunmeAsync happens, this gets rid of the "android.test.purchased" item on the server.
  4. Remove the consumeAsync code (or comment it out).
  5. Back in the Security.java, change the "return true" back to "return false".

Reference:
http://stackoverflow.com/questions/14600664/android-in-app-purchase-signature-verification-failed

Monday, May 26, 2014

New hire setup at hinkhoj

Tech to Learn:
1. ubuntu operating system
2. apt-get tool for installing new softwares.

Import softwares to be installed:
1. git
2. vim
3.apache2
4.php5
5.mysql-server
6. phpmyadmin


new machine setup:
1. install ubuntu 12.04 LTS x64
3. configure /var/www/ folder

sudo adduser hinkhoj www-data
sudo chown hinkhoj:www-data -R /var/www
sudo chmod 755 -R /var/www


Android setup:
1. get adt complete bundle
2. make link to eclipse on desktop
3. install 32 libs for 12.04 LTS on x64

Bashrc setup:

export PATH=$PATH:$HOME/android-sdk/sdk/platform-tools:$HOME/android-sdk/sdk/tools


Monday, May 19, 2014

PHP: display date with right timezone


$date = new DateTime($row['date_added'], new DateTimeZone('UTC'));
$date->setTimezone("Asia/Culcutta");
            $reportInfo[]=Array(
                               'status'=>$row['status'],
                               'date'=>$date->format("d-m-Y h:i a"),

Wednesday, May 14, 2014

Apache2: How to check status

use : http://localhost/server-status

1. is status module enabled?
/etc/apache2/mods-enabled/status.conf


Open using below command:

lynx http://localhost/server-status




Monday, May 12, 2014

Android: Listview with expandable hieght

Use below code:
package HinKhoj.Dictionary.ui;
import android.content.Context;
import android.util.AttributeSet;
import android.view.ViewGroup;
import android.widget.ListView;

public class ExpandableHeightListView extends ListView
{

    boolean expanded = false;

    public ExpandableHeightListView(Context context)
    {
        super(context);
    }

    public ExpandableHeightListView(Context context, AttributeSet attrs)
    {
        super(context, attrs);
    }

    public ExpandableHeightListView(Context context, AttributeSet attrs,
            int defStyle)
    {
        super(context, attrs, defStyle);
    }

    public boolean isExpanded()
    {
        return expanded;
    }

    @Override
    public void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
    {
        // HACK! TAKE THAT ANDROID!
        if (isExpanded())
        {
            // Calculate entire height by providing a very large height hint.
            // View.MEASURED_SIZE_MASK represents the largest height possible.
            int expandSpec = MeasureSpec.makeMeasureSpec(MEASURED_SIZE_MASK,
                    MeasureSpec.AT_MOST);
            super.onMeasure(widthMeasureSpec, expandSpec);

            ViewGroup.LayoutParams params = getLayoutParams();
            params.height = getMeasuredHeight();
        }
        else
        {
            super.onMeasure(widthMeasureSpec, heightMeasureSpec);
        }
    }

    public void setExpanded(boolean expanded)
    {
        this.expanded = expanded;
    }
}


usage:

SimpleListAdapter adapter = new SimpleListAdapter(getActivity(), R.layout.simple_list_item,defMeaning);

meaning_list.setAdapter(adapter);
meaning_list.setExpanded(true);

Tuesday, May 6, 2014

How to check connected ip address to apache2

Run below command to check connected ip address:

netstat -ntu | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -nr >ip.txt

open ip.txt to check list


Sunday, May 4, 2014

How to take right receipt of payment

Below conditions should be met:

1. It should be legal receipt of payment.
2. It should mention date in full.
3. It should have Bill Number
4. It Must have signature of payment receiver.
5. It should have Legal name of business.
6. It should contain your name if possible.

After receipt:
1. scan it to expensify or put scanned on drop box.