I came across a problem when playing with the new HTML5 DataList. At first, I thought it would be a direct replacement for the select dropdown that we have seen and programmed a million times before: I would soon be proven wrong in the premise that it's a replacement. It can live along side, but it comes with a caveat.

The following is some simply code that displays an HTML dropdown populated with some dummy data:

You simply create a list of values in a datalist and you tell the storage where to get the data from.

In this case (as it was before), the name of my container is "browsers".

Notice that you can also have a label attribute attached to each value. It's a nice addition, and the label value gets shown on the right justified side on the item value. It's also lighter (in the default case) than the item's value, so it won't look like it's part of the original item. It's noticeable that it's an extended value.

For example, the dropdown value for the first option would look like this:

Chrome Oh Yeah

The "Oh yeah" is noticeably lighter than the "Chrome". It's a nice effect.

Mistaken:

I figured that the new HTML5 DataList is a direct replacement, so I simply created the list with the same name, "browsers", and ran the fiddle.

To my surprise, the change event didn't fire when I made a selection. Even stranger, the change event fired when I clicked outside of the current dropdown. I was stumped.

So, my first try was to see if the blur event was firing, so I changed the JQuery code:

$('#browsers').on('blur', function(){
alert($(this).val());
});

When I ran the code, it worked EXACTLY like the change event. At least this time it worked like I expected.

So, I changed the blur event back to the change event, and it worked exactly like the blur event.

EPIPHANY:

I decided to go back to the beginning, and look at the differences between the old and new HTML. Originally, I glanced over the syntax, and didn't pay much attention. But now I broke it down into parts. This wasn't a select statement, it was an INPUT with some data.attached to it to make it look like a dropdown.

I figured that I would have to change the event from BLUR or CHANGE to INPUT.

$('#browsers').on('input', function(){
alert($(this).val());
});

That was it!!! It worked like a dropdown, and the new event was working perfectly.

CAVEAT:

One caveat about this method, is that it fires every time the value changes in the input component. So, if the user is typing the value, instead of choosing from the drop down list, the event will fire after each letter/number typed.

That would be a nice followup to this post. I'll turn this into a tutorial for an autocomplete dropdown.

So, this is a simple example on how to use HTML5's new DATALIST, and how to capture the change event when an item is selected.]]>Mon, 15 Dec 2014 20:33:28 +0000http://forum.codecall.net/blog/1699/entry-2035-jquery-and-the-html5-datalist/http://forum.codecall.net/blog/1277/entry-2034-new-project-implementing-a-simple-language/
( 1 READ x )
( 2 READ y )
( 3 OR 1 2 )
( 4 AND 1 2)
( 5 NOT 4 )
( 6 AND 3 5 )
( 7 OUTPUT 6 )
I chose to do Boolean straight lines because that's the kind that was described in the book I was reading, which gives this project as an exercise. There are other forms of straight line programs, for example, programs where the commands are arithmetic operators. Any straight line programming language with a sufficient set of operators is equivalent to a finite automaton. Of course the straight line model is not Turing-Complete; that would require branching or other flow control constructs.

As you can see, this provides a fairly simple language which is relatively easy to write a compiler or interpreter for. It's an ideal place to start, since I won't have to be worrying a lot about the fine details of the language and I can focus on the discipline of parsing. Here and possibly in future blog posts I will chronicle what I've done toward this end. I hope my writings will serve as a sort of amateur tutorial on the discipline of compiler design, written as a narrative of my own efforts to learn this discipline through practice.

Writing a compiler or interpreter requires a lot of initial planning before you start coding. This begins with specifying the syntax, semantics, and pragmatics or the language. Syntax refers to how the code is structured, e.g. right and left curly brackets have to match, etc. Semantics refers to what the code actually means and what it does; type-checking is generally considered a semantic issue. Pragmatics is mainly an optimization issue: what is the best way to implement a programming language?

Context-free grammars are generally sufficient for expressing the syntax of a programming language. The standard method is Backus-Naur form (BNF), which is a variation on this theme. I'm not going to launch into an explanation of formal grammars and BNF here, because that would make this blog entry much longer than I'd like it to be. I'd like to keep this on the topic of my project. As the first step in designing my interpreter, I came up with the BNF specification for the language of Boolean straight line programs:

The next step after specifying the syntax is to figure out how to implement it in the code. I chose C as the language to write the interpreter in, simply because that is the language I'm most comfortable with. For the lexical analysis, a finite automaton is generally sufficient. I planned an automaton that would use a vector of bit flags for the state. The first few bits would denote the position within a lexeme, while the higher-order bits would be flags determining whether the scanner is inside a READ, OUTPUT, number, etc.

I came up with what I think was a rather clever trick for implementing token-lexeme pairs. I would use a union type where the tokens are the fields of the union and the lexemes are the values. Like so:

Once the tokens are scanned, they can be arranged one-by-one into a doubly linked list. A doubly linked list will allow easy access to either end of the list, so that tokens can be accessed in the same order in which they were scanned.

After the syntactic analysis, the token-lexeme pairs will be arranged into an abstract syntax tree by the parser. I have not put much thought into how to implement this part. I'm also not entirely sure how the semantic analysis should be carried out, whether I should find some way to implement an attribute grammar.

Overall, this is a very exciting project that will take a lot of creativity to complete. I will be employing some of the most advanced knowledge and techniques I currently know.]]>Fri, 05 Dec 2014 15:33:00 +0000http://forum.codecall.net/blog/1277/entry-2034-new-project-implementing-a-simple-language/http://forum.codecall.net/blog/1699/entry-2022-accessing-sharepoint-lists-using-object-oriented-javascriptjquery/
That was the case with this one item. It was for an emergency site that contained information links, etc., about the latest headlines regarding this specific topic.

So, me and my very limited SharePoint experience was asked to help get this done. So, my education into SharePoint began. Since this project was a simple web page hosted in SharePoint, it seemed very simple. Create a web page that read a SharePoint list, and display the results on the page. Very simple.

I got the results I needed. This was going to be an easy task.......too easy. During testing, most testers found that it worked perfectly. But thankfully, one tester tried it first thing in the morning, BEFORE logging into SharePoint first. That's when the huge problem arose. In SharePoint 2010, anonymous access to the REST service is blocked. There isn't a setting to enable it either. This has been fixed in SP 2013, but this is 2010.

Back to square one.

Since rest wasn't an option, we had to use the standard SOAP list service. Back to learning about SharePoint again.

One developer soon found some code that accessed the lists through the sp.js javascript file. In testing, it didn't seem to work on a web page. It was discovered that it only worked in SharePoint web parts.

Great. I have to learn another thing about SharePoint. I already learned that I hated it so far

The main thing to note is that the variable listItems is now a member variable of the object, not a global.

The asynchronous call of executeQueryAsync, takes 2 parameters, one to call if the process is successful, and one to call if it fails.

This actually posed a slight problem. I needed to access the data in the successful callback. I tried adding the parameter to the success delegate, but it didn't work correctly. It was a timing issue. When you create the delegate, the value has not yet been populated, thus the value passed to the callback was always null.

To counter this, I simply called an internal callback function that accessed the data values AFTER the async call.

I hope this saves someone the headaches that I had endured while figuring this out. It was a headache, but it gave me an education into SharePoint. What I learned most about SharePoint was that I hate SharePoint ]]>Fri, 07 Nov 2014 14:37:28 +0000http://forum.codecall.net/blog/1699/entry-2022-accessing-sharepoint-lists-using-object-oriented-javascriptjquery/http://forum.codecall.net/blog/1827/entry-2021-where-have-you-been-kadence/
I originally planned to only be away for two weeks, I thought how busy I was would stop after a few weeks, but no I'm very active all the time in the 36 Days I've been here I have had only 3 days where I have not been doing something the studies are challenging and fun, not stressful but not easy either.

I will probably blog more and I will definitely be back on CC more often now I know my work load and how much is going on.

Lots of love
Mod Kadence]]>Sat, 25 Oct 2014 13:15:00 +0000http://forum.codecall.net/blog/1827/entry-2021-where-have-you-been-kadence/http://forum.codecall.net/blog/1699/entry-2020-a-very-simple-scroll-to-top-in-c-mvc-using-jquery/
So, here is an incredibly easy way to create a clickable "scroll to top" to bring them to the top of the page.

The application was done in MVC 5, in C#, but nothing here, other than the location of the div is specific to MVC, or C# at all.

First, I place the div for the Layout (or Master Page) inside the content div, which renders to the child pages.

That's basically it. A nice little effect with minimal work, that will work on any page that uses the layout (master page).]]>Wed, 15 Oct 2014 13:37:16 +0000http://forum.codecall.net/blog/1699/entry-2020-a-very-simple-scroll-to-top-in-c-mvc-using-jquery/http://forum.codecall.net/blog/1829/entry-2019-php-based-job-scheduler/

Attached thumbnail(s)

]]>Tue, 16 Sep 2014 13:18:00 +0000http://forum.codecall.net/blog/1829/entry-2019-php-based-job-scheduler/http://forum.codecall.net/blog/1699/entry-2018-the-not-so-hidden-cost-of-compressed-air-cans/
). Not only was I using them for the above items, my kids were using the air can for various uses. The cans seemed to disappear, and we were off to Costco for more. We were going through cans fairly quickly.

About a year ago, I went into Costco and looked for them myself. I couldn't believe the amount of money I was spending over the years. Each can ran about $6. That doesn't seem like much, but considering the expansion of uses, it adds up quickly.

I started looking at compressors. I was looking for a portable one that I could move to different locations for the various uses. I read tons and tons of reviews and found a few that were around $100. At $100, it wasn't very easy to justify buying one, just to replace air cans. But something happened, and a hardware chain had one of the highly rated ones on sale for $49. I was ready to get it, when I realized that I should check my email, since I regularly get coupons from them. There it was, a $10 off $50 coupon. I picked up the compressor and padded it with a workshop pencil for $1.19 to surpass the $50. So essentially, I got a 2 gallon compressor for $40.

I have never looked back. When you have a compressor, you have so many more options over air cans. You can inflate bike/car tires, and you can attach air tools to it. Since this model also has a regulator, I can use it for air brushing. All this expanded functionality for the price of a few throw-away air cans.

If you use compressed air cans, I recommend doing your homework on compressors. Make sure you get one with a regulator, which regulates the pressure. It may be a little money up front, but it will save you money in the long run. Wait for a deal and grab one.]]>Tue, 02 Sep 2014 18:01:29 +0000http://forum.codecall.net/blog/1699/entry-2018-the-not-so-hidden-cost-of-compressed-air-cans/http://forum.codecall.net/blog/1277/entry-2017-im-back/
Well, I guess this calls for an update, some kind of explanation for why I've been gone so long and what I've been doing all this time. Well, basically, my life was in a constant downward spiral for a couple of years. I had a series of hospitalizations for psychiatric issues - first psychosis and then bipolar symptoms. I had to quit my job because I realized I wasn't able to work anymore due to everything that was going on. That was back in January 2013, though I hadn't worked at that job since the end of October 2012. That summer I had some more psychiatric problems, which I still can't ascribe to any specific cause. I started to lose contact with reality, retreating into a fantasy world. I no longer cared about real life, only my fantasy world of speculating about things that would probably never happen. I was stuck in that loop for almost a year. I lost interest in programming and mathematics. I did do one positive thing, which is I took up an interest in art. I spent some time drawing (though mostly I was just fantasizing) and I hung out on DeviantArt for a while. Last March I moved out of my parents' house and into a group home, and that made everything even worse. I lost my ability to drive due to my seizure disorder, which had been under control for a while, until I started having an allergic reaction to the medication I was on and had to be taken off it. I was still spending my money like I had an unlimited supply, and I ended up running out last June. At the same time a bunch of my things broke, things that I absolutely depended on for conducting my daily life, and I had to shell out huge sums of cash to fix or replace them. So I was left with no money, no car, no job, no friends, no parents to help me out, nothing.

