Learn2c.org web site has a new, cleaner and simpler look

I have redesigned the Learn2c.org web site to feature this clean and simple look, with less clutter than I had on the prior design. Do not be alarmed – its the same web site as before!

The following is a cross-post from my older web site on App Inventor:

This web site – appinventor.pevest.com – is no longer the primary web site for our App Inventor tutorials. However, that web site will remain there indefinitely as many people link to it, including search engines and my own e-books 🙂

The new, short and easy to remember URL is Learn2C.org as in “Learn 2 Code”

Unfortunately, for reasons I will not get into, it is not possible to integrate the two web sites together. So appinventor.pevest.com will remain “as is”, and Learn2C.org is the  primary focus point.

I am looking into having Learn2C automatically cross post to the appinventor.pevest.com web site but that has not yet been implemented. But I’d like to do that for those that already follow the appinventor.pevest.com web site.

My apologies for not doing a lot of updates during 2018. I have already written some new code examples (Bluetooth LE anyone?) and am working on more in that area. These tutorials will appear once I have completed the entire series of example programs. There are also other items in the works that I cannot talk about yet.

Google will be discontinuing Google Fusion Tables at end of 2019

Google created a cloud-based data base system called Fusion Tables. Later, support for Fusion Tables was added to App Inventor.

Google has sent out an email advising Fusion Tables users that they will be discontinuing Fusion Tables – literally, the database service will go away on 3 December 2019.

If you have used Fusion Tables, you will need to update the code to use a new data base system. You might consider third-party App Inventor-based development systems such as Appy Builder.

Hello,

Google Fusion Tables was launched almost nine years ago as a research project in Google Labs, later evolving into an experimental product. For a long time, it was one of the few free tools for easily visualizing large datasets, especially on a map. Since then, Google has developed several alternatives, providing deeper experiences in more specialized domains.

In order to continue focusing our efforts in these areas, we will be retiring Fusion Tables. We plan to turn down Fusion Tables and the Fusion Tables API on December 3, 2019. Embedded Fusion Tables visualizations — maps, charts, tables and cards — will also stop working that day. Maps using the Fusion Tables Layer in the Maps JavaScript API v3.37 will start to see errors in August 2019.

Here are some next steps to consider:

Learn about alternative toolsSeveral new Google tools have been developed over the years, and we encourage you to visit the Help Center to learn which ones fit your use-case.

Teams at Google have developed internal tools that can create powerful map visualizations. We are working to make some of these tools publicly available and will have more to share in the coming months—sign up to stay in touch.

Download your dataFilter by “type:table” to pull up a list of your tables in Google Drive. Download data from an individual table by following these instructions. If you have a lot of tables, we will make it easy to download all your data in one step via Google Takeoutstarting in March 2019.

Thank you for supporting Fusion Tables over the years. If you have feedback, visit the Fusion Tables Help Forum.

Sincerely,
The Google Fusion Tables Team

Calculating a square root value

A reader asked a question about how square roots can be calculated, referring to an example in my Volume 1 Introduction to App Inventor e-book. He was confused by the explanation of how it works – so I have written an expanded explanation of the method for calculating a square root of a number.

You could use the built in Math function to find the square root of a number – and generally that is what you should do. But if you would like to learn a method of calculating the square root of a number – then read on!

2,000 years ago, Greek mathematicians identified a method of finding approximate square roots. The method makes an initial guess of a square root (which is often not even close to the right value) and then repeats a sequence of dividing and averaging which gradually refines the initial guess into an accurate square root.  To find the square root of some number n, we set our initial guess to n (which we know is not correct), and then calculate an average of our guess with n divided by our guess.

To find the square root of 30, we initially guess the square root is 30 (which we know is wrong). We then take 30 and divide it by our guess, which in this case is 30. This gives us a value of 1. The average of our original number 30 and our divided value is 15.5. We select 15.5 as our new guess.

This little spreadsheet may help understand how the square root concept works.

