windows’ta nginx kurulumu ve proxy olarak kullanımı

önce windows için burdan indiriyoruz.

conf klasöründeki nginx.conf dosyasında şu gibi değişiklikleri yapıyoruz:

server {
 listen 80;
 server_name localhost;

 location / {
 #proxy_pass http://localhost:8080;
 proxy_pass http://madvens.wordpress.com;
 }
}

cmd den nginx klasörüne girip start nginx komutu ile nginx’i çalıştırıyoruz.

artık 80. porta gelen istekleri nginx otomatik proxy_pass te belirttiğimiz yere yönlendiriyor.

not: nginx i durdurmak için: taskkill /F /IM nginx.exe

Jelastic’te mysql konfigürasyonu

http://jelastic.com/docs/connection-to-mysql

<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
 <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
 <!--<property name="url" value="jdbc:mysql://localhost:3306/fcDb"/>-->
 <property name="url" value="jdbc:mysql://mysql-formCreator.jelastic.servint.net/JelasticDB"/>
 <property name="username" value="jelasticDBUser"/>
 <property name="password" value="jelasticDBUser"/>
</bean>

Eclipse Kullanarak Android’de HelloWorld Uygulaması

- Android SDK indirilmesi ve Kurulumu

öncelikle bu adresten android sdk yı indiriyoruz. inince Android SDK’nın kurulduğu klasörde bulunan SDK Manager.exe dosyasını çalıştırıyoruz. program bize uygun olanları checkli gösterecek. accept all ve install diyoruz. “Access is denied” diye bişeyler çıkıyorsa programı baştan “run as administrator” diye çalıştırıyoruz ve yine accept all ve install…

- Eclipse’de ADT Plugin Kurulumu

şimdi eclipse de bu adreste anlatıldığı gibi ADT Pluginini kuruyoruz. bakmaya üşenenler için:

  1. Start Eclipse, then select Help > Install New Software….
  2. Click Add, in the top-right corner.
  3. In the Add Repository dialog that appears, enter “ADT Plugin” for the Name and the following URL for the Location:
  4. https://dl-ssl.google.com/android/eclipse/
  5. Click OK
  6. Note: If you have trouble acquiring the plugin, try using “http” in the Location URL, instead of “https” (https is preferred for security reasons).
  7. In the Available Software dialog, select the checkbox next to Developer Tools and click Next.
  8. In the next window, you’ll see a list of the tools to be downloaded. Click Next.
  9. Read and accept the license agreements, then click Finish.
  10. Note: If you get a security warning saying that the authenticity or validity of the software can’t be established, click OK.

  11. When the installation completes, restart Eclipse.

Son olarak SDK Locatin ayarlarınız yapmalıyız. Bunun için ana menüden Window -> Preferences yolunu takip edin. Daha sonra Android sekmesine tıklıyoruz. Sağ taraftan Browse seçeneğine tıklayarak, SDK Manager.exe’nin bulunduğu dizini seçiyoruz. Seçtikten sonra Apply yapıyoruz ve entegrasyon tamamlanmış oluyor.

- HelloWorld!

Kurulum işlemini tamamladıktan sonra “Hello World” uygulamasını yazmaya başlayabiliriz. burdan sonrası bu linkte :) “Run the Application” bölümünü tamamladıktan sonra “Upgrade the UI to an XML Layout” bölümüne geçilmese de program artık çalışıyor..

- Uygulamayı Gerçek Bir Cihazda Çalıştırmak

şimdi geldi uygulamayı gerçek bir cihazda çalıştırmaya.. bunun çeşitli yolları var. bence en kolayı Astro File Manager gibi bir porgramı telefona android marketten indirmek. sd karta apk dosyasını taşıdıktan sonra bu program vasıtasıyla kolayca install edebiliyoruz. tavsiye ederim..

Git with Eclipse (EGit)

http://www.vogella.de/articles/EGit/article.html

