Posts

Showing posts from February, 2015

python - pcapy.PcapError: eth1: You don't have permission to capture on that device -

i trying run pcapy_sniffer.py this pcapy.pcaperror: eth1: don't have permission capture on device (socket: operation not permitted) if you're running on linux or os x try running root or sudo , otherwise if you're on windows try running administrator.

html5 - Need to make my jquery carousal accessible using tab -

hi have created basic jquery carousal. need make accessible using tab, follows sequence prev tab, casousal dots, next tab. <div id="maindiv"> <div id="buttons"> <a href="#" id="prev" style="font-size: 60px; font-weight : bold; text-decoration : none; position: absolute; top: 250px; left : 300px;">&lt;</a> <a href="#" id="next" style="font-size: 60px; font-weight : bold; text-decoration : none; position: absolute; top: 250px; right: 250px;">&gt;</a> </div> <div onclick ="changecontent()" id="sliderdiv"> <ul tabindex="1" class="slider"> <li> <h3>image 1</h3> <img src="images/1.jpg" alt="image not found"> </li> <li> <h3>image 2</h3> <img src="images/2.jpg"

Regex subbing in Python leads to ASCII characters appearing -

i trying use regex replace issues in text. strings this: a = "here shortstring various issueswith spacing" my regex looks right now: new_string = re.sub("[a-z][a-z]", "\1 \2", a) . this takes places missing spaces (there capital letter after lowercase letter), , adds space. unfortunately, output looks this: here shor\x01 \x02tring various issue\x01 \x02ith spacing i want this: b = "here short string various issues spacing" it seems regex matching correct instances of things want change, there wrong substitution. thought \1 \2 meant replace first part of regex, add space, , add second matched item. reason else? >>> = "here shortstring various issueswith spacing" >>> re.sub("([a-z])([a-z])", r"\1 \2", a) 'here short string various issues spacing' capturing group , backslash escaping missing. you can go further: >>> = "here shortstring various

c++ - How can I flip a buffer vertically during an YUV to RGB conversion -

edit : question not clear sorry, updated , added details. i have buffer image data (yuv format) convert rgb format. problem is, flip image vertically (invert y-position). what i'm able moment convert yuv data rgb data in buffer, flip buffer vertically. here working code : unsigned char* decklinkcapturedelegate::convertyuvtorgb(void* framebytes) { unsigned char *mycopy = new unsigned char[height*width*3]; unsigned char *flippedcopy = new unsigned char[height*width*3]; unsigned char* pdata = (unsigned char *) framebytes; //conversion yuv rgb for(int = 0, j=0; < width * height * 3; i+=6, j+=4) { unsigned char v = pdata[j]; unsigned char y = pdata[j+1]; unsigned char u = pdata[j+2]; mycopy[i+2] = 1.0*y + 8 + 1.402*(v-128); // r mycopy[i+1] = 1.0*y - 0.34413*(u-128) - 0.71414*(v-128); // g mycopy[i] = 1.0*y + 1.772*(u-128) + 0; // b y = pdata[j

New theme integration on multi site website in magento not showing changes on frontend -

i have created new theme scratch multi site website. have uploaded theme folders, skin folders , made changes in admin>configuration>web , in design store scope. have cleared cache. after these changes cannot able see changes on new website(website 2) loading current theme of website 1. please suggest best answer this.

double - symbolic expression to numeric in matlab -

i need calculation on symbolic toolbox. i have value is: q = sym('q%d', [n 1]) ; n not fixed value (it defined user) i need calculations on such as: for i=1:n z(:,i+1) = t_a(1:3,1:3)*z(:,1); end where (for n=2 value of t_a changing different n values) t_a=[ cos(q1), -(4967757600021511*sin(q1))/81129638414606681695789005144064, -sin(q1), 0; sin(q1), (4967757600021511*cos(q1))/81129638414606681695789005144064, cos(q1), 0; 0, -1, 4967757600021511/81129638414606681695789005144064, 1/10 0, 0, 0, 1] and z = 0 0 0 0 0 0 1 0 0 when run code gives error , says: the following error occurred converting sym double: double cannot convert input expression

configuration - What does the timeout in nerve signify? -

i'm trying discover few services using nerve . while came across timeout configuration specified in nerve docs . timeout: (optional) maximum time check can take; defaults 100ms however when @ examples provided, timeout mentioned "0.2". does mean timeout these examples " 0.2ms "? valid configuration timeout? or 0.2 considered 2 sec ? i went through code nerve , looks timeout configuration provided in nerve json read value , directly pass http client read_timeout without additional processing. as per ruby documentation, value in seconds. so 0.2 means 200ms. i'm assuming nerve docs not updated or has mistake w.r.t documentation. read_timeout[r] number of seconds wait 1 block read (via 1 read(2) call). number may used, including floats fractional seconds. if http object cannot read data in many seconds, raises net::readtimeout exception. default value 60 seconds.

How to do unit testing using PHPUnit in wordpress? -

