Programming And More
Tags: programming   php   php5   oop  
Tue, 6/1/2010

Moin!
When I played with ruby I found some nice features of the language that I’d really like to see in php as well but apparently most of the syntactic sugar is not part of php5 at all. However, due to that you will often see classes with get and setter methods that basically do nothing special. In your getter and setter methods you can work on the data passed around which is very useful if you change this unique logic at some point later in the applications lifetime when you don’t want to change too much in your interface.

In my ruby quickstart I wrote about classes and how you can write short properties getters and setters.

class Car
  attr_accessor :mileage

  def initialize(mileage)
    @mileage = mileage
  end
end

audi = Car.new(245000)
puts "old mileage: "+audi.mileage.to_s
audi.mileage = 246000
puts "new mileage: "+audi.mileage.to_s



In php5 there is no such thing like “attr_accessor” but you can at least try to build something similar which is not too bad at all:

I first tried to replicate it 1:1 but it doesn’t work of course :). Look!

  class Car {
    private $mileage = 123000;

    function mileage($newMileage=0) {
      if ($newMileage>0) {
        $this->mileage = $newMileage;
      } else {
        return $this->mileage;
      }
    }
  }

  $mycar = new Car;
  print $mycar->mileage;
  $mycar->mileage = 124000;
  print $mycar->mileage;



This doesn’t work and throws “Fatal error: Cannot access private property Car::$mileage”. Sure, “mileage” is a private property of class “Car” so you can’t access it and I didn’t wanted to access it. I wanted to use the method like a property…no sir!

The best solution I came up with so far is the following:

  class Car {
    private $mileage = 123000;

    function mileage($newMileage=0) {
      if ($newMileage>0) {
        $this->mileage = $newMileage;
      } else {
        return $this->mileage;
      }
    }
  }

  $mycar = new Car;
  print $mycar->mileage(); // 123000
  $mycar->mileage(124000);
  print $mycar->mileage(); // 124000



This way I really lose all the verbose get and setter methods that many books teach you to write. This way you can still work on the data you pass, it’s shorter and using it in your code is by far more readable and it makes more sense.

Tell me if you disagree :). I really prefer it that way!

Andreas Schipplock.

Posted 11 months ago
Tags: programming   javascript  
Mon, 5/31/2010

Today I’m about to tell you something about Javascript objects and how to use them properly.

You can use rhino (javascript interpreter and shell) to test your scripts or you can throw it into your webbrowser. I prefer rhino over the webbrowser as I can test my code without firing up the webbrowser.

Let’s start simple:

Create an object with properties and print and access them:

var car = {
"make": "Audi",
"engine": "V8",
"mileage": "123.000"
};

// both is possible
print(car.make)
print(car["make"])



Here we have a simple object with some properties. Nothing special about it. The expected result is “Audi”.

Sometimes if you don’t know the properties by heart, you may print the wrong propertie, e.g.

var car = {
"make": "Audi",
"engine": "V8",
"mileage": "123.000"
};

print(car.brand)



Rhino will simply print out “undefined”. To workaround this issue you can put default values to it:

var car = {
"make": "Audi",
"engine": "V8",
"mileage": "123.000"
};

print(car.brand || "the unknown brand")



And it will print out “the unknown brand” which is something you can expect and it’s always better to work with values you expect than with “undefined” ones.

However, here is a more detailed example of our car represented as an object:

var car = {
"make": "Audi",
"engine": {
"type":"V",
"cylinders":"8",
"capacity":"4.2"
},
"mileage": "123.000"
};

print(car.engine.type)



There we print out the engine type which is “V” but what happens if we mistype “engine” e.g.:

var car = {
"make": "Audi",
"engine": {
"type":"V",
"cylinders":"8",
"capacity":"4.2"
},
"mileage": "123.000"
};

print(car.engne.type)



We even get an exception using this so in fact the script “died”. We could use || like before, right?

var car = {
"make": "Audi",
"engine": {
"type":"V",
"cylinders":"8",
"capacity":"4.2"
},
"mileage": "123.000"
};

print(car.engne.type || "unknown engine type")



No, we can’t! We still get an exception.

So I discovered the following construct:

var car = {
"make": "Audi",
"engine": {
"type":"V",
"cylinders":"8",
"capacity":"4.2"
},
"mileage": "123.000"
};

print(car.engne && car.engne.type || "unknown engine type")



We don’t get an exception anymore but the result “unknown engine type”.

