Generating XML from XSD

If you have XSD or you are modyfiyng XSD and want to see generated example of XML you have several options to use.

I know that SpyXML (Altova) has that posibility same as Oxygenxml , but this is commercial software (didn’t test it).

I have found out that eclipse J2EE version which includes WTP (web tools platform) has that posibility and it is free.

Here is small tutorial generating XML from XSD how to do that, but in basic you need to do this:

  • download Eclipse IDE for Java EE Developers (this includes WTP plugins)
  • create new project (you can use example which comes with eclipse: File>New>Examples>XML>Editing and validating XML files)
  • to generate XML from XSD/DTD,… you need to follow these steps:
    • Run New XML File wizard  – File>New>Other>XML>XML
    • select project name and you can change xml file name -> Next
    • if you want to test XSD then next step is to select Create XML file from an XML Schema file and select the xsd file from project (or import it to to the project)
    • Next step is to select check box if you want to add some default attributes
    • at the last step you will be see the resulted XML file

 

Advertisements

2010 in review

The stats helper monkeys at WordPress.com mulled over how this blog did in 2010, and here’s a high level summary of its overall blog health:

Healthy blog!

The Blog-Health-o-Meter™ reads Fresher than ever.

Crunchy numbers

Featured image

A helper monkey made this abstract painting, inspired by your stats.

The average container ship can carry about 4,500 containers. This blog was viewed about 14,000 times in 2010. If each view were a shipping container, your blog would have filled about 3 fully loaded ships.

 

In 2010, there were 10 new posts, growing the total archive of this blog to 89 posts. There was 1 picture uploaded, taking a total of 172kb.

The busiest day of the year was July 7th with 114 views. The most popular post that day was iPhone 3g os4 too slow to work – downgrading.

Where did they come from?

The top referring sites in 2010 were search.seznam.cz, sit.fbk.eu, google.com, blog.adamnash.com, and modmyi.com.

Some visitors came searching, mostly for networkconnect.dmg, juniper vpn snow leopard, pdanet 1.33, iphone 3g os4 slow, and juniper ssl vpn snow leopard.

Attractions in 2010

These are the posts and pages that got the most views in 2010.

1

iPhone 3g os4 too slow to work – downgrading June 2010
2 comments

2

juniper VPN with Snow Leopard September 2009
5 comments

3

GWT using maven2 April 2008

4

pdaNet – how to downgrade pdaNet to v.1.33 – no trial January 2009
3 comments

5

zbozi z USA a clo/dan April 2008
7 comments


authentication against google in java

Google, Yahoo and others allows to authenticate users using OpenID protocol. Some pages are here and openid4j .

In my last post I have mentioned about google data libraries which is actually APIs for most of the google services, including to authenticate users and much more. GData libraries are let’s say higher level layer which handles all the openid pain for you. 2 simple lines of code and you are authenticate 🙂

Here is simple example

pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
 <modelVersion>4.0.0</modelVersion>
 <groupId>com.majecek.gdata</groupId>
 <artifactId>gdata_testing</artifactId>
 <version>1.0-SNAPSHOT</version>
 <packaging>jar</packaging>
 <name>gdata_testing</name>
 <url>http://maven.apache.org</url>
 <properties>
 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
 </properties>

<repositories>
<repository>
<id>mandubian-mvn</id>
<url>http://mandubian-mvn.googlecode.com/svn/trunk/mandubian-mvn/repository</url>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
 <scope>test</scope>
 </dependency>
 <dependency>
 <groupId>com.google.gdata</groupId>
 <artifactId>gdata-calendar-2.0</artifactId>
 <version>1.41.3</version>
 </dependency>
 <dependency>
 <groupId>com.google.gdata</groupId>
 <artifactId>gdata-core-1.0</artifactId>
 <version>1.41.3</version>
 </dependency>
 </dependencies>
 </project>

Simple java project:

package com.majecek.gdata;
 import com.google.gdata.client.GoogleService;
 import com.google.gdata.client.calendar.CalendarService;
 import com.google.gdata.util.AuthenticationException;

