Saturday, June 13, 2015

Latex in 5 minutes, a quick guide

Picture

1) Download and install MikTeX

2) Download and install TexStudio

3) Download and open thesisLATEX.rar (if you are writing a Bachelor, MSc or PhD thesis at any university).
Alternatively download and open reportLATEX.rar (if you are writing an executive report at any company). 
Please note that the steps below are referred to the thesis template, but the report template is even easier. 

4) Copy the folder ThesisLATEX where you like it. (e.g. desktop)

5) Inside the folder \desktop\ThesisLATEX, open thesis.tex with TexStudio.

6) Click on the double green arrow at the top of the window (the button is besides a single green arrow)

7) Click install to everything (if asked)

8) Your pdf will appear on the right. The pdf file is updated inside the folder \desktop\ThesisLATEX.

9) Now change something on the source file (on the left-hand part of texstudio, full of unfriendly code)

10) Click again the double green arrow and check your changes.

That's it.

If you want to edit the chapters, you should open and edit the file chapterXX.tex inside the subfolders.
Hint: try ctrl+click on the code or on the pdf
For any trouble, before trying anything else, I personally recommend the button in menu tools -> Clean Auxiliary Files
Sources : http://www.antonellocherubini.com/latex-in-5-min.html

Thursday, June 4, 2015

Configure PhpStorm to Auto-complete CakePHP Models, Views, and Controllers

After playing around a bit today I finally figured out how to get PhpStorm to auto-complete methods for models and controllers. Here's what you need to do.


Removing Multiple Definitions


First, let's tackle the multiple definitions problem that we see below.
Multiple Definitions


There are multiple places defining AppController. We need to remove the ones that are included in the following locations from our 'Directories' in the project's settings.

The two locations are:
  • $CAKEHOME/cake/console
  • $CAKEHOME/cake/tests
Exclude Directories


Next we need to mark the following file as plain text.
  • $CAKEHOME/cake/libs/controllers/app_controller.php
Mark as Plain Text


You should now see that PhpStorm is no longer complaining about multiple definitions. If it is you may want to check your plugins/components to see if they're mucking it up. If they are, just mark the file with the definition as plain text.
Multiple Definitions Resolved


Auto-completion should now work for the controller. However, it's still not working correctly on our model.

Autocomplete works, but not on the model.


Adding the Model


To fix the model we need to add a magic property to the class.

/** 
*@property ModelName $ModelName 
*/ 

Here's an example from the controller we've been working in.

@property ModelName $ModelName


 We can now auto-complete on our models in the controller.
Auto-complete on the model.


Defining Model Relationships


Lastly, we need to add magic properties to our models to define its relationships with other models. Basically, for each "belongs to" relationship defined in the model's file you need to add the magic property comment.
Define belongs to relationships


We can now auto-complete these relationships.
Auto-complete model relationships


Setting Up Helper Auto-completion in Views


To get auto-completion working in views we need to include a file created by junichi11 over at GitHub.

Download this file and save it in a directory somewhere outside of your current project. I did this so I could use the same file on multiple projects.
Now add that directory to your current project.

Open a view file and add the following variable definition.
/** 
*@var $this View 
*/ 


You should now be able to auto-complete helpers in your view!
Auto-completion of helpers


Core Component Auto-Completion


Add the following to your app_controller.php file and this will add component auto-completion.
/** 
 * CakePHP Component & Model Code Completion 
 * @author junichi11 
 
 * ============================================== 
 * CakePHP Core Components 
 * ============================================== 
 * @property AuthComponent $Auth 
 * @property AclComponent $Acl 
 * @property CookieComponent $Cookie 
 * @property EmailComponent $Email 
 * @property RequestHandlerComponent $RequestHandler 
 * @property SecurityComponent $Security 
 * @property SessionComponent $Session 
 */ 

Source: http://blog.hwarf.com/