bu sitedeki adımları takip ettim. Fakat eclipseteki kodları github a push etmek isterken “Reason: ssh://git@github.com:22 Passphrase for ...” gibi bi hata çıkıyor. çünkü, bendeki eclipse versiyonu indigo ve galiba incubationlarda böyle bir bug varmış. bu linkte de görüldüğü gibi, eclipse in older versionlarından birini yüklemek gerekiyor. peki Where can I find older releases of EGit? :)
bendeki güncel versiyonu uninstall edip, http://download.eclipse.org/egit/updates-1.0 bunu install ettim, oldu. yani github a eclipseteki projeyi push edebildim.

Alternatively, şöyle de birşeyler var:

Simple fix that skips the passphrase and uses only Eclipse

  1. Use ssh-keygen from Git Bash, or Eclipse, to generate an RSA key, but do so without setting a passphrase.
  2. Open and copy the public key from ~/.ssh/id_rsa.pub and add it to GitHub via the SSH Public Keys section in Account Settings.
  3. Restart Eclipse. (Note: Not doing this was tripping me up for a while.)
  4. Try the Push Upstream steps again from the EGit User Guide.

The obvious pitfall here is that a passphrase cannot be associated with the RSA key. If skipping the passphrase is out of the question the following solution a little more up your alley.

Tomcat – java.lang.OutOfMemoryError: PermGen space

Tomcat production server sometime will hit the following java.lang.OutOfMemoryError: PermGen space error.

java.lang.OutOfMemoryError: PermGen space
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)

It’s usually happened when the Tomcat start and stop few times. It’s just funny, however you can fine tune it with some minor changes in the Tomcat configuration setting. By default, Tomcat assigned very little memory for the running process, you should increase the memory by make change in catalina.sh or catalina.bat file.

How to fix it?

1) Find where is Cataline.sh located. We need to make some changes in “catalina.sh” file.
P.S Cataline.sh is located at \tomcat folder\bin\catalina.sh

2) Assign following line to JAVA_OPTS variable and add it into catalina.sh file.

JAVA_OPTS="-Djava.awt.headless=true -Dfile.encoding=UTF-8
-server -Xms1536m -Xmx1536m
-XX:NewSize=256m -XX:MaxNewSize=256m -XX:PermSize=256m
-XX:MaxPermSize=256m -XX:+DisableExplicitGC"

Partial example of the catalina.sh file

# JSSE_HOME (Optional) May point at your Java Secure Sockets Extension
# (JSSE) installation, whose JAR files will be added to the
# system class path used to start Tomcat.
#
# CATALINA_PID (Optional) Path of the file which should contains the pid
# of catalina startup java process, when start (fork) is used
#
# $Id: catalina.sh 609438 2008-01-06 22:14:28Z markt $
# -----------------------------------------------------------------------------

JAVA_OPTS="-Djava.awt.headless=true -Dfile.encoding=UTF-8 -server -Xms1536m
-Xmx1536m -XX:NewSize=256m -XX:MaxNewSize=256m -XX:PermSize=256m
-XX:MaxPermSize=256m -XX:+DisableExplicitGC"

# OS specific support. $var _must_ be set to either true or false.
cygwin=false
os400=false
darwin=false
case "`uname`" in
CYGWIN*) cygwin=true;;
OS400*) os400=true;;
Darwin*) darwin=true;;
esac

# resolve links - $0 may be a softlink
PRG="$0"

3) Done. Restart Tomcat.
You should change the “Xms” and “PermSize” value base on your server capability.

Windowsta Java + MongoDB

Windowsta Mongodb kurulumu:

öncelikle bu adresten mongodb yi indiriyoruz. unzip ettikten sonra bin klasöründeki mongod.exe yi (database sever için)  ve mongo.exe yi (administrative shell için) çalıştırıyoruz.

by default mongodb dataları C:\data\db klasöründe tutuyor. eğer başka yerde tutmak isterseniz mongod.exe yi --dbpath komutu ile çalıştırıyoruz. (örneğin: dataları d:\mongodb\data\db klasöründe tutmak için,  mongod.exe --dbpath d:\mongodb\data\db  gibi)

eğer bi aksilik olmazsa “waiting for connections on port 27017″ diyecek.

artık mongo.exe yi çalıştırıp administrative shell imize geçebiliriz.

