Monday, August 30, 2021

Perseverance pictures straight to your Gmail

Perseverance Rovers Image of Mars

Mars Perseverance Rover is at Sol 186 on Mars. Since it's landing last February 18, 2021, it already roamed 1.97 km (1.22 mi) and spent 4611 hours on an alien planet. I'm going to describe the science and the technical aspect of the Rover. Instead, I will share to you on how to capture the raw images from Mars as captured by Mars Perseverance rover's many camera.

Note: The script/code is not a gmailapp, it's a stand alone script written with Google Apps Script

NASA Open API

The images are open for public to view. Stay tune on their Mars Perseverance Multimedia site when it's published. Or, you can always get ahead using NASA Open API. Of course, we'll make use of Google Apps Script to fetch from the API. Run the code on a daily basis. Then email the images properly into our Gmail inbox. Now, that's really cool way to get those images fresh.

Sample email output

Just a caution, the script only allows upto 100 images to be embedded in the Gmail body. It's the html table with rows capped at that number. Beyond that cap, will cause an error. As a remedy, I've added a line where the full html saved into a text file, saved into a my GDrive then attach it to the email notification.

Sample gmail notification


The Script (have fun!):

Friday, August 27, 2021

Google Sheets as API database

API - An application programming interface is a connection between computers or between computer programs. It is a type of software interface, offering a service to other pieces of software. A document or standard that describes how to build such a connection or interface is called an API specification [wikipedia].

It's a popular resource for developers in tapping external databases. A staple of every web application consumables. It may sound high-tech. But, the application is a very foundational and with the right approach and basic database knowledge, it is a very powerful tool.

API is most of the time offered for free or premium to developers. Depending on the application and level of data exposure, sometimes this is very expensive. But, for hobbyist and early stage learners. There's ready platform we can take advantage and host your own API.

Here comes Google Sheets

Google sheets it's not just a spreadsheet. Just take off your mind on the Microsoft Suite comparison. Google Apps offers great flexibility in terms of customizing your sheets application. In this article I will show how you make use of sheets as database for your API.

In this application, I will use my existing API integration with NASA API on Mars rover weather collection in Mars. This will not cover the process where I tap the Mars Weather API and pulling them into a spreadsheet. Please see Mars Weather and how to fetch the data for understanding how I was able to pull the resources automatically.


Sample Calls: 
Here's the Script:

Monday, August 23, 2021

IP what is my address

 

IP what is my?



It's a really weird question. It's like asking a genie for something. Basically asking for an address. This is an age old question in the context of internet history. A very basic information, yet most of us are yet hitting search on Google.

On average, 1 million - 10 million monthly searches for this question. It's a very interesting information considering majority of us went through computer class/lessons. I'm pretty sure this was mentioned many times. And for those are searching for this information, for sure, are well versed enough with these code.

So, what my ip address and how to determine this?

  1. Let's start with the simplest approach. On Google search, type "what is my ip". At the top of the search result is the actual information. This is also the same address that Google used to return local result using your location.


  2. Then there's the searching through your PC setting. 




  3. Then there's the command prompt. A very straight forward approach, by the way. A good way to show-off as well. You know just want to impress, how good you are with IT stuff, typing and going into the telnet aspect of identifying your IP Address. On windows, go to Search and type cmd and it enter. Then type Ipconfig in the black screen =). Just look for the blinking cursor =)

And before I forget, on a Mac..

Go to your System Preferences and follow the images below.



If you're that confident with the MacOS Terminal
  1. Start Terminal
  2. Enter the command ipconfig getifaddr en1 at the command prompt. Or...
  3. Enter the command ipconfig getifaddr en0


There you have it. Be aware of this information as you will encounter or be needing this as more devices are connected in the internet. Even in your homes, this will be a staple and to provide proper allocation of internet usage and level of control as well.

Saturday, August 21, 2021

Ingenuity's flight

 

It's not news anymore that powered flight was successfully conducted on Mars. First flight was on April 19, 2021 and had logged 12 flights with almost 22 hrs of flight time. That's impressive for an autonomous helicopter on a planet 300 million miles away from Earth. This is not your typical NASA Mars Exploration article. Instead an idea that was influenced with Chrome's Dino Run and a fun side of with Mars Helicopter's Ingenuity as it takes flight in a webpage.

How about we keep it flying?

I'm sharing a project that I've been working to do just as this. I will not create an actual helicopter. Instead, I'll create a web app that could apply the same dynamics as Google Chrome's Dino run. Well...the foundation...for start.


I'm not going to create the game. But, I'm going to share the baseline on how that endless strip of scene as the main character run its way through the desert. On this case, I'll let Mars Helicopter fly endlessly with the Martian terrain and mountains as the background. I'm using Google Apps Script to build this project. Long term goal is to make this interactive like that Dino run above. Who knows, I might get bored some more...





