AdSense

Sunday, May 12, 2013

Getting SMS Deliver Notification from SMS Center using AT Command

I have been working on the SMS Application that would send and receive SMS using USB modem through serial port using AT Commands. During the development, i stumbled upon getting SMS Message Deliver Confirmation Status Report from the SMS Service Center. After much googling, and hit and trial, i could finally get the status report. Thus, i wanted to share my part of experience with the hope that it would make some one else's work a little bit easier.

For the Text Mode:
  1.  AT+CMGF=1
  2.  AT+CSMP = 49,167,0,242 
  3.  AT+CNMI = 1,0,0,1,0 
  4.  AT+CNMI = 2  (This was how i could set the correct values. I used ZTE Modem  and Nepal Telecom SIM card)
After setting up the Notificaton setting, you can send the SMS using AT+CMGS="PhoneNumber" and wait for few seconds to get the delivery status report from the message center.
A successful delivery report will have error code "0" at the end.
+CDS:6,72,"9851111111[PhoneNumber]" ,129[Message ID],"05/12/13,13:16:18+22"[Time Stamp] , "08/11/17,10:16:21+22" , 0[Error Code]

For the PDU Mode:

PDU gives you better leverage over text mode, as you can edit different SMS Submit headers. While working on Text mode, I was unable to send SMS to CDMA network from a GSM network. Later, switching to PDU mode made made it possible. So if you too are having problem sending SMS, from GSM network to a CDMA network, you can try switching to PDU mode.
To get the message deliver status report in PDU mode one  need to edit the TPDU parameters.
Let's take an example of sample TPDU SMS Submit code:
0031000A9189151111110000AA0CC8329BFD065DDF72363904
It's a hex code that has a message "Hello World!", destined to number "9851111111". I assume that you know the different meaning that the values of parameter determined.
The first  sub field "00" dictates modem to use SMSC number assigned by the SIM itself or by AT+CMSCA command. The second sub field "31" is the one that we are looking for. It says the SMSC that the message is of SUBMIT type and a delivery status report is requested from the SMSC about the SMS.  Rest, i believe, the reader knows the meaning and value of each sub field. For interested ones, a good tutorial about the SMS Submit PDU can be read here.

That's it. Now, for every SMS sent, we get a delivery report from the SMSC center, and can be read from the serial port. We can parse the Delivery report for further purpose such as error check or know SMS status.

Saturday, October 22, 2011

BIPPA Treaty,is it risk worthy to be taken ?

We need to take risk, but prudent one would take a calculated risk. If we just wanted to play dice, well we can pick a gambler and send him to Las Vegas.
Politically, our law can't handle people like Jammarkattel and Parshuram. Even the very same PM Babu Ram Bhattarai, defends accused murderer and creates haven for criminals proven guilty by court.Impunity is on rife.So its suicidal to provide insurance against this very thing that we all know is protected by politicians according to their interest. PM BRB bold claim to sort things out in order is skeptical with his current actions and ironically his government fate's is undecided after Mangshir 14. The UCPN Maoist party that the Premier represent, itself, has taken hold of properties during the insurgency period, which they are reluctant to return. The Surya Nepal Garment just got closed because of the protest and strike called by Trade Union affiliated to the PM's Maoist party. Upper Karnali Project is still being obstructed by local Maoist cadres.The facts and figures just doesn't match the statements and rhetoric. Sad but true!

Economically, large foreign investment,flooding from India, will be a threat to the mediocre and cottage industry of Nepal. Indian money will make it hard to compete for Nepalese. Investment must be controlled and monitored according to national interest, not that we let em enter blindly and give em license to mess around with economic structure.With this increase dependency on single "India" factor, we might not be planning our economy right.We are behind, and we need to rebuild our economy from the base root, not from the top. May be if the same protectionism is given to the domestic company and investment for a time being, we could see different result. Why not experiment first in our own country for our own entrepreneurs.
Its good to be optimistic,but when signing long term treaty that affect mass, may be there should have been proper study,at least of current scenario to next 5 year position. May be BRB was in haste to sign the treaty during his premiership.
The politics is bleak, the peace process is fragile. Economy is stagnant, Corporatism is greedy.
We dont want our tax money to flow southward along with our river.

