Wednesday, July 18, 2012

How to unsubscribe from Mobily and STC (KSA) Facebook SMS Service

Facebook SMS Service is nice feature and it can be setup easily through Mobile tab on your Facebook Account Settings, after that you will start receiving messages according to your preference. The mobile provider will charge you a certain amount by weekly or monthly basis to keep sending it. but if you need to remove the Facebook SMS Service, it is not easy as you think, even if you removed your mobile number from Facebook Account Settings the Mobile Operator will keep charging you . I faced this issue on my Mobily (Saudi)number, every Friday morning I will get two messages stats “ your last call costs SAR 3” and “ you are still registered to the Mobily Facebook SMS service”. I called customer support, went to their office nothing happened. finally I got a solution one of my friend working as a mobile technician.
The solution is as follows

Mobily 
Send a SMS to 606050 contains“UF” without quotation marks in subject field.
if you need to subscribe again send “F” to 606050.

STC 
Send a SMS to 86677 contains“UF” without quotation marks in subject field.
if you need to subscribe again send “F” to 86677.

Reference:
ShameerOnline
http://www.shameeronline.com/how-to-unsubscribe-from-mobily-ksa-facebook-sms-service/

Saturday, March 31, 2012

How to get page width & height (cross-browsers) with javascript

I spent many hours trying & searching for a stable function working fine across the different browsers and at last i found this code which i can say it's amazing code, type of my favorite way in writing down coding (simple & effective).
This function worked fine and tested on

  • IE 6, 8, 9
  • Opera 11.62
  • FF 11.0
  • Chrome 19.0.1084.1 dev-m
  • Safari 5.1.5
  • Comodo Dragon 18.0
  • Avant browser ultimate 2012 build 28

function GetPageXY() {

var PositionXY = { Width: 0, Height: 0 };
var db = document.body;
var dde = document.documentElement;
PositionXY.Width = Math.max(db.scrollTop, dde.scrollTop, db.offsetWidth, dde.offsetWidth, db.clientWidth, dde.clientWidth);

PositionXY.Height = Math.max(db.scrollHeight, dde.scrollHeight, db.offsetHeight, dde.offsetHeight, db.clientHeight, dde.clientHeight);

return PositionXY;
}

Reference:
Get document height (cross-browser)    James Padolsey

Wednesday, March 7, 2012

Adding HTML5 Drag and Drop to SharePoint Lists

Microsoft SharePoint is an enterprise platform with a long history and vast variety of features, which is why it can’t always react quickly enough to follow emerging Web technology trends. Despite a wide enterprise adoption of SharePoint and a huge effort to provide a broad number of features, SharePoint still lags behind modern CMS products in terms of immersive UIs, such as HTML5 and CSS3.
Continue Reading on MSDN Magazine

Sunday, July 3, 2011

Samrter & better than "loop statements" With JavaScript Join() function


Al salam alikom ("hi all")
   Today we'll talking about amazing JavaScript function it's the "Join()" function, and I'll explain it with an easy example & little words

before the example let's see what is the definition of (join()) 

The join() method joins all elements of an array into a string, and returns the string.
The elements will be separated by a specified separator. The default separator is comma (,).

Syntax
----------------
 
Join(separator);

separator: Optional. The separator to be used. If omitted, the elements are separated with a comma

So, if we have an array and wee need to display it in html list ("ul")
we have to options

First solution:
--------------------


var arr = ["Cairo", "Alex", "Aswan"];
var list = "<ul><li>";
for (var i = 0; i < arr.length; i++) {
    if (i !== (arr.length - 1)) {
        list += arr[i] + "</li><li>";
    }
    else {
        list += arr[i];
    }
}
list += "</li></ul>"
;

Second solution:
-------------------
 which i recommend it and it's very easy & smart

var arr = ["Cairo", "Alex", "Aswan"];      
var list = "<ul><li>" + arr.join ("</li><li>") + "</li></ul>";

The two solutions have the same out and you have the choice to use any one of them, but i think (2) lines of code are better than (11) ;)

Sunday, June 26, 2011

(IF, ELSE IF and ELSE) with (? :) syntax

Al salam alikom ("hi all")
          all of us know how to write the IF : ELSE with this syntax 

(Condition) ? IF action goes here : Else action goes here;

today I'll explain how to write  IF, IF Else, and Else with this syntax with very simple sample :)



//Java Script
var x = 0;
(x < 0) ? alert("Error: Number can't be minus...!") : (x >= 1) ? alert(x) : alert("Zero");



// C#
int x = 0;
string result = (x < 0) ? "Error: Number can't be minus...!" : (x >= 1) ? x.ToString() : "Zero";

Easy and simple, wish you like it.

Thursday, April 28, 2011

List of reserved ports that preferred to avoid use it when creating a new web site for "share Point"


Each "SharePoint" developer or administrator know the issue of opening a website hosted on another port of  "80" on any different browser than "IE" Like (Chrome, FireFox, Safari, Opera, ...etc). 
At the past I used to search for a way to open these blocked ports for the different browsers, but once when I was searching for a solution for this issue for safari I found a very important piece of information that made me realize I was mistaken when I believe that those ports that I use are non-reserved, 
This info is a list of the reserved ports that we must avoid use it when creating a website for "SharePoint" or any website that use port number different than "80", and here is the ports list with a hint for each port reserved for



// The blocked port list matches the port blocking mozilla implements
// See http://www.mozilla.org/projects/netlib/PortBanning.html for more information
1,    // tcpmux        
7,    // echo    
9,    // discard        
11,   // systat  
13,   // daytime        
15,   // netstat
17,   // qotd            
19,   // chargen
20,   // FTP-data
21,   // FTP-control      
22,   // SSH            
23,   // telnet  
25,   // SMTP    
37,   // time    
42,   // name    
43,   // nicname
53,   // domain
77,   // priv-rjs
79,   // finger  
87,   // ttylink
95,   // supdup  
101,  // hostriame
102,  // iso-tsap
103,  // gppitnp
104,  // acr-nema
109,  // POP2    
110,  // POP3    
111,  // sunrpc  
113,  // auth    
115,  // SFTP    
117,  // uucp-path
119,  // nntp    
123,  // NTP
135,  // loc-srv / epmap        
139,  // netbios
143,  // IMAP2
179,  // BGP
389,  // LDAP
465,  // SMTP+SSL
512,  // print / exec        
513,  // login        
514,  // shell        
515,  // printer        
526,  // tempo        
530,  // courier      
531,  // Chat        
532,  // netnews      
540,  // UUCP      
556,  // remotefs  
563,  // NNTP+SSL
587,  // ESMTP
601,  // syslog-conn
636,  // LDAP+SSL
993,  // IMAP+SSL
995,  // POP3+SSL
2049, // NFS
4045, // lockd
6000, // X11      
0

And if you need more information go  there

Saturday, May 8, 2010

Loading Bar with JavaScript

Add divs code to your page body, or wherever you want
<div id="div1"> <div
id="Div2" style="border: solid 1px #000000; width: 7px; height: 7px; background-color:
#D3D3D3; float: left; margin-right: 5px; margin-left: 5px;">
<
/div>
<div id="Div3"
style="border: solid 1px #000000; width: 7px; height: 7px; background-color: #D3D3D3;
margin-right: 5px; float: left;"> </div> <div
id="Div4" style="border: solid 1px #000000; width: 7px; height: 7px; background-color:
#D3D3D3; margin-right: 5px; float: left;"> </div>
<
div id="Div5" style="border:
solid 1px #000000; width: 7px; height: 7px; background-color: #D3D3D3; margin-right:
5px; float: left;"><
/div
> <div id="Div6" style="border: solid 1px #000000;
width: 7px; height: 7px; background-color: #D3D3D3; margin-right: 5px; float: left;">< /div>
<div id="Div7"
style="border: solid 1px #000000; width: 7px; height: 7px; background-color: #D3D3D3;
margin-right: 5px; float: left;"> </div
> <div id="Div8" style="border: solid 1px #000000;
width: 7px; height: 7px; background-color: #D3D3D3; margin-right: 5px; float: left;">
</div> </div>

Add these two buttons at the buttom of your progress bar (divs)
<input type ="button" id="btn_StartLoad" value ="Stop Loading" onclick ="StartLoading();" />

<input type="button" id="btn_StopLoad" value="Stop Loading" onclick="StopLoading();" />


Add these javascript functions to the same page which including divs and the two buttons.
var index = 1;
var prevIndex = 0;
var divCount = 7;
var loaded = false;
var Loading;

function StartLoading() {
    if (!loaded)
   {
      Loading = setInterval(DoLoading, 450);
   }
}

function DoLoading() {
  loaded = true;
  if (index > 1 && index != prevIndex) {
    prevIndex = index - 1;
    document.getElementById("loading"
+ prevIndex).style.backgroundColor = "#D3D3D3";
    document.getElementById("loading"
+ prevIndex).style.border = "solid 1px #000000";
  }
  else if (index > 1 && index == prevIndex)
{
    document.getElementById("loading"
+ (prevIndex - 1)).style.backgroundColor = "#000000";
    document.getElementById("loading"
+ (prevIndex - 1)).style.border = "solid 1px red";
    index = 1;
  }
  if (index <= divCount) {     document.getElementById("loading"
+ index).style.backgroundColor = "#000000";
    document.getElementById("loading"
+ index).style.border = "solid 1px red";
  if ((prevIndex - 1) == divCount) {
    document.getElementById("loading"
+ (prevIndex - 1)).style.backgroundColor = "#D3D3D3";
    document.getElementById("loading"
+ (prevIndex - 1)).style.border = "solid 1px #000000";
  }
  index++;
  if (index > divCount) {
    prevIndex = index;
  }
}
}

function StopLoading() {
  clearInterval(Loading);
  for (i = 1; i <= divCount; i++) {     document.getElementById("loading"
+ (i)).style.backgroundColor = "#D3D3D3";
    document.getElementById("loading"
+ (i)).style.border = "solid 1px #000000";
  }
  loaded = false;
  index = 1;
  prevIndex = 0;
  }

Example:


Friday, April 30, 2010

How to display From & To Date Range from Query in Dynamics Ax

If you build a report that use range date you will need to show user which date range he choose 
when he view the report, this method print the date range which user selected it just  add it into
your report header and it'll be like that

Date Range: 01/01/2010..10/01/2010

(Date Range) is the the label of the display method



Display str DateRange()
{
    str rangeValue;
    QueryBuildDataSource datasource;
    QueryBuildRange range;
    ;
    datasource =  element.query().dataSourceTable(tableNum(YourDatasourceTable));
    range = datasource.findRange(fieldnum(YourDatasourceTable, YourDateField));
    if(range)
    {
       rangeValue = range.value();
    }
    return rangeValue;
}

Saturday, September 12, 2009

3 ways to loop into LINQ query output

This article shows us how to iterate into LINQ query output.
to know how let's see this example.

first let's say that we have this class


//Customer class
public class Customer
{
private int _id;
public int Id
{
get { return _id; }
set { _id = value; }
}

private string _name;
public string Name
{
get { return _name; }
set { _name = value; }
}

private string _city;
public string City
{
get { return _city; }
set { _city = value; }
}
}

//then we use object initialization to initialize a list of "Customer"
List<Customer> listofCustomers = new List
<Customer
>{
new Customer{ Id = 1, Name = "ahmed", City = "Cairo" },
new Customer{ Id = 2, Name = "mohamed", City = "Alex" },
new Customer{ Id = 3, Name = "Sameh", City = "Luxor" } };

//now we need to create our LINQ query
var query = listofCustomers
.Where(city => city.City.ToLower() == "alex".ToLower() && city.City.ToLower() == "cairo".ToLower())
.Select(s => new { s.Id, s.Name, s.City }).OrderBy(c => c.City);


now if we need to get data from our query we have many ways here will see 3 ways

1- First way (for loop):
------------------------
int x = query.Count();
for (int z = 0; z < x; z++) { Response.Write(string.Format( "ID = {0}, Name = {1}, City Name ={2}",
query.ElementAt(z).Id, query.ElementAt(z).Name, query.ElementAt(z).City));
}


2-Second way (List.ForEach):
--------------------------------
query.ToList().ForEach(obj => Response.Write(string.Format("ID = {0}, Name = {1}, City Name ={2}", obj.Id, obj.Name, obj.City)));


3- Third way (foreach):
-----------------------------
foreach (var obj in query)
{
Response.Write(string.Format("ID = {0}, Name = {1}, City Name ={2} ", obj.Id,
obj.Name, obj.City));
}