It’s either I’m too dumb to understand it, or I simply underestimate it for being very easy. Yes, I am talking about jQuery’s methods in retrieving elements property/attribute.
Today was the nth time i was bitten by this error. Instead of using attr(), I used prop(). A few times I left scratching my head as my Ajax post message in Firebug’s Net Inspector shown with missing key.
So I write this post hoping that I can put rest this recurring mistakes for good (which almost immediately happened as I look at the problem deeper).
What is element’s property? What is an attribute? I found it quite difficult to answer if I based on jQuery’s documentation page on this subject. But when I look at Firebug, I immediately understand.
Just look at the DOM Inspector:
It’s crystal clear baby! It’s kinda embarrassing to have this simple fact overlooked! Oh, I just want to add that the reason why my Ajax backend-post missing key(s) is because prop() will return undefined if the property is not found. As for attr(), it will return empty text for missing attributes.
That’s all, cheers!
About Hardono
Howdy! I'm Hardono. I am working as a Software Developer. I am working mostly in Windows, dealing with .NET, conversing in C#. But I know a bit of Linux, mainly because I need to keep this blog operational. I've been working in Logistics/Transport industry for more than 11 years.
Meanwhile in Singapore, the Ministry of Manpower (MOM) has recently lodged police report on websites that look like MOM’s website. The correct URL for MOM is http://www.mom.gov.sg. The copycat websites URL are:
http://www.movgov.sg
http://www.momgov.sg
I can’t believe that someone would foolish enough to carry phishing attack against Singapore Government. Isn’t this violates Singapore’s Law? According to Prof. Warren Chik, it does violate the law.
For now, let’s try to find the motive of this phishing attack. Unfortunately, since both websites is now no longer accessible, I can’t really find out how deep they imitates the MOM’s website. I can only speculates on their goals:
Spread misinformation. I’m not sure how someone can directly profit from this.
Stole SingPass credentials. There are areas in MOM’s website that requires you to login using SingPass. SingPass is used to access all public services provided by Government. Any financial transactions on these services will go through payment gateway like E-NETS/Bank. So I don’t think anyone can directly profit from stolen SingPass.
It’s a test website. It’s possible, but very unlikely. Who would careless enough to develop website in open internet? If you look at MOM’s website HTML source, you can tell that it’s using SharePoint. If the copycat websites also using SharePoint, then very likely they really are test website.
The interesting point is that these websites uses .sg domain. Dot-SG domain is an exclusive domain managed by SGNIC. According to their rules, anyone (locals or foreigners) can register .sg domain as long as they have local Singapore postal address.
On one of SGNIC’s accredited registrar (IP-Mirror), I found a more detailed restriction which states that the domain contact person must have a valid SingPass ID. Hmm.. do you think this is the motive? Harvest as many SingPass ID you can get, use them to register .sg domains which later be used for fraud/scam.
These are the WHOIS result for the copycat websites:
----------------------------------------------------------------------
SGNIC WHOIS Server
----------------------------------------------------------------------
The following data is provided for information purposes only.
Registrar: IP MIRROR PTE LTD
Domain Name: MOMGOV.SG
Creation Date: 11-Nov-2013 21:19:20
Modified Date: 29-Nov-2013 23:36:37
Expiration Date: 11-Nov-2014 21:19:20
Domain Status: DELETED
Domain Status: CLIENT TRANSFER PROHIBITED
Domain Status: VerifiedID@SG-Mandatory
Domain Status: VerifiedID@SG-OK (VERIFIED BY ADMIN CONTACT)
Registrant:
Name: MARIN PLACEMENT (SGNIC-PER20045392)
Administrative Contact:
Name: IP MIRROR PTE. LTD. (SGNIC-ORGIP243488)
Technical Contact:
Name: MARIN PLACEMENT (SGNIC-PER20045392)
Email: sglobestar@gmail.com
Name Servers:
NS74.DOMAINCONTROL.COM
NS73.DOMAINCONTROL.COM
I am particularly interested with the domain’s status: VerifiedID@SG-OK (VERIFIED BY ADMIN CONTACT). According to SGNIC FAQ, it only requires two simple steps to have this status:
login to SingPass
click on a ‘Verify Identity’ button.
With this, I am sure it will be very easy for SPF (Singapore Police Force) to find out the individual who registered these two domains. After all, these two domains were verified using SingPass ID. Unless, it was already a stolen SingPass used to register. Whoever own the compromised SingPass ID will have the burden to proof that they were not the one validating these two domains.
About Hardono
Howdy! I'm Hardono. I am working as a Software Developer. I am working mostly in Windows, dealing with .NET, conversing in C#. But I know a bit of Linux, mainly because I need to keep this blog operational. I've been working in Logistics/Transport industry for more than 11 years.
Ahh.. the joy of not doing anything. Just to watch the world slip and pass by. Everyday my brain is bombarded by hundreds of not-necessarily related information from HackerNews, Kompas, Detik and ChannelNewsAsia. So it’s very convenient to just consume the information without producing any output. Which means my brain will automatically discarded the information the next day. And yes, at the end of the week, I will vaguely remember what was happen in that particular week.
Then I read this article I found in HackerNews. Basically it encourages us to write every day. Yes, EVERY SINGLE FREAKING DAY! Not just every day, but also at least one thousand words.
By doing so, sooner or later you will hit your “masterpiece”. By masterpiece I mean a writing that is not crap 🙂 At least, your brain will mark the information you consumed as “important”. Trust me; you’ll remember more by writing what’s in your brain now.
Sow how to cultivate this habit? In short, they are:
Use activation energy: In short, if you reduce the amount of energy to do something, you’ll increase the likeliness of you actually doing that something. One example that Srinivas give is: writing one sentence before you go to bed, go to sleep and let your brain dwell on it. Then expand that one sentence into a complete writing the next day. (Frankly, I haven’t tried this. I have one worry that I might end up thinking too much, resulting in insomnia.)
Dealing with writer’s block: Srinivas suggests that the only way to beat this block is just to keep on writing whatever you have in your brain. (Ha, even writing this post I took more than three days. I simply surrender to my procrastinating urge. I need to have stronger will to overcome my procrastinate-self.)
The willingness to create crap: Just do it. Just write one thousand words every day. Some of it (well, in my case, most of it) will be crap. Just march on. Pretend that you are inside a dark tunnel. You already see that small dot of light at the end of the tunnel. Dance your finger away to get closer to the exit.
So there you are, I hope you get inspired as I am.
(PS: This post is not even hit 500 words, but I am already running out of words. It’s alright, I still have tomorrow to catch)
About Hardono
Howdy! I'm Hardono. I am working as a Software Developer. I am working mostly in Windows, dealing with .NET, conversing in C#. But I know a bit of Linux, mainly because I need to keep this blog operational. I've been working in Logistics/Transport industry for more than 11 years.