Emptiness

EnsoZen

If you are brought up in a country of the West, chances are that the word emptiness invokes negative connotations. Lack of meaning, lack of emotions and affect, aimless activity, no vision, no desires or dreams.

Travel a bit eastward and, maybe, a few centuries back in time, and emptiness presents itself in all its buddhist glory. Emptiness, there, is the ceasing from all worldly and, therefore, according to buddhism, vain, preoccupations. Becoming void of desires, intentions, object directed thoughts, purposeful mental activity allows the inner truths to take shape. It’s immersing oneself into the primordial vacuum, which is full of light and potentialities.

It was in a moment of afternoon relaxation, doing nothing, expecting nothing, wishing for nothing, staring at the gentle beams of the setting sun coming through the window, while my daughter was crisscrossing the room cheerfully, exercising her newly found walking ability, that I remembered good old Buddha. Probably a podcast I listened recently worked its subconscious way to bring up such an association. The podcast was about two books from Stephen Asma, the first about the origin of the imagination and the other about religion.

Daydreaming, letting the thoughts follow the obscure and, often, unexpected paths of free association, is an endangered species of mental activity. When at home, we watch TV or surf the web. In the car we listen to music or radio broadcasts. A bus or the metro have become synonymous of people hooked on their smartphones.

When awake, we rarely stop focusing our attention onto something. Our activities are the outcome of intention. Unlike children, we have stopped playing, exploring, being open to the unknown and the unexpected.

Imagination is the offspring of day dreaming and free association. And religion, Buddhism in particular, is a means of emotional healing and rehabilitation. At least, that’s what I remember Asma saying in the podcast.

The above may sound overly philosophical, without practical importance or significance, suitable for lazy, navel-gazing.

Wrong!

Practical people are interested at least in one aspect of doing nothing: creativity and innovation.

I can’t recall how many times I have read the story of  August Kekulé’s discovery of the molecular structure of Benzene. Kekule was long trying to solve this problem in vain. One night, while he was sitting by the fireplace, weary from the day’s labours, he started drowsing and in his reverie he saw a snake bitting its own tail. The image is an ancient symbol,  a reference to ouboros (ουροβόρος), the tail eating snake. The image, by association,  led Kekulé  to imagine the shape of Benzene’s molecule as a ring. And he soon confirmed experimentally that it is actually a hexagon.

Ouroboros-benzene.svg

In terms of neural correlates, daydreaming and free association are related to the creation of new synapses, the formation of new neural paths and networks, connecting, often remote, parts of the brain to each other. The new connection literally transform the brain giving rise to new functions and possibilities. The subject experiences this new synapse formation as spark, enlightenment, problem solving, innovation and creativity.

You might argue that we don’t need to let daydreaming reign  as there is the real, night time, dreaming that is a similar, if not superior, activity. “Sleep on it”, we say when we advise someone to ‘outsource’ problem solving to sleep. And it works. But like daydreaming, real dreaming is also under siege. We are all sleep deprived, and, again screens are the most usual culprit.

Apart of the practical aspects of doing nothing,  letting our brains reshape, recalibrate and reform brings into our consciousness aspects of ourselves unknown. Realisations, understanding, comprehending and emotional deepening.  In short, it begets psychological  growth and maturity.

Time to stop.

Tariffs on Data

bernard-hermant-607979-unsplash

If you happen to follow the news, even superficially, you can’t have missed the looming trade war between the United States and, well, everyone else.

On June 1st, the Trump administration announced its decision to impose tariffs on steel and aluminum imports from Mexico, Canada, Brazil, South Korea and EU. These countries were temporarily excepted from the initial tariffs imposition against all the other countries of the world back in March. Australia continues to be excepted.

Retaliation came back almost immediately from Canada, Mexico and the EU.

To be honest, I know very little about steel or aluminum and it is not my intention to write about their tariffs.

The problem with trade wars is that they are rarely contained in a number of products. Retaliations lead to escalation and before you know it, it’s an all out trade war on everything.

In such a case all lose. But who loses the most?

I think it will be the US. 

But not for the usual reasons cited by free trade proponents.

They will lose because retaliations will hurt their most dominant sector. How? Read on.

On May 25 the new European GDPR regulation took effect. Although it is far from been implemented yet, it shows that it has an impact. The major US companies hurried to comply while others even stopped operating in EU.

If we want to be completely honest, GDPR is as much about privacy as about against the expansion of FAMGA (Facebook, Apple, Microsoft, Google, Amazon) and more in EU. Or, at least, about curtailing their dominant position. And the current US administration already views it this way.

But that’s not all.

There is still an open discussion about the imposition of a special tax on digital ad revenues and subscription fees.

 The levy, which is likely to be set at a rate of 3 per cent, will be raised against advertising revenues generated by digital companies such as Google, the fees raised from users and subscribers to services such as Apple or Spotify, and the income made from selling personal data to third parties.

The current estimation is that such a tax will raise approximately 5 Bio Euros. Not one of. Per year.

With EU data harvesting contained through GDPR and their revenues taxed, the big US companies, and, consequently, the US, will suffer a setback to the only foreign big market they play uninhibited.

In China and Russia FAMGA face strong local competition. Think of Baidu and Yandex versus Google. VKontakte and Tencent versus Facebook. AliBaba versus Amazon etc. These companies thrive, partly because of language and culture barriers, and partly because of legal ones.

Europe has no comparable players. It never had.

Depending on the length and depth of the trade war, more barriers can and will come up from the EU side. And, I dare think, this will open a window of opportunity for the emergence of “local” FAMGA competitors, something currently unthinkable.

If this happens, then the US will lose a huge advantage and a huge leverage in the international arena. Both technological and strategic. Even if no competitors show up, a significant amount that could flow in the US, will stay in EU. But US may gain another four years of Trump. Oh, well!

Spotify for News: a solution for investigative journalism

rawpixel-585630-unsplash

Democracies are fragile. If we want them to live and prosper, we must support their pillars. And one of them is currently under attack: journalism.

Beyond Fake News

It’s not the latest fake news epidemic that threats journalism. It is actually the other way around. Journalism is under threat and this has left the door wide open for fake news.

No, it’s not a conspiracy. The problem with journalism is financial.

With the advent of the internet, the business model of the old news organizations collapsed. Attempts to adjust to the new era have nor provided a general replacement, despite eventual success here and there.

The root of the problem is advertising. Gone are the days of the expensive full page ads. Internet does not offer something similar. And when it does, it brings in much less.

Internet ads cannot sustain adequately staffed, investigative, unbiased news teams. That’s why paywalls are on the rise among media companies. But a subscription is roughly equivalent to the newspaper price on the street, if we take out the paper costs. It was not the newspaper, the actual paper, sales that drove the income of the news outlets. It was advertising.

So, to save journalism, a new news business model is required. A business model that can generate enough revenues for news organization to thrive and prosper.

Enter the aggregator

If you ask those who continue to read the news (and care about content quality), where do they get them from, the most probable answer will be something like Flipboard. That is, not from specific “old” news brands directly.

But if this is what people like and people do, this where the monetization lies hidden.

Drawing parallels

Does this ring a bell? Certainly. We all have experienced something similar with the music industry. People don’t buy records or CD’s anymore (although the LP is making a come back, lately).

The iPod opened the way to buying single songs.And, then, came Pandora and the Spotify and their like, where you buy nothing, you own nothing, yet you can listen endlessly and at a very low cost.

A Spotify for news

Imagine a service which would be connected to all the major news organizations. Content would be categorised and served on demand much like in Flipboard. With one caveat. The content would not be free. It would require a subscription.

Another paywall? Yes. But with a difference. Paying for what one actually consumes. Proportionally.

Measuring readability is easy. And can provide the basis for splitting the subscription proceeds. So, the news orgs would continue to compete for capturing a greater audience within such an aggregator, but through other means.

What’s the difference?

… you might ask. It’s the psychology, stupid!

No hard facts here, but such a model can potentially attract a much bigger subscription base than the total aggregate of all newspaper subscribers.

Let me relate you my personal experience. In the past year, I bought subscriptions to two major publications. After a few months, I discontinued both, not because I was not satisfied with the content. On the contrary. I discontinued because I felt I did not consume enough of this content.

Why so? Because skimming content that superficially came my way through social media, I was tempted to jump here and there. But this innocent act of betrayal to my subscriptions, limited my available time. And I ended up feeling that I paid for something I was not making use of.

If the flitting behavior is our inherent preference, it should be the new black to. It should be the attitude we feel comfortable to pay for.

Is there an interested entrepreneur among my readers? Hey, you! You have a potential client here.

Have you heard the news? Literally.

malte-wingen-381988-unsplash

The phrase of the title comes from the old times when the news, were heard, not read. The news, and about everything else.

Nowadays, hearing the news equates to radio, web-radio and podcast content consumption.

Is there any reason why bother with audio, when text and image are omnipresent? Yes, if you value the content and if you value your time.

Miss reading?

Reading on the internet is almost a joke. No-one reads. People scan a page, savour the title and a bulleted list and that’s it. Most of the time.

Which is astonishing, if you come to think of it. Compare the endless hours spent reading newspapers and magazines a few years back. These same people, now, cannot finish an article with more than 150 words.

With the internet and so many different devices, we are always connected. There is too much distraction. Too much craving for the next piece of “news”, be it a tweet, a facebook status or an instagram photo.

“Interference” is now the signal, not the noise.

But, what if you want to delve deeper on certain topics? What if you want to protect your eyesight from the constant focus on tiny phone screen letters ? What if you want to avoid the ensuing fatigue from the light the screens emit?

To add insult to injury, what if you’re over 45 and far-sightedness is already taking its toll on you. What if the casual reading of your smartphone has become tedious, without glasses? Next to impossible?

Finally, what if you were avid book reader and a life’s turn has wiped out much of your time? The time you dedicated to your relaxing hobby or personal education and development?

A personal observation

Sometimes my eyes get so wary from work that the slightest glance to my phone makes them hurt. A lot.

During weekends, when the eye pain problem afflicted me, I realised how much my life depends on seeing. And how impoverished my world would be without it.

Drop reading (no books, no tv, no computer, no phone or tablet) and immediately you are confronted with the question: “How will I fill the empty time?”.

Socialising with friends or an outdoor activity could make up for the loss. But, alas, the environment is not always amenable to our needs.

It was then that I started experimenting with the accessibility tools of my iPhone.

Tools of the “trade”

Turning on text-to-speech reading, allows one to listen to his favourite web pages .

Admittedly, this kind of synthetic voice is neither too appealing nor without mistakes. But it’s better than nothing.

Let me note here, that some years back, I was a podcaster. It’s odd to admit it, but it was not the love of audio that made me one. I was experimenting with all the new social media forms and podcasting was another one of the bunch. And I was also consuming podcast content, at times, quite a lot. So turning back to audio was no stranger to me.

After a little experimenting with the text-to-speech feature, I discovered something unexpected. Reading an article with the voice-over switched on required significantly less mental effort. Plus I enjoyed better comprehension.

This observation opened my appetite for more voice. But real voice this time, not synthetic.

Luckily, I knew of at least two websites where I could enjoy articles in audio and text form: Medium and Aeon.

Listening to articles read by professionals was a superior experience . It made me stick to this new habit.

The next step was audio books. I made a subscription to Audible and started listening. The first book went down easily. I am still struggling with the second though. Two reasons. It’s too long. And it’s rather complex, requiring extra attention from my still inexperienced ear.

I am not finished experimenting with audio books. But my feeling is that non-fiction books of the scientific kind are not well suited for the audio format. Literature, History and Politics seem better candidates.

But what about news? This is the title, remember?

Bloomberg’s app has a text-to-speech feature which works better than the one provided by the phone. For a quick catch up of the latest headlines, it works fine.

there is something even better. Curio. This I discovered through the Aeon magazine, mentioned above, as the audio content of Aeon is provided by Curio.

A subscription to Curio, provides you with a selection of articles from 20 high profile publications, beautifully read. I am already looking for other similar apps as they are worth their money.

Audio time

If you live in a big city, like me, chances are that you spent more than an hour commuting to work daily. Reading while driving is impossible. In buses and subways, it’s feasible but not enjoyable. The vehicle vibrations make the hand holding the book or phone shake. And the letter dance along with the trembling hand.

Turning on the radio is a solution. Provided you are ok with the quality of the program of modern radio stations. As for me, I listen to radio only for the music.

Commuting is suitable for listening to curio and medium, or an audio book. It makes the trip enjoyable and the listener better informed.

My journey to sound is definitely not over. All the content I am consuming so far is in English. I would like to find some in my native language too. And I would like to have the text and the audio always coupled.

If you have any suggestions, I would like to … hear them 🙂

Wish, Try, Achieve. Why it is false, but good to believe, anyway.

barbell_bodybuilding_effort_exercise_fitness_gym_man_muscles-1366500

I can’t remember how many times people have joked with Paulo Coelio’s quote:

And, when you want something, all the universe conspires in helping you to achieve it.

And I can’t also count how many people hold it high up in their belief system, even if they have never heard of Coelio at all.

Motivational speakers and startup mentors routinely attribute success to relentless effort. And effort to strong will. To an unbending spirit. To a fighter’s mentalityTo an internal locus of controlTo a growth mindset.

No wonder. This belief is so rooted in our culture that can be traced back to religion:

Ask and it will be given to you; seek and you will find; knock and the door will be opened to you. (Matthew 7.7)

Unfortunately, like many common beliefs, it is not true¹. It is not true because there is this menacing element in life, called luck, that gets in the way. Or, to put it more scientifically, one is bound to encounter variability, randomness and unpredictability, regardless of his intentions or efforts.

When counting for whatever quality we have, we fall somewhere on a bell curve that measures this particular quality for the human population. We might be above or below average. So, if, say one is endowed by mother nature with qualities that fall in the lower quartiles of the distribution, he is destined to achieve less than one falling on the higher quartiles, given the same amount of effort and all other thing being equal. Doesn’t sound fair, but not preposterous either.

But there is a more chilling statistic. Because chance gets in the way, those in the higher quartiles do not achieve what they were destined too. Counting for effort too, the disparity is greater. And there is a dynamic that helps those who start earlier and reap benefits earlier: they take a boost and leapfrog their equals and more. As a result, whenever we measure outcomes like success, riches, fame or power, we are confronted with an entirely “unjust” distribution, the Pareto distribution where the proverbial 10% has 90% of whatever is counted. Just look at all those articles complaining about how the 1% of the ultra-rich controls half of the worlds wealth.

As I was heading back home from work today, I was listening to an audio book: Robert Sapolsky’s “Why Zebra’s don’t get ulcers”.

I must admit is hard to grasp this kind of content in audio form, as the book has a lot of endocrinology and neurochemistry references that don’t come down easily without visual aids. Nevertheless, somewhere around chapter 17, I heard a piece of information that elucidated the subject of this post.

Sapolksy’s book is about stress and it’s effects. And it has a wealth of information about what stress can do to our bodies and minds (mostly bad things). In Chapter 17 though, there were some good news about how to cope with stress, or, better, what can make our reaction to stressful situations less pronounced or even non existent, at all.

One prominent such factor is being, or, at least, feeling, in control. Surprisingly, it doesn’t make a difference.

Life is stressful, modern life more so. Aiming higher than the average is even more stressful. And if you want to make it to the top, the stress is almost unbearable. So it is paramount to get any help you can on the way. And such a help is a deeply held belief that the outcome is depended only on your efforts. That you are in control of your life, of your happiness, of your destiny. Or, to put it more realistically, that you feel like you are in control. Down goes the stress.

With less stress, any effort has better chances of a more benevolent outcome. So if luck is blind to our efforts, we should get blind to its obstacles. We might not reach our destination, but we will get closer, and we will have a much more pleasant journey.


  1. It is also a, so called, metaphysical claim, a term the epistemologists use for sentences that cannot be proved wrong. Why it can’t be proved wrong? Simply, because if you try as hard as you can and come to no end, you do not disprove the proposition, as one can always tell you: “You didn’t try enough”.

The five stages of GDPR

800px-Gustave_Doré_-_The_Holy_Bible_-_Plate_I,_The_Deluge

1. Denial

It’s not about us. We do not have sensitive data. It will not be implemented. People won’t understand it or adopt it. We are too small to matter. Who will dig up our sh*t, anyway?

2. Anger

Those bastards in Brussels, what else they will come up with? F*ck them, we won’t do anything. Let them come. We will deliver trouble.

3. Bargaining

If we change our contracts to look compliant, will we avoid detection? If we move outside Europe? If we delegate to third parties? If we delay a few months past the May 25 deadline?

4. Depression

We will never make it. We don’t have the skills or the resources to comply. If we get sued, it’s game over.

5. Acceptance

Roll up sleeves. Get a quotation from this consultant. Arrange a meeting with that lawyer. Dig up this diagram with your processes. Dig in your data files. Get insurance coverage. And, God help us.

3 thoughts about what is coming

1_Vkf6A8Mb0wBoL3Fw1u0paA

We just changed to 2017 and writing about time looks fitting.

It is three years now that when I encounter an extraordinary event, I mentally play a game: I am trying to predict what its repercussions will be, both short and long term.

For example, after the Brexit vote, I tried to divine what will be the medium term reaction of the markets to the British pound.

I won’t boast that I have made any spectacular predictions so far. If there is anything that has turned up from this habit, is that I am now alert of the possible outcomes and won’t be but moderately surprised from what will eventually take place.

This mental game though, has led me gradually to longer term prediction attempts. Not really predictions of an outcome, but rather fathoming of the consequences of a possible outcome.

There are three things, that currently look remote, but which I deem not so, and which, regardless of the time span, I think will have unprecedented consequences. Not for my/our/current view/life/perspective, but for the humankind as a whole.

Here they are, ordered by their future proximity.

The end of work.

This is the first thing that I see coming. And it cannot come easily. If you skim the news these days, you can’t miss either announcements of factory job replacements by robots or white collars turned obsolete by a certain AI.

The truth is that technology has reached a point where it can substitute any kind of human labor.

There is a line of thought that goes like this: a lot of jobs will be lost, but new ones will be created.

Numbers are always missing in such claims, because they are hard to come up with, in the first place, but, primarily, because they are very inconvenient. If there is going to be a shift in the type of labor on demand, it will be but an insignificant fraction of the type turned obsolete.

A more realistic approach is the discussion about a Universal Minimum Income for all. UMI, or basic income, the theory goes, will be given unconditionally and without exchange. And regardless if the recipient is employed or not. Actually, it is even presented as a job stimulant, in certain cases. And there are already a few countries (CanadaFinlandScotland) experimenting with the concept while the EU MP’s have started a discussion for a Pan-European roll out.

This makes more sense. There are huge unanswered questions about what a life without employment will be like, what will it mean to our psychology, curiosity, drive, creative powers, relationships etc. But at least, UMI will prevent us from one very violent thing: a massive revolt that will bring an unprecedented global bloodshed without solving the problem.

Why a revolt wouldn’t solve the problem?

Time and again, we have seen that once a technology is introduced, it cannot be taken back. It can only become obsolete by another technology. Regardless of how many people will lose their lives in such a luddite but truly justifiable uprising, robots and AI are here to stay. And we better be prepared.

Leaving scepticism aside for a moment, let’s try to imagine what UMI implies.

All the economies of the world today combine capital with labor to make products and services. This is what Adam Smith and Karl Marx have taught us.

Robots and AI are a sort of capital. They are owned by individuals or firms, and, if they become the sole production factor, the capital owners are entitled to all the gains from production. No salaries are due or required, no income for the average person is generated. Everything goes to the capitalist.

There are big question marks here. Those with an economic background will raise a flag: “Supply creates its own demand” they will say, echoing John Maynard Keynes and his reformulation of the Say’s law. With one apparent difference: labor was the factor mediating between supply and demand. As supply increases, wages are paid that become income that becomes demand, it turn. But what happens if the need to pay wages does not exist anymore?

Longevity.

The life expectancy kept increasing in the previous century, going from ~40 to ~80. It has, effectively, doubled in a century. And this trend will continue. There is a biological limit which we have approached very closely. But it is questionable whether this limit is meaningful any more, since biotechnology and genetics are making inroads into reverse-engineering human biology something that can increase artificially the human lifespan (there are already companies founded with this sole purpose).

By how much?

Who knows? Maybe indefinitely. If you can break down a mechanism to its parts and then can replace the faulty ones and reassemble it, you can make it work almost indefinitely.

But here is the double problem: All the more people will become jobless but will potentially be able to live longer because, to a certain extent, the breakthroughs in the human engineering will drip down to anyone. Restless ness will be on the rise.

But, say, a key part of bioengineering is very expensive. Like, rejuvenating a brain. What if this can give people a 50% increase in their life expectancy? And what if it is marketed so as to be affordable only by the very few? Historically, death was the great equalizer. It is what religions have always preached: we are all equal in front of death. This teaching has been some consolation for the poor, and, at times, a form of justice. The only one they were left with.

But if this final limit becomes a luxury product, then the poor will feel shattered, ultimately cheated, deprived of the last drop of worth and dignity. And they will revolt. Much more fiercely than they would because of wealth differences. And then what? Resolution or dystopia?

The great leap forward.

In a jobless world with longer lifespans and re-engineered bodies, space travel will not be that unthinkable anymore. Even with the current spacecraft speeds, going to the nearest star and back will be within the span of a lifetime.

But why go to space, in the first place?

If Elon Musk’s argument (being an interplanetary species gives us more chances of survival) is not convincing you, then the quest for raw materials will make more sense. The asteroid belt is full of them and technology is always hungry for more.

I am not talking about fossil fuel, of course. There aren’t any elsewhere in the solar system, and, with the progress in renewable technologies soon we won’t be needing them anyway.

I am talking about metals, rare metals, too expensive to find on an earth already overexploited. Far fetched? Well, Luxemburg is already drafting laws about asteroid exploitation. And, at least two (Planetary Resources and Deep Space Industries) companies have announced relevant plans.

But the economic aspect, while compelling, it is not the most thrilling one. The most thrilling aspect is the possibility of a first attempt to an interstellar manned travel.

Think of it: the Earth will be full, people will not worry about subsistence, lives will be longer and healthier. Certainly some people will think, even out of sheer boredom, to make the big leap and try to explore the Cosmos. The Martial colonisation already has attracted volunteers even without the conditions mentioned before. How many more will come then, when the prerequisites materialise?

Given the advances in medical technologies and AI, and for the needs of such a travel, we can imagine various enhancements of the human biology and cognition. Enhancements that might frighten us now but that will be fundamental for the survival in outer space.

And if we arrive to this, shall we be humans anymore? The nuances of what is human, transhuman and posthuman will be all too real and pretty much blurred.

One thing is certain: the future will not be boring.

Updates:

Here I will list all things that corroborate the views expressed above.

The AI Threat Isn’t Skynet. It’s the End of the Middle Class.

