• Category Archives Technology
  • Technology and Software Development

  • Le Pan II tablet upgrade to ICS (Ice Cream Sandwich) the brute force method

    If you’re like my son, happily using his Le Pan II tablet because it sports awesome hardware and offers great performance. Unfortunately while trying many new programs from the google app store he was finding that many were NOT working. This lead to debate in the family as to whether or not the Motorola Xoom tablet was better than the Le Pan II simply because it did not create so many compatibility problems. Let me assure you the Le Pan II ia a great tablet and upgrading to ICS solved most of my sons compatibility issues while offering greatly improved performance (he was a happy camper).

    The process of upgrading to ICS however was NOT EASY and following the useless instructions from Le Pan was equally useless. For example when press Volume + and Power buttons we NEVER could get into fastboot mode, and selecting the ICS zip file from the tablets About / System update screen only gave signature invalid errors on reboot (hold the lock button to reboot back to normal mode if that happens).

    1. So first download the ICS firmware from:

    2. Unzip it in either Windows XP or higher (Yes thats right Le Pan only supports Windows for this update process, how evilly convenient) in your root of C:\

    3. In Control Panel (in Windows) select the Add new hardware option, select All or whatever option it takes so you can tell Windows to install from a disk, then navigate to the AnyData folder that is in the extracted folder in C:\ and Windows will install the Any Data driver (THIS IS REQUIRED AS IT ALLOWS DIRECT COMMUNICATION WITH THE TABLET VIA USB)

    4. Reboot your windows computer

    5. Ensure your tablet has Development USB mode enabled (not sure why but we had to do this or the Anydata driver did not find the tablet properly) and reboot the tablet

    6. Once the tablet has rebooted and is at the main screen, open a command prompt in your Windows Machine (make sure the tablet is connected via the usb cable) and enter the Extracted folder from step 2 but this time NOT the any data fodler but the other folder which contains a .cmd file (Release_LePanII_v406_Secured_Fused_06272012_user_fastboot). From this folder run:

    adb devices

    and you should see a device show up under the listing title. If not reinstall the USB driver and ensure the tablet has USB debugging enabled. NExt execute the following command from the windows command prompt:

    adb reboot bootloader

    You should see the tablet reboot in fastboot mode (the words fastboot mode display on the tablet in the top left corner within 30 seconds)

    from the same command prompt run:

    flash_all_with_new_partition.cmd

    When this command finishes your tablet will reboot and finish the ICS install (and will ask for system setting info on reboot)

    Done!


  • How to use libvlc in an open source application?

    For a while I was looking for a good open source cross platform library to use for video playback in my open source software. After a long while I finally found libvlc, which does the job well.

    If you want to see libvlc in action, with a wrapper class to play videos (local and streaming from youtube), compiled cross platform and integrated with OpenGL, check out the source code from here:

    http://megaglest.svn.sourceforge.net/viewvc/megaglest/trunk/source/shared_lib/sources/graphics/video_player.cpp?view=log


  • Freedom at last, Linux + MingW cross compiler’s endless possibilies

    Having worked on an RTS (real time strategy) open source game at sourceforge.net, I came across many challenges but also learned many things related to the world of open source. This article will attempt to discuss some of those things in the hope that the information helps other developers in the open source realm. I will attempt to share this in 2 parts, part 1 will be the ultimate way to freedom, while part 2 will discuss things encountered along the way and will act almost as a kind of story.

    Part 1: Cross compiling your C/C++ open source project in Linux, for Linux and Windows.

    The basic recipe that I used to accomplish this involves the following:

    – CodeBlocks IDE (you could likely use eclipse too)
    – MingW cross compiler
    – All the source code for your project (and its dependencies)
    – time (the precious commodity that everyone wants from you)

    For the first 2 items (CodeBlocks and MingW) got the following links:

    CodeBlocks
    MingW

    Now, a few things to keep in mind as you travel through the compilation process:

    – you MUST recompile all dll’s and libs within MingW (VC++ and other compilers are NOT compatible with MingW)

    Take for example compiling OpenAL (Open Audio Library) from Creative that many open source projects use. Compiling this library includes a few challenges, including the need to fix dsound.h from the DirectX SDK to compile with MingW.

    edit dsound.h and comment out line 1899:

    //typedef struct IDirectSoundFullDuplex *LPDIRECTSOUNDFULLDUPLEX;

    next edit the file included in the OpenAL SDK named XCompile.txt so its looks something like the following:

    # Cross-compiling requires CMake 2.6 or newer. To cross-compile, first modify
    # this file to set the proper settings and paths. Then use it from build/ like:
    # cmake .. -DCMAKE_TOOLCHAIN_FILE=../XCompile.txt \
    #          -DCMAKE_INSTALL_PREFIX=/usr/mingw32/mingw
    # If you already have a toolchain file setup, you may use that instead of this
    # file.

    # the name of the target operating system
    SET(CMAKE_SYSTEM_NAME Windows)

    # which compilers to use for C and C++
    SET(CMAKE_C_COMPILER i586-mingw32msvc-gcc)
    SET(CMAKE_CXX_COMPILER i586-mingw32msvc-g++)

    # here is the target environment located
    SET(CMAKE_FIND_ROOT_PATH /usr/i586-mingw32msvc)

    # adjust the default behaviour of the FIND_XXX() commands:
    # search headers and libraries in the target environment, search
    # programs in the host environment
    set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
    set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
    set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

    Next edit CMakeLists.txt to tell it where to find your DirectX SDK files adding something like the following BEFORE the section:

    # Check DSound/MMSystem backend
    IF(DSOUND)

    Add the following:

    SET (DXSDK_DIR "/home/softcoder/Code/megaglest/trunk/source/win32_deps/Microsoft DirectX SDK (November 2007)")
    SET(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} "${DXSDK_DIR}/Include")
    INCLUDE_DIRECTORIES("${DXSDK_DIR}/Include")
    LINK_DIRECTORIES("${DXSDK_DIR}/Lib")

    Next run cmake to produce the makefiles for OpenAL which should now properly find direct sound from DirectX:

    cmake .. -DCMAKE_TOOLCHAIN_FILE=../XCompile.txt -DCMAKE_INSTALL_PREFIX=/usr/i586-mingw32msvc

    make

    after running this you should get OpenAL lib’s / DLL’s produced for MingW.

    As a general rule you simply need to point the compiler etc.. the MingW’s and any dependencies need to find your MingW compiled libs.

    For example Compiling lobogg and libvorbis:

    ./configure --host=i586-mingw32msvc --build=i686-pc-linux-gnu --enable-shared --disable-static --libdir=./lib

    make

    LDFLAGS="-L/home/softcoder/Code/megaglest/trunk/source/win32_deps/lib" ./configure --host=i586-mingw32msvc --enable-shared --disable-static --with-ogg-libraries=../lib --with-ogg-includes=../libogg-1.2.1/include

    make

    What should you do if you get lots of:

    undefined reference to x

    linker errors? This typically means you need to order the libs in your project in proper order! Here’s an example from my codeblocks project file (the order does matter):

    <Linker>
              <Add option="-Wl,-subsystem,console" />
              <Add option="-mconsole" />
              <Add library="mingw32" />
              <Add library="ddraw" />
              <Add library="dsound" />
              <Add library="dxguid" />
              <Add library="ws2_32" />
              <Add library="iphlpapi" />
              <Add library="wsock32" />
              <Add library="liblibogg" />
              <Add library="liblibvorbis" />
              <Add library="liblibvorbisfile" />
              <Add library="zlib" />
              <Add library="jpeg" />
              <Add library="liblibpng" />
              <Add library="xerces-c" />
              <Add library="OpenAL32" />
              <Add library="liblibcurl" />
              <Add library="winmm" />
              <Add library="gdi32" />
              <Add library="opengl32" />
              <Add library="glu32" />
              <Add library="SDL" />
              <Add library="SDLmain" />
              <Add library="lua5.1" />
              <Add library="streflop" />
              <Add library="glest" />
              <Add directory="../../source/win32_deps/lib" />
              <Add directory="../../source/win32_deps/xerces-c-src_2_8_0/lib" />
    </Linker>

    Also what should you do if you program always produces stdout.txt and stderror.txt even though the application is a console application? It appears that this can happen due ti SDL taking convtrol of these streams. You can recompile SDL with:

    ./configure --disable-stdio-redirect

    For more details check out: here

    Another item that caused trouble was wxWidgets. I kept getting the following error after running configure:

    ./configure --target=i586-mingw32msvc --host=i586-mingw32msvc

    /home/softcoder/Code/megaglest/trunk/source/win32_deps/wxWidgets-2.8.10/bk-deps i586-mingw32msvc-gcc -c -o wxexpat_xmlparse.o -I./src/expat   -I/home/softcoder/Code/megaglest/trunk/source/win32_deps/wxWidgets-2.8.10/lib/wx/include/i586-mingw32msvc-msw-ansi-release-2.8 -I./include -mthreads -Wall -Wundef -O2 -fno-strict-aliasing -mthreads ./src/expat/lib/xmlparse.c
    ./src/expat/lib/xmlparse.c:97:2: error: #error memmove does not exist on this platform, nor is a substitute available
    ./src/expat/lib/xmlparse.c: In function ‘XML_SetEncoding’:
    ./src/expat/lib/xmlparse.c:888: error: ‘isParamEntity’ undeclared (first use in this function)
    ./src/expat/lib/xmlparse.c:888: error: (Each undeclared identifier is reported only once
    ./src/expat/lib/xmlparse.c:888: error: for each function it appears in.)
    ./src/expat/lib/xmlparse.c:888: error: ‘externalParEntInitProcessor’ undeclared (first use in this function)
    ./src/expat/lib/xmlparse.c: In function ‘XML_SetReturnNSTriplet’:
    ./src/expat/lib/xmlparse.c:1110: error: ‘isParamEntity’ undeclared (first use in this function)
    ./src/expat/lib/xmlparse.c:1110: error: ‘externalParEntInitProcessor’ undeclared (first use in this function)
    ./src/expat/lib/xmlparse.c: In function ‘XML_SetParamEntityParsing’:
    ./src/expat/lib/xmlparse.c:1362: error: ‘isParamEntity’ undeclared (first use in this function)
    ./src/expat/lib/xmlparse.c:1362: error: ‘externalParEntInitProcessor’ undeclared (first use in this function)
    make: *** [wxexpat_xmlparse.o] Error 1

    To fix this issue I had to edit the configure script and add the following:

    ORIGINAL:

    OPTIMISE_CFLAGS=
    if test "$wxUSE_OPTIMISE" = "no" ; then
        if test "$GCC" = yes ; then
                            OPTIMISE_CFLAGS="-O0"
        fi
    else
        if test "$GCC" = yes ; then
            case "${host}" in
                *-pc-os2_emx | *-pc-os2-emx )
                                                    OPTIMISE_CFLAGS="-O2"
                ;;
                *)
                                                                    OPTIMISE_CFLAGS="-O2 -fno-strict-aliasing"
                ;;
            esac
        else
            OPTIMISE_CFLAGS="-O"
        fi
    fi

    FIXED:

    OPTIMISE_CFLAGS=
    if test "$wxUSE_OPTIMISE" = "no" ; then
        if test "$GCC" = yes ; then
                            OPTIMISE_CFLAGS="-O0"
        fi
    else
        if test "$GCC" = yes ; then
            case "${host}" in
                *-pc-os2_emx | *-pc-os2-emx )
                                                    OPTIMISE_CFLAGS="-O2"
                ;;
                *-*-cygwin* | *-*-mingw32* )
                    OPTIMISE_CFLAGS="-O2 -fno-strict-aliasing -DHAVE_MEMMOVE=1 -DXML_DTD"
    
                    echo "=====================> MingW Fix Setup"
                ;;
    
                *)
                                                                    OPTIMISE_CFLAGS="-O2 -fno-strict-aliasing"
                ;;
            esac
        else
            OPTIMISE_CFLAGS="-O"
        fi
    fi

    I re-ran configure and then make compiled everything properly.

    For my project I successfully compiled:

    xerces-c
    lua5.1
    sdl
    opengl
    curl
    openal
    libpng
    jpeg
    zlib
    libogg
    libvorbis


    Part 2: Why is it a good idea to cross compile?

    If your software supports multiple platforms (like many “good” open source projects do), then you already know the answer. It can be a very tedious task to try to maintain code for multiple platforms especially if you cannot easily, quickly compile your code changes for the target platform in one development environment (and operating system). Some people use Virtual Machine Software (Like the highly recommended Virtual Box) but even this approach often leaves you feeling dirty, having to load up some version of Windows in your VM (assuming of course that you have a legit license, etc). All to offer a binary for those poor “entangled” windows users!

    No more! Now we simply target the same code to the Windows platform and it builds the binaries using the MingW cross compiler! Now developers can focus on cross platform code with a purpose, and not worry so much about how to compile for those other platforms. This should open the doors for a broader audience for numerous open source projects (especially where build resources are limited). Add to this the installation of WINE (here) and you can also test the windows binary from your Linux environment. Lovely! This means you may support more users without compromising your coding morals.

    Thanks, and I hope this helps others.


  • VC++ 2008 express (vs2008) – fatal error C1085 … The parameter is incorrect.

    Recently while trying to compile wxWidgets for the open source project glest, I kept getting errors in VC++ 2008 express edition related to pre-compiled headers. The errors were:

    fatal error C1085 … The parameter is incorrect.

    In my case the solution was found here (see Gary Gilbreath’s comment.. especially item #3)

    I was compiling on a mapped network drive (in my case using VirtualBox’s shared folders) and VS2008 does NOT like working on pre-compiled headers on network drives. The solution was to change the path of the pre-compiled headers from pointing to my mapped drive (w:) to c:\xx.pch


  • A house of cards – The Canadian Financial System

    I have for some time had an interest and have studied financial systems for Canada and America. At first my interest came when I worked for an online stock trading company, at which time I took the Canadian Securities course (CSC) which I never completed.

    I learned so much about the “real” side of the system in those years (being included in conferences calls with brokers, etc). Since that time I have researched more heavily the history of the American and more recently the Canadian financial systems and have thus far concluded they are “By design” a disaster waiting to happen.

    First allow me to discuss the Canadian side, the “Bank of Canada”. Taken from the Bank of Canada website here are some facts (irrelevant points skipped):

    1.  What is the Bank of Canada?

    The Bank of Canada is the country’s central bank. Its role, as defined in the original Bank of Canada Act of 1934, is “to promote the economic and financial welfare of Canada.”

    3. Who owns the Bank of Canada?

    The Bank was founded in 1934 as a privately owned corporation. In 1938, the Bank became a Crown corporation belonging to the federal government. Since that time, the Minister of Finance has held the entire share capital issued by the Bank.

    4. Is the Bank of Canada a government department?

    No, it is a special type of Crown corporation. The Bank has considerable autonomy to carry out its responsibilities.

    5. Why do we need a central bank?

    The Bank of Canada was created to be the sole issuer of bank notes and to facilitate management of the country’s financial system.

    Having an independent monetary institution allows for the separation of the power to spend money from the power to create money.

    Separating the central bank from the political process enables it to adopt the medium- and long-term perspectives essential to conducting effective monetary policy.

    7. Can I file a complaint with the Bank of Canada regarding a bank?

    No. The Bank of Canada does not play any part in the regulation or daily administration of commercial banks. To file such a complaint, contact the Financial Consumer Agency of Canada.

    and last (but certainly NOT least)…

    8. How does the Bank of Canada pay its operating expenses?

    The revenues generated by the Bank each year greatly exceed its operating expenses.

    The revenues derive from the Bank of Canada’s role as the issuer of bank notes to Canada’s financial institutions. Institutions pay the Bank when they withdraw bank notes from it. The Bank then invests these funds in government bonds and treasury bills. The interest earned on these investments is the Bank’s main source of revenue.

    The difference between the interest the Bank earns and its operating expenses is its net profit, which is given to the federal government. In recent years this profit has averaged about $1.7 billion annually.

    This process, whereby a central bank earns revenue in exchange for its role as the issuer of a country’s currency, is called seigniorage.

    Here is some food for thought:

    The purpose of the central bank in Canada is “to promote the economic and financial welfare of Canada.”. In 1938, the Bank became a Crown corporation belonging to the federal government. Is the Central Bank a government run department? No, it is a special type of Crown corporation. The Bank has considerable autonomy to carry out its responsibilities. The Bank of Canada was created to be the sole issuer of bank notes and to facilitate management of the country’s financial system.

    In some ways this may sound very noble, but something just feels wrong. How does this central bank make money and how do the private banks make money and who is affected?

    The revenues derive from the Bank of Canada’s role as the issuer of bank notes to Canada’s financial institutions. Institutions pay the Bank when they withdraw bank notes from it. The Bank then invests these funds in government bonds and treasury bills. The interest earned on these investments is the Bank’s main source of revenue.

    So lets try to understand this. The central bank prints money (bank notes) and is the “sole issuer”. The more they print, the less each dollar is worth that is sitting in my bank account and my wallet (that is called inflation). Who creates inflation? The central bank does (not you and me). Why is our money worth less? Because each time they print notes, there is nothing backing the value of those notes (like gold or other real goods) so as they introduce more notes, it de-valuates the existing notes (like what happened in Germany during the world wars).

    So the bank “issues” bank notes to “financial institutions”. What did it cost the bank to print these notes, or rather “issue” notes (think of the cost of introducing numbers into a computer). Almost nothing compared to the value of that note. It was virtually “for free” to create that money and lend it to private banks.

    Now lets say the central bank lends $1.00 Canadian to a private bank and charges them $0.05 to do  so. In order for that bank to pay that fee and make profit, they lend it to you and me by charging the original fee of $0.05 + their profit margin (say $0.15) = the cost for you and I $1.20.

    My question is why should these banks essentially “for free” make money from us? Why can’t we get in at the $0.05 on the dollar? Why are we dealing with usury middle-men who get the privilege of charging us for something they didn’t earn, they got $0.15 on the dollar for doing nothing! Further more when these banks fail, it almost always ends up with a bail-out of some kind (it HAS to since there is nothing to back these notes in the first place, unless you count the fact they liquidate all of your assets when you declare bankruptcy).

    Next the central bank takes that $0.05 for each dollar lent to private banks and “invests” it in Bonds and T-Bills. These are primarily bought up my foreign investors and private banks. Essentially by design the central bank %100 relies on the private banks and the private banks %100 rely on the central bank. Each will NEVER allow the others to disappear. While the purpose of the central bank is to separate the politic process from the monetary system, its purpose is ALSO: Having an independent monetary institution allows for the separation of the power to spend money from the power to create money.

    This separation clearly DOES NOT EXIST!

    Perhaps another time I will discuss the American System, which might I say is “the cavalier of all systems”. Canada is quite mild in comparison to the American counterpart. For starters look here.