samedi, mai 01, 2021

World mapped crypto metaverse - managing diverging interests part II: Jerusalem / unresolved real world controversies

 This is  the 2nd blog post of a series about OVR, a virtual land different from other metaverses. It is different because it maps above the physical world and this has many implications due to human psychology.

There are many land conflicts in the real world which are called wars. Hopefully (or not?), they should be solved by contract in the crypto metaverses.

However some controversial sites, even if they exist in land nominally at peace, are controversial or highly controversial. Jerusalem is the most obvious one where 3 religions inerests and holy landmarks collide. While religion is always a big part of the controversies linked to these sites, history also always plays a role in the story.

Jerusalem holy sites area is "locked" today by OVR management, and this is good.

The answer to the question: Is total building freedom something that should be wished? is obviously a big NO!

Each site needs specific attention, policy & diplomacy, that will not apply to other controversial sites, but the subject can already be discussed.

Context

Usually, millenaries ago, a group of people assigned a specific meaning to a site and erected a landmark on it. Then centuries later, another group of invaders erected another landmark at the same place as a way to make visible their power & truth. 

But the original group didn't disappear and still hold the place as an important part of their culture today.

Discussion as a list of open questions

Who should decide what to build?

In the crypto metaverse, contractually, the owner decides what to build. 
Morally, the decision of what to do with the building should be a collective decision.

Should a vote be held? 

  • On what basis should the electoral college be built?
  • What would be the the place made for the minority?

Should there be a menu at the entry of the building enabling the visitor to see the building she wants?
Should there be alternative days or hours with different featured huildings?

  • With building ratios based on vote?

Let the local people decide?

  • Who are local people in a metaverse?
    • Surrounding lands owners?
    • Local physical world inhabitants?

Should the controversy be solved?

Why not leaving the site empty as a sign that crypto world acknowledges physical world issues and doesn't consider it can solve all issues?

Tentative list of controversial sites

Jerusalem, Hagia Sophia, Ayodhya, Yasukuni shrine, Hebron's cave of the Patriarchs.

mardi, avril 06, 2021

World mapped crypto metaverse - managing diverging interests part I: Macao / virtual local governance

 This is  the first blog post of a series about OVR a decentralized augmented reality world. OVR is fundamentally different from other metaverses in that it maps above the physical world and this has many implications.

OVR is still in its infancy and there are a whole lot of unanswered questions and possible solutions.

Open OVR questions

When exploring lands with OVR interface, rivers, roads and buildings plus road can be seen with their real-world names. This throws up some interesting questions:

  • What is the freedom that will be left to owners to build an environment? 
  • Can someone buying all hexagons across the fifth avenue, build a wall and be able to block traffic?
  • Can an owner build a virtual building outside the boundaries defined in the hex in the real world?
  • Is total building freedom something that should be encouraged or forbidden?

This post was written early in my discovery of augmented reality and I now better grasp what could be the answers: there are no definite answers.

Exploring answers

  • What is the freedom that will be left to owners to build an environment? 
    • If we look at what is happening in Decentraland, there is total freedom inside the hex up to a certain height. Having many contiguous hexes increase allowed height. 
    • But Decentraland is a VR world while OVR is an AR world.
  • Can someone buying all hexes across the 5th avenue, build a wall and be able to block traffic?
  • Can an owner build a building outside the boundaries defined in the hex in the real world?
    • Let's suppose that this is the case... Regarding walls, it's possible to teleport anyway. Regarding whatever you want in your hex: we're in digital world. As long as it doesn't promote hatred or unlawful digital attitudes, it should be fine.
  • Is total building freedom something that should be wished?
    • If a bunch of hexes is alone in the wild, I guess it's OK.

But what about places where several stakeholders are involved with diverging interests?

From there, 2 different types of possible conflicts should be distinguished:
  • When deep cultural or string religious feelings are involved that will be addressed in a later post, i.e. jew religious landmarks, churches, mosques @ Jerusalem.
  • When some financial is at stake like a famous commercial street such as the fifth avenue in New York or Macao casinos.

Macao Casinos on Cotai

Why casinos in specific places have big potential on OVR

What is missing on Decentraland Casinos though? Some connection with the real world. this physical and emotional connection is brought by OVR with Las Vegas & Macao locations. 


Success of a place as Macao most probably needs some kind of governance in order to offer the visitor:
  • Unity, towards the same goal: gambling. I guess it's obvious and doesn't need any governance, but some sort of rules such as agreeing on not promoting internet sex is needed? 
  • Diversity (same as physical world where several casinos are installed).
  • Accessibility (move between different sites without constant teleportation)
How can this be achieved?
  • Another contract supported by another layer of ERC20 coin? 
  • Activate a new organisation on https://colony.io/?
  • Begin to organize Macao at "OVR land level" . "OVR land level" means use what is available and known today in OVR land.

Organize Macau at "OVR land level" in 4 steps.

  1. Make sure some streets with continuity allowing access to various lands without any walls. I built some of those streets in Macao : status- started
  2. Advertising for Macao: status - started with this post
    • In the real world, Macao,is far ahead of Las Vegas in terms of gambling revenue.
    • While in OVR the Las Vegas strip is almost already 90% owned, Macao land is still 95% available. 
  3. Buy lands in Las Vegas : status- started
    • to display advertising boards for Macao
    • to install one way teleportation machines to Macao

Casinos on OVR land are starting their history!

Given the OVR land management open questions. Let's be proactive to make sure that Macao consumer's experience is superior.









mercredi, février 20, 2019

ECC backdoors for dummies in 5 steps

It will be explained in the most simple and pragmatic way, what possible ECC backdoors look like and why choosing the right curve and the right prime number to build the cryptographic curve is important.

1st step: understand how ecc cryptography works

Read and meditate https://www.coindesk.com/math-behind-bitcoin/


2nd step: Understand graphically how a scalar multiplication looks like when choosing the right base point with a good prime number on a good curve 


We first takes a random base point (2,22) and scalar multiply from 1 to n until it reaches infinity or point (0,0), then we look for the next base point that was not part of previous loop and multiply it, and so on until there are no free untouched base points.

For [y2 = x3 + 0x + 7  Ordre 67  size 78] curve whatever base point you start with, the loop contains all points of the curve (plus(0,0)), Thus there is only one curve.

To decrypt some data, without knowing the key, using these parameters you have to do 78 tests.


3rd step: choose a wrong prime number on a good curve


We first takes a random base point (1,9) and scalr multiply from 1 to n until it reaches infinity or point (0,0), then we look for the next base point that was not part of previous loop (6,2) and multiply it, and so on until there are no free untouched base points.

For [y2 = x3 + 0x + 7  Ordre 73  size 63] curve, loop sizes are 8 or 4.  

To decrypt some data, without knowing the key, using these parameters you have to do only a maximum of 8 tests.

What makes the [y2 = x3 + 0x + 7  Ordre 73  size 63] curve a bad choice is that at least one base point is on the x axis here zero_base_points are (42,0), (44,0) & (60,0)

4th step: choose a wrong curve

Some curves do not show any prime number without any zero_base_points:

(y2 = x3 + 0x + 1,TreeSet())
(y2 = x3 + 0x + 2,TreeSet(13, 37, 67, 139, 379, 541))
(y2 = x3 + 0x + 3,TreeSet(7, 31, 43, 79, 163, 199, 223, 463))
(y2 = x3 + 0x + 4,TreeSet())
(y2 = x3 + 0x + 5,TreeSet(43, 73, 193, 223, 277, 307, 397, 433))
(y2 = x3 + 0x + 6,TreeSet(31, 199, 223, 271, 367))
(y2 = x3 + 0x + 7,TreeSet(67, 229, 241, 499))
(y2 = x3 + 0x + 8,TreeSet())


5th step: going further open points

https://www.coindesk.com/math-behind-bitcoin/
https://crypto.stackexchange.com/questions/44304/understanding-elliptic-curve-point-addition-over-a-finite-field
https://fr.wikipedia.org/wiki/Courbe_elliptiquehttps://en.wikipedia.org/wiki/Elliptic_curve_point_multiplication#Point_addition

The code to draw these curves : https://github.com/emariacher/kebra/blob/master/elliptique_sbt/core/src/main/scala/FaisGaffeAuxBackDoors.scala

lundi, juin 24, 2013

How bitcoin may be already crumbling under its own success


The bitcoin community has recently discussed about government interference, but today, I want to discuss 2 mostly overlooked bitcoin news:
 * blockchain has reached a size of 8 Gb
 * transactions shall have, now, a minimum size

 These 2 events/news are closely related. Every transaction contributes to the 8Gb ledger size, and "they (the miners?)" want to limit the ledger size. This will be done by fighting transaction spam i.e. eliminating insignifiant exchanges and non-financial transactions such as those initiated by satoshidice.

Why is it needed to limit transactions when there are so few users?
Is limiting transactions today a sign that bitcoin will not scale well?

Some predict that bitcoin market capitalization will reach orders tens, hundred of billions or even trillions.
 * How many people will use bitcoins in a few years?
 * What will be, then, the size of the bitcoin ledger? Will it still be manageable? 

Most probably to keep the ledger at a computable size, transaction size will be limited to higher limits. People will be less able to use it, then, for day to day transactions, if the limit is set to 0.1 bitcoin (equivalent to 100$?) for instance.

Maybe are we going to need to use other currencies, for smaller amounts, such as litecoin sometimes deemed as "silver compared to bitcoin's gold"? If "open currencies" become mainstream, I guess in addition to gold and silver, copper, iron, lead and feather coins are going to be needed to be able to manage the huge number of transactions when half the planet is going to use these new currencies.

Today's amount of transfers is looking like ripples compared to tomorrow's tsunamis of transactions. If we consider bitcoin as the "Napster" of open currencies and expect future open currencies, answering to those questions, which I personnally find unsolved yet, is something essential.

Or ... did I miss something?
A few weeks ago, I understood that maybe oldest parts of the ledger will be dropped. When will that happen?

 Anyway the amount of transactions is already a problem because today  "they" feel they should limit the number of transactions.

vendredi, novembre 02, 2012

Managing dates with a DSL implemented in Scala

Following Paulo "JCranky" Siqueira's post who himself built it based on Sergio Lopes's post, I also enhanced this class by adding the ability to set dates and to compare them.

Another good link: Baysick: A Scala DSL Implementing BASIC



package kebra

import java.util.Calendar
import java.text.SimpleDateFormat
import java.text.ParsePosition

class DateDSL(val cal: Calendar) {
 cal.clear(Calendar.HOUR)
 import DateDSL.Conjunction
 
 def this(d: DateDSL) = this(d.cal)

 private var last = 0;

 def plus(num: Int) = { last = num; this }
 def minus(num: Int) = { last = -num; this }

 def +(num: Int) = plus(num)
 def -(num: Int) = minus(num)

 def months = { cal.add(Calendar.MONTH, last); this }
 def months(and: Conjunction): DateDSL = months
 def month = months
 def month(and: Conjunction): DateDSL = months

 def years = { cal.add(Calendar.YEAR, last); this }
 def years(and: Conjunction): DateDSL = years
 def year = years
 def year(and: Conjunction): DateDSL = years

 def days = { cal.add(Calendar.DAY_OF_MONTH, last); this }
 def days(and: Conjunction): DateDSL = days
 def day = days
 def day(and: Conjunction): DateDSL = days

 def is(then: Calendar) = {
  cal.setTimeInMillis(then.getTimeInMillis)
  cal.clear(Calendar.HOUR)
  this
 }

 def is(then: String) = {
  val cthen = ParseDate(then,"MM/dd/yyyy")
  cal.setTimeInMillis(cthen.getTimeInMillis)
  cal.clear(Calendar.HOUR)
  this
 }

 def ParseDate(s_date: String, s_format: String): Calendar = {
  var cal = Calendar.getInstance()
  cal.setTime(new SimpleDateFormat(s_format).parse(s_date, new ParsePosition(0)))
  cal
 }

 def before(d: DateDSL): Boolean = cal.before(d.cal)
 def after(d: DateDSL): Boolean = cal.after(d.cal)

 override def toString = new String(new SimpleDateFormat("ddMMMyy").format(cal.getTime()))
}

object DateDSL {
 class Conjunction
 val and = new Conjunction

 def Today = new DateDSL(Calendar.getInstance)
 def Tomorrow = Today + 1 day
 def Yesterday = Today - 1 day

 def today = Today
 def tomorrow = Tomorrow
 def yesterday = Yesterday

 def Now = Today
 def now = Today
}
I also added a testcase below:
package kebra

import java.util.Calendar
import java.text.SimpleDateFormat
import kebra.DateDSL._


object TestKebra extends App {

 println("Hello World!")
 println(Tomorrow minus 1 month and plus 10 years and plus 1 day)
 println(Today + 2 months and plus 9 years and minus 1 day)
 println(Today - 9 years and minus 1 day)
 println(((Today + 2 months and) + 9 years and) - 1 day)
 println(now is "10/1/2011" plus 3 days)
 println("\n"+printZisday((now is "10/1/2011" plus 3 days).cal,"ddMMMyy"))
 assert(printZisday((now is "10/1/2011" plus 3 days).cal,"MM/dd/yyyy").indexOf("10/04/2011")==0)
 assert((now is "10/1/2011" plus 3 days).before(now is "10/1/2011" plus 4 days))
 assert((now is "10/1/2011" plus 4 days).after(now is "10/2/2011" plus 2 days))
 
 val zendDate = new DateDSL(now is "2/2/2011")
 var ago = new DateDSL(now is "2/2/2011" minus (9*7) days)
 println("***** ago: "+ago+", zendDate: "+zendDate)
 while(ago.before(zendDate)) {
  println("      ago: "+ago)
  ago plus 7 days
 }
 println("***** ago: "+ago+", zendDate: "+zendDate)
 assert((ago plus 1 day).after(zendDate))
 println("***** ago: "+ago+", zendDate: "+zendDate)
 assert((ago minus 2 days).before(zendDate))
 println("***** ago: "+ago+", zendDate: "+zendDate)
 
 def printZisday(zisday:  Calendar, fmt: String): String = new String(new SimpleDateFormat(fmt).format(zisday.getTime()))
}

jeudi, décembre 08, 2011

Simple linear regression in Scala

Here is how to compute Simple linear regression in Scala.
Class LinearRegression takes in n measurements from a List[(x: Double, y: Double)] and computes the line that best fits the data according to the least squares metric.
This Scala program is the scala translation of the java program available at http://introcs.cs.princeton.edu/java/97data/LinearRegression.java.html .
class LinearRegression(val pairs: List[(Double,Double)]) { 
 val size = pairs.size
 println("pairs = " + pairs)

 // first pass: read in data, compute xbar and ybar
 val sums = pairs.foldLeft(new X_X2_Y(0D,0D,0D))(_ + new X_X2_Y(_))
 val bars = (sums.x / size, sums.y / size)

 // second pass: compute summary statistics
 val sumstats = pairs.foldLeft(new X2_Y2_XY(0D,0D,0D))(_ + new X2_Y2_XY(_, bars))

 val beta1 = sumstats.xy / sumstats.x2
 val beta0 = bars._2 - (beta1 * bars._1)
 val betas = (beta0, beta1)

 println("y = " + ("%4.3f" format beta1) + " * x + " + ("%4.3f" format beta0))

 // analyze results
 val correlation = pairs.foldLeft(new RSS_SSR(0D,0D))(_ + RSS_SSR.build(_, bars, betas))
 val R2 = correlation.ssr / sumstats.y2
 val svar = correlation.rss / (size - 2)
 val svar1 = svar / sumstats.x2
 val svar0 = ( svar / size ) + ( bars._1 * bars._1 * svar1)
 val svar0bis = svar * sums.x2 / (size * sumstats.x2)
 println("R^2                 = " + R2)
 println("std error of beta_1 = " + Math.sqrt(svar1))
 println("std error of beta_0 = " + Math.sqrt(svar0))
 println("std error of beta_0 = " + Math.sqrt(svar0bis))
 println("SSTO = " + sumstats.y2)
 println("SSE  = " + correlation.rss)
 println("SSR  = " + correlation.ssr)
}

object RSS_SSR {
 def build(p: (Double,Double), bars: (Double,Double), betas: (Double,Double)): RSS_SSR = {
  val fit = (betas._2 * p._1) + betas._1
  val rss = (fit-p._2) * (fit-p._2)
  val ssr = (fit-bars._2) * (fit-bars._2)
  new RSS_SSR(rss, ssr)
 }
}

class RSS_SSR(val rss: Double, val ssr: Double) {
 def +(p: RSS_SSR): RSS_SSR = new RSS_SSR(rss+p.rss, ssr+p.ssr)
}

class X_X2_Y(val x: Double, val x2: Double, val y: Double) {
 def this(p: (Double,Double)) = this(p._1, p._1*p._1, p._2)
 def +(p: X_X2_Y): X_X2_Y = new X_X2_Y(x+p.x,x2+p.x2,y+p.y)
}

class X2_Y2_XY(val x2: Double, val y2: Double, val xy: Double) {
 def this(p: (Double,Double), bars: (Double,Double)) = this((p._1-bars._1)*(p._1-bars._1), (p._2-bars._2)*(p._2-bars._2),(p._1-bars._1)*(p._2-bars._2))
 def +(p: X2_Y2_XY): X2_Y2_XY = new X2_Y2_XY(x2+p.x2,y2+p.y2,xy+p.xy)
}

mardi, novembre 29, 2011

Concrete Scala Map and SortedMap example

This is a concrete Scala Map and SortedMap example.
I wrote this post because I found it very difficult to find the right information when trying to get a concrete Map and SortedMap.
class StringOrder extends Ordering[String] {
 override def compare(s1: String, s2: String) = s1.compare(s2)
}
class MyParameter() {}


class ZeParameters(val pairs:List[(String,MyParameter)] = Nil) extends SortedMap[String,MyParameter] {
 /**** Minimal Map stuff begin ****/
 lazy val keyLookup = Map() ++ pairs
 override def get(key: String): Option[MyParameter] = keyLookup.get(key)
 override def iterator: Iterator[(String, MyParameter)] = pairs.reverseIterator
 override def + [B1 >: MyParameter](kv: (String, B1)) = {
  val (key:String, value:MyParameter) = kv
  new ZeParameters((key,value) :: pairs)
 }
 override def -(key: String): ZeParameters  = new ZeParameters(pairs.filterNot(_._1 == key))
 /**** Minimal map stuff end ****/
 /**** Minimal SortedMap stuff begin ****/
 def rangeImpl (from: Option[String], until: Option[String]): ZeParameters = {
  val out = pairs.filter((p: (String, MyParameter)) => {
   var compareFrom = 0
   from match {
    case Some(s) => compareFrom = p._1.compare(s)
    case _ =>
   }
   var compareUntil = 0
   until match {
    case Some(s) => compareUntil = p._1.compare(s)
    case _ =>
   }
   compareFrom>=0 && compareUntil<=0
  })
  new ZeParameters(out)
 }
 
 def ordering: Ordering[String] = new StringOrder
 /**** Minimal SortedMap stuff end ****/
}
Do not forget that you can also transform your map into a list and then use sortBy:
class ListSort {
  println(List((1.0,"zob"),(1.2,"zab"),(0.9,"zub")).sortBy{_._1})
}

jeudi, novembre 24, 2011

SW development / Agile SCRUM quotes

Ziv’s Law: Software Development is Inherently Unpredictable

Humphrey’s Law: Users Do Not Know What They Want Until They See Working Software

Conway’s Law: The Structure of the Organization Will Be Embedded in the Code

Wegner’s lemma: an interactive system can never be fully specified nor can it ever be fully tested

Langdon’s lemma: software evolves more rapidly as it approaches chaotic regions (taking care not to spill over into chaos)

jeudi, septembre 01, 2011

When programming in Java or Scala, I miss those C pre compiler macros __FILE__ , __LINE__ and __FUNC__ . I use them for logging where I am in my programs.

Well, I decided to have those in Scala, using Stack parsing after athrowing an interruption. I personally don't care if it's take time to execute.

There is one advantage compared to the C macros: you can get any upper level in the calling stack, which I sometimes find handy.


object util {
 val MatchFileLine = """.+\((.+)\..+:(\d+)\)""".r
 val MatchFunc = """(.+)\(.+""".r
 def main(args: Array[String]): Unit = { 
  println(util.tag(1))
  println(util.func(1))
 }
 def tag(i_level: Int): String = {
  val s_rien = ""
  try {
   throw new Exception()
  } catch {
   case unknown => unknown.getStackTrace.toList.apply(i_level).toString match {
    case MatchFileLine(file, line) => file+":"+line
    case _ => s_rien
   }
  }
 }

 def func(i_level: Int): String = {
  val s_rien = "functionNotFound"
  try {
   throw new Exception()
  } catch {
   case unknown => unknown.getStackTrace.toList.apply(i_level).toString match {
    case MatchFunc(funcs) => funcs.split('.').toList.last
    case _ => s_rien
   }
  } 
 }
}

class util() { }

vendredi, août 19, 2011

After 8 years, 6 specifics reasons for getting as many contacts as possible on LinkedIn


8 years ago, I started to be very active on social business networking. I registered on LinkedIn, Viadeo and Xing.

I then sent a huge number of invitations, using some programming techniques, gathering and guessing emails. And I got a fairly high number of contacts...

I now use Viadeo for France (6000+ 1st level contacts), LinkedIn for the world (20000+ 1st level contacts) and Xing for german speaking countries  (1000+ 1st level contacts).
Read my 2 most popular previous posts about business social networking:

Here are 6 specifics reasons why I feel I made the right choice: getting as many contacts as possible:
  1. In 2007, Through a chain of “weak contacts(*)” on LinkedIn I was able to hire a new employee in my team.
  2. In 2012, I was instrumental in getting an ex-colleague from the Bay area get hired by a famous company in Cuppertino. (I live in France and work in Switzerland).
  3. Once, I received a mail from someone writing me: “I want to thank you for just having forwarded an introduction for me, and because of this simple action, I got a 200K$/year job”
  4. In 2011, someone from my company HR, asked me several times to advertize some job position on LinkedIn, knowing I had a lot of contacts and it would get greater visibility.
  5. I regularly forward business opportunities to business development people in my company.
  6. Getting so many contacts demonstrates some persuasion ability. I got connected to 50% people through carefully crafted invitations. The 50% other part of my connections invited me.

As you can see, I did not get any personal advantage in having so many contacts. Networking is something I consider primarily as a service to others: to get a job, hire someone or simply do business together.

Here are the reasons why you should network with people such as me who have huge networks:
  1. You will see more profiles.
  2. You will be seen by more people.
  3. I always answer positively to requests for help, even if the requester is a young student working in another part of the world.
  4. If a request comes through me, it will be forwarded quickly because:
    • I am accessing my networking sites daily.
    • I know how to use the networking tools.
    • You will probably need less networking hopping as I have access to more people.
  5. I don’t do spam, because I value my huge network too much to annoy people with mass mailing.


Glossary:
A “weak contact” is someone, You have never closely interacted with in the real life.

jeudi, mars 10, 2011

Scala TreeSet: foreach vs foldLeft

Here is the best article I found to understand what is foldLeft. And here is an example on how to replace foreach with foldLeft:


class KbdKey() {
  def generateQuartets(): ListSet[Quartet] = {...}
}

class KbdMatrix() {
  var ts_keys = new TreeSet[KbdKey]()

  var l_quartets = ListSet.empty[Quartet];
  ts_keys.foreach(l_quartets ++= _.generateQuartets())

  // 2 lines above can be replaced by the line below

  val l_quartets = ts_keys.tail.foldLeft(ts_keys.head.generateQuartets)(_ ++ _.generateQuartets)
}

mercredi, mars 09, 2011

Scala Treeset example: partition

var ts_keys = new TreeSet[KbdKey]()(new CompareRowThenCol())

val (ts_inferiorOrEqualRowKeys,ts_superiorRowKeys) = ts_Keys.partition(_.i_row<=i_row)

class CompareRowThenCol extends Ordering[KbdKey] {
    def compare(k1: KbdKey, k2: KbdKey) = k1.value-k2.value
}

lundi, mars 07, 2011

Scala Treeset example: filter, groupBy, foldLeft, sortBy, etc...

A scala example doing various operations on a TreeSet containing keys organized in rows and columns and who have a certain type. Output is an html table.

def myPrint(i_type: Int, ts_keys: TreeSet[KbdKey]) {

  val lcol = (0 to 16)

  print(lcol.tail.foldLeft("Column [" + lcol.head +"]")(_ + "Column [" + _ +"]"))

  val ts_matrixFilteredByType = ts_keys.filter((k: KbdKey) => k.i_type==i_type)

  val m_matrixGroupByRow = ts_matrixFilteredByType.groupBy((k: KbdKey) => k.i_row)

  val m_matrixGroupBySortedRow = ListMap(m_matrixGroupByRow.toList.sortBy{_._1}:_*)

  m_matrixGroupBySortedRow.foreach((p:(Int, TreeSet[KbdKey])) => 
    print(p._2.tail.foldLeft("Row["+p._1+"]" + p._2.head.myprint)(_ + _.myprint) +"-"))
}

Things to notice are:
  • use of foldLeft to do some printing and not some plain summing "as usual".
  • groupBy returns pairs.

Scala and Java libraries in Eclipse

Don't try to mix scala and java in the same scala project in eclipse. You will 1st have the feeling that it works, but as they are not compiled the same way, it's better to have java and scala files in separate projects. Scala project should have the java project as a dependency.

To get it working, you have to do a lot of project cleaning, to "synchronize" both projects.

A Scala file using a Java class:
   import kbdmatrix_java._
   class KbdMatrix(val L: MyLog) {

The Java file:
   package kbdmatrix_java;
   public class MyLog {

Do not forget to advertize the Java class and its methods as public.