Pokemon ported to VR glasses w/sound

https://www.wareable.com/ar/odg-ported-pokemon-go-onto-ar-smartglasses-3001

Advertisements

Appliance Timers for bringing your traditional appliances into the modern home IoT

I don’t do a lot of super techs around home, not even a siri/amazon…but this I have an absolute need for… hooking up my oldschool espresso machine to run in the morning before I get up!

Even if I’m replacing my old style espresso maker, the ones with times start around $200, so going with a $30 – $100 old style, then adding a bluetooth timer to the power cord of the espresso machine saves me $100 for the same machine.

Highlights are it’s blue tooth to android or ios (apple, not cisco) and it programs via a QR code you scan … Link.  There might be a power draw issue, redditors recommend a slightly more powerful version – Link.

It’s almost enough to want to plug in an Echo Dot ( Link  ) upstairs so I can set the timer from my bedroom just before I crawl into bed!

Finding the class based on an object instance of the object in Rails with Constantize

Trying to write a rails method to count the rows in a table.

The twist:  I want to do it in such a way that I can call the method from any object and it will automatically determine the name of the table to count the rows from.

Basic outline of the flow … I want to use Rails Way to identify the table & count the resulting table name’s rows.

Model.count

To do so I need the name of the model.  As my test object, I cleverly naming it anObject

2.3.1 :040 > anObject = Player.first
 Player Load (2.4ms) SELECT "players".* FROM "players" ORDER BY "players"."id" ASC LIMIT $1 [["LIMIT", 1]]
 => #<Player id: 1, screenname: "Serena Mitchell I", motto: "Wyaaaaaa.", country_id: nil, created_at: "2017-09-01 12:52:27", updated_at: "2017-09-01 12:52:27">

Rails has several definitions which hold that information in various states.  I chose to use .class …

2.3.1 :043 > anObject.class
 => Player(id: integer, screenname: string, motto: string, country_id: integer, created_at: datetime, updated_at: datetime)

When we look at this, it’s more information than we need.    The Rails Way is to call the .name method out of the class method …

2.3.1 :046 > anObject.class.name
 => "Player"

As a bonus .name gives us access to .constantize which is the goal.

2.3.1 :048 > anObject.class.name.constantize
 => Player(id: integer, screenname: string, motto: string, country_id: integer, created_at: datetime, updated_at: datetime)

Now we can put .constantize to search all the Rails app’s constants …

2.3.1 :050 > anObject.class.name.constantize
 => Player(id: integer, screenname: string, motto: string, country_id: integer, created_at: datetime, updated_at: datetime)

… which when proceeded by the .class.name will give the activerecord model as an object which we can then .count against …

2.3.1 :052 > anObject.class.name.constantize.count
 (0.8ms) SELECT COUNT(*) FROM "players"
 => 46

At this point .class.name.constantize should net us what we need, so I wrap it in a method for easy reuse …

#  gets name of constant to get a count of model
def row_count(ar_object)
  ar_object.class.name.constantize.count
end

This of course isn’t perfect, if ever you had an conflict in the naming scheme, scope issues or an orphaned object from the inheritance tree, the .constantize search up the object inheritance tree would fail even though your object exists.

Note there is another way, that if you are only doing ActiveRecord objects works too … Link.  My example is slightly more generic example as you can use it to find other types of objectives – though you can’t use the count method with most of them.

The reason you would use it, is that it’s more self documenting, thus more in line with the Rails Way ….

# .model_name.name is basically the same as .class.name for this purpose
ar_object.model_name.name.constantize.count

My studies from other authors which I found helpful, in no particular order …

  • Failure points & discussions for constantize – Link
  • Implementing in a custom module from Stackoverflow – Link
  • Implementing the constantize lookup in depth & use – Link
  • Safelty constantize in forms, aka don’t – Link
  • Metaprogramming & testing with constantize – Link

I often try to help people.

Not sure I get it right every time.

It is something of a calling for me…though as time goes on I have to be more selective about it.

What I don’t often talk about is helping myself or why helping is important.

We won’t talk about why today either.

What I need today is to capture some thoughts.  These will probably not impact people or be easily understood – I have heard people say that ’emotional intelligence’ is a thing.  Well, there’s a phrase I’ve been playing with, ’emotional perspective’.  Something where the meaning & understanding are not as impacting once the moment is gone.


Children.

When you have a part of your brain that doesn’t work, how do you make the choice to pass that along?  For Asperger/autism spectrum it’s a struggle, but it’s not an altogether hopeless thing.  Most people are reactive to treatment for ADHD and develop some amount of coping skills, but some are crippled by the condition & not able to advance themselves at the rate of others.

This can be depressing.

When we get to double depressive, bipolar, manic type conditions … we are now talking about not just something that is making life hard, it’s literally eating / deadening chunks of your brain … stealing months & years off the end of your life.

Many days you barely make it through yourself.  How do you inflict that on someone else?  How do you risk it getting worse for your kid?

I know there’s many people who think you can just talk to the kids and that will help them understand…right?  Because we just talk to racist people & they suddenly give up being racist or we talk to clueless people who think picking on disabled is fun & they suddenly stop laughing?

The fact is that I’ve had to fight myself for my life … more than a few times each year.  More months than I haven’t … my brain gives me the feels & they are intense I weep with the beauty of music & my memories of wonderful people and things I’ve seen.  More regularly though, I am a mess inside and unable to comprehend the brutal world humans created for each other.

As an individual with autism spectrum w/adhd, a history of bipolar & double depressive on both sides of the family – I have issues comprehending people & their lack of context or why they can’t grasp my context.  How would I explain, guide & mentor a child of my own through their life.  Especially knowing it’s late in my life to start & my brain is taking vacations to destroy itself every so often each year?

What would be the content of the conversation…

  • You will see other people, but you mustn’t ever compare yourself to them – instead celebrate them & their joys like they are your own…because you might never experience their happiness for yourself?
  • You will live with fear, anxiety, depression, obsession for the rest of your short life?
  • These things will plague you at work, they will plague you in making & keeping friends, they will plague you in building a home & a life with your would be spouse.
  • You will always struggle with basic things that other people just get?
  • There are drugs that will help you, but eventually they will lose their power to help?
  • We need to live without attachment, to love fiercely, to appreciate every little thing, because no one is guaranteed anything other than death – except we are guaranteed to suffer more than others & to die earlier?
  • I have literally felt alone most of my life since 10 years old & you probably will too?
  • I traveled instead of of saving money as a young man & that you won’t have a chance in hell at college due to my choices, but that’s probably okay, because with all the disabilities – you would have to struggle much harder than other students?
  • I’m telling you this, but you need to struggle on anyways, even if one day I’m not around, even if I die early or lose my fight and choose to leave this world?
  • You might not have me to help guide you & honestly, I’m not sure how good of guide I can or have been?

Even if we come up with the perfect message & strip out all the negativity, will the very act of talking about it make it like a destiny to them?  Influencing and sticking that fear in their brains like a deterministic bias?

Can I medicate them from 9 years old till 18 to get them through the bad times without depriving them of time to develop their ability to cope?

I have to imagine that my parents had some of these same thoughts or discussions between themselves.  Knowing this I can’t blame them for getting divorced … do you scare the living crap out of them or coddle the children?  Its not an insignificant choice.

This all assumes I could be a basically good & well intending parent.  That my depression, sadness, anger, etc don’t make me unable to be there for my child.  That my kid never has to visit the ‘hospital’ to see me while I’m fighting my brain … I’ve avoided that thus far, but if it’s a struggle where there’s more on the stake than just me – that’s a bigger deal and a heavy anxiety debt to carry.  This assumes that even if I avoid going away, that I will be 100% present.  That my sadness won’t dampen my children or the medication won’t make me less empathetic & excited around them…or take me to the point where I don’t care enough about them or understand their happiness/sadness enough to connect to them.  The worst assumption is the one that what if between all of the stress in life, I become a monster who lashes out at my children?


I can’t really see the screen through my tears right now to type & there’s a guilty part of me that is glad my girlfriend from 10 years ago miscarried, because this is a hell of a thing to think & write…much less if my child’s well being depended on me & I barely make it by as is …

Rails organization / patterns

Been summarizing some of my studies – note none of this is confirmed by an official Ruby on Rails historian …

I started out looking for where code was supposed to be placed.  Why?  Because I read about DRY.  I really liked the idea of not wasting time redoing code – it’s one of the reason I got into Rails, which I will call RoR from here forward.

So people divide the RoR apps up according to MVC philosophy, which the short version is the model of the database logic, the view you see & is’ logic, and the controller with its logic to tie the two together.

In this MVC design, when I entered RoR’s world most posters were talking about Fat Model / Skinny Controller.

I started reading a lot about this stuff … Justin Weiss has a great breakdown summary of different patterns & where they get placed in the RoR app – Link.  I also like the description of the process on Stackoverflow from ‘Jason‘ & Mike Woodhouse – Link.

 

From what I can gather from posts there was a development of programming as people moved along.  Notice I’m not numbering these…there’s a reason…

  • model / controller / views
  • helpers (with special visibility to only their views)
  • custom classes anywhere
  • app/lib as “the spot” which at one point in RoR history auto loaded (not anymore)
  • modules / mix-ins to include the classes/methods
  • gems – which
  • plugins – which were discontinued in Rails 4, but the command used to make engines now – Hawkins had a good break down if somewhat biased – Link
  • concerns – which even had a special activesupport::concerns for including classes added
  • rails engines which improve on the modules>gems by encapsulating the database too … often these are wrapped in gems when created with mountable option – this might be part of the micro-services movement…

IT jobs

If you’re starting out a certificate for Microsoft Certified Professional (MCP) for just about anything OS related + 1 or 2 years of experience answering phones will get you in the door for basic helpdesk support at one of the small or midsized companies, no college required…

  • Atomic $14-16 – Link
  • Erickson $14-16 – Link
  • Driving version of helpdesk – $19-22 – Link
  • IT Retraining program for minneapolis – Link

Stretching it a bit is the big companies, they will want a year experience in something or equivalent college.

  • Honeywell – IT Support Tech support liaison – Link