Search Results

Search found 6 results on 1 pages for 'frkt'.

Page 1/1 | 1 

  • Where should I configure software installed by 3rd-party chef recipes?

    - by FRKT
    I'm provisioning a Vagrant virtual machine with Chef and it's amazing, but I'm unsure where I should put code to configure software installed by 3rd-party chef recipes. For example, I'm installing NGINX with this recipe but I need to configure the default virtual host to serve content from /vagrant/public instead of /var/www/nginx-default. Should I change the template of the 3rd-party recipe, or create another recipe that reconfigures it?

    Read the article

  • Extending MySQLi

    - by FRKT
    Hello, I've run into problems extending the MySQLi class. It won't let me add any properties. class MySQLii extends MySQLi { public $database; public function MySQLii($host, $username, $password, $database){ // Initialize MySQLi parent::MySQLi($host, $username, $password, $database); // Save database name $this->database = $database; } } $mysqlii = new MySQLii('localhost', 'root', 'password', 'database'); var_dump($mysqlii); object(MySQLii)#1 (17) { ["affected_rows"]= int(0) ["client_info"]= string(48) "mysqlnd 5.0.5-dev - 081106 - $Revision: 289630 $" ["client_version"]= int(50005) ["connect_errno"]= int(0) ["connect_error"]= NULL ["errno"]= int(0) ["error"]= string(0) "" ["field_count"]= int(0) ["host_info"]= string(42) "MySQL host info: Localhost via UNIX socket" ["info"]= NULL ["insert_id"]= int(0) ["server_info"]= string(6) "5.1.44" ["server_version"]= int(50144) ["sqlstate"]= string(5) "00000" ["protocol_version"]= int(10) ["thread_id"]= int(4019) ["warning_count"]= int(0) } Note the absence of the database property I added in the MySQLii constructor. Am I missing something?

    Read the article

  • When to throw exceptions?

    - by FRKT
    Exceptions are wonderful things, but I sometimes worry that I throw too many. Consider this example: Class User { public function User(user){ // Query database for user data if(!user) throw new ExistenceException('User not found'); } } I'd argue that it makes as much sense to simply return false (or set all user data to false in this case), rather than throwing an exception. Which do you prefer?

    Read the article

  • Does Flash comply with HTTP Location header?

    - by FRKT
    Hello, does Flash comply with HTTP Location headers? For example, if Flash makes a POST request to http://www.example.org/mail and it returns Location: http://www.example.org/mail/1.xml, will Flash return the data in in 1.xml upon completing the POST request?

    Read the article

  • JOIN (SELECT DISTINCT [..] substitute

    - by FRKT
    Hello, I'd like to find a substitute for using SELECT DISTINCT in a derived table. Let's say I have three tables: CREATE TABLE `trades` ( `tradeID` int(11) unsigned NOT NULL AUTO_INCREMENT, `employeeID` int(11) unsigned NOT NULL, `corporationID` int(11) unsigned NOT NULL, `profit` int(11) NOT NULL, KEY `tradeID` (`tradeID`), KEY `employeeID` (`employeeID`), KEY `corporationID` (`corporationID`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE `corporations` ( `corporationID` int(11) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, PRIMARY KEY (`corporationID`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE `employees` ( `employeeID` int(11) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, PRIMARY KEY (`employeeID`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 Let's say I'd like to find out how much profit a specific employee has generated. Simple: SELECT SUM(profit) FROM trades JOIN employees ON trades.employeeID = employees.employeeID AND employees.employeeID = 1; It gets trickier if I'd like to query how much revenue a specific corporation has, however. I cannot simply replicate the aforementioned query, because two or more employees from the same company might be involved in the same trade. This query should do the trick: SELECT SUM(profit) FROM trades JOIN (SELECT DISTINCT tradeID FROM trades WHERE trades.corporationID = 1) ... unfortunately, DISTINCT JOINs seem crazy ineffective. Is there any alternative I can use to determine how much revenue a corporation has, taking into account that a corporation might be listed several times with the same tradeID?

    Read the article

  • Passing data to notification page

    - by FRKT
    I'm not sure what the best way of populating a notification page is. I've been using sessions to populate it with information, but this falls short if the user is blocking cookies. I've considered passing it in HTTP GET variables, but I'm unsure whether it's a good alternative since its length is limited by some browsers. Which method do you prefer?

    Read the article

1