Drupal, Silex, Symfony2, Ubuntu, Website Development
Regex can be so difficult but because of its ability to be so flexible it becomes necessary to use when searching a string that could have multiple variants. PHP uses the PCRE format so this could be used in other formats. Below are patterns I constantly use,
Searching for a characters with tags in a string
// String to be searched 1111<thumbnail code='1150400' />2222 // Regex pattern /<thumbnail code='.+?' \/>/ // Response <thumbnail code='1150400' />
Searching for the code in a string
// String to be searched 1111<thumbnail code='1150400' />2222 // Regex pattern () is what you will search for /<thumbnail code='(.+?)' \/>/ // Response 1150400Read more
Grep is a powerful tool but remembering the commands at times does affect your ability to be productive because you don't use it all the time and to recall them can be a headache. Below are important ones I uses at times
Searching a document for a word
~$ grep <searchterm> or <"search term"> <path/filename>Read more
Apache2 has changed the way you can deploy your websites under /etc/apache2/sites-available/ the hosted directive file names need to end in .conf eg, purencool.aust.dev.conf. Below are some commands need to run Apache2 web server from the command-line
To enable a website on Ubuntu.
~$ a2ensite <sitename.conf> //Creates a symlink to sites-enabled
To disable a website on Ubuntu.
~$ a2dissite <sitename.conf> //Removes the symlink to sites-enabledRead more
The more web development I do the more I use Vim and Vim buffers. Wow, once you get your head around not using the mouse and the editing keys which are more than "i" it really does speed you up. Below are some of the keys that I need to remember.
This closes the current buffer that you are in.
This moves to the next buffer.
This to goes back to last buffer.
Lists all the hidden buffers.
Deletes the character that the cursor is on.
x //in visual mode
Vim insert commands
i to insert CRTL p will search down the document for terms you want to use
i to insert CRTL n will search up the document for terms you want to useRead more
Now that Drupal 8 is starting to use Drupal components I thought that it would be in my best interest to try installing Symfony 2 and read up on its components and how they work. From the start what you find is that it does nothing even after you have created a Bundle. Yaml is completely foreign. But after going through the Symfony 2 Cook Book things started to make sense. I love the command line tools and composer wow and to see it all in OOP, sorry Drupal but it just makes so much more sense and I don't feel like I need to belt my head up against a brick wall and then jump off a cliff. Below are some points that I found interesting when installing Symfony 2.
Redirect rules in apache .htaccess are very useful. Below are some examples that allow you to achieve some simple tasks that I use on a regular basis.
Testing to see if htaccess is working?
The best thing to do in this circumstance is find or create a file called .htaccess in your root directory and add a whole lot of characters and then open your browser. Navigate to the url in the browser. Refresh the page and you will either see an error from the web server or you'll get a blank page.
I want to customise my 404 redirect page
Create a document and call it anything you like and add it into any directory you like from public_html.Read more
The use of Less and Scss is almost becoming mandatory. What I have been finding is that different projects want to use Less or Scss when doing web development, this is a real pain to constantly setup especially if you want to do a small update on one development. Below I have created two Bash scripts to automate the process.
To get them to work the packages needed on your Unix system are Ruby, the Scss and Less ruby gems, and Inotifywait for the automation of Less. Once they are installed then add css-compilers script to a directory of your choosing. Here is where it starts to get very easy, when you have a new project you copy the compiler-tool rename the file to the project name and open it and fill out the details.Read more
From our last post we worked out that a Drupal developer means different things to different people, but what does that mean for a new developer? I can give you some idea of the elements that make a Drupal developer that have helped me understand this large community. A Drupal developer knows a little about everything but their skill set is deep in certain areas.
The issue really arises when a person, agency or recruiter is looking for a Drupal Developer. They want one that suits their particular circumstances they then by extension create a view of what a Drupal developer is and start looking for that type of person.Read more
As this Drupaler has found the question What is a Drupal Developer? is not an easy one to answer. During the last few months what became more and more apparent to me is if you are new to Drupal this is a question that is asked a lot and because Drupal is a complex system it is not the easiest thing to explain. So here goesRead more
After getting an StdClass() from a PDO database call you need to sort the data in some way, at times however you only need to access one property of the object. You could place the object into a foreach loop and search the object but if you know the property that you want to access there is an easier way.
Creating a StdClass()
First we need our StdClass() for our example this is relatively painless. Create the lass and then by using -> you can add the property and the value of that property. Most of the time I find you will get a StdClass PDO call that has taken data out of your database.Read more