w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How to refactor in Sublime Text? (Ruby, Rails, JavaScript)
I wrote this plugin for JavaScript refactoring https://github.com/s-a/sublime-text-refactor I guess there are a lot more out there supporting RoR.

Categories : Javascript

Adding syntax highlighting to Sublime Text for JavaScript
The default syntax highlighting for javascript in Sublime is not great. I use JavascriptNext: https://github.com/Benvie/JavaScriptNext.tmLanguage It improves on the default syntax hightlighting and also adds support for future ES6 syntax. In your particular case it is more consistent on the coloring of the if values, though less consistent on the property values for the : syntax. But I think thats ok since its not actually valid syntax anyhow.

Categories : Javascript

Custom JavaScript snippets for emmet (in Sublime Text 2)
You should use js as syntax name since Sublime Text defines JavaScript scope as source.js. In future, you should use source.(SYNTAX_NAME) part for syntax name. And you shouldn’t use abbreviations section for snippets since abbreviations defines element blocks and should be written as HTML element. Use snippets section. Note that in JS files in ST editor you have to use Ctrl+E to expand abbreviations since Tab key is disabled for this syntax. And, as Protractor Ninja noted, it’s not a good idea to use Emmet snippets in editors that supports native ones.

Categories : Javascript

Start Sublime 3 from terminal, when default is Sublime Text 2
When you run sublime, your computer should run a bash file at /usr/bin/sublime (running which sublime as Mike Li suggested will confirm the location. Open that up and edit it for Sublime Text 3. The contents of that file should be: #!/bin/bash /usr/lib/sublime-text-2/sublime_text --class=sublime-text-2 "$@" Edit it as so: (On my computer the executable is called subime_text_3 instead of subime_text. Verifiy by opening /usr/lib/sublime-text-3.) #!/bin/bash /usr/lib/sublime-text-3/sublime_text_3 --class=sublime-text-3 "$@" Point it to the location of Sublime Text 3 on your system. Edit Build 2221 (using the ppa) changed the installation directory from /usr/lib/sublime-text-2 to /opt/sublime_text_2

Categories : Linux

Sublime Text 2 Python.sublime-package
Remove existing /User/Python.sublime-package and try manually unzip Python.sublime-package (change it's extension to .zip) to Package folder /Packages/Python. Package folder can be revealed via Preferences->Browse Packages... command.

Categories : Python

how to install sublime text indent xml in sublime 3
The location is system dependent, but are located at: OS X: ~/Library/Application Support/Sublime Text 3/Packages/ Windows: %APPDATA%/Sublime Text 3/Packages/ Linux: ~/.config/sublime-text-3/Packages/

Categories : Xml

Why Date adds 1 month automatically?
Calendar class months starts from 0, not from 1, so when setting month as 10 you're not setting October but November. Change your code to cal.set(2012, 9, 22); Or even better cal.set(2012, Calendar.OCTOBER, 22); More info: java.util.Calendar

Categories : Java

Joomla Component adds underscore automatically
This is very strange. However let's look at it the other way around. If your component outputs the code correctly, there can be only one piece of code that can change it, and that's a plugin (either a content plugin or a system plugin). Try disabling all 3rd party content or system plugins until you find the one responsible for this behaviour.

Categories : PHP

Make a windows explorer like html5 menu that automatically adds new files/maps
Have a look at these options for jQuery. Some of them do exactly what you want... http://www.jquery4u.com/plugins/10-jquery-file-manager-plugins/

Categories : Javascript

Automatically combine values of two text boxes in Javascript to display in a third
Use the following code: IN PHP CODE: while($c=mysql_fetch_array($b)) { echo "<td>".$CLOSINGstk."</td><input type='hidden' name='CLOSINGstk".$a."' value='".$CLOSINGstk."' id='CLS".$a."'>"; echo "<td><input type='text' name='rate".$a."' id='rate".$a."' onblur='multiply(".$a.");'></td>"; echo "<td><input type='button' name='valuation".$a."' id='valuation".$a."'></td>"; } This will work.

Categories : PHP

Modify preseed file to automatically install packages in /pool/extra
Why don't you create a metapackage which depends on all the packages you want installed, and simply set up the preseed to install that. equivs was designed for this sort of thing, although it's not very hard to create a metapackage from scratch with the standard packaging tools, either. To instruct the installer to install packages, you can include the line d-i pkgsel/include string package1 package2 in your preseed file. If you just want to install all the *.deb files from a directory (not a full Apt repository with Packages.gz etc) then maybe d-i preseed/late_command string in-target dpkg -i /pool/extras/*.deb but I would actually prefer a full repo; basically it just takes a run of dpgk-scanpackages.

Categories : Ubuntu

Post-Build command exited with code 1 (trying to automatically generate NuGet packages)
I finally ended up solving the problem: I had to copy an instance of Nuget to the folder where my solution lies. Even if Nuget was in the path. I still don't know why VS was not able to find nuget if started from a post-build event (I'm not using nuget anymore, it doesn't fit my needs as I was expecting something similar to maven).

Categories : Visual Studio 2010

Jslint and sublime text
I found solution in this link: http://nicksantan.com/blog/2012/12/adding-auto-format-code-indenting-to-sublime-text-2/ Hopt it work.

Categories : Javascript

Using Sublime Text 2 for C++ and OpenGL
I c++, if you want to use a (static in this example) library, you have to link against it. In normal english, you have to tell your compiler where it can find the implementations of the library's functions. I don't know how to do that in your editor, but usually there is something called linker settings, where you can link all the libraries you need for your project. For more info see this wiki page

Categories : C++

Sublime Text 2 C Compiling
What Operating System do you use? Linux? Using Linux is more practical, because you compile in the terminal. Installing the Compiler 1 - Make sure that you have the compiler installed. If you dont have, open the terminal (Ctrl + Alt + t) and type this and press Enter: sudo apt-get install g++ gcc build-essential Compiling a file Open the terminal and go to the local that you had saved the files. Type in the terminal: gcc filename.c -o filename Then, type: ./filename The program you run in the terminal normally. PS: gcc is for programs in .c g++ for programs in .cpp -o = to create an "executable" file ./ = to run the program

Categories : C

Vintage Sublime Text go to tab N
Not that it matters, but those are ST1 docs. The command is probably focus_view (though I haven't checked it). If you are using ST3, I'd recommend trying Vintageous. It appears to be much more complete than the built in vintage mode. For example, 3gt does move you to the third tab with this plugin.

Categories : Vim

Sublime text 2 snippets
Sorry snippets are primarily meant for reusability; you can do precisely as you say above but cannot insert specific things - you would have to write your own plugin in order to add this functionality as it would require things like a specific way of selecting things to modify and replace which would be specific to it.

Categories : Python

Using Sublime Text 3 as a Python IDE with 3.3.2?
Set your "cmd" to the following: "cmd": ["/Library/Framework/Python.framework/Versions/3.3/bin/python3", "-u", "$file"], and it should work. Probably the reason your path addition didn't work was because it was missing the beginning /.

Categories : Python

Change behavior of Alt key in Sublime Text 2
There is a Sublime Text 2 plugin called Sublemacs Pro that provides emacs-like keybindings and operations, including those that you mentioned pining for. You can find installation instructions and the complete keybinding reference on the Github page.

Categories : Osx

uninstall sublime text 3 on ubuntu 12.04
Option 1 If you installed sublime-text-3 with apt-get, based on this article: http://www.webupd8.org/2013/07/sublime-text-3-ubuntu-ppa-now-available.html With these lines: sudo add-apt-repository ppa:webupd8team/sublime-text-3 sudo apt-get update sudo apt-get install sublime-text-installer You could remove your installation: sudo apt-get remove sublime-text-installer Option 2 If you installed Sublime Text 3 from a .deb package which was downloaded directly from Sublime Text page: http://www.sublimetext.com/3 And you have used this command for installation sudo dpkg -i sublime-text_build-3047_amd64.deb Or you just double clicked on it and Ubuntu Software Center installed it... So, in this case: sudo dpkg -r sublime-text But you have to reinstall Sublime Text 2 in each case

Categories : Ubuntu

Python settings in Sublime Text 2
First make sure that you saved the file with .py extension and then try to run again. You also need to check that the Python in your .sublime-build is correct. For this look at %APPDATA%Sublime Text 2PythonPython.sublime-build file. This file should have something like this: { "cmd": ["C:\python27\python.exe", "-u", "$file"], "file_regex": "^[ ]*File "(...*?)", line ([0-9]*)", "selector": "source.python" } This is equivalent to doing the following on the command line, check that you can do: python -u C:your_pathyour_script.py If this doesn't work from the command line it also wont from sublime.

Categories : Python

The REPL of sublime text 2 can't using the command of git?
SublimeREPL is for programming language interpreters like Clojure or Python, not shell programs like git. What you need is sublime-text-2-git, available from the Package Control menu as "Git". SideBarGit may also be useful.

Categories : GIT

sublime text 2 portable update not sure how?
Assume that your old version is installed in Sublime.old, and the new version in Sublime.new. Make sure Sublime Text 2 is closed, then move the Sublime.newData folder to someplace else (like your Desktop, for now), just in case anything breaks. Then, copy (don't move) the Sublime.oldData folder to Sublime.new. Fire up the program and check to see that everything is there, and works properly. Please note that this method will not work when upgrading from ST2 to ST3, as there are major differences in the way plugins are run.

Categories : Windows

Make Envs Available To Sublime Text
Just a guess, but if you are using the build system, perhaps adding the "shell": true option? If it's a plugin you are working through, perhaps create an issue for the plugin (I'm guessing it's on github)

Categories : Ruby On Rails

RubyTest has no output in Sublime Text 2
Personally, I'd recommend installing ZenTest and using its autotest functionality to continually run your tests in a terminal window. It watches for changes in the tests and reruns them automatically. It's very handy as you write your code and tests.

Categories : Ruby On Rails

Sublime Text 3 C++ Build System for OS X
According to this thread, ST simply doesn't allow for interactive builds. Edit: Check out this thread here for a workaround.

Categories : C++

How to run Ruby file on Sublime Text
It is possible to run your programs when you need to have user input from the keyboard, but it isn't very nice. When I do so, I need to input from a terminal that opens when I run Sublime, while also reading the response from the program at the bottom of the editor. It is simply easier to run the program from the console/terminal. So, the answer is, while it is possible to do so, there are concerns. You may need to use STDOUT.sync = true or STDOUT.flush to help manage the buffer with the OS, you have two thing to look at, while doing so... yuck. It may not be the answer you are looking for, but as a developer, you should be comfortable running things from the console/terminal.

Categories : Ruby

In Sublime text 2 php autocomplete is not working
In your sublime User/Preferences.sublime-settings file add: { "auto_complete_selector": "source, text", } This will enable auto-complete even when there is no closing PHP tag.

Categories : PHP

Sublime Text 2 python SublimeREPL
CtrlShiftP is the keyboard shortcut for the Command Palette, which is what you want. You can also open it via Tools -> Command Palette.... CtrlP is Goto Anything, and has nothing to do with Package Control or installing things. Don't use it. Open the Command Palette by whichever way suits you best, menu or keyboard shortcut. Once there, type PCI and Package Control: Install will be highlighted. Hit Enter, and a dropdown of the full list of available packages should appear. Now, type "sublimerepl" and it should show up. Click on it or hit Enter and you should see a message at the bottom of the window that SublimeREPL is installing. Once it's done, restart ST2 (for good luck) and it should be available in the Tools menu down at the bottom. Please read the full documentation to familiari

Categories : Python

Sublime Text 2. Autocomplete python `from`
Have you checked out SublimeCodeIntel? It's available through Package Control, and has this functionality. The initial indexing of your packages may take some time, but once it's all set (you may need to restart Sublime once or twice to get everything loaded) it works like a charm.

Categories : Python

Sublime Text 3 Java autocomplete
Sublime 3 does have basic autocompletion for Java baked-in - if you start typing "pub", for example, it'll suggest "public". I'd also suggest looking at the Javatar plugin, which adds things like automatic creation of classes, packages, and interfaces. The QuickJava plugin might also be worth a look - it adds automatic creation commands for setters, getters, and constructors.

Categories : Java

Sublime Text indentation issue
For ST2 : Open the html package and edit the Packages/HTML/Miscellaneous.tmPreferences file. Replace the text with the one below. The below regex accepts basic jsp tags in <c:if> format & JSP comments. This will not format scriplets. <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>name</key> <string>Miscellaneous</string> <key>scope</key> <string>text.html</string> <key>settings</key> <dict> <key>decreaseIndentPattern</key> <string>(?x) ^s* (&lt;/(?!html) ([A-Za-z0-9]

Categories : Jsp

sublime text remove repository
Click on Sublime Text 2 on the menu bar, then Preferences -> Browse Packages to open up a Finder window pointing to ~/Library/Application Support/Sublime Text 2/Packages. Open the User folder and open Package Control.sublime-settings in Sublime Text. You should see a list of installed packages, and a key (possible down at the bottom) called "repositories". The file should look something like this: { "auto_upgrade_last_run": null, "installed_packages": [ "PackageName", "AnotherPackageName", "AwesomeSublimePlugin", "Neon Color Scheme" ], "repositories": [ "https://github.com/SoMeUsEr/BadURL" ] } and to delete the repository you should make it look like this: { "auto_upgrade_last_run": null, "installed_packages

Categories : Python

How to update Sublime Text 2 on Ubuntu 12.04?
There is a PPA for Sublime Text 2: https://launchpad.net/~webupd8team/+archive/sublime-text-2 But remember, that you will be integrating a new third-party-repository into your system.

Categories : Ubuntu

Unable to run tests from sublime text 3
From looking at this issue, it's probably related to your bundler generated binstubs. Looking at the RVM docs, you might want to try running: gem regenerate_binstubs or: bundle install --binstubs If you still have issues after that, I'd try totally removing the binstubs. Instructions for doing that can be found here.

Categories : Ruby

Why is it not OK to call Matplotlib from Sublime Text 2?
You need to install matplotlib before you can import anything from pylab. Try installing the package from the downloads page. (exactly as @nordev says)

Categories : Python

Can i add css property shortcuts to sublime text?
These are called snippets. For this particular example, Open the Tools menu and select New Snippet..., then paste in the following: <snippet> <content><![CDATA[margin: 0 auto;]]></content> <tabTrigger>m-a</tabTrigger> <scope>source.css</scope> </snippet> Save this file as Packages/User/CSS/margin auto.sublime-snippet and you should be good to go. Open a CSS file, type m-a, hit Tab, and you're all set. Snippets are pretty powerful, and also allow for tab stops to enter customized data. For example, you could set up some boilerplate code that only requires that the colors be customized like so: <snippet> <content><![CDATA[body { max-width: 500px; _width: 500px; padding: 30px 20px 50px; bo

Categories : HTML

Sublime Text 3 - Clean Paste
Not too much work to make this python 3 compatible: # coding=utf8 import sublime_plugin, sublime, re, html def clipboard(): return sublime.get_clipboard() def copy(data): sublime.set_clipboard(data) # to transfer data to sublime text def clean_paste(data): # clean word data = str(data) data = data.replace(u'”', '"').replace(u'“', '"').replace(u'’', "'") data = data.replace('________________________________________', ' ') # clean htmlentities data = re.sub('&([^;]+);', lambda m: unichr(html.entities.name2codepoint[m.group(1)]), data) return data; # to transfer data from sublime text def clean_copy(data): # clean html data = str(data) data = re.sub(r'<br ?/?>', ' ', data, re.I); data = re.sub(r'<[^>]*>', '', da

Categories : Python

Make Sublime Text treat