But I learned to adapt. I started economizing with what little money I had. I worked to eliminate all the self-defeating behaviors I had, that I could no longer afford to continue - impulse buying, excessive fantasizing, explosive irritability, etc. I took a gradual, holistic approach to improving my situation, using a method of getting rid of bad habits one by one and slowly building up good habits. I knew that the first step was to improve my overall health - mental, physical, and spiritual. I started a regimen of daily meditation, along with mindfulness. I started studying Buddhism and learning about the Noble Eightfold Path. It was obvious that what I had been doing so far wasn't working, and I had to try something completely new. I couldn't go on living the way I was, and none of the life skills I had learned thus far had had any effect in rectifying my situation. The only remedy was to effect drastic changes in the way I think, feel, and live.

Now, after more than two years of fighting wall after wall, I'm finally starting to see some improvement. I have another job now; it's not much, but I get a little bit of money from it. I went from spending $500 to $1000 a month on things I would probably never use to having a weekly budget of only $25, which I have been able to stick to. I've figured out the root cause of the fantasizing and eliminated it, and I've also gotten over my sexual addiction and managed to maintain a lifestyle of complete celibacy. My irritability has significantly decreased - whereas in the past I would throw a fit every time my computer was slow or a vending machine ate my money, now I can have my computer break on me without even raising my voice. In fact today my Debian box failed to boot at all - I think I had it off and unplugged for too long and the CMOS battery died, causing the BIOS settings to be lost, and now I have to pay someone to manually reset the BIOS, but I don't have enough money - I will have to go without Linux, TeX, Common Lisp, etc. for a while, until I can save up some more money. But I handled it well; I figured out what was probably wrong with my computer, without getting really irritable. This isn't just a single occurrence either; this $hit happens to me on a regular basis. I've had horrible luck lately. Everything good that has happened in my life has been solely a result of my own hard work and ingenuity; I have had almost no luck or help to aid me.

There have been some other improvements as well. People around me have been a lot more friendly with me for some reason. I think it has a lot to do with the calm, peaceful, affable vibe I'm now giving off due to months of practicing mindfulness and meditation. I'm also able to think more clearly, to see things more objectively, to remember things I'm supposed to do, and to deal with life intelligently without having to overanalyze it. I'm also able to understand concepts I'm learning better. Since I started studying mathematics and computer science again, trying to relearn all the things I forgot during the worst few months of my life, I can easily understand things like Karnaugh maps, RS flip-flops, D flip-flops, bases of vector spaces, and the theory of cardinal arithmetic. I think this is partly due to the time I spent studying mathematics in 2012, which instilled in me a much better aptitude for understanding rigorous mathematical principles, and possibly partly due to my healthier lifestyle and more focused approach to learning. I'm correcting some misconceptions I had the first time I read these books. For example, I used to not understand the Schröder-Bernstein theorem because I thought it was a trivial statement that if A and B are cardinal numbers, then A ≤ B and B ≥ A implies A = B, which is obvious. Now I understand that the statement pertains not to simple ordering, but to the relation "is similar to a subset of", which makes the statement of the theorem far less obvious. I also understand the importance of the theorem in providing the necessary condition for proving that the set of rational numbers is countable. I also used to think that the completeness of the real number line precluded the existence of surreal numbers (nonreal numbers between real numbers); now I understand that surreal numbers are a possibility because the real numbers are not dense within the surreal numbers.

Right now I'm taking a more balanced approach to my self education. Rather than focusing on one subject for a few months and then abandoning it for another, I'm focusing on several areas of learning. I'm currently studying mathematics, computer science, and physics, and trying to teach myself TeX (though I won't be able to actually use it). I've put the drawing aside for a while, but I'm going to come back to it in a couple weeks, and then it will be fresh and new. I'm rediscovering everything that used to fascinate me, as well as reconnecting with the computer geek community and the mathematical community. I started reading Slashdot again. Looks like Steve Ballmer quit Microsoft, and now MS is being led by a computer geek. That's a positive change to say the least. I kinda wish the same thing would happen with Apple. Since I can no longer use gcc and make (on either my Mac or my Debian box), I'm figuring out how to use XCode, so I can start C programming again. I worked out how to make a command line program, but for some reason it spits out a compiler error whenever I try to use multiple C files. So no modular programming for a while; I'm going to have to compress all my code into one megalithic source file.

I'm coming back to CodeCall, hoping all the people I knew are still here. WingedPanther, gregwarner, Guest, Alexander. I'd love to hear from you guys if you're still here. ]]>Sun, 31 Aug 2014 13:52:00 +0000http://forum.codecall.net/blog/1277/entry-2017-im-back/http://forum.codecall.net/blog/1665/entry-2016-vaielabs-rant-what-is-cloud/
We all heard this new buzzword "cloud", and I have some clients that absolutly want to be on the "cloud" but don't even really know what it is...
But the truth is no one really know what cloud is.

That it's, it's just a buzzword to make you feel bigger (normally there is some pills for that, but theses day, the important thing, is your server size)

I've been with Rackspace for the last 2months on their "cloud" services... and I won't be there for a third month.
In the first 2 months I was there, they were 3 downtime (that I know about), theses are the logs
0150: (40 min) (hardware issue, Strike 1) Server2
9730: (20 min) (Network issue, no strike) Server1
9527: (20 min) (hypervisor issue, no strike) Server1

First thing that pop in mind is the downtime #0150. They say it's was 40minutes long... but I was on the live chat trying to find a solution for over 90minutes (I do have the chat logs with timestamp to prove it), plus the time that I got my first call because the server wasen't running, plus the time I stop the live chat because I could not do anything more. So the downtime was more like 2h30, but they are assuring me it was only 40minutes.

But hey... What? Hardware issue? On a cloud?
Normally, on a cloud, if a machine catch fire, your virtualos should be transfered to a other machine without you even realizing it, without any downtime (maybe a very little one)
Durant the live chat conversation, I ask them about changing the machine, and they told me it could be done, but will most likely take 3-4hours and they will have to use a 1 day old backup...
So I was kinda surprised about their "cloud", I even double check their logo, underneat it, we can read "The #1 managed cloud compagny"
To be #1 in something don't you have to offer it first?

So I ask them on a supports tickets: "What exactly are your criteria to say this is a cloud, even tho, my os is on one machine and cannot be moved (and to reinstall from a 1day old backup isn't what I call moved)"
The next day, I got an answer telling me for a question like this, they need to transfer me to a account manager...
What?!?!
I mean, anyone from the sale team should be able to answer this no? Sale team, engeneer, programmer, probably even the guy cleaning up the bathroom at rackspace should be able to answer this!

So I waited... and waited, waited... 7 days later, still no anwser.
I reply to the ticket again... and waited, waited, 2days later, no answer... so I join the live chat telling them if I don't have a answer soon, I'll simply quit.
2 hours later, I finally got an answer: "To answer your question, we call our Cloud Servers cloud since it is truly a Cloud offering. Even though your Cloud servers are provisioned on a single host(usually in different parts of our datacenter), that still makes it Cloud because you have the flexibility to add, delete, replicate and move servers automatically to provide redundancy. "

Are they talking about a control panel?
If I have any kind of architecture and I add a control panel to create them, modify, delete, I can call this a cloud?

That awesome! At home, I have a computer with a headless virtualbox installed on it, and I control it with phpvirtualbox, I can create machine with that, back them up, modify and delete them, I did not know I had a cloud at home! Suddently, I feel so much more important!

So I ask them about that... and now I'm waiting, hopefully I'll get an answer in the next 7days

To answer this blog's question: "What is cloud?" it's easy, no one know, anyone can invent their own definition of cloud and it's ok... Cloud is only a buzzword to be able to sell your stuff at a much higher price.
But one thing sure, I'm gonna leave rackspace as soon as I find a other place to host my projects.

Have you had experience with real or false cloud?
What do you consider cloud is?
Or do you have some good decicated server with managed service to suggest me?]]>Wed, 20 Aug 2014 16:53:00 +0000http://forum.codecall.net/blog/1665/entry-2016-vaielabs-rant-what-is-cloud/http://forum.codecall.net/blog/1665/entry-2015-vaielabs-rant-government/
But sometime, seriously, I feel like my government is so stupid!

Here, I'm not talking about corruption, or bad decision in general (because everybody knows we are good at making them), I'm talking about decision made by 50-60years old people who know nothing about technology and making laws that simply make life harder for everyone.

Here's a example: In Quebec, we speak french, and this, for a lots of people is very important (that will probably be my next rant). So we have a law, everything has to be at least 51% in french.
So if you show a ads, and you want the text both in french and in english, the french version has to be bigger than the english text.
That is not so bad, because it's public ads, so we should prioritize the french version.
But when it come to my personal preferences, now I have a problem.
With my tv provider, I can select what channel I wish to have. Personally, I prefer english tv, so I mostly pick english channel (obviously). But because of that, my tv provider had to add a lots of useless channel in french that no one ever watch (I have 3 24/24 tv ads commercial channel, and 4 channel that only show the same government debate in different angle... why would I want to pick a angle to view a government debate?!?!)

Actually, this is only an example to come to my point, I don't think it's too bad, it's just annoying.

About 4years ago, the government decided that receiving phone call from compagny trying to sell you something was such a big trouble that they needed to make a law forbidding it.
In 8years living in appartement, I think I received 2 or 3 undesired call, but now, because of that law, when a compagny want to contact me (remind me of a appointment, or telling me something important), it's almost impossible.
But phone spammer are not stupid (in contrast to my governement), they understood that since we know compagny can't call us for selling us stuff, if someone is calling us, it will be for a "legit" reason.
So since that day, every 2 days, I get a phone call telling me (by a recorded message) that I won a trip to somewhere, all I needed is to tell them my personal infos.
And this is perfectly legit since the law forbid compagny to contact us from inside Canada, but theses days, it's pretty easy with ip phone to start a call from outside Canada even if we are physically here.

So now, we have to live with this every day, and there is absolutly nothing to do, but we get used to it.

But now, they did it again!
Since the first of the month, it is illegal by law for compagny to send you emails without your express consent. Again, that sound good in theory.
17 days ago, I was receiving maybe 1 spam email every months, but now, for the last 16days, I'm receiving at least 7 or 8 spams every days!
And on all my emails (personnal email, job email, gmail, hotmail...) so that is not because I got a email published somewhere.
Yeah, good job governement. Didn't they learn with their mistake with the phone's law?
The same exact thing, but it was made to "help" people, and decided by someone who has no idea how the world really work.

I really wished that someday they would leave me alone, the real way to help me would be to stop trying to help me!
Someday I will create my own country and be happy in it, until that day, there is nothing to do, just pay your taxes and shut up.
Now it's done, if they ever decided to revoke thoses laws, it will be even worst, not everything can be undone.

I know on this forum there people from around the world, how are your governement about technological decision (try to stay on topic of technology)?
Are you in peace with them or you wish to create your own country like me?

---
Edit: and since the moment I publish this, I received 4 new spams, someone want a affair with me, I won a price, I can find love and I can stop aging!]]>Wed, 16 Jul 2014 14:53:00 +0000http://forum.codecall.net/blog/1665/entry-2015-vaielabs-rant-government/