Archive for June, 2013

Why we hate bikes in traffic ?

June 20, 2013

I recently saw an article about some bicyclist involved in an accident from which he was the one considered guilty by the police. In that article it wasn’t discussed if the bicyclist was guilty or not, but the bad ‘image’ that this might do to the ‘bike community’ who is struggling so much to obtain some rights from the city hall. This brought to my mind the struggle of the Gay ‘community’ who are struggling to obtain some rights, which is pretty sad.

The problem is deeper and it comes from the cynicism of people, we tend to pick random things to hate or feel annoyed by, with no particular reason, we just decide to hate or like things (too bad we decide to hate more than to like). Some people hate taxi drivers, some hate bikers, people without cars hate people with cars, some hate old people, some hate young people, some hate successful people, some hate lazy people, some hate others because of their faces, clothes, or voice, without even interacting with them, … we just pick a side (and sometimes switch sides).

I’m a biker too and I used to ride my bike only outside Bucharest in offroad regions and at competitions, because I knew/thought biking on Bucharest streets is dangerous (when I had to, I used the sidewalk, but there you are slower as you have to pay attention to other people, and there are also more bumps), also dogs bark at cyclist. Once, I had to meet a friend in the other side of Bucharest to ride the bike in Titan Park and I put my bike in the car and went there with the car (yeah I did that) because it felt safer.

The need ‘taught’ me that it is ok to ride my bike in the city (the need is losing my driving license for 30 days, don’t ask how :D) and I realized that I didn’t found any bad ‘accompaniment’ in traffic, I tend to have very good sense in not disturbing other cars, and drivers see that and I think they respect me for that, I also turn my head to drivers who might make a risky maneuver to see if they saw me, and this kind of makes them more aware of my presence. I’m also not afraid of dogs anymore, this comes mainly from my confidence that if a dog barks at me I will stop and ‘convince’ him that it’s not ok to bark at cyclists … ever … (if we all do this, they will start running from us instead of barking).

I live at 3,5 km from where I work and it takes me 7 minutes to get to work with my bike, around 20 min with the Bus (I do take the Bus when it rains or when I’m dressed more elegant than t-shirt) and 15 min by car (driving like in NFS and using all the shortcuts). These are summer times, because in the rest of the year you can sometimes double it. When I arrive at work I’m full of energy, I can carry a backpack with clothes for gym or with food (if I pick to eat at the office) and I change my T-shirt. At the office we have a special place for tying our bikes and there are many people arriving at the office by bikes, which gives you a better feeling not being the only one.

As these ideas aren’t very tightly related I will tell you the conclusion for bikers (or future bikers) and for bike haters (or future bikers):

For bikers:

special places to tie our bikes safely will increase the number of kilometers rode by bike by people daily

– if you are polite when riding your bike you will get positive feedback from drivers

– fuck dogs

– we all know the benefits of doing some sport daily, but the biggest benefit is that you arrive faster where you want (and cheaper), if we only had confidence that it’s a safe option, more people will come into this

For haters:

– if you were normal people walking, you weren’t in your car and the biker wasn’t on his bike, would you punch him ? if not, then don’t accident them in traffic, because they aren’t protected and the damage you will do won’t do any good to you or him

– even though our hate is artificial, when you see a bike in traffic you should thank him for letting its car at home so that the traffic is lighter

– using the bike is far less cheaper, the probability of being involved in an accident is smaller (if you drive like me :D), you feel more good about yourself and a sport like this can attract you to other sports, so the benefit will grow exponentially. You don’t have to be fit to ride a bike, all kinds of people ride bikes. Bikers greet other bikers when they meet, comparing to drivers swearing at other drivers (or basically at everything/everybody) when they meet. Cars make you bad, because you’re nervous because of the traffic, the parking place, the costs. On the other hand the bikes cheers you, because you feel free, you feel energetic, you got the power

– you don’t have to ride your bike every day, you can take the bus, you can go with your car, but if we find the best balance we can manage to live in a big populated city in harmony (without traffic jams and dumb nerves)

Bottom Line:

“When you see a biker on the street thank him for letting his car at home.”

Very Technical Presentation about 1z0-897

June 4, 2013

Certification Title : Oracle Certified Expert, Java EE 6 Web Services Developer

Exam : Java EE6 Web Services Developer Certified Expert Exam (1z0-897)

Duration: 90 minutes

Number of Questions: 60

Passing Score: 64.00% (but not all 60 questions are taken into account, usually one or two are left out)

Format: multiple choice (it’s specified the number of correct answers, and also it could contain ‘all of the above’ option)

You can take the exam at any Pearson Vue center, you must have a Pearson Vue account in order to take the exam, you will get all the instructions when you register for the exam, one thing to keep in mind is that you will need two ID cards with photo. 

About the exam:

It’s not a very difficult exam, but there’s no such thing as a single book / course dedicated for the exam that will be enough, and you need to gather your own sources. There is some information on coderanch forum and you can also browse in the topics.

