Saturday, February 23, 2019

Why are prime numbers important in real life? What practical use are prime numbers?

Primes have properties of uniqueness such that multiplying primes together produce unique results, for example multiply 3*7=21 which is a unique method for creating 21.
Uniqueness is a confusing term in mathematics. To me, uniqueness describes a unique path or vector to reach a specific point.
You can exploit that concept using small primes for creating an efficient database. In fact the first program I ever wrote back in the early eighties had used such a method in a phone book program.
I was trying to create a phone book program that could filter records into multiple different groups or multiple different phone books such as coworkers, friends, clients, church group, poker players, etc. One record could exist in multiple groups, but each record should only be stored once such that if the number was to change for that person, it would only require changing the number once in a master database that contained every record.
How this worked was to assign a prime number to each phone book. Records would be assigned to each phone book by taking the factors of those primes.
For example, let’s say that Bob is a friend, a coworker, and a poker player. The phone book for friends had the prime number 2 assigned to it, coworkers was assigned the prime number 3, and poker players had the prime 7 assigned to it. Then Bobs record would have the number 2x3x7 = 42 linked to it’s record.
Then when I decide to have a poker game and look up poker players to invite to the game, it would search the factors linked to all records for numbers evenly divisible by 7 to display only the records of poker players.
I guess the same concept was later used for digital security only applied in a kind of inside out way where only 2 large primes were used and the idea was to create semiprime index that was so large that they became prohibitively unsolvable for finding their primes based on using math due to computers being so dumb at doing arithmetic for large numbers.
They call it a complexity issue, I would call it something else because its not really that complex. It’s just doing something simple lots and lots of times.

Friday, February 8, 2019

git stash - How to Save Your Changes Temporarily

git stash - How to Save Your Changes Temporarily

There are lots of situations where a clean working copy is recommended or even required: when merging branches, when pulling from a remote, or simply when checking out a different branch.
The "git stash" command can help you to (temporarily but safely) store your uncommitted local changes - and leave you with a clean working copy.

git stash: a Clipboard for Your Changes

if you have to switch context - e.g. because you need to work on an urgent bug - you need to get these changes out of the way. You shouldn't just commit them, of course, because it's unfinished work.
This is where "git stash" comes in handy:
our working copy is now clean: all uncommitted local changes have been saved on this kind of "clipboard" that Git's Stash represents. You're ready to start your new task (for example by pulling changes from remote or simply switching branches).

Continuing Where You Left Off

As already mentioned, Git's Stash is meant as a temporary storage. When you're ready to continue where you left off, you can restore the saved state easily:
The "pop" flag will reapply the last saved state and, at the same time, delete its representation on the Stash (in other words: it does the clean-up for you).

Recent Post

Databricks Delta table merge Example

here's some sample code that demonstrates a merge operation on a Delta table using PySpark:   from pyspark.sql import SparkSession # cre...