Elsewhere there are things that we all miss, yet it takes just one to notice...

Re-install PC

I’ve recently upgraded from Linux Mint 17.3 to 18 and although everything else is working just fine, the tomcat server doesn’t. The client side of a web application works but there’s no joy from the server side so zero RPC calls are working.

A fresh install will be good anyway as it will clear a lot of junk out.

Ah well, should be about 30 minutes to an hour installing most of my software back. It’s handy having a nice 480Gb SSD and decent download speeds.

TCP internet communication notes

Now that I’ve got that working over the internet, there are many things that this kind of thing can be used for. Most of them are obvious, but a few I’ve had in mind for some time now.

  1. For an app running on a device, it can download media specific to that device. ie, scaled to fit the resolution.
  2. A device can be checked for memory and storage space limits and then download media that is optimised for the device to run the app.
  3. Even for 3D apps, a device can request 3D meshes optimised to run on that device depending on the graphics capabilities. This can be useful for animated meshes with lots of vertices. The server can reduce the size of the mesh and the animation.
  4. If a device can output in surround sound then audio can requested that supports surround sound.
  5. Multiplayer games. The server can receive players positions and then send the local information back out to other devices.
  6. Devices can also send data to the server. This can be for a multitude of reasons. ie. a players profile picture or for audio communication between players.

As you can see from the above, there’s no limit to what a running server can do.

One thing I will have to do soon is to handle brute force attacks on the server. This happens when a DoS (Denial Of Service) attack occurs, which is a deliberate attack in which lots of data is sent to the server continuously. The simple way around this is to have a damn good fast CPU in the server and to record IP’s that are connecting. If an IP is not requesting the usual data and has attempted X amount of times then it goes onto a block list. Each connection attempt will first check the block list and instantly close the connection if that IP is blocked so that no further time is spent processing the connections request. At this current moment in time the Intel Xeon and the latest Intel i7’s have the cores that could handle DoS attacks.

Multiplayer games requires a whole new line of thinking, especially when they’re real time. Band width can be a pain, but there are many ways to get around this. In one of the above notes, I mentioned ‘local’ data. This comes into play when a players device only needs to receive the local updates in the surrounding area. Although the server will handle all players, it will only send each device its local data.

Anyway, that’s me done for now while I think of what to do next.

Any ideas, then get in touch.

Testing out TCP server over the web (my IoT stuff)

So I have this idea where I can take photos on my phone or save images from the web and then send them directly to my PC.

I’m currently using a Sky router in which I have enabled a port redirect to my PC. That’s all working. And I’ve got an external web address which re-routes to my PC also. That’s all working as I can host a website on my PC and access from outside.

The first pitfall was I started a console application in Qt to be a TCP server, but, deploying Qt applications to anywhere can be a huge pain in the butt.

So now I’ve decided to pick between a Java server or a C/C++ server. The issue I will have with a standard C/C++ server is image handling when it comes to working with them in the future, whereas Java has built in Bitmap libraries. Although I could add a 3rd party library to get around this, Java has lots of other libraries.

The other issue is speed. C/C++ has raw speed and that it. But because its a server, speed shouldn’t really be an issue for most things.

I’ve already successfully got the address of my PC over the internet and in the past had a basic TCP communication test working. This time it’s for real.

Okay, I’ll try out a Java project and see how it goes.

My current stack development

Linux headless server

Once everything is deployed, the linux distribution will have  the desktop stripped and left to run headless.

UDP server

General broadcasting of the servers location on the network along with the current time 4 times a second as the end point devices have no internet connection and no time.

TCP server

Used for communication between the server and devices. Content is managed through TCP instead of FTP as it is more secure.

C/C++

The software manages the servers UDP and TCP communication and also handles other commands when necessary from the web server. UDP is used for streaming DVB-T data across the network. Continually running daemon in linux.

Apache Tomcat 7

The Java based web server.

Google Web Toolkit (GWT)

The web framework for both front and back end web server. Used to manage user logins and session authentication. Manages the devices deployment. Mainly in Java. The web server is a large project.

Android Studio and Qt 5.7

Used to write the software for the end point devices.

More stuff August 2016

Very rarely do I update my website. That’s because I work all day and get very little time at home to actually work on my own stuff. However, I can update on a few things.

  1. My knowledge of Java has improved vastly that now it’s rare I use google to solve my problems for me. Personally I wouldn’t use it for my own projects, except for the web server I will eventually start work on. Lots of people still say that there is now speed difference between Java and C++, but there is when you are running constant loops in code.
  2. Google Web Toolkit or GWT. I’ve used this extensively for over a year now and I do actually like it more and more as the months go by. More recently, I’ve figured out how to manage logged in users and session management. I usually have a tomcat user assigned in Linux which the back-end can use, away from the web server to do it’s storage and data crunching. LibGDX also uses GWT and with the experience I’ve had, I’ve got a few things up my sleeve.
  3. Qt… What more can I say. Every new version that comes out it gets more and more support. Recently I have figured how to call Java functions from Qt’s C++ on the Android platform which can be used for lots of missing features from native.
  4. I still haven’t got round to playing around more with Python which I really want to do. As a scripting language it looks great. And for it’s mega bloated support for everything and anything (API’s etc), there’s no end to what it can do. Ideally once I get to getting good at it I want to be able to quickly prototype stuff to be redone in C++ or Java.

For the time being that’s it.

My plan for the very near future is to get some more stuff done on my website using the GWT back-end.

Work ‘Smarter’ not ‘Harder’ as a programmer

I’ve just come across a question posted on Quora which I tend to peruse through daily out of interest, and I can across the question:

What are some uncommon ways to work smarter instead of harder?

One person gave a list of answers which were very interesting and tickled my fancy. In short before I explain my personal experiences, here they are:

  1. Learn to say “No.”
  2. Sleep at least 8-9 hours
  3. Don’t be a night Owl. Work in between  5am-10pm not from 10pm-5am
  4. Stop multitasking.
  5. Take more breaks: respect your natural attention spans
  6. Spend time in nature
  7. Move around and work in blocks
  8. Limit your to-do list
  9. Measure your results, not your time
  10. Build “getting ready to work” routines
  11. Track what you’re wasting time on
  12. Exercise daily even if you think you have no time
  13. Believe that you can do it

And being employed now for a while as a professional programmer after a lifetime of being a hobbyist here’s my thoughts on those points…

Learn to say “No.”

This is probably one of my failings because I’m quick to tell others they ought to ‘learn to say no’, it’s hard to actually do it yourself. There are times when I need some wind down time and I’m needed elsewhere at other times which doesn’t help me get that proper chill time at the weekends especially.

Sleep at least 8-9 hours

On average I get about 7 hours. Usually at the weekends, I fight the urge to sleep during the day in order to keep my sleep pattern regular.

Don’t be a night Owl. Work in between  5am-10pm not from 10pm-5am

Going from a hobbyist programmer to an employed programmer has seen a huge change in the hours I code. Years ago I would work through the night until the sun came back up. Now, I get home and just read stuff online and do no coding in my spare time.

Stop multitasking.

A programmer needs to focus on the project they are working on. Ask them to do something that doesn’t relate will throw them miles off track. Just just distractions can take them right out of the zone just for saying ‘hi’ to them.

Take more breaks: respect your natural attention spans

I’ve found that taking breaks regular helps immensely. I used to often find myself getting stuck at points and clock watching before I left the screen. That was counter productive to progress. Now when I get so far and need to give my thoughts and brain a rest, I get up and go for a quick wonder around.

Spend time in nature

Oh… Errr… Maybe I’ll plan for this one.

Move around and work in blocks

With working on large projects, I now tend to break it up into many smaller chunks and work through each piece.

Limit your to-do list

Just like the above, but when it comes to planning, I never set too many targets for the next days worth of coding. It’s usually just about two things I plan to get through and if I do manage more then it makes me feel better for it.

Measure your results, not your time

This is learning patience too. Working on large project is extremely time consuming. As I mentioned above, by breaking the project down into many smaller parts, it makes it easier to see progress being made.

Build “getting ready to work” routines

I do… I get to work… Make a brew… Read some interesting stuff for at least half an hour… Then within an hour after work starts, I am getting into the zone. Sometimes I get quickly zapped out of it when other members of staff start having loud conversations.

Track what you’re wasting time on

This is definitely another matter that I’ve learnt over the past couple of years. There’s been times when I’ve tried out something and dumped all the code only to start again a few times. Now I make small unit tests to make sure I know what I am doing before it gets implemented into the project. So much time can be wasted by having to backtrack a shed load of junk code.

Exercise daily even if you think you have no time

I don’t have time… I really need to but I haven’t yet got around to it. I will do as soon as I possibly can.

Believe that you can do it

This is not an issue with me. When I first started at the position I’m in now, I was thrown in the deep end and I had to create my own paddles and floats. Nowadays, it seems that after a few unit tests per awkward section, anything is possible.

As you can see, I’m not perfect, but I still very much enjoy day to day coding…

wlgfx@home

My PC at home does actually host a website for testing purpose which you may be interested in seeing. A lot more content will be provided over time.

wlgfx@home Link updated (2017 Jul 31)

This only works when my home PC is on.

Hosting a website from your home PC is possible by using NOIP.com which my Sky router updates each time it is rebooted by sending noip.com my IP address. From there I added a setting on my router which redirects a port to a static IP which my PC is set at.

And that folks, is how I host stuff from my PC.

I only use Apache Tomcat 7, I’m not interested in PHP or SQL.

I’ve also tested out opening a specific port on the router and redirecting to my PC and having a TCP listener. The listener will accept 4 bytes (a command code). If the 4 bytes do not match any valid commands, the connection is closed. Otherwise it will send data back to the client. This project was an interesting test and is not currently running as I do not want to leave open ports on the internet for too long.

New online profile begins here

With the loss of the content from my old website, I am forced to start over again. In one sense that’s a good thing, but there was quite a bit that I really did want to keep.

With an insight into what I want out of my future, I am rebuilding my online profile.

Here, over time, there will be showcase examples of my programming skills as well as topics covering various experiences over the time that I’ve been a programmer. There are two simple examples so far, and I will post the code to that, hopefully, later.

Keep an eye out because I have a lot to write about…

Posts navigation

1 2 3 4 5 6 7
Scroll to top