PhpStorm: Can I sort properties/methods alphabetically? - phpstorm

Can I sort class properties and methods alphabetically.
I found that: https://plugins.jetbrains.com/plugin/9883-intellij-idea-properties-sorter
Is there any similar for PhpStorm?

First, to provide an answer to the question: Arrange your code automatically with PhpStorm (re)arranger.
To create a new rule, click the Add rule button in the upper right corner of the rules list. Configure it by type and modifier, add a name rule (like “init.*” or “*Test”) and/or set order type, if needed.
Now, in case someone is looking to sort selected text alphabetically, like I was trying to do, this might be able to help you: String Manipulation.
I wanted to select some text (like class imports in TypeScript) and order it alphabetically. I tried with the built-in code rearranger, but found it didn't work for just this simple purpose.
Source: How to sort text lines?

Related

How to make USE for class quickly in PhpStorm?

How i can quickly make
use \DateTime;
for new \DateTime();
in PhpStorm ? I saw on some videos guys do that with some hotkey or something like that.
You can find the most relevant contextual options with secondary mouse click. The one you want is Show Context Actions (you'll see your current keyboard shortcut beside, mine is Alt+Enter):
Additionally, clicking on the code and waiting for a second will often display a standalone light bulb that points to the same command:
Those are called intentions. There're two that apply here:
Replace with alias (to add use foo as bar;)
Simplify FQN (to just add use foo or remove it altogether if already in root namespace)
Your particular example is a strange use case (you only save one character worth of typing) but the feature rocks when you have nested namespaces.

how to avoid repetition of <select></select>?

Say, I have 50 input fields and in each field there is a dropdown list having options 1, 2, 3, .., 100.
Simply it can be done by inserting the long list of options in every input fields by commands.
Is there anyway by which we can write the full list only for one input field and refer it in the other input fields
If I'm understanding this question correctly this sounds like it would be a great case for using some server side logic like php or asp. A simple FOR loop would make it easy to maintain without adding the complexity / reliance on JavaScript that a client - side function brings into play.
You could use jQuery to append the options list to all dropdown lists with a certain class name in the $().ready() event handler.
JSFiddle Link

Sublime Text 2: Is there anyway to automate the process of searching for a style in a stylesheet?

I tried to find something in a previous question but honestly I don't how to word the search query in order to get what I'm asking for, so I apologize if this has been answered in the past.
Is there any way that you can double click a class and that sublime takes you to the position of the stylesheet in which you can find that class.
I'm currently switching between the stylsheet tab and the html tab and I'm using ctrl+f to find the styles I want to edit but it seems a bit inefficient.
Thanks
https://www.sublimetext.com/forum/viewtopic.php?f=5&t=4397
Something like that?
Quote from http://sublimetext.userecho.com/topic/96090-go-to-definitiondeclaration/:
Currently, you can highlight function name, wherever in source code, and press ctrl+shift+f for searching across project files. And then you get file names and contexts where the function name appears.
But this can be simplified, something like if the current search function is looking for something like: funciton_name = function or funciton function_name etc.. (for few cases how function desclaration can show up in php/js (for what I'm interested in) code.
Also, is it really that inefficient? How many times are you writing styles for any one particular class that means you can't find the one declaration you're looking for?

QTableView drag move rows

I'm using a QTableView with a QAbstractTableModel and a QSortFilterProxyModel so that I can sort the items by clicking on the table headers. I'd like to add the option for the user to sort the rows in the view manually, by dragging them. I don't need to be able to do drag and drop from/to any external application, just to change the order in the list. I also don't need to change the data in the model, I only want the order to be different in the view.
I've been looking through the documentation, and it seems like I have to implement mimeTypes, mimeData, and dropMimeData, but this gets very complicated fast! Some of the data in my model is not actually displayed in the view, and like I said I don't want to change the order of data in the model. Is there a way to simply drag items to change their sorting (just like the headers are already able to do) without a huge amount of coding?
Updated for QT5 to remove deprecated methods
If you are using PyQT All you need to do for your requirements is this:
your_tableview.verticalHeader().setSectionsMovable(True)
your_tableview.verticalHeader().setDragEnabled(True)
your_tableview.verticalHeader().setDragDropMode(QAbstractItemView.InternalMove)
Then rinse and repeat with horizontalHeader if you want those rearrange-able too.
You are absolutely right, you shouldn't need to touch or even know what the model is for this functionality. This is further demonstrated by your proper use of the QSortFilterProxyModel decorator over the model itself.
The stuff you saw about mimeTypes and all of that stuff is for drag-and-drop of actual objects of varying sources from other windows/applications/desktop/etc and isn't needed for what you are trying to accomplish currently.

Selector box question

What is the name of the html tool used for creating a list of objects from a select field. It usually looks like two boxes with an arrow in the middle. An example would be if you were creating a group and box A had a list of users and you would click on a name and then click the arrow in the middle. It would then add it to box B creating a unqiue group list. I am trying to find the name of this so I can find some examples online. Anyone know the name or where I can find some good examples?
It's called Picklist. Google gives good examples with that keyword: http://google.com/search?q=html+picklist. Good luck.
try this
Multi select transfer script
or this
Option transfer
HTML does not have this control built in. But many other environments provide it. Sometimes its called a doubleselect(struts2).