Symptoms
When trying to start your Ruby application from within RubyMine using a “Run” or “Debug” configuration, you get an error message like this:
/usr/share/ruby-rvm/rubies/ruby-1.9.2-p180/bin/ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /usr/share/ruby-rvm/gems/ruby-1.9.2-p180/bin/unicorn_rails -l 0.0.0.0:5000 -E development -c ./config/unicorn.rb
/usr/share/ruby-rvm/gems/ruby-1.9.2-p180/gems/bundler-1.1.3/lib/bundler/spec_set.rb:90:in `block in materialize’: Could not find rake-0.9.2.2 in any of the sources (Bundler::GemNotFound)
from /usr/share/ruby-rvm/gems/ruby-1.9.2-p180/gems/bundler-1.1.3/lib/bundler/spec_set.rb:83:in `map!’
[...]
Process finished with exit code 1
Cause
This happens because RubyMine itself does not run within a RVM environment, so cannot start Ruby applications correctly from it. You probably have installed RVM globally (like from the Ubuntu package) and all your gems of RVM environments are likewise stored globally rather than in ~/.rvm/. However, RubyMine is only able to automatically detect and use RVM environments when these are stored in ~/.rvm/ [source]. So in our case here, the applications try to use globally installed gems, which are not necessarily there.
Solution
This can be fixed by starting RubyMine from a login shell where RVM is loaded (such as a virtual terminal; check with “type rvm | head -1″ and “which ruby” if RVM is loaded and your desired RVM environment is in use first).
This can also be worked around by not starting applications from within RubyMine at all, instead using a login shell for that.
The more elegant solution is to use the fact that RubyMine can use RVM environments if the gems are found in ~/.rvm/. For that either uninstall RVM and re-install it locally into ~/.rvm/, which is the simplest and most comfortable way [instructions]. Alternatively, transform your system-wide install into a “mixed mode” installation, where RVM is installed system-wide but the gems and rubies reside in ~/.rvm/ [instructions].
This is a bit of a tricky task because the package ruby_rvm from the Ubuntu 12.10 archives is naturally installed system-wide, but RubyMine only works with rvm that provides gems on a per-user basis [source]. The solution is to use the so-called “mixed mode” installation of rvm: installed system-wide, but gems and optionally rubies provided on a per-user basis in ~/.rvm/.
Also, any rvm installation has this peculiarity: rvm is only loaded in login shells, while being on the PATH but not loaded in (interactive and non-interactive) non-login shells. (The docs refer only to non-interactive shells for the latter case: “For non-interactive shells RVM will be added to PATH only, not loaded.” [source] However it is clear from the docs’ gnome-terminal integration instructions and the following observations, that this refers to all non-login shells: rvm, in a system-wide installation, does its loading via /etc/profile.d/rvm.sh and via .bash_login, which all are only evaluated for login shells (while .bash_rc is evaluated for non-login shells). But there’s a way to load RVM at the start of any non-login shell, including the non-interactive shell environments when executing a script [see].)
Let’s install it:
sudo apt-get install ruby_rvm;
sudo apt-get install bison openssl libssl-dev libyaml-dev libxslt-dev libtool autoconf libc6-dev ncurses-dev; # requirements not recorded as packages
sudo rvm package install openssl;
sudo rvm install 1.9.2 --with-openssl-dir=/usr/share/ruby-rvm/usr/; # [source]
sudo rvm use 1.9.2 --default; # Set a system-wide default version into /usr/share/ruby_rvm/config/alias [source]
sudo addgroup rvm;
sudo addgroup username rvm; # Add all users to that group that may use rvm.
sudo chown -RL :rvm /usr/share/ruby-rvm; # Fix write permission probs when installing gems as non-superuser; might not be needed. If setting the group is not enough, make yourself the owner of these files.
Now close your X session and open a new X session – only this forced re-login makes your new group membership effective.
At this point, RVM will be registered as a shell function whenever starting a login shell, and user’s rights to it are evaluated based on the rvm group membership [source, see section 2]. But there is no means to let the chosen RVM configuration become effective, like selecting a default Ruby environment (/etc/profile.d/rvm.sh sources /etc/rvmrc and ~/.rvmrc, but these are files that use bash syntax for setting path variables etc., not RVM config files). It is unclear why this step of reading the rvm config was not included in /etc/profile.d/rvm.sh, but probably because this has to be done on a user-specific basis, not system-wide, as it can also include user-specific configuration (but these are also optional). So to read the RVM config, add the following line to the end of .bash_profile:
[[ -s "/usr/share/ruby-rvm/scripts/rvm" ]] && . "/usr/share/ruby-rvm/scripts/rvm"
Note that on Ubuntu 12.04, this really has to go to .bash_profile, which, if present, is read as the only configuration file for login shells. Normally, it should also be possible to add this to the end of .profile, which is also read by login shells but on Ubuntu sources .bashrc before; and that step does something, unknown so far, that prohibits that the above line is effective (see ruby -v output). The same problem happen when sourcing .bashrc in .bash_profile. This problem is not the [ -z "$PS1" ] && return line problem [discussion of it] because it also happens in interactive shells (those allowing user interaction, like a normal virtual terminal). The problem with this line exists in .bashrc in Ubuntu 12.04, but can be ignored as .bashrc will not be evalutated in our above setup.
Now, some additional configuration is needed to make the “Mixed Mode” effective. For every user, execute [source, see 2. Load RVM ...: Mixed Mode]:
- For rubies installed in system, gemsets separated per user (it is unknown so far if RubyMine supports this):
- For rubies and gemsets separated per user:
Next, we need to re-configure the used virtual terminal to use a login shell, for above reasons. For gnome-terminal, see this fix. For konsole, go to “Settings -> Configure Current Profile …” and change the command to “/bin/bash -l“, the login shell.
To check for success of the rvm setup, open a new virtual console and run type rvm | head -1. It should indicate that rvm is a shell function. Then run which ruby; it should point to your default ruby version in /usr/share/ruby-rvm/rubies/. Now go on and install the gems you need as desired, with the normal “gem” command.
With a setup like this, RubyMine should be able to detect and use and switch the correct RVM environment, being able to start Ruby applications within it when using its Run / Debug configurations.
Problem Description
The necessity to manage more than one stock counter per product can have multiple reasons:
- You have a central warehouse for selling online and also a brick-and-mortar store for over-the-counter sales, and you want an overview what stock is where so that you can also offer the stock from the store for selling online.
- You have a network of several physical stores that sell your products, and each one should have a web ordering interface.
- You have multiple warehouses for selling online, each one for a different geographical area.
- You have multiple warehouses for selling online, all in one location, just because the goods do not fit in one only.
- You are a group of people operating a common webshop, with multiple warehouses for selling online, each being another person’s home and managed by this person (“distributed distribution”).
Solutions
According to my research in 2012-05, you have these options to solve this. Ordered by quality, from my judgment – pick the first that fits your needs. I would suggest to use either the InnoExts or, if you don’t need all its features, the Wyomind extension (we use the latter).
InnoExts Multi-Warehouse. A commercial Magento extension for 300 USD (as of 2012-04). It has the most complete feature set for multi-stock management of all options here, including associating customers with warehouses and websites / stores with warehouses, doing automatic order routing to warehouses to avoid shipping costs, shipping methods per warehouse, notification about orders to all warehouses, list of products per warehouse, low-stock products per warehouse (they modified “Reports -> Products -> Low Stock” for that). What I miss is a comfortable “stock movement” feature incl. a stock movement journal, as in EmbeddedERP below. And what I rather dislike is the bloated look of the products overview list by having per-warehouse stock levels listed in it. But overall, solid quality. They have an online demo available.
Wyomind Advanced Inventory. This is a commercial Magento extension for just 65 EUR (as of 2012-04). It offers all the basic features to expect from a multi-stock solution, and has some nice GUI details to make working with it comfortable, but so far it’s not as feature rich as the InnoExts extension and some functionality requires some polishing. But it’s in active development, and collaboration with the developer happens to be great. They have the docs available online, and an online demo, so see for yourself.
The great features:
- You can assign “places” (warehouse / shop) to Magento store views (many-to-many relationship). Orders done in these store views can then be automatically lead to a deduction from the local stock of the assigned “place”. This routing can also be refined based on the customer’s country and ZIP location.
- You can also do the “order routing” manually, after the order comes in.
- You can use of arrow buttons to increase and decrease stock levels, in both the individual product view and the “Catalog -> Manage Stocks” overview.
- There is an automatic Google Maps integration to show your stores and their business times.
- It displays on the frontend how much is available in what store (if you want that).
- It has a concept of keeping an “online stock level” (the usual field Magento had before) and per-warehouse levels which are automatically or manually sync’ed to the online level, the latter being the sum. This seems to be to prohibit overselling while incoming orders are not yet assigned to a warehouse, but it also helps to avoid errors in stock transfers. Because the ”Catalog -> Manage Stocks” tells you how much to add / subtract to another warehouse to keep the sum intact. You can however also disable the separate “online stock level”.
What’s missing (as of 2012-05-04, but it’s promised for the coming versions):
- A stock movement feature incl. a journal, like done in EmbeddedERP (see below).
- E-mail notification of the specific warehouse after an order was assigned to it, including a copy of the order. (The order copy is needed because store operators not necessarily are trusted enough to get Magento backend access, also allowing them to edit their own stock levels to their advantage.)
Bizelo eRetail. This is an external, web based software offered as SaaS for 25 USD monthly [source]. It is a nice and modern looking application that is used to centrally gather all inventory information, including multiple warehouses and multiple stores. It then can sync this information with various marketplaces and shopping carts, including Magento. However this approach also means that there will only be one stock level visible on Magento, so there is no way to assign orders to warehouses from within Magento. You could of course sync the stock level of every warehouse to different website; that is, if eRetail supports this – I did not check; and it’s an admin’s nightmare anyway, as you then have to manage a ton of Magento installations in parallel. If however you only want to have one web shop offering, but keep track of your stock separated by warehouse, this solution might be for you.
Smile OpenERP Synchro. Gratis Magento extension that acts as a connector to the likwise gratis and open source OpenERP. I have not tried out this alternative, yet it seems to be not for the faint of heart: orders and stock are imported from Magento into OpenERP and processed there, also providing the multi-stock feature as per the docs. However if you’re only after multi-stock, this solution is overkill, as OpenERP will require quite a bunch of learning, being a complex system.
BoostMyShop Embedded ERP. A commercial Magento extension for 590 EUR (as of 2012-04). You will probably not buy it for having just the multi-stock feature, because of that price tag. However once you have it, you have much more than multi-stock (including automated re-orders at suppliers etc.). Also the multi-stock feature is the most complete implementation that I have seen so far, including a record of movements between stocks that also makes it easy to do the transfers (without the need to calculate manually and adapt two stock counters correctly, as in the other multi-stock extensions).
Multi-Location Inventory. A commercial Magento extesion costing 99 USD (as per 2012-04). It can manage one stock counter per website view and additionally one “default” stock counter that you can then reference in all websites that should share common stock. So technically it does what you want, yet the problem is that managing the stock information has bad usability: it happen on the per-website-view product forms of the “Inventory” tab when editing a Magento product. So switching to a stock level for a different website requires two clicks and you cannot see all stock levels at once. There’s also no custom report or total sum for seeing all stocks at once. They have an online demo for you to check.
Advanced Product Options. An commercial Magento extension currently available for 139 USD. The purpose is not multi-location stock management, but to some extent it can be used for that because the extension provides stock levels per option value. So one could have a “Buy from location:” option on the product page, with a stock value for each location listed there, and let the customer choose from which one he wants to order. However, this is quite some work and quite confusing for the customer, but there seems to be no integrated way yet to simplify this by tieing specific option values to be auto-selected on specific websites or stores. If you want to hack this, it would work out (adding this is possible, as the extension comes with access to the source).
Unleashed Online Inventory. This is a stand-alone web application that talks to Magento by its API (so, is no extension). Their subscription based pricing starting at 35 USD monthly will probably deter many. But maybe if you use the Xero inventory management solution, this will be for you – because that’s what its made for: a connector from Magento to Xero, though it can also be used without Xero.
Fishbowl EZ Connector with Fishbowl Inventory. Fishbowl is a huge and professional inventory management software that integrates with QuickBooks and starts at ~4400 USD licence costs [source]. While Fishbowl Inventory is a cross-platform software, the EZ Connector seems to be a Windows-only software that syncs Fishbowl inventory levels into Magento and Magento orders into Fishbowl. This will probably work so that the multiple warehouse specific inventory levels of Fishbowl are summed up and transferred that way to Magento, meaning there is no way in Magento to assign an order to a warehouse etc. (would be done in Fishbowl Inventory). Only recommended if you already use Fishbowl Inventory, or plan using it anyway.
Doing several Magento installations. Quite a nightmare to keep up to date, and also it’s much manual work to do stock movements between them.
And finally, here’s the link to the “official” Magento forums thread about the multi-stock feature.
Just posted a short bio on my Edgeryders profile and thought it’s quite funny, so I also post it here. I made the experience that putting your life “as it is”, without elevating yourself, makes for the most cool and readable presentation style (think Cullman Liquidation – they inspired me). Self-appraisal just puts you on par with boring old commercials, but telling them how it is makes people think “Wow, he went through that all and is still an upright man. Respect!” You can also profit yourself from writing it down like that: when reading again and feeling your life reads strange enough to make for a movie, it will help you in all that suffering ;-.)
Hope you have as much fun reading as I have living this
CS studies. In my computer science, I pretty much only appeared at exams (yea I know, quite solitary learning style – distance learning would be my thing, but it wasn’t widespread back then). After the finals two of my profs offered me a PhD option. Yet I declined, even without knowing what to do instead and at all. But some narrow research stuff of their choosing very probably wasn’t it.
On knowing not. So not knowing what to choose next, I simply jobbed part-time as a truck driver for a friend’s company, until after a year he lost the whole trucking contract. By then, living on just a minimal income with plenty of time to think about life, I had finally found what to do with it: “I am here to find out why I’m here”. There was no way for me to circumnavigate the meaning-of-life question. So instead it became my first passion. Here we go.
Umh, why do you call it work “life”? But even the tech monk that I was now needed to earn a living. Continuing extreme aversion to 9-5 nonsensical work left me with few options. I becamse self-employed, avoiding the 9-5, but the nonsense sticked: For a laundry shop, I built digital video surveillance that made the police happy (yikes!). For another customer, the task was to take free software captive by bundling it as a for-sale extension to their app. And I had my fair share of precarious freelance work when some fixed-price web dev projects turned out five times the original effort and got paid years late. I left freelancing in utmost frustration and now work as hopeful co-founder of a collaborative consumption startup (mintybox.com).
Heureka (thank you, economic crisis)! So this is how I stumbled into worklife, while around me, the global economic crisis was going rampant. Together, these ingredients made me think hard and I became obsessed with how to design a society that just works, and the tech to run it sustainably. That’s now my second passion and very much a work in progress, called “EarthOS”. It’s a system orchestrating all the existing free & open ideas so that all aspects of life are served by free, open, P2P tech and services only – see the EarthOS framework and equipment documents. Of course everybody here thinks I’m this crazy utopian
The nomad. And I’m also getting practical with EarthOS stuff from equipment levels 1 and 2, making it the interior for my … well, home. It happened to be cheap, just what I needed at that time: 500 bucks for that freezer box body from a torn-down truck. And a year after, I found a 4×4 firefighter truck chassis from 1968 and bolted the box body to the truck. This combo is street legal now (yay!) and I’m eager to move in, to get going with my meaning-of-life expeditions and further EarthOS prototyping. (And hey, I will always be happy to stop at the door of amazing people. Welcome to drop me a line!)
This should be no problem but it is – because the integrated print feature of the iPad only works with “AirPrint compatible” printers. So what is AirPrint? I don’t care.
We have a network-enabled PCL speaking HP LaserJet 2200dtn printer here and the iPad has to print to this. No AirPrint. PCL. So I looked through all the option for two hours and here are the results.
Recommended options:
- Microtech Corp. ePrint: Available for 2.86 EUR from the App store. Be sure to add the bookmarklet to Safari as mentioned in the ePrint manual in order to have the most comfort for printing web pages.
Not recommended options:
- Wellala Printer Test for Print Magic: Also a stand-alone printing app like ePrint and therefore worth a try (as these seem to be the only such apps). It did print the test page o.k. to the LaserJet 2200 after entering the printer’s IP manually. However it can only print by “copy and paste” and it seems that some formatting (like HTML tables) will get lost doing so [source].
- Printer Pro Lite: Failed to print the test page (printer showed some short flashing of the orange LED and nothing printed).
- EuroSmartz printing apps: They all require a separate server app to be installed on the computer [source], which is unacceptable in our case as no computer might be running.
Problem: When using a PostScript driver, some print jobs are slow on the LaserJet 2200, taking like 125 s from start of transmission to start of printing for a DIN A5 DHL shipping label generated by the DHL Intraship Magento extension. Others are fast as they should, like 7 s for a DIN A4 Magento invoice.
Solution: Use a HP PCL driver instead. This will result in 3-4 s print times for the aforementioned DIN A5 label. This problem should affect all operating systems, as one can configure all of them to use a PostScript driver for printing to this printer. However, it will rarely affect Windows, as most users will use the manufacturer supplied driver there.
To use a PCL driver in Linux, choose the hpijs driver (named “HP LaserJet 2200 Series hpijs, 3.11.7″ in the driver database). Be sure to change “Printer Options: Printout Mode: Normal” to “High Quality” in the printer default properties, accessible from the printer management system tool. Otherwise, the rendering quality will be visibly bad. Even with the “High Quality” setting, this driver will only print with 600 dpi, while the Postscript driver will print with 1200. But that difference is hardly ever noticeable without a magnifying glass.
An alternative is to use the gutenprint-ijs driver (named “Generic PCL 6 PCL XL LF Printer Foomatic/gutenprint-ijs.5.2″ in the driver database). Likewise, set it to “Printer Options: Printout Mode: High Quality” in the printer default properties or it will even have a worse, “fringy” rendering quality than the hpijs driver. It also gives 3-4 s print times for the DHL Intraship labels, but also only achieves 600 dpi.
To use a PCL driver on Mac OS X, use the “Generic PCL” printer driver, not the “HP Laserjet 2200″ one. [TODO: It has to be confirmed that this helps.]
Discussion: This printer understands PostScript Level 2, but only as an emulation. This probably makes processing slow for some elements, maybe the barcodes on shipping labels. Talking to the printer in its native PCL6 language fixes this.
Changes that did not help:
- This problem could not be fixed by choosing “print as image” in the Adobe Reader options. This works, but is even slower than the 125 s print time for a DHL shipping label.
- This problem could not be fixed by sending Postscript Level 3 instead (the LaserJet 2200 only understands level 2, it will not even blink for transmission, and the print job is discarded after a time).
- This problem could also not be fixed by using a Postscript Level 2 driver and adapting the settings from “Resolution: FastRes 1200″ to “600 dpi” and from “Resolution Enhancement: Printer’s Current Setting” to “Off”. Print time was exactly the same 125 s for the DHL shipping label, and print quality was even with magnification hardly any different from the original printouts. Maybe only the “Resolution Enhancement” was disabled, while the “Resolution” setting does not work at all?
- This problem could not be solved by setting the “Total Printer Memory” parameter from “8-15 MB” to “16-23 MB”. (The printer had 16 MB and the idea was, maybe only 8 MB get used with that current setting, as the computer probably cannot determine how much is in the printer.) However, this did not improve printing speed by any means. Print time was exactly the same 125 s for the DHL shipping label.
Changes that might help but have not been tried:
- Pre-processing the PDF label document with a command like ps2ps. This might convert the Postscript elements to others that take less effort to render.
- Adding more memory to the printer. Because maybe the “difficult” Postscript elements just need more memory, not more processing power. And when lacking the proper amount of physical memory, this printer will will automatically compress memory content to be able to process the document [source: HP Manual for this printer]. And this processing will make it take more time, probably.
Currently, there seems to be no way to enable the full 1200 dpi using a PCL driver. The problem is also reported on the driver’s support page.
For those still using the (superseded) M2E version 2 and need to find or do something in its database tables, I have here an explanation of what ot find where.
First name is the real table name in M2E Pro 2.0.13, second name is a more intuitive one proposed by me.
- m2e (m2e_tmpl_projects): Contains listing templates, corresponding to the backend concept of the same name.
- m2epricetemplates (m2e_tmpl_prices): Contains price templates, just as they can be modified in the backend. Note that listing templates contain the price template information redundantly.
- m2etemplates (m2e_tmpl_descriptions): Contains description templates, corresponding to the backend concept of the same name. Note that listing templates contain the price template information redundantly.
- m2e_account (m2e_licences): Contains the licences for the M2E Pro software.
- m2e_account_list (m2e_ebayaccounts): Contains eBay accounts used in M2E Pro.
- m2e_api_versions ():
- m2e_calculated_shipping ():
- m2e_category_version ():
- m2e_currency (): Contains currency abbreviations and their long form.
- m2e_ebay_categories_77 (): The eBay category tree with category numbers, as fetched from eBay.
- m2e_items ():
- m2e_item_specifics ():
- m2e_listings (m2e_projects): Contains listing sets: the things visible immediately when clicking on “M2E Pro -> Listings”. They are called “projects” in the database structure.
- m2e_listing_item_shipping (m2e_listingtmpl_shipping): Contains the shipping methods of listing templates.
- m2e_log (m2e_log_projects): The log of projects, containing eBay API results from listing, deleting etc. the articles of projects.
- m2e_logcleaning_settings (m2e_config_log): Settings when logs should be cleaned automatically.
- m2e_marketplace (m2e_marketplaces): Definitions of international eBay sites.
- m2e_product_to_project (m2e_listings): The actual products contained in projects (“listing sets”), together with their linked eBay items if applicable.
- m2e_p_to_p (m2e_listingtmpl_payments): Contains the payment methods of listing templates. The current name suggests to mean “payment to project”, but that would be wrong: projects are the actual listing sets, not their templates.
- m2e_shedule_task_settings (m2e_config_sync): Configuration saying which sync tasks are enabled.
- m2e_store_management (m2e_config_syncwindow): Configuration which start time to use for the time window when fetching updates from eBay. It will be 24 hours before the last successful sync.
- m2e_synchronization_log (m2e_log_sync): The log of syncing with eBay, as available in “M2E Pro -> Logs -> Synchronization Logs”.
- m2e_templates_descriptions (m2e_tmpl_ebay): eBay’s article templates, as downloaded from them.
- m2e_transactions_events (m2e_log_transactions): The transactions done via eBay, as available in “M2E Pro -> Logs -> Transaction Log”.
|
|