Jul 19 2008

Creating a SVN repository

Published by under Server Side

I had found this awesome tutorial online to create svn repository and how to use it but i couldn’t find it again. I had to work hard and google a lot to get the repository working as i wanted it to be.

 

In end it was very easy to get it going and i would like to share with everyone. I won’t go into the installation procedures, i expect you have all the tools up and running. By tools i mean svnadmin, svnserve and svn installed.

 

I did this procedure on a Fedora 6 linux server and am assuming it should be the same for all unix systems.

Disclaimer: I am using svnserve for svn, it is not a secure way to implment svn and if you want security then i suppose you should stop reading this further 😀

 

svnadmin create /myreponame/mainfolder

 

That is it, the repository is created, its a blank one but then its taken care of. We need to add something now to the repository. So we will import something from the server. 

 

svn import projects file:///myreponame/mainfolder -m ‘initial import’

 

projects is the folder which has all the files you want to import, I had two Flex builder projects inside this projects folder and they were imported into the svn.

 

At this stage the svn is ready, by default the anonymous access is enabled and we need to change that. The configuration files exist in /myreponame/mainfolder/conf folder. We need to modify svnserve.conf and passwd which holds your svn access passwords. type in whatever username and password you need and then save it. The authz file controls the various read/write property and i don’t bother with it since it is for personal use.

 

just one final thing before we are ready to hold the repository, svnserve is the server for svn access, to start it as a daemon just type the following,

 

svnserve -d -r /myreponame/mainfolder

 

we need to point it to the correct folder, that is it you are all set with your repository.

 

svn co svn://www.yourdomain.com/mainfolder will download the repository and then you can use it.

 

I have used the above procedure to create a working svn repository and its for personal use only.

No responses yet

Jul 15 2008

Silverlight v/s Flash

Published by under General

Being a Flash/Flex developer i am prejudiced towards Flash but Microsoft really amazes me. The websites they develop or endorse are made using Flash and not Silverlight. I would expect Microsoft to go full on with Silverlight or is it because I am using Safari to visit this website. 

So much for a Flash killer, oh wait i forgot Zune is the IPod killer isn’t it???????? What next? are we going to see IPhone killer as well. 

I have to admit i don’t like MS at all, I have been a Mac user for over 3 years now. 

http://www.worldwidetelescope.org/ this is the website i am talking about, I think the MSN video player is made using Flash. 😀

I will be updating this as i feel to rant about MS :)

No responses yet

Jul 14 2008

Cairngorm and Remote Object

Published by under AS 3.0,Flex

I have had opportunity to use Cairngorm with Webservices, Httpservice and Remote Object as well. I had some difficulty passing variables to the amfphp backend but ultimately resolved it. here is how,

public function execute(event:CairngormEvent):void {
           
    product = event.data.product;
    responderObj = event.data.responderObj;
    productId = product.products_id;
    var service:RemoteObject = ServiceLocator.getInstance().getRemoteObject("getProducts");
           
    var operation:Operation = service.getOperation("get_colors") as Operation;     
   
    //this method of sending arguments wasn't working, it was sending undefined.       
    //var dataArray:Array = new Array({productId:"93"});
    //operation.argumentNames = dataArray;
   
    var token:AsyncToken = operation.send(productId);
    token.addResponder(this);
           
           
}

For some reason operation.argumentNames i thought would take the array and then send the objects in this array as variables, but it was sending undefined as the value for the variable.

I resolved the problem by sending the variables in send function and i am sure you can send more than one variable in the send function.

2 responses so far

Jul 09 2008

Catalina Long Weekend Trip

Published by under Diving,General,Hiking

I was kinda desperate to get out of the city for 4th of july long weekend and was trying different options but nothing worked. Finally due to last minute cancellations a campground at Catalina was available so i booked it. Bhanik, Amrish and Rajesh (henceforth referred to as BAR :) ) decided to join me on this trip. They were made aware that there was a hike of 12 miles involved on the final day. Here is how the trip went by. 

Pre-Trip Preparations. 

