Removing MinGW dll dependencies in QT Static linking

libgcc_s_dw2-1.dll

Passing -static-libgcc will remove this dependency for all languages other than C.
Note: C++ exceptions depends on this option.

mingwm10.dll

Remove -mthreads option from your makefile.
Note: Multithreading and C++ exceptions depends on this option.

Popularity: 32% [?]

Apr03

Insert accounts in Sugar CRM using Codeigniter

//load new database of Sugar CRM as defined in database.php
        $this->db2 = $this->ci->load->database('db_crm', TRUE);
 
        //generate unique id for sugar crm . length:36
        $accounts_id=$this->generateCrmID('accounts');
 
        //insert account into CRM
        $account_data=array(
            'id'=> $accounts_id,
            'name'=> $user_details['first_name'].' '.$user_details['last_name'],
            'date_entered'=> date('Y-m-d h:i:s'),
            'date_modified'=> date('Y-m-d h:i:s'),
            'modified_user_id'=> '417785b3-1644-6586-11f7-4b2a02c9fede',
            'created_by'=> '417785b3-1644-6586-11f7-4b2a02c9fede',
            'description'=> strip_tags($content),
            'deleted'=> 0,
            'assigned_user_id'=> '417785b3-1644-6586-11f7-4b2a02c9fede',
            'account_type'=> 'Customer',
            'industry'=> $user_details['industry'],
            'annual_revenue'=> '',
            'phone_fax'=> '',
            'billing_address_street'=> $user_details['address1']." ".$user_details['address2'],
            'billing_address_city'=> $user_details['city'],
            'billing_address_state'=> $user_details['state'],
            'billing_address_postalcode'=> $user_details['zip'],
            'billing_address_country'=> $user_details['country'],
            'rating'=> '',
            'phone_office'=> $user_details['mobile'],
            'phone_alternate'=> $user_details['phone'],
            'website'=> $user_details['website'],
            'ownership'=> '',
            'employees'=> '',
            'ticker_symbol'=> '',
            'shipping_address_street'=> '',
            'shipping_address_city'=> '',
            'shipping_address_state'=> '',
            'shipping_address_postalcode'=> '',
            'shipping_address_country'=> '',
            'parent_id'=> '',
            'sic_code'=> '',
            'campaign_id'=> '');
 
        $this->db2->insert('accounts',$account_data);
 
        $email_id=$this->generateCrmID('email_addresses');
        $email_data=array(
            'id' => $email_id,
            'email_address' => $user_details['email'] ,
            'email_address_caps' => strtoupper($user_details['email'] ),
            'invalid_email' => 0,
            'opt_out' => 0,
            'date_created' => date('Y-m-d h:i:s'),
            'date_modified' => date('Y-m-d h:i:s'),
            'deleted' => 0
        );
        $this->db2->insert('email_addresses',$email_data);
 
        $email_addr_id=$this->generateCrmID('email_addr_bean_rel');
        $email_addr_bean_rel_data=array(
            'id' => $email_addr_id,
            'email_address_id' => $email_id,
            'bean_id' => $accounts_id,
            'bean_module' => 'Accounts',
            'primary_address' => 0,
            'reply_to_address' => 0,
            'date_created' => date('Y-m-d h:i:s'),
            'date_modified' => date('Y-m-d h:i:s'),
            'deleted' => 0,
        );
        $this->db2->insert('email_addr_bean_rel',$email_addr_bean_rel_data);
 
        //load default database
        $this->ci->load->database('default', TRUE);

Dependent function(s)

function generateCrmID($condition)
    {
 
        do
        {
            $crm_id = "CONX".random_string('unique');
 
            switch($condition)
            {
                case 'accounts':
                    $query = $this->ci->db->get_where('accounts', array('id' => $crm_id));
                    break;
                case 'email_addresses':
                    $query = $this->ci->db->get_where('email_addresses', array('id' => $crm_id));
                    break;
                case 'email_addr_bean_rel':
                    $query = $this->ci->db->get_where('email_addresses', array('id' => $crm_id));
                    break;
                default:
                    $query = $this->ci->db->get_where('accounts', array('id' => $crm_id));
                    break;
            }
            //ticketmaskid FROM '". TABLE_PREFIX ."' WHERE '' = '". $dbCore->escape() ."';");
            $id=$this->ci->db->count_all();
 
        } while ($id!=0);
 
        return $crm_id;
 
    }

Popularity: 100% [?]

Dec30

Insert ticket in Support Suite using CodeIgniter

   // Insert the Actual Record
        $ticket_data=array(
            'ticketid'=>'',
            'ticketmaskid'=>$ticketmaskid ,
            'departmentid'=>1 ,
            'ticketstatusid'=>1 ,
            'priorityid'=> 1,
            'emailqueueid'=>0 ,
            'userid'=>68 ,
            'staffid'=>2,
            'ownerstaffid'=>2,
            'assignstatus'=>1,
            'fullname'=>'someva' ,
            'email'=>$user_details['email'] ,
            'lastreplier'=>'someva' ,
            'replyto'=>$user_details['email'] ,
            'subject'=>'New Account is registered' ,
            'dateline'=>now() ,
            'lastactivity'=>now() ,
            'laststaffreplytime'=>now() ,
            'slaplanid'=>1 ,
            'duetime'=>0 ,
            'totalreplies'=>0 ,
            'ipaddress'=>'' ,
            'flagtype'=> 0,
            'hasnotes'=> 0,
            'hasattachments'=> 0,
            'isemailed'=> 0,
            'edited'=> 0,
            'editedbystaffid'=> 0,
            'editeddateline'=> 0,
            'creator'=> 1,
            'charset'=>'UTF-8' ,
            'transferencoding'=>'' ,
            'timeworked' =>0 ,
            'dateicon' =>0,
            'lastpostid'=>0,
            'firstpostid'=>0,
            'tgroupid'=>1 ,
            'messageid' =>$messageid ,
            'escalationruleid'=>0 ,
            'hasdraft'=>0 ,
            'hasbilling' =>0 ,
            'isphonecall' =>0 ,
            'isescalated'=>0 ,
            'phoneno'=>'' ,
            'autoclosetimeline' =>0 ,
            'islabeled' =>0 ,
            'lastuserreplytime' => now(),
            'escalatedtime' =>0 ,
            'followupcount'=>0 );
 
        $this->db1->insert('swtickets',$ticket_data);
        $ticketid=$this->db1->insert_id();
 
        $content="<p>Hi,</p>";
        $content.="<p>New account is registered with following details:</p>";
        $content.="<p> Full Name: ".$user_details['first_name']." ".$user_details['last_name'];
        $content.="</p><p> Email: ".$user_details['email']." </p>";
        $content.="<p> ".$this->get_orders()." </p>";
        $content.="<p></p>";
 
        $post_data=array(
            'ticketpostid'=>'' ,
            'ticketid'=>$ticketid ,
            'dateline'=>now() ,
            'userid'=>68 ,
            'fullname'=> 'someva',
            'email'=>$user_details['email'] ,
            'emailto'=>'' ,
            'subject'=>'New Account Registration' ,
            'ipaddress'=>'' ,
            'hasattachments'=>0 ,
            'edited'=>0 ,
            'editedbystaffid'=>0 ,
            'editeddateline'=>0 ,
            'creator'=>1 ,
            'ishtml'=>1 ,
            'isemailed'=>0 ,
            'staffid'=>2 ,
            'contents'=> $content,
            'contenthash'=>md5($content) ,
            'subjecthash'=>md5('New Account Registration')
        );
 
        $this->db1->insert('swticketposts',$post_data);
        $ticketpostid=$this->db1->insert_id();
 
 
 
        $ticket_message_data=array(
            'ticketmessageid'=>'',
            'messageid'=>$messageid ,
            'ticketid'=>$ticketid ,
            'ticketpostid'=>$ticketpostid ,
            'dateline' => now());
 
        $this->db1->insert('swticketmessageids',$ticket_message_data);
        $ticketmessageid=$this->db1->insert_id();
 
        //load default database
        $this->ci->load->database('default', TRUE);

