It is possible to run the Ember server with `ember s` on one port 4200 by default and testing with `ember t -s` on port 7357 by default.
However, it is possible to run the server and run the tests on that same port (4200) as well just by navigating to `http://localhost:4200/tests` after running `ember s`
Monday, September 26, 2016
Thursday, April 24, 2014
Merge pdf files into one pdf file using GhostScript on Linux
Command:
gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=finished.pdf file1.pdf file2.pdf
gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=finished.pdf file1.pdf file2.pdf
Explanation:
- gs starts the Ghostscript program.
- -dBATCH once Ghostscript processes the PDF files, it should exit. If you don't include this option, Ghostscript will just keep running.
- -dNOPAUSE forces Ghostscript to process each page without pausing for user interaction.
- -q stops Ghostscript from displaying messages while it works
- -sDEVICE=pdfwrite tells Ghostscript to use its built-in PDF writer to process the files.
- -sOutputFile=finished.pdf tells Ghostscript to save the combined PDF file with the specified name.
Tuesday, April 22, 2014
Crop a video file using ffmpeg
If you want to crop the file beyond 1 min then use the -t flag and as follows. It will generates the output.avi video with the first 60 seconds of the input.avi
ffmpeg -t 60 -i input.avi -an -vcodec copy output.avi
ffmpeg -t 60 -i input.avi -an -vcodec copy output.avi
Sunday, April 13, 2014
CSS clearfix
.group:before,
.group:after {
content: "";
display: table;
}
.group:after {
clear: both;
}
.group {
zoom: 1 /* IE6&7 */
}
.group:after {
content: "";
display: table;
}
.group:after {
clear: both;
}
.group {
zoom: 1 /* IE6&7 */
}
Make Odin flashable tar.md5 on Linux
Steps:
- tar -H ustar -c image_1 image_2 > your_odin_package.tar
- md5sum -t your_odin_package.tar >> your_odin_package.tar
- mv your_odin_package.tar your_odin_package.tar.md5
You are done!!!
Enjoy!
Friday, November 15, 2013
Gnome online accounts and google gmail two step verification
If you are stuck in authenticating your gmail (google) account with Gnome's 'Online Accounts', here's the quick solution to resolve it.
Prior to that you have to create an application specific password for this authentication.
Follow the following steps OR use this link directly.
Manage your application specific passwords
Have fun!
Prior to that you have to create an application specific password for this authentication.
Follow the following steps OR use this link directly.
Manage your application specific passwords
- Go to https://www.google.com/settings/account
- Select 'Security' from left.
- Scroll down to '2-step verification' and select 'Manage your application specific passwords'.
- Enter a name for in the field and 'Generate password'
- Keep the generated password copied somewhere or in the memory.
- Go to 'Online Accounts' in Gnome and add your google account using your login password (not the generated one).
- Now go to 'Passwords and Keys' application (also know as Seahorse).
- Search for 'GOA google' and your specific account you just added above.
- Get properties and click show password.
- At the end of that string, you can find your password as "'password': <'your password'>". Replace 'your password' with the generated password above.
- That's it. You're done with the authentication.
Have fun!
Labels:
gmail,
gnome,
google,
Linux,
online accounts,
saehorse,
two step verification
Friday, April 27, 2012
Android (Contacts): How to lookup and add contacts
This is how you can look-up for a specific contact in Android and do whatever you want if the contact is available or not.
The following code segment shows how the contact is programmatically added to contacts.
Check for an existing number in the Android contacts
Uri lookupUri = Uri.withAppendedPath(ContactsContract.PhoneLookup.CONTENT_FILTER_URI,
Uri.encode(CommonVariables.merchantPhone));
String[] mPhoneNumberProjection = {
ContactsContract.PhoneLookup._ID,
ContactsContract.PhoneLookup.NUMBER,
ContactsContract.PhoneLookup.DISPLAY_NAME
};
Cursor cur = context.getContentResolver().query(lookupUri,mPhoneNumberProjection, null, null, null);
if (cur != null && cur.moveToFirst()) {
// The code to be executed if the phone number is available
}
else {
// The code to be executed if the number is not available
}
Add a new number to the Android contacts
ArrayList op_list = new ArrayList();
op_list.add(ContentProviderOperation.newInsert(ContactsContract.RawContacts.CONTENT_URI)
.withValue(ContactsContract.RawContacts.ACCOUNT_TYPE, null)
.withValue(ContactsContract.RawContacts.ACCOUNT_NAME, null)
.build());
op_list.add(ContentProviderOperation.newInsert(ContactsContract.Data.CONTENT_URI)
.withValueBackReference(ContactsContract.Data.RAW_CONTACT_ID, 0)
.withValue(ContactsContract.Data.MIMETYPE, ContactsContract.CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE)
.withValue(ContactsContract.CommonDataKinds.StructuredName.DISPLAY_NAME, CommonVariables.merchantName)
.build());
op_list.add(ContentProviderOperation.newInsert(ContactsContract.Data.CONTENT_URI)
.withValueBackReference(ContactsContract.Data.RAW_CONTACT_ID, 0) .withValue(ContactsContract.Data.MIMETYPE,ContactsContract.CommonDataKinds.Phone.CONTENT_ITEM_TYPE)
.withValue(ContactsContract.CommonDataKinds.Phone.NUMBER, CommonVariables.merchantPhone)
.build());
op_list.add(ContentProviderOperation.newInsert(ContactsContract.Data.CONTENT_URI)
.withValueBackReference(ContactsContract.Data.RAW_CONTACT_ID, 0)
.withValue(ContactsContract.Data.MIMETYPE,ContactsContract.CommonDataKinds.Email.CONTENT_ITEM_TYPE)
.withValue(ContactsContract.CommonDataKinds.Email.DATA, getResources().getString(R.string.merchant_email))
.build());
try {
ContentProviderResult[] results = getContentResolver().applyBatch(ContactsContract.AUTHORITY, op_list);
Toast.makeText(AmountSet.this, getResources().getString(R.string.msg_contact_added), Toast.LENGTH_LONG).show();
} catch(Exception e){
Toast.makeText(AmountSet.this, getResources().getString(R.string.msg_contact_error_adding), Toast.LENGTH_LONG).show();
e.printStackTrace();
}
The following code segment shows how the contact is programmatically added to contacts.
Check for an existing number in the Android contacts
Uri lookupUri = Uri.withAppendedPath(ContactsContract.PhoneLookup.CONTENT_FILTER_URI,
Uri.encode(CommonVariables.merchantPhone));
String[] mPhoneNumberProjection = {
ContactsContract.PhoneLookup._ID,
ContactsContract.PhoneLookup.NUMBER,
ContactsContract.PhoneLookup.DISPLAY_NAME
};
Cursor cur = context.getContentResolver().query(lookupUri,mPhoneNumberProjection, null, null, null);
if (cur != null && cur.moveToFirst()) {
// The code to be executed if the phone number is available
}
else {
// The code to be executed if the number is not available
}
Add a new number to the Android contacts
ArrayList
op_list.add(ContentProviderOperation.newInsert(ContactsContract.RawContacts.CONTENT_URI)
.withValue(ContactsContract.RawContacts.ACCOUNT_TYPE, null)
.withValue(ContactsContract.RawContacts.ACCOUNT_NAME, null)
.build());
op_list.add(ContentProviderOperation.newInsert(ContactsContract.Data.CONTENT_URI)
.withValueBackReference(ContactsContract.Data.RAW_CONTACT_ID, 0)
.withValue(ContactsContract.Data.MIMETYPE, ContactsContract.CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE)
.withValue(ContactsContract.CommonDataKinds.StructuredName.DISPLAY_NAME, CommonVariables.merchantName)
.build());
op_list.add(ContentProviderOperation.newInsert(ContactsContract.Data.CONTENT_URI)
.withValueBackReference(ContactsContract.Data.RAW_CONTACT_ID, 0) .withValue(ContactsContract.Data.MIMETYPE,ContactsContract.CommonDataKinds.Phone.CONTENT_ITEM_TYPE)
.withValue(ContactsContract.CommonDataKinds.Phone.NUMBER, CommonVariables.merchantPhone)
.build());
op_list.add(ContentProviderOperation.newInsert(ContactsContract.Data.CONTENT_URI)
.withValueBackReference(ContactsContract.Data.RAW_CONTACT_ID, 0)
.withValue(ContactsContract.Data.MIMETYPE,ContactsContract.CommonDataKinds.Email.CONTENT_ITEM_TYPE)
.withValue(ContactsContract.CommonDataKinds.Email.DATA, getResources().getString(R.string.merchant_email))
.build());
try {
ContentProviderResult[] results = getContentResolver().applyBatch(ContactsContract.AUTHORITY, op_list);
Toast.makeText(AmountSet.this, getResources().getString(R.string.msg_contact_added), Toast.LENGTH_LONG).show();
} catch(Exception e){
Toast.makeText(AmountSet.this, getResources().getString(R.string.msg_contact_error_adding), Toast.LENGTH_LONG).show();
e.printStackTrace();
}
Subscribe to:
Posts (Atom)


