473,395 Members | 1,462 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

A bit off topic, but good web hosting for PostgreSQL/Python?

Seems like most web hosting providers support MySQL, but not
PostgreSQL. I need a web hosting account that supports PostgreSQL for a
particular personal project I'm working on (as well as Python, natch),
since PostGIS runs only on PostgreSQL. PostGIS is a nice open source
spatial database extension to PostgreSQL that allows you to store
geometry in the database.

Couldn't find a good PostgreSQL newsgroup so I thought I'd ask here.
Did find one weird one named Mailing something or other, but that may
be a gateway to a e-mail distribution list.

Feb 25 '06 #1
8 2112
da*****@yahoo.com writes:
Seems like most web hosting providers support MySQL, but not
PostgreSQL.
There are actually many.

Two that I personally have experience with:
http://hub.org
http://bizintegrators.com

They both support PostgreSQL.

Not sure on their python support, but I believe they likely already have it
or would do mod_python for you.
Couldn't find a good PostgreSQL newsgroup so I thought I'd ask here.


The postgresql mailing lists are both active and very helpfull. Just check
the postgresql site for mailing list subscription info.
Feb 25 '06 #2
The string method isalpha() returns True when all characters in the
string are alphabetic. Unfortunately the underscore is not alphabetic.
A function that does what I need is:

def alfa_(w):
return "".join(w.split("_")).isalpha()

but for the kind of strings that I have this is about ten times
slower than isalpha() sec. Any suggestions ?
Thanks.
--
Egbert Bouwman - Keizersgracht 197 II - 1016 DS Amsterdam - 020 6257991
================================================== ======================
Feb 26 '06 #3
This is probably faster:

def alfa_(w):
return w.replace("_", "a").isalpha()
This is another solution, but it's probably slower, you can time it:

from string import letters
_setalpha = set(letters + "_")

def alfa_2(w):
return not (set(w) - _setalpha)

Bye,
bearophile

Feb 26 '06 #4
egbert <eg************@hccnet.nl> writes:
The string method isalpha() returns True when all characters in the
string are alphabetic. Unfortunately the underscore is not alphabetic.
A function that does what I need is:

def alfa_(w):
return "".join(w.split("_")).isalpha()

but for the kind of strings that I have this is about ten times
slower than isalpha() sec. Any suggestions ?
Thanks.


what about

def alfa_(w):
return w.isalpha() or w.find('_') != -1

? but yes it does scan `w' twice ..

You could also do something like:

def alfa_(w):
for c in w:
if not c.isalpha() and not c == '_':
return False
return True

--
lg
Feb 26 '06 #5

Zajcev Evgeny wrote:
egbert <eg************@hccnet.nl> writes:
The string method isalpha() returns True when all characters in the
string are alphabetic. Unfortunately the underscore is not alphabetic.
A function that does what I need is:

def alfa_(w):
return "".join(w.split("_")).isalpha()

but for the kind of strings that I have this is about ten times
slower than isalpha() sec. Any suggestions ?
Thanks.
what about

def alfa_(w):
return w.isalpha() or w.find('_') != -1


That returns True if 'w' contains an underscore. The spec is to return
True if 'w' contains *only* alphaebtical characters and '_'.

alfa('%^_*&')

would return True here.
? but yes it does scan `w' twice ..

You could also do something like:

def alfa_(w):
for c in w:
if not c.isalpha() and not c == '_':
return False
return True

Part of the problem is that the string method 'isalpha' is implemented
in C, and so will be quicker than any pure Python alternative.

The following will work, and probably only be twice as slow as
'isalpha' :-) :

def alfa(w):
return w.replace('_', '').isalpha()

Fuzzyman
http://www.voidspace.org.uk/python/index.shtml
--
lg


Feb 26 '06 #6
"Fuzzyman" <fu******@gmail.com> writes:
Zajcev Evgeny wrote:
egbert <eg************@hccnet.nl> writes:
> The string method isalpha() returns True when all characters in the
> string are alphabetic. Unfortunately the underscore is not alphabetic.
> A function that does what I need is:
>
> def alfa_(w):
> return "".join(w.split("_")).isalpha()
>
> but for the kind of strings that I have this is about ten times
> slower than isalpha() sec. Any suggestions ?
> Thanks.
what about

def alfa_(w):
return w.isalpha() or w.find('_') != -1


That returns True if 'w' contains an underscore. The spec is to return
True if 'w' contains *only* alphaebtical characters and '_'.


true, my fault :-< !
alfa('%^_*&')

would return True here.
? but yes it does scan `w' twice ..

You could also do something like:

def alfa_(w):
for c in w:
if not c.isalpha() and not c == '_':
return False
return True

Part of the problem is that the string method 'isalpha' is implemented
in C, and so will be quicker than any pure Python alternative.


I've been suspecting this ..
The following will work, and probably only be twice as slow as
'isalpha' :-) :

def alfa(w):
return w.replace('_', '').isalpha()


Yeah, great performance indeed, thanks!

--
lg
Feb 26 '06 #7
Zajcev Evgeny <ze***@yandex.ru> wrote:
...
The following will work, and probably only be twice as slow as
'isalpha' :-) :

def alfa(w):
return w.replace('_', '').isalpha()


Yeah, great performance indeed, thanks!


Except it rejects a w that's JUST an underscore, while it would accept a
w that's just a letter, which seems weird to me. Using 'a' as the
second argument of the replace call, as somebody else suggested, appears
to produce a more sensible uniformity.
Alex
Feb 26 '06 #8
In the discussion about isalpha()_mutants that accept
underscores as well, we did not talk about regular expressions.

Afterwards I did some timings.
My first observation was that the whole experiment is rather futile,
because it takes only about a second to do a million tests.
If you take the trouble to collect a million words,
you might as well spend an extra second to analyze them.

Apart from that, a simple regular expression is often faster
than a test with replace. The last one, replace, does better
with shorter tokens without underscores. Nothing to replace.
Regular expressions are less sensitive to the length of the tokens.
Regular expressions are not monsters of inefficiency.

This is my script:

#!/usr/bin/env python
import sys
from timeit import Timer

import re
pat = re.compile(r'^[a-zA-Z_]+$')

if len(sys.argv) > 1:
token = sys.argv[1]
else:
token = "contains_underscore"

t = Timer("''.join(token.split('_')).isalpha()", "from __main__ import token")
print t.timeit() # 1.94

t = Timer("token.replace('_','X').isalpha()", "from __main__ import token")
print t.timeit() # 1.36

t = Timer("pat.search(token)", "from __main__ import token, pat")
print t.timeit() # 1.18

t = Timer("token.isalpha()", "from __main__ import token")
print t.timeit() # 0.28

#egbert

--
Egbert Bouwman - Keizersgracht 197 II - 1016 DS Amsterdam - 020 6257991
================================================== ======================
Mar 1 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: W. Borgert | last post by:
Hi, I'm not new to Python, but new to databases and PostgreSQL. I like to write a PostgreSQL client application (not code running inside of the RDBMS), and Debian has four modules: ...
1
by: Mateusz [PEYN] Adamus | last post by:
Hi I'm a developer currently wondering which DB choose for my next project. I looked on the net found ofcourse Oracle but also came up with PostgreSQL. I heard quite few things about it, all...
0
by: B.r.K.o.N.j.A. | last post by:
I'm looking for php5 + postgresql 7.3 or higher shared hosting, I also need any kind of versioning system installed. Hosting must be located in europe and must have telephone support. The key here...
6
by: MaRcElO PeReIrA | last post by:
Hi guys, Do you know any web based bug tracker software that use PostgreSQL??? Somebody has told me about Mantis, but it use MySQL... and I resign to use that! :( Which is the best bug...
13
by: Erick Papadakis | last post by:
hello, i am a newbie to the pgsql world, so pls bear with a possibly stupid question. i want to test out pgsql but i only have a shared hosting account. is it possible to install pgsql without...
14
by: Manuel Tejada | last post by:
Hi My box: RedHat 9.0, Pentium III Recently I upgraded from PostgreSQL 7.3.2 to PostgreSQL 7.4.1. The PostgreSQL 7.3.2's rpms were installed from RehHat CDs The PostgreSQL 7.4.1's rpms I used...
0
by: Adam Smith | last post by:
Hello, I am attempting to compile postgresql from source with python enable. I have compiled & installed python on my machine according to the instruction, installation seems fine My Platform...
1
by: PAllen | last post by:
Hi all, I am trying to get rid of a few of my old MS Access applications and move them to PostgreSQL and Python/wxpython. Does anyone have any suggestions on the easiest way to learn to program...
4
by: walterbyrd | last post by:
According to hostmonster's list of features, they do support python. Does anybody have any experience with hostmonster?
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.