tag:blogger.com,1999:blog-82225262024-03-13T22:58:12.660-06:00BatokSoftware Developer as a matter of factBatokhttp://www.blogger.com/profile/01896692220559183675noreply@blogger.comBlogger34125tag:blogger.com,1999:blog-8222526.post-32516707743532107642010-07-21T21:12:00.002-05:002010-07-21T21:16:30.062-05:00A brief guide to using virtualenv with wxpythonIf you are developing wxpython applications may be you can find ...<br /><br /><blockquote>Brief Guide to using virtualenv with wxpython</blockquote> useful.<br /><br />Albeit it's specific for python 2.7 and Mac OS X, some ideas can be used for other platforms and versions.<br /><br />Available at github <a href="http://bit.ly/bwdWCR">here</a>Batokhttp://www.blogger.com/profile/01896692220559183675noreply@blogger.com0tag:blogger.com,1999:blog-8222526.post-22637938215119036622009-02-27T19:08:00.002-06:002009-02-27T19:10:48.849-06:00Just a test of syntaxhighlighter in bloggerThis is just a test of syntaxhighlighter.<br /><br /><pre name="code" class="python"><br />from couchdb.schema import Document, View, IntegerField, TextField<br />from couchdb import Database<br /><br />map_fun = """<br />function(doc){<br /> emit(doc.name, doc.age);<br />}<br />"""<br />class Person(Document):<br /> name = TextField()<br /> age = IntegerField()<br /> by_name = View('people', map_fun)<br /><br />db = Database("http://127.0.0.1:5984/borrame")<br /><br /># to make a view permanent do this<br />from couchdb.design import ViewDefinition<br />ViewDefinition.sync_many(db, [Person.by_name])<br /><br />Person(name = "batok", age = 48).store(db)<br />Person(name = "rgalvan", age = 47).store(db)<br />Person(name = "robert", age = 30).store(db)<br /><br />for person in Person.by_name( db, limit = 3):<br /> print person.name, person.age<br /></pre>Batokhttp://www.blogger.com/profile/01896692220559183675noreply@blogger.com0tag:blogger.com,1999:blog-8222526.post-17407122363494006002008-12-22T16:18:00.003-06:002008-12-22T16:27:39.613-06:00Introducing blogcdbI have created a new project at github.<br /><br />It's blogcdb ( a blog engine that uses couchdb ).<br /><br />The blog engine is made with turbogears 2, a very good python web framework.<br /><br />Also uses dojo javascript framework for some fancy stuff. Dojo version 1.2.3 is included.<br /><br />To store blog posts, comments and attachments , the erlang based couchdb document database engine is used.<br /><br />Requirements:<br /><br />couchdb-python module by Christopher Lenz and Jan Lenhardt.<br />python 2.6<br />turbogears 2 : trunk version which also needs a lot of modules.<br />dojo 1.2.3 ( included ).<br />couchdb ( svn truk version ) available from apache software foundation.<br />erlang/otp<br />mozilla's spidermonkey.<br /><br />Get blogcdb at http://www.github.com/batok/blogcdbBatokhttp://www.blogger.com/profile/01896692220559183675noreply@blogger.com0tag:blogger.com,1999:blog-8222526.post-49618762564630636022008-12-10T14:45:00.005-06:002008-12-10T15:10:18.730-06:00A wxpython GUI interface to a blog.<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://lh6.ggpht.com/_-hyF8eAeQds/SUAuhvP7oUI/AAAAAAAAACY/LBUZO1lL7pY/s144/screenshot20081127210325191840.png"><img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 144px; height: 90px;" src="http://lh6.ggpht.com/_-hyF8eAeQds/SUAuhvP7oUI/AAAAAAAAACY/LBUZO1lL7pY/s144/screenshot20081127210325191840.png" border="0" alt="" /></a><br /><br />I have created a github project with the name <a href="http://github.com/batok/couchdb-wxpython/wikis">couchdb-wxpython</a>.<br /><br /><br />The project is a python script that uses:<br /><br />wxpython ( a python module for GUI which is cross-platform. It is a wrapper for wxwidgets ).<br /><br />couchdb , a document oriented database to store blogposts , comments and attachments.<br /><br /><br />The program can also take screenshots and store them as attachments into couchdb.Batokhttp://www.blogger.com/profile/01896692220559183675noreply@blogger.com0tag:blogger.com,1999:blog-8222526.post-89736572330527680992008-09-09T18:41:00.007-05:002008-10-08T23:48:04.327-05:00New attachment handling in couchdb-python moduleI've been trying out the new methods for the Database class in couchdb-python, in the svn repository.<br /><br />I tried put_attachment.<br /><br />Guess you already have a couchdb database called blog. To get a reference to the db you have to...<br /><br /><br />from couchdb.schema import *<br /><pre><br />class Post(Document):<br /> author = TextField()<br /> subject = TextField()<br /> content = TextField()<br /> tags = ListField( TextField() )<br /> comments = ListField( DictField(Schema.build(<br /> comment_author = TextField(),<br /> comment = TextField(),<br /> comment_date = DateTimeField()<br /> )))<br /> date = DateTimeField()<br /></pre><br /><br />from couchdb import Server<br />from datetime import datetime<br />import binascii<br />s = Server("http://127.0.0.1:5984/")<br />s.create("blog")<br />blog = s["blog"]<br />p = Post( author = "Me", subject = "Whatever for the subject ", content = "Any content",date = datetime.now(), tags = ["Python", "Couchdb", "Blog"])<br /><br />p.store(blog)<br /><br />f = open("apythonfile.py", "rb")<br />foo = binascii.b2a_base64(f.read()) # this convert the content of the file to a encode 64 string<br /><br />#put_attachment only works right now with an encoded string as I see and with a dictionary object for the document ( first parameter ) and not for a Document instance as used here , so...<br /><br /><br />blog = s["blog"]<br />adoc = blog[p.id] <br /><br />and finally call the method...<br /><br />blog.put_attachment( adoc, "apythonfile.py", foo, "text/python")<br /><br />#you can't do blog.put_attachment( p, "apythonfile.py", f, "text/python") which I taught by reading the doc inside the method.Batokhttp://www.blogger.com/profile/01896692220559183675noreply@blogger.com1tag:blogger.com,1999:blog-8222526.post-27762725900842671102008-07-18T17:08:00.005-05:002008-07-21T15:32:18.427-05:00Yet another python frameworks' "which one is best for my project"Python web frameworks ( or libraries ) which I have used for real world projects.<br /><br />1 - Zope 2 /Plone. This was the first one. Tal template system was nice to learn. Throw the web zope application server update is nice for designers but not for development ( despite I used cadaver webdav command line client which also uses vim ). In general, I didn't like Zope, because is not very pythonic.<br /><br />2 - Nevow. This came second after asking in IRC channels about a good one framework to use. A guy convinced me to try it. Nevow is the swiss army knife of the python web frameworks. You can do the impossible with it , but it's very complex for simple , business like endeavors.<br /><br />3 - After Nevow I gave Django a try and liked it. At the same time I gave Turbogears 1 a try after watching the wiki in 20 minutes screencast by TG's author Kevin Dangoor. Then I decided on embrace TG 1.<br /><br />4. When TG 1.0 felt short to one of my project expectations I decided to use Pylons which I liked a lot. The problem with Pylons is that , becoming another "swiss army knife" as Nevow, simple things were ackward to do.<br /><br />5 - Now it's time of a happy convergence : TG simplicity + Pylons , that is , Turbogears 2. So I have to say good bye to cherrypy , kid and sqlobject . Welcome Paste, gengshi, webob, sqlalchemy, toscawidgets, beaker, etc. At this very moment I think TG2 is "Easy Pylons".Batokhttp://www.blogger.com/profile/01896692220559183675noreply@blogger.com0tag:blogger.com,1999:blog-8222526.post-32059802866524496072007-06-18T17:55:00.000-05:002007-06-18T19:57:06.637-05:00Wxwidgets' messages in Spanish<span style="font-size:85%;">In a cpp wxwidgets app...<br /><br />1 - Within the source wxwidgets , there's a samples folder.<br /><br />2 - cd to samples folder , and then to calendar folder.<br /><br />3 - Add this line before the end of the wxApp class in calendar.cpp...<br /><br /><br />wxLocale m_locale;<br /><br />4 - Add these four at the beginning of the OnInit method of the inherited wxApp...<br /><br />if( m_locale.Init()){<br />m_locale.AddCatalog(wxT("es"));<br />m_locale.AddCatalogLookupPathPrefix( wxT("."));<br /><br />}<br /><br />5 - Compile the sample with ... make -f makefile.unx ( this in MacOSX or any Unix)<br /><br />6 - Do this if in MacOSX ...<br /><br />$ mkdir calendar.app<br />$ cd calendar.app<br />$ mkdir Contents<br />$ cd Contents<br />$ mkdir MacOS<br />$ cd MacOS<br />$ ln -s ../../../calendar calendar<br />$ cd ../../..<br />$ open calendar.app<br /><br />7 - If everything goes as expected days and months of the calendar widget get displayed in spanish.<br /><br />In you want to apply this in a <span style="font-weight: bold;">wxpython</span> program...<br /><br />1 - If you started your wxpython program with wx.PySimpleApp, ie ...<br />app = wx.PySimpleApp()<br /><br />2 - add these lines after that ...<br /><br />locale = wx.Locale()<br />if locale.Init(wx.LANGUAGE_DEFAULT , wx.LOCALE_LOAD_DEFAULT | wx.LOCALE_CONV_ENCODING ):<br /> locale.AddCatalog("es")<br /> locale.AddCatalogLookupPathPrefix(".")<br /><br /><br />3 - After this if your program , for example, uses wx.PreviewFrame, all messages in the frame and widgets will be displayed in Spanish!</span>Batokhttp://www.blogger.com/profile/01896692220559183675noreply@blogger.com0tag:blogger.com,1999:blog-8222526.post-51763028240469822862007-03-23T17:30:00.000-06:002007-03-23T17:41:09.527-06:00wxPython ArtProvider images mini browser<pre style="font-size: 1em"><br /><font color="#a020f0">import</font> wx<br /><font color="#804040"><b>class</b></font> <font color="#008080">MyFrame</font>(wx.Frame):<br /> <font color="#804040"><b>def</b></font> <font color="#008080">__init__</font>(self):<br /> title = "<font color="#ff00ff">wx.ART browser</font>"<br /> wx.Frame.__init__(self, None, -1, title, size = (200,300))<br /><br /> li = ["<font color="#ff00ff">wx.%s</font>" % x <font color="#804040"><b>for</b></font> x <font color="#804040"><b>in</b></font> dir(wx) <font color="#804040"><b>if</b></font> x.startswith("<font color="#ff00ff">ART</font>")]<br /><br /> lb = wx.ListBox(self, -1, choices = li, style=wx.LB_SINGLE)<br /> self.sb = wx.StaticBitmap(self, -1, wx.ArtProvider.GetBitmap(eval(li[0])))<br /><br /> sizer = wx.BoxSizer(wx.VERTICAL)<br /> sizer.Add(lb)<br /> sizer.Add( [ 20, 20 ] , 0, wx.ALIGN_CENTER|wx.ALL, 5 )<br /> sizer.Add(self.sb, wx.ALIGN_CENTER|wx.ALL, 5)<br /> self.SetSizer(sizer)<br /><br /> self.Bind(wx.EVT_LISTBOX, self.OnUpdateBitmap, lb)<br /><br /> <font color="#804040"><b>def</b></font> <font color="#008080">OnUpdateBitmap</font>(self, event):<br /> name = event.GetString()<br /> im = wx.ArtProvider.GetBitmap(eval(name))<br /> w, h = im.GetSize()<br /> self.sb.SetSize((w,h))<br /> self.sb.SetBitmap(im)<br /><br /><br />app = wx.PySimpleApp()<br />f = MyFrame()<br />f.Center()<br />f.Show()<br />app.MainLoop()<br /><br /></pre>Batokhttp://www.blogger.com/profile/01896692220559183675noreply@blogger.com1tag:blogger.com,1999:blog-8222526.post-1163726618089764302006-11-16T19:11:00.000-06:002006-11-16T19:23:38.100-06:00Scp of a screenshot ( using wxpython and paramiko )<span style="font-weight:bold;">Try this one.<br />This takes a screenshot and send it to a server using scp ( paramiko )<br />All you need is WxPython.</span><br /><br /><pre><br />import wx<br />import paramiko<br />import sys<br />from time import sleep<br /><br />class Screenshot(object):<br /> def __init__(self, filename = "snap.png"):<br /> self.filename = filename<br /> try:<br /> p = wx.GetDisplaySize()<br /> self.p = p<br /> bitmap = wx.EmptyBitmap( p.x, p.y)<br /> dc = wx.ScreenDC()<br /> memdc = wx.MemoryDC()<br /> memdc.SelectObject(bitmap)<br /> memdc.Blit(0,0, p.x, p.y, dc, 0,0)<br /> memdc.SelectObject(wx.NullBitmap)<br /> bitmap.SaveFile(filename, wx.BITMAP_TYPE_PNG )<br /> <br /> except:<br /> self.filename = ""<br /> <br />def main(): <br /> paramiko.util.log_to_file('snap.log')<br /> <br /> caption = u"Required data"<br /> path = "/var/www/html/screenshots" # change this to make it your default path<br /> hostname = "www.whateverdomain.com" # change this to make it your default targe host<br /> username = "batok" # change this to make it your default user<br /> port = 22 # change this to another port if necessary....<br /> <br /> app = wx.PySimpleApp()<br /> time_to_wait = wx.GetNumberFromUser(message = "Time", <br /> prompt = "Secs.",<br /> caption = "Enter Seconds to Wait...",<br /> value = 5,<br /> min = 5,<br /> max = 20,<br /> parent= None )<br /> try:<br /> tw = int(time_to_wait)<br /> except:<br /> sys.exit(-1)<br /> sleep( tw )<br /> try:<br /> wx.Bell()<br /> except:<br /> pass<br /> <br /> s_shot = Screenshot()<br /> <br /> filename = s_shot.filename<br /> if filename == "":<br /> sys.exit(-1)<br /> <br /> if wx.YES == wx.MessageBox("Do you want to see the screenshot/nreduced by the half ?", "Hey!", wx.YES_NO | wx.ICON_QUESTION):<br /> dlg = wx.Dialog(None,-1, "Your screenshot half the size")<br /> img = wx.Image("snap.png" , wx.BITMAP_TYPE_ANY)<br /> w = img.GetWidth()<br /> h = img.GetHeight()<br /> img2 = img.Scale(w/2,h/2)<br /> wx.StaticBitmap(dlg,-1, wx.BitmapFromImage(img2))<br /> dlg.Fit()<br /> dlg.Show()<br /> <br /> <br /> target = "%s/%s" % ( path, filename )<br /> wx.MessageBox("A %s X %s screenshot\nis at %s" % (s_shot.p.x, s_shot.p.y, filename ), "Hey!")<br /> hostname = wx.GetTextFromUser("Host", caption = caption , default_value=hostname)<br /> username = wx.GetTextFromUser("User Name", caption = caption , default_value=username)<br /> password = wx.GetPasswordFromUser("Password", caption = caption )<br /> s_target = wx.GetTextFromUser("Destination File", caption= caption, default_value = target)<br /> <br /> if "" in (hostname, username, s_target):<br /> wx.MessageBox("Mmmm... some required fields are empty", "Hey!")<br /> sys.exit(-1)<br /> <br /> # Now paramiko's stuff... a.k.a secure copy<br /> try:<br /> <br /> t = paramiko.Transport((hostname, port))<br /> t.use_compression(True)<br /> t.connect(username=username, password=password, hostkey=None)<br /> sftp = paramiko.SFTPClient.from_transport(t)<br /> data = open(filename, 'rb').read()<br /> sftp.open(s_target, 'wb').write(data)<br /> t.close()<br /> wx.MessageBox("The %s file was sent to server" % filename, "Hey!")<br /> <br /> except Exception, e:<br /> print e<br /> try:<br /> t.close()<br /> except:<br /> pass<br /> <br /> return<br /><br />if __name__ == "__main__":<br /> main()<br /></pre>Batokhttp://www.blogger.com/profile/01896692220559183675noreply@blogger.com0tag:blogger.com,1999:blog-8222526.post-1158792421931015432006-09-20T17:30:00.000-05:002006-09-20T17:47:01.950-05:00Turbogears and Genshi baby stepsThese are the baby steps for using Genshi template system in Turbogears.<br /><br />1 - In case you have not installed Genshi do....<br />easy_install Genshi<br /><br />2 - Create a new turbogears project with...<br />tg-admin quickstart genshibasic<br /><br />3 - Go to controllers.py in ./genshibasic/genshibasic directory<br /><br />add this to the Root class<br /><pre><br /> @expose(template="genshi:genshibasic.templates.genshi")<br /> def genshi(self):<br /> return dict(pretty="basic")<br /></pre><br /><br />4 - create a new template file ( genshi.html ) in the templates directory of the project.<br /><br />include this in genshi.html ...<br /><br /><html xmlns="http://www.w3.org/1999/xhtml"<br /> xmlns:py="http://genshi.edgewall.org/"<br /> lang="en"><br />pretty ${pretty}<br /></html><br /><br />5 - Start your project with<br /><br />python start-genshibasic.py<br /><br /><br />6 - Open your browser and type http://localhost:8080/genshi<br /><br />Enjoy!<br />The rest is to study carefully genshi documentation to be a black belt.Batokhttp://www.blogger.com/profile/01896692220559183675noreply@blogger.com1tag:blogger.com,1999:blog-8222526.post-1156973299659791502006-08-30T16:23:00.000-05:002006-08-30T16:42:26.116-05:00A snap of the screen in wxPython and scp afterwardsThis <span style="font-weight:bold;">python</span> program takes a snapshot of the screen, saving it to snap.png file, and copying the file via sftp to a server.<br /><br />Python 2.4 , Wxpython and paramiko are required.<br /><br /><br />---------------------------------------------------<br /><pre><br />import wx<br />import paramiko<br /><br />paramiko.util.log_to_file('snap.log')<br />filename = "snap.png"<br />app = wx.PySimpleApp()<br />p = wx.GetDisplaySize()<br />bitmap = wx.EmptyBitmap( p.x, p.y)<br />dc = wx.ScreenDC()<br />memdc = wx.MemoryDC()<br />memdc.SelectObject(bitmap)<br />memdc.Blit(0,0, p.x, p.y, dc, 0,0)<br />memdc.SelectObject(wx.NullBitmap)<br />bitmap.SaveFile(filename, wx.BITMAP_TYPE_PNG )<br />hostname = wx.GetTextFromUser("Host")<br />username = wx.GetTextFromUser("User Name")<br />password = wx.GetPasswordFromUser("Password")<br />port = 22<br /></pre><br />wx.MessageBox("A %s X %s snap of the screen\nis at %s" % (p.x, p.y, filename ), "Hey!")<br /><pre><br />try:<br /> t = paramiko.Transport((hostname, port))<br /> t.connect(username=username, password=password, hostkey=None)<br /> sftp = paramiko.SFTPClient.from_transport(t)<br /><br /> data = open(filename, 'rb').read()<br /> sftp.open(filename, 'wb').write(data)<br /><br /> t.close()<br /> wx.MessageBox("The %s file was sent to server" % filename, "Hey!")<br /><br />except Exception, e:<br /> print e<br /> try:<br /> t.close()<br /> except:<br /> pass<br /></pre>Batokhttp://www.blogger.com/profile/01896692220559183675noreply@blogger.com0tag:blogger.com,1999:blog-8222526.post-1156619756855167432006-08-26T14:15:00.000-05:002006-08-27T09:44:56.463-05:00A snap of the screen in wxPythonThis <span style="font-weight: bold;">python</span> program takes a snapshot of the screen.<br /><span style="font-weight: bold;">WxPython</span> is required.<br /><br />import wx<br />filename = "snap.png"<br />app = wx.PySimpleApp()<br />p = wx.GetDisplaySize()<br />bitmap = wx.EmptyBitmap( p.x, p.y)<br />dc = wx.ScreenDC()<br />memdc = wx.MemoryDC()<br />memdc.SelectObject(bitmap)<br />memdc.Blit(0,0, p.x, p.y, dc, 0,0)<br />memdc.SelectObject(wx.NullBitmap)<br />bitmap.SaveFile(filename, wx.BITMAP_TYPE_PNG )<br />wx.MessageBox("A %s X %s snap of the screen\nis at %s" % (p.x, p.y, filename ), "Hey!")Batokhttp://www.blogger.com/profile/01896692220559183675noreply@blogger.com0tag:blogger.com,1999:blog-8222526.post-1155939766293922422006-08-18T17:22:00.000-05:002006-08-18T17:22:46.296-05:00<a href='http://photos1.blogger.com/hello/110/1719/320/Snap031%202006081817_13_06.jpg'><img border='0' style='border:1px solid #000000; margin:2px' src='http://photos1.blogger.com/hello/110/1719/400/Snap031%202006081817_13_06.jpg'></a><br />vmware server win32 console <a href='http://picasa.google.com/blogger/' target='ext'><img src='http://photos1.blogger.com/pbp.gif' alt='Posted by Picasa' border='0' style='border:0px;padding:0px;background:transparent;' align='absmiddle'></a>Batokhttp://www.blogger.com/profile/01896692220559183675noreply@blogger.com0tag:blogger.com,1999:blog-8222526.post-1149351605311111752006-06-03T11:11:00.000-05:002006-06-03T11:20:05.346-05:00In search of the python web framework-Look no further, a good guy yell me at IRC.<br />Try Nevow.<br /><br />That was about a year and half.<br /><br />-If you are looking for a python based web framework try Nevow!, this guy insisted.<br /><br />There was no Turbogears or Django then, the very hyped framewords of these very days.<br /><br />TG and Django have good screencast and nice looking websites. Speaking about their features, well, they seem very well integrated. In the case of TG, an impressive tie of disperate projects. Django includes everything from the same project.<br /><br />Despite facts and popularity of the two, I still love the swiss army knife freedom and power of Nevow.Batokhttp://www.blogger.com/profile/01896692220559183675noreply@blogger.com0tag:blogger.com,1999:blog-8222526.post-1136320070228220052006-01-03T14:22:00.000-06:002006-01-03T14:30:25.580-06:00Nevow has nice features!<a href="http://divmod.org/trac/wiki/DivmodNevow">Nevow</a> , a python based web construction toolkit , has a lot of nice features, that deserve attention:<br /><br />1 - LivePage ( Ajax ).<br />2 - Canvas ( Flash to server ).<br />3 - XUL , the python way.<br />4 - Stan ( Python...ized XHTML )<br />5 - Formless ( automatic Form generation ).Batokhttp://www.blogger.com/profile/01896692220559183675noreply@blogger.com0tag:blogger.com,1999:blog-8222526.post-1124800808304783472005-08-23T07:36:00.000-05:002005-08-23T07:40:08.310-05:00Another one on wxPythonI've made a python class ( wxpython ) to dump the contents of a wx.Grid or wx.ListCtrl to an excel file.<br /><br />The class and a demo app is available at www.smartics.biz/site/descargas/index_html<br /><br />The messages of the class and the demo app are in spanish.Batokhttp://www.blogger.com/profile/01896692220559183675noreply@blogger.com1tag:blogger.com,1999:blog-8222526.post-1123879967083930682005-08-12T13:39:00.000-05:002005-08-12T15:52:47.130-05:00Swatch and sendxmpp to rescue!In these days there are lots of kids using hacking tools that try to log in via ssh.<br /><br />My servers are attacked every day in this way.<br /><br />I decided to add swatch to monitor log files.<br /><br />Also I installed sendxmpp to send xmpp messages ( jabber ) to my jabber server.<br /><br />The combination is great!<br /><br />Both tools, swatch and sendxmpp are written in Perl, and to be installed depend on other perl modules which are properly installed via cpan.Batokhttp://www.blogger.com/profile/01896692220559183675noreply@blogger.com0tag:blogger.com,1999:blog-8222526.post-1123650110419868182005-08-09T23:54:00.000-05:002005-08-10T00:01:50.426-05:00wxPython!wxPython , the marriage of wxWidgets and Python , is a very good option to develop multiplatform GUI apps.<br /><br />Windows installation is a matter of running and exe, and follow the wizard.<br /><br />For Mac OS X is a little bit trickier.<br /><br />And for Linux , depends on the distro. For fedora core 3 or 4 is about compiling RPM source files and then installing the resulting binary RPM files.Batokhttp://www.blogger.com/profile/01896692220559183675noreply@blogger.com0tag:blogger.com,1999:blog-8222526.post-1116961395055061292005-05-24T14:03:00.000-05:002005-05-24T14:03:15.096-05:00<a href='http://photos1.blogger.com/img/110/1719/320/desktop.jpg'><img border='0' style='border:1px solid #000000; margin:2px' src='http://photos1.blogger.com/img/110/1719/400/desktop.jpg'></a><br />my desktop <a href='http://www.hello.com/' target='ext'><img src='http://photos1.blogger.com/pbh.gif' alt='Posted by Hello' border='0' style='border:0px;padding:0px;background:transparent;' align='absmiddle'></a>Batokhttp://www.blogger.com/profile/01896692220559183675noreply@blogger.com0tag:blogger.com,1999:blog-8222526.post-1096770312613808402004-10-02T21:09:00.000-05:002004-10-02T21:25:12.613-05:00Tips for todayFedora core 2:
<br />
<br />Everything was ok with one of my customers. Each user accesing a dos based app from dosemu/freedos had been working smooth... until fedora core 2 arrived...
<br />
<br />Well the change from Xfree86 to X.org had its consequences. The new fedora user couldn't run the app as the other people ( which had Mandrake and Redhat 8 and 9 installed ).
<br />
<br />After several tries I decided to access the app from one of the RH9 users. So I did this bash script:
<br />
<br />#!/bin/sh
<br />
<br />FONTDIR=/home/blabla/dosemu/Xfonts
<br />cd $FONTDIR
<br />mkfontdir
<br />xset +fp $FONTDIR
<br />ssh user@machine "dosemu/xdosemu"
<br />
<br />
<br />
<br />.....
<br />
<br />Now the problem was with Squid...
<br />
<br />How to make a user access everything related to yahoo but nothing else ?
<br />
<br />The trick was editing the /etc/squid/squid.conf file by prepending the domain def in dstdomain directive with a . ( dot ) like this ...
<br />
<br />acl yahoouser src 192.168.0.152
<br />
<br />acl yahoo dstdomain .yahoo.com
<br />acl yahoo2 dstdomain .yimg.com
<br />http_access deny yahoouser !yahoo !yahoo2
<br />
<br />( See the . before yahoo.com and yimg.com )
<br />
<br />
<br />
<br />Batokhttp://www.blogger.com/profile/01896692220559183675noreply@blogger.com0tag:blogger.com,1999:blog-8222526.post-1096392397391406682004-09-28T12:26:00.000-05:002004-09-28T12:26:37.390-05:00<a href='http://photos1.blogger.com/img/110/1719/320/Snap022%202004092812_21_15.2.jpg'><img border='0' style='border:1px solid #000000; margin:2px' src='http://photos1.blogger.com/img/110/1719/400/Snap022%202004092812_21_15.jpg'></a><br />Introducing my dhcpf.conf file <a href='http://www.hello.com/' target='ext'><img src='http://photos1.blogger.com/pbh.gif' alt='Posted by Hello' border='0' style='border:0px;padding:0px;background:transparent;' align='absmiddle'></a>Batokhttp://www.blogger.com/profile/01896692220559183675noreply@blogger.com0tag:blogger.com,1999:blog-8222526.post-1096207245320647802004-09-26T08:46:00.000-05:002004-09-26T09:05:55.316-05:00One more on SquidOne example on configuring squid to let navigate user(s) only to selected places ( it needs Squid to be run on the machine which is resolving names <span style="font-style:italic;">[ may be using bind with resolv.conf pointing to 127.0.0.1 ]</span>. Once I tried this on a machine which was resolved by another one and the dstdomain feature didn't work ):
<br />
<br />acl myipaddress src 192.168.0.111
<br />acl firstdomain dstdomain www.oneallowed.com
<br />acl seconddomain dstdomain www.anotherallowed.com
<br />...
<br />...
<br />http_access deny myipaddress !firstdomain !seconddomain
<br />
<br />( this means , 192.168.0.111 can't access anything but www.oneallowed and www.anotherallowed ).
<br />
<br />Batokhttp://www.blogger.com/profile/01896692220559183675noreply@blogger.com0tag:blogger.com,1999:blog-8222526.post-1096047469312461832004-09-24T12:37:00.000-05:002004-09-24T12:37:49.313-05:00<a href='http://photos1.blogger.com/img/110/1719/320/Snap021%202004092412_38_01.jpg'><img border='0' style='border:1px solid #000000; margin:2px' src='http://photos1.blogger.com/img/110/1719/200/Snap021%202004092412_38_01.jpg'></a><br />Tks Robert for the help on Combos <a href='http://www.hello.com/' target='ext'><img src='http://photos1.blogger.com/pbh.gif' alt='Posted by Hello' border='0' style='border:0px;padding:0px;background:transparent;' align='absmiddle'></a>Batokhttp://www.blogger.com/profile/01896692220559183675noreply@blogger.com0tag:blogger.com,1999:blog-8222526.post-1096047104710281732004-09-24T12:31:00.000-05:002004-09-24T12:31:44.710-05:00<a href='http://photos1.blogger.com/img/110/1719/320/bk.jpg'><img border='0' style='border:1px solid #000000; margin:2px' src='http://photos1.blogger.com/img/110/1719/200/bk.jpg'></a><br />Ladies and Gentlemen: Bullwinkle <a href='http://www.hello.com/' target='ext'><img src='http://photos1.blogger.com/pbh.gif' alt='Posted by Hello' border='0' style='border:0px;padding:0px;background:transparent;' align='absmiddle'></a>Batokhttp://www.blogger.com/profile/01896692220559183675noreply@blogger.com0tag:blogger.com,1999:blog-8222526.post-1095986332183712132004-09-23T19:30:00.000-05:002004-09-23T19:38:52.183-05:00ScrewdriversOne pseudo-cop got my 6 screwdriver set at Mexico City International Airport just before departure:
<br />
<br />- You can't have these on the plane.
<br />
<br />- Why not, do I look like a terrorist or what?
<br />
<br />- No Mr. you don't. You have to go where the clerk is ( 2 miles away ).
<br />
<br />- Hey Pal, my plane is about to take off and I need to...
<br />
<br />- You must go where the clerk.
<br />
<br />Suddenly I looked over my shoulders and the screen displayed -- 5 minutes to go.
<br />
<br />- Mmm. Happy Birthday ( damn cop ) . This is my gift ( fk* asshole ).
<br />
<br />Goodbye screwdriver set :(
<br />
<br />Moral : "Never get a screwdriver set at Mexico City Airport"Batokhttp://www.blogger.com/profile/01896692220559183675noreply@blogger.com0