Monday, November 12, 2012

Tools #3: Ditto clipboard manager, the ultimate tool in your pocket

Whether you admit it or not, it doesn’t change the fact that the most frequent operation on our PC is in a way or another copy/paste. I copy and paste all the time: code snippets, files, links, you name it.

The problem with copy pasting is that it is one way ticket, you can’t go back and browse all your copy and paste history, search through it and find everything you copied or pasted.

Ditto is the tool that solves all your problem and it does that in such a way that you don’t even observe that it exists on your laptop or other devices. In short, Ditto is a clipboard manager that is managing all your copies and pastes, the number of occurrences it keeps in the SQLite database is configurable. I always have there a 1000. It is relatively good handled by the DB when you do searches, and it is a big enough number for keeping your most important recent copies and pastes.

ditto_1

I also like that it contains files and even tables from Excel or Word, that is pretty cool.

2012-11-12_0005

You call that by pressing Ctrl + ~

This way when you want to copy and paste multiple snippets of code, you don’t need to switch between the editors, just copy, copy, copy and than paste, paste, paste, and when you are not sure what you should paste use the search feature.

P.S. There are some problems in Windows 8 interactions with Ditto, in short there were made fixes in beta branch and there is a download for windows 8, here you can find the corresponding thread: http://sourceforge.net/p/ditto-cp/discussion/287511/thread/2d4c8635

Thank you, and I hope you all will have this great tool in your belt, and it will save you a lot of time.

Friday, October 5, 2012

What is cron and how to configure it with Drupal (secure) on a shared hosting

I can’t name myself a heavy Linux user developer, I don’t know by heart hundreds of commands, but recently I had to setup a hosting for NetBeans PHP Community Council. You can read my post about it at NetBeans PHP team blog. And I needed to setup cron to make my notifications in Drupal works.

So what is cron? Shortly cron is a time based job scheduler that allows you to run certain bash scripts in a certain frequency. What could we do with it? Well, a lot, think of email sending or verifying a certain flag in a web service, cleansing the database, you name it.

explaining cron configuration: CRONTAB

So cron has a configuration file: crontab, it describes the frequency at which the job runs and also the script that describes what will actually be done.

If you are in command line you can access crontab by typing

crontab -e

this will open the configuration file in your default Unix editor, usually vi.

FREQUENCY DESCRIPTION

Ok so how we describe frequency, there are 5 stars, which by default are placeholders. A star means ‘every’

* * * * *

Ok so what all these start mean

*  - minutes (from 0 to 59)

* hours (from 0 to 23)

* – days of month (from 1 to 31)

* – month (from 1 to 12)

* – day of week (0 to 6)

So the previous example means

* * * * - every minute

* * * * 0 – every Sunday

*/5 * * * * – every 5 minutes

45 * * * * – every hour on 45th minute

15,45 * * * * – every hour on 15th and 45th minute

* * */15 * * – twice a month

I hope you got the idea. Also cron has some predefined values like @yearly, @monthly, @weekly, @daily and others.

CONFIGURE DRUPAL TO WORK WITH CRON

In Drupal we have different moving parts. One of these are notifications, which are very important and even more important in OpenAtrium, Drupal’s flavor. Notifications work with cron. To send all the notifications that are in the queue you can go to your Drupal site’s cron.php script, for example, at http://somedrupal.org/cron.php. At this point you’ll have in your administration panel, Administer –> Reports –> Recent logs, some entries related to cron script.

2012-10-09_2354

Now to make this script run at a certain frequency we’ll need to create a job for it. Drupal’s guide propose to make such an entry in your crontab:

45 * * * * /usr/bin/wget -O - -q -t 1 http://www.example.com/cron.php

When you set it up in your crontab –e everything should work fine.

CONFIGURE SHARED HOSTING TO WORK WITH CRON AnD WGET

On my shared hosting solution I hadn’t rights to execute wget command from /usr/bin/wget and my cron failed, so I made a ticket and the guys from the hosting made me a simple copy of wget binary into my /home with all the rights I needed. After that I modified the script from crontab so it could work with my local copy of wget, and everything cron related was working without a single issue from that day.

