Friday, December 28, 2012

Installing and Configuring FlashTool for Xperia Devices in Ubuuntu

I've been constantly switching between my two OSs, Win7 and Linux Mint for just flashing a ROM to my Xperia device. And ofcourse, I hate being in Windows. So, I found this nice little method to do the same in my Linux.
Credits go to these two pages:
http://duopetalflower.blogspot.com/2012/08/flashtool-in-ubuntu-linux.html
http://ubuntuforums.org/showthread.php?t=2084266
1. First of all go to
http://www.flashtool.net/downloads.php
and download the Linux version
2. Extract the 7z then the TAR somewhere and you find the directory FlashTool
3. Now some configuring, first of all you need a package called libusb. By the time you might come to this post the lib may get upgraded so just use your head to handle the scenarios a bit. First off, go to the site
http://libusbx.org
and download the latest tar.bz2 version.
4. Place it somewhere and cd into that directory
5. Type
sudo su
6. You're given root rights, type
tar xvf $(ls | grep "libusb")
This will extract the tar.bz2 file you've downloaded, considering that directory has no other file whose name contains "libusb".
7. Now type
cd $(ls | grep "libusb")
and you'll be inside the extracted directory.
8. Type
$ sudo su
$ ./configure && make && make install && sudo ldconfig
9. Now type this command the configure some USB settings for Flashing interface
sudo cp /etc/udev/rules.d/70-persistent-net.rules /etc/udev/rules.d/80-persistent-usb.rules
10. Open that newly created file in nano using
sudo vi /etc/udev/rules.d/80-persistent-usb.rules
11. Add these lines to the end of the document
SUBSYSTEM=="usb", ACTION=="add", SYSFS{idVendor}=="0fce", SYSFS{idProduct}=="*", MODE="0777"
12. Most of the hard part is done, now just a final installation of the ia32-libs using
 sudo apt-get install ia32-libs 
13. Now you're good to go just go to the directory where your Flash Tool executable is and just type
./FlashTool

Monday, December 24, 2012

Installing openERP in Linux (Ubuntu)

The DEB file supplied by OpenERP site works but you need two extra packages. So, first run this command.
sudo apt-get install postgresql-common postgresql-9.1
Then do the
sudo dpkg -i [the deb file]
In case you find some dependency issues just use
sudo apt-get -f install
Afterward you can access openerp in
http://localhost:8069/web/webclient/home
Use the username: openpg
password: openpgpwd
The default admin password or the Master password is: admin

Saturday, December 01, 2012

[For ICPC] Links

Has some nice DP Problems : GitHUB
Has lots of links: Online Resources

[UVa] 574 - Sum It Up

Method: Backtracking
Possible optimizations: Used a map to check if a set was generated before, it takes more time than checking if the numbers were used more than they appeared in input
#include <cstdio>
#include <iostream>
#include <vector>
#include <map>
using namespace std;

vector<int> nlist;
vector< vector<int> > finlist;
bool used[20];
map< vector<int>, bool > mp;
int btracking(int t, int sum, vector<int> temp, int k) {
    //if (!sum) solve[i].clear();

    if (sum == t) {
        if (!mp[temp]) {
            finlist.push_back(temp);
            mp[temp] = true;
        }
        return 0;
    }

    for (k ; k<nlist.size() ; k++) {
        if (!used[k]) {
            if (nlist[k]<=(t-sum)) {
                sum+=nlist[k];
                temp.push_back(nlist[k]);
                used[k] = true;
                btracking(t, sum, temp, k);
                used[k] = false;
                temp.pop_back();
                sum-=nlist[k];
            }
        }
    }

    return 0;
}

int main( void ) {

    int t, n, i, j, x;

    //freopen("574_in.txt","r+",stdin);

    while ( scanf("%d %d",&t,&n) == 2 ) {
        if (!n) break;

        printf("Sums of %d:\n",t);

        nlist.clear();
        for (i=0 ; i<n ; i++) {
            scanf("%d",&x);
            nlist.push_back(x);
            used[i] = false;
        }
        //cout << "-----> " << nlist.size() << endl;

        finlist.clear();
        vector<int> temp;
        temp.clear();
        mp.clear();
        btracking(t, 0, temp, 0);

        if (!finlist.size()) {
            printf("NONE\n");
        }

        //printf("--> %d\n",finlist.size());
        for (i=0 ; i<finlist.size() ; i++) {
            for (j=0 ; j<finlist[i].size() ; j++) {
                if (!j) printf("%d",finlist[i][j]);
                else printf("+%d",finlist[i][j]);
            }
            printf("\n");
        }

    }

    return 0;
}


Connect Rapoo MT750S with Linux (Tested on Manjaro)

 I bought this obvious copy of MX Master 2S in hopes of having the device switching functionality along with a lightweight body because I ha...