Thursday, October 13, 2011

IOS 5 iCloud Dilemma and solution

If you're like me you have your awesome former mobileme, whatever@mac.com or me.com . You like that email address. But..... before there was a mobileme you had also been purchasing apps , music , movies, dark matter from that nasty email address that was tied to your itunes account when you were 17, and using hotmail or comcast as your email.

Of course Apple still refuses to offer any sort of merging of accounts. So you get IOS 5, on setup it asks for your iCloud account, well I didn't really know which account to give it, so I gave it the one that I knew purchases were associated with, hoping I could add additional accounts as well. So I do that, and everything is fine, except I can't change the primary iCloud account!!! I can change random stuff like iMessage from , but a lot of the functionality is directly linked to the primary account.

Solution:

On initial IOS 5 setup, using your iCloud account that you want to use. Then later, go to the Store options, under Settings, and change that account to your account that all of your purchases are associated with.

Saturday, August 6, 2011

Social network change

I've decided to change the technology to build the site from ASP.Net MVC 3, I've decided that the sort of people I'd like to use my site, wouldn't be very appreciate of it being built from a Microsoft project, I think i'm going to looking into using RoR, i've used it in past projects and would probably be a pretty good choice.

Thursday, August 4, 2011

Social Network


I'm considering creating a social network for developers. I know such things sort of exist with applications such as git hub or stack overflow, but I"m thinking of something that sort of blends several elements from different social networks together. Neither of the above sites have truly social feel (as the way Facebook for instance does). I'm going to attempt to create a site that blends Facebook with Linked IN with Github. A place people can collaborate on projects that they find of interest or simply to learn about areas that they might be interested in. More details to come.

Monday, February 21, 2011

Memory Management

So I've been working on several projects involving ASP.NET 4. I've relied heavily on LINQ to talk to my SQL database. I've been curious though about how to deal with my dbml object in a code-behind C# file. For instance usually I just declare a global instance of it in my file, and reference it directly in functions that are called through out the lifetime of the page object. I didn't know if it was better to declare local instances of this object in functions instead. I posted some forum posts about this and I got an unexpected answer. Instead of using either of the above mentioned methods, I should instead use the using statement in C#.
http://msdn.microsoft.com/en-us/library/yh598w02(v=vs.80).aspx

With a 'using' statement, I can create a local instance in my function, and essentially immediately dereference it from memory as soon as my code has left the scope of my 'using'. This provides for much better memory management especially in website's with high user activity, as otherwise your server will continue to load instances of the object through your memory, and you're at the mercy of the garbage collector for when those memory allocations are destroyed.


Saturday, February 5, 2011

Duplicate iTunes So Lets Write some Code!


So once again new computer. My iTunes library is on a external hd connected as a network device. Since I don't want to actually bother mounting the network hd to my mac when I want to use iTunes I just wanted to add external music files to my local hd. An hour later, it's done, but practically every song is duplicated. I checked my network drive, and sure enough every song on it is doubled(not sure why). Regardless of reason I want to resolve this issue. Now of course I could use the 'find duplicate song' from the itunes menu, but that dones't quite solve the issue, as I still have to manually delete the duplicates. PLUS.. the songs are still duplicated on the network drive, so I'd have to do this again when I got another computer. There's a few software solutions out there that I could buy and try. But frankly I don't want to risk it messing something up. Instead why don't I make use of a perfectly good Sat night/sunday morning and script it myself. Open up terminal, g++ here we come! I'll post source code once I've finished it. I'll probably try to take a safe route. Write some recursive function, probably start at a top level directory. If there is another directory go into that. If not go through songs, if next song is duplicate of current song(account for something like a balhblah(1).mp4 ) remove it. Then terminate call. Recursion handles rest.

Blogging from android app

Google has now released an official blogger app. So far looks pretty simple and good. We'll see once I actually post this. Sorry for the lack of usefulness in this post.

Monday, January 24, 2011

Fun with RFID


Recently I've been attempting to take advantage of the fancy new hardware packed into the Nexus S. More specifically reading rfid cards using the Nexus's nfc hardware. This turned out to be a bit more tricky than I thought.

Easy part:

Google provides source code for a demo application that will greatly aid you in figuring out the api. The android.nfc btw is stupid simple. In fact you don't have to worry about connections, listeners, any of that stuff. The google nfc service is always on, constantly polling for new card scans. When it detects a card, it issues a nfc intent. You just have to make sure that your applications manifest file, is setup for that intent.

As in: Make sure to have this in your main activity.

<intent-filter>

<action android:name="android.nfc.action.TAG_DISCOVERED"/>

<category android:name="android.intent.category.DEFAULT"/>

intent-filter>

Also make sure you enable nfc permissions and hardware requirement.

<uses-permission android:name="android.permission.NFC" />

<uses-sdk android:minSdkVersion="9">uses-sdk>

<uses-feature android:name="android.hardware.nfc" android:required="true" />


Next in your main activity all you have to do is use the getIntent() to retreive information picked up from a scan. Once again , 'YOU DONT HAVE TO WORRY ABOUT LISTENING FOR SCANS ' which is awesome!


byte[] byte_id = getIntent().getByteArrayExtra(NfcAdapter.EXTRA_ID);


This one above line, retrieves the unique id from the rfid chip, and pushes it into a bytearray.


Tricky Part:


Now that you have your card_id in the array, you cant just push it out to screen. By default android attempt to convert the bytearray to UTF-8, so you would get some weird symbols. In my case I needed the hexadecimal from that to store in a DB. I'm going to list the exact sort of rfid chip I dealt with, in hopes that this will help someone else attempting to do something similar. This is because there is 0 information on the internet that will help you figure this out otherwise. With the exception of a technical specification document that I'll link.



My card type and rfid chip:

High quality CR80 30mil white PVC RFID

cards HF Icode SLI

CR80ICODESLI

Operating frequency 125KHZ


Link to documentation: http://www.nxp.com/acrobat_download2/other/identification/SFS052611.pdf


Your chip type is important, because it will let you know how to read your uid. In the case of my chip, it's a 64 uid, with MSB as the left most.

This is very important in being able to correctly convert your bytearray to binary, hex whatever. There's several code examples of how to convert to hex, but unless you know if you're dealing with little endian, big endian, where your lsb, msb is, it won't work, even though you'll get a hex output.

In my case I used the below function

//Modified from function, I found on internet to suit specific needs.(Not trying to take credit :) )

public String ConvertbyteArrayToHexString(byte in[]) {

byte ch = 0x00;

int i = in.length-1;


if (in == null)

return null;


String HEXSET[] = {"0", "1", "2","3", "4", "5", "6", "7", "8","9", "A", "B", "C", "D", "E","F"};

//Double length, as you're converting an array of 8 bytes, to 16 characters for hexadecimal

StringBuffer out = new StringBuffer(in.length * 2);


//You need to iterate from msb to lsb, in the case of using iCode SLI rfid

while (i >= 0) {

ch = (byte) (in[i] & 0xF0); // Strip off high nibble

ch = (byte) (ch >>> 4); // shift the bits down

ch = (byte) (ch & 0x0F); // must do this is high order bit is on!

out.append(HEXSET[ (int) ch]); // convert the nibble to a String Character

ch = (byte) (in[i] & 0x0F); // Strip off low nibble

out.append(HEXSET[ (int) ch]); // convert the nibble to a String Character

i--;

}

return (new String(out));

}


Using this, I was able to successfully parse though the bits of my 8 bytes, and convert all necessary to hex. I really hope this helps someone, and I'm sure there are many glaring inefficiencies with this code, and any comments left with suggestions to improve it are greatly appreciated.


Tuesday, April 20, 2010

Visual Studios 2010

While I'm usually a big open source fan, I can't deny that I've always found Visual Studios a fairly productive development platform. VS 2010 has added a few changes that I'm really liking. For instance, finally, yes finally Microsoft realized developers use multiple desktops to write code. So now in 2010 you can drag and drop your code sheets and tool bars anywhere you want on the screens. That feature is a decade late but hey, it's there now... Also as I spend much of my time on the database end, I can now connect directly to a sql server db through visual studios and write queries, modify sps, whatever I want to do without ever having to open Sql server management studio. Now for more hardcore DB work Management Studio is still neccessary for tasks like creating databases and table. It also appears that Visual Studios 2010 includes some much more robust code analyzer tools, I haven't had a whole lot of time to look into them, but from tutorials I've seen they look like they could be a big help in ensuring code consistency and mantainability.

Saturday, August 8, 2009

TextMate

Just discovered another great TextMate feature. TODO. Type TODO and add your todo thought, and then you can go to Bundles->ToDo-> Show TODO list and it will consolidate all of the TODOS into a single list regardless where they are in your project. This feature is great for when you're coding, have a concept of something you'd like to add or possibly review or change, but don't currently have the time to do so. Great way to stay more organized and on top of things.

Thursday, May 21, 2009

Putback