SECURE ACCESS TO CRON.PHP WITH .HTACCESS

Now that everything works ok, the question is how to configure your site that your cron.php script couldn’t be accessed from the browser. Otherwise anyone could just refresh /cron.php 5 millions time and put a big load on server.

We can avoid it by limiting access to cron.php file via .htaccess file.

  1. Find out your server’s name: use the command  uname –n.
  2. Put the following in .htaccess file
  3. <Files "cron.php">
      Order deny,allow
      Allow from WEBSERVERNAME
      Allow from 127.0.0.1
      Deny from all
    </Files>

  4. Change the WEBSERVERNAME with your own server’s name.
  5. Test that you can’t access the cron.php from browser
  6. Test that the cron job on linux is running and is executed OK.

 

That’s all I wanted to share with you today about cron, if you have any questions or suggestions please write a comment.

Monday, September 24, 2012

TEDx Chisinau NXT LVL #nxtlvl

Hello friends,

TEDxToday I was attending an extraordinary event TEDx in my own town, I must say I’ve never been to a TED event before and hardly imagined what it will be like, but it was an unusual event because pretty much a lot of topics where open-ended points to discuss. We were around 400 attendees with 12 speakers, speaking in 3 languages (English, Romanian, Russian) and pretty much everyone was willing to listen, to learn and to evolve as a personality.

UPDATE: Here are some videos: http://www.youtube.com/playlist?list=PLADJSjJ03wMkNQI_B0ARgzqgO5NZnOtpL

 

 

schedule

Before we get started I’d like to thank everyone involved into organizing this event, and I hope we’ll get many other events related or not to IT, I think communication is the key to get to that next level we’ve kept talking about all day long. Don’t think you’re smarter than someone, but if you got an idea that’s burning you inside out, just make it happen, start by small steps and then it will lead you to some kind of lesson learning.

The bio of all the speakers is on TEDx Chisinau official site: http://www.tedxchisinau.com/speakers/ 

The photos are taken from https://www.facebook.com/TEDxChisinau photos and from Victor Buzu’s FB album.

Elena Pahomova – There will be no  future

An interesting topic for opening of the event – actually the main idea what Elena Pahomova was presenting is that today is the base for our future, we don’t need to wait until it happens with us. Future is happening now, we model it day by day, so we should live as today dreamers, changing something today, living better today, etc. Another good piece of advice for young journalists was “don’t try to chase big money, work for experience, this is why you got here in first place.”

 

 

 

Octavian Ticu – Bankrupt state with elite sport

Octavian Ticu presented a very good info about the idea of meritocracy and that it is mostly applicable to sports, because we know for sure who is the best one there, there are seconds, kilograms, kilometers, etc. He also talked about one little village in Moldova: Grimancauti, this village with a population of 4200 people, gave us (moldovan) 3 Olympic medalists and a lot of champions in box. Also he compared the years when the most progress is done, and these are the years before and after the USSR period in Moldavian history. He also expresses the idea that as a community, as a state we are not yet ready, we don’t have conditions to raise champions in team sports as football, basketball, and others, because the team is a micro community with all its strengths and flaws. This is why we fail in these types of sports. In several words a very good presentation I’d advise you to watch it on YouTube when available.

Onorica Banciu – Get out from the game

Onorica’s insights on our Moldavian budget are very interesting, she indicated several numbers, which seemed very outraged when measuring the price and the value. Getting as an example a simple Moldovan family from a village she presented some of the day-to-day problems and expressed an interesting idea: “Don’t wait until government will give you something, remember when it does, it means that government first took from someone something and than gave that to you”, so basically when you’re doing great, government is putting pressure on your business, when you’re doing bad it will give you some money so you could still be at least on the edge. So don’t get into the game of protesting without changing anything yourself - stop, innovate, create something new and the changes will come. 

Dave Erasmus – Is giving good for you ?

