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
Educational 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.

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

jQuery Star Rating Plugin Web Method Call with ASP.Net

I started playing with the jQuery Star Rating Plugin v3.14. But, I could not really find a good way to make web method calls or a decent write up of how to use it with ASP.Net.

So, I added auto-submit-star to the markup for it to make the callback, added runat=”server”, and a hidden field with the record id.

<input name="star1" type="radio" class="auto-submit-star" runat="server">
<input name="star1" type="radio" class="auto-submit-star" runat="server">
<input name="star1" type="radio" class="auto-submit-star" runat="server">
<input name="star1" type="radio" class="auto-submit-star" runat="server">
<input name="star1" type="radio" class="auto-submit-star" runat="server">
<asp:HiddenValue id="hfRatingID" runat="server"/> 

After that, added the following script that performs the jQuery Web Method call

$(".auto-submit-star").rating({ callback: function (a, b) { 
PageMethods.RateIt( $(this).siblings('input[id*="hfRatingID"]').val(), a) 
}})

Then makes web method call to a static class in code behind

[System.Web.Services.WebMethod()]
[System.Web.Script.Services.ScriptMethod()]
public static void RateIt(int id, string value) // Method have to be static { 
// Make call to update DB rating value 
}

Now you should be able to make an asynchronous call for users to rate an item. Hope this helps.

Say NO to the SMS “Tax”

No SMSAs you may already know, the “evil” telecom companies want to squeeze every cent they can out of you by making up fees. SMS or Short Message Service is what is usually described as texting by your carrier. In the last decade before the explosion of smartphone, SMS used to fill a gap where there was little to no connection to the Internet. SMS functioned though SMS centers hence requiring its own infrastructure.

Nowadays, this is completely irrelevant as most smartphones typically use standard mail protocols such as SMTP over TCP/IP. Meaning, if you have a smartphone, it is very likely you are being charged for something that should be covered by your data plan alone. Of course, I am not familiar with pricing from all cell phone companies; however, if you are on a “bundle” plan and texting is part of it, most likely they are just getting a bundle of money from you. Otherwise, if it is clearly spelled out as a separate fee, you might want to consider just not paying for it and using alternatives that require your data plan alone.

There are several apps out there, each one with its limitations, but with more features than SMS.  So far, Kik is my favorite cross platform messaging app as it is free and it is available for iOS, Android, BlackBerry, and WP7. The makers of Kik are currently being sued by RIM, the maker of BlackBerry Messenger Continue reading “Say NO to the SMS “Tax””

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?

What to do with a small SSD?

As with most technologies, SSD is actually becoming affordable. There are several entry level drives that vary from $80 to $120 in price and 20GB to 60GB in size. However, I strongly advice to step it up to a bigger drive because you are going to run into several issues and annoyances if you go with a small capacity SSD.
First of all, since the drives are so small, the OS will most likely take half the space of the drive. You then install Office, Visual Studio, Photoshop, or any other big app that will benefit from the performance gains and you’ll start running out of space.
Putting media in a mechanical drive should go without saying. Then take a look at hibernation, if you are not on a laptop, you might want to consider disabling it. Hibernation uses an amount of space equivalent to the amount of RAM you have on your computer. 4GB is pretty common and 8GB is starting to become the norm, meaning that would be space you will have to live without. To disable it in Windows 7, open a command prompt and type

powercfg -h off

Next, if you already have something in place to regularly back up your computer, consider disabling system restore. Go to the Control Panel, select to view by Large Icons instead of Category, pick System, and then System Protection. There, you can click on the Configure button, and you will be able to disable System Restore for your booting drive.
After that there is Pagefile.sys, a file in Windows that acts as virtual memory. If you have a large amount of RAM, you can easily do away with this file, make it smaller, or move it to another drive. Simply, go to System again, click on Advance System Properties, in the Advanced tab, click on the performance section the settings button. That will open the Performance Options window where you should click on the Advance tab, then on the Change… button in the Virtual Memory Section. Some sources advocate these changes for small performance gains or to extend your drive’s life, but the jury is still out on that. For certain, they will save you space in your drive.

However, the latest intel chipset on the market, Z68, has a clever way to handle these small drives. It will allow you to use Smart Response Technology (aka SSD caching). It acts as cache for a mechanical drive. It will speed up your system automatically without having to deal with all the nuisance of a small SSD maintenance or SSDs in general.
Continue reading “What to do with a small SSD?”

Best Price to Perfomance Ratio PC for Summer 2011

This build is for people who want a good quality system but do not want to research the components themselves. There is nothing taken into consideration for future upgrades. This is a PC for 2 to 3 years that will perform well and play games decently.

I have decided to pick an Intel CPU since for most purposes it outperforms AMD and I like Z68 chipset features. As you may notice there is a small SSD drive on this build. This will allow you to use Smart Response Technology (aka SSD caching). It will speed up your system automatically without having to deal with all the nuisance of small SSD maintenance or SSDs in general.

I want to provide an overall great experience so I still want good quality on all components. There are plenty of areas where money can be saved like input devices but they make PC usage more enjoyable. Most people skimp on a good UPS but I strongly recommend getting one especially for areas with a lot of thunderstorms. It helps and increases your components’ lifetime. The whole enchilada comes down to about $1450.

Components list after the break:
Continue reading “Best Price to Perfomance Ratio PC for Summer 2011”