Postgresql 8.3 on Ubuntu Interpid

 2009.04.01. 18:18

PostgreSQL is my preferred database on a Linux environment.This is the sequence I used to install it on my development machine. It is running Ubuntu 8.10 (Intrepid Ibex) beta on a VMware Workstation virtual machine.

I referred to https://help.ubuntu.com/community/PostgreSQL, http://bioinformaticsonline.co.uk/2007/02/26/postgresql_on_ubuntu_linux_how_to and  http://hocuspokus.net/2007/11/05/install-postgresql-on-ubuntu-710/ and adapted the instructions a little bit.

Installing the server and basic tools

sudo apt-get install postgresql postgresql-client postgresql-contrib

That got me PostgreSQL 8.3.

Basic Server Setup

First, changing the password of the postgres user:

sudo -u postgres psql postgres
ALTER USER postgres WITH ENCRYPTED PASSWORD '<***password***>';
\q

Creating the initial databases

sudo -u postgres createdb dev
sudo -u postgres createdb test

That creates a database named “dev”, for development, and another named “test”, for testing.

I use schemas to have multiple applications using a single database.

Setting Up the Admin Pack

The admin pack is said enable better logging and monitoring within pgAdmin.

sudo -u postgres psql < /usr/share/postgresql/8.3/contrib/adminpack.sql

Installing pgAdmin III

pgAdmin III is a database design and management application for use with PostgreSQL.

sudo aptitude install pgadmin3

Using pgAdmin

pgadmin3

I clicked on the “Add a connection to a server” button (top left). I filled in the host (localhost) and password of the postgres user (from the previous ALTER USER command). Then I clicked OK and was connected to the local PostgreSQL server.

Incidentally, I noticed that the databases I created were set to UTF-8 encoding. Great, exactly what I wanted.

Restarting the server

If there is any need, the server can be restarted this way:

sudo /etc/init.d/postgresql-8.3 restart

Other tasks

Some times I might want to open up the server for network access and/or install phpPgAdmin to control it with a Web interface. The articles mentioned in the introduction can help with that. I don’t think I’ll have to do either thing on this development environment, though.

Conclusion

That’s it. Quick, easy and powerful. I really like Ubuntu.

Bevezetés

Mint tudjuk, az XML 1.0 szabványt elfogadta a W3 konzorcium és egy kis csoport elkezdett dolgozni Simple Object Access Protocol, amely késbőbb Service Oriented Architecture Protocol lett, amit SOAP névén ismerünk.

Dave Winer másokkal előrukkolt az XML-RPC-vel, ami Remote Procedure Call nevet takar. RPC lehetővé tette, hogy szerver és kliens közötti interaktivitását használjuk ki a WEB-n. Mit takar:

  1. Limitált Adat típusok
  2. Szerveren definiált metódusok, amelyeket kliensek használhatnak.
  3. XML kommunikáció HTTP rétegen keresztül.

Egy lehetséges XML-RPC adat definíció:

<?xml version="1.0"?>
<methodCall>
     <methodName>movie.getMovieName</methodName>
     <params>
          <param>
               <value><i4>17</i4></value>
          </param>
     </params>
</methodCall>

Azonban vannak hátrányai. Egy nagy rendszerben, az XML kommunikáció átláthatatlanná válik. Rugalmatlan, mivel minden egyes XML-RPC szerver oldalon egyedileg van kiépítve, ennek hatására, nagyon kötötté válik a renszerrel. Azonkívül kliens oldali fejlesztőnek WSDL ( Web service description language ) fájlal kozultálnia kell, hogy megértse mit várhat szerver oldalról, ami persze lehet automatizálni különböző eszközökkel.

 

Java Exceptions

 2009.02.24. 16:38

Mindig megkell nézni, ha nem tudjuk, mit is takar az Exception. Hát íme, egy szorgos programozó kigyűjtötte :

 

Explanations of common Java exceptions

