IntelliJ IDEA + Java versions + Maven + Gradle
Posted: 5 Jun 2020, 11:57am - Friday

Ok, I have been writing java codes from quite some time now. And most common I forgot to set are the following areas to configure in IntelliJ IDEA.

  1. Project Structure - always set both Project SDK and Project Language Level

2. SDK - you have to define the JDK home path to use in your project

3. Java bytecode - ensure that you set the Project bytecode version and add your project in per-module bytecode version and define the target bytecode version.

4. Maven - pom.xml file

5. Gradle - build.gradle file

And if you fail to configure these versions, you'll end up seeing RED texts/icons.

Gradle JVM not set properly, was set to 13 instead of 11.
Gradle JVM setup correctly.

I recently encountered a weird error on my repo when I "git push" or "git pull" in Windows 7. But when I tried it on my Mac, Ubuntu & Windows 10, its working fine.

Windows 7 - PHPStorm Terminal - git pull

As shown above, that's the error I am getting when I pull/push. I tried the solution from others:

reference: https://stackoverflow.com/questions/4485059/git-bash-is-extremely-slow-on-windows-7-x64

But unfortunately it didn't resolve my problem. Somehow, it did made it a bit faster.

I already tried many things, but I cannot find any solution that works for my problem. I know that the issue is just in my PC, even tried emptying my hosts file still didn't work.

Then a lightbulb popup, maybe I should delete my current repo and checkout again. So I did and resolve my problem. I can pull and push after that.

ASP.Net Core C#: Visual Studio 2019 missing UseSqlServer()
Posted: 21 Mar 2020, 0:17am - Saturday

Few days ago, been learning again ASP.Net C#, but this time its ASP.Net Core C#. It took me a while to resolve this issue because all the reference in the internet and stackoverflow were for Visual Studio 2017.

DotNet Version: 3.1 | IDE: VS 2019

In VS2017 might work just by adding:

use using Microsoft.EntityFrameworkCore;

But in VS2019, what works is both adding describe above and execute add package:

dotnet add package Microsoft.EntityFrameworkCore.SqlServer

after that, you problem should go away...

CentOS / RHEL 7 : How to create custom daemon service
Posted: 25 Jul 2018, 13:08pm - Wednesday
First, create the script you want to run...
# vi /root/firewalld.sh
#!/bin/bash
iptables -F
iptables -L
Then make this executable...
chmox u+x /root/firewalld.sh
then you need to create the daemon service
# vi /etc/systemd/system/sample.service
[Unit]
Description=Description for sample script goes here
After=network.target

[Service]
Type=simple
ExecStart=/root/firewalld.sh
TimeoutStartSec=0

[Install]
WantedBy=default.target
definitions:
After= : If the script needs any other system facilities (networking, etc), modify the [Unit] section to include appropriate After=, Wants=, or Requires= directives.
Type= : Switch Type=simple for Type=idle in the [Service] section to delay execution of the script until all other jobs are dispatched
WantedBy= : target to run the sample script in
then cast the commands below:
# systemctl daemon-reload
# systemctl enable sample.service
# systemctl start sample.service
# systemctl reboot
after rebooting, your script should be executed.   Reference: https://www.thegeekdiary.com/centos-rhel-7-how-to-make-custom-script-to-run-automatically-during-boot/
[ssllabs.com] How to get "A+" on SSL Server test
Posted: 23 Mar 2018, 9:38am - Friday
Nowadays its very important that you configure your Server's SSL right. So one thing to test your configuration is enter your website at Qualys SSL Server Test and get your score. So far, I can score A+ for this unlike the security headers, I only get "A". Its very simple to achieve this, just edit /etc/apache2/conf-available/ssl.conf and change following:
SSLProtocol all -SSLv2 -SSLv3

SSLHonorCipherOrder on
Then save your changes and restart your Apache. That's it! You should get an A+ for that. Note: It was just recently that you have to turn on that SSLHonorCipherOrder or "Apache for Forward Secrecy" to ON. Reference: https://www.digicert.com/ssl-support/ssl-enabling-perfect-forward-secrecy.htm
PHP: about NULL vs 0
Posted: 18 Sep 2017, 20:43pm - Monday
A client reported about the data wasn't populating... So I debug and took me hours to find out... Background: We have this enterprise system with legacy code and we created a QueryDriver class to make the legacy, Silex DBAL & CodeIgniter works and reusable. Behind the QueryDriver, it uses vsprintf() function.
$parcelData = [];
$jobVarObj = new JobsVarsTable();
$jobVarObj->setDrivers($this->getQueryDriver());
$prime_parcel = $jobVarObj->getVarValue($this->job_id, 'PRIMARY_PARCEL');

...

$q = "SELECT * FROM jobs_parcels WHERE JID = '%d' AND ID != '%d' AND Deleted IS NULL";
$sql = $this->getQueryDriver()->fetchAll($q, [$this->job_id, $prime_parcel]);
$parcel_data_list = $sql->getData();

In that codes above, the $parcel_data_list is always empty and I know there are 1 row results. 2 hours later... Note: $prime_parcel = null; // if does not exists in the records, will return literal null I just realised that printing vsprintf($q, [ $this->job, $prime_parcel ]) will gave me what I expected because when you sprintf() or vsprintf() the NULL to %d, this will convert to ZERO. But actually when I pass the query to our QueryDriver, %d and %s are actually converted to ? which the NULL become literal NULL in the query. Instead of "SELECT * FROM jobs_parcels JID = '123' AND ID != '0' AND DELETED IS NULL" then becomes "SELECT * FROM jobs_parcels JID = '123' AND ID != NULL AND DELETED IS NULL". So there will be no result. So lesson learn... Solution:
$parcelData = [];
$jobVarObj = new JobsVarsTable();
$jobVarObj->setDrivers($this->getQueryDriver());
$prime_parcel = (int)$jobVarObj->getVarValue($this->job_id, 'PRIMARY_PARCEL', 'n');

...

$q = "SELECT * FROM jobs_parcels WHERE JID = '%d' AND ID != '%d' AND Deleted IS NULL";
$sql = $this->getQueryDriver()->fetchAll($q, [$this->job_id, $prime_parcel]);
$parcel_data_list = $sql->getData();
Then it solves my 2hrs problem!!! Ok that's my entry for half of 2017... hehehe.. Cheers!
How do I backup my e-mails?
Posted: 26 Mar 2017, 10:03am - Sunday
I was asked by my workmate if I could help him create backup of his email. So I've been search for a simple software that can do the job. The result was stunning, there's no free software and everyone are selling to a stunning price. So I created my own software to create backup on your emails with reasonable cheapest price out there in the internet. I called it, Email Backup Tool. A very simple UI and easy to use and will download all your email straight to your hard drive. See screenshot below:                                                                         If you need a tool like this, just go to: http://www.howtobackupmyemails.com/
PH: Message to the World!
Posted: 25 Aug 2016, 21:26pm - Thursday
http://dutertenews.com/photos-american-activists-rally-duterte-new-york/ A letter to my friends and family in the US and elsewhere: Thank you for the concern, but you're being misled. (Now, I really want to know who that Filipina is in this group. She looks like the odd person out in a sea of kids. Was she the organizer? Very interesting.) If the President is forcibly removed, please know that you will be doing our country more harm than good. Not only will you leave us a fragmented country, you will also leave us at the mercy of drug cartels which have run this country, and which are so powerful that they have on their payroll judges, politicians, and as investigations are being done now, allegedly the ex-Secretary of the Department of Justice (now Senator) herself. There is also a chance that Mindanao, the second largest archipelago, will secede, and all peace negotiations that have been started between the government and the Communists in our country (the longest insurgency ever), will be halted. There will be little pockets of rebellion, and you will be fomenting resentment for the US among our previously US-loving citizens. We've been staunchly pro US all these years. If you meddle, not a few Filipinos will suddenly find themselves sympathizing, justified or not, with the countries the US has invaded to "save"; to question the wisdom of forcing a foreigner's ethnocentric view on a sovereign state. You don't understand the depth of desperation until you've lived here. The things you hear in the news do not even scratch the surface. We are angry, desperate, and frustrated, and we hope you can see that. It will be back to Third World, most-corrupt-country-ever status for us. Forget about visiting this country too. Right now, there are improvements being done in our airports, only a few years ago considered the World's Worst. You dont want terrorists? Please leave our country alone. Drug money fuels terrorism, and we haven't had a President who could talk to the militants and the rebels like this one could. Some parts of Mindanao have become training ground for future ISIS rebels. To stop this President's war against drug lords and terrorists is to sign your agreement that more powerful terrorist organizations can come to poor, disorganized, US-hating Philippines to harvest more willing bodies. You don't know the scope. No news article has ever summed it up so you could understand the depth and breadth of the Philippines' problems. Please don't let yourselves be used by those who want to wrestle power away from the President of our country, the only man with cojones big enough to take on not just the ruling elite of the Philippines but also international drug cartels. The TL/DR version of why you're being manipulated is this: Rodrigo Roa Duterte was a mayor of Davao City for 20 years. He was forced to run for President by the Filipino people because the choices were dismal. Apart from an alleged corrupt vice president and a newbie senator, he ran against the anointed one named Mar Roxas, who was the previous administration's bet. While the previous administration has its fans, the overwhelming support for Duterte--91 percent--means most people are crying for change. You remember his predecessor? Benigno Aquino III was the President when Typhoon Haiyan happened. Do you remember asking where your donations went? Do you remember hostages from Hong Kong dying in that bus because of bungled operations? Or the news of our country's Special Action Forces dying in battle due to botched, ill-organized operations? That's not even half of it. If you don't know that, I'm sure you know how notorious Manila traffic is. The chief who handled that told us Filipinos not to worry because traffic isn't fatal anyway. (A Japanese firm did say that while we aren't dying, our economy is, as we lose about 3 billion dollars EVERY DAY in the gridlock.) You understand why people did not want Mar Roxas, who by the way, as the interior secretary, was "on top" of the failed Haiyan relief operations. When Duterte came into power, he sought to dismantle the organized crime and corruption that have been the most prominent features of this country. The Philippines is run on patronage politics, and because Duterte was not an insider--he was just a mayor of a far away city, after all--he stepped on as many toes as liberally and with as much impunity, shocking for toes that have never been stepped on. He went after the most untouchable of our leaders: generals, priests, mayors, cabinet secretaries. He also has a dirty mouth--but if you made us Filipinos choose between his dirty mouth, and his rivals' dirty hands, we'd let out a string of curses. And this is why you hear so much bad press about Duterte. Who was it that said, history is written by the victor? In our case, our story is being written by those who have the access and the resources to alter the truth. WHO STANDS TO GAIN MOST FROM DUTERTE BEING IMPEACHED? 91 percent of us can only hope to reach you this way. This guy is 71 years old. He has nothing to lose (except his life, which apparently does not bother him) and everything to gain. He is fighting for the legacy, the bragging rights to say, "I cleaned up the Philippines." What you see in the news, the killings on the streets, is not the handiwork of the government alone. As the President often says, what we're dealing with is not a crisis, but a war. And there will be blood. There is blood not just because of legal police apprehensions, but because the drug cartels are cleaning up after their own. Our policemen are not provided their own bullets--do you think at a salary of 300-400 usd a month, they can afford to go on a killing rampage? Someone is bankrolling it, and it's not the government. I agree that the President needs to make a tougher stand on the killings--he did condemn them but apparently not emphatically enough--and I agree that he needs to be harsher, but if those were his only shortcomings, to call for his impeachment, when he has done so much for the ordinary Filipino, is taking it too far. Here's something to think about: While we are a poor country, Filipinos are known to be a strong, united people. We are not ignorant, we are not stupid, we are highly literate. We have unhampered access to social media, we have scholars and students everywhere. The only times we ever needed saving are the times when our leaders couldnt do it for us, like Haiyan. Since 1986, when we successfully ousted the dictator Ferdinand Marcos in EDSA 1, the Filipino has believed in his freedom and his capacity to change the government. Our bloodless revolutions have become iconic. We ousted one more President after: Joseph Estrada, for charges of graft and corruption on EDSA 2. We also sent one President, Gloria Macapagal Arroyo, to "jail." EDSA is a symbol of our freedom and our capacity to THINK FOR OURSELVES. We are highly capable of OUSTING LEADERS we do not want. So if we wanted to oust Duterte, we would be VERY CAPABLE to do it on our own. And it would be hell of a lot easier too. We would have disgruntled oligarchs on our side, and I am sure the drug cartels would even happily fund those who are corrupt in our military to stage coup d' etats. BUT WE DONT. SO MANY OF US DONT! 91 percent of us dont! Because we understand our own internal struggles more than any of you do. To meddle in our affairs is akin to saying you do not trust us to govern for ourselves, which smacks so hard of colonialism. Please, thank you for your concern, and for the aid, but allow us to build our nation the way we think best. There are dissenters,some trolls, but others very brilliant, in our midst. We have oppositions in both Houses, in the Senate and Congress. There is an ongoing Senate hearing on the killings, led quite ironically, by the woman charged of coddling drug protectors herself. WE DO NOT LACK FOR DISSENT. PEOPLE ARE NOT DYING HERE FOR ATTACKING DUTERTE. There is NO dictatorship. The original plan is to impeach Duterte, but because they could not find the support from the Filipino public--actually the opposition is very much reviled in this country, to put it mildly--the threat is to have Duterte dragged to the International Crimes Court. And you have become unwitting characters in a stage that has been set to make this happen. YOU ARE BEING USED IN AN ELABORATE POWER PLAY AND YOU DO NOT EVEN KNOW IT. When and if we are ready to oust Duterte, you will hear about it. As I've said, we can do it on our own. But until then, please respect, please, please LISTEN to the voices of the majority of the Filipino people. Thank you!   --Krizette Laureta Chu
Apache Cordova: Hybrid Mobile App
Posted: 9 Jul 2016, 11:32am - Saturday
I was very interested learning mobile app development since 2013 but I never got a chance to learn it. When I was working at QCIT last 2013, I tried Android Native but wasn't successful creating an app. On 2015, I attempted another study on mobile app and I did create my first android app but it was just a webview (http://blog.camilord.com/2015/08/15/my-first-android-app/). hahhahaa.. For those years, I never get a chance to focus learning mobile app development because my company was demanding most of my time. But this year, my company is starting to embrace mobile apps for our main system. So I volunteer to develop the app and my workmate suggested to use Apache Cordova to support multi-platform. Since I know HTML + CSS + JavaScript, then it would be my advantage. So here are my experiences on learning Cordova and would like to share to the world who might experience the same issues that I have. Alright, let's get started. My objective is creating an app for android and iOS. If you are a windows or linux user, in compiling iOS app, you need a Mac to do this. But if you're a Mac user, then you're an awesome guy. so first, you need to install "npm" & "nodejs" or you can follow the steps at https://cordova.apache.org/docs/en/latest/guide/cli/. Once, done installing the basic stuff, all you need to do is create a project (click here). Assuming you have read the link, you must have created the project and added the platforms (android & iOS). Then you can start coding using HTML + JavaScript. It would be easier if you use CSS frameworks. I did tried few frameworks such as: So far Bootstrap works perfectly for my project. I tried Framework7 but it doesn't work well. I like the design/layout but too many issues. I tried jQuery Mobile, but it didn't play well too. Bootstrap stand among other CSS frameworks, very simple, lite and compatible on most devices/OS. Warning: don't use alert() function in javascript as some devices does not support this and your app will crash. So assuming you're done with your app, then you need to build it. First, I will talk about android. When I was developing my app, I was actually using Windows 7. So my AVD settings is (see image below): Screen Shot 2016-07-09 at 11.30.57 PM copy           But on my Mac AVD is different, looks like this: Screen Shot 2016-07-09 at 11.33.20 PM copy                   So once you have done creating the AVD, you can run your app. But first, start your AVD first then build & run your app. Note on windows user, you need set your Java and Android path or else you will get an error. So for linux and mac, all good to go. So all you need to cast is:
$ cordova emulate android
Then you will see your app in the emulated android. So for the iOS side of it which took me while to figure it out the issues I encountered. First, you need XCODE in your mac or cast a command in CLI "xcode-select --install". Once you have XCODE installed, go to you project working directory and cast the following command:
$ sudo npm install -g ios-sim ios-deploy --unsafe-perm=true
Note for possible errors you will encounter:
  1. if you will not include the --unsafe-perm=true argument, you will get permission error and so on.
  2. Make sure all your iOS app icons are properly sized and follow Cordova icon guideline (click here). Fail to do so, will give you error about AppIcon content error...
  3. Make sure your iOS app icons are 72dpi (web standard). Fail to do so, will give you error about AppIcon content error...
