[jug.bg] jProfessionals 2.0

Today was the second edition of the jProfessionals format we started 5 months ago.

IMG_6574

jProfessionals is a one-day free conf. Smaller than jPrime (our star yearly event).

In the first version we invited Koshuke Kawaguchi. (the creator of Jenkins CI).

 

Today the first presenter was Richard Warburton.

IMG_6573

The session was about java 8 lambdas and even though it started as a very introductory session it turned out to be quite interesting. We discussed currying, Optional and the elvis operator.

What I learned is that Optional with value types is going to be fast (all in stack, no heap). Elvis is going in another direction - just a simple !=null check. Optional is kind of an explicit contract (preferred despite the verbosity and the extra object).

 

The second speaker was Vlado Tsanev aka tsachev.

IMG_6575

He talked about Spring REST Docs. The talk was one big live demo. REST Docs is a way to document a rest api automatically by extracting the info from the tests - it creates cURL commands, headers, params as so called snippets, and it allows the use of a adoc files with links to the REST Docs snippets.

 

After a tasty lunch it was time for "The Seven Deadly Sins of Microservices" by Daniel Bryant.

IMG_6576

It was a soft session with a lot of links and cool ideas of what microservices are good for and what they are not. There was a discussion on where people fail mostly using them. Very interesting and engaging - I bookmarked a lot of books that I'm never going to read.

 

Doychin Bondzev talked about Firebird (an alternative to postgres) - free, has triggers and is embeddable with nice tools and binary backup that is fast enough on windows.

 

Richard Warburton was next with another session for the future of Generics which was really fun.

IMG_6577

I finally understood why enums are defined recursively (Enum<E extends Enum<E>>).

 

Next was a talk about Jenkins Builds with Docker Containers by Petar Velikov from e-card.bg.

IMG_6578

It was quite interesting especially the docker part (he even used dockviz).

 

Finally there were two lightning talks. Martin Toshev talked about RxJava and RxJS.

Another guy - Teodor Tunev talked about Activiti - a java BPM platform far better than jBPM in his words.

IMG_6578

 

Finally some beer was due.

IMG_6580

(has not arrived yet)

Remote-controlled lego with LeJOS using EV3 controller

The last day of jCrete was with two hacking sessions - one on optimizing a NES emulator (if I got it correctly) and one on building a Lego and writing some software on LeJOS and EV3 controller (ARM processor inside).

This is what we did (@claudiotagliola did more than I have):

lego IMG_5263 IMG_5266

We used LeJOS, with LeJOS plugin for eclipse, initial code we got from Steven's presentation on the subject,  but we decided not to build the thing shown on the presentation.

We built a pretty bulky two-motor lego using snow-chains. We installed a server app that listened on a port and we sent it commands using a awt/swing app.

Videos:

Here's the code:

The app installed on the device:

package jcrete.hacking;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.ServerSocket;
import java.net.Socket;

import lejos.hardware.Button;
import lejos.hardware.Key;
import lejos.hardware.KeyListener;
import lejos.hardware.motor.EV3LargeRegulatedMotor;
import lejos.hardware.port.MotorPort;
import lejos.utility.Delay;

/**
 * This was written on jCrete 2015 on a LeJOS session by Steven Chin.
 * 
 * We were given the task to build a lego and do something cool with it.
 * We built a pretty large tank and remote-controlled it via wi-fi with
 * simple socket commands.
 * 
 * For more info, go to https://mihail.stoynov.com/?p=2909
 * 
 * This is a mock server for testing if you don't have a lego at hand.
 * 
 * @author Nayden Gochev, jug.bg
 * @author Mihail Stoynov, jug.bg
 *
 */
public class E3vRemoteControlCarApp {

	static boolean isRunning = true;

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

		try (
				final EV3LargeRegulatedMotor leftMottor = new EV3LargeRegulatedMotor(MotorPort.B);
				final EV3LargeRegulatedMotor rightMottor = new EV3LargeRegulatedMotor(MotorPort.C);
				ServerSocket serv = new ServerSocket(19231);
				) {

			Socket socket = serv.accept();
			BufferedReader reader = new BufferedReader(new InputStreamReader(
					socket.getInputStream()));

			// if we use the buttons on the device directly
			Button.UP.addKeyListener(new KeyListener() {

				@Override
				public void keyReleased(Key k) {
					leftMottor.stop(true);
					rightMottor.stop(true);
				}

				@Override
				public void keyPressed(Key k) {
					leftMottor.setSpeed(1500);
					leftMottor.setAcceleration(150);
					leftMottor.forward();
					rightMottor.setSpeed(1500);
					rightMottor.setAcceleration(150);
					rightMottor.forward();

				}
			});

			Button.DOWN.addKeyListener(new KeyListener() {

				@Override
				public void keyReleased(Key k) {
					leftMottor.stop(true);
					rightMottor.stop(true);
				}

				@Override
				public void keyPressed(Key k) {
					leftMottor.setSpeed(1500);
					leftMottor.setAcceleration(150);
					leftMottor.backward();
					rightMottor.setSpeed(1500);
					rightMottor.setAcceleration(150);
					rightMottor.backward();

				}
			});

			Button.RIGHT.addKeyListener(new KeyListener() {

				@Override
				public void keyReleased(Key k) {
					rightMottor.stop(true);
					leftMottor.stop(true);
				}

				@Override
				public void keyPressed(Key k) {
					rightMottor.setSpeed(1500);
					rightMottor.setAcceleration(150);
					rightMottor.forward();
					leftMottor.setSpeed(1500);
					leftMottor.setAcceleration(150);
					leftMottor.backward();
				}
			});

			Button.LEFT.addKeyListener(new KeyListener() {

				@Override
				public void keyReleased(Key k) {
					rightMottor.stop(true);
					leftMottor.stop(true);
				}

				@Override
				public void keyPressed(Key k) {
					rightMottor.setSpeed(1500);
					rightMottor.setAcceleration(150);
					rightMottor.backward();
					leftMottor.setSpeed(1500);
					leftMottor.setAcceleration(150);
					leftMottor.forward();
				}
			});

			Button.ESCAPE.addKeyListener(new KeyListener() {

				@Override
				public void keyReleased(Key k) {
				}

				@Override
				public void keyPressed(Key k) {
					E3vRemoteControlCarApp.isRunning = false;
				}
			});


			// we copied it from somewhere, not necessary
			Delay.msDelay(3000);


			// the listener with the while readline
			String line;
			while ((line = reader.readLine()) != "STOP" && isRunning) {
				System.out.println("RECIEVED " + line);
				switch (line) {
				case "UP-PRESS":
					leftMottor.setSpeed(1500);
					// leftMottor.setAcceleration(150);
					leftMottor.forward();
					rightMottor.setSpeed(1500);
					// rightMottor.setAcceleration(150);
					rightMottor.forward();
					break;
				case "UP-RELEASE":
					leftMottor.stop(true);
					rightMottor.stop(true);
					break;
				case "DOWN-PRESS":
					leftMottor.setSpeed(1500);
					// leftMottor.setAcceleration(150);
					leftMottor.backward();
					rightMottor.setSpeed(1500);
					// rightMottor.setAcceleration(150);
					rightMottor.backward();
					break;
				case "DOWN-RELEASE":
					leftMottor.stop(true);
					rightMottor.stop(true);
					break;
				case "LEFT-PRESS":
					rightMottor.setSpeed(1500);
					// rightMottor.setAcceleration(150);
					rightMottor.backward();
					leftMottor.setSpeed(1500);
					// leftMottor.setAcceleration(150);
					leftMottor.forward();
					break;
				case "LEFT-RELEASE":
					rightMottor.stop(true);
					leftMottor.stop(true);
					break;
				case "RIGHT-PRESS":
					rightMottor.setSpeed(1500);
					// rightMottor.setAcceleration(150);
					rightMottor.forward();
					leftMottor.setSpeed(1500);
					// leftMottor.setAcceleration(150);
					leftMottor.backward();
					break;
				case "RIGHT-RELEASE":
					rightMottor.stop(true);
					leftMottor.stop(true);
					break;
				case "STOP":
					E3vRemoteControlCarApp.isRunning = false;
					break;
				}
			}
		}
	}
}

 