is_giving_good_4_uDave mentioned once again that love isn’t just as simple as a resource, each time you give away love, you’re getting it back. Don’t be afraid of giving something without demanding anything in return, which is the essence of true altruism. As an example on the picture he’s talking about a mother giving everything to her 6 months daughter without getting anything material in return from her. Another idea was that if you have a cause or an idea that you support than getting the funds for that cause is not that complicated, isn’t that complex, just let the people know that you’re passionate about it. Nice talk and a profound one.

Alex Cosmescu – Do you exist ? Really ?

Alex gave the most confusing talk, at least for me. The idea is interesting but not the one that I like, so basically the idea is that life is a union of emotions, feelings, stresses, and many many other things, that we can’t control. Basically life is just happening. And this is why it is not fair to say that you have to suffer more or less than someone else, because life’s just happening want it or not, you can’t change it. Anyway I think this talk enlarged a little bit the common pattern for a TEDx speaker.

 

Eugen Boico – Remix your way into  the future

Once again I loved the presentation. For a beginning artist, designer there is this idea of being unique, that is like a trigger in their mind. But what is the easiest path to express yourself as a creative artist, the answer is simple, that is remix. With loads of data generated every minute on our planet, there is extremely low possibility that you’ve created something unique that was never created before you. But get a piece of art, a track, something that you like a lot, and improve it with your ideas and thoughts, and this way you shouldn’t invest a lot to progress in this area. Remix of course isn’t the only way, but it is the simplest and the most effective one for a beginner. Watch the presentation on YouTube when available.

Ruslan Cojocaru – Happiness 2.0

Unfortunately I just arrived after the lunch at the end of the presentation, but I got the idea of being positive in everything you do and to succeed you need two components: the passion about the project, the passion about what you do, and the other one is the team. Get the perfect team and when you got it experiment with it to do it better. I hope I’ll get more ideas from YouTube watch.

 

 

Maria Gaidar – Changing system from the inside

Maria is talking about being an opposition activist in Russia, and than suddenly things changed when she became vice-governor in the social sector of Kirov region. She talks about her problems and how she tried changing the system from the inside, not breaking it but step by step changing the attitude of the people towards politicians, by listening and making reforms where needed and possible. When asked if she thinks a single person could make the difference, she is a strong believer that a single person can do a lot of things using different tools and techniques.

 

 

 

Chad Rogers – Tweeting isn’t enough

Chad Rogers is talking about tweeter and Facebook and other social media that is used by lots of people, what he’s saying about it that you need to be active for sure, but not on social networks because sharing some link or clicking the “Like” button isn’t an action, it is just an excuse for doing nothing. He also says “Remember why everyone hates politicians ? They keep talking but they are taking no action. The same might happen to you”. The word introduced by Chad is “slacktivism” Smile.

 

Jennifer Brush – Moldovan Youth: Bricks into  the foundation of  the peace

Jennifer Brush is Head of the OSCE in Moldova. She’s talking about the Tighina bridge that can play the key factor of Moldova’s future if opened. There’s a plan of creating a series of European roads from Kiev to Istanbul – Corridor IX and Moldova is right into the center of this road – this road means prosperity and wealth and growing economics, now the bridge is closed because of our past conflict with Transnistria. Also she notice that there’s another organization that involves multiple countries in Danube zone which is also somehow interested in developing the transport routes, and Moldova can get the benefits that comes with that. She’s asking us at least to show to the governors that we’re aware of this problem. Let’s say it straight - I didn’t know about such plans and such organizations till Jennifer told us about those. Now that we’re aware of it what will change ? She answers that at least if this would be on 5th position in the social polls that would be great, and may be our governors will do something about it.

 

Dorin Dusciac – Nuclear physics danger comes from ignorance

A hilarious guy, he’s a research engineer at the French Atomic Energy Commission near Paris. He’s talking about the formulas and the concepts with such an ease that it is truly pleasant to watch him, plus he’s always making jokes. For example he explained about Roentgen and Sievert and than he said “So now everybody knows the difference between Roentgen and Sievert? Right. The Roentgen has beard, and Sievert hasn’t”. Than he talks about the myth that the wine is protecting us from the radiation and that is not correct because wine protects us only from one element in the radiation specter. Also he talks that if we fly pretty often than that dose of 1 mSv can be achieved pretty fast. For example if you get 7 flight of 7 hours you get the dose of radiation that is already higher than the yearly limit. Thanks Dorin, for a great presentation!   

Dmitry Volosin – Live projects

A serious person with a big experience in internet portals. A lot of ideas here, ok for starters he enumerated some of the components of a successful project: obsession, enjoying the project, accepting failures/deaths of the project. He says first projects are like calf's teeth but when those fall, from these small projects can grow big projects with a base already. On the question “Is it normal to lose obsession from time to time ?”, he says that it’s normal because we aren’t robots and these periods of sadness and desperation happen from time to time, but if you lost for good you obsession than sooner or later your project will die. “You should be on fire with this idea, like Jeanne d’Arc… but that isn’t the best example” Open-mouthed smile A good presentation worth watching on YouTube.

 

 

 

truly_yoursWhat I would like to say in the end… Please come to these type of events, support this type of movements. Today in parallel with TEDx Chisinau, in our city was organized “VeloHora”, a great bike event, aside with it, near Opera and Ballet Theatre was running a minifootball European championship, today I felt that our city was really alive and I hope such events will occur more and more often,

Best of wishes.

Tuesday, September 18, 2012

X-Share – cool tutorial for learning Symfony2 Framework

Hello,

At the moment of writing this blog post I’m working in Pentalog, which is a computer and technology services company, focusing on low cost offshore/nearshore IT engineering and software development.

Few days ago I found out, that as a result of our summer internship program some of the developers from our company created a great tutorial called X-Share. Following this tutorial you’ll create a website, that permits sharing of some objects between the members of a group. As an example it could be sharing books, sharing of the discount cards, sports equipment, etc. This tutorial is open sourced and is on SourceForge.

I hope you guys will find it useful, because one of you right now could be searching for a practical example of a  Symfony2 working application. And a little disclaimer: although I’m very proud of what my colleagues have done and achieved, I wasn’t involved in any way in creation and developing of this tutorial, so all the credits goes to them.

P.S. It is great to see how open source community evolves, and I hope X-Share become your first place to show to your new junior PHP developer for learning Symfony2 basics.

Friday, August 3, 2012

Unified Udevi Symfony2 Plugin for NetBeans 7.2

Hello,

I’ve recently created the unified Udevi Symfony2 Plugin that contains both File Templates plugin as well as Code Templates plugin. This plugin is made for new version of NetBeans - 7.2. It passed the validation today so you can install it directly from NetBeans. Go to Tools –> Plugins –> Available plugins. You might need to update plugins info, so it will contain the latest list of validated plugins.

plugin_udevi_symfony2

The content of the plugin remained the same, just uniting 2 templates content. The current statistic is

chart_1 (1)

In the previous table I counted number of days that this extension is published in the NetBeans Plugins Center until today. So 2.5 downloads per day isn’t so bad I would say. Probably Symfony2 and NetBeans are a good combination and a lot of people know it. But 5.5 per day is definitely better. I guess now when it is validated in Plugins Center it will sustain current number of downloads per day

chart_1

I would like to give a shout to first and I hope not the last person making 5 pull requests in total for those 2 plugins:

   Smeagol07     -       Thank you very much I hope that with the input of the community I will improve the quality of the product into something much bigger, than it is today.

 

I would also like to thank NetBeans team, because their 7.2 version has a higher performance than the previous version and made my plugin run much faster without lots of time for processing.

I’d also like to hear from you what else would you like to improve in your day to day job with Symfony2 and NetBeans and who knows may be I will be able to fulfill your expectations.

the bad part

While File templates are working fine, the code templates are not completely working, the only code templates that are working are for php editor, example action template, and others. First the code templates for Twig editor don’t work, I’ll see what I can do with it. Second the code completions for with doctrine annotations are not working, probably because for now I set them as a php documentor templates, may be I’ll need to set them as a php code templates.

The code source is here: https://github.com/Monomachus/UdeviSymfonyPlugin

If you have any questions or suggestions please share them in comments, it will be great to know what you’re thinking about it.