Tuesday, July 26, 2011

Recovering SMS/Text Message from iPhone!

So you have deleted a SMS (Swipe - Delete) just to find out later that it had some important info and you jumped into this page after hustle Googling for How to :) .  Hush, you can get the SMS text content, provided, you haven't synced your iPhone, i.e, you haven't synced or updated your iPhone after the moment you have deleted your message.


1. Connect you iPhone to the computer MAKE SURE it doesn't gets sync automatically. (In my case, luckily, i had unchecked Open iTunes and Sync Automatically when connected).If you aren't that lucky, then try brute aborting sync the moment you connect your iPhone. Good Luck! :)


2. Once your iPhone is connected, Right click your iPhone(name) and click Back Up(Only).


3. After the backup is done, navigate to the back up folder, i.e ( "C:\Users\\Roaming\AppData\Roaming\Apple Computer\MobileSync\Backup\") and double click the backup folder .( note: the modified date of the folder will be of today )


4. There you will find list of different back up files, search for the file that starts with "3d0....". This file name too will be of modified date today. Since you just backed up the iPhone.


5. Open the file in Notepad++, and search the text content with the "Senders Name" or any part of the SMS text that you remember.


6. Voila...you will find your the deleted SMS Contents there.


Disclaimer:I cannot guarantee the success of this process. For me, I followed this process on my iPhone4 32 GB Black,running on iOS 4.2.1 Powered by DevTeam with iTunes 10.2.1 on Windows 7.


Also i found a great method to backup all your SMS to a new database table archive, so that you can find your SMS there no matter what CRUD action you do with the default Message DB table.
For this you need to have have your iPhone Jailbroken (See here). 


Steps:

1)  Download "iPhone Browser" from here. Connect your iPhone and navigate to (/private/var/mobile/Library/SMS/sms.db). Copy the sms.db to  desktop.

2) Open the SMS.db (I used SQLite Manager for Firefox which is free, you can use "Sqlite Browser") select “message” table then right click and select “Duplicate Table”

3) You’ll get a new table called “message_copy” select and rename it to “shadow” (or any other name you want)

4) Scroll down to “Triggers” option in the left, right click and select “New Trigger” once new window apperas select “message” in the drop down “Table Name”

5) In option “Fire” select “AFTER” then “On Event” option check “Insert”.

6) Click now on the upper tab called “Body”, erase all the content an copy this:

BEGIN
INSERT INTO shadow (address,date,text,flags) VALUES (new.address,new.date,new.text,new.flags);
END

NOTE: Pay attention the "INSERT INTO...." line ends with a ";"


7) After that select “Save” in the menu options and give a name to the trigger (I choose “insert_shadow”)
8) Now, close the "SQLite Manager" and put the sms.db modified again in the iPhone (You´ll receive an Overwrite warning…select YES)
9) Reboot  your iPhone.




This process was given by @Hugardo_ar in the comment section of this post. This will make a copy of every incoming or outgoing sms in the new Shadow Table. So you can always go to sms.db, open it with SQLite Manager and browse and search the "shadow" table to get the SMS content no matter what you did with the original copy of SMS in "message" table.


Happy Tweaking!

Sunday, May 29, 2011

One Love, One Heart, One United!

I was pumped up from the very beginning of the day May 28,2011. It was Manchester United vs Barcelona at the Wembely , the long wait was just hours away. After a usual lazy Saturday afternoon,made up my mind to see The Hangover II, along with my peer, Niraj and Yangma. So headed my way out to QFX Jai Nepal for evening show. The movie plot and flow was ditto to its predecessor, but still enjoyed it, especially the last photo stream part :)
Then we went to Pulchowk to meet my Grand Old Party of Manchester United Supporter and Football Fanatic, at Chapro number 1.The environment of Pulchowk Campus was already splurged with football and  the CL Final had gripped hard every one of em.I had a quick ride to my flat at Talchikhel, bought some R-OH on the way, boozed with friends and then returned to Pulchowk campus all set and ready for the match.
Barca did control the game with their copious ball possession. They scored first we leveled with "Wazzza" goal. But that wasn't enough, they outplayed us with all the short passes and possession, we couldn't get into our normal game, playing from the wing and passing into deep. We lost the game 1-3. I would like to congratulate all the Barca fans for their win, esp. Tsuman Bhai, the one true fan of Barca i've known.Congrats to all the fans who truly loved Barca as the only one team and not as option, who stayed up late night just to watch the Barca play in La Liga, like we did to see Man United play in Premier League. At the moment, Barca re near to invincible with perfect team set  up and game play. Barca deserved the win, we couldn't perform our game and we were punished.
But, we did had a successful 10/11. With 7.5 mils signing of lil' pea "Hernandez", we won the premier league for 19th time. The history making in Premier league and the dream of SAF when he joined Manchester United 25 years ago, to knock Liverpool off their perch.We were the one to go to Wembely and play the CL final with another best team. We gave a match we fought till the very end of the road, till the last battle. We are proud and we will remember yesterday night forever cause we were supporting and cheering for our dear team. Win or Loss we always had belief and we always will!
All other United haters, your fickle capricious love for Barca, you just got that one flick happiness. All you did was jeer United. You were supporting Barca cause you're own fucking team couldn't make it to Wembely for the CL final.Face it, United were there, with their glorious crest on their chest,competing for the Silverware, playing in the final of world's best tournament. Whereas your team were nowhere. Even if we lost, we will have the memories and feelings with us for the rest of the life, cause WE CHEERED FOR OUR BELOVED, and you were there to jeer for the one you hate. Big fucking difference!
We stayed at the Bijendra's restro till all the workers slept and the bar went dry. There were post match discussion, and usual drinker's talk about love , life and politics. All of sudden i took em all far a ride from Pulchwok to Bhaisipati at the wee hour. As soon as we reached Bhaisipati, the light transcended the darkness,and then there appeared the aurora. Looked like it was just waiting for our arrival! The sky was drenched with dawn's aura, the hills of Dakshinkali and Champadevi were painted blue, and the deep distant  retro "newar gaun" was hidden in the mist. The scene was simple awe ! I savored every bit of that beatific moment of the mother nature's live art! Was thankful for this beautiful life, and remembered the awesomest night i had had!
See you all football lovers at the next season. One Love, One Heart, One United! Man United! We'll be back!
Here's to the beautiful game in this living planet, Football, to all the haters lovers newbie pundit, the one with lots of fav team and the one with single heart! Cheers!

Wednesday, March 16, 2011

Dear MoFA and Nepal Government!

I was a day late when i went to Ministry of Foreign Affairs (MoFA) for my Machine Readable Passport (M.R.P), because overnight MoFA had appended a new node in its lists of rules, and so now i had to get some signature and official stamp from District Administration to authenticate that i did indeed acquired my citizenship from Jhapa(my hometown). Well, the original citizenship wasn't of enough proof of element for the MoFA to believe. I returned, disappointed and furious over the out of blue rule and irrational new MoFA rule. Now, i had to schedule a visit to Jhapa, not to get my passport but just to get the official stamp.
Today, i went to Central Passport Department,MoFA, with all the necessary credentials, and with high hope of getting through, in submitting my request form, to get a Nepali Passport. But, i did had some doubt,that i might not be successful this time too with the public rambling and gossiping. The queue for the submission of form was a mass of people, all swerved  and jam packed to form a structure of giant serpent. The office was supposed to be open at 9:30 but was 45 minutes late, and after waiting for 4 hours,i got my turn, just to know that my Photo was not according to the criteria. Damn! I rushed outside of office hastily, followed a broker to his photo studio and paid 175 for 8 pieces of PP photo. On my way back the door to the office was closed,and there was another huge line of those who had been returned citing failure in meeting different criteria on filling up the form. Waiting for another 45 minutes,after the office resumed from lunch break, i finally submitted my form, just to get it rejected second time in a day. This time the form wasn't of the right aspect ratio and size. WTF! If only they would have told it earlier, i would have change it together with the photograph, rather than waiting with reckless mind and abominating the late workers of MoFA. After much hustling, i was finally able to make my form accepted and got a date of 8th of Baisakh,2068. Literally, i felt like winning a war, like i just solved a baffling numerical.
*************************************
And now i wanna wax lyrical about our dear MoFA and its MRP procedure based on my experience. Seriously you guys have lots of bugs on your work flow chart. It's totally unplanned and mess like a spaghetti structure, so that we the people suffer from the processing. MoFA being a governmental office, should have analyzed and planned the best for the smooth and untangled service to the people.MRP distribution to all the people of nation from a singular source is utter nuisance. After much abortive effort, abeyance,political artifice and a national drama government finalizes the MRP deal, and all they can do is get a single machine, or the number we the people are not aware of, but certainly, number so less that they cannot afford it to send to other districts. Or is it the technical manpower to operate it ? If it is so, why wouldn't they calculate it before. They had lots of futile period, at least during that time span, they could do some simple secondary mathematics to calculate the number and give the training or hire the people.
If the number of MRP Machine is low, at least they can get 4 more machines for other developmental region. At least that would make people from Darchula or Olangchunggola not to come to Kathmandu, to get the work done that could be done with 10 times less spending. Our government surely doesn't have enough principal amount to get 4 more MRP Machine, to generate electricity, to make suspension bridge on remote place, but they do have some special reserve to give incentives and bonuses for workers who give most pathetic services to people, for the lavish incoming and outgoing party of 3 prime minister in 3 years, to all those legislative members who goes on abroad visit to study federalism, from England to Ethopia, and yes their extra wage for parliamentary meeting with no concrete agenda. Speaking bluntly, you can ask help or more bluntly cry a river, to China and India to make yourself PM, but you cant on national matters that would be beneficial to people. If you  have any ounce of feeling left, to serve the nation, ask some dough to get some more MRP's or to train some more of your obtuse civil servants on using MRP. You dont feel shame on sending your MoFA  official to get trained on diplomacy from another nation. Why shame on asking some dough and technical training. On this note, how ludicrous is it for a nation's MoFA to get training on DIPLOMACY from its neighbor .
What's with the authentication of Citizenship. Cannot different governmental ministries work along for the sake of people's welfare. Why wouldn't MoFA think it's need before hand, and at least collect the citizenship data record and save it centrally for the reference ? Does government enjoy annoying people ? When will the KOICA funded Data center come into any use, if we cannot get Citizenship data on central grid server ? And they talk big about National ID and eGovernance. For tech shake , eGovernance doesn't mean having unaligned and poorly designed websites online and giving PDF's of load shedding and form to download.

All that said blatantly, some of my suggestion would be:

If our dear MoFA is all broke, cannot accumulate money from any of its source and cant get any monetarily support from any donor, why not accepting form from all the District Administration, center collecting it weekly or fortnightly, and deliver it accordingly. This would really save lot of time and money for the people. They would submit the form and get passport on their respective district head quarters. After all it takes MoFA at least a month to serve the passport even when its submitted in KTM. They would wait 15-30 days more if they can get it on their own home district.
If that too is not possible, please shift from you current warm and cozy place. Get a goliath auditorium with ample space. Make several booth over there so that there are many server to serve the people according to the request.This will certainly make current processing less tedious and much ease. Get at least three help desk to check the form correctly before getting in line so that one doesn't have to return disappointingly after queuing for so long. If the resource isn't there for the aforementioned work, hire some temporary workers. After all our nation do have lots of fresh and old graduates who are unemployed and ready to work to put something on the CV. Thanks! to the government, again for that scenario.
Well, we would really love to see our hard earned tax money go into something atleast creative that would make us feel, we were well served. Not just on so called VVIP's security and their "Sawaris" which backfires back to us, very badly!

Tuesday, March 8, 2011

Night at Office

