Thursday, February 3, 2011

sms global user

WAP Push
http://www.smsglobal.com/http-api.php?action=sendsms&msgtype=wappush&user=USERNAME&password=PASSWORD&from=FROMNUMBER&to=TONUMBER&url=URL&subject=SUBJECT
SSL is available via the same URL but https://
https://www.smsglobal.com/http-api.php?action=sendsms&msgtype=wappush&user=USERNAME&password=PASSWORD&from=FROMNUMBER&to=TONUMBER&url=URL&subject=SUBJECT
This section describes how to send requests from the Client Application (Client) to the Messaging Exchange (MeX) and the possible responses to such requests.
The Client issues a HTTP GET or POST request to the MeX using a specific URL. The MeX issues back a response, which completes the transaction. Please note that the MeX response can either be an HTTP error code or a HTTP OK (200) in which case the returned response body will contain further information.
The Client supplies a number of parameters to the MeX in the request as described below.
PARAMETERDESCRIPTIONPRESENCE
ACTIONAction taken. Eg: sendsmsMandatory
MSGTYPESet to "wappush". Sends WAP link to the recipient's phoneMandatory
USERNAMEUsername for MP accountMandatory
PASSWORDPassword for MP accountMandatory
FROMNUMBERSource address (sender)Mandatory
TONUMBERDestination address (recipient) MSISDN should be on international format starting with country code. Example: 61409317436 (Do not use + before the country code!)Mandatory
URLThe URL to be pushed (must be URL-encoded)Mandatory
SUBJECTThe subject of the message (must be URL-encoded)Mandatory
EXAMPLE - SENDING VCARD
Username: USERNAME
Password: SECRET
To Address: +61 409317436
Subject: SMSGlobal's website
URL: http://www.smsglobal.com
http://www.smsglobal.com/http-api.php?action=ACTION&user=USERNAME& password=SECRET&from=FROMNUMBER&to=61409317436&subject=SMSGlobal's+website &url=http%3a%2f%2fwww.smsglobal.com
RESPONSES
Responses from the Messaging Exchange (MeX) are encoded in a HTTP response, which contain an status code according to the SMPP specification which is either 0 (OK) or an error code.
Response body includes one or, optionally, two lines:
  1. Contains the status code, 0 for success or otherwise a numeric value other than 0 indicating what error occurred.
  2. If present, contains a text describing the error that occurred.
SUCCESS / FAILURE RESPONSES
Example: Response indicating success
  0
  OK
Example: Response indicating failure
  ADD DETAILS
  Recipient (TONUMBER) is missing
Returns Status code If Status = 0 then returns OK:0 sent queued message ID; SMSGlobalID: MessageID (to use in Statussms)
If Status <> 0 then returns WARNING: Status code
Incoming SMS - Receive replies on your webserverIncoming SMS will be delivered to the URL specified in the preferences page once you have logged into your account. Check under the "Incoming SMS Settings" section.

