Al Johnston

Ranch Hand
+ Follow
since May 02, 2009
Al likes ...
Postgres Database Flex Java
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Al Johnston

I disagree with the assertion that you can only write native iOS apps on Mac... For instance this app: Dognapper was written entirely on a Windows machine.

I write Java server side programs and Flex (Apache Flex Project) UI programs. I write the Flex side almost exclusively in ActionScript. I then use the Apache Flex engine to convert the ActionScript to native iOS and Android apps and I do so in Windows. I generated my distribution keys with Open SSL, tell FlashBuilder where to find the keys and use TestFlightApp to distribute iOS apps for debug purposes.

Since my animator has been working in Flash for many years, it is also a lot easier for us to rapidly create complex mobile apps with a back end server. For example, we built a poker game (Java game server on Linux and Flex Mobile front end) that allows multiple players to play at the same time in a poker sort of way... We wrote a Flex UI to talk to a Java socket where the mobile (iOS and Android) and (non-mobile) web users connect, subscribe and receive messages so that the UI can synchronize - for example if you bet 20 chips, everyone at the table should be told about it when it happens so that they see your stack change. Because of the tools we use, I get to take my animator's FLA and call "new" on any Flash components and to be able to use them as objects (MovieClips in ActionScript 3.0) while easily connecting to Java while writing code ONE TIME that runs on all mobile devices and in web browsers. We do all of this in Windows.

You can't skip the Mac entirely though. While you absolutely can create iOS programs on a Windows machine and should not let not having a Mac slow you down, the iTunes store will not allow you to deploy your apps to the iTunes store without a Mac. This used to not be the case, but Apple changed how the iTunes distribution store works being the swell, open company that they are. Whether you get a Mac or not, I don't know why anyone would want to write software multiple times. Write software once (use a tool like Flex - IMO). Then you can spend more time making your software do the fun things you want your software to do rather than being railroaded into an expensive computer just so you can do work twice (assuming you care about deploying your software to devices other than just iOS devices). Anytime I deploy to the app store, I just borrow a Mac from someone who uses it to read email and surf the web.
8 years ago
iOS
Hi,

Sorry... this is sort of a java/flex in general question. Not knowing whether my problem is on the java or the flex side I'm rolling the dice.

I'm having a bit of a problem with calculating the same encryption key on both sides of an encryption chain. On the server (Java) I am able to decrypt the message I generated on the client (Flex) if I use the key generated by the Flex client (makes sense, right?). But, I obviously don't want to send that key across the internet so I have both the server and the client generating their own respective keys via a matching algorithm. Both keys are an SHA256 hash of various values.

In Java the SHA hash method looks like this:



In Flex, the method is:



Flex outputs a key: 96a296d224f285c67bee93c30f8a309157f0daa35dc5b87e410b78630a09cfc7

Java, hashing the same string outputs the key: 86dadd24a11b2378d13f55741f0f7c13d916fb4125ca1e4eb093c43937c392d6

Thus, I get a padding exception when I try to decrypt the message I'm getting from Flex. Can someone please help me see what is wrong with my hash algorithm? BTW, I also tried:



That was also to no avail.

Best,
Al
10 years ago
BTW, that error is on the flex side. It is telling you that it does not understand what it just heard.
10 years ago
From the information in your post, I can't say this is the answer for sure, but you might try BlazeDS. It is very easy to setup (especially if you're using Maven) and you'll likely never get that error again.
10 years ago
Found it. Looks like Flex's auto-generated HTML wrapper overwrote my settings. Now that the main container settings are set, everything is laying out as expected.
10 years ago
I am in the process of trying to get our newest release for a video sharing product done. On one of the screens (which is about 5 containers deep) I have a series of video posters that layout on the page with a 1-n navigation below the videos (the page displays 12 posters and then adds navigation if any feed exceeds 12 videos).

In my HTML wrapper, I have set dimensions for my SWF and have lined up the SWF with those dimensions. Whether in FireFox or IE, the parent container is positioned on screen where I expect it and there are no layout anomalies. However, the children of the parent differ depending on which browser I use. I have set the positions and the sizes of the containers in the AS3.0 code. Yet, the video posters I mentioned above will have the navigation below them in FireFox but it will be off the screen in IE. When the posters line up perfectly in FireFox, to get them to display properly in IE, I have to reduce their size which makes the FireFox rendering too small. I have no idea why one browser would have a different layout result than any other browser - especially since this is an SWF being sent down to the wrapper from Tomcat. Has anyone faced this and how do you fix it?

