Cellphone…Booster..Wifi..SIP….VoIP….MADNESS

2012 May 5
tags: ,
by Micah

Okay.. So I live in a hilly area, in kind of a nook and even there’s a Sprint cell tower only about 2 miles from my house, I get terrible reception. Like really bad. I have to climb the steps up to the hill behind my house to really make sure the call isn’t dropped.

Almost more annoyingly, I miss calls constantly.

There’s a few solutions to this. I’ve played with a cellphone signal booster, which works, but really requires a line up to the roof, and with my roof access currently blocked by a blooming acacia tree filled with bees, I decided to go another route.

I was thinking that it would be nice if while I was at home, my android phone could switch into WIFI mode, and send/receive called over VoIP, and then switch back to CDMA mode when I leave and go elsewhere. Easy right?

Well. No. Not easy. But possible. Here’s how I did it.

Prerequisites:

Overview:

The idea is that you have two endpoints for calls, your normal cell phone #, and your SIP/VoIP number. Google Voice will then route incoming calls on your voice number to the proper endpoint based on how you configure it.

Then Google Voice Locations app will use the location awareness of the phone to dynamically reconfigure google voice based on where you’re at.

For Sprint users your voice # can be the same as your cell number, resulting in some routing magic akin to lifting yourself by your own bootstraps.

Outgoing calls are handled by Voice+, for VoIP calls.

Steps:

  1. First create the necessary accounts for your Voice, SIP and your new VoIP #.
  2. Connect your VoIP # to the sip account. No tricks there.
  3. Setup Google voice with this new VoIP # as a forwarding number.
  4. Install the recommended Apps on your phone. I had no issues with these, csipsimple is sip2sip.info aware, and makes it easy.
  5. Setup Voice Locations to route based on your location.

Voila.. try calling out (You may have to buy some calling credits on sip2sip.info, but it’s like 2 cents a minute.. $20 would last me a year..)

Have a friend call you. Should route through voip.

You may also route manually using Google voice settings, or have it setup to just route to the VoIP endpoint if your normal number doesn’t pick up after a couple of rings.

Since I do get some service at home, I set my phone to airplane mode, and then manually turn on just WIFI – this will (at least on my HTC EVO) turn off the CDMA modem, so my phone is essantially just an IP phone at that point.

This is all working on my HTC EVO 4G phone, rooted and running the Nitrous ROM (great for the EVO BTW.. really fast) - but there’s nothing here you shouldn’t be able to do on a non-rooted phone.

If anyone has any questions.. hit me up.

Email Deluge…

2012 May 1
by Micah

The other day I recieved about 250,000 emails from a script I wrote.. I was in a hurry and didn’t properly log the output like I should of, or limit by quantity, or use any one of the 1000 better methods in my app. I simply sent out an email when it hit an error at a certain point to let me know.

This has worked fine for some time, but an external team is responsible for writing plugins to the application, and their plugin hit a service that was throwing an error..
so yeah.. IMAP4 with 250K emails to download and delete. Thunderbird croaked under the pressure.
I fired up an instance of Roundcube which is a web-based client, and in my experience performs REALLY well under large email load hoping I could take care of it, but I ran into an unfortunate fact that I could only delete groups of 100 emails or so with it.
So yeah – that won’t work.
After googling around for a bit, I ran across an old post on http://lukecyca.com/ that had a nice Python recipe to solve my problem. Observe the power of Python:
import imaplib
from getpass import getpass

imap = imaplib.IMAP4_SSL('mail.example.com')
imap.login('luke',getpass())

imap.select()
typ, data = imap.search(None, '(FROM \"zabbix@example.com\")')
for num in data[0].split():
    imap.store(num, '+FLAGS', '\\Deleted')

imap.expunge()
imap.close()
imap.logout()

This obviously filters by ‘From’ address, but you can easily filter by other stuff. Look here for more info.

This took a while, but it was automatic and saved me a lot of time. Thought I’d pass it along.

Easy LDAP

2012 March 20
tags:
by Micah

After spending hours wrapping my head around OpenLDAP and creating a single instance of it, getting 5 test servers to authenticate against it, and seeing it work I had to stop and think to myself, “Why the hell is this so hard?”

LDAP or Lightweight Directory Access Protocol is a way to store and access data. It’s usually used for storing contact information and passwords so that you can have a single source of this information for the many services a network provides. Makes updating passwords much easier.

OpenLDAP is essentially just a database. A hierarchical key/value store with search and indexing capabilities. It seems to be engineered to be difficult on purpose, but always comes up first in Google searches, so I assume it’s the leader in it’s field.

