Ubuntu on the G50-45?

Hello,
I wanted to know if it is OK and possible to install Ubuntu istead of windows 8 on my G50-45.
Will there be the needed drivers?
Will there be errors/issues?
Do I still have the warranty?
Thank you.

I would suggest trying a "live disk" first, from Kbuntu or Ubuntu, or even Linux Mint to see if you have errors when it attempt to locate drivers for your notebook.  Alternatively you can also look on Ubuntu hardware list, to see if anything in your notebook fails to show up.
I use OpenSUSE, Linuxx Mint and Kbuntu on various computers and notebooks in my office and shop.  I like them for server and critical needs as they rarely have to reboot and will run on a boat anchor of a system.
Good luck!

Similar Messages

  • Running ubuntu on the 5k imac

    Is there support for running ubuntu on the new 5k 27 inch imac, i need to run closed source code that was compiled on linux, so won't run on mac OS and i can't recompile it, my questions is
    a) is it possible to run ubuntu on the new 5k imac (so does the graphics card support it, are there any driver issues, can it output to the screen etc)
    b) if so is it possible to run at the native 5k resolution (unlikely i know but would be nice)
    i don't plan on getting the graphics card upgrade, just the base AMD one

    Yes to all. Use AMD Catalyst 14.9 Proprietary Linux x86 Display Driver

  • Can I install Ubuntu in the SSD of Satellite U940-sp4103gl?

    Please help me as soon as possible.
    These are my questions:
    Can I install ubuntu in the ssd of Toshiba u940-sp4103gl?
    How to do that?
    This is urgent, I'll appreciate any help. Thanks in advance.

    Hi there
    Sorry for a late reply!
    Yes, you can install any late Linux distro on the SSD.
    But You need to remove the RAID-config first (suggest using the DISKS utility).
    Then you'll have SDA and SDB - depending on BIOS setup the SSD will get either one.
    Point the installer to the SSD but make sure to format and set the HDD as your HOME mount point.
    That will give you a unit with SSD performance but a large storage.
    BR Tom

  • I had the same UEFI partions after installing Ubuntu, and the Diskpart suggestion didn't work!

    I have a system with a 128 GB SSD, and a WD15EARS drive. I was hoping to install Windows 8.1 PRO on a 90 Gig partition and the 64 bit version of Ubuntu 14.04 on the 30 Gig partition, and put all of the data and apps on the Western Digital Drive. This is
    a brand new system using a Gigabyte B85M-D3H motherboard, 8 Gig Kingston HyperX 1600 Mhz RAM, and an i3-4330 3.5 GHz processor. My BIOS is set to UEFI and Legacy setting by default. I had previously had Windows 8.1 PRO and Ubuntu 14.04 working in a dual boot
    configuration but found out I was running the 32 bit version.
    I got rid of Ubuntu 32 bit by deleting the partition it was installed on and cleaning up with the Disk Manager from Windows. I created NTFS volumes on the affected partitions and downloaded the 64 bit version of the Ubuntu 14.04 .iso! The first time I tried
    to burn a disk, it wasn't bootable, so I downloaded Imgburn and created a bootable CD. I ran the TRY 1st, but when I chose install the program did not recognized that Windows 8.1 Pro was previously installed. It wanted to install to the 90 Gig partition on
    my SSD drive (which is where Windows 8.1 PRO) was installed. I manually redirected the install to the Western Digital Drive and the install proceeded until completion.
    It was obvious that since Ubuntu did not recognize the previous install of Windows, the Computer rebooted into Ubuntu. This is almost identical to another situation listed.
    The solution given was to open an administrative command line and issue the following:
    DISKPART
    RESCAN
    LIST DISK
    SELECT DISK #
    LIST PARTITION
    SELECT PARTITION x
    DELETE PARTITION OVERRIDE  ; and I received the following
    Virtual disk service error; Delete is not allowed on the Current Boot, System, Pagefile, Crashdump, or Hybernation Volume.
    is there any tool that wil wipe partitions no matter what?

    Hi,
    The reason why you encountered this error is that the partition you wanted to delete is "system" partition, marked as "Active", it contains files to boot into system, so you can't delete it with the command.
    And here're some useful links about dual boot Windows 8/8.1 and Ubuntu.
    http://askubuntu.com/questions/221835/installing-ubuntu-on-a-pre-installed-windows-8-64-bit-system-uefi-supported
    http://itsfoss.com/install-ubuntu-1404-dual-boot-mode-windows-8-81-uefi/
    NOTE
    This response contains a reference to a third party World
    Wide Web site. Microsoft is providing this information as a convenience to you.
    Microsoft does not control these sites and has not tested any software or information found
    on these sites.
    Yolanda Zhu
    TechNet Community Support

  • Firefox 7 does Win XP into a blue screen, when I use FF7 with Ubuntu on the same pc the pc does not crash. So it seems to be a problem of win XP and not my pc ....

    FF 7 opens and then after a few minutes the pc goes to a blue screen.
    the blue screen advices a bios upgrade, but with Ubuntu (most recent version) I can use FF endlessly without any problem.

    Instead GarageBand recognize my keyboard and i can play normally, also, if it can help, those are the Audio and Midi Logic Preferences and the Controller Surfaces Setup with the keyboard connected :

  • Using firefox on a computer with both winXP and Ubuntu, having the Firefox profile-map in a separate partition, I would like not to have to delete the "parent lock" each time I want to use Firefox.

    I have Firefox in the Windowspartition of my computer and in the Linuxpartition of my computer, I have a third partition where I store my personal data, such as my Firefox-profile-map and my download-map.
    If I don't manually delete "Parent Lock" Firefox won't start saying that there is already a session open.
    It would be better not to have this parentlock-system.

    It would be better to use two separate profiles for each Operating System and sync the data between the two as there may be other problems as well with the caches that current Firefox versions use and other files that store OS dependent file paths.
    * http://kb.mozillazine.org/Using_multiple_profiles_-_Firefox

  • Webpage does not load properly in firefox on ubunut, but in all other browsers (both ubuntu and windows[including firefox windows]) the page seems to be fine.

    Hello, i am newbie, and i am developing my website.
    My web-site's pages appears to be fine when i open in any browser (including IE, Firefox, Chrome) in windows..
    but when i open the same website page in Ubuntu-Firefox the page has lots of css and font errors..is this a problem in ubuntu or my website?
    my website link: http://www.beakkon.com
    any suggestion on how to fix it?
    i am also attaching the snippet of a page of my website when it is opened in Ubuntu-firefox.
    Thanks in advance!!

    There are some CSS errors in the Tools > Error Console about font instead of font-family.
    Font-weight is also wrong here:
    <pre><code>.heading_orange {
    font:Georgia, "Times New Roman", Times, serif;
    font-weight:500px;
    font-size:24px;
    color:#db4d3d;
    text-align:justify;
    </code></pre>

  • Security Breach on the Ubuntu Forums

    So apparently the ubuntu forums got hacked and someone made out with 2 million usernames, passwords and email adresses- ouch! Their site is currently down. Just posting as an FYI because their advice is to change your password if you have an account there and use it for multiple sites. 
    Ubuntu Forums is down for maintenance
    There has been a security breach on the Ubuntu Forums. The Canonical IS team is working hard as we speak to restore normal operations. This page will be updated regularly with progress reports.
    What we know
    Unfortunately the attackers have gotten every user's local username, password, and email address from the Ubuntu Forums database.
    The passwords are not stored in plain text, they are stored as salted hashes. However, if you were using the same password as your Ubuntu Forums one on another service (such as email), you are strongly encouraged to change the password on the other service ASAP.
    Ubuntu One, Launchpad and other Ubuntu/Canonical services are NOT affected by the breach.
    Progress report
    2013-07-20 2011UTC: Reports of defacement
    2013-07-20 2015UTC: Site taken down, this splash page put in place while investigation continues.
    If you're using Ubuntu and need technical support please see the following page for support:
    Finding Help.
    If you're looking for a place to discuss Ubuntu, in the meantime we encourage you to check out these sites:
    Last edited by w201 (2013-07-22 08:59:58)

    fukawi2 wrote:An unfortunate event for Canonical and the Ubuntu team. Glad to see the passwords were at least hashed, and with a salt.
    Unfortunately md5 hashes even with salt are easily crackable. On the other hand, it's just a forum account and since they alerted people early, anyone foolish enough to use the same password elseware can change the other password on time.
    One thing I disliked is that they haven't alerted people by email, at least I haven't got one yet. I got this information from various source, but many people (dormant accounts / less frequent users) are unlikely to know of it.
    Last edited by x33a (2013-07-22 17:15:35)

  • When using the same Firefox profile in Ubuntu 12.04 and Windows 8.1, how can I keep autoscrolling enabled in Firefox for Linux?

    I access the same Firefox profile in Ubuntu 12.04 and Windows 8.1 (Windows fast startup disabled). I have the newest version of Firefox (26.0) on each system.
    Every time I launch Firefox in Ubuntu after using the profile in Windows, I notice that autoscrolling is disabled. So I have to manually enable it every time after using my profile in Windows.
    Conversely, every time I launch Firefox in Windows after using the profile in Ubuntu, I'm asked whether I would like to set Firefox as my default browser. I choose "No", first making sure that there is no check mark next to "Always perform this check when starting Firefox". I have to do this every time after using my profile in Ubuntu, despite the fact that if I check my preferences in either OS, "Always check to see if Firefox is the default browser on startup" is not enabled. Note that Firefox is my default browser in Ubuntu but not in Windows, but I have no need for Firefox to check whether it's the default every time it starts in either OS.
    I don't know whether these problems are related, but it seems likely that they are. Is there a way that I can keep these settings constant, so they don't reset every time I switch operating systems?

    I'm sure that when I close the browser in either OS before switching to the other, the following two conditions are true in the Advanced tab of the Firefox Preferences menu:
    1) "Use autoscrolling" is enabled (with a check mark)
    2) "Always check to see if Firefox is the default browser on startup" is disabled (no check mark)
    The autoscrolling feature allows you to scroll by holding down the middle mouse button and moving the mouse up and down. The extension you linked to, ScrollyFox, enables scrolling by clicking a button in the Firefox UI, which is quite a different feature. So unfortunately the problems still remain.

  • I was unable to accesss ubuntu-11.04-desktop-amd64.iso from Downloads via InfraRecorder because itdid not show in the list of Downloads when I browsed using InfraRecorder.

    From [http://www.delicious.com/askrefwt/Software__Linux?sort=alpha&order=asc http://www.delicious.com/askrefwt/Software__Linux?sort=alpha&order=asc] askrefwt's Software__Linux Bookmarks on Delicious I accessed [http://www.ubuntu.com/download/ubuntu/download Download | Ubuntu] Download | Ubuntu . From there I downloaded Ubuntu into the Firefox 5.0 Downloads folder. That took a while.
    I followed their advice about installing '''InfraRecorder''', but when I followed their advice about using it nothing happened because I could not access the Download by browsing.
    When I went into Computer and C: drive I did not find it listed among the downloads instead finding only some folders. I think that there might be a second download folder which does not show for some reason. I seem to recall that, but I don't know how to access it if that is indeed the case. It should show up on a list somewhere. I guess that it does not show up under Programs because it is not installed.
    (I thought of trying to use [http://www.pendrivelinux.com/ Pendrive Linux] Pendrive Linux to do this but instead tried this first. This might require less space.)
    The program is '''698 MB''' long. I guess that might fit on a CD.
    I am not really sure that this is Firefox's fault. I suppose that I could try accessing it through Internet Explorer.
    Thanks for trying to help me with this.
    Guard Raven on June 27, 2011, Monday.

    If the download is still listed in Tools->Downloads in Firefox then select it in download window and right-click and "Open containing folder" to see where it is.

  • Does the Qosmio G50-129 screen have single or dual lamp

    Does the Qosmio G50-129 screen have single or dual lamp in it?
    My screen has burnt out (or the lamp has) so thinking about buying this screen off ebay
    http://cgi.ebay.co.uk/NEW-LTN184HT01-18-4-LAPTOP-LCD-SCREEN-DUAL-LAMP-/280597631901?pt=UK_Computing_LaptopAccess_RL&hash= item4154ec139d
    Will this be compatible with the G50-129 model?
    Thank you

    Hi mate:
    Please don't start always new threads about one and the same theme.
    Please follow this first thread to avoid misunderstandings:
    http://forums.computers.toshiba-europe.com/forums/message.jspa?messageID=237001

  • Not installing the bb10 simulator in ubuntu 12.0

    Hi,
    i tried to insatll the bb10 dev simulator in ubuntu.All the installation of simulator well but when geetting start the vmware the simulator closes automatically.i can't see the simulator.i want simulator ip address to test my app in it.
    i read the documetation as in blackberry.com but i'm not configuring the simulator.Please help me out for this situation.
    Thank you

    Your computer meet the minimum requirements for run vmware?
    If i've helped you use the like button (KUDOS)!
    Follow me at twitter: @hektorc
    Read my blog: http://hektor.in
    Check my GitHub: github.com/hektorcyc

  • Ubuntu-like fonts in the system

    Hello everyone!
    I've recently installed and setup Arch and am already loving it with all the customization it can offer. The only thing I currently don't like is fonts. I've been using Ubuntu in the last 3 years approximately and admit it, got used to it pretty much. Google search results for example look kinda ugly for me now. I've read a lot of similar threads here, but didn't really find an answer. Sure, applying a good fontconfig helped a bit and fonts do look better, but it's still not really what I exactly would like to have.
    My specs:
    Old laptop: 1366x768 resolution (15.6"), Radeon proprietary drivers, Ubuntu 13.10 (yeah, had bad experience with updating and just didn't get to it, shame on me!), no extra font setup.
    New laptop: 1920x1080 resolution (15.6"), Intel i915 driver, Gnome 3.14, default example fontconfig from Wiki page (this made it look a bit better). I also installed ttf-ubuntu-font-family, to no avail.
    Some other information: In gnome-tweak-tool I set font scaling factor to 1.1, this also made stuff a bit better. I use Firefox and had to set layout.css.devPixelsPerPx to 1.3 to have bigger overall look. It's the same in Ubuntu with Firefox, text is small, but this "tweak" fixes it, so it's not a real problem. It's good in Win8.1 by default though.
    Based on what I read this is not just a one-sider problem I think, I mean DPI, resolution, font rendering, the actual font, scaling, etc. might too play a role in here. Since I have no fonts, DPI and similar stuff experience, I don't even no where to start looking into this. What could be the problem? If you need any more information, please ask.
    Thanks in advance!

    brebs wrote:
    So check it, e.g.:
    $ xdpyinfo | grep -B1 dot
    dimensions: 1920x1080 pixels (406x229 millimeters)
    resolution: 120x120 dots per inch
    Read the Infinality threads, for tons of info.
    Thanks for the suggestion! Now playing with this, found some interesting stuff. By default, even if I set DisplaySize to correct ones in /etc/X11/xorg.conf.d/90-monitor.conf, it shows 96 dpi and some weird 508x286 mms if started with GDM (both in Gnome and XFCE4). Now if I start gnome(/xfce4)-session in .xinitrc and use startx, it reads 142 fine in XFCE4, but not in Gnome. Xft.dpi setting also seem to be totally ignored by Gnome, but not in XFCE4 if I don't use custom setting.
    Edit: Same applies for awesome, if started from GDM, it totally ignores my settings.
    Last edited by Adam77Root (2014-12-21 11:42:20)

  • When I open Firefox in my laptop, I get an alert message that says that "It could not initialize the applications security component. The most likely cause is problems with files in your application's profile directory, etc"

    This morning it was working fine, but I tried to put 2 addons, "adblock" and "Forcastfox Weather" .
    I have both of this addons in my Desktop as well as in Ubuntu. The problem is in Windows XP

    This link shows things to check - https://support.mozilla.com/kb/Could+not+initialize+the+browser+security+component

  • The Bug about 'DB_SECONDARY_BAD' still exists in BerkeleyDB4.8!

    The Bug about 'DB_SECONDARY_BAD' still exists in BerkeleyDB4.8?
    I'm sorry for my poor English, But I just cannot find anywhere else for help.
    Thanks for your patience first!
    I'm using BDB4.8 C++ API on Ubuntu 10.04, Linux Kernel 2.6.32-24-generic
    $uname -a
    $Linux wonpc 2.6.32-24-generic #43-Ubuntu SMP Thu Sep 16 14:17:33 UTC 2010 i686 GNU/Linux
    When I update(overwrite) a record in database, I may get a DB_SECONDARY_BAD exception,
    What's worse, This case doesn't always occures, it's random. So I think it probably a bug
    of BDB, I have seen many issues about DB_SECONDARY_BAD with BDB4.5,4.6...
    To reproduce the issue, I make a simplified test program from my real program.
    The data to be stroed into database is a class called 'EntryData', It's defined in db_access.h,
    where also defines some HighLevel API functions that hide the BDB calls, such as
    store_entry_data(), which use EntryData as its argument. The EntryData have a string-type
    member-data 'name' and a vector<string>-type mem-data 'labels', So store_entry_data() will
    put the real data of EntryData to a contiguous memory block. The get_entry_data() returns
    an EntryData builed up from the contiguous memory block fetched from database.
    The comlete test program is post following this line:
    /////////db_access.h////////////
    #ifndef __DB_ACCESS_H__
    #define __DB_ACCESS_H__
    #include <string>
    #include <vector>
    #include <db_cxx.h>
    class EntryData;
    //extern Path DataDir; // default value, can be changed
    extern int database_setup();
    extern int database_close();
    extern int store_entry_data(const EntryData&, u_int32_t = DB_NOOVERWRITE);
    extern int get_entry_data(const std::string&, EntryData*, u_int32_t = 0);
    extern int rm_entry_data(const std::string&);
    class DBSetup
    // 构造时调用database_setup, 超出作用域自动调用database_close .
    // 该类没有数据成员.
    public:
    DBSetup() {
    database_setup();
    ~DBSetup() {
    database_close();
    class EntryData
    public:
    typedef std::vector<std::string> LabelContainerType;
    EntryData() {}
    EntryData(const std::string& s) : name(s) {}
    EntryData(const std::string& s, LabelContainerType& v)
    : name(s), labels(v) {}
    EntryData(const std::string&, const char*[]);
    class DataBlock;
    // 直接从内存块中构建, mem指针将会从数据库中获取,
    // 它就是EntryData转化成的DataBlock中buf_ptr->buf的内容.
    EntryData(const void* mem_blk, const int len);
    ~EntryData() {};
    const std::string& get_name () const { return name; }
    const LabelContainerType& get_labels() const { return labels; }
    void set_name (const std::string& s) { name = s; }
    void add_label(const std::string&);
    void rem_label(const std::string&);
    void show() const;
    // get contiguous memory for all:
    DataBlock get_block() const { return DataBlock(*this); }
    class DataBlock
    // contiguous memory for all.
    public:
    DataBlock(const EntryData& data);
    // 引进一块内存作为 buf_ptr->buf 的内容.
    // 例如从数据库中获取结果
    DataBlock(void* mem, int len);
    // 复制构造函数:
    DataBlock(const DataBlock& orig) :
    data_size(orig.data_size),
    capacity(orig.capacity),
    buf_ptr(orig.buf_ptr) { ++buf_ptr->use; }
    // 赋值操作符:
    DataBlock& operator=(const DataBlock& oth)
    data_size = oth.data_size;
    capacity = oth.capacity;
    if(--buf_ptr->use == 0)
    delete buf_ptr;
    buf_ptr = oth.buf_ptr;
    return *this;
    ~DataBlock() {
    if(--buf_ptr->use == 0) { delete buf_ptr; }
    // data()函数因 Dbt 构造函数不支持const char*而被迫返回 char*
    // data() 返回的指针是应该被修改的.
    const char* data() const { return buf_ptr->buf; }
    int size() const { return data_size; }
    private:
    void pack_str(const std::string& s);
    static const int init_capacity = 100;
    int data_size; // 记录数据块的长度.
    int capacity; // 已经分配到 buf 的内存大小.
    class SmartPtr; // 前向声明.
    SmartPtr* buf_ptr;
    class SmartPtr
    friend class DataBlock;
    char* buf;
    int use;
    SmartPtr(char* p) : buf(p), use(1) {}
    ~SmartPtr() { delete [] buf; }
    private:
    std::string name; // entry name
    LabelContainerType labels; // entry labels list
    }; // class EntryData
    #endif
    //////db_access.cc/////////////
    #include <iostream>
    #include <cstring>
    #include <cstdlib>
    #include <vector>
    #include <algorithm>
    #include "directory.h"
    #include "db_access.h"
    using namespace std;
    static Path DataDir("~/mydict_data"); // default value, can be changed
    const Path& get_datadir() { return DataDir; }
    static DbEnv myEnv(0);
    static Db db_bynam(&myEnv, 0); // using name as key
    static Db db_bylab(&myEnv, 0); // using label as key
    static int generate_keys_for_db_bylab
    (Db* sdbp, const Dbt* pkey, const Dbt* pdata, Dbt* skey)
    EntryData entry_data(pdata->get_data(), pdata->get_size());
    int lab_num = entry_data.get_labels().size();
    Dbt* tmpdbt = (Dbt*) malloc( sizeof(Dbt) * lab_num );
    memset(tmpdbt, 0, sizeof(Dbt) * lab_num);
    EntryData::LabelContainerType::const_iterator
    lab_it = entry_data.get_labels().begin(), lab_end = entry_data.get_labels().end();
    for(int i = 0; lab_it != lab_end; ++lab_it, ++i) {
    tmpdbt[ i ].set_data( (void*)lab_it->c_str() );
    tmpdbt[ i ].set_size( lab_it->size() );
    skey->set_flags(DB_DBT_MULTIPLE | DB_DBT_APPMALLOC);
    skey->set_data(tmpdbt);
    skey->set_size(lab_num);
    return 0;
    //@Return Value: return non-zero at error
    extern int database_setup()
    const string DBEnvHome (DataDir + "DBEnv");
    const string dbfile_bynam("dbfile_bynam");
    const string dbfile_bylab("dbfile_bylab");
    db_bylab.set_flags(DB_DUPSORT);
    const u_int32_t env_flags = DB_CREATE | DB_INIT_MPOOL;
    const u_int32_t db_flags = DB_CREATE;
    rmkdir(DBEnvHome);
    try
    myEnv.open(DBEnvHome.c_str(), env_flags, 0);
    db_bynam.open(NULL, dbfile_bynam.c_str(), NULL, DB_BTREE, db_flags, 0);
    db_bylab.open(NULL, dbfile_bylab.c_str(), NULL, DB_BTREE, db_flags, 0);
    db_bynam.associate(NULL, &db_bylab, generate_keys_for_db_bylab, 0);
    } catch(DbException &e) {
    cerr << "Err when open DBEnv or Db: " << e.what() << endl;
    return -1;
    } catch(std::exception& e) {
    cerr << "Err when open DBEnv or Db: " << e.what() << endl;
    return -1;
    return 0;
    int database_close()
    try {
    db_bylab.close(0);
    db_bynam.close(0);
    myEnv.close(0);
    } catch(DbException &e) {
    cerr << e.what();
    return -1;
    } catch(std::exception &e) {
    cerr << e.what();
    return -1;
    return 0;
    // 返回Dbt::put()的返回值
    int store_entry_data(const EntryData& e, u_int32_t flags)
    int res = 0;
    try {
    EntryData::DataBlock blk(e);
    // data()返回的buf中存放的第一个字符串便是 e.get_name().
    Dbt key ( (void*)blk.data(), strlen(blk.data()) + 1 );
    Dbt data( (void*)blk.data(), blk.size() );
    res = db_bynam.put(NULL, &key, &data, flags);
    } catch (DbException& e) {
    cerr << e.what() << endl;
    throw; // 重新抛出.
    return res;
    // 返回 Db::get()的返回值, 调用成功时 EntryData* e的值才有意义
    int get_entry_data
    (const std::string& entry_name, EntryData* e, u_int32_t flags)
    Dbt key( (void*)entry_name.c_str(), entry_name.size() + 1 );
    Dbt data;
    data.set_flags(DB_DBT_MALLOC);
    int res = db_bynam.get(NULL, &key, &data, flags);
    if(res == 0)
    new (e) EntryData( data.get_data(), data.get_size() );
    free( data.get_data() );
    return res;
    int rm_entry_data(const std::string& name)
    Dbt key( (void*)name.c_str(), name.size() + 1 );
    cout << "to remove: \'" << name << "\'" << endl;
    int res = db_bynam.del(NULL, &key, 0);
    return res;
    EntryData::EntryData(const std::string& s, const char* labels_arr[]) : name(s)
    {   // labels_arr 需要以 NULL 结尾.
    for(const char** i = labels_arr; *i != NULL; i++)
    labels.push_back(*i);
    EntryData::EntryData(const void* mem_blk, const int len)
    const char* buf = (const char*)mem_blk;
    int consumed = 0; // 已经消耗的mem_blk的大小.
    name = buf; // 第一串为 name
    consumed += name.size() + 1;
    for (string label = buf + consumed;
    consumed < len;
    consumed += label.size() + 1)
    label = buf + consumed;
    labels.push_back(label);
    void EntryData::add_label(const string& new_label)
    if(find(labels.begin(), labels.end(), new_label)
    == labels.end())
    labels.push_back(new_label);
    void EntryData::rem_label(const string& to_rem)
    LabelContainerType::iterator iter = find(labels.begin(), labels.end(), to_rem);
    if(iter != labels.end())
    labels.erase(iter);
    void EntryData::show() const {
    cout << "name: " << name << "; labels: ";
    LabelContainerType::const_iterator it, end = labels.end();
    for(it = labels.begin(); it != end; ++it)
    cout << *it << " ";
    cout << endl;
    EntryData::DataBlock::DataBlock(const EntryData& data) :
    data_size(0),
    capacity(init_capacity),
    buf_ptr(new SmartPtr(new char[init_capacity]))
    pack_str(data.name);
    for(EntryData::LabelContainerType::const_iterator \
    i = data.labels.begin();
    i != data.labels.end();
    ++i) { pack_str(*i); }
    void EntryData::DataBlock::pack_str(const std::string& s)
    int string_size = s.size() + 1; // to put sting in buf separately.
    if(capacity >= data_size + string_size) {
    memcpy(buf_ptr->buf + data_size, s.c_str(), string_size);
    else {
    capacity = (data_size + string_size)*2; // 分配尽可能大的空间.
    buf_ptr->buf = (char*)realloc(buf_ptr->buf, capacity);
    memcpy(buf_ptr->buf + data_size, s.c_str(), string_size);
    data_size += string_size;
    //////////// test_put.cc ///////////
    #include <iostream>
    #include <string>
    #include <cstdlib>
    #include "db_access.h"
    using namespace std;
    int main(int argc, char** argv)
    if(argc < 2) { exit(EXIT_FAILURE); }
    DBSetup setupup_mydb;
    int res = 0;
    EntryData ed(argv[1], (const char**)argv + 2);
    res = store_entry_data(ed);
    if(res != 0) {
         cerr << db_strerror(res) << endl;
         return res;
    return 0;
    // To Compile:
    // $ g++ -ldb_cxx -lboost_regex -o test_put test_put.cc db_access.cc directory.cc
    //////////// test_update.cc ///////////
    #include <iostream>
    #include <cstdlib>
    #include <string>
    #include <boost/program_options.hpp>
    #include "db_access.h"
    using namespace std;
    namespace po = boost::program_options;
    int main(int argc, char** argv)
    if(argc < 2) { exit(EXIT_SUCCESS); }
    DBSetup setupup_mydb;
    int res = 0;
    po::options_description cmdopts("Allowed options");
    po::positional_options_description pos_opts;
    cmdopts.add_options()
    ("entry", "Specify the entry that will be edited")
    ("addlabel,a", po::value< vector<string> >(),
    "add a label for specified entry")
    ("removelabel,r", po::value< vector<string> >(),
    "remove the label of specified entry")
    pos_opts.add("entry", 1);
    po::variables_map vm;
    store( po::command_line_parser(argc, argv).
    options(cmdopts).positional(pos_opts).run(), vm );
    notify(vm);
    EntryData entry_data;
    if(vm.count("entry")) {
    const string& entry_to_edit = vm["entry"].as<string>();
    res = get_entry_data( entry_to_edit, &entry_data );
    switch (res)
    case 0:
    break;
    case DB_NOTFOUND:
    cerr << "No entry named: \'"
    << entry_to_edit << "\'\n";
    return res;
    break;
    default:
    cerr << db_strerror(res) << endl;
    return res;
    } else {
    cerr << "No entry specified\n";
    exit(EXIT_FAILURE);
    EntryData new_entry_data(entry_data);
    typedef vector<string>::const_iterator VS_CI;
    if(vm.count("addlabel")) {
    const vector<string>& to_adds = vm["addlabel"].as< vector<string> >();
    VS_CI end = to_adds.end();
    for(VS_CI i = to_adds.begin(); i != end; ++i) {
    new_entry_data.add_label(*i);
    if(vm.count("removelabel")) {
    const vector<string>& to_rems = vm["removelabel"].as< vector<string> >();
    VS_CI end = to_rems.end();
    for(VS_CI i = to_rems.begin(); i != end; ++i) {
    new_entry_data.rem_label(*i);
    cout << "Old data| ";
    entry_data.show();
    cout << "New data| ";
    new_entry_data.show();
    res = store_entry_data(new_entry_data, 0); // set flags to zero permitting Over Write
    if(res != 0) {
    cerr << db_strerror(res) << endl;
    return res;
    return 0;
    // To Compile:
    // $ g++ -ldb_cxx -lboost_regex -lboost_program_options -o test_update test_update.cc db_access.cc directory.cc

    ////////directory.h//////
    #ifndef __DIRECTORY_H__
    #define __DIRECTORY_H__
    #include <string>
    #include <string>
    #include <sys/types.h>
    using std::string;
    class Path
    public:
    Path() {}
    Path(const std::string&);
    Path(const char* raw) { new (this) Path(string(raw)); }
    Path upper() const;
    void operator+= (const std::string&);
    // convert to string (char*):
    //operator std::string() const {return spath;}
    operator const char*() const {return spath.c_str();}
    const std::string& str() const {return spath;}
    private:
    std::string spath; // the real path
    inline Path operator+(const Path& L, const string& R)
    Path p(L);
    p += R;
    return p;
    int rmkdir(const string& path, const mode_t mode = 0744, const int depth = -1);
    #endif
    ///////directory.cc///////
    #ifndef __DIRECTORY_H__
    #define __DIRECTORY_H__
    #include <string>
    #include <string>
    #include <sys/types.h>
    using std::string;
    class Path
    public:
    Path() {}
    Path(const std::string&);
    Path(const char* raw) { new (this) Path(string(raw)); }
    Path upper() const;
    void operator+= (const std::string&);
    // convert to string (char*):
    //operator std::string() const {return spath;}
    operator const char*() const {return spath.c_str();}
    const std::string& str() const {return spath;}
    private:
    std::string spath; // the real path
    inline Path operator+(const Path& L, const string& R)
    Path p(L);
    p += R;
    return p;
    int rmkdir(const string& path, const mode_t mode = 0744, const int depth = -1);
    #endif
    //////////////////// All the code is above ////////////////////////////////
    Use the under command
    $ g++ -ldb_cxx -lboost_regex -o test_put test_put.cc db_access.cc directory.cc
    to get a test program that can insert a record to database.
    To insert a record, use the under command:
    $ ./test_put ubuntu linux os
    It will store an EntryData named 'ubuntu' and two labels('linux', 'os') to database.
    Use the under command
    $ g++ -ldb_cxx -lboost_regex -lboost_program_options -o test_update test_update.cc db_access.cc directory.cc
    to get a test program that can update the existing records.
    To update the record, use the under command:
    $ ./test_update ubuntu -r linux -a canonical
    It will update the with the key 'ubuntu', with the label 'linux' removed and a new
    label 'canonical'.
    Great thanks to you if you've read and understood my code!
    I've said that the DB_SECONDARY_BAD exception is random. The same operation may cause
    exception in one time and may goes well in another time.
    As I've test below:
    ## Lines not started with '$' is the stdout or stderr.
    $ ./test_put linux os linus
    $ ./test_update linux -r os
    Old data| name: linux; labels: os linus
    New data| name: linux; labels: linus
    $ ./test_update linux -r linus
    Old data| name: linux; labels: linus
    New data| name: linux; labels:
    dbfile_bynam: DB_SECONDARY_BAD: Secondary index inconsistent with primary
    Db::put: DB_SECONDARY_BAD: Secondary index inconsistent with primary
    terminate called after throwing an instance of 'DbException'
    what(): Db::put: DB_SECONDARY_BAD: Secondary index inconsistent with primary
    已放弃
    Look! I've received a DB_SECONDARY_BAD exception. But thus exception does not always
    happen even under the same operation.
    For the exception is random, you may have not the "luck" to get it during your test.
    So let's insert a record by:
    $ ./test_put t
    and then give it a great number of labels:
    $ for((i = 0; i != 100; ++i)); do ./test_update t -a "label_$i"; done
    and then:
    $ for((i = 0; i != 100; ++i)); do ./test_update t -r "label_$i"; done
    Thus, the DB_SECONDARY_BAD exception is almost certain to happen.
    I've been confused by the problem for times. I would appreciate if someone can solve
    my problem.
    Many thanks!
    Wonder

Maybe you are looking for

  • Never Get Buddy's Video in Window for iChat AV

    Here's something basic that's got me stymied - I'm trying to set up a video chat with my daughter at school, both on iSight-equipped MacBooks. We tested the capability when she was home, and it worked great. Now, we get the chat set up, and she can s

  • Serial Number Works But Photoshop Wont Open

    My photoshop trial endend but i saved a serial number for when it did and i put it in and it says it works but then when i press continue it says press close and reopen it and it wont open

  • Help explaining Code

    INSERT INTO TABLE (SELECT c.consists_of FROM programme_tab c WHERE programme# = 'P111') (SELECT REF(m) FROM module_tab m WHERE module# = 'a111' OR module# = 'a112'); Can someone help me explain this code in plain English , it is for revision reasons

  • Airport Express: Works for a while then drops

    I have an Airport Express extending my Time Capsule base station. I've moved it out to the garage, and it works pretty decently even though it's pretty far away from the base station. But in order to get it working, I have to unplug/replug to get it

  • Can you somehow put the music on an old ipod to a new one?

    I want to get a new ipod, but the computers that have the music that is on my ipod are either destroyed or no longer workimg so i can't get to them. Is there a way to get music from one ipod to another?