May 1, 2016

Amazon echo for home automation using x10 and ifttt.com

The way this works currently is you need to be able to access a remote url inside your home.  Usually this will require the use of a dynamic dos host provider that can provide you with a hostname that points to your dynamic home address that is updated automatically by your router.  This is not exactly ideal security wise but obscure enough that you’re not likely to have some hacker turning your lights on and off just to mess with you and about the worst case scenario is they turn all your lights on while you are way turning up your electric bill.

June 21, 2013

Mountain Lion broke X11

Want to run apps under linux and pipe the graphical display to your mac using mountain lion?  This is how you do it.

August 5, 2008

iPone activation issue

This morning I awoke to the shinny new 2.0.1 update. Without a second though I installed it only to be left with a bricked iPhone. I could not complete the activation process and kept getting an error: “The iPhone cannot be used with iTunes because the information required for activation could not be obtained from the phone”.  Looked on Google and found a few unresolved issues then I decided to try the *#307* trick and was prompted to enable the radio. This was the fix for me as I post this from the word press app on a 2.0.1 iPhone. Hopefully this will help someone else when googling for help with the issue.<br><br>

The steps would be make emergency call enter *#3078 call enabled the radio and done.  You might try just entering 0 and calling I did not get a chance to try other combinations to see if it would even try to enable the radio.

July 13, 2008

Slingbox AV with Zenith DTT900 Digital Tuner

Finally laid my hands on a Slingbox AV unit from woot.com to go with my Zenith DTT900 digital tuner. The intent was for this to go straight into my rack and used whenever I find myself wanting to have the TV in the background while I’m on the computer in the office. The only problem is they don’t support the DTT900. So I setoff to make my own remote and while in the process of reverse engineering from of the config files for Remote Master I got frustrated and took a break starting playing with just randomly trying remotes and I found one that worked.

To get it working you simply follow the selections in the screen shots below. The device is a Direct TV LG receiver.

Select the Satelite/Free-to-Air Receiver
DirectTV
LG

Here you want to test the power button. If it doesn’t work try checking the connection on your IR cable and just make sure the IR emitters are pointed at the plastic in the front of the device. The plastic seems to diffuse the IR signal and gets it to the receiver from almost any angle.

Test the units power

Here I experimented with the various settings and found if you press 3 it brings up channel 33 in my area so I had it go with a single leading zero when direct tunning a chanel. Doing multiple zeros sends it into the sub-channel when tuning and since the device does not tune past 69 it seemed ok to use this method to get direct tuning working. I also added the press enter to make tuning faster. Test the setup click the checkbox and it should be good to go.

Customize Controls

Since I have this working I’m content with the generic remote. If anyone is interested in making a remote with the actual I will upload the image file, map file and other information I had gathered to get this working before discovering the guide I was following only left me with a bin file for telling the slingbox the command set instead of building the full remote plus commands file. Download here Zenith DTT900 Remote.zip.

July 11, 2008

The Abusive PickerView

iPhone SDK 2.0 is a welcome thing but some of the controls make you wonder how they are supposed to be easy to work with. One thing iPhone devs will need that has driven me nuts because so few implement it right yet in any of the apps I’ve seen it in. The odometer style pickerview, no one seems to understand so I’m going to break down the UIPickerView into its most basic components hopefully this helps someone with the spare time to develop for the iphone to create some kewl apps that use it to make the ui experience better.

First here is some sample code that should help you better understand how to virtually wrap the pickerview. What we have in the titleForRow method is an array the returns the value of the selected row modulus 10. This ensures we stay in our array and return the appropriate string label for the row we want. This means no matter what “row” the ui thinks we are in we will be returning what we want them to see for that row giving us the virtual wrap we want. The return could just as easily be simply the row%10 as an NSString without the array for a basic odometer style picker.

Picture 1.png

