Debugging externally compiled Typescript in IntelliJ - intellij-idea

I was trying to debug typescript with IntelliJ but I cannot get it working. I use webpack to build the typescript files and maps and only the compiled js is used in the page. I also use an external webserver, so I cannot use the build in IDEA webserver.
My structure looks as follows:
root
|-- compiled
|-- compiled.js
|-- compiled.js.map
|-- src
|-- file1.ts
|-- some_subfolder
|-- file2.ts
|-- ....
I setup a debug configuration for Javascript, installed the Chrome extension and did the path mappings. If I put a breakpoint into compiled.js, the breakpoint gets hit and I can debug. Breakpoints in my ts files are ignored though. I did mark the compiled folder as excluded as per documentation (it says the IDE will then autoload map files from these folders). As far as I can see there is no option to manually set a map file for the script file in the debug configuration.
Any ideas what I might be missing?

Related

PhpStorm | Web server folder and project root aren't the same

I'm trying to make a project with a public folder inside. That folder is where the web server is pointing at, but I can't make PhpStorm to understand that and open in the built-in browser the correct URL.
I mean:
Project root
|-- app
|-- config
|-- core
`-- public (Web server root folder)
`-- index.php

How are polymerDart components deployed in Dartium versus their Source tree

When i am making PolymerElements in Dart and have folders organized to store css/html/dart files, when i run index.html in Dartium and look at the sources it seems that everything is shifted around and stored in the packages folder.
Im trying to find these custom PolymerElement dart files I have written, but to no avail. It seems when looking at index.html at runtime, it will paste the css/html as required into the custom elements i had created, but im still not sure where the dart files themselves are stored.
Right now I have a SRC structure that looks like:
.pub/
lib/
common/
...
tw_datagrid/
a.css
a.html
a.dart
packages/
web/
packages/
index.html
main.dart
and for the deployment to Index, i look at the source and see the following:
proj_name/web
packages/
it seems that packages in the web sources has a more robust set of information. My logic tends to lean towards it containing the imported libraries as well.
Still though, i cant find the new location of: a.dart within the packages/ folder
Html, CSS and JS is inlined into index.html. For CSS files this can be disabled.
Source files from the library directory can be found in Dartium (in the Sources tab in the dev-tools) under the (no domain) node under package:proj_name/tw_datagrid/a.dart

Package PyGObject Python 3 program with pynsist?

I would like to package a Python3-PyGObject program with pynsist. The repository has an example for PyGTK and it made me think that it shouldn't be too hard to change the example.
The example can be found here:
https://github.com/takluyver/pynsist/tree/master/examples/pygtk
In this file (https://github.com/takluyver/pynsist/blob/master/examples/pygtk/grab_files.sh) I think one just has to grab the files targeting GTK 3 (http://www.gtk.org/download/win32.php):
wget -O gtkbundle.zip http://win32builder.gnome.org/gtk+-bundle_3.6.4-20130921_win32.zip
wget -O pygobject.exe http://sourceforge.net/projects/pygobjectwin32/files/pygi-aio-3.14.0_rev12-setup.exe/download
wget -O pycairo.zip http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/cairo_1.10.2-2_win32.zip
I am not sure what to do with the fourth line, because it is my current understanding that those bindings should already be inside the gtk or pygobject bundle:
wget -O pygtk.exe http://ftp.gnome.org/pub/GNOME/binaries/win32/pygtk/2.24/pygtk-2.24.0.win32-py2.7.exe
I then tried to customize this file (https://github.com/takluyver/pynsist/blob/master/examples/pygtk/installer.cfg) to include (use gi instead of gi.repository):
[Include]
packages=gi
This resulting error is:
raise ExtensionModuleMismatch(extensionmod_errmsg % ('Windows', path))
nsist.copymodules.ExtensionModuleMismatch: Found an extension module that will not be usable on Windows:
/usr/lib/python3/dist-packages/gi/_gi.cpython-34m-x86_64-linux-gnu.so
Put Windows packages in pynsist_pkgs/ to avoid this.
Does anyone know what the correct approach for a program (like e.g. one of these: https://python-gtk-3-tutorial.readthedocs.org) would be?
Edit 1
After packaging and installing the program on Windows, starting the test-program produces the following traceback:
Traceback (most recent call last):
File "C:\Program Files (x86)\hellogtk\hellogtk.launch.pyw", line 31, in <module>
from gtk_test import main
File "C:\Program Files (x86)\hellogtk\pkgs\gtk_test.py", line 3, in <module>
from gi.repository import Gtk
File "C:\Program Files (x86)\hellogtk\pkgs\gi\__init__.py", line 42, in <module>
from . import _gi
ImportError: DLL load failed: The specified module could not be found.
It is odd that this ImportError occurs because there is a _gi.pyd-file in the same directory (gi) as the __init__.py
This is the current layout:
- directory
|- pynsist_pkgs
|-- cairo
|--- _cairo.pyd
|--- __init__.py
|-- gi
|--- _gobject
|--- overrides
|--- repository
|--- __init__.py
|--- _gi.pyd
|--- ...
|-- gtk
|--- bin
|--- etc
|--- lib
|--- manifest
|--- share
|-- dbus
|--- __init__.py
|--- ...
|-- gnome
|--- ...
|-- pygtkcompat
|--- ...
|-- _dbus_bindings.pyd
|-- _dbus_glib_bindings.pyd
|-- ...
|- gtk_test.py
|- grab_files.sh
|- installer.cfg
|- gtk_preamble.py
And I used the py-3.4-64 folder of the pygobject bindings. The Linux I am creating the package on is 64 bit, and the Windows I am running the program is also 64 bit.
Edit 2:
Using Dependency-Walker I can see that 2 DLLs are missing: GPSVC.DLL and IESHIMS.DLL.
Edit 3:
I found those 2 DLLs on the system and copied them in different directories of the test-program, but it didn't work.
Edit 4:
This might be useful for the import-error:
import gtk/glib produces ImportError: DLL load failed
I worked together with Thomas K, the author of pynsist, to solve this. And I do want to advertise that it is a great tool, with very good support, and it makes packaging orders of magnitudes easier in my opinion.
There were a number of mistakes in my approach (see question), so it might be easier to just describe the correct approach:
Download dependencies
The only dependency needed for a program that only imports:
from gi.repository import Gtk
is the most recent pygi-aio (currently pygi-aio-3.14) bundle that can be downloaded here (The example in the pynsist-repository has a download script, but i might need to be updated for newer releases):
https://sourceforge.net/projects/pygobjectwin32/files/
Extract dependencies
The PyGObject/PyGI example that has now been merged into the pynsist-repository, comes with a script that extracts the necessary dependencies from the bundle (See: https://github.com/takluyver/pynsist/tree/master/examples/pygi_mpl_numpy).
Most importantly it extracts the contents of the bindings zip file (Modify the script for the targeted Python version and bitness) and copies them into the pynsist_pkgs folder:
- cairo
- dbus
- gi
- gnome
- pygtkcompat
Then it extracts and copies the subdependencies into the pynsist_pkgs/gnome/ folder. As lazka pointed out, the minimum requirements for a typical minimal Gtk-program are (each library has a pygi/noarch and pygi/[TargetedArchitecture] zip file):
- ATK
- Base
- Gdk
- GDKPixbuf
- GTK
- JPEG
- Pango
- WebP
- TIFF
Build the installer
The installer was then build in my case using:
python3 -m nsist installer.cfg
The installer.cfg is also in the repositories example folder. It only requires gnome to be listed (The subdependecies in the gnome folder behave as one unit).
Note about the pygi-aio bundle
When the pygi-aio is installed on a Windows-machine, the installer performs some post-installation compiling steps. This might become an issue if you are using this approach, because it only extracts the dependencies. In some cases you might need to run an exe file (comes with the bundle) and copy the compiled files back into your build directory. I describe the only problem I had here:
https://github.com/tobias47n9e/innsbruck-stereographic/issues/1
And there is a bug report with more information here:
https://sourceforge.net/p/pygobjectwin32/tickets/12/
Working example
You can get the example here:
https://github.com/takluyver/pynsist/tree/master/examples/pygi_mpl_numpy

Deploying a Yii 2 app to a subdirectory of the document root

I want to deploy a Yii 2 app to a website's subdirectory:
http://example.com/subdirectory
My app's directory structure looks like this:
|-- LICENSE.md
|-- README.md
|-- assets
|-- commands
|-- components
|-- composer.json
|-- composer.lock
|-- config
|-- controllers
|-- mail
|-- models
|-- requirements.php
|-- runtime
|-- test.php
|-- test.txt
|-- tests
|-- vendor
|-- views
|-- web
|-- yii
`-- yii.bat
According to Yii 2's documentation, for deployment you're supposed to rename the web folder to the document root of your server, like public_html, wwww, etc. Then you copy all the files to the parent directory of the document root. But nothing is said about how to deploy the app to a subdirectory of the document root.
The host is Apache, and I'm wondering if using an alias is the easiest way. I'm not sure from the documentation on mod_alias which directive to use or where it should go, though.
What do you recommend?
It turned out to be simpler than I expected.
Move the web directory into your document root (e.g., public_html, www, etc.).
Rename the web directory how you want to appear after the domain name. For instance, if you want your app to live at http://example.com/myapp, then rename web to myapp.
Move your app's directory (which now should be minus the web subdirectory) one directory above your document root.
In the web directory, change the paths of the three require functions in index.php.
My modified index.php looks similar to the below. (If you copy and paste, remember to replace your_app_name with the name of your app's directory. Also note that I have multiple websites in my document root, so I have to get the parent of the parent of the parent of the web folder to make it out of the document root. Whew.)
<?php
// comment out the following two lines when deployed to production
defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'dev');
require(__DIR__ . '/../../../your_app_name/vendor/autoload.php');
require(__DIR__ . '/../../../your_app_name/vendor/yiisoft/yii2/Yii.php');
$config = require(__DIR__ . '/../../../your_app_name/config/web.php');
(new yii\web\Application($config))->run();

How to make a custom ear file in maven

Here is my challenge, I need to make an ear file for a specific container. To be more specific on how this ear will be created:
This is a standard j2ee ear file, with 1 WAR in it.
The container it is deployed to will expect certain xml files (which can easily be found (somewhere) inside the source project).
Here are my obstacles
The source folder contains various container specific xml files. But, these files do not map directly to where the container expects them inside the EAR file. For example, there will be a file that this container expects to be in 'EARFILE.ear/config/connections.xml'. But this file is located (in the source) at /some/obscure/unrelated/directory. This is the case for about 5-7 files.
I cannot change the original source project layout at all.
So, how can I create the compliant EAR file that I need. There is NO plugin at this time for the container that I am using, I have certainly looked.
Update:
The original layout is for JDeveloper:
.adf
/META-INF/
(some xml files to map to various locations in the EAR)
Model
ViewController
public_html
src/
META-INF/
(some xml files to map to various locations in the EAR)
This is a standard j2ee ear file, with 1 WAR in it. The container it is deployed to will expect certain xml files (which can easily be found (somewhere) inside the source project).
As I told you in this previous answer, the typical layout for a maven project with a war and an ear module would look like this:
.
|-- ear
| |-- src
| | `-- main
| | `-- application
| | |-- META-INF
| | | `-- application.xml
| | `-- config
| | `-- connections.xml
| `-- pom.xml
|-- web
| +-- src
| `-- pom.xml
`-- pom.xml
Where the files under the ${basedir}/src/main/application directory will be included in the EAR (this is the default value of the earSourceDirectory parameter).
The source folder contains various container specific xml files. But, these files do not map directly to where the container expects them inside the EAR file. (...)
I'm sorry but... what source folder? It would be maybe possible to use the Maven AntRun plugin to copy some files to the ear project from another location but 1. that would be very messy and 2. without more details, it is impossible to provide more guidance.
I cannot change the original source project layout at all.
Which looks like? You really need to give more details (and if you can't change anything, mavenizing this project may not be easy at all, especially if you're new to maven).