Embed code from github two ways

As a blogger and a programmer at the same time. Bringing your code to the general audience creates sense of pride. It depends on the language, presenting them as close to how it appears in an IDE would be very helpful for the readers. You can always take screens shots and post them on your blog as an image. But, most of the coder out there, that code in an image is not useful. Every coder needs a text based blocks of scripts to copied easily. 

So how would you post your script to a blog post and retail the visual text representation just like in an IDE?

Github

It is a popular platform for software developer to host codes. It simply offers the ability to share scripts for multiple developers and offer version controls to managed source code systematically. For mainstream developers, it does that efficiently. But for a blogger, it gives that flexibility, to capture those posted scripts and share it through a blog.

Embed code from github two ways

This involves editing your site in html level. You are reading this article upto this line, for sure you know what I'm talking about.

https://github.com/ - the main site and how to embed your code from this domain. It should look same in the image below. Just incase the actual implementation works on this article.

The script embedded:





https://gist.github.com/ - this approach works similar with above approach. In the main github repository, on url is good for single file repository. In gist, single gist file can hold multiple blocks of codes in different file type (i.e., .html, .js, .css and etc). Below is how you copy your gist url and write on the html level of your article.



The script embedded:

Which is better? 

Lately, using the http://gist-it.appspot.com causes some intermittent issues of showing up. Or, not really working at all. There could be some new guidelines or new link, I don't have any information as of the moment. But, if you have, feel free to share in the comment below.



Tuesday, August 17, 2021

Hoodies for guys

I'm a hoodie guy and wearing gives me such expression of one being in the tech industry. It also reflects my introvert side...you know with the hoodies on, gets you that concealment and do your stuff privately. Being a coder, it give's such incognito profile.

10 favorite hoodie designs

Here are some of my top choices if you want to express as a coder with a hoodie. Hope you'll like them as well.

SEMICOLON Any coder will figure this out. Miss this one and debug mode is a "killer".
CODE NINJA All of us thinks we are a ninja. The red color give's that strength and the brute side of it...I think
CODER DEFINED This funny geek t-shirt is great for computing programmer, computer science, geeks, coders and software developers. They think and breathe code from HTML, Javascript, PHP, C, C#, C++ or Python. This programmer meaning t-shirt is perfect as a gift for Christmas, birthdays or a fathers day tee for your dad.
DEBUG 6 STAGES You love fixing bugs, errors, coding and programming? Sounds like you need to purchase this Computer Specialist Debugging Tee for to show it to the nerds or admin in the office or purchase it as a gift for a friend geek, hacker, software developer or designer.
COMMIT TO MASTER This is actually something you should never do. A trolling design created to cause your fellow programmers blow a gasket. That's how focused we are.
A BUG OR A FEATURE It's not a bug...it's a feature...so what really is it? only a programmer knows...
IM A HACKER The idea is to use binary code to write the statement. So the T-shirt statement is "I AM A HACKER"...Or is it? Figure it out...
HEADPHONES ARE ON THESE HEADPHONES ARE ON FOR A REASON...So just back-off
ITS ACTUALLY TRUE It's actually true...just trust us...
WHILE LOOP To be clear it's not an infinite loop...

Monday, August 16, 2021

Power bi and how to organize your measures

 


Power Bi had gain significant traction in the business analytics space. Microsoft had proven to penetrate the market and successfully, introduced the app into a staple in the office productivity as well. In this article, I will not dwell into the history and the features of the tool. Instead, I will show you how to organize your power bi fields for easy and smooth dashboard development. 

Power Bi for dashboard

Yes, it is for that purpose and in the business analytics practice, this is a very useful tool. Seeing the numbers graphically and at a glance had proven efficient in drawing out insight and quick decisions. But, creating those highly interactive charts and graphs, could be harder than thought. 

The development could be messy and to produce that summary or data point could involved layers of calculation.

Navigating in the Development phase

Developing a power bi dashboard could be straightforward ( as what Microsoft intends it to be ). Just a heads up though, you could get lost in the sea of data fields as you get to dive in this application. Most times you will have to need to create customer formulas to draw certain calculation. This customize calculation is what we called as Measures.

Measures

There are actually two types and the are;

  • Quick Measure - this is a preset formula most of them are self explanatory such as rolling averages.
  • Custom Measure - this is an outright creation of the formula. Pretty much same as having one in a spreadsheet.

How to organize your measures?

Dealing with multiple fields on your data can be confusing. At some point, as you created multiple measures, unknowingly you've duplicated some. So, how do you manage this kind of scenario and somehow create an efficient way of navigating your measures.

Two ways to "5S" your measures

  • Folders - this is the most effective approach. Containing your measures into a folder see below for the demo
  • Simple prefix - this is just a personal labeling approach that I've done which is also effective. Example below shows "#_" as prefix. In this way, I have all measures at the top of the field list. It's helpful for I tend to create more measures when developing PowerBi dashboards. 

