how to reduce line space for <pre> - html

reproducible code
Hello, I used the following code in markdown
<pre><span style="color:blue">Text = ' Sooo SAD I will miss you here in San Diego!!!'</span>, <span style="color:blue">Selected Text='Sooo SAD'</span>, <span style="color:blue">Sentiment = 'negative'</span></pre>
<pre>tokens =</pre>
<pre>input_ids = [0, 2430, 98, 3036, 5074, 939, 40, 2649, 47, 259, 11, 15610, 1597, 2977, 16506, 2, 1, 1...1]</pre>
<pre>attention_masks = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0...0]</pre>
<pre>start_tokens = [0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...0]</pre>
<pre>end_tokens = [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...0]</pre>
<pre>Edit Text = ' Sooo SAD I will miss you here in San Diego!!!' (len=46), Edit Seletected Text='Sooo SAD' (len=8)</pre>
<pre>char = [1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0...0] (len=46, num_1=9)</pre>
<pre>offset = [(0, 3), (3, 5), (5, 9), (9, 11), (11, 16), (16, 21), (21, 25), (25, 30), (30, 33), (33, 37), (37, 41), (41, 43), (43, 46)]</pre>
undesired effect
and generate the following effect
But the too wide line space makes the effect is kind of ugly. Do you know how to redue the line space?
Tried method
I tried this method
<pre style='display:inline'>tokens =</pre> <br>
<pre>input_ids = [0, 2430, 98, 3036, 5074, 939, 40, 2649, 47, 259, 11, 15610, 1597, 2977, 16506, 2, 1, 1...1]</pre>
But it only works for one line, if I want to apply to other lines such as this
<pre style='display:inline'>tokens =</pre> <br>
<pre style='display:inline'>input_ids = [0, 2430, 98, 3036, 5074, 939, 40, 2649, 47, 259, 11, 15610, 1597, 2977, 16506, 2, 1, 1...1]</pre> <br>
<pre>attention_masks = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0...0]</pre>
it would cover part of line content
Question
How to reduce the line space? Thank you

You could use css display and line-height properties on the pre elements and adjust the line-height you want.
pre {
display: inline;
line-height: 0.8em;
}
<pre><span style="color:blue">Text = ' Sooo SAD I will miss you here in San Diego!!!'</span>, <span style="color:blue">Selected Text='Sooo SAD'</span>, <span style="color:blue">Sentiment = 'negative'</span></pre>
<pre>tokens =</pre>
<pre>input_ids = [0, 2430, 98, 3036, 5074, 939, 40, 2649, 47, 259, 11, 15610, 1597, 2977, 16506, 2, 1, 1...1]</pre>
<pre>attention_masks = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0...0]</pre>
<pre>start_tokens = [0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...0]</pre>
<pre>end_tokens = [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...0]</pre>
<pre>Edit Text = ' Sooo SAD I will miss you here in San Diego!!!' (len=46), Edit Seletected Text='Sooo SAD' (len=8)</pre>
<pre>char = [1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0...0] (len=46, num_1=9)</pre>
<pre>offset = [(0, 3), (3, 5), (5, 9), (9, 11), (11, 16), (16, 21), (21, 25), (25, 30), (30, 33), (33, 37), (37, 41), (41, 43), (43, 46)]</pre>
Or reset the default margin.

You can use margin: 0 (or any other value) for pre in CSS:
pre {
margin: 0;
}
<pre><span style="color:blue">Text = ' Sooo SAD I will miss you here in San Diego!!!'</span>, <span style="color:blue">Selected Text='Sooo SAD'</span>, <span style="color:blue">Sentiment = 'negative'</span></pre>
<pre>tokens =</pre>
<pre>input_ids = [0, 2430, 98, 3036, 5074, 939, 40, 2649, 47, 259, 11, 15610, 1597, 2977, 16506, 2, 1, 1...1]</pre>
<pre>attention_masks = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0...0]</pre>
<pre>start_tokens = [0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...0]</pre>
<pre>end_tokens = [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...0]</pre>
<pre>Edit Text = ' Sooo SAD I will miss you here in San Diego!!!' (len=46), Edit Seletected Text='Sooo SAD' (len=8)</pre>
<pre>char = [1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0...0] (len=46, num_1=9)</pre>
<pre>offset = [(0, 3), (3, 5), (5, 9), (9, 11), (11, 16), (16, 21), (21, 25), (25, 30), (30, 33), (33, 37), (37, 41), (41, 43), (43, 46)]</pre>

Related

how do i rewrite the correct statement for COUNT under this condition

Bring back the count of all the batsmen who have played a certain number of innings only if there are more than one batsman who have played that number of innings. 4 innings – 2 batsmen, 5 innings – 3 batsmen etc.
SELECT COUNT(Innings) AS TotalInnings, COUNT(player) AS Totalplayer
FROM Batting
GROUP BY Player
Player is the field name for the batsmens name. I am kinda stuck on how to write the last lines statement
4 innings – 2 batsmen, 5 innings – 3 batsmen etc
This is the table design
CREATE TABLE Batting (
Player CHAR(25),
CarrerSpan VARCHAR(20),
Matches INT,
Innings INT,
Playing INT,
Runs INT,
HighestScore CHAR(10),
AverageScore NUMERIC,
BallsFaced INT,
StrikeRate NUMERIC,
Hundreds INT,
Fifties INT,
Zeros INT,
Fours INT,
Sixs INT
);
INSERT INTO Batting
VALUES ('JP Duminy', '2007-2018', 77, 71, 22, 1825, '96*', 37.24, 1468, 124.31, 0, 11, 6, 130, 65);
INSERT INTO Batting
VALUES ('AB de Villiers', '2006-2017', 78, 75, 11, 1672, '79*', 26.12, 1237, 135.16, 0, 10, 5, 140, 60);
INSERT INTO Batting
VALUES ('HM Amla', '2009-2018', 41, 41, 5, 1158, '97*', 32.16, 883, 131.14, 0, 7, 2, 133, 23);
INSERT INTO Batting
VALUES ('F du Plessis', '2012-2017', 36, 36, 6, 1129, 119, 37.63, 849, 132.97, 1, 7, 0, 102, 35);
INSERT INTO Batting
VALUES('DA Miller', '2010-2018', 58, 51, 15, 1043, '101*', 28.97, 745, 140.00, 1, 1, 0, 71, 46);
INSERT INTO Batting
VALUES('GC Smith', '2005-2011', 33, 33, 2, 982, '89*', 31.67, 770, 127.53, 0, 5, 1, 123, 26);
INSERT INTO Batting
VALUES('Q de Kock','2012-2018', 32, 32, 4, 821, 59, 29.32, 637, 128.88, 0, 2, 3, 97, 24);
INSERT INTO Batting
VALUES('JH Kallis', '2005-2012', 25, 23, 4, 666, 73, 35.05, 558, 119.35, 0, 5, 0, 56, 20);
INSERT INTO Batting
VALUES('JA Morkel', '2005-2015', 50, 38, 11, 572, 43, 21.18, 402, 142.28, 0, 0, 1, 29, 39);
INSERT INTO Batting
VALUES('F Behardien', '2012-2018', 37, 29, 13, 515, '64*', 32.18, 402, 128.10, 0, 1, 1, 37, 16);
INSERT INTO Batting
VALUES('HH Gibbs', '2005-2010', 23, 23, 1, 400, '90*', 18.18, 318, 125.78, 0, 3, 4, 45, 12);
INSERT INTO Batting
VALUES('RR Rossouw', '2014-2016', 15, 14, 3, 327, 78, 29.72, 237, 137.97, 0, 2, 2, 29, 12);
INSERT INTO Batting
VALUES('LE Bosman', '2006-2010', 14, 14, 1, 323, 94, 24.84, 219, 147.48, 0, 3, 2, 27, 20);
INSERT INTO Batting
VALUES('RR Hendricks', '2014-2018', 13, 13, 0, 294, 70, 22.61, 262, 112.21, 0, 1, 2, 33, 3);
INSERT INTO Batting
VALUES('MV Boucher', '2005-2010', 25, 21, 6, 268, '36*', 17.86, 275, 97.45, 0, 0, 0, 22, 2);
INSERT INTO Batting
VALUES('RE Levi', '2012-2012', 13 ,13, 2, 236, '117*', 21.45, 167, 141.31, 1, 1, 3, 20, 15);
INSERT INTO Batting
VALUES('MN van Wyk', '2007-2015', 8, 7, 1, 225, '114*', 37.50, 157, 143.31, 1, 1, 0, 19, 14);
INSERT INTO Batting
VALUES('CA Ingram', '2010-2012', 9, 9, 1, 210, 78, 26.25, 162, 129.62, 0, 1, 1, 23, 7);
INSERT INTO Batting
VALUES('JM Kemp', '2005-2007', 8, 7, 3, 203, '89*', 50.75, 160, 126.87, 0, 1, 0, 17, 10);
INSERT INTO Batting
VALUES('J Botha', '2006-2012', 40, 0, 9, 201, 34, 18.27, 165, 121.81, 0, 0, 1, 15, 9);
INSERT INTO Batting
VALUES('H Davids', '2012-2013', 9, 9, 0, 161, 68, 17.88, 134, 120.14, 0, 2, 2, 18, 4);
INSERT INTO Batting
VALUES('JL Ontong', '2008-2015', 14, 10, 0, 158, 48, 15.80, 109, 144.95, 0, 0, 1, 6, 11);
INSERT INTO Batting
VALUES('JT Smuts', '2017-2018', 8, 8, 0, 126, 45, 15.75, 114, 110.52, 0, 0, 1, 14, 5);
INSERT INTO Batting
VALUES('RJ Peterson', '2006-2014', 21, 12, 4, 124, 34, 15.50, 113, 109.73, 0, 0, 1, 13, 2);
INSERT INTO Batting
VALUES('WD Parnell', '2009-2017', 40, 13, 9, 114, '29*', 28.50, 96, 118.75, 0, 0, 0, 10, 3);
INSERT INTO Batting
VALUES( 'H Klaasen', '2018-2018', 4, 4, 0, 110, '69', 27.50, 64, 171.87, 0, 1, 0, 5, 9);
INSERT INTO Batting
VALUES( 'M Mosehle', '2017-2017', 7, 6, 1, 105, '36', 21.00, 65, 161.53, 0, 0, 0, 6, 9);
INSERT INTO Batting
VALUES( 'D Wiese', '2013-2016', 20, 11, 4, 92, '28', 13.14, 75, 122.66, 0, 0, 1, 4, 3);
INSERT INTO Batting
VALUES( 'SM Pollock', '2005-2008', 12, 9, 2, 86, '36*', 12.28, 70, 122.85, 0, 0, 3, 4, 4);
INSERT INTO Batting
VALUES( 'CH Morris', '2012-2018', 17, 10, 3, 77, '17*', 11.00, 70, 110.00, 0, 0, 2, 7, 2);
INSERT INTO Batting
VALUES( 'RE van der Merwe', '2009-2010', 13, 6, 3, 57, '48', 19.00, 50, 114.00, 0, 0, 1, 2, 4);
INSERT INTO Batting
VALUES( 'C Jonker', '2018-2018', 1, 1, 0, 49, '49', 49.00, 24, 204.16, 0, 0, 0, 5, 2);
INSERT INTO Batting
VALUES( 'HG Kuhn', '2009-2017', 7, 6, 2, 49, '29', 12.25, 42, 116.66, 0, 0, 0, 3, 2);
INSERT INTO Batting
VALUES( 'JJ van der Wath', '2006-2007', 8, 4, 1, 46, '21', 15.33, 39, 117.94, 0, 0, 0, 3, 1);
INSERT INTO Batting
I think this could be the solution to your problem:
Query1
SELECT Innings,
COUNT(player) AS Totalplayer
FROM Batting
GROUP BY Innings
HAVING COUNT(player) > 1;
OR
Query2
SELECT Innings,
COUNT(player) AS Totalplayer
FROM Batting
GROUP BY Innings
HAVING COUNT(Innings) > 1;
Sample Output :
Innings
Totalplayer
4
2
6
3
7
2
9
3
10
2
13
3
14
2
23
2
View on DB Fiddle
Well you can save the number of rows for which the Innings column has certain value. You can save this number in a temporary table and then query the table. See following SQL:
CREATE TEMPORARY TABLE BatsmenCount (SELECT count(*) as total FROM Batting WHERE Innings=71);
SELECT * FROM BatsmenCount WHERE total > 1;
This query will return the number of batsmen that have played 71 innings and save the result in a temporary table. Next this number is fetched using SELECT query. If the query returns no results, then the number of batsmen that have played 71 innings is 1 or less. If the query returns a result, then this result is the number of batsmen that have played 71 innings.
See the SQL code on dbfiddle.

Problem Static analysis when importing a large database

I have a problem with importing a large database. I created a database on PHPMyAdmin on my wamp64 locally and then installed a GLPI with this database. Now that everything is functional I would like to import it on the company's server where I am to set up my GLPI with my database instead of the current one. However I have a problem when I go to the company's PhPMyAdmin I try to import a database but I have an error that tells me""" so I try to zip the file so that it is less heavy or to create the line $cfg['UploadDir'] ='upload'; but when I do that I have this error :
Error
Static analysis :
1 errors found during the analysis.
Unrecognized keyword. (near "ON" at position 25)
SQL query: Modify Modify Modify
SET FOREIGN_KEY_CHECKS = ON;
MySQL replied: Documentation
2006 - MySQL server has gone away
Warning in .\libraries\dbi\DBIMysqli.class.php#261
mysqli_query(): MySQL server has gone away
Backtrace
.\libraries\dbi\DBIMysqli.class.php#261: mysqli_query( object, string
INSERT INTO glpi_crontasklogs (id, crontasks_id,
crontasklogs_id, date, state, elapsed, volume, content)
VALUES (1, 9, 0, \'2019-03-01 15:39:08', 0, 0, 0, 0, 0, \'Run mode:
CLI\'), (2, 9, 1, \'2019-03-01 15:39:08\', 1, 0.0755451, 0, \'Collect
mails from assistance#carpediem.pro
({outlook.office365.com:995/pop/ssl})\n\n\'), (3, 9, 1, \'2019-03-01
15:39:08\', 1, 0.645032, 0, \'Number of messages: available=0,
retrieved=0, refused=0, errors=0, blacklisted=0\n\n\'), (4, 9, 1,
\'2019-03-01 15:39:08\', 2, 1.23802, 0, \'Action completed, no
processing required\'), (7, 9, 0, 0, \'2019-03-01 15:40:18\', 0, 0, 0,
0, \'Run mode: CLI\'), (8, 9, 7, \'2019-03-01 15:40:18\', 1,
0.0849578, 0, \'Mail collection from assistance#carpediem.pro ({outlook.office365.com:995/pop/ssl})\n\n\'), (9, 9, 7, \'2019-03-01
15:40:18\', 1, 1.17437, 0, \'Number of messages: available=0,
retrieved=0, refused=0, errors=0, blacklisted=0\n\'), (10, 9, 7,
\'2019-03-01 15:40:18\', 2, 1.45225, 0, \'Action completed, no
processing required\'), (11, 29, 0, \'2019-03-01 15:40:18\', 0, 0, 0,
0, \'Run mode: CLI\'), (12, 29, 11, \'2019-03-01 15:40:18\', 2,
0.126937, 0, \'Action completed, no processing required\'), (15, 9, 0, 0, \'2019-03-01 15:41:07\', 0, 0, 0, 0, \'Run mode: CLI\'), (16, 9,
15, \'2019-03-01 15:41:07\', 1, 0.0819528, 0, \'Collect mails from
assistance#carpediem.pro ({outlook.office365.com:995/pop/ssl})\n\n\'),
(17, 9, 15, \'2019-03-01 15:41:07\', 1, 0.995655, 0, \'Number of
messages: available=0, retrieved=0, refused=0, errors=0,
blacklisted=0\n\n\'), (18, 9, 15, \'2019-03-01 15:41:07\', 2, 1.05668,
0, \'Action completed, no processing required\'), (21, 9, 0, 0,
\'2019-03-01 15:42:17\', 0, 0, 0, 0, \'Run mode: CLI\'), (22, 9, 21,
\'2019-03-01 15:42:17\', 1, 0.0884838, 0, \'Collect mails from
assistance#carpediem.pro ({outlook.office365.com:995/pop/ssl})\n\n\'),
(23, 9, 21, \'2019-03-01 15:42:17\', 1, 1.15658, 0, \'Number of
messages: available=0, retrieved=0, refused=0, errors=0,
blacklisted=0\n\n\'), (24, 9, 21, \'2019-03-01 15:42:17\', 2, 1.20123,
0, \'Action completed, no processing required\'), (25, 17, 0, 0,
\'2019-03-01 15:42:17\', 0, 0, 0, 0, \'Run mode: CLI\'), (26, 17, 25,
\'2019-03-01 15:42:17\', 2, 0.102944, 0, \'Action completed, no
processing required\'), (31, 9, 0, 0, \'2019-03-01 15:43:05\', 0, 0,
0, 0, \'Run mode: CLI\'), (32, 9, 31, \'2019-03-01 15:43:05\', 1,
0.0800591, 0, \'Collect mails from assistance#carpediem.pro ({outlook.office365.com:995/pop/ssl})\n\n\'), (33, 9, 31, \'2019-03-01
15:43:05\', 1, 1.04019, 0, \'Number of messages: available=0,
retrieved=0, rejected=0, errors=0, blacklisted=0\n\n\'), (34, 9, 31,
\'2019-03-01 15:43:05\', 2, 1.05323, 0, \'Action completed, no
processing required\'), (35, 23, 0, 0, \'2019-03-01 15:43:05\', 0, 0,
0, 0, \'Run mode: CLI\'), (36, 23, 35, \'2019-03-01 15:43:05\', 2,
0.117135, 0, \'Action completed, no processing required'), (39, 9, 0, 0, \'2019-03-01 15:44:16\', 0, 0, 0, 0, \'Run mode: CLI\'), (40, 9,
39, \'2019-03-01 15:44:16\', 1, 0.0911481, 0, \'Collect emails from
assistance#carpediem.pro ({outlook.office365.com:995/pop/ssl})\n\n\'),
(41, 9, 39, \'2019-03-01 15:44:16\', 1, 1.14253, 0, \'Number of
messages: available=0, retrieved=0, refused=0, errors=0,
blacklisted=0\n\n\'), (42, 9, 39, \'2019-03-01 15:44:16\', 2, 1.18234,
0, \'Action completed, no processing required\'), (45, 9, 0, 0,
\'2019-03-01 15:45:03\', 0, 0, 0, 0, \'Run mode: CLI\'), (46, 9, 45,
\'2019-03-01 15:45:03\', 1, 0.053148, 0, \'Collect mails from
assistance#carpediem.pro ({outlook.office365.com:995/pop/ssl})\n\n\'),
(47, 9, 45, \'2019-03-01 15:45:45:03\', 1, 0.933414, 0, \'Number of
messages: available=0, retrieved=0, refused=0, errors=0,
blacklisted=0\n\n\'), (48, 9, 45, \'2019-03-01 15:45:03\', 2,
0.941932, 0, \'Action completed, no processing required\'), (49, 29, 0, \'2019-03-01 15:45:03\', 0, 0, 0, 0, \'Run mod.....
.\libraries\plugins\import\ImportSql.class.php#161:
PMA_importRunQuery( string 'DROP TABLE IF EXISTS glpi_crontasks',
string 'DROP TABLE IF EXISTS glpi_crontasks', boolean false, array,
) .\import.php#641: ImportSql->doImport(array)
Can you help me because I don't know where the problem comes from and I don't know how to fix it
Using phpmyadmin to export and import a large database might be suboptimal.
Use mysqldump command to backup and mysql to restore. There are plenty of examples over the net. Just a head start:
Backup
mysqldump --add-drop-table --complete-insert --extended-insert --quote-names --host=localhost --user=root --password=YOURPASSWORD glpi > c:\glpibackup\glpi_mysqldump.sql
Restore
mysql -u root -p YOURPASSWORD < c:\glpibackup\glpi_mysqldump.sql

MYSQL- Substract two colums and get the result

I am trying to write a query wherein it should count the number of students and tell me the remaining seats available in a vehicle.
Have managaed to identify which student is associated to which bus but getting stuck to find the seat remaining
Below is data :
vehnum route seats student id
23 2 45 2345
33 3 46 6789
Below is the query :
SELECT deveh.vehicle_reg_no AS vehnum
, veh.route_code AS route
, deveh.seating_capacity AS vehseat
, class.fk_stu_id
FROM tbl_stu_class AS class
JOIN tbl_stu_route AS route
ON route.fk_stu_cls_id = class.pk_stu_cls_id
JOIN list_routes AS veh
ON route.fk_route_id = veh.pk_route_id
JOIN list_vehicles AS deveh
ON deveh.pk_vehicle_id = veh.fk_vehicle_id
WHERE class.fk_year_id = 62
AND class.current_yr = 'Y'
Added sample data :
INSERT INTO `list_vehicles` (`pk_vehicle_id`, `vehicle_reg_no`, `vehicle_type`, `regd_owner_name`, `seating_capacity`, `brand_model`, `type_of_body`, `reg_address`, `fuel_type`, `chasis_no`, `reg_authority`, `engine_no`, `color`, `reg_date`, `reg_valid_date`, `month_yr_mfg`, `fk_user_id`, `timestamp`) VALUES
(46, 'J58987', 'Bus', 'M', 30, 'VOlvo', 'Steel', 'FBD', 'Petrol', '565', 'M1', '5689', 'blue', '2016-10-02', '2016-10-02', '2014-12-31', 1, '2018-07-11 18:01:06'),
(53, 'J1234', 'Bus', 'der', 45, 'Volvo', 'Metal', 'Indirapuram', 'Petrol', '123456', 'det', '2365', 'blue', '2010-12-12', '2020-12-12', '2009-12-11', 1, '2018-07-12 06:54:50'),
(54, 'J1234er', 'Van', 'der', 46, 'Volvo', 'Metal', 'Indirapuram', 'Petrol', '12345634', 'det', '236534', 'blue', '2020-02-03', '2020-02-03', '2008-11-11', 1, '2018-07-12 06:57:59');
INSERT INTO `tbl_stu_class` (`pk_stu_cls_id`, `fk_stu_id`, `fk_year_id`, `fk_class_id`, `fk_section_id`, `current_yr`, `fk_user_id`, `timestamp`) VALUES
(1, 56, 50, 22, 10, 'N', 1, '2018-06-08 06:57:34'),
(3, 123, 50, 24, 7, 'N', 1, '2018-06-12 07:54:46'),
(4, 126, 50, 24, 7, 'N', 56, '2018-06-12 07:54:46'),
(5, 123, 52, 25, 7, 'Y', 1, '2018-06-12 17:30:32'),
(6, 126, 52, 25, 7, 'Y', 1, '2018-06-12 17:30:32'),
(7, 132, 50, 22, 9, 'Y', 1, '2018-06-24 10:27:57'),
(8, 133, 51, 23, NULL, 'Y', 1, '2018-06-24 18:22:33'),
(10, 127, 51, 23, NULL, 'Y', 0, '2018-07-11 17:47:05'),
(11, 134, 62, 22, NULL, 'Y', 0, '2018-07-13 08:11:16'),
(12, 135, 62, 21, 7, 'Y', 1, '2018-07-13 11:12:08'),
(13, 136, 62, 21, 9, 'Y', 1, '2018-07-13 14:59:04');

Timestamp in Google Spreadsheets not working properly anymore

Since last weeks update in Google Spreadsheets, this code is not working properly anymore. Only when a user ENTERS data, timestamp appears, when a user PASTE data, nothing happens.
This is the code we use:
function onEditSwapsheet(e) {
var s = e.source.getActiveSheet(),
sheets = ["5B","10B","15B","20B","25B","30B","35B","40B","50B","60B","70B","80B","90B","100B" ],
watchCols = [6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110,],
offsetCol = [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,],
sheetInd = sheets.indexOf(s.getName()),
colInd = watchCols.indexOf(e.range.columnStart);
if (sheetInd === -1 || colInd === -1 ) return;
e.range.offset(0, offsetCol[colInd])
.setValue(!e.value ? null : Utilities.formatDate(new Date(), "GMT+0100", "HH:mm dd/MM"))
}

Mathematica: inverse IntegerDigits with FromDigits

Using IntegerDigits and ToCharacterCode I convert a String a 2D Table of binary. Now I need to reverse this and all the Mathematica Help claims that FromDigits is the inverse of IntegerDigits. Yet I cannot get back to my original string. Here's my code:
ConvTextTo[s_String]:= IntegerDigits[ToCharacterCode[s],2, 8];
ConvTextFrom[l_List]:= FromCharacterCode[FromDigits[l, 2]];
This returns gibberish and I cannot figure out why. If FromDigits is indeed the inverse of IntegerDigits, why doesn't this work, for god's sake? This is driving me insane, I googled this for an hour now, I cannot find a solution. I've tried whatever I could think of, nothing seems to produce a result.
Thanks for your help.
You did well but there is just a little more to it. First you need to Map (/#) FromDigits onto each binary sequence, representing one character. Second Apply (##) StringJoin to the result of FromCharacterCode to get the original concatenated String. Apply replaces the Head of any expression with a new function that is applied to its arguments.
In general on reducing frustration :-) try giving the problem a rest and coming back to it, or just asking for help as you did. It's an elegant language and will gradually become instinctive.
In[9]:= string1 =
"The quick brown fox jumped over the lazy white dog.";
In[10]:= ToCharacterCode#string1
Out[10]= {84, 104, 101, 32, 113, 117, 105, 99, 107, 32, 98, 114, 111, \
119, 110, 32, 102, 111, 120, 32, 106, 117, 109, 112, 101, 100, 32, \
111, 118, 101, 114, 32, 116, 104, 101, 32, 108, 97, 122, 121, 32, \
119, 104, 105, 116, 101, 32, 100, 111, 103, 46}
In[11]:= IntegerDigits[%10, 2, 8]
Out[11]= {{0, 1, 0, 1, 0, 1, 0, 0}, {0, 1, 1, 0, 1, 0, 0, 0}, {0, 1,
1, 0, 0, 1, 0, 1}, {0, 0, 1, 0, 0, 0, 0, 0}, {0, 1, 1, 1, 0, 0, 0,
1}, {0, 1, 1, 1, 0, 1, 0, 1}, {0, 1, 1, 0, 1, 0, 0, 1}, {0, 1, 1, 0,
0, 0, 1, 1}, {0, 1, 1, 0, 1, 0, 1, 1}, {0, 0, 1, 0, 0, 0, 0,
0}, {0, 1, 1, 0, 0, 0, 1, 0}, {0, 1, 1, 1, 0, 0, 1, 0}, {0, 1, 1, 0,
1, 1, 1, 1}, {0, 1, 1, 1, 0, 1, 1, 1}, {0, 1, 1, 0, 1, 1, 1,
0}, {0, 0, 1, 0, 0, 0, 0, 0}, {0, 1, 1, 0, 0, 1, 1, 0}, {0, 1, 1, 0,
1, 1, 1, 1}, {0, 1, 1, 1, 1, 0, 0, 0}, {0, 0, 1, 0, 0, 0, 0,
0}, {0, 1, 1, 0, 1, 0, 1, 0}, {0, 1, 1, 1, 0, 1, 0, 1}, {0, 1, 1, 0,
1, 1, 0, 1}, {0, 1, 1, 1, 0, 0, 0, 0}, {0, 1, 1, 0, 0, 1, 0,
1}, {0, 1, 1, 0, 0, 1, 0, 0}, {0, 0, 1, 0, 0, 0, 0, 0}, {0, 1, 1, 0,
1, 1, 1, 1}, {0, 1, 1, 1, 0, 1, 1, 0}, {0, 1, 1, 0, 0, 1, 0,
1}, {0, 1, 1, 1, 0, 0, 1, 0}, {0, 0, 1, 0, 0, 0, 0, 0}, {0, 1, 1, 1,
0, 1, 0, 0}, {0, 1, 1, 0, 1, 0, 0, 0}, {0, 1, 1, 0, 0, 1, 0,
1}, {0, 0, 1, 0, 0, 0, 0, 0}, {0, 1, 1, 0, 1, 1, 0, 0}, {0, 1, 1, 0,
0, 0, 0, 1}, {0, 1, 1, 1, 1, 0, 1, 0}, {0, 1, 1, 1, 1, 0, 0,
1}, {0, 0, 1, 0, 0, 0, 0, 0}, {0, 1, 1, 1, 0, 1, 1, 1}, {0, 1, 1, 0,
1, 0, 0, 0}, {0, 1, 1, 0, 1, 0, 0, 1}, {0, 1, 1, 1, 0, 1, 0,
0}, {0, 1, 1, 0, 0, 1, 0, 1}, {0, 0, 1, 0, 0, 0, 0, 0}, {0, 1, 1, 0,
0, 1, 0, 0}, {0, 1, 1, 0, 1, 1, 1, 1}, {0, 1, 1, 0, 0, 1, 1,
1}, {0, 0, 1, 0, 1, 1, 1, 0}}
In[14]:= FromDigits[#, 2] & /# %11
Out[14]= {84, 104, 101, 32, 113, 117, 105, 99, 107, 32, 98, 114, 111, \
119, 110, 32, 102, 111, 120, 32, 106, 117, 109, 112, 101, 100, 32, \
111, 118, 101, 114, 32, 116, 104, 101, 32, 108, 97, 122, 121, 32, \
119, 104, 105, 116, 101, 32, 100, 111, 103, 46}
In[15]:= FromCharacterCode## & /# %14
Out[15]= {"T", "h", "e", " ", "q", "u", "i", "c", "k", " ", "b", "r", \
"o", "w", "n", " ", "f", "o", "x", " ", "j", "u", "m", "p", "e", "d", \
" ", "o", "v", "e", "r", " ", "t", "h", "e", " ", "l", "a", "z", "y", \
" ", "w", "h", "i", "t", "e", " ", "d", "o", "g", "."}
In[16]:= StringJoin ## %15
Out[16]= "The quick brown fox jumped over the lazy white dog."