The controller:

import java.awt.BorderLayout;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.net.Socket;
import java.net.UnknownHostException;
 
import javax.swing.JButton;
import javax.swing.JFrame;
 
/**
/**
 * This was written on jCrete 2015 on a LeJOS session by Steven Chin.
 * 
 * We were given the task to build a lego and do something cool with it.
 * We built a pretty large tank and remote-controlled it via wi-fi with
 * simple socket commands.
 * 
 * For more info, go to https://mihail.stoynov.com/?p=2909
 * 
 * This is a mock server for testing if you don't have a lego at hand.
 * 
 * @author Nayden Gochev, jug.bg
 * @author Mihail Stoynov, jug.bg
 *
 */
public class Remote extends JFrame {
 
	private static final long serialVersionUID = -8402983606638099877L;
 
	private final JButton left;
	private final JButton right;
	private final JButton up;
	private final JButton down;
	private final JButton stop;
 
	private BufferedWriter pw;
 
	public static void main(String[] args) {
		Remote remote = new Remote();
		remote.setSize(500, 500);
		remote.setVisible(true);
	}
 
	public Remote() {
		try {
			Socket socket = new Socket("192.168.0.107", 19231);
//			Socket socket = new Socket("127.0.0.1", 19231);//for mocking
			pw = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream()));
		} catch (UnknownHostException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
 
		setLayout(new BorderLayout());
 
 
 
		left = new JButton("LEFT");
		this.getContentPane().add(left, BorderLayout.WEST);
		left.addMouseListener(new MouseAdapter() {
 
			@Override
			public void mouseReleased(MouseEvent e) {
				leftRelease();
//				System.out.println("LEFT-RELEASE\n");pw.flush();
			}
 
 
			@Override
			public void mousePressed(MouseEvent e) {
				leftPress();
//				System.out.println("LEFT-PRESS\n");pw.flush();
			}
 
 
		});
		right = new JButton("RIGHT");
		this.getContentPane().add(right, BorderLayout.EAST);
		right.addMouseListener(new MouseAdapter() {
 
			@Override
			public void mouseReleased(MouseEvent e) {
				rightRelease();
//				System.out.println("RIGHT-RELEASE\n");pw.flush();
			}
 
 
 
			@Override
			public void mousePressed(MouseEvent e) {
				rightPress();
//				System.out.println("RIGHT-PRESS\n");pw.flush();
			}
 
 
		});
		up = new JButton("UP");
		this.getContentPane().add(up, BorderLayout.NORTH);
		up.addMouseListener(new MouseAdapter() {
 
			@Override
			public void mouseReleased(MouseEvent e) {
				upRelease();
//				System.out.println("UP-RELEASE\n");pw.flush();
			}
 
 
 
			@Override
			public void mousePressed(MouseEvent e) {
				upPress();
//				System.out.println("UP-PRESS\n");pw.flush();
			}
 
 
		});
		down = new JButton("DOWN");
		this.getContentPane().add(down, BorderLayout.SOUTH);
		down.addMouseListener(new MouseAdapter() {
 
			@Override
			public void mouseReleased(MouseEvent e) {
				downRelease();
//				System.out.println("DOWN-RELEASE\n");
			}
 
 
 
			@Override
			public void mousePressed(MouseEvent e) {
				downPress();
//				System.out.println("DOWN-PRESS\n");
			}
 
 
		});
		stop = new JButton("STOP\n");
		this.getContentPane().add(stop, BorderLayout.CENTER);
		stop.addMouseListener(new MouseAdapter() {
 
			@Override
			public void mousePressed(MouseEvent e) {
				sendCommand("STOP");
			}
		});
 
		//keypad arrows work only if the focus is on the stop button
		//lame but that's life
		stop.addKeyListener(new KeyListener() {
			@Override
			public void keyTyped(KeyEvent event) {
				// TODO Auto-generated method stub
 
			}
 
			@Override
			public void keyReleased(KeyEvent event) {
				if(KeyEvent.VK_UP == event.getKeyCode()){
					upRelease();
				} else if(KeyEvent.VK_DOWN == event.getKeyCode()){
					downRelease();
				} else if(KeyEvent.VK_LEFT == event.getKeyCode()){
					leftRelease();
				} else if(KeyEvent.VK_RIGHT == event.getKeyCode()){
					rightRelease();
				}
			}
 
			@Override
			public void keyPressed(KeyEvent event) {
				if(KeyEvent.VK_UP == event.getKeyCode()){
					upPress();
				} else if(KeyEvent.VK_DOWN == event.getKeyCode()){
					downPress();
				} else if(KeyEvent.VK_LEFT == event.getKeyCode()){
					leftPress();
				} else if(KeyEvent.VK_RIGHT == event.getKeyCode()){
					rightPress();
				}
			}
		});
 
 
		pack();
	}
 
	private void downPress() {
		sendCommand("DOWN-PRESS");
	}
 
	private void sendCommand(String command) {
		try {
			pw.write(command+"\n");pw.flush();
		} catch (IOException e1) {
			e1.printStackTrace();
		}
	}
 
	private void downRelease() {
		sendCommand("DOWN-RELEASE");
	}
 
	private void leftPress() {
		sendCommand("LEFT-PRESS");
	}
 
	private void upRelease() {
		sendCommand("UP-RELEASE");
	}
 
	private void leftRelease() {
		sendCommand("LEFT-RELEASE");
	}
	private void rightRelease() {
		sendCommand("RIGHT-RELEASE");
	}
 
	private void upPress() {
		sendCommand("UP-PRESS");
	}
 
	private void rightPress() {
		sendCommand("RIGHT-PRESS");
	}
}

 

