Posts

Showing posts from January, 2012

ios - Custom uicollectionview - pass data -

i have uicollectionview use custom cell: [_collectionview registernib:[uinib nibwithnibname:@"collectionviewcell" bundle:nil] forcellwithreuseidentifier:@"cellidentifier"]; - (uicollectionviewcell *)collectionview:(uicollectionview *)collectionview cellforitematindexpath:(nsindexpath *)indexpath { collectionviewcell *cell = (collectionviewcell *)[collectionview dequeuereusablecellwithreuseidentifier:@"cellidentifier" forindexpath:indexpath]; cell.articolo = [_array objectatindex:indexpath.row]; i want pass object articolo cell, create property: @property (strong, nonatomic) nsmutabledictionary *articolo; but if try read property in 1 of method: @implementation collectionviewcell - (id)initwithframe:(cgrect)frame { self = [super initwithframe:frame]; if (self) {nslog(@"articolo: %@",_articolo);} return self; } - (id)initwithcoder:(nscoder*)adecoder { self = [super initwithcoder:adecoder]; if(self) {nsl

google cast - Android - Unable to add to RemoteMediaPlayer queue by calling queueInsertItems() multiple times -

i using castcompanionlibrary add items remotemediaplayer queue calling queueinsertitems() videocastmanager.java so: queueinsertitems(unique_items, mediaqueueitem.invalid_item_id, customdata); the first few requests go through, after few times, start getting transientnetworkdisconnectionexception , subsequent requests return status code 2103 (replaced) . @ point, can no longer add items media queue until disconnect , reconnect cast device. here copy of logcat: 01-28 00:24:56.750 7185-7185/com.google.sample.cast.myplayer d/ccl_videocastmanager: [v2.7.1] > queueinsertitems returned. status code: 2103 01-28 00:24:56.789 455-469/? i/surfaceflinger: id=5534(5) createsurf 0x41449a94 (1x1),1 flag=4, uoast 01-28 00:24:56.805 463-1700/? d/powermanagerservice: [api] acquire wakelock flags=0x2000000a > tag=windowmanager uid=1000 pid=463 01-28 00:24:56.891 7185-7189/com.google.sample.cast.myplayer d/dalvikvm: gc_concurre> nt freed > 1843k, 28% free 18679k/25856k, p

javascript - Check if function is fully executed -

how can check if java script function executed without callback function? i scripting adobe illustrator , use "save()" method save active document. when it's done saving want something, after completeley saved. the method doesn't offer callback function need way execute own funciton, after document saved. which sdk use? documentaftersave event need instead? (described dco umentaftersave (yes, typo) in programmers-guide.pdf )

view - ios Controls taking long to get displayed -

not sure if problem facing generic ios issue or there other problem. have main storyboard file , there few screens in xib files. issue controls taking long displayed xib e.g. if have view, after setting hidden property false, takes few seconds display view. has else faced issue earlier? regards, kavita

javascript - How to unbind onbeforeunload event from all elements of the html body -

how unbind beforeunload event elements of html body. kindly tell me , there way unbind beforeunload event every javascript function call . please me , stuck badly on this. i using below code : var j$ = jquery.noconflict(); j$(document).ready(function() { jquery(window).bind("onbeforeunload", function() { return confirm("do want exit?", "true"); }); jquery('a').on('click', function() { jquery(window).unbind('onbeforeunload') }); jquery(window).bind('keydown keyup', function(e) { if (e.which === 116) { jquery(window).unbind('onbeforeunload'); } if (e.which === 82 && e.ctrlkey) { jquery(window).unbind('onbeforeunload'); } }); jquery(window).mousedown(function(e) { if (e.button == 2) { jquery(window).unbind('onbeforeunload'); } else { jquery(window).bind('onbeforeunload'); }

How can I programatically modify an XML Document to respect a DTD in java -

i have xml document built programatically , waiting serialisation (as string ). before serialising though, re-arrange nodes match definition of dtd. should mention implementation prevents me know in order tree built. any recommended solutions ? there academic research correct invalid xml: correction of invalid xml documents respect single type tree grammars but don't know if there available library that. so need hand, or better rework generation of document produces valid instance in first place.

javascript - Using touch events in cordova windos app -

i creating application windows using cordova heavily relies on touch events such touchstart , touchmove . these events work fine in android , ios version not fired in windows version. instead browser tries scroll page on touches (note: calling event.preventdefault function on touchstart . event doesn't fire). in case edge browser has same behaviour cordova app. in edge option when u navigate about:flags called enable touch events when flag set always on or only on when touchscreen detected application works perfectly. wondering if plausible set flag in cordova application.

Restrict end user to edit content to some height and width in ckeditor -

is there way restrict end user editing content height , width. suppose if ckeditor height 200px , width 300px , end user should not able add more content height , width. have set overflow hidden in html, not working. please help.

sql - netezza passing variables -

hi trying pass values variable in sql using run_nzodbc script, run_nzodbc /development/df2/dfr/sql/adhoc/sriram/gen.sql -v condition =prod.usc_code in (12000,12001) >/development/df2/data01/sriram/df2_astrazeneca_seroquel_mthly_01160044dpt.log 2>/development/df2/data01/sriram/df2_astrazeneca_seroquel_mthly_01160044dpt.err & gen.sql create table xxx as ( select * abc a.string =:condition ); instead of condition have replace string contains space in between passed variable while running query. when value passed gets truncated after instance of space occurs, have tried passing value enclosed in single , double quotes. please let me know there way pass string values space in between vriable this works me. nzsql -atv "condition='1 space'" -c "select :condition" i imagine run_nzodbc command work same.

gunzip - How can i decompress my json data using gzip format in android? -

i want decompress json data , store string.i tried more not working well. i called jsonparser class activity raised error when run application. here, jsonparse.java public class jsonparse { static string res=null; public final static int = 1; public final static int post = 2; inputstreamreader reader = null; bytearrayinputstream bais=null; gzipinputstream gzis=null; bufferedreader in=null; string str=""; string outstr=""; public jsonparser() { } public string makeservicecall(string url, int method, list<namevaluepair> params) { try { defaulthttpclient httpclient = new defaulthttpclient(); httpentity httpentity = null; httpresponse httpresponse = null; if (method == post) { httppost httppost = new httppost(url); if (params != null) { httppost.setentity(new urlen

php - How to stop bootstrap modal from closing after authentication fail in laravel 5.1? -

i have bootstrap modal login when ever fails redirects auth/login , modal closes. how stop modal closing when authentication fails , how stop redirecting auth/login? my login form: <form action="{{ url::to('auth/login')}}" method="post"> {!! csrf_field() !!} <div class="left-form__form"> <div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label"> <input class="mdl-textfield__input" type="text" id="mdl_email" name="email"> <label class="mdl-textfield__label" for="mdl_email">email id</label> </div> <div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label"> <input class="mdl-textfield__input" type="password" id="mdl_password" name="password"> <label class="mdl-textfield__label" for=&q

node.js - how to create a room based on 2 users in socket.io? -

my goal create 1 one chat based on 2 different users. way think of use socket.io rooms but problem right how create unique room? for example socket.on('join', function(room) { socket.join(room); }); do need emit room client, if , how make unique. imagine there thousands of users. the chat application, similar facebook chat application. can chat 1 on one. do need redis or mongodb store room? of have experience using socket.io in scale, please share opinion thanks! i tried minimal example of can in 1 room @ time (apart default socket.id room) , other sockets in same room receive messages. can change rooms. the basic premise is, if socket in room 'xyz' , socket b, on server side can socket.to('xyz').emit('message', 'hello') socket a, , socket b receive message, connected socket c isn't in room 'xyz' won't.

css - How to hide the apparent inset box shadow on background image when using filter blur -

i wondered if has come across problem i'm having , might able point me in right direction... i have image slider , each li within contains following: <li class="web"> <div class="cd-full-width square"> <h1 class="slider">something interesting here</h1> <h2 class="letter">something not interesting here</h2> <a href="/website-design.htm" class="cd-btn button">more</a> </div> <div class="bg">&nbsp;</div> </li> each <div class="bg"> has background image , i'm applying filter: blur(5px); div. the blur works fine seem have inset box-shadow around div don't want. example of box shadow here i've tried hide shadow including box-shadow or -webkit-drop-shadow set 0 / none. doesn't seem work. any ideas welcome

ios - How to set dynamic UICollectionView cell height? -

how set dynamic cell height? i need set cell size in method: func collectionview(collectionview: uicollectionview, cellforitematindexpath indexpath: nsindexpath) -> uicollectionviewcell i try this: cell.bounds = cgrect(x: cell.bounds.origin.x, y: cell.bounds.origin.y, width: width, height: height) but can't scrool down... and try methiod: func collectionview(collectionview: uicollectionview, layout collectionviewlayout: uicollectionviewlayout, sizeforitematindexpath indexpath: nsindexpath) -> cgsize but method ben call first, call method: cell.bounds = cgrect(x: cell.bounds.origin.x, y: cell.bounds.origin.y, width: width, height: height) so.. how change cell height? firstly, set per normal. (normal constraints [left,right,top,bottom, , height] , iboutlet uicollectionview. secondly, make iboutlets height constraint, top constraint, , bottom constraint. thirdly, add -> //these outlets naming generic names name them wish iboutlet v

c# - Update/Sync value on all WPF usercontrols -

with 2 booleans (bool 1, bool2) changing between 4 screens / usercontrols (over ipageviewmodel class). every usercontrol connected viewmodelbasescreens class. above have 1 main screen in lying 2 booleans can change screen. every of screen have same boolean synchronized between screens. how update boolean between usercontrols ? or how bind @ same time (when property change)? best solution? i transfer bool value between screen user set in previous screen. i pretty beginner in wpf ( mvvm ) please gentle me :) sketch you have not provided full context of problem, here general steps should take in mvvm application: use mvvm framework. mvvm light favorite. inherit viewmodel viewmodelbase (defined in mvvm light). define both bool value public properties , use raisepropertychanged() tell world change. bind screens same viewmodel object using standard wpf binding . now whenever values of bool properties change, screens refreshed automatically.

ruby - How do I modify devise so that Pins are read only on Rails 4.2.4 -

Image
i junior developer building first web application customer using rails 4.2.4, devise authentication , pins scaffolding listing of customers products sale. everything working, users can signup , login , create, read, update , destroy pins. problem is, don't want users able create, update or destroy pins on index.html.erb page. (only view such customer sales products) if @ image attached. when click on ladies products btn on home page takes index.html.erb pins listed. nb: still want users able signup , log in through devise, update address details shipping , not change pins content. pins crud content should created customer. how should approach this. how should approach this you're looking @ authorization ... authentication process of verifying (login). authorization process of verifying have access (permission). -- devise authentication (user logged in), authorization different matter. ryan bates (railscasts) made very video & tut

python - How can I force a repaint in PySide? -

i have think repainting issue pyside widget. how can force widget (or whole window/app) repaint in middle of method? def on_button_clicked(): window.resulttextedit.setplaintext("parsing file...") # indicate delay, message should visible while parsing # in fact never appears # can force repaint here? result = parse() # (takes little while) window.resulttextedit.setplaintext(result) # display results once done app = qapplication(sys.argv) window = qtuitools.quiloader().load("application.ui") window.userbutton.clicked.connect(on_button_clicked) window.show() sys.exit(app.exec_()) for widget needs repaint in middle of event, can call widget.repaint() . note rest of ui unresponsive during repaint (which fine one-off call, not if you're repainting repeatedly). (thanks mel pointing me https://stackoverflow.com/a/11806126/4720935 )

python - django - object filter logic -

i stuck in state: have locations table in db. , have rating table, contains rating of each location referencing id of each location. now want first 5 locations , rating. have touch 2 tables now: locations , rating. i did this: all_locations = locations.objects.all()[:5] all_ratings = rating.objects.filter(of_location=all_locations.id) but seems wrong because all_locations queryset containing 5 locations , not 1 location, has 5 different ids. how can achieve goal?: take 5 locations , ratings of each of these 5 locations. you can use in indicate value contained in list: locations_ids = [location.id location in locations.objects.all()[:5]] all_ratings = rating.objects.filter(location__id__in=locations_ids)

qt - Strange characters when transferring file with QTcpSocket -

i'm trying transfer file using qtcpsocket. connection runs fine, problem when try record received bytes on file. when open file there strange characters @ beginning of file. these characters? my problem was saving whole object in file. when use operator >> in stream, qt serializes whole object , sends it. if want write bytes of file, or whatever want, need use writerawdata or write methods passing char * bytes. :)

Rails and Simpe Form - translate file upload button -

has found tip how translate simple_form input field upload files ? have pretty simple form (in slim): = simple_form_for(@some_object) |f| = f.error_notification = f.input :text = f.input :photo, as: :file = f.button :submit and generated html has button 'choose file' label on right 'no file chosen'. googling gave nothing working, of them proposing tricks in js. other ideas ?

sql - My query join from more than 2 TABLES return double values using same key reference -

i'm trying join more 2 tables using 1 same key reference, works fine when join 2 two tables using left join : select userprofile.userprofileid, userprofile.name, jobposition.levelname master.eliuserprofile userprofile left join master.elijobposition jobposition on userprofile.userprofileid = jobposition.userprofileid userprofile.userprofileid = '5001' result : userprofileid | name | levelname | -----------------+---------+--------------+ 5001 | dirdple | direktur ple | 5001 | dirdple | direktur ple | but when want join table it, return double values, using master table reference (which userprofile) : select userprofile.userprofileid, userprofile.name, jobposition.levelname, useracmmapping.useracmmappingid, useracmmapping.refid master.eliuserprofile userprofile left join master.elijobposition jobposition on userprofile.userprofileid = jobposition.userprofileid left join transactions.eliuseracmmapping useracmmapping on

c# - Trying to create an email process that receives an email and replies to the sender with their sent email included as an attachment -

i'm using c# / visual studio 2012 create email process replies sender of email original email attachment. when error occurs while processing email send. i'm using stock .net system.net.mail.mailmessage , system.net.mail.smtpclient . i take original email eml, , construct memorystream contents of email eml: memstream = new memorystream(encoding.ascii.getbytes(exception.emaileml)); memstream.seek(0, seekorigin.begin); i construct email , try adding attachment follows: message.attachments.add(new attachment(contentstream, system.net.mime.mediatypenames.text.plain)); message.attachments[0].name = subject + ".msg"; in outlook, see message attachment, outlook isn't able open attachment. error outlook... is matter of setting correct mime type .msg attachment opens in outlook, or else need do? when review .msg attachment within text editor, see following in header: received: server.com ([___]) server.com ([___])

javascript - select2, unhide the already selected value -

i using select2 drop down allow multiple selections removing selected value drop-down list. how can disable that? want show values in drop-down. xyz.select2({ formatresult: formatelement, formatselection: formatelement, closeonselect: false })

How can we get full path of a tree from mysql event data and hierarchical master data? -

i working on product user can read through branched stories. in bi events, capture decision node points user picks 1 node on other. have master data of story content has information of tree. so, our tables this: user_events: user_id link_id 1000 1 1000 7 2000 2 2000 6 so user user_id 1000 has clicked on links 1 , 7, user 2000 has clicked on links 2 , 6. depending on this, both users have traversed different path of nodes. static path details stored in hierarchical data follows: link info: link_id from_node to_node 1 101 102 2 101 103 3 102 104 4 104 105 5 103 106 6 106 107 7 105 107 8 106 108 9 105 108 at nodes 101, 105 , 106, user can take 2 different paths , 'decision nodes'

Windows to Windows Connectivity -

i want automate job in windows server,can 1 please share idea or initiation scenario? i connect windows server windows server , download oracle database table in .csv format , place in system folder.and job should run every day. basically, i'm unix platform want in windows platform, thank support!! you need create small application that, can use asp.net build application, or php, latter require more effort setup environment. after application built, have create windows task scheduler execute application @ specified time.

magento checkout struck at billing information for some customers -

Image
we facing strangest problem ever in live site. for some registered customers [email id ], when enter billing address , click on "continue" button, its not moving next step. instead of ,its coming previous step. we using https checkout. ajax response : console : you may remove shipping address step on checkout page. but on checkout billing step ,you have set billing[use_for_shipping] value 0 .for 0 value need got @ shipping address step not exit; so need set billing[use_for_shipping] value 1 (means ship same address) directly goto @ shipping method step ship address

windows - Can`t block localhost communications -

i have tcp socket server , clients on local machine. want write program, disable connections , let them when _do_smth_. question - how can reset connections (to server) , don`t allow reconnect ? try create different rules in windows firewall (block port, block ip address, etc.) makes no effect if server , clients on same machine. and sorry english, it`s bad enough.

c - I have an issue printing the length of a string from the command line without using strlen? -

hello there program meant when user enters string command line print word , size. e.g ./commandline hello world output: hello world 2 what i'm trying add method print length without using strlen output should length 10 example above. this code bare in mind new c. int main(int args, char *argv[]){ for(int =1; <args; i++){ printf("%s\n", argv[i]); size_t(argv[i]); } printf("%d\n", args -1); } size_t string_length( char *argv[]){ int length = 0; while(argv[length]!='\0') { length++; printf("%i\n", length); } return 0; } my program not print length prints string entered , size. for(int =1; <args; i++){ printf("%s\n", argv[i]); size_t(argv[i]); } printf("%d\n", args -1); here you're not calling function anywhere . program prints arguments , number of them. size_t(argv[i]); merely casts argv[i] type ca

PTSV and calling python from C# -

is possible use python tools visual studio in visual studio such allows side side coding of asp.net c# application , python code? secondly how call python script c#? thanks in advance. as running python scripts in c# can this: processstartinfo start = new processstartinfo(); start.filename = "path/to/python.exe"; start.arguments = string.format("{0} {1}", cmd, args); start.useshellexecute = false; start.redirectstandardoutput = true; using(process process = process.start(start)) { using(streamreader reader = process.standardoutput) { string result = reader.readtoend(); console.write(result); } } passing python script cmd , arguments args .

php - How can I use Autoprefixer with Symfony2 -

i'm trying integrate autoprefixer in symfony2 (with assetic) workflow. first thought assetic provided support filter (like uglifycss , others), tried this: {% stylesheets '@privatebundle/resources/public/less/bootstrap/bootstrap.less' '@privatebundle/resources/public/less/private.less' filter='less,cssrewrite,autoprefixer,?uglifycss' %} <link rel="stylesheet" href="{{ asset_url }}"> {% endstylesheets %} but didn't work. the alternative find netzmacht/assetic-autoprefixer , couldn't make work either. i installed autoprefixer globally (via sudo npm install -g autoprefixer ), , installed kriswallsmith/assetic (which guess different assetic supports autoprefixer) via composer, after not find binary need parameters.yml file. i read on github issue autoprefixer may have changed several times since assetic-autoprefixer last updated, can't find thread now. there w

Why Does My C Program That Uses A Function To Total Months in a Year Fail? -

i've written program that's gradually grown simple structure holds information month, array of 12 structures of same information non-leap year. now, i'm trying include function that, "when given month number, returns total days in year including month. assume structure template of question 3 , appropriate array of such structures declared externally." when press run 2 errors, neither of understand. here are: "undefined symbols architecture x86_64: "_months", referenced from: _days in main.o ld: symbol(s) not found architecture x86_64 clang: error: linker command failed exit code 1 (use -v see invocation)" any appreciated, thanks. #include <stdio.h> int days(int monthnum); struct month { char name[10]; char abbreviaton[4]; int days; int monthnum; }; int main(void) { struct month months[12] = { {"january", "jan", 31, 1}, {"february", "feb", 28, 2}, {"march", &q

c - Implementation of printf -

can please explain me implementation of printf prints string correctly? version 1: printf(const char * s) { while(*s != '\0') { write(s, 1, f); s++; } } version 2: printf(const char *s) { write(s, strlen(s), f); } both print "a string correctly". print given string in argument correctly. if question better implementation suggest depends on implementation of write. option 1 slower if write call has large enough overhead or can buffer characters before committing write. option 2 slower if write unoptimized. example puts character character on serial connection. here pay additional iteration of string strlen. note write call takes file descriptor first argument, not last.

how to install libx265 for ffmpeg build on centos 7 -

when try compile ffmpeg libx265 (./configure --enable-gpl --enable-libx265), getting error as: (error: x265 not found using pkg-config). how install libx265 , configure ffmpeg. there 2 solutions problem. a) if there no libx265 available on centos 7 you'll have build yourself. follows pretty straightforward method of configure/make. using mercurial: hg clone http://hg.videolan.org/x265 cd x265/build/linux ./make-makefiles.bash make -j6 make install ldconfig then sure specify path libx265 installed when building ffmpeg. pkg-config: pkg_config_path="/usr/local/lib/pkgconfig" . b) but appears there rpm entries x265 on centos 7: http://pkgs.org/centos-7/nux-dextop-x86_64/x265-devel-1.2-6.el7.nux.x86_64.rpm.html . if compatible on system should able install instead of building.

java - How to connect H2 console to embedded Spring H2 DB -

ok, im developing simple app, has spring ebedded h2 database development. database.xml bean conf looks this: <bean id="h2server" class="org.h2.tools.server" factory-method="createtcpserver" init-method="start" destroy-method="stop" depends-on="h2webserver"> <constructor-arg value="-tcp,-tcpallowothers,-tcpport,9092" /> </bean> <bean id="h2webserver" class="org.h2.tools.server" factory-method="createwebserver" init-method="start" destroy-method="stop"> <constructor-arg value="-web,-weballowothers,-webport,8082" /> </bean> <jdbc:embedded-database id="datasource" type="h2" /> h2 database initializing, app working, im creating entities, , stored in h2 db when tomcat launched (i know because use , retrieve them). however, when @ h2 console, entit

dockerfile - Run jar file in docker image -

i create docker image java , coppying jar file in image . dockerfile : from anapsix/alpine-java maintainer myname copy testprj-1.0-snapshot.jar /home/testprj-1.0-snapshot.jar run java -jar /home/testprj-1.0-snapshot.j after execute following command docker build -t imagename. in console see output application , everthing fine . when stop image don`t know how run image again ? when execute following command : docker run -i -t imagename java -jar /home/testprj-1.0-snapshot.jar the application run again ,but in dockerfile wrote command. how run image without command , application run automatically ? there difference between images , containers. images build once you can start containers images in case: change image: from anapsix/alpine-java maintainer myname copy testprj-1.0-snapshot.jar /home/testprj-1.0-snapshot.jar cmd ["java","-jar","/home/testprj-1.0-snapshot.jar"] build image: docker build -t imagename . now

java - UnmarshalException error -

i'm trying unmarshal dom parsed document can update xml. got following namespace error: javax.xml.bind.unmarshalexception: unexpected element (uri:"", local:"showing_today"). expected elements <{http://xml.netbeans.org/schema/shows}showing_today> here my: package-info.java @javax.xml.bind.annotation.xmlschema (namespace = "http://xml.netbeans.org/schema/shows", elementformdefault = javax.xml.bind.annotation.xmlnsform.qualified) package media; here xml file i'm trying unmarshal: <?xml version="1.0" encoding="utf-8" standalone="yes" ?> <showing_today xmlns="http://xml.netbeans.org/schema/shows"> <movie_collection> <title>red</title> <director>robert schwentke</director> <year>2010</year> </movie_collection> showingtoday.java @xmlaccessortype(xmlaccesstype.field) @xmltype(name = "", proporder = { &

WordPress page broken image paths -

i made wp page while ago (not me) , of sudden images can't displayed ... i took html code , saw img paths wrong! those workig like: http://www.niebauer.co.at/wp/wp-content/uploads/2013/04/senato-tasse-178x108px.jpg the ones not work: /usr/local/www/apache22/data/niebauer/www.niebauer.co.at/htdocs/wp/wp-content/uploads/et_temp/cool-2015-9941_165x184.jpg i have no idea why wp of sudden changed paths. tried reupload images seems, wp automatically "wrong". working solution found upload them in exact size display on page. guess wrong wp asset manager did not change anything.

excel - Adding Validation List with VBA is unstable -

in setws sheet have following code in worksheet_deactivate: private sub worksheet_deactivate() dim actws, setws worksheet set actws = activeworkbook.sheets("activity_plan") set setws = activeworkbook.sheets("settings") actws.range("j11:j20").validation .delete .add type:=xlvalidatelist, alertstyle:=xlvalidalertstop, _ operator:=xlbetween, formula1:="=settings!$as$10:$as$20" ' .ignoreblank = true .incelldropdown = true end ' end sub in repws sheet (where create couple of graphs) have following code in worksheet_activate: private sub worksheet_activate() application.enableevents = false application.screenupdating = false application.calculation = xlcalculationmanual dim scopews, repws, actws, setws worksheet set scopews = activeworkbook.sheets("scope")

(continuous) deployment from dropbox to github or gitlab pages? -

host website jekyll on github pages. folder posts should available dropbox, if dropbox gets modified or new file within folder, github website gets updated. is possible? may have solution zapier i'd rather have better way of doing this.

python - Ctypes segmentation fault -

so i'm trying speedup python script loading data files , storing in array. realized if repeat procedure around 1020 times don't ask me why arrive @ segmentation fault. code loading data is: import os,sys import numpy np import pandas pd import ctypes ct version = 0.1 try: path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "_vec") except nameerror: path = "./_im7" if not(sys.platform in ('win32', 'cygwin')): path += '.so.'+str(version) libfunctions = ct.cdll.loadlibrary(path) else: libfunctions = ct.cdll.loadlibrary(path) libfunctions.readvec.restype = ct.c_void_p libfunctions.readvec.argtypes = [ct.c_char_p, np.ctypeslib.ndpointer(ct.c_float), \ ct.c_int,ct.c_int,ct.c_int] def readvecct(filename,nx,ny,nz): # supposing moment naming scheme piv__vxy.case piv__vxy.geo not changes should # not case appropriate changes have made corresponding file # ctypes data_temp = np.ze

python - pandas scatterplots: how to plot data on a secondary y axis? -

Image
i want put 2 scatterplots on same graph x axis shared y axes different. can't work out how there though. create first scatterplot doing: ax=df.plot(kind='scatter', x='vf', y='hf_ratio', xlim=[2e-06,6e-06], ylim=[1,10], color='darkblue', s=40, label='a') ax.ticklabel_format(axis='x', style='sci', scilimits=(0,0)) now want add second on right-hand y axis. pandas documentation gives info adding secondary axis line plot ( secondary_y=true ) i've tried doesn't seem work: df.plot(kind='scatter', x='vf', y='hfall', secondary_y=true, color='red', s=40, label='hfall', ax=ax); it seems ignore secondary_y=true command , plots on original y axis, isn't useful. rub further salt wounds, removes attractive white gridlines... if able appreciated. this seems issue (bug?) pandas code. has been reported in github page here . explanation give there, h

c++ - Not able to figure out how the code can be further optimised -

this problem hackerrank , link : https://www.hackerrank.com/challenges/sherlock-and-squares . program below prints count of numbers perfect squares within given range. however, error of time limit exceeded constraints testcases 1 < testcase < 100 , 2 integers in range 1 < number 1 < 10^9, 1 < number2 < 10^9 . #include <cmath> #include <cstdio> #include <vector> #include <iostream> #include <algorithm> #include<math.h> using namespace std; int main() { /* enter code here. read input stdin. print output stdout */ int testcase; cin>>testcase; //input testcase while(testcase--) { int number1,number2,count=0; cin>>number1>>number2; //input limits for(int i=number1;i<=number2;i++) //check each number within limits if proper square { if(sqrt(i)==floor(sqrt(i))) count++; } cout<<count<<endl

html - JQuery edit div from main file with loaded file script -

i want show div that's in main file. <html> <body> <script> $(document).ready(function(){ $( "#load_div" ).load( "/resources/load.php" ); }); </script> <div id="load_div"></div> <div id="change" style="display:none;"></div> </body> </html> and in loaded life: <html> <body> <script> $("#change").show(); </script> </body> </html>

hybrid mobile app - nativescript include new element to view after app is already built -

i need download view element backend , show on application. don't know if it's possible on nativescript. if it's possible modify view after app build. it possible. fetch .xml, .js, or .css file remote location , dynamically change markup of view.

java - DataOutputStream to Array -

is there way write dataoutputstream content array or string regardless type of data contains? dataoutputstream output = new dataoutputstream(new bufferedoutputstream(new fileoutputstream(string datapath))); thanks use bytearrrayoutputstream. https://docs.oracle.com/javase/7/docs/api/java/io/bytearrayoutputstream.html bytearrayoutputstream baos = new bytearrayoutputstream(); outputstream os = new dataoutputstream(baos); os.write(...); byte[] data = baos.tobytearray(); string dataasstring = new string(data, "utf-8"); // or whatever encoding using you may use following strategy well: class compositeoutputstream implements outputstream { private outputstream first,second; public compositeoutputstream(outputstream first, outputstream second) { this.first = first; this.second=second; } public void write(int b) throws ioexception { first.write(b); second.write(b); } // etc. } use with: bytearray

twig - How to get formatted HTML generated by Symfony -

i'm using symfony2 generate forms, or twig, uses symfony's functions, view looks this: {{ form_start(form) }} {{ form_widget(form) }} {{ form_end(form) }} this generates html code without newlines or indentation. unreadable when html source code. is there way force symfony/twig format generated html? this link explains form customization in twig beautifully. there numerous ways of applying css styling form elements. example, if have form field name can add css class way: {# render widget, add "foo" class #} {{ form_widget(form.name, {'attr': {'class': 'foo'}}) }} or label: {{ form_label(form.name, 'your name', {'label_attr': {'class': 'foo'}}) }} then can use css classes render form elements per design. hope idea. docs , link provided in answer both useful in regard.

servlets - Not able to show image in jsp -

i have added image folder in webapp/images. structure of app myapp --src --main --java --webapp --images this doing in jsp <img src="images/siteicon.png"/> . can me, doing wrong here. using intellij your path image should start slash. like: <img src="/images/siteicon.png"/>

node.js - Puppet "onlyif" attribute cannot find not(!) operator -

i trying figure out if node package pm2 installed in path , executable or not following puppet code. exec { "create symbolic link pm2": cwd => "${pm2_link_dir}", path => ['/usr/bin','/bin','/usr/sbin','/sbin'], onlyif => "! node &> /dev/null", command => "ln -s ../lib/node_modules/pm2/bin/pm2 pm2" } it telling me cannot find command "!". right way find out if program installed , executable?? , why puppet cannot understand not operator?? working on redhat master , slave. and why puppet cannot understand not operator? the ! operator provided shell; not command. using exec 's default provider ( posix ) runs commands directly rather via shell. (or documented do. has come light posix provider runs commands via shell, in apparent contradiction of docs.) it anyway bit silly use ! in exec 's onlyif attribute, when instead drop ! , switch

javascript - How to trigger a method at page load in vuejs? -

hy.. have quetion vuejs , quetion how trigger method @ page load tab..? example: <div id='wraper'> <!-- div id menu not load --> <div id="menu"> <a href='#'>test</a> <a href='#'>test</a> <a href='#'>test</a> </div> <!-- load content --> <div id="content"> konten </div> </div> thanks for vue >= 2.0 use mounted , previous version use ready . vm=new vue({ el:"#app", mounted:function(){ this.method1() //method1 execute @ pageload }, methods:{ method1:function(){ /* logic */ } }, })

How to detect an error in a Tcl thread fileevent or after script -

in main thread trying detect , respond error occurs in worker thread's fileevent script. wrote test script try detect thread errors in 4 cases: synchronous thread::send, immediate error in thread synchronous thread::send, error in thread after script asynchronous thread::send, immediate error in thread asynchronous thread::send, error in thread after script i used after command in test thread (hopefully) mimic fileevent script. expected, case 1 thread error caught via catch of thread::send command , case 3 thread error caught thread::errorproc procedure , custom bgerror procedure. cases 2 , 4 thread errors reflected in main thread can't seem catch them via custom procedures. following test script: #!/usr/bin/env tclsh package require thread; # custom error handling procedure errors during asynchronous thread::send proc error_proc {id error} { puts "\n---------- error_proc: $id $error **********\n"; } thread::err

ios - UIButton inside UIVIew not centered in iPhone app -

Image
i'm setting custom uiview programmatically contain several uibutton , working fine. i'm trying center uibutton inside sub-custom uiview i've created programmatically. here code i'm using //uiview used parent blurreffectview blurredpowerdown = [[uiview alloc] initwithframe:cgrectmake(0, 0, [[uiscreen mainscreen] bounds].size.width, [[uiscreen mainscreen] bounds].size.height)]; blurredpowerdown.backgroundcolor = [uicolor clearcolor]; //i'm calling applying custom view on top of other application (yes jailbreak development issue not related @ at window = [[uiwindow alloc] initwithframe:[[uiscreen mainscreen] bounds]]; window.windowlevel = uiwindowlevelalert + 2; [window sethidden:no]; [window setalpha:1.0]; [window setbackgroundcolor:[uicolor clearcolor]]; [window addsubview:blurredpowerdown];

filter - Recycler View with Header and Edit Text -

i have recyclerview header achieved using 2 different element types. in header there edit text want use filtering nonheader elements of list. below current implementation, have 1 concern , 1 problem it. my concern doing in publishresults notifyitemrangeremoved , notifyiteminserted wrong way update recycler view. doing notifydatasetchanged cause header row refreshed , edit text lose focus. want way refresh item rows , leave header row untouched. my current problem existing code if scroll down edit text looses focus. want edit text keep focus if scroll bottom of list. the code used use listview setheaderview , worked somehow there must someway of achieving goal not sure trick recycler view is. appreciated. public class sidelistadapter extends recyclerview.adapter<recyclerview.viewholder> implements filterable { private static final int type_header = 0; private static final int type_item = 1; private final list<string> data; public list<