As Goldman Embraces Automation, Even the Masters of the Universe Are Threatened

What It Would Take to Reach the Stars

UAE Announces Plans to Have a Human Colony on Mars by 2117

.Net Core on Mac: Connecting to SQLServer

In the previous post I described how I set the basic development environment using Visual Studio Code. You cannot do much application development without a database though, and while there are many options for database connectivity, since this exercise is  about using a Microsoft development stack on a Mac, the database of choice is inevitably Sqlserver.

When I started thinking about all these, the only option I had was to install Sqlserver on my Mac in a virtual machine. And this is what I did. I installed Virtualbox with  Windows 10 LTBS and in it, I installed Sqlserver. I won’t go through this process as it is not Mac related. The point of interest is the network connectivity for the Virtualbox: in order to be able to talk to the Sqlserver inside it, one needs to use bridged networking.

screen-shot-2016-11-26-at-7-34-10-pm

Also, since we are going to connect to Sqlserver through the network, TCP connectivity must be enabled.

screen-shot-2016-11-26-at-8-34-51-pm

To test the connectivity you can use command line tools, a Mac client like Navicat Essentials for SQL Server or connect directly through the Visual Studio Code.

There is an extension for this:  mssql for Visual Studio Code

Like all extensions in VSC it adds a bunch of commands

screen-shot-2016-11-26-at-8-42-55-pm

The extension works from within the editor: you open a document and change the language mode to SQL.

screen-shot-2016-11-26-at-9-04-23-pm

Then you create a connection profile and connect to the Virtualbox Sqlserver. Upon a successful connection the footer of VSC changes to this:

screen-shot-2016-11-26-at-8-48-15-pm

And now the party begins.

In the opened document you type sql commands and execute them running the Execute query command. The results are fetched in another document and the screen splits in two: sql on the left, data on the right.

Screen Shot 2016-11-26 at 8.52.57 PM.png

From this point on, you have all the tools in place to dive into some real development.

Except that…

connecting to a Virtualbox hosted Sqlserver is not the less resource hungry solution.

After I set the above, Microsoft made a lot a good announcements in the Connect() event. Among them was the release of Sqlserver for Mac though Docker, which promises a lighter solution. The docker container runs Ubuntu linux, so there is no real Sqlserver for Mac. Just a better workaround. But I will leave this for a future post.

.Net Core on a Mac: Setting the development environment

Let’s begin from the beginning: I installed  .Net Core SDK ,  Visual Studio Code (VSC) and the C# extension. The tricky part was the SDK which uses OpenSSL . I had  to install it  beforehand with Homebrew.

At this point a basic development environment is place. But since I didn’t want to develop a CLI application but an Asp .Net MVC one, and since VSC does not provide project scaffolding like it’s big brother, Visual Studio, I had to install yeoman for this task (another cli tool) a task that, requires Node.js so that you end up with npm and finally run

npm install -g yo generator-aspnet bower

(Yes, it has to have bower too).

And now, everything is ready to start a project. I run:

yo aspnet

and got

     _-----_     ╭──────────────────────────╮
    |       |    │      Welcome to the      │
    |--(o)--|    │  marvellous ASP.NET Core │
   `---------´   │        generator!        │
    ( _´U`_ )    ╰──────────────────────────╯
    /___A___\   /
     |  ~  |     
   __'.___.'__   
 ´   `  |° ´ Y ` 

? What type of application do you want to create? (Use arrow keys)
❯ Empty Web Application 
  Empty Web Application (F#) 
  Console Application 
  Console Application (F#) 
  Web Application 
  Web Application Basic [without Membership and Authorization] 
  Web Application Basic [without Membership and Authorization] (F#)

I chose

 Web Application Basic [without Membership and Authorization]

and was good to go.

Or, was I?

Client side development encompasses tasks like building css from sass or less, bundling and minifying. I had to accommodate for these too. I decided for scss so I had to install sass.

gem install sass

(Has anyone been counting the package managers used so far? I will provide a count later).

And, per the .Net Core tutorials and documentation, I had to install gulp for sass compilation (and bundling/minification). Thank God, npm was already in place.

npm install --save-dev gulp

At this point I could open my newly created project (ok, the screenshot was taken later).

screen-shot-2016-11-16-at-8-06-30-pm

Database connectivity would have to wait a bit, until we get the basics straight.

The last piece I had to install was the C# extension. Yes, C# is not supported by default! You need to add it as an extension from within VSC.

VSC is mainly addressed to javascript developers, it seems.

So, to come here I have used the following package managers:

  • brew
  • npm
  • gem
  • bower
  • nuget (internally in VSC)

and two additional cli tools

  • yeoman
  • gulp

Unfortunately, after having done all the above, I found out that gulp will be discontinued in future releases (Bye, bye gulp).

And advancing a little bit with the configuration, I found also that the current project.json is going to be replaced by MSBuild (Bye, bye project.json).
Honestly, this gave me the creeps, not because I have any particular affection for either gulp or project.json but because it shows a fickleness of ‘heart’ towards the adopted affiliations. If one wants to adopt something new, the last thing he needs in uncertainty.

Having said that, it doesn’t seem to be a compromise on Microsoft’s newly developed commitment to openness, as, today, they announced joining the Linux foundation and they released Visual Studio for Mac (preview).

 

It’s been now quite a few days that I have been working with the current environment and apart from some annoyances that I will list below, I am rather happy, mostly because VSC is not just an editor. It has a lot of IDE capabilities, something that I have been missing to other lighter editors, or found too cumbersome to work with.

And since Intellisense is one of my main reasons for satisfaction, it is its shortfalls that frustrate me the most:

  • Version management in project.json is messy. Intellisense suggestions sometime are wrong (I got hints for version 2.0.0 and 3.0.0 where the package is still in 1.x.x), other times they do not show up at all.
  • Enabling Visual Studio Code Taghelpers did not help. Taghelpers Intellisense does not work. I posted a relevant question in Stackoverflow which, to the moment of writing, remains unanswered.
  • After correcting some misprints or wrong references in the code, there are artifacts left behind (red squiggly lines, underlining the problem that does not exist anymore). They go away with the first compilation though.

But with the current environment I have done a lot of progress in two areas: after creating the basic views and controllers, I spent a lot of time in route configuration and localization, which, I remind to those that haven’t read my previous post, is to migrate the company website from WordPress to Asp Net MVC.

.Net Core on a Mac

It’s been ages since I blogged anything. More, anything technical. Since I am in the process of experimenting with ASP .NET Core on my Mac, I thought to take the opportunity and log this journey here.

So far I have done three things:

This isn’t as straightforward as just installing Visual Studio Code. To have scaffolding one  needs to rely on CLI tools, and to do some client side development on the usual suspects: bower, jQuery, bootstrap etc. Which means you need to spend a lot of time  with the Terminal.

  • Set up a development database

While one can experiment with SQLite or MySQL, I wanted the real Microsoft thing, SQL Server, and since this isn’t available for Mac I used Virtual Box with a Windows 10 LTSB guest, where I installed SQL Server Express.

To connect to the database from the host, the VirtualBox has to be on bridged networking and SQL Server should be accepting TCP connections.

  • Found a relatively simple project that entails the most common workflows.

Our company’s website  is multilingual and it is WordPress based (no wonder). While the blog  parts serve their purpose nicely, the pages are bloated (HTML-wise) and have a lot of javascript code running (for a reason) which could benefit from a slimming diet.

So, I thought, why not try to migrate the WordPress pages (not the posts) to an MVC site based on Asp .Net Core. To make things more interesting, I want to add some dynamic content too, pulled from our app’s database (why should I be bothering with SQL Server if I didn’t?).

And here I am. So far, I have made some progress which I will relate in subsequent posts. This post is only an introduction to the theme. If you have interest in such experiments, stay tuned.