Setting up Sublime Text 3 w/ a local server for testing - eclipse

I am taking a course on web development and I haven't been getting any help on how to set up Sublime Text 3 with a local server. I am being taught by some foreigners who can hardly speak English, so when I ask them, they don't really know how to explain it to me. Videos online haven't helped.
They want me to use Eclipse with Apache Tomcat, which I have set up, but I would like to use Sublime Text 3 instead of Eclipse, because I like it much better. I read something about MAMP, but again, I would need help setting it up. If anyone could point me in the right direction or give me a breakdown of what I need to do. My current assignments are with using AJAX & JSON... and then AngularJS. So I need to basically be able to retrieve items from a JSON file and insert them in my HTML, from a local server. I hope I made sense here.
Thanks!

Use livereload, it helps auto refreshing the site, it also compiles files like less, css, html, javascript and more. make sure all your files are in one big folder with sub folders for images etc.

Do you know how to use Terminal? The simplest way to set up a local server is to navigate to your project folder inside the Terminal and then type Python -m SimpleHTTPServer. Then, you will have a server running and you can go to your browser and go to localhost:8000 as your address.

Related

TYPO3 - Error 500 in right panel of Filelist

Friend gave me access to TYPO3 CMS of his page to make some changes and I can not open Filelist.
The left panel with directories is displaying but on the right, a have error 500 message in IE or in Chrome just empty frame.
I did some modifications to that page some time ago and everything was working fine then.
Can anyone help me with that ?
If a folder contains to much files you might get problems opening it in the file list module, as the gathering of all information and maybe creating of preview thumbnails may take longer than is granted to any php process.
If it's only the preview images you might be able to load the folder after some attempts, as sometime all preview images are generated, but as it also can be other delays because of too much files you need to enhace the runtimelimit
or/and you might need to restructure the files and folders.
Be aware that a moving of files with FTP/SSH might break content in the FE as you might invalidate some FAL (sys_file) records so that used files are not found any more. Better: enhance the timeout (temporarily) and move the files in the backend.
in general: if you only got a blank page you disabled all error-messages (which is ok for FE, but will leave you without hint about errors).
As a first start you could take a look in the webserver-error-log.
If you got no clues: enable errormessages in TYPO3 Install Tool (enable debug mode in "Configuration presets")
Ok.
I solved that.
I disabled that extension and then when I looked at maintenance tab on this extension i saw something like "delete LOCAL installation of this ext".
After deleting local installation and enabling system FileList instance, everything is working just fine :)
Thank You for help.

Get the real-time web design preview from the browser

Assume that I have two monitors assigned to my pc. Now I want to get the preview of a web site while coding it. Is there anyway to do this?
eg:- Do the coding from sublime text from a one monitor and the meantime watch the output from the Firefox web browser.
I have used live.js for this more than once. It can work either as a bookmarklet or embedded on your page, and it works in any browser as it's not an extension. Also requires no other software to work.
The downside is it that it will flood your developer tools with HEAD requests every second or so to determine when to reload things. That's the cost of not having to install external software.
You can use the LiveReload plugin for SublimeText. It listens for changes to your code files and updates them in the browser in real time.
Also, do not forget to add the respective browser extension. That should save you from adding any scripts into your page.
You could use yeoman ( with Grunt or Gulp depends on which generator you want to use ).

Packaging a GWT app to run completely offline NOT installed via a "marketplace"