Mock app to test the remote:

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * This was written on jCrete 2015 on a LeJOS session by Steven Chin.
 * 
 * We were given the task to build a lego and do something cool with it.
 * We built a pretty large tank and remote-controlled it via wi-fi with
 * simple socket commands.
 * 
 * For more info, go to https://mihail.stoynov.com/?p=2909
 * 
 * This is a mock server for testing if you don't have a lego at hand.
 * 
 * @author Nayden Gochev, jug.bg
 * @author Mihail Stoynov, jug.bg
 *
 */
public class ServerMock {
	public static void main(String[] args) throws IOException {
		try (ServerSocket server = new ServerSocket(19231);) {
			Socket socket = server.accept();
			System.out.println("ACCEPTING");
			BufferedReader reader = new BufferedReader(
					new InputStreamReader(
							socket.getInputStream()));
	
			System.out.println(reader.readLine());
			String line;
			while ((line = reader.readLine()) != null) {
				System.out.println("RECIEVED " + line);
			}
		}
	}
}

jCrete

jCrete is an unconference organized by Heinz Kabutz (author of the Java Specialist newsletter).

*unconference - top people, informal talks, discussions instead of sessions (most in a restaurant or at the beach).

What I learned:

Unsafe is going to be available in jdk9 with a jre switch on startup. Oracle is working on isolating (boundary checks) the unmanaged heap so that

  • mistakes will not mess up the managed heap
  • mistakes will not cause a segmentation fault (crash the whole jvm, because someone is trying to read memory from another process)

Oracle might introduce a commercial GC with deterministic stop-the-world pauses.

G1 will become the default GC in jdk9.

I will update this accordingly with more info.

jprime: Why would someone organize a conference?

Every morning I wake up to this: Screen Shot 2015-05-20 at 23.09.29and this: Screen Shot 2015-05-20 at 22.21.30. Every day I wage a fruitless war to go down to zero on both fronts and I fail miserably. But I'm getting better.

Recently we managed to "inject" a company as a gold sponsor after all the deadlines have passed. We did it in 20 minutes after 6 phone calls.

The server firewall failed. Someone fixed it on a Saturday morning.

Our invoicing architecture after so many patches fails to follow all the complex branches of the process of issuing an invoice. We somehow manage to still use it fruitfully. And I have big plans for rewriting most of it.

ePay integration was a pain it the ass. Very bad documentation, different undocumented services, support could be better. But it was fun encrypting and decrypting a ton of messages until we stabilized it. We even "support" credit cards (in a way).

Our Turkish speaker delayed his visa application. I called the Bulgarian embassy in Ankara. They were nice, didn't forget to call me back. Actually they kept me updated the whole time. And they issued the visa in less than a day. So kudos to them.

We fight less, work more, plan better, became team players and learned a lot. Organizing a conference is fun.

Go buy a ticket at jprime.io.

An amateur's guide to organizing a conference

I remember when 8 months ago Ivan came up with the idea to organize a conference, we were all - why the hell not. How hard can it be? I want to go back in time and give my cocky past self a slap in the face. A very hard slap.

We had already done many hackatons, pushed a couple of openjdk patches (which are as of now still not accepted) and drank many beers planning the bright future.

I remember feeling a bit in a rut. And this was a really good excuse to write some java code, meet new java people and work with some new java technologies.

I remember when we just talked about the conference for four months. It all got very real 4 months ago and we had a choice - organize the whole thing in 4 months (which then I had no idea was a really short time for a conference) or give up for next year.

We were very eager back then. We all decided to do it. I remember some of our organizers looking at us, probably thinking "let's sit and watch go down in flames".