You can also find the exam’s objectives on oracle page, but it’s very vague.

I will tell you all the materials that I studied from, but keep in mind that this is more than the exam requires, yet it does help you to understand in depth the topic if you’re interested.

You will need to have/gain some basic knowledge about HTTP, MIME, XML, XSD, Java, EJB, Servlet Container.

Read to understand, practice a lot, do mock tests, look at the API and at the XSDs for all XMLs you’re interested in, search on Google/Wikipedia what it doesn’t make sense.

What does it cover:

XML: well formed, elements, attributes, default attributes

XML namespaces: prefix, default namespace, namespace inheritance from parent element, qualified/unqualified

URI: form scheme://host:port/path?queryString#fragment

http://hello.world.com (URL < URI)

urn://whatever

XSD:

Web Services in general: coarse grained, platform neutral, transport neutral, based on ubiquitous standards: XML, XSD, better than the other alternatives (although not faster, it is the de facto integration model between no matter how different applications)

SOAP: Envelope, Header, Body, Attachments. SOAP 1.1 / 1.2

WSDL: know every tag and purpose of every part, RPC/Document <part type/element, WSDL 1.1 (/ 2.0 it’s not on the exam but if you’re curious).

WSI-BP 1.1: what’s its purpose, ex: requires XSD schema (WSDL suggests using XSD), only UTF-8/UTF-16, prohibits SOAP Encoding (XSD schema renders it obsolete), conformance claim

JAX-WS:generated proxy & dynamic dispatch, IN-OUT parameters, wrapped request/response, restrictions on classes

– Annotations JAX-WS: you should have an idea about all of them and their attributes, and you should know the main ones: @WebService, @WebMethod, @WebParam, @WebFault, @OneWay, @WebServiceClient, also you sould know the defaults in absence of some annotation.

webservices.xml: you should be able to configure / override / suplement the annotations with XML, just common sense not knowing it by heart.

SOAP Web service java clients: java.net.URLConnection, generated proxies, dynamic dispatch

EJB, Servlet, POJO: publish as WS, and particular information about each type, which EJBs can be published as WS, what you get from an EJB WS. Some configuration ejb-jar.xml / web.xml, especially for security: method security / url-pattern security

Attachments/MTOM: how a HTTP Request for a SOAP Message with attachments looks like, configure MTOM in multiple ways on Server/Client, MIME types and mapping to Java types, base64 encoding default, XML Infoset (addresses XML performance)

– Asynchronous: general Asynch WS, and Asynch processing in java of Synchronous WS with java.util.concurrent.Future / AsyncHandler. How to enable Asynch.

Addressing: how to enable it and few details about it

SAAJ: SOAPMessage, SOAPEnvelope, SOAPHeader, SOAPBody, AttachmentPart. API for manipulating SOAP Message similar to DOM, but targeted for SOAP Messages, as opposed to arbitrary XMLs in the case of DOM, SAAJ classes extend DOM classes.

SOAP Faults, Exceptions: SOAPFaultException / SAAJ SOAPFault class, checked exceptions, SOAP Fault elements: faultcode, faultstring, faultactor, detail.

Handlers: Logical/SOAP, order for incoming / outcoming messages

wsimport: WSDL-to-Java, JAX-WS customizations

JAXB: customization files, internal structure, Java-to-XML, XML-to-Java

JAXP: SAX, DOM, StAX, XSLT

Packaging: .war, .jar, WEB-INF(META-INF)/wsdl/bla.wsdl, WEB-INF(META-INF)/webservices.xml

Security: JavaEE: a lot about servlet, also about EJB and JavaSE, how is HTTPS established, Transport security vs WS-Security: encrypt whole message or just some parts, security remains even after arriving in the target system. Authentication: credentials, Integrity: Digital Signatures, Confidentiality: Encryption. Symmetric vs Asymmetric encryption, public key, private key, trusted authority

WS-Security: very high level, XACML, XKMS, SAML, XML Encryption, XML Digital Signatures, Canonicalization

WSIT: WS-*, very high level, how to specify WS-* in WSDL, how it is carried in the SOAP Header (ex: WS-ReliableMessaging : enables systems to recover when messages in a given sequence are lost in transit or delivered out of order)

JAX-RS:

    – REST philosophy: addressable resources by URI, a uniform, constrained interface, representation-oriented: different format as the requested by the client, communicate statelessly, HATEOAS: navigation links in the response

   – EJB, POJO, Servlet, JAX-WS to publish REST (@WebServiceProvider)

   – @Path

   – resource method/sub-resource locator

   – @Produces

   – @Consumes

   – @PathParam/MatrixParam/QueryParam/FormParam/HeaderParam/CookieParam (@DefaultValue)

   – @GET/POST(nonideimpotent)/PUT/DELETE (CRUD)

   – JAX-RS Annotations

   – configure servlet to enable JAX-RS, Application class, deployment

   – Exceptions, ExceptionMapper, HTTP Codes

   – Providers: MessageBodyWriter/MessageBodyReader

   – HTTP Content Negotiation (MIME Types, most specific wins)

   – HTTP Response Codes, HTTP Headers

   – Cache, Conditional GET

   – Security: WebContainer & EJB methods if EJB

   – Clients: Servlet, JAX-WS (with XML binding, instead of SOAP), JavaSE, Jersey

   – JAX-RS mapping between Mime Type to Java class

   – @Context: inject different stuff

   – UriBuilder: API for safely building URIs

   – Response.ResponseBuilder: API for safely building HTTP Responses with headers and http codes

   – JAXB, JSON