The arguments are:
TO (which number the message was sent to)
FROM (the sender's MSISDN)
MSG (the contents of the message)
USERFIELD (the same INTERNAL ID submitted when sending the SMS that the incoming SMS is a reply to)
DATE (the date and time the message was received by SMSGlobal's servers)
e.g. if a phone is turned off, you will receive a DLR status with 107 Absent subscriber with the DONEDATE at the initial attempt to send the message, then when the phone is turned back on, you will receive another DLR report with the same message id with an updated status of DELIVRD, and the DONEDATE of the time the message was delivered when the phone was turned on.
So e.g. a url would be http://www.yourserver.com/receivedlr.php?to=TONUMBER&from=FROMNUMBER&msg=TEXT&userfield=YOURINTERNALID&date=DATETIME
Please respond with "OK" to complete delivery of the message. If SMSGlobal receives no response, we assume your server is down and continue to attempt to send the message to you.
Balancesms - Check MeX balance for the user account USERNAMEhttp://www.smsglobal.com/http-api.php?action=balancesms&user=USERNAME&password=PASSWORD

Possible error codes through API
Error code valueDescription
SND_TIMEOUT = "400"Send message timed-out
SND_TEMP_DISABLED = "401"System temporary disabled
SND_NO_RESPONSE = "402"No response from SMSGlobal SMSC
SND_BIND_ERROR = "13"ESME_RBINDFAIL - Can not Bind to MeX
SND_SMPP_ERROR = "8"ESME_RSYSERR - System Error
SND_SMPP_ERROR = "1"ESME_RINVMSGLEN Message Length is invalid
SND_SMPP_ERROR = "2"ESME_RINVCMDLEN Command Length is invalid
SND_SMPP_ERROR = "3"ESME_RINVCMDID Invalid Command ID
SND_SMPP_ERROR = "4"ESME_RINVBNDSTS Incorrect BIND
SND_SMPP_ERROR = "5"ESME_RALYBND ESME Already in Bound State
SND_SMPP_ERROR = "10"ESME_RINVSRCADR Invalid Source Address
SND_SMPP_ERROR = "11"ESME_RINVDSTADR Invalid Dest Addr
SND_SMPP_ERROR = "12"ESME_RINVMSGID Message ID is invalid
SND_SMPP_ERROR = "13"ESME_RBINDFAIL Bind Failed
SND_SMPP_ERROR = "14"ESME_RINVPASWD Invalid Password
SND_SMPP_ERROR = "69"ESME_RSUBMITFAIL Submit SM failed
SND_SMPP_ERROR = "88"ESME_RTHROTTLED Exceeded allowed message limits
SND_SMPP_ERROR = "102"Destination not covered or Unknown prefix

Friday, January 28, 2011

configure sql for using membership and roles in the website


sp_configure 'user instances enabled' , 1
reconfigure


Tuesday, January 25, 2011

the Service Controller,


the Service Controller, is opened by entering "sc' into the command prompt and contains a large assembly of subcommands that we will survey.The command-line method of managing services has the advantage of being available for scripts. It also allows for quickly stopping and starting services for troubleshooting purposes. Systems administrators use it for managing services on networks and for very detailed configuration. For the average PC user, it provides a quick and easy way to turn services on and off to see how system performance is affected.

The SC subcommands

The "sc" command comes with numerous subcommands. A list can be seen at the this Microsoft page or by entering "sc /?" into a command prompt. There is also a list in the Windows XP Help and Support Center. Altogether, 24 subcommands are listed. Each subcommand in turn may have a subset of different commands. The table below shows a selection of the subcommands and their functions that are of most relevance to a typical PC owner. Much more detailed information is available at the XP Help and Support Center by searching "sc".
Table I. Selected subcommands for SC
CommandFunction
sc configConfigures service startup and login accounts
sc continueResumes a paused service
sc enumdependLists the services that cannot run unless the specified service is running
sc failureSpecifies what action to take upon failure of the service
sc pausePauses a service
sc qcDisplays the configuration of a particular service
sc queryDisplays information about the specified service, driver, type of service, or type of driver
sc startStarts a service running
sc stopSends a STOP request to a service (not all will respond)

Examples of some useful ways to apply SC

The suite of commands that are available are very powerful and allow for much configuring of services. Although not all functions will be of interest to the average PC use, some are applicable to everyday experience. You can learn if a service is runninng, stop, start. or pause it, and determine if it will run when the system is started up. Here are examples of some commands that I think might be of interest.
sc config
This command has a number of functions but one is to determine the status of a service at system startup. A service can be set to run automatically, manually or not at all. The commands aresc config ServiceName start= flagHere ServiceName is the name of the service and flag has one of the values autodemand. or disabled . For example, to set a service to run manually the command issc config ServiceName start= demandNote that there must be a space after the equals sign. The correct value for the parameter ServiceName may not always be obvious and the next command can be used to find it for all services.
sc query
Information about services and drivers can be obtained with this command. Used alone it returns a list of running services with various information about the service. Lists can be inconvenient to read on a screen and they can be redirected to a text file. To create a text list of running services use the commandsc query > serviceslist.txtThe path for the text file serviceslist.txt can be anywhere that is convenient. To create a list of all services, usesc query type= service state= all > allserviceslist.txtTo create a list of active drivers, usesc query type= driverOr for a list of everything, usesc query state= all
sc start
To start up a service that is not running, usesc start ServiceName
sc stop
To stop a running service, usesc stop ServiceNameHowever, some services cannot or should not be stopped.

Tuesday, January 18, 2011

Class implementing Multiple Interface with same method

 public interface ITestA
    {
        void Calculate();
    }
    public interface ITestB
    {
       void Calculate();
    }
    class InterFaceTest: ITestA , ITestB
    {
        public void Calculate()
        {
            MessageBox.Show("Class Method");
        }


        void ITestB.Calculate() //SCOPE INTERNAL
        {
            MessageBox.Show("Interface B");
        }
        
        void ITestA.Calculate() //SCOPE INTERNAL
        {
            MessageBox.Show("Interface A");
        }
      
    }





   InterFaceTestobj = new InterFaceTest();
            obj.Calculate();
            ITestA objA = new InterFaceTest();
            objA.Calculate();
            ITestB objB = new InterFaceTest();
            objB.Calculate();

Wednesday, January 12, 2011

new year resolution

My new year resolution for 2011


  • Buying a Laptop with in July
  • Write MCTS exam
  • Improve hands on experience in Web Development
  • Learn more and practice in System Design Phase 
i hope i will come with a large list next year. 

Sunday, January 9, 2011

How to insert into a table with just one IDENTITY column

Credits : http://stackoverflow.com/questions/850327/how-to-insert-into-a-table-with-just-one-identity-column 

Create table singleIdTable ( nId int identity(1,1))
insert into singleIdTable Default values
Select * from singleIdTable 

Thursday, January 6, 2011

Pivots with Dynamic Columns in SQL Server 2005

article source : http://www.simple-talk.com/community/blogs/andras/archive/2007/09/14/37265.aspx

 Andras

Software Architect - Red Gate Software

Pivots with Dynamic Columns in SQL Server 2005

Published Friday, September 14, 2007 9:28 AM 

Pivots in SQL Server 2005 can rotate a table, i.e. they can turn rows into columns. PIVOTs are frequently used in reports, and they are reasonably simple to work with. However, I've seen quite a few questions about this operator. Most questions were about the column list in the PIVOT statement. This list is fixed, but many times the new columns are determined by the report at a later stage. This problem is easily solved when we mix pivots with dynamic SQL, so here is a very simple example about how to dynamically generate the pivot statement:
PIVOT allows you to turn data rows into columns. For example, if you have a table like this (I use only three months here for simplicity):
CREATE TABLE Sales ([Month] VARCHAR(20) ,SaleAmount INT)

INSERT INTO Sales VALUES ('January', 100)
INSERT INTO Sales VALUES ('February', 200)
INSERT INTO Sales VALUES ('March', 300)

SELECT FROM SALES
 

Month             SaleAmount
----------------  -----------
January           100
February          200
March             300 

Suppose we wanted to convert the above into this:
 
January     February    March
----------- ----------  ----------
100         200         300

We can do this using the PIVOT operator, as follows:
SELECT  [January]
      [February]
      [March]
FROM    SELECT    [Month]
                  SaleAmount
          FROM      Sales
        p PIVOT SUM(SaleAmount)
                    FOR [Month] 
                      IN ([January],[February],[March])
                  ) AS pvt

However, in the above example, I have the column names fixed as the first three months. If I want to create a result in which the columns are dynamic (for example, they are read from a table), then I need to construct the above query dynamically. To demonstrate this let’s look at the following example:
In the first table I have the column names I want to use:
CREATE TABLE Table1 (ColId INT,ColName VARCHAR(10))
INSERT INTO Table1 VALUES(1, 'Country')
INSERT INTO Table1 VALUES(2, 'Month')
INSERT INTO Table1 VALUES(3, 'Day')

In the second table I have the data. This consists of a row identifier (tID), a column ID (ColID) that refers to the column type in Table1, and a value:
CREATE TABLE Table2 (tID INT,ColID INT,Txt VARCHAR(10))

INSERT INTO Table2 VALUES (1,1, 'US')
INSERT INTO Table2 VALUES (1,2, 'July')
INSERT INTO Table2 VALUES (1,3, '4')
INSERT INTO Table2 VALUES (2,1, 'US')
INSERT INTO Table2 VALUES (2,2, 'Sep')
INSERT INTO Table2 VALUES (2,3, '11')
INSERT INTO Table2 VALUES (3,1, 'US')
INSERT INTO Table2 VALUES (3,2, 'Dec')
INSERT INTO Table2 VALUES (3,3, '25')

Now I would like to retrieve data from these two tables, in the following format:

tID         Country    Day        Month
----------- ---------- ---------- ----------
1           US         4          July
2           US         11         Sep
3           US         25         Dec 

In other words I want to turn the data rows in Table2 into columns. If I had a fixed set of columns for the result, i.e. the columns Country, Day, and Month were fixed, I could use SQL Server 2005’s PIVOT operator in a query like:
SELECT  tID
      [Country]
      [Day]
      [Month]
FROM    SELECT    t2.tID
                  t1.ColName
                  t2.Txt
          FROM      Table1 AS t1
                    JOIN Table2 
                       AS t2 ON t1.ColId t2.ColID
        p PIVOT MAX([Txt])
                    FOR ColName IN [Country][Day],
                                     [Month] ) ) AS pvt
