Posts

Showing posts with the label Linux

Cross Compiling Clarity

I have an important distinction to make clear... Cross Compiling is using a machine with a different processor type than the target machine for your program. So, you have a PC with an Intel Core 2 Duo in it, and you use a compiler to output an ARM executable, that is cross compiling. If you're on an Intel Core Duo toting 15" MacBook pro (from 2006 ) and you use that to produce the same ARM executable, that's still cross-compiling.  BUT if you use that MacBook to generate a windows executable it's not cross compiling, as the processor is the same in both targets, you're not crossing over... Some folks argue this differently, because you're crossing between the Windows and Apple OS's you're cross-compiling.  In my book, and by the definition given elsewhere, you're not, in this case you are cross-platform (the platform being the OS) but you're not cross compiling because the processors are the same family. That's all, I just wanted this out t...

Ikea Server Rack is Finished

Image
What kind of bloke gets to play with servers on his day off?  A damn lucky one my wife always tell me?.. Am I lucky?  Or do I have a plan?  I think I have a plan, this is a project I've been meaning to sort out for quite some time, now I have a week off of work, I'm knocking things out the park... Sooo...... Meet my new server wrack, so this is a pair of Ikea Lack Coffee tables, one with the feet fitted, and it's screwed down onto the top of another, with a pair of wheel which I also got at Ikea. I've reinforced the leg uprights, and I'm busy fitting out the rear with a dedicated switch and power setup. It's all on wheels so it can go anywhere in my office with relative ease. And yes, these are my older Poweredge servers (from my fan/noise reduction videos). Only the top unit is operational, with all the drives fitted and a full compliment of memory (64GB I think is in it).  Its socking a quad port gigabyte Ethernet at the moment but I have a whole box of fiber...

Kdenlive : First Impressions

They say first impressions count and that's certainly true for any tool I utilize.  In what little free time I've had over the weekend, I've been starting to edit up all the clips I took of the workstation upgrade & rebuild.  This is my passage from the pedestrian Core i7 950 to a Xeon X5670. I've elected to update my video editing software and Kdenlive seemed to be the answer to visual challenges I had at hand, and oh boy was I right. Following a seamless download of the Appimage version, a simple startup and about ten minutes orientating myself, then about a further ten to just get used to the S X and M control core points I was applying effects to clips, setting up spacing in between others and saving to perform a test render. I am utterly and totally so impressed with Kdenlive, this is the first time in a long while I've been equally surprised and delighted by a piece of software.

Ultra Cheap ZFS Array

Make your own ZFS array (mirrored) with USB Flash drives, for cheap! http://megalomaniacbore.blogspot.co.uk/2017/12/using-flash-drives-in-zfs-mirror.html Since this... interesting post of mine... has only about 10 views, and my tech items usually get a few hundred, I figure somewhere along the lines it got trampled by my silly New Years post....

Using Flash Drives in ZFS Mirror

Image
This post comes from an idea I had to allow me to easily carry a ZFS mirror away from a site and back again, we didn't need much space - only 5gb - but it had to be mirrored in triplicate, one copy to stay locally, one going into a fire safe on site and the third to be carried by the IT manager off-site each evening. The trouble?  A near zero budget, so for a little over £45 we have a 14GB ZFS mirrored pool, across three 16 GB USB Flash drives and one three port USB 3.0 hub. It was perfect for the task at hand, extremely portable, and cheap, I thought the same approach may help anyone trying to get to learn a little more about ZFS, a student or even someone using a laptop as a small office server - as the laptop literally has its own battery back-up system built in! It's not the fastest solution, its in fact extremely slow, but as an entry step it's perfect. See the full video below, throughout the commands I list were in use... Commands: Listing Disks by ID... ls /dev/disk...

Windows Defrag v KingDian SSD... FAIL

Image
I'm sure you all already know this one, and many vendor specific implementations of SSD drivers/applications prevent this... Not me though. Yes, I have a dirty cheap (£27) SSD from KingDian in my Laptop... Wait, wait wait, stop abusing me!  This is just a boot disk to hold a local OS and some scratch space, all my storage is provided to this machine over NFS. The trouble?  Well, in the late summer the wife and I had a few days away in deepest darkest Wales... Now this was a disconnected break, however, I couldn't resist taking the laptop loaded down with a few DVD based games and a steam download or two, plus I got to take some system code with me and a slew of PDF's I could read... I got a lot of work done, even without Linux (yes I had to flatten the machine back to Windows 7). And I pretty much put the machine away until just before Christmas, I then needed it again, so flipped it out the cabinet and fired it up, only to immediately find the battery was dead... It had be...

C/C++ Stop Miss using inline.... PLEASE!

Image
This is a plea, from the bottom of my rotten black heart, please... Please... PLEASE stop miss using the inline directive in your C and C++. Now, I can't blame you for this, I remember back in the 90's being actually taught (at degree level) "use inline to make a function faster", and this old lie still bites today. inline does not make your function faster, it simply forces the compiler to insert "inline" another copy of the same code whenever you call it, so this code: #include <iostream> inline void Hello() {     std::cout << "Hello"; } int main () {     Hello();     Hello();     Hello(); } Turns into the effective output code of: int main () {     std::cout << "Hello";     std::cout << "Hello";     std::cout << "Hello"; } What does this mean in practice?  Well, you saves yourself a JMP into the function, and the position on the stack holding the return address, and the RET from t...