If that’s what I need to do to figure out LDAP, fine I’ll do it, and honestly after a bit, it did get easier once I saw how the server was architected.  Then I tried to slave another backup LDAP server to it.

Bad move. I mean.. I assume it’s possible, and there’s probably lots of smart people who can set it up in seconds, or minutes or something faster than the hours I spent before I gave up trying to get it to work.

Typically in the linux world, the documentation isn’t super great. It makes perfect sense to the person who’s already familiar with the system, but a little worse for learners. And I have to admit, I didn’t hop on my neighborhood IRC channel to ask for help, or mail list.

After poking around a while I found OpenDJ. A Java based LDAP server. Keep in mind that I’m not a fan of Java’s typical memory-hogging meager performance, but I was a little desperate to find something to vindicate my strategy of using LDAP in the first place.

Surprisingly it was a pleasant experience, not unlike my surprise when first using Jenkins.

Go check out their quickstart guide!

We’re fallible, but it works.

2011 February 24
by Micah

Reading over the posts here it seems to me that I might beat the same drum a little too much – yeah okay, we don’t realize everything that goes on around us, our perspective limits us, most of the time we’re wrong, blah blah..

The reason that I keep coming back to this, and subjectify it in the blog is that we know this, yet we still get it wrong. Our brains almost seem to be wired to ignore this. In many ways I believe (IANADOR) that belief in this illusion is a building block to the way our brain has evolved to work.

Simply put, we are built to believe in ourselves, regardless of the facts. Some people are more egotistical than others, but we all are this way to some degree.

This harms us and helps us, and this is why it fascinates me so much. As an engineer, I say, “That’s a mistake! You must build on facts.” But there are so many examples in history that show me that the things that happened were only possibly through ignoring the facts and facing the likely prospect of bitter defeat with a optimistic eye.

I think this is one aspect of what it is to be human. To see that we’re wrong, and to go on in the face of wrongness, and sometimes win.

Decentralization for better perspective

2011 January 13
by Micah

If you’re looking at a problem, trying to understand a situation, or living in general, one of the big things you should keep in mind is that you have a point of view.

This may be painfully obvious, but they key in consciously recognizing this is to know that this viewpoint is limited. And by limited, I mean probably wrong in some way, and by wrong I mean incomplete at best.

You can’t fix this. But you can plan for it in many ways, one of which is by capitalizing on the idea that different people or groups have different perspectives. I believe this is one of the strengths of the original idea of the United States.

We see this in action today by watching the states deal with the recession. Illinois has decided to try and meet the needs of it’s people by increasing taxes greatly. South Carolina’s governor has been pitching the opposite idea. This is how it’s supposed to work. One of them might be wrong, maybe both ways work.. do we know?

By giving the power to smaller pieces of our country to try out ideas, we can all benefit from the answers they find. More so than democracy, or liberty, this is what it means to be a United Statesein. Unfortunately incidents in our history have limited our ability to pursue this goal, but still we see it at work.

Perspectives on numbers.

2011 January 8

As with most things, as I’ve stated many times on this blog already, you can look at things in various ways and walk away with different conclusions as a result. Also these conclusions can offer various degrees of ‘helpfulness’ – Sometimes they’re plain wrong even, and ‘right’ conclusions are often hard to come by.

Another example of this is the numbers we see regarding human prosperity. I think most people would agree, regardless of your politics, that increasing prosperity is a good thing. You can define prosperity in lots of ways, in this case, let’s use Health and Wealth. I won’t argue this is the best, but it’s one way.

You can look at the world and today we have a much larger disparity between the richest and healthiest people on the planet and the poorest and sickest people on the planet.  The statistics show us this, and it’s commonly regarded as a bad thing.

Watch this video, keeping it in mind and then think about whether or not this is a bad thing. By observing the trends, I think you’ll perhaps have a different opinion simply because you now have a different way of looking at the same numbers.

Troubleshooting the wrong thing.

2010 November 14
by Micah

Today I had an interesting experience. At about noon the two main webservers of a major client went down under massive load. We immediately assembled a team to address the issue.

Our system is based on web scripts with data in a database. As the application designers we immediately attacked those two variables. The database seemed to be operating normally, and no queries were funking things up there. That seemed fine.

