b0j3 logo

electronics are back

0
Filed under Uncategorized

Some time ago I was programming microcontrollers eps. Atmel ones. Hey I even posted few instructables pages as AVR mini board with additional boards and pic 12f675 mini protoboard.

I think I was first or at least one of the first to use connectors like that (connecting directly to the breadboard).

I’m thinking about starting to play with electronics again. We’ll see. I have to check the market to see what changed from that time and there might be better connectors to use.
There is also problem of having PCB made, since I hate doing it myself.
But for the starts I need to get back to use Kicad EDA suit, again.

String to date conversion in Python

0
Filed under Uncategorized

Needed to convert date as a string to datetime format, so I did:

import time
import datetime
 
ret = time.strptime(indate_in_string,"%d-%m-%Y") #format of date is in the string
print datetime.date(ret.tm_year,ret.tm_mon, ret.tm_mday)

emacs, shortcuts and solution

0
Filed under Uncategorized

I’ve decided to start using Emacs … again. But on Mac this time.

 

Sure you have Aquamacs, but it wasn’t that stable for me. At the end I’ve decided to compile my own version of Emacs.

 

It’s really just a straight compilation of Emacs to support Cocoa GUI.

 

Since I use Slovene keyboard and mapping I had trouble inserting some characters regularly useful in programming or web page creation (e.g. {, [, \). Sure you can just copy&paste, but you still need to create at least first character.

And it’s a hassle. So I finally found the time to prepare .emacs file and include following:

 

(global-set-key (kbd "M-š") (kbd "["))
(global-set-key (kbd "M-Š") (kbd "{"))
(global-set-key (kbd "M-đ") (kbd "]"))
(global-set-key (kbd "M-Đ") (kbd "}"))
(global-set-key (kbd "M-ž") (kbd "\\"))
(global-set-key (kbd "M-Ž") (kbd "|"))
(global-set-key (kbd "M-ć") (kbd "^"))
(global-set-key (kbd "M-\"") (kbd "@"))

 

Enhanced by Zemanta

Blogging or not, here I come…

0
Filed under Uncategorized

I had … well I still have (not for long I hope) blog opened at Tumblr. It’s nice and everything, but I would like to have more control and also I’d like to add some marketing stuff, so I’ve decided to move all the blogs to me – using WordPress as a platform.

The funny thing is that I never learned php and tried to avoid it as a plague. Not sure if it is time for me too check php seriously, but I’ll still do Python as much as possible :)

Enhanced by Zemanta

Twitter and Follow Friday

0
Filed under general

Anybody using twitter knows the term: Follow Friday (#FF). It was Friday yesterday and I thought to do it a bit different.

Image representing Twitter as depicted in Crun...

Image via CrunchBase

I decided to write every recommendation in its own tweet with extensive (well in 140 chars) explanation why I recommend that person.

Interesting thing happened. Almost everybody who I recommended was pleased (well at least I hope   they were), but I lost one follower.

As he explained his decision was (my interpretation) that he’s fed up with that shit.

Apparently all the tweets seemed like spam to him.

Interesting.

Is there a deeper meaning to that or just a coincidence I don’t know? Was the problem that I was too nice to others or just too chatty?

Enhanced by Zemanta

Apache 2.2.17 & mod_proxy

0
Filed under webapps

So…you’ve did everything as advertised on other pages to get your proxy working, but the damn thing doesn’t work.

Been there… done that…

What was the problem?

Had to add only ProxyPass and ProxyPassReverse to enabled sites.

The important thing is to do setting in proxy.conf (in mods-enabled) according to comments in the file.

Mine settings are:

#ProxyRequests On
<Proxy *>
 AddDefaultCharset off
 Order deny,allow
 #Deny from all
 Allow from 127.0.0.1
</Proxy>

If you’ll try to add these settings to enabled sites instead of proxy.conf the proxy doesn’t work.

Let’s say vacation is over

0
Filed under general

Hopefully :D

In the meantime I tried other blogging platform (tumblr), but I somehow didn’t like it.

After some secret work I guess it’s time to come out.

Vacation time

0
Filed under general

Due to vacation I’m a bit of the schedule, but the more or less normal service will resume soon.
Maybe even using some other blogging tools/places

SugarCRM, SOAP, Python and ZSI

0
Filed under Uncategorized

Yeah I know, the title promises a mess of the subjects, but bear with me.

It makes sense.

First of all. Install SugarCRM – how to install it, you ask? Well, check the documentation for your favorite distribution and I guess it’ll “just work”.

The problem I have is that the CRM is written in PHP. I know it’s the next best thing after sliced bread, but I just don’t like it.

I prefer using Python for my programming ventures, but lately trying to enter the functional programming area, but that’s whole new thing and I won’t go into it (yet).

Therefore I’ve decided to just access the data from SugarCRM using MySQL and after checking the documentation I’ve found the SugarCRM can be access using SOAP.

And since I’ve used ZSI before – for SOAP access to the web services it was natural to try it with the SugarCRM.

Here are the results of the jury:

The simplest thing to try was login service, for which the WSDL file says:

<message name="loginRequest">
  <part name="user_auth" type="tns:user_auth"/>
  <part name="application_name" type="xsd:string"/>
</message>

and user_auth is ComplexType:

<xsd:complexType name="user_auth">
  <xsd:all>
    <xsd:element name="user_name" type="xsd:string"/>
    <xsd:element name="password" type="xsd:string"/>
    <xsd:element name="version" type="xsd:string"/>
  </xsd:all>
</xsd:complexType>

And the code to do it is following:

#-*- encoding: utf-8 -*-
import sys,md5
# call: python <script_name> -u <url_of_wsdl_file>
from optparse import OptionParser
from ZSI.ServiceProxy import ServiceProxy
op = OptionParser(usage="%prog [options]")
op.add_option("-u", "--url", help="service URL (mandatory)", metavar="URL")
options, args = op.parse_args()
if not options.url:
  op.print_help()
  sys.exit(1)
else:
  options.url = options.url.replace("?WSDL", "?wsdl")
  if not options.url.endswith("?wsdl"):
    options.url += "?wsdl"
  service = ServiceProxy(wsdl=options.url, tracefile=sys.stdout)
  print "Accessing service in SugarCRM, method login..."
  #password is md5 encoded
  passwrd = md5.new("user_password").hexdigest()
  auth = {"user_name":"insert_user_name","password":passwrd,"version":"1.1"}
  resultDict = service.login(user_auth=auth,application_name="sugar_soap")
  id = resultDict["return"]["id"]
  print "session id=",id
  print "error=",resultDict["return"]["error"]

Ditching Django for web2py

0
Filed under python, web2py

Interesting things happening lately.

One of the main things is that I’m ditching Django for web2py and the reason is precisely the one I used to select Django.

Namely, I wanted to have free hands to do whatever I wanted and not to be constrained by the tool.

But lately I am venturing in SaaS business and other things became more important than web framework.

And there is another reason. I’ve installed version 1.2 and it broke backward compatibility and this is a huge NO NO for me so I started looking for other Python based web framework and came to the web2py which I looked before.

I love the constraints it gives me (go figure). You do it one way and that’s it.

Now I am free to try other things.

I really hope I’ll be able to write more about my web2py ventures.