Setup Script throws Error : Call to undefined method Mage_Core_Model_Resource_Setup::addAttribute()

I am following a tutorial from the book of Roman Zenner & Vinai Kopp called “Magento – The Handbook for Developers” (german: Magento – Das Handbuch für Entwickler).

It says that I need this setup script:

<?php /**  * @var Mage_Sales_Model_Mysql4_Setup $  installer  */  $  installer = $  this; $  installer->startSetup();  Mage::Log("Setup Script is getting executed.", 7, "setup.log");  $  installer->addAttribute('quote_item', 'shipping_surcharge', array(         'label' => 'Versandkostenaufpreis'         ,'type' => 'decimal'     ) );  $  installer->endSetup(); 

But I get a 500 Status Code Error and the error “Call to undefined method Mage_Core_Model_Resource_Setup::addAttribute()” is getting logged.

Snippet from config.xml

<config>     <modules>         <WR_EPO>             <version></version>         </WR_EPO>     </modules>     <global>         <resources>             <wr_epo_setup>                 <setup>                     <module>WR_EPO</module>                 </setup>             </wr_epo_setup>             ... 

Is the tutorial outdated? How to do it right?

[ Politics ] Open Question : Isn’t everything we call communism actually just socialism cause communism is a pipe dream that will never actually exist?

Literally all those totalitarian governments from the 20th century were socialist. Fascism was literally created by socialist, both fascism and socialism can be right or left wing. They all centralized the economy, some might let people operate privately but it was all owned by the state and they owned the means of production, exchange and distribution as even Mussolini explained. Fascism “Together we are stronger like a bundle of sticks” the essence of what socialism is all about, COLLECTIVISM. These idiots who call themselves socialists today would be purged by their own dictatoral government or forced to work in work camps >The Soviet Union >Cuba >China >National Socialist Germany >East Germany after it was split by ideological lines >Camodia >Vietnam >North Korea which is still very much a socialist government just with a juche ideology

Is there an app that allows an iPhone-to-iPhone local network call with shared music?

My wife and I started going to a gym recently. We each have our own separate workouts and we listen to music through our earbuds. We realized though that this has reduced our evening chat time, so I had this idea to “call” each other to idly (verbally) chat during our separate workouts at the gym. And I was wondering if it was possible for us to listen to the same music as we chat. I’ve tried a bunch of different searches, but the best I can figure is that we can make an actual phone call and listen to our own separate music. We have unlimited plans, so that’s a possibility, but I think it would really be nice if we were listening to the same music (with independent volume control, i.e. voice versus music). Is there an app that will do this, ideally just over a local network (as opposed to making a call that routes through a cell phone tower or some internet service)?

What would be the best place for sharing Call for Papers for NEW Academic Journal about UX and Urban Creativity?

The journal of User Experience & Urban Creativity (UXUC) is concerned with improving the experience of living in cities. Although all UX disciplines focus on improving designs for people to use, the human experience of the built environment is of crucial importance because a majority of people now live in an urban or suburban environment.

Worldwide, there are a myriad urban design approaches in cities both modern and ancient. People inhabit, decorate, customize, modify, and fit their environment to their purposes. We aim to cross-pollinate, across cultures, across time, and thus to help envision more human-centered cities.

We invite case studies, theoretical explorations, stories from UX practitioners, best practices, cautionary tales, and practical approaches for improving human-city interaction and the urban environment. We are interested in photo essays, architectural drawings, lessons from history, first-person accounts and interpretations, academic research, information about urban design working groups, articles on techniques, methodologies, explorations of bad design, before-and-after transformations, policy and politics of urban design change, and philosophical principles for urban (re)design and usability.

Call for Papers 2019, Theme: Urban User Experience: How can cities become better human habitat?

More info:

Call JavaScript dynamically on Visual Web Part

I currently have a visual web part that displays clocks from different time zones, using the jClocksGMT library as provided here in the .ascx file. However, instead of hardcoding the timezones I want to be able to pass the correct GMT values from the .ascx.cs file and have the clocks update accordingly. However I can’t seem to find a straight answer for how to do this. How is it done?

Here is an example of the code from my .ascx file:

<!doctype html> <html>     <head>         <title>jClocksGMT v. 2.0</title>                 <style>             body { font-family: Arial, sans-serif; }         </style>          <script src=""></script>         <link rel="stylesheet" href="http://dev/Style%20Library/jClocksGMT-master/css/jclocksGMT.css"/>         <script type="text/css" src="https://dev/Style%20Library/jClocksGMT-master/css/jClocksGMT.css"></script>         <script type="text/javascript" src="https://dev/Style%20Library/jClocksGMT-master/js/jClocksGMT.js"></script>         <script type="text/javascript" src="https://dev/Style%20Library/jClocksGMT-master/js/jquery.rotate.js"></script>     </head>     <body>         <div id="clock_city"></div>         <script>             $  (document).ready(                  function () {                     $  ('#clock_city').jClocksGMT(                     {                         title: 'City, USA',                         offset: '-7' // <-- Value I want to change via .ascx.cs file                         //imgpath: 'http://dev/Style Library/jClockGMT-master/'                     });                  }             )         </script>     </body> </html> 

Passport Received at Gerry but I haven’t got any call for collection

Have any experienced delays while getting a call from Passport collection offices? I got an email from UKVI Abu Dhabi on Thursday, Jan 10th, 2019 that my application has been issued, then I got a confirmation message on Jan 11th, 2019 that we have received your processed application at Gerry’s.

I was hoping a call on Friday but didn’t get any and now its almost 2 hours left in Gerry Office timings and I haven’t got any call and when I call them they provide a generic response that we can not track your application so you need to wait for the call.

Let me know if this is common?


How to call a cdef method

I’d like to call my cdef methods and improve the speed of my program as much as possible. I do not want to use cpdef (I explain why below). Ultimately, I’d like to access cdef methods (some of which return void) that are members of my Cython extensions.

I tried following this example, which gives me the impression that I can call a cdef function by making a Python (def) wrapper for it.

I can’t reproduce these results, so I tried a different problem for myself (summing all the numbers from 0 to n).

Of course, I’m looking at the documentation, which says

The directive cpdef makes two versions of the method available; one fast for use from Cython and one slower for use from Python.

and later (emphasis mine),

This does slightly more than providing a python wrapper for a cdef method: unlike a cdef method, a cpdef method is fully overridable by methods and instance attributes in Python subclasses. It adds a little calling overhead compared to a cdef method.

So how does one use a cdef function without the extra calling overhead of a cpdef function?

With the code at the end of this question, I get the following results:

def/cdef: 273.04207632583245 def/cpdef: 304.4114626176919 cpdef/cdef: 0.8969507060538783 

Somehow, cpdef is faster than cdef. For n < 100, I can occasionally get cpdef/cdef > 1, but it’s rare. I think it has to do with wrapping the cdef function in a def function. This is what the example I link to does, but they claim better performance from using cdef than from using cpdef.

I’m pretty sure this is not how you wrap a cdef function while avoiding the additional overhead (the source of which is not clearly documented) of a cpdef.

And now, the code:

from setuptools import setup, Extension from Cython.Build import cythonize  pkg_name = "tmp"  compile_args=['-std=c++17']  cy_foo = Extension(         name=pkg_name + '.core.cy_foo',         sources=[             pkg_name + '/core/cy_foo.pyx',         ],         language='c++',         extra_compile_args=compile_args, )  setup(     name=pkg_name,     ext_modules=cythonize(cy_foo,                           annotate=True,                           build_dir='build'),     packages=[         pkg_name,         pkg_name + '.core',     ], )

def foo_def(n):     sum = 0     for i in range(n):         sum += i     return sum 


def foo_cdef(n):     return foo_cy(n)  cdef int foo_cy(int n):     cdef int sum = 0     cdef int i = 0     for i in range(n):         sum += i     return sum  cpdef int foo_cpdef(int n):     cdef int sum = 0     cdef int i = 0     for i in range(n):         sum += i     return sum

import timeit from import foo_def from tmp.core.cy_foo import foo_cdef from tmp.core.cy_foo import foo_cpdef  n = 10000  # Python call start_time = timeit.default_timer() a = foo_def(n) pyTime = timeit.default_timer() - start_time  # Call Python wrapper for C function start_time = timeit.default_timer() b = foo_cdef(n) cTime = timeit.default_timer() - start_time  # Call cpdef function, which does more than wrap a cdef function (whatever that means) start_time = timeit.default_timer() c = foo_cpdef(n) cpTime = timeit.default_timer() - start_time  print("def/cdef:") print(pyTime/cTime) print("def/cpdef:") print(pyTime/cpTime) print("cpdef/cdef:") print(cpTime/cTime) 

C++ – Call a specific function after inactivity of a period

I’m trying to get mind around this problem. Possibly I may be taking an incorrect approach.

I would like to make a dog detector so if a dog hasn’t hasn’t been for 10 second (inactivity), the program would turn off a light. The idea is to run a specific function after a specific period of inactivity based on an if condition.

The goal is to run this code without interfering with the main program. I understand i could use threads. However, my current approach is still interferes my program /sensors.

My Approach (pseudo-code)

if(detect_object == dog){   std::cout << "Dog detected";   }else{ 

std::this_thread::sleep_for(std::chrono::seconds(10)); //Turn light off

//If Dog is not detected after 10 seconds. After waiting 10 seconds turn light off. Without delaying the the program std::cout << "Dog not detected, turning light off";   } 

Thank you!