Skip to main content

Posts

Showing posts from August, 2018

Mobile menu created with Bootstrap 3

// Change positioning of mobile menu icon based on screen size. $(document).ready(function(){ if($(window).width() Toggle navigation Home About Services Location Gallery Contact I have a mobile menu created with Bootstrap 3 that automatically aligns to the right side of screen. I wrote some JavaScript code to make mobile menu icon appear on the left side of screen because I have a Facebook button on the right side of screen. Everything works with my code; however, there is one area I'm trying to improve. On my gallery page I have 500+ images. The problem is my mobile menu stays on right side and pushes the Facebook button slightly over to the left until the page fully loads. After the page fully loads everything appears correctly. How ca...

MariaDB update error inner join and select

I hope you can help me again, thanks already for pointing me to the right direction with creating the check digit for the new IBAN in Germany. I am now trying to update our membership database with the newly calculated BIC and IBAN but seem to have a problem with the UPDATE statement on the MariaDB MySQL database, despite the fact that I think I got the syntax right. All I am trying to do is set the two fields "konto_bic" and "konto_iban" in the table "mitglieder" from the SELECT statement which creates a temporary table called b with the columns "id", "bic" and "iban". The "id" is the same in the two tables. Here is my first try: update a set a.`konto_bic` = b.`BIC`, a.`konto_iban` = b.`IBAN` from `mitglieder` a INNER JOIN (SELECT m.`id`, m.`nachname`, m.`vorname`, m.`konto_bank`, m.`konto_blz`, m.`konto_nummer`, k.`bic` AS 'BIC', CONCAT('DE',LPAD(98-MOD(CONVERT(CONCAT(m.`konto_blz`,LPAD(m.`k...

How to lock tables with codeigniter?

I have to run this sql routine in a model: $this->db->query('LOCK TABLE orders WRITE'); $this->db->query('TRUNCATE TABLE orders'); $this->db->query('INSERT INTO orders SELECT * FROM orders_tmp'); $this->db->query('UNLOCK TABLES'); but I get this error: Error Number: 1192 Impossible to execute the requested command: tables under lock or transaction running TRUNCATE TABLE orders I use MyISAM as DB engine on this table. Could you please help me? Solved To perform many INSERT and SELECT operations on a table real_table when concurrent inserts are not possible, you can insert rows into a temporary table temp_table and update the real table with the rows from the temporary table periodically. This can be done with the following code: mysql> LOCK TABLES real_table WRITE, temp_table WRITE; Kindly ask if it not worked for you. try this $this->db->query('TRUNCATE TAB...

Vacuum does not reclaim disk space

I have a fact table with 9.5M records. The table uses distyle=key, and is hosted on a RedShift cluster with 2 "small" nodes. I made many UPDATE and DELETE operations on the table, and as expected, I see that the "real" number of rows is much above 9.5M. Hence, I ran vacuum on the table, and to my surprise, after vacuum finished, I still see that the number of "rows" the table allocates did not come back to 9.5M records. Could you please advice what may be a reason for such a behavior? What would be the best way to solve it? A little bit of copy-pastes from my shell: The fact table I was talking about: select count(1) from tbl_facts; 9597184 The "real" number of records in the DB: select * from stv_tbl_perm where id= 332469; slice | id | name | rows | sorted_rows | temp | db_id | insert_pristine | delete_pristine -------+--------+--------------------------------------------------------------------------+----------+-------------...