I went to REI to pick up some cookware since i didn’t have any for backpacking. I found something useful Kitchen Cupboard (which i didn’t take completely) and Cooking system (which was very useful). I also picked up some food items and desert for our dinner. 

Headed off to USC to Amrish’s place to pick everyone and after making sure they packed properly we went to Paru’s for dinner. Dinner at Paru’s was awesome as usual and then came back to my place after stopping at Ralphs and finally after packing my stuff i dozed off at about 12.30.

 

4th July

We had to take 7 am Catalina Express from San Pedro so had to wake up at 4.30 am to get everyone ready and then drive to the terminal. We made it to the terminal at about 6.45, just in time, we reached Avalon at about 8.15 and immediately stored most of the stuff in locker just outside the dock. We decided to take the shuttle bus to BlackJack campground since BAR wanted to take Introduction to Scuba and i was planning to dive along with them. So we got our campsite details, booked the 4 pm bus to Blackjack junction and since the Scuba was going to be at noon we had some time to kill before that. 

Golf Cart to the rescue, We rented a golf cart to go around Avalon and since i was the only person above 25 i was the lone driver. Amrish and Rajesh wanted to drive it but it was supposed to be $850 ticket and I didn’t want to take that chance. We took the scenic route on the island and stopped for sometime in between to take pictures and stuff, an hour well spent. Since it was almost time for BAR scuba lessons we headed off there and I also decided to rent BCD, Regulator etc so that i could also dive. Yes, I would be diving Solo. I have got my certification at Casino point and also have dove there before so I was completely comfortable diving on my own.

View of Avalon from the cart

View of Avalon from top.

Since i wasn’t sure if i could equalize my Ears, I decided to head out and see what happens. The water wasn’t as cold as i am used to, it was about 64F on the surface. I descended down the buoy and wasn’t sure in what direction i was gonna go but i found myself at the Plague. I was surprised at the marine life, It was different than i have seen here before. Plenty of different fishes and I also saw a Bat Ray zoom by. The Kelp Bass were huge, they seemed to have grown in few months. I ended the dive after consuming 1000 psi of air and didn’t go more then 40 feet deep.

Once comfortable with the fact that i could equalize my ears, I got more confident. This time Bhanik and Amrish got ready to go in the water and I followed them 10 mins after they got in. Bhanik had a leak in his tank and Amrish without the hood was having hard time getting comfortable in water. The instructor had to get him out since he wasn’t completely comfortable. Bhanik did a dive to about 12 ft, I followed him for a while and then decided to head off on my own. My camera stopped working too and that was sad since i saw a lot of critters. I didn’t wander too far from the buoy and just decided to explore the reefs and the kelp. As mentioned earlier the Kelp bass were huge and there was a big lobster hiding in the reef. I was down to 600 psi and i decided to end my dive. Amrish, this time with a hood and Rajesh were getting ready to dive, I thought with little air left i could take a look at them but I had too much water in my BCD and hence i decided to call it a day. Amrish and Rajesh stayed in for a long time and i was getting little worried but it seems they dove to about 30 ft. It was already 2.45 pm by the time the dives ended and we had to take the 4 pm bus so we had to hurry up.

Amrish and Myself decided to go and pick up the stuff from the lockers while Bhanik and Rajesh went to get firewood etc. Initially we planned to have dinner directly but then after the dive everyone was hungry so we decided to get something on the go. I finished my burger in less than 2 mins, was i hungry or what. We had two firewood bundles and it was a 1.5 mile hike from the junction to the campground, it would be suicide carrying them so we decided to return one of them. So at Blackjack junction, I decided to carry that firewood bundle and the 1.5 mile hike to campground was gentle uphill climb. It was a killer, specially after all the diving we did. Bhanik decided to carry the firewood after a while and finally we made it to the campground at about 6pm. The sun was brutal all along the way and i got some burns on my hands. Returning that one bundle of firewood and that burger were the smartest decisions of the day.

View from Blackjack Campground Junction

View from Blackjack Campground Junction

We found out site fairly easily and there was already a tent erect out there, I thought it was the one we had rented. I immediately crashed and took a brief nap for more than an hour and was woken by the chatter of ranger. 

Campsite

Campsite

Gilligan, the ranger. He was cool and very helpful. He gave us the tent and also propane since we had rented a stove but he didn’t have it on him. He left and we started pitching the tent only to discover that it had one of the poles missing and hence we called the ranger. He was back very soon and handed us another tent, apologizing and stuff. The other tent he gave us, its poles were also messed up but then we managed to combine poles from two tents and have a tent pitched up. The ranger was about to leave and while backing up he slammed into the trash can and made a mess of it. He seemed to be amused by it and he had an extra trash can which he kept there.

It was about time to make dinner and get a fire going. We had chana masala for dinner and cheesecake for dessert. It was good even though i messed up making of the cake. It was a long day with two more long ones ahead and we all slept well.

 

5th July: Hike to Little Harbor

 

We had already planned to do 7 mile hike to Little Harbor. I decided to take it easy and not wake up early for the hike. So we all got up at like 9.30, had our breakfast which was coffee and bagel. We started the hike at about 10.30 and it was downhill for the first 3.2 miles till we reached the ranch. The cotton wood trail we took was going to take us all the way to the wrong beach but fortunately for us we met couple of people on the way who told us that we missed the diversion to the ranch. So after correcting ourselves and getting on the right path again we reached beautiful little harbor campground at about 2 pm. Since we didn’t book snorkel rentals in advance, there was nothing to do. No one was interested in Kayaking out there. 

First View of Little Harbor

First View of Little Harbor

Since the hike on the way back was going to be continuos uphill, we decided to take the bus back to Blackjack junction and do the 1.5 mile hike to campground. It was 4 pm bus so we just relaxed at the beach, played some cards and just walked around. We took the 4 pm bus and the hike to Blackjack was lot easier than the previous evening. All of us took showers that evening and it was indeed refreshing. 

Dinner was beans and rice though the pack had some fancy name for it and the dessert was strawberry crumble. I preferred the previous night’s dinner and dessert as well. Since we were planning to get up at 4 am  and leave as early as we could, everyone went to bed early.

 

6th July: The long hike to Two Harbors

 

It is 11.8 miles hike from Blackjack campground to Two harbors and we woke up early at 4.30 am to pack everything and leave as early as we could. Breakfast was again coffee along with Bagels and by the time we left the campsite it was 6 am. We had to pack up the tents and clean up everything so it took us a lot of time. The climate was amazing by the time we got at the Blackjack junction it was foggy and the visibility on the road was about 30 feet. It was really a pleasant walk despite the fact that i had about 25-30 pounds on my back, its not that much but still. As we got closer to the airport, yes there is airport on top of catalina island, we saw a heard of wild buffalos which seemed ready to attack us if we got any closer to their young. 

Heard of Wild Buffalo

Herd of Wild Buffalo

Dew Flower

Advantage of Hiking Early.

We took the airport trail loop, there is a sign which says private road no admittance but the trail goes on that road itself. On this trail there was a split which i was tempted to take but we were supposed be on this trail for 1.6 miles and it didn’t seem that we walked for that long. So we continued on this airport loop trail and met someone on the way who confirmed that we were on the right path. We hit another junction, where one of the signs said cross catalina trail and other was small one with EL 1.5 miles. Emerald Landing (EL) trail was the correct one to take and it would be another 1.5 miles before we hit next junction but how wrong we were….

After walking for about half hour we hit another junction and it was very tempting to take that supposedly short cut trail to the left, we met one more person who told us we would be fine on the left but he didn’t seem that sure. The right path would slowly but surely take us on the right path, how ironic :) but we decided to continue on the left steep trail. We continued on it for another half hour or so and hit a dead end. I could see a trail continuing in my head and went on, others weren’t so sure and they were correct, something which i realized after another half hour. Traversing this sloped hill, we hit a ridge line, i kept on going along that ridge with others complaining to me behind and being afraid that we won’t be able to turn back etc.

