Aptana and CodeIgniter - ide

I've just installed Aptana 2.0, and I'm trying to get Code Assist for Codeigniter. I've never used an IDE before, always stick with my good ol' E-text (Windows version for TextMate). But in every screencast about CodeIgniter, people use Aptana and get benefits of it's awesome Code Assist.
So...any tips for setting it up??
Thanks

Aptana autocomplete feature for php's build-in function and custom functions in your project is working out of the box. Just type the part of function name, and then press Ctrl+Space. A list of functions will displayed, and if there are only 1 function with that name, the full function name will automatically written.
However, since CI load the library and model using $this->load() method, Aptana will not recognize the methods in the library and models. To make Aptana recognize library's and model's methods, add these comments:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
*
* #author donny
* #property CI_Loader $load
* #property CI_Input $input
* #property CI_Output $output
* #property CI_Email $email
* #property CI_Form_validation $form_validation
* #property CI_URI $uri
* #property Firephp $firephp
* #property ADOConnection $adodb
* #property Content_model $content_model
*/
class Content extends MY_Controller {
function Content()
{
parent::MY_Controller();
//load model
$this->load->model('content_model');
//...
}
/**
*
* #return void
* #access public
*/
function index()
{
//...
}
}
In code snipped above, when I type $this->input-> then press Ctrl+Space, a list of methods from Input library will be displayed. The key to do this is the comment with this line:
* #property CI_Input $input
This will tell Aptana that in my controller, the $this->input-> is actually an object of the CI_Input class. You can do this for models too. Just write the actual class name, and the name inside the controller, and Aptana will recognize and use it, like this:
* #property Content_model $content_model
I use Aptana and I don't set much. I just set the tab into space with 2 space, install git plugins and jquery support, tweak the shortcut, add php templates that I always use, and I'm ready to go. I try to keep the change minimum, so when I had to use other computer with fresh installed Aptana, I don't have to do re-setting too much. Just do some mandator setting and I can use it right away.
I hope this simple trick work for you.

Here is one for autocomplete
http://forums.aptana.com/viewtopic.php?f=14&t=8519

Related

Leo Bootstrap Megamenu Error In Prestashop

I'm starting to learn Prestashop, so I've downloaded a free theme and started to edit it. But I have a problem with the navbar and now I need to edit it.
This is my navbar:
I need to add all my categories to the category section of the navbar, but I'm not able to do it. This theme uses Leo Bootstrap Mega Menu. So when I edited that module to add a product, it gives me the following error:
How would I fix this?
Your theme or module uses a function that is not included in your version of Prestashop. Try to put this function in your classes/Language.php file before the last }.
/**
* Returns an array of language IDs.
*
* #param bool $active Select only active languages
* #param int|bool $id_shop Shop ID
*
* #return array
*/
public static function getIDs($active = true, $id_shop = false)
{
return self::getLanguages($active, $id_shop, true);
}
As for #Roman K suggestion. I recommend you should add the code to overrides folder. It will be easier for you when you upgrade to new version of Prestashop.
If you still get the error. I think you should download other Prestashop Mega Menu Module.

logd shortcut doesn't work in Intellij with Kotlin

Logging Java in Intellij is easy with shortcuts such as 'logt', 'logd', 'loge'... and so on. But I moved to Kotlin, I noticed that those shortcuts doesn't work anymore. I don't know if it has something to do with my configuration, but if not, how can I fix this?
You should create separate templates to make them work correctly.
Here is the step-by-step guide:
Firstly, Copy and paste AndroidLog templates to Kotlin (Just select them and use CMD+C, CMD+V (or Ctrl+C, Ctrl+V)
Secondly, You have to adjust them manually:
1. logd (and others)
Select the logd item and press "Edit variables"
Change expression to: kotlinFunctionName()
Also, remove ; from the end of the template, as you don't need it in Kotlin.
Now your method name will be shown correctly
logt
This one is a bit trickier.
Solution 1 TAG = class name.
Template text :
private val TAG = "$className$"
Edit variables -> Expression:
groovyScript("_1.take(Math.min(23, _1.length()));", kotlinClassName())
Solution 2 TAG = file name (can be used inside Companion)
Template text :
private const val TAG = "$className$
or:
companion object {
private const val TAG = "$className$"
}
Edit variables -> Expression:
groovyScript("_1.take(Math.min(23, _1.length()));", fileNameWithoutExtension())
Edit 19.02.19
Also, it might be useful for someone.
In order to avoid creating the TAG variable, you can use the class name as a variable, for instance:
Log.d("BaseActivity", "onCreate: ")
Where BaseActivity is the class name.
The template will look now as:
android.util.Log.d("$CLASS_NAME$", "$METHOD_NAME$: $content$")
Where CLASS_NAME variable is:
groovyScript("_1.take(Math.min(23, _1.length()));", fileNameWithoutExtension())
These are provided in IntelliJ as a Live Template configuration for AndroidLog (found in Preferences -> Editor -> Live Templates), and are applicable specifically to Java code:
There isn't anything broken in your configuration, but if you want to make these Live Templates available for Kotlin you will need to add new Live Template for AndroidLog and make them applicable to Kotlin code.
https://www.jetbrains.com/help/idea/2017.1/creating-and-editing-live-templates.html
There's an open feature request to have them added as defaults here: https://youtrack.jetbrains.com/issue/KT-10464
Change the scope of the template in the applicable option.
In Android Studio 4.0 there's new AndroidLogKotlin block. You can implement #LeoDroidcoder's solution there.

How to force MVC to scaffold string fields by #Html.DropDownListFor helper method instead of #Html.EditFor

This is my model
public class FacePart
{
public long Id {get;set;}
public string Name {get;set}
public string Area {get;set}
}
I just want to store three values in Area field. (Left, Right and L & R). By default MVC scaffolds string fields by #Html.Editfor helper method. so in this case I have to change it to #Html.DropDownListFor helper method manually.
As a lazy programmer I just want to know Is there anyway to force MVC to scaffold some string fields by #Html.DropDownListFor helper method instead of #Html.EditFor.
One method is to use UIHint and "nudge" MVC to use a view of your choosing (though now it's still an editor template, but it's your editor template).
The other option is to change the scaffolding at the root level:
* SomeSolution
* SomeMVCProject
* Properties
* [CodeTemplates]
* [AddView]
* [CSHTML]
* Create.tt
* Delete.tt
* Details.tt
* Edit.tt
* Empty.tt
* List.tt
Which is essentially copying the CodeTemplates folder over from C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\ItemTemplates\CSharp\Web\MVC 4\ and placing it in your project, remove the "Custom Tool" property from the files, then modify as you see fit. You can also add your own in there which will show up when you go to "Add View".

How can I add a description of the deprecated list?

I was able to add custom pages to the doxygen documentation even with a description (which is not realy documentated). However I have this here:
/*!
* \page fielname Here comes the title
* \brief A short introduction which explains this page.
*
* The real page content...
*/
That works fine but how I add a \brief (description) for the deprecated list? Now that looks a undocumentated page what I want to avoid.
I think what you are looking for can be achieved with the following:
/** Test class
* #deprecated Will be removed in release 2.0
*/
class Test
{
};
/** #page deprecated
* #brief Deprecated page brief
*
* Deprecated page contents.
*/

How to pass Bootstrap-Variables in Rails

I try to pass Bootstrap Variables to other files in Rails - and fail.
My application.css.scss looks like this:
/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the top of the
* compiled file, but it's generally better to create a new file per style scope.
*
*= require_self
*= require_tree .
*/
/* Import own Vars */
#import 'myvars';
/* Import Twitter Bootstrap */
#import 'bootstrap';
/* Import own layout */
#import 'custom';
When I create a $testVar: 100px; in _myvars.scss and try to use it in custom.css.scss it´s not working - the page fails to load and I get an Undefined variable: "$testVar".-Error
It works when defining the variable directly in custom.css.scss but I´d rather have a overview-file with all my variables (like I used to have when using TB as a standalone). I´m very new to Rails, so please be patient :)
Thanks in advance!
You have to remove *= require_tree . . Check this screen cast for more info.