RSS Feed

RSS

Comments RSS

Python – very graphic! cont.

I must say, this has been a great experience trying out some graphical programming in Python. I looked at two different graphics packages for this exercise, Tk and PyGame. While Tk is very good for many graphical interfaces, particularly GUI, it did not provide what I needed most – the ability to do pixel by pixel plotting. Tk, does provide a “way” of doing it using the PhotoImage class, but it was rather cumbersome and felt like a workaround. So, I explored PyGame. It is a mature third party Python library specifically designed for graphical game design. It had exactly what I needed and was very straight forward. I simply wanted to create a display screen area and plot colored pixels to it corresponding to Mandelbrot Set. PyGame gave me exactly what I needed. Here is a series of pictures of the Mandelbrot Set. First, the full set. Second, an image zooming in on a region in the set. Third, zooming in even further. The fascinating thing about the Mandelbrot Set, and all fractal objects, is the the more you zoom in, the more detail you see – not less.

The Mandelbrot Set

Zooming in on the Mandelbrot set #1

Zooming in on the Mandelbrot Set #2

Python – Accessing Oracle Databases

Still learning the Python programming language here. However, along the way, I have found a need to branch out with some add-on modules for specific tasks. One of these is a module for accessing Oracle Databases. The module is cx_Oracle. Performing a query to an Oracle database become this simple process:

import the cx_Oracle module

import cx_Oracle

make your connection to the Oracle database

connection = cx_Oracle.connect(“username”,”password”,”oracle_instance”)

create an instance of the cursor

cursor = connection.cursor()

Perform a query. This demonstrates a simple select query, how to pass some user input as an argument to it, and how to do something something with the result.

user_input = str.upper(str(input(“Please provide value to query>>”)))

cursor.execute(“select some_field from some_table where some_field like :arg_1”, arg_1 = user_input)

for some_field in cursor:

print(some_field)

Learning Python

I have picked up learning to program in Python again.   Looking to add it to my trophy case along with BASIC, x86 Assembler, IBM BAL, Pascal, Modula-2, Forth and C.   In the process I have found some great resources, aside from the official Python website to share. The first two sites are excellent on-line books about programming in Python. The last two sites teach programming skills generally using Python as the example programming language.

A Byte of Python
Dive Into Python
Learning to Program
How to Think Like a Computer Scientist

More resources can be found on my Web Development and Programming page.

Shave Secret – WOW!

Ok, do not usually do this and certainly am not being paid to do it, but it is very seldom that a product I try on a whim that works out so well. I have always HATED shaving. Even the very best lubricated shaving gels did not prevent me getting pretty bad razor rash. I would not shave very often because of it, usually just once a week for church or otherwise on special occasions (like my wife insisting!). I was in Wal-Mart about two months ago and noticed a product called Shave Secret shaving oil. It is a little bottle and the product is a blend of oils. I bought it on a whim out of desperation for something that would work better than shaving cream or shaving gel. It works fantastically well! With it, I can shave daily and not be one constant case of razor rash and it leaves the skin refreshed, moisturized, and well conditioned. It can be found on-line at http://www.shavesecret.com. Oh, and it is a TEXAS product made by USA King’s Crossing, LLC.. Cuero, Texas.

A Romantic Dinner

It is my wife’s birthday today.  We are out of town in Houston and vacationing, away from the kids who are vacationing separately.  It is wonderful to finally be at that point in life where that is possible!  It has allowed for a nice romantic dinner tonight at Perry’s Steakhouse, a great fine dining experience.   We had an excellent dinner and I did what I wish I had done twenty years ago, get down on one knee in public and make a proper proposal.  Of course, we are already married, but I did next best thing.  I asked her if she had it to do all over again, would she still marry me?  I also asked her if she would renew our wedding vows with me later this summer when our 2oth wedding anniversary comes around.  I received a joyful affirmative on both counts!  My advice to any married couple, take the time to do the simple, romantic things.  Go out to dinner.  Tell each other often you love them.  Do not forget how to go out on a date.  Take time for each other, because a limited amount of time is all you have together.

A beautiful day!

What a beautiful day!   My wife and I went on a date today to Clark Gardens Botanical Park.   The gardens are located outside of Mineral Wells, TX which is about an hour from where we live.   We packed some fixings for sandwiches and a nice Muscat Canelli wine from Sister Creek Vineyards, one of our favorite wines.   The flowers were gorgeous and very fragrant.  The gardens exhibit a large variety of plant life, particularly flowers such as roses, iris, poppies, etc.  There is also a local contingent geese, guinea flow, swans, ducks, and peacocks.   As a bonus, if you are a fan of model trains, there is a brilliant set of G-scale model trains running in a section of the garden.  I highly recommend anyone take some time to visit this wonderful place.  Pack a lunch, take a loved one, and enjoy a great day out in the outdoors and the beauty of nature!

Incredibly deep fractal zoom

Mandelbrot Fractal Set Trip To e214 HD from teamfresh on Vimeo.

The final magnification is e.214. Want some perspective? a magnification of e.12 would increase the size of a particle to the same as the earths orbit! e.21 would make a particle look the same size as the milky way and e.42 would be equal to the universe. This zoom smashes all of them all away. If you were “actually” traveling into the fractal your speed would be faster than the speed of light.

