2017 tarihine ait yayınlar gösteriliyor

sample activity in android

package com.example.android.sunshine; import android.os.AsyncTask; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.widget.ProgressBar; import android.widget.TextView; import com.example.android.sunshine.data.SunshinePreferences; import com.example.android.sunshine.utilities.NetworkUtils; import com.example.android.sunshine.utilities.OpenWeatherJsonUtils; import java.net.URL; public class MainActivity extends AppCompatActivity { private TextView mWeatherTextView ; // TODO (6) Add a TextView variable for the error message display private TextView errorTextView ; // TODO (16) Add a ProgressBar variable to show and hide the progress bar private ProgressBar progressBar ; @Override protected void onCreate(Bundle savedInstanceState) { super .onCreate(savedInstanceState); setContent

Override onCreateOptionsMenu to inflate the menu for the Activity

Override onCreateOptionsMenu to inflate the menu for the Activity @Override public boolean onCreateOptionsMenu(Menu menu) { /* Use AppCompatActivity's method getMenuInflater to get a handle on the menu inflater */ MenuInflater inflater = getMenuInflater(); /* Use the inflater's inflate method to inflate our menu layout to this menu */ inflater.inflate(R.menu. forecast ,menu); /* Return true so that the menu is displayed in the Toolbar */ return true ; }

Github query URL (using Uri) and get the response data in Android

/* These utilities will be used to communicate with the network.*/ public class NetworkUtils { final static String GITHUB_BASE_URL = "https://api.github.com/search/repositories" ; final static String PARAM_QUERY = "q" ; /** The sort field. Default: results are sorted by best match * if no field is specified. */ final static String PARAM_SORT = "sort" ; final static String sortBy = "stars" ; /** * Builds the URL used to query Github. * @param githubSearchQuery The keyword that will be queried for. * @return The URL to use to query the weather server. */ public static URL buildUrl(String githubSearchQuery) { // To build the proper Github query URL Uri builtUri = Uri. parse ( GITHUB_BASE_URL ) .buildUpon() .appendQueryParameter( PARAM_QUERY ,githubSearchQuery) .appendQueryPara

Some Python Commands

Installation virtual environment for Python project D:\ProgramFiles\Python34> virtualenv projeName New python executable in D:\ProgramFiles\Python34\projeName\Scripts\python.exe Installing setuptools, pip, wheel...done. Activate virtual environment D:\ProgramFiles\Python34>cd  projeName D:\ProgramFiles\Python34\projeName>cd Scripts D:\ProgramFiles\Python34\ projeName \Scripts> activate ( projeName ) D:\ProgramFiles\Python34\ projeName \Scripts> Install a specific version of setup tools in python pip install setuptools==36.0.1 Update pip  pip install -U pip List installed plugins pip list

Android Resource Directories

Some Common Resource Types Name What's Stored Here values XML files that contain simple values, such as string or integers drawable A bunch of visual files, including Bitmap file types and shapes. More information is  here layouts XML layouts for your app Other Resource Types Name What's stored here animator XML files for property animations anim XML files for tween animations color XML files that define state list colors mipmap Drawable files for launcher icons menu XML files that define application menus raw Resource file for arbitrary files saved in their raw form. For example, you could put audio files here. (You might also be interested in the  assets folder , depending on how you use that audio) xml Arbitrary XML; if you have XML configuration files, this is a good place to put them More information

In terms of increasing verboseness in severity in Android Log.

WTF-> Error->Warn-> Info-> Debug->Verbose WTF (What a Terrible Failure) level is for errors that should never, ever happen. Most developers should never, ever use it.

About Android padding, margin, width, height, wrap_content, match_parent, R Class

Padding and Margin padding  and  layout_margin  are two very similar attributes. Both determine the space around a View. The difference is that  padding  determines space within the boundaries of the view, and  layout_margin  determines the space outside the boundaries of the view. Width and Height Some of the most important properties are the width property and height property - those must be defined for every view. Remember that all views occupy a rectangular area on the screen - the width and height are the width and height of that area. You can define this in pixels, or better yet dp (stands for density-independent pixels): android:layout_width="200dp" android:layout_height="300dp" For the sake of having a layout be responsive and adjust to different devices, two common values are not numbers at all, but  wrap_content  and  match_parent  used as shown here: android:layout_width="wrap_content" android:layout_height="match_parent"

Ctrl Alt Delete Function in Remote Desktop

Just Ctrl + Ins :)

Ubuntu useful terminal commands

* restart sudo reboot sudo shutdown -r now * download a file wget url with output file wget  -O /home/omio/Desktop/ "url" After "apt-get install filezilla" I got an error.   dpkg was interrupted, you must manually run 'dpkg --configure -a' to correct the problem..  "It is called when packages are broken, or the package installation is interrupted."  To solve type "dpkg --configure -a", you can type again "apt-get install filezilla", it should work. * list apps (Ubuntu 14.04 above)  apt list --installed * remove an app sudo apt-get remove <application_name> * VSFTPD, stands for Very Secure File Transfer Protocol Daemon sudo apt-get install vsftpd * learn ubuntu version lsb_release -a *add a new user adduser username * format a drive mkfs -t ext4 /dev/xvde * list mounted and unmounted partitions blkid -o list device     fs_type label    mount point    UUID --------------------------------

Start your android app from the command line

 Start your android app from the command line, you could type: adb shell am start -n com.package.name/com.package.name.ActivityName

Show Task in Gradle from command line in the Android Project

Gradle from the Command Line Run gradle build tasks from the command line if you prefer. To start, you should navigate to the root of your project folder. From there you can run: ./gradlew tasks This will give you a full list of runnable tasks. You may need to run chmod +x on gradlew before you can run it. 

Installing and Configuring ProFTPD on Ubuntu 14.4

To install  ProFTPd  on Ubuntu (or most Debian based) Linux, execute the following command. sudo apt-get install proftpd Installing a GUI Manager for ProFTPd sudo apt-get install gadmin-proftpd sudo rm /etc/proftpd/proftpd.conf we should remove because if we won't be able to run the app. The first time you start gadmin-proftpd, you will need to configure a few settings. All default values should be used unless otherwise noted below: Server Name: off Admin email: your.email@yourdomain.com Enable virtual users: checked Server user: ftpuser Server group: ftpgroup To add a virtual user: Click on the  Users  tab Click the '+Add' button. All settings can remain with their default values except: Username: Enter a username. Password: Enter a password. Group: ftpgroup Click +Add directory Click  File System Click home Click ftpuser Click the Open button Modify the directory permissions as needed. Click the Apply button.

Install VSFTPD, stands for Very Secure File Transfer Protocol Daemon on Ubuntu 16.04.3 LTS

In Ubuntu, the FileZilla server is not available. The VSFTPD is used instead of FileZilla Server. To install this, sudo apt-get install vsftpd Edit /etc/vsftpd.conf file: sudo nano /etc/vsftpd.conf  1.Disable anonymous user login. anonymous_enable=NO 2.Uncomment these two lines. ascii_upload_enable=YES ascii_download_enable=YES 3.Uncomment and enter your Welcome message - Not necessary, It's optional. ftpd_banner=Welcome to OSTechNix FTP service. 4.Add this line the end. use_localtime=YES 5.Save and close the file. Restart vsftpd service to take effect the changes. sudo systemctl restart vsftpd or sudo service vsftpd restart 6.Check if vsftpd service is running or not: sudo systemctl status vsftpd You will see like this  vsftpd.service - vsftpd FTP server    Loaded: loaded (/lib/systemd/system/vsftpd.service; enabled; vendor preset: enabled)    Active: active (running) since Mon 2017-10-30 15:10:15 CST; 19s ago   Process: 36480 ExecStartPre=/bin/mk

Fork the repository and clone your fork

You could make your changes directly to the master branch in your fork, but when contributing to a public repository, it’s standard practice to make the changes in a non-master branch within the fork. This way, you can easily keep your master branch up-to-date with master of the original repository, and merge changes from master into your branch when you are ready. Note for Windows Users:  The story has grown so large that it exceeds Windows' path length limit. If you encounter an error when cloning you can work around it by modifying a configuration setting. Run this command in git bash:  git config --system core.longpaths true .

Old Notes

Spring Boot Instead of using @EnableAutoConfiguration, @ComponentScan & @Configuration on a class, you could just use only @SpringBootApplication which is equivalent to using @Configuration, @EnableAutoConfiguration and @ComponentScan with their default attributes. http://websystique.com/spring-boot/spring-boot-introduction-hello-world-example/ Eclipse eclipse:clean \\Deletes the .project, .classpath, .wtpmodules files and .settings folder used by Eclipse. eclipse:eclipse \\build the project into eclipse project like structure. JAXB Java Architecture for XML Binding (JAXB) is a Java standard that defines how Java objects are converted from and to XML.JAXB defines an API for reading and writing Java objects to and from XML documents.Using JAXB annotation to convert Java object to / from XML file. Use JAXB to do following stuffs : Marshalling – Convert a Java object into a XML file. Unmarshalling – Convert XML content into a Java Object. SAX SAX (Simple API for XML) is

Getting git to work with a proxy server

git config --global http.proxy http://proxyuser:proxypwd@proxy.server.com:8080 change  proxyuser  to your proxy user change  proxypwd  to your proxy password change  proxy.server.com  to the URL of your proxy server change  8080  to the proxy port configured on your proxy server If you decide at any time to reset this proxy and work without proxy: Command to use: git config --global --unset http.proxy Finally, to check the currently set proxy: git config --global --get http.proxy OR Step 1:  Open Git BASH Step 2:  Look for  .gitconfig , executing following command: git config --list --global --show-origin Step 3:  Copy the below content in  .gitconfig : [http] proxy = http://YOUR_PROXY_USERNAME:YOUR_PROXY_PASSWORD@YOUR.PROXY.SERVER:YOUR.PROXY.SERVER.PORT sslverify = false [https] proxy = http://YOUR_PROXY_USERNAME:YOUR_PROXY_PASSWORD@YOUR.PROXY.SERVER:YOUR.PROXY.SERVER.PORT sslverify = false [url "http://github.com/"] insteadOf = git