java.lang
ArithmeticException You are trying to use your computer to solve a mathematical problem that you cannot solve yourself. Read up on your arithmetics and try again.
ArrayIndexOutOfBoundsException See IndexOutOfBoundsException. The difference is that this exception refers to more than one finger.
ArrayStoreException You have used all your arrays and need to buy more from the array store.
ClassCastException You need to stay in the class or caste you were born into. Java will not accept dailits acting as kshatriyas or noblemen pretending to be working class. Note the spelling mistake (of caste) that was introduced in Java 1.0 and has not been corrected for backwards compatability reasons.
ClassNotFoundException You seem to have invented your own class. There are also caste systems that are not yet implemented in Java, most notibly the balinese caste system. For example, if you are a wesia, use the indian counterpart vaishya.
CloneNotSupportedException You are a clone. Find the original you, tell him what you want to do and then kill yourself.
IllegalAccessException You are a burgler that are running a Java program during a burglery. Please finish stealing the computer, leave the premises and try again.
IllegalArgumentException You have tried to protest against a previous exception.
IllegalMonitorStateException Please turn your computer screen back on.
IllegalStateException You come from a state that is not yet recognized by the UN, possibly Kurdistan or Palestine. Get a real citizenship, recompile your java code and try again.
IllegalThreadStateException One of the screws in your computer is threaded the wrong way. Please contact your hardware vendor.
IndexOutOfBoundsException You have put your index finger in an unacceptable place. Reposition it and try again.
InstantiationException Not everything can happen instantly. Please be more patient.
InterruptedException Tell your colleagues, room-mates etc. to leave you alone while you are working.
NegativeArraySizeException You have created an array with negative size. This can cause information to be lost and in the long run the Universe will be destroyed. Be happy that Java noticed what you were doing and DON'T DO IT AGAIN.
NoSuchFieldException You are trying to have a picknick on a field that does not exist. You can also get this exception if you try to visit an airfield that in fact does exist, but has been classified as top-secret. I'd give you examples, but then I'd have to kill you.
NoSuchMethodException Don't use that method! Please, do things like we have always done.
NullPointerException You do not own a dog. Get one, for example a brittany spaniel, and try again.
NumberFormatException You are using outdated units of measurement, for example inches or pints. Convert to SI. There is a known bug that causes this exception to be thrown if you are very short or tall.
RuntimeException You cannot run fast enough, possibly due to obesity. Turn off your computer and go out and get som exercise.
SecurityException You have been deemed a threat to nationaly security. Please sit still and wait for the authorities to come and get you.
StringIndexOutOfBoundsException Your panties have shiften out of place. Adjust them and try again. You can also get this exception if you are not wearing any panties at all.
UnsupportedOperationException You are trying to have an operation that for som reason, ethical or otherwise, is not supported by Java. Examples of this include unneeded amputations, for example circumcisions. Please stop abusing your body and do not remove pieces of you child, damn it!

 

java.util
ConcurrentModificationException Someone else has modified your Java code. You should probably change your password.
EmptyStackException In order for Java to work, you must have a stack of Java books on your desk. Actually, one is enough if it is really thick.
MissingResourceException You are too poor to be using Java. Switch to a cheaper language (such as Whitespace, Shakespeare, Cow, Spaghetti or C#).
NoSuchElementException There are only four elements (earth, water, air, fire). The Fifth Element is just a movie.
TooManyListenersException You are bugged by too many secret organizations. Expect a SecurityException soon.

 

java.awt
AWTException You are using AWT, which means your GUI will be ugly. This exception is only a warning and can be ignored.
FontFormatException Your layout is ugly, or you have selected a bad font, or too many fonts. Please consult a professional designer.
HeadlessException Java thinks you are too stupid to be a programmer.
IllegalComponentStateException One of your hardware components (e.g. harddrive, CPU, RAM) is broken. Please contact your hardware vendor.

 

java.awt.color
CMMException Your CMM is broken. What ever the hell that is. I usually burn my house down and move to a new city to start over.
ProfileDataException Your personal profile contains suspicious information. If you are not a communist, terrorist, atheist etc., please contact the CIA to correct the mistake.

 

java.awt.datatransfer
MimeTypeParseException You are a bad mime. Noone can understand what you are trying to express. Try something simpler, like walking-against-the-wind och being-trapped-in-an-invisible-box.
UnsupportedFlavorException You are trying to use a flavor that is unknown to Java. Most people seem to get by using only vanilla and cherry.

 

java.beans
IntrospectionException You are too introverted. Be more extroverted. Stop being such a nerd and go out and meet some people!
PropertyVetoException One of your properties has been vetoed. The message should inform you of who did it and why. If it does not, you probably shouldn't ask.

 

java.io
CharConversionException You have been trying to incinerate something noncombustible. It is also possible that you have tried turning yourself into a fish, but that's rare.
EOFException You get this exception because you don't know what EOF stands for. Well, I'm not going to tell you, Mr Ignoramus.
FileNotFoundException A carpenter should always know where his tools are.
InterruptedIOException You have been using IO despite of an earlier IOException and your activities have been interrupted.
InvalidClassException See ClassNotFoundException.
InvalidObjectException Objection overruled, as they say in court.
IOException IO stands for input/output and has to do with sending and recieving data. IO is a security problem and should not be used.
NotActiveException This can mean two things. Either something is inactive and needs to be active, or something is active and needs to be inactive. Activate and inactivate things randomly until things work.
NotSerializableException You are trying to make a TV series based on a movie.
ObjectStreamException You have issued a stream of objections. Please limit yourself to one at a time and wait for the judge to make a ruling before issuing a new one. See InvalidObjectException.
OptionalDataException You seem to think that some optional data is required. Don't make things harder than they are.
StreamCorruptedException Your data stream is corrupted, which means that it has been stealing packages and selling them on the black market.
SyncFailedException You have tried to synchronize your failures with someone else and you have turned out to be a bigger failure that that person. Try to find someone on your own level.
UnsupportedEncodingException If you want to send something coded over the network, you have to file your encryption key with the NSA. If you don't, you will be regarded as a terrorist and dealt with in the appropriate way. If you get this exception, you should run away very fast indeed.
UTFDataFormatException UTF stands for Universal Transmission Format and is a way of transmitting data that works regardless of which format you use. You have tried to transmit data over UTF using the wrong format.
WriteAbortedException You need to write the word "aborted" somewhere in your program. It usually doesn't matter where, you just have to do it.

 

java.net
BindException Java programming and bondage don't mix.
ConnectException You are trying to connect something to something it cannot be connected to. Try to connect it to something else. Perhaps it is possible to connect your things to eachother via a special connection object that connects to both ends of your desired connection.
MalformedURLException You are making an urn and either it has the wrong shape (e.g. an "L" shape) or you have misspelled the word "urn" (e.g. "url").
NoRouteToHostException There is no route to the host. Contact the Road Administration.
PortUnreachableException Ports and harbors must be placed right next to a water body. If placed inland, they will be unreachable.
ProtocolException This is the result of a serious breach of etiquette (such as pukíng on your host). The solution is simple: Don't do that!
SocketException You have connected your computer to a power outlet of the wrong kind. Most of the times you have to find another outlet, but some computers have a switch on the back where you can set the power outlet type.
SocketTimeoutException You have connected your computer a power outlet with a timer and the time has run out. Such outlets should only be used for flat-irons and similar things.
UnknownHostException Didn't your parents teach you to not talk to strangers?
UnknownServiceException You are trying to access an unknown service. The most known unknown service is perhaps Secret Service.
URISyntaxException The sentence "You are I" is not syntactically correct. Change it to "You are me". What ever the hell that means.

 

java.rmi
AccessException You are using Microsoft Access. Please don't.
AlreadyBoundException Despite what is stated in the description of java.net.BindException, RMI does support bondage. However, you cannot tie up someone that is already bound.
ConnectException You are trying to connect something to something it cannot be connected to. Try to connect it to something else. Perhaps it is possible to connect your things to eachother via a special connection object that connects to both ends of your desired connection.
ConnectIOException You are trying to connect something that has to do with IO to something it cannot be connected to. Try to connect it to something else. Perhaps it is possible to connect your things to eachother via a special connection object that connects to both ends of your desired connection.
MarshalException Something is wrong with your marshal. What you should do depends on what kind of marshal we are talking about. It can be a field marshal, police, firefighter or just your ordinary basic marshal. Note that this exception has nothing to do with the Republic of the Marshall Islands, a.k.a. RMI.
NoSuchObjectException You are trying to use an object that does not exist. Create it or don't use it, Einstein!
NotBoundException If you are using bondage, please make sure that at least one person is tied up.
RemoteException This is a special exception that is thrown remotely. If someone else's application has become so instable that it can't even produce an exception, then you may get the exception instead. Please find the source and inform that programmer of the error.
RMISecurityException The Republic of the Marshall Islands has become instable. If you live there, you should probably leave and don't come back until your security can be guaranteed. If you live elsewhere, you can ignore this exception.
ServerException Second serve. (Or double fault if applicable.)
ServerRuntimeException Tennis matches are long enough as it is. You will get this exception if you take too long to serve.
StubNotFoundException When you go to the movies, you should always keep your stub. If you don't, and also leave the theater, you will not be let back in and you may have to buy a new ticket. So, KEEP YOUR STUB!
UnexpectedException This exception should come as a total surprise to you. If it did, everything is as it should be.
UnknownHostException Didn't your parents teach you to not talk to strangers?
UnmarshalException You have not fullfilled your duties as an officer of the law (or whatever marshal you used to work as). Note that the correct term is "used to". You have been fired (which is really ironic if you were a firefighter).

 

java.security
AccessControlException You have lost control of Microsoft Access. If you cannot regain control or stop the program in some other way, you should cut the power to your computer as fast as possible.
DigestException You should be careful with what you eat. Indigestion can be a serious problem.
GeneralSecurityException Something somewhere appears to be unsafe. If you have the power to do so, you should invade a random country (preferably in the middle east). If you do not have such power, you should at least get a gun.
InvalidAlgorithmParameterException You have explained your algorithm to a disabled person in a way that is not suited to that person's level of understanding. Keep it simple!
InvalidKeyException There are two rather different reasons for this exception: 1. You are using the wrong key. My advice is to paint small dots in different colors on your keys to help you remember which one is for which lock. 2. You are not allowed to lock up disabled people without giving them a key. If they are smart enough to figure out how to use it, they have a right to move freely.
InvalidParameterException You have used a disparaging term to describe a disabled person.
KeyException Do not try to unlock locks without a key.
KeyManagementException You have lost your key. Most likely you left it at the office (if you're trying to enter your home) or at home (if you're trying to enter the office).
KeyStoreException The explanation for the previous KeyManagementException is that there is a hole in your pocket.
NoSuchAlgorithmException You are trying to solve a problem in a previously unknown way. Stop being so damn creative and rewrite your program using old algorithms. You can also patent your idea and wait for it to be incorporated into a future Java release.
NoSuchProviderException If you are a single mom, you cannot be a housewife. First, you need to get a provider for your family.
PrivilegedActionException You have tried to take an action that you do not have the privilege to take. For example, getting away with murder is something that only famous people can do, child molestation is only for catholic priests and high ranking jehova's witnesses, and only people with managerial positions in private corporations are allowed to steal money.
ProviderException You are a woman and are trying to be the provider of a family. Obviously, your husband cannot be a housewife, so you need to let him do the providing. Thinking that Java is old-fashioned will not change reality. This is how things work. Deal with it.
SignatureException Either you have forged someone else's signature, or your signature unacceptable. A signature cannot be too ugly, too readable or too large.
UnrecoverableKeyException Damn. You dropped your key down a drain. The only comfort I can offer is that the key should be unrecoverable for other people as well, so it may not be necessary to change your locks.

 

java.text
ParseException You are not making any sense. Calm down and try again.

 

Copyright © 2005 Björn Andersson

 

Preface:

Pénteken megkellett változtatnom egy-két adatot az adatbázisban. Sajnálatos módon, kevés DB tapasztalattal, úgy kezdtem hozzá, hogy

update table_name set column_name = value where condition

És mint aki jól végezte a dolgát, elmentem cigizni. Cigiből vissza, kipróbáltam, hogy valóban megváltoztak-e az adatok. Megdöbbenten tapasztaltam, hogy túlságosan is megváltoztattak.

Gebasz van. WARNING !!!

Problem:

Ezekután próbáltam Rollback-ezni a változtatásokat, de nem lehetet. Miért? Mert nem volt transaction block-ban az utasítás sorozat, szerencsétlen adatbázis honnan tudná, hogy mit kell rollback-ezni.

Solution:

Akár milyen kis, triviális változtatást, mostantól kezdve, mindig

begin;

 transaction block-ba kell helyezni. Utána már lehet rollback-ket alkalmazni ha mégis elbasztam volna valamit.

rollback;

Hogyan is működik? Természetesen rollback-ezni lehet egy Work vagy tranzakciót. Részletesebb doksi: http://www.postgresql.org/docs/7.4/interactive/sql-rollback.html

Íme egy példa transaction rollback-re:

Example:

isys=#create table dummy( a varchar(1));
CREATE TABLE
isys=#insert into dummy values('a');
INSERT 0 1
isys=#select * from dummy;
 a
---
 a
(1 row)
isys=#begin;
BEGIN
isys=#update dummy set a = 'b' where a = 'a';
UPDATE 1
isys=#select * from dummy;
 a
---
 b
(1 row)
isys=#rollback;
ROLLBACK
isys=#select * from dummy;
 a
---
 a
(1 row)

Enyhén szólva megizzadtam, hogy kijavítsam a hibát. Ezért gondoltam megosztom a hülyeségemet, nehogy mások is elkövessék.

 

 

Mit kell tudni róla : http://www.j2mepolish.org/cms/topsection/home.html


Próbálok interaktívan blogolni, így még én sem tudom, hogy mennyire lesz használható e remeknek tűnő szoftver.

Instaláció:

jar file-t letöltése megtörtént.java -jar j2mepolish-{version}.jar

Itt az első lépés hogy beállítsuk, hogy hol vannak a platform $HOME. Megjegyzem, létezik olyan állat aki egyszerre:

  1. S60
  2. Motorola
  3. Sony-Ericsson
  4. Blackberry
  5. Siemens
  6. Benq
  7. Doja

platformokra fejleszt? Ha van ilyen lény, akkor feltétlenül jelentkezzen, mert jövök neki egy túró rudival ( Respect ).

De ne ugorjunk ennyire előre, első és legfontosabb path a Sun Wireless Toolkit $HOME. Ezt lelehet tölteni a Sun oldaláról. Itt gyorsan megjegyezném, hogy MacOSX alatt Moile Power Player SDK-t kell beállítani.

Next

Kövezkező oldalon kiválaszthatjuk, hogy milyen csomagokat szeretnénk felrakni, itt annyi van mint a nyűg. Én Eclipse Mepose/Netbeans integration pluszban kipipáltam, a többit hagytam változatlanul.

Next

Másolja a cuccost ezerrel.

Next

Kész.

Mit tud?

Eclipsebe próbálkozom, kiváncsi vagyok, hogy működik-e 3.4 eclipse alatt.

Software Update

Miután beintegrálta magát az eclipse-be, természetesen az instalálásnál megkellett adnunk az eclipse $HOME-t. Update-elnünk kell a plugin-t az alábbi címen: http://www.j2mepolish.org/mepose

Miután újra indult a eclipse, állítsuk be a Preferences menüpont alatt a Polish $HOME könyvtáráat. Ezekután mehet a játék.

Create New J2ME-Polish Project

Ami nagyon tetszik, hogy kitudod választani, hogy milyen CLDC konfigurációkra, MIDP platformokra generálja le a projektet. Ja Android-t is kiválaszthatod ;) Nagyon baba.

Ezek után kiválaszthatod, hogy milyen eszközökre emulálja, elég sok a választási lehetőség:

  • Virtual Generikus, Android
  • Nokia
  • SE
  • LG
  • Motorola
  • Blackberry
  • etc.

Elkészült a projekt. Próbáljuk ki a HelloWorld-t.

Kód

 

package hu.elte.dummy;

import javax.microedition.lcdui.Display;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;

import de.enough.polish.ui.TextBox;

public class DummyMidlet extends MIDlet{

     protected void startApp() throws MIDletStateChangeException{
          // TODO: Implement this method.
          String scrOut = "Fasza!";
          Display.getDisplay(this).setCurrent(
          	new TextBox("TitlePane",scrOut,10,1));
     }

     protected void pauseApp(){
          // TODO: Implement this method.
     }

     protected void destroyApp(boolean unconditional) throws MIDletStateChangeException{
          // TODO: Implement this method.
     }

}
   
Run as Polish Midlet.

 

 

 

Véletlenül találtam rá erre az oldalra: www.ohloh.net/languages/compare

Azt hiszem tartalmazza a legtöbb nyelvet, amit valaha is használtak. Készítettem egy összehasonlítást a köv. nyelvekre:

  • C/C++
  • Java
  • C#
  • Ada
  • Assembly
  • PHP
  • Ruby

