2012 tarihine ait yayınlar gösteriliyor

Turn off resize textarea

CSS to disable resizing The CSS to disable resizing for all textareas looks like this: textarea { resize : none ; } You could instead just assign it to a single textarea by name (where the textarea HTML is ): textarea [ name = foo ] { resize : none ; } Or by id (where the textarea HTML is ): #foo { resize : none ; }

How to view the SQLite database on your Android Emulator

How to view the SQLite database on your Android Emulator This tutorial will show you how to open a SQLite datbase from your Android emulator. This requires Eclipse and the Android plugin. If you don't have them, follow this tutorial . This also requires a SQLite viewer. I used SQLite Database Browser . Step 1 With Eclipse open and your emulator running select the DDMS perspective by clicking on the Window -> Open Perspective -> DDMS menu option. Step 1 Step 2 Select the emulator you have currently have running.  Click the File Explorer tab Find the data folder. Step 2 Step 3 Follow the filepath to the application you want /data/data/your.app.namespace/dbname.db Click the Pull a file from the device button and save the database file on your computer. Step 3 Step 4 Open the SQLite Database Viewer and click Open Database.  Open the file and you can browse the data and view the schema! Step 4 This can really help you

Dynamic SQL Scripts

SqlConnection sql =new SqlConnection("Server=(local); User id=sa; Password=sa; Database=Friends"); sql.Open(); string sadsoyad="koray",smeslek=" bilgisayar",yer="......",mail= "i@",tel="2143234"; string sdogum="12.12.1987"; string id=textBox1.Text; Dataset1 dataSet1=new Dataset1(); string sorgu="UPDATE "; string tabloAd=dataSet1.Tables[1]. TableName; string set1=" SET"; string where=" WHERE "; string update=" adSoyad='"+sadsoyad+"',meslek= '"+smeslek+"',dogumTarihi='"+ sdogum+"',yasadigiYer='"+yer+" ',eMail='"+mail+"',telefon='"+ tel+"' "; string edilecek=" adSoyad='"+sadsoyad+"' "; sorgu+=tabloAd; sorgu+=set1; sorgu+=update; sorgu+=where; sorgu+=edilecek; textBox2.Text=sorgu ; SqlCommand komut=new SqlCommand(sorgu,sql); komut.ExecuteNonQuer

Set span width

spans default to inline style, which you can't specify the width of. display : inline - block ; would be a good way, except IE doesn't support it

Parsing a URL

Sample - 1 import java.net.*; import java.io.*; public class ParseURL { public static void main(String[] args) throws Exception { URL aURL = new URL("http://example.com:80/docs/books/tutorial" + "/index.html?name=networking#DOWNLOADING"); System.out.println("protocol = " + aURL.getProtocol()); System.out.println("authority = " + aURL.getAuthority()); System.out.println("host = " + aURL.getHost()); System.out.println("port = " + aURL.getPort()); System.out.println("path = " + aURL.getPath()); System.out.println("query = " + aURL.getQuery()); System.out.println("filename = " + aURL.getFile()); System.out.println("ref = " + aURL.getRef()); } } Here is the output displayed by the program: protocol = http authority = example.com:80 host = example.com port = 80 path = /docs/boo

Quick and easy image resizing with Java ImageIO

Quick and easy image resizing with Java ImageIO There are quite a lot of examples of image resizing floating around the web but they all seem to access all sort of hidden features and classes deep inside the JDK to achieve their goal. Here is the most straightforward method that I could come up with - all in all just 5 lines of code. It requires ImageIO and requires Java 1.4 or later to run. If the ImageIO.write() method accepted plain ol' AWT Image arguments it could have been reduced further still to three lines, but you have to give it a BufferedImage instance as input. The snippet below assumes that there exist the following variables (coloured green in the code): an input stream to read from a desired width variable (specifying the height as -1 tells the toolkit to preserve the original aspect ratio) and an output stream to write the encoded image to. Sample code: import java.awt.Image; import java.awt.image.BufferedImage; import javax.imageio.ImageIO; // ..

Get Images from link and store in movie folder on andriod

                            URL url = new URL(R.string.VM_01 + "movie_image/scene/kung_fu_panda_2/kung_fu_panda_2_1.jpg");                             InputStream is = url.openStream();                             OutputStream os = new FileOutputStream( "movie/pic/large/kung_fu_panda_2_1.jpg");                                                       byte[] b = new byte[2048];                             int length;                             while ((length = is.read(b)) != -1) {                                 os.write(b, 0, length);                             }                             is.close();                             os.close();