Some other code that helps us with the illusion is the numberOfRowsInComponent method. In here we return the number of possible rows to select. I started off using NSMaxIneger and quickly found this breaks everything so I bumped the number down until I got around 16384. This allows you to wrap around and around and force the user into having to be pretty dedicated to reach the end of the list breaking the illusion. Change the number down to 32 to see the end of the list and get a better feel for what is going on in the background as the delegate methods aid in rendering the UI.

Picture 3.png

Now what you really want to happen is if they hit the end of the list repopulate it and the easiest way to do this is redirect the list to its own middle. But if every time you did this you took them to the middle it would mess up their current selection so the algorithm has to be a little smarter and offset them to their current selection. There are three pieces to this. The first is the didSelectRow this delegate is called when the user stops moving the control. From here we want to call a delegate that is called when the control loads as well pickerViewLoaded. When the pickerViewLoaded delegate is called we setup the same max as the max returned in numberOfRowsInComponent because we want to go to the middle of the possible selections. We then take the max divided by two for the middle then use that value mod 10 to get the offset to take us to the nearest row divisible by ten. From here we can take the current selected row modulus ten and use that as the offset tot he current row we want them to be on. When we select this row without animation there should be no apparent movement to the end user and they should now be back towards the middle of the list.

Picture 5.png
Picture 6.png

The final piece of code here should enable us to return the number of horizontal components in the pickerview. As you can see the other methods have a component method that returns which column of data you are looking at. There is additional programming required for dealing with this but it shouldn’t be to difficult to figure out once you understand what you’re dealing with in the basics of the pickerview.

Picture 7.png

If your anything like me while the interface is unique but the loading mechanism I think could be significantly optimized but I think the user experience is one that as a developer I can live with because even with the overhead on the device it seems to work well enough. I would also like to disclaim this isn’t meant to be a definitive on the subject of the PickerView only a guide so application developers wanting to work with this control can do so without going bald because of the complexities of the control.

I attached the code as a project so building it in xcode and messing around with the parameters shouldn’t be to difficult.

UIPickerViewU.zip

April 30, 2008

Membership Provider Oddity

I thought I would write this one up as maybe I’m not the only slow one unable to find any reference to information about a way to set a users password to a known value programatically using the MembershipProvider classes. It seems much of System.Web.Security is geared towards interacting with a user and not as an API into the security framework itself. That is unless of course you wish to create you own provider.

If you have a user pauldy and you wish to change his password you create a MembershipUser then using the Membership class’s static method GetAllUsers() to retrieve a Collection of users indexed off the username and assign it to a MembershipUser like so


MembershipUser pauldy = Membership.GetAllUsers()["pauldy"];

It is pretty clear from the API there are two methods for reseting a users password. One of them ChangePassword requires you to know the old user password and lacks any overrides the other is ResetPassword which has an override that is the answer to a question he user supplies giving them the right to modify the user password and returns a random password. As a programmer I am a little interested in why there is no way to simply reset the password to a known value in an administrative fashion. There are methods to create a user with a known password or to delete users using the MembershipProvider but no direct method for simply reseting the password.

There is also a method for retrieving a Password using the GetPassword method that only works if you have the EnablePasswordRetrieval option set to true. Anyone who is evenly slightly security conscious is probably going to have that set to false.

The solution I have found i suboptimal as it hits the database with two writes for what should be just one but it does work. Because unlike most modifications to the MembershipUser the ResetPassword method actually modifies the user information when invoked you can change a users password to a known value by using the following statement.


String pass = "supersecretpass";
MembershipUser pauldy = Membership.GetAllUsers()["pauldy"];
pauldy.ChangePassword(pauldy.ResetPassword(), pass);

Now this effectively changes the password to some random foo generated by the ResetPassword method and uses its output as the current password for the ChangePassword method allowing you to set it to a known value. If anyone knows a better way to do this please post in the comments. The ultimate goal of me diving into this was in a user management app to place a button that allows a privileged user to reset the password of another user and not have them get a messy new password. So I created a function to generate random passwords and use it to make it easier on clients.