To find the square root of 30, we initially guess the square root is 30 (which we know is wrong). We then take 30 and divide it by our initial guess, which is 30. This gives  a value of 1. The average of our original number 30 and 1 is 15.5. We select 15.5 as our new guess on the next row down in the Guess column.

Then we repeat this and take 30 divided by our new guess of 15.5. This gives us 1.93548. We average our 15.5 guess with our new value of 1.9458 giving us 8.717, which becomes our new guess on the next row down.

We repeat again using 8.717 as our new guess and divide 30 by 8.717, giving us 3.44. We average the 8.717 with 3.44 giving us 6.0795, use that as our next guess.

When do we stop this repeating cycle? We could repeat this a set number of times, say six, and then stop. But a better solution is to specify how many digits of accuracy we would like to have in our answer.

Let’s say that 5.4 is accurate enough for our purposes. We could stop as soon as our new guess is within 0.1 of our prior guess. In our spreadsheet above, our generated guesses are:

  • 15.5
  • 8.717742
  • 6.0795
  • 5.507058
  • 5.477306
  • 5.477226

As you can see, the correct answer has converged to 5.477 rather quickly. If we wanted an accuracy of just 1 digit to the right of the decimal point, we can stop once the difference between the current and previous guess is 0.1

The first digits of the last two guesses are the same 5.4 so we could stop with an accuracy of .1. In this particular calculation, we see that we are accurate to the thousandth’s place 5.477 as these values are no longer changing.

We stop the cycle when the difference between guesses becomes very small.

With our definition of small to 0.1, we stop at 5.4. If we set our definition of small difference to 0.001, then we stop at 5.477.

Here is some sample App Inventor code that calculates the square root. It fetches the number for which we find the square root from a user interface Text Box named txtDataEntry. We set NewValue (our initial guess) to this value. Then the code uses a while test loop to repeatedly do the calculation while the difference between our new guess and our previous guess is greater than 0.1 (you can change this to smaller values for greater accuracy).

This square root calculation repeats as long as the difference between our NewValue and OldValue are large.

As long as the difference remains large, the while test condition is “true”, and the code inside the while block continues to execute. However, once the difference becomes small, the test condition evaluates to “false” and the the execution of the “do” section stops. We have found our approximate square root.

The most popular programming languages

There are many surveys of programming language popularity. Many of the popular surveys have problems with the survey methodology such that they likely produce erroneous estimates of programming language popularity. For example, one survey looks at how many times each programming language is looked up on Internet search systems.

The chart, below, comes from GitHub and bases popularity on the number of “pull requests” that are made to the GitHub software repository. Using this method, JavaScript is the most popular programming language, followed by Python, Java, Ruby and PHP.

Python has become a standard for use by non-computer science students. Whether your college studies be in mechanical engineering or geology, there is a good chance you will learn Python for data analysis projects.

Java is now an old programming language, but still used especially for Android programming. It’s popularity for desktop applications is starting to diminish.

Ruby become popular about ten years ago. Ruby is based on a concept of “frameworks” that provide pre-made program skeletons which you adapt to make your own application. Ruby is very popular for quickly creating web-based applications.

PHP pre-dates Ruby – PHP is a script language that runs on the server side of a web application. PHP is very easy to learn and couples easily with MySQL databases, making the combination a great solution for web-based, database-backed applications.

Finally we get to the “C” derived languages including C, C++ and Microsoft’s cousin C# (a very powerful language with great development tools.). C dates back to about 1970 or so.

C++ was developed in the 1980s and added object oriented programming to C and has since expanded in many ways. C and C++ are commonly “compiled” into machine instructions for each CPU and are used for high performance applications, including operating systems, video games and media applications.

C# has features resembling Java and C++ – but in a more modern design. In some ways, C# is where some wish C++ had gone 🙂

Capture

Interested in JavaScript programming?

A follow up to my earlier post asking about interest in other programming languages.

How about JavaScript? JavaScript is widely used in web development, can be programmed with a text editor and tested with a browser – you do not need to download and install development software.

Another plus, if you do choose to download an Integrated Development Environment, you can then package your JavaScript apps within PhoneGap and run them on Android and iOS devices. Thus, JavaScript is another way to write apps for Android (and iOS) that goes beyond App Inventor.

My thinking is this topic could be of interest to those wishing to leverage their App Inventor programming on to other types of programming. The idea would be to create tutorials that leverage what you know about App Inventor (hopefully!) and translate that into JavaScript.

For now, this is just an idea. Looking for feedback!

Learn Javascript programming?

If you have already learned App Inventor programming, what new things would you be interested in learning?

For example, would you be interested in Javascript tutorials that help you translate your App Inventor skills into programming Javascript or some other programming language? Possibly for mobile apps but perhaps for desktop apps or web apps?

What App Inventor features or techniques would you like to learn about for App Inventor? I do not write custom apps here but instead try to identify generic features and methods that might be useful to know across many different types of apps.

Leave a comment with your thoughts. Thanks!

 

A countdown timer app to avoid empty #quadcopter batteries

One of my hobbies is building and flying small quadcopter radio control (RC) aircraft. Most RC aircraft use a one way transmitter – the remote control is the transmitter and there is a receiver on the aircraft to process received commands for flying the aircraft. But the aircraft does not transmit anything back to the control unit – you have no way of knowing when the battery is about to reach empty!

Some RC aircraft use Wi-Fi or proprietary links sending data in both directions – those quads send an alert when the battery is low.

But for simple systems, there is no alert!

A crashed my small quad recently due to draining the battery. I was flying it back to land when its battery died. While only 2 meters off the ground, it came down hard and damaged a prop and motor. (I was flying at an AMA approved RC model airfield so this was all done safely over a grassy area.)

To solve this, I decided I needed a count down timer app that gives me an alert after 10-15 minutes of flying.

That’s where App Inventor comes in.

User Interface View

To set the countdown timer, move the slider control to select a number of minutes between 0 and 59. Or, select one of the “preset” buttons which set the time limit to 10, 12 or 15 minutes.

Press the Start Countdown button to activate. The count down timer shows the remaining time in minutes and seconds.

Once the timer reaches 3 minutes, the remaining time color changes to red and an audio alert “3 minutes” is played. At 2 minutes, there is a “2 minutes” alert and then a “1 minute” alert when there is 1 minute remaining.

The Stop button stops the timer and resets everything to zero. The Exit button closes the application.

Continue reading A countdown timer app to avoid empty #quadcopter batteries

Sorry for lack of recent posts!

Just wanted everyone to know that I am still alive!

I’ve had some other things occupying my mind for a long time as a result of having experienced in life not one – but six – traumatic brain injuries. Bleh. Traumatic brain injuries or TBI as they are known in health care, happen when you have head injuries that jostle your brain around. I do not recommend having head injuries!  For me these head injuries included a skull fracture plus being knocked out four times in falls or bike crashes (which broke bike helmets and bones) and other bad whacks on the head… Amazingly, I’ve managed to space these head injuries out over my entire life too, for good measure, or something.

They tell me the effects of TBI are seen as cumulative – that is, a TBI + a TBI + a TBI is worse than having a single TBI.

The issues I was dealing with are now largely over and resolved and I am starting to get lots of things done again. Yay!

I’ve have a list of App Inventor projects I’d want to get to and will hopefully resume those projects near the end of this month.

Anyway, I’m okay, I’m fine, I’m still here!

Keep on programming!

Part 4: Protecting yourself from online tracking

Today we understand everything we do online is tracked, recorded in databases, analyzed by software to determine detailed aspects of our lives and then used for marketing and propaganda purposes. In some cases, this information is used against our own interests.

We can minimize online – and offline – tracking by paying attention to when we are being tracked and taking steps to disable the tracking.

For example, I am typing this in a coffee shop. Until today, access to their WiFi has been open. But today they require I enter a name and email address. Providing this information provides them with a way to link my retail store purchase here with online activities (since it is a chain, it also provides a way to track my travels). I gave them a fake name and an email address that I created 30 minutes ago, specifically to avoid trackers like this.