If you mess up something, just cast the command:
$ cordova platform remove ios
$ cordova platform add ios
Just add and remove for some other issues and it would be fine. So if you succeed the command "sudo npm install -g ios-sim ios-deploy --unsafe-perm=true" then you will see something like: build_succeed             Then you will need to run your Xcod, go to File > Open Project and go to your app working directory then go to platforms/ios directories and look for *.xcodeproj then click open. Select what device you want to emulate, in my case I selected iPhone 6 and run my app. Result are shown below: iphone_bootingios_app                   builders_app                   That's it... easy? :) You'll get it.. it's not that bad...
OCZ SSD is the worst SSD!
Posted: 10 Apr 2016, 23:03pm - Sunday
ocz_ssdOK, let me share this to the world how bad this OCZ SSD. Bought 3 OCZ SSD months ago. First SSD is where my OS installed, Windows 7 Professional. 2nd SSD is my MySQL Database, 3rd SSD is my Development Source Codes. OS SSD crashed first after 6 months and undetectable. Then the vendor replaced the SSD with Samsung and works fine until now. Next is the DB SSD crashed after 9 months. Dev SSD crashed after 12 months. How can you rely on these OCZ SSDs? I lost tons of files because of these SSDs. If you want SSD, buy Intel SSD or Samsung SSD and they are the reliable brands. Never again be fooled with those other SSDs. Too much promising yet they are all crap! Advise: NEVER BUY OCZ SSD! FULL OF CRAP!
C# WebRequest: Headers pitfall
Posted: 4 Jun 2020, 6:36am - Thursday

I have written my own WebRequest wrapper and it took me ages why I am getting a response of bad request. Hours of debugging, I realize that I have overwritten my Content-Type header with my Authentication-Authorization entries.

the issue:

            WebRequest request = WebRequest.Create(url);
            request.Method = method_request;
            request.ContentType = "application/x-www-form-urlencoded";
            /**
             * dont add content-type header on authenticate
             */
            if (!url.Contains("/authenticate"))
            {
                WebHeaderCollection whc = new WebHeaderCollection();
                whc.Add("Auth-username", authorizationEntity.getUsername());
                whc.Add("Auth-session-key", authorizationEntity.getSessionKey());
                request.Headers = whc;
            }

            if (method_request.ToUpper() == "POST")
            {
                Stream stream = request.GetRequestStream();
                byte[] postArray = Encoding.UTF8.GetBytes(flatten_post_data);
                stream.Write(postArray, 0, postArray.Length);
                stream.Close();
            }

            string Result;
            try
            {
                Console.WriteLine(request.Headers.ToString());
                StreamReader sr = new StreamReader(request.GetResponse().GetResponseStream());
                Result = sr.ReadToEnd();
            } catch(WebException e)
            {
                Console.WriteLine(e.Message);
                Result = "[]";
            } 

