Typing lag on linkedin sucks.

Ever try typing anything on Linkedin? Like not on your phone, so you type faster than 10 words a minute or a single entry to the input?


Typing lag on linkedin

So laggy and slow I often have to just stop trying for up to a minute while Linkedin code does WTF ever it does. What are you people doing anyways recording every damn keystroke? Why does it constantly pause while I am typing? I can’t figure out what is going on to make it so slow other than some sort of key logging or trying to save the comment or searching for something?

Don’t believe me? Watch this. I got so damn tired of the lagginess that I screen captured this mess. At about 29 seconds you can see it looks like I am not typing. I am still typing it is just not responding and lagging.


Php how to use array_map with an anonymous function

In PHP you can use array_map() and the other array related methods like array_filter() with either a named function or an anonymous function.
I didn’t see any examples in the PHP docs about how to use an anonymous function, so I tried it and here is how to do it.
Below is the array_map function definition from the PHP docs.
array_map(?callable $callback, array $array, array ...$arrays): array
As you can see it takes a callable/callback function. This means you could create a function and supply it to this method. And that is a great way to do this… unless what you need to do in the function is very small.
For example I needed to remove the word “Repository” from every file name. I globbed the file names from the directory then I use this function

private function getRepositoryNames(): array{
$values = array_map(function ($val){
return str_replace('Repository', '', $val);
}, $this->_repositoryNames);

return $values;

Look closely and you will see the anonymous function. It is the first argument to the array_map() method. The second argument is the actual array I want to work on here. As you can see this would quickly become hard to read if the function were more than a few lines of code. You see this a lot more often in languages like Javascript and Scala.

As you can see I am simply using str_replace() If I needed to do much more it would be better to have a separate named function instead of an anonymous one for several reasons. The #1 reason to separate out the function is for readability purposes. The #2 I can think of relates to #1, maintaining or changing how the function works. But mostly if it is long separate it out so it is easier to read the code.

How does it work?

Basically the way array_map works is the second value you supply, an array, is looped over and supplied to your function one at a time and your function operates on it and returns it to array_map. When array_map is done looping over all the values it returns the new array. You can read more in the PHP docs here.


How to configure a fake domain name on your localhost on linux aka virtualhosts

Often when testing a web project locally you will use something like http://localhost:9000. Unless you are using Docker and dockerizing your app. What if you want to run multiple apps or multiple versions of one app at the same time and instead of going to localhost:9000, localhost:9001 etc. etc. you want to go to https://yourappname and https://yourapp-name2 …

Well on linux you edit the Hosts file and create a loopback to localhost or whatever IP you want. I mostly leave it with the localhost loopback though to prevent myself from blocking access to other websites on accident.

Here is an example of my hosts file, you can see I have made quite a few changes. This file is usually located at /etc/hosts there is no document type just “hosts” is the name. localhost sogi-test sogizmo
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

Now this way I can type http://sogizmo and my app opens on localhost. I can open another tab and type http://sogi-test. This is also handy for testing that your app works correctly with SSL/https. I’ll cover how to do that in another article later.

Note if you add a .com to the end of your app names you block your access to the real app from your device only. That is, your PC uses the hosts file to lookup hosts before hitting your router which hits your ISP servers, which does a reverse lookup. If you have in your hosts file and try to access that from your computer that you made changes to the hosts file on, it will take you to your local copy not the .com website so remember not to add the .com

I still find the old fashioned way easier for now. Plus I haven’t fully embraced Docker other than running things my app needs without installing them. I am slowly moving more towards dockerizing everything.

There is still more to do to get the app to work correctly on your system though. You will also need to configure your local server to serve pages from your apps local root directory.

I use Nginx so this is as easy as a few lines of code and a few minor changes. The files are located in /etc/nginx/sites-available. I wont cover the configuration because it is different for each app, however the location is always the same.  Here is a link about configuring Nginx. Here is the official documentation for Nginx.

Basically inside the Nginx configuration you want to set the name of the server to the same as the name you listed in the “hosts”file for me it is sogizmo.

Like so :

server_name sogizmo;

Then you need to tell Nginx where your server root is on my system for my app it is

root /var/www/sogizmo/public;

So basically that is it. You add your desired site name in the hosts file with an ip such as Then you create your Nginx or Apache configuration and set your server to match the name you added in the hosts file. Then you set the root directory for your app. There are also other things you will need to set in the configuration based on the tech stack your app uses.

Uncategorized Web Development

Why most current social platforms suck

One major problem with most current social platforms is they randomly ban people for things that are not offensive.

You can’t even make a joke on these platforms. They ban people for making jokes like the following.

Social censorship at it’s finest

Anyone with an IQ over 75 can clearly see I am making a joke here about how much Javascript sucks. In no way am I telling anyone to harm themselves or saying I want to harm myself.

What kind of petty broken censorship system is this?  Is this AI making these judgements? If so it sucks.
Did  some amateur that just started to learn to code, who is totally in love with Javascript reported this? If so grow up and learn some other languages and you will realize Javascript sucks.

I use Javascript all day every day for user interface creation, which is probably why I hate it. It just swallows things that should be an error or warning, making debugging harder. The 100% lack of a type system makes it really suck BAD BAD BAD. You never know what is going to be passed to functions. This. Don’t get me started on this in Javascript.
Javascript was one of the first languages I learned 15 years ago now. I have plenty experience with Javascript. I also have used Golang, PHP, Perl, Java, Scala, Actionscript, VB.NET, Sketchs, BASH and more. I speak out of experience not failure.

And if you are a Javascript fanboy and don’t know why it sucks… read this article. Javascript gives you secret hidden bugs and errors.

So much suck in 1 language



Symfony events resources, links and videos

To see a list of all events use this command

 php bin/console debug:event-dispatcher

Built-in Symfony Events – this covers some of how events work in Symfony and the basic default events that fire with every request.

The HTTP kernel component – This gets to the core of Symfony and it’s event system. The kernel is driven by events. This also covers the basic flow of events that symfony follows when a request enters the system.

Events and event listeners – More information about symfony events.

The EventDispacher component – This is more about the symfony system events.

An example of how to use the EventDispacher component


This video covers how to create a custom event subscriber


Bash how write large amounts of text to a file

I searched and tried for days to find the answer to this. All I wanted to do was be able to basically create a file and write text to it exactly as I had entered it in a shell script. Every suggestion on the internet was fubar.

Note : to run these commands, put them in a folder like and use chmod 755 to make it executable then type bash or sh or /

I wanted to put something like this in a file from within a shell script.

Line one text
   Line two text
   line three text
   lets talk about some text

I tried everything. I googled for days and I finally found this article  where someone had basically the same need as me. Basically the syntax to put a bunch of text into a file from shell script is this.

if [ ! -e $testFile ]; then
    touch $testFile
outside_var="Some text from outside hell"

cat <<TEST  >> $testFile
Line one text
   Line two text
   line three text
NEWVAR = values
lets talk about some $NEWVAR
or not
but look at some outside text $outside_var

This uses <<HEREDOC syntax but it also redirects the input with >>. This is the oddest syntax I have ever seen so I can’t explain why it works. I would expect the redirect to be at the end of the closing TEST, but that doesn’t work. Bash heredocs are the weirdest thing other than if statements I’ve come across. Learning bash has been like traveling back in time to the 70’s or 80’s the syntax is beyond odd.

Also you will notice I tried defining a variable in the heredoc. That doesn’t work. You can copy and paste the code above and see what I mean. You don’t get errors but the variable doesn’t expand. I don’t know if it is supposed to or not. Here is a link to some info about heredoc. However what you can do is define variables outside the heredoc and use them within, see the $outside_var.

If you read the “info about heredoc” link above( in links below too) it shows this alternate syntax which works too, and makes more sense. I honestly don’t know how or why  the above ugly mess works.

if [ ! -e $testFile ]; then
    touch $testFile
outside_var="Some text from outside hell"

cat > $testFile <<TEST
Line one text
   Line two text
   line three text

   but look at some outside text $outside_var

This looks a little better to me than the other version. So there you have it that is how you write lots of text to a file.  I had to search for days to figure this out so I hope this saves at least one person some time.

Version 1 heredoc syntax
Version 2 heredoc syntax

Software Development Uncategorized

Linux xclip command makes command line life easier

I discovered a new tool today while adding my ssh keys to Github, something called xclip.

The xclip command makes it easy to capture output to the clipboard so you can paste it to another location like into a browser or word file etc.

The github docs above have you use it to copy your RSA key and save it for pushing your repository so you don’t have to supply a user name and password.

xclip -selection clipboard < ~/.ssh/

The above tells xclip to put the contents of into the clipboard. You can then use ctrl + v to paste it anywhere you need it.

Here is more info and examples on how to use xclip

Link to some man page  type info about the options it accepts as arguments.

Another link to similar info about xclip it’s options etc.


C programming language resources and links

C Syntax Rules – Learn the ABCs of Programming in C Language

Above is a great link to get started with C programming languge



Undocumented parts and pieces of Scala magic

I constantly run into things that are not in the documentation of Scala or if they are they are hidden. This kind of stuff only increases the learning curve of Scala. Any increase in the learning curve decreases acceptance rates.

Self typing. The docs only show one single way, but low and behold there are more ways. Imagine that. Disambiguating ‘this’ in Scala, or what does ‘self =>’ mean?



random interesting science articles

Wonder Material Mimics Desert Beetles and Cacti To Suck Water Out of Thin Air

Quantum researchers create an error correcting cat.

How earthquake resistant buildings work. – Cool article that talks about pyramid structures.