on Oct 17th, 2008PL/SQL Trees Sorting.

I found this article and it realy helped me with me Oracle trees:

select name, slave_id, supervisor_id
from corporate_slaves
connect by prior slave_id = supervisor_id
start with slave_id in (select slave_id
                        from corporate_slaves
                        where supervisor_id is null);

NAME		       SLAVE_ID SUPERVISOR_ID
-------------------- ---------- -------------
Big Boss Man		1
VP Marketing		2 	    1
VP Sales			3 	    1
Joe Sales Guy		4 	    3
Bill Sales Assistant	5 	    4
VP Engineering		6 	    1
Jane Nerd			7 	    6
Bob Nerd			8 	    6

8 rows selected.

Thanks and enjoy!

on Oct 8th, 2008Which ways of Java/.Net (ESB) application integration with old/legacy database system do you know?

Situation: Some Bank has an old legacy ABS (Automatic bank system).

Bank wants to:

1. notify old legacy CRM system about client’s account changes (Publish operation).
2. check PIN codes of client cards (Request/Response operation) - in synchronious mode.

ABS is implemented in very old private technologies with StoredProcedures calls. So, I can connect to this system via database only.

Which ways of Java/.Net (ESB) application integration with old/legacy database system do you know?

Write/Publish operation

Any vendor’s databse server:

1. Scan tables for new entries - too low speed.
2. Trigger (if they’re supported) which handles SQL updates and inserts and writes event information to some table. And application listener should be checking this table for events.

Reading operation

1. Just write result into tables of ABS - dangerous.

2. …

How to notify legacy database system about responses in synchronious mode??? How to implement Write/Read in synchronious mode???

on Sep 30th, 2008Location of logging.properties and log4j.properties files in WAR application.

Log4J

The file log4j.properties should be located in \WEB-INF\classes folder of WAR archive.

Java Logging

But logging.properties must live in the same directory.

on Sep 30th, 2008Installing Hyperic HQ on RedHat 5.1.

1. Don’t use RPM package, because it contains only server. Or download agent RPM seperately.

2. If you try to install from

# tar zxvf hyperic-hq-installer-3.0.2-xxx.tgz
# ./hyperic-hq-installer/setup.sh

Execution of HQ setup not allowed as the root user.
Please log in as a different user and re-run
.../hyperic-hq-installer/installer-3.2.5/bin/hq-setup.sh

you will get a lot of problems like checking you privileges and rights. The installer will recommend you to login under non-root user, and then it will show many other erros and etc.

Just open file …/hyperic-hq-installer/installer-3.2.5/bin/hq-setup.sh and comment these lines:

if [ "$USER" = "root" -o "$UID" = "0" -o "$EUID" = "0" ]; then
    echo ""
    echo "Execution of HQ setup not allowed as the root user."
    echo "Please log in as a different user and re-run $0"
    echo ""
    exit 1;
fi

And then you will be able to setup hyperic as you wish.

on Sep 27th, 2008Hexing numbers!

Here is an example of convertion integer or byte into hex format:

private static String getHexDump(byte[] bytes) {
	final StringBuffer sb = new StringBuffer();
	for(byte b : bytes){
		sb.append(Integer.toHexString(((int)b & 0xff))).append(" ");
	}
	return sb.toString();
}

on Aug 20th, 2008502 Proxy Error on Apache Load Balancer.

Sometimes in my servers farm the “502 Proxy Error” error occures (”The proxy server received an invalid response from an upstream server.”), and I decided to find out where and why it hepends. After scanning the Internet and manuals of Apache Load Balancer I supposed that my Glassfish servers closed TCP connection after timeout and every first client of proxy would get the error. The solution is to set:

ProxyPass http://buggyappserver:7001/foo/
SetEnv force-proxy-request-1.0 1
SetEnv proxy-nokeepalive 1

after ProxyPass parameters. And Apache server will reconnect to Glassfish every time, but this veriant should be slower…

Enjoy!

on May 24th, 2008Smooth JPEG image scaling in Java.

Today, I have to write Java utility for resizing JPEG images for my photo gallary. It wasn’t so easy, because to resize is really stupid task. But what about smoothing of result images. They used to become absolutely unsuitable for posting to my web-site.

I found solution and glad to open a source code:

private void resizeImage(String filename, String newfilename)
	throws InterruptedException, ImageFormatException, IOException
{
	LOG.info("Resizing file : " + filename);
	// load image from file
	Image image = Toolkit.getDefaultToolkit().getImage(filename);
	MediaTracker mediaTracker = new MediaTracker(new Container());
	mediaTracker.addImage(image, 0);
	mediaTracker.waitForID(0);

	// get real size
	int imageWidth = image.getWidth(null);
	int imageHeight = image.getHeight(null);
	double imageRatio = (double)imageWidth / (double)imageHeight;

	// determine - vertical or horizontal
	if(imageHeight > imageWidth) {
		// vertical
		imageHeight = biggerPart;
		imageWidth = (int)(imageHeight * imageRatio);
	} else {
		// horizontal
		imageWidth = biggerPart;
		imageHeight = (int)(imageWidth / imageRatio);
	}
	LOG.info("New height = " + imageHeight + " and width = " + imageWidth);

	// draw original image to new image object and
	// scale it to the new size on-the-fly
	BufferedImage newImage = new BufferedImage(imageWidth,
			imageHeight, BufferedImage.TYPE_INT_RGB);
	Graphics2D graphics2D = newImage.createGraphics();
	graphics2D.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
			RenderingHints.VALUE_INTERPOLATION_BICUBIC);
	graphics2D.drawImage(image, 0, 0, imageWidth, imageHeight, null);

	// Soften
	float softenFactor = 0.09f;
        float[] softenArray = {0, softenFactor, 0, softenFactor, 1-(softenFactor*4), softenFactor, 0, softenFactor, 0};
        Kernel kernel = new Kernel(3, 3, softenArray);
        ConvolveOp cOp = new ConvolveOp(kernel, ConvolveOp.EDGE_NO_OP, null);
        newImage = cOp.filter(newImage, null);		

	// save new image to OUTFILE
	BufferedOutputStream out = new BufferedOutputStream(new
			FileOutputStream(newfilename));
	try {
		JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
		JPEGEncodeParam param = encoder.getDefaultJPEGEncodeParam(newImage);
		quality = Math.max(0, Math.min(quality, 100));
		param.setQuality((float)quality / 100.0f, false);
		encoder.setJPEGEncodeParam(param);
		encoder.encode(newImage);
	}finally {
		out.close();
	}
	LOG.info("Resized file : " + filename + " to " + newfilename);
}

Enjoy!

on May 4th, 2008How to know size of folder in Linux.

This command will show you the summarized size of the current folder and it’s subfolders:

du -hs

Enjoy!

on Apr 17th, 2008How to update Windows’s DNS cache.

This command flushes and updates local DNS cache wihtout rebooting machine:

# ipconfig /flushdns

Enjoy!

on Mar 27th, 2008Mule and Spring configuration file.

If you use a scheme-based Spring configuration file in Mule server like this one:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.springframework.org/schema/beans
 http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<beans>
	....
</beans>

you will get an error:

org.xml.sax.SAXParseException: Document root element “beans”, must match DOCTYPE root “null”.

It is required to use a DOCTYPE header of XML and DTD-based definition:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans-2.0.dtd">
<beans>
...
</beans>

Enjoy!

