Posts

Oneplus 5T Flashing from Hydrogen OS to Oxygen OS

Image
How to Convert Hydrogen OS to Oxygen OS in One plus 5T I just bought One Plus 5T, Is very easy but it will be hard if you did the wrong thing (that me ).
I have done many mistakes from converting the Hydrogen os to Oxygen os.  But I try to let you all avoid the mistake I have done.

Ok, First download the Oxygen OS from the official website. (link: http://downloads.oneplus.net/devices/oneplus-5t/)



(VERY VERY Important)  After finishing download from the website. Open the PowerShell.  (Win + R => Type in "Powershell" => Enter)
Then try to locate the zip that you have just download. 
then type in the following in the PowerShell.
Get-FileHash <filepath> -Algorithm MD5
(Replace the <filepath> with the file path of the zip you just download.
Wait the result come out. The value must same as the value of md5 hash show on the website. If not same then redownload the rom.






Then you need to create a hash file and name it as the name of the file "<filename>.md5…

Disable Shutdown button

Image
I accidentally shut down the remote server, so  I was looking for a way to disable the remote user to shutdown.

There is a method to prevent the user to shutdown according to user and access but I do not recommend it.

Below is the method to disable shutdown:

1)  (Win+ R) Run "gpedit.msc"














2) go to User configuration => Administrator template -> Start Menu and Taskbar


3) Find "Remove and Prevent access to shutdown, Restart ...." and double click

4) You will see the setting is not configure

5) all you need to do is click enable and apply. Done


That simple. you should not able to see shutdown and restart. However, you can do it with command prompt or set the setting back to not configure.

PS: shutdown -s now


Feel free to leave a comment below if you have a better solution! Thank you ~~




Content Security Policy CSP

What is Content Security Policy?
Content Security Policy is internet security standard to prevent the known attack like Cross-site scripting XSS, click hijacking and code injection. For example like, if your visiting website is http://www.example.com  then you only able to access the data come from http://www.example.com, others URL or script and CDN like http://google.com/jquery.js also will be blocked.

Beside that, it also contain some inline script <button onclick="testing()">Click Me!</button> will also be blocked. unless you do some configuration on the header.


In short, it will do the following:
1) Whitelist to tell the client (Normally is Browser) what's allowed and what is not allowed.
2) Learn what directives are available
3) Learn the keywords they take
4) Inline code and eval () are considered harmful
5) Report Policy violations to your server before enforcing them.



How to implement Content Security Policy (CSP)?
<system.webServer> <http…

Step to Configure Php and Apache at windows

Image
Configure PHP and Apache windows 10  This configuration guide is using Php 5.6 and Apache 2.4 for 32 bit on windows 10x64.
I do this installation because of Laravel PHP framework but this guide won't touch about the Laravel.

There some binaries that you might need to take care but I not gonna touch that at here either. If any question you can leave your comment below.



1) DOWNLOAD AND INSTALL APACHE  First, you will need to download apache, and I gonna use Apache Haus as an example.
However, you can use others options here.




after you finish download then extract it. After that go to httpd-2.4.25-x86-vc14\Apache24\conf
and open the httpd.conf . (Assume you an expert ... else go leave here and download XAMPP or Easyphp)

Then find "Server root"

Define SRVROOT "D:\Program\httpd-2.4.25-x86-vc14\Apache24"
ServerRoot "${SRVROOT}"

Replace the "D:\Program\httpd-2.4.25-x86-vc14\Apache24"  
to your director of the apache, you have download and extract.






Af…

Method to Convert from Stream to Json C#

Recently I was using the C# HttpClient to make REST request but I found that is was quite troublesome so I have changed to using HttpWebRequest instead.


So want the HttpWebRequest result is return it was in Stream form. I not able to convert it into Json.

this is the method i convert the stream to JSON.


HttpWebResponse response =(HttpWebResponse)requirejs.GetResponse();Stream stream = response.GetResponseStream();StreamReader sr =newStreamReader(stream);var serializer =newSystem.Web.Script.Serialization.JavaScriptSerializer();var jsonObject = serializer.DeserializeObject(sr.ReadToEnd()); As you can see that jsonObject is an object. Now you can parse it into the Json(JsonObject);


If you have any question can leave a comment below.

IIS Setup let text file without extension

How to Write to NTFS Drives on a Mac for free

Free method but need Extra work


1) Download Osxfuse. (Better choose latest version and with dmg Eg,osxfuse-3.2.0.dmg ) Install it.

2) Then Download Homebrew. or copy the the highlighter link and  paste it at terminal
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

3)then paste xcode-select –install  if pop up the itunes alert box then download it, else just continute next step.

4)  brew install homebrew/fuse/ntfs-3g   wait it download finish and installed.

IMPORTANT
5)   Start from this step, you need to do it with care. First you need to reboot your mac and hold Command+R 

6) Then wait the loading bar to finish will bring you to another Mac utilities screen. Here you need to find the terminal on the top menu bar. Launch it.

7) type in csrutil disable  . (PS: this is to disable the configuration by the macbook to do modification on the system so need to enable it back) .

8) Exit terminal and reboot. After that open terminal and …