Theres a few questions similar to this, so I'll try to be clear as possible.
We have an existing, fairly large and complex, GWT webgame I have been asked to make work offline. It has to be offline in pretty much the strictest sense.
Imagine we have been told to make it work off a CD Rom.
So installation is allowed, but we cant expect the users to go to a Chrome/Firefox store and install it from there. It would need to be off the disc.
Likewise, altering of the browsers start-up flags would be unreasonable to expect of users.
Ideally, it would be nice if they just clicked a HTML file for the start page and it opened in their browsers of choice.
We successfully got it working this way in Firefox by adding;
"<add-linker name='xsiframe' />"
To our gwt.xml settings. This seems to solve any security issues FF has with local file access.
However, this does not solve the problem for Chrome.
The main game starts up, but various file requests are blocked due to security issues like these;
XMLHttpRequest cannot load file:///E:/Game%20projects/[Thorn]%20Game/ThornGame/text/messages_en.properties. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.MyApplication-0.js:34053 com_google_gwt_http_client_RequestBuilder_$doSend__Lcom_google_gwt_http_client_RequestBuilder_2Ljava_lang_String_2Lcom_google_gwt_http_client_RequestCallback_2Lcom_google_gwt_http_client_Request_2 MyApplication-0.js:34053
Now I was aware same origin policy issues might popup as during development we often tested locally using flags in chrome to bi-pass them.
Thing is...now I dont know how to get around them when we cant use startup flags.
Obviously in the example given its just the .properties file GWT uses to get some language related text. I could dump that inline in one way or another.
However, its only one of many,many,many files being blocked.
The whole game was made to run off *.txt game scripts on the sever - to allow easy updating by non-coders. Really the actual GWT code is just an "engine" and all the XMLHttpRequested files supply the actual "game".
These files are of various types; csv, txt, ntlist, jam.
The last two being custom extensions for what are really just txt files.
All these files are blocked by chromes security. It seems from what I can make out only images are allowed to be accessed locally.
Having all these files compiled in would just be impossible, as they are not fixed in number (ie, one central .txt file determains various scene .txt files which in turn determain various object files and directory's...).
Putting all this into a bundle would be nightmare to create and maintain.
So in essence I need some way to supply a offline version of a GWT project that can access a large number of various files in its subdirectories without security issues.
So far all I can think of is;
A) Theres something I can tell chrome via html or gwt that allows these files to be read in Chrome like FF can. (I suspect this isn't possible).
An alternative to XMLHttpRequest maybe?
B) I need to somehow package a game+a webbrowser in a executable package that has permission to access files in its directory's. (http://www.appcelerator.com/titanium ? ?? ).
C) I need to package and have the user run a full webserver that can then deliver all these files in a XMLHttp accessible way.
D) Bit of a funny one...we cant tell the user to add flags to browser start up...but Maybe I could write a game installer which just detects if they have Chrome or Firefox. It then opens up the games html in their browser with the correct flags for them? This would open up security issues if they browse elsewhere with that instance though, so Id presumably need other flags to disable the url bar if that's possible.
I am happy to make various changes to our code to achieve any of this - but as mentioned above theres no way to determain all the files needing to be accessed at compile time.
And finally, of course, it all has to be as easy as possible for the end user.
Ideally just clicking a html file, or installing something no more complex then a standard windows program.
Thanks for reading this rather long explanation, any pointers and ideas would be very welcome. I especially will appreciate multiple different options or feedback from anyone that's done this.
========================================
I accepted the suggestion to use Chromiumembedded below.
This works and does what I need (and much much more)
To help others that might want to use it, I specifically made two critical changes to the example project;
Because CEF needs a absolute path to the web apps local html, I wrote a c++ function to get the directory the .exe was launched from. This was a platform specific implementation, so if supporting a few OS's (which CEF does) be sure to write dedicated code for each.
Because my webapp will make use of local files, I enabled the Chrome flag for this by changing the browser settings;
browser_settings.file_access_from_file_urls = STATE_ENABLED;
These two changes were enough to get my app working, but it is obviously the bare minimum to make a application. Hopefully my finding will help others.
I'd suggest going the wrapper route. That is, provide a minimal browser implementation that opens your files directly. Options are Chromium Embedded[1]. If the nature of the application absolutely requires the files to be served as non-file urls then bundle a minimal webserver, have the on-disk executable start the server and open the bundled browser with whatever startup arguments you want.
[1] https://bitbucket.org/chromiumembedded/cef

Thunderbird removes any attempt to make an extension

I might be a complete idiot, so please bear with me if I am.
I've been attempting to create an extension for Thunderbird.
I quickly googled for an official documentation and followed it as closely as I could. This way, I ended up with a simple result to test, which would, according to the documentation, work.
So I opened up Thunderbird, nothing.
I closed it again and went to see what I did wrong. However, Thunderbird had completely removed the folder I had.
I did this a few times more with the same result.
This is what my folder setup looked like:
%APPDATA%/Thunderbird/Profiles/[profile name]/extensions/
foobar#foo.bar/
install.rdf
chrome.manifest
chrome/
content/
foobar.xul
foobar.js
locale/
defaults/
preferences/
The contents of these files were, at my last attempt, literally copy/pasted from the documentation, only with altered filenames(both in code and in actual files), extension ID(both in code and the folder name), and maximum version tag.
What exactly am I missing here?
I absolutely agree with using proxy files for addon development. But if you followed the guide mentioned by Jonathan Protzenko, your structure would look more like this:
%APPDATA%\Thunderbird\profiles\[profile name]\extensions\
foobar#foo.bar
SomeDrive:\path\to\some\place\
foobar_dev_directory\
install.rdf
...
chrome\
i.e, the development directory is not located inside your profile. Instead, consider the proxy file
%APPDATA%\Thunderbird\profiles\[profile name]\extensions\foobar#foo.bar
SomeDrive:\path\to\some\place\foobar_dev_directory\
You must only enter the second line, and never forget the trailing \ as mentioned here (3, Note).
Also you should uninstall the addon (if you had one with the same id created and installed before). When you start tb the first time thereafter, you will be asked to allow exernal addons to be installed or something similar.
I got things working this way, hope this helps.
A second guess might be the following: you're obviously working on windows. Are you viewing files always with extension in windows explorer? If not or not sure, check the following:
In Windows Explorer under Organize \ Folder Options \ View deactivate Hide extensions for known file types.
Further, try using a proxy file named differently, especially without the top-level domain. I suspect this could be misinterpreted by windows as an extension. You should call your proxy file thus foobar#foobar.

Auto-upload on save

I'm delveloping a PHP web application on my local PC. Whenever I save a file it would be handy if Eclipse could upload the file to my web server via FTP. Is Eclipse able to do that?? I think Netbeans offers such an option. At the moment I do the upload manually which is very annoying...
Take a look at Eclipse Target Management (RSE). You can find a tutorial on getting started page.
A big downside is that the quality of RSE's error messages range from okay-if-ambiguous to downright horrible (IBM-style 3 chars + 4 digits with no text message) so it's best if you know whatever protocol you're using well enough to guess what the error is without really needing the message to explain it to you.
So, after a whole lot of tries, I finally found something that works!
What you need to install is Eclipse WebDAV and FTP Support. I have not found the eclipse update site, but this site has n archived version of it. This allows you to sychronize your code with an FTP site.
http://eclipse.jcraft.com/
Then, to Automatically Upload On Save, you can use my Auto Hot Keys Script at:
Eclipse Synchronize Hotkeys