Friday, May 31, 2013

Package Control didn't work in Mac OSX

This helped (taken from here)

  1. Click the Preferences > Browse Packages… menu entry
  2. Browse up a folder and then into the Installed Packages folder
  3. Download Package Control.sublime-package and copy it into the Installed Packages directory
  4. Restart Sublime Text

Install an RPM Package on Ubuntu Linux


Run this command to install alien and other necessary packages:
sudo apt-get install alien dpkg-dev debhelper build-essential
To convert a package from rpm to debian format, use this command syntax. The sudo may not be necessary, but we’ll include it just in case.
sudo alien packagename.rpm
To install the package, you’ll use the dpkg utility, which is the internal package management tool behind debian and Ubuntu.
sudo dpkg -i packagename.deb
The package should now be installed, providing it’s compatible with your system. Taken from here.

Tuesday, November 01, 2011

Nice syntax highlight plug-in

Windows Live Writer Plugin - Source Code Formatter

Accessing Stored Procedures Using ADO.NET

From here.

// create the connection
OracleConnection conn = new OracleConnection("Data Source=oracledb;
    User Id=UserID;Password=Password;");
// create the command for the stored procedure
OracleCommand cmd = new OracleCommand();
cmd.Connection = conn;
cmd.CommandText = "SELECT_JOB_HISTORY.GetJobHistoryByEmployeeId";
cmd.CommandType = CommandType.StoredProcedure;
// add the parameters for the stored procedure including the REF CURSOR
// to retrieve the result set
cmd.Parameters.Add("p_employee_id", OracleType.Number).Value = 101;
cmd.Parameters.Add("cur_JobHistory", OracleType.Cursor).Direction =
    ParameterDirection.Output;
// createt the DataAdapter from the command and use it to fill the
// DataSet
OracleDataAdapter da = new OracleDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
// output the results.
Console.WriteLine(ds.Tables[0].Rows.Count);

Thursday, September 15, 2011

Set to array[T]

T[] array = set.toArray(new T[set.size()]);






Sunday, September 04, 2011

Starting activity from command line

am start -a android.intent.action.MAIN -n com.mydomain.mypackage/com.mydomain.mypackage.HomeActivity


-a action to perform


-n on this activity



Tuesday, August 16, 2011

Add static libraries *.jar to Android.mk based build

in Android.mk


LOCAL_STATIC_JAVA_LIBRARIES := mylocaljar


LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := mylocaljar: mylocaljar.jar


mylocaljar.jar should be in root directory of the project. Look at the Calculator app's Android.mk in Android tree as an example



Fragments for All

http://android-developers.blogspot.com/2011/03/fragments-for-all.html



Blogpost code highlighting

Here I found how to highlight code in my blogposts on Blogspot. It's still not ideal because it doesn't support the original indentation but better nothing.



Automatic thread

Nice piece of code from Android e-mail client



public static AsyncTask runAsync(final Runnable r)
{ return new AsyncTask() {
@Override
protected Void doInBackground(Void... params) {
r.run();
return null;
}}.execute();
}
runAsync(new Runnable() {
@Override
public void run() {}}
);



Monday, August 15, 2011

Friday, July 29, 2011

Market filters

Today's challenger was the defect where some Android devices did not see some apps on Android Market and some other did. Android is complicated in this area too. If your device is not good for a certain app Android Market hides the app rom the view. On one hand it's good. If your device cannot run an app why bother and display it? On the other what if I, a user, want this app so bad that I wanna buy a new phone just to make this app happy. How am I supposed to know what phone I need and what features or operating system version it should have?


Anyway the solution (not for newbies) lies here. This article explains a million complicated reasons why you don't see your app. I think Google should always display apps like that. But it should not let user to install them with explanations why.












Wednesday, July 13, 2011

Broadcast receiver problem

Today I saw a weird bug. I had a broadcast receiver in one app's AndroidManifest.xml


<receiver android:name=".MyReceiver">


<intent-filter>


<action android:name="com.my.intent.update" />


</intent-filter>


</receiver>




and another app sent broadcast with the intent the first app had to handle.




Intent intent = new Intent("com.my.intent.update");


sendBroadcast(intent);




The problem was it never did. I spent some time and asked my co-worker to look at it with me. While looking I found the problem (pair programming works after all). I had an activity in the same manifest file that had a receiver that handled the same intent!





<activity android:label="Test" android:name=".HomeActivity"


android:launchMode="singleTask" android:configChanges="orientation">


<intent-filter>


<action android:name="com.my.intent.update" />


</intent-filter>


</activity>




I don't know why it was there but it made receiver never handle the intent.



Tuesday, July 12, 2011

Echo from Android.mk

$(info YOUR MESSAGE HERE)



Wednesday, May 18, 2011

Amazon trade in program

Not a bad idea



Curse of SSD

"The problem with an SSD is [that] data is written in blocks. A block may be 256KB: 256 * 1000 * 8 binary digits. To change even ONE of these digits, you must rewrite the ENTIRE block. That is to say, your OS sees 1 bit being written, but the SSD wear is equivalent to 256KB being written: a 2.048 MILLION fold difference." From here



Friday, May 13, 2011

Simple sync adapter sample server cridentials

Use account user1/test on samplesyncadapter server.






Thursday, May 12, 2011

О как!

"Маме Джульетты на момент событий, описанных в пьесе, было 28 лет.


Марья Гавриловна из «Метели» Пушкина была уже немолода: «Ей шел 20-й год».


«Бальзаковский возраст» – 30 лет.


Ивану Сусанину на момент совершения подвига было 32 года (у него была 16-летняя дочь на выданье).


Старухе процентщице из романа Достоевского «Преступление и наказание» было 42 года.


Анне Карениной на момент гибели было 28 лет, Вронскому – 23 года, старику мужу Анны Карениной – 48 лет (в начале описанных в романе событий всем на 2 года меньше).


Старикану кардиналу Ришелье на момент описанной в «Трех мушкетерах» осады крепости Ла-Рошель было 42 года.


Из записок 16-летнего Пушкина: «В комнату вошел старик лет 30» (это был Карамзин).


У Тынянова: «Николай Михайлович Карамзин был старше всех собравшихся. Ему было тридцать четыре года – возраст угасания»




Взято с фейсбука.



Friday, May 06, 2011

Grep search

grep -i -n -r 'my search term' --include=*.java .



searches for 'my search term' in current directory and sub directories in all files