How do I use Interactive Magento Console - magento

I have downloaded IMC and don't know how to use it. I am using Denver it is the same like wamp, xamp and so on. I was reading developer book of Magento And there are following notes that describes how to connect to magento folder.
Please help me how can I do it if I use on my local computer Wamp|Xamp|Denver!?
=========================Developer book==========================================
For this purpose, I have created the Interactive Magento Console (IMC), which is
a shell script specially created for this book and inspired by Ruby's own Interactive Ruby Console (IRB). Follow these steps:
The first thing we will need to do is to install the IMC. To do so, download
the source files from https://github.com/amacgregor/mdg_imc and
extract them under your Magento test installation. The IMC is a simple
Magento shell script that will allow us to test our code in real time.
Once you extracted the script, log in to the shell of your virtualbox.
Next, we will need to navigate to our Magento root folder. If you are using
the default vagrant box, the installation is already provided; the root folder
is located under /srv/www/ce1720/public_html/, and we navigate to it by
running the following command line:
$ cd /srv/www/ce1720/public_html
Finally, we can start the IMC by running the following command line:
$ php shell/imc.php
If everything is installed successfully, we should see a new line starting with
magento >.

I'm actually the original author of that script. The readline functions are not available on Windows, which the version of the script that was "borrowed" relies upon. I've since added some fallback support which uses stream_get_line to read STDIN. You can get the latest version here: https://github.com/rgranadino/Interactive-Magento-Console
This fallback support isn't as handy as using readline but it could still come in handy.

After all of the preparation in this book, you should delete this code in shell/imc.php
pcntl_signal(SIGTERM, array($this, 'sigintShutdown'));
pcntl_signal(SIGINT, array($this, 'sigintShutdown'));
And now, it works.

Related

stupid nube cant even do one simple code test [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 10 months ago.
Improve this question
I decided recently that I want to start learning to code. I chose python as my first language because of it's versatility and Open Source connections. Now, of course to learn any programming language, first you have to be able to practice with it by writing code and running it.
I have Python beginner tutorials I am using but as soon as I got to the point where I wanted to run a simple Hello World message, I couldn't figure out how to get my document to actually RUN. I downloaded LiClipse with the hopes of using PyDev. I read that you can run a code directly from PyDev.
Wow, what a confusing mess! I downloaded the instant install version of LiClipse and I had to manually update the pip because it was out of date and that took an hour of research all on it's own to figure out how to do it.
Now that I have the interpreter set up correctly with the most recent pip...(I THINK), when I try to run any code I write, it doesn't let me. It wants me to save it first, which of course is quite logical. But when I try to save it, it says there is no folders to save to. How can there be no folders? I have been reading the install help, but it doesn't say anything about this issue. Or maybe it did explain how to fix this issue and I simply didn't understand all the jargon included in the configuration documentation. It kept instructing me to do technical things I couldn't understand.
Can anyone tell me what is going on? Shouldn't this all be ready to go when I used the "instant install" ?? I am just a beginner here, I don't know all this technical installation jargon. If anyone can help me get this setup, please let me know.
I really want to start learning. But I can't if I don't have the right tools.
Yeah, the technical jargon can be really confusing in the beginning. I've never heard of LiClipse but I can give you a few tips to get started:
Use a good IDE or Editor. For beginning VsCode with the Python PlugIn is quite good. You can also use PyCharm (the free version is enough) but that IDE is quite confusing.
Get comfortable with the commandline. On Windows you can invoke Python by running py on Linux with python3. You open the commandline on Windows by opening the startmenu, entering cmd and hitting enter.
You will have to make sure Python is in your "PATH" enviroment variable. That is a variable telling the Operating System where to find your programms. It should have asked you whether you want to add Python to your PATH during the install.
You run your python programm by saving it as a .py file and running py <filename.py> or python3 <filename.py> on Windows or linux respectively. You have to be in the directory where you saved your file of course.
I hope I could help you. Please mark this answer as accepted if it did answer your question or helped you with your issue.
I want to start by saying I'm mainly experienced in C & C++, not Python, but with programming in general many of the concepts carry over. I also don't have enough rep to comment, or I'd ask for some clarification on how familiar you are with the commandline.
I'm going to assume you're on Windows since you didn't mention the platform.
I wrote this like a tutorial, because I found those to be very helpful when I first started programming.
I can't recommend this enough, start off by using the commandline!
I think you complicated things more by searching for a text editor that can also run code. In order to get something like that working for your setup you need to know what's happening behind-the-scenes first.
Once you have a grasp of how to write & execute Python code, then you can move on to an IDE or advanced text editor like Visual Studio Code or LiClipse with confidence.
R+Click on the Start Menu, then click on Windows PowerShell to open a terminal.
Take a moment to note the filepath shown before the blinking cursor.
This is known as the Working Directory, which works similar to how the file explorer only allows you to "view" one directory at any given time; You can open multiple explorer windows side-by-side, but you can't view multiple directories at the same time in a single window.
You can run commands by typing them and pressing Enter.
You can also use the Tab key to autocomplete things like directory/file names, commands, etc. after typing a few characters.
Now let's create a workspace directory for your first project.
This can be anywhere that you choose, but for the sake of simplicity I'll be using my User directory which is usually where PowerShell will start by default.
To create a new directory named _workspace, use the mkdir (Make Directory) command like so:
mkdir _workspace
Now let's change our working directory to _workspace by using the cd (Change Directory) command like so:
cd _workspace
This directory is empty, but if you want to view the contents of a directory you can use the ls (List Directory) command:
ls
Since this is an empty directory, nothing will happen.
Next, we'll create a Python script file using the touch command, which creates empty files:
touch HelloWorld.py
Now that we have a script file, open HelloWorld.py in Notepad by running this command:
notepad HelloWorld.py
If you use a dark desktop theme, now is the time when your retinas may be seared out by the intensity of Notepad's white color scheme.
Now, let's add the code to print "Hello World!" in Python:
print("Hello World!")
Once you're done, you can save & close Notepad to save your retinas.
Now it's time to run the program! In the PowerShell window, enter this command:
py HelloWorld.py
which will show:
Hello World!
If you see an error saying this:
The term 'py' is not recognized as the name of a cmdlet, function, script file, or operable program.
You should re-install Python and make sure you check this box in the installer:
After re-installing Python and checking the Add to PATH box, close and reopen the PowerShell window, enter the cd _workspace command again, followed by py HelloWorld.py, which should be successful this time.
I hope I could be of some help, if so, I'd greatly appreciate marking this answer as accepted so I can write comments. Happy coding!
If you are using Linux following will work.
Install python3 first (Its better to stuck on python3 now. Once you get use-to then you can code in python2.7 also.)
Open a terminal, go the folder contains your code. If your source code is in hello.py then type python3 hello.py on terminal. It will execute and print the output on terminal.
The suggestions given by both #radj and #C. Dautermann are excellent.
Like others here, I will be assuming that you are on Windows.
Before jumping into LiClipse and PyDev, I highly recommend making sure that Python and packages (such as pip) are functioning on their own first. Command line is a great tool for this.
Windows Command Line can be accessed in a variety of ways, one of which is to go to your start menu and search "cmd." Command Prompt should return. In the command prompt, run the following:
python
This should return the version of Python installed on your machine if it is configured properly. For example, you may see the following:
Python 3.10.1 (...)[...] on win32
If this does not appear, I recommend uninstalling Python and reinstalling. In the installer, you will want to check the "Add Python ... to PATH" option. This will configure your environment variables on your machine. If you plan on running multiple versions of Python down the road, don't worry; you can use batch files to set the PATH variable to another version.
Once you have Python working, your command prompt will lead with the following:
>>>
Notice that there is no longer a file path followed by >>. This is because you are now in the Python interpreter. Congratulations!
To exit the Python interpreter, enter Ctrl+Z. It should appear as the following:
^Z
After we know Python works, we will check to see that pip works. Ensure you have pip installed by entering the following:
python -m pip --version
You should then be able to see the pip version. For example:
pip 22.0.3 from C:\...
If pip is not working, you can consult this documentation on pip to make sure pip gets installed properly.
Once pip is working, again, congratulations! You've gotten over some of the biggest hurdles. At this point, you can open up any text editor, type in:
print('Hello World!')
save the file with the extension .py, then run the script through command prompt. To run a script through the command line, you have to cd to the file location, then run the script with python, like so:
cd filepath
python filename.py
Where filepath is the path to the Python file and filename is the name of the file. For example:
cd C:\Users\name\Documents\PythonPractice
python helloworld.py
Usually, command line is all that is needed when starting out with Python outside of a text editor. Notepad comes standard on Windows computers, but there are plenty of other editors out there. Sublime text and Notepad++ are some of my favorites, personally.
Now, if you're able to run everything prior, the good news is that your Python and pip are both working, and you have everything you need to get started learning Python. If Python and/or pip are not functioning, there's thankfully a huge body of troubleshooting tips out there.
Unfortunately, from what I get of your initial post, you might be struggling with configuring LiClipse. I personally do not use LiClipse, nor do I use PyDev, so my help at this point may be limited. You may want to uninstall and reinstall after confirming your Python and pip work as a first step. After that, perhaps check that you are following the practices outlined in the LiClipse manual. Worst case scenario, you can try a different version of Python (I believe it has some Python3 incompatibilities), try running PyDev independent of LiClipse, or look at a different tool. If you believe the problem lies with file locations/existence, I would look at radj's post or play around in File Explorer to see what is going on for yourself.
Again, to get familiar with Python, you don't even need these extra tools. All you need is a text editor and the command line to get started.
Some other tools to help you get started:
PyPI
A venv virtual environment tutorial
PyDev
A comparison of LiClipse alternatives in case you continue to struggle
Hope this helps. Happy Coding!

can not find ipy_user_conf.py for Enthought python

I have EPD. I would like to use the ipython shell. I think it's called 'pylab' in your distribution. I would like to be able to append to the system path ($pythonpath) at the moment when the shell loads. Unfortunately, I can not seem to locate the ipy_user_conf.py file that many users on the internet report is where I need to include a line to do that. Please help!!!
I'm going to guess that you're running IPython >= 0.11. (Note the IPython version is displayed when starting up the IPython shell.)
Older versions of IPython (pre-0.11) used ipy_user_conf.py, but IPython's configuration system was overhauled in 0.11. For details, see this overview. If you want to run some code on start up, you can add a python file in your IPython startup directory, which should be here:
~/.ipython/profile_default/startup/
Any python code in that directory gets run on startup, so you can just create a new .py to modify your python path. If the startup directory doesn't exist, you may need to run:
ipython profile create
which creates those directories (plus some other goodies).

Installing Zend Framework 2 on XAMPP in Windows

I know this question may have appeared few times here and in the internet. But still I feel it is not clear for somebody who wanted to enter into the world of frameworks. I have followed these links Rob Allens Tutorial, ZF Quick Tutorial.
But some how I feel it is not quite clear with the installation part. I have a windows system basically Vista with the newest version of XAMPP installed. I have downloaded the latest version of ZFSkeletonApplication from this link ZFSkeletonApp, extracted the skeleton contents, renamed the folder to zendframework and moved it to xampp folder i.e now ZF skeleton is in c:\xampp\zendframework.
So until here everything seems clear and easy, from here I am some how lost with the configurations. Can some one elaborate the things from here how to install the Zf and make it work, like changes in the include paths, .htaccess files and so on. Please do remember that I have windows with XAMPP on it. If some one can guide me exactly for this set up, it would be helpful.
P.S. It would be good if one can provide info about the changes which I need to make with examples consisting of paths, so that I am not lost, for example like you can find .htaccess file here(ex pathname), changes in .htaccess file should be so and so.
Thanks
For future references, i also made a big post on how to install ZF2 on a windows xampp environment right here Install ZF2 on Windows Xampp
OK, i have done this on multiple systems now. For a home system the following steps work quite well:
Download msysGit and install it to any directory
Run the git-cmd.bat from the msysGit-Folder
Move into the directory you want i.e. C:\xampp\htdocs\ (this is done via cd dirname or cd .. to go up a level, change partition with D: and hit enter)
Run the following command. The <OptionalFolderName> would be the name of a Sub-Directory of htdocs, if you skip this, the folder will get named ZendSkeletonApplication
git clone git://github.com/zendframework/ZendSkeletonApplication.git <OptionalFolderName>
Possible Trouble Scenario (fatal:unable to connect to github.com)
Once again at workplaces, pretty often the default port (9418) for the git-protocol is blocked. If this is the case for you, then you should try one of the following Commands
git clone https://github.com/zendframework/ZendSkeletonApplication.git <OptionalFolderName>
git clone git#github.com:zendframework/ZendSkeletonApplication.git <OptionalFolderName>
Now you are not done yet. The skeleton Application is installed, but the framework is still missing, here some people might run into the first problems, but this actually is quite easy.
We're still at the command line interface
cd <OptionalFolderName> or cd ZendSkeletonApplication depending on what you did earlier
php composer.phar self-update
php composer.phar install (this might take a while)
So, this is the part where lots of things can happen. I have two scenarios happened to me:
Scenario #1 No directory write permissions
This is easily handled by running the command line interface with administrator privileges
Scenario #2 Working behind a router (i.e. at work)
Personally i didn't have to do much to get this working, but the line might change depending on your proxy. Personally i did the following at the command line interface
SET HTTP_PROXY=http://proxy.domain.tld:8080 you might also be good with
SET HTTP_PROXY=proxy.domain.tld:8080 don't ask me why, but i needed the http://
With all those done, you should have an almost running ZendSkeletonApplication. The other part is how to set up your virtual host, but i won't go into detail on this, as that's even ZF1 Stuff and everyone should be familiar with that by now, if not, there's good resources to learn out there.
I hope i could be of help to you.
Setbacks have to install in Windows, but I ended up finding a solution. From ZF2 to install on windows via git, for this is the only use that simulates msysGit git linux on windows, for it is only access the tutorial: http://zf2.com.br/tutoriais/post/instalando-o-git-no-windows-para-fazer-a-instalacao-do-zf2-somente-no-comando-do-windows-via-composer
Since I had lot dependency extension problems (mostly .dll files) with old version of XAMPP, so first thing I did was made sure I uninstall all previous versions of PHP already present on my system as well as old XAMPP. Then installed latest XAMPP v3.2.2 (using latest XAMPP 3.2.2-32-bit on Win-7-64-bit). Then followed installation steps in XAMPP Documentation under title Start a New Zend Framework 2 Project.
I had issues while installing composer also with old-XAMPP, but somehow those errors didn't appear during composer installation this time. And, I successfully installed ZEND till I typed http://localhost:8081/myapp/ (I renamed my ZendSkeletonAppliction folder as myapp as per documentation) into my browser to access the same and met the error which said:
Fatal error: Uncaught RuntimeException: Unable to load ZF2. Run php composer.phar install or define a ZF2_PATH environment variable. in C:\xampp\apps\myapp\htdocs\init_autoloader.php:51
Stack trace:
#0 C:\xampp\apps\myapp\htdocs\public\index.php(18): require()
#1 {main} thrown in C:\xampp\apps\myapp\htdocs\init_autoloader.php on line 51
Composer.phar was not even present the first time I downloaded ZendSkeletonApplication‐master.zip from Github (there was only composer.json and composer.lock files present). Anyhow I didn't need them since I followed XAMPP Doc which doesn't call composer.phar in command line:
composer create‐project ‐s dev zendframework/skeleton‐application path/to/install
I am not that tech-savvy to know how to 'define a ZF2_PATH environment variable' correctly, so I wasted time looking for solution online, couldn't find any (which is when I stumbled on this forum which also turned out not to have a solution for my query). In the end, in a fit of depression and anxiety, serendipity happened. All I did was as per XAMPP's ZEND documentation I right-clicked inside C:\xampp\apps\myapp\htdocs folder and clicked 'Composer Install' which reinstalled the Zend files from cache. Then refreshed http://localhost:8081/myapp/ and the Zend intro page appeared.
I just did it like that:
D:\web_dev\zendapp>C:\PHP\php.exe composer.phar self-update
it worked perfectly

automatic installation of common magento extensions at project kickoff

There are some Magento Connect extensions that I find myself installing every time I create a new project, such as Fontis_Recaptcha, Mass_Product_Relater, HM_DeveloperToolbar, ModuleCreator, Alanstormdotcom_Layoutviewer, etc. What's on your list?
Does anyone know of a capability to automate the installation of a base set of modules? In the same way that Mage itself installs all its modules. I guess a bash or phing script to automate PEAR? Thoughts?
I would take another approach. Install a clean installation and add all your extension. When your done export the DB and zip all the files. Then you should be able to use the files and the DB as a base for all your magento installations...
I do the same with Joomla, have not tried that with magento yet, but it should work.
Cant you just use the auto installer script as provided and maintained here:
http://www.magentocommerce.com/wiki/groups/227/magento_bash_script_installer
and edit it to install your desired extensions
ie just add ./pear install xxxxxxx at the end of the script.

How to change /usr/bin/env?

I have scripts that use #!/usr/bin/env ruby but I've switched to using Ruby Enterprise Edition instead of the default ruby that is included with Ubuntu server. Thus, the scripts freak out when I try to run them. How can I add the Ruby EE path to /usr/bin/env?
#!/usr/bin/env ruby is similar to simply calling ruby from the command line, so the same rules apply. Basically, the individual entries in the $PATH environment variable are checked in order, and the ruby that is found first is used. So make sure that the ruby for Ruby EE is earlier in the search path order than your other rubys.
I'm not familiar with Ruby EE, so if it doesn't have an executable called ruby, just create a symlink in a directory that's early in your search path to Ruby EE's executable.
Since you have an explicit dependency on Ruby EE, you could always modify the scripts instead of your environment ( which could have other unintended consequences ).
#!/usr/bin/env ruby
becomes
#!/path/to/enterprise/edition/ruby
Now it becomes clear to the reader that you using a specific version of ruby rather than just whatever ruby is in your path.
I had a similar problem where cron jobs stopped working... Cron seems to run commands by default without using the PATH settings you would expect for the user (when logging in as that user). In fact it didn't even seem to use any of the default PATH settings (be it in /etc/profile or elsewhere).
I was able to find the problem using the following commands (the first one is how cron seems to run commands):
su -c 'printenv PATH' userX
With output: /usr/local/bin:/usr/bin:/bin:/usr/games
su -l userX -c 'printenv PATH'
With output: /opt/ruby-enterprise-1.8.7-2010.02/bin/:/opt/ruby-enterprise-1.8.7-2010.02/bin/:/usr/local/bin:/usr/bin:/bin:/usr/games
The first command doesn't seem to populate the PATH variable in any way except for the bare system default.
In my case I solved it by just adding the necessary (REE) path to: /etc/login.defs, which by default looks as follows:
/etc/login.defs:103:ENV_PATH PATH=/usr/local/bin:/usr/bin:/bin:/usr/games
See section 1.6 in the Ruby EE documentation page:
http://www.rubyenterpriseedition.com/documentation.html
For a system wide change you can update your PATH in the /etc/environment file to include the Ruby EE bin directory. Maybe something like this:
PATH="/opt/ruby-enterprise-x.x.x/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
If you only want to the change to be visible for one user on the system you can update your .bashrc or .profile with the correct path.
Make sure to include the REE path first in the list of directories.
I posted the solution I used on Ubuntu here:
http://groups.google.com/group/emm-ruby/browse_thread/thread/d0c685bbd096823a#msg_effa7d6ad42c541c
There were some additional steps to get it working beyond what was described in the Ruby Enterprise Edition documentation.

Resources