K!

by Karl Bunyan

Programming, PHP, JavaScript, .Net, motorbikes, pubs, poker, football, news, restaurants and anything else

Facebook
http://twitter.com/karlbunyan

Monday, December 29, 2008

Microsoft SQL Server text data column and PHP length problems

I've had this problem before: PHP truncates results from a SQL Server text field to 4096 characters. (This is running PHP under Apache on Windows.) To save myself having to work out the right Google terms again, this is the solution: change the following in php.ini (note that ini_set doesn't appear to work:

; Valid range 0 - 2147483647.  Default = 4096.
mssql.textlimit = 2147483647

; Valid range 0 - 2147483647.  Default = 4096.
mssql.textsize = 2147483647

Link to this post

Comments:

At work with sql files i usually use next software-sql server database repair,tool is free as far as i know,it repair data from corrupted databases in the MS SQL Server format (files with the *.mdf extension),supports data extraction via the local area network,can save recovered data as SQL scripts, it is also possible to split data into files of any size,compatible with all supported versions of Microsoft Windows, such as Windows 98, Windows Me, Windows NT 4.0, Windows 2000, Windows XP, Windows XP SP2, Windows 2003 Server, Windows Vista,tool supports the following database formats: Microsoft SQL Server 7.0, 2000, 2005,also can repair .mdf files of Microsoft SQL Server 2005, repair mdf file of Microsoft SQL Server 2005 (64-bit).

posted by Blogger Alex : March 26, 2009 4:11 PM

Post a Comment
Wednesday, December 17, 2008

Repeatable random numbers in JavaScript

Ever since programming BASIC on the Spectrum I'd wondered why it was possible to seed a "random" number generator. But then I found I wanted to do something that would produce repeatable results, but look like a random sequence. Strangely, although JavaScript alongs you to specify a seed for Math.random() the numbers that follow aren't a repeated sequence. I'm guessing the system clock comes into it.

So after some Googling for an equation to generate numbers I put together the following function. It works on a sequence of 2^32 numbers, in "random" order. (I believed the equation I found - I didn't test the completeness of it, but it looks pretty random to me.) So, just call Random.next() to get a decimal between 0 and 1, or pass in a range (lower,upper) and you get a random number between the two.

var Random = 
{
 seed : 12345,
 //Returns a random number between 0 and 1
 next : function(lower,upper)
 {
  var maxi = Math.pow(2,32);
  this.seed = (134775813 * (this.seed + 1))
     % maxi;
  var num = (this.seed) / maxi;
  if(typeof lower!='undefined')
  {
   var range = upper - lower;
   num *= range;
   num += lower;
  }
  return num;
 }
}

Set "Random.seed" to taste.

Link to this post

Comments:
Post a Comment
Tuesday, December 16, 2008

Firing JavaScript functions after a .Net AJAX request

I wanted to have a function called after data was returned to the page from a .Net AJAX call. (The idea was to fade out when you pressed "submit" and then redraw when data came back.) It turns out there are handy handlers already there to, erm, handle this:

Sys.WebForms.PageRequestManager.getInstance()
.add_beginRequest(StartRequestHandler);
Sys.WebForms.PageRequestManager.getInstance()
.add_endRequest(EndRequestHandler);

Those little nuggets add calls to your functions, and the functions themselves are:

function StartRequestHandler(sender,args)
{
}
function EndRequestHandler(sender, args)
{
}

Nice.

Link to this post

Comments:
Post a Comment
Wednesday, December 03, 2008

Near Athens - the island of Aegina

Whether the island is actually spelt Aegina or not I couldn't tell - it was spelt differently on every timetable and in every guidebook. But if fits for me.

We started off at Piraeus, the port that's virtually a suburb of Athens now, and went to "Gate 8" as directed and bought a ticket. We followed signs for the passenger terminal, thinking that it would be an ideal place to wait for the fast boat. How wrong we were. "Gate 8" was in fact a stretch of dock probably totalling about half a mile in length, if not more, from which about 15 boats departed. It was as much use as saying "your boat leaves from Spain" in terms of directions, and so we missed it by about 5 minutes while we were trying to find the right one. Still, it actually worked out for the better, as instead we caught a regular slow ferry (which is only just over an hour anyway) and got a much better view.

It was also a nice day, so there are some nice photos too:

Nothing seems amiss in this photo, does it? Apart from a boat name that consists mainly of symbols. No reason to be alarmed at all:

But this is the front. Thankfully, our Poseidon adventure didn't end up with our boat being upside down. Nor was there a Gene Hackman nor (and this would have been really bad) an Ernest Borgnine onboard:

The ship's mast, and a blue sky:

One of the main old boats we saw on our way out. Piraeus was a very busy port:

Maybe the other passengers were more freaked by getting on the Poseidon as the top deck was empty. Surprisingly, it was also the warmest deck on the boat (bar sitting inside, of course, which was thick with cigarette smoke, as the whole of Greece tends to be):

Looking back towards the mainland:

Leaving Piraeus behind in our wake:

Ann on the empty deck:

Blue sea and into the mountains which were all around with the craggy coastline:

A smaller island we passed on the way:

A view of Aegina island:

The port of Aegina town was rather small, and our large ferry very much stood out:

A strange fortified building in the town, possibly from the late 18th century, although some thought older:

We had an excellent lunch at one of the seafood restaurants next to the fish market. They attracted their fair share of rather well-fed stray cats, such as the one below:

A small stretch of beach on the island:

On the way back we saw God in the distance peeking out from behind a cloud:

As usual with that kind of excursion the journey was half the fun, but the island was quite a pleasant place to be, and provided excellent food (at a cheaper price) than Athens.

Link to this post

Comments:
Post a Comment
Monday, December 01, 2008

Athens - some modern stuff

Athens has a strange history of very ancient architecture, a bit of development with the Romans, and then not much for a very long period of time. Most of the city looks very 20th century, and not particularly well done at that. However there are a few large modern buildings. Unfortunately, somehow they don't seem particularly well integrated into the rest.

The New Acropolis Museum was supposed to be finished quite some time ago. A lot of the building structure seems finished but there are cables everywhere and the main entrance is fenced off for some reason I couldn't discern. (There's a side entrance.) The building is very late, yet there were no signs of anybody working on it to try and finish it off. Anyone else would attempt to finish the thing by getting more people working on it but I guess that's not the Greek way:

This is the current approach to the museum. It's currently free to get in, owing to it having nothing on display (unless you like looking at hanging electrical cables). Actually, there were a few displays, and the text was heavily laced with "give us our Elgin marbles back" messages. Really, though, it's just not a very nice building:

The other major modern pieces in Athens are obviously around the Olympic stadium. It was very desolate there and, although some of the structures are impressive, and the stadium roof itself quite elegant, there was a certain air of desolation. It starts with the arch structures by Santiago Calatrava:

The journey to the site on the metro made me think that perhaps the commute from central London to Stratford won't look so bad in 2012. The transport was good, but it certainly didn't feel like being in the heart of Athens. This is a plan of the Olympic site. :

The velodrome was another interesting structure, at least from the outside:

Some of the other structures were just existing ones given a new lease of life (apparently). They provided ample pigeon resting spots, as you can see from the piles of crap along the walkways:

The stadium with the mountains and clouds behind. Although London may be able to compete on venues the setting will be nothing like the same:

The stadium arch:

The stadium's huge roof structure anchors, with Ann providing scale:

The inside of one of those anchors:

And all the screws to hold it down. I couldn't work out how to loosen any, unfortunately:

This is one of the existing terraces, that of bird-crap-terrace fame:

The diagram of things that you can't do inside the Olympic complex area. I'm not sure if the giant green cross now means that you can do those things or not. I particularly liked the two descriptions for flags (one limiting the size of the flag, one the size of the pole) and the restriction on taking your pet budgie to watch any of the events:

There was also a large screen, but I have no idea what it was there for. I'm sure there was some use for it at the time:

I don't know if the area in front of the stadium is ever inhabitated now, but somehow I doubt if it's ever crowded:

The arch again, reflected in a pool:

More from inside the arch:

The site was interesting, but I can't see how this offers any kind of the legacy for the city that the Olympic organisers are always interested in. So far I've visited this and Barcelona and, although not perfect, the latter did seem to have had some effect on the surroundings. As I live about a mile away from the 2012 site I get a lot of the plans relating to the area through and I do think the London developments will make more of a difference once the games are gone than the few monumental structures that have been left behind in Athens.

Link to this post

Comments:
Post a Comment

Athens - various old stuff

Athens is full of old stuff. You can't help seeing it everywhere, and they can't help but finding it every time they want to build something. As a result, there are quite a few museums of old stuff, or places to wander around ruins. In fact, I'm sure you could just start building a museum anywhere and by the time you'd finished the foundations you'd have found enough to fill the museum anyway.

So, we saw museums, and ruins, and probably even some ruins of museums. Who knows. Some of them had vague promises of being open one day, or at least getting some exhibits togther. There was an admission fee for most of the old monuments, but since a 12 euro ticket covered all the main ones (including the Acropolis) and lasted for 5 days it was hardly a big lay-out. If you're really a cheapskate then you could just stand outside the gate and look in for free; most things are so big that they need to be seen from afar anyway. Certainly the forum was interesting from the outside alone.

The Panathenaic Stadium, which isn't actually an old thing but is a reconstruction of something old. You can't get into it though.

At one end of the Panathenaic Stadium, with the Olympic Rings. Although impressive I'm not sure it's used for anything and apparently the curves in the running track are too tight for modern races. I'm sure "It's a Knockout" could make use of it, though.

There were quite a few Byzantine churches around Athens. This one had an interesting belltower separate from the main body of the church:

A view of a Byzantine church inside the area of the Roman Forum:

The ruins of the gateway to the forum on a cloudy day:

The forum gateway on a much nicer day:

Inside the forum:

One of the many column capitals inside the forum grounds. A lot of the buildings have collapsed over time but there are fairly intact pieces still remaining:

The porch of the church inside the forum:

The ceiling of the church porch inside the forum area:

Ann at the forum:

One of the ancient carving things in the excellent National Archeological Museum, which I think was from Neolithic times. To me it looked like a Newcastle United supporter:

And one of the more amusing reliefs of two men being interrupted by a horse with an important message:

Another quaint little Byzantine church:

A view of the Temple of Hierocles from the direction of the Acropolis:

The east front of the Temple of Hierocles from inside the Agora complex:

One of the more interesting finds being a "wild" tortoise (if a tortoise can ever be described as wild) inside the grounds of the Agora:

The Temple of Hierocles is one of the best preserved in Athens and quite photogenic with it, particularly shown nestled within the greenery around the Agora:

It's still impressive close-up:

The ceiling of Temple of Hierocles:

Even though the temple isn't particularly high up there are still good views around and through:

A column showing some wear and tear:

The Temple of Heirocles in all its glory:

The main market building of the Agora is a reconstruction, and quite impressive too. There's a small(ish) museum inside which, I have to admit, I didn't pay too much attention too. I'd seen far too many old pots by this point so I just sat outside and admired the view for 10 minutes:

A column capital inside the Agora:

On the other side of the Acropolis from the Temple of Heirocles is Hadrian's Arch and the Temple of Olympian Zeus. The temple apparently took quite a few hundred years to build, mainly because no-one could be bothered, it seemed. (And why did we doubt the Olympics would be ready?) It wasn't until Hadrian came along that it was topped off and he also had an arch built for himself, shown below:

The temple must have been particularly impressive in its time as it was certainly the largest around. Only a handful of columns remain and even they're impressive enough:

This photo with Ann standing near one gives you an idea of just how big they are:

The temple with the Acropolis in the background:

Capital columns and the frieze:

A few columns stand alone or in pairs. I've no idea how half of it could fall down without bringing the rest with it, but I'm glad there's something left to see:

One of the last columns to collapse during a storm in the 19th century. Personally, the fact that a column hang around for the best part of 2000 years and then decided to fall over suddenly makes me slightly anxious about hanging around them on a windy day. This one also reminded me of an opened pack of rolos

So those are all the ancient monument warm-up acts out of the way. But, of course, the crowing glory of Athens is certainly the Acopolis itself. Don't worry, I'm coming to it soon enough. It's getting a whole post to itself.

Link to this post

Comments:
Post a Comment

Archive

Current Posts

Other links

Change the background image