Dart is now an ECMA standard


Google’s Dart language is now an official ECMA standard with the catchy name of ECMA-408ECMA may not be a household name, but if you’re reading this, your browser is using ECMAscript to render at least some parts of this page. That’s because ECMAscript is the official standard body behind JavaScript. In the past, the organization has also been behind the specs for JSON, C#, the Office Open XML format and various CD-ROM specs.Credits: techcrunch

Hopefully now we can see Dart VMs in more browsers

 

My opinion on Javascript

Java Script is a good language for manipulating the DOM and maybe write some small scripts but I would hate to use it in a large project. This is because of the missing safety that strong typed languages have, refactoring or adding things in an existing javascript project would be a huge pain, maybe if you have test cases for everything you can do it with more confidence.

Prolog

Writing code with this programming language is always a chalange and always satisfing to solve problems with this language. I think the reason I like it so much is that it forces you to think in a different way, similar like FP programming does, I am planing to read some Prolog books in this weeked if I have time.

Public domain image from Pixabay

Flex Drag and Drop is broken

I am trying for  a week to make draging from a List or Tree into an HTMl work, but the framework is so broekn, soem events will nver fire like the dragdrop event, calling acceptDragDrop has no effect and later I noticed that mouseUp event are not fireing also(it works sometime in a test application so I fear is a layout thing, I read that  drops will not work on some containers but this seems to be a very stupid limitation.  

Flex setting the selectedItem on a tree freezes the application

application start freezing, after I debugged the code I found that the problem was the Tree setter selectedItem, googling I found this page http://forums.adobe.com/thread/823041 with people that have the same issue, the solution suggested was to call validateProperties before the problematic setter, this worked to make the app not freeze but the selectedItem did not done it's job so I used a callLater function to set the selectedItem  after an interval 

Egit merge

Today I made my first git merge, using EGit(an Eclipse plugin), I had to read a lot of documentation about egit, fix some conflicts and finaly commit the fixes. In the end all worked ok,not great  I am not sure I like how the conflict resolving works.

Accessing the ItemRenderer in a Flex spark DataGrid

I did not found a way to do this with the spark DataGrid, only with the mx one, the developers encapsulated very well the renderers. Because Flex is open source I read the code and finaly found a way to access the renderers. I could not use bindings in my case and I did not had other idea at that moment and because the renderers are very optimized it is hard to make them refresh.

 

 

My first scala steps

2Disclaimer(this is not a tutorial or how to, i am a newb to scala and i recod my thoughts)

I was reading about scala for a time now and yesterday i started coding. I started with a simple application, making some simple function and try to get used with the syntax. So i started coding without looking in the book(Programing in scala) or on the web(to really learn it,i used to copy paste or read then type code in the scala interpretor but those methods don’t let you make mistakes that will help you remember )



package scalaprim

object Main {

  /**
   * @param args the command line arguments
   */
  def main(args: Array[String]): Unit = {
    println("Hello, world!")
    println(divide(10,2))
    println(divide(10,3))
    println(isPrime(11))
    println(isPrime(4))
    //findPrimes(100)
    val primes=findPrimes3(100)
    //primes.foreach(println)
  //consecutivePrimes(primes);
  consecutivePrimes2(primes);
  }
def divide(number:Int,divizor:Int):Boolean=(number%divizor==0);
def isPrime(number:Int):Boolean={

  val range = 2.until(Math.sqrt(number).intValue +1)
  for (i <- range)
    {
    if(divide(number, i))
     return false;
  }
  return  true;
}
def findPrimes(number:Int):Unit={
    for(i <-2.until(number))
      {
        if(isPrime(i))
          println(i)
      }
  }
  def findPrimes2(number:Int):IndexedSeq[Int]={
    val range=2 until number+1
    val primes=range.filter(isPrime)
    return primes
  }
  def findPrimes3(number:Int):IndexedSeq[Int]={
    (2 until number+1)filter isPrime   
  }

  def consecutivePrimes(listOfPrimes:IndexedSeq[Int]):Unit={
    var i:Int=0;
    while(i{
        if(prev+2==curent)
          println(prev,",",curent)
         curent
        }})
  }
}


My conclusion on this project is that using scala i can write less code, especially it could be possible to skip using lots of for, i worked on a c++ program and i think i have more then 100 fors, and nested fors that could be easily replaced in scala with calls to filter or exist or something else. And reducing for is not only about code clarity but often you can make bugs in for loops, like mistaking the indices in nested loops or getting outside of the array bounds.

I will investigate Scala in my free time and hope i could put it to use in a large project.

P.S. blogilo is failing uploading my posts, hope eventualy this post will be uploaded(finding a fix and trying another apps)