Given that this is many levels deep in my code and it is loaded in an HTML wrapper, I'm not sure what code to post here in case it is a coding problem. If more information is needed, please let me know. I can give you a link to the app to see what I'm talking about if you are interested and if you PM me. We're not yet ready to release it to the public domain otherwise - and problems like this keep us from doing so.

Best,
Al
10 years ago
The difference is about $50,000 per processor (or at least it was at one time).

I use BlazeDS because it is free but it cannot do all that LCDS can. I use Wowza for all RTSP because it is fantastic and a lot less expensive than LCDS. If you want to go all open-source (and have need for certain features) you can use BlazeDS and Red5 (in my case I have to stream video).
10 years ago
Hi,

Per Jeremy's - the author who participated in the forum this week - advice, I switched our web-service from SOAP to BlazeDS. Everything is running smoothly up to a point. I get two Maps back just as I expect to. However, I still can't get a List in Java to be an ArrayList in AS3. Can someone help me see what I need to change?

Here is the java code for the service:



I put the printouts on the server and see the videos return in 50 to 90 seconds - which is expected right now.

I have one object in Flex that does all my web-service work. It has a matching method for each method that is on the server. Since the server returns different result types, I have to be able to initialize differing types and objects based on what the caller is expecting. So, I have a resultHandler function in the Flex web-service object that knows what the caller is expecting. The caller registers with the web-service, waits to hear back and then the caller gets the type the caller is expecting. As an aside, I have to do a lot of rigmarole to avoid race conditions in Flex - if I ask for videos and expect that the screen won't load and the next method won't run until they come back, I'll be wrong so I have to make methods key off of one another and be very careful about what I let happen when. In any event, this caller is "holisticSelection" and is expecting to get back a List. I commented out the listObject instantiation and changed the results to a Map...