Being effective with PowerBi is basically doing 5S on your back-end. The foundation to create useful dashboard starts with sustainable Power Bi desktop (.pbix) files. Making your data fields tidy and easy to navigate is key in the development phase. How about you? Do you have any better approach? Let us know in the comment section below.




Saturday, August 14, 2021

Google Apps Script and How to allow web camera access

Coding is fun! 

 I've been doing coding for more than 10 years now. Tried various programming languages and had a fair share of creating applications. May it be in office productivity, database, simple game application and even doing customized camera capture skins.

Camera skins in this aspect is where you could see those texts or captions in the background while capture is on-going. Although there are free applications out there, which I'm sure, can do better. I've just built my own for fun. 

If you have seen The Martian movie. Below is what I have in mind. Doing live video log with live weather attributes (with graphs) in the background. How cool is that!


In my version, I did capture current weather information as captured by Mars Perseverance Rover currently on Mars. See script below and enjoy! For more info and code on how to capture Mars Weather data from Perseverance Rover, you can check this post > Mars Weather and how to fetch the data

The  script:



Tuesday, August 10, 2021

Google Apps Script and how to access NASA API for Mars pictures



Most of us, probably, would get that "front row" passes just to have that first peek. We can't just wait for NASA Mars 2020 and NASA JPL site to prompt us in our newsletter subscription.

NASA APIs } have been generous and let us have that "front row" ticket for free. It is a good way for bloggers and hobbyists alike to play around with code and get that first had snippets of the images that NASA Perseverance rover captured on Mars.

Take note though in the Rover Camera list below, Perseverance is not yet available. But, don't worry, I got you covered on that one.

AbbreviationCameraCuriosityOpportunitySpirit
FHAZFront Hazard Avoidance Camera
RHAZRear Hazard Avoidance Camera
MASTMast Camera
CHEMCAMChemistry and Camera Complex
MAHLIMars Hand Lens Imager
MARDIMars Descent Imager
NAVCAMNavigation Camera
PANCAMPanoramic Camera
MINITESMiniature Thermal Emission Spectrometer (Mini-TES)

Google apps script in the works

If you know JavaScript Google Apps Script will can surely help you make those postcard from Mars delivered at your will. In the NASA API's, resources for Perseverance haven't disclosed yet. But, it is not that difficult to create since we already have the base API URL's in place with the previous rovers. All we need is to be guided with the available cameras in the rover and the latest Sol it captured.

You can view the code on my github link [ NASA Perseverance Rover image resources API ]. Here's a snippets of the code in image format.

The script:


Mars Weather and how to fetch the data

What's the weather on Mars? Aside from drilling holes and collecting samples from the Martian surface, it is vital to keep tabs on the environmental information. I'm sure it's not all sunny all throughout a Martian year. If at all sunny, what could be the temperature and how the atmospheric variation for each Sols. Mars rover have to capture information such as these. It would be helpful to future missions on how the seasons on Mars varies and how could future rovers or even human missions sustain such a fluctuation with minimal disruption.

This is not a technical article of analyzing Mars Weather. Instead, as hobbyist, I'm going to share on how to fetch such information for personal or education purposes. But, before we dive into the "how" here's a short background on the REMS.

How we can take hold of such weather data?

With API we can get these information or data. The question is what API. NASA open API have published for InSight: Mars Weather. With Curiosity REMS, it's not openly shared. But, here, I will show you how. If you'll look into Mars MSL Curiosity REMS page. Inspect the webpage at the right element you will see the API they are currently using to create the weather information posted on the page as shown below.

The API URL is https://mars.nasa.gov/rss/api/?feed=weather&category=msl&feedtype=json. Opening this link will direct you to a page which contains all weather data since Sol 1. That's almost 3000 lines of data, considering is about Sol 3073 on Gale Crater Mars. You can always get down to coding and create ways to fetch those JSON data into usable and structured table. A .csv or directly written into a spreadsheet.

This approach is for script written in Google Apps Script. What's about to be shown are methods on...

  1. How to fetch the REMS Curiosity data and write accordingly the latest Sol info into a spreadsheet.
  2. Fetch like an online API where you can pick the information you only need. The API show above is not clearly mapped and no documentation available (found) to properly access the resources. Creating the API for you from the daily fetch done from the main API will be convenient for developers who just want the direct data right away. 
To save you time, you can access the full script on this github link https://github.com/git-janus/tracking_perseverance/blob/master/Mars_Weather_API_custom.js. Here are snippets of the code. Apologies for some image may not be clear enough. But, you may go ahead use above github link for better view of the code. As of the moment, it only caters with MSL Curiosity REMS data. I was hoping that I could find the API for Perseverance MEDA. Until such time we can have another attributes to our tracking percy as it searches for clues on Mars.

The script: