Why PHP Framework over CorePHP?

The 2018 World Cup is fast approaching, with national sides making their final preparations ahead of this summer’s tournament.

We now know the groups after December’s draw. England have been put together with Belgium, Tunisia and Panama in Group G.

Gareth Southgate’s side were not among the top seeds, meaning they featured in pot two during the proceedings.

And with England’s route now mapped out, Southgate will be able to ramp up preparations for the 2018 tournament. 2018 World cup, football News ,Gaming ,Betscore ,Casino …..Sports.vin

Steps to reflect changes in ShaPoint Timer job in MOSS

 

I’ve developed SharePoint Timer job in moss and gained a lot of experiences with deploying, configuring, debugging and updating it. The problem I had faced was my timer job changes don’t affect. Even after deploying multiple times then also changes are not affect in timer job. After lots of efforts finally I got the steps which will reflect the changes in timer job every time I deploy the solution. Here is the steps (my project type is WSPBuilder):

 

First Way:

  1. In visual studio 2008 right click on solution, Select WSPBuilder -> Uninstall.
  2. Check the dll of your solution name in C:WINDOWSassembly and if you find your dll then right click on dll and select Uninstall.
  3. Restart Windows SharePoint Services Timer from the Services.
  4. iisreset.
  5. Right click on solution, select Build.
  6. Right click on FEATURES folder of solution and select Copy to 12 hive.
  7. Right click on solution, WSPBuilder -> Copy to GAC.
  8. Right click on solution, WSPBuilder -> Copy to 12 hive.
  9. Right click on solution, WSPBuilder -> Build WSP.
    1. Right click on solution, WSPBuilder -> Deploy.
    2. Now you can run you timer job. You will got the changes.

 

Second Way:

After following above steps sometimes you might got changes in timer job. For that follow the below steps:

  1. Make changes in code which you want to do in code.
  2. After that right click on solution, WSPBuilder -> Upgrade. One popup is come to you for Rebuild Solution, click on Yes button.
    Timerjob
    Note: If you do not get this popup then your code might not be changed. So, for that again make some changes in you code and try again Step no.1 and 2 until you get this popup.
  1. Right click on solution, select Clean.
  2. Right click on solution, select Rebuild.
  3. Follow the same steps from First way (1 to 10).

 

Reference links

http://bytes.com/topic/asp-net/insights/902681-how-create-deploy-sharepoint-2007-timer-job

 

Sameer J. Vaghela

 

Moss 2007 to Sharepoint2013 page migration

Few months ago, I had arequirement of copy SharePoint 2007 pages to SharePoint 2013 site in my migration project. The web application was hosted on other server (not on the SharePoint server). So Ihad to use SharePoint services model.I have used copy-service for this requirement. Please note that this service will only copy static content of page not other webparts content.

To start the page migration, first fetch source page fieldinfo and bytearray using copy-service ‘GetItem’ method(add copy service reference and programatically change its url).

 //give source copy-service url and credentials
CopyWS.Copy copyWS = new CopyWS.Copy();
copyWS.Url = “http://wssdev:7001/_vti_bin/copy.asmx”;
copyWS.Credentials = new NetworkCredential(“sourcesite-username”, “sourcesite-password”);//fetch page fieldinfo and bytearray using copy GetItem method from source page.
CopyWS.FieldInformation[] mossPageFieldInfoArray;
byte[] mossPageByteArray;
uint myGetUint = copyWS.GetItem(“http://wssdev:7001/Pages/test1.aspx”, out mossPageFieldInfoArray, out mossPageByteArray);

Next, set copy-service url to destination site and copy the page using ‘CopyIntoItems’ method. Provide source page fieldinfo and bytearray into this method.

//give destination copy-service url and credentials
copyWS = new CopyWS.Copy();
copyWS.Url = “http://spe2013dev1:4444/_vti_bin/copy.asmx”;
copyWS.Credentials = new NetworkCredential(“destinationsite-username”, “destinationsite-password”);// create page in destination site using source page info.
CopyWS.CopyResult[] copyResultArray;
string[] copyDest = { “http://spe2013dev1:4444/Pages/test1.aspx” };
uint myCopyUint = copyWS.CopyIntoItems(“http://wssdev:7001/Pages/test1.aspx”, copyDest, mossPageFieldInfoArray, mossPageByteArray, out copyResultArray);

To confirm the migration process, check CopyResult.ErrorCode, if it is successful than your page gets copied successfully else it will show error message.

Additional Information:

  • Page FieldInformation Array
  • Page Byte Array
  • Page Copy Result
Related link:
http://msdn.microsoft.com/en-us/library/copy.copy.copyintoitems%28v=office.12%29.aspx

In ASP.Net C#, Call webpage asynchronously with get and post method type and additional parameters in callback method

Asynchronous method call is a mechanism in which control execution returns directly to the next statement without waiting for the method operation execution. Every asynchronous call is associated with a dedicated thread. IIS has limited number of application thread pools (default 5000 per CPU). IIS can handle that number of concurrent request at a time. So if you have a situation where you expect large number of concurrent requests in a single application, asynchronous method call will be a good practice. Where synchronous call executes by occupying 5000 threads, asynchronous can perform the same task with only 50 available threads. Here you can read more on thread pools here

In C# data posting with get() method in asynchronous calls can be done by just passing parameters in URL where as in asynchronous post() method for passing the parameters you will need to write them in stream asynchronously. For that .Net is providing reach HttpWebRequest class methods.

Recently I had a situation where my application was expecting very heavy user traffic and I had a requirement to store them into my database as well as also need to pass the data to a third party webpage. So I needed to pass the data asynchronously to that third party webpage without waiting for the response from that webpage. Also if any asynchronous call fails during the execution due to any data mismatch, I need to log the error along with an “id” from my database for that user request. And to achieve that I needed to pass some extra data like “UserId”, which was not a part of asynchronous method parameters. Also I could not add the “id” in webpage parameter collection as it was not a part of the third party webpage definition.
So to accomplish this I have sent the parameter of type Object array into asynchronous method request with method type post. Following are the example of code for asynchronous get method, asynchronous post method and asynchronous post method with extra parameters.

Example for asynchronous GET method:

protected void Page_Load(object sender, EventArgs e)
{
//For testing I have used current application’s about.aspx itself
//Passes id, firstname and lastname as a quesrystring in URL
GetMethodCall(“http://localhost:2839/about.aspx?id=1&firstname=abc&lastname=xyz”);
}
private static void GetMethodCall(string URL)
{
//Create new HttpWebRequest object for the passed URL using create method
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(URL);//BeginGetResponse is used to call asynchronously URL
IAsyncResult result =
(IAsyncResult)request.BeginGetResponse(new AsyncCallback(GetResponseCallback), request);}
private static void GetResponseCallback(IAsyncResult asynchronousResult)
{
// Request state is asynchronous.
HttpWebRequest request = (HttpWebRequest)asynchronousResult.AsyncState;
request.Method = “GET”;
try
{
//Read the response for any future needs.
HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(asynchronousResult);// Release the HttpWebResponse
response.Close();
}
catch (Exception ex)
{
//Log the error
string errormessage = ex.Message;
}
}

 

Example for POST method:

protected void Page_Load(object sender, EventArgs e)
{
// GetMethodCall(“http://localhost:2839/about.aspx?id=1&firstname=abc&lastname=xyz”);
//For post data testing I have used current application’s aboutpost.aspx
PostMethodCall(“http://localhost:2839/aboutpost.aspx”);
}
private static void PostMethodCall(string URL)
{
//Create new HttpWebRequest object for the passed URL using create method
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(URL);//Set method verb type to POST
request.Method = “POST”;
request.ContentType = “application/x-www-form-urlencoded”;// BeginGetRequestStream is used to set post data content in asynchronously call
IAsyncResult result =
(IAsyncResult)request.BeginGetRequestStream(new AsyncCallback(GetRequestCallback), request);}
private static void GetRequestCallback(IAsyncResult asynchronousResult)
{
// Request state is asynchronous.
HttpWebRequest request = (HttpWebRequest)asynchronousResult.AsyncState;
try
{
Stream postStream = request.EndGetRequestStream(asynchronousResult);//Set data to be post
string postData = “id=1&firstname=abc&lastname=xyz”;// Convert the string into a byte array.
byte[] byteArray = Encoding.UTF8.GetBytes(postData);// Write to the request stream.
postStream.Write(byteArray, 0, postData.Length);
postStream.Close();// Start the asynchronous operation to get the response
request.BeginGetResponse(new AsyncCallback(GetResponseCallback), request);
}
catch (Exception ex)
{
//Log the error
string errormessage = ex.Message;
}
}

You need to use same GetResponseCallback method as previous example.

Example for GET & POST methods with additional user defined parameters:

protected void Page_Load(object sender, EventArgs e)
{
// GetMethodCall(“http://localhost:2839/about.aspx?id=1&firstname=abc&lastname=xyz”);
//For post data testing I have used current application’s aboutpost.aspx
PostMethodCall(“http://localhost:2839/aboutpost.aspx”, “L001020″, “U112″);
}
private static void PostMethodCall(string URL, string logID, string userid)
{
//Create new HttpWebRequest object for the passed URL using create method
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(URL);//Set method verb type to POST
request.Method = “POST”;
request.ContentType = “application/x-www-form-urlencoded”;// BeginGetRequestStream is used to set post data content in asynchronously call
//Use 2nd parameter for asyncresult as oject type and pass additional parameters comma separated
IAsyncResult result =
(IAsyncResult)request.BeginGetRequestStream(new AsyncCallback(GetRequestCallback), new object[] { request, userid, logID });}
private static void GetRequestCallback(IAsyncResult asynchronousResult)
{
// Request state is asynchronous.
object[] param = (object[])asynchronousResult.AsyncState;
HttpWebRequest request = (HttpWebRequest)param[0];
//Read additional parametrs using object array
string userid = param[1].ToString();
string MyUniqueLogID = param[2].ToString();
try
{
Stream postStream = request.EndGetRequestStream(asynchronousResult);//Set data to be post
string postData = “id=1&firstname=abc&lastname=xyz”;// Convert the string into a byte array.
byte[] byteArray = Encoding.UTF8.GetBytes(postData);// Write to the request stream.
postStream.Write(byteArray, 0, postData.Length);
postStream.Close();// Start the asynchronous operation to get the response
//Use 2nd parameter for asyncresult as oject type and pass additional parameters comma separated
request.BeginGetResponse(new AsyncCallback(GetResponseCallback), new object[] { request, userid, MyUniqueLogID });
}
catch (Exception ex)
{
//My custom log with my unique logID and userid
string errormessage = userid + “-” + MyUniqueLogID + “:” + ex.Message;
}
}private static void GetResponseCallback(IAsyncResult asynchronousResult)
{
// Request state is asynchronous.
object[] param = (object[])asynchronousResult.AsyncState;
HttpWebRequest request = (HttpWebRequest)param[0];
//Read additional parametrs using object array
string userid = param[1].ToString();
string MyUniqueLogID = param[2].ToString();
try
{
//Read the response for any future needs.
HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(asynchronousResult);// Release the HttpWebResponse
response.Close();
}
catch (Exception ex)
{
//My custom log with my unique logID and userid
string errormessage = userid + “-” + MyUniqueLogID + “:” + ex.Message;
}
}

Similarly you can pass additional parameters in GET method type by calling same GetResponseCallback callback.

request.BeginGetResponse(new AsyncCallback(GetResponseCallback), new object[] { request, userid, MyUniqueLogID });

Additional information:

  • You can retrieve GET method parameters as follows:

  • You can retrieve POST method parameters as follows:

You can retrieve return value from asynchronous web page call using following code:

private static void GetResponseCallback(IAsyncResult asynchronousResult)
{
// Request state is asynchronous.
object[] param = (object[])asynchronousResult.AsyncState;
HttpWebRequest request = (HttpWebRequest)param[0];
//Read additional parametrs using object array
string userid = param[1].ToString();
string MyUniqueLogID = param[2].ToString();
try
{
//Read the response for any future needs.
HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(asynchronousResult);
//Get response stream for check return values by external webpage
Stream streamResponse = response.GetResponseStream();
StreamReader streamRead = new StreamReader(streamResponse);
string responseString = streamRead.ReadToEnd();
//Get response in string object
string myResult = responseString;
if (myResult == “success”)
{
string status = “I am done”;
}
else
{
string status = “I am done with some error”;
}

// Close the stream object
streamResponse.Close();
streamRead.Close();
// Release the HttpWebResponse
response.Close();
}
catch (Exception ex)
{
//My custom log with my unique logID and userid
string errormessage = userid + “-” + MyUniqueLogID + “:” + ex.Message;
}
}

Required additional namespaces

System.Net.HttpWebRequest
System.Text; // for Encoding.UTF8

Supported .NET Frameworks

Supported in: 4.5.1, 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

Posted By: Kruti V Parmar