ORDER BY tID ;

However I need to construct this query dynamically, because the column names Country, Day, and Month are specified in a table, and can be changed independently from my query. In our case these columns are given in Table1.
In the first step to generate the final pivot query I need to create the list of columns, in this case [Country], [Day], [Month].
Since there is no string concatenation aggregator in SQL (a concatenation aggregator would not be deterministic without some order restriction), and since the column names are stored in rows of a table, I need to flatten these columns into a single row or variable. There are various solutions to achieve this. One solution would be to use a query like:
DECLARE @cols NVARCHAR(2000)
SELECT  @cols COALESCE(@cols ',[' colName ']',
                         '[' colName ']')
FROM    Table1
ORDER BY colName

This query works both on SQL Server 2000 and 2005. It is efficient, but some may not like it because it uses the same variable (@cols) on both sides of an assignment. Another solution that works on SQL Server 2005 only is to use XML PATH.
DECLARE @cols NVARCHAR(2000)
SELECT  @cols STUFF(( SELECT DISTINCT TOP 100 PERCENT
                                '],[' t2.ColName
                        FROM    Table1 AS t2
                        ORDER BY '],[' t2.ColName
                        FOR XML PATH('')
                      ), 12'') + ']'

This second query (I’ve seen this posted by Peter Larsson) has the advantage that it does not use the @cols variable on the right hand side. I like this solution more, since this can be extended as a general string concatenation aggregate in more complex queries.
Both of the above queries generate, from Table1, the string: ‘[Country],[Day], [Month]’. This column list is used twice in the pivot query that we aim to construct. Once it is use in the list of columns that we want to retrieve, and once it is used as the list of values that should become columns. Having constructed this list of columns above, we can just concatenate it with the missing parts of the pivot query like:
DECLARE @query NVARCHAR(4000)
SET @query N'SELECT tID, '+
@cols +'
FROM
(SELECT  t2.tID
      , t1.ColName
      , t2.Txt
FROM    Table1 AS t1
        JOIN Table2 AS t2 ON t1.ColId = t2.ColID) p
PIVOT
(
MAX([Txt])
FOR ColName IN
( '+
@cols +' )
) AS pvt
ORDER BY tID;'
Executing this with
EXECUTE(@query)
will give us the expected result: a table that is pivoted and shows columns that were specified in a table:
tID         Country    Day        Month
----------- ---------- ---------- ----------
1           US         4          July
2           US         11         Sep
3           US         25         Dec