Moved my blog over to my company site. I just hope my server can handle all the traffic from the millions and millions of my blog fans (ha!)
I am currently using pebble, but i think i am going to switch over to Roller or something running of a mysql db...
http://www.getwebinspired.com/gwiBlog/index.html
Wednesday, November 24, 2010
Friday, February 26, 2010
Flex talking to Java through Sockets
This is just a prelimanary writing to what will eventually go on my company website.
I decided to look into Flash/Flex <--> Java communications... I really love Flex and actionscript. Its a great tool for building forms. It has its limitations in that it really does nothing on the server side. I also love Java programming although i consider java front ends to be kinda tedious. I always thought using Flex as a front end for Java applications would be great, so i decided to write a bit of an infrastructure. I also want to try comets socket's with this infrastrucuture when i get some time.
I am basically using a debian server that i built to do all this. I am not going to go into detail on all the code now but i would like to talk about some of the pitfalls that cost me time in doing this.
PITFALL 1: security sandbox
the as3 code i had to use is:
PITFALL 2: Policy Server, your kidding right
Ok kiddies, in order to have Flex/Flash talk to your java server, you need to write a server to serve the policy file... Or have your admin install one. I tried the ones that adobe mentions and they where not working for me. I ended up writing my own in perl and it is working nicely (still early in testing though). Basically your going to sever a policy back to the flash app that looks a bit like this:
PITFALL 3: iPv6
This one resulted in me losing alot of hair. I really have to read up on iPv6 because i have no idea why it was screwing up my java socket server but it was. I completely rewrote my java server for no reason because of this. It turns out that IpV6 was banging up my java socket server so i had to disable it via adding:
to my servers /etc/sysctl.conf file.
The final product is pretty cool, i am passing xml from the Flex front to the Java server. I am probably going to build upon this to write a chat server so i can explore passing data both ways. In the short run i should be able to build some pretty bad as forms that dont require page refreshes to post.
I am basically using a debian server that i built to do all this. I am not going to go into detail on all the code now but i would like to talk about some of the pitfalls that cost me time in doing this.
PITFALL 1: security sandbox
Error #2044: Unhandled securityError:. text=Error #2048: Security sandbox
I had done cross server stuff with flash before, and i was aware of how to use crossdomain.xml. I did not know that when doing transactions through a socket (even locally, serving the file from the same machine java is running on) that i would have to use a different type of policy file..the as3 code i had to use is:
System.security.loadPolicyFile("xmlsocket://localhost:8080");
PITFALL 2: Policy Server, your kidding right
Ok kiddies, in order to have Flex/Flash talk to your java server, you need to write a server to serve the policy file... Or have your admin install one. I tried the ones that adobe mentions and they where not working for me. I ended up writing my own in perl and it is working nicely (still early in testing though). Basically your going to sever a policy back to the flash app that looks a bit like this:
<cross-domain-policy>
<allow-access-from domain="*" to-ports="*" />
</cross-domain-policy>
pretty basic stuff. I am guessing adobe is making this a pain in the ass so they can sell us a as3 server or something... Maybe an air server that is for more than desktop apps or something like that... <allow-access-from domain="*" to-ports="*" />
</cross-domain-policy>
PITFALL 3: iPv6
This one resulted in me losing alot of hair. I really have to read up on iPv6 because i have no idea why it was screwing up my java socket server but it was. I completely rewrote my java server for no reason because of this. It turns out that IpV6 was banging up my java socket server so i had to disable it via adding:
net.ipv6.conf.all.disable_ipv6 = 1 The final product is pretty cool, i am passing xml from the Flex front to the Java server. I am probably going to build upon this to write a chat server so i can explore passing data both ways. In the short run i should be able to build some pretty bad as forms that dont require page refreshes to post.
Monday, January 18, 2010
IE 8 Whitespace Issue and a fix.
Not sure if this is an issue or just bad coding on my part but it was annoying. IE 8 (internet explorer 8) put an annoying whitespace above a flash item on my website:
The large black line across the top represents the background of the div that the flash document sits in. For those new to CSS, I refer to the space as a whitespace because that is how this bug or issue has always been referred to.. It only showed up in IE8 not in Firefox (shocking right). The white bar below the black is supposed to be there to give an overlap effect of the pen in the flash piece.
This is the css code of the div that is getting the space. I changed the background to black so that the space would stand out more.
The large black line across the top represents the background of the div that the flash document sits in. For those new to CSS, I refer to the space as a whitespace because that is how this bug or issue has always been referred to.. It only showed up in IE8 not in Firefox (shocking right). The white bar below the black is supposed to be there to give an overlap effect of the pen in the flash piece.
This is the css code of the div that is getting the space. I changed the background to black so that the space would stand out more.
#flashBanner {
width:950px;
height: 330px;
padding: 0px 0px 0px 0px;
margin: 0px 0px 0px 0px;
background:#000000;
border:none;
outline:none;
text-decoration:none;
float:none;
}
To fix the problem I added an absolute position to the flash class in the css:.flashDiv{
position:absolute;
}
Once again this space issue seemed to only be on IE not on Firefox... I did not test of previous versions of Internet Explorer. To see the final implementation you can visit: http://www.getwebinspired.net/Sanity loss: 8 (out of 10)
Labels:
css,
Internet Explorer,
web design
Subscribe to:
Posts (Atom)