Crashed my Build Server....

Image
When I say I crashed it, I mean... It just locked up and I had to soft reboot it... And when I say build server I mean one of the virtual machines on one of my Xen Hosts.... So, the machine is a fairly beefy 16 core machine with 48GB of RAM running on a Dell server under the desk, this disk base is a RAID-0 200GB unit over a bunch of 2.5" 10,000 RPM SAS Drives to a Perci5 RAID Controller.... The machine is only really spooled up for big builds, and this was one of them, I wanted to build LLVM support before bed. The problem?  When I performed the build with "make -j all" it would get to 16% and then blank the screen, and totally lock up, nothing, nada, nowt... I left it for a while but nothing happened, and yes the LLVM build is time consuming but it doesn't lock at 16% for minutes. Soft reboot, and the same happened again... I've started the build again with "make -j 15" rather than all sixteen cores.  And it's already up into the 35% area of the b...

CMake rather than Mammoth makefile marathons

Image
I'm having difficulty communicating with some folks about the beauty of cmake and using ccmake to leverage that beauty. These are folks whom are either completely ignorant of what a makefile should look like, are happy to manage their own or at worst case are folks put off of makefiles by having inherited projects which have spiralled out of control with mammoth makefiles and a propensity to being so complex as to prevent any cost-effective entry grade for new developers to key into - i.e. they're too hard to learn, or obfuscated sufficiently to allow established developers to retain their positions of glory and power. I don't subscribe to that ethos however, and believe that as a leader in development you should facilitate everyone to be being able to do everyone else's development role, be that starting a new project or continuing an old. It perhaps comes from my being able to work alone and defining a role which others are then keyed into, I have been forced to allow...

Software Development - All Areas Stagnation

Image
It has been said by far bigger and better minds than myself, that if you sit still, if you don't continue to learn about new things and innovate you will stagnate.  This has been a huge problem looming within the business I work, certain things have worked since the industry sector was conceived and even though more than half a century has passed it has largely passed the internals of this industry by. That is until very recently, where market competition has sprung up, the market base itself has reduced and so pressure is on... Nowhere is this more apparent in my industry than on the software, the front-line of pushing product to customers. The trouble however seems to be that many people have stagnated, they've stuck with the safe option, the tools which work off of the shelf, I am of course talking about Windows, the entire tool chain that is used by 99% of the company is all Windows based, I am the man on the spot waving the Linux flag. But just a few days ago, the Windows ...

C++ : Ignored qualifiers (-Wignored-qualifiers)

What is an ignored qualifier?  Well, in a class, lets have a student class: #include <string> class Student {     public:         const std::string Name;     private:         bool m_Present;     public:         Student(const std::string& p_Name)             :             Name(p_Name),             m_Present         {         }                 void SetPresent() { m_Present = true; }         void SetAbsent() { m_Present = false; } }; Now, we may want to access the present flag, therefore provide a function to do so:     bool Present() const { return m_Present } This function is telling the user of our class quite a bit, it tells them that the return type is boolean and that the calling...

Bash : Power of Pipes

Subtitle: "Get IP Address Easily" When I say easily, I mean not so easily, but with the proper tools... Let me explain, it's been one of those days... I've a remote server running some flavour of Linux, and no-one knows it's remote IP Address, they all SSH into the box run " ifconfig " and note down the value, they then plug this into a config (or worse still were baking it directly into some code) and running their services.... The trouble of course being, years later, they're no-longer the programmers nor maintainers of this machine, I am... And to be frank whenever the IP address changes I don't want to recompile their java code, nor use vi to edit the various configuration files, I want a script to at least update the settings automatically. I therefore changed their code to load the IP address, not hard code it, and used some other scripts to put the IP address into the config file at boot... The first line of that script is what I'm goi...

Software Engineering : My very bad way to set up makefiles

I may have wrote this post, but I'm just being lazy... Read on. I've made other Boost videos, and other codeblocks videos, and I've always assumed that the user at the other end was well aware of how to compile & build code. However, it seems there are lots of users whom are not aware of how you actual create a program from source code, at least not with C++. So I'm going to show you the absolutely most  wrong basic way of creating and using a makefile to perform a build... The first step of C++ program creation, is that trivial matter of creating the source code, easy right?... Yep, so lets skip that step, and go to when its once  and we want to pass the code through a compiler, the compiler turns the source not into a program, but into an intermediary format called an object file or object code. The compiler then leaves the process and another program takes over, this second program is known as the Linker, and it takes the object code and links it with all the sy...

Server Admin : How Good is your Backup?

Image
How robust is your back up solution?  Go on, be honest with yourself, how good is it?... Because I've seen a whole host of them and, at this very moment, this is the screen up on one of my servers.... Yes, my raid 5, just a test raid 5 with three really bad recycled SAS drives in it has failed; this doesn't surprise me, but it does delay me because I now have to rebuild the data... However, I know my data is good.... Lets see how good my back up is. This back up is coming from a DD created raw image of the virtual disk, stored to and soon lifted from my NFS accessible ZFS mirrored back up server. Therefore you would be right to ask, why are you rebuilding the virtual RAID disk in the above screen shot?  Well, I'm going to test my back up strategy! I popped the known bad disk and the good disks out, replaced all three and I'm able to test a restore to a new virtual disk set, I have a USB boot drive ready, this is a test. This kind of test, a real live restore, is sorely ...