Posts Mentioning RSS Toggle Comment Threads | Keyboard Shortcuts

  • John 9:12 am on June 30, 2009 Permalink | Reply
    Tags: , , ,   

    Three Mobile On Linux Update 

    UPDATE: After installing three mobile on Fedora 11 I noticed that the DNS servers had changed. The new one are as follows

    DNS Server: 4.2.2.1,4.2.2.2

    One thing that I forgot to mention in my previous post about setting up mobile broadband on Fedora 11 is that three do not always set the correct DNS servers. This was annoying as it would appear that the connection was working however any attempt to access a website would timeout. In order to do so edit the connection via NetworkManager and add in the follow DNS server in the IPv4 tab.

    DNS Server: 172.31.76.69, 172.31.140.69

    The server addresses are comma seperated so you can add DNS server of your choice. I have used the DNS servers that Three normally set up you can use OpenDNS.

    Network Manager IPv4 Settings

     
  • John 7:21 pm on June 28, 2009 Permalink | Reply
    Tags: ASP.NET, , MVC,   

    Professional ASP.NET MVC 1.0 

    At work we have been looking at the ASP.NET MVC, model-view-controller, framework. After looking around at various different tutorials and articles we found a sample chapter from the wrox book Professional ASP.NET MVC 1.0. The sample chapter took the hello world example and create a full application. The application, NerdDinner is an application that allows you to create dinner parties and RSPV to them. The sample covers a lot of the functionality that is within ASP.NET MVC. The sample chapter can be found online at Wrox’s website with the source code hosted at codeplex.


    Professional ASP.NET MVC 1.0

    Reading though the sample chapter is a good way to get started with ASP.NET MVC as the chapter explains what it is doing in a easy to understand manor, but more importantly it explains why they are being done. The chapter is a comprehensive walk through of how to create the NerdDinner application. Throughout the chapter the authors provide titbits of useful information, for example the use of the repository pattern and dependency injection. Throughout the chapter the authors trying to enforce good coding practice and often make reference to test driven development which in a later chapter they go into more detail about, discussing different development techniques.

    The sample chapter is more than enough to get anyone started with ASP.NET MVC and follows the development process from start to finish including a section on unit testing the application. The following chapters delve into more detail about specific areas of the ASP.NET MVC framework. The second and third chapters go into detail about the MVC pattern, detailing its background and its use on the web. The chapter also provides an overview, albeit brief, of other frameworks that are available. Although their coverage was brief they were not mentioned as either superior or inferior rather just as alternatives to the ASP.NET MVC framework. This tone was subsequently repeated in the third chapter when the authors compare ASP.NET with WebForms to ASP.NET MVC. They often mention that MVC is not a replacement for WebForms rather it is a different approach. These two chapters are extremely useful as they allow you to make an informed decision whether ASP.NET MVC is the right choice for you.

    I’ve still to finish reading the rest of this book so I’ll update this post the more I read of it.

     
  • John 7:03 pm on June 20, 2009 Permalink | Reply
    Tags: , MSSQL, ,   

    Python and MSSQL 

    I have been playing about with django a fair bit over the last week. After written a small app with django I wanted to import some data from an existing MSSQL database. To get the data into the django model I created a seperate python script to perform the import. Below is a script to import data from a table compaines in a mssql data to a django model called Company. To connect to the mssql server I used the pymssql library.

    #!/usr/bin/env python
    import sys,os
    os.environ['DJANGO_SETTINGS_MODULE'] ='settings'
    # import the modules needed to start the import
    import pymssql
    from datetime import *
    import unicodedata
    from django.core.management import setup_environ
    import settings
    
    setup_environ(settings)
    
    #import the django models
    from apps.clients.models import *
    
    def importCompanies(conn):
    	cur = conn.cursor()
    	cur.execute("""SELECT
    			liCompanyPk,
    			szCompanyName
    		FROM companies""")
    	row = cur.fetchone()
    	while row:
    		company = Company()
    		company.pk = row[0]
    		company.Name = row[1]
    		company.save()
    		row = cur.fetchone()
    
    if len(sys.argv) != 5:
    	print 'data_import.py [server] [username] [password] [database]'
    else:
    	print 'host=%s, user=%s, password=%s, database=%s' % (sys.argv[1],sys.argv[2],sys.argv[3],sys.argv[4])
    	conn = pymssql.connect(host=sys.argv[1], user=sys.argv[2], password=sys.argv[3], database=sys.argv[4])
    	importCompanies(conn)
    	conn.close()
    

    After this I started to play around with pymssql I wanted a quick way to execute simple sql queries, not knowing of an linux alternative to the mysql console client I write another simple script to provide this basic functionality.

    #!/usr/bin/env python
    import sys,os
    import _mssql
    
    if len(sys.argv) != 5:
    	print 'data_import.py [server] [username] [password] [database]'
    else:
    	print 'host=%s, user=%s, password=%s, database=%s' % (sys.argv[1],sys.argv[2],sys.argv[3],sys.argv[4])
    	conn = _mssql.connect(server=sys.argv[1], user=sys.argv[2], password=sys.argv[3], database=sys.argv[4])
    	print '>',
    	cmd = raw_input()
    	while cmd != 'exit':
    		if cmd != '':
    			print cmd
    			try:
    				conn.execute_query(cmd)
    				for row in conn:
    					for i in range(0,( len(row) / 2 )):
    						print row[i],'|',
    					print ''
    			except _mssql.MssqlDatabaseException,e:
    				print e
    		print '>',
    		cmd = raw_input();
    
    	conn.close()
    

    You can download mssql_client.py here

    So after only using for python for a couple of weeks It’s definitely powerful and fun to code with. Now to try out for all of the libraries that provide bindings such as pysvn or pyldap.

     
  • John 9:33 pm on June 16, 2009 Permalink | Reply
    Tags: , ,   

    Fedora 11 and Mobile Broadband 

    When I was previously running F10 I managed to get my three mobile broadband setup without any hassle, which I conveniently forgot how to do when I install Fedora 11. After a quick search I found a comment on the redhat bugzilla. I have the ZTE MF622 usb modem from Three. Here the steps I followed to get it up and running.

    Install usb_modeswitch, this changes the device from a CD Drive to a usb modem.

    #as root
    yum install usb_modeswitch
    

    Edit the /etc/usb_modeswitch.conf and uncomment the section that related to your specific modem. This tells usb_modeswitch which modem you are using.

    # ZTE MF622 (aka "Onda MDC502HS")
    #
    # Contributor: "andylog"
    
    DefaultVendor=  0x19d2
    DefaultProduct= 0x2000
    
    TargetVendor=   0x19d2
    TargetProduct=  0x0002
    
    MessageEndpoint=0x04
    

    Now edit the udev rules to add a new line to automatically call the usb_modeswitch when the device is plugged in.

    vi /etc/udev/rules.d/70-persistent-cd.rules
    

    Append the following to the end of the file

    ACTION=="add", ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="2000",
    RUN+="/usr/bin/usb_modeswitch"
    

    Once this has been done run the following and then plug your modem in

    udevadm control --reload-rules
    

    You should now be ready to create a mobile broadband connection via NetworkManager.

     
    • r.eriksson 7:42 am on July 29, 2009 Permalink | Reply

      realy bad that fedora not have this mobile Brodband in fedora 11 frome the start

      • John 10:06 am on July 29, 2009 Permalink | Reply

        I noticed a new packaged come down the other day called mobile-broadband-providers. However there is still no support for mobile broadband for the UK users. Which is something that I’ll try and take a look at when get time.

    • x-rayman 12:15 am on November 7, 2009 Permalink | Reply

      I followed your guide but did you miss a step out? I found the device was not recognised by HAL in my case it was the ZTE MF627 dongle not the 622 so it could be that HAL is not up to date. The result was that I had no device in my NetworkManager settings!

      I found a useful post here http://forum.eeeuser.com/viewtopic.php?id=53171

      Which gives the HAL setup:

      GSM-07.07
      GSM-07.05
      modem

      Not certain if will help another lost 627 user out there. Final note 627 uses the 628+ (plus a load of other 62* numbers) settings in usb_switch even though it is not explicitly named.

    • Cachique 7:17 pm on December 22, 2009 Permalink | Reply

      Thanks for the guide. It worked like a charm.
      The only thing was that I used he next ZTE MF622 option instead of your suggestion.

  • John 5:04 pm on June 13, 2009 Permalink | Reply
    Tags: , ,   

    Fedora 11 is out, upgrade time 

    So Fedora 11 has been out for a little while now and I’m getting ready to upgrade. Previously I have tried using the upgrade facility however I normally end up having to perform a clean install. So now I’m currently backing up my home directories to my external storage ready to wipe everything and start again. Ill update how this goes.

    Update: Install was painless simple selecting of packages that wanted to install. However my internet connection was playing up which meant that it hung whilst trying to download packages from the net. Currently installing the nvidia packages from rpmfusion.

    Update Everything is up and running and I have restored all my data back on. A few problems and annoyances. There is a problem with the non-free nvidia driver. The only other annoyance is the System -> Preferences menu is not split into further sub menus which creates a menu that doesn’t fit on my screen. I have yet to have a proper play with everything else but so far it all looks good.

     
  • John 9:17 am on June 12, 2009 Permalink | Reply
    Tags: ,   

    Django and Python 

    I have recently started having a play about with django. After reading loads of about it and have a little play about with snowy (a django based note sync for tomboy). After getting used to coding in python I found django really quick to develop in. But the documentation is by far the best thing about the project. There’s loads of the stuff, and its brilliant. Its readable. Its completely unlike reading other tech documents. If this isn’t a good selling point for checking it out then I don’t know what is because RTFMing has never been so easy.

     
  • John 9:10 am on June 12, 2009 Permalink | Reply
    Tags: , , ,   

    Unit testing jQuery plugins with jqunit 

    Whilst creating a plugin for jquery, that would provide auto formatting for a textbox for numeric values, I was looking for a way to run the tests for confirm its functionality. After getting sick of running the tests manually the penny dropped that I could unit test the plugins functionality. After a little searching I came across jqunit that seems to fit the bill perfectly.

    The project is hosted over at google code. The tests them self run from a html file but the a template is provided with the jqunit library. The tests are simple to create and follow the jquery syntax style. Below is a smple test case with unit test

    var numericTestCase = new jqUnit.TestCase('jQuery.numeric - decimal',function(){
     /*setup*/
    
      },function(){
    
        /*teardown*/
    
    });
    numericTestCase.test('T1: Null Value ',function(){
        var txtInput = $("
    ");
        txtInput.numeric(true);
        txtInput.blur();
    
        jqUnit.equals(txtInput.val(),"0.00");
    });
    

    Tests can quickly be written to test the functionality of your code. With the testing being able to run form a single location it provides a quick an easy way to check your plugins work across multiple browsers, that is, as long as you have written the correct tests.

     
c
compose new post
j
next post/next comment
k
previous post/previous comment
r
reply
e
edit
o
show/hide comments
t
go to top
l
go to login
h
show/hide help
esc
cancel

Powered by Web Design Company Plugins