jump to navigation

Poem: The Red Sea November 19, 2009

Posted by yoavniran in Poetry.
Tags: , , , , , ,
add a comment

Red Sea Sunset

This one I finished last Sunday, November 15th, 2009 while visiting the beautiful San Francisco.

Thoughts about this poem though came while visiting Eilat(Israel’s Southernmost city) which sits on the Red Sea(Yam Suf).

Hope you enjoy it.

The standard disclaimers apply, the poem was originally written in Hebrew therefore the translation may lose or change some of the meanings, rhyming, wordplay, etc.


~ The Red Sea ~

Silence,
The world shrinks to a blue ribbon
I lean on the water line
Listening to the sea telling his story
It’s a familiar one, he tells:
Of love long forgotten
Of Innocence stolen
Of a war that never ended
But he also whispers of Hope.
Eyes skywards, I float
I can feel the world’s curvature
Can feel the life it stores
Feel all the words it holds
And yet he tells:
Of bitter disappointment
Of long-lasting sorrow
Of the broken human spirit
Yet he also sings of Hope.
The wild sun sears my skin
Her staring eye she never shuts
So I close my eyes
Let myself sink slowly
As I listen to the sea telling his story.

The original Hebrew version:

~ הים האדום ~

שקט,
העולם מצטמצם לפס כחול
אני מתפרש על קו המים
ומאזין לים המספר את סיפורו
זהו סיפור מוכר, הוא מספר:
על אהבה שנשכחה
על תמימות שנגנבה
על מלחמה שלעולם לא נגמרה
אך לוחש גם על תקווה.
עיניים מופנות למעלה, אני צף
מרגיש את קימורו של העולם
מרגיש את החיים שבתוכו הוא עוצר
מרגיש את כל המילים שהוא לא אומר
ובכל זאת מספר:
על אכזבה כאובה
על עצבות ארוכה
על רוח האדם שנשברה
אך שר הוא גם על תקווה.
השמש הפראית את עורי צורבת
את עינה החודרת לא עוצמת
אז את עיניי אני סוגר
ולאט שוקע אל קירבו
ומקשיב לים כשהוא מספר סיפורו.

Poem: Memories from the Green Mill October 27, 2009

Posted by yoavniran in Poetry.
Tags: , , , , , , ,
add a comment

Green Mill Jazz

This one i wrote in June of 2005. Strangely enough, I haven’t marked down the exact date of its writing even though I’ve started doing that long before.

I was reminded of this poem just the other day from speaking to a friend about being in Chicago and visiting its Jazz clubs.

I have to say that I have very fond memories of Chicago, it was a wonderful time and I found a really great city to experience and enjoy as well as meeting very interesting people while being there.

Update: This poem was also published at StormSage Central.

So here it is:

The standard disclaimers apply, the poem was originally written in Hebrew therefore the translation may lose or change some of the meanings, rhyming, wordplay, etc.

~ Memories from the Green Mill ~

“We are all born crazy,
Its just that some of us stay that way”.
Says the writing on the mens bathroom wall.
I return to my seat
The band is still playing the same song
A happy tune that reminds me of you
Everything reminds me of you.
I’ve already lost control of my mind
My thoughts control me without mercy
The memories hold me like a stringed puppet
I try to fight them
But I never had a chance.
I am drawn to pictures of the past
The melody is left behind
Its you that I see over and over again
I see the reflection of myself
Staring at me from the memory of your eyes.
A feeling of pain brings me back
The candle’s wax drips on my hand
But I do not stop it, I use it,
If only for a moment it distracts me
I savor the realness of the pain.
The guitar plays on my heart’s strings
The bass shakes a tear from my eye
It falls into my empty glass
My voice shakes as I call for another drink.
The players are already playing a new song
And I am left only to surrender
So I lean back in my seat,
I let the pure music run through my body,
The alcohol numb my senses
As the memories sweep the whole of me.

The original Hebrew version:

~ זיכרונות מהטחנה הירוקה ~

“כולנו נולדנו משוגעים,
רק חלקנו נשארנו כך”.
אומרת ההודעה שעל קיר שרותי הגברים.
אני חוזר למקומי
הלהקה עדיין מנגנת את אותו השיר
שיר שמח שמזכיר לי אותך
הכול מזכיר לי אותך.
איבדתי כבר שליטה על מוחי
המחשבות שולטות בי בלי רחמים
הזיכרונות מחזיקים בי כבובה על חוטים
אני מנסה להלחם בהם
אך לא היה לי סיכוי מעולם.
אני נשאב אל תמונות העבר
המנגינה נשארת ברקע
רואה אותך שוב ושוב
מסתכל על השתקפות עצמי
שמביטה בי מתוך זיכרון עיניך.
כאב מחזירני אל ההווה
שעוות הנר מטפטפת על ידי
אך אינני מפסיקה, משמשת אותי,
אם רק לרגע מסיחה היא דעתי
מתענג לזמן קצר על הכאב המוחשי.
הגיטרה פורטת על תווי נשמתי
הבאס מרעיד את הדמעה מעיני
נופלת היא לתוך כוסי הריקה,
קולי רועד כשאני קורא לעוד משקה.
הנגנים כבר עוברים לשיר הבא
ולי לא נותר אלא להיכנע
אז אני נשען אחורה בכיסאי,
נותן למוזיקה הטהורה לעבור דרכי,
לאלכוהול להקהות חושיי
ולזיכרונות שוב לסחוף את כול כולי.

A Few Useful Tridion Extension Methods October 26, 2009

Posted by yoavniran in Programming, Tridion.
Tags: , , , , , , ,
4 comments

Following my recent blog about extension methods. Here are a few useful extension methods I’ve created recently for working with Tridion’s TOM API.

.NET Interops – COM API (5.2 and onwards)

Here are a few useful methods to use with the older TOM API (interops), these can come in handy when writing custom tools, event system code, etc.

Publish

The publish method for both Page and Component objects require quite a few parameters which in many cases are always set the same within a single application scope. If you want to use defaults for these values you can use these extension methods to predetermine the values of the parameters leaving a shorter and more convenient way for sending the items to be published:

For Components:

/// <summary>
/// Offers a simple call to publish a components using defaults for all of the publish parameters
/// </summary>
/// <param name="targets">one or more pucliation targets or target types to publish to</param>
public static void Publish(this Component component, object targets, EnumPublishPriority priority)
{
component.Publish(targets, false, false, false, DateTime.Now, DateTime.MinValue, DateTime.Now, true, priority, true, 100);
}

For Pages:

/// <summary>
/// Offers a simple call to publish a components using defaults for all of the publish parameters
/// </summary>
/// <param name="targets">one or more pucliation targets or target types to publish to</param>
public static void Publish(this Page page, object targets, EnumPublishPriority priority)
{
page.Publish(targets, false, false, false, DateTime.Now, DateTime.MinValue, DateTime.Now, true, priority, true, 100);
}

UnPublish

Very similarly to the publish method, here’s an example for creating a shorter way to call un-publish on a page object:

public static void UnPublish(this Page page, object targets, EnumPublishPriority priority)
{
page.UnPublish(targets, true, false, false, DateTime.Now, false, priority);
}

IsPublished

Tridion provides a method to check whether a page is published to a specific Target Type or Publication Target but what if you just want to check whether the page is published or not?
You need to check each target.
Here’s a way to add a method to the page type that will check whether a page is published by providing a list of targets to the method call:

/// <summary>
/// Assert whether a page is published or not
/// </summary>
/// <param name="page">The page in question</param>
/// <param name="targets">A list of target types or publication targets to check</param>
/// <returns>True if the page is published to at least one of the provided targets</returns>
public static bool IsPublished(this Page page, IEnumerable<string> targets)
{
foreach (var t in targets)
{
if (page.IsPublishedTo(t)) return true;
}

return false;
}

Release

Its very important to make sure you correctly dispose of the Tridion COM objects exposed by the interops.

Here’s an example of how to easily do that for components and pages without having to add: “using System.Runtime.InteropServices;” to every code file:

For Component:

/// <summary>
/// Releases the COM Component object
/// </summary>
public static void Release(this Component component)
{
Marshal.ReleaseComObject(component);
}


For Page:

/// <summary>
/// Releases the COM Page object
/// </summary>
public static void Release(this Page page)
{
Marshal.ReleaseComObject(page);
}

TOM.NET (5.3 and onwards)

Fields

One of the things I was quite astonished to find when i first started working with the TOM.NET API was that the Component object no longer exposed a fields collection as a property. Instead to get an instance of those fields you are required to write code which is not very intuitive and definitely shouldnt be required for such a basic property.
I’ve since filed a formal request to our R&D department to change this but there’s no guarantee that this is going to change anytime soon.

If you are using Tridion 2009 and .NET 3.5 or brave enough to write your .NET templates on 5.3 or 5.3 SP1 with .NET 3.5 you might be interested in using the following extension method:

/// <summary>
///  Returns an ItemFields collection for the Component
/// </summary>
public static ItemFields Fields(this Component component)
{
return new ItemFields(component.Content, component.Schema);
}

With this method in place to get the fields collection of a component you only need the following: comp.Fields()…

Root StructureGroup

Another oddity in the relatively new API is that the publication object doesnt expose a RootStructureGroup property while it does expose a RootFolder property. Slightly annoying but easily fixed with… you guessed it! An extension method:

/// <summary>
/// Returns the root structure group for this publication
/// </summary>
public static StructureGroup RootSG(this Repository publication)
{
Filter filter = new Filter();
filter.Conditions["ItemType"] = ItemType.StructureGroup;
IList<RepositoryLocalObject> items = publication.GetItems(filter);

if (items.Count == 0)
return null;
else
return (StructureGroup)items[0];
}

Conclusion

These are just a few useful methods that can make your Tridion development quicker and more convenient.
Undoubtedly there’s many more such methods people can think of, if you do have some that you use please share them and if we have enough I will create an extension on World with all of them!

Code

You can download the methods ive shown in this article here: code.

A few useful String extension methods October 26, 2009

Posted by yoavniran in Programming.
Tags: , , , ,
1 comment so far

There are a couple of actions I find myself doing over and over again when it comes to strings and frankly, its becoming rather annoying writing the same lines of code over and over again for every application I create.

So, I have created a few of useful (at least for me) Extension Methods that encapsulate the reoccurring logic.

If you are not familiar with extension methods, its a great way introduced in .NET 3.5 to add functionality to an already existing type.
You typically use these methods to attach functionality to types you dont have access to their source code, those could be types in the .NET’s BCL, in a 3rd party library or even your own code you dont think this addition merits a change to the source.

So here are mine:

IsEmpty

This is a simple one born from pure laziness :) . While i was working on an application recently I got tired writing

if (String.IsNullOrEmpty(str))…

for the hundredth time so I created an Extension method for the String type that does just that, now i can write it in shorter way:

If (str.IsEmpty())…


/// <summary>
/// Executes the String.IsNullOrEmpty on the current string
/// </summary>
/// <returns>True if either empty or null</returns>
public static bool IsEmpty(this String str)
{
return String.IsNullOrEmpty(str);
}

CsvToList

Working with configuration files quite allot I noticed that many times im passing a collection of (usually) comma separated values in a single string and then to parse this list im using the String.Split method.
What you usually need to do with the split method is provide a separator character or an array of these separators and optionally use the StringSplitOptions enumeration.

Doing this once is fine but what if you need to do this more than that? here’s my solution:

/// <summary>
/// Parses the String into a list of values separated by a comma (',')
/// </summary>
public static IEnumerable<string> CsvToList(this String str)
{
return CsvToList(str, ',');
}

/// <summary>
/// Parses the String into a list of values separated by the provided delimiter character
/// </summary>
/// <param name="delimiter">A character used in the String to separate between the values</param>
public static IEnumerable<string> CsvToList(this String str, char delimiter)
{
var delString = delimiter.ToString();

var delimiters = new[] { String.Format(" {0} ", delimiter), String.Format("{0} ", delimiter), delString };

return str.Split(delimiters, StringSplitOptions.RemoveEmptyEntries);
}

Take

Probably could have found a better name for it. This method lets you specify the start and end index of the sub-string to extract from the original string.
When manipulating strings and extracting sub-strings from other strings this method could come quite handy.

/// <summary>
/// Extension method allowing to state the start and end positions of the sub string to get from another string
/// </summary>
/// <param name="start">The start index of the sub-string</param>
/// <param name="end">The end index of the sub-string</param>
public static string Take(this String str, int start, int end)
{
return str.Substring(start, (end - start));
}

Conclusion

None of these methods I presented in this article are revolutionary by any means, their purpose is to make life a bit easier, especially when like with these examples you find yourself writing the same couple lines of code over and over again.
If at first it seems unnecessary, I promise that after making use of such extension methods youll find them both time saving and convenient to use.

So what extension methods are you using?

Source Code

You can download these methods here: code. I even included a method that creates a CSV String from an IEnumerable<string> :)

Poem: The Horizon August 25, 2009

Posted by yoavniran in Poetry.
Tags: , , , , ,
2 comments

This one i wrote on July 2nd, 2009.

The standard disclaimers apply, the poem was originally written in Hebrew therefore the translation may lose or change some of the meanings, rhyming, wordplay, etc.

~ The Horizon ~

I found myself sitting before the horizon
Looking at that distant line
The border between a memory and a touch
A divider between my past and the dream.

I found myself for one moment content
for an instant gazing at it aloof
It – that cuts the imagination to broken shards of glass
The ever threatening wave that is reluctant to come.

As I sat there, I found a tree nearby
Old it was, barren limbs, leafs no longer growing
like me its gaze is full of wonder
but the tree is staying here and I’m already disappearing.

I found myself thinking about that disconcerting horizon
Does more life exist beyond its colors?
Is it covering an internal light, or rather,
Is it holding back the darkness from blanketing my world?

Does the horizon also have searching eyes?
Does it see my already fading footsteps?
For a moment it pleased me to sit here
but I’m rising to go, I’m already disappearing.

The original Hebrew version:

~ האופק ~

מצאתי עצמי יושב מול האופק
מביט אל אותו קו מרוחק
הגבול בין זכרון ובין נגיעה
חוצץ שעובר בין עברי והחלום.

מצאתי עצמי לרגע מרוצה
לרגע באדישות לעברו בוהה
הוא שחותך דמיון לזכוכית שבורה
הגל המאיים אך שלא מגיע.

בעודי יושב שם מצאתי לידי עץ
עץ זקן, ענפיו ריקים ועליו לא צומחים
כמוני הוא מסתכל לעבר האופק ומשתהה
אך הוא נשאר כאן ואני כבר נעלם.

מצאתי עצמי חושב על אותו אופק מתעתע
האם מעבר לצבעיו יישנם עוד חיים?
האם הוא מסתיר אור נצחי, או שמא,
מחזיק מבעד החושך לכסות עולמי?

האם גם לאופק עיניים מחפשות?
האם רואה את עקבותיי שכבר מטשטשות?
לרגע קט הישיבה נעמה לי
אך אני קם והולך, אני כבר נעלם.

Favorite Poems of the Day Up to Date: 21/08/2009 August 21, 2009

Posted by yoavniran in Poetry.
Tags: , , , , , ,
1 comment so far

As some of you know I’ve taken upon myself to try and publish a link to a poem i like per day on Twitter: #PoemOfTheDay.

Admittedly, I havent been able to keep it up everyday since I started but I did manage  to share quite a few over the past few months.

I’d like to take the opportunity to collect some of my personal recent favorites in this post.

Enjoy!

August 19th 2009Metallic Wing” by Efrat Mishori: http://tinyurl.com/mdlv57 – “Metallic wing in its socket, beating unseen.”

August 18th 2009 – Pleasure for Pleasure” by Peter Stavropoulos: http://bit.ly/3Y7S4O – “…Pleasure for pleasure will surely start”

August 13th 2009 – “Night Heron” by Samuel Peralta: http://bit.ly/rtZ1m – “rising from the waters / like a dream.”

August 11th 2009 – Sonnet 56” by William Shakespeare: http://bit.ly/hPEcw – “Sweet love, renew thy force! Be it not said…”

August 10th 2009 – from: Prayers of Atonement” by Lea Goldberg http://bit.ly/klx4t -”If there were torments–then they voyaged toward you”

August 3rd 2009 – Endless Poem” by Yehuda Amichai: http://bit.ly/jGQ7o – “Within me / My heart / Within my heart / A museum”

July 30th 2009 – Listening” by Amy Lowell: http://bit.ly/1K8pK – “‘T is you that are the music, not your song…”

July 27th 2009 – The Garden” by Mark Strand: http://bit.ly/rSKuf – “it shines: even now in the moment before it disappears.”

July 26th 2009 – Song of Hope” by Thomas Hardy: http://bit.ly/n4rlU – “To-morrow shines soon -Shines soon!”

July 21st 2009 – On Pain” by Khalil Gibran: http://bit.ly/vmHgr – “…your pain would not seem less wondrous than your joy…”

July 17th 2009 - “Petals” by Amy Lowell: http://twurl.nl/s5v6ai – “…Petal by petal the flower of our heart…”

July 16th 2009 – When the Eyes Open” by Dahlia Ravikovitz: http://bit.ly/Z8Re0 -”as the soul returns to the body when the eyes open.”

July 15th 2009 – Touched by an Angel” by Maya Angelou: http://bit.ly/uAerx – “Yet it is only love which sets us free.”

July 12th 2009 – A Pearl, a Girl” by Robert Browning: http://bit.ly/6rDpB -”…Through the love in a girl!”

July 10th 2009 – Valentine” by Carol Ann Duffy: http://bit.ly/YMoIj -”I give you an onion. It is a moon wrapped in brown paper…”

July 4th 2009 – Moonwalk” by Samuel Peralta : http://bit.ly/4sbHqx -”…The words begin to form a song / The melody begins to burn…”

July 3rd 2009 – Wild Nights” by Emily Dickinson: http://bit.ly/qOMhk -”…Wild nights should be Our luxury!…”

July 1st 2009 – If You Forget Me” by Pablo Neruda: http://bit.ly/1j9EgT -”if each day,each hour,you feel that you are destined for..”

Poem: Distant Thoughts August 6, 2009

Posted by yoavniran in Poetry.
Tags: , , , ,
add a comment

This one i wrote in June 2004:

The standard disclaimers apply, the poem was originally written in Hebrew therefore the translation may lose or change some of the meanings, rhyming, wordplay, etc.

~ Distant Thoughts ~

Lost,
Cannot find her
She won’t come back to me
No gentle word will be enough.
Drowning,
Air is no longer found
The will to breathe gone as well
My life is where she is
And she is gone.
Blind,
No light is strong enough
No scream in the dark is heard
It is just the wind blowing in the gaping hole
She was mine but no more.
Stumbling,
Step after step
Direction unknown
She will not be there when I arrive
Where will that be – doesn’t matter.
Dreaming,
The Images a blur
Like leafs a moment before the storm
What was – that was no dream
As real as pain
Pain of loss and longing
The dream slowly dissipates
Not Breaking,
Not whole either
A piece is distant and missing
Even when the wound heals
The scar will remain to remind me
And she, she will also be with me.

The original Hebrew version:

~ מחשבות רחוקות ~

אבדתי,
אינני מוצא אותה
שוב אלי היא לא תחזור
שום מילה עדינה לא תספיק.
טובע,
האוויר גם הוא לא בנמצא
והרצון לנשום גם הוא נעלם
חיי היכן שהיא תהיה
והיא איננה.
עיוור,
אף אור לא חזק מספיק
אף צעקה בחושך איננה נשמעת
רק הרוח המנשבת בחלל שנפער
שלי הייתה אך לא עוד.
מועד,
צעד אחר צעד
הכיוון אינו ידוע
אך היא לא תהיה שם כשאגיע
גם לא תהיה שם לפני שאלך
לאן – זה כבר לא משנה.
חולם,
התמונות מסתחררות
כמו העלים רגע לפני שהסערה מגיעה
אך מה שהיה לא חלום הוא
אמיתי כמו הכאב
כאב של אובדן וגעגוע
אט אט מתפוגג לו החלום.
לא נשבר,
אך גם לא שלם באמת
משהו חסר ותמיד רחוק
גם שהפצע יחלים
הצלקת תשאר להזכיר לי
והיא, גם היא תשאר איתי.

Creating a Webservice Proxy with jQuery August 2, 2009

Posted by yoavniran in Programming.
Tags: , , , , , , , , , ,
1 comment so far

Contents

Introduction

In a previous post I’ve shown how to use WCF, jQuery and jTemplates to retrieve information from the server and lay it out on the page using jTemplates’ templating engine.

The code example in that article used the Microsoft Ajax client library and the proxy it creates at run time to ease the javascript code needed to call the methods of the webservice I created.

In this article I would like to show an easy way of creating a similar proxy to the Microsoft one in pure javascript and the help of jQuery’s AJAX abilities. This makes a lot of sense if you do not have the option to use the MS library on the client or simply don’t want to.
I will be relying mostly on the code examples and concepts I described in the previous article  so I’d recommend reading it first before continuing to read this post.

Server Side

The good news: no need to change anything on the server side, the web service can continue to work as it always did. All we’re doing in this exercise is to replace the client side logic and so we will not touch the server code.

Client Side

Using the same website ive shown how to create in the previous article we will create the new proxy for our WCF webservice.
In the System folder create a javascript file and call it ServiceProxy.js, To the file add the following code:

ServiceProxy = function() //constructor for the proxy
{
this._baseURL = "Services/TutorialService.svc/";
};
ServiceProxy.prototype =

{_defaultErrorHandler: function(xhr, status, error)
{
alert(xhr.statusText);
},

_doAjax: function(method, data, fnSuccess, fnError)
{
if (!data) data = {};

if (!fnError) fnError = this._defaultErrorHandler;

$.ajax({
type: "GET",
url: this._baseURL + method,
data: data,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: fnSuccess,
error: fnError,
dataFilter: function(data)
{
var response;
if (typeof (JSON) !== "undefined" && typeof (JSON.parse) === "function")
response = JSON.parse(data);
else
response = val("(" + data + ")");


if (response.hasOwnProperty("d"))
return response.d;
else
return response;
}
});
}
};

Lets examine the code:

The first section is the constructor of the proxy object, in there we define the base URL of the service we will be calling.

The second method is _defaultErrorHandler, this is a default error handler, its strictly a developer friendly method, allowing the calling method to leave the pointer to an error handling method empty. Of course the implementation of this default error handler should be changed in a real life scenario as its not wise to show any raw error information to a website’s visitor.

The third and most important method is _doAjax, this is where the “magic” happens which takes care of the back and forward communication with the server.

The first two lines take care of the defaults, if there is no data passed to the webservice we assign an empty object and if there is no pointer supplied to an error handler we assign our default method.

Next is the where we use jQuery’s incredibly convenient Ajax method, lets examine this call, jQuery’s ajax method accepts an object that sets all the needed information:

‘type’: The HTTP verb: could be GET, POST, etc. In this example we use GET since we’re only retrieving from the server.
For a more robust scenario we would probably want to make this into a parameter of the method.

‘url’: The URL of the webservice method, in this case the base URL defined in the constructor and the name of the method.

‘data’: The parameters passed to the service method, constructed as a JSON object.

‘contentType’: the content type of the data being sent to the server. In our case we’re communicating with the webservice using JSON and therefore we use: “application/json; charset=utf-8”

‘success’: A pointer to the method to be called when the asynchronous call has finished successfully.

‘error’: A pointer to the method to be called when the asynchronous call finished with an error.

‘dataFilter’: I’ve taken the code block in this example from Dave Ward’s Encosia blog. I will add the links to a couple of his articles at the end of this post.

The dataFilter is used whenever there is a successful response from the server and allows us to modify the response in any way we like before its passed to the success method.

In this example there are two uses to the filter: The first one is to turn the response into a JSON object from the string result coming from the server. It will first check whether the current browser supports JSON parsing natively (Firefox 3.5, IE8 for example). If it does it will use the native JSON object and if not will use the less optimized and less secure eval() function.

The second part is to check whether the response is enclosed within a ‘d’ property, this ‘d’ property is added automatically by Microsoft’s WCF service and since we want to abstract this fact from the caller we only return the relevant response if this is the case.

Now that we have everything we need for our base proxy functionality all we need to do is add the methods that match the exposed methods on the webservice. To the prototype of the ServiceProxy object add these two methods:

getArticles: function(success, error)
{
this._doAjax("GetArticles", null, success, error);
},

getArticle: function(link, success, error)
{
var data = {link: link};

this._doAjax("GetArticle", data, success, error)
},

These two methods call our _doAjax, passing the necessary information such as the method name and the parameters if needed to the call.

In fact the methods mirror the methods available on the webservice thus completing the proxy.

Now the only thing to do is create a HTML file (or any other file, could even be JSP) that will replace the aspx page we created in the previous article.
You can find all the source code in the example site ive made available for download, in this post I will only show the changes needed.

- First, create a default.html in the root of the site.
- In the head element add these links:

<script src=”System/jquery.js” type=”text/javascript”></script>
<script src=”System/jquery-jtemplates.js” type=”text/javascript”></script>
<script src=”System/ServiceProxy.js” type=”text/javascript”></script>
<link href=”System/Styles.css” rel=”stylesheet” type=”text/css” />

- Copy over the entire javascript element.
- Add the following line as the first line of the script:

<script type="text/javascript">
var proxy = new ServiceProxy();

- In the document ready function replace the call to the GetArticles method with this one:

$(document).ready(function() //executes this code when page loading is done
{
proxy.getArticles(articlesRetrieved);
});

- In the loadArticle function replace the call to getArticle with this one:

function loadArticle(link)
{
$("#LoadingImg").removeClass("Hidden");
$("#SingleArticle").html("");

proxy.getArticle(link, articleRetrieved, serviceDefaultErrorHandler);
}

That’s all! Now you have a working page doing exactly the same as it did before only using our own javascript proxy without any dependencies on the Microsoft proxy or the MS Ajax library.
The end result is as expected identical to the one before:

serviceproxy result

Source Code

Can be downloaded here.

Resources

Poem: Love is Possible July 29, 2009

Posted by yoavniran in Poetry.
Tags: , , ,
add a comment

This is one i wrote today: 29/07/2009  (on the way to work).

~ Love is Possible ~

Walking down the street alone
The throng around me pulses
A pretty girl passes by
Is there a small smile for me
Hiding in her weary expression?
Walking resumes, I never stopped
Nevertheless I resume.
The letters on the street wall say:
“Love is Possible”
No question mark, it’s just there
Why do the letters seem to quiver?
Three little words
Words giving hope, words obliterating consciousness
Do these words lie to me?
Go on walking, I didn’t stop
Yet I continue.
“LOVE IS POSSIBLE”
I shout to the foggy air
There is no doubt in the sound
Then why does my voice quiver?
The echo seems to mock me
Did my heart lie?
Is that the sun behind rolling clouds?
Will it shine for me?

Poem: In Love’s Defense July 18, 2009

Posted by yoavniran in Poetry.
Tags: , , ,
add a comment

This one i wrote today: 18/07/2009.

Enjoy.

~ In Love’s Defense ~

In love’s defense,
she was here first
Long before we came along
She was never ours to hold
She never belonged to us
but to the world
Belonged to the butterflies’ wings
and to the tree tops’ wind
Our claim on her was never just
All our praises never enough
In Love’s defense,
She never presumed to be more
than what she is
Never asked for anything in return
Not once ridiculed our ethereal groping
Her light continues to elude
our ever present darkness
She dances between music notes
Swims in life’s deep currents
She is free
for us to enjoy
She is here
for us to share
Never own
In love’s defense -
She is LOVE.