function fn() {
this.a = 0;
this.b = function() {
alert(this.a)
}
}
fn.prototype = {
b: function() {
this.a = 20;
alert(this.a);
},
c: function() {
this.a = 30;
alert(this.a);
}
}
var myfn = new fn();
myfn.b();
myfn.c();
// result
// 0
// 30
2.
function fun(n,o) {
console.log(o)
return {
fun:function(m){
return fun(m,n);
}
};
}
var a = fun(0); a.fun(1); a.fun(2); a.fun(3);
// undefined, 0 0 0
var b = fun(0).fun(1).fun(2).fun(3);
var c = fun(0).fun(1); c.fun(2); c.fun(3);
// undefined, 0, 1,2
// undefined, 0,1, 1,
reference: web.jobbole.com/88041/
Wednesday, September 28, 2016
Thursday, November 5, 2015
odoo db postgres ops, import restore; Odoo development Essentials create odoo serevice; api;
git clone --depth 1 --branch 8.0 https://github.com/odoo/odoo.git odoo8
https://www.odoo.com/forum/help-1/question/website-guest-customer-portal-user-63938
It appears that your package manager failed to create the database named $user for you. The reason that
psql -d template1
works for you is that template1 is a database created by postgres itself, and is present on all installations. You are apparently able to log in to template1, so you must have some rights assigned to you by the database. Try this at a shell prompt:
createdb
and then see if you can log in again with
psql -h localhost
This will simply create a database for your login user, which I think is what you are looking for. If createdb fails, then you don't have enough rights to make your own database, and you will have to figure out how to fix the homebrew package.
http://stackoverflow.com/questions/17633422/psql-fatal-database-user-does-not-exist
\l
on mac,shows a list of the databases,
pg_restore -d odoo8 /Users/jing/Documents/repo/dump/dump.sql
pg_restore: [archiver] input file appears to be a text format dump. Please use psql.
http://stackoverflow.com/questions/21122598/postgres-user-does-not-exist
psql odoo8 < /Users/jing/Documents/repo/dump/dump.sql
role "postgres" does not exist
seems it doesn’t matter all tables database created
Q
the race condition with LESS and viewing the website as a logged in editor while also viewing it as a logged out visitor
API
import xmlrpclib
srv,db = ‘http://localhost:8069', ‘v8dev’
user,pwd = ‘admin’,’jing’
common = xmlrpclib.serverProxy(‘%s/xmlrpc/2/common’ % src)
common.version()
api=xmlrpclib.ServerProxy(‘%s/xmlrpc/2/object’ %srv)
api.execute_kw(db, uid, pwd, ‘res.partner’, ‘search_count’, [[]])
local clone
from stage to the prod site
git clone ~/odoo-dev/odoo ~/odoo-prd/odoo
set up as system service
sudo cp ~/odoo-prd/odoo/debian/init /etc/init.d/odoo
sudo chmod +x /etc/init.d/odoo
open the init, script
sudo ln -s ~/odoo-prd/odoo/odoo.py /usr/bin/openerp-server
sudo chown $(whoami) /usr/bin/openerp-server
create the log file directory
sudo mkdir /var/log/odoo
sudo chown $(whoami) /usr/bin/openerp-server
be able to start /stop odoo service
sudo /etc/init.d/odoo start
being able to get back
when curl http://localhost:8069
ubuntu
easier command to remember:
sudo service odoo start
start auto on system boot
sudo update-rc.d odoo defaults
Monday, October 26, 2015
fix for broken wkhtmltopdf, odoo9, after a while, the confirmation freezed, python shell freeze at wkhtmltopdf;
wkhtmltopdf —version
/Library/Caches/Homebrew/wkhtmltopdf-0.9.9.tar.bz2
rm the above
brew doctor
brew update
then
brew install wkhtmltopdfworksEven in cases where cooperation is intended, misunderstandings and personality incompatibilities can result in an extremely chaotic and hostile environment. Catalysts help prevent and resolve misunderstanding, calm the waters when users have difficulties dealing with each other and provide examples of constructive behavior in environments where such behavior might not otherwise be the norm.reference:https://freenode.net/catalysts.shtml
https://mig5.net/content/adding-yubikey-2-factor-authentication-ssh-and-sudo-debian
PATH=/usr/local/bin;
openerp.addons.report.models.report: Will use the Wkhtmltopdf binary at /usr/local/bin/wkhtmltopdf
- Grab yourself a copy of fresh wkhtmltopdf
- Open it and drag to Applications
- Then
cd /usr/local/bin && ln -s /Applications/wkhtmltopdf.app/Contents/MacOS/wkhtmltopdf wkhtmltopdf reference:http://stackoverflow.com/questions/10375168/how-to-install-and-run-wkhtmltopdf-on-mac-osx-10-7-3-for-use-in-a-php-applicatio
my case,
os 10.10.3
it is installed directly under /usr/local/bin, no need to ln
and this time,
wkhtmltopdf --version
wkhtmltopdf 0.12.2.1 (with patched qt)
this time, checkout confirmation print out fast, no exec pop out, no freeze
symptoms:
after brew uninstall wkhtmltopdf
"No such keg" when uninstalling formula from URL
when instal brew install wkhtmltopdf
Error: MD5 support has been dropped for security reasons.
Please switch this formula to SHA256.
Friday, October 23, 2015
set correct access right to website users
checked out https://apps.openerp.com/apps/modules/8.0/website_sale_suggest_create_account/
This is the user's account page after sign up checkout.
Apps <<'application': true>> in the module definition file (__openerp__.py)
This is the user's account page after sign up checkout.
Apps <<'application': true>> in the module definition file (__openerp__.py)
to make a module importable, need to have __init__.py file
# -*- coding: utf-8 -*-
marker telling python interpreter that this field has UTF-8,
it can expect and handle non-ASCII characters.
safer
1 . remove the public under the user's settings, won't have another sign in after user sign in afready. 2nd time: created via sign up ( template user) also correct, the book says almost every one owns the employee right, while, with employee after sign in, there would be black admin bar on top. newly signed up template users, no. seems, alright. remove the inheritance of own leads, under website user |
web?#page=0&limit=80&view_type=list&model=mail.followers&action=92&active_id=channel_inbox
permission errors, how come a registered user is able to see that page
actually, has only Addresses in Sales Orders, menus has 12 left only pics are the older setting with more accesses
menus of own leads
Wednesday, October 21, 2015
notes of book https://www.packtpub.com/books/content/support/20017
post-mortem:a medical examination of a dead person's body in order to findout the cause of death:
http://dictionary.cambridge.org/dictionary/english/post-mortem?q=mortem
https://docs.python.org/2/library/pdb.html#debugger-commands
odoo.py setup_deps #installs odoo system dependencies
odoo.py setup_pg #installs postgres sql & db superuser for unix user
odoofresh.od.dev
creating a user account for Odoo
linux
apt-get update && apt-get upgrade
apt-get install sudo #make sure sudo is installed
useradd -m -g sudo -s /bin/bash odoo #create an ‘odoo’ user with sudo powers
passwd odoo # ask and set a pwd for the new user
-m create home directory
-g sudo adds it to the shudders list, can run commands as root
-s /bin/bash sets the default shell to bash
whoami
echo $HOME
/Users/Jing
initialize a new odoo db from terminal
postgres super user,
.odoo.py setup_pg
or
sudo createuser —superuser $(whoami)
wile for mac, seems the os admin is by default the super user of postgres,
$createdb v8dev
odoo.py -d v8dev #this will load the demo data, if no,
-- without-demo-data=all
if use VM
- change VM network type from NAT to bridged,
- use NAT, configure port forwarding
$createdb --template=v8dev v8test
create a new db by copying an existing one,make sure do instance is stopped and no connection open on v8dev
template1 is used by default
psql -l
UTF8 defualt
dropdb v8test
set the odoo github repo as upstream,
record in the EHF payable,
on the website, shows, on pdf not showing
everything shows under tax,
while not separated,
./odoo.py --help
session_read
when uninstall the open academy module, the session_read group got removed too
odoo 8
./odoo.py --save --stop-after-init #save config to .openerp-serverrc file
stop after init option, have server stop after it finishes action
run tests/run a module upgrade to check if it installs correctly
Samba: provides linux file sharing services compatible with windows os,
sudo apt-get install samba samba-common-bin
need to register user for file share access
sudo smbpasswd -a odoo
sudo vi /etc/samba/smb.conf
to enable write access
read only = no
sudo /etc/init.d/smbd restart
on windows,
Map network drive
\\192.168.0.2\odoo
(\odoo needed sometimes if sys auto prepended something)
can add the customized location for modules via
--add ons-path=“../department, ./addons”
database mapping mechanism is the ORM
xml -> web client framework -> data-aware html views
************************* magento ******************************
don't save the session it in the db, local.xml it will slow down magentout
PHP Fatal error: Call to a member function insert() on a non-object in /Source/zcoder/magento/app/code/core/Mage/Core/Model/Resource/Resource.php on line 133, referer:
*************************************** db ***************************************************************
The database combines two data structures to meet the challenge: a doubly linked list and a search tree. These two structures explain most of the database’s performance characteristics.
doubly: twice as much, or very much more:
Databases use doubly linked lists to connect the so-called index leaf nodes. Each leaf node is stored in a database block or page; that is, the database’s smallest storage unit. All index blocks are of the same size—typically a few kilobytes.
reference: http://use-the-index-luke.com/sql/anatomy
http://dictionary.cambridge.org/dictionary/english/doubly?q=doubly+
./odoo.py —xmlrpc-port=8070
create multiple odoo9 instances; postgres start stop;
git clone --depth 1 https://github.com/odoo/odoo.git -b 9.0 odoofresh/etc/vhosts add127.0.0.1 http://odoofresh.od.devno restart neededsubdomain is the db name,python openerp-server -c openerp-server.conf
curl -s -D - http://odoo9.od.dev:9069/
Canada - Accounting
first module to install, before install any modulesto be able to check outhttp://odoo.od.dev:8069/ 500 internal server errorthis instance failed due to the messed up steps herechmod +x /usr/local/bin/brew-services.rbbrew services stop postgresqlbrew servicesstart postgresqllunchy start postgreslunchy stop postgres
Tuesday, October 13, 2015
odoo pycharm config, create apache pwd to access the site; multiple dbs with odoo;install multiple odoo instances on local, db filter, subdomain; odoo back end set up
better not use django for ecommerce
for selling digital stuff, like selling how much storage each insitution needs,
need api, use strip
otherwise, for purchasing
for low volume, both are 3%
######################################################################
pycharm, add the /usr/local/bin env path so that the libs installed such as lessc can be found
Odoo 8 can set up configrable public category tree, paypal is fine
######################################################################
encrypt the apache pwd:then put it in to .htpasswd
############### if set up multiple dbs with odoo ###############
do not install ecommerce,
otherwise have to use the dbfilter (conf, regex to call the configs in the /etc/host
in etc/host
have to use the db name as the domain name
do not touch the core:
openerp addons -> base -> res
pycharm: Edit configuration:
script: /user/jing/Sites/odoo/openerp-server
script paramters: -c openerp-server.conf
env path
add PATH=/usr/local/bin
python interpreter ~/Sites/odoo-env
working dir root dir
######################################################################
https://github.com/odoo/odoo.git
multiple installation
git clone --depth 1 https://github.com/odoo/odoo.git odoo9
db name is my subdomain
/etc/hosts
127.0.0.1 odoo.od.dev
127.0.0.1 odoo9.od.dev
add the
db_filter = ^%d$
xmlrpc_port = 9069
proxy not needed, only if behind apache or nginx
into the openerp-server.conf file,
same command to start the server:
loaded the old odoo database
http://odoo9.od.dev:9069/web/database/manager
delete the db,
then create a new db called odour
after wards,
go to the apps backend control panel
search Canada
install Accounting Canada first
######################################################################
cached browsers, clear the cache, then select db first
admin jing
apps: ecommerce
only after install commerce have a front end site to purchase have home page
Add COD and PO number
######################################################################
not restore the db yet:
create a duplicated db:
Applications/pgAdmin3.app/Contents/SharedSupport/pg_dump --host localhost --port 5432 --username “jing" --no-password --format custom --verbose --file "/Users/jing/Documents/odoobackup" "odoo"
http://get.enterprisedb.com/docs/Tutorial_All_PP_pgAdmin_Backup_Restore.pdf
Subscribe to:
Posts (Atom)