Sometimes you really want to make sure that your object has your desired property, so if you want you can check for the existense of a property, it’s simple:

if (car.hasOwnProperty("engine")) {
print("car has an engine")
}



To add new properties, simply write it like this:

car.engine.mileage = "12.145"



And to update values, simply put:

car.engine.capacity = "3.7"



Sometimes you want to have a prototype you can base your objects on and it’s not too difficult:

if (typeof Object.fromPrototype !== 'function') {
Object.fromPrototype = function(thePrototype) {
var the_new_function = function() {};
the_new_function.prototype = thePrototype;
return new the_new_function;
};
}

var car = {
"make": "Audi",
"engine": {
"type":"V",
"cylinders":"8",
"capacity":"4.2"
},
"mileage": "123.000"
};

var security_car = Object.fromPrototype(car)
security_car.make = "Mercedes"
security_car.platinggrade = "10"

print(security_car.make || "na")



It will print “Mercedes” and it’s easy to understand. Whenever you want to retrieve a value, it goes down the hirarchy and tries to find it. In this case you told javascript that “security_car” has an additional property “platinggrade” which the prototype “car” doesn’t have. But you could try to print out the mileage and you’d get “123.000”.

And to get rid of your newly created property, you can simply delete it:

var security_car = Object.fromPrototype(car)
security_car.make = "Mercedes"
security_car.platinggrade = "10"

print(security_car.make || "na") // Mercedes

delete security_car.make

print(security_car.make || "na") // Audi (from the prototype)



So it will print “Mercedes” and “Audi”.

Finally try to namespace your whole objects so that no other code can interfere:

var SCHIPPLOCK = {};

if (typeof Object.fromPrototype !== 'function') {
Object.fromPrototype = function(thePrototype) {
var the_new_function = function() {};
the_new_function.prototype = thePrototype;
return new the_new_function;
};
}

SCHIPPLOCK.car = {
"make": "Audi",
"engine": {
"type":"V",
"cylinders":"8",
"capacity":"4.2"
},
"mileage": "123.000"
};

var security_car = Object.fromPrototype(SCHIPPLOCK.car)

security_car.make = "Mercedes"
security_car.platinggrade = "10"

print(security_car.make || "na")

delete security_car.make

print(security_car.make || "na")



Where “SCHIPPLOCK” is an empty object which reflects my namespace.


For now that’s enough I think. Play around with your code and don’t make javascript too ugly :). It’s not that bad imho :).

Andreas Schipplock.

Posted 11 months ago
Tags: funny  
Sun, 5/30/2010
that’s what you get if you think to get a cool new job there :).

that’s what you get if you think to get a cool new job there :).

Posted 11 months ago
Sun, 5/30/2010

When I talk about Ada, one can probably assume I’m about to tell something about the programming language Ada and he might be right. Ada is an object oriented programming language which was initially developed by the DoD because they needed a solid base to build on. They needed tested, compatible, and sane tools. They needed a standardized programming language that’s strongly typed, so this is where Ada came in.

Read more about the Ada programming language on wikipedia.

If you are a pascal programmer or even a “delphi” coder you might feel at home when you put your hands on Ada because it all looks and feels like pascal though Ada is much more than a blind copy.


What compiler should I use?


GNAT. Really…this is the best supported Ada compiler these days and it’s almost available everyhwere. If you are running debian or ubuntu you can simply install gnat by issuing “apt-get install gnat” or if not search for it “apt-cache search gnat” and install the appropriate package.


I want to learn Ada


Don’t believe Ada is a widely supported language. There will be times when you can’t fix an issue yourself and are stuck on yourself, too…there is a mailinglist but it’s run by adacore and you have to rely on them.

However…

In the www there are many resources to learn Ada and due to the standards defined you can rely on almost every piece of code out there. Some books are horribly and some are good. You will have to find out yourself…



So is Ada the right choice?



In the first few moments I really liked Ada because I like the pascal syntax and because I developed with pascal and delphi earlier before I felt home somehow…but there is this thing what programmers and software engineers heavily rely on and which is missing in Ada…the 3rd party libraries. I’m not talking about missing bindings to connect to postgresql, mysql or oracle but you may find yourself in a strange mood when you find out that these libs are very old but due to the standardized language the chance that these old bindings work is really good. In fact I could easily establish a connection to a postgresql database but still you have the feeling there is something missing. The “big support”, the feeling that some big company is taking care…no, you don’t have it. And then you also begin to realize that nobody or at least not the mass is needing this knowledge.

Well…

This is just my personal opinion and I can’t judge for you. You will have to do it on your own. Selecting the appropriate programming language is also a task of a software developer and if you are unable to choose the right thing, it’s your fault.
Posted 11 months ago
Tags: pics   funny  
Sat, 5/29/2010
The doctor said “only one beer per day”. Well, here it is :). 

The doctor said “only one beer per day”. Well, here it is :). 

Posted 11 months ago
Tags: programming  
Tue, 3/30/2010

Today I had a conversation about how cross platform gui development can be accomplished as easy as possible and whenever one asks that himself the first time he might be in that illusion that cross platform gui development can be easy and that it’s not a hard thing to accomplish but whenever one is thinking like that he is probably just wrong.

The first idea many people come across is to develop the gui application in Java most likely with the SWING gui toolkit which is shipped with SUN’s java distribution and which can be used to create cross platform gui applications that almost look native and almost feel native. Most people fear SWING because they got reminded of the old times where swing had the metal look by default which was a lot of a difference to what the native os widgets looked like.

However, today JAVAs SWING toolkit is not the worst idea if you want to go cross platform. You can deploy your application to linux, windows and even os-x but you will fight with a big drawback that almost any SWING application has to fight with: a slow gui.
There are SWING based java applications that are quite responsive but the majority just feels slow. They don’t even need to _be_ slow but they feel slow and for a desktop application there is this one criteria that’s very important but underrated by most programmers: startup-time.

Startup-time for a desktop application is very important as the user, when he clicks the icon of the application, expects the app to be started immediately. It’s a simple criteria but it exists and as you know the java virtual machine takes quite some time to start up which is not a problem for server based software but for desktop apps it is.

If you still want to go the java route and hate swing there is an alternative which in fact is quite a good idea. It’s called SWT, is part of eclipse and implements the native ui of the os specifically so if you want to deploy your app on os-x you’ll have to ship the os-x jar explictly. The drawback is that there aren’t many gui builder available (there is one which seems buggy).

There are some other gui libraries for java but the most stable are AWT, Swing and SWT which you can consider to use if you want to develop cross platform gui applications.

If you aren’t the java guy, but like c++, the fastest way to develop cross platform gui applications is to use Qt from Nokia. Really, the lib is one of the best you may come across when hacking c++ plus Nokia gives you the Qt IDE for free which is a killer app productivity-wise. Learning the Qt API is also very easy if you are used to programming in general and building for different platforms is a breeze. The only drawback is the license which is restrictive if you want to modify the core of Qt itself. If you just want to develop your next commercial software on top of Qt it’s absolutely no problem but it’s still a bitter taste in your mouth. Consider this license “issue” when you are doing serious development.

So what else do we have to cross develop gui applications? C with Gtk? C++ with FLTK? Flex? Na…we want it native! Almost at least!

Depending on what specific operating systems you want to support it may change your decision on what to use. If you are just want to target Windows and Linux it’s easier to choose the right tool for the right job compared to supporting OS-X, Linux and Windows at once just because the whole desktop and usage of OS-X and Linux or Windows is quite different. There are so tiny differences that make you cry out loud like OS-X not having a “tray notification bar” which is available under most Linux and Windows desktops and which can be very usable for desktop applications. There is such a thing in OS-X as well (upper right corner) but it’s still different.

Window management under OS-X is different. You close the main window of an app in windows and it will close the entire app (standard behaviour). You can still add that behaviour to your OS-X variant. Sure but you’ll have to take all those tiny differences and make it work.

Sometimes it even makes more sense to write for each platform than to have all the hassles fixing the differences with a lot of conditionals in your code.

Under OS-X your best bet is Xcode which is on the second DVD and which is free but you’ll have to learn objective-C which is quite a strange language if you are used to C or any other c-style language.

And now I’m going to tell you one big secret about me and my plans in the future and why this topic ruined many weekends trying to figure out how to develop the most generic app that runs on Windows, Linux and OS-X and I tell you what: I failed…I failed all the times and the reason is that you simply can’t code that generic. It’s just impossible.

I _really_ downloaded Realstudio 2010 trial because they promised cross platform development with that tool is possible and simple plus you can create binaries for Windows, Linux and OS-X under one OS (cross compiling).

I tried that and yes, you can do all that and it’s really a breeze to work with realstudio and I even bought a license in the end but there is still the issue of different concepts for each operating system. Realstudio handles these quite well but at some points you still have to workaround with conditionals.

I’m still hacking perl and clojure to develop web services and all kinds of things but for cross platform gui development realstudio 2010 is really one way to go though you have to code in a basic dialect. The only drawback is the licensecosts but the prices are quite low. I bought an os-x pro license so I can test on all supported operating systems.

So what? Nothing! Just that cross platform gui development needs careful thinking before you invest time that will be wasted somewhere. Think about it before you start.

Kind regards,
Andreas.

Posted 1 year ago
Tags: programming   sql   postgresql  
Fri, 2/19/2010

I faced a problem today. I defined the following table:

create table todos (
	id integer primary key,
	user_id integer references users(id),
	priority smallint not null default 5,
	category text,
	title text not null,
	body text not null,
	created_on timestamp not null default CURRENT_TIMESTAMP,
	created_by integer references users(id),
	finish_on timestamp not null default CURRENT_TIMESTAMP,
	repeat text not null default 'none' check (repeat in ('none','yearly','monthly','weekly','daily')),
	reminder integer[] default '{ 44640, 10080, 8640, 7200, 5760, 4320, 2880, 1400 }', 
	done boolean not null default false
);


And the remind field is an array of integers and postgresql allows me to have a dynamic array with unspecified length but the drawback is that there is no real function to simply get the array length.

However, with the following snippet, it’s simple:

select count(*) from (select regexp_split_to_table(array_to_string(reminder, '-'), '-') 
from todos 
where id=0) as foo;



Just define a delimiter that works for your array and change the where-clause to fit your needs :).

Andreas Schipplock.

Posted 1 year ago
Tags: programming   clojure   postgresql  
Sun, 2/14/2010

Hi, I’m still playing around with clojure and I wanted to do something with my postgresql database system and I started using clojure.contrib.sql to connect to the database, to execute statements etc…this library is a thin wrapper around JDBC so you need the newest jar from jdbc.postgresql.org and put it on your classpath (java -cp …). You also need clojure-contrib in your class path. I have written a quick guide on how to get started quickly with “compojure”, a web framework for clojure, and most topics there are relevant to this, too. So if you want to get started quickly, take a look.

However, I faced a problem with timestamp values in contrib.sql. I wanted to save a timestamp value and normally I simply form a string that’s a compliant “timestamp” value regarding postgresqls “timestamp” type. This idea didn’t work out for contrib.sql.

(defn create-todo
  [user_id title body created_on created_by finish_on repeat]
  (sql/insert-values
   :todos
   [:user_id :title :body :created_on :created_by :finish_on :repeat]
   [user_id title body created_on created_by finish_on repeat]))



This definition saves a todo entry in my todoserver-database and the fields “created_on” and “finish_on” are timestamp values with a content like “2010-02-11 00:00:00” which is a valid timestamp in postgresql. However, when contrib.sql executes this statement I got an error message about a type mismatch.

For this to work I had to define a “cast” definition:

(defn timestamp [time-string] (java.sql.Timestamp/valueOf time-string))



This definition returns a java.sql.timestamp suitable for the jdbc driver.

I use it like that:

(defn create-todo
  [user_id title body created_on created_by finish_on repeat]
  (sql/insert-values
   :todos
   [:user_id :title :body :created_on :created_by :finish_on :repeat]
   [user_id title body (timestamp created_on) created_by (timestamp finish_on) repeat]))



It works! However: always try to enclose your code with the (try) macro.

(GET "/create-todo"
       (if (master-password-correct? (params :mp))
	 (if (every? #(-> % params empty? not) [:for :title :body :created_on :created_by :finish_on :repeat]) 
	   (try
	    (sql/with-connection dbc
	      (sql/transaction
	       (create-todo (user-id (params :for)) (params :title) (params :body) (params :created_on) (user-id (params :created_by)) (params :finish_on) (params :repeat))))
	    (html "ok")
	    (catch Exception _))
	   (html "2:parameter list incomplete"))))



This way you are able to see the exact error message of the jdbc driver! If you aren’t, you simply get an ugly java exception output with no valuable information.

Important: I posted a message to the clojure mailing list and it seems to be the expected behaviour of the contrib.sql lib. IMHO the examples for contrib.sql should be optimized. I wasted quite some time to figure this out :).

There is also a problem with the “update-values” definition and when you are giving it numbers as criteria. JDBC is thinking you are giving a string and yes, you are but pgsql doesn’t care.

However, when you face an error like this:

Update counts:
BatchUpdateException:
 Message: Batch entry 0 UPDATE todos SET done='1' WHERE id='0' was
aborted.  Call getNextException to see the cause.
 SQLState: 42883
 Error Code: 0
PSQLException:
 Message: ERROR: operator does not exist: integer = character varying
 Hint: No operator matches the given name and argument type(s). You
might need to add explicit type casts.
 Position: 34
 SQLState: 42883
 Error Code: 0



You can do something like this:

(defn update-todo 
  [id attrib_map] 
  (sql/update-values 
   :todos 
   ["id=?::integer" id] attrib_map))



Do you see the postgresql typecast in there? It’s needed! I’m running pgsql 8.4.2 with the latest jdbc driver, clojure 1.1.0 and clojure-contrib 1.1.0.

You can call this like that:

 (GET "/todo-done"
       (if (master-password-correct? (params :mp))
	 (if-not (empty? (params :id))
	   (try
	    (sql/with-connection dbc
	      (sql/transaction
	       (update-todo (params :id) {:done 1})))
	    (html "ok")
	    (log "HINT" (str "todo entry w. id " (params :id) " has been set to done = true"))
	    (catch Exception _)))))



You can also give “true” or “false” as ::integer value even when you defined the field in your data definition as boolean in pgsql. I accidentially did that and faced no error because boolean values are represented using integers in postgresql. I’ll add another post about the typecasts in the near future but to give you an idea for now this should get you started on clojure.contrib.sql and postgresql.

Hope you liked it!

Kind regards,
Andreas Schipplock.

Posted 1 year ago
1 note
Tags: programming   clojure  
Sun, 1/31/2010

I’ve been playing around with clojure this weekend and after I learned the basics of the language I wanted to see what possibilities I have to do web development using clojure because it’s one of my main interests for now and the last few years.

I googled for “clojure web framework” and found compojure and though I had no idea about its quality I tried it out.

Compojure embeds the jetty http server and though you are not limited to jetty it’s a good default choice and my primary goal is also to embed jetty because I want to have it behind a reverse proxy like pound so I have the maximum flexibility. Jetty is fast, solid and easy to use.

To get yourself started quickly, create a directory where you will store all required jar files for your compojure web application like “/home/andreas/clojure/jars/”. You’ll need the following files:

You now should have the following files:

  • clojure-contrib.jar
  • commons-fileupload-1.2.1.jar
  • grizzly-http-servlet-1.9.10.jar
  • jetty-util-6.1.15.jar
  • clojure.jar
  • commons-io-1.4.jar
  • grizzly-http-webserver-1.9.10.jar
  • servlet-api-2.5-20081211.jar
  • commons-codec-1.3.jar
  • compojure.jar
  • jetty-6.1.15.jar

Regarding the wikibooks hello world your hello world could look like this:

(ns hello-world
  (:use compojure))

(defroutes greeter
  (GET "/"
    (html [:h1 "Hello World"])))

(run-server {:port 8080}
  "/*" (servlet greeter))

I am using gedit with the external tools plugin which is not activated by default on ubuntu but you can simply enable it in the preferences. This plugin is very useful for what I need because for this example we need a simple script that calls clojure.

My script for executing/compiling a clojure file looks like this:

#!/bin/bash
for f in /home/andreas/clojure/jars/*.jar; do
    CLASSPATH=$CLASSPATH:$f
done
java -cp $CLASSPATH clojure.main $GEDIT_CURRENT_DOCUMENT_NAME


If you try out the hello world example and execute it you can open your webbrowser at “localhost:8080” and you’ll see your hello world message.

Now if you want to distribute your web app to some customer’s server you probably don’t want to publish the source code (depends :P), so whether you create a war file which would expect a running application server being there set up or you are going the route to have a standalone clojure/java app running that embeds jetty and runs in the background as a so called daemon. In this case you need to use a dedicated port just for this app but using pound it can give you a great flexibility (app servers are flexible, too; it simply depends).

In the case you want to create a standalone jar file that you can start with java -jar you have to modify your hello world example and your buildscript:

the hello world example modified

(ns main
	(:gen-class)
	(:use compojure))
	
(defroutes greeter
	(GET "/"
		(html [:h1 "Hello World"])))
		
(defn -main
	[]
	(run-server {:port 8080}
		"/*" (servlet greeter)))



the script to build a jar file

#!/bin/bash
for f in /home/andreas/clojure/jars/*.jar; do
    CLASSPATH=$CLASSPATH:$f
done

echo "Main-Class: main" > $GEDIT_CURRENT_DOCUMENT_DIR/Manifest.txt
echo "Class-Path: ." >> $GEDIT_CURRENT_DOCUMENT_DIR/Manifest.txt

rm -rf $GEDIT_CURRENT_DOCUMENT_DIR/classes/*
mkdir -p $GEDIT_CURRENT_DOCUMENT_DIR/classes

for f in /home/andreas/clojure/jars/*.jar; do
    unzip -u $f -d $GEDIT_CURRENT_DOCUMENT_DIR/classes/ > /tmp/foo
done

CLASSPATH=$CLASSPATH:classes/

rm -rf $GEDIT_CURRENT_DOCUMENT_DIR/classes/META-INF

java -cp $CLASSPATH clojure.main -e "(compile 'main)" > /tmp/foo
jar cmf $GEDIT_CURRENT_DOCUMENT_DIR/Manifest.txt $GEDIT_CURRENT_DOCUMENT_NAME.jar -C classes . > /tmp/foo
java -jar $GEDIT_CURRENT_DOCUMENT_NAME.jar

Gedit has a tiny bug that prevents the java process to be killed after execution. Kill the process manually and you can start the jar with “java -jar main.clj.jar”. Rename the file if you wish to do so.

serving static files
by default your static files are expected to reside in “public”.

(defroutes greeter
	(GET "/"
		(html (greet "andreas")))
	(GET "/*" 
    	(or (serve-file (params :*)) :next)) 
  	(ANY "*" 
    	(page-not-found)))


implement your favicon

(defroutes greeter
	(GET "/favicon.ico"
		(redirect-to "/fav.ico"))
	(GET "/"
		(html (greet "andreas")))
	(GET "/*" 
    	(or (serve-file (params :*)) :next)) 
  	(ANY "*" 
    	(page-not-found)))


It only works if you serve static files as shown in this example.

get GET parameters

(GET "/greet"
		(html (greet (params :user))))



For web development you probably want to read config values from a json file:

1.) set up lein (see this text)
2.) clone the clojure-json repository:

git clone git://github.com/danlarkin/clojure-json.git


3.) cd to clojure-json and issue:

lein jar


This will create a jar that you have to put in your jar folder or add it to your classpath.

Let’s assume the following json file:

{
	"database": {
		"host": "127.0.0.1",
		"user": "postgres",
		"pass": "secret",
		"name": "mydatabase"
	},
	"email": {
		"user": "foo@bar.com",
		"pass": "mysecret"
	}
}



Let’s assume you want to get the value of the database host:

(ns my.config)
(require '(org.danlarkin [json :as json]))

(defn read-custom-config
  [file]
  (json/decode-from-str (slurp file)))

(println (-> (read-custom-config "config.json") :database :host))



You can also write it like this:

(ns my.config)
(require '(org.danlarkin [json :as json]))

(defn read-custom-config
  [file]
  (json/decode-from-str (slurp file)))

(println (:host (:database (read-custom-config "config.json"))))



For now that’s all I know about compojure, too :).

Posted 1 year ago
Tags: domains  
Sun, 7/12/2009

Hi, sometimes you are about to register a domainname beneath some “strange” topleveldomain like .tl, .pe, .ec and so on and in all cases you have to enter a nameserver which is responsible for that domainname you will register and I once got into trouble with cocca.cx which is the registry for .tl. I registered a name and told the nameservers but after a few months users complained that they can’t resolve my domainname but I also had a lot of users who could resolve that domainname so I believed it was a misconfigured nameserver of the side of the users…

But in the end I was utterly wrong.

The real problem was that the responsible dns servers of cocca weren’t synchronized so a that a bunch were up and running with correct nameserver information and some others weren’t.

I could easily find out with “dig”:

1.) dig

This gives you a list of all root nameservers. Pick one, e.g. “L.ROOT-SERVERS.NET.”.

2.) dig @L.ROOT-SERVERS.NET. as.tl

…where “as.tl” is your desired domainname like “heise.de” e.g. It will give you a list of responsible nameservers of the associated registry which controls the topleveldomain. Pick one!

3.) dig @ns.anycast.nic.tl. as.tl

Do not forget to append your domainname again…you should now get a list of _your_ nameservers or the ones of your provider. If that works, the chosen nameserver “ns.anycast.nic.tl.” works and has valid records…you now have to cycle through all of them to find out if they are all synchronized!

I’m sure you can automate all this but I just wanted to give a straight “way” to walk through to find out if your registrys nameservers are well configured…

Hope it will help some day :P…

Posted 1 year ago
Latest Tweets