Saturday, May 19, 2012

Android - adb devices error device not found

I've been developing some basic android applications.  

After carrying out some testing using the emulator within eclipse I wanted to deploy the app to my phone so I could show to some customers.

You'd think it would be fairly straight forward, not so.  

Anyway  a little problem I came across was when I ran the command 

adb devices

From the platform-tools folder it was showing no devices attached even though I'd connected my phone and I'd set USB debug mode according to the android SDK how-tos.

I also tried to reboot the adb daemon with

adb reboot recovery

Again no joy

Finally I tried the following and it worked

adb kill-server
adb start-server

And finally adb devices listed my phone correctly


Monday, May 7, 2012

Different Domains For Same X-CART Admin Site

Recently I came across a problem where I needed to give users both internal and remote access to the admin features of an x-cart ecommerce site.

Basically in this instance we host the admin portion of the site on an internal server and the actual online store is hosted in two data centres one in Ireland and the other in the UK.

The problem I had, I wanted to use two different domains e.g.



http://intheoffice/admin
http://workingremote.yourdomain.com/admin


The problem with earlier versions of x-cart is that you can only assign a single domain name to the one installation.

To do this you change
$xcart_http_host to point to the domain you wish to use

I was using WAMP on a Windows Server 2003 system

So to get around this, because I was using only the admin portion of the site

I knew the source code for the admin features would not change that often (if at all)

so I created two working directories


c:\webfolder\internal    // this is the directory that will contain code which will be executed from internal browser requests with http://intheoffice/admin



c:\webfolder\external    // this is the directory that will contain code which will be executed from external browser requests with http://workingremote.yourdomain.com/admin


I change the config.php in each code base to reflect the domain I'm serving


c:\webfolder\internal\config.php
$xcart_http_host = "http://intheoffice/admin";

c:\webfolder\external\config.php
$xcart_http_host = "http://workingremote.yourdomain.com/admin";

Then I configure httpd.conf in Apache under WAMP to serve content for different virtual hosts

Something like the following needs to be added

In my instance I was listening on port 8080 but you can use what ever you wish once its not already bound to another services on the windows system.

NameVirtualHost 192.168.0.33:8080


<VirtualHost 192.168.0.33:8080>
ServerName intheoffice

DocumentRoot "c:/webfolder/internal"
<Directory "c:/webfolder/internal">

allow from all
order allow,deny
AllowOverride All
</Directory>
</VirtualHost>

<VirtualHost 192.168.0.33:8080>
ServerName workingremote.yourdomain.com
DocumentRoot "c:/webfolder/external"
<Directory "c:/webfolder/external">
allow from all
order allow,deny
AllowOverride All
</Directory>
</VirtualHost>

Thursday, May 3, 2012

VMWARE Converter to create DR for Workstations In Remote Locations

Recently I've been working on a project that involves creating an easy to use, quick way to rebuild a workstation in the event of a hardware failure.

The environment is very different to your typical network environment in that the following characteristics hold true

1. There is no internet connection on this workstation.
2. The workstations work in a harsh environment on a network segment of their up
3. There is a manual procedure in place to allow you connect the workstation to a central company network where you can access central file shares etc.
4. This environment is replicated throughout the business at several locations each location been isolated as above.

You can use tools like Ghost or Symantec System Recovery however I came up with this easy to use option that meets with the requirements of my client.

Because each machine is an identical build, we have a central computer in head office which hosts all the pre-installed software i.e. Windows 7, business applications, business database etc.

From this we create a VM Image using VMWARE Converter and we save this image to a shared location.

From this shared location we copy this image to a USB drive or other portable storage device.

At each remote location we run Linux as the host operating system on each workstation, with VM Workstation on top

Simply connect in the USB storage device and locate the VM Image already created.

You may need to change configuration details in the VM Image configuration file. For example in our instance software on the system was  bound to specific MAC addresses. You can set these to a manual setting in the VM Image configuration file.

Below is a basic diagram of what it looks like



Wednesday, April 18, 2012

Basic Batch Script Backup MySQL Tables To Separate Files

This is a very crude example of how to use a windows batch script to backup each table within a mysql database to an individual sql file in a folder.

@ECHO OFF
FOR /F %%G IN ('"echo show tables | mysql -s -u user -ppassword mydatabase"')  DO mysqldump -s -u user --password=password mydatabase %%G > t:\mysqlbackup\tables\%%G.sql

Transfer XML Files Faster With No Data Loss


If you develop software solutions that require the transfer of large XML files between computer systems accross a distributed network or if you are developing software for devices with limited computational resources such as memory or available bandwidth, OpenEXI can substantially enhance the performance of your software.

What is OpenEXI?

OpenEXI is an open source Java implementation that provides tools you can use to transform XML files to Efficient XML Interchange (EIX) format and
back.

This transformation can be performed very quickly with no risk of data loss.

What is EXI?

EXI (Efficient XML Interchange) is a more concise method of describing XML documents.

To find out more please visit the OpenEXI web site http://openexi.sourceforge.net/

Or watch this quick introduction.


Tuesday, April 17, 2012

JBoss Stops Responding For Time Period


Somehting you will notice if you are running JBoss from behind a firewall is that it can take a long time to respond to some events.

This is becasue JBoss is trying to resolve external references to xsd files.

You should see messages similar to this in your log files

16:07:03,071 WARN  [JBossEntityResolver] Trying to resolve systemId as a non-file URL: http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd

To get around this and to speed things up you need to change the reference in persistence.xml to a local xsd file

Like this

Step 1:

Download persistence_2_0.xsd, and place it in your META-INF folder.

Step 2:

Change persistence.xml to point to local file reference

<persistence version="2.0"
 xmlns="http://java.sun.com/xml/ns/persistence"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="file://persistence_2_0.xsd
        http://java.sun.com/xml/ns/persistence">

Monday, April 16, 2012

First Comp, Good Weekend

A good enough weekend, didn't throw that well on Saturday but it was my first competition in a long time.

So can only get better.  Need a lot of work to improve my throwing technique

Its a great hobby outside computers.  Next event will be the Kerry County Masters on 27th May this year.

Anyway time to get back to the serious work.