és kaptam egy nagyon elszomorító grafikont

Elnézést a lustaságomért, Firefox Grabemall plugin-t használtam, elég késő van ahhoz, hogy screenshot-t vagdossak. Próbáltam Ubiquity-vel (convert) is, de hasonló volt az eredmény.

Mint látható, a Java torony magasan vezet bármely nyelv előtt.

Miért? Ez egy jó kérdés. Erről elég sokáig beszélgettünk Winnie-vel pénteken, végülis arra jutottunk, hogy a platform függetlenség viszi a díjat.

Remélem eljön az idő, amikor feltámad a C++.

Mit takar a Netbeans 6.5

 2009.02.14. 17:24

Mit is takar a csodálatos Netbeans 6.5 ( csodával határos módon alig zabál memóriát, de ezt majd később ):

  • J2SE IDE
  • J2ME (opcionális )
  • JEE (opcionális), amely tartalmaz
  1. Glassfish V2/V3 Prelude
  2. Tomcat 5.5
  3. JBoss App. Srv.
  4. BEA WebLogic, ha jól emlékszem
  • WEB development Ruby, PHP
  • Perverzeknek Java IDE alatt C++ fejlesztést is kínál.

Röviden ennyit.

Meg kell jegyeznem, hogy elég kevés ram-ot zabál önmagában,  de mivel Java-s így ott a java process amely csak úgy habzsolja a ram-t. Egyik munkatársamat idézve

Ilyen a Java lelkivilága, megkell szeretni

Az erőltetett szeretetet sosem kedveltem, de gondolom azon programozók csoportja akik a BDSM-t szeretik és még nem volt alkalmuk flörtölgetni a

Java lelkivilágával

feltétlenül tudom ajánlani.

További szép délutánt :)

PS.: Pocsék egy esemény volt az EPOCH Time.

süti beállítások módosítása