(bu arada diğer seçenekleri görmek için mongod --help veya mongo --help)

biraz takılmak isterseniz, burada  örnekler var..

Javada Mongodb kullanımı:

bu adresten mongo jarını indiriyoruz ve bu jarı classpath e include ediyoruz. artık kullanmaya başlayabiliriz.

bu kod ile test edebilirsiniz:

package com.wordpress.madvens.mongo;

import com.mongodb.Mongo;

public class Test {
   public static void main(String[] args) throws Exception {
       Mongo m = new Mongo();
       System.out.println(m.getDatabaseNames());
    }
}

daha fazla öğrenmek için: https://github.com/mongodb/mongo-java-driver/blob/master/examples/QuickTour.java

online Java API dökümantasyonu için: http://api.mongodb.org/java/current/

online MongoDB API dökümantasyonu için: http://api.mongodb.org/java/current/

son olarak faydalı bir link : http://www.mkyong.com/tutorials/java-mongodb-tutorials/

Installing Jadclipse

Today I am going to show you how to install and use Jadclipse. Jadclipse is eclipse plug-in that integrates Jad (Java decompiler) with Eclipse.

  • First you require Jad for decompiling java files. You can find a list of mirrors on this site where you can get JAD for various platforms. Download it and unzip into any folder on your hard drive.
  • Next download the Jadclipse plug-in jar file from here and place the jar file in your eclipse plugins folder
  • Restart your eclipse. If eclipse didn’t recognize the plug-in then launch eclipse with -clean flag.
eclipse -clean
  • Configure the path to the Jad executable in eclipse under Window > Preferences… > Java > JadClipse > Path to Decompiler.

  • Set the full path of the jad executable, e.g. C:\Program Files\Jad\jad.exe
  • Go to Window > Preferences… > General > Editors > File Associations and make sure that the JadClipse Class File Viewer has the default file association for *.class  files.

Now everything is done. If you want to view the source for any class then simply ctrl+click on that class then the source for that class will be showed in your eclipse editor.

Java IO ile ilgili bişeyler

kodda OutputStreamWriter hakkında iki örnek var:

public static void main(String args[]) throws IOException {

  ByteArrayOutputStream out = new ByteArrayOutputStream();
  OutputStreamWriter ow = new OutputStreamWriter(out);

  ow.write("Constructor argument is ByteArrayOutStream object");
  ow.flush();
  System.out.println(out.toString());

  FileOutputStream flt = new FileOutputStream(new File("D:/madvens.txt"));
  ow = new OutputStreamWriter(flt);
  ow.append("welcome to http://madvens.wordpress.com");

  System.out.println("\nAppended sequence of characters will generate in a file madvens.txt");
  ow.flush();
}

Java IO Class Overview Table

Byte Based Character Based
Input Output Input Output
Basic InputStream OutputStream Reader
InputStreamReader
Writer
OutputStreamWriter
Arrays ByteArrayInputStream ByteArrayOutputStream CharArrayReader CharArrayWriter
Files FileInputStream
RandomAccessFile
FileOutputStream
RandomAccessFile
FileReader FileWriter
Pipes PipedInputStream PipedOutputStream PipedReader PipedWriter
Buffering BufferedInputStream BufferedOutputStream BufferedReader BufferedWriter
Filtering FilterInputStream FilterOutputStream FilterReader FilterWriter
Parsing PushbackInputStream
StreamTokenizer
PushbackReader
LineNumberReader
Strings StringReader StringWriter
Data DataInputStream DataOutputStream
Data – Formatted PrintStream PrintWriter
Objects ObjectInputStream ObjectOutputStream
Utilities SequenceInputStream

faydalı şeyler

quartz ile ilgili güzel şeyler - http://www.quartz-scheduler.org/documentation/quartz-2.x/tutorials/tutorial-lesson-06

javascript kod daraltmaca - http://closure-compiler.appspot.com/home

javascript kod düzenlemece - http://jsbeautifier.org/

brainstorming - http://www.mindmeister.com/

sql designer - http://ondras.zarovi.cz/sql/demo/

mysql commands - http://www.pantz.org/software/mysql/mysqlcommands.html