My sense of adventure/willingness to experiment/over confidence whatever you want to call it got better of me at that time and i kept on going until we saw ocean and guess what it wasn’t two harbors but it was little harbor. how fascinating, jaana tha japan pahuch gaye chin (wanted to go to japan but reached china), its an old hindi song. 

Steep Hill

It all went wrong at this point. Yes I had carried my Fins and Snorkel gear :)

It wasn’t a pleasant feeling at all and with almost an hour lost turning back didn’t seem an option. We contemplated going to little harbor and then taking shuttle to two harbors but we couldn’t speak to a representative and get confirmed tickets on the bus. Also it seemed that we were about 4-5 miles away from two harbors anyway, our boat left at 2.45 pm and it was about 9 – 9.30 so we had plenty of time as well. We decided to get off this hill and on the road which was visible to us at the bottom and take it from there. With no visible trail to get off this mountain i just took the route which was less steep and seemed easier until we reached a small trail. Even though this wasn’t going to take us exactly where we planned on going it would still lead us to the dirt road connecting little harbor and two harbor. 

Once at the bottom of this hill, we had to cross a muddy marshland where we had to trample some of the plants to avoid getting into the mud. Bhanik managed to get one of his feet into the mud and it was messy. He decided to ditch his socks (no we didn’t throw them there, they were dumped in LA) and wear a plastic bag instead of the sock. Once on the dirt road, I wanted to maintain my rhythm and didn’t take a break along with BAR. I told them to hitch a ride in the first vehicle they could find and make it to two harbors, it was going to be a 4 mile hike in the sun on this dirt road. I kept on going at my pace which wasn’t that much at all, about half an hour into this walk i saw Bhanik get a ride and he stopped to get my backpack. I decided not to hand my pack since i would need water etc on the way but got rid of my tent, event though it didn’t seem that much of difference to me i am sure it helped a lot. Rajesh and Amrish also caught up with me by that time but they again decided to take a break after sometime and i kept on going. It wasn’t exactly a pleasant walk in the park but the ocean views all along the final few miles made it worthwhile. I met up with Bhanik at Two harbors at about 12.15 pm, the ranger had refused to give ride to Amrish or Rajesh but they got ride from USC Wrigley dudes and we all were in Two Harbors by 12.30 pm.

Bhanik wanted to snorkel from the start itself and after the hike, Amrish and Rajesh didn’t want to. I rented a wet suit (i was carrying my fins, mask etc) and Bhanik complete snorkeling gear  and we jumped into the water to snorkel for about an hour. There wasn’t much to see on the beach but then when we went to one side which had some kelp, we saw garibaldis, few more fishes. Also spotted a tiny Spanish Shawl (nudibranch) and a sea slug. It was surprising that i managed to free dive with a 3 mm wet suit and no weights. 

The 2.15 pm boat took a long while to unload and departed late and hence our boat also got delayed. We reached San Pedro and after a short drive, we reached Amrish’s place at about 5.15 pm. That was it, our really long long weekend had ended. It was a very nice one too. 

 

More Pictures

Bhaniks’s Album

Rajesh’s Album

Rest haven’t uploaded their pics, My camera was in water proof case but it stopped working.

www.visitcatalinaisland.com For all information regarding Catalina, ofcourse you can always contact me as well.

4 responses so far

Jul 03 2008

Advantage of using Static classes for constants

Published by under Flash

Static classes for defining constants, wait what?????. You might have come across classes like StageDisplayState in flash.display package and it doesn’t contain any useful methods except for constants which are used for setting the state of stage. This is not exactly a static class but if you remove all the methods it would be one. 

Why do we need this class when we can set the stage property like this in AS 2,

Stage[“displayState”] = “fullScreen”;

where as in AS 3/Flex its wise to use something like,

Application.application.stage.displayState = StageDisplayState.FULL_SCREEN;

It might seem unnecessary to create an extra class to define variables but its helpful. 

  • A programmer might decide to change the string instead of fullScreen it will be now FullScreen, dumb but it can happen. If it does happen then there won’t be any errors at compile time but you might get run time errors.
  • By same argument as above, if we decide to change StageDisplayState.FULL_SCREEN to StageDisplayState.FULLSCREEN we will get a compile time error and we can fix it.
So its mainly to fix problems during compile time rather than run time the above method is useful. Hope it makes sense. I should probably come up with a more concrete example i suppose.

No responses yet

Jul 01 2008

Flash SEO optimization

Published by under Flash

Finally Google and Yahoo we spiders are able to index swf file. It is a great news, here is the link to the entire article, Google Blog. They don’t specify how exactly one would increase chances of been found since its proprietary but i would love to explore that.

 

I can imagine there would be a new breed of SEO optimizers specifically for Flash, let keep our eye out. I might jump on the bandwagon as well if i figure out something 😀

No responses yet

Jun 27 2008

Functionality and Features v/s Performance and Cost

Published by under General

This is a major issue in developing applications, what functionality and features do we require and they come at what expense. I usually like to things simple for the user and that generally means better performance and less cost. Ofcourse there are certain features those need to be implemented irrespective of the cost, performance has to be optimized for them. 

 

Here is an example of when i personally think that a feature is irrelevant, I had to implement a shopping cart in Flex and as soon as a product is added to the shopping cart its saved on the server as well. The idea behind this is that if the user doesn’t buy the product and returns to the site again he still has the product saved in the cart.

It just doesn’t make sense to me, making a server call every time product is added will increase the load tremendously, yes we need to make a server call when the product is removed as well. If the client logs in after a week or so and the product is no longer available, we need to handle it differently, is it worth the effort????? i would say NO. The end user i think doesn’t care if their cart information is saved, if i add something to cart then i will buy it right away. 

It might seem just a server call but on the server there is a call to the database, insertion, deletion etc, all those operations take up precious server time and resources. It doesn’t matter if its a call to webservice or a remote method the basic idea is the same. If the number of users increases then the load on the server will increase like crazy, every tiny bit of operation has to be optimized.

 

I would use a shared object to store the cart information as a compromise but then I am just getting paid to write the code, its not my problem to maintain the servers etc. I have presented my case to them and its their choice. 

 

Another scenario was when we wanted to save users favorites data on the server and were faced with the same problem. It just wouldn’t make sense to update that information every time user will add an item or delete something from favorites, it would literally kill the server. So we decided to store that information in memory on the client side and then send it out every 2 minutes, a reasonable compromise i would say.

 

So next time if you decide to add a feature it would be wise to consider the server performance, most of the times people can get away with it because the number of users are not that much and the server is heavy duty server with lots of RAM and CPU power. Only when the number of users increase exponentially and then people start to realize the importance of taking all these points into consideration. 

One response so far

Jun 22 2008

Cairngorm and Web Services

Published by under Flex

I had to use Cairngorm where the data was coming from web services and i had little trouble initially setting up services in my command class. But after a few tries and misses i was able to get web services to work. This is how i have implemented it.

Service class just defines a webservice as follows,

 

Pretty straightforward and the services are global so any changes in the server can be easily changed. Now the execute method of the command class which calls this service looks like this.

 

public function execute(event:CairngormEvent):void {
    var service:WebService;
    var operation:Operation;
    var token:AsyncToken;
    var requestObj:Object;
    var email:String = event.data.email;
    var password:String = event.data.password;

    service = ServiceLocator.getInstance().getWebService("signUpService");
//load the wsdl file
    service.loadWSDL();

//we assign the operation to the function that needs to be called inside the wsdl
    operation = service.getOperation("GetItemsFromStore") as Operation;
//the result format we need is e4x
    operation.resultFormat = "e4x";
//this object will pass all the required parameters for this function
    requestObj = new Object();
    requestObj.email = email;
    requestObj.password = password;
    operation.request = requestObj;
    token = operation.send() as AsyncToken;
//this is the line where the responder object is passed to the Asynctoken
    token.addResponder(event.data.responderObj);

}

Disclaimer: The above code is a copy paste and then modified so please forgive the coding style.

Now the fault or the result method of our responderObj will be called accordingly.

One response so far

Jun 20 2008

Connecting Cairngorm View with the Command Class.

Published by under AS 3.0,Flex

I have been playing with Cairngorm quite a bit and usually when i dispatch cairngorm event, i rely on flex data binding with the model class to manage the view. This is applicable in most of the cases but then sometimes its not required to bind some data in your view with the model. 

I came up with this solution to convert my view to a responder and then once data is fetched, I can update my view as required. Its really an easy solution, your view container has to implement mx.rpc.IResponder Interface and then in the cairngorm event you just pass its reference. It looks as follows,

<mx:Canvas xmlns:mx=”http://www.adobe.com/2006/mxml” width=”343” height=”389” show=”initModule()” implements=”mx.rpc.IResponder>

there are only two methods in this interface, result and fault, this is how my script block looks inside this Canvas.

import com.adobe.cairngorm.control.CairngormEventDispatcher;
import com.sampleapp.events.GetStoreItemsEvent;
import com.sampleapp.model.SampleAppModel;
import mx.controls.Alert;

private var model:SampleAppModel;

public function fault(data:Object):void{
}

private function initModule():void{
    if (!SampleAppModel.getInstance().albumDataList){
        model = SampleAppModel.getInstance();
        var event:GetStoreItemsEvent = new GetStoreItemsEvent(GetStoreItemsEvent.GET_STOREITEM);
        event.data = new Object();
        event.data.responderObj = this;
        CairngormEventDispatcher.getInstance().dispatchEvent(event);
    }

}

public function result(data:Object):void{
    var resultXML:XMLList = data.result[0].children().children();
    var finalXML:XML = new XML(resultXML[0].toString());
    model.albumDataList = finalXML.children();
}

and this is how the execute block inside my command class looks like,

public function execute(event:CairngormEvent):void {
    var service:WebService;
    var operation:Operation;
    var token:AsyncToken;
    var requestObj:Object;
    itemType = event.data.itemType;

    service = ServiceLocator.getInstance().getWebService("storeService");

    service.loadWSDL();

    operation = service.getOperation("GetItemsFromStore") as Operation;
    operation.resultFormat = "e4x";
    requestObj = new Object();
    requestObj.itemType = itemType;
    operation.request = requestObj;
    token = operation.send() as AsyncToken;
    //this is the line where the responder object is passed to the Asynctoken
    token.addResponder(event.data.responderObj);

}

so using the above method, We make sure that the result function inside the canvas will be called when the data is received. Now you can do whatever you need to inside this function.

Questions, Comments, Suggestions always welcome.

One response so far

Jun 17 2008

Hike to Mt Islip

Published by under Hiking

I decided to join Travis and James for a hike to Mt Islip and it was a very pleasant hike, here is my trip report.

Woke up at about 4.30 am, it didn’t bother me that previous night i had went to bed at like 2 am. Got ready, had breakfast and then headed out to Travis’s place. On my way i had to get some trail mix and was there at about 5.50. We immediately headed out in James’s car and reached the trailhead at about 6.50 am. It was an ideal time to start the hike.

We started at about 7 and i really found going tough. My legs weren’t ready at all after not hiking for about 6 months or so but i managed to hang in there and we walked at a steady pace with Travis leading the pack. He was way ahead of myself and James.

We took a short break near Little Jimmy campground at about 8.15 or so and then continued our hike to the summit. The day was clear and we had good views of the area. As the hike went on, I was starting to feel lot better and going on at a decent pace. We reached the summit at about 8.45 am and it was beautiful day. The sky was clear and the views were excellent.

Travis decided to make tea on summit and since we had plenty of time we really took it easy. He really enjoyed chivda, James liked it too. So after chilling on the summit for almost an hour we started heading out. We reached the trailhead in an hour or so and were back at Travis’s place at noon. It was a pleasant hike and we were all glad that we finished it before the heat kicked in.

Below are some of the pictures from the hike, coming soon……

No responses yet

« Prev - Next »