4 months later I know a lot about accounting and VAT. I wrote a lot of code, most of the times after midnight. The funniest story is when we were deploying the electornic ticket system (epay integration) - proudly written mostly by me (but I'm ashamed of the code).

4 months later I can sign a contract in a couple of hours. A procedure previously taking me almost a week. I have optimized so many of the bureaucracy procedures I do. As a business owner I had the same issues, but after we started the conference I couldn't keep up and had to optimize again and again. Here's the place to send a special thank you for our lawyer and accountant - two of the people I would fail without.

4 months later I sleep less, and I do more. I hope the sleeping part will fix itself after the 27th. I now can read 30 emails in an hour (unfortunately after another hour I have 30 more). Half of my inbox has "Ivan" in the sender's field - he has the nasty habit of putting every little detail in an email, requires the same from me, and is pissed off if I fail to read something 2 hours after he sent it.

One of the funniest stories from the past week is me sitting in an office, signing a contract. The contract has to be signed, and I have to pay that contract in 10 minutes. So I'm sitting on my laptop sending the money, the other side sitting on theirs checking if the money is going to arrive. And at some point it feels as a movie scene where the good guy is going to appear any minute and break the drug deal.

So organizing a conference is tough, but it's a lot of fun. Next time (yes, if I have the opportunity, I'd do it again) it's going to be even better. My conference cherry is about to be popped in 27 days. Hope to see you there.

--Mihail S (and, yes, I know it says "by Admin", but we have more important things to fix first)

[jug.bg] hackaton to fix warnings in openjdk

Today, 17.02.2015, the Bulgarian Java User Group (BGJUG) organized another hackaton. This time we wanted to fix warnings inside the jdk.

Screen Shot 2015-02-17 at 8.33.57 PM

First we did

make clean JAVAC_WARNINGS="-Xlint:all,deprecation,rawtypes,\
unchecked,cast,serial,dep-ann,static,fallthrough,try,varargs,\
empty,finally -Xmaxwarns 10000" DISABLE_WARNINGS="-Xlint:all"\
 LOG=info images

to generate a build.log to find out all the warnings. Then with any text editor one could open jdk9/build/linux-x86_64-normal-server-release/build.log and use these searches (using regular expressions) to find all the warnings:

openjdk/jdk9/corba(.)* warning
openjdk/jdk9/jaxp(.)* warning
openjdk/jdk9/jaxws(.)* warning
openjdk/jdk9/nashorn(.)* warning
(Substitute with your username)
The result was:
359 corba
100 jaxp
500 jaxws
0 nashorn
Initially Mitya proposed nashorn, but all of them were already fixed. Then Ivan and Nayden settled on jaxp. Because we all dislike corba.
Joe Darcy has a blog post on different warning types and how to fix them. We split the warnings into different types:
rawtypes 43
unchecked 14
serial 32
cast 10
dep-ann 1

Note: Dep-ann is to add the @Deprecated annotation.

We fixed the last three types and created a patch: http://bgjug.sty.bz/bgjug/~bgjug/fix-warnings-jaxp-part1/webrev.00/, because the unchecked and the rawtypes are a bit tricky as they involve changing public APIs.

We then tried to solve as much of the latter as possible and then created a second patch: http://bgjug.sty.bz/bgjug/~bgjug/fix-warnings-jaxp-full/webrev.00/

 

OSX: hide an app from the Command+Tab

Open the config file for the app

Last login: Tue Nov 25 21:29:02 on ttys001
ff:~ steve$ sudo nano /Applications/iTerm.app/Contents/Info.plist

Add the selected text:
Screen Shot 2014-11-25 at 9.29.59 PM

Text to add:

        <!-- mihail.stoynov: the following is to hide the iTerm.app from the finder -->
        <key>NSUIElement</key>
        <string>1</string>

Then

Last login: Tue Nov 25 21:29:02 on ttys001
ff:~ steve$ killall iTerm

Yosemite: Finder to show folders before other files

sudo cp /System/library/CoreServices/Finder.app/Contents/Resources/English.lproj/InfoPlist.strings /System/library/CoreServices/Finder.app/Contents/Resources/English.lproj/InfoPlist.strings.bak
#convert from binary to xml format
sudo plutil -convert xml1 /System/library/CoreServices/Finder.app/Contents/Resources/English.lproj/InfoPlist.strings
sudo nano /System/library/CoreServices/Finder.app/Contents/Resources/English.lproj/InfoPlist.strings
# add a space so it looks like: <value> Folder</value>, check the screenshot
sudo plutil -convert binary1 /System/library/CoreServices/Finder.app/Contents/Resources/English.lproj/InfoPlist.strings
sudo killall Finder

2014-11-13_2230

FBI is on their way to your house (a south-african scheme to steal money)

I am selling my old motorcycle and it is listed on an online auctioning site. Following is my communication with a south-african guy trying to steal some money from me. I continued the communication with him as far as possible, because I was interested how these things go. My info is anonymised, his info is not, so that google may cache his name name and contact info. The fun part is in bold.

--- I receive a text from +1 (717) 826 0150:
Is ur bike for sales?if yes get back to me via email (dan.rowey147@hotmail.com)

--- I reply to the email:
Hey,
My bike is for sale. You sent me a text. Wanna buy it?

--- him:
Hello
I am really interested in the immediate purchase of your merchandise and i will like to know how long have you owned it??  what's your best price for it and when last was it serviced?
Dan

--- me:
Now what?

--- him:
Thank you for getting back to me. Can you assure me that it's in good state and that i will not be disappointed with it.I'm ready to pay your asking price and to be honest, i wanted to buy this for my Son, but the issue is i am an oceanographer and i do have a contract to go for which starts tomorrow and am leaving any moment from now.The contract is strictly no call due to the lack of reception on the sea area. But I'm able to access email anytime as we will make use of laptop so my only quickest payment option is PayPal as i can send money via PayPal anytime.Since I'm requesting this transaction to be done via PayPal, i will be responsible for all the paypal charges on this transaction and if you don't have an account with paypal, its pretty easy, safe and secured to open one. Just log on to http://www.paypal.com. I hope we can make the purchase as fast as possible? I have a mover that will come for it once payment clears and they will take care of very necessary paper for me. So i look forward to hear from you soon. will like to see more pics.
I need the address where the agent will meet you and your PayPal Full name and email address so i can send the money now.
Dan

--- me: (newly created paypal account)
paypal account: xxxxxxxxx@gmail.com

--- him:
Hi,
i have just completed the payment via PayPal. A total of €1,650.00 EUR was sent,€1,100.00 EUR for the bike and the extra €500.00 EUR for the shipping charges and €50.00 EUR for the western union charges am sure you notice that,which you will be sending the €500.00 EUR to the address below via western union.I will advice you to check your inbox or spam mail of junk am sure you will find the Paypal confirmation email in one of those box.

Name : D A V I D - O L A G U N J U
Address: 65 Celliers street,
City: Pretoria
Post Code: 0002
Country: South Africa.

The shipper would be coming around to your area to have the bike picked up once you have sent the shipping charges fee to them,as i need you to send me your home address for the pickup and let me know what time you want them to come for the pick up.

I will be waiting to hear from you once the money has been sent to the shipper.
Thanks.
Dan

--- him again:
i receive a message from paypal stating that a legal action will be take against you since you refuse play your role in the transaction going on between me and you and now i don't even know what to do because am confuse.So please lets try and sort this out try as much as possible to the money and settle the shipper because i wont like paypal taking a brutal action against you... Wish to read from you soon.
Regards...

--- me:
Oh my god. What should i do to stop that? I have a lot of money in paypal and i don't want it blocked.

--- him:
Hi, it's up to you as well to act fast as I'd already made the full payment through PayPal. There is nothing I could do from my side to influence PayPal rules. It's better you act according to PayPal request or I mail PayPal to suspend the transaction.I look forward to hear from you soon...

--- me:
I already sent you the money. I am at work now and the receipt is at home. tomorrow I am going to scan it, because I don't have a scanner at home.

Please don't suspend the transaction.

--- him:
You can send the following details to me so that i can forward it to PayPal management..

(1) Sender's Name;
(2) Receiver's Name;
(3) MTCN (Money Transfer Control Number);
(4) Amount Sent;

Get back to me asap..

--- him:
Stephen De-Guerre
David-Olangudju
9871282084
1650 EURO

You are ask to send the scan receipt to me,so that we can confirm the transaction.

--- me:
I can do that tomorrow evening.

--- him:
Send it now...........Cause FBI is on their way to your house.

--- me:
I DONT HAVE A SCANNER HERE. I AM AT WORK. ARE YOU CRAZY? I AM GOING TO GET FIRED. STOP THEM PLEASE

--- him:
Send it when you get home...

--- me:
PROMISE ME YOU WILL STOP THE FBI. I don't have a scanner at home. I can scan it at work only. Only if the scanner is free and nobody is in the office. I will wait after everyone leaves. So 5pm tomorrow

--- him:
I will ask PayPal management to stop the FBI....So get back to me with the scan receipt by 5pm tomorrow..

--- me:
Thank you, thank you, thank you, thank you. Why are you being so mean?

--- He stopped the communication ---

Gallery3 patch

There's this php photo album - Gallery3. I needed it to share images but the outlook had to be different:

  • the title of the pics is HH:MM
  • Separator between pictures from different days.
  • Ordered by exif.date-picture-taken
  • Upload from a phone (only current option is via ftp and then load the pics to the album via a module).
  • Special simple comments section.

This is the patch - it's ugly and inconsistent, but it works for me. My php is not that awesome 🙂

gallery3.diet.install

gallery3.diet.ver3.patch

(in gallery3 with modules)# patch -p1 < gallery3.diet.ver3.patch

How to run ScanTool on Linux

ScanTool is an OBD data reader. Here's how you can run it on linux:

#!/bin/bash
#!/bin/bash
 
wget http://archive.ubuntu.com/ubuntu/pool/universe/s/scantool/scantool_1.21+dfsg.orig.tar.bz2
tar xjf scantool_1.21+dfsg.orig.tar.bz2
cd scantool-1.21
wget http://archive.ubuntu.com/ubuntu/pool/universe/s/scantool/scantool_1.21+dfsg.orig-dzcomm.tar.bz2
tar xjf scantool_1.21+dfsg.orig-dzcomm.tar.bz2
mv dzcomm-0.9.9i/ dzcomm
wget http://patch-tracker.debian.org/patch/series/dl/scantool/1.21+dfsg-3/dzcomm-usb-serial.patch
wget http://patch-tracker.debian.org/patch/series/dl/scantool/1.21+dfsg-3/scantool-linux-build.patch
wget http://patch-tracker.debian.org/patch/series/dl/scantool/1.21+dfsg-3/logging-newlines.patch
wget http://patch-tracker.debian.org/patch/series/dl/scantool/1.21+dfsg-3/drop-listports.patch
wget http://patch-tracker.debian.org/patch/series/dl/scantool/1.21+dfsg-3/allow-elm327-clones.patch
wget http://patch-tracker.debian.org/patch/series/dl/scantool/1.21+dfsg-3/drop-report-request.patch
wget http://patch-tracker.debian.org/patch/series/dl/scantool/1.21+dfsg-3/build-flags.patch
sed s_/usr/share/scantool/__ -i scantool-linux-build.patch
patch -p1 -i dzcomm-usb-serial.patch
patch -p1 -i scantool-linux-build.patch
patch -p1 -i logging-newlines.patch
patch -p1 -i drop-listports.patch
patch -p1 -i allow-elm327-clones.patch
patch -p1 -i drop-report-request.patch
patch -p1 -i build-flags.patch
cd dzcomm && sh ./fixunix.sh && ./configure && make depend && make lib; cd ..
make CFLAGS="-Idzcomm/include -DDZCOMM_DJGPP=1" LDFLAGS="-Ldzcomm/lib/unix"
cd ..
cp scantool-1.21/scantool .
cp scantool-1.21/scantool.dat .
cp scantool-1.21/codes.dat .
rm -rf scantool-1.21
rm scantool_1.21+dfsg.orig.tar.bz2

Courtesy goes to PePe.

Force Integrated graphics on VMware Fusion (and probably other apps) on OS X 10.8 Mountain lion (avoid discrete graphics)

With OS X 10.8 gfxCardStatus is no longer capable of enforcing Integrated Graphics card only.

When one uses VMWare Fusion, the discrete graphics card is enforced, which drains the battery too fast.

I have not found any solution online to fix this. But I managed (thanks to PePe) to discover one.

How to use Integrated Graphics Card with VMware Fusion on OS X 10.8:

  • Install gfxCardStatus
  • Before launching VMware Fusion, click on Integrated only (click it several times until it has the checkbox on the Integrated only):

Screen Shot 2013-02-15 at 2.05.32 PM

  • Then launch VMWare Fusion, start whatever virtual machine. And don't do anything inside. Leave it idle.
  • There's a BackTrack 5 R3 with the integrated graphics card:

Screen Shot 2013-02-15 at 2.08.15 PM

  • There's a BackTrack 5 R3 VM and a Windows XP (both idle) with the integrated graphics card:

Screen Shot 2013-02-15 at 2.12.34 PM

  • I'm using iStatMenus to check my power consumption. Here's my power consumption with the two VMs:

Screen Shot 2013-02-15 at 2.07.10 PM

  • Cody Krieger (the creator of gfxGraphicsStatus) says that even if it says that the Integrated is being used, the Discrete (NVidia) is still being powered on, which invalidates the whole exercise.
  • How do I know that I'm saving power? Well, let's go to Discrete and check the power consumption:

Screen Shot 2013-02-15 at 2.16.56 PM -> discrete

  • Now, let's check what the consumption is (the same two idle VMs):

 Screen Shot 2013-02-15 at 2.20.26 PM

 

  • So instead of having 3:27 hours left, I now have 1:22 hours left. My consumption 2.5 Amp, instead of 1.1 Amp.
  • I can't directly go back though:

Screen Shot 2013-02-15 at 2.27.07 PM

  • What I have to do is to stop VMware completely (Cmd + Q), go to Integrated only again and restart all the VMs
  • This is something that I discovered today. So it may not be working as expected, but for now it seems it is.
  • My setup:
    • OS X 10.8.2 on a Macbook Pro 8.2 (A1286, Quad Core i7 2.3 Ghz, 16gb RAM, 256gb OCZ Vertex 3, AMD Radeon HD 6750M 1GB)
    •  VMware Fusion 5.0.1 with 2 VMs - Windows XP Pro and Backtrack 5 R3 (both were idle during this setup).

 

Mirroring options in OS X mountain lion.

Note to me:
They took away my displays menu, but I got it back.
http://displaymenu.milchimgemuesefach.de

Keywords: mirroring displays, os x, mountain lion, display settings, external monitor....