What it doesn’t cover:

– UDDI

– JAXR

– JAX-RPC

– WSDL 2.0

Suggested materials:

– Java Web Services Up and Running, Martin Kalin

– Richard Monson Haefel J2EE Web Services

– Restful Java With JAX-RS

– SCDJWS 5 Study Notes, Ivan A Krizsan

– JavaEE 6 Tutorial (Web Services part)

JAXB Tutorial

JAXP Tutorial: SAX, StAX, DOM, XSLT

– Wikipedia & Google when I didn’t understood something (especially on WS-*)

JavaEE6 API (relevant WS stuff)

JavaSE6 API (relevant WS stuff)

– XSD Schemas for : xsd, wsdl, soap, soap-envelope, web.xml, ejb-jar.xml, webservices.xml

Mock tests:

– ezpractice labs

– ucertify

– ? Mikalai Zaikin’s OCE WSD 6 Quiz

How I learned 100 decimals from PI, and what this teaches us ?

June 3, 2013

Few months ago I was thinking about how many things we keep in our minds, all the passwords, usernames, strange words, song lyrics, poems, quotes, and as I always was fascinated in the cognitive science, I thought I would do a little experiment on me, so I picked a symbolic number PI (kind of helps for my faith in learning, instead of a random keyboard hazard typed number, and also it’s universally available, no matter where you are you can tell somebody that you know the first 100 digits from PI and they can test you finding it on the internet).

So this is PI:

3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679

(yeah I just typed it, I didn’t copy-pasted it from the Wikipedia :P)

as I learned PI I also found that the world record is 67,890 digits, recited in China by Lu Chao in 24 hours and 4 minutes on 20 November 2005, and also about the history of PI, how digits were calculated and the fact that computers increased the calculated number of digits exponentially.

“Many persons have memorized large numbers of digits of π, a practice called piphilology. One common technique is to memorize a story or poem”, Wikipedia : but I find that stupid, and because I’m good with numbers, as I’m a programmer, I’m writing down my strategy of memorizing it. I must say that I learned PI few months ago, and I didn’t repeated it since then, and today I didn’t remembered much of it, but in one hour of retaking the ‘algorithm’ I started to have dejavus and in the end remembered it, so once you learn it you won’t forget it (like riding a bicycle, yet after a big pause you have some difficulties riding that bike, but after few moments you’re ready to go)

 

3. 14 15 92 65 389 79 | 32 38 46 26 43 38 327528| 84 1971 69 | 39 93 | 75 152097 444 59 | 2307 | 81 64 | 0628 6208| 99 | 86 28 03 48 | 2534 | 2117 06 79

 

Explanation:

– I made big groups of ~4 smaller groups of 2 digits, as I find that groups of two digits are easier to learn

– I colored similar digits and symmetric groups, as they are easier to learn

– also what seemed like a year I grouped it alone, perfect squares also are easy to learn

– two interesting groups were: 795028 with 75105820, where I made a correlation on them

– also the last 03, 06: because this groups started with 0 I knew that the first was with 3 and the last with 6

 

It did helped me to type them on the number pad, and also to speak them loud, in Romanian, then in English, I also tried to tell it in reverse, but it was harder and I found that I took individual big groups from the end and transformed the big group as I knew it in reverse order and then the next group and so on.

I learned in a progression: the first x digits, and I always added new big groups, which I repeated separately, and then added to the main group and repeated it all. The groups were easy to remember, it’s like knowing some telephone numbers, which is fairly easy, the challenge was to know which group came after which group.

The grouping it’s plain arbitrary and I could have chosen any type of grouping, but this is how they seemed natural to my brain, and I begun to think that there was some kind of coincidence in the fact that all small groups of 8 digits have some digits in common, or that some big groups are similar to some other big groups, but I think this is just because there are only 10 digits and the probability of groups to look similar is big enough.

I think(hope?) that anybody can do this, in their own unique way, and maybe there are some correlations made by people that intersect, which could mean something about how our brain works on numbers.

Why on earth would you spend time doing this ? Well because why on earth you spend a lot of time doing nothing interesting, watching TV, smoking, or who knows what. It’s not like you’re really busy, and it’s also a ‘game’ for your brain, it’s not like you’re wearing out your brain, it’s kind of the opposite. You can do it anywhere, in a Bus, at home, but preferably in a hammock. It’s nice to get out of the routine and do crazy things, all sort of things. Start small and then expand and share, you will find more and more.