May 1. still working :(

•2009/05/01 • 2 Comments

i just did the master page this morning and it spent me about 2 days doing this kinda graphic design..im not good at anyway.. Thx one of my friends’ helping me design IWorld logo. Its much easier for me 2 handle other menu stuff.
I am using advanced CSS Menu design there. by adding styles and modify (PS pictures).
what i have done till now::

i am creating a new website project -> iworld
creating iworld.master page.(done some style and graphic work )
Change the Facebook callback setting from webTesting to iworld now…(it seems will take while to make it works..)
menu

ajax tool controls notes

•2009/05/01 • Leave a Comment

im linking some websites here may help me found out information much easier…

Set up your environment

new problem of Video comments object (Wireshark)

•2009/04/30 • Leave a Comment

This is the problem i have posted in to asp.net forms and also send some copy forward to some api team members

Abstract:
HOWTO get the video comments for a specific video clip…
The request.getcomment(Video) doesnt work

Content:
i met a problem with Youtube video comments.

YouTubeQuery YTquery_MP = new YouTubeQuery();
YTquery_MP.Uri = new Uri(“http://gdata.youtube.com/feeds/api/standardfeeds/most_popular?time=today”);
YTquery_MP.NumberToRetrieve = 20;
YTquery_MP.StartIndex = 1;
i am using Feed v= request.Get(YTquery_MP);

After this, i obtained the video entry which contained 20 videos.
and i saved the vid and title into dataset in the foreach loop, in order to do the paging work.

And i got another page called: display.aspx. ( once user click a video clip picture in first page, hyperlink will redriect to display.aspx page within this url “~/display.aspx?vid=xxx”)

My problem is.. i can display(or embed the video in display page) but im not sure how to get the comments.

i go through the .Net guide, it shows Feed commentlist= request.Getcomments(Video v) could be design to do this job, however, here, i just send the videoid to the display page..
i tried to create a new Video instance called Video v= new Video();
and add the id for it…. v.id=xxx; v. videoid= xxx; to it, and then using the
Feed commentlist= request.Getcomments(Video v) , but the result always turns to null.

and i found Feed commentlist= request.Get() got three overloaded method…
(Feedquery f), ( url ) and ( Feedcomments feed, requestType operation)..
i am not sure how to handle the comments stuff..
cause i can only send this videoid, and vidoeTitle to the display page within url..
Any good way to get the comments information in this case?

some codes like this may help get the basic idea:

if (Request.QueryString["vid"] != null)
{

YouTubeRequestSettings youtubesetting = new YouTubeRequestSettings();
YouTubeRequest requset = new YouTubeRequest(youtubesetting);

string vid = Request.QueryString["vid"];
Video v = new Video();
v.Id = vid;
v.VideoId = vid;
Feed commentlist = requset.GetComments(v); //it doesnt work..

}

The things in vid is like :”l8pSPfZFysg”

Here is the API supporter’s generous reply :
To get the comments, i use the LINK inside the Video entry. so a reqquest.GetComments looks at the comments subelement, and the href attribute in there. With just the videoID, you are lost. There is nothing you can do with that, as far as i know. You might ask in the youtube newsgroup if there is a “shortcut” that computes the link you need to use.

So you either store the above LINK and send that one. Then you can use the query object to take that link and get a feed of comments. Or you need to hold on to the video object etc.. or get the video object based on the videoId (by constructing a query object etc…)

i spent the whole night to figure out the problem, since the request.Get(uri) existed, so, could be some url to handle retrieve the specific video clip’s comments. i wish…
I turn on the Wireshark, wanna find the http request for the feed response. i captured the package and read through the http header:
and found out the url for doing this feed query.
wrieshark1

The the URL after GET / is what we looking for..

The solution i did also for replying the expert’s help:
i did it by using Wireshark Analysis the post http request:
and found it could be easy solve by using Feed c=request.Get(new Uri(“http://gdata.youtube.com/feeds/api/videos/”+vid+”/comments?client=yourclientINFO,HTTP/1.1″));
and its great easy and u only need to know vid there..

Now, i can get a single video page only for displaying video and show out the related comments. :D ..
display

Really haaappy to sort out the problem after almost 5 hr+ looking up. :D

Youtube Paging Testing

•2009/04/29 • Leave a Comment

Hi,i have been doing the paging stuff all days. it really sucks, and i have been reading reading, googling all kinds of information wanna figure out the problem.
But the problem here, most of the online resources are suggest using Gridview, Gridlist for easily paging information. but the stuff im doing,kinda hard to use Gridview to output data. The Lable out stream method could be much easier to embed the youtube videos.

i have tried more than ten ways to handle paging, some of them creating a new class to do the paging work, and u did send the (index, NumberToRetrieve, pagesize) to the class. and get the paging page after this processes.

some of them using url and response.querystring["page"] to get the current page and display into different results.
The thing i am trying to do is a simple paging system.
since i can retrieve up to 20 video clips from the youtube webserive, and i wanna display 5 video clips in one page and using 1…2…3…4 this hyperlink to redirect pages to get the different video clips information in different pages.


i am doing the Testing paging now..
Three major important elements using here in current case are:
[Hyperlink = NavigateURL="http://localhostxxx/yourapplicationname/?page=1"] (2,3,4);
[Dataset ds... and create dataColumn, in Foreach statement adding DataRow dr= dt.NewRow;
dr["V_Title"] = v.Title; dt.Rows.Add(dr); ]
[using Session["Video"] object to transfer the dataset information from one event_class to pageLoad class and display the results.]

And saving data into dataset,save lots of user waiting time on loading from the webservice, the react speed is quite fast compared with after clicking “1″ hyperlink.. sending url query and waiting for webservice responses.

two sample screen shoots about the paging test here;
pagingtesting1

pagingtesting11

Google News Integrated

•2009/04/28 • Leave a Comment

Hi,i have done the Google news parts integrated for Iworld application here. Basically, it uses the knowledge within the RSS feed and xml Reader in asp.net infrastracture.
The process is quite simple, post a url using httprequest and and response, using htmlgetresponse to get the rss feed response and start a xml IO stream reader to read through the xml feed response. Save it in to HardDisk, in order to get the better react performance.

System.Net.HttpWebRequest webRequest1 = (HttpWebRequest)System.Net.WebRequest.Create(“http://news.google.com/news?ned=nz&hl=en&topic=h&output=rss”);
webRequest1.Accept = “text/xml”;
webRequest1.UserAgent = “Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.4) Gecko/20070515 Firefox/2.0.0.4″;
webRequest1.AllowAutoRedirect = true;
System.Net.HttpWebResponse webresponse1 = (HttpWebResponse)webRequest1.GetResponse();
System.IO.Stream s1 = webresponse1.GetResponseStream();
StreamReader r1 = new StreamReader(s1);
string xml1 = r1.ReadToEnd();
XmlDocument doc = new XmlDocument();
doc.LoadXml(xml1);
doc.Save(“D:\\MyDocument\\Visual Studio 2008\\WebSites\\FacebookTesting\\GoogleNews_TopStroiesNZ.xml”);

Then, using RSS FEED phrase to read the things we need to formate the output stream to get the result we really want.

In my case, i still using the Ajax Tabcontrols to display each News categories. well, i think it could a good way, since im not really familiar with css and javascription. However, i found some tricky stuff involved in Ajax Tab controls and i jumped lots of my time ( almost one day to fix the problem, the Forms are really help, as well as Google Serach).

In the content phrase parts, there is lots of way for doing Phrase work. The most easiest way which i found from lots of precious resources. it shows Most of Rss feed are(were) written in the basically ATMO formate– using “http://purl.org/rss/1.0/” namespace:
and the atom RSS feeds basically contain

These elements.

XmlNamespaceManager manager =
new XmlNamespaceManager(xmldoc.NameTable);
//add the Rss namespace to the manager

manager.AddNamespace(“rss”, “http://purl.org/rss/1.0/”);
//Get the title node out of the Rss document

XmlNode titleNode = xmldoc.SelectSingleNode(“rss/channel/title”, manager);
XmlNodeList articalNodes = xmldoc.SelectNodes(“/rss/channel/item”, manager);

Then using Foreach to read through the articalNodes to get the interested information which contained in this nodes..

The one good things about google news Rss feed, is they were using XSLT formate to output the RSS feed. instead of using pure XML file to contain Basic info, using XSLT will give a basic layout of doing these things.
The Atom feeds may contain the related news resources, the time of publish and some video objects from yotube or some other streaming videos websites.
googlenews_1

facebook functions – album adding

•2009/04/24 • Leave a Comment

i am doing lots of stuff for my Iworld application, since i wanna finish the application development phase ASAP,i can get start with my project report work earier..

someone says the facebook application is quite simple, people cant the picture and album information there, and i decided to go back the facebook platform to add some album information there.

the thing is harder than i excepted, cause, The facebook stuff is quite unlike the google one. and basically u need programming the code to pharse the xml which u query from the facebook webserive to a ASP.net C# class.

and The Ajax Tab controls aslo met some tricky problem when i am trying to add new tab and fill the album functions there.

the code im using for adding album function is like this:

IList<facebook.Schema.album> useralbum = fbService.photos.getAlbums();

foreach (facebook.Schema.album a in useralbum)

{

lableuseralbums.Text += “<tr><td>Album Name: ” + a.name + ” </td> <br>”;

lableuseralbums.Text += “<td>Album Description: ” + a.description + ” </td><br>”;

lableuseralbums.Text += “<td>Cover Picture :” + a.cover_pid + “<br> Created Date :”+a.created_date.Date+”<br> Modified Date: “+a.modified_date.Date+”</td></tr>”;

list_coverpid.Add(a.cover_pid);

}

this part is easy, but the problem coming with the facebook toolkits for get the album is that.. the received xml file only contained the cover_pid(21312u9312048) instead of the covered pic src url.. So it just add more difficulty for my work,  i need post a FQL query to facebook database again with the current pid i got and retrieve the coverd_pic src from photo table in Database. The result is aslo a xml file, u probably need pharse it again to get the only little bit cover_pic src url  :(

and another problem, i am trying to use labeloutput stream to display the result, but however, i cant do this kinda combination cause i need twice foreach to get all the data i neeed… firstly, got the album number, aid, cover_pid.. posing back pid to get the src …using foreach to display..

this doesnt work, after i paid about 2 hr to try to figure out a good solution. [or it can really works, but it will sacrify the data transfer performance and it gonna be a nightmare for my users, i think. ] – cause it will use three foreach to handle the problem, the u need communicate to facebook twice to get everything u needd there… Hoolly shXX;

users-albums1

So, i decided to go Dataset to saving these data first. and using GridView to pop up the result.

So, i add a DateSet, create a DataTable and add the Datacolum for the different fileds..

DataSet ds = new DataSet();

DataTable dt = ds.Tables.Add(“Album”);

DataColumn pk_name = dt.Columns.Add(“Album Name”, typeof(string));

dt.Columns.Add(“Desciption”, typeof(string));

dt.Columns.Add(“Created_Date”, typeof(DateTime));

dt.Columns.Add(“Cover_Pic”, typeof(string));

dt.Columns.Add(“Links”, typeof(string));

dt.Columns.Add(“Location”, typeof(string));

List<long> list_coverpid = new List<long>();

foreach (facebook.Schema.album a in useralbum)

{

DataRow dr = dt.NewRow();

dr["Album Name"] = a.name;

dr["Desciption"] = a.description;

dr["Created_Date"] = a.created_date;

dr["Links"] = a.link;

dr["Location"] = a.location;

dt.Rows.Add(dr);

list_coverpid.Add(a.cover_pid);

}

foreach (photo p in photos_coverpic)

{

al.Add(p.src_small);

}

for (int i = 0; i < photos_coverpic.Count; i++)

{

dt.Rows[i]["Cover_Pic"] = al[i].ToString();

}

GridView1.DataSource = ds.Tables[0].DefaultView;

GridView1.DataBind();

And u need go back the aspx page to edit the the colum and bind filed.

after done the hyper link and bound field adding,  once the user click the picture album name it will redirect to the current album address and shown pictures there..i aslo can do another page to shown the different pictures in one album. however, consider of the time stuff. probably need save some time to focus on some main stream functions.

the current album i have done shown below:

users-albums_advanced


i dont like to write too much stuff after i have done something….thats wrong i havent do blog for a while. but to keep it in my memory, i still need write down some critical thinks and problem solving process, otherwise, i will forget every quickly..
i have done the user’s uploaded videos retrieve and the youtube browser upload video from my site.. ill write more if i got time..Cheers..Everybody.. have good days..

Things Recent carring on.

•2009/04/21 • Leave a Comment

Sorry everyone, havent been updating blog for long. Since i am been doing some kinda Graphic design for the log stuff, hahh.However, im not good at PS or some modification logo, the results is pretty sucks, i wont wannna show here somehow.

i am trying sort of the basic layout the functional page about my page, and aslo got lots of optional choice can be applied on my detail design.

Now,im trying grab the Google News inforamtion and chunck it up to my application, the paping stuff still a pain here, and uploading vedios still will meet some problems, (request failed, or token expried).

The News Feeds (Rss Feed in google is well-formed -however,its too much in detailed, (a normal feed there is in XHTML format  which is mean, it has font and size layout somehow when u outputing this data in to html page.) some of the news feeds even contain the <object> Youtube, vedio  </object> , anyway, i still need to figure out the news categories i wanna to put on to the web application.

Facebook_ Message Sending from iworld

•2009/04/18 • Leave a Comment

it seems i still left some pars of facebook application design, yeah.

i havent done the popup window and show up the sending object and subject & message it.

it has been left 4 ages and the reason why it still exist, maybe becasue i dont know how to use javascript and client contron those stuff. (i dont really know either by now).

i find out some solution how to figure out popup windows and redirect to some specified uri stuff… it turns out lots of ways u can do it.. u can create a javascript function, in html head ,and recall it the ur main codes.. u can aslo using lable output displaying method to add the inline <script></script> code to pages. or u can user my way  Using    this.ClientScript.RegisterStartupScript(GetType(), “open”, JavaScript); method to point the client Javascript..

another thing, u need to know how to use the sending message api( in fact, theres no api for this one), just sending the url+ the suject and message want to send to the specified uid..

forinstance, my uid is 12312424124( ofcourse fake one)

the url contain message should be : http://www.facebook.com/message?uid= 12312424124&subject=Hi&msg=hello, alex.i miss u so much

it seems easy, cause in my application, it seems i dont know the uid in dropdown list, i only know user name this time.

and Rayn’s way- dictionary is pretty handy anyway.

i created a new dictionary<string, user>. and adding into a new Session object.

and it url reference the Session["xxx"] get the uid which belonged to the specified username…

the coding is preety much straightfoward.

string JavaScript = “”;

JavaScript += “<script>”;

JavaScript += “window.open”;

JavaScript += “(‘http://www.facebook.com/message.php?id=” + (Session["usernameTouid"] as Dictionary<string, user>)[lblsendingobject.Text.ToString()].uid + ” &subject=” + txtSubject.Text.ToString() + “&msg=” + txtMessage.Text.ToString() + “‘,’mywindow’,'location=1,status=1,scrollbars=1,width=300,height=400′)”;

JavaScript += “</script>”;

this.ClientScript.RegisterStartupScript(GetType(), “open”, JavaScript);

what u need, is if u r authorized user.. select the user u wanna send message and type in subject and message…

click sending.. it will auto popup a window which contain all ur message in pervious page… Simply click send.. all ur work has been done here..

Step one:

facebook_sendingmessage

step two:

facebook_sendingmessage1all down here.. i think…Clicking send….ahhhh


Solving the problem of AuthSub with Google Support help

•2009/04/16 • Leave a Comment

This is the reply from Google Youtbe API donet Support Team (Frank )about my current problem with Youtube AuthSub problem::



You are not using an authenticated service. The service object is the one identifying if the request itself is going to be authenticated or not. After you create the service you need to set the authentication token on the service.


Yeah, i should add the authtoken in to my service.
After typing code, adding code like :

GAuthSubRequestFactory authFactory = new GAuthSubRequestFactory(“youtube”, “Iworld”);
authFactory.Token = (String)Session["token"];
YouTubeService service = new YouTubeService(authFactory.ApplicationName);
service.RequestFactory = authFactory;

After that, i can use the query.Uri (“http://gdata.youtube.com/feeds/api/users/default/subscriptions”) to retrieve the authenticated user information..

Everything now works fine, get better move forward a little bit..
Thanks Google API support team’s help.

Now the process is quite straight forward:

go through the HyperLink-> send request to youtube service

using the uri in below:

http://www.youtube.com/auth_sub_request?scope=http://gdata.youtube.com&session=1&next=http://localhost:2211/YTtest/Login.aspx&secure=0

after that…google service provide the Google service interface to let the user promote or deny the thrid party access. then response the url contained a authtoken. -> in your code, need add the authen to youtube service using “AuthFactory” -> then request page with in authtoken head, then get the response which you need..

the result truns out to be like that:

youtube_subscription1

problem with youtube authsub authorize mechanism

•2009/04/15 • Leave a Comment

problems:

i got some problem came accross with the Youtube Authentication method.. as i was talked, im using AuthSub mechnism to handle the user authorize process.

Uri targetUri = new Uri(Request.Url, “YoutubePage.aspx”);

GotoAuthSubLink.Visible = false;

if (Session ["token"] != null)

{

Response.Redirect(targetUri.ToString());

}

else if (Request.QueryString["token"] != null)

{

string token = Request.QueryString["token"];

Session["token"] = AuthSubUtil.exchangeForSessionToken(token, null);

Response.Redirect(targetUri.ToString(), true);

}

else // no auth, prink link

{

GotoAuthSubLink.Text = “Login to your Google Account”;

GotoAuthSubLink.Visible = true;

GotoAuthSubLink.NavigateUrl = AuthSubUtil.getRequestUrl(Request.Url.ToString(),

“http://gdata.youtube.com”, false, true);

}

This code is very straightforward..

check the Session["token"] is null or not…. if its not null ->redirect to the target uri

if the result is null, okay. using AuthSubUtil.getRequestUrl(Request.Url.ToString(),”http://gdata.youtube.com”, false, true); to requrie a authtoken in Youtube page by typing the username and password..then it will redirect to localhost, our applicaiton… it seems we got a token from now on::

the screenshot about the process is like this ->>authorise-youtube-access

However, i am trying to select the user subscribed vedio using casting url– http://gdata.youtube.com/feeds/api/users/username/subscriptions”

The .Net Api guide said, if its authorized, by done the Authsub process. i should be okay to use default to replace username here..

The problem is when i use the code:

YouTubeRequestSettings youtubesetting = new YouTubeRequestSettings(“Iworld”, “ytapi-LiZige-Iworld-2frljgmn-0″, “AI39si4FxRiMjBnxNRVToJn3zdmhKuJyJvr3F9d_ihfF9pEBR9XyBB73kHCJvxEwhytiorMXv9M3LtbajPTyATloOZ0nMjXtqg”);

YouTubeRequest requset = new YouTubeRequest(youtubesetting);

string feedUrl = “http://gdata.youtube.com/feeds/api/users/kimialex92/subscriptions”;

YouTubeQuery query = new YouTubeQuery(feedUrl);

YouTubeService service = new YouTubeService(“Iworld”, “clientID”, “developer key”);

SubscriptionFeed subFeed = service.GetSubscriptions(query);

it aways show the problem.

Error:

Execution of request failed: http://gdata.youtube.com/feeds/api/users/default

this is very tricky… i am still going through the resources to find the solutions..