StackEdit is really great online editor. It could connect with Google Drive. And what’s more, you can even use Vim in this editor.
Now add the following snippet into Settings–Extensions–UserCustom extension javascript area.
I once faced with a problem. I wrote a piece of code related with notifcation. Everything goes fine except one little issue. I found the ongoing notification switching order. My notification blinked each second. After Googling I found the reason and resolved the problem.
Now I am dealing with Mac OSX. However I found sometimes this is no sound. People say it’s a bug. I have tried some methods. And found this goes for me every time.
I once tried to use MediaScanner to resolve problems; however it turned out to be a failure. Now I make it.This post is to write down why I failed and how I work it out now. I think it could be deeper that other posts.
A great application should provide a function to let users set it as the preferred or default application. In this post, I will make a description on PreferredApplication
Before an application is about to be set as default, it has two possibilities. One is that there is already a default application and the other is no default application.
I am getting well on with Fedora now. However when I was a fresher to Fedora, I have met a lot of problems.
One of them is that When I type some wrong commands It will take too long to respond. It’s totally different from Ubuntu,which I used before. However I like it could quickly reponse even through the command does not exist.
//Let take com.mx.browser as the package nameIntentintent=newIntent(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS,Uri.parse("package:com.mx.browser"));startActivity(intent);
The following code works. Here take getting String resource for example.
1234567891011121314151617
publicvoidtestUseAndroidString(){Contextcontext=getContext();Resourcesres=null;try{//I want to use the clear_activities string in Package com.android.settingsres=context.getPackageManager().getResourcesForApplication("com.android.settings");intresourceId=res.getIdentifier("com.android.settings:string/clear_activities",null,null);if(0!=resourceId){CharSequences=context.getPackageManager().getText("com.android.settings",resourceId,null);Log.i(VIEW_LOG_TAG,"resource="+s);}}catch(NameNotFoundExceptione){e.printStackTrace();}}
##The Other way
You can also use adb shell to get into the shell of your device and the use pm list features to get the available features of a device.
There was a requirement of my work. It requires me to integrated my current project with Facebook SDK for measuring. However this came into my sights.
1
Jar mismatch! Fix your dependencies
The fact is that Both my project and my library project which the former refers to have used android-support-v4.jar. However I realize the two android-support-v4.jar are different after making the md5 hash.
My solution: I use the android-support-v4.jar in my project as the right one. And then replace the one in Facebook SDK with my project one. And then it works.
But my question remains; why it asks me for fix the dependencies to use the same lib jar file?
I guess android will keep only one file for all the references so this will ask developers to make all the same lib all the same.
Sorry for the codeless post.
When I create a new application on Facebook, I meet the problem. Facebook asks me to provide the Key Hash. But it does not show the guidance about how to generate. After Googling, I have found this works for me.
Before executing the following command, you need install openssl
This pragma returns one row for each column in the named table. Columns in the result set include the column name, data type, whether or not the column can be NULL, and the default value for the column. The “pk” column in the result set is zero for columns that are not part of the primary key, and is the index of the column in the primary key for columns that are part of the primary key.
sqlite> .header on
sqlite> PRAGMA table_info(password);
cid|name|type|notnull|dflt_value|pk
0|_id|INTEGER|0||1
1|host|TEXT|0||0
2|username|TEXT|0||0
3|password|TEXT|0||0
#password is the name of a table.
Another answer may also work .schema [tablename] will show the CREATE statement(s) for a table or tables
I was once stucked in How to check Whether a Python module has been installed or not. After Googling, I found this trick.
Python allows user to pass command from out of a python file.See here
1
-c cmd : program passed in as string (terminates option list)
The result if we import an installed module
1234
20:15:45-androidyue~/osc_git/LnxClient (master)$ python -c"import os"20:31:24-androidyue~/osc_git/LnxClient (master)$ echo$?0
#0 means the module has been installed
Now if we import an module which is not installed.
1234567
20:31:41-androidyue~/osc_git/LnxClient (master)$ python -c"import aaa"Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named aaa
20:31:46-androidyue~/osc_git/LnxClient (master)$ echo$?1
#1 means that module is not installed.
As a coder, I am always handling exceptions or errors,or in a word throwables. To impove the release build, I need to collect every throwable information.
And I need to get the information as string and post it to the Bug Collect Server. Now here is an easy trick to get stacktrace from a Throwable