I was flipping through my c++ book today, a book I haven't really used since my freshmen year, and discovered a very useful function, putback(char) . When reading in a stream of characters it allows you to put a character back into the stream, could be very useful for certain parsing needs.
-- Post From My iPhone

Sunday, April 19, 2009

Bison

Learning about compilers, I'm finding Bison & flex very interesting. The setup is a bit cryptic at first, but I'm starting to really appreciate the power and simplicity of Bison and lalr(1).


-- Post From My iPhone

Thursday, February 26, 2009

airport extreme basestation and Fedora 10

I'm impressed, on the first try I was able to get my hp psc 750 printer (that is connected to my airport extreme basestation) to work with Fedora 10. All I had to do was (in Fedora) go to printer setup, choose the category "AppSocket/HP JetDirect", I entered in the IP of the airport which for me was 10.0.1.1, the next step asked me for what type of printer, and it was done! Tried to print out a page and it worked perfectly. I was expecting this to be a freagin 10 hour project.

Wednesday, February 11, 2009

Fedora 10 & Radeon x3870x2

Hurrah!! For crappy drivers. I've been using Fedora 10 for some time now, just upgraded to the new ati drivers( ATI Catalyst™ 9.1 Proprietary Linux x86 Display Driver) and now there is an attractive water mark on the bottom right hand of my screen, overlapping everything else. The watermark reads "AMD Unsupported hardware", I reviewed ati's knowledge base, and it indicated that either my hardware was truelly not supported, or I was missing a "control" or "signature" file from /etc/ati. Both files are present on my install, and I chose the ati drivers under the 3xxx model series. So either it wasn't tested with the 3870 x2 or there is something else wrong with the new driver release. Either way I downgraded to the previous 8.12 release, and now the watermark is no more. On a side note, I'm actually very much pleased with the ati catalyst driver installation process now, before you had to turn off x-server before you could install them, now it's a simple gui window, with just a restart required.

Thursday, January 8, 2009

Getting wireless working in Fedora 10

My desktop has a Linksys wireless usb N adapter. After installing Fedora 10 I have having extreme difficulty using the network manager to connect to my wireless network. The alternative was to turn off network manager and use wpa_supplicant. To do this I hade to go through a few steps. First make sure that your wireless adpater is set up correctly with ndiswrapper there are a ton of guides out there for how to do this. If you have my adapter make sure you are using 32 bit Fedora 10, as they're currently aren't any 64 bit driver options. Second you'll need to setup a config file for wpa_supplicant. The config file is usually under something like /etc/wpa_supplicant/wpa_supplicant.conf. My file looks like this

ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=wheel
network={
ssid="network1"
scan_ssid=1
proto=WPA RSN
key_mgmt=WPA-PSK
pairwise=CCMP TKIP
group=CCMP TKIP
psk="somepassword"
}


The password will be encrypted to do get the encrypted form of your password, you'll need to run a "wpa_passphrase + your network name + your network password". Then copy and pass the encytped passphrase into the .conf file. Now you should be ready to connect to your network. There are two commands neccesary to complete this. The first command to run is

wpa_supplicant -d -B -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf

The command to run next is

dhclient wlan0

It was wlan0 for me, but that will be the name of whatever your adpater is recognized as. The first command will cause the adapter to connect to the router. The dhclient command will actually retrive an i.p address from the router. Sometimes it takes a few minutes after running the dhclient command for anything to happen. I hope this helps. Also you will probably want to create a startup script for these two commands, so that your computer connects upon startup. Otherwise you'll have to run these manually each time.

Monday, November 12, 2007

FreeRice

This is amazing. Nothing tech related. Go to this site, every question on the quiz that you get right increases your donation of rice to those in need of food. " http://freerice.com ". 

Saturday, November 10, 2007

Getting my GeForce 8800 working in Fedora 8

By combining what I've read from several other solutions, I managed to install the proprietary NVIDIA driver for my 8800 in Fedora 8. 
Steps were:
1. In the terminal I ran "yum update" to make sure I have the most current build. 
2. Then "yum install kernel-devel". This is very important, the NVIDA installation won't work without step 2!
3. Download the proprietary NVIDIA driver from nvidia.com. 
4. Kill X-serve, I did this by running typing "telinit 3", there are several other ways but this one works well enough.
5. Now that x-serve is off, go to the folder containing the driver, and type "sh NVIDIA.(whatever its called)".
6. An installer screen should come up, and it will probably want to compile it's own module. Everything should be self-explanatory for this. 
7. After installer is finished, reboot computer, and in terminal type:
  "nvidia-config-display enable"
  then "nvidia restart". 
