Posts

Showing posts from June, 2012

ios - Can we create subdivisions of #pragma mark in Objective C? -

Image
we using #pragma make code more readable, accurate , separated groups. for example: i'm using #pragma below: //--------------------------------------------------------------- #pragma mark #pragma mark prefrences methods //--------------------------------------------------------------- however there wondering, can create sub section of #pragma in can divide in 1 more layer. like have lots of related methods below: you can see these preference related methods , can not divide other #pragma . just want know whether there constants in xcode #subpragma or can divide #pragma ? possibility: category: #pragma mark #pragma mark level 1 the 2 lines (two #pragma mark ) create "separator". subcategory: #pragma mark — sublevel the single line (one #pragma mark ) give title. used — change "indent" of text. sample: render: code: #pragma mark #pragma mark life cycle -(id)init { self = [super init]; if (self) {

Python - Get total amount of bytes used by files -

i'm trying total amount of bytes used files. what i've got far following. def getsize(self): totalsize = 0 size = 0 root, dirs, files in os.walk(r'c:\\'): files in files: size = os.stat(files).st_size totalsize = totalsize + size however, when running this, following error pops filenotfounderror: [winerror 2] system cannot find file specified: 'hiberfil.sys' does know how can fix error , correctly calculate total bytes on disk? edit: after looking @ more, came following code. def getsize(): print("getting total system bytes") data = 0 root, dirs, files in os.walk(r'c:\\'): name in files: data = data + getsize(join(root, name)) print("total system bytes", data) however following error. permissionerror: [winerror 5] access denied: 'c:\\programdata\microsoft\microsoft antimalware\scans\history\cachemanager\mpscancache-1.bin' this m

vmware - Unable to delete Snapshot from Snapshot Manager in Virtual machine -

i have virtual machine many snaps. when going delete of snap snapshot manager shows error the virtual machine template , not allow me delete snap. can 1 tell me why has been happened? there 1 problem, in snapshot manager if check checkbox show autoprotect snapshots shows many hidden shapshots. how can delete snapshots? any type of suggestion or can appreciated. the following kb should assist in changing template vm http://kb.vmware.com/selfservice/microsites/search.do?language=en_us&cmd=displaykc&externalid=1004538

php - Route "does not exist" in Symfony even though it's declared in main routing file -

here contents of relevant files : contents of app/config/routing.yml : horse_route: path: /horse defaults: { _controller: appbundle:horse:show } app: resource: "@appbundle/controller/" type: annotation contents of src/appbundle/controller/walruscontroller.php : <?php namespace appbundle\controller; use sensio\bundle\frameworkextrabundle\configuration\route; use symfony\component\httpfoundation\response; use symfony\bundle\frameworkbundle\controller\controller; class walruscontroller extends controller { /** * @route("/walrus/red") */ public function walrusredirect() { return $this->redirecttoroute('/horse', array(), 301); } } contents of src/appbundle/controller/horsecontroller.php : <?php namespace appbundle\controller; use sensio\bundle\frameworkextrabundle\configuration\route; use symfony\component\httpfoundation\response; use symfony\bundle\frameworkbundle\con

makefile - Why GNU Make's secondary expansion does not work with pattern rules for dependencies? -

consider makefile: %: %.c @echo making $@ @touch $@ .secondexpansion: %.pid: $$(basename $$@) $(<d)/$(<f) --pidfile=$<.pid here, first rule builds program , second rule starts it, producing pid-file. note: know secondary expansion unnecessary in example; real makefile more complex , need secondary expansion there. so, typing make foo.pid , expect make build foo foo.c first rule , run ./foo --pidfile=foo.pid second one. however, not seem work: $ make -f makefile.test foo.pid make: *** no rule make target 'foo.pid'. stop. this somehow relates secondary-expanded dependencies provided pattern rules. if write either %.pid: % in second rule (i. e. rid of secondary-expansion), or foo: %: %.c in first rule (i. e. write explicit static pattern rule), it works. why? limitation of gnu make? in case, i'd avoid pre-listing possible programs in first rule. i think situation described in section 10.5.5 match-anything pattern rule

R recycling process -

please see snippet below: x <- c(23,43,54,75,76,6,87,5,43,234,2) y <- c(1,2,23,43,54,75,76,6,87,1) z <- x + y the snippet gives me warning message.when try add x , y as: #warning message: #in x + y : longer object length not multiple of shorter object length however when add: x <- c(3,4,5,8) y <- c(1,3) z <- x + y z no error message thrown , r recycles perfectly. why? first of all, important notice warning , , not error . in either case, no error thrown , vectors added. concerning absence of warning in second example, warning message states reason quite clearly: object length not multiple of shorter object length in second example, length of x twice length of y , is multiple (in contrast first example, yields warning). hence, no warning given in second example when vector y recycled.

parsing - ANTLR for IntelliJ 15 -

i trying use antlr4 plug-in intellij create simple expression analyzer. have seen few websites , questions don't seem able running. have watched this video still error can't load hello lexer or parser does have way of using antlr create grammar , using standard input or text file input test grammar , print out. trying take infix expression , convert postfix expression. also there way use intellij write, compile , run program rather swapping command line? thank you. i ran same problem. installed antlr plugin intellij 15. created java project called antlr, , created example hello.g4 text file right-clicking on src directory node , selecting new->file. once grammar typed hello.g4, compiled right-clicking on hello.g4 tab , selecting compile "hello.g4", created template files in directory "gen". i wasn't able figure out how run grun example in antlr4 reference, "hello parrt" parsed , analyzed. instead, turns out if right

java - how can add two login in one web application? -

i'm working on web application spring. should able access user , admin. user login implemented spring-security. web-security.xml <?xml version="1.0" encoding="utf-8"?> <beans:beans xmlns="http://www.springframework.org/schema/security" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemalocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd

jquery - Function getting called twice on mouse click event -

i calling function uploads image on mouse click as: <img type="file" id="uploadlogo" ng-click="triggerfileuploadclick('logoinput')" required> <input ng-disabled="disableimageupload" type="file" class="edit-button" id="logoinput" title="click upload logo" ngf-select="uploadfiles($files)" resetonclick="true"> and controller is: $scope.disableeditemailer = function(){ $scope.disableimageupload = true; } 'disableeditemailer()' called on button click and in controller setting value of disableimageupload true or false depending upon situation. after setting value, , clicking on image triggerfileuploadclick() called twice. not getting why called twice?

reactjs - react redux store is not a function -

const rootreducer = combinereducers({ router: routerstatereducer, todos, }) const createstorewithmiddleware = compose( applymiddleware(thunk), reduxreactrouter({ routes, createhistory }) )(createstore)(reducer); export default function configurestore(initialstate) { const store = createstorewithmiddleware(rootreducer, initialstate) it giving me createstorewithmiddleware not function.. why ? you're executing result of compose (which returns function). instead of setting createstorewithmiddleware returned function, setting executed result variable reducer . not sure variable reducer in context since have rootreducer defined above. code should read: const createstorewithmiddleware = compose( applymiddleware(thunk), reduxreactrouter({ routes, createhistory }) )(createstore) doing define createstorewithmiddleware extended createstore function, can receive rootreducer , initialstate .

python - Using a reference list to find specific files by name -

i have list of file names extracted csv stored in variable, want search within directory, see extraction of list variable names filenames below. if found want perform operation on matched files 1 one. #python 3.5, pandas 0.17.1 #reading in list characteristics of files index = pd.read_csv('index.csv',usecols = ['filenumber','province']) #automating extraction of column filename on basis of province , full rows province = index[index.province == 'mg'] filenames = province['filenumber'] so far have not found solution problem. new python , therefore appreciate push in right direction in form of solution or reference material read on these types of operations. in summary: with variable filenames has names of files (minus file type (.csv)), want find files these names in 1 directory/folder. , after (or during search files) perform operation on each file. is looking for? import os filenames =['testfile1','testfile2

c# - Return concrete type in abstract class -

we have abstract class baseclass (note generic arg!) method called me. me returns this. if use me in concrete classes return type object. have cast result of me type working with. how can achieve me returns actual type of this? in example type a? public abstract class baseclass<tidentifier>{ public virtual object me{ { return this; } } } public class a: baseclass<long> { } public class b: baseclass<long> { } public class controller{ public void somemethod(){ var = new a(); var b = new b(); var aobject = a.me; // of type object var aobjectcasted = (a)aobject; // cast original // how want var aconcrete = a.me; // returns type } } update since people really, desperately (wink:-)) wish understand i'm trying do. with nhibernate doing this: var result = session.get<a>(idtolookup); in cases happens result isn't of type of type aproxy, due laze loading etc. if want cast result else: inv

android - Creating graphical apps using C++ -

i can it's long time i've been searching more correct way of using c++ skills making real world apps. me, of real world apps graphical ones — have graphical environment , gui s, ordinary app used on ms windows . of course there many other (and vital) real world apps used embedded systems may don't have gui. apart ms windows , there quite bit programs other oses linux . on smartphones use ios apps devices made apple , android ones well. my purpose being able create apps following platforms, in order of priority: 1- ms windows platform 2- ios , android platform 3- maybe in future, linux platform or embedded systems these needs generally. saying these matters, 1 idea comes view: ide can use our c++ experience in make cross-platform apps can supports 3 needs perfectly, yes, qt . but there seem difficulties on using qt . read of discussions said in link below, since i'm not familiar yet, couldn't understand high-level subjects. https://

javascript - how to get json data using jquery -

i generating radio button depends on jsondata id , name. below code not working.how resove issue. json: { "a": [ { "id" : "a1", "family" : "family" }, { "id" : "a2", "family" : "family" }, { "id" : "a3", "family" : "family" } ], "b": [ { "id" : "b1", "family" : "family" }, { "id" : "b2", "family" : "family" }, { "id" : "b3", "family" : "family" } ], "c": [ { "id" : "c1", "family" : "family" }, { "id" : "c2", "family" : "family" }, { "id" : "c3", "family" : "family&qu

bash - Removing rows from one file which do not mach another -

i looking efficient way delete rows in file1 not exist in file2 in bash: file1.txt: file1 <- 'probeset_id sample1 sample2 sample3 ax-2 100 200 180 ax-1 90 180 267 ax-3 80 890 124' file1 <- read.table(text=file1, header=t) write.table(file1, "file1.txt", col.names=t, quote=f, row.names=f) file2.txt: file2 <- 'probeset_id ax-1 ax-2 ' file2 <- read.table(text=file2, header=t) write.table(file2, "file2.txt", col.names=f, quote=f, row.names=f) the expected output: out <- 'probeset_id sample1 sample2 sample3 ax-1 90 180 267 ax-2 100 200 180' out <- read.table(text=out, header=t) write.table(out, "out.txt", col.names=t, quote=f, row.names=f) the additional problem file2 not sorted file1 . trying use: head -n 1 file1.txt ; grep -f file2.txt file1.txt however, ta

javascript - create json like key and value -

var data1=[ {"year":2000, "country":"madagascar", "country_id":847, "indicator":"current account balance - national currency (millions)" }, {"year":2005, "country":"madagascar", "country_id":847, "indicator":"current account balance - national currency (millions)" }, {"year":2000, "country":"madagascar", "country_id":847, "indicator":"net income - national currency (millions)" }, {"year":2005, "country":"madagascar", "country_id":847, "indicator":"net income - national currency (millions)" } ] this json data want using underscorejs { "key":"madagascar" "values":[ {"year":2000, "country":&qu

c++ - How to open a web link whenever user click on wxWidget event? -

i'm creating wxwidgets application , i'm trying open web link whenever user press event. class myframe : public wxframe { void onviewhelp( wxcommandevent &event ); } begin_event_table( myframe, wxframe ) evt_menu( wxid_viewhelp, myframe :: onviewhelp ) end_event_table() void onviewhelp( wxcommandevent &event ) { //open www.google.com } if searched "browser" in manual, should have been able find wxlaunchdefaultbrowser() function.

android - Adapter shows items sometimes -

i have 2 baseadapter, 1 posts , other answers posts. first 1 works , shows items. when press see answers of post adapter work (the answeradapater): public adapteranswers(context context, arraylist<hashmap<string, string>> list) { this.context=context; searcharraylist=list; inflater = ((activity) context).getlayoutinflater(); } @override public int getcount() { if (searcharraylist != null) return searcharraylist.size(); else return 5; } public view getview(final int position, view convertview, viewgroup parent) { view view = convertview; dataofarow = searcharraylist.get(position); if (view == null) { view = inflater.inflate(r.layout.comment_item, parent, false); log.d("converview", "null" + view.gettag()); } textview comment= (textview) view.findviewbyid(r.id.txt_comment); comment.settext(dataofarow.get(tag_posttext)); return view;} i set adapter listview in oncreate() o

Python: count word lenth in site name -

got stuck part of python script. example got 2 domain names like: domain.com new.domain1.us is possible count word lenght of every word, splited dot , put lenght in brackets before every word like: (6)domain(3)com (3)new(7)domain1(2)us string = 'domain.com' answer = '' x in string.split('.'): answer += '(' + str(len(x)) + ')' + x print(answer)

python - Import CSV NBA Stats in Excel -

so after struggling long time i've found way data nba.com in comma separated values this result http://stats.nba.com/stats/leaguedashplayerstats?datefrom=&dateto=&gamescope=&gamesegment=&lastngames=15&leagueid=00&location=&measuretype=advanced&month=0&opponentteamid=0&outcome=&paceadjust=n&permode=totals&period=0&playerexperience=&playerposition=&plusminus=n&rank=n&season=2015-16&seasonsegment=&seasontype=regular+season&starterbench=&vsconference=&vsdivision= how nice csv or excel file? or better if possible, how can automatically query data web querying table through excel web query? the following should started: import requests import csv url = "http://stats.nba.com/stats/leaguedashplayerstats?datefrom=&dateto=&gamescope=&gamesegment=&lastngames=15&leagueid=00&location=&measuretype=advanced&month=0&opponentteamid=0&outcome=&a

node.js - Is nodeJs event-driven? -

in "professional nodejs" found sentence "this project (nodejs) not other server-side javascript platforms i/o primitives event-driven , there no way around it." but, know, nodejs event-driven , streams in nodejs event-driven. can explain sentence? node.js asynchronous event driven framework. in following "hello world" example, many connections can handled concurrently. upon each connection callback fired, if there no work done node sleeping. const http = require('http'); const hostname = '127.0.0.1'; const port = 1337; http.createserver((req, res) => { res.writehead(200, { 'content-type': 'text/plain' }); res.end('hello world\n'); }).listen(port, hostname, () => { console.log(`server running @ http://${hostname}:${port}/`); }); this in contrast today's more common concurrency model os threads employed. thread-based networking relatively inefficient , difficult use. furthermore, user

How to customize data using WordPress hooks in WP? -

i have wordpress plugin displays recipe food. want customize ingredients before displaying it. i'm using plugin hook this. have create separate plugin ( functions.php ) customize data before displaying. when run page ingredients array() in customize_recipe_field($arg) function , change ingredient using ingredient name: $arg[$key]['ingredient'] = $data['ingredient']."-demo";` add "-demo" after print $arg , changes done plugin function, when displays on web page no changes done. still shows old data. here customize function: function customize_recipe_field($arg) { foreach ($arg $key=>$data){ $arg[$key]['ingredient'] = $data['ingredient']."-demo"; } return $arg; } add_action('recipe_field_ingredients', 'customize_recipe_field');

c++ - CEdit edit_box has hwnd null -

i have cedit control on mfc dialog: class odbc_dialog : public cdialog { cedit sql_edit_; }; but sql_edit_ variable later in ctor has hwnd = 0x00000000; i suspect should have value other , because has nullptr value cannot use , i'm getting runtime error when trying use it. supposed initialize variable somehow? check if control variable mentioned in ::dodataexchange. check if resource identifier matches of control. if ::dodataexchange() is not called, mfc framework lifecycle may broken example not calling base of overridden ::on...dialog... member function: https://social.msdn.microsoft.com/forums/en-us/872b8e39-db53-4635-87a8-42b2235a43d9/dodataexchange-not-called?forum=vclanguage

c# - Ways of speeding up WebRequests? -

this question has answer here: how perform fast web request in c# 4 answers i've made app can access , control onvif cameras enough. first time making app uses web requests (or @ all) assume i'm using quite basic techniques. part of code i'm curious this: uri uri = new uri( string.format("http://" + ipaddr + "/onvif/" + "{0}", service)); webrequest request = webrequest.create((uri)); request.method = "post"; byte[] b = encoding.ascii.getbytes(postdata); request.contentlength = b.length; //request.timeout = 1000; stream stream = request.getrequeststream(); //send message xmldocument recdata = new xmldocument(); try { using (stream = request.getrequeststream()) { stream.write(

typescript - Unexpected reserved word error while testing using wallaby -

in test file have written test cases, have imported typescript file below: import {rootreducer} "../src/reducers/rootreducer"; in rootreducer.ts have imported typescript file below: import taskreducer "./taskreducer.ts"; then shows error: syntaxerror: unexpected reserved word @ src/reducers/rootreducer.ts:7 both rootreducer.ts , taskreducer.ts come under folder /src/reducers no failing tests if remove '.ts' import statement, throws error in browser. app won't run then the wallaby configuration below: module.exports = function (wallaby) { return { files: [ 'src/*.ts', 'src/**/*.ts' ], tests: [ 'test/*test.ts' ], testframework: "mocha", env: { type: 'node' }, compilers: { '**/*.ts': wallaby.compilers.typescript({ /* 1 commonjs*/

meteor - How do I attach a reactive-var to a child template? -

i tried standard way, happens currentodds of child templates receive value given reactive-var in last child template created. o.o is bug of meteor? how did it: template.childtemplate.oncreated(function () { instance = this; odds = ... (dynamically generated) instance.currentodds = new reactivevar(odds); }); i wasn't doing wrong, issue had because of bug in blaze ( 1 ) there's nothing we're supposed to different when attaching reactive-var child template, compared normal template. should done in same manner.( 2 )

python - Sort xls file content by mutiple column with data-type -

i have sort xls file content 4 columns in ascending order. i converted xls file content list of list. following input input : data = """abc, not consider1, 101, title , subtitle, not consider2, 30/12/2015 abc, not consider1, 100, title , subtitle, not consider2, 31/12/2015 abc, not consider1, 99, bic codes, not consider2, 31/12/2015 abc, not consider1, 98, title , subtitle, not consider2, 25/12/2015 abc, not consider1, 100, atitle , subtitle, not consider2, 30/12/2015 xyz, not consider1, 100, atitle , subtitle, not consider2, 30/12/2015 xyz, not consider1, 100, atitle , subtitle, not consider2, 30/12/2015 abc, not consider1, 100, title , subtitle, not consider2, 30/12/2015""" respective output in string format : data = """abc, not consider1, 98, title , subtitle, not consider2, 25/12/2015 abc, not consider1, 99, bic codes, not consider2, 31/12/2015 abc, not consider1, 100, atitle , subtitle, not consider2, 30/12/2015 abc, no

amazon web services - AWS Security group - Do I need to open outbound port for accessing internet or using yum -

as read aws security groups, must open outbound ports initiate traffic within instance. if have access website or download packages (using yum) on http? need open specific ports this? understand http/https client uses random ports make socket connection in case should open ports? in order make connections ec2 instance internet, must open outbound ports in security group. the port number need open destination port, not source port(s). some examples: to allow http connections ec2 instance internet, need create rule 0.0.0.0/0 on port 80. to allow https connections ec2 instance internet, need create rule 0.0.0.0/0 on port 443. if web servers you're connecting listening on different ports (aside 80 or 443), need change or add more rules accordingly.

php - How to handle edge case for a subscriber to not act on a specific object using the JMS/Serializer library? -

i using jms/serialzier library . i have setup event-subscriber, listens events::pre_serialize , convert object instances of class price having property currency , amount different currencies. public function onpreserialize(preserializeevent $event) { $object = $event->getobject(); $class = get_class($object); switch ($class) { case price::class: return $this->currencyservice->convertprice($object); } } yet now, in application have edge case 1 price belonging 1 container object edgecase not need converted @ all: use jms\serializer\annotation\type; class edgecase { /** * @type("kopernikus\price") * @var price */ private $price; // 1 instance should not handled event subscriber } but has retain original state. yet don't seem able differentiate origin of object comming from. i want able configure price objects should converted , when. as quick , dirty solution have created sta

for-loop in shell between hosts (with ssh) -

i have loop go through other amazon instances: #!/bin/bash list="ec2xxxa.compute.amazonaws.com ec2xxxb-central-1.compute.amazonaws.com" sshkey="ssh -tt -i key.pem centos@" in $list; ${sshkey}$i hostname now try loop through list , print hostname of 2 instances of amazon. works first one. after loop doesn't go further:. ./script.sh ip-172-xx-xx-01 connection ec2-xxxa-1.compute.amazonaws.com closed. last login: thu jan 28 14:09:48 2016 ip-172-xx-xx-01.compute.internal [centos@ip-172-xx-xx-01 ~]$ so can see it's telling me closed connection after closing connection prompt shows ip of host again. have type exit , after it, goes further following host (which have exit). adding exit in script did not help. it's stopping after first host. try removing -tt option command.

c# - Specific characters in language files in InstallShield 2015 Limited Edition -

i have program , want make setup file it. use installshield 2015 limited edition. i want replace english messages during run of setup, couldn't find way change code page other 1252. some of messages contain character 'Å‘', not available in 1252 code page. i tried change project's language other language program can serve, no avail. i tried change code page in project's isl file 1250, unicode, utf-8, error message still refers 1252 page code. the error message way: -7185: 'whatever' translation string identifier 'something' includes characters not available on code page 1250. has met similar problem? their support said not available in limited edition. 1 should buy professional or premier edition have 'Å‘' , fellows.

mysql - Store computation results in database? -

how useful store "simple" computation results in (sql)-database? lets make example: the gross price is: 10.00$ taxes are: 20% shipping costs are: 5.00$ from these informations can compute the: net price: 12.00$ overall costs: 17.00$ the question is: should store 3 raw values , compute other 2 on every request or should compute them once , store them too? in other words: more more valuable? computation power or storage space? to question: in other words: more more valuable? computation power or storage space? to answer this, need consider use case of data, , trade-offs willing make speed , storage. consider use case there 100 million records, , need run reports queries net price, overall costs. in case, reports run slower if values computed. now, if need reports run faster, can consider storing computed values in table. as use case, if have above data, , have audit table stores every update data, , there archive jobs backup data

caching - EclipseLink Cache not getting cached -

@namedquery( name=dbconstants.service_by_id, query="select s service s s.id= :id", hints={ @queryhint(name = queryhints.query_results_cache, value = hintvalues.true), @queryhint(name = queryhints.query_results_cache_size, value = "500") }) i using different entity manager on every query request. query query = em.createnamedquery(dbconstants.service_by_id); query.setparameter("id", id); result = (service) query.getsingleresult(); this returning data database not cache. how tested -> changed column value in database , when performed query, modified value coming. ideally should return stale data since cache not refreshed or invalidated. revision 2: if trying cache named queries, using multitenant aware persistence classes cause problem. how? here way think works: @cache( type=cachetype.soft, size=6000, expiry=600000 ) @multitenant @tenantdi

github - Unity Google Play Services version replace every time after git pull -

we using unity on github repository , everytime 2 of push , pull changes, unity asks following, every time: unity remove or replace play-services-plus version 8.3.0 version 8.4.0 this results in constant push of deleted 8.3 files , add of 8.4 files. i'm not familiar either play services or gitignoring things , know causes continuous reimport , how make constant change this pretty want. .gitignore - ignore 'bin' directory edit git.ignore include directory of play services folder. as issue itself, i'd imagine 1 of has local reference play services scripts changing project settings. either way, it's not need track can go ahead , ignore it.

android - strange behavior of image view selector in class which extends imageview -

i trying add simple selector object - imageview - instance of class extends imageview. final packagetypeview ptv = packagetypeviewslist.get(index); index++; drawable drawable = getresources().getdrawable( r.drawable.selector); imagetitleview imageview = new imagetitleview( getactivity()); imageview.setimagebitmap(beanutils.decodesampledbitmapfromresource(new file(ptv.gettilerenderpath()), screenwidth, screenwidth)); if (ptv.gettitlebgargb() != null) { imageview.setcolorcode(ptv.gettitlebgargb()); } imageview.setimagedrawable(drawable); //todo check entry in database if (ptv.isshowingtitle()) { imageview.setdescription(ptv.getname()); } imageview.setscaletype(scaletype.center_crop); imageview.setclickable(true); // imageview.setimageresource(r.dra

java - cannot convert xml to jaxb -

i have problem converting xml java class, cannot see problem. public myresponse getsmartfocusresponse(myresponse myresponse, string data) throws jaxbexception { try { jaxbcontext jaxbcontext = jaxbcontext.newinstance(myresponse.getclass()); unmarshaller unmarshaller = jaxbcontext.createunmarshaller(); stringreader reader = new stringreader(data); myresponse response = (myresponse) unmarshaller.unmarshal(reader); return response; } catch (jaxbexception e) { e.printstacktrace(); throw e; } } here class convert to: @xmlrootelement(name = "response") public class myresult { private innerresult result; private string responsestatus; @xmlelement(name = "result") public void setresult(innerresult uploadstatus) { this.result = uploadstatus; } @xmlattribute(name = "responsestatus") public void setresponsestatus(string responsestatus) { this.responsestatus = responsestatus; }

python - cannot associate image to tkinter label -

i trying display image tkinter gui using tkinter.label() widget. procedure seems simple , straightforward, code doesn't work! code: import tkinter tk import image, imagetk, sys filename = 'ap_icon.gif' im = image.open(filename) # image loaded, because im.show() works tkim = imagetk.photoimage(im) root = tk.tk() label = tk.label(root, image = tkim) # here core problem (see text explanation) label.image = tkim # should keep reference, right? label.grid (row = 0, column = 0) tk.button(root, text = 'quit', command = lambda: sys.exit()).grid(row = 1, column = 1) root.mainloop() when execute code, doesn't compile, giving error: tclerror: image "pyimage9" doesn't exist when define label without parent root , no compilation error occurs, gui not display image! can identify issue? this problem happens when attempt run above code in ipython. , can solved changing line root = tk.tk() root = tk.toplevel()

ldap - openldap with lmdb; cannot be opened: No such file or directory -

i trying configure openldap-2.4.43 lmdb backend on linux system. far without success. slapd.conf: include /opt/openldap/etc/schema/core.schema include /opt/openldap/etc/schema/cosine.schema include /opt/openldap/etc/schema/inetorgperson.schema allow bind_v2 pidfile /var/run/slapd.pid argsfile /var/run/slapd.args database config rootdn "cn=manager,cn=config" rootpw {ssha}smxtpwsal9yegdslsxmzim+qgljzw9vo database mdb suffix "dc=mydomain,dc=com" rootdn "cn=manager,dc=mydomain,dc=com" rootpw {ssha}smxtpwsal9yegdslsxmzim+qgljzw9vo directory /var/openldap/data/main/ maxsize 10485760 index objectclass eq,pres index ou,cn,mail,surname,givenname eq,pres,sub straced slaptest (/opt/openldap/sbin/slaptest -f slapd.conf -f ./slapd.d/) result (last part): stat("/var/openldap/data/main/", {st_mode=s_ifdir|0700, st_size=40, ...}) = 0 getpid()

How to normalize working tree line endings in Git? -

i have cloned repository had inconsistend line endings. have added .gitattributes sets text attribute files want normalize. when commit changes message: warning: crlf replaced lf in file. file have original line endings in working directory. how can make git normalize working copy of file me? preferably git normalize entire working tree. the docs gitattributes provides answer: $ rm .git/index # remove index force git $ git reset # re-scan working directory $ git status # show files normalized $ git add -u $ git add .gitattributes $ git commit -m "introduce end-of-line normalization" do sequence after have edited .gitattributes .

python - Pydev setup not recognizing undefined value -

i have pydev setup in eclipse.i think did configure workspace show python files in pydev perspective. still not show files in python format. steps tried installed pydev in eclipse, configured pythonpath associated file types. opened in pydev perspective. closed , opened project. still files show in normal text format..not in python format. after many trials , able something-- - changed pydev-> code analysis -> undefined warning - same imports per in link -- how fix pydev "undefined variable import" errors? -i stopped , started eclipse again. these steps took care of issue. hope helps stuck this.

javascript - Date formula, Calculating Leap Year, Week, etc, in Persian Datetime -

Image
old title: how calculate number of week in given month due answer provide change title... i'm creating library wrap in project, provide date information in culture, the library this: ///<reference path="idate.ts"/> /** * created hassan on 1/28/2016. */ // references: // 1- http://www.aftabir.com/encyclopedia/urgent/calendar/chronometry/leapyear_new.php var persiandate = (function () { function persiandate(year, month, day, firstdayofweek) { this.day = day; this.month = month; this.year = year; this.firstdayofweek = firstdayofweek; } persiandate.prototype.isleapyear = function () { var year = this.year; //var = 0.025; //var b = 266; //var leapdays0; //var leapdays1; //var frac0; //var frac1; //if (year > 0) { // leapdays0 = ((year + 38) % 2820) * 0.24219 + a; // 0.24219 ~ days of 1 year // leapdays1 = ((year + 39) % 2820

html - Center css navigation menu -

#cssmenu, #cssmenu ul, #cssmenu ul li, #cssmenu ul li { margin: 0; padding: 0; border: 0; list-style: none; line-height: 1; display: block; position: relative; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } #cssmenu:after, #cssmenu > ul:after { content: "."; display: block; clear: both; visibility: hidden; line-height: 0; height: 0; } #cssmenu { width: auto; border-bottom: 3px solid #47c9af; font-family: raleway, sans-serif; line-height: 1; } #cssmenu ul { background: #ffffff; } #cssmenu > ul > li { float: left; } #cssmenu.align-center > ul { font-size: 0; text-align: center; } #cssmenu.align-center > ul > li { display: inline-block; float: none; } #cssmenu.align-right > ul > li { float: right; } #cssmenu.align-right > ul > li > { margin-right: 0; margin-left: -4px; } #cssmenu > ul >

Excel VBA iterate over all used cells and substitute their values -

this first time ever working vba , excel , problem caused big lack of knowledge on part. i have 1 column list of city names ( containing 800 items, hence i'm looking automatically replace them ) , chunks of text in term "cityname" occurs multiple times , needs replaced correct city name, in setup value of first column cell in same row . so found this: how iterate through cells in excel vba or vsto 2005 and found instr , substitute functions looking through excel vba reference. using iteration works fine: sub mysubstitute() dim cell range each cell in activesheet.usedrange.cells if instr(cell.value, "cityname") > 0 msgbox "hello world!" end if next cell end sub i message box every "cityname" in sheet ( a test sheet 2 rows ). however when add want achieve runtime error (1004) : sub mysubstitute() dim cell range each cell in activesheet.usedrange.cells i

elasticsearch - Disable initial search when accessing kibana 4 -

simple question regarding kibana 4. when navigate kibana page, default queries "*" last 15 minutes in index. is there way disable automatic search? checked advanced settings didn't see obvious. thanks you may want set kibana.defaultappid in de kibana.yml file "settings". opens settings-page @ startup, no query gets executed.

javascript - Generate and track same template multiple times using Knockout in MVC view? -

i put contacts prototype mvc application uses knockoutjs. i'm new knockout , wondering if design correct in reaching end goal. end goal take mvc model passed contacts view start , achieve following: mapping ko viewmodel. use bootstrap modal popup input contact data. upon clicking add in bootstrap modal call template after posting json data controller , have display under edit button on each template rendered under div if clicked brings same modal popup edit templates data. here's code breakdown of have in place. view code <h2>contacts list</h2> <div class="row"> <div class="col-lg-2"></div> <div class="col-lg-10"><h3>ko results</h3></div> </div> <br /> <div class="row"> <div class="col-lg-2"></div> <div class="col-lg-10"><div id="koresults" data-