Tuesday, December 21, 2010

Flex 3: two way binding with value objects

Today at work I was working with a VO and I didn't want to code an update function to update my VO every time there was a change. I feel like that extra function and calling updateVO all over the place looks sloppy.

What I ended up doing was inside my action script file I created a bindable instance of my VO.

[Bindable]
public var exampleVO:ExampleVO = new ExampleVO();


For the mxml file I ended up doing this.

<mx:binding source="txtFname.text" destination="exampleVO.fname">
<mx:binding source="txtLname.text" destination="exampleVO.lname">
<mx:Vbox>
<mx:Hbox>
<mx:label text="First Name:">
<mx:textinput id="txtFname" text="{exampleVO.fname}">
</mx:Hbox>
<mx:Hbox>
<mx:label text="Last Name:">
<mx:textinput id="txtLname" text="{exampleVO.lname}">
</mx:Hbox>
</mx:Vbox>

I had to be placed bindable tags at the top of page inside of the main tag. I set my bindings right after where I created my remote object.

That is how I did my two data bindings and I'm sure there are some other ways but this was the easiest for me and for what I was working on.

I did try to set the bindings with just AS3 using the BindingUtils.bindProperty() but I couldn't get it to work. I think my problem was that I didn't set it up to go both ways, so I might have to come back to that and try it.

Thursday, December 16, 2010

Flex 3 ObjectUtil.copy()

So the other day at work, I was working with a datagrid whose data provider was an arrayCollection that was holding a list of VO's. What I wanting to do was edit the selected VO in another component.

What I was doing was passing the VO into the component like:
exampleComponent.exampleVO = arrayCollectionExample[dataGrid.selectedIndex];
This was doing what I wanted, set the component VO to the selected VO. Worked great.

Now the problem I ran into was when I updated the VO and an error occurred. Although it wasn't updating in the database, the datagrid was updated. The item was binded I believe.

To corrected this I found this ObjectUtil.copy().
exampleComponent.exampleVO = ObjectUtil.copy(arrayCollectionExample[dataGrid.selectedIndex]) as exampleVO;

It worked for me and there was no more binding to the data grid. :)

Tuesday, December 14, 2010

Ok, I thought I had iHeartradio working

Ok, I thought I had iHeartradio working.

iHeartradio will work more then it did before. It turns out there are more IP address that need to be added to the "Do Not Cache" field inside your squid proxy settings.

Once I find out more those IP addresses, I will post them here for people.


Thanks!

Wednesday, December 8, 2010

Finally got iHeartRadio iphone app to work on home network

Finally got iheartradio to work on my network at home after months of trying.

I currently run pfsense with squid and squidquard packages for blocking network traffic to certain sites. It is very easy to set and manage.

But there was one problem that I ran into...iPhone iHeart Radio app wouldn't work. I couldn't figure out why it would work. At first I thought it was the squidguard blocking it but it turns out it wasn't. It would always work if I turned the squid proxy server off.

Being a noob to pfSense and networking monitoring, I couldn't figure out where to go to find the traffic logs. Finally I stumbled upon an article that says to run this command "tail -f /usr/squid/log/access.log". I SSH'd into my pfsense box and ran that command. When you start that command, get your iPhone and open the iHeart Radio app and try to stream, you will see the log file start filling up with the http requests.

For me that ip that iHeart was trying to use was 209.107.222.167 and the domain was akamaistream.net.

Now the fix once you find the ip address. In the web GUI of pfsense, go to your squid proxy server edit screen (services -> proxy server). On the general tab, there is a section for "Bypass proxy for these destination IPs". In the text field to the right, enter the ip address that you've found. In my case it was 209.107.222.167.

I couldn't find anything on the web about this and since I finally have it working, I wanted to let everyone know.

Monday, October 5, 2009

After a month of pfSense

It has been a little over a month of running pfSense and I generally like it.

During the past month of running pfSense, I've installed the Squid proxy and Squidguard. These are very easy to to install with pfSense. I've chosen to install Squid so I could keep track of the sites that were visited by people on the network.

I want to keep track because I plan on getting another Linksys router and let the neighbors us that. Of course I'll limit what they can do.

I also install squidguard so I could block sites on my network. I really like squidguard. Squidguard is really useful if you were to run a small business and you wanted to block sites.

Well that's all for tonight on this topic.

Wednesday, September 2, 2009

pfSense -- Open Source Routing

I recently acquired a old desktop pc, previously running windows 2000. So I figured, I'm nerdy, lets try to make my own router for home use.

I had previously worked a shop that used IP Cop and from my experience that I didn't really like the UI. Only knowing of IP Cop, I set out to find another open source router. I discovered pfSense.

From the screenshots, it looked really good and from the information I gathered from reading forums it looked like a winner to me. So I downloaded it.

It's only been a few days since I've started playing with pfSense and so far I like it. I don't currently have the internet at my house so it's kind of tough to test it all out but from what I've been able to test I like. I really like the webGUI. It makes dealing with all the options a breeze.

There is a cool setting that I did find. It's an option to authenticate the user before you allow them to use surf the net. You can set it up to ask for a user name and pass and then redirect them to another page. I'm not real sure if you need to log them in before redirecting them, which I'm sure you don't, but this would be a good way if you an extra wireless router to redirect them to a URL with the user rights to the network or what not.

I think I'm really going to like pfSense once really get into it. As of right now I've just skimmed it.

Friday, May 8, 2009

Useful advice from Bill Gates

I know this has been around for a while but here it is again:

Bill Gates recently gave a speech at a High School about 11 things they did not and will not learn in school.

Rule 1: Life is not fair - get used to it!

Rule 2 : The world won’t care about your self-esteem.
The world will expect you to accomplish something BEFORE you feel good about yourself.

Rule 3 : You will NOT make $60,000 a year right out of high school.
You won’t be a vice-president with a car phone until you earn both.

Rule 4 : If you think your teacher is tough, wait till you get a boss.

Rule 5 : Flipping burgers is not beneath your dignity.
Your Grandparents had a different word for burger flipping: they called it opportunity.

Rule 6: If you mess up, it’s not your parents’ fault, so don’t whine about your mistakes, learn from them.

Rule 7: Before you were born, your parents weren’t as boring as they are now.
They got that way from paying your bills, cleaning your clothes and listening to you talk about how cool you thought you were.
So before you save the rain forest from the parasites of your parent’s generation, try delousing the closet in your own room.

Rule 8: Your school may have done away with winners and losers, but life HAS NOT.
In some schools, they have abolished failing grades and they’ll give you as MANY TIMES as you want to get the right answer.
This doesn’t bear the slightest resemblance to ANYTHING in real life.

Rule 9: Life is not divided into semesters.
You don’t get summers off and very few employers are interested in helping you FIND YOURSELF.
Do that on your own time..

Rule 10: Television is NOT real life.
In real life people actually have to leave the coffee shop and go to jobs.

Rule 11: Be nice to nerds.
Chances are you’ll end up working for one.