protected String genPassword(int genPassLength) {
String approvedCharList = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!$%&*?";
StringBuilder newPass = new StringBuilder();
Random random = new Random(DateTime.Now.Millisecond);
for (int x = 0; x < genPassLength; x++) { newPass.Append(approvedCharList[random.Next(0, (approvedCharList.Length - 1))]); } return newPass.ToString(); }

February 8, 2008

Yahoo goes Live

It isn’t often I’m excited about new web services I see, especially in the content delivery space because it is such a huge technical challenge you don’t get to see anything that mind blowing. Today I caught wind of the live service from Yahoo logged in checked it out and it really is a technical marvel. Web based video conferencing it show cases something that really seemed live it might not be doable until now.You can see my live feed if available below. Probably just a shot of the back of my head from the macbook but it should give a nice preview of the possibilities from live broadcasting to what I think is the more important feature cross platform video conferencing with a unified front end. You can view it by going to live.yahoo.com 

 

January 30, 2008

I love my Mac Applescript + Mail.app

Normally I just enjoy computing more that I have switched to the mac platform. Mainly because all of the software just seems to be so well thought out. So much of my experience with Windows was whatever it took to get the job done as quickly as possible so we can move on to the next one. With the Mac there are just certain elements that make me fell all giddy inside as a technology enthusiast and software developer. One of these little moments came to me in the form of a post on MacOSXHints.com.

It was a very simple AppleScript something I have messed with in the past for creating some things I thought were missing in the Finder like a directory up button and directory refresh button on my Finder windows. But I hadn’t really thought of it in the same way I might think about a unix shell script. It just doesn’t seem structured enough to do anything really useful. Until I saw this tip, the jest of which was to announce the name of an incoming mail message sender instead of a simple incoming mail alert.

With very little modification here is my version of the script.


using terms from application "Mail"
on perform mail action with messages newMessages
repeat with newMessage in newMessages
tell application "Mail"
set senderName to (extract name from sender of newMessage)
set mailSubject to (get subject of newMessage)
say "E-Mail from " & senderName
say "Subject " & mailSubject
end tell
end repeat
end perform mail action with messages
end using terms from

Mail.app PrefPane

I saved this as a compiled application and move to Mail.app where I created a rule called Announce and was able to integrate it with my Address book and tell it to only fire for people who are in my family or friends groups. This means only people I know who send me e-mail all the time will run this script. Next I moved it to the top of the list so no other scripts would run before it. Now when my wife sends me an e-mail that might be of importance instead of hearing a bing and knowing I have some random e-mail that I will look at later I hear that she sent me an e-mail plus the subject so I can decide if it is something I should read or if she is just forwarding me another chain joke e-mail.

January 10, 2008

Calendar Server for iCal

I’ve been struggling with Markspaces Sync Together for Mac OS ever since leopard came out. They had a notice on their website for months concerning incompatibility with leopard but no notice as to when or if they would be working on making it compatible. Finally the time came I was ready to figure something else out. I found all kinds of tutorials on setting up a .mac clone which seemed interesting but all I really wanted was to keep my contacts and various calendar events in sync. I also wanted to share this information with my wife’s machine without it being a big hassle. I had read about calendar server before so I decided to set out to get it installed.

I have been working with open sourced software like this for years so I expected some bumps but figured in a few hours of free time I should have it up and running. I was so utterly wrong I could not have imagined the pain this software would cause. First what little documentation there is pre supposes configuration options and package installations that are almost sure to be incorrect for anyone who attempts the install. Second the server makes use of some new technologies like extended attributes for files that while mentioned are not described in enough detail for anyone not already intimately familiar with to make use of as for most installations this is disabled by default. So the setup isn’t the easiest to grind through. The good news is if you know what hurdles await there really is nothing to it.

So here are some of the steps required to get it up and running under Ubuntu 7.10.

My assumptions are that you are at least running a base installation of ubuntu and that you have not removed any of the packages installed by default and are using the default ext3 file system. I will also assume you understand how to deal with any issues regarding apt-get and mirrors.

First you want to get any extras that might not be installed by default with the following command.

apt-get install curl zope3 python-xml python-pyopenssl python-dateutil python-xattr python-pysqlite2 python-twisted python-vobject python-kerberos

Next you want to setup the file system for the metadata storage. This part took me quite a while to figure out that it was indeed a showstopper not to have a file system that supports this interaction. Fortunately I was running ext3 so it was a simple as running the following command mount -o remount,user_xattr /. This remounts the root partition with the ability to read and write the required metadata. This is required for whatever partition you store the data on only and once you have done this you may want to add user_xattr to your /etc/fstab in the options section.

Once this has completed you are ready to get the server from svn. You can place this any number of places popular ones include /opt /var and /usr/local so change your directory accordingly and run the following command.

svn checkout http://svn.calendarserver.org/repository/calendarserver/CalendarServer/trunk CalendarServer

Keep in mind not everyone is a trunk kind of person you can also use the release versions found by pointing your browser to http://svn.calendarserver.org/repository/calendarserver/CalendarServer/tags/release/ and grabbing one of the directories you see in there and use that url in place of the one pointing to trunk.

After the files have finished downloading it is time to configure your server defaults you can do this by changing directory into the Calendar Server directory and running the command run -s once this has completed you need to create your config file so cd into conf and the run cp caldavd-test.plist caldavd-dev.plist. I don’t know why that was their naming convention but it is.

Now you have a working server ready to accept local connections to enable remote connections edit the caldavd-dev.plist and search for 127.0.0.1 and replace it with the external interface you wish the service to listen on. You can now configure your client to access the server to test out prior to getting into the config file and securing it for your personal needs.

The client connection from iCal was pretty simple you go to the iCal menu select preferences. Then you select the accounts tab click the plus sign to add a new account. Type in your own description and then the username and password to connect to the server. Next enter the url to the server begining with http or https depending on your setup. Then the hostname or ip of the server you are connecting to. Leave off the trailing / it will auto setup your path if you elave it off. Click add and you should be reading your online calendar.

Some things I hope to see in the future are event notifications when something has changed on the server it should notify the client to check for modifications. It should also maintain the connection to the server when iCal is closed and update notifications accordingly. Overall thought I’m happy with how it does work and glad I took the time to get it setup.

January 3, 2008

Bad Buisness May Make Next Years Holiday Retail Suffer

Ok the holidays for many mean consumerism on a massive scale. This isn’t a bad thing it circulates wealth and helps promote economic growth and development plus we sometimes get cool gifts. Sometimes we don’t so we have to deal with the returns desk. Last week we did our returns after Christmas and found most companies were quite helpful. With many of the companies I felt almost guilty how easy it was to return the merchandise. We hit Macy’s, Dillard’s, and Neiman’s. All were pleasant service with a smile people who issued store credit for the merchandise making it easy for us to possibly locate something in the store we actually wanted or in some cases needed.

The bad news was all stores were not this easy to deal with. I received an Apple iTunes Gift card, I don’t really buy anything from there but I plan on buying a new machine in the next month. The monetary value wasn’t much 25 dollars but I wanted to get store credit instead so I could use it towards the purchase price of my new machine. I entered the store thinking this should be a slam dunk no brainer of a deal. When I inquired about the return the initial rep I asked told me he would have to check. He turned to a guy behind the counter and asked him if they could exchange the card for in store credit. He literally gave me a dirty look and said we don’t do that. I left the store disgusted by the double whammy. When I got home I discovered this was common practice and that once you own a gift card to the iTunes store you’re pretty much locked into buying music with it. This is very disappointing as with most any other reputable company you can purchase items from any of their subsidiaries with the same gift card. For instance I received a gift card for Outback Steak house as a prize from work. I’m not big on Outback Steak House but on further inspection they will allow me to redeem it at all sorts of other restaurants including one on my favorite list Carrabba’s. Why Apple isn’t like this I have no idea at least one other person knows the pain of this too.

The next issue we faced was the return desk at Target which according to a few websites, including the consumer affairs website, is becoming more difficult to deal with concerning their return policies. We received several outfits from Target for our 10 month old child. He is wearing 12+ month clothing but we received a few items that were 9 months. We attempted to return these items just to get store credit to return when he actually needed clothing we were then confronted with the asinine return policy that limits returns to 2 items per year. Then we reasonably thought ok can we exchange them for larger sizes and were told that act counted against us as a return. I know companies are faced with problems of product slippage and looking to set policies to prevent abuse of their systems but they are ultimately punishing their patrons with this policy and have placed us in the position of recruiting friends and family to return the products ensuring they are unable to return future products themselves for the rest of the year. This also means we will be less likely to make gift purchases at Target for fear of placing people whom we know and like in similar situations. I can only imagine others might have to face similar decisions.

But those attempted returns where just the tip of the iceberg for how some retail treats its customers. Over the holidays my grandfather mentioned a company I had long since written off Geek Squad. Most everyone in the IT industry has an inherent 6th sense about companies like this who prey on the ignorant up selling them on every little piece of software and service they have available and we avoid them at all costs. My reasoning in contacting them was that I have a simple problem I understand the solution can these guys provide it at a price I’m willing to pay. What I need is someone to run cable from my wiring closet to my computer wall and another from the garage to the wiring closet. Pretty simple I have a 6 foot auger, tone tester, wire, wall plates, cable crimper, rj45 ends, and fish tape. What I don’t have is someone I like but not so much that I wouldn’t mind subjecting them to this wire rat exercise, low pitch roof bad insulation and roofing nails that were about an inch and a half to long. So I called up the Geek Squad got in touch with their computer department and instead of asking my question I was assaulted with questions attempting to extract personal information form me, my name, phone number, address. All I had was a simple can you do this or not question. Instead of answering these questions I asked the lady if she couldn’t at least tell me if they could accommodate my request before I gave her this information. I told her what I wanted done a network drop for two machines to a central location. Her response no problem we can do that, I though great now I will give her my info get a quote and decide if this is the route I want to take. I gave her my info and she put me on hold for the quote. When she returned her first question to me was, “So will this be in store or onsite.” I thought to myself are you kidding me, yea let me drag my house to the store so you can run some wire though it, I don’t live in a freaking tent lady! But, my response was onsite, she then asked how many computers will they be setting up I responded with just the two but they don’t need anything setup on them really if I can just get the drops I will take it from there. Her response was if you want cable run in your house you’re going to have to call your cable company. This sent me spinning because this point I realized this lady was absolutely clueless and she had just lied to me to get my name number and address, and for what so they can sell it to some third party and mass market crap at me I don’t want in the first place. I tried to compose myself and adjust my question to improve her comprehension of the situation. I made it clear I wasn’t looking for tv or internet I wanted to setup my home network and I needed network drops to connect to the computers. She confirmed her lie by telling me they only do wireless setups.

For these companies I wonder what forces have caused them to make such bad decisions with their customer care. The next holiday season now not only do I have to worry about who I’m buying for, what their tastes are, am I getting the right kind of gift, is this in their size, is this what color scheme they have in their house, etc… Now I have the pleasure of studying return policies to see how they might adversely effect the people I’m buying for to make sure I’m not potentially setting them up for disappointment when what I get them isn’t the right color, doesn’t fit, or isn’t the style they feel most comfortable with. Then we get to add to this the companies who seem to be more concerned with getting your personal data than they are offering you any goods or services. So if we know you don’t be surprised if you start to simply receive cash or gift cards from a major credit card company don’t think it’s because we didn’t put any thought into it or it was a last minute purchasing decision. The reality is retail sucks and we would rather you be in a position with the leverage to walk away if you run into a Geek Squad vs being beholden to the asinine policies of an Apple or Target. Maybe by next year’s sales figures will reflect just how much, then I can look forward to 2010’s Christmas Season where we will be treated like customers instead of potential thieves or sheep for the slaughter.