Android Simple Http Get Request without any Parameter

                    String result="";                     HttpClient httpclient = new  DefaultHttpClient();                                         // Prepare a request object                     HttpGet link = new HttpGet("");                                         // Execute the request                     HttpResponse response;                     try                     {                         response = httpclient.execute(link);                         // Examine the response status                         Log.d("Response Status", response.getStatusLine().toString());                                                // Get hold of the response entity                         HttpEntity entity = response.getEntity();                         // If the response does not enclose an entity, there is no need                         // to worry about connection release                   

Short information about the first iphone development

The @autoreleasepool statement supports the Automatic Reference Counting (ARC) system. ARC provides automatic object-lifetime management for your app, ensuring that objects remain in existence for as long as they're needed and no longer. The call to UIApplicationMain creates an instance of the UIApplication class and an instance of the app delegate (in this tutorial, the app delegate is HelloWorldAppDelegate , which is provided for you by the Single View template). The main job of the app delegate is to provide the window into which your app’s content is drawn. The app delegate can also perform some app configuration tasks before the app is displayed. ( Delegation is a design pattern in which one object acts on behalf of, or in coordination with, another object.) In an iOS app, a window object provides a container for the app’s visible content, helps deliver events to app objects, and helps the app respond to changes in the device’s orientation. The window itself

How to loop ArrayList in Java

No nonsense, four ways to loop ArrayList in Java For loop For loop (Advance) While loop Iterator loop package com.mkyong.core ;   import java.util.ArrayList ; import java.util.Iterator ; import java.util.List ;   public class ArrayListLoopingExample { public static void main ( String [ ] args ) {   List < String > list = new ArrayList < String > ( ) ; list. add ( "Text 1" ) ; list. add ( "Text 2" ) ; list. add ( "Text 3" ) ;   System . out . println ( "#1 normal for loop" ) ; for ( int i = 0 ; i < list. size ( ) ; i ++ ) { System . out . println ( list. get ( i ) ) ; }   System . out . println ( "#2 advance for loop" ) ; for ( String temp : list ) { System . out . println ( temp ) ; }   System . out . println ( "#3 while loop" ) ; int j = 0 ; while ( list. size ( ) > j ) { System . out . println ( list. get ( j

Start Apache and Tomcat Commands

Start Apache and Tomcat Start Apache: $APACHE_HOME / bin / apachectl -k start To stop use: $APACHE_HOME / bin / apachectl -k stop Start Tomcat: $TOMCAT_HOME / bin / startup.sh Stop Tomcat: $TOMCAT_HOME / bin / shutdown.sh

5 Minute Guide to Clustering – Java Web Apps in Tomcat

There are pretty much two ways to set up basic clustering, which use two different Apache modules. The architecture for both, is the same. Apache sits in front of the Tomcat nodes and acts as a load balancer. Traffic is passed between Apache and Tomcat(s) using the binary AJP 1.3 protocol. The two modules are mod_jk and mod_proxy . mod_jk stands for “ jakarta ” the original project under which Tomcat was developed. It is the older way of setting this up, but still has some advantages. mod_proxy is a newer and more generic way of setting this up. The rest of this guide will focus on mod_proxy , since it ships “out of the box” with newer versions of Apache. You should be able to follow this guide by downloading Apache and Tomcat default distributions and following the steps. Clustering Background You can cluster at the request or session level. Request level means that each request may go to a different node – this is the ideal since the traffic would be balanced across

(Unsupported major.minor version 50.0) error is getting while starting tomcat

Use the following table to map the versions: Major Minor Java platform version 45 3 1.1 46 0 1.2 47 0 1.3 48 0 1.4 Example: 1.4.x 49 0 1.5 Example: 1.5 50 0 1.6 51 0 1.7 For this example, there are 2 items to map: a) Runtime Java version 1.4.x => major.minor is 48.0 b) Java class file shows "version 49.0", but it should be interpreted as: major.minor 49.0 => Java 1.5 Conclusion: You are trying to run in a system that has Java 1.4 (major.minor 48) a Java class file that was compiled under Java 1.5 (major.minor 49), thus the error message: (Unsupported major.minor version 49.0) In other words, the runtime (major.minor 48) does not support major.minor 49. Check the runtime version of Java. java -version For example, the output might look like this: java version "1.4.2" Java 2 Runtime Environment, Standard Edition (build 1.4.2)

set JAVA for Suse

 sudo update-alternatives --install "/usr/bin/java" "java" "/opt/jdk1.7.0_05/bin/java" 3  sudo update-alternatives --config java

Change Date time on Linux

You just need to use “date” command followed by the month, day, hour, minute, and year all numeric and no spaces. # date 021415232010 Sun Feb 14 15:23:31 PST 2010

list memory usage of application in ubuntu

$ ps euf If I run free -m I get total used free shared buffers cached Mem: 496 489 6 0 4 452 -/+ buffers/cache: 33 462 Swap: 511 4 507   If I run ps euf I get USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 948 0.0 0.0 5928 472 tty6 Ss+ Aug25 0:00 /sbin/getty 384 root 947 0.0 0.0 5928 472 tty5 Ss+ Aug25 0:00 /sbin/getty 384 root 946 0.0 0.0 5928 472 tty4 Ss+ Aug25 0:00 /sbin/getty 384 root 945 0.0 0.0 5928 472 tty3 Ss+ Aug25 0:00 /sbin/getty 384 root 944 0.0 0.0 5928 472 tty2 Ss+ Aug25 0:00 /sbin/getty 384 root 943 0.0 0.1 51856 536 hvc0 Ss Aug25 0:00 /bin/login -- root 978 0.0 0.4 20580 2424 hvc0 S Aug25 0:01 \_ -bash TERM= root 7593 0.0 0.1 10332 524 hvc0 T Aug25 0:00

View in tar file

Task: List the contents of a tar file Use the following command: $ tar -tvf file.tar

How to install and configure tomcat 6 in ubuntu server

Tomcat is a well known and widely used java servlet container. These days I am planning a project, which needs a tomcat 6 in ubuntu server. I found that to make tomcat work in ubuntu is very easy, but you need have a little trick to change your server listening port from 8080 to 80. Here I give you the way that I make it work. 1. Install tomcat 6 in ubuntu normally, you just need to type the following command to install it sudo apt-get install tomcat6 tomcat6-admin tomcat6-common tomcat6-user tomcat6-docs tomcat6-examples 2. Start tomcat sudo /etc/init.d/tomcat6 start   Now, you can use your browser to navigate this address: http://<your ip>:8080   And you will see the tomcat It works! page Usually, HTTP server works with the port 80, but the default port for tomcat is 8080, that is why we need specify 8080 after your ip address. To change the default port from 8080 to 80, type the following command in the terminal: sudo vim /etc/tomcat6/server.xml Find

Linux Check Memory Usage

free command Display free memory size in MB: $ free -m Output: total used free shared buffers cached Mem: 750 625 125 0 35 335 -/+ buffers/cache: 254 496 Swap: 956 0 956   Displays a line containing the totals memory in MB: $ free -t -m Output: total used free shared buffers cached Mem: 750 625 125 0 35 335 -/+ buffers/cache: 253 496 Swap: 956 0 956 Total: 1707 625 1082 vmstat command Type vmstat command at shell prompt: $ vmstat Output: procs -----------memory---------- ---swap-- -----io---- --system-- ----cpu---- r b swpd free buff cache si so bi bo in cs us sy id wa 1 0 0 131620 35432 341496 0 0 42 82 737 1364 15 3 81 1 top command Type top command at the s

Change Heap Size of JVM

The aim is to change heap size of JVM. Under the  /usr/share/tomcat6/bin , there is a file name as catalina.sh. In the file you can write CATALINA_OPTS="-Xms256m -Xmx256m" at the 2nd line and then restart the tomcat. To do that, (I supposed that you have a root right. If not , type sudo -s ) First of all, go to the tomcat6 bin directory and stop it.  ex. /etc/init.d/tomcat6 stop Then, change the right of the catalina.sh file as root. Here is;  chown  gunay /usr/share/tomcat6/bin/catalina.sh Important: I have used in ubuntu machine and tomcat6 is ubuntu's tomcat not a standalone version. At the end, you can change file rights as tomcat6 and then start the server. /etc/init.d/tomcat6 start

Keyboard Popup when activity is started.

 Error: Pop-up keyboard and textedit selected when the activity is started. The first solution is ;   This is hide keyboard and also nothing is not selected or focused.   Use this attributes in your layout tag in XML file: android : focusable = "true" android : focusableInTouchMode = "true"   The second solution is ; Put a ndroid:windowSoftInputMode="stateHidden" in activity in the AndroidManifest.xml   This is only hide keyboard but the textedit is selected or focused.   <activity android:name="com.test.login" android:windowSoftInputMode="stateHidden" android:screenOrientation="portrait" />    

How do I make a dotted/dashed line in Android?

Without java code: android:dashGap means here is the distance between line dashes. drawable/dotted.xml: <shape xmlns:android = "http://schemas.android.com/apk/res/android" android:shape = "line" > <stroke     android:color = "#C7B299"     android:dashWidth = "10px"     android:dashGap = "10px" />   </shape> view.xml:   <ImageView     android:layout_width = "match_parent"     android:layout_height = "wrap_content"     android:src = "@drawable/dotted" />

List Item Layout Design/Style in Spinner

List Item Layout Design/Style in Spinner <CheckedTextView     xmlns:android="http://schemas.android.com/apk/res/android"     android:text="CheckedTextView"     android:id="@+id/checkedTextView1"     style="?android:attr/spinnerDropDownItemStyle"     android:background="@drawable/gradient_background_clickable"     android:textColor="@drawable/text_color_changeable"     android:layout_width="fill_parent"     android:layout_height="?android:attr/listPreferredItemHeight"> </CheckedTextView> gradient background <selector xmlns:android="http://schemas.android.com/apk/res/android">     <item android:drawable="@drawable/gradient_background" android:state_pressed="true" />     <item android:drawable="@drawable/gradient_background_reverse_color" /> </selector> gradient background xml <?xml version="1.0" enco

Sample ListView example

 //Sample  ListView  example         ListView fontListView = (ListView) findViewById(R.id.fontlistView);         ArrayList<String> fontListData = Font.getFontStyles();         ArrayAdapter<String> fontListAdapter = new ArrayAdapter<String>(this, R.layout.listview_style_layout, fontListData);         fontListView.setAdapter(fontListAdapter); In the xml  <TableLayout android:id="@+id/listViewTableLayout" android:layout_width="wrap_content" android:layout_height="wrap_content">                            <TableRow  android:paddingBottom="5dip">                <ListView android:id="@+id/fontlistView"                      android:scrollbars="vertical"                     android:choiceMode="singleChoice"                     android:layout_height="wrap_content"                     android:layout_width="200dip"                     android:layout_gravity=&qu

Using Themes on Android Mobile Application

you can apply styles as themes on an activity level or application level. if you apply a theme on an activity level then all widgets within that activity will inherit from that theme. to do so, open the AndroidManifest.xml and go the <activity> tag and add the android:theme attribute:   <activity android:name=".StylesDemo" android:label="@string/app_name" android:theme="@style/BlueLabel">   to apply a theme on the application level so that the style will be applied to all activities within your application, open the AndroidManifest.xml and go the <application> tag and add the android:theme attribute:   <application android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@style/BlueLabel"> to set the theme of an activity programmatically call this line in the onCreate method   this.setTheme(R.style.BlueLabel);

Using Custom Fonts in Android Mobile Application

Place the TTF file in the ./assets directory (create it if it doesn’t exist yet). We’re going to use a basic layout file with a TextView, marked with an id of “custom_font” so we can access it in our code.   <? xml   version = "1.0"   encoding = "utf-8" ?>    < LinearLayout   xmlns:android = "http://schemas.android.com/apk/res/android"                   android:orientation = "vertical"                   android:layout_width = "fill_parent"                   android:layout_height = "fill_parent"             >            < TextView                 android:id = "@+id/custom_font"                 android:layout_width = "fill_parent"                 android:layout_height = "wrap_content"                 android:text = "This is the Chantelli Antiqua font."                 />       </ LinearLayout >      Open your main activity file and insert this into t

How To Design For Multiple Screen Sizes

Creating Three Sets of Graphics Because of the aforementioned screen resolution/size issue, Android recommends creating three sets of graphics for: Hi Density Screens Medium Density Screens Low Density Screens This will keep your design from getting crunked up when it’s displayed on various screen sizes. The grid below shows the various screen sizes and resolutions you use for your Photoshop files: I know it’s a lot. But if you’re creating your design using vector shape layers, the re-sizing process shouldn’t be too painful. The key is to design for the smallest screen first, and then size up for larger screens.

Visual separator in RelativeView

So far , i have tried to add separator inside the TableLayout using the below code: <View android:id ="@+id/view_separator" android:background ="#FFFFFF" android:layout_centerVertical ="true" android:layout_width = "fill_parent" android:layout_height ="2dip" android:layout_alignParentTop ="true"/>   It may helps you, just try it.

End the ellipse problem with TextViews

In the android mobile development, If you want to ellipsize, simply use android:singleLine="true" , or android:ellipsize="end" .

How to Fix Memory Leaks in Java

What Are Memory Leaks? Let’s start by describing how memory leaks happen in Java. Java implements automatic garbage collection (GC), and once you stop using an object you can depend on the garbage collector to collect it. While additional details of the collection process are important when tuning GC performance, for the sole purpose of fixing a memory leak we can safely ignore them. Is My Program Leaking Memory? Not every OutOfMemoryError alert indicates that a program is suffering from a memory leak. Some programs simply need more memory to run. In other words, some OutOfMemoryError alerts are caused by the load, not by the passage of time, and as a result they indicate the need for more memory in a program rather than a memory leak. To distinguish between a memory leak and an application that simply needs more memory, we need to look at the “peak load” concept. When program has just started no users have yet used it, and as a result it typically needs much less m

How to Check Memory Usage in Linux based Server

free free command displays amount of total, free and used physical memory (RAM) in the system, as well as shoing information on shared memory, buffers, cached memory and swap space used by the Linux kernel. Syntax of free free -[options] usage: free [-b|-k|-m|-g] [-l] [-o] [-t] [-s delay] [-c count] [-V]   -b,-k,-m,-g show output in bytes, KB, MB, or GB   -l show detailed low and high memory statistics   -o use old format (no -/+buffers/cache line)   -t display total for RAM + swap   -s update every [delay] seconds   -c update [count] times   -V display version information and exit Example usage of free free -m The command will display information about physical memory in MB.

Creating a memory leak with Java

Here's a good way to create a true memory leak (objects inaccessible by running code but still stored in memory) in pure Java: The application creates a long-running thread (or use a thread pool to leak even faster). The thread loads a class via an (optionally custom) ClassLoader. The class allocates a large chunk of memory (e.g. new byte[1000000] ), stores a strong reference to it in a static field, and then stores a reference to itself in a ThreadLocal. Allocating the extra memory is optional (leaking the Class instance is enough), but it will make the leak work that much faster. The thread clears all references to the custom class or the ClassLoader it was loaded from. Repeat. This works because the ThreadLocal keeps a reference to the object, which keeps a reference to its Class, which in turn keeps a reference to its ClassLoader. The ClassLoader, in turn, keeps a reference to all the Classes it has loaded. It gets worse because in many JVM implementations

10 Points about Java Heap Space

10 Points about Java Heap Space 1. Java Heap Memory is part of Memory allocated to JVM by Operating System. 2. Whenever we create objects they are created inside Heap in Java. 3. Java Heap space is divided into three regions or generation for sake of garbage collection called New Generation, Old or tenured Generation or Perm Space. 4. You can increase or change size of Java Heap space by using JVM command line option -Xms, -Xmx and -Xmn. don't forget to add word "M" or "G" after specifying size to indicate Mega or Giga. for example you can set java heap size to 258MB by executing following command java -Xmx256m HelloWord. 5. You can use either JConsole or Runtime.maxMemory(), Runtime.totalMemory(), Runtime.freeMemory() to query about Heap size programmatic in Java. 6. You can use command "jmap" to take Heap dump in Java and "jhat" to analyze that heap dump. 7. Java Heap space is different than Stack wh

Installation Oracle 11.10 g on Ubuntu

I tried several times to install Oracle from handbook ,youtube, oracle web sites, forums and so on.. however this is not possible because Ubuntu Linux is not certificated for Oracle 11.10 g ,you have to install lots of package and also you change some important hardware configuration.

Backup iPhone Notes

Doubtlessly the simplest way to backup iPhone notes is to send them to yourself by email Start by setting up your email account on your iPhone ( shown here with Gmail ) Make sure your iPhone is properly connected to the Internet through Wi-Fi or mobile phone network Tap Mail Then tap Gmail Your name is optional, but enter at least your email address and password and tap "Save" Now, back to the iPhone main screen Tap Notes Open one of your Notes At the bottom of your display, tap the Envelope Tap your email address in the "To" field Edit the Subject if required Click "Send" and Voila ! Your Note will show up in your Gmail account within a couple of seconds !

Sync iPhone Notes

If you really want to "synchronize" iPhone Notes, your best bet is to use Google Sync Just follow our Sync iPhone Contacts with Gmail Guide and make sure "Notes" is switched on when you select the Google services you wish to sync Notes & possible issues Syncing iPhone notes requires Apple's iOS 4.x firmware ( iPhone OS 4.x ) This allows you to Sync your iPhone Notes with Gmail. They will show up in Gmail with the "Notes" label This solution allows to Copy Notes from one iPhone to another, which is very handy if you need to Transfer Notes from your current iPhone to a new iPhone

How to edit notes in icloud mail

To create a note: 1. Create a new email message. 2. Save it as a draft. 3. Move the message to Notes folder. To edit or delete an existing note: 1. Move the note from Notes folder to Drafts folder. 2. Do what you need 3. If you want to keep the info - save it and move it back to Notes folder. I wish Apple at least automated this process :)