Posts

Showing posts from March, 2015

java - How one can pause and/or stop javafx.concurrent.Task? -

say, i've got javafx.concurrent.task nested thread , ie.: task task = new task(); thread thread = new thread(task); thread.start(); how can in situation pause and/or stop executing task nad resume work? there no easy way, except using deprecated suspend() , resume() methods on thread class. in case sure task doesn't enter synchronized code work otherwise have have halt points in task check if task has been halted , if call wait() on object block thread. call notify on object wake thread , resume. below chunk of pseudo code approach. note work expected need check halt variable in task code. class mytask{ volatile boolean halt = false; object o = new object(); public void run(){ while(notdone) { if (halt) halt(); } } private halt(){ synchronized (o){o.wait()} } public resume(){ halt = false; synchronized (o){o.notify()} } public suspend(){ halt=true; ...

c# - ServiceKnownType client side issue -

server side: service details: [serviceknowntype("getknowntypes", typeof(helper))] [servicecontract] public interface iappconfigurationmanager { [operationcontract] object changeobjectproperty(object mycustomobject); } implementation: public class appconfigurationmanager : iappconfigurationmanager { public object changeobjectproperty(object mycustomobject) { foreach (type type in globals.mycustomtypes) { if (type == mycustomobject.gettype()) { foreach (propertyinfo property in mycustomobject.gettype().getproperties()) { if(property.name == "id") { int oldvalue = convert.toint32(property.getvalue(mycustomobject)); property.setvalue(mycustomobject, oldvalue + 1); break; }; }; } } ...

git - Get private repos stats with Github API and ruby -

how can stats private repos in github ruby code? steps need do? know github api , have succeeded access public repo through curl command. i found guide useful https://developer.github.com/guides/getting-started/ getting informations private repos explained step step, can reproduce curl commands , adapt ruby. for instance, stats on contributors : curl -h accept:application/json -u "yourlogin:yourpassword" https://api.github.com/repos/yourusernameororganization/theprivaterepo/stats/contributors note putting password in command line not recommended it's easier understand way.

vagrant - "Job for system-cloudinit@-var-tmp-hostname.yml.service failed because a configured resource limit was exceeded" -

i starting using rancher , vagrant create local environment development. steps i've done: i had virtualbox installed. i download , installed vagrant package linux sudo rpm -i vagrant_1.7.2_x86_64.rpm vagrant version: vagran --version vagrant 1.7.2 i cloned rancher repo github: git clone git@github.com:rancherio/rancher.git which has vagrant file. after executing: sudo vagrant which step error, got this: ==> rancher: box 'coreos-alpha' not found. attempting find , install... rancher: box provider: virtualbox rancher: box version: >= 308.0.1 ==> rancher: loading metadata box 'http://alpha.release.core-os.net/amd64-usr/current/coreos_production_vagrant.json' rancher: url: http://alpha.release.core-os.net/amd64-usr/current/coreos_production_vagrant.json ==> rancher: adding box 'coreos-alpha' (v709.0.0) provider: virtualbox rancher: downloading: http://alpha.release.core-os.net/amd64-usr/709.0.0/coreos_produ...

touchscreen - Android touch screen power consumption -

hope question in right place! i wondering power consumption of app leaving phone screen on, light @ minimum level, screen may respond touch. how turning light higher level matter power consumption anyway? there way calculate/evaluate level of consumption in simple way? let's assume samsung galaxy * phone (running android). thanks! comparing screen backlight, touch screen power usage negligible (far less 0.1 ma). remaining backlight power consumption, @ almost-zero level, more significant. in addition, when screen remains on , device not locked, there not screen uses power, cpu not dropped in deep sleep mode , remains active.

jquery - Fade in div one after another with delay -

Image
i want the images should fade in right , scale 100% fade out right , vice versa and that's code the problem when second .spinner fade in behave different first 1 , when reaches 75% of transition go out of .row also third 1 appearing on next line , tried display:inline , doesn't work any please ? ps: forget red buttons , transition working 1 .spinner you want elements share same movement. so, initial position them must same. if use elements in flow, won't happen. position them absolutely: .spinner { position: absolute; left: 500px; } i have laso removed lot of prefixes no longer necessary, , added z-index changes. not perfect, need work on little... fiddle

javascript - Loop through jQuery Mobile list view data attribute -

i'm trying loop through data attribute of jquery mobile listview, can last element, , don't know why. var listitems = $("li.placeslist"); listitems.each(function (idx, li) { var $this = $(li); console.log($this.attr("id")); // works expected. shows ids console.log($this.data('distancia')); //it shows last item's data value of list }); the way i'm assigning data value in part of code is: $('<li class="placeslist"></li>').data({ location: pointsarray[pointcount].location, distancia: distancia }); i know data being added correctly. in console see correct values: 0.409 0.26 using $each() loop, see 3 correct ids, data of last element: a //id 0.26 b //id 0.26 what doing wrong? in advance.

c# - How to create large array of integers to test LongCount? -

i want allocate large array of integers test longcount operator. longcount operator used when, quote : you expect result greater maxvalue. so prepare test, want allocate array of integers little larger int32.maxvalue : int64[] arr = new int64[int32.maxvalue + 10ul]; but throws overflowexception . what want this: int64[] arr = new int64[int32.maxvalue + 10ul]; var res = arr.longcount(); and expect res 2147483657 (which int32.maxvalue + 10 ). how can this? you write own list implementation store several arrays , link them (or there's better 1 where..). map huge ulong int 2 int32 indexes there, implement ienumerable interface on it, , test away. ulong listsize = int32.maxvalue + 10ul; biglist<bool> mylist = new biglist<bool>(listsize); debug.assert(mylist.longcount() == (long)listsize); console.readkey(); example implementation.. public class biglist<t> : ienumerable<t> { private list<t[]> _storage = new li...

Dollars to Cents in AngularJS for Stripe Checkout -

so have value returned firebase looks this: 143.418 when run through angulars currency filter returns: {{invoice.pricing.gratotal | currency}} //returns : $143.42 i have integrated stripe checkout application , needs values so: 14342 so without decimal points or dollar signs. not formatted @ all. how original value rounded , remove decimal point sent stripe? i tried adding variables formatter: {{invoice.pricing.gratotal | currency:undefined:0}} but added dollar sign , removed cents together. $143 simply define filter uses math.round(amount * 100);

ios - How to fade in and out an ActivityIndicator in Swift? -

here activity indicator: self.activityindicator = uiactivityindicatorview(activityindicatorstyle: uiactivityindicatorviewstyle.whitelarge) self.activityindicator.center = self.view.center self.view.addsubview(activityindicator) i can start self.activityindicator.startanimating() , stop self.activityindicator.stopanimating() . i'd transition when stops more fluid , think nice fade out element on 400 milliseconds rather hiding when call stopanimating. any ideas on how this? // set initial state self.activityindicator.alpha = 0.0 // show self.activityindicator.startanimating() uiview.animatewithduration(0.4) { self.activityindicator.alpha = 1.0 } // hide uiview.animatewithduration(0.4, animations: { self.activityindicator.alpha = 0.0 }) { complete in self.activityindicator.stopanimating() }

c - Getting a “format not a string literal and no format arguments” warning while using GTK+2 -

i getting error this: warning: format not string literal , no format arguments [-wformat-security] gtk_buttons_ok, (const gchar*)message); ^ because of function: static void show_message (gchar *message, gtkmessagetype type) { gtkwidget *dialog = gtk_message_dialog_new(null, 0, type, gtk_buttons_ok, message); gtk_dialog_run(gtk_dialog(dialog)); gtk_widget_destroy(dialog); } how can fix it? the answer quite simple. you have add "%s" arguments of gtk_message_dialog_new() function this: static void show_message (gchar *message, gtkmessagetype type) { gtkwidget *dialog = gtk_message_dialog_new(null, 0, type, gtk_buttons_ok, "%s", message); gtk_dialog_run(gtk_dialog(dialog)); gtk_widget_destr...

html - Images won't display horizontally -

i tried using both inline , inline-block, doesn't work. here code: http://jsbin.com/bixako/edit in opinion, other answers sort of hacky , not address real cause of problem. reason why happening related using html <figure></figure> tag you've been putting <img /> tags inside of. the <figure> tag specifies self-contained content, illustrations, diagrams, photos, code listings, etc. while content of element related main flow, position independent of main flow , , if removed should not affect flow of document. source: http://www.w3schools.com/tags/tag_figure.asp the <figure> tag going automatically displace element's position independent of main content flow, , why seems move flow using css float or position: absolute because float , absolute position displace element's position it's main position flow. eliminate <figure> tags , once again able use white-space: nowrap; , display: inline-block; ...

How to group with Emmet -

div>header>ul>li*2>a+footer>p not working me. need group whatever between ul , a . how can this? you can group things emmet brackets. in case: div>header>(ul>li*2>a)+footer>p give try.

backbone.js - How to let Webpack require a root node_module instead of an child package? -

i have installed backbone , backbone.babysitter trough npm. when use backbone in scripts this: import backbone "backbone"; loads installed backbone version 1.2.1 . works fine until want use backbone.babysitter. when backbone.babysitter loads needs add properties backbone itself. package of backbone.babysitter imports own backbone dependency in own node_modules folder, backbone on 1.2.0 . attaches methods different backbone working with. how can force webpack require backbone root node_modules folder backbone.babysitter? found workaround here module.exports = { resolve: { alias: { 'backbone': require.resolve('backbone') } } }

ios - Display button on UICollectionViewCell after UILongPressGestureRecognizer -

i have uilongpressgesturerecognizer on cell collectionview , want display button (and others) cells after long touch happens. here's code: func collectionview(collectionview: uicollectionview, cellforitematindexpath indexpath: nsindexpath) -> uicollectionviewcell { let cell: cellcontroller = collection.dequeuereusablecellwithreuseidentifier("cell", forindexpath: indexpath) as! cellcontroller cell.exitbutton.hidden = true return cell } i want set false cell.exitbutton.hidden after touch happen. thanks in advance have bool variable in collectionview's class scope. when detect long press, modify bool variable. in example, i'll declare var exitbuttonhidden = true . change implementation of cellforitematindexpath , such modifies cell.exitbutton.hidden = true cell.exitbutton.hidden = exitbuttonhidden . now, need call reloaddata on collectionview whenever detect long press collectionview gets chance refresh cell...

c++ - Can't find my mistake! error: expected identifier before '(' token -

this main code, did search related mistakes before asking doesn't seem wrong...the ide says error in line 11. #include<stdio.h> int main() { float sal; printf("digite o salário bruto: "); scanf("%f",&sal); if(sal<=2246.75){ printf("salário líquido : ",sal); } else{ if(sal>2246.75)&&(sal<2995.70){ printf("salário líquido: ",sal * 0.925); } else{ if(sal>2995.70)&&(sal<=3743.19){ printf("salário líquido: ",sal * 0.845); } else{ printf("salário líquido: ", sal * 0.775); return 0; } } } } if(sal>2246.75)&&(sal<2995.70){ the problem entire condition must placed within set of parentheses. it's fine if want further enclose sub-conditions, must surround entire lot, too: if ((sal ...

caching - Google Chrome Manifest fetch failed (6) -

i reworking app made while ago work offline. when page loads, cache.manifest found , caches pages correctly. however, when refresh page when not connected, ton of errors. one of errors manifest fetch failed (6) , which, according this answer means network_error . not connected internet, point of making website available offline, right? other errors of files use, saying net::err_internet_disconnected , these files in cache.manifest , me not make sense. i don't totally blank page either. inspecting page reveal index page, seems others not load correctly. looking chrome://appcache-internals/ shows files in cache correctly. this cache.manifest looks like: cache manifest cache: images/arandomimage.jpg bower_components/polymer/polymer.html bower_components/polymer/polymer.js bower_components/polymer/layout.html #etc possibly worth noting i'm using polymer 0.5 . have tried turning off chrome running in background , removing cache folder, no avail. missing? ...

linux - SSH connection on ec2 -

i'm trying connect aws ec2 instance keep being refused. i'm using same computer, same wifi when connect 1 of ec2 instance, fails. when connect, says.. ssh -i successintoeflcom.pem ec2-user@52.68.152.179 ssh: connect host 52.68.152.179 port 22: connection refused ssh -v successintoeflcom.pem ec2-user@52.68.152.179 openssh_6.2p2, osslshim 0.9.8r 8 dec 2011 debug1: reading configuration data /etc/ssh_config debug1: /etc/ssh_config line 26: applying options * ssh: not resolve hostname successintoeflcom.pem: nodename nor servname provided, or not known i looked @ /etc/ssh_config line 26, , found host * sendenv lang lc_* something got wrong, haven't found way make right. i tried deleting ec2 instance , make new 1 new ssh key , new eip did not work. honestly, i'm new ssh settings. appreciated. ps reason, able connect other ec2 instance on other aws account, use work. check security groups inbound settings, make sure ssh protocol enabled source a...

vis.js - VisJS Stabilization -

i have visjs chart , want "fit" add content it. have 200 nodes , 2000 edges. i have defined these options, note have said "fit:true" in stabilization options. however, if stabilization iterations less 100, chart not fit @ all. i want keep number of stabilizations low chart loads - want keep fitted. i not able chart fitted till call fit function many times over, , assuming there should simple way this. can please let me know. var options = { nodes: { shape: 'dot', scaling: { label: { min: 20, max: 40 }, } }, edges: { smooth: { enabled: true, type: "dynamic", // roundness: 0.5 },}, interaction: { multiselect: false, navigationbuttons: true, selectable: true, selectconnectededges: true, tooltipdelay: 100, zoomview: true }, ...

ruby - Rails, Postgres, ActiveRecord query postgres based on columns value -

i working rails , postgresql , i'm trying query postgres db based on value of column. to put perspective, have events table in postgres , in table have events recurring , aren't based on column value of repeats . if events recur, have value of daily , weekly , monthly , etc. inside of repeats column. obviously, if doesn't recur value set null . i receive events recur in repeats column. if it's null, query skip on it. i've looked through activerecord query interface due inexperience, unable find helper trick me. please let me know if more info needed. any advice appreciated. thanks! event.where.not(repeats: nil) alternatively, can specify sql stream event.where("repeats not null")

lisp - Invalid specialized parameter in method lambda list -

i trying write simple coin flip program in common lisp. code have (defun yn (let ht (random 1) (if (eq ht 1) (princ heads) (princ tails)) ) ) it seems simple enough, keep getting error: "invalid specialized parameter in method lambda list (let ht (random 1) (if (eq ht 1) (princ heads) (princ tails))): (if (eq ht 1) (princ heads) (princ tails))" ) what wrong here? for defun without parameters, there should empty parameter list, following: (defun yn () (let ((ht (random 2))) (if (eq ht 1) (princ heads) (princ tails))))

javascript - Updating Columns Dynamically - Alloy UI -

i'm trying change columns dynamically in alloy ui datatable - depending on button selected, columns changed depending on data returned. my columns updated, actual data never included in table. when don't define columns both columns , data returned - of course want control of how columns displayed , want set attributes below code: var datatable = new y.datatable({ //defining datatable no columns preset editevent: 'dblclick', plugins: [{ cfg: { highlightrange: false }] }); button.on( 'click', //on click... function() { var category = $(this).attr("id"); //value retrieved id of button selected datasource = new y.datasource.io({source: '/searchmydata datasource.sendrequest({ datatype: 'json', on: { success: function(e) { response = e.data.responsetext; setcolumnnames(category); //set colum...

mysql - Sending data of variable length to SQL table from PHP, is there a better way? -

i have json string coming php file js/ajax. number of entries dynamic, ranging 6 30. i populate array follow $myarray = array(); $datalength= count($decodedjson['make'][0]['model'][0]['color']); ($x = 0; $x < $datalength*2; $x+=2) { $myarray[$x] = $decodedjson['make'][0]['model'][0]['color'][$x/2]['int']; $myarray[$x+1] = $decodedjson['make'][0]['model'][0]['color'][$x/2]['ext']; } ($x = $datalength*2; $x < 30; $x++) { $myarray[$x] = 0; } so gives me array end-padded zeros data @ front. now, want insert sql table has maximum number of column $sql = "insert cars values ( '$datalength', '$myarray[0]', '$myarray[1]', '$myarray[2]', '$myarray[3]', '$myarray[4]', '$myarray[5]', '$myarray[6]', '$myarray[7]', '$myarray[8]', '$myarray[9]', '$myarray[10]', '$myarray[11]...

c++ - Understanding base class initialization -

consider program: #include<iostream> #include<vector> struct { int a; a(int) { } virtual int foo(){ std::cout << "base" << std::endl; return 5; } }; struct b : { int b; b(): b(9), a(foo()) { } virtual int foo(){ std::cout << "derived" << std::endl; return 6; } }; b b; //prints derived int main(){ } demo what scott meyers in effective c++ said : during base class construction of derived class object, type of object of base class. so, expected base printed instead, because under base class class construction while invoking foo function. did miss? maybe it's ub? if so, please point me out relevant section. scott means while in base class constructor usual rules virtual function don't work. if in base class constructor virtual functions(of base class) called inside ctor called on object under construction in ctor. so code prints correct result: foo() called in b ...

windows - Is it possible to send the content of text file over PuTTY over serial port -

here's do. i'd send text content of file on serial port, on putty. know extensions exists such xmodem , zmodem, use checksum protocols confirm file sent on port. however, requirements more simple. i'd send bunch of text (in file) on serial port in windows (under linux must more simple), preferred terminal program putty. possible? there terminal program has type of feature built it? use plink (a command-line connection tool putty suite). it's console application intended automate connection tasks, yours. being console application, can redirect input text file: plink.exe -serial -sercfg ... < input.txt see using command-line connection tool plink see related how execute remote command using putty on telnet .

sql - two foreign keys to same primary key select statement MYSQL -

first table "teams" has teamcode(varchar 5) , teamname (varchar 20) second table "season" has hometeam (varchar 5) , team2 (varchar 5), gameday (date) hometeam & team2 fks connected teamcode pk table: teams | teamcode | teamname | |:-----------:|:--------------| | 1 | usa | | 2 | uk | | 3 | japan | table: season each team plays other once home team | team1 | team2 |gameday |:-----:|:------|:------| | 1 | 2 | 7 jan| | 1 | 3 | 14 jan| | 2 | 1 | 21 jan| | 2 | 3 | 28 jan| | 3 | 1 | 4 feb| | 3 | 2 | 11 feb| i want query display team names , day play together so should like hometeam name | team2 name | gameday try this select t1.name host , t2.name guest, s.date [dbo].[season] s inner join [dbo].[team] t1 on s.hostteam = t1.id inner join [dbo].[team] t2 on s.guestteam = t2.id

When PUTting to a playlist on Soundcloud's API, the playlist doesn't actually get updated? -

when try http put soundcloud playlist through api, data structure: {"tracks": [{"id": 12345}, {"id": 45678}]} , playlist doesn't updated. api returns 200 response in playlist, ignoring modifications. what think might wrong the soundcloud api doesn't accept format of data somehow authorization invalid, though it's returning 200 the code: import requests playlist_url = 'https://api.soundcloud.com/playlists/xxxxx?client_id=xxxxx' like_url = 'https://api.soundcloud.com/users/xxxxx/favorites?client_id=xxxxx' likes = requests.get(like_url) likes_json = likes.json() # oauth2_token = requests.post('https://api.soundcloud.com/oauth2/token', data=opts).json() oauth2_token = 'xxxxx' playlist = {'tracks': []} in likes_json[::-1]: track_id = like['id'] playlist['tracks'].append({'id': track_id}) resp = requests.put('https://api.soundcloud.com/playlists/xxxxx', j...

jquery - GET request inside of a loop in JavaScript -

so, code looks for(int n = 0; n < object.length; n++){ /*other code */ $.get(...,function(data){ //do stuff });} now, other code executes multiple times should. however, when command ran, ran once , when n reaches object.length. causes sorts of errors. n being incremented in loop. can not loop get/post commands? or if can, doing wrong? thanks. the for-loop won't wait $.get call finish need add async flow control around this. check out async.eachseries . done callback below key controlling loop. after success/fail of each $.get request call done(); (or if there's error, call done(someerr); ). advance array iterator , move next item in loop. var async = require("async"); var list = ["foo", "bar", "qux"]; async.eachseries(list, function(item, done) { // perform request each item in list // url?somevar=foo // url?somevar=bar // url?somevar=qux $.get(url, {somevar: item}, function(data) { ...

enums - What's the cleanest way to set up an enumeration in Python? -

this question has answer here: how can represent 'enum' in python? 43 answers i'm relatively new python , interested in finding out simplest way create enumeration. the best i've found like: (apple, banana, walrus) = range(3) which sets apple 0, banana 1, etc. but i'm wondering if there's simpler way. enums added in python 3.4 ( docs ). see pep 0435 details. if on python 2.x, there exists backport on pypi. pip install enum34 your usage example similar python enum's functional api: >>> enum import enum >>> myenum = enum('myenum', 'apple banana walrus') >>> myenum.banana <myenum.banana: 2> however, more typical usage example: class myenum(enum): apple = 1 banana = 2 walrus = 3 you can use intenum if need enum instances compare equal integers, do...

java - How to partially mock a dependency abstract object in JMockit -

i have abstract class d dependency of tested class t . the test class: public class t_test { @tested t tested; d dependency; public void test() { dependency.dosomething(); tested.testedmethod(dependency); } } i want dependency.dosomething() run real code of method, abstract methods mocked. if run test is, nullpointerexception using uninitialized dependency . if add @mocked annotation d dependency line, methods in d mocked, d.dosomething() doesn't it's supposed do. if keep @mocked annotation , add empty nonstrictexpectations block @ beginning of test method, in order have partial mock, either this: new nonstrictexpectations(d.class) {}; or this: new nonstrictexpectations(d) {}; i java.lang.illegalargumentexception: mocked: class d . if keep nonstrictexpectations block , remove @mocked annotation, again nullpointerexception using uninitialized dependency . so how can partially mock dependency abstract clas...

smalltalk - Syntax for class and instance variables and methods in Pharo 4.0 -

Image
i learning pharo online , not sure if got syntax correct creating class , instance variables. please correct me if wrong :- class (static) method created on class side of pharo, name, email, phone instance variables of class createuser: createnewuser:arguments name:username email:useremail phone:userphone to call static method of class createuser, following :- createuser name:username email:useremail phone:userphone if want create instance variable name, method declaration same above, on instance side of class. however, when call method, call using keyword "new" create new instance under: createuser new name:username email:useremail phone:userphone when run above code , call method statically, error message as:- messagenotunderstood: createuser class >>name:email:phone: however, when go createuser class recheck, see above method create on class side : createuser:name:email:phone: my queries below: 1. doing wrong ...

javascript - AngularJS Bypass promise if data is present in cache -

i sending ajax request fetch data server , storing in local variable. inside service. in controller using promise data when needed. first time works because no cache detected , promise returned next time onwards not returning promise service function , hence javascript error. my function in service is: getproductdetails: function(product) { if(!productdetailsarr[product.id]) { if (!promiseproductdetails) { // $http returns promise, has function, returns promise promiseproductdetails = $http.get(product.id + '/productdetails.json').then(function(response) { productdetailsarr[product.id] = response; return productdetailsarr[product.id]; }); } // return promise controller return promiseproductdetails; } else { return productdetailsarr[product.id]; } } in controller have invoked above function ...

javascript - Pattern which take input in just positive integer -

i want take input in positive integer @ front end. make pattern takes input negative integers don't want negative integer in input. kindly me. echo "<input type=number pattern=[0-9] value='" . $counter_row['counter_balance'] . "' name=new_cash class=input_panel>"; that markup looks pretty invalid. need double quotes around properties values , regular expression pattern half finished, unclosed. looking for, more or less: echo '<input type="number" pattern="[0-9]+" value="' . $counter_row['counter_balance'] . '" name="new_cash" class="input_panel">'."\n";

php - MySQL Errors - phpBB3 -

being complete noob @ php, i've been trying install phpbb3 several mods. however, has broken site , can't receive support official forums unless know mod causing problems. here error message i'm receiving: sql error [ mysqli ] have error in sql syntax; check manual corresponds mysql server version right syntax use near '*, pb.id pb_id, pb.holding pb_holding (phpbb_users u cross join phpbb' @ line 1 [1064] sql select u.*, z.friend, z.foe, p.*, gu.personal_album_id, gu.user_images, .*, pb.id pb_id, pb.holding pb_holding (phpbb_users u cross join phpbb_posts p) left join phpbb_zebra z on (z.user_id = 2 , z.zebra_id = p.poster_id) left join phpbb_gallery_users gu on (gu.user_id = p.poster_id) left join phpbb_points_bank pb on (pb.user_id = p.poster_id) p.post_id = 3 , u.user_id = p.poster_id backtrace file: (not given php) line: (not given php) call: msg_handler() file: [root]/includes/db/dbal.php line: 757 call: trigger_error() file: [root]/includes/db...

slidetoggle - jQuery Toggle for Mobile Menu -

i'm using mobile menu toggles open on screen width of less 768px toggle on screen width higher 769. did change operator < 769 doesn't work. jquery(function( $ ){ $(".nav-primary .main-nav-menu").addclass("responsive-menu").before('<div class="responsive-menu-icon"></div>'); $(".responsive-menu-icon").click(function(){ $(this).next(".nav-primary .main-nav-menu").slidetoggle(); }); $(window).resize(function(){ if(window.innerwidth > 768) { $(".nav-primary .main-nav-menu, .nav-primary .sub-menu").removeattr("style"); $(".responsive-menu > .menu-item").removeclass("menu-open"); } }); $(".responsive-menu > .menu-item").click(function(event){ if (event.target !== this) return; $(this).find(".sub-menu:first").slidetoggle(function() { ...

My protocol definition is not visible in another Swift file -

i have 2 files: dbstartviewcontroller.swift , dbfindviewcontroller.swift when define protocol : protocol dbviewanimationtransitioning { var viewforanimation: uiview? { set } } in dbstartviewcontroller.swift not visible in dbfindviewcontroller.swift . error: use of undeclared type dbviewanimationtransitioning . but when move declaration dbfindviewcontroller.swift ok. why works that? i need have in dbstartviewcontroller.swift make code clean , clear. if classes reside in separate app targets, make sure use public access modifier protocol. default it's internal , means it's shared within module, not visible outside.

c# - How to make enemies turn and move towards player when near? Unity3D -

i trying make enemy object turn , start moving towards player object when player comes within vicinity. for turning have been testing transform.lookat() function although isn't returning desired results when player close enemy object enemy starts tilt backwards , want enemy able rotate along y axis, in advance. using unityengine; using system.collections; public class enemycontroller : monobehaviour { public transform visionpoint; private playercontroller player; public transform player; public float visionangle = 30f; public float visiondistance = 10f; public float movespeed = 2f; public float chasedistance = 3f; private vector3? lastknownplayerposition; // use initialization void start () { player = gameobject.findobjectoftype<playercontroller> (); } // update called once per frame void update () { // not giving desired results transform.lookat(player); } void fixedupdate () { ...

dropwizard - One to one chat in Atmosphere java -

i able find couple of examples broadcasting messages atmosphere framework in java couldn't find concrete example 1 one chat. deliver messages particular users intended for. use broadcaster#broadcast(object, atmosphereresource) deliver message specific connection.

android - Change layout of EditText on state "selected" -

i trying obtain edittext changing it's colors , layout when user clicks on type something, , custom drawable, attributes android:state_enabled="true" android:state_focused="true"> don't work @ all, meaning don't called. edittext : <edittext android:id="@+id/field_user_info" android:hint="nome e cognome" android:layout_margintop="8dp" android:layout_marginbottom="8dp" android:padding="8dp" android:maxlines="1" android:background="@drawable/custom_account_edittext" android:layout_width="match_parent" android:layout_height="wrap_content" android:textcolorhint="@color/texthint"/> custom_account_edittext drawable: <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item> <shape android:shape="rectangle"> ...

visual studio 2010 - Error with argument and procedure -

i have use subroutine ( neqnf ) included in imsl library, let me solve non-linear systems. (link users manual, neqnf page here ) main.f90 , is: program prova_sistema_in_un_modulo include "link_fnl_shared.h" use neqnf_int use modx implicit none call d_neqnf(fcn, x, xguess=x_guess, fnorm=f_norm) end program prova_sistema_in_un_modulo where subroutine fcn coded in external module, modx.f90 : module modx implicit none integer, parameter :: ikind = selected_real_kind(8,99) integer :: n=3 real(kind=ikind) :: f_norm real(kind=ikind), dimension(3) :: x, x_guess=(/ 4.0, 4.0, 4.0/) contains subroutine fcn(x,f,n) integer :: n !dummy var real(kind=ikind), dimension(3) :: x, f !dummy var f(1)=x(1)+a(x(1))+(x(2)+x(3))*(x(2)+x(3))-27.0 ! =0 f(2)=b(x(1),x(2))+x(3)*x(3)-10.0 ! =0 f(3)=z(x(2),x(3)) ! =0 end subroutine fc...

ElasticSearch Nest AutoComplete based on words split by whitespace -

i have autocomplete working elasticsearch (nest) , it's fine when user types in letters begining of phrase able use specialized type of auto complete if it's possible caters words in sentence. to clarify further, requirement able "auto complete" such: imagine full indexed string "this title" . when user types in "th" , comes suggestion current code. i same thing returned if user types in "som" or "title" or letters form word (word being classified string between 2 spaces or start/end of string). the code have is: var result = _client.search<contentindexable>( body => body .index(indexname) .suggestcompletion("content-suggest" + guid.newguid(), descriptor => descriptor .onfield(t => t.title.s...

How to get public link for the uploaded file on google cloud storage in local dev server(Google App engine+JAVA) -

i trying upload image files using gcs client library+java in local google app engine dev server. images uploaded , can see entries created in local datastore under localhost:8888/_ah/admin/datastore how public key uploaded images can show images in application. example profile pic. sample copy of code: string filepath = constants.gcsurl + "/" + bucketname + "/"+ objectname; gcsservice gcsservice = gcsservicefactory .creategcsservice(new retryparams.builder() .initialretrydelaymillis(10).retrymaxattempts(10) .totalretryperiodmillis(15000).build()); gcsfilename filename = new gcsfilename(bucketname, objectname); gcsfileoptions options = new gcsfileoptions.builder() .addusermetadata("cache-control", "max-age=" + (86400 * 365)).mimetype(mimetype) .acl(acl_public_read).build(); gcsoutputchannel wri...

php - form name Order break my design in cakephp -

<?php echo $this->form->create('order', array( 'inputdefaults' => array( 'label' => false, 'div' => false ), 'id'=> 'form-validate', 'class' => 'form-horizontal', 'novalidate'=>'novalidate' ) ); ?> the above code worked fine few moment ago. set flash message entire page broken. if change form name works fine again. following code works fine: <?php echo $this->form->create('order1', array( 'inputdefaults' => array( 'label' => false, ...

objective c - How to add UIImage object into NSMutableArray in iOS -

i'm trying add uiimage objects array not being added. please help my code: imagearray = [[nsmutablearray alloc] init]; arry = [[nsmutablearray alloc] init]; [arry addobject:@"http://adjingo.2cimple.com/content/151/image/6291.jpg"]; [arry addobject:@"http://adjingo.2cimple.com/content/151/image/6290.jpg"]; //fetch images web , store in array (int i=0; i<[arry count]; i++) { nsstring *string=[arry objectatindex:i]; nsurl *url=[nsurl urlwithstring:string]; nsmutableurlrequest *request = [nsmutableurlrequest requestwithurl:url]; [nsurlconnection sendasynchronousrequest:request queue:[nsoperationqueue mainqueue] completionhandler:^(nsurlresponse *response, nsdata *data, nserror *error) { if ( !error ) { uiimage *image = [[uiimage alloc] initwithdata:data]; //store i...

ubuntu - How to prevent user from removing lines from a file ( so he could only add lines,never remove) -

i'm trying fight bad habit of wasting time on time-consuming websites such reddit/liveleak etc. the thing seems work adding line etc/hosts 127.0.1.1 www.reddit.com it works few days when got nothing edit file , remove line , start wasting life again. is way make etc/hosts file immune changes delete ? (so able add things when stumble upon website think potential threat time) it perfect if way delete hosts's immunity deleting lines installing system once again,because wouldnt browse reddit. it important me , extremely grateful help. do chmod 644 /etc/hosts on file , chmod root:root /etc/hosts . remove account sudoers file. ask else change root password not know it. keep in mind can control not other way. way might face problems in other tasks require root privileges.

javascript - SAPUI5 How to create a custom control by extending existing control -

i have customize functionality of existing control (facetfilter). not customize functionality of renderer of facetfilter. can please me in this. the code have in xml is <facetfilter id="idfacetfilter" type="simple" showpersonalization="true" showreset="true" reset="handlefacetfilterreset" lists="{/productcollectionstats/filters}"> <lists> <facetfilterlist title="{type}" key="{key}" active="false" multiselect="true" listclose="handlelistclose" items="{values}" > <items> <facetfilteritem text="{text}" key="{key}" count="{data}" /> </items> </facetfilterlist> </lists> </facetfilter> i tried extend control, code tried below, ...

jsf - render based on h:selectOneMenu value -

this question has answer here: how conditionally render plain html elements <div>s? 4 answers i want display div layers based on h:selectonemenu selected value. cr eated code: <h:selectonemenu id="zone" value="#{download.zone}" style="width: 212px;"> <f:selectitem id="select" itemlabel="select download mirror" itemvalue="select download mirror" /> <f:selectitem id="usa" itemlabel="usa" itemvalue="usa" /> <f:selectitem id="canada" itemlabel="canada" itemvalue="canada" /> </h:selectonemenu> ... private string zone; public string getzone() { return zone; } public void setzone(string zone) { this.zone = zone; } this div layer want display...

c# - Print lists in a list to excel, randomly stops printing after 0.5-6 lists. Comexpection 0x800AC472 -

first of have have codes filling lists of strings, after puts lists in 1 big list. when want print lists in excel sheets, stops after pint half of first list, or stops after print 5 , half list, , says: exception hresult: 0x800ac472. there 30 tabs in excel doc, not problem. feel free rename title, ihad no idea how call problem. this how print lists in excel: for (int = 0; < listoflists.count; i++) { (int j = 1; j <= listoflists[i].count; j++) { exceldatahandler.excel_setvalue("a" + j, listoflists[i][j-1], "", (i+1)); //a = cell, data of list, color of cell, sheetnumber } } excel_setvalue method: public void excel_setvalue(string cellname, string value, string color, int worksheet) { ((microsoft.office.interop.excel._worksheet)newworkbook_first.sheets[worksheet]).get_range(cellname).set_value(type.missing, value); if (color == "red") { newsh...

parsing - PHPMailer error - HTML email error -

i new php , installed phpmailer using composer in system. facing problem html message trying send. i have tried send plain text , working fine , getting response of phpmailer. below code : <?php require_once 'autoload.php'; $mail = new phpmailer; $mail->issmtp(); $mail->host = 'smtp.gmail.com'; $mail->smtpauth = true; $mail->username = 'email@exapmle.com'; $mail->password = 'password'; $mail->smtpsecure = 'ssl'; $mail->port = 465; $mail->from="mailer@example.com"; $mail->fromname="my site's mailer"; $mail->sender="mailer@example.com"; $mail->addreplyto("replies@example.com", "replies site"); $mail->addaddress("receiver@example.com"); $mail->subject = "test 1"; $mail->ishtml(true); $mail->body = '<html> <head> <l...