Dependent functions

 /**
     * Generates a Random Message ID
     */
    function generateRandomMessageID()
    {
        srand((double)microtime()*10000000);
        $messageid = base_convert(time(), 10, 36).".". base_convert(rand(), 10, 36);
        return $messageid;
 
    }
    /**
     * Generate a random Ticket Mask
     */
    function generateTicketMask()
    {
 
    //        $id=100;
        do
        {
 
            $prefix = strtoupper(chr(mt_rand(65,90)) . chr(mt_rand(65,90)) . chr(mt_rand(65,90)));
 
            $ticketmaskid = $prefix . "-" . mt_rand(100000,999999);
            //$_maskcheck =
 
            $query = $this->ci->db->get_where('swtickets', array('ticketmaskid' => $ticketmaskid));
            //ticketmaskid FROM '". TABLE_PREFIX ."' WHERE '' = '". $dbCore->escape() ."';");
            $id=$this->ci->db->count_all();
 
        } while ($id!=0);
 
        return $ticketmaskid;
 
    }

Popularity: 58% [?]

Dec30

SEO based urls : CodeIgniter routes

You can use this code for SEO urls

 
//this section enables you to use some controllers 
$route['admin/(:any)'] = "admin/$1";    
$route['contact/(:any)'] = "contact/$1";
$route['auth/(:any)'] = "auth/$1";
$route['testimonials/(:any)'] = "testimonials/$1";
 
//else everything in url will handle by this pro controller's index function
$route['(:any)'] = "pro/index";

May be when you need this you can understand this logic. crazy na ;)

Popularity: 89% [?]

Dec30

Automatic Config BASE URL in CodeIgniter

Change $config['base_url'] with this.
This is one time set config system for all sites and urls.
In application/config folder open config.php
Find this

$config['base_url']='http://example.com';

and replace with this

 
$config['base_url'] =  ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") ?  "https" : "http");
$config['base_url'] .=  "://".$_SERVER['HTTP_HOST'];
$config['base_url'] .=  str_replace(basename($_SERVER['SCRIPT_NAME']),"",$_SERVER['SCRIPT_NAME']);

Popularity: 69% [?]

Dec24

Insert user in Support suite using CodeIginiter

Paste following code in end of database.php located in config folder

$db['db_support']['hostname'] = "localhost";
$db['db_support']['username'] = "dbname";
$db['db_support']['password'] = "password";
$db['db_support']['database'] = "supportsuite_databasename";
$db['db_support']['dbdriver'] = "mysql";
$db['db_support']['dbprefix'] = "";
$db['db_support']['pconnect'] = TRUE;
$db['db_support']['db_debug'] = TRUE;
$db['db_support']['cache_on'] = FALSE;
$db['db_support']['cachedir'] = "";
$db['db_support']['char_set'] = "utf8";
$db['db_support']['dbcollat'] = "utf8_general_ci";

and use this one where ever you want.

 
        $this->db->select("users.*", FALSE);  //these are tables where you have original codeigniter based users
        $this->db->select("user_profile.*", FALSE);
        $this->db->join('user_profile', "user_profile.user_id = users.id");
        $this->db->where('users.id',$user_id);
        $this->db->order_by("users.id", "ASC");
        $query = $this->db1->get();
        //print_r( $query->row_array());
 
       $this->db1 = $this->load->database('db_support', TRUE);
        $this->db1->from('swusers');
        $this->db1->where('swusers');
        $query = $this->db1->get();
        //print_r( $query->row_array());
 
        $user=array(
            'userid' =>'',
            'usergroupid' =>3,
            'fullname' =>'',
            'phone' =>'',
            'userpassword' =>'',
            'userpasswordtxt' =>'',
            'dateline' =>'',
            'lastvisit' =>'',
            'lastactivity' =>'',
            'enabled' =>'',
            'loginapi_moduleid' =>'',
            'loginapi_userid' =>'',
            'languageid' =>'',
            'timezoneoffset' =>'',
            'enabledst' =>'',
            'useremailcount' =>'',
            'allowemail' =>'',
            'slaplanid' =>'',
            'slaexpiry' =>'',
            'ismanager' =>''
        );
 
        $this->db1->insert('swusers',$user);
 
        $user_email=array(
            'useremailid'=> '',
            'userid' => $this->db1->insert_id(),
            'email' => 'isprimary'
        );
 
        $this->db1->insert('swusers',$user);

Popularity: 70% [?]

Dec15

Use QColor from getColor on QLabel and QTextbox

//To use color on text and label 
//Simple sample :)
QColor color = QColorDialog::getColor(QColor(ui->backgroundColorPickerText->text()), this);
   if(color.isValid())
    {
 
        QPixmap pix(21, 21);
        pix.fill(color);
 
        ui->backgroundColorPickerLabel->setPixmap(pix);
        ui->backgroundColorPickerText->setText(color.name());
    }

Popularity: 60% [?]

Dec12

create a custom dialog box with multi line input in qt

//create a custom dialog box with multi line input
void MainWindow::createMultilineInput()
{
//class variable    
dlgMultiLine =    new QDialog(this);
 
//local variable
    QGridLayout *gridLayout = new QGridLayout(dlgMultiLine);
 
//class variable
    txtMultiline = new QPlainTextEdit();
 
    txtMultiline->setObjectName(QString::fromUtf8("txtMultiline"));
    gridLayout->addWidget(txtMultiline, 0, 0, 1, 1);
    QDialogButtonBox *buttonBox = new QDialogButtonBox();
    buttonBox->setObjectName(QString::fromUtf8("buttonBox"));
    buttonBox->setOrientation(Qt::Horizontal);
    buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
 
    gridLayout->addWidget(buttonBox, 1, 0, 1, 1);
 
    connect(buttonBox,SIGNAL(accepted()),this,SLOT(on_acceptLoadHtml()));
    connect(buttonBox,SIGNAL(rejected()),this,SLOT(on_rejectLoadHtml()));
 
    dlgMultiLine->show();
}

Popularity: 88% [?]

Dec12

show data in external window with custom widget in qt

Sometime you need to show data in external window with custom widget(s). This little code will help you.

function showCustomWidget() {
 
 QDialog *dlgMultiLine =    new QDialog();
 QGridLayout *gridLayout = new QGridLayout(dlgMultiLine);
 QPlainTextEdit *txtMultiline = new QPlainTextEdit();
 
 txtMultiline->setPlainText(this->toPlainText());
 
 gridLayout->addWidget(txtMultiline, 0, 0, 1, 1);
 dlgMultiLine->show();
 
}

Popularity: 60% [?]

Dec12

getting all files from subdirectories recursively with c using qt framework/

// Display a dialog to the user to choose his music directory
      QString directory_path = QFileDialog::getExistingDirectory(this, tr("Select your music directory"), QDir::currentPath());
 
     // Then create an instance of our QDirIterator, which takes as parameters
     // the directory, a QDir filter and an option flag which the QDirIterator is told
     // to go on the subdirectories also.
     // I have combined the QDir filters to list files and not to get the symbolic links (shortcuts in Windows).
 
     QDirIterator directory_walker(directory_path, QDir::Files | QDir::NoSymLinks, QDirIterator::Subdirectories);
 
    // QDirIterator object has a boolean method called hasNext() which returns true
    // if the directory have more files, false otherwise and based on that information,
    // we can write a while loop like the one below
 
    while(directory_walker.hasNext())
    {
          // then we tell our directory_walker object to explicitly take next element until the loop finishes
          directory_walker.next();
 
         // I want to list just mp3 files!
         //if(directory_walker.fileInfo().completeSuffix() == "css")
                 // then we take a filename and display it to a listWidget like the code below:
                ui->listWidget->addItem(directory_walker.fileName());
    }

Original link : phalanx.spartansoft.org/2009/01/20/getting-all-files-from-subdirectories-recursively-with-c-using-qt-framework/

Popularity: 61% [?]

Dec12