The inception of idea came out of Tsuman bhai, one hell of staunch supporter of Albiceleste and Lionell Messi. The idea was in embryonic stage, and then the NTC internet starts acting total lazy bum during the day time. I became skeptical about any good progress in the speed, as there had been problem with it since couple of days. But, the speed increased gradually towards the evening, and then I finally decided to join Suman and Suraj bhai, for a stay at office for tonight, to watch Barcelona vs Arsenal :)
After finishing official work hours, stayed late in the office just flipping around internet. Later around half past seven, took a walk to Sundhara from Kalikasthan. Tried to take some photos on my way, only to find out that, can't make my iPhone4 to take some good shot for night photography :( . After voraciously devouring Thakali Khana Set, took walk back to Office. It was great to walk along the streets lights and cross the over head bridge after a long time. I hadn't done that since i don't know when, may be about 2 years ? Kathmandu was glowing with red and yellow traffic lights,all of them in haste.May be returning home or may be searching for home away from home.
Back at office, the download of "Sudden Impact" was complete. I wanted to watch this movie for two reason, AFI Top 100 movie quotes "Go Ahead...Make my Day" and of course, Clint Eastwood. The movie seemed to be some old school Hollywood flick ( sorry, growing up in Nepal with limitation to Doordarshan :P ).I know in fact, it's the reverse that's true.The story was about, bad ass yet persistently  dutiful cop,a rape victim,a mysterious murder series,and  vengeance the cause. Sounds like 90's Bollywood masala , don't it ? But i did enjoy the movie, Clint Eastwood act itself and some nifty punch lines.
Well, it's about 1:00 AM in my PC clock. I have been in front my work PC, in this same working environment, in my same ergonomic chair, my Dell Screen tilted in same orientation from 9:00 AM yesterday morning. All of this , to get to watch some beautiful game ahead, and yes courtesy of Nepal Electrical Authority,the only disciplined institution of our entropic nation. Never fails to cut the power and give the power in the just scheduled time.
So i don't want any less then 1 or 2 awesome magical goal from the wonder boy Messi if Barcelona is to win. Or else, i would be happy with Arsenal winning too. This will make their upcoming schedule as tight as Man United :) . Can't help ignoring the fact that, they're neck to neck with us in the league. Said that, since both the team are famous for their beautiful game( which i just can't agree in case of Arsenal (-; ), i want my stay at my office, just to watch these clash of humongous team to be one hell of thrilling an enticing.Let it be Extra time, Penalty, many goals, awesome goals.
All for the shake of Football. Who says football is not a religion ? I say it's bigger than religion!
Now i'm off to watch , Suman bhai already got a live streaming channel and he's been beckoning me.

P.S: gonna experience sleeping in the couch too later.
------------------------
Edit1: What a wonderful goal by Messi. Can anyone do that ? Flick the ball dodge the keeper and hit the net. Looks like playing #FIFA11. That one moment was worth waking up all night. Adios Arsenal. Though , the second yellow was kinda lame decision, who gives a rat ass for Dobbin Van Horsie :) ! You guys weren't never in the game.
Good night!

Monday, February 14, 2011

Jailbreak and Unlock iPhone4 on iOS 4.2.1

I Jailbroke my iPhone 4 yesterday smoothly with charm, without any set back :). I went through many blogs and posts before doing this. Now i've done it, hope this post will help other newbies to Jailbreak theirs.

Firstly, get all the necessary files sorted out in one folder.It includes:

Once you have all of the above files sorted fasten your seat belt and get ready to Jailbreak :D
If you need the iPhone to be unlocked to use(because you don't have/use official SIM carrier), make sure you have base band 01.59.00. (Settings->General->About->ModernFirmware). This is a must. You cannot unlock you iPhone with ultrasn0w for now if you have updated baseband other than 01.59.00. Have patience and wait for a while , while the dev team releases the new version of ultrasn0w.
Now, once you got it figured out, lets update to iOS 4.2.1 preserving your current baseband 01.59.00.For this:
  1. Backup your iPhone so that you don't loose your old data
  2. Run Tinyumbrella and close down the iTunes.
  3. Save the SHSH blobs for future downgrade if something goes wrong.
  4. Start the TSS Server
  5. Connect your iPhone.
  6. Double check that the TSS Server is running well.
  7. You can also check you hosts file(\\system32\\dreivers\\etc\\hosts) to see whether: gs.apple.com is directed to Saurik server or not.
  8. Once it is all fine, open iTunes and click (Shift+restore for Windows) and browse the .ipsw file.
  9. Wait for some minutes until the iTunes finishes restoring. After that you will be prompted with 1013 error.Click OK and then exit iTunes.( You will see a Connect to iTunes picture in the iPhone screen)
At this point, you have successfully upgraded your firmware preserving your older baseband. Now you need to jailbreak your iPhone.
  1. Now you need to enter the DFU Mode for this:
    • Press both the Power and Home button until the screen goes black.
    • The moment screen goes black, wait for about 2 seconds(approx.) and then release the power button, but keep pressing the home button.
    • You will see a black screen if everything goes well. This means you entered the DFU mode. Or else you will go back to "Connect to iTunes Picture".
    • This is a little tricky so you might need to give it a try for more than few times(as for my case)
  2. Once you've entered the DFU mode, run Greenpois0n,and then hit "Jailbreak".
  3. It will take a while.You will see a cmd shell screen in the iphone screen , saying "greenpois0n intialized".
  4. After the jailbreak is done, your iPhone restarts with a greenpois0n icon at startup. You will end up with "Emergency Call" screen in different language. :)