option-brightness: Display Preference Pane
command-decrease-brightness: Change display mode (only on revised fn keyboard layout on Alu. keyboards, newer MBP/MBs?

https://discussions.apple.com/thread/4156736?start=0&tstart=0

OS X Mountain Lion

I installed the "new" OS X - Mountain Lion - 10.8. This is the more un-hyped version of the operating system. The only usable features I found were Notes and Notifications sync with my iPhone, so far they work good enough.

Speech recognition integration is good. Recognition actually happens on an apple server which sucks especially with no internet connection.

Unsigned pkg files are harder to to install. An option has to be changed.

icloud.com is very neat - Mail, Contacts, Calendar, Find My iPhone, iWork.

People say there are battery issues. I haven't tested.

 

Хриси

Хриси има два партишъна: един logical, на който е инсталирана операционната система, след него има един primary партишън с данни.

MBR сочи към втория, затова там са ntldr, ntdetect.com и boot.ini, сега ще ги сложа тук. (hrisi_boot)

Вероятно й е свършило дисковото пространство и е замазала файловете и затова не е буутвало (NTLDR is missing грешка).

Сега системния драйв е почистен от инсталатори и има достатъчно празно пространство.

Ако сега нещо се скапе, отивам на ntldrismissing.com, правя си буутъбъл флашка и качвам новите файлове.

 

Anonymous SMB sharing from OS X Lion (10.7)

Sharing a folder via SMB (the so called Windows Sharing) with OS X is easy. But username and password were always required. I wanted to make an anonymous share and didn't know how.

Sharing is done like this:

One can see the Everyone user added and still a password was required to log in. Accidentally I found the fix for that.

I had to enable the guest user for file sharing:

That's it. Problem solved.

NOTE: The guest user is disabled by default in OS X Lion. You'll have to enable it first.

Local torrent server on OS X

Today I had to share 13 GB with ~10 people, and I had to do it quickly. I thought of many options - ftp (it would take a while), usb flash drive - even worse.

I thought of the P2P capabilities of the torrent technology. How hard can it be?

Starting a local server couldn't have been easier. I used Tomato Torrent:

There aren't many options, the defaults are good enough. To share the torrents initially I used Transmission. uTorrent for some reason refused to share the files or it was too slow, I don't know.

Transmission:

The torrent server even has a very basic web interface that doesn't tell much, but it is helpful:

13 Gb transmitted to  ~10 people in a 100mbit LAN network in less than an hour. And my machine didn't take that much of a performance hit. I worked during that time.

NOTE: creating the torrents as private somehow made sharing faster. I don't know why. But it did.

Review: Miro

Miro is an application I first heard for at thepiratebay.org. It's a torrent client, a video player and a desktop portal solution for all media. It's free and integrates well with the pirate bay's torrent tracker. Unfortunately it doesn't integrate with local torrent trackers for some reason. Anyway it's very good for following youtube channels and watching cnet shows and most of all watching TED presentations.

It has versions for both Mac and Windows, though I have only tried the Mac OS version, both look and behave the same. The GUI rocks, the player is light and runs nice.

The best thing is it downloads the youtube clips or ted presentations in HD and stores them locally. It's full of browsable free content.

One note: youtube channels have to be added with the URL in this format: http://gdata.youtube.com/feeds/api/users/hdstarcraft/uploads?alt=rss with hdstarcraft being the user name. Otherwise it complains for some reason.

Verdict: highly recommended.

Update (24.08.2011): Version 4.x (especially for Mac) is bloated with pointless features. It's not that fast and slim. It runs slowly. It crashes. And the most stupid thing I've seen - right/left arrow now goes to the next/previous feature respectively. To forward/rewind with 30 secs the Shift+right/left arrow must be used. So stupid. Cannot be configured.

Google Maps for Symbian vs. Garmin XT

When one goes to an entirely unknown place one tends to take stuff that gives him some security and might help in case of emergency. That’s why I loaded my GPS with offline map of the US using the Garmin XT software.

The GPS device is a Nokia E71 mobile phone (there are some other articles in the blog about it I think, but can’t link to them – I’m in offline mode). It has a 1500 miliamperhour-battery, which is the most I’ve ever seen on a phone and a pretty small screen, so lot’s of time being online.

I had to buy a data plan (I chose T-Mobile, $77 sim with unlimited data) so naturally I decided to try Google Maps for Symbian S60. First of all it’s free as opposed to Garmin XT (even the software is not free, not to mention the maps).

Navigation

Google Maps has an outstanding navigation (by navigation I mean going up/down/left/right and zooming in/out), it’s always fast no matter if the map is loaded or not (shrinks/enlarges the image it has, then replaces that with the newly downloaded one). Garmin’s navigation is plain stupid – the cursor accelerates as one presses up/down/left/right, so one would never know where the cursor would end up.

Searching

Searching in Garmin is like this: Where to go? –> Address/City/POI –> Choose Country –> Choose City –> Choose number –> Choose street. And this takes a while. And it doesn’t always return a result or at least not what one would expect. Google Maps would give you a result if you type “Grand Central, NY”. With Garmin XT if it works it would be hard and time-consuming to do.

Speed

Garmin wasn’t very fast with a 20 mb map of Bulgaria. But it’s definitely slow with a 1.2 gb map of the US, even on “very low detail” setting. Google Maps is always responsive no matter how much it takes for it to load.

Routing

Currently I use trains or metro or just walk. Routing with with Google Maps is fast – three tabs (Public transport, Car, Walk) and then I have to give only start and end locations – that’s it. It gives me amazingly correct results. In Garmin one has to go to the settings and change the Routing to Pedestrian/Car. I don’t even think it has the public transport option.

No GPS option

Google Maps can work without a GPS – it uses the network cells and wi-fi routers to know where it stands. It’s not very accurate but it doesn’t drain the battery with the GPS. It’s very easy to start the GPS – a few clicks away.

The Nokia E71’s GPS is always very quick to find it’s location. I’m guessing the phone starts the GPS for short period once and a while to keep it’s internal clock synchronized. So this option of Google Maps is extremely useful.

Start time

Google Maps is faster and it doesn’t have the annoying warning in the beginning that one has to click on to continue using the Garmin XT.

Satellite view

Very useful in Google Maps. I think Garmin has something similar, but can’t remember how was it.

Maps

Google Maps works so good only in the States. The last time I tested it in Sofia the map was pretty low detail. And Google Maps obviously needs a data connection. The traffic is not that much though, the data flowing is pretty size-optimized it would seem.

Overall

Google Maps is fast, user-friendly and easy to use, but needs internet. It can do more in less time, but sometimes it’s maps are not as good as Garmin ones. Garmin XT is pretty unusable and slow but can work offline and the maps most of the times are the best one can find.

Garmin is a nice-to-have second option in case Google Maps fails somewhere or there’s no network coverage.

European Parliament and local government elections

This is stealing. They are denying a taxpayer to post his vote (no voting section will be raised in NYC):

http://www.webhousing.biz/~bulgaria/news.php?id=148
(Bulgarian Embassy in the USA on the EP elections on 7th of June)

For such a voting section to exist for the local Bulgaria government, 100 voters have to register “either personally, via FAX or via a scanned document saying they want to vote”. So now I have to find a scanner.

The vote is on 5th of July.

http://www.webhousing.biz/~bulgaria/news.php?id=149

Idiots.

How to start matrixtunnel

Matrixtunnel is a small http wrapper that adds ssl on top of plain http. Small memory footprint.

Here’s how to start it:

user:~# matrixtunnel -A /etc/ssl/domain.com.cer -p /etc/ssl/domain.com.key -r 80 -d 444

Print help screen:

user:~# matrixtunnel -h
usage: [-c] [-v] [-d localip:port] [-r remoteip:port]

    -A      Certificate Authority file
    -p      private key and certificate chain PEM file name
    -c      client mode. remote is ssl, local plain
    -v      validate certificate
    -d      listen locally on this [host:]port
    -r      connect to remote machine on [host:]port
    -P      pidfile
    -f      foreground mode
    -D      syslog level (0...7)

If one wants to test, one can use –f (start on the console, not as a daemon).

Note: don’t use –v, sometimes it fails. I don’t know why.

Usability of the blog

Watching the blog stat one can't help but notice the decreasing amount of articles (I guess my single reader and I are the ones that should notice). Maybe it's because a lack of time. Maybe it's because of too much work,study or travel (I'm currently in Turkey on vacation).

Lately one new reason is emerging in my head (yes, it takes them (the thought) some time to mature :). Maybe I'm not writing that much because of the usability of the blog. The usability from the readers' point of view is bad (here for example,), but it's hard to fix it and I'm too lazy to do it. But now I'd like to talk about usability from my perspective (as the author).

I'm running the blog (hosted on dasBlog) at my own server with a very cheap internet connection so it's a bit slow. dasBlog doesn't do any kind of image help (not to mention anything more complex) - I have to do my own thumbnails (I so very much hate that). dasBlog's rich text editor does not support my phone's browser or Safari.

So at the end even if i think of a good story it takes a lot of time to represent it in the blog. Especially if it's very visual, or even only a bit visual.

So I have to think of other ways to improve my experience. And I just thought of one. I'll write when I do it.

Gmail's new attach file button

Gmail recently changed the "Attach..." button with a flash one. Today I found out why. Now one can attach multiple documents with one click. It's awesome.

