Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the wordpress-seo domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/chridpkm/chrisrios.com/wp-includes/functions.php on line 6114
Programming Archives - Christian Rios' Blog

5 Reasons Why a Programming Job is the Best Career Choice for You

Programming is one of the most in-demand and lucrative careers in the tech industry. With the rise of technology, the demand for programmers has skyrocketed, making it a great time to pursue a career in programming. Here are 5 reasons why a programming job is the best career choice for you:

  1. High demand and good pay: As technology continues to advance and more and more industries are going digital, the demand for programmers has never been higher. And, with high demand comes good pay. Programmers can expect to earn a high salary, with the average salary for a programmer in the US being around $80,000.
  2. Constant learning and growth: Programming is a field that is always evolving, and there are always new languages, frameworks, and tools to learn. This means that as a programmer, you will never stop learning and growing, which can be very rewarding.
  3. Flexibility and remote work: Many programming jobs offer the option of working remotely or having a flexible schedule. This allows you to work from anywhere and have more control over your work-life balance.
  4. Variety of industries and roles: Programming is not just for tech companies. Today, programming skills are in high demand across a wide range of industries, such as finance, healthcare, and retail. This means that as a programmer, you can choose from a wide variety of roles and industries to work in.
  5. Ability to make a positive impact: Programming skills can be used to build and create software that helps people and businesses. With the ability to create and develop software, you can make a positive impact on the world and make a difference in people’s lives.

In conclusion, a programming job offers a range of benefits that make it an excellent career choice. From high demand and good pay to flexibility and remote work, there are many reasons why a programming job is the best career choice for you. So, if you’re looking for a rewarding and fulfilling career, consider pursuing a career in programming.

Codility as a tool for filtering out bad developers

Earlier this week, a headhunter approached me for a Java back-end developer position. She tells me as you might expect that she has a vague understanding of Software Engineering and that they have two tests to give me before a technical interview. These were a psychological test and a Java Codility test that consisted of three tasks. They gave me three hours to finish the exam. The tasks are usually variations of common programming problems used in academia and programming competitions.

The first and second tasks were very similar just varying in complexity. Codility provides a good web interface with great feedback on what is asked of you. This is definitely a step up from coding on a whiteboard interview. You get two tabs where you can quickly generate test data that is passed into a function in the coding tab. Boilerplate is mostly filled out which is great. Most IDEs do this for you nowadays anyways.

The third task is about finding a bug in the code. The way they test this is checking closely on your reading skills. This is key in modifying a couple of lines of code. The interface did not let me add or remove lines. The solution I came up with require me to add a line so I appended it to closing brace. The interface has no way to allow for debugging so you might need to have your own handy.

My C+ result for a Java Test, saw what I did there? :p

Should you filter out developers that do average in these tests?

Probably not. A developer with a decade out of college has already forgotten this kind of coding. Many have never used an array in production. This is part of the reason I got 0% in performance for the second task. I added the array to a list and used methods on the list to solve the task. I did not realized I was being rated on performance and that I had to produce a log n algorithm until I read in the third task that this task will not be rated on performance. At that point, I had no chance to go back. As you can see from my result, performance is 62% of the grade.

CONCLUSION

Codility is not bad but it should not be your only way to measure a developer skill. If a developer is doing data analysis or someone straight out of college, it is probably a great tool since it is more closely related to their experience. However, I was given the impression that if I do bad on these I was not going to a technical interview. I will probably have somebody write a CRUD site or create a cascading drop down, but these things require several technologies which is probably harder to develop a tool to test for. In the mean time, there is not really a good way to measure a developer talent or algorithm to rank them. Use Codility as part of your score, and not the comprehensive examination.

ServiceNow script to calculate days until AD account expires

I am just starting to learn how to develop applications and write scripts for ServiceNow. I’m adapting to going from using some of the best tools used for dotNET development to the few options ServiceNow provides (an in-browser IDE with a hit and miss debugger). My employer is not a development house so I get by with Visual Studio Code and some other open source tools.

One of my first tasks was to send an email notification each time an Active Directory account was 10, 7, and 3 days from expiring. But, we quickly discovered LDAP stores this value as a number of 100-nanosecond intervals since January 1, 1601 (UTC). JavaScript does something similar, but it uses milliseconds since January 1, 1970. So, I have to put both in the same unit to be able to subtract one interval from the other.

I added a script in a Field Map inside a Table Transform Map that runs daily to import data from LDAP/AD. This script transforms the value to be imported in the number of days until expiration.

answer = (function transformEntry(source) {

var daysToExpiration = 0;
// Account-Expires attribute comes as source.u_accountexpires from LDAP.
// This value represents the number of 100-nanosecond intervals since January 1, 1601 (UTC).

// If variable is coming null return 0 days
if (source.u_accountexpires == '' || 
    source.u_accountexpires == null || 
    source.u_accountexpires == undefined) {
daysToExpiration = 0

}

A value of 0 or 0x7FFFFFFFFFFFFFFF (9223372036854775807) indicates that the account never expires. Therefore, we assign a big number for the days. This way the user never gets an email.

else {
if (source.u_accountexpires == 0 || 
    source.u_accountexpires == 9223372036854775807) { 
daysToExpiration = 50000;
}
else {

I tried to get the JavaScript Date object to work but it did not so I used GlideDateTime from the ServiceNow API for server scripts to do the calculations.
11644473600000 is the 100ns from Jan 1, 1601, to Jan 1, 1970. Added to match LDAP to Javascript.
now.getNumericValue() return the milliseconds from Jan 1, 1970.
Multiply by 10000 to convert from milliseconds(js) to 100 of a nanosecond (LDAP).

var now = new GlideDateTime();

var today = 116444736000000000 + ( now.getNumericValue() * 10000 )

Subtract today in LDAP format and divide by the number of 100 of nanoseconds in a day.


daysToExpiration = ( source.u_accountexpires - today ) / 864000000000;

If the account has already expired, we assign it a 0

if (daysToExpiration < 0) {
    daysToExpiration = 0;
}

Next is the code that determines if the notification is sent or not, and returns the days to expiration.

daysToExpiration = parseInt(daysToExpiration, 10)

switch (daysToExpiration) {
    case 3:
    case 7:
    case 10:
     //LDAP-disabled users are not sent an email during transform based on 'userAccountControl' attribute
         switch (parseInt(source.u_useraccountcontrol,10)) {
              case 514:
              case 546:
              break;
              default:
              gs.eventQueue('userid.expired', target, parseInt( daysToExpiration, 10 ), target.email);
          }//inner switch
     } // end switch outer
}

return daysToExpiration;
}
})

(source);

Download Script from GitHub

Limit the number of items the user can select in a ListBox with JQuery

This little script is able to grab all the listboxes on the page.

      $(document).ready(function() {
          $("select").change(function() {
             if ($(this).find('option:selected').length > 5) {
               this.options[this.selectedIndex].selected = false;
             }; }); }); 

pretty sleek huh?