how can phpunit testing in wordpress website ? including theme , plugin everything. i have setup phpunit , included wp-load.php file functions , classes access. is correct way ? or there better way of doing unit testing in wordpress. have read https://make.wordpress.org/core/handbook/testing/automated-testing/phpunit/ ? when writing unit testing should ask yourself: want function do? , write test based on that. to answer question if there correct way write unit testing, think it's not. matter on how smart write tests. go have @ new unit testing, how write great tests? inspiration. luck!

node.js - typings command not found after installing with nodejs -

if want use nodejs typescript. reasen try install typings, when enter typings command commandline, thing 'command not found'. try install typings global , local. changed global path of npm directory: https://docs.npmjs.com/getting-started/fixing-npm-permissions . it missing link. if run tiping full path (~/.npm-global/bin/typings) works fine. how create missing command? how tell npm automaticly? @ pc @ home creates link own.

struts 1 - ORA-00942: table or view does not exist at oracle.jdbc.driver.T2CConnection.checkError(T2CConnection.java:765) -

i tried execute select * query in code , getting following error. java.sql.sqlsyntaxerrorexception: ora-00942: table or view not exist @ oracle.jdbc.driver.t2cconnection.checkerror(t2cconnection.java:765) @ oracle.jdbc.driver.t2cconnection.checkerror(t2cconnection.java:662) @ oracle.jdbc.driver.t2cstatement.executefordescribe(t2cstatement.java:765) @ oracle.jdbc.driver.oraclestatement.executemaybedescribe(oraclestatement.java:1167) @ oracle.jdbc.driver.oraclestatement.doexecutewithtimeout(oraclestatement.java:1289) @ oracle.jdbc.driver.oraclestatement.executequery(oraclestatement.java:1491) @ oracle.jdbc.driver.oraclestatementwrapper.executequery(oraclestatementwrapper.java:406) @ com.ibm.ws.rsadapter.jdbc.wsjdbcstatement.pmiexecutequery(wsjdbcstatement.java:1695) @ com.ibm.ws.rsadapter.jdbc.wsjdbcstatement.executequery(wsjdbcstatement.java:999)

java - How to make a model changes visible on a JDatePicker? -

after doing date date = new date(); jdatepicker.getmodel().setvalue(date); i'd jdatepicker display new value in ui. tried jdatepicker.repaint(); which doesn't have effect. i'm using jdatepicker 2.0.0-snapshot. jdatepicker.getmodel().setvalue(date) works fine , correctly updates gui (i looking on wrong component). jdatepicker.repaint() isn't necessary.

dataframe - Counting back to events in R -

how count years since happened in r? data looks this: year fatal non-fatal french airline 1989 1 1 french airline 1990 1 0 french airline 1991 0 0 french airline 1992 0 1 french airline 1993 0 0 uk airline 1989 1 1 uk airline 1990 0 0 uk airline 1991 1 0 uk airline 1992 0 0 uk airline 1993 0 0 grouped airline, want have column counts when last fatal, or non-fatal crash happened. output this: year fatal non-fatal since fatal since non-fatal french airline 1989 1 1 0 0 french airline 1990 1 0 0 1 french airline 1991 0 0 1 2 french airline 1992 0 1 2 0 french airline 1993 0 0 3 1 uk airline 1989 1 1 0

javascript - How to make a border? -

i have element <div id="square"></div> he has property move on document var square = document.getelementbyid("square"); document.body.onkeydown = function(e) { if (e.keycode == 37) {left()} if (e.keycode == 38) {up()} if (e.keycode == 39) {right()} if (e.keycode == 40) {down()} } how make function, not allowed movement, if square element closest document border? jsfiddle: https://jsfiddle.net/zutxylsq/ you need check if left outside of boundaries this: function left() { console.log('left'); var left = parseint(square.style.left || getcomputedstyle(square)['left'], 10); if (left >= 50) { square.style.left = (left - 50) + 'px'; } } function right() { console.log('right'); var left = parseint(square.style.left || getcomputedstyle(square)['left'], 10); if (left+50+square.offsetwidth < window.innerwidth) { square.style.left = (

.net - log4net - separate appender for a namespace -

i have been googling haven't yet found answer question. have application , have client library connecting me database (in case, it's ravendb). i ravendb client messages go separate file (meaning, messages instances of classes of raven.client.xyz should logged raven-client.log file - actions client library performs, e.g. connecting server, waiting response, getting/updating documents, querying index, etc. , not code interacting client library ). how can achieve that? tried separate appender, ravendb logs appear in application logger too. i'm using xml configuration , log4net version 1.2.10 actually, checked , solution works: <log4net> <appender name="consoleappender" type="log4net.appender.consoleappender"> <layout type="log4net.layout.patternlayout"> <conversionpattern value="%utcdate [%thread] %-3level %logger - %message%newline" /> </layout> </append

asp.net - Microsoft.AspNetCore.Identity UserManager GetUserAsync -

i've been reading source code of usermanager.cs , i've stepped following block: public virtual task<tuser> getuserasync(claimsprincipal principal) { if (principal == null) { throw new argumentnullexception(nameof(principal)); } var id = getuserid(principal); return id == null ? task.fromresult<tuser>(null) : findbyidasync(id); } i've been curious if there reason why above not this: public virtual async task<tuser> getuserasync(claimsprincipal principal) { if (principal == null) { throw new argumentnullexception(nameof(principal)); } var id = getuserid(principal); return id == null ? await task.fromresult<tuser>(null) : await findbyidasync(id); } as can see i've added async/await. *i'm implementing usermanager class orm. since didn't write cannot know certain. ;) guess it's regar

pyspark - Spark Delete Rows -

i have dataframe containing 20k rows. i want delete 186 rows randomly in dataset. to understand context - testing classification model on missing data, , each row has unix timestamp. 186 rows corresponds 3 seconds (there 62 rows of data per second.) my aim is, when data streaming, data missing number of seconds. extracting features time window, want see how missing data effects model performance. i think best approach convert rdd , use filter function, this, , put logic inside filter function. dataframe.rdd.zipwithindex().filter(lambda x: ) but stuck logic - how implement this? (using pyspark) try this: import random startval = random.randint(0,dataframe.count() - 62) dataframe.rdd.zipwithindex()\ .filter(lambda x: not x[<<index>>] in range(startval, startval+62)) this should work!

python - Django MissingFileError: Path is a directory -

i'm trying deploy project static files on s3 aws when collectstatic on terminal, got error. heard looks i'm trying include static asset in template, have specified directory instead of file... , not understand :/ traceback (most recent call last): file "/usr/lib/python2.7/wsgiref/handlers.py", line 85, in run self.result = application(self.environ, self.start_response) file "/home/damian/proj1/local/lib/python2.7/site-packages/django/contrib/staticfiles/handlers.py", line 63, in __call__ return self.application(environ, start_response) file "/home/damian/proj1/local/lib/python2.7/site-packages/whitenoise/base.py", line 57, in __call__ static_file = self.find_file(environ['path_info']) file "/home/damian/proj1/local/lib/python2.7/site-packages/whitenoise/django.py", line 75, in find_file return self.get_static_file(path, url) file "/home/damian/proj1/local/lib/python2.7/site-packages/whitenoise/base.py", line 111, i

amazon ec2 - Failed to fetch ec2 uri http://169.254.169.254/ -

i have simple puppet manifest class javaora(include ::archive) { group { 'serviceusrgroup': name => 'serviceusrgroup', ensure => 'present', } user { 'jersey': name => 'jersey', home => '/home/jersey', gid => 'serviceusrgroup', comment => 'user run servers', } file { ['/usrdata/archive', '/usrdata/apps/java']: ensure => 'directory' } archive { "/usrdata/archive/${tomcat::jreversion}": ensure => present, extract => true, extract_path => '/usrdata/apps/java', source => $tomcat::jredownload, creates => "/usrdata/apps/java/${tomcat::jdkversion}" } i getting error failed fetch ec2 uri http://169.254.169.254/latest/meta-data/:403 forbidden it gives me error at line 2 : syntax error near include ; expected ")"

c++ - ZMQ Publish/Subscribe pattern publisher connects to subscribers -

i new zmq , did tutorials publish subscribe pattern. application don't quite apply. have 2 types of applications. application 1 can create connections multiple "applications two"s on network , send them data. i tried implementing publish/subscribe pattern, instead of subscriber connecting publisher publisher connects subscribers. publisher: zmq::context_t context(1); zmq::socket_t socket(context, zmq_pub); socket.connect("tcp://localhost:5555"); std::string text = "hello world"; zmq::message_t message(text.size()); memcpy(message.data(), text.c_str(), text.size()); socket.send(message); subscriber: zmq::context_t context(1); zmq::socket_t socket(context, zmq_sub); socket.bind("tcp://*:5555"); const char* filter = "hello "; socket.setsockopt(zmq_subscribe, filter, strlen(filter)); zmq::message_t request; socket.recv(&request); std::string message = std::string(static_cast<char*>(request.data()), request.

xsd - JAXB globalBinding for anonymous enums -

i'm trying generate java classes using jaxb below xsd. and had use below bindings file generate enum classes simple element derived xs:string , has enumeration facets. generates string instead... (note: cannot change xsd) see typesafeenumbase here bindings.xjb file: <jaxb:bindings xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:xs="http://www.w3.org/2001/xmlschema" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc" jaxb:version="2.0"> <jaxb:globalbindings typesafeenummembername="generatename" typesafeenumbase="xs:string"/> </jaxb:bindings> test.xsd: <?xml version="1.0" encoding="utf-8"?> <xs:schema targetnamespace="http://www.example.com" xmlns="http://www.example.com" xmlns:xs="http://www.w3.org/2001/xmlschema"> <xs:element name="elementname"> &l

http - Strange image request causing servlet doGet method to be called twice? -

Image
i'm working on java web application running on tomcat. i'm having strange issue occurs every request. seems every request being made twice 1 of requests seems image request. causing doget method called twice same page request. here screenshot of chrome network console's image tab: as can see, there request under image tab same main request. verified duplicate request received server , happening in both firefox , chrome. please suggest cause of request might be? know i'm missing don't know what. appreciate help. thank you.

Getting rates from an array - json -

i trying rates website . so connect website = faraday.get('https://bitpay.com/api/rates')).status == 200 , try parse this. a segment of response is: #<faraday::response:0x007fcf1ce25688 @env= #<struct faraday::env method=:get, body= "[{\"code\":\"btc\",\"name\":\"bitcoin\",\"rate\":1}, {\"code\":\"usd\",\"name\":\"us dollar\",\"rate\":586.66},{\"code\":\"eur\",\"name\":\"eurozone euro\",\"rate\":528.991322},{\"code\":\"gbp\",\"name\":\"pound sterling\",\"rate\":449.441986},{\"code\":\"jpy\",\"name\":\"japanese yen\",\"rate\":59907.95922},{\"code\":\"cad\",\"name\" when website.body string class of these values found on website. want parse them though (json?) can e

excel - Count number of rows where value in a column is not a part of a list -

i have data set, let's this: item name apple carrot carrot pear pear pineapple radish orange orange pineapple pineapple and have list this: list of items: apple orange pineapple how write formula count how many rows in dataset have value not part of list? ... in case 5... you take number in list away total:- =counta($a$2:$a$20)-sumproduct(countif($a$2:$a$20,$b$2:$b$20)) assuming data items in column , list in column b.

scala - Test if implicit exists -

is possible on compile time using macros test if exists implicit current type ? something def packone(tpe:c.universe.type,....) = { if(tpe =:= bytetpe ) makeast1 else if (tpe =:= longtpe ) makeast2 else if (tpe =:= c.typeof[java.lang.string]) makeast3 .... else exists implicit convention tpe { q""" // call function implicit pack[t] implicitly[packer[$tpe]].pack(...) """ } else { // make default conversion } } it should possible use inferimplicitvalue : val t = c.internal.typeref(noprefix, typeof[packer[_]].typesymbol, list(tpe)) c.inferimplicitvalue(t) match { case emptytree => … // default conversion case packer => q"packer.pack(…)" }

c++ - Weird crash when I try to attribute a variable in OpenCV IOS -

there i'm not able understand. i'm using opencv ios ios device. i have c++ class private variable cv::rect . variable located .h file. in .cpp file, have method creates cv::rect . then, attribute new created cv::rect class variable crashs , not understand why. .h file class detection { public: detection(); cv::mat processimage(cv::mat frame); cv::mat detectface(cv::mat frame); public: cv::rect getrectangledetection(); void setrectangledetection(cv::rect& rect); private: cv::rect _rectangedetect; }; .cpp file cv::mat detection::processimage(cv::mat frame){ mat originalcolorimage; frame.copyto(originalcolorimage); int cx = frame.cols/2; int cy = frame.rows/2; int width = 1000; int height = 1000; nslog(@"[info] rectangle creation"); cv::rect rect1(cx-width/2, cy-height/2, width,height); cv::rect test2; //test2 = rect1;//it works ! setrectangledetection(rect1); // or _r

java - Spring Boot 1.4: Executing Method after Liquibase finished -

i have spring boot 1.4.0 based project uses liquibase. is possible execute method after liquibase finished? something bean post processor? what want adding data database when application started in development mode. in developement mode application uses in-memory h2 database, liquibase has create tables before can write data. spring boot auto-configures springliquibase bean named liquibase . bean depends on bean created after liquibase has finished. example, use @postconstruct populate database: @bean @dependson("liquibase") public yourbean yourbean() { return new yourbean(); } static class yourbean { @postconstruct public void populatedatabase() { system.out.println("this called after liquibase has finished"); } }

time in strings format: python -

i using function bring date consistent in column, goes this from dateutil.parser import parse def dateconv1(x): c = parse(x) return c so if use as, works fine in[15]:dateconv1("1 / 22 / 2016 15:03") out[15]:datetime.datetime(2016, 1, 22, 15, 3) but when pass in variable a= 1 / 22 / 2016 15:03 in[16]:dateconv1(str(a)) it doesn't work, how bring in quotes or string, every appreciating assuming you talking pandas dataset , can use pandas to_datetime() method: in [66]: dates = ['1 / 22 / 2016 15:03', 'jul 22 2016 12:32pm', 'jul 22 2016 5:40pm', ....: 'jul 22 2016 8:31pm', 'jul 23 2016 2:01pm', 'jul 23 2016 7:24pm', ....: 'jul 24 2016 4:30pm', 'aug 1 2016 4:00pm', 'aug 1 2016 7:49pm'] in [67]: df = pd.dataframe({'d':dates}) in [68]: df.dtypes out[68]: d object dtype: object d object - means d column of string (object) dtype in

jquery - Squarespace Code Block Alignment Issues -

we have custom coded animate flipping cards on our website. there issue alignment , sizing of them. issue occurs when there multiple cards on page (they made using code blocks). can see issue on link below. any appreciated! link site jsfiddle (only 1 card...issue doesn't show up) html: <div class="flip-container" ontouchstart="this.classlist.toggle('focus');"> <div class="flipper"> <div class="front-brian"> </div> <div class="back"> <div class="centerize"> <div class="socicon-style"> <a href="imdb.com"> <span class="socicon-imdb"> </span> </a> </div> <div class="back-title">brian perry</div> <div class="role">ceo</div> </div> </div> </div&g

css - Responsive image issue using Bootstrap -

i build slider when resize browser want images center part not whole part or not left side part. how ? css : .fill { width: 100%; height: 100%; /*background-position: center;*/ /*-webkit-background-size: cover;*/ /*-moz-background-size: cover;*/ /*background-size: cover;*/ background-position: center center; /*-o-background-size: cover;*/ background-color: transparent ; }

css - Grid system can't locate with navbar -

i have question navbar , grid system. q1.grid system i make 2 100% height navbar on left , right , center text seems locate on left :0 ,and left navbar overlaps it. here's link code. enter link description here html, body { height: 100%; width: 100%; margin: 0; } [class*="col-"] { float: left; } .col-1 { width: 4.16%; } .col-2 { width: 8.33%; } .col-3 { width: 12.5%; } .col-4 { width: 16.66%; } .col-5 { width: 20.83%; } .col-6 { width: 25%; } .col-7 { width: 29.16; } .col-8 { width: 33.33%; } .col-9 { width: 37.5%; } .col-10 { width: 41.66%; } .col-11 { width: 45.83%; } .col-12 { width: 50%; } .col-13 { width: 54.16%; } .col-14 { width: 58.33%; } .col-15 { width: 62.5%; } .col-16 { width: 66.66%; } .col-17 { width: 70.83%; } .col-18 { width: 75%; } .col-19 { width: 79.16%; } .col-20 { width

Rails multiple radio buttons not independent -

i new rails. part of form, want set of radio buttons each member. as trial, part of /view is: <table> <tr> <% topic.listings.each |listing| %> <td><%= listing %></td> <% end %> <tr> <tr> <% topic.listings.each |listing| %> <td> <%= render 'layouts/button' %> </td> <% end %> </tr> </table> layouts/_button.html.erb is: <%= radio_button_tag(:listing, "present") %> <%= label_tag(:listing_present, "present") %><br> <%= radio_button_tag(:listing, "absent") %> <%= label_tag(:listing_absent, "absent") %><br> <%= radio_button_tag(:listing, "unknown") %> <%= label_tag(:listing_unknown, "unknown") %><br> and in /mo

javascript - Angular Timer - UTC to local time's timestamp? -

i'm unsure how angular timer directive display countdown in local time? server app (laravel) returns time in utc (iso 8601). for example: 2016-08-06t09:11:01z 7 hours late compared timezone. the angular relative date directive return correct localized time: {{feed.date | relativedate}} output: 2 mins ago but i'm not sure how convert timestamp can used timer display in local time? wouldn't show right end-time in timezone. <timer end-time="feed.time*1000">@{{hhours}}h</timer> feed.time 1470448297 use angular moment , to relative time : <span am-time-ago="feed.date"></span> you can check docs other applications.

Faild to build clang with ninja -

there problem when i've tried build clang ninja.i've executed commands 1 after link: http://clang.llvm.org/docs/libastmatcherstutorial.html after running ninja tutorial says "okay.now we’ll build clang!" takes 2 hours build half of objects , after os stuck , couldn't move cursor.i did job on both laptop , pc result same.what attract attention that, size of folder huge (18.3gb). is there way solve problem? i have answered same question on stackoverflow here . suggest deeper search in future before asking same question. including information here in case link lost. happening building clang in debug mode (that's default) lot of debug information being generated each compilation unit file sizes becoming big. the solution turn off debug info that's been attached default. not going debug clang, won't need it. instead of doing this cmake -g ninja ../llvm -dllvm_build_tests=on what should is cmake -g ninja ../llvm -dllvm_build_tests

php - superobject not loaded in hook at codeigniter -

when load hook in codeigniter, hook load superobject not. public function __construct() { $this->ci =& get_instance(); // gives me nothing print_r($this->ci); // works fine echo "hello!"; } codeigniter version :3.1.0 any idea? you should use post_controller_constructor or post_controller , instead of pre_controller or pre_system . check docs . no routing or other processes have happened @ point.

c# - SendMail in asp .net -

using system.net.mail; protected void sendmail() { try { mailmessage mail = new mailmessage(); smtpclient smtpserver = new smtpclient("smtp.google.com"); smtpserver.timeout = 30000; smtpserver.deliverymethod = smtpdeliverymethod.network; mail.from = new mailaddress("myemail@gmail.com"); mail.to.add("recipient@gmail.com"); mail.subject = "test"; mail.body = "test"; mail.priority = mailpriority.high; smtpserver.port = 587;//25 smtpserver.credentials = new system.net.networkcredential("myemail@gmail.com", "pwd"); smtpserver.enablessl = true; smtpserver.usedefaultcredentials = false; smtpserver.send(mail); //messagebox.show("mail send"); } catch (exception ex) { //messagebox.show(ex.message.tostring()); } } i have not found error in code per several sou

appcelerator: uuidgen command not found -

i using appcelerator studio trial account. project not running on device need guid app. following appcelerator's support, running "uuidgen" in order guid. however, "uuidgen: command not found" error. is there need set on appcelerator studio before can run command? many in advance! uuidgen not command appcelerator. in mac, it's default utility. don't in windows os. i think can generate online - https://www.uuidgenerator.net i believe wanted use generated uuid in manifest file/tiapp.xml file.

javascript - Jssor - reduce slides on smaller screens -

i working on full-width slider 1 x slides, displaying 4 slides @ time. looks great on large or medium screens, responsive script decrease width of slider on smaller screens drastically still contain 4 slides. there way adjust cols or slidewidth on smaller screens won't resize slides drastically? $(document).ready(function(){ var jssor_1_options = { $autoplay: true, $autoplaysteps: 4, $fillmode: 5, $cols: 4, $slidewidth: 313, $slidespacing: 15, $slideduration: 800, $slideeasing: $jease$.$outquint, $arrownavigatoroptions: { $class: $jssorarrownavigator$, $steps: 1, }, }; var jssor_1_slider = new $jssorslider$("jssor_1", jssor_1_options); function scaleslider() { var refsize = jssor_1_slider.$elmt.parentnode.clientwidth; if (refsize) { refsize = math.min(refsize, 1920); jssor_1_slider.$scalewidth(refsize);

MongoDB query group with 'sub' group -

from product stocks log have created mongodb collection. relevant fields are: sku, stock , date. every time products stock updated there new entry total stock. the skus made of 2 parts. parent part, 'a' , variant or child part, '1', '2', '3', etc.. sku might this: 'a2'. i can query single products stock, grouped day, query: [{ $match: { sku: 'a2' } }, { $group: { _id: { year: {$year: '$date'}, day: {$dayofyear: '$date'} }, stock: { $min: '$stock' }, date: { $first: '$date' } } }, { $sort: { date: 1 } }] note: want minimum stock each day. but need query variations (minimum) stocks added up. can change $match object to: [{ $match: { sku: /^a

javascript - Rendering sub views, maintaining history and not re rendering the entire view. Is this possible? -

i migrating existing react app on using director using react-router . while i'm loving far, maintaining history without re rendering entire page easy director, , i'm not sure whether possible react-router . what have view, let's call slides , 2 other nested view components let's call them one , two . in router, these components map /slides , slides/one , slides/two . slides contains various layout components header , nav , footer . these static. now, there transitional animation play when navigating between slides. previous router, able achieve without having render slides , sub components again. after reading https://github.com/reactjs/react-router/issues/266 , https://github.com/reactjs/react-router/issues/3691 figured may not possible. is accepted way via csstransitionsgroup , accept re renders? not ui if render slow , static components blinked in , out or something. any advice appreciated! you need define sub routes: <route pa

jquery - A Framework to remind the user that their login is about to expire -

is there framework can implement on mvc website hook session , provide reminder login time out? ideally provide view have popup message on can configured. also how work across browser tabs? if there 2 tabs , logged out on 1 session finished on second tab. there way of gracefully redirecting second tab login page. example if on second tab , fire ajax secured action fail. redirect login? i written in past can time consuming test etc. , multi tab issue tricky. ideally wanting plug in , use , configure. you not find required solution out of box. step step need implement : - js side script run timeout time of timeout - 1 min example. need sync other tabs using plugin. , keep in mind fact, every ajax-call or request server extend user session. - logout tabs can implemented using js plugin share data across tabs. tabs subscribing logout event , first tab detect logout @ client side throw event. something that... or can use signalr, massive task

Advantages of using Angular 2 Button component over html/css button -

is there advantage using angular 2 button/tabs/any other html component on creating component in plain html/css globally reusable code? will overhead using angular 2 button component on normal buttons? the advantage don't need build ;-). the disadvantage might contain more code (ts, html, css) , several imports of components built of might necessary current use case because built in generic way can used in many use cases. another disadvantage might limited how can customize while limited browser allows if build yourself. if care additional code, html, css i'm pretty sure it's case of premature optimization without knowing more details concrete requirements it's hard tell.

PHP while loop dynamic rowspan -

Image
consider table example using these table wanted print table these adding rowspan item id 1002. here php code $temp_val = ''; $counter = 1; $sql_sel = mysqli_query($con,"select * item_table"); while($res_sel = mysqli_fetch_array($sql_sel)){ if($temp_val == $res_sel['item_id']){ $counter++; echo "<tr></tr>"; } else{ echo "<tr><td rowspan='".$counter."'>".$res_sel['item_id']."</td></tr>"; } $temp_val = $res_sel['item_id']; } echo "</table>"; it's not correct, it's adding rowspan item id 1003 you should switch code inside else , if statement

Spring Cloud Stream App that is both sink and source -

can create spring boot application spring cloud stream app having both bindings sink , source? such app seat in middle of stream, , called processor in spring cloud stream / dataflow lingo. see this explanation in reference documentation.

html - Two column different position -

Image
i want not hard don't know how do. now here have version mobile how looks now. mobile version looks this: and here it's how want looks: here have code. $query = "select * my_table"; $res = mysqli_query($con, $query); $i = 0; while ($row = mysqli_fetch_assoc($res)) { if($i%2==0) { echo "<div class='row' style='margin-right:0; margin-left:0'> <div class='col-md-6' style='padding:0;''> <img class='image-width img-responsive' src='images/my_img/".$row['primary_img']."' /> </div><!--/span--> <div class='col-md-6 find-content' style='margin-top:8%;'> <img src='images/my_img/".$row['

java - Arrays.sort( myarray) physically changes the array? -

this question has answer here: why void function return value? 5 answers please me understand going on here: main.java: int[] myarray = new int[125]; // setup array here, code omitted. int minimum = processarray.min(myarray ); // array values print if have been sorted... for(int i=0; i<myarray.length;i++) { system.out.println(myarray[i]); } processarray.java import java.util.arrays; public class processarray { public static int min(int[] anarray){ arrays.sort(anarray); return anarray[0]; } } after finding minimum value of array, array print in sorted order. why array re-arranged in sorted order? when pass array function reference myarray not clone/copy your minimum function sorted array, sorted after call you can clone array manually keep original array int minimum = processarray.min(myarray.clone()); or use arr

java - How to make pipes work with Runtime.exec()? -

consider following code: string commandf = "ls /etc | grep release"; try { // execute command , wait complete process child = runtime.getruntime().exec(commandf); child.waitfor(); // print first 16 bytes of output inputstream = child.getinputstream(); byte[] b = new byte[16]; i.read(b, 0, b.length); system.out.println(new string(b)); } catch (ioexception e) { e.printstacktrace(); system.exit(-1); } the program's output is: /etc: adduser.co when run shell, of course, works expected: poundifdef@parker:~/rabbit_test$ ls /etc | grep release lsb-release the internets tell me that, due fact pipe behavior isn't cross-platform, brilliant minds work in java factory producing java can't guarantee pipes work. how can this? i not going of parsing using java constructs rather grep , sed , because if want change language, i'll forced re-write parsing code in language, totally no-go. how can make java piping

python - convert pandas dataframe to list of tuples and drop all pandas datatypes -

i need convert dataframe format can inserted sql table. data_tuples = [tuple(row) row in df.values] how remove non python datatypes pandas dataframe (including np ints , nans , nats)? if want efficiently, use corresponding pandas method - to_sql() : from sqlalchemy import create_engine # conn = create_engine('postgresql://user:password@host:port/dbname') conn = create_engine('postgresql+psycopg2://user:password@host:port/dbname') df.to_sql('table_name', conn) where conn sqlalchemy engine connection object docs: using sqlalchemy postgresql

php - Check <th> value and update in <td> based on condition -

Image
i have result , json , $response['json'] contain table header columns , table data comes $response['results']. need check if header contain column name "nn id" respective table column data should in anchor <a href="">data</a> tag. php code: $json = $response['json']; $result = $response['result']; echo '<strong>search results</strong> <h4 class="bg-default"><strong>total records ('.count($result).')</strong></h4>'; if (count($result) > 0) { echo '<table class="table table-striped table-hover table-bordered"> <thead class="bg-primary"> <tr>'; foreach (array_values($json) $column) { echo '<th>'.$column.'</th>'; } echo '</tr> </thead> <tbody>';

mysql - SQL BUG doesn't accept null when write != -

this question has answer here: why in sql null can't match null? 9 answers when write column!=something doesn't choose null value , something. why happened? can prevent writing , column null? you need check null too. select * your_table column <> or column null note: cannot compare null null . let's @ following code snippets: set @v := null; select @v = null; result: null; because null can compared using null select @v null; result: 1 (i.e. true) the null value can surprising until used it. conceptually, null means “a missing unknown value” , treated differently other values. to test null, use null , not null working null values in mysql

erlang - Understanding dialyzer result -

i have following function: -spec check_connection_header(list()) -> atom(). check_connection_header([{<<"connection">>, <<"close">>}|_]) -> close; check_connection_header([{<<"connection">>, <<"close">>}|_]) -> close; check_connection_header([{<<"connection">>, <<"close">>}|_]) -> close; check_connection_header([{<<"connection">>, <<"close">>}|_]) -> close; check_connection_header([_|rest]) -> check_connection_header(rest); check_connection_header([])-> keep_alive. and when run dialyzer following output: 131: pattern [{<<67:8/integer-unit:1,111:8/integer-unit:1,110:8/integer-unit:1,110:8/integer-unit:1,101:8/integer-unit:1,99:8/integer-unit:1,116:8/integer-unit:1,105:8/integer-unit:1,111:8/integer-unit:1,110:8/integer-unit:1>>, <<99:8/i

Setting specific day to print specific message in the django template -

Image
here model: class sitting(models.model): sit_date = models.datefield(blank=false) cut_off_date = models.datefield(null=true, blank=true) ballot_date = models.datefield(null=true, blank=true) sess_no = models.foreignkey(session, on_delete=models.cascade) genre = treeforeignkey('genre', null=true, blank=true, db_index=true) here view: def sitting_list(request): sitting=sitting.objects.select_related('genre') return render( request, 'genre/sitting_list.html', {'sittings':sitting, }, ) here template: {% block content %} <table> <tr> <th>sitting day & date</th> <th>ministry/division</th> <th>ballot date</th> </tr> {% sitting in sittings %} <tr> <td> {{ sitting.sit_date|date:"l, d f, y" }}</td> {% genre in sitting.genre.get_descendants %}

ios - Creating a 2 x 2 Horizontal Grid in UICollectionView? -

Image
i have popover has uicollectionviewcontroller. i'm trying make 2 x 2 grid it's showing 1 row. want 2 rows. i attempted divide uicollectionview frame number of rows, still shows 1 row. func collectionview(collectionview: uicollectionview, layout collectionviewlayout: uicollectionviewlayout, sizeforitematindexpath indexpath: nsindexpath) -> cgsize { let itemwidth = cgrectgetwidth(collectionview.frame) let itemheight = cgrectgetheight(collectionview.frame) let squaresizeheight = itemheight / 2 let squaresizewidth = itemwidth / 2 return cgsizemake(squaresizewidth, squaresizeheight) } (note: made popover big on purpose) he need set min spacing , section inset value zero and if want show spacing between 2 cell use below formula func collectionview(collectionview: uicollectionview, layout collectionviewlayout: uicollectionviewlayout, sizeforitematindexpath indexpath: nsindexpath) -> cgsize { let itemwidth = cgrectgetwidth(coll

c - What makes this saved array different from the loaded array? -

i have function saves entire array ia file called 'filename' in json text file array file format: int intarr_save_json( intarr_t* ia, const char* filename ) { if(ia==null) { return 1; } int *arr=ia->data; int n=ia->len; int i; file *p; p=fopen(filename,"w"); if(p!=null) { fprintf(p,"[\n"); for(i=0;i<n;i++) { if(i!=n-1) { fprintf(p," %d,\n",arr[i]); } else { fprintf(p," %d\n",arr[i]); } } fprintf(p,"]"); fclose(p); return 0; } return 1; } and function loads new array file called 'filename', saved using intarr_save(). intarr_t* intarr_load_json( const char* filename ) { file* f = fopen(filename, "r"); if (f == null) return null; intarr_t* loaded = intarr_create(0);

mongodb - Update nested sub document using Node.js and mongoose -

i tried save details nested sub document tertiary . module.exports = mongoose.model('todo', { title : string, image:string, bgimage:string, secondary:[secondary] }); var secondary = new mongoose.schema({ title : string, image:string, bgimage:string, tertiary :[tertiary] }); var tertiary = new mongoose.schema({ title : string, description:string, image:string }); the code saving tertiary data below. have primary object id secondary object id. todo.findbyid(fields.primaryid, function (err, secondary_todo) { if (!err) { console.log("---inside not errot----"); console.log(fields.secondaryrefid); secondary_todo.secondary.findbyid(fields.secondaryrefid, function (err, tertiary_todo) { console.log("---in secondary data----"); console.log(tertiary_todo); if (!err) { tertiary_todo.tertiary

xamarin.forms - Installation of Xamarin in Visual Studio 2013 -

we have visual studio professional 2013 installed in windows 8.1 , have requirement cross platform development. can know how set xamarin vs professional 2013 in windows 8.1 ? please check here univeral installer https://developer.xamarin.com/guides/android/getting_started/installation/windows/ manual installation https://developer.xamarin.com/guides/android/getting_started/installation/windows/manual_installation/

Akka.Net cluster singleton - handover not occurs when current singleton node shutdown unexpectedly -

i'm trying akka.net cluster tools, in order use singleton behavior , seems work perfectly, when current singleton node "host" leaves cluster in gracefully way. if shutdown host node, handover not occur. background i'm building system composed 4 nodes (initially). 1 of nodes "workers coordinator" , responsible monitor data database and, when necessary, submit jobs other workers. thinking subscribe cluster events , use role leader changing event make actor (on leader node) become coordinator, think cluster singleton better choice in case. working sample (but if gracefully leave cluster) private void start() { console.title = "worker"; var section = (akkaconfigurationsection)configurationmanager.getsection("akka"); var config = section.akkaconfig; // create new actor system (a container actors) var system = actorsystem.create("singletonactorsystem", config); var cluster = cluster.get(system);