Second we attacked the code. It had to be the code because it wasn’t the database. Also we had moved a version of code to the production servers barely 30 minutes before the problem occurred.  We spent almost 6 hours troubleshooting this, convinced we had a coding problem. It turned out it wasn’t a code problem at all, an affiliate had increased their load on the server by over 1000% – were being D0S’d in effect and because of the nature of the requests, our normal rate limiting system hadn’t kicked in.

I saw this affiliate hitting the server very often early on in the process of working the problem, but I ignored the evidence and went on trying to find a problem in the code. Why? Several reasons:

  • We had recently updated the code. Correlation is causation, right?
  • Some of my code was questioned from the start. My ego was defending my skills, so I was invested in working a ‘code’ angle of the problem so I could find another problem with the code other than mine to redeem myself.
  • Everyone else thought it was a code problem. Group influence. No one else had any alternatives to a ‘busted code’ explanation. This also corresponded with my ego problem, so they reinforced each other.
  • We have a stigma as a group writing code. We usually have problems with code and database, those are the big variables in the system and we had eliminated the database as a possibility, so it must be the code. No one could think of other variables.

So analyzing this situation, what could I of done better? Probably a lot of things. Primarily I fell into the trap of first impressions. As someone experienced with the technology I often have pretty accurate first impressions on what is wrong with this system. In this case though the as-always brief set of data I had to go on was misleading, and I bought into what it suggested.

This shaped my perspective which literally blocked out competing information – I even saw the evidence of an affiliate hitting the system really hard. Much harder than anyone should be doing anything.

I even showed this to another engineer who was involved with the affiliate system – Both of us agreed with little thought or evidence that this was unlikely the problem. We both were already convinced of another source of the problem, even though we hadn’t found it.

Lesson learned: Beware of snap judgements. They are ALWAYS formed on insufficient data. Those that are experts in an area are seem more likely to make mistakes than beginners simply because beginners don’t know enough to make the snap judgements yet. They question themselves more inherently. Maybe this is a good thing.

When approaching a problem like this, keep a young mind. Look at it as a newb would.

Realize what you don’t see.

2010 June 27
by Micah

Just ran across the story of Carly – an autistic girl that stumbled upon an ability to communication by typing out her feelings on a laptop.  This is an amazing story, and 20/20 did a special on it. I highly recommend you take a look:

This made me think of two things: One, that this is another example of how having the right tool to understand an unknown is so important. We as human beings are limited in experience and to fill in the blanks we are not shy about making things up, either through superstition, or theory. Once something happens to open a window on the truth that is underneath the exterior appearance of something, we’re more often wrong that right.

This is important to understand. The simple fact that if you don’t really know something through a direct experience, or obtaining repeatable evidence, you’re probably wrong is something that too many people ignore on a daily basis. To survive we must make assumptions, and we must operate on incomplete facts. However, to have an accurate view of the world, we also must realize when we’re being assumptive and when we are operating on incomplete facts. Our tendency to approach the world differently after making an assumption too often wastes time and hurts us. Like Carly’s father. I of course don’t blame him – he obviously cares greatly for his daughter, has spent his life caring for her, and in the big scheme, some of the things he regrets doing are probably not a big deal.

Second, this is an amazing example of why our brains must operate on a limited data set. Listening to Carly’s explanations of why she does what she does exemplifies what might happen if our brains didn’t constantly filter out information instead of giving it all to us. Her comment about not liking to look at people’s faces because of the slew of ‘pictures’ her eyes take was very interesting. On one hand I’ve talked before about how we normally filter out so much, this causes us problems. On the other hand, it’s obviously a blessing. I’d bet if you asked Carly if she would want to turn down the amount of data entering her brain, she’d take it.

Science.. the logic that sustains us?

2010 March 21
by Micah

SaltI’ve always liked salt on my food, as do most humans.. we seem to be genetically inclined to seek out sugar, fat and salt – but I’ve always felt a bit guilty.. There’s been many times when I was making it snow on my plate where a friend has commented on my salt intake and how it was bad for me.

This is understandable, 20 years of public policy in the United States has been telling us that it’s bad, it’ll increase our blood pressure and destroy our heart. However today in Hacker News I noticed an interesting article about this subject. Other than the small satisfaction I got from rationalizing that this supported my salt habit, I started to realize a familiar theme in science today:

Decades have passed without a resolution because the epidemiologic tools are incapable of distinguishing a small benefit from no benefit or even from a small adverse effect. This has led to a literature so enormous and conflicting that it is easy to amass a body of evidence — what Stamler calls a “totality of data” — that appears to support a particular conviction definitively, unless one is aware of the other totality of data that doesn’t.

Gary Taubes

“The (Political) Science of Salt”