the correct approach:

            WebRequest request = WebRequest.Create(url);
            request.Method = method_request;
            /**
             * dont add content-type header on authenticate
             */
            if (!url.Contains("/authenticate"))
            {
                WebHeaderCollection whc = new WebHeaderCollection();
                whc.Add("Auth-username", authorizationEntity.getUsername());
                whc.Add("Auth-session-key", authorizationEntity.getSessionKey());
                request.Headers = whc;
            }
            request.ContentType = "application/x-www-form-urlencoded";

            if (method_request.ToUpper() == "POST")
            {
                Stream stream = request.GetRequestStream();
                byte[] postArray = Encoding.UTF8.GetBytes(flatten_post_data);
                stream.Write(postArray, 0, postArray.Length);
                stream.Close();
            }

            string Result;
            try
            {
                Console.WriteLine(request.Headers.ToString());
                StreamReader sr = new StreamReader(request.GetResponse().GetResponseStream());
                Result = sr.ReadToEnd();
            } catch(WebException e)
            {
                Console.WriteLine(e.Message);
                Result = "[]";
            }

So that's it. lesson learn! LOL

COVID-19
Posted: 29 Mar 2020, 9:58am - Sunday
Novel Corona Virus 2019

World Health Organisation (WHO) declared it as pandemic on 12 March 2019.

Rumors circulating that USA made the virus and planted in Wuhan, China. We all know that China and USA are in economic and cyber war for decades. In my opinion, this could be true because there's only two countries that really good at bio-warfare, that's USA and Russia.

On the other hand, USA accusing China that they created the virus so that the world will economically crushed and later China will buy the companies to increase their dominance. Its bold claim but its possible.

But for me, I still wonder why USA is so relax resolving or responding on the outbreak. Every countries affected were already in lockdown but not them. Probably they already have vaccine and wait until to show the world they were the most affected country from the outbreak? But actually they already have the vaccine because they created the virus? Who knows!

Anyway, looking to my birth-country, Philippines, from watching and reading the news, seems the crab mentality and political idiocy still over the top. NPA, UP activists, Dilawans still try to bring down the President Duterte amid of the COVID-19 outbreak. People doesn't listen to the government. Government officials uses their power and abuse it. Even they are tested positive, they break the rules they imposed. The virus is spreading fast and I see no future in Philippines same when I left my birth-country (that's when the corrupt Aquino ruled the country). People are rallying about the community quarantine while the rest of the affected countries around the world were already in lockdown. It seems its not serious for them. People don't understand the severity of the outbreak.

I think Philippines will have a higher deaths at the end of this outbreak. If not, it will be one of the countries that have highest number of deaths.

While in my new home country, New Zealand, I am very happy the Prime MInister Jacinda Ardern take the precautionary step to stop or to flatten the curve. We are on level 4 lockdown in New Zealand. Since my partner is a nurse and only her can see the current picture of the city, Its very disappointing that few people still going out and not staying home. Suppose to be "Stay home, save lives!" I hope the government impose more strict rules, no one will go out unless buying supplies. If citizens will not follow the COVID-19 rules imposed by the Government, this lockdown will take more longer than we thought.

Use magnetic field as ship propulsion
Posted: 29 Jan 2020, 9:08am - Wednesday

I am not an astrophysicist nor great scientist but why we, humans, still use chemical or fossil fuel on getting to space and we know that it is not the answer. I am just wondering if animals able to harness the magnetic field, why are we not using earth's magnetic field as/for our ship propulsion. The very problem on getting to space is escaping our gravity. So if we use the magnetic field, I think it will very easy to escape from earth's gravity. Isn't it?

Electricity is also the the primary element to achieve this goal. Somebody keeps telling me that the answer or native source to our flight to space is magnet and electricity. Traveling from A to B with a distance of hundred thousands to millions of lightspeed can be achieved by magnetic equation + amount of electricity or power.

Once we achieve how to escape the gravity by using the magnetic field, this can be applied to any planets. It will be easy to get in and get out to a planet.

So, I think we really need to stop using chemical or fossil fuel and start using the correct element to achieve space flight. If not, we will not progress.

My Meme Generator (mymeme.app)
Posted: 16 Jul 2018, 12:08pm - Monday
Hello, if you ever need to generate your own meme, just go to www.mymeme.app Very simple meme generator and easy to use. cheers!
[securityheaders.io] Getting an "A"
Posted: 22 Mar 2018, 11:29am - Thursday
We've been dealing with our servers and systems security audit. One thing I need to achieve is getting an A score in our security headers. So far I got "A" and if you are achieving the same goal, here's the steps: Go to /etc/apache2/conf-available and edit security.conf then at the bottom of the file, add the following below:
#
# to apply this settings, you must enable apache headers first...
# e.g.: a2enmod headers
#
# headers customised by camilo3rd | 2018-03-22 ---- [start]
#
Header unset Content-Security-Policy
#Header add Content-Security-Policy "default-src 'self'"
Header add Content-Security-Policy "default-src * 'self'; img-src * 'self' data: 'unsafe-inline'; style-src * 'self' 'unsafe-inline'; script-src * 'self' 'unsafe-inline' 'unsafe-eval'; report-uri https://www.abcs.co.nz/violationReportForCSP.php;"

Header unset X-Content-Security-Policy
#Header add X-Content-Security-Policy "default-src 'self'"
Header add X-Content-Security-Policy "default-src * 'self'; img-src * 'self' data: 'unsafe-inline'; style-src * 'self' 'unsafe-inline'; script-src * 'self' 'unsafe-inline' 'unsafe-eval';"

Header unset X-WebKit-CSP
#Header add X-WebKit-CSP "default-src 'self'"
Header add  X-WebKit-CSP "default-src * 'self'; img-src * 'self' data: 'unsafe-inline'; style-src * 'self' 'unsafe-inline'; script-src * 'self' 'unsafe-inline' 'unsafe-eval';"
Header always set Referrer-Policy "same-origin"

Header set X-Content-Type-Options "nosniff"
Header set X-XSS-Protection "1; mode=block"
#Header set X-Frame-Options "DENY"
Header set X-Frame-Options SAMEORIGIN
Header set Strict-Transport-Security "max-age=631138519; includeSubDomains"
#
# headers customised by camilo3rd | 2018-03-22 ---- [end]
#
Then save.. Restart your apache and that's it. You should get an A score. To understand those statements above especially the values, please refer to:
  • https://developers.google.com/web/fundamentals/security/csp/
  • https://content-security-policy.com/
