Posts

How to tell magento that I use different theme directory? -

i'm newbie magento. downloaded module created , want modify it. have problem when change theme directory. magento reads older directory. has product view. i try edit the, let's say, abcd.xml file inside layout folder from <reference name='product.info'> <action method='settemplate'><template>histheme/template/catalog/product/view.phtml</template></action> </reference> <reference name='product.info.addtocart'> <action method='settemplate'><template>histheme/template/catalog/product/view/addtocart.phtml</template></action> </reference> to line this <reference name='product.info'> <action method='settemplate'><template>default/mytheme/template/catalog/product/view.phtml</template></action> </reference> <reference name='product.info.addtocart'> <action method='settemplate'>...

Getting a list of values from a list of dict in python: Without using list comprehension -

i have list of dict example, [{'id': 1l, 'name': u'library'}, {'id': 2l, 'name': u'arts'}, {'id': 3l, 'name': u'sports'}] now, have retrieve following list dict without using list comprehension [u'library', u'arts', u'sports'] is there way achieve in python? saw many similar questions, answers using list comprehension. any suggestion appreciated. in advance. you use itemgetter : from operator import itemgetter categories = map(itemgetter('name'), things) but list comprehension too. what's wrong list comprehensions?

c# - How to use Substring , to return an integer of all the values after the first char -

i have string assetnumber have following format c100200. need folloiwng:- get characters after first (e.g. 100200 using above example) convert substring integer return integer + 1 but not know how use sub-string characters after first char, , how convert string int? on appreciated. var result = int32.parse("c100200".substring(1)) + 1; if have default value, if can't parse current string: int result; if (!int32.tryparse("sdfsdf".substring(1), out result)) { result = 42; } result+=1;

response object in scrapy not complete -

sorry if question stupid couldn't find answer yet. i trying prepare script extract data website using "scrapy shell" command : using web browser entering url (e.g. " http://www.testsite.com/data_to_extract "), data extract. page contains static data + dynamic data. using command "scrapy shell http://www.testsite.com/data_to_extract " , issuing command ("view(response)"), see in web browser static data of page not dynamic data. what suspect web server serves first static data fills-in dynamic data in page. guess managed through javascript on web page. if understanding correct, needs happen scrapy needs wait little bit before returning result. could me here ? thanks ! here working example using selenium , phantomjs headless webdriver in download handler middleware. class jsdownload(object): @check_spider_middleware def process_request(self, request, spider): driver = webdriver.phantomjs(executable_path='d:...

c# - PropertyChanged event not Handled properly -

i'm trying property changed event handler working, , i've checked dubugger onpropertychanged method being called, it's not invoking method expecting to. public class mainviewmodel : observableobject { public mainviewmodel() { _characterselection = new characterselectionviewmodel(); _characterselection.propertychanged += new propertychangedeventhandler(characterselection_propertychanged); } private void characterselection_propertychanged(object sender, propertychangedeventargs e) { if (e.propertyname.equals("character")) { _character = _characterselection.character; _currentview = _newcharacter; onpropertychanged("currentview"); } } } [serializable] public class observableobject : inotifypropertychanged { public event propertychangedeventhandler propertychanged; // create onpropertychanged method raise event protected void onpropertych...

linux - Android Screenshot and Screencap Permissions -

i'm trying take screensshot on adb logged root , i'm getting "permission denied" error. screenshot -i /sdcard/screen.png error: writing file /sdcard/screen.png: permission denied but if use screencap works. screencap -p /sdcard/screen.png why happening ? according source code screenshot sets uid aid_shell (shell user) before writing file: /* switch non-root user , group */ gid_t groups[] = { aid_log, aid_sdcard_rw }; setgroups(sizeof(groups)/sizeof(groups[0]), groups); setuid(aid_shell); png = fopen(outfile, "w"); if (!png) { fprintf(stderr, "error: writing file %s: %s\n", outfile, strerror(errno)); exit(1); }

java - How do I prompt a user until they enter a valid integer? -

valid integer being letter. don't know command make check strings, nor know find it. appreciated. import java.util.scanner; public class stringtest{ public static void main(string[] args) { scanner input = new scanner(system.in); int test = 10; while (test>0){ system.out.println("input maximum temperature."); string maxtemp = input.nextline(); system.out.println("input minimum temperature."); string mintemp = input.nextline(); } } } use nextint() next integer value. should try/catch in case user types non-integer value. here's example: scanner input = new scanner(system.in); // infinite loop while (true){ system.out.println("input maximum temperature."); try { int maxtemp = input.nextint(); // todo whatever need max temp } catch (throwable t) { // todo handle better t.printstacktrace(); break; ...