I mention this because the key is to be mindful of when you are being tracked and pro-actively taking steps to reduce data surveillance.

Pro-actively seek out privacy settings and set them to restrictive options. Avoid giving out real contact information for places who have no need for your real contact information. Create a fictitious email and phone number for these situations. Mostly, think! Be aware of when someone is asking for information that they do not actually need – and do not give it to them.

Plus, use the right online tools with the best settings to avoid tracking.

Use the Best Browser or Plugins to Stop Tracking

Facebook (and Google and more) track you as you move about the online web using many methods including “cookie files” deposited on your computer, hidden single pixel images that link to Facebook, and through their ad network. In 2017, an estimated 44% of all online ads seen anywhere on the web were served through the Facebook ad network. Each of these ads provides an opportunity for Facebook to track which web sites you visit, which pages you visit, and even which products you may have viewed online.

The best way to avoid this tracking is to use a browser that supports privacy enhancements.

The Epic Privacy Browser has privacy features built in – as a feature. Give it a try! Plus the organization behind Epic provides a proxy server when you wish to surf anonymously.

The Firefox browser from Mozilla supports several “add ons” that reduce tracking of your online behavior.

In the Firefox browser, click on the 3 small horizontal bars at upper right of the address line to display Firefox options. Click on Add-ons. Then click on Get Add-ons at upper left, then page all the way to the bottom to find “See more add-ons”. Using the Search box, search for and install each of these add-ons:

  • Ghostery
  • Privacy Badger
  • Adblock Plus (or other ad blocker)
  • Cookie Autodelete

These add-ons work to disable tracking features used by web sites and ad networks. To some extent they overlap in their functionality, but that is okay. Cookie Autodelete automatically deletes tracking cookies when you leave a page. After installing this add on, click on the icon that appears at the right of the Address bar and make sure you have “Auto-clean enabled” set.

Once enabled, Cookie Autodelete removes all cookie files generated by pages you visit, a few seconds after you have left the page. It is common to discover that individual pages drop 30 to 100 cookie-based trackers on your browser.

Sometimes you may not want cookies automatically deleted. For example, sites that keep you logged in between visits will lose the login connection when their cookie files are deleted. To prevent auto deletion of those sites, when you visit such sites, click on the “Whitelist” option to add the domain name to a list of sites that will not have their cookie files cleaned.

Each of these add-ons can be “Enabled” or “disabled” for individual web sites. Occasionally a page may nor format correctly or the web site may say that it will not work with ad-blockers. When that happens, disable the add-on for that individual page or site and refresh the page.

Smart phone and tablet apps

The Facebook and Messenger apps are nasty and default to enabling numerous “Permissions” to access most everything on your device.These apps are privacy nightmares.

My recommendation, if possible, is to uninstall these apps and not use them on your portable device. These apps are basically enhanced surveillance tools.

If you can, uninstall these apps. If you cannot, then selectively set more restrictive permissions for each app. Definitely turn off the Mic permission. Back in 2014, Facebook said their app listened using the Microphone:

Don’t worry, though. Facebook says they’re respecting your privacy while they do this. While ambient audio is definitely being recorded, they’re not storing exactly what the microphone picks up. The new feature works just like Shazam does: it tries to match an audio fingerprint from your environment with one in its database. The goal is to figure out if you’re listening to particular song or watching a TV show like The Simpsons.

As a general rule, selectively turn off app permissions whenever you can. I found half of the apps installed on my phone ask for the “Location” permission. Many of these are specifically for tracking my location – for someone’s benefit but not mine – while some are for mapping functions and obviously, need Location permission.

41% of the top 2500+ apps in the Google Play Store act as Facebook trackers (similar to how web sites track things on behalf of Facebook). To block those apps from tracking you, go to the Google Play Store and install Adguard. Adguard is an app that works to block the Facebook trackers, not just in the browser but also from other apps. I am not sure but I think this or similar tools are available for the iPhone.

Also, install the https everywhere plugin which works to encrypt your online communications whenever possible.

Other Apps

Review the apps you have installed on your phone. Uninstall those that you are no longer using. Review the permissions of the apps that you are using – and consider setting those options to more restrictive levels.

Online Web Surfing

Use a privacy-enhanced browser, as described above.

However, your Internet Service Provider is also tracking everything you do online, and depending on which country you live in, your ISP can share your full online history with third parties.

To minimize ISP tracking, do not use their default Domain Name System or DNS lookup.

You can configure your computer to use DNS services provided by other parties, such as Open DNS, 1.1.1.1 or even Google DNS. You should also set DNS settings for your phone and tablet devices (you may need to look up online how to do this – its not obvious in Android and the method varies depending on the version of Android.)

These DNS providers do collect data but they anonymize it so it is not connected to you specifically.

Offline tracking

How many stores have you visited that offered you a Loyalty Discount Card? Just fill out this little application – where they try to collect as much personal identification as possible. Our experience is the discounts are bogus – in fact most vendors using these seem to have raised prices – and then give a discount that drops prices to where they were before they introduced their discount card!

If you fill out and use a Loyalty card give them fake information. Do not give them your real phone number or real email address. Those two items are the data base keys that enables them to sell your retail store purchase history to offline data brokers.

Break the link between your online and offline store purchases, wherever possible.

Social Media

In addition to setting privacy and sharing options, do not accept friend requests from completely random people (there needs to be some connection to you or common interests, at least). “Random connections” are an obvious and simple way for someone to intentionally spy on you as they have access to your private, “Friends-only” posts and comments.

Limit your friends to those you know in real life, or those with which you have a substantial interaction or common interests.

Periodically clean up your Friends list. For years, we believed it was important to gather as many friends as possible. Our total friend count was a badge of honor and most us were anxious to add to our friends list. Because of social media filtering, however, we rarely see posts from most friends. Do we really need this many friends?

By reducing your friends list, your news feed can become usable again. It also reduces the amount of information linked to you via networked friend graph analysis.

Do delete old posts – especially those that may be controversial. The “half life of a Tweet” is said to be 15 minutes. That means, half of all views of a Tweet occur within 15 minutes of posting in online. Tweets that are weeks or months or years old are rarely viewed and there is little reason to keep them online. You can use a service like tweetdelete.net to automatically delete all tweets older than a specified number of days.

 

Do not upload Contact lists to Instagram, Facebook and so on. The primary purpose of these contact lists is for the provider to enlarge their database, identify people connections, and learn more about you.

Afterword

In 2014, I noticed a lot of “Friends” were sharing what we now call propaganda. I knew  little about propaganda. Wasn’t propaganda what governments do during war time? Yes, it is, but propaganda is far bigger than that! We are surrounded by propaganda, which is based on specific methods designed to influence us. I started reading books and papers on the subject. I started a private blog to record my notes – I kept the blog private for a year and a half.

Eventually, one post shared on Facebook convinced me to make a public blog about social media propaganda – I first called it Occupy Propaganda – but later renamed it Social Panic. The blog is propaganda about propaganda! Specifically, about social media propaganda.

In the past two weeks, we all learned a lot about social media surveillance and propaganda. I think half the posts I made in 4 years were written in the past two weeks!

Everyone is now aware of social media’s surveillance and propaganda problems and I expect I will let my little Social Panic blog fade away.

And then I can return to more tutorials on App Inventor relate topics. I am working on something involving Fusion Tables, and possible a way to bring back functionality similar to the original TinyWebDB.

After Afterword

I said at the top of this post I wrote this while sitting in a coffee shop. At the table next to me, two people were using online tools to look up all kinds of information on their clients, figuring out how much they were worth, their current jobs, their future career growth trajectory – and how good looking they are (really). And talking about all of this while they did it – in a public cafe!

If you do not think online surveillance is widespread and potentially a problem, you are not paying attention!

 

 

The quick and easy way to write Android Apps

%d bloggers like this: