Tuesday, 12 March 2019

Using OnEdit to add Date to Previous Cell in Google Sheets

Here's a nifty bit of code that will add a Date to the cell of your row when you enter data in the 3rd cell.


function onEdit(e) {
 
    var ss = e.source.getActiveSheet();
    if (ss.getName() !== 'sheet1' || e.range.columnStart !== 2return;
    e.range.offset(0, -1)
        .setValue(e.value ? new Date() : null);
}


Or if you want to have it on a couple of sheets you could use


function onEdit(e) {
 
    var ss = e.source.getActiveSheet();
  if (ss.getName() == 'sheet1' && e.range.columnStart == 2) {
    e.range.offset(0, -1)
        .setValue(e.value ? new Date() : null);
  }
  else if (ss.getName() == 'sheet3' && e.range.columnStart == 2){
    e.range.offset(0, -1)
        .setValue(e.value ? new Date() : null);
  }
  else if (ss.getName() == 'sheet5' && e.range.columnStart == 2){
    e.range.offset(0, -1)
        .setValue(e.value ? new Date() : null);
  }
  else {
   return; 
  }
  
}


Saturday, 9 March 2019

What different voice operations are there on my phone ?

What different voice operations are there on my phone ?


I have a Samsung S9 , and I thought it may be useful to others to list the ways in which I using voice commands.
Talking to your mobile to operate it and to connect to the internet is on the rise.  It’s not only often much quicker than manually operating but it also means you can use your phone hands free.  Handy if you’re Driving.

1. Google shopping list
2. Google Routines
3. Reminders
4. Sending and receiving messages
5. Sat Nav Features
6. Asking assistant to convert something for me.
7. Chatting with Google Translate
8. Dictate something to text.  Using Voice Recorder
9.  Using Pocket to Readme a Webpage
10. Help making calls hands free calls


Google Shopping List

Just add stuff to it whenever it comes into your head 

“ok google, add XXXX to my shopping list”
"show me shopping list "
You can also have multiple contributors, so everyone in the family can add to the same list. 

> To do this just click on the person icon in the top right. 

Google Routines

This is basically a wrapper for all the things you have access to in Google Assistant.  So you can string a whole heap of stuff together.
Here’s an example for you.  On a midweek night I pick up the kids and their friends from a sports activity.  I’ve programmed run this routine when I say “Ok google I’m ready to pick up”

Google then -
1. Tells me the time
2. SMS messages the parents
3. Checks my route home and tells me how long it’ll take.
4. Read my Reminder
5. Tell me a riddle ( something to amuse the kids when the get in )
6. SMS messages my wife to say I’m on the way.

There are preset Routines and you can add as many others as you'd like
1. Open Google APP
2. Go to ‘Settings’
3. Click on Google Assistant
4. Click ‘assistant’ tab
5. Click on Routines



Reminders

Using reminders at using Google assistant as a second memory is a great for someone like me who has a terrible memory.   You can set reminders on a timer, for example 
“Remind me tomorrow morning that I need to get petrol”

You can also set a reminder on location 

“remind me in Newquay Town that I need to get Petrol “

Not only that but you can just set a reminder like 

“Remember that Mike Smiths wife is called Ann”  

and then to retrieve that you’d say 

“Remind me what was Mike Smiths wife called”




Sending and receiving messages


I’ve been sending, receiving and getting read for me ; from Gmail, SMS and WhatsApp.
"Send an Email to Mum"
"Read my last email ( from XXXX ) "
"Send a SMS message to XXXX"
"Send a Whatsapp message"
"Send a Voice message"


Sat Nav Features

“Navigate to WHEREEVER”
“Get driving directions to WHEREEVER”

Tip; if you set up your personal locations in Google Maps then you can say “home”, “work”, “Mums”, ‘the Gym” etc.  This one will impress your passengers !


Asking assistant to convert something for me.

Convert Lengths, Area, Temperature, Volume, Mass & Data.  Also ( this was a revelation to me ) calculate currencies, it even does the more random ones like Czech Koruna .

"what is 15% of 135"
"how many centimetres in 2 foot"
"How much in British Pounds in 10 thousand Czech Koruna"

Google Translate


Using Google Translate is a great way to learn some basics of a language.

“What the spanish word for XXXX”
“How do you say XXXXXX  in spanish”


Podcasts and Text to Speach

Find out what Podcast that you think will be good for you to listen to.  And then use.

“Listen to XXXXX Poscast”
“Play the latest episode of XXXXXX”
“Recommend a podcast”

If you’re looking for a Text to Speech APP then I use Pocket which is awesome.  Presave your webpages that you want it to read and then when you start your journey click on the headphones and get it read back to you.




Initiate Phone Call

This one should probably be higher of the list but you can also use your phone as a phone.
Who knew eh!

Voice control helps you initiate the calls

“call a mum at home on speakerphone”




If you’ve got any call features you use then why not let me know, I’m also looking for more ways to increase my usage of Mobile phone voice assistant options.

Most of the advice I’ve wirtten about above can from Googles documentation.


https://assistant.google.com/explore

Tuesday, 7 August 2018

How to Add a Hyperlink in Power BI Desktop


  • Go to the Query editor for the Query you need to extend. 
  • Go to  Add Column
  • Click on Custom Column
  •  New Column Name = url
  • Custom column formula = "http://mysite.com" & [ Page ]
    -- where Page can be retrieved by clicking on the column name you wish from the 'Available Columns' selection on the right. 
  • CLick 'OK' 
  • Now Go back to the data view. 
  • You can now add the 'url' column to you visual . 
  • Click on the URL 'measure' on the fields display 
  • Click on 'Modelling' task 
  • You'll now be able to choose from the  'Data Category' dropdown and select 'Data Category: Web URL' 
  • If you want to change this to a link symbol instead - you can but only in Tables
  • Go to the paint roller ( formatting icon ) on the visualizations section. 
  • Under 'Values' you can choice for 'URL icon' .  Slide this to ON. 

Thursday, 12 April 2018

Drupal 7 calls to stdClass from inside and outside classes.

I have a call to 'stdClass' in my .module page. Which works fine. However when I put it in a Class method this produces an error. The fix was to put a forward slash infront of it. '/stdClass' Fixed.

Friday, 7 October 2016

JQuery on a form that sends to submit once all the fields are filled out


                              // All sections have been filled out
                // After this we'll then reveal the next section.

                $("#edit-field-supplier-email-und-0-email").focusout(function(e){
                    // has all fields got data in.  If so lets move on
                    if ( $("#edit-field-supplier-email-und-0-email").val() != '' && $("#edit-field-company-name-und-0-value").val() != '' && $("#edit-field-phone-number-und-0-value").val() != '' && $("#edit-field-post-code-und-0-value").val() != '' && $("#edit-field-supplier-email-und-0-email").val() != ''){

                        // prefill postion placing
                        $("#edit-field-position-reached-und-0-value").val(1);

                        $("#supplier-node-form").submit();

                    }

                });


Wednesday, 7 September 2016

JQuery to check a Checkbox is filled out and then add a class to the parent Div.

I had a bit of a struggle with this simple bit of code. And that was because examples I'd found hadn't include the use of .each !!

Here's a couple of searches I'd made - 'javascript checkbox value checked then add class to parent' , 'jquery onload' and 'jquery check an object with no action'

The code that worked for me is as such

 

$("input[type=checkbox], input[type=radio]").each(function(){
                    console.log('loading checkbox object');
                    // is(':checked')
                    if($(this).is(':checked')){
                        $(this).parent().addClass("chked");
                        $(this).parent().parent().addClass("chked");
                    }
                });

Thursday, 1 September 2016

Drupal 7 Form API displaying only the Parent options in an Entity / Content Field item

So what I have is a Content Form where I want to display a Term / Taxonomy but only the Parent items for the moment.

Here's a way of solving this programmatically in a Hook Form Alter.

In my hook_form_FORM_ID_alter I iterate through the options array and remove the child choices. This is easy as those choices start with a minus sign .

  foreach ($form['my_field']['und']['#options'] as $key => $value) {
   // if $value starts with '-' then its a child item and I'll unset it.
    if ($value[0] == '-'){
      unset($form['my_field']['und']['#options'][$key]);
    }

  }