|
journal
all | Rob is 20,355 days old today. |
Apr 2013 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
Sept 2013 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
2012
jan feb mar apr
may jun jul aug
sep oct nov dec
2014
jan feb mar apr
may jun jul aug
sep oct nov dec
|< << more >> >| |
Entries this day: awesome-example-requiring-temp-tables disclosure-dream helping-reinforce-all-beautiful-code-starts-ugly awesome example requiring temp tables ##13:35 Thursday 09 May 2013 1:26pm Thursday 9 May 2013 I've realized that the obtuse requirements for a certain report will be a lot easier to create with temporary tables. While digging around for info on temp tables, I found this gem of an DB example by Brian Hartsock: CREATE TABLE `dogs` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `name` VARCHAR(255) DEFAULT NULL, PRIMARY KEY (`id`) ) CREATE TABLE `legs` ( `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, `dog_id` INT(10) UNSIGNED NOT NULL, PRIMARY KEY (`id`) ) CREATE TABLE `nails` ( `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, `leg_id` INT(10) UNSIGNED NOT NULL, `last_clipped` datetime NOT NULL, PRIMARY KEY (`id`) ) Hooray for toenail ids! permalinkdisclosure dream ##06:53 Thursday 09 May 2013 6:42am Thursday 9 May 2013 _I was in a small room, controlled by the government that was a bit like prison but not completely terrible conditions and it was time for alien disclosure but they were doing it in a very specific way. Some spider webs were in my room in the corner, and there was a pillow but nothing else. I was asked to lie face down with pillow ofer my head and to cover my ears as the aliens were revealed and each person could be shwon the aliens under supeision and not get freaked out. I was already not freaked out and planned to not cover my ears and couldn't lie face down because under pillow plus face down meant I couldn't breathe. I lay down face up with the pillow like a dome over my head and covered my ears fakely so I could hear but it looked like I was covering. I could hear the guy talking to the alien and he goes, "face up?" because the alien apparently ratted on me and he checked me and I was like yeah I can't breathe otherwise. He confirmed I coudln't see anything and allowed it._ _ Eventually I wa able to see the aliens, starting with seeing them out in the yard, and was a bt curious to see they loked like very large rats. Each prson outside was assigned an alient partner, and the humans were treated them ike pets, which the aliens were allowing s they knew we just needed to get it out of our system. I was determined to treat mine more respectfully so when I was assigned my alien I immediately asked if I could learn their language. I had a large book with alien symbols (looking something like Thai writing, but with a lot more space inside and between the letters). I was talking to my alien partner and asking questions about why it seemed to take so long and why go about disclosure in this way and the reply was this is how our government wanted it and how the people seemed ready for it. I explained that we each had the ability to think without the government so they could have asked us individually. He said they had, but we didn't hear them. Hmmmm._ permalinkhelping reinforce all beautiful code starts ugly ##18:06 Thursday 09 May 2013 5:52pm Thursday 9 May 2013 "All beautiful code starts ugly" was my mantra today as I hacked in some changes to the abstract search class. It now features a new function
public function setRidiculousStationJoin($bool = true) {
$this->ridiculous_station_join = $bool;
}
The search() function went from this
protected function search($search_text = "", $limit = 0, $page_num = 1){
return $this->runSearchLimitOffset($search_text, $limit, $limit * (($page_num > 0) ? $page_num - 1 : 0));
}
to this
protected function search($search_text = "", $limit = 0, $page_num = 1){
if($this->ridiculous_station_join) {
$this->creating_temp_table = true;
$this->runSearchLimitOffset($search_text, $limit, $limit * (($page_num > 0) ? $page_num - 1 : 0));
}
$this->creating_temp_table = false;
if($this->ridiculous_station_join) {
$this->join_temp_table = true;
}
return $this->runSearchLimitOffset($search_text, $limit, $limit * (($page_num > 0) ? $page_num - 1 : 0));
}
AND, inside runSearchLimitOffset are a buncha if statements asking if $this->create_temp_table / $this->join_temp_table are true, and behaving differently accordingly. However, for the ugly hackiness, it works pretty well. My sincere hope is one of two things: 1) we can convince the client that the request doesn't result in a good UX (*) (30% likely) 2) I can clean up the code, or at least make it a bit more generalized
(*) The request is to add another option to the select that tells what sort order to show results. They want to add a "group by" option... it makes no sense! A user should be able to group by something and sort at the same time, but with this request, they can only do one or the other. permalinkprev day next day |