The if at line 11 will never run - even when listObject is instantiated. After first trying to cast the result as an ArrayList (which I want) and then an ArrayCollection (which didn't work either), I tried just getting it as an object in line 7. That works. If I have to, I will go back through my code and modify the objects that are looking for Lists to start working with Maps. Instead of that, I'd like to get the Flex code to work with the List. Is there some easy solution to this outside of just changing all returns into Maps?

Regards,
Al
10 years ago
BTW, now that we've gotten into Flex and are quickly adopting it, I am still a little lost as to why we went this way. I like the familiarity of ActionScript and the ease of MXML, but if you don't mind me getting off topic, what is the advantage of Flash over Java FX and/or Swing and Applets or even Swing and JNLP?

I have found that in order to use Flex, I have to have some helpers from time to time - whether the helper be JavaScript or some other helper. For instance, I wanted to automate an upload process where we need to ensure certain directories have certain things before we upload. Since Flash runs in a security sand-box, I found that what we were trying to do would not work. The only way to make it work is to use JavaScript to browse directories and build logic and then validate it all in Flex and then call back to JavaScript to do more work then back to flex... or use a technology that can be configured to allow directory browsing. So, I wound up writing a JFileChooser and JTable with a table-model and a JNLP file for web-start for this one exception process. As I did that, I wondered why we did not just make the whole thing Java since we all know it and it seems to be able to do anything that Flex can do plus not have security restrictions. Don't get me wrong... I like Flex and am comfortable with it. Just curious why you would select it over arguably more capable technologies like Java (especially now that there are layout tools in the IDE for alternatives to Flex).

Maybe I should make this a new thread. Apart from your thoughts on the advantages of Flash over other solutions, does your book discuss where Flex is going and do you believe that html 5 or any other technology is likely to change the relevance of Flash?
11 years ago
Makes sense. I am not the web-services guy. Have never done anything but call them. I wrote the code that goes on either side (the UI and the Server). As we got into using Flex, we had these discussions and tried to pick what we though would be most re-usable. Now that I've gotten BlazeDS up and experienced how it works, I can totally see how you can accomplish both tasks at the same time with one object.

As an aside for anyone who may stumble upon this and have the same trouble I did... When setting up BlazeDS using Maven instead of setting up per the instructions on Adobe, I had to add the apache-commons-http and logging dependency to the pom to get MessageBrokerServlet to instantiate.
11 years ago
Thanks Jeremy. We are trying to build something that works with every front end, not just Flex and thus built a standard web-service. It looks like the simplest means to getting this done is to go ahead and put Blaze DS in as yet another framework.

I read the first chapter. I thought it did a great job of explaining the concept, giving step by step examples with comprehensive information - without being verbose. It would have been a great resource to have a few weeks ago when I started learning Flex. The sample chapter is way better than any resource I was using to learning as it is so Java focused. Explaining Maven and Spring (both of which we use on this project) was fantastic.
11 years ago
BTW, My sample code for getting returned values is not entirely correct. It needs one more inner loop to loop the number of keys and values stored in the object. In real life, the only way I've been able to make it work is to loop the ArrayCollection (which is really an ArrayList), get each object and then loop the object "for (var key:String in Object)" as an inner loop. Then for each "key" in "Object" get the "key" and then get the "value" such that the final result is var returnedValue = String (ArrayCollection.getItemAt(location).k["value"]. I need loops of loops to get collection values back which defeats the purpose of sending back maps at all. If one of my values of the map happens to be a Map, I wind up with loops building on top of loops just to get to the point of having usable Flex data.

Also, the first result handler you see in my post (the second code block) was put together when I was surprised by the first web-service call we tried. That call does not return a List. It returns a Map. I tried var:myValue = returned_map.server_key and got null pointers. I put in the loop to find out that my keys were all stored under "key" keys and my values were all stored under "value" keys. I was able to get the actual values I need through the loop. But, I should be able to get the values I need without any looping at all.
11 years ago
Hi Bernard and Jeremy,

I created a Java server which I used to run as an RMI service that talked to ColdFusion and then delivered data from ColdFusion to Flash in XML. We moved to Flex in Flash Builder 4 and decided to drop CF and make a web-service. In reading about Flex, it seemed great. I can return a List<Map> from Java (via a web-service) and then the List will be an ArrayList in Flex where the Maps will be Objects and on each Object I can get the value by using the Java key. For instance:



Now, in Flex, I should be able to do this:



I can do the above and have success. What is strange to me is the return (when I don't get an Apache error telling me that it can't create a mapping for ArrayList and I actually get a return anyway). To continue, now that my service is bound and I've gotten data back to my result handler, I should be able to do the following according to everything I read about ActionScript and Flex:



Are there any pointers you can give and/or would your book help me fix this? In order to get Maps or Lists that are usable by my ActionScript/Flex code, I have to do a lot of looping and printing to screen which is killing me in development and is not creating optimized code. What good does it do me to return an Object if I have to do exponentially more times the amount of processing than I would have to do if we just stayed with XML and JSON? Surely I am doing something wrong...
11 years ago
Yep. That did it. Just took out the codebase path and it fired right up. Thanks!
11 years ago
I am hoping someone can help me figure out how to get my RMI objects running again.

We have a current production system that uses ColdFusion as a controller with RMI serving up objects. The RMI sever Jar was deployed under %java%/jre6/lib/ext directory. When deployed there (with a security file) the RMI server started up and served objects for many months with no complaints.

Now we are migrating away from CF and to Tomcat with no RMI but the same jar files. We were getting exceptions in the code as the Tomcat implementation will not look at the war file for the jar in question. The reason is that the jar file in question was in the ext directory and Java loads those classes first. So, when Tomcat goes looking for classes, it finds the ext classes. That's not right.

I have to have both implementations running. The old one using RMI is in production today. The new one using Tomcat and no RMI is what we hope to replace the production system with once we're done testing. So, to solve this, I moved the jar file for the production system from ext to a new directory I created "deployed_rmi_apps". I modified the security files, start RMI and then start the server. But, when I start the server, I get access errors. Here is how I am starting:



For the security file, it looks like this:



But, when I execute the java commands, the system throws an error once the server gets to "registry.rebind(name,stub)" where name is my server name and stub is UnicastRemoteObject. This was not a problem - everything ran fine - when the jar was in the ext directory. Now all the sudden it does not care what my policy file says. It simply denies me with the following:


FaceBookServer line 789 is the rebind call.

Does anyone know how to solve this? I've tried many things in the policy file and in the startup commands, all to no avail.

Best,
Al
11 years ago