Posts

Showing posts from March, 2013

javascript - Karma + PhantomJS TypeError: undefined is not an object (evaulating scope.jackpot) -

i still new unit testing, , honest, there isn't think of testing, cannot build app unless have @ least 1 test case, attempted make simple test case could, on smallest block of code in controller, , doesn't seem working. i believe it's error in test case, , not in controller's code itself, because when view app in browser grunt serve console shows no errors. this error gives me: phantomjs 2.1.1 (linux 0.0.0) controller: mainctrl should attach list of jackpot scope failed /home/elli0t/documents/yeoman projects/monopoly/app/bower_components/angular/angular.js:3746:53 foreach@[native code] foreach@/home/elli0t/documents/yeoman projects/monopoly/app/bower_components/angular/angular.js:323:18 loadmodules@/home/elli0t/documents/yeoman projects/monopoly/app/bower_components/angular/angular.js:3711:12 createinjector@/home/elli0t/documents/yeoman projects/monopoly/app/bower_components/angular/angular.js:3651:22 workfn@/home/elli0t/documents/yeoman projects/monopoly/app

google play - Application not found on Android TV -

i have app created android tv cannot discover on nexus player when try search in google play store. application has been approved distribution on android tv still not discoverable. any ideas wrong manifest/distribution options causes app filtered out on nexus player devices? make sure mention tv supports leanback: <uses-feature android:name="android.software.leanback" android:required="true" /> and app not require touchscreen: <uses-feature android:name="android.hardware.touchscreen" android:required="false" /> without manifest tags play store may not show app

Objects in Java is printing out junk -

my program simple program involves use of objects. there no errors problem program printing out junk. after asked user name, age , , gender. down below 2 sets of programs. first 1 object or skeleton of person. second 1 print asks user name age gender , prints out. public class person { private string name; private int age,personality,appearance; private string gender; //constructor method. use once public person(string nm, int ag,string gend) { name=nm; age=ag; gend=gender; personality=1+(int)(math.random()*10); appearance=1+(int)(math.random()*10); } //accessor created public string getname() { return name; } public string getgend() { return gender; } public int getint() { return age; } //mutator method. when using "void" no return type public void setname (string nm) { name=nm; } public void setage (int ag) {

osx - Clozure CL : an error occurs when requiring Cocoa framework -

i'm trying require cocoa framework on mac os x 10.11.4, cannot require it. log: $ ccl --version version 1.11-r16635 (darwinx8632) $ ccl welcome clozure common lisp version 1.11-r16635 (darwinx8632)! ? (require :cocoa) :cocoa ("ide-bundle" "objc-package" "sequence-utils" "name-translation" "objc-clos" "objc-runtime" "bridge" "objc-support" "compile-hemlock" "hemlock" "cocoa") ? unhandled exception 10 @ 0x992bb43c, context->regs @ #xbfffdbcc exception occurred while executing foreign code @ _class_initialize + 9 received signal 10; faulting address: 0xbf7ffffc ? [6330] clozure cl kernel debugger: ^ckilled: 9 how solve this? use 64-bit version $ ccl64 --version version 1.11-r16635 (darwinx8664) $ ccl64 welcome clozure common lisp version 1.11-r16635 (darwinx8664)! ccl developed , maintained clozure associates. more information ccl visit http:/

Matlab - How to create logical array matrix without looping -

this question has answer here: creating indicator matrix 5 answers i want following: y = [1; 2; 3]; x = repmat(1:10, 3, 1); i=1:3 x(i,:) = x(i,:) == y(i); end so end x = 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 is there way without looping? if start 1:10 vector, using bsxfun : y = [1; 2; 3]; x = bsxfun(@eq, y, 1:10); otherwise repmat : y = [1; 2; 3]; x = repmat(1:10, 3, 1); x = repmat(y, 1, size(x,2)) == x; (or ones suggested leo .)

submit ID using multiple checkboxes in PHP HTML Mysql -

i using multiple html checkboxes submit student attendance. checkbox once clicked submit '1' , if not checked, submit '0'. able submit '1' when checked cant submit '0'. below code: <?php $subcheck = (isset($_post['subcheck'])) ? 1 : 0; $date = date("y/m/d"); foreach ( $student $attendance ) { echo "<tr>"; echo "<td>$attendance->id</td>"; echo "<td>$attendance->name</td>"; echo "<td> $attendance->classroom_id </td>";?> <input type="hidden" name="date[]" value="<?php echo $date;?>" /> <td><input type="checkbox" name="status[]" value="<?php echo $attendance->id;?>"></td> <td>

carousel - What do we call the `bottom bar` of an HTML image slider? -

Image
english second language , don't know how call bottom bar @3 in below snapshot - bottom navigator guess? when need know specific term of thing website, can check source code (right click → inspect element) term revealed class name or similar. far can tell don’t have one definitive name, each site , each carousel library has own name them. these acceptable names: carousel indicators carousel controls carousel dots ( owl carousel ) dot navigation carousel bullets (on shouldiuseacarousel.com )

shell - How to execute more than one command in terminal over SSH? -

i'm connecting raspberry pi model b running raspbian via ssh. i'm trying program script run several commands continuously; want these 2 commands run along side each other: arpspoof -i wlan0 -t 192.168.1.1 192.168.1.100 arpspoof -i wlan0 -t 192.168.1.100 192.168.1.1 does putting 1 command after in shell script allow them both run together? you can use nohup run these commands together, i.e: nohup arpspoof -i wlan0 -t 192.168.1.1 192.168.1.100 > /var/log/logfile1 & nohup arpspoof -i wlan0 -t 192.168.1.100 192.168.1.1 > /var/log/logfile2 &

sql - Case condition does not return desirable results -

here query: select accounttitle, case when sourcedocdr < 1 replace(cast(sourcedocdr int), 0, '') else sourcedocdr end 'debit', case when sourcedoccr < 1 replace(cast(sourcedoccr int), 0, '') else sourcedoccr end 'credit' tblaccounting_gl month(postingdate) = month(getdate()) group accounttitle, sourcedocdr, sourcedoccr; result else statement: +----------------------------------+---------+--------+ | account title | debit | credit | +----------------------------------+---------+--------+ | accounts payable | 0.00 | 100.00 | | accounts receivable -vat | 0.00 | 300.00 | | cash in bank bpi mia road - php | 2600.00 | 0.00 | +----------------------------------+---------+--------+ result without else statement: +----------------------------------+-------+--------+ | account title | debit | credit | +----------------------------------+-

java - How to access the subclass using jsoup -

i want access webpage: https://www.google.com/trends/explore#q=ice%20cream , extract data within in center line graph. html file is(here, paste part use.): <div class="center-col"> <div class="comparison-summary-title-line">...</div> ... <div id="reportcontent" class="report-content"> <!-- tag handles report titles component --> ... <div id="report"> <div id="reportmain"> <div class="timesection"> <div class = "primaryband timeband">...</div> ... <div aria-lable = "one-chart" style = "position: absolute; ..."> <svg ....> ... <script type="text/javascript"> var chartdata = {...} and data used stored in script p

osx - productbuild path ignored on install -

i have osx application built qt. codesigned, packaged fit macstore , has been approved apple , ready sale in mac store. though after installing it, installed location residing during packaging process instead of /applications. alternatively i'm creating .dmg package of file, can install /applications. at end of build procedure i'm running these commands: codesign --force --deep --verify myapp.app/ --entitlements ${instdir}/entitlements.plist -s "3rd party mac developer application: company name" productbuild --component myapp.app /applications --sign "3rd party mac developer installer: company name" myapp.pkg the result of pkg, i'm attempting install via installer: $ sudo installer -store -pkg myapp.pkg -target / installer: note: running installer admin user (instead of root) gives better mac app store fidelity installer: myapp.pkg has valid signature submission: 3rd party mac developer installer: company name (key) installer: installatio

python - Converting rows in pandas dataframe to columns -

i want convert rows in foll. pandas dataframe column headers: transition area 0 a_to_b -9.339710e+10 1 b_to_c 2.135599e+02 result: a_to_b b_to_c 0 -9.339710e+10 2.135599e+02 i tried using pivot table, not seem give result want. i think can first set_index column transition , transpose t , remove columns name rename_axis , last reset_index : print df.set_index('transition').t.rename_axis(none, axis=1).reset_index(drop=true) a_to_b b_to_c 0 -9.339710e+10 213.5599

mysql - i want to translate SQL to DQL -

i want translate sql statement dql ? have user entity -------user-------- id username email password ... -------------------- and friend entity wich have 2 attribute friend_one , friend_two reference user ------friend---- id friend_one friend_two statu -------------- so sql statement update friend set status="1" (friend_one="$user_id" or friend_two="$user_id") , (friend_one="$friend_id" or friend_two="$friend_id") select 'friend_one','friend_two','status' friend (friend_one="$user_id" or friend_two="$user_id") , (friend_one="$friend_id" or friend_two="$friend_id") select f.statu, u.username, u.id user u, friend f case when f.friend_one = '$user_id' f.friend_two = u.user_id when f.friend_two= '$user_id' f.friend_one= u.user_id end , f.statu='1' any please :/ good have tried far?

python - Sympy and lambda functions -

this question has answer here: how create list of python lambdas (in list comprehension/for loop)? 8 answers i want generate list of basic monomial x^0 x^n (in particular, n=9) using sympy. quick solution simple list comprehension combined python's lambda function syntax: import sympy sym x = sym.symbols('x') monomials = [lambda x: x**n n in range(10)] however, when verify monomials constructed expected, find that: print([f(x) f in monomials]) >>> [x**9, x**9, x**9, x**9, x**9, x**9, x**9, x**9, x**9, x**9] if redefine monomials without using lambda syntax, otherwise expect: monomials = [x**n n in range(10)] print(monomials) >>> [1, x, x**2, x**3, x**4, x**5, x**6, x**7, x**8, x**9] why behavior? specs : python 3.5.1 sympy 1.0 i using anaconda 2.5.0 (64-bit) package manager. you need use second arg defa

node.js - ExpressJS uncaughtException: [TypeError: opt.expires.toUTCString is not a function] -

i'm getting following weird behaviour happens randomly , can't reproduce can "fix". i have static webapp send file express api. i'm not sure it's best practice on router: router.get('/', function(req, res, next) { var webappdir = path.join(__dirname, '..', '..','webappsimple'); //show user profile if(req.isauthenticated() || consts.webapp.debug == 1) { res.sendfile(webappdir + '/index.html'); //res.json({}); } //show signup else { res.redirect('/signup'); } }); then following error: 'typeerror: opt.expires.toutcstring not function', ' @ object.serialize (/users/andreymigalovich/projects_localmac/print-that-sheet/server/node_modules/express/node_modules/cookie/index.js:135:56)', ' @ serverresponse.res.cookie (/users/andreymigalovich/projects_localmac/print-that-sheet/server/node_modules/express/lib/response.js:804:36)', ' @ serverresponse.res.writ

java - Android Intent ACTION_GET_CONTENT does not return extension of file -

i trying path of file selected user, using calling intent action_get_content result. the problem when selecting audio file file manager, intent not return extension of file (which there in file name checked it). in case of video or image working fine. here code: intent calling: intent intent = getintent(); if(intent.getaction() == null) { if(build.version.sdk_int >= build.version_codes.kitkat) intent = new intent(intent.action_open_document); else intent = new intent(intent.action_get_content); intent.settype("*/*"); intent.addcategory(intent.category_openable); startactivityforresult(intent.createchooser(intent, "select file upload"),cloudconstants.cloud_request_file_chooser); on result code: if (data != null) { //get uri data intent - uri of file chosen user in //file picker urifileuri = data.getdata(); if(urifileuri != null && build.version.sdk_int >= build.version_codes.kitkat)

java - JPQL Query doesn't work -

hello wanna try to run query update warmtimemonitoring wtm set wtm.warmtime = (extract(hour current_timestamp - wtm.entrydate)*60)+ extract(minute current_timestamp - wtm.entrydate ) wtm.leavingdate null when try query right on database works update warmtime_monitoring w set w.warm_time = (extract(hour current_timestamp - w.entry_date)*60)+ extract(minute current_timestamp - w.entry_date) leaving_date null; if try jpql following error: exception occurred while performing database query: illegalargumentexception-> exception occurred while creating query in entitymanager: exception description: syntax error parsing [update warmtimemonitoring wtm set wtm.warmtime = (extract(hour current_timestamp - wtm.entrydate)*60)+ extract(minute current_timestamp - wtm.entrydate ) wtm.leavingdate null ]. [68, 85] left expression not arithmetic expression. [131, 148] left expression not arithmetic expression. can explain me why happens , how can fix it? and yes ch

windows - How to right click from javascript -

it seems not possible emulate right click in javascript. i have tried right click element (paragraph) in iframe this: html <button onclick="popup_context_menu_in_iframe()"> popup menu </button> <br/><br/> <iframe srcdoc="<p>hello world!</p>"> </iframe> script function popup_context_menu_in_iframe() { var $element = $('iframe').contents().find('p'); var element = $element.get(0); if (window.customevent) { element.dispatchevent(new customevent('contextmenu')); } else if (document.createevent) { var ev = document.createevent('htmlevents'); ev.initevent('contextmenu', true, false); element.dispatchevent(ev); } else { // internet explorer element.fireevent('oncontextmenu'); } } https://jsfiddle.net/sca60d64/2/ it seems impossible make context menu appear need find other ways. i first headed @ creating chrome exten

javascript - How to decrease the zoom level of google-map loaded in iframe -

i loading map iframe. in iframe code corresponding map present. iframe loaded dynamically in zoom effect not present. want control zoom effect of map in case. know if map directly loaded can control "z" factor in link. if in iframe map code present how control on zoom factor of map. <iframe src="<?php echo $file_name; ?>" width="100%" height="700px;" frameborder="0"></iframe> this code of line , $file_name html file load dynamically. map.setzoom(zoom:number) check link gmap options

visual studio 2010 - WIN32 Preprocessor definition in 64bit windows platform -

should change preprocessor definition win32 win64 while migrating visual 2012 c++ projects target 64-bit platforms. now have built project below settigns machine (specify target platform) set /machine:x64 . target environment set /env x64 in c/c++ project settings -> code generation, struct member allignment 8 bytes please guide me else project settings should target change. did mean _win32 , _win64 macros? if specified parameters right (see p.s.) don't need change code. in 64-bit solution must defined _win32 , _win64 both. _win32 macro specifies can use win32 api , _win64 macro specifies compilation 64-bit mode. can use different macro itanium (_m_ia64) , x86-64 (_m_amd64). see details in msdn . p.s. did choose platform parameters manually? can specify via vs: 1. build menu -> configuration manager. 2. select new in active solution platform. 3. type or select new platform -> x64 , click ok. 4. in "platform" row can simple choose x6

jquery - Text after "<" symbol gets truncated -

this question has answer here: how display text tags in jsp 3 answers i found problem setting value in jsp. have element stored in database, if provide value "phenom<name" in database saves "phenom<name" .but while displaying data user text after "<" symbol gets truncated , displays "phenom<" instead of "phenom<name" you need escape it.. <c:out value="phenom<name" /> or ${fn:escapexml('phenom<name')} or "phenom&lt;name"

storage - SCSI to NVME Translation -

we developing application manage nvme devices in windows 10. not supposed use our own driver talk drives, sending of commands, have rely on whatever available windows 10. for commands security receive , security send , using support of scsi-nvme translation, in scsi command sent host , translated nvme command scsi kernel stack, , sent drive. we can see commands reaching drive, translation not able send correct namespace identifier drive in case of security receive command, , therefore, scsi returning error in sense data access denied, invalid lu identifier . scsi-nvme translation not allow setting namespace identifier field in cdb. there other way setting namespace identifier in scsi command sending host side? or driver error sending incorrect data drive? other apis of microsoft (like storage query property) set namespace id themselves, , don't have set user side. if has worked in similar kind of environment, can out, helpful. this interesting question,

sql server 2008 - Prevent table from adding more than a row -

in way of implementing configuration table, table suppose have 1 row @ time. is there way in sql server 2008 prevent table adding more row? any ideas? add static, computed, column , make unique. alter table mytable add uniquekey 1 persisted constraint uq_mytable_uniquekey unique if adds row, cause unique constraint violation

jsf - How to conditionally render or style a row of primefaces dataTable? -

Image
inside p:datatable , trying render rows need. code: <h:form id="f"> <p:datatable var="order" value="#{mbordercontroller.orderslist}"> <f:facet name="header">#{msg.orders}</f:facet> <p:column sortby="#{order.ordernr}" headertext="#{msg.order_number}"> <p:outputlabel value="#{order.ordernr}" rendered="#{order.type.label == 'shoes'}" /> </p:column> <p:column sortby="#{order.date}" headertext="#{msg.date}"> <p:outputlabel value="#{order.date}"> <f:convertdatetime pattern="dd.mm.yy" /> </p:outputlabel> </p:column> <p:column sortby="#{order.type.label}" headertext="#{msg.type}"> <p:outputlabel value="#{o

coding style - C++ Picking a type for a constant -

so on regular bases seems find type of constant declared (typically integer, other things strings) not ideal type in context being used, requiring cast or resulting in compiler warning implicit cast. e.g. in 1 piece of code had below, , got signed/unsigned comparison issue. static const int max_foo = 16; ... if (container.size() > max_foo) {...} i have been thinking of using smallest / basic type allowed given constant (e.g. char, unsigned char, const char* etc rather int, size_t , std::string), wondering if idea, , if there places potentially bad idea? e.g. code using 'auto' keyword (or perhaps templates) getting small type , overflowing on appeared safe operation? going smallest type can hold initial value bad habit. invites overflow. always code general (which according murphy's law worst) case. templates generalize things, makes worst case lot worse. prepared bizarre kinds of overflows , avoid negative numbers while unsigned types in neighborho

Jupyter Notebook: command for save the current notebook? -

i can automatically save notebook html after running code. however, results generated quick, output html not have output in last cells. i'm wondering, if possible tell file save itself? something # in last cell current_filename = 'my_file.ipynb' save_current_notebook(current_filename) output_html(current_filename) now can away with: display(javascript("ipython.notebook.save_notebook()"), include=['application/javascript'])

Maintaining two almost identical gits, one commit apart? -

i working on project , have 2 branches configured it: 1 connected remote server , other connected local server. the difference between 2 several lines of code, indicating server address , desired port. want keep 2 branch identical possible difference being connection settings (a single commit). doing git rebase time tedious, , couldn't find convenient way it. possible? thanks!! the difference data (not code). should in separate file (or in case, maybe environment variable) can stored separately. keep code base same.

python - Plotting mysql data on a real time graph using pyplot -

plotting mysql data on real time graph using pyplot hi everyone, reading in advance. i've been working on mysql database, adding sample every few seconds sensor, , create table every one, tables don't become huge. i've done this, want know plot last 15 recent samples database, last 15, use query extract data mysql: "select columnname tablename id > ((select max(id) tablename) - (15 + 1)) order id asc;" here's code: #!/usr/bin/python # -*- coding: utf-8 -*- import mysqldb, time, locale, datetime, pyoo, random, os.path, matplotlib matplotlib import pyplot plt itertools import chain subprocess import popen import rpi.gpio gpio import mysql.connector import numpy np locale.setlocale(locale.lc_all, '') def informacion(): info_dato = round(random.uniform(1,5),2) info_dia = time.strftime('%a') info_fecha_hora = time.strftime('%y-%m-%d %h:%m:%s') info_lugar = 'cd python' return i

Powershell: Display last X lines of a log that match a criteria and keep watching the file -

i trying watch log file occurrences of word ("purge"). want display last 10 matching lines (at time command runs) , keep watching file newly appended lines match criteria. so far, got something working powershell: get-content .\callaudit.engine.log -tail 10 -wait | {$_ -match "purge"} this works, gets last (any) 10 lines , applies filter. i want get matching last 10 lines have command keep watching file. can done? -tail 10 won't because purge -filter executed after has read last 10 lines (which may or may not contain purge ). i split 2 calls. 1 list last 10 values, , 1 monitor. get-content -path .\callaudit.engine.log | where-object {$_ -match "purge"} | select-object -last 10 get-content -path .\callaudit.engine.log -wait -tail 0 | where-object {$_ -match "purge"}

setfocus - Set focus on dataTable in javascript -

<table id="table-dispatch" class="display data-table" cellspacing="0" width="100%" onclick="showrequestmap()"> <thead> <tr> <th> id </th> <th> status </th> <th> client </th> <th> client phone number </th> <th> dispatch date </th> <th> driver </th> <th> distance </th> <th> current location </th> <th> estimated fare </th> <th> action </th> </tr> </thead> <tbody> <tr> <td>5</td> <td> waiting pickup </td> <td> raj </td> <td> 85115 </td> <td> apr 18, 2016 7:07 pm </td> <td&g

Ruby on rails and a replicated MySQL instance -

[disclaimer: i'm wearing devops hat, isn't full-time hat. don't have ror hat, best.] i have ror application runs in several data centres. mysql lets me replicate data dc's, 1 instance of mysql writeable. (yes, there techniques replicate master, don't believe ror maintains necessary contracts safely. maybe i'm wrong.) most of time, ror reading mysql, faster if tell ror use local mysql instance except when needs write something. or maybe i'm looking @ problem incorrectly , can tell mysql mean. (indeed, perhaps right thing set mysql proxy instance , tell it read/write splitting.) one solution create 2 different connections same class, 1 connection connect writeable db, , other readable db. keep original db connection class, create readable-only class, you'll have 2 different classes defined: class example < activerecord::base end class readexample < activerecord::base establish_connection configurations['read_exampl

c++ - I am attempting to create a strtok function from scratch using arrays -

i not sure go here. trying strtok function scratch using arrays. wanted store each token in temp array, print it, , keep doing many tokens array have. instance, string such "this fab" wanted "this", copied on temp until delimiter( null, or space or character) encountered. printed. final result of should have been: this \n is \n fab \n does have insight. char strtok( char s[], char key) { char find; char temp[100] = " "; int = 0; while( s[i] != '\0') { i++; for(; s[find] != key && s[find] != '\0'; find++) { temp[i]= s[find]; } cout<<endl; } for( int x = 0; temp[x] != '\0'; x++) { cout<<temp[x]; } cout<<endl; } standard strtok defined follows: char *strtok(char *str, const char *delim) for homemade version, must return char* . example below similar standard version uses char delimiter. see example of strtok in fir

word 2003 VBA code not working in word 2007 -

friends, trying disable display alerts while using printout command. code isn't working runtime error like'read only', 'word converter','invalid reference type'. suppress errors. code below confirm how code same word in 2007, works okay in word 2003. if optcentral.value = false set oprint = getobject(lbxresults.list(varloop)) end if end if if optcentral.value = true 'do nothing, copied elseif optptrover.value = true oprint 'store existing print settings bvaluestoreufap = .application.options.updatefieldsatprint bvaluestoreulap = .application.options.updatelinksatprint bvaluestoredisplayallerts = .application.displayalerts 'change print settings, stops unwanted pop-up boxes .application.options.updatefieldsatprint = false .application.options.updatelinksatprint = false .application.displayalerts = wdalertsnone 'print document .print

android - Setting title for listview -

i have android app should parse data php web page , display them 2 listview, each listview display values of string my problem how set titles these listviews? public class mainactivity extends activity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); new getdata().execute(); } private class getdata extends asynctask<void, void, void> { progressdialog progressdialog; string data; list<string> r = new arraylist<string>(); list<string> r2 = new arraylist<string>(); arrayadapter<string>adapter=new arrayadapter<string>(getapplicationcontext(), android.r.layout.simple_list_item_1,r); arrayadapter<string>adapter2=new arrayadapter<string>(getapplicationcontext(), android.r.layout.simple_list_item_1,r2); listview list = (listview)findviewbyid(r.id.right); listview list2= (listview)findviewbyid(r.id.left); p

c# - Why IList<T> inherits IEnumerable<T> and IEnumerable again -

i have taken on ilist<t> , icollection<t> on msdn chance, , see definition of these 2 interfaces are: public interface icollection<t> : ienumerable<t>, ienumerable public interface ilist<t> : icollection<t>, ienumerable<t>, ienumerable notice icollection<t> inherits ienumerable<t> , ienumerable , that's okay. ilist<t> inherits icollection<t> , why ilist<t> has inherit ienumerable<t> , ienumerable again? any there reason this? the documentation generated way can see interfaces type implements without having follow transitive links through interface inheritance hierarchy.

How to access parent Iframe from JavaScript -

well, have iframe, calls same domain page. problem want access information parent iframe called page (from javascript). how can access iframe? details: there several iframes one, can have same page loaded, because programming windows environment. intend close iframe, that's why need know should close inside him. have array keeping references these iframes. edit: there iframes generated dynamically also can set name , id equal values <iframe id="frame1" name="frame1" src="any.html"></iframe> so able use next code inside child page parent.document.getelementbyid(window.name);

magento - how to call phtml file in controller? -

i need show minicart in topbar when user click on add cart. have created file named topcart.phtml @ location app/design/frontend/default/mytheme/template/checkout/cart/mycart.phtml. now calling block in controller file , returning response show mini cart. $sidebar_block = $this->getlayout()->getblock('mycart'); $sidebar = $sidebar_block->tohtml(); $response['sidebar'] = $sidebar; but showing error "fatal error: call member function tohtml() on non-object " in controller file. do need call mycart.phtml file in layout or other location? mycart.phtml <?php $_cartqty = $this->getsummarycount() ?> <div class="shoppingcart"> <div class="fadelink"> <div class="shopping_cart_mini hidden-phone hidden-tablet <?php if(!$_cartqty) echo 'empty'; ?>"> <div class="close1">x</div> <div class="inner-wrapper&

hql - How to write a query in hibernate for count(*) -

i want execute below query in hibernate ? select count(*) login emailid='something' , password='something' suppose login table mapped loginclass class, emailid , password instance variables. you'll execute like: query query = session.createquery( "select count(*) loginclass login login.emailid=:email , login.password=:password"); query.setstring("email", "something"); query.setstring("password", "password"); long count = (long)query.uniqueresult(); it should return in count result you're looking for. have adapt name class , parameter names.

How to extract data from a json object in android -

in application receiving json object {"secquelist":{"1":"which favorite book?","2":"who childhood hero?","3":"what pet's name?","4":"what make first car or bike?","5":"what favorite color?","6":"which favorite sports team?","7":"what name of school?","8":"what mother's maiden name?","9":"which birthplace?","10":"which favourite sport?","11":"which favourite place of visit?"},"que1":null,"ans1":null,"message":null,"fielderrors":null} i not able figure out how should parse object. tried using below code not jsonarray throws exception. string getparam(string code, string element){ try { string base = this.getitembyid(code); jsonobject product = new jsonobject(base); jsonarray jarray

c# - Issues converting Adobe Ai and Psd files using Magick -

i'm using magick convert adobe files (pdf, ai, psd) png images , works fine except ai files can take on minute convert , psd files lose shape when converted, layers laid out side side instead of overlaying each other. code using.. magickreadsettings settings = new magickreadsettings(); settings.density = new density(300); using (magickimagecollection images = new magickimagecollection()) { images.read(file, settings); using (magickimage horizontal = images.appendhorizontally()) { file = path + "\\" + thumbnailfolder + "\\tempthumb.png"; horizontal.write(path + "\\" + thumbnailfolder + "\\tempthumb.png"); } } are there changes can make in settings fix these issues? i've had fix issue want share in case has similar problem. firstly .ai files taking long because of detailed resolution set out in settings, reduce resolution , created faster. secondly, psd files being created because i'm app

Keep list index number unchanged after removing NULL and character[0] in R -

Image
is there way in r keep index number same before, while removing null , character[0] element list. example: ld: [[1]] [1]"d2hgdh" [[2]] character(0) [[3]] character(0) [[4]] [1] "tnf" "il6" "cxcl1" [[5]] character(0) [[6]] character(0) [[7]] [1] "icam1" [[8]] null than removing null , character[0] using following code. #remove character 0 element rmchar <- lapply(seq(ld) , function(x) ld[[x]][!ld[[x]] == "character(0)" ]) # remove null is.nullob <- function(x) if(!(is.function(x))) is.null(x) | all(sapply(x, is.null)) else false rmnullobs <- function(x) { x <- filter(negate(is.nullob), x) lapply(x, function(x) if (is.list(x)) rmnullobs(x) else x) } rmnull <- rmnullobs(rmchar) so after running index changed like: [[1]] [1] "d2hgdh" [[2]] [1] "tnf" "il6" "cxcl1" [[3]] [1] "icam1" which don't want. want index number same in lis

GWT RequestFactory throws java.lang.UnsupportedOperationException: <Proxy interface class> from ValueCodex.getTypeOrDie -

in our application need share domain code between gwt client , server. because of using common interfaces gwt proxies , server-side entities. approach once described @thomas-broyer here: https://stackoverflow.com/a/15852887/187241 exception stacktrace: error com.google.web.bindery.requestfactory.server.simplerequestprocessor - error while processing request java.lang.unsupportedoperationexception: se.homework.hwbs.domain.shared.model.iappointment @ com.google.web.bindery.autobean.shared.valuecodex.gettypeordie(valuecodex.java:388) @ com.google.web.bindery.autobean.shared.valuecodex.decode(valuecodex.java:312) @ com.google.web.bindery.requestfactory.shared.impl.entitycodex.decode(entitycodex.java:107) @ com.google.web.bindery.requestfactory.server.simplerequestprocessor$3.visitreferenceproperty(simplerequestprocessor.java:633) @ com.google.web.bindery.autobean.vm.impl.proxyautobean.traverseproperties(proxyautobean.java:370)

java - JList render invisible "selection marker" -

the jlist supports multiple selection when holding control key: press ctrl+up/down move invisible marker (nimbus laf). if no press space, element gets selected. example: jlist has 3 elements, first 1 selected. know press ctrl + down, ctrl + down , space. last element selected. the question is: how can render invisible marker move ctrl+up/down? for example windows file explorer renders marker dotted border , render similar. thing ctrl + up/down don't change selection change element selected/deselected if press space. defaultlistcellrenderer automatically using special border. if want change border, can change appropriate setting of l&f in uimanager . import java.awt.basicstroke; import java.awt.color; import java.awt.component; import javax.swing.jframe; import javax.swing.jlist; import javax.swing.jscrollpane; import javax.swing.swingutilities; import javax.swing.uimanager; import javax.swing.border.strokeborder; public class listtryout { public st

c - Unexpected output on initializing array by using both "Element-by-Element" & "Designated" techniques together -

c99 provides feature initialize arrays using both element-by-element & designated method as: int a[] = {2,1,[3] = 5,[5] = 9,6,[8] = 4}; on running code: #include <stdio.h> int main() { int a[] = {2,1,[3] = 5,[0] = 9,4,[6] = 25}; for(int = 0; < sizeof(a)/sizeof(a[0]); i++) printf("%d ",a[i]); return 0; } ( note element 0 initialized 2 , again initialised designator [0] 9 ) expecting element 0 (which 2 ) replaced 9 (as designator [0] = 9 ) , hence o/p become 9 1 0 5 4 0 25 unfortunately wrong o/p came; 9 4 0 5 0 0 25 any explanation unexpected o/p? the process of initializing array initializer basically: set index counter 0, , initialize entire array 0s go through initializer elements left right if initializer element has designated index, set index counter designated index store initializer element value @ index given index counter increment index counter go step 3

Convert the date (start and stop) to a time interval so I can compare using Python -

hello working .csv file contains birth date , death date of presidents. problem trying solve year year presidents alive. assume this, have convert dates of birth , deaths of presidents time series , presidents alive, have have death dates changed present time. know can go doing using python , packages - pandas , numpy? here code have far: also date in format: feb 22 1732 if president hasn't died death date blank #!/usr/bin/python #simple problem: find year presidents #were alive import pandas pd import numpy np #import presidents.csv , save dataframe presidents = pd.read_csv('presidents.csv') #view first ten lines of dataframe presidents.head(10) #change column names remove whitespace presidents.columns = ['president','birth date','birth place','death date','location of death'] #save column names of dataframe list columns_of_pres = list(presidents.columns) #create data frame contains name, birth , death date of president

Create a text file in Google Glass -

i able install native apps in google glass now. hope know how create text file using native apps in google glass can save data text files. thanks! since glass android device , writing native android apps it, should able write text files on other android device. the android documentation on data storage should helpful.

eclipse(set with scala envirnment) : object apache is not a member of package org -

Image
as shown in image, giving error when importing spark packages. please help. when hover there, shows "object apache not member of package org". searched on error, shows spark jars has not been imported. so, imported "spark-assembly-1.4.1-hadoop2.2.0.jar" too. still same error.below want run: import org.apache.spark.{sparkconf, sparkcontext} object abc { def main(args: array[string]){ //scala main method println("spark configuration") val conf = new sparkconf() conf.setappname("my first spark scala application") conf.setmaster("spark://ip-10-237-224-94:7077") println("creating spark context") } } adding spark-core jar in classpath should resolve issue. if using build tools maven or gradle (if not should because spark-core has lot many dependencies , keep getting such problem different jars), try use eclipse task provided these tools set classpath in project.

html - How to get all alt attributes of all img tags using jQuery -

my html code: <img src="" alt="google.com"> <img src="" alt="gmsil.com"> <img src="" alt="gmail1.com"> how alt values of img tag? try : can make use of attr() method of jquery object. iterate images , call $(this).attr('alt'); alt attribute value. $(function(){ $('img').each(function(){ alert($(this).attr('alt')); }); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <img src = "" alt="google.com"> <img src = "" alt="gmsil.com"> <img src = "" alt="gmail1.com">

android - Plot Projects - exit geofence occasionally not triggering -

i'm using plot projects service send geofencing notifications users of ios , android application. there seems strange situation happening, notification linked exit event on geofence not triggered. user enters geofence, gets enter notification (which different notification exit one, on same geofence , same configuration except trigger , custom data), after leaving geofence exit notification not triggered. i'm using notification filter , application, when receiving "silent" notification, contacts back-end (by making api call), , depending on response shows notification or ignores it. although app logs not accessible @ time when happens, can deducted back-end logs call has never reached back-end api. mean "silent" notification has either never been triggered (meaning geofence exit not recorded plot projects sdk reason), or has been triggered reason not handled app. having in mind proper exit notifications occasionally, i'm not sure in-app problem

swift - Xcode 7.3 update error: "Use of unresolved identifier WLHttpMethodGet" -

i'm developing native ios swift application mobilefirst backend, , have integrated therefore mobilefirst api in xcode project. since latest update xcode 7.3 , swift 2.2 i'm getting error: " use of unresolved identifier wlhttpmethodget" when calling adapters though wlhttpmethodget method in code: let request = wlresourcerequest(url: nsurl(string: "/adapters/sampleadapter/adaptermethod"), method: wlhttpmethodget) request.setqueryparametervalue("...", forname: "..") request.sendwithcompletionhandler { ( response: wlresponse, error: nserror) -> void in if(error != nil){ ... } else if(response != nil){ ... } } specifically in line: let request = wlresourcerequest(url: nsurl(string: "/adapters/sampleadapter/adaptermethod"), method: wlhttpmethodget) is there existing solution issue? this defect in product discovered using latest swift

c++ - Exclude logging from function -

i've encountered problem multiple times. there "smart" way exclude logging functions? if there logical check (if/else) before logging happens. have if/else excluded too. example: return_value = init_winsock(); if( return_value != 0 ) { cout << "(" << __filename__ << ":" << __line__ << "): "; errorcode_to_string( __function__ ); } else { cout << "(" << __filename__ << ":" << __line__ << "): " << "info: winsocked started" << endl; } socket = socket( af_inet, sock_dgram, 0 ); if( socket == invalid_socket ) { cout << "(" << __filename__ << ":" << __line__ << "): "; errorcode_to_string( __function__ ); } else { cout << "(" << __filename__ << ":" << __l