sys.ora_mining_number
can be used to turn a set of numbers to a result set:
Friday, October 31, 2014
Little things that make live easier #2: sys.ora_mining_number_nt
Thursday, October 30, 2014
Is this a bug in the PL/SQL compiler
I still find this quite funny, so I had to post it on this blog!
Thursday, October 23, 2014
Creating psychedelic images with word and VBA
Shape
object of MS-Word can be used to insert pictures into word documents with VBA. If I insert a small picture and blow it up to use the entire page size, it creates a cool, almost psychedelic effect.
Here's the image: Its size is 20x30 pixels, approximately the aspect ratio of an A4 document.
The function, named main
needs a parameter, path
, that points to the location of the image:
First, we declare a variable for the image (background_image
), which is a shape
), then load an image and assign it to the variable:
Then, we need to place the image's top left corner on the page's top left corner:
Finally, we want the image to be behind the text in case we're going to write on it:
This VBA program should be saved into a file, for example backgroundImage.bas
. It can then be executed with a
The resulting word (or image) then looks like
runVBAFilesInOffice.vbs
.
Friday, October 17, 2014
Cloning a user in Oracle
First, I create a small schema with some simple grants:
The first user (a_user
) is needed to contain a few tables to test if grants to these tables will be cloned:
The second user (user_to_be_cloned
) is the user that I will actually duplicate:
I also need a role through which I will grant an object privilege:
Creating the mentioned tables:
Granting some privileges:
Now, I want an sql script that contains the necessary statements to clone the user. The following script uses the SQL*Plus spool
command to create the file (so it is designed to be run in SQL*Plus).
It also uses replace
a lot to change USER_TO_BE_CLONED
to CLONED_USER
.
The created script can now be used to create the cloned user. After logging on with CLONED_USER
you can verify that the grants are cloned, too, by trying to select from a_user.table_01
, a_user.table_02
and a_user.table_03
.
Thursday, October 9, 2014
How UBS cuts costs for finding solutions to their Big Data problems
Here's what it boils down to: UBS has lots of data and everybody talks about turning Big Data into Big Money. This is exactly what UBS want to to. The problem: UBS lacks the expertise and know how to tackle this kind of problem. After all, they're a bank. So, what can they do?
They could go to one of the many new Big Data consultancies that spring up like mushrooms these days and ask them for a solution. Yet, that is risky. How can a bank determine if such a consultancy is worth the money, especially in a field where those companies are relatively young. UBS could contact many consultancies. Of course, that will drive prices even higher. There must be a better way.
Indeed, UBS has found a better way. They do the UBS Innovation Challenge. Everybody can participate with ideas tailored to the UBS problem domain. UBS screens those ideas, selects a "best idea" and gives the winner SGD 40'000. There are additional costs, such as flights to Singapore and accomodations for the final participiants, but the costs for UBS are manageable.
So, UBS benefits in two ways: 1) They are presented with not only one or two ideas but with many ideas. 2) The costs for these ideas is known in advance.
Saturday, October 4, 2014
An open street map node density map for Switzerland
First, I create a table that contains the count of nodes per pixel. I fill this this table with a create table... as ...count(*).... group by
. The values for the variables a
through f
determine the aspect ration and the size of the resulting picture:
x
and y
are unique. This pair represents a pixel on the final image. cnt
is the number of nodes that fall into the area covered by a x
/y
pair.
After filling this table, I can iterate over each pixel and draw a color that is lighter for large pixel counts and darker for small pixel counts. I use the Python Image Library (import Image
) to draw the image.
Here's the result:
The same picture with a better resolution.
Wednesday, October 1, 2014
A Google Earth hiking map for the Säntis region with Open Street Map data
Additionally, I restricted the respective nodes to the lattitude longitude for the Säntis region.
These ways are kept in a specific table:
With this table, I can now extract the lattitude/longitude pairs for each node in the relevant ways and write them into a kml file.
The algorithm basically boils down to:
Here's a screen shot of the result: