Thursday, September 22, 2016

Read / Write permissions in /opt directory

I changed the owner of the android studio directory from root to my user account and it worked. Here is the command, where $USER will change by itself to your current active user:

sudo chown -R $USER:$USER /opt/android-studio

Tuesday, April 28, 2015

Filter LogCat to get only the messages from My Application in Android?

Package names are guaranteed to be unique so you can use the Log function with the tag as your package name and then filter by package name:
NOTE: As of Build Tools 21.0.3 this will no longer work as TAGS are restricted to 23 characters or less.
Log.<log level>("<your package name>", "message");
adb -d logcat <your package name>:<log level> *:S
-d denotes an actual device and -e denotes an emulator. If there's more than 1 emulator running you can use -s emulator-<emulator number> (eg, -s emulator-5558)
Example: adb -d logcat com.example.example:I *:S
Or if you are using System.out.print to send messages to the log you can use adb -d logcat System.out:I *:S to show only calls to System.out.
You can find all the log levels and more info here:http://developer.android.com/guide/developing/tools/adb.html#logcat
EDIT: Looks like I jumped the gun a little and just realized you were asking about logcat in Eclipse. What I posted above is for using logcat through adb from the command line. I'm not sure if the same filters transfer over into Eclipse.

Thursday, November 27, 2014

STACK: Dagger example built through eclipse fails with 'Please ensure that code generation was run for this module.'

За dagger ашиглаж байхад 1 асуудал нэлээд цагийг минь үрлээ, энэ асуудлыг шийдсэн зааврыг орууллаа.

-----------------------------------------------------------------------------------
The problem is I am missing the javawriter library. Also, you MUST use version 2.2.1 of javawriter and NOT the latest which is 2.3.0 (this will probably change, but remains true at the time of writing this on 11/27/2013). The link provided should take you to the correct place. Please double triple check this, for a total of six times. I'll also include a list of other reasons why you might see this message.
First, please ensure that all these checkboxes are checked.
Project -> Properties ->Java Compiler -> Enable Project Specific Settings
Project -> Properties ->Java Compiler -> Annotation Processing -> Enable Project Specific Settings
Project -> Properties ->Java Compiler -> Annotation Processing -> Factory path -> Enable Project Specific Settings. 
Then on the same screen, click "Add jars" and add: javawriter-2.2.1.jar, dagger-1.1.0.jar, dagger-compiler-1.1.0.jar and javax.inject.jar in this list as well for a total of four jars.
Those four jars should be in a folder called 'libs' on your project's main path.
If you are using libraries and want to use Dagger for DI in those libraries, you will have to do the steps above on those projects as well.
-----------------------------------------------------------------------------------
Source: http://stackoverflow.com/questions/19555023/dagger-example-built-through-eclipse-fails-with-please-ensure-that-code-generat

Wednesday, November 12, 2014

STACK: Similarity String Comparison in Java

Calculating String Similarity:

The common way of calculating the similarity between two strings in a 0%-100% fashion, as used in many libraries, is measuring how much (in %) you'd have to change the biggest string to turn it into the other:
public static double similarity(String s1, String s2) {
    if (s1.length() < s2.length()) { // s1 should always be bigger
        String swap = s1; s1 = s2; s2 = swap;
    }
    int bigLen = s1.length();
    if (bigLen == 0) { return 1.0; /* both strings are zero length */ }
    return (bigLen - computeEditDistance(s1, s2)) / (double) bigLen;
}
// full copy-paste working code is below

Wednesday, November 5, 2014

HOW TO: AJAX form submission with Google App Engine

Form:

<form id="loginForm"  >

<label for="loginEmail">Email:</label>
<input type="email" name="usrEmail"  id="loginEmail"  autocapitalize="none" />
                    
<div  style="width:100%; height: 8px;"></div>
                    
<label for="loginPassword">Password: </label>
<input type="password" name="usrPassword" id="loginPassword"   autocapitalize="none" style="width:145px;"/>
<div  style="width:100%; height: 20px;"></div>
<div align="center">
<input type="submit" id="loginSubmitButton"  data-mini="true" data-inline="true" data-theme="b"  value="LOGIN" >
</div>

</form>

Tuesday, November 4, 2014

HOW TO: Device Art Generator

Хийсэн аппликэшныхаа сурталчилгаанд ашиглагдах зургийг дараах багажаар бэлдэж болох юм байна. Аппликэшны дэлгэцийн агшинаа оруулаад, бодит төхөөрөмж дээр хэрхэн харагдаж байгаа байдлаар зурагаа үүсгээд авна.

Monday, October 27, 2014

STACK: Setup SSL on Google App Engine

Google App Engine дээр SSL суулгахад 1 хувийн түлхүүр, 1 сертификат шаардаж байгаа. Тэрийг үүсгэхэд багахан асуудал гарж байсан юм. Тэр асуудлын шийдлийг орууллаа.


Доорх команд нь opensll ашиглан  түлхүүр болон сертификатыг үүсгэж байна.

openssl genrsa -out rsaprivkey.pem 1024

openssl req -new -x509 -key rsaprivkey.pem -out dsacert.pem

Сертификатыг үүсгэхэд асууж байгаа асуултанд байгаа дараах 2 асуултыг доорх загвараар бөглөж байж зөв болж байсан юм. Гол асуудал үүн дээр гарж байлаа. Одоо харин шийдэгдлээ.

Organization Name (eg, company) [Internet Widgits Pty Ltd]: > example.com
Common Name (eg, YOUR name) > *.example.com