NodeJS Series #5: Installing,Uninstalling,Updating Modules

Hi Wizards, Do you remember what we did previously? We created a Port Listener which listens to a port and get response. In that post, we used a module named “http” to send request and get response. Now im gonna talk about “Modules” and how to use them. MODULES Node Package Manager consists of many modules that can be downloaded and used in your project.The list of repository can be accessed from: https://www.npmjs.com/ You can however specify if a module will be used local or global. What does that mean? Global…

Read More

NodeJS Series #4: Creating a Port Listener

Hello Wizards, First of all,sorry I couldn’t publish this post as I promised,i had illness.Even Wizards get sick! The purpose of this post is all about creating a server,listening it through a port number and then sending output to the browser. So lets start immediately! We shall write a small script that creates server and listens to this object. [sourcecode language=”javascript”] var http = require("http"); http.createServer(function (request, response) { response.writeHead(200, { "Content-Type": "text/plain" }); response.write("Listening to localhost:8888"); response.end(); }).listen(8888); [/sourcecode] Lets take a breath and talk about what this script does in…

Read More

NodeJS Series #3: Using External Files

Hello Wizards, This time we will create external .js files to call from NodeJS Command Prompt. Create a new .js file (for instance I’ve created sample.js). Add these javascript lines as an example: [sourcecode language=”javascript”] console.log("Poooff"); [/sourcecode] When we call external file from nodejs command prompt,it shall write “Pooff” as an output. Store this file to a close destination,easy to access later from command prompt.Now open “Nodejs Command Prompt” application and call this: Then press enter and see what happens.According to me,I get this one: Its that easy to call external…

Read More

NodeJS Series #2: Installing the Device and Casting a Simple Spell

Hello there Magicians, Ready to enter to the world of Node Spells? Lets install the Node.js now via http://nodejs.org Click on Install and start executable setup file. Complete the installation. Then open “Node.js” application with green icon to start casting your spells. Lets say we want to write “Poooof” on the console,heres how: [sourcecode language=”javascript”] console.log("Poooff"); [/sourcecode] Well Done Wizard! This was your first spell with Node Device and you’ve successfully did it! Next time you shall see how to install and run seperate Node spells and master at it!…

Read More

NodeJS Series #1: An Introduction to Magical Device

Hi dear readers, Its really amazing when you decide to start writing about most popular technologies and this is one of them.I’ve planned on publishing 1 article per day about this topic.It will be a real experience for you,too. NodeJS is one of the most popular “things-to-learn” nowadays. So my advice is add me to your bookmarks or simply “follow me” and read the series everyday as i’ll keep writing about it. Lets cut to the chase and speak about what NodeJS is. NodeJS? What the hell is that? Once…

Read More

SharePoint 2013 REST API and Charset Problem

I’ve been on a project lately.The project was to migrate contents from a farm to another.Since there was corporate rules like a bank we couldnt use Content Migration tool in CA so our only option was to use SharePoint REST API. Whenever i sent values from a list in farm to another list in another farm,i had problems with non-english chars. For example; characters like “İ”,”Ç”,”Ğ” arent ASCII supported so my only option was to use “Encoding” There are a couple known drawbacks while using Encoding with HttpWebRequest so i implemented those…

Read More

Problem and Solution : Dynamic operations can only be performed in homogenous AppDomain.

If u have ever used “dynamic” keyword in your webpart code,its 100% possibility you will meet this error. Its because using dynamic operation in same appdomain as sharepoint is not supported in new LegacyCASModel. So heres a workaround i did to make it work: if you wrote a timerjob, edit owstimer.config otherwise edit web.config: Instead of this: <trust level=”Full” originUrl=”” legacyCasModel=”true” /> Use this: <trust level=”Full”  /> and add this to <configuration><runtime>: <NetFx40_LegacySecurityPolicy enabled=”false”/> Hope it helps

Read More

Get Yahoo Weather and Parse it in C#

Here’s a code i wrote for a sharepoint 2013 visual webpart which retrieves Istanbul’s temperature and condition text from Yahoo Weather (YQL) in JSON format and parsing. string results = “”; using (WebClient wc = new WebClient()) { results = wc.DownloadString(“https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20weather.forecast%20where%20woeid%3D2344116&format=json”); } dynamic jo = JObject.Parse(results); var items = jo.query.results.channel.item.condition; var code = items.code; var temp = items.temp; var text = items.text; Console.WriteLine(code + ” – ” + temp + ” – ” + text); Console.Read();

Read More