How to install Sublime Text plugin for Laravel 4 Artisan? - laravel

And so, I'm using sublime text 3 and I don't know on how to install the plugin Sublime Text plugin for Laravel 4 Artisan. It says in Installation tab that Use Package Controller or create a the directory Laravel 4 Artisan in your Sublime Text Packages directory with source code, and you're ready to go. So what to do now? I don't get it. Please help.

First If you don't have Package Control Install it ctrl+` and paste this:
For SUBLIME 3
import urllib.request,os,hashlib; h = 'eb2297e1a458f27d836c04bb0cbaf282' + 'd0e7a3098092775ccb37ca9d6b2e4b7d'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)
After that you can use Package control with:
⇧ + ⌘ + P and write install and select Package control.
It opens other field to write, in this write Laravel and choose Laravel 4 Artisan and wait to finish the installation.
So when you finish the process you can use that plugin to create controllers and models.

Related

AttributeError: 'Ghostscript' object has no attribute '_instance'

In my university semester project we are attempting to use ghostscript on some PDF files, however when we try to run our code, we get the error:
AttributeError: 'Ghostscript' object has no attribute '_instance'
We have tried various attempts to fix this, however have not found a solution yet. The only part in which we are using ghostscript is the following code:
ar = ["-sDEVICE=pdfwrite", "-dPDFSETTINGS=/prepress", "-dQUIET", "-dBATCH", "-dNOPAUSE", "-dPDFSETTINGS=/printer", "-sOutputFile=" + os.path.join(filepath, file), os.path.join(filepath, file)]
gs = ghostscript.Ghostscript(*ar)
del gs
We are using Python-3.8 and PyPi Ghostscript 0.7.
Has anyone else encountered this error or does anyone know how to fix it?
Apparently the order in which you pass the arguments is important. So instead of having:
ar = ["-sDEVICE=pdfwrite", "-dPDFSETTINGS=/prepress", "-dQUIET", "-dBATCH", "-dNOPAUSE", "-dPDFSETTINGS=/printer", "-sOutputFile=" + os.path.join(filepath, file), os.path.join(filepath, file)]
We now have:
ar = ["-dQUIET", "-dBATCH", "-dNOPAUSE", "-sDEVICE=pdfwrite", "-dPDFSETTINGS=/prepress", "-dPDFSETTINGS=/printer", "-sOutputFile=" + os.path.join(filepath, file), os.path.join(filepath, file)]
This solved the issue for us.

Getting error when trying to install R Package "Tidytext"

Error: package or namespace load failed for ‘tidytext’ in library.dynam(lib, package, package.lib): shared object ‘stringi.so’ not found
6.
stop(msg, call. = FALSE, domain = NA)
5.
value[3L]
4.
tryCatchOne(expr, names, parentenv, handlers[[1L]])
3.
tryCatchList(expr, classes, parentenv, handlers)
2.
tryCatch({ attr(package, "LibPath") <- which.lib.loc ns <- loadNamespace(package, lib.loc) env <- attachNamespace(ns, pos = pos, deps) ...
1.
library(tidytext)
upon running
tidyverse:::tidyverse_attach()
tidyverse:::tidyverse_conflicts()
> tidyverse:::tidyverse_attach()
Error in library.dynam(lib, package, package.lib) :
shared object ‘stringi.so’ not found
> tidyverse:::tidyverse_conflicts()
Error in library.dynam(lib, package, package.lib) :
shared object ‘stringi.so’ not found
Try running install.packages('stringi')
See this issue thread for more details: https://github.com/bvieth/powsimR/issues/20
I personally found that when my OS updates R, all of my downloaded packages get broken in some weird way. I've yet to find a fix for it.

Yocto How to overwrite a file of linux rootfs depending on an IMAGE-recipe?

I'm trying to add a simple line in fstab within
the final rootfs that Yocto builds.
My first approach was to add my own fstab in my layer meta-mylayer/recipes-core/base-files/base-files/fstab and the proper meta-mylayer/recipes-core/base-files/base-files/base-files_%.bbappend which only have the following line:
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
And it works, but as the title of my question says, i want to modify fstab based on the recipe-image i want to build i.e. dev-image & prod-image.
After some investigation i think i have 2 options
Modify fstab within the recipe image, extending the do_install task...
dev-image.bb
--------------
DESCRIPTION = "Development Image"
[...]
inherit core-image
do_install_append () {
echo "======= Modifying fstab ========"
cat >> ${D}${sysconfdir}/fstab <<EOF
# The line i want to Add
EOF
}
[...]
--------------
Problem is that i'm actually not seeing my modified line in my final /etc/fstab and bitbake is not showing any build error or warning about this, actually, i'm not even able to see the echo-trace i put.
My second attempt was to handle these modifications with packages and depending on the recipe-image i will be able to add the package for *-dev or *-prod. This idea was taken from Oleksandr Poznyak in this answer in summary he suggest the following:
1) Create *.bbappend recipe base-files_%s.bbappend in your layer. It
appends to poky "base-files" recipe.
2) Create your own "python do_package_prepend" function where you should
make your recipe produce two different packages
3) Add them to DEPENDS in your image recipe
And based on his example i made my own recipe:
base-files_%.bbappend
-------------------------
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
SRC_URI += "file://fstab-dev \
file://fstab-prod \
"
PACKAGES += " ${PN}-dev ${PN}-prod"
CONFFILES_${PN}-dev = "${CONFFILES_${PN}}"
CONFFILES_${PN}-prod = "${CONFFILES_${PN}}"
pkg_preinst_${PN}-dev = "${pkg_preinst_${PN}}"
pkg_preinst_${PN}-prod = "${pkg_preinst_${PN}}"
RREPLACES_${PN}-dev = "${PN}"
RPROVIDES_${PN}-dev = "${PN}"
RCONFLICTS_${PN}-dev = "${PN}"
RREPLACES_${PN}-prod = "${PN}"
RPROVIDES_${PN}-prod = "${PN}"
RCONFLICTS_${PN}-prod = "${PN}"
python populate_packages_prepend() {
import shutil
packages = ("${PN}-dev", "${PN}-prod")
for package in packages:
# copy ${PN} content to packages
shutil.copytree("${PKGD}", "${PKGDEST}/%s" % package, symlinks=True)
# replace fstab
if package == "${PN}-dev":
shutil.copy("${WORKDIR}/fstab-dev", "${PKGDEST}/${PN}-dev/etc/fstab")
else:
shutil.copy("${WORKDIR}/fstab-prod", "${PKGDEST}/${PN}-prod/etc/fstab")
}
-------------------------
And in my recipe-image(dev-image.bb) i added base-files-dev packet
dev-image.bb
--------------
DESCRIPTION = "Development Image"
[...]
inherit core-image
IMAGE_INSTALL = " \
${MY_PACKETS} \
base-files-dev \
"
[...]
--------------
Problem with this, is that i'm not familiarized with phyton indentation so probably i'm messing things up, the error log shows as follows.
DEBUG: Executing python function populate_packages
ERROR: Error executing a python function in exec_python_func() autogenerated:
The stack trace of python calls that resulted in this exception/failure was:
File: 'exec_python_func() autogenerated', lineno: 2, function: <module>
0001:
*** 0002:populate_packages(d)
0003:
File: '/home/build/share/build_2/../sources/poky/meta/classes/package.bbclass', lineno: 1138, function: populate_packages
1134:
1135: workdir = d.getVar('WORKDIR')
1136: outdir = d.getVar('DEPLOY_DIR')
1137: dvar = d.getVar('PKGD')
*** 1138: packages = d.getVar('PACKAGES').split()
1139: pn = d.getVar('PN')
1140:
1141: bb.utils.mkdirhier(outdir)
1142: os.chdir(dvar)
File: '/usr/lib/python3.6/shutil.py', lineno: 315, function: copytree
0311: destination path as arguments. By default, copy2() is used, but any
0312: function that supports the same signature (like copy()) can be used.
0313:
0314: """
*** 0315: names = os.listdir(src)
0316: if ignore is not None:
0317: ignored_names = ignore(src, names)
0318: else:
0319: ignored_names = set()
Exception: FileNotFoundError: [Errno 2] No such file or directory: '${PKGD}'
DEBUG: Python function populate_packages finished
DEBUG: Python function do_package finished
I will really appreciate any clue or sort of direction, i'm not an Yocto expert so maybe the options that i suggest are not the most elegant and probably there is a better way to do it, so be free to give me any recommendation.
Thank you very much.
UPDATE:
As always, i was not the only one trying this, the way that i make it work was thanks this answer the only inconvenience with this is that you need to rm what you want to install through a .bbappend but for now is fine for me.
I also tried to do the same with bbclasses, which for me, it is a more elegant wayto do it, but i failed... i got the following error
ERROR: base-files-dev-3.0.14-r89 do_packagedata: The recipe base-files-dev is trying to install files into a shared area when those files already exist. Those files and their manifest location are:
I tried to rm fstab within the .bbappend but the same error is showed
Maybe somebody will share what i'm doing wrong...
If you don't find this post valuable please remove...
Your recipe which base on Oleksandr doesn't work due to dropped support for variables expansion in newer Poky.
https://www.yoctoproject.org/docs/latest/mega-manual/mega-manual.html#migration-2.1-variable-expansion-in-python-functions
Error explicit says:
Exception: FileNotFoundError: [Errno 2] No such file or directory: '${PKGD}'
It didn't expand the variable.
P.S.
This is not a proper answer to Your question but SO blocks comments.

Saving or downloading plotly iplot images on Google Colaboratory

I have been attempting to download a plot created using plotly on google colaboratory. So far this is what I have attempted:
I have tried changing
files.download('foo.svg')
to
files.download('foo')
and I still get no results. I navigated to the files on Google colab and nothing shows there
import numpy as np
import pandas as pd
from plotly.offline import iplot
import plotly.graph_objs as go
from google.colab import files
def enable_plotly_in_cell():
import IPython
from plotly.offline import init_notebook_mode
display(IPython.core.display.HTML('''<script src="/static/components/requirejs/require.js"></script>'''))
init_notebook_mode(connected=False)
#this actually shows the plot
enable_plotly_in_cell()
N = 500
x = np.linspace(0, 1, N)
y = np.random.randn(N)
df = pd.DataFrame({'x': x, 'y': y})
df.head()
data = [
go.Scatter(
x=df['x'], # assign x as the dataframe column 'x'
y=df['y']
)
]
iplot(data,image = 'svg', filename = 'foo')
files.download('foo.svg')
This is the error I am getting:
OSErrorTraceback (most recent call last)
<ipython-input-18-31523eb02a59> in <module>()
29 iplot(data,image = 'svg', filename = 'foo')
30
---> 31 files.download('foo.svg')
32
/usr/local/lib/python2.7/dist-packages/google/colab/files.pyc in download(filename)
140 msg = 'Cannot find file: {}'.format(filename)
141 if _six.PY2:
--> 142 raise OSError(msg)
143 else:
144 raise FileNotFoundError(msg) # pylint: disable=undefined-variable
OSError: Cannot find file: foo.svg
To save vector or raster images (e.g. SVGs or PNGs) from Plotly figures you need to have Kaleido (preferred) or Orca (legacy) installed, which is actually possible using the following commands in Colab:
Kaleido:
!pip install kaleido
Orca:
!pip install plotly>=4.0.0
!wget https://github.com/plotly/orca/releases/download/v1.2.1/orca-1.2.1-x86_64.AppImage -O /usr/local/bin/orca
!chmod +x /usr/local/bin/orca
!apt-get install xvfb libgtk2.0-0 libgconf-2-4
Once either of the above is done you can use the following code to make, show and export a figure (using plotly version 4):
import plotly.graph_objects as go
fig = go.Figure( go.Scatter(x=[1,2,3], y=[1,3,2] ) )
fig.show()
fig.write_image("image.svg")
fig.write_image("image.png")
The files can then be downloaded with:
from google.colab import files
files.download('image.svg')
files.download('image.png')
Try this, it does work for me:
import plotly.graph_objects as go
fig = go.Figure(...) # plot your fig
go.Figure.write_html(fig,"file.html") # write as html or image
files.download("file.html") # download your file and give me a vote my answer

Sublime3 throw error after added the proxy details

In my sublime3 (standalone) I am getting the error, while i run a command:
`urllib.error.HTTPError: HTTP Error 407: Proxy Authentication Required ( Forefront TMG requires authorization to fulfill the request. Access to the Web Proxy filter is denied. )
`
I understand that, it require the proxy setting and credentials, for that I ran this command adding my proxy informatins:
import urllib.request,os,hashlib; h = '7183a2d3e96f11eeadd761d777e62404' + 'e330c659d4bb41d3bdf022e94cab3cd0'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler({"http":"**http://xxxx:xxxxxx#172.18.18.87:80/**"})) ); by = urllib.request.urlopen( 'http://sublime.wbond.net/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)
after I done that, I updated my user setting like this:
{
"installed_packages":
[
"AdvancedNewFile",
"Alignment",
"AngularInject",
"AngularJS",
"Bootstrap 3 Jade Snippets",
"BracketHighlighter",
"EasyDiff",
"Emmet",
"FileDiffs",
"HTML5",
"HTMLBeautify",
"Jade",
"Jade Build",
"Jade Snippets",
"jQuery",
"Open-Include",
"SideBarEnhancements",
"SublimeLinter-jshint",
"Theme - Afterglow",
"Theme - Soda",
"WhoCalled Function Finder"
],
"http_proxy": "http://xxxxxx:xxxxxx#172.18.18.87:80/",
"https_proxy": "http://xxxxxx:xxxxx#172.18.18.87:80/"
}
After restarting sublime3 - still i am getting same error. how to fix this?
any one help me to sort out this please?
You should use dedicated variables for the proxy username and password (proxy_username and proxy_password) and http_proxy/https_proxy should be in the form domainname:port or ip:port.
In example:
"http_proxy": "proxyserver:8080",
"https_proxy": "proxyserver:8080", // If http_proxy is set and this settings is not, the value from http_proxy will be used.
"proxy_username": "username",
"proxy_password": "password"
Also double check your proxy port, as 80 is not a common port for a proxy. And make sure that you've curl installed (e.g. apt-get install curl) as the package controller needs it.
Eventually check if your ~/.curlrc file doesn't override any settings.
If nothing helps, then set debug to true, so it'll print HTTP headers and other debug information to the Sublime Text console, so you can investigate the issue further.
Please also check:
Package Control Docs Settings
Sublime Text 2 Package Control error

Resources