8. You might need to restart X-server at this point, either way the driver should be installed and working at this point. 

Friday, November 9, 2007

Fedora 8 upgrade through yum

Well it is time for me to bite the bullet and upgrade to Fedora 8. I have been using Fedora 7 since it's release and while pleased with it, I'm ready for the next iteration of Fedora. After reading quite a few forums and articles on Fedora 8, I decided to go with upgrade through yum. Two excellent resources for Fedora 8 through yum are : http://www.ioncannon.net/system-administration/133/upgrading-from-fedora-7-to-fedora-8-with-yum/ and http://www.leenukes.co.uk/?p=39.  Anyway first thing I did was make sure to have all updates taken care off. 
1.  yum update -y.
2. yum clean all.
I read from several other websites that people are having some dependency issues due to Beryl and related. I took care of that in step 3. 
3. yum -y remove beryl-plugins heliodor bdock.    
4. 

Wednesday, October 31, 2007

Still learning my way around Unix

So I've started to consider myself a fairly competent Unix / Linux user, only to continue to realize how little I know. It seems like that is always the case for me when it comes to computers, the more I've learned about computers in my various C.S classes, experience in programming jobs, and  tech news articles, the more I realize just how little I know. I want to know it all and I want to really really understand it.  I've been wanting to figure out a way to backup my data from my macbook to my tux machine (yes... I know Time Machine exists) but that isn't really what I need. So I started learning python and perl, hoping that would help me figure out how to traverse files and such. And yes it did!, yesterday night I spent several hours writing code that connects to a server via. ftp and begins to compare files. Well I then discover something called "rsync" hmm a preexisting way to handle backup processes oh wait, and it doesn't even use ftp. Rsync is incredible, I suspect Time Machine might be using it under the hood, anyway after figuring out how to use rsync I was like "great, but I really wish there was a way to automate this process like schedule backups daily or something..." and so I discovered cron. As soon as I started trying to add lines to cronedit, I was presented with a new problem... something called vi. Now that I have discovered what vi is, I hate it!! Pico  or Nano or whatever are so much better and make so much more sense for editing documents. I really do not see the advantages of vi. So within the course of a day, I have discovered: rsync, cron, vi, how to change default editor, ftp by default is a crappy way to transmit data, and python. But to be honest I really haven't learned that much, I have no idea how rsync works at the code level, nor cron, nor really ftp (well actually I'm pretty sure I know more or less whats going on with ftp at the code level) . Anyway although I think myself a relatively strong coder, I really don't know very much outside of that, and am seeking anyway I can to become a more knowledgeable, efficient, and useful computer scientist.  That is my goal in life. 

Tuesday, October 30, 2007

On Operating Systems

The new version of OSX , Leopard is quite interesting. I became a mac user only this summer and quickly found it to be quite superior to Windows. I have not abandoned Windows entirely as a .net programmer I am unable to leave it, my balance is found using parallels which allows me to use Windows like a tool instead of a desktop. Anyway one of the things I really enjoyed about Tiger was the fact that the operating system under that flashy productive GUI is Unix, or Unix like really. See I'm a Linux man, Fedora is my flavor and I really appreciated the fact that Tiger was Unix based. Anyway on to actually talking about Leopard. I did not like Leopard when I first tried using it, I found coverflow stupid, and I didn't like the way that the dock looks now. However after giving it a few days I have finally not just grown to like it but found it more productive than Tiger. Preview is awesome!!! preview has simplified the task of viewing things like mail attachments so much. No more waiting for Microsoft office to load or adobe for that matter, my document is immediately viewable. Another thing I really love is spaces, I was not sold on the idea as a Beryl Cube using Fedora man :). However as I've used it more and more I'm finding it much more useful than a cube effect. And I'm not sure why, as they both really accomplish the same thing. I suppose the ability to view all at once really helps.  There are many other things I have left out that I probably like without realizing it ,but the one thing I really want to mention is the fact that leopard's operating system is different than Tiger, certified Unix is under the hood. In fact that was the main reason I was excited about Leopard releasing. No open-source unix code will be easier than ever to make for Linux and OSX. And I find myself feeling like I'm in the same place when dealing with ftping or sshing it up through my macbook to linux box and back. CoverFlow is still stupid and not useful btw. Leopard has taken me a little bit longer to fall in love with than Tiger did, but after it's all done and said , Leopard is just another great update to a very already strong operating system that I hope will continue to grow in popularity.