Lately I've been dealing mainly with code instead of administration, so the dramas I face with coding are much more than server ones., so I decided to write a few lines about the nonsense I manage to create. We are preparing hard to present our project, which forces the opening of the dramatic parts to some extent

  • The first thing that would certainly cause problems is the exclusion of javascript from browser support. Like any modern application, our tool uses a lot of JS for AJAX and other dynamic processes that transmit interactivity and modernly improve vision and functionality. We thought of a lot of solutions and the most acceptable was with an information cookie and then php to check if the information is valid and if everything is OK. Quite a competent solution, but in the end it appeared in a decent way. HTML to run if it gets into noscript. In my opinion, it is the most elegant solution.
<noscript>
<meta http-equiv="refresh" content="0;URL=./nojs.html" />
</noscript>

In general, the situation is trivial if we stop JS support we will be redirected to nojs.html. A simple and quite effective solution

  • Php multhithreading – very filament is something that is quite useful with more core processors (not that single-core is not OK but with many nuclear systems things are different beer). Our software has a section that deals with gathering information from others API – that and me import you into our database. Generally no challenge except that we implemented it again in php with multhithreading in cli mode because this process is large enough and needs to be automated to force someone to do it by hand. There was a drama here related to the formation of processes and not the very creation of child process-and that the script was waiting to finish to create a new one. Stupidly this killed the idea of ​​multiprocessing what is actually behavior and not multhithreading but these are details. First we put & after the process, which means that the script continues to work, but still there was no change in the behavior, it was required that the standard output of the script be redirected. – in my case best to /dev/null 🙂 In the end, the structure of this piece of code looked like this
$pid = pcntl_fork();
if ($pid == -1) {
die('could not fork');
}else if ($pid) {
// we are the parent
echo "I'm parent  \n";
pcntl_wait($status); //Protect against Zombie children
} else {
// we are the child
echo "I'm a child $timer  \n";
exec("$command > /dev/null &");
exit (0);
}

The example is again trivial. In terms of performance, I was very impressed with the interruptions between lifting processes and so on 50 child process who made their side 7800+ mysql inserts for about 30-40 sec. And the machine is extremely weak because it is a test verer before we pick up the application of the real.

  • Mysql querys – I was shocked by a great stupidity. There was a code he was making 4-5 redundant database queries, instead of using a bolder sql query and then the main job is to take it to php. The drama was like that, the most- first a request was made which took information then the output of the request was used to make other requests as it served as arguments. Quite an ugly and fat situation. Subquery and it's unfamiliar territory obviously as well as left join or things just weren't well thought out. I caught rewriting the request everything went pretty well and overall the load dropped by about 200% for the same part of the code.

In general, these are the last things we deal with and I can't say that it's boring, but sometimes I am amazed by various ill-considered pieces of code that I have to fix and the most confusing thing is that they are often mine 😆

Enhanced by Zemanta

I have not written again since … an awful lot of time – caused pain and reluctance to think somewhere. I tried 3-4 times to post some things but I was not very happy with the result and so I gave up every time 🙂 I decided to look at my blog so just for sports 🙂 I see interesting things. The real reason that made me write this post is not most of the time I have because it is the same as yesterday, last day and so on and a compilation of feelings that overwhelmed me 🙂 I also came across this computer, I hope the author doesn't get mad at me for releasing it 🙄

***

honey,
I am an attractive man.
And I know him.
I know women quite well
and secrets
of their bodies and souls.
I can
to easily obsess the weak.
The strong
are more difficult, but not for long.
A lot
they are looking for me themselves, not for love, and for
substitute.
I understand them and give them what they want.
Always
I say the words, who want and
I kiss
skillfully where no one dares.
My hands
magically make their bodies sing,
and after
when they merge with my weeping…
Never
I was not proud of myself, but
I do not stop.
I've tried, not that I'm not,
sometimes,
I want you to know it, and it always was
unsuccessfully.
That's why I'm left without a soul.
I banished
so as not to interfere with my decisions.
In fact
she left me disgusted by me.
Today
I feel something new and painful.
My conscience
it eats at me and I wonder how she stayed
in me
like grass sprouting in a stone
cold.
I'm suffering now, deservedly, and I think I am
on the road
to finally do a heroic deed
and say:
– Stay away from me. Beware!
I love you!
You don't deserve a replacement!

For one project that I lead in gitweb it annoyed me, that there is no coloring of the code in the tree. Лесен начин как да оцветите синтаксиса в tree частта на gitweb е като инсталирате пакета highlight и добавите следния ред в /etc/gitweb.conf или където ви се намира конфигурационния файл на gitweb

$feature{‘highlight’}{‘default’} = [1];

For the Debian package it is in the package system for other distributions I have not checked.

ps There is an alternative option by making changes to the gitweb files, but it seemed pointless to me as there is a simple option 🙂

I haven't written much, an awful lot of time. Apparently for some strange reason people missed me because I received several letters with questions – What's happening, Where he got lost, not to give up the blog. Quite interesting, obviously for some strange and inexplicable reason for me people read me and even more strangely they like this piece of meaningless nonsense. It was quite interesting for me after I moved my blog to shared hosting that I don't have enough resources 😆 Quite a funny fact I don't have enough CPU time from overloading with too many visits 😀 So in general so far I had the great difficulty to be able to blog just because I don't constant access to the Internet but since last week I have been in my home and I am global again. I will probably pull my server again so that I don't create unnecessary problems for my hosting provider, I have optical connectivity anyway, and I miss experimenting with web services, to pick at my machine and watch how the speed and consumption of resources change. For a few days I've been thinking of an interesting room inspired by the latest craziness I'm dealing with, but let's see what happens, that my cisco is quite busy, it continues at full speed, we go to English from the company, that to raise the level and free time again tends to minus infinity.

It's been a long time since I last wrote but I'm terribly busy with my new job, I haven't settled in yet and I haven't put the Internet in my new place. Separately, that the hosting where my small blog was located had a lot of hardware problems and there was a period in which it could not function due to my inability to have physical access to the machine. After much thought, I decided to transfer my blog to a public web server, a decision that required a lot of thinking and not a very easy acceptance. After all, I'm primarily a system administrator, and that strikes my pride a lot, but at the moment I don't have any suitable machine to host the site like that, that I swallow the bitter bite and move on. Excluding this fact and the fact that I am extremely limited by the possibility of manipulating the settings of apache + php + mysql things don't look so bad. People make regular backups have their disaster recovery plan have their technical help you can ask for help – as well as had to import the backup to my database which is in the modest size of about 1GB. For now there are a few more small settings to complete but it will be like im nerves to fight the dumb cpanel 😆