Update: due to some comments here are some screenshots:

On a mac (firefox) it's working:

On Windows (firefox) there was no flash button. (I've seen Gmail and other google applications change the look&feel on different browsers and different google users. Maybe that's the reason.)

The screenshot:

Guitar tuner - how to tune up a guitar for dummies

I can't distinguish notes. This makes it hard for me to tune up my guitar.

There are tuners that just play a certain tone and one should be able to tune up based on the tone heard. I can't do it like that.

That's why I searched for a tuner that could "hear" my guitar.

Guess what - I found it. It's called AP Tuner 3:

It's amazing. It just works. No configuration, no nothing.
This is how software should be written.

What's new

I haven't written in over a month.

During this time I busted my ass off (worked a lot).

Somewhere around my last post I managed to stop the coffee, which for me is like a dream-come-true. One would ask - so what, it's not that hard? For me it was. I started drinking coffee in 10th grade. Around my first year in the university I started drinking a lot - my personal best is 8 cups per day. Since then it got stable around 6 cups/day.
From that time off I have made two attempts to stop it. They both failed. The first one managed to drop the dose to around 3 cups. The second attempt managed to drop to 1-2 cups per day. During the "dry period" I wasn't the same guy - I slept a lot, I couldn't stay focused - it was difficult.
The third attempt I did was different - it was easy. I guess the first two did the job. This time I just sealed the deal.
One would also ask - is coffee that bad? I don't know really. For me it was because I drank a lot and couldn't control it.

I stopped my facebook account - for me the cons are more than the pros.

Young people, voting and Michael Moore

Michael Moore's new movie's gonna be out in a week. It's about his going to colleges and making young people vote 4 years ago. It's gonna be free for download.

In my own country young people don't vote, they don't care about politics. It's a kind of silent protest, they say.

To my fellow country men (The aforementioned young ones):
So somebody is f*cking you in the *** and all you do is silently protest?! What kind of behaviour is that?!

Take a little responsibility, you're going to live in this country for quite a while, not the elderly people (who vote).

Currently we're being governed by coalition of ex-communists and an ethnic party and we're the laughing stock of the EU.

You put under the same denominator the last two right and the last two left governments.

Please, shut up, read a little more and go and vote the next time. There aren't any good candidates, you say? CHOOSE THE LESSER EVIL. I'll bet that you won't vote for that ethnic party, right? We all dislike this guy, right?

Vote for the single reason of getting him out of the parliament, he has done enough harm.

Just vote, please.

Chrome's EULA and Spying

Galcho
commented out in a previous post of mine that Google Chrome's EULA said something like
whatever I do with Chrome is property of Google. They of course revoked that and said it was a mistake. If it wasn't I would, obviously, have stopped using it.

Later on I read on the history of the browser and how A browser is very important to Google.
This brings me to another topic. How much info does any corp have about me? Google has a lot - mail, calendar, reader, search.....(there are claims that Google is misusing cookies so they can track anyone - gmail cookie used in search). I don't like the idea that a single entity has so much info about me. As much as I don't like my Government spying on me via the ISPs (an ongoing issue here). I don't trust my Government and I don't trust Google. But until now there's not much I can do. Google's services are really good and free. Maybe if I have some free time, I'll spend it on finding ways to make collection my private info a lot harder, especially for Google. I'll share the experience, of course.

Google Chrome, part II, processes

Here's how browser looks process wise:

They really do have multiple processes as they promised.

Update: Chrome just can't play cacao.fm

Update2: Firefox's new super-duper-nice search in history feature...

...is not in Chrome, too bad, it's a great feature.

Actually I don't see history in Chrome. I don't use it too often, but it's nice to have it.

Ctrl+Shift+T is working in Chrome, great

Google Chrome

The new browser from Google - Google Chrome - is out.

First impressions: the html editor in the blog is NOT working, no idea why. I have to write html, it's really annoying.
It's fast. I don't see anything that's that much different from firefox.
The plug-ins are missing, I miss them.

Update: It's really fast, but so was firefox before all the pages and plug-ins.
Drag and drop works really nice:



Writing html really sucks.

Update2: It has something like the Firebug plug-in:



It has a javascript debugger, or at least it says so - I couldn't see what it can do.
The interface is really minimalistic, Google Talk style, I enjoy it. I could browse through all the options in a single minute.
It has the firefox shortcuts, downloads (Ctrl+J).

Update3: In maximized mode it uses even the title bar for the tabs. Cool. The tab text is too short to show the full title bar 🙁
I REALLY HATE WRITING HTML, I'm going to post to the blog with firefox :((((((((((((
This thing is really fast.

Update4: The dream is over - it crashed (while opening an online radio):

Still, it's a great piece of software, especially the interface.

Copyright policy: no rights reserved

I've just changed my copyright policy to: no rights reserved.
Not that I have something useful here.

I
find it really annoying that every body has some rights reserved on the
things they produce - from coca-cola to a newborn blogger. This is my
humble protest on the subject.

It's always better to ask than to enforce, so "if you mention my name, thank you".

@CollectionOfElements, JPA, the documentation and the problems it raises

In a project that I mention a lot there's an persistent model using JPA as an interface to Hibernate.

There was case where I wanted to put extra columns in a @ManyToMany relationship. JPA cannot do that.

So I had to use the Hibernate's @CollectionOfElements.
It works like that: if there are the objects Class and Student, the extra columns go to the wrapper class EnhancedStudent. The EnhancedStudent has a property of type Student.

Now I have a few bugs related to it:

  1. Causes the @Version of the containing object (Class) to increment on EntityManager.html#find(java.lang.Class, java.lang.Object)
  2. The creation of an ExtraStudent cannot propagate (cascade) the inner Student - no matter what.

The funniest thing is that the documentation of the @CollectionOfElements is a single line:


Annotation used to mark a collection as a collection of elements or a collection of embedded objects

http://www.hibernate.org/hib_docs/annotations/api/org/hibernate/annotations/CollectionOfElements.html

🙁