Operand for NSDecimalNumber
When I started to learn Objective C, that is hard to understand the NSDecimalNumber. I am C# and Java Programmer, in these languages, we used the primitive, such as integer and long, I can just use - and + as operand. However, in IOS, the most of situations, we are using NSDecimalNumber. That is an object. So, you cannot use + and -. If you write this, it will cause error:
Code
NSDecimalNumber *percent = self.tiprecord.tip/ self.tiprecord.total |
You should use such operands:
decimalNumberByAdding = +
decimalNumberBySubtracting = -
decimalNumberByMultiplyingBy = *
decimalNumberByDividingBy = /
For Example:
Code
NSDecimalNumber *percent = [self.tiprecord.tip decimalNumberByDividingBy: self.tiprecord.total ] |
Omni ROM in Galaxy S3
My Galaxy S3 is aging now. That is running Android 4.1 which is quite old. I flashed my phone with a new ROM. I chose OmniRom. That is very lightweighted and simple.
1.I turned off the phone, and then Press Power+Home+ Volume Down to enter a download mode.
2. I used Odin3 to flash the CF-Auto Root image, making the phone to be rooted. You can find those instructions in xda forum.
3. I used ClockwiseMod to flash OmiRom rom.
That is easy.
I got a "new" phone with Android 4.4!
I found the UI is basic and clean. Also, that is very smooth! The most important is the batter life improved a lot!
404 Error for 7z
If you upload a 7z file to an iis server and you try to load from web, then you got a 404 error. Even you checked the resource path is right. You are sure there is a file. Please check whether you have set the mime type for .7z file type. If not, please add "application/x-7z-compressed" for .7z. Then it should be work.
VPN Server Router - ASUS RT-N12
Sometime, I need to access my home network in Hong Kong. Moreover, in some cases, I need to make sure my clients' websites are accessible from oversea. So, I need a VPN connection in Hong Kong. Recently, I was in Hong Kong for more than a month. This times is a good time to improve my home network in Hong Kong. I bought a VPN Server Router , ASUS RT-N12. I love it. It has a Dynamic DNS service. I am using a cable service in Hong Kong, so I cannot have a fix ip. So, that is helpful to access the router from oversea. Also, it has PPPTP VPN, up to 5 users at the same time. That is good enough. I am in Australia. I have no problems to access my home network from desktop and phones via VPN! The most important things, it is only HKD$256!
Screenshot in Android
There are many apps can do a screenshot in Android. However, I tested a few of them. They required your android phone are rooted.
Well, most of android phones have a shortcut to do a screenshot.
If you are using Samsung phone, please try to hold home key and power button for a few seconds.
For other android phone, you should try to hold volume down button (some models using volume up button) and power button for a few seconds.
These two shortcuts are the most common way to do a screen shot.