Posts

Showing posts from April, 2014

php - Overide Magento Enterprise Core Observer Method -

im trying on ride several methods located in enterprise_catalog_model_observer class. in core config observer defined <catalog_product_save_after> <observers> <catalog_product_save_custom_redirect> <class>enterprise_catalog/observer</class> <method>saveproductcustomredirect</method> </catalog_product_save_custom_redirect> </observers> </catalog_product_save_after> in enxtension app/code/local/extensioname/redirects/etc/config.xml <?xml version="1.0"?> <config> <modules> <extensioname_redirects> <version>0.1.0</version> </extensioname_redirects> </modules> <global> <models> <extensioname_redirects> <class>extensioname_redirects_model_observer</class&

How can I write a program in Python Dictionary that prints repeated keys values? -

this input: dic1 = {'a':'usa', 'b':'canada', 'c':'france'} dic2 = {'c':'italy', 'd':'norway', 'e':'denmark'} dic3 = {'e':'finland', 'f':'japan', 'g':'germany’} i want output below: {'g': 'germany', 'e': [‘denmark’,’finland'], 'd': 'norway', 'c': ['italy’,'france', 'f': 'japan', 'b': 'canada', 'a': 'usa'} that programing - think steps need desired results, , write code perform these steps, 1 @ time. a funciton can it: def merge_dicts(*args): merged = {} dct in args: key, value in dct.items(): if key not in merged: merged[key] = [] merged[key].append(value) return merged

c++ - Error: expected constructor, destructor, or type conversion before '(' token 2 -

i see common error, didn't see response quite fit. trying compile simple c++ application using dec-c++ under win 10. code included chinese usb i/o module, , need recompile prompts , comments in english. first part easy, google translate, project won't compile, giving subject error. the errors output when compiling included function called main.cpp. offending function below. i sure appreciate here! dave #ifndef _mc100_h #define _mc100_h extern "c"{ // 2013-3-27 #ifndef winapi #define winapi __stdcall #endif #define mc100_porta 0 #define mc100_portb 1 #define mc100_portc 2 // error v here, in _declspec lines _declspec(dllimport) int winapi mc100_scan_device(void); _declspec(dllimport) int winapi mc100_open(int id); _declspec(dllimport) int winapi mc100_close(int id); _declspec(dllimport) int winapi mc100_set_pin(int id, int pin); _declspec(dllimport) int winapi mc100_clear_pin(int id, int pin); _declspec(dllimport) in

My javascript is not working (w jquery as well) -

i not able javascript work html: <div id="tomato"> <body> <button id="totato">total</button> </body> </div> javascript: $(document).ready(function() { $("totato").click = potato(); function potato() { $("tomato").css("background", "red"); } }) you missing # => id selector event binding should implement using .on() expect first argument event , second argument function expression(callback function) note have parenthesis () around function name invoke function when line executed. $(document).ready(function() { $("#totato").on('click', potato); function potato() { $(this).css("background", "red"); } }) <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> <div id="tomato"> <body> <

wordpress - Woocommerce How to hide product tab -

i'm trying hide or remove tab want keep product description. there way this? https://www.absolutept.com/product/electric-stimulation-machine-ev906/ see how word "description" appears - want remove , dot in front of keep else. thanks in advance. you have remove code snippet: <ul class="tabs wc-tabs"> <li class="description_tab active"> <a href="#tab-description">description</a> </li> </ul> that should solve problem.

ios - Can I use Apple Universal Links with HTTP server? -

i have not been able confirm anywhere, maybe here can. know when targeting ios 9+ , using https 1 can implement universal links plaintext app-site-association-file. i know, when supporting handof/shared web credentials, file needs signed. what i'm interested in whether universal links work signed file avaiable via http? for wondering - no cannot. when using signed file (which requirement handoff , shared web credentials in ios 8), connection still needed accesible via https. reference docs : the file must meet following requirements: the file must hosted on https:// site valid certificate (for example, safari must not issue certificate warning when viewing site). the file must not use redirects. the file must have mime type application/pkcs7-mime. the file must cms signed valid tls certificate.

java - Apache POI - Iterating over columns in excel (XSSF) -

this question has answer here: apache poi - java - iterating on columns in excel 1 answer i want program read excel column top bottom, not left right, doing right now. unfortunately, cannot find in documentation lets me this. i have excel file looks this: col1 col2 col3 col4 ----------------------------- row1 | 2,3,1 _ 1 w row2 | 3,2,7 _ 2 x row3 | _ _ 3 y row4 | 4,9 _ 4 z i'm writing values (using xlwt) in column 2 this: col1 col2 col3 col4 ----------------------------- row1 | 2,3,1 x,y,w 1 w row2 | 3,2,7 y,x 2 x row3 | _ _ 3 y row4 | 4,9 z 4 z essentially, column 3 , column 1 being compared, , if cell (1,1) has values matched in column 3, column 4's values (which correspond column

r - finding the previous Monday -

i'm looking way find date object previous calendar week's monday. example, today 1/15/2016; need build function return '2016-01-04 utc' the question asks "previous calendar week's monday". assume below means want monday on or before input date. note better use "date" class since times not needed , "date" class has no time zone avoids potential time zone errors associated "posixt" classes. there nextfri function in zoo vignette, zoo quickref vignette can use basis of similar function. make these changes (1) ceiling replaced floor , (2) 5 (friday) replaced 1 (monday) , (3) add origin= argument to as.date -- if zoo loaded default origin provided origin= argument optionally omitted. this function uses base r , vectorized. accepts "date" class vector , returns "date" class vector of dates monday on or before respective input dates. lastmon <- function(x) 7 * floor(as.nume

php - Visitor CAPTCHA Image Has An Error Revolving Around "fopen", "fputs" & "fclose" -

i've made simple captcha displays total number of visitors of website using 4 files: counter.php , counter.png , counter.txt , , visitor-ip.txt . counter.txt file keeps total number of visitors (1, 2, 10, 20, 140, etc). visitor-ip.txt file keeps track of of visitor's ip address, if return won't counted again. counter.php writes total number of visitors counter.png file. last night every thing worked. won't. 3-4 errors , when check indicated lines, seems normals. errors seems revolve around fopen , fputs , fclose . errors warning: fopen(visitor-ip.txt): failed open stream: permission denied in /users/matthew/sites/counter/counter-1/counter.php on line 24 warning: fputs() expects parameter 1 resource, boolean given in /users/matthew/sites/counter/counter-1/counter.php on line 30 warning: fclose() expects parameter 1 resource, boolean given in /users/matthew/sites/counter/counter-1/counter.php on on line 31 fatal error: call undefined function createcounterimag

java - How to reset Scanner? -

i want read text file , put each line in string (array of strings). requires scanning file twice, 1 figure out how many line there , time create array of strings of size. throws error. , reset method doesn't seem work. filereader read = null; try { read = new filereader("modulesin.txt"); //scan through , make array of strings - each line scanner scan = new scanner(read); while(scan.hasnextline()) { numofmods++; scan.nextline(); } scan.reset(); lines = new string[numofmods]; for(int = 0; < numofmods; i++) lines[i] = scan.nextline(); this sinppet of code relevant. skip using standard array... it's waste of time scan through file , scan through again. use arraylist instead has dynamic size , convert standard array afterwards. bufferedreader in = new bufferedreader(new filereader("path/of/text")); string str;

c# - Create a property name with the same name as a Keyword -

this question has answer here: use long reserved word variable name in c# 5 answers i'm sure question has been asked before, can't find answer need. i creating assembly using c# , 1 of it's structs named need. i'm trying following: internal struct need { internal need how { { return how; } } internal need true { { return true; } } } i want create new property named true. need.true obvious ide doesn't trying create property has same name keyword. the obvious fix change name else, truth, heart tells me that's not should do. this peaked interest. can theoretically created variable (or whatever) , assembly should able figure out variable referring based on context , scope. if like: (pseudo code) create int number create need.int number or

Unable to save the last xml file php -

i new php, , have written code work amazon api. when request information api, receive it, unable sort through xml. here error: fatal error: call member function children() on null in j:\xampp\htdocs\phillip\src\marketplacewebserviceproducts\samples\csv_prep.php on line 117 here code: if(is_array($xmlfiles)){ foreach($xmlfiles $xmlfile){ $xml = simplexml_load_file($xmlfile); foreach($xml->getmatchingproductforidresult $items) { //line 117 -> if(isset($items->products->product->attributesets->children('ns2', true)->itemattributes->listprice->amount) !== false) { $amount = $items->products->product->attributesets->children('ns2', true)->itemattributes->listprice->amount }else{ $amount = '0.00'; } } } } the tag in xml trying value of looks this: <ns2:amount>9.99</ns2:amount> it

jquery - Angular2 - Delete Row Or Column Where the delete button was clicked -

we can delete using jquery, can use angular this? <tr> <td *ngfor="#lev of rubric?.criteria[0].levels"> <button class="close removelevel" (click)="onclickremove($event)">&times;</button> <input type="text" class="form-control" placeholder="performance level" #level="ngform" [(ngmodel)]="lev.level" ngcontrol="level" /> </td> </tr> and in component.ts: onclickremove($event) { } how can access row or cell element here, event raised? from question , want delete row when delete button pressed . in angular way must doing remove record model . pass row id unique ng-controller , remove model. so if have below <td *ngfor="#lev of rubric?.criteria[0].levels"> &

ruby on rails - @Simple_form rendering but not showing *SOLVED* -

i switched rails , started on first application. im struggling bit forms , bootstrap however! says form rendering , im not receiving errors, none of form code showing. im running rails 4.2.5 latest bootstrap-sass , simple_form versions. im not sure whether bootstrap css working @ either, doesnt appear be. been trying different versions, installing , uninstalling , changing code hours canẗ seem working. immensely grateful help! kind regards, jens form (_form.html.erb) code; <%= simple_form_for @book, html: ({ cĺass:'form-horizontal'}) |f| %> <div class = "field"> <%= f.input :title, label: "book title" %> <%= f.input :description %> <%= f.input :author %> <%= f.button :submit %> <% end %> i renamed application.css .scss, contains only; @import "bootstrap-sprockets"; @import "bootstrap"; application.js contains: //= require jquery //= require jquery_ujs //= require bootstrap-sp

android - syntax error while compiling SQLite DB (creating a table) whats wrong with my query? -

public void oncreate(sqlitedatabase db) { string query = "create table " + table_info + "(" + column_id + " integer primary key " + column_date + " text " + column_docname + " text " + column_symp + " text " + column_digno + " text " + column_meds + " text " + ");"; db.execsql(query); what wrong this? getting androidruntime: fatal exception: main android.database.sqlite.sqliteexception: near "date": syntax error: , while compiling: create table info(_id integer primary key date text docname text symp text digno text meds text ); error. please help you have comma missing in query after each column, change query string below: string query = "create table " + t

android - Using shared element transitions from a non-activity class to an activity class -

i have non-activty class (precisely recyclerview adapter holding cardviews), trying use "authentic motion" transition cardview final activity using shared image element. implemented between 2 activity classes non-activity class activity class, unable so? here's code (recyclerviewadapter.java): public class rvadapter extends recyclerview.adapter { public static class personviewholder extends recyclerview.viewholder { cardview cv; textview personname; textview personage; imageview personphoto; textview myid; front ft = new front(); personviewholder(view itemview) { super(itemview); personname = (textview)itemview.findviewbyid(r.id.person_name); personage = (textview)itemview.findviewbyid(r.id.person_age); personphoto = (imageview)itemview.findviewbyid(r.id.person_photo); myid = (textview)itemview.findviewbyid(r.id.idtag); cv = (cardview)itemview.findviewbyid(r.id.cv); cv.setuse

how to install Emacs predictive-mode in Aquamacs? -

i'm trying install emacs predictive-mode, when predictive-mode , loading completion-ui': old-style backquotes detected!` then get: wrong type argument: listp, word backtrace: http://pastebin.com/42nkinyp looks completion-ui might require tiny fix adjust newer emacs you're using. report author of completion-ui (or predictive-mode).

How can i customize GenerateChangePhoneNumberToken in ASP.NET Identity? -

i need customize generatechangephonenumbertoken() , generateemailconfirmationtoken() in asp.net identity 2. how implement it? need generate custom token. can it? no, cannot except replacing complete asp.net identity code yourself. tokens generated , validated according rfc 6238 6 digits used. can refer source code here

verilog - how to force data in design instead of using testbench -

hi guys wondering if there way force bit in design instead of using testbench? verilog code single port ram below how force ram[address] 1000 instead of using testbench? module ram(clk, rst, w, r, data, address, read, read_out); parameter length = 4; parameter depth = 8; input clk, rst, r, w; input [length-1:0] data, address; output [length-1:0] read; output reg[length-1:0] read_out; reg[length-1:0] ram [depth-1:0]; assign read = ram[address]; always@(posedge clk) begin if (!rst) begin if(w) ram[address] <= data; else if (r) read_out <= ram[address]; end else begin if (w) ram[address] <= data; end end endmodule there procedural continuous assignment type of statements have precedence on procedural statements. these assign statements inside always block. referring example in systemverilog lrm 1800-2012 section 10.6, the assign procedural continuous assignment statement shall override procedural assignments variable. deassign

c++ static methods and inheritance in templates with overloading -

it's first post here, have looked answer days, have ask. complex construction. embed spidermonkey javascript engine in illustrator plugin. illustrator has complicate , inconsistent api. in case have call method having short type parameter: namespace ai { ... typedef signed short int16; ... }; the method referred pointer in struct: struct aidocumentsuite { ... aiapi aierr (*getdocumentrulerunits) ( ai::int16 *units ); ... }; but, enum source of parameter: enum aidocumentrulerunitvalue { kunknownunits = 0, /** inches */ kinchesunits, /** centimeters */ kcentimetersunits, /** points */ kpointsunits, /** picas */ kpicasunits, /** millimeters */ kmillimetersunits, /** pixels */ kpixelsunits, /** q units */ kqunits }; i have wrapped these in classes in order have javascript objects managed spidermonkey. have following working call somewhere in code (a bit simplified, cleaned of tests verifications): ai::

php - How to post data using curl and get reponse based on posted data -

here code post data: <?php $data = array("account" => "1234", "dob" => "30051987", "site" => "mytestsite.com"); $data_string = json_encode($data); $url = 'http://mydomain.com/curl.php'; $ch = curl_init($url); curl_setopt($ch, curlopt_customrequest, "post"); curl_setopt($ch, curlopt_postfields, $data_string); curl_setopt($ch, curlopt_returntransfer, true); curl_setopt($ch, curlopt_httpheader, array( 'content-type: application/json', 'content-length: ' . strlen($data_string)) ); $result = curl_exec($ch); curl_close($ch); $json_result = json_decode($result, true); ?> <p>your confirmation number is: <strong><?php echo $json_result['confirmationcode']; ?></strong></p> whereas on domain/server curl.php file code under: <?php // header header("content-type: application/json"); if($_post): echo json_encode(a

ios - How to load and play a list of audio files -

i have 2 view controllers collectionviewchild , imageviewcontroller . load image in imageviewcontroller . on image have button want play specific sound on each image. know how play single audio sound don't know how select specific sound , play required image. // collectionviewchild , here want display image in collectionviewchild func collectionview(collectionview: uicollectionview, didselectitematindexpath indexpath: nsindexpath) { self.performseguewithidentifier("showdetailedimage", sender: self) } override func prepareforsegue(segue: uistoryboardsegue, sender: anyobject?){ if segue.identifier == "showdetailedimage" { let indexpaths = self.collectionviewchild!.indexpathsforselecteditems()! let indexpath = indexpaths[0] nsindexpath let vc = segue.destinationviewcontroller as! imageviewcontroller vc.title = self.tabledata[indexpath.row] vc.image = images[indexp

heroku command not working error Installing core plugins -

i'm keep getting error. have installed heroku toolkit c:\users\hp-u>heroku login submit heroku cli usage information better improve cli user experience? [y/n] y heroku-cli: installing core plugins...error reading plugin heroku-apps. reinstalling... error reading plugin heroku-apps. reinstalling ... error reading plugin heroku-apps. reinstalling i removed s https:// in value https_proxy variable , worked. so: export https_proxy="http://myproxy.com:8080" //instead of export https_proxy="https://myproxy.com:8080" i.e. somehow internal college proxy might not able perform ssl communication

c++ - how to initialize the size of a two dimensional vector -

i trying initialize size of 2 dimensional vector way: vector<vector<int> > a(10, vector<int>) ; but when compile error:expected primary-expression before ')' token why? correct way it? in code vector defined inside structure. realise if define outside of structure problem disappears... why? need define in struct perhaps class inner : public vector<int> { public: inner() : vector<int>(10) { }; }; class outer : public vector<inner> { public: outer() vector<inner>(10) { }; }; then outer a; should work.

php - How to write the Sum() method in zend -

hi beginner zend , need queries . trying write following query in zend gives error saying "unrecognized method sum()" "select tableid , orderid , itemid ,sum(itemqty), rate ,sum(itemqty)*rate amount temporder tableid=3 group itemid" in advance <?php class temporder extends zend_db_table_abstract{ protected $_name="temporder"; public $db; public function init(){ $this->db = zend_registry::get('db'); } public function gettableorder(){ $select = $this->select() ->from($this,array('tableid','orderid','itemid','sum(itemqty)','rate', 'sum(itemqty)' * 'rate' 'amount')) ->where('tableid =3&

vim - when using plugin cvim, \if meas insert a function with comments. but the format is wrong -

well, title says. following looks in c++ source code: 1 2 /* 3 * === function ============================================================= 4 * name: sample_function 5 * description: 6 * ============================================================================= 7 */ 8 void sample_function ( <+argument_list+> ) 9 { 10 return <+return_value+>; 11 } /* ----- end of function sample_function ----- */ when looked c-support/templates/cpp.idioms.template or c-support/templates/c.idioms.template right. it seems when insert template code ,vim format again itself. can me? the automatic indenting interferes way template inserted. should report issue plugin's author. you can temporarily work around problem turning off indenting; dep

java - @RequestMapping("/main") does not work in netbeans spring 4 it is working in spring 3 -

Image
@requestmapping("/main") not work in netbeans spring 4 working in spring 3. same thing when using in spring framework 3.0 compleletly working fine dont know why not working in spring framework 4. when trying open url: http://localhost:8080/anotationmultiactiondemo/main not going open. please me...... dispatcher-servlet.xml <?xml version='1.0' encoding='utf-8' ?> <!-- was: <?xml version="1.0" encoding="utf-8"?> --> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd

php - how to fetch value from array_chunk function -

i'm using array_chunk function: <?php $chunks = array_chunk($coupons, 2,true); ?> @foreach($chunks $k => $c ) @if(2 == sizeof($c)) $c[0]['tr']->coupon_code but blow code not works fine : $c[0]['tr']->coupon_code or $c[0]['tr']['coupon_code'] the content of var_dump($c) : array(2) { [217517]=> array(3) { ["tr"]=> object(stdclass)#71 (30) { ["id"]=> string(6) "217517" ["price"]=> string(5) "14400" ["date"]=> string(19) "2016-01-16 11:13:13" ["user_id"]=> string(5) "16433" ["ip"]=> string(14) "46.225.196.181" ["code"]=> string(13) "5699f4917b9c3" ["succ"]=> string(1) "1" ["admin_seen"]=> string(1) "0" ["user_seen"]=> string(1) "0" ["coupon_id"]=> string(5) "15373"

sql server - UPDATE 2 columns of a table of values from a table -

i have these 2 tables table p | b | c | d ----------------------------- 'abc' | null | 'kkk' | null 'xyz' | null | 'www' | null 'pqr' | null | 'ccc' | null table q x | y ----------------------------- 'abc' | 123 'xyz' | 12 'pqr' | 34 i need update table p column b , d value of y table q long column , c in table p matches values of column x in table q. my update now: update tablep set b = q.y tableq q (nolock) q.x = update tablep set d = q.y tableq q (nolock) q.x = c i know how in 2 update statements, how do in single update statement? you use update join : update p set b = q1.y, --coalesce(q1.y, p.b) if needed d = q2.y --coalesce(q2.y, p.d) tablep p left join tableq q1 on p.a = q1.x left join tableq q2 on p.c = q2.x; livedemo output: ╔═════╦═════╦═════╦═══╗ ║ ║ b ║ c ║ d ║ ╠═════╬═════╬═════╬═══╣ ║ abc ║ 123 ║ kkk ║ ║ ║ xyz ║

python - Why is __init__() always called after __new__()? -

i'm trying streamline 1 of classes , have introduced functionality in same style flyweight design pattern . however, i'm bit confused why __init__ called after __new__ . wasn't expecting this. can tell me why happening , how can implement functionality otherwise? (apart putting implementation __new__ feels quite hacky.) here's example: class a(object): _dict = dict() def __new__(cls): if 'key' in a._dict: print "exists" return a._dict['key'] else: print "new" return super(a, cls).__new__(cls) def __init__(self): print "init" a._dict['key'] = self print "" a1 = a() a2 = a() a3 = a() outputs: new init exists init exists init why? use __new__ when need control creation of new instance. use __init__ when need control initialization of new instance. __new__ first ste

Skipping Read URL data of IP Camera in MS Access Which is not Active C# -

i have problem. have database contains urls of ip cameras. program read of urls database. additionally, exclude urls of cameras inactive. if program connects url of inactive camera, hangs. use emgu cv image processing. these have done. string koneksi = @"provider=microsoft.ace.oledb.12.0; data source=d:\dokumen\alfon\ta alfon\cobafitur\sistemparkir.accdb; persist security info=false"; private void prosessemuakamera() { oledbconnection kon = new oledbconnection(koneksi); oledbcommand commandurl = kon.createcommand(); kon.open(); string selectsemuaurl = "select * datakamera"; commandurl.commandtext = selectsemuaurl; oledbdatareader prosessemuaurl = commandurl.executereader(); while (prosessemuaurl.read()) { capturesemuakamera = new capture(prosessemuaurl["urlkamera"].tostring()); //(352x288) application.idle += processframesemuakamera; prosescapture = !prosescapture; } kon.close();

android - MediaPlayer with seekbar Using Handler not working ?? -

hi trying make simple media player app including seek bar. issue when trying update seek bar goes on, song not running smoothly while seek bar updating. have looked many links on internet cannot resolve problem. please have @ code snippet. paly.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { s_player.start(); handler.postdelayed(new runnable() { @override public void run() { start_time = s_player.getcurrentposition(); s_bar.setprogress(start_time); } }, 500); } });

c - STM32f3 - Multiple ADC -

i have , stm32f3 discovery board, , i'm trying use 4 adc channels. read function: int adc_read(int channel) { adc_regularchannelconfig(adc1, channel, 1, adc_sampletime_7cycles5); adc_startconversion(adc1); while (adc_getflagstatus(adc1, adc_flag_eoc) != set); return adc_getconversionvalue(adc1); } everything goes well, until program stucks in while loop. there way avoid putting adc_flag_eoc in loop? or other way make program work? is far understand depending on version of board using must use adc_softwarestartconvcmd or adc_startconversion . so maybe not starting adc conversion properly, please try this: adc_regularchannelconfig(adc1, channel, 1, adc_sampletime_7cycles5); #if defined(series_stm32f10x) adc_softwarestartconvcmd(adc1, enable); #elif defined(series_stm32f30x) adc_startconversion(adc1); #else adc_softwarestartconv(adc1); #endif while(adc_getflagstatus(adc1, adc_flag_eoc) == reset); return adc_getconversionvalue(adc1);

javascript - Tracking each request logs in Express JS -

i having web application build on node , express in backend. web site having lot of users logs confusing when try debug of logs(console.log) in case of issues. logs clumsy among different users, there way track logs respect request (request id kinda thing)? recommend simple log middleware, example https://github.com/villadora/express-bunyan-logger app.use(require('express-bunyan-logger').errorlogger()); app.use(require('express-bunyan-logger')({ name: 'logger', streams: [{ level: 'info', stream: process.stdout }] })); app.use(require('express-bunyan-logger')({ format: ":remote-address - :user-agent[major] custom logger" }); app.use(require('express-bunyan-logger')(); app.use(function(req, res, next) { req.log.debug('this debug in middleware'); next(); }); you can castumize logger, write difference data file ot stdout.

Build gnome-shell issue: jhbuild does not find libtiff -

i started tinkering gnome-shell kill time , can't jhbuild work! followed instructions on jhbuild guide on gnome-shell wiki . i got part says run $ jhbuild sysdeps gnome-shell . txjoe@superpotato:~$ jhbuild sysdeps gnome-shell system installed packages new enough: libvpx (vpx.pc, installed=1.4.0) speex (speex.pc, required=1.2rc1, installed=1.2rc1) ruby libtool libtool-ltdl [...] gmime (gmime-2.6.pc, required=2.6.6, installed=2.6.20) docbook-xml mtdev (mtdev.pc, required=1.1.1, installed=1.1.5) required packages: system installed packages old: (none) no matching system package installed: libsystemd-journal (libsystemd-journal.pc, required=201) libtiff poppler (poppler-glib.pc, required=0.24.0) optional packages: (jhbuild build missing packages) system installed packages old: libical (libical.pc, required=1.0.1, installed=1.0) webkit (webkit2gtk-4.0.pc, required=2.11.3, installed=2.8.5) no matching sys

json - Java - get the last element in a JsonObject -

i using java pull json object off internet. how last element of json object? the key timecode wondering if possible skip using jsonobject.get(timecode); method , last element of object? this json object returned: {"daily":{"1437436800000":271,"1437523200000":271,"1437609600000":271,"1437696000000":271,"1437782400000":271,"1437868800000":271}} any appreciated thanks ok have found solution. the .keys() method not available me when using gson library. method available in maven repository: org.json @suppresswarnings("unchecked") public static list<object> getlistfromjsonobject(jsonobject jobject) throws jsonexception { list<object> returnlist = new arraylist<object>(); iterator<string> keys = jobject.keys(); list<long> keyslist = new arraylist<long>(); while (keys.hasnext()) { keyslist.add(long.parselong(keys.next

JavaScript array of object -

i have written block of typescript code. createarray():any [] { console.log("start"); var array = []; var nameobjects = ["dave", "mike", "dave1", "mike1"]; (var j = 0; j < nameobjects.length; j++) { (var = 1; < 9; i++) { array.push({ "hour": i, nameobjects }) } } console.log(array); return array; } the output this: { hour: 1, nameobjects :{"dave", "mike", "dave1", "mike1"} }, { hour: 2, nameobjects :{"dave", "mike", "dave1", "mike1"} } ..... {hour: 9, nameobjects :{"dave", "mike", "dave1", "mike1"} } } i want output like: { hour: 1, dave:0, mike:0, dave1:0, mike1:0 }, { hour: 2, dave:0, mike:0, dave1:0, mike1:0 }, i have tried fi

java - What is the purpose of the "client ejb" module that can be generated when creating an ejb project? -

as title says, search can't figure out purpose of th "ejb client" module can generated when creating ejb project , give me tip? thanks quoting netbeans ide documentation: a java ee application client stand-alone application configured work part of java ee enterprise application. java application can access remote ejb methods , web services, not have create java ee application client access enterprise application. advantage of accessing enterprise applications enterprise application clients application clients have access services , functionality running on enterprise application server, while regular java applications not. example, can configure security roles , permissions enterprise application client. so it's regular java application can run inside application server, accessing ejbs, in plain java standalone applications, application server services.

Oracle SQL Search for or find character by its ascii value -

my challenge find characters across multiple tables. at work db set keep date values in columns named d_date, d_inserteby_id, d_valid_to etc. underscore reserved char in sql right, straight forward '%d_%' wont work. so when im looking rows containing reference date have bit more creative '%d_%' i know can: select * table t upper(t.column) '%d_%' escape '\' but how search d , underscore using ascii value? you can't search column name in table it's part of, have @ data dictionary , use dynamic sql if schema changes frequently. you can ... select table_name, column_name all_tab_columns owner = ? -- insert name of table owner , upper(column_name) 'd\_%' escape '\' there's no advantage using ascii value of d in search -- obfuscate code. , escape correct approach. using mixed-case object names considered bad practice in oracle, way. edit: of course if wanted search strings ascii char

python - Append hrefs into list using Beautiful Soup -

using beautiful soup, trying append links on site list following code. however, code seems iterate through link list , add 15 times code iterates through link list on site, output not expected. have advice how adjust code each link appended once? in end, i'd have list containing 15 links. thanks. from bs4 import beautifulsoup import urllib2 url = 'http://www.gks.ru/bgd/free/b00_25/isswww.exe/stg/d000/i000650r.htm' data = urllib2.urlopen(url).read() page = beautifulsoup(data,'html.parser') l=[] link in page.findall('a'): l.append(link.get('href')) print l[0:] based on discussion in comments, appears error include print statement in loop. wanted print of links once @ end, code should be: l=[] link in page.findall('a'): l.append(link.get('href')) print l note need print l . l[0:] equivalent.

rotating an image in a canvas in jquery -

i have canvas , contains 5 images having different id named img1, img2, img3, img4 , img5. using jquery slider. if change rotation in slider image rotated assigned slider. in case, able create multiple sliders if make rotation in 1 of sliders, image having id img5 changing not exact image slider. in short, sliders assigning last image. code like: $('.slider').slider({ orientation : 'horizontal', max:180, min:-180, value:0, id:objid, slide: function(event, ui) { var $this = $(this); /* change rotation , register value in data object when stops */ draggable_elem.css({'-moz-transform':'rotate('+ui.value+'deg)','-webkit-transform':'rotate('+ui.value+'deg)'}); $('.degrees',$this).html(ui.value); }, stop:function(event, ui) { newobject.rotation = ui.value; } }); whereas objid id of image. please advice, how distinguish image 1 slider. in advance.

python - Mean line on top of bar plot with pandas and matplotlib -

Image
i'm trying plot pandas dataframe, , add line show mean , median. can see below, i'm adding red line mean, doesn't show. if try draw green line @ 5, shows @ x=190. apparently x values treated 0, 1, 2, ... rather 160, 165, 170, ... how can draw lines x values match of x axis? from jupyter: full code: %matplotlib inline pandas import series import matplotlib.pyplot plt heights = series( [165, 170, 195, 190, 170, 170, 185, 160, 170, 165, 185, 195, 185, 195, 200, 195, 185, 180, 185, 195], name='heights' ) freq = heights.value_counts().sort_index() freq_frame = freq.to_frame() mean = heights.mean() median = heights.median() freq_frame.plot.bar(legend=false) plt.xlabel('height (cm)') plt.ylabel('count') plt.axvline(mean, color='r', linestyle='--') plt.axvline(5, color='g', linestyle='--') plt.show() use plt.bar(freq_frame.index,freq_frame['heights']) plot ba

angularjs - Angular 2 component two-way databinding with objects -

i'm experimenting angular 2 beta , want use semantic ui dropdown control angular 2 component. http://semantic-ui.com/modules/dropdown.html#converting-form-elements my small sample project here: https://github.com/unki23/angular2semantic/ i've wrapped inside angular 2 component 'uiselectcomponent' can see here: https://github.com/unki23/angular2semantic/blob/master/src/app/components/ui-select.component.ts any other component should use uiselectcomponent passing 2 objects: array holding possible choices , optional pre-defined selected choice. i've made interface choice 'selectoption' has 2 properties 'value' (number) , 'displayvalue' (string). component should used this: https://github.com/unki23/angular2semantic/blob/master/src/app/components/app.component.html first question: want achieve is, pre-selected option passed uiselectcomponent, user selection changes option and option should change selected object parent compo

javascript - SyntaxError: Unexpected token true in html generated by ruby -

why getting error: syntaxerror: unexpected token true in line $('#atp_13').append("<a data-remote="true" rel="nofollow" data-method="delete" href="/clots/test/unjoin"><i class='icon-check clot-unfollow-icon'></i></a>)"); i m generating using $('#<%= "atp_#{@atp.id}" %>').append("<%= link_to unjoin_atp_path(@atp), :method => :delete, remote: true %><i class='icon-check clot-unfollow-icon'></i><% end %>)"); $("#atp_<%=@atp.id %>").append("<%= escape_javascript(link_to unjoin_atp_path(@atp), :method => :delete, remote: true %><i class='icon-check clot-unfollow-icon'></i><% end %>)"); escape_javascript used escape rails helper methods replaced in page. you can move link_to tag partial file make clean, , can call partial name in js.erb file. $("

fb.ui feed picture not showing when posting to facebook new design -

i see common problem caused several reasons, i'm not sure case. js code post on users wall simple , straight forward, , has been working far no problem (about 6 month in use): fb.ui( { method: 'feed', name: 'some text', link: 'https://apps.facebook.com/myapp', picture: 'http://mydomain.com/content/images/theimage.png?v=123', caption: 'my caption', actions: [ { 'name': 'play now' , 'link': 'https://apps.facebook.com/myapp' }], description: 'my description', ref: 'my ref' }, function (response) { } ); i've switched facebook account new design (2013), , on feed these publishes appear without image. checking account running previous design, these publishes shows correctly correct image. so, it's not facebook cache, , it's not code. facebook bug? other ideas?

python - Run many simulations simultaneously -

i want run many random deposition simulations in order analyze statistics. the individual simulations aren't dependent on each other, each produces 1-d numpy array , want result 2-d array composed of these 1-d arrays. i know nothing parallel computing have have 2 ideas how achieve this: simple for-loop take days run (i'm not in hurry after all) run same file many, each shorter for-loop, let os take care of distributing cpu power among runs , join files after finished however, think there must better way this. current code following: l = 60 n = 100 t = 100 hrubost_relax = np.zeros((n,t)) n in range(0,n): level = np.zeros((t,l)) heights = np.zeros(level.shape[1]) t in range(1,level.shape[0]): pos = np.random.randint(level.shape[1]) left = heights[pos-1] if pos-1>0 else heights[-1] right = heights[pos+1] if pos+1<l else heights[0] if left<heights[pos]: if right<heights[pos]: d

android - Error when adding two Mats in OpenCV, Java -

i writing opencv based image processing algorythm thresholding. algorythm written here in c++ language , rewriting in on java , android studio. in 1 line, have add 2 mat (opencv matrix) objects. in c++ res=img+res; , in java core.add(imgmat, res, res); . @ line error, cannot solve: cvexception: /volumes/./././././././arithm.cpp:639: error: (-209) operation neither 'array op array' (where arrays have same size , same number of channels), nor 'array op scalar', nor 'scalar op array' in function void cv::arithm_op(...) in code below see, both mat objects have same size , has same format (cvtype) too. again, how code looks in c++, can see in this question . my code (java): public bitmap thresholding(bitmap bitmap) { mat imgmat = new mat(); utils.bitmaptomat(bitmap, imgmat); imgmat.convertto(imgmat, cvtype.cv_32fc1, 1.0 / 255.0); mat res = calcblockmeanvariance(imgmat, 21); core.subtract(new matofdouble(1.0), res, res); core.add(

javascript - Access / process (nested) objects, arrays or JSON -

i have (nested) data structure containing objects , arrays. how can extract information, i.e. access specific or multiple values (or keys)? for example: var data = { code: 42, items: [{ id: 1, name: 'foo' }, { id: 2, name: 'bar' }] }; how access name of second item in items ? preliminaries javascript has 1 data type can contain multiple values: object . array special form of object. (plain) objects have form {key: value, key: value, ...} arrays have form [value, value, ...] both arrays , objects expose key -> value structure. keys in array must numeric, whereas string can used key in objects. key-value pairs called "properties" . properties can accessed either using dot notation const value = obj.someproperty; or bracket notation , if property name not valid javascript identifier name [spec] , or name value of variable: // space not valid character in identifier names