Phentermine Phentermine ChatCod Overnight PhentermineCocaine PhenterminePhentermine Free Shipping Medical Consult90 Ct Phentermine OnlineWhat Is The Price Of ViagraYour Source For Phentermine Adipex ViagraPhentermine Cheap Cod No PrescriptionGeneric Pal Pay ViagraPharmacy Comparison For PhentermineTramadol Vas ScoreCheapest Tramadol Weebly ComPhentermine London DiscreetGeneric Levitra 32Phentermine Scripts OnlineCustomer Reviews About Save Generic PhentermineForums PhentermineLegal Phentermine OrderingFioricet PicturePhentermine 37.5 Without RxXanax Online Overnight ShippingPaxil And Xanax Drug InteractionDiet Pills Phentermine Online ConsultationCheap Drug Generic Generic ViagraTramadol For Vicodin Detox Message BoardsHeating Tramadol HydrochlorideCheap Domain Ebuy Onlinecom PhenterminePhentermine Health RiskSildenafil Approved Pulmonary HypertensionClick Phentermine Top Phentermine Pharmacies OnlineCheap Phentermine Without A PrescriptionTramadol Cheap Fast No PrescriptionPhentermine Heart ProblemsBuy Ultram TramadolPhentermine Erection AddBuy Dreampharmaceuticals From Meridia OnlinePhentermine No Prescription 2007Buying Viagra OnlinePhentermine LawWhich Is Better Meridia Or PhentermineChewable Viagra 100mgViagra Levitra Cialis AdsTramadol DrugsinfoIttoolbox Com Profiles Buy_tramadolSide Effects Of Tramadol For DogsOnline Online Phentermine SalesBuy Online Us Viagra2007 Ordering PhentermineIs There Really Generic LevitraBuy Xanax Prescription RequireFlorida In PhenterminePhentermine Cash On DeliveryAdipex Meridia Online Phentermine Prescription ViaPhentermine No Physician NeededGeneric Levitra UsaMindful Musings Cheap ViagraOrder Phentermine Without A Doctors NameBest Price For Tramadol Generic UltramCheap Phentermine 37.5Buy Viagra Online UTramadol 400 PillsNlm TramadolFastin Phentermine Drug Description PrescriptionNon Prescription Sildenafil CitrateTramadol LongOnline Prescriptions Of PhenterminePakistanian PhentermineCheap Keyword TramadolTramadol Used To TreatPhentermine 37.5 Sale No PrescriptionBuy Medication PhenterminePhentermine And LexaproEffexor Compared To LexaproBuy Flomax On The NetSide Effect Of Tramadol AcetaminophenHydrocodone Cod OnlineCheap Deal Pill Viagra ViagraBuy Fastin Phentermine No PerscrptionsCanadian Pharmacy Cheap ViagraUltram Er Tramadol HydrochloridePhentermine Discussion ForumLowest Vas Score By Tramadol IvBuy Phentermine 15mgPhentermine And Prozac And Weight Loss CocktailCialis Or Vardenafil 20mg TabletYouth Football Magazine Forum Buy ValiumSnorting Phentermine CapsulesBuy Online Tramadol50mg Capsule Hydrochloride TramadolBuying Herbal Pill Sale ViagraPhentermine Noprescription In Stock Fed ExAdipex Phentermine Cheap Pay With PaypalTramadol During PregnancyOnline Games Buy Vitamins Viagra SaleNo Prescription Vardenafil HydrochlorideIs Tramadol HydrocodonePhentermine Online OverniteGeneric Prozac Look LikePhentermine Weight Loss Pharmacy OnlineBurn Desert Ephedrine PhentermineTramadol Patent FerretsCod Tramadol SaturdayAllpharmacy TramadolTramadol Overnight No PriorPhentermine No Rx Usps KyPhentermine Free Shipping BluePhentermine Order Forums TopixPhentermine FourmsOrder Phentermine SiteNo Rx Generic SomaInjecting TramadolSildenafil Citrate Indian ProductsPurchase 100mg Tramadol OnlineBuy Extra Cheap Phentermine Phentermine OnlineDoes Phentermine Raise Blood PressureTalk About PhentermineBuy Phentermine Online Without A RxTramadol WidrawlWhere To Buy Phentermine No PrescriptionOrder Phentermine Pay With MastercardPhentermine Buy Phentermine Phentermine Online DiscountDiet Pill Phentermine 37.5Tmj And TramadolDrug Interaction Ambien Lortab NaproxenTramadol Online To Florida With MastercardBoards Diet Googlepray Phentermine PillAdipex Bontril PhentermineCanine Dosage TramadolPhentermine Online SalesBuy Phentermine OverseasGeneric Levitra Wit McXanax With KlonopinCanada Viagra No PrescriptionPhentermine PrescriptionsPhentermine Hcl TabletsLevitra Low Price Pharmacy Zoloft Phentermine ViagraPurchase Evista Prescription On LineReal Phentermine Without Prescription Overnight ShipPhentermine DiscussionTramadol Pain KillerBontril Foradil Phentermine EvistaPhentermine Online Medical ConsultValium Online Description Chemistry Ingredients BlackboxXanax Doctor OnlineBuy Online Q Results Php ValiumFatigue Cause Of Effexor XlOnline Pharmacy DepakoteXpress Rx Tramadol 50mg By FedexInjecting Tramadol CapsulesWhen Will Generic Viagra Be AvailableTramadol Hcl 50 Mg Description MedicationTramadol UseTramadol Hci TabletsOffshore Pharmacy PhentermineBuying Phentermine Without A PrescriptionCheap Combivent OnlineAdipex Message Phentermine PostBuy Cheap Domain Online Order ValiumBuy Echeck PhentermineTricuspid Regurgitation And PhentermineHerbal Phentermine Faq SFioricet DirectionsPharmacy Fluconazole OnlineFree Viagra Shopping On InternetC O D Phentermine 37.5 OnlineBuy.jixx.de Linkdomain Online TramadolViagra And Blood Pressure PillsMexico Pharmacy PhenterminePhentermine DosesU S Pharmacy Phentermine Buy OnlineBuy Xanax Without PrescriptionMedications TramadolCheapest Phentermine Quicktopic Document ReviewGeneric Tramadol OnlineBuy Tramadol Online Free ShippingWellbutrin Vs Effexor XrOnline Pharmacy Prescription Drug ViagraIonaminOrder Phentermine From Pharmacy Free ConsultationOrder Phentermine In Usa Without ScriptDrug TramadolAdipex Site Adipex Meridia Phentermine XenicalOnline Pharmacy Prescription ViagraLowest Price For Phentermine Overnight DeliveryTramadol EfficasyOnline Ordering XanaxBest Buy Online Price Viagra ViagraFree Viagra No PrescriptionCheap Meridia With Money OrderTramadol No PrescriptionPhentermine ViagraPurchase Phentermine Without Prescription UsaPhentermine AffordableOnline And Viagra SoftTramadol Cod FloridaCheap Tramadol No PrescriptionHow Long Does Tramadol Withdrawal LastTramadol Vs Tramadol HclDescription Of Generic Drug XanaxOnline Pharmacy And Sildenafil Citrate 25mg