public class App
 {
 public static void main( String[] args )
 {
 GoogleService myService = new CalendarService("some_apps");
 try {
 myService.setUserCredentials("userLogin".concat("@gmail.com"), "password");
 //if success then succes authentication occures
 System.out.println("success authentication");
 } catch (AuthenticationException e) {
 //if not then invalid credentials has been set
 //invalid username or password
 System.out.println("invalid authentication");
 }
 }
}

Example can be downloaded from google code repository. It is maven project.

I have updated and uploaded this example to github. Read README.

The bigest advantage is that we don’t need to handle any “openid” tricks, just creates service against google service (in my example Calendar) and call “setUserCredentials” which already authenticate user.

Credits go also @Petr Olivka


vmware fusion ctrl clik

Ever wanted to know how to do CTRL clik in fusion and do the same result as on standalone windows pc ?

If you do CTRL + click it actually does right click. If you want to normal CTRL + click (aka select some items) you need to go to Vmware Fusion Preferences (not the instance settings) -> Keyboard & mouse  -> Mouse shortcuts -> and unselect the row “Secondary button   Control – primary button”

that’s it.


iPhone 3g os4 too slow to work – downgrading

As many other uses who have iPhone 3G and updated to OS4 noticed that their phone after some time is almost unusable or this. I have installed SBssetings which shows me free RAM and i noticed when RAM is lower 10MB phone doesn’t respond and can’t work properly.  (Some memory leak ? not sure)

So I have decided to downgrade to 3.1.3  and it is not as easy as you would thought.

I want my phone to be jailbreaken so you have 2 options:

1. find already customized firmware (search for customized restore firmware)

2. customize firmware yourself 🙂

Everything was ok, except that I got error 1600.

I have solved this issue by setting iPhone NOT in DFU mode but in RECOVERY mode.

There is another application for this issue “IREB” or this but it didn’t work for me (I think it works for 3.1.3 but not in os4).


vnc keyboard problem in ubuntu

I had problem with keybord mapping in vnc.

I used some of the solution very successfully on 9.10 but on 10.4 it is not possible. waiting for some reply.

Here are several sites which has few solutions:

http://wiki.archlinux.org/index.php/Tightvnc

http://blog.yclian.com/2007/12/3-solutions-to-gnomevnc-keyboard.html  -> really good one which helped on 9.10

http://markus.revti.com/2009/11/ubuntu-9-04-keyboard-mapping-problem-on-tight-vnc/


installing new firmware on wrt54gl – update

Last year I have written about installing new firmware on wrt54gl and installing openvpn on this tiny excelent router.

to install latest openwrt firmware follow this steps:

ssh as root to the device.

# cd /tmp
# wget http://downloads.x-wrt.org/xwrt/kamikaze/8.09.2/brcm-2.4/openvpn/openwrt-brcm-2.4-squashfs.trx
# mtd -r -e linux write openwrt-brcm-2.4-squashfs.trx linux

Please note that the image is not downloaded from openwrt but from x-wrt.org. x-wrt.org is project which cooperate with openwrt. The reason is that the firmware already includes openvpn package. My device has not enough memory and I always struggle with memory on this device.

  • bootwait should be already on (if not, see my article from last year)
  • telnet wrtbox and change password (allows ssh & web access)
    telnet 192.168.1.1
    passwd
  • repair time on wrt
    crontab -e
    30 6 * * * /usr/sbin/rdate -s rdate.cpanel.net

you already have openvpn package (if not just install it). I had problems to use my old certificates and config, so I have also installed openvpn-easyrsa

  • move to /etc/easy-rsa
  • just call the opnvpn commands – little bit modified – I am following openvpn howto
    • vars
    • clean-all
    • build-ca
    • build-key-server server
    • build-key client1
    • build-dh – this one takes long time

Notice that it is missing at the begining “dot” and “slash” – which is standard way to do it on linux.

Next is standard openvpn steps