I am working through the Zend framework tutorial at http://framework.zend.com/manual/en/.
Right now I am on the 'Create a Model and Database Table' section, and have followed the tutorial's guidelines for initializing database resources. In my terminal I entered
zf configure db-adapter \
then
adapter=PDO_SQLITE&dbname=APPLICATION_PATH "/../data/db/guestbook.db" \
and then
production
At this point, I am supposed to receive a message saying that a db configuration for production has been written to my config file. Instead, the prompt stays open. I've tried using ":q", ":quit", and "\q" to leave the prompt, but those don't work. The server that I am working on runs of RHEL5. I know I can close the terminal and open a new one, but I want to learn how to actually get out of the zend framework command line prompt. Solutions?
Ctrl+c will exit a prompt.
Related
I have a Django project connecting to a PostgreSQL database which I develop in PyCharm, and I want to enable PostgreSQL history logging.
There is PSQL_HISTORY env variable set to /home/user/apps/postgres/logs/.pycharm_log, but when I start the project in PyCharm and update some data via the Django Admin (which certainly hits the database) -- nothing gets logged and the file is not created at all.
Is there a way to make PyCharm and PSQL_HISTORY work together as I expected?
'psql' is the name of a specific client tool. Why would a completely different tool use psql's configuration options? If you want to log every statement sent to the server, you could configure that in the server side with log_statement=all.
It's my first day tinkering with the Play framework, and I'm having a hard time with evolutions. I'm using Play 2.4.
I picked a sample app from the many that come up in activator ui, it uses play-slick and play-slick-evolutions for DB connection and evolutions.
I've perused the docs, but I can't seem to find a way to run the evolutions from the command line. When I run activator on bash I get thrown into a shell, and the help doesn't bring up anything about running evolutions, or slick.
I've been doing PHP for a while, so I'm used to being able to run these up/down from the command line. I can drop the tables from the database client and do activator run which should prompt me to run the evolutions, but I'm looking for the right, manual way to do this. I imagine it's possible since it would need to be done on deploy.
As far as I know, they are not designed to be run manually. In development, Play asks you to run them:
In Production I trigger the evolutions by starting my server with the parameter -DapplyEvolutions.default=true. You can write this (without -D of course) also to the application.conf-file to run them always. You can also use only the down- or up-evolutions with -DapplyUpEvolutions.default=true or -DapplyDownEvolutions.default=true.
And of course there is always the option to just copy the part of the script you need manually and apply it with your favorite database tool. However, you then need to tell Play what you did by manually altering the table play_evolutions. An easier solution then would be to not use the evolutions mechanism provided by the Play Framework at all.
A quick hack that works for me and doesn't involve bringing up a play instance:
export PGPASSWORD=<password>
for SQL_FILE in $(ls <path-to-evolution-files>); do
psql -h localhost -U <username> -c "$(sed '1,/Ups/d' <path-to-evolution-files>/$SQL_FILE | sed -n '/Downs/q;p')";
done
Removes everything up to and include Ups and everything after and including Downs, and runs the commands on the Postgres instance.
I'm trying to start Libreoffice impress automatically once my raspberry pi has started up.
I created:
.config/lxsession/LXDE/autostart
and added my presentation:
sudo libreoffice -show /home/pi/test.odp
When i execute the command in a terminal, all works fine.
However the autostart doesn't seem to work at boot. Libreoffice starts, but then says it can't find the file...
The file .config/lxsession/LXDE/autostart is used to start applications without root privileges. Therefore, you should remove "sudo" from your code:
libreoffice -show /home/pi/test.odp
That should work as intended. If your presentation need root privileges (I don't see why it would, but anyway), you could use gksudo on your code, then at boot you would see a window asking for your password to proceed. The new code would look like this:
gksudo libreoffice -show /home/pi/test.odp
Important: please note you should not try to open a GUI enabled application with sudo or root privileges, as this can have bad consequences, such as modifying permissions and ownership on program files, which could lead to malfunctioning. If you really need to open a GUI application as root, always use gksudo or gksu.
On the other hand, if you really need to open a program at boot with root privileges, you should look into using the file /etc/rc.local or the cron service for that.
I am using helios Eclipse for debugging my code in postgresql.
My aim is to know how postgresql uses join algorithms during the join query, so I started to debug nodenestloop.c which is in the Executor folder.
I gave break points in that file, But whenever I try to debug that file, the control goes to main.c and never comes back,How do I constraint the control only to that particular file(nodenestloop.c)
Below are the following fields which I gave in Debug configurations of Helios Eclipse.
C/C++ Application - src/backend/postgres and
project - pgsql
I followed the steps given in the following link for running the program.
https://wiki.postgresql.org/wiki/Working_with_Eclipse#
I even uncheked the field "Start on Start up=main" , but When I do that, The step in and Step over buttons are not activated and the following problem has popped up.
Could not save master table to file '/home/ravi/workspace/.metadata/.plugins/org.eclipse.core.resources/.safetable/org.eclipse.core.resources'.
/home/ravi/workspace/.metadata/.plugins/org.eclipse.core.resources/.safetable/org.eclipse.core.resources (Permission denied)
So I started eclipse using sudo, but this time the following error has come in the console of eclipse.
"root" execution of the PostgreSQL server is not permitted.
The server must be started under an unprivileged user ID to prevent
possible system security compromise. See the documentation for
more information on how to properly start the server.
Could any one help me with this.
Thank you
Problem 1: User ID mismatch
Reading between the lines, it sounds like you're trying to debug a PostgreSQL instance that's running as the postgres user, or a different user ID to your own anyway. Hence your attempt to use sudo.
That's painful, especially when using an IDE like Eclipse. With plain gdb you can just sudo the gdb command to the desired uid, e.g. sudo -u postgres -p 12345 to attach to pid 12345 running as user postgres. This will not work with Eclipse. In fact, running it with sudo has probably left your workspace with some messed up file permissions; run:
sudo chown -R ravi /home/ravi/workspace/
to fix file ownership.
If you want to debug processes under other user IDs with Eclipse, you'll need to figure out how to make Eclipse run gdb with sudo. Do not just run all of Eclipse with sudo.
Problem 2: Trying to run PostgreSQL under the control of Eclipse
This:
"root" execution of the PostgreSQL server is not permitted. The server must be started under an unprivileged user ID to prevent possible system security compromise. See the documentation for more information on how to properly start the server.
suggests that you're also attempting to let Eclipse start postgres directly. That's very useful if you're trying to debug the postmaster, but since you're talking about the query planner it's clear you want to debug a particular backend. Launching the postmaster under Eclipse is useless for that, you'll be attached to the wrong process.
I think you probably need to read the documentation on PostgreSQL's internals:
Tour of PostgreSQL Internals
PostgreSQL internals through pictures
Documentation chapter - internals
Doing it right
Here's what you need to do - rough outline, since I've only used Eclipse for Java development and do my C development with vim and gdb:
Compile a debug build of PostgreSQL (compiled with ./configure --enable-debug and preferably also CFLAGS="-ggdb -Og -fno-omit-frame-pointer"). Specify a --prefix within your homedir, like --prefix=$HOME/postgres-debug
Put your debug build's bin directory first on your PATH, e.g. export PATH=$HOME/postgres-debug/bin:$PATH
initdb -U postgres -D $HOME/postgres-debug-data a new instance of PostgreSQL from your debug build
Start the new instance with PGPORT=5599 pg_ctl -D $HOME/postgres-debug-data -l $HOME/postgres-debug-data.log -w start
Connect with PGPORT=5599 psql postgres
Do whatever setup you need to do
Get the backend process ID with SELECT pg_backend_pid() in a psql session. Leave that session open; it's the one you'll be debugging.
Attach Eclipse's debugger to that process ID, using the Eclipse project that contains the PostgreSQL extension source code you're debugging. Make sure Eclipse is configured so it can find the PostgreSQL source code you compiled with too (no idea how to do that, see the manual).
Set any desired breakpoints and resume execution
In the psql session, do whatever you need to do to make your extension run and hit the breakpoint
When execution pauses at the breakpoint in Eclipse, debug as desired.
Basic misunderstandings?
Also, in case you're really confused about how all this works: PostgreSQL is a client/server application. If you are attempting to debug a client program that uses libpq or odbc, and expecting a breakpoint to trigger in some PostgreSQL backend extension code, that is not going to happen. The client application communicates with PostgreSQL over a TCP/IP socket. It's a separate program. gdb cannot set breakpoints in the PostgreSQL server when it's connected to the client, because they are separate programs. If you want to debug the server, you have to attach gdb to the server. PostgreSQL uses one process per connection, so you have to attach gdb to the correct server process. Which is why I said to use SELECT pg_backend_pid() above, and attach to the process ID.
See the internals documentation linked above, and:
PostgreSQL site - coding
PostgreSQL wiki - developer resources
Developer FAQ
Attaching gdb to a backend on linux/bsd/unix
I also faced similar issue and resolved it after some struggle
I misunderstood the following point under Debugging with child processes in the wiki (https://wiki.postgresql.org/wiki/Working_with_Eclipse).
5."Start postmaster & one instant of postgresql client (for creating one new postgres)"
The above step should be performed from terminal by starting postgres server and one client.
Hope this helps
Once this is done then debugger in eclipse needs to be started for C/C++ Attach to Application
I am trying to access an Oracle ILOM interface via command line to read the event log.
As far as I know there are several ways to do this, but none work for me and my environment:
IPMItools: seems to be available only for Linux or on the CD/DVD that originally came with the server, which of course was lost;
SSH access (via putty) works fine, but I could not figure a way to automate logging in, running a command on the remote server and reading the result (still looking into it);
command line SSH access via plink works fine, but as soon as I try adding a command to run on the server (e.g. plink.exe -l root -pw password FQDN help) I get the error message "shell: Invalid credentials". adding the -t option did not change anything;
the SSH.NET library for powershell fails with the following exception "Exception calling "Connect" with "0" argument(s): "No suitable authentication method found to complete authentication". Documentation suggests adding a generated public RSA key to the server to allow for possword-less login. That cannot be done on Sun ILOMs;
Connecting via a serial port as detailed here does not work for me. I must be missing something from the posted code, but I simply cannot open a connection.
Has anyone ever tried to access an ILOM from command line? Could anyone offer a pointer as to what might work?
Ideally I'd like to automate this in a powershell script to be run from a Windows machine, but I'm open to any suggestions that do not require Visual Studio to implement.
Any help would be greatly appreciated!
ipmi and ssh remote command only supports in ilom3.0+.
if you are using alom, ilom2.0, or sxcf, you won't be able to use these tools.
I'd recommand to use python with pexpect https://pexpect.readthedocs.io/en/stable/.
check my snippet https://gist.github.com/happlebao/ca143cf3feaf60ca8ef75f7a66cf8a8a