I have been fascinated with fractals ever since the 1980’s when I was exposed to them in an issue of Scientific American in the Mathematical Recreations column.  I was a young programmer then and would devour the pseudo-code and algorithms found in that magazine.  I began working on writing my own Mandelbrot fractal program and with joy saw it appear on my screen. This was on an IBM XT 8088 clone with a Hercules graphics card and amber screen, so all I had was amber grayscale images, but it was still a thrill!  This was in such computationally ancient times that I had to write my own graphics primitives in assembler for use in the BASIC and Pascal programs because the graphics libraries were not available for my system configuration.   My programs took many hours to produce a single image on that old system.  The the video you are watching here demonstrates how far the science, art, and hardware available to produce these beautiful and intricate images has come.  Bravo!

adapted from the kottke.org blog

Khan Academy, awesome Internet educational resource!

I have found a truly awesome educational resource in the Internet, the Khan Academy.
Khan Academy

From the website:

The Khan Academy is a not-for-profit organization with the mission of providing a high quality education to anyone, anywhere.

We have 1000+ videos on YouTube covering everything from basic arithmetic and algebra to differential equations, physics, chemistry, biology and finance which have been recorded by Salman Khan.

I have viewed several of the teaching videos and they are excellent.  Done in a very nice “blackboard” style with Mr. Khan speaking, they are very much to the point and highly interesting.   The vast number of subject areas covered is impressive – most are mathematics and science related.  Done as individual lessons on very distinct topics, one can freely pick and choose any lesson as a stand alone tutorial or pull several together to build a curriculum.  I recommend this wonderful resource!

baby steps to getting healthier

Well, my day went pretty well with the eating. Kept it low cal and healthy during the day for breakfast, lunch, and intervening snacks. However, had a BIG supper as I was hungry. On the other hand, I will not do any late night eating. Nothing else for me other than zero cal drinkables until morning. Biggest goal of the day today was to not touch any candy or chocolate, SUCCESS on that one! 😀

I still need to get the calorie counting and exercise program going. I am beginning this with baby steps.

It’s a start.

Happy New Year, 2010!

Happy New Year, 2010! Here is wishing the best and blessings to everyone for the new year. 2009 was a year of challenges for me, but who grows without challenges? No regrets, but I do hope to do better in the new year. My aims are to reclaim my health, get back to living in a less haphazard way, and to devote more time to my family. Things I really enjoyed about 2009 were that I took on a new job at work, that I had more travel and vacation time with my wife, my activities with TAARC, I became politically active in a formal way, and that I discovered the SDF community. Here is to 2010. Cheers!

WA5PB Blog – vive la différence

While visiting many fellow SDF.org websites, and while chatting with users on this system, I have come to really appreciate its international nature. To celebrate the spirit of global diversity found on SDF, I have added Google Language Translation to my MOTD blog and am working to add it on my webpages. vive la différence!

The Star of Bethlehem

At this time of year, the nativity of Jesus Christ and the trappings of the Christmas holiday are much on the minds of many millions of believers. Very well, such is the tradition. I certainly would not cast aspersions upon the faith and traditions of so many, and hardly so as I was raised in these traditions as well and still enjoy them with my family to this day. However, as a believer, we are encouraged by the apostle Paul to “Prove all things; hold fast that which is good.” 1Th 5:21 This being the case, I would draw your attention to the highly unlikely nature of the date observed today to commemorate the incarnation birth of our Lord. It is known and recognised by most all that December 25 is surely not the true date but one adopted primarily from Roman culture, having previously been the date of the winter solstice Saturnalia festival and was picked as a transition from pagan Rome to Christian Rome under Constantine, and used to help establish Christianity as the state religion of the Roman Empire. The date stuck and is with us today! However, if this is not the real date of the birth of Jesus Christ, what is the correct date? Many say that it cannot truly be know. I disagree with this. I believe there is a preponderance of evidence that can surely give us a much better estimate of the date, if not the exact date itself. To this end, I would like to recommend a book to you that I believe to give a serious, and studied approach to the subject that takes into account what people of the era of Christ’s birth would have themselves known and understood. This approach is vitally important in any legitamate historical research as it is not our modern opinions that matter, it is what the people of the time in question knew, believed and understood. When we find clues into these things, then we find ourselves much closer to the truth. The book is The Start of Bethlehem, The Legacy of the Magi – by Michael R. Molnar. Michael Molar, astronomer and numismatist, gives an intriguing account of his chance discovery of a significant Roman coin and of his own research into the ancient astrology of the era to discern what it was that led the Magi to Bethlehem to find the new King of the Jews. What was the date they saw the Star of Bethlehem? April 17, 6 B.C. What was the “star”, why that date? Read the book. It is a very good read for those with scholarly and more casual interests alike. Here is the website:
Revealing the Star of Bethlehem

Regardless of the actual date of our Saviour’s birth, I still wish you a very Merry Christmas and hope the joy and peace of the knowledge of the birth of Jesus Christ enriches you throughout the year to come!