From info at egenix.com Wed Nov 19 09:56:22 2014 From: info at egenix.com (eGenix Team: M.-A. Lemburg) Date: Wed, 19 Nov 2014 09:56:22 +0100 Subject: [DB-SIG] ANN: eGenix mxODBC Connect 2.1.1 - Python Database Interface Message-ID: <546C5B36.3030202@egenix.com> ________________________________________________________________________ ANNOUNCING eGenix.com mxODBC Connect Python Database Interface Version 2.1.1 mxODBC Connect is our commercially supported client-server product for connecting Python applications to relational databases in a truly platform independent way. This announcement is also available on our web-site for online reading: http://www.egenix.com/company/news/eGenix-mxODBC-Connect-2.1.1-GA.html ________________________________________________________________________ INTRODUCTION The mxODBC Connect Database Interface for Python allows users to easily connect Python applications to all major databases on the market today in a highly portable, convenient and secure way. Python Database Connectivity the Easy Way ----------------------------------------- Unlike our mxODBC Python extension, mxODBC Connect is designed as client-server application, so you no longer need to find production quality ODBC drivers for all the platforms you target with your Python application. Instead you use an easy to install royalty-free Python client library which connects directly to the mxODBC Connect database server over the network. This makes mxODBC Connect a great basis for writing cross-platform multi-tier database applications and utilities in Python, especially if you run applications that need to communicate with databases such as MS SQL Server and MS Access, Oracle Database, IBM DB2 and Informix, Sybase ASE and Sybase Anywhere, MySQL, PostgreSQL, SAP MaxDB and many more, that run on Windows or Linux machines. Ideal for Database Driven Client Applications --------------------------------------------- By removing the need to install and configure ODBC drivers on the client side and dealing with complicated network setups for each set of drivers, mxODBC Connect greatly simplifies deployment of database driven client applications, while at the same time making the network communication between client and database server more efficient and more secure. For more information, please have a look at the mxODBC Connect product page, in particular, the full list of available features. For more information, please see the product page: http://www.egenix.com/products/python/mxODBCConnect/ ________________________________________________________________________ NEWS mxODBC Connect 2.1.0 is a patch level release of our successful mxODBC Connect product. We have put great emphasis on enhancing the TLS/SSL setup of the mxODBC Connect product, addressing recent attacks on SSLv3 and improving the security defaults. Security Enhancements --------------------- * Updated included eGenix pyOpenSSL to 0.13.6, which includes OpenSSL 1.0.1j and enables the TLS_FALLBACK_SCSV protection against protocol downgrade attacks. * OpenSSL cipher string list updated to use the best available ciphers in OpenSSL 1.0.1j per default and support perfect forward security. * OpenSSL context options setup to disallow weak protocol features. * Disabled SSLv3 for the mxODBC Connect Client in response to the recent POODLE attack on SSLv3. mxODBC Connect Client 2.1.1 will not be able to communicate with mxODBC Connect Server 2.1.0 and earlier when using SSL mode. The error message looks like this: [Error] [('SSL routines', 'SSL23_GET_SERVER_HELLO', 'unsupported protocol')] (using pyOpenSSL) or [SSLError] [Errno 1] _ssl.c:493: error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number (using the ssl module). * Enabled TLS v1, v1.1 and v1.2 for the mxODBC Connect Server in SSL mode and have it use the best possible protocol when talking to a client. The server will still support SSLv3 for backwards compatibility reasons, since older mxODBC Connect Clients only support SSLv3. This will be changed in the next major/minor mxODBC Connect Server release. * Fixed a linker setting on Linux to have the mxODBC Connect Server use the embedded OpenSSL libraries instead of the system ones. * Improved the protocol handlers for SSL connection setups using mixed plain text/TLS connections to renew the session id after having established the TLS session. mxODBC Connect Enhancements --------------------------- * Fixed a problem where connection/cursor.messages could not be accessed from the client side. * mxODBC Connect Client is now also available as web installer, greatly simplifying the installation of the client. It is now possible to install the client using a single pip command: pip install egenix-mx-base egenix-mxodbc-connect-client egenix-pyopenssl * Upgraded eGenix PyRun used for mxODBC Connect Server on Linux to 2.0.1. * Upgraded the Python version used for mxODBC Connect Server on Windows to 2.7.8. Asynchronous Processing ----------------------- * Fixed a problem which prevented the mxODBC Connect Client to connect to the server when using both gevent integration and the Python ssl module for communication. mxODBC API Enhancements ----------------------- * Upgraded the mxODBC Connect Server to mxODBC 3.3.1. SQL Server * Documented a solution for a problem with the SQL Server 2012 parser complaining about not being able to deduce types of some operations using more than one bound variable, e.g. "col1 >= ? + ?". Teradata * Improved the Teradata ODBC driver setup instructions to address some common gotchas when setting up mxODBC to work with these drivers. * Fixed a problem with Teradata and the test suite which resulted in an error "[Teradata][ODBC Teradata Driver] Beyond SQL_ACTIVE_STATEMENTS limit". The driver needs an explicit call to cursor.flush() to close any open result sets before running commits or rollbacks. Misc * Fixed a problem in cursor.getcolattributes() that caused errors to be ignored. * Added better protection against ODBC driver bugs in getenvattr(). * Fixed an attribute error when using the NamespaceRowFactory function. * Fixed a deprecation warning when using the NamespaceRowFactory function. For the full set of changes, including those of the 2.1 series of mxODBC Connect, please check the mxODBC Connect change log: http://www.egenix.com/products/python/mxODBCConnect/changelog.html ________________________________________________________________________ UPGRADING You are encouraged to upgrade to this latest mxODBC Connect release. When upgrading, please always upgrade both the server and the client installations to the same version - even for patch level releases. We will give out 20% discount coupons for upgrade purchases going from mxODBC Connect Server 1.x to 2.1 and 50% coupons for upgrades from mxODBC 2.x to 2.1. Please contact the eGenix.com Sales Team (sales at egenix.com) with your existing license serials for details. Users of our stand-alone mxODBC product will have to purchase new licenses from our online shop in order to use mxODBC Connect. You can request free 30-day evaluation licenses by visiting our web-site or writing to sales at egenix.com, stating your name (or the name of the company) and the number of eval licenses that you need. http://www.egenix.com/products/python/mxODBCConnect/#Evaluation ________________________________________________________________________ DOWNLOADS The download archives as well as instructions for installation and configuration of the product can be found on the product page: http://www.egenix.com/products/python/mxODBCConnect/ If you want to try the package, jump straight to the download instructions: https://cms.egenix.com/products/python/mxODBCConnect/#Download Fully functional evaluation licenses for the mxODBC Connect Server are available free of charge: http://www.egenix.com/products/python/mxODBCConnect/#Evaluation mxODBC Connect Client is always free of charge. _______________________________________________________________________ SUPPORT Commercial support for this product is available from eGenix.com. Please see http://www.egenix.com/services/support/ for details about our support offerings. _______________________________________________________________________ INFORMATION About Python (http://www.python.org/): Python is an object-oriented Open Source programming language which runs on all modern platforms. By integrating ease-of-use, clarity in coding, enterprise application connectivity and rapid application design, Python establishes an ideal programming platform for today's IT challenges. About eGenix (http://www.egenix.com/): eGenix is a software project, consulting and product company focusing on expert project services and professional quality products for companies, Python users and developers. Enjoy, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2014) >>> Python Projects, Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope/Plone.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ 2014-11-11: Released eGenix pyOpenSSL 0.13.6 ... http://egenix.com/go64 ::::: Try our mxODBC.Connect Python Database Interface for free ! :::::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 http://www.egenix.com/company/contact/ From lucie at interworks.eu Thu Nov 20 10:52:52 2014 From: lucie at interworks.eu (Lucie Krennwallner) Date: Thu, 20 Nov 2014 10:52:52 +0100 Subject: [DB-SIG] Python: convert Hijri to Gregorian Date and vice versa Message-ID: Dear Mr Egli, online I found your Python code for Islamic & Gregorian Dates (https://mail.python.org/pipermail/db-sig/1997-December/000361.html) and wondered whether you might help me: I have python script (see below) that to translate Hijri Dates to Gregorian Date and vice versa. But the days might be off for about 1 day. eg gregorian date: 31/01/2013 is translated into Hirji date: 19-03-1434 instead of the correct 20-03-2013. My guess: there is a problem with leap years and last days of month and/or leap years. Python knowledge is not good enough to correct the code implement your suggestions. Would you kindly help me? Any tiny advice will be helpful! What do I have to change (add) to get the correct result? Thanks for any effort! All the best, Lucie Krennwallner Python Script modified from http://gersham-xbmc-repo.googlecode.com/svn/trunk/addons/script.islamic.prayer.times/resources/lib/Hijri.py 1) GREGORIAN DATE CONVERTED TO HIJRI DATES import math def intPart(floatNum): if floatNum < -0.0000001: return math.ceil(floatNum - 0.0000001) return math.floor(floatNum + 0.0000001) def Gregorian2Hijri(yr, mth, day): jd1 = intPart((1461 * (yr + 4800 + intPart((mth - 14) / 12.0))) / 4) jd2 = intPart((367 * (mth - 2 - 12 * (intPart((mth - 14) / 12.0)))) / 12) jd3 = intPart((3 * (intPart((yr + 4900 + intPart((mth - 14) / 12.0)) / 100))) / 4) jd = jd1 + jd2 - jd3 + day - 32075 l = jd - 1948440 + 10632 n = intPart((l - 1) /10631.0) l = l - 10631 * n + 354 j1 = (intPart((10985 - l) / 5316.0)) * (intPart((50 * l) / 17719.0)) j2 = (intPart(l / 5670.0)) * (intPart((43 * l) / 15238.0)) j = j1 + j2 l1 = (intPart((30 - j) / 15.0)) * (intPart((17719 * j) / 50.0)) l2 = (intPart(j / 16.0)) * (intPart((15238 * j) / 43.0)) l = l - l1 - l2 + 29 m = intPart((24 * l) / 709.0) y = 30 * n + j - 30 d = l - intPart((709 * m) / 24.0) yr = int(raw_input("Gegorian year: ")) mth= int(raw_input("Gegorian month: ")) day = int(raw_input("Gegorian day: ")) hi = Gregorian2Hijri(yr, mth, day) print hi 2) HIJRI DATE CONVERTED TO GREGORIAN DATES import math def intPart(floatNum): if floatNum < -0.0000001: return math.ceil(floatNum - 0.0000001) return math.floor(floatNum + 0.0000001) def Hijri2Gregorian(yr, mth, day): jd1 = intPart((11 * yr + 3) / 30.0) jd2 = intPart((mth - 1) / 2.0) jd = jd1 + 354 * yr + 30 * mth - jd2 + day + 1948440 - 385 l = jd + 68569 n = intPart((4 * l) / 146097.0) l = l - intPart((146097 * n + 3) / 4.0) i = intPart((4000 * (l + 1)) / 1461001.0) l = l - intPart((1461 * i) / 4.0) + 31 j = intPart((80 * l) / 2447.0) d = l - intPart((2447 * j) / 80.0) l = intPart(j / 11.0) m = j + 2 - 12 * l y = 100 * (n - 49) + i + l return y, m, d yr = int(raw_input("Provide year, like 1395: ")) mth = int(raw_input("Provide year, like 07: ")) day = int(raw_input("Provide year, like 12: ")) inp =Hijri2Gregorian(yr, mth, day) print inp Lucie Krennwallner | BI Consultant t: +44 (0)1202 373333 | m: +49 (0)176 328 324 62 We're Hiring! | Support | Blog | LinkedIn | Facebook [image: InterWorks Europe] Unit 1, Christchurch Business Park, Dorset, BH23 4FLCo Reg No 08368863 | VAT 154881290 -------------- next part -------------- An HTML attachment was scrubbed... URL: From mal at egenix.com Mon Nov 24 21:01:03 2014 From: mal at egenix.com (M.-A. Lemburg) Date: Mon, 24 Nov 2014 21:01:03 +0100 Subject: [DB-SIG] Python: convert Hijri to Gregorian Date and vice versa In-Reply-To: References: Message-ID: <54738E7F.5080904@egenix.com> Hello Lucie, this list is about relational databases, not date/time questions. You may get help on comp.lang.python or the Python tutor list: https://mail.python.org/mailman/listinfo/tutor BTW: The Hirji calendar is somewhat difficult to map to an algorithm, due to its reliance on (official) sightings of the moon. You are probably looking for a variant of the tabular Islamic calendar: http://en.wikipedia.org/wiki/Islamic_calendar For some interesting research on the subject, see: http://www.math.nus.edu.sg/aslaksen/calendar/islamic.html Thanks, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 24 2014) >>> Python Projects, Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope/Plone.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ 2014-11-19: Released mxODBC Connect 2.1.1 ... http://egenix.com/go65 2014-11-11: Released eGenix pyOpenSSL 0.13.6 ... http://egenix.com/go64 ::::: Try our mxODBC.Connect Python Database Interface for free ! :::::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 http://www.egenix.com/company/contact/ On 20.11.2014 10:52, Lucie Krennwallner wrote: > Dear Mr Egli, > > online I found your Python code for Islamic & Gregorian Dates > (https://mail.python.org/pipermail/db-sig/1997-December/000361.html) and > wondered whether you might help me: > > I have python script (see below) that to translate Hijri Dates to Gregorian > Date and vice versa. But the days might be off for about 1 day. > eg > gregorian date: 31/01/2013 is translated into > Hirji date: 19-03-1434 > instead of the correct 20-03-2013. > > My guess: there is a problem with leap years and last days of month and/or > leap years. > Python knowledge is not good enough to correct the code implement your > suggestions. > Would you kindly help me? Any tiny advice will be helpful! > What do I have to change (add) to get the correct result? > > Thanks for any effort! > > All the best, > Lucie Krennwallner > > > Python Script modified from > http://gersham-xbmc-repo.googlecode.com/svn/trunk/addons/script.islamic.prayer.times/resources/lib/Hijri.py > > > 1) GREGORIAN DATE CONVERTED TO HIJRI DATES > > import math > > def intPart(floatNum): > if floatNum < -0.0000001: return math.ceil(floatNum - 0.0000001) > return math.floor(floatNum + 0.0000001) > > > def Gregorian2Hijri(yr, mth, day): > > jd1 = intPart((1461 * (yr + 4800 + intPart((mth - 14) / 12.0))) / 4) > jd2 = intPart((367 * (mth - 2 - 12 * (intPart((mth - 14) / > 12.0)))) / 12) > jd3 = intPart((3 * (intPart((yr + 4900 + intPart((mth - 14) / > 12.0)) / 100))) / 4) > jd = jd1 + jd2 - jd3 + day - 32075 > > l = jd - 1948440 + 10632 > n = intPart((l - 1) /10631.0) > l = l - 10631 * n + 354 > > j1 = (intPart((10985 - l) / 5316.0)) * (intPart((50 * l) / 17719.0)) > j2 = (intPart(l / 5670.0)) * (intPart((43 * l) / 15238.0)) > j = j1 + j2 > > l1 = (intPart((30 - j) / 15.0)) * (intPart((17719 * j) / 50.0)) > l2 = (intPart(j / 16.0)) * (intPart((15238 * j) / 43.0)) > l = l - l1 - l2 + 29 > > > m = intPart((24 * l) / 709.0) > y = 30 * n + j - 30 > d = l - intPart((709 * m) / 24.0) > > > > yr = int(raw_input("Gegorian year: ")) > mth= int(raw_input("Gegorian month: ")) > day = int(raw_input("Gegorian day: ")) > hi = Gregorian2Hijri(yr, mth, day) > > print hi > > 2) HIJRI DATE CONVERTED TO GREGORIAN DATES > > import math > > def intPart(floatNum): > if floatNum < -0.0000001: return math.ceil(floatNum - 0.0000001) > return math.floor(floatNum + 0.0000001) > > def Hijri2Gregorian(yr, mth, day): > jd1 = intPart((11 * yr + 3) / 30.0) > jd2 = intPart((mth - 1) / 2.0) > jd = jd1 + 354 * yr + 30 * mth - jd2 + day + 1948440 - 385 > > > l = jd + 68569 > n = intPart((4 * l) / 146097.0) > l = l - intPart((146097 * n + 3) / 4.0) > i = intPart((4000 * (l + 1)) / 1461001.0) > l = l - intPart((1461 * i) / 4.0) + 31 > j = intPart((80 * l) / 2447.0) > d = l - intPart((2447 * j) / 80.0) > l = intPart(j / 11.0) > m = j + 2 - 12 * l > y = 100 * (n - 49) + i + l > return y, m, d > > yr = int(raw_input("Provide year, like 1395: ")) > mth = int(raw_input("Provide year, like 07: ")) > day = int(raw_input("Provide year, like 12: ")) > > inp =Hijri2Gregorian(yr, mth, day) > print inp > > > Lucie Krennwallner | BI Consultant > t: +44 (0)1202 373333 | m: +49 (0)176 328 324 62 > We're Hiring! | Support > | Blog | > LinkedIn | Facebook > [image: InterWorks Europe] > Unit 1, Christchurch Business Park, Dorset, BH23 > 4FLCo Reg No 08368863 | VAT 154881290 > > > > _______________________________________________ > DB-SIG maillist - DB-SIG at python.org > https://mail.python.org/mailman/listinfo/db-sig >