That's it. You have successfully Jailbroken you iPhone4. Now you need to activate the iPhone.For this:
  1. Switch off your iPhone and run redsnow.
  2. Follow the steps, and then check " Install Cydia" only. And nothing more.
  3. Click next and hit the Jailbreak now.
  4. redsn0w will go through jailbreak steps but it will not alter your greenpois0n jailbreak but just adds Cydia on your iPhone and Hacktivate/Activate your iphone.
  5. Once it is complete,your iPhone restarts and  you will be able see the Springboard in your iPhone with Cydia installed.(You can remove the Loader app that was installed by greenpois0n. Just open loader and click "Remove Loader")
Congrats! You have completely jailbroken and activated your iPhone. Now to unlock your iPhone with ultrasn0w.
  1. Go to Cydia->Manage->Sources
  2. Press Edit-> and then add-> "repo666.ultrasnow.com" and click Add Source.
  3. Cydia will download the package. Once it is completed go to the package and Install "ultrasn0w"
That's it, when it is completed, your iPhone will start searching for network regardless of  any kind of SIM. Enjoy the limitless boundaries of your iPhone.

**************************************

I hope this will help people who doesn't live in the States or Europe or any other official iPhone seller nation but want to use it. Like my country Nepal. It's useless to pay 2-3 K for some other person to Jailbreak and unlock your iPhone when the "Chronic Dev"/ "iPhone Dev" releases it for free to the community. If you want to pay, let the donation go to them the real brain rather than other third person who monetize it.
Cheers!

Friday, December 3, 2010

iPhone 4 : Invalid Sim Falilure for the Jail Broken ones!

After getting my hands on iPhone 4, all i have been doing for two days is researching on Jailbreak and Unlock. All the JB apps, Limera1n, ultrasnow, tinyumbrela.
Like others JB iPhone owners i am having two problems:
1. Battery Drainage : The battery gets fucked up real fast even without using the phone, but connected to WiFi.
2. Invalid Sim error: Whenever i try to restart the iPhone, i get invalid SIM failure.

I still haven't found out any good tips to cure the battery drainage problem. Well some say it's a jailbreak issue and will be fixed sooner, so hold on and be patience.
Out of blue, i think i have found the cure for the invalid SIM error, with brute Hit and Trial one. It has worked for me, hope it will for you lads too.
  • Before switching off the iPhone make sure you disable the following things:-
1. Turn off the WiFi in Settings.
2. Turn off the mobile data (Setting->General->Network)
3. Disable the 3G ( Setting->General->Network)
  • Switch off the Phone, and then Power on back.
  • Hopefully, you might not get the SIM Invalid Failure message ;-)
 Try it out, and do write the comment if it worked for you or not.

Happy Jailbreaking!

Thursday, October 8, 2009

I Miss You!

I Miss You !

Summer Eve,Sitting on the balcony wandering at the clouds
blowing with the wind,every shapes resembles you.
The moon playing hide and seek has finally risen,
Bright and Beautiful, Oh I miss You!

The lightening at distant horizon catches me now and then,
seems like you're too missing me even sky is in pain.
Cool Northern Breeze whooshes by,and there's music in the leaves,
silhouette under the moonlight, Oh Nature thee Artist.

I want to embrace you in these arms of mine,
Hold you under the starry nights.
Stroll on the gravel pavement with fireflies illuminating the way,
Kiss you and love You, and forget all the fray.
Sing you a lullaby just to watch you sleep,
tuck you with the velvet cloth, just to repeat as it slips..

With every thought...
I feel your touch, i feel your love.
I feel You......and i miss you even more.

- Bishwa Hang Rai