I was fascinated with this news... [embed]http://www.anonews.co/nasas-kepler-telescope/[/embed] For me, the alien harness the power of the sun using transparent solar panel concentrator, article below. [embed]https://energy.mit.edu/news/transparent-solar-cells/[/embed] It would be very interesting that someday we humans can communicate with them and share technologies from each other. Hope it will happen before I die. Hehehe..
How do you kick a benign user off your system?
Posted: 7 Dec 2016, 22:17pm - Wednesday
There's probably an easier way, but I do this: See who's logged into your machine -- use who -u:
root@alphaone:~# who -u
root     pts/1        2016-12-08 11:02   .          7953 (192.168.0.99)
camilord pts/2        2016-12-08 10:59   .          7625 (192.168.0.7)
Laugh at their impending disconnection (this step is optional, but encouraged)
root@alphaone:~# echo "HAHHAHAHAHAHA... BYE!" | write root pts/1
write: write: you have write permission turned off.
Kill the corresponding process:
root@alphaone:~# kill -9 7953
  Reference: http://unix.stackexchange.com/questions/615/how-do-you-kick-a-benign-user-off-your-system
MD5 File Hash for C# and PHP
Posted: 14 Aug 2016, 10:06am - Sunday
I encountered again on how to generate MD5 File Hash in C# and compare generated C# file hash to PHP md5_file() function. This is to make sure the file integrity are maintained on copying files. It took me while to find the function but I know I have created one of my previous projects. And this time, I will post here in my blog for future use. Hehehe! For C#:
public static string md5_file(string fileName)
{
    FileStream file = new FileStream(fileName, FileMode.Open);
    MD5 md5 = new MD5CryptoServiceProvider();
    int length = (int)file.Length;  // get file length
    byte[] buffer = new byte[length];      // create buffer
    int count;                      // actual number of bytes read
    int sum = 0;                    // total number of bytes read

    // read until Read method returns 0 (end of the stream has been reached)
    while ((count = file.Read(buffer, sum, length - sum)) > 0)
        sum += count;  // sum is a buffer offset for next reading
    byte[] retVal = md5.ComputeHash(buffer);
    file.Close();

    StringBuilder sb = new StringBuilder();
    for (int i = 0; i < retVal.Length; i++)
    {
        sb.Append(retVal[i].ToString("x2"));
    }
    return sb.ToString();
}
For PHP:
<?php

echo md5_file($filename_with_fullpath);

?>
Hope this helps... Thanks to: http://stackoverflow.com/questions/15705676/different-md5-file-hash-in-c-sharp-and-php
Bash: File Server Hourly Backup Script
Posted: 11 May 2016, 3:04am - Wednesday
Been creating bash backup scripts but every time I create for the new server, I forgot the commands and research again. This time, I'm gonna save it in my blog so that I will search it in one place. Hehehe...
#!/bin/bash

cd /backup/

DATE=$(date "+%Y%m%d%H%M%S")
BACKUPNAME="jdrive_$DATE"

mkdir $BACKUPNAME

# find -mtime -1 | xargs cp -t --parents "$BACKUPNAME/"

find /jdrive/ -mmin -60 -exec cp --parents '{}' "$BACKUPNAME/" \;

tar -zcvf "ibackup/$BACKUPNAME.tar.gz" "$BACKUPNAME/"

rm -rf "$BACKUPNAME/"

# file and delete all files smaller than the specified filesize
find /backup/ibackup/ -name "*.gz" -size -500 -delete

# file and delete all files that are older than 45 days
find /backup/ibackup/ -mtime +45 -type f -exec rm -rf {} \;
Here you go... My home-brewed incremental backup script. We usually use duplicity but it failed us twice. So, we are using now both my home-brewed script and duplicity. Oh! by the way,  I used this script for our file server only.
Restart your computer and press COMMAND + S then this will enter to terminal mode. First you need to mount the "root" path before you can modify the disk.
:/ root# mount -uw /
Now after mounting the root path, you have two option here, factory reset or reset password of a user so you can access the files. Factory Reset In factory reset, all you need is to delete the file /var/db/.applesetupdone then OS X will detect that the system has run the first time (but the data are all intact).
rm /var/db/.applesetupdone
User Reset Password In user reset password, this is what you will do:
  1. go to /Users directory then list the files and folders
  2. whoever you want to reset the password, just type passwd <username>
  3. then this will ask you for the new password and confirm new password
  4. that's it
:/ root# cd /Users
:/ root# ls -lsa
:/ root# password user1
Enter New Password: 
Confirm Password:

:/ root# reboot
then type exit or reboot or restart the machine. then you all good to go...
GitLab: docker DNS issue and container already in use
Posted: 6 May 2020, 21:46pm - Wednesday

I decided to create another stage to test our API in GitLab CI runner using postman/newman. I made it work but there are issues from time to time like DNS issue and "container already in use" (see screenshot below). The common error that occurs most of the time is the DNS issue.

docker DNS issue

In my various experiments, I managed to resolve the `container already in use` issue by adding the container name with commit ID from gitlab.

docker container already in use issue
.gitlab-ci.yml

However, since I implemented the commit ID on the container, the DNS issue reduced from 8/10 fails to 2/10 fails. It still fail time to time, its not perfect but for now its tolerable. I hope there's a better solution.

success like.. wohooo!
ASP.Net Core C#: Handling new lines in Razor view
Posted: 21 Mar 2020, 20:52pm - Saturday

I've been programming using PHP for a long time, and its funny I am struggling to do it on ASP.Net Core C#. In PHP, all you need to do is call the function "nl2br()" and that's it.

In this blog, I am reminding myself how to do it in ASP.Net Core C#. There are two ways how to resolve my issue:

Method 1 is adding an css line but this approach is not always applicable.
Method 2 is calling Razor Html.Raw() method. I believe this is a better approach. But be careful of XSS attack on this. Make sure you sanitize before saving to database.

I think that's it... Hope for the readers of this post looking for answers like me will help you as well.

zsh -> grml
Posted: 18 Nov 2019, 1:09am - Monday
It's been a while I haven't posted something in my blog. Since AlphaOne was acquired by Objective Corporation and our PC will be replaced with Laptops (I felt its a downgrade really but there's nothing I can do about it.) So start setting up my Ubuntu environment under VM which I'm gonna clone the image and just place it into that laptop. I've seen my workmate using the custom shell and I find it handy in development. Here's how to set it up: install zsh package
$ sudo apt install -y zsh
download grml's zsh configuration
$ cd ~/; wget -O .zshrc https://git.grml.org/f/grml-etc-core/etc/zsh/zshrc
then run zsh
$ zsh
that's it.. will look like this:         also you can make zsh-grml shell as default:
chsh -s /bin/zsh
or
camilord@camilo3rd-ubuntu /srv/localhost/alpha1v1 (git)-[3508-fixing-unit-test] % chsh
Password: 
Changing the login shell for camilord
Enter the new value, or press ENTER for the default
	Login Shell [/bin/bash]:    
Can LIGHT be use as propulsion?
Posted: 8 Jul 2018, 12:07pm - Sunday
Can LIGHT be use as propulsion? How about sound wave as propulsion? Currently we are developing the ION propulsion but still in premature stage...   YouTube/watch?v=jjy-eqWM38g
NZ Companies Register API
Posted: 25 Feb 2018, 3:50am - Sunday
In case you need it... https://github.com/camilord/nz-companies-register Very simple to use...
 
 
use camilord\NZCompaniesRegister\NZCompaniesRegister;
 
$obj = new NZCompaniesRegister();
$result = $obj->search('blue horn');
 
print_r($result);
 
Cheers!
Backup your files on any Android smartphones
Posted: 15 Apr 2017, 12:05pm - Saturday
Alright, I stumble with Huawei LYO-L02 model which very primitive model and can't even get a support on it. If you plug to your PC, nothing happens. You cannot access the internal storage. So the question is how do I backup the contents of my phone? Here's the simple steps:
  1. Install an App in your phone called "SSHD"
    • after installing, create a server and set the port then add a user
    • start the server or SSHD
    • once started, it will show the IP address where your SSHD can be connected
  2. Then in your Desktop computer or laptop (PC/Mac) , install FileZilla
  3. Remember, your phone and computer should be connected to the same WiFi or network.
  4. Open your FileZilla, go to site manager and add new site
  5. Enter the IP address provided in step 1 then port, username and password.
  6. On protocol, select SFTP (SSH File Transfer Protocol) then connect
  7. After connecting, it will give an error like cannot read directory because its reading to "/" root directory. In Android, the default storage of the files will be "/storage/" so just change the address bar on Filezilla and press enter and this will show you few directories.
  8. Just find the folder you want to backup and drag to your computer.
  9. Wallah! You just backup your smartphone files.
True History of the Philippines
Posted: 28 Nov 2016, 11:29am - Monday
I am not Pro-Marcos nor like politics... But I always believe Duterte's Change. And for the article below, I believe...
ANG HINDI ITINUTURO NG MGA PAARALAN, ISISIWALAT! 15085547_1026733897452153_101796368808312139_n 15122902_1026733884118821_6254310278283190027_o
MARCOS Wealth/Gold! The Cojuangco-Aquino Family envy Ferdinand Marcos because of Ferdinand Marcos's personal wealth given by his former client the Tallano royal family of the Philippines who is the real owner of our country. The tallano was the richest royal family in the history of man. Richer than any ancient empires/kingdoms, they hired Marcos as their family lawyer and pay him hundred thousand tons of gold bars. About the so called ill-gotten wealth that the Aquino administration accuses the Marcoses is a lie. FEM has a major role in the world and it is the Monetary-1.
Take Note: MONETARY-1 Actually, the Aquino’s are puppets by those who wanted to bring Marcos down ‘coz they wanted to have the wealth that belongs to mankind who's been under FEM hands. Search about MONETARY-1 and the answer were out there! Q: Bakit may nag mamay-ari ba na isang pamilya sa bansang Pilipinas? Paano po nangyari iyon? A: Our country was a kingdom before, called the Maharlika kingdom, ruled by the great DATU's such as Datu Puti and Lapu Lapu. Parts of our country was Brunei, South Borneo, Hawaii, Spratly Island and Saba. Our country was a rich kingdom and even the Ming dynasty of China respect our kingdom, no other empires and kingdoms in Asia can matched our wealth. The DATU's who ruled the kingdom was the Tagean/Tallano royal famil. They owned our country until the midst 18th century. JOSE P. RIZAL was a direct descendants of the Tallano's. His great grandfather was Prince Julian Macleod Tallano who is been half European royalty "Macleod and half Maharlikan Tallano. 192 thousand tons of golds paid by the Tallano's family to Marcos yet too damn smart. He got the WW2 2 loots which is the YAMASHITA GOLDS who's been guarded by the imbecile General Yamashita and out smarted by Ferdinand Marcos. That is why there is a monetary-1. Due to WW2 loots belongs to humanity, Marcos wanted us to have that and not ended up to the hands of the REPTILIANS/ the world elite/ the one eyed/ the illuminati/ who wanted to enslave humanity, that is why they do everything to bring Marcos down. But Marcos is so smart, they can't find ways how. Then they saw a little hole and used it to manipulate the minds of FEM's own people, then used it to bring him down. They may succeed to bring Marcos out of power in this country but still Out smarted by the late great Ferdinand Marcos because they were not able to get the golds. The real enemy of Ferdinand Marcos was also the enemy of mankind. They're like a pyramid on top of them was a silent but powerful country. America and Vatican was working for the interest of that powerful country controlled by a single and powerful family called the Rothschild’s! We have the right to know the truth about us Filipinos. School never teach our ancient past, our real origins, our long lost kingdom. We are the people of MAHARLIKA kingdom ruled by the DATU's. Our kingdom was a peaceful and respected kingdom until the Spaniards invaded us under the flag of King Phillip. They call our kingdom Philippines! They claim that they discover our country but in reality our kingdom was far richer than the 4 major empires in Europe. The Roman Italians, the Gothic Spaniards, the Celtic England, and the Vandal France. Combine all of their imperial wealth can't matched our wealth! That was the truth that's been hidden from us. The U.N. knows it. U.S.A. knows that. China and Russia knows that. I remember George W. Bush morning interview in 2001 and he's been ask who's the richest country on the planet he smiled and says "The Philippines"- Marcos knew that but he didn't talk! Yes, Marcos didn't talk how rich we are ‘coz he carefully doing his plans away from the eyes of the enemies who wanted to claim all our wealth. Then he decided to create an Asian dollar, so that Asia wills never barrow money to European Union with sky rocket interests. Did anyone know that Marcos represents Asia and he is the head of Asian Union. Napaka daming magagandang plano ni Marcos not only for our country pero sa buong Asia. But the dark forces did everything they can to prevent Marcos! They manipulates the minds of the youths about truth and make Marcos a bad man while they pretend to be a good one, they use the church like Cory did! They made the terrorist a hero like what they did to Ninoy! And now they wanted to install Cory Aquino as a saint! They used a yellow ribbon instead of a swastika! Pero the force that manipulates the midst of the Filipinos was only a puppet of the true force who wanted to enslave humanity pero hindi pa nila magawa all the way dahil Marcos locked the Monetary-1, so it will never ended up in the hands of the dark side reptilian illuminati. The monetary-1 represented by Marcos was for all humanity. CARLO GAMBINO said…. My great great grandfather was Salvador Tagean, he is a direct descendant of the Tagean, and the Tagean is a close relative of the Tallano royal family. My grandfather who is war veteran keep telling us that the most important thing for us to know is to know the truth about our history, the truth about Marcos ‘coz it was all connected. I manage to connect all the dots and I figured out who was the force behind Marcos downfall and it's not the people power and the Aquinos. They are just instrument or puppets. My grandfather tells us many things including important and highly sensitive topics or events. There is too much lies in school and even in major religion. School teaches the young ones wrong information like Ninoy was the hero and Marcos minimal lang ang appearance saga books. They never mention the Tagean/tallano royal family who owned our country the Maharlika kingdom! Kaya what I do to my children is what my grandfather did he educated us everyday by telling tales, and those tales was the reality that never been told or teach by those who wanted to poison our intelligence they fear we found out the truth ‘coz if we find it out no one can command anyone! Means we all equal in life! There is no poor anymore, and there is no rich! The word elite will never be used again! We are familiar to General Antonio Luna… the greatest general in the history of the Philippines but the school never said that, Antonio Luna has an affair with YSIDRA COJUANGCO the grandmother of Cory Aquino! YSIDRA and Emilio AGUINALDO plotted the death of Antonio Luna, Antonio Luna has a thousand tons of gold’s… gagamitin sana to fund the war against invading UNITED STATES OF AMERICA, pero the AGUINALDO regime was corrupt and under the influence of America, kaya they plotted the death of the great General Luna. Gregorio Del Pilar and Manuel Quezon can't do anything about it ‘coz that time they are powerless to prevent it, but they knew it’s going to happen sooner than later! Apolinario Mabini who's also the adviser of AGUINALDO wanted to prevent it, pero dahil lumpo siya na dapat talaga siya din ang presidente wala din nagawa para mapigilan pa ang naka ambang kamatayan ng magiting na Antonio Luna. Emilio AGUINALDO also killed the true and first president of our republic and it is the great Andres Bonifacio… killed by the order of Emilio AGUINALDO and claimed the first presidency! Did anyone hear this in school?! I've heard this to my grandfather… At first I'm confused ‘coz iba ang teachings sa school pero why would our grandfather tell us lies? Then we grew up and connect all the dots then it makes sense, the truth cannot be hidden for a long time! And it's our right to know it! Marcos didn't do anything bad for us! Instead he loves us more than himself. Lahat ng pinakikinabangan natin ngayon sa bansa produkto ng pag mamahal ni FEM. Pero ninanakaw sa atin ng mga yellow ribbon army! They can't let Bongbong Marcos become a president dahil pag nangyari yan people will know the truth! Not just the truth but we will have the things that belong to us! Like what I've said before we are rich! Richer than any country! The world leaders know that! But they also know we've been manipulated by corrupt government China and Russia respects Marcos they treat him as a king ‘coz Marcos was a good leader with brilliant mind! Vladimir Putin's Russia opposed American rule, China too! Then America keep telling’ the world that Russia and China is a major threat! Pero mali kabaliktaran! When U.S. invades Middle East and put the 9-11 to Osama that's a lie! They just wanted to invade Middle East, Iraq and Iran ‘coz Iraq is the ancient empire of Babylon, mayaman sa oil! Gusto nila yung oil business! They keep making movies na ang terrorist ay Muslims, Russians, Chinese pero those countries didn't engage to war like U.S. did. Napansin niyo ba na halos lahat ng giyera may partisipasyon ang U.S.?! U.S government destroyed Marcos dahil baon sila sa utang kay Marcos personal na pera ni Marcos ang ipinautang sa kanila. Marcos lends them gold bars hidden under the twin towers with interest yan. The contract expires exactly the same time the twin tower was been attacked, ika nga ng America! But it's not been attacked; it's been a part of the deal! The gold’s was under the twin towers and twin towers also were part of it! The towers must be destroyed and the gold bars must be returned to the owners! Marcos owns the gold’s! After that American economy collapse dahil wala na silang gold reserves! Q: how is that happened na ang U.S. ay malaki ang utang sa pilipinas? Sabi tayo ang lubog sa utang nung panahon ni Marcos… kamuntik na nga daw tayo mabankrupt dahil panay utang daw po ni Marcos.. kung hindi lang sana nag edsa1..di ba 1986 ang maturity ng mga PAUTANG ni Marcos sa ibat ibang bansa? Is this true?! A: The past government hide it and never told anyone except to those who lived at the time na nangyayari ang mga yun, they know the truth… ang mga bata ngayon hindi nila alam, kaya ano man ang itinuro sakanila sa school they believe it agad! ISYDRA CUJUANGCO, yes she get 60% of the gold’s held by General Luna dahil she played major role to assassinate the great general! The rest kaya mayaman ang COJUANGCO, pero they can't matched the Marcos wealth even the Rothschild’s and the Rockefellers envied Ferdinand Marcos wealth that is why they do everything they can to get that wealth pinalabas nila na ill- gotten wealth samantalang may sariling papeles ang yaman ni Marcos, before pa siya maging president gave by the royal family tallano! Yes, America has a huge dept to Marcos and it’s paid already after the collapse of twin towers U.S. Government pays all the gold’s that they barrowed to Marcos with interest! Kaya American economic bagsak na! And yes Marcos lends all major country na nag boom today like Dubai and other countries. Kasi nga sa Monetary-1, si Marcos and holder ng yaman ng tao at bansa sa buong planeta it's kinda hard to explain! It is better for us to know things the truth and the liars. 1976 maturity humingi ng 10 years extension para mapag planuhan nila na after that out of power na si Marcos sa mata ng madla, pero he's never been out of power dahil until now they prevented the Marcos not having absolute power like maging Vice President or maging President dahil it will become their downfall! Kaya they keep telling the young ones na si Marcos bad man Napakadami ng may utang Kay Marcos and they all envy him dahil he is the Monetary-1… can you see how Ronald Reagan respects Ferdinand Marcos…. Reagan acted like his the biggest fan of Ferdinand Marcos dahil reality lang, Marcos is more powerful than the pope! He is a good man with good heart! * *
reference: https://www.facebook.com/Philippine-Cyber-Warrior-For-Peace-Truth-And-Freedom-985454804913396/?pnref=story
Publishing your App to Google Play & Apple Apps Store
Posted: 12 Jul 2016, 23:39pm - Tuesday
Now, I have completed my app, well tested and working good. So my experience and how I did it. Google Play Note: I assume you have subscribe Google Developer Console and paid the necessary payments. First you need to generate/create your app key or certificate by using java keytool. In windows, you need to add the java bin path on  Windows environments path, see below: win_env So once you have configure this, go to you App working directory and cast the command:
$ keytool -genkey -v -keystore [APP_NAME].keystore -alias [APP_NAME_ALIAS] -keyalg RSA -keysize 2048 -validity 10000
Now that you have the key, then compile your APK with the key (most commonly called as keystore)... Note: you must be in your App working directory.
$ cordova build android --release -- --keystore="[FULL_PATH_OF_YOUR_KEYSTORE]" --storePassword=[KEYSTORE_PASSWORD] --alias=[APP_NAME_ALIAS]
That's it, then you need to go to platforms/android/build/outputs/apk/ and look for android-release.apk and upload it on Google Developer Console. Easy enough!   Apple App Store To be honest, apple is more daunting process. Ok, here it comes. First of all, you need to complete the following in Apple Developers:
  1. Register to Apple Developers at developers.apple.com
  2. Purchase Apple Developer Program for NZD 150.00
  3. Assign or invite admin and developers in your account (developers profile)
  4. Create iOS certificates for iOS Development and iOS Distribution
  5. Then create identifiers (App ID)
  6. After creating the developers profile, certificates and identifiers you may now export this to bind it to your app.
  7. In Xcode, go to Preferences then select Accounts and select your apple ID
  8. At the bottom of the dialog, click the cog icon and click Export Developer Accounts then save this file as .developerprofile  at platforms/ios/ folder of your app project
Note: You cannot test your app to real device without the above mentioned. So if you have it all setup, you can now test run your app to your real device for testing and then publish it. To test it on real device, plugin your iPhone/iPad to you iMac or Mac machine then on Xcode you should see your device. Screen Shot 2016-07-13 at 1.11.37 PM copy Just select the device and click Play button to test your app to your real device. Easy! Now let's proceed on publishing the app, we have two steps here. Create the app profile in Apple iTunes Connect and compile/build the app... Apple iTunes Connect
  1. login to itunesconnect.apple.com using your developer's apple ID
  2. go to My Apps
  3. create new AppScreen Shot 2016-07-13 at 1.49.59 PM
  4. just tick iOS and fill up the form. In SKU field, you can fill up anything, something unique. It would be good name like if you app name is TestApp and the version is 1.0.0 then you can put SKU field as TestApp1.0.0
  5. Then click Create and will bring you to more fields to fill up. Just complete the mandatory fields.
Compile/Build the App
  1. In your app working directory, cast the command cordova build ios
  2. Open Xcode, open your App project then go to Product and select Clean
  3. Make sure you have select an iOS device in the build dropdown
  4. Then go to Product and select Archive
  5. After archiving, a dialog will popup Screen Shot 2016-07-13 at 1.29.31 PM
  6. You can click "Upload to App Store" to upload your app
  7. Click export then select the appropriate option for you appScreen Shot 2016-07-13 at 1.30.02 PM
  8. Just follow the steps and it will do it for you
  9. Once done, go to itunesconnect.apple.com then click the App you want to publish then select the app that you just uploaded via Xcode Archive.
Important Reminders:
  1. All App Bundle ID should be the SAME on the following:
    • Xcode > Project Property > General > Bundle Identifier
    • Apple Developers > Identifiers > App ID entry
    • Apple iTunes Connect > My Apps > App entry
  2. Make sure the app bundle identifier is unique
  3. Every release, don't forget to update your build and version
I think that's it! Good luck...   Conclusion: I found Android as the easier way to publish app. Less hassle, not so strict and really simple.
POLi Payment Gateway: Why you shouldn't use this option...
Posted: 11 Apr 2016, 1:59am - Monday
poli_1           The first time I saw POLi payments was in Qantas Airlines New Zealand. The moment I saw asking for my Bank Credentials, I click back button ripoli_3ght away. Why? Because POLi is asking your Access Code/Username and Password of your bank, your BANK CREDENTIALS! Imagine your hosts file has been altered by malware or any virus or your network has been hacked or exploited or your ISP has been hacked or whatever above your internet line has been altered pointing POLi payment gateway's DNS to different server, you will be giving your bank access to the hackers. And POLi is a direct access to your bank account (your entire assets in your bank) and initiate the transaction right away. Unlike credit cards, if your card has been expospoli_2ed, then the risk is JUST your card, not your whole account in the bank then you still have time to call the bank the close it right away. So my advise never use POLi payments. I'm not against the company or the people who created it but I am just against how the implementation or how it works.
iMac Intel Diagnostic LED's
Posted: 25 Mar 2016, 5:44am - Friday
To observe the LED's you need to apply power to the iMac with the front bezel off. Please ensure you don't touch any part of the iMac or the exposed circuit boards while you have power connected. Locate the Diagnostic LED's between the RAM slots and the SATA connector. The LED's are numbered 1-4 from left to right. You may need to move the SATA cable to get a clear view of the LED's. If you are using this guide for iMac Intel 20" EMC 2210 and 2133 the LED's are located above the SATA connector and not as visible.
  • LED 1 - Indicates that the trickle voltage from the power supply is detected by the main logic board. This LED will remain ON while the iMac is connected to the AC power. The LED will remain on even when the computer has been shut down or put to sleep. The LED will turn off only if the AC power is disconnected or the power supply is faulty.
  • LED 2 - Indicates that the main logic board has detected proper power from the power supply when the computer is turned on. This LED will be ON when the computer is turned on and the power supply is working correctly.
  • LED 3 - Indicates that the computer and the video card are communicating. This LED will be ON when the computer is communicating properly with the video card. If LEDs 1 and 2 are ON and you heard the startup sound, but LED 3 is OFF, then the video card might be installed incorrectly or need replacement.
  • LED 4 - Indicates that the computer and the LCD display panel are communicating. This LED will be ON when the computer is turned on and video signal is being generated. If the LED is ON and there is no image on the LCD display panel, the LCD display panel or inverter might be installed incorrectly or need replacement.
Refence: https://www.ifixit.com/Guide/iMac+Intel+24-Inch+EMC+2134+and+2211+Diagnostic+LED's/7443