As I’ve hinted at before, it’s hard to be rational, if not impossible – science has a myth that it too is rational. Science is really not much more than a framework to allow for an attempt at rationality. In reality, much of science is plagued by the same problems people have always had with superstition, the ‘better safe than sorry’ fallacy, and jumping to conclusions.

If this doesn’t sound familiar, take a look at the climate debate. I think you’ll find some obvious parallels.

Cashless society sucks

2010 January 30
tags: , ,
by Micah

Recently a friend related a story to me:

I am fucking jinxed. Someone used my credit card to buy $60 worth of
gas at a Chevron. I tried to use a pump, it froze up on me and
wouldn’t pump gas, so I moved to another pump. I saw this big white
bro-y truck pull up to the pump. I walked over and checked the pump
to make sure he couldn’t use my card. Looked all clear, so I resumed
my gas-pumpin’. Asshole somehow figured out how to use my card and
charge his gas to my card. DICK!
And once again, I have to file a dispute and hope I get my money back.
GODDAMMIT I SWEAR

This sucks for her.. I have had problems with unauthorized access myself, and it’s a pain to get it sorted out.

This reminds me that the dream of cashless society SUCKS. Let me elaborate:

document-encrypt On a practical level, when you spend your cash you have physically less of it. Spending money on a credit card does not decrease it’s weight, thickness, or change it’s physical appearance in any way. SUCK

document-encrypt When you buy something with cash, the transaction is complete. Done! You’ve got your shit, and they’ve got your cash. You go home, and all is well.

When you buy something with a credit card (or debit card) you’re essentially telling the merchant “I’ll gladly pay you tuesday for a hamburger today” and the merchant agrees to that because there’s a third party taking responsibility for the money exchange. This is dependent on all three parties agreeing to an arbitrary identification of the three parties. Later reconciliation happens magically and largely by luck.

There are no hard limits or practical checks on the transaction agreement. It’s totally based on trust and well, anyone that’s been fucked over by someone they trusted knows how reliable that is. SUCK

document-encrypt When you don’t have enough cash to buy something you either bargain with the merchant, or you’re fucked and you go home without your toy.  Credit cards and Debit cards inherently have no limits – Additionally, the providing institution stands to gain when you fuck up and overspend.

Being human that happens to many of us. The market encourages this behavior because of the benefit the banking institution gets. Addendum: Recent laws now address this fortunately. I’m normallly against regulation if at all possible, but this is one that I think is somewhat useful. However the REAL solution is to just avoid the problem in the first place.  SUCK

document-encrypt When you don’t have enough cash, you’re screwed, but if you have a credit card, you can get free money and get your shit NOW. RULES – right? No – this encourages tactical spending, and enforces budgeting based on debit instead of strategic budgeting based on management of personal worth.

Essentially it’s teaching us to budget because we’re fucked if we don’t pay that steadily increasing bill at the end of each month.. “gotta pay the CC bill.. “  Instead we should be teaching our youth and adults to empower themselves through effective wealth management instead of indentured servitude to the banks.


American society would be much better off if we don’t get into the vicious cycle of debit. Credit cards don’t empower you. They don’t! They can be effective tools in certain situations, but as a general rule, if you’re putting stuff on your credit card, you’re fucking up.

Many people that use a credit card as a convenience, and seemingly benefit, however about 43% of American families spend more than they earn each year. The average American family carries $8000 in debt. (From cardweb.com)

This $8000 figure is a bit misleading, as estimated 30% of those with cards pay them off each month. Most (48% of cardowners) that do carry a balance have less than $1000 on it. So this means that 22% of the cardholders are carrying enough debt that if it was spread out over everyone, we’d all owe $8000 – (counting only people with credit cards)

…this doesn’t take into account the THOUSANDS each of use owes to China an other entities that own our national debts.

I believe you can’t own a credit card without paying. Even if you’re responsible, pay off each month so you don’t accrue interest and rack up those air miles – you’re still screwed. Our tendency to fail in predictable patterns is exploited by the banking industry as much as they can, to the point where I feel it’s a detriment to society as a whole. It’s not as big of a deal as cancer or heart disease, or the plague – but it still sucks.

I don’t believe in legislating against business. Quite the opposite. The solution I believe lies in effective financial education at an early age and good role models. Indoctrination. If society gets smart enough that credit cards become a money losing business, believe me, banks will go elsewhere.

The moral of this story is that cash rules, plastic sucks. Criminals know this, banks know this, rich people know this. Only stupid people and government think that credit is a route to success.