Posts

Showing posts from June, 2011

google chrome - AngularJS custom validation directive: cursor jumps to end of string -

i wrote custom angularjs directive dynamically adds ng-pattern , other stuff. it works, in chrome , internet explorer, if user tries enter chars in middle of existing string, cursor jumps end of string. in firefox works fine. (tested chrome 44, firefox 40, ie 11) html: <input type="text" name="input1" ng-model="value1" validation-directive> js: myapp.directive("validationdirective", function ($compile) { return { restrict: 'a', link: function (scope, element) { element.removeattr('validation-directive'); // necessary avoid infinite compile loop element.attr("ng-pattern", new regexp("^[a-z]{0,10}$")); //do more stuff... $compile(element)(scope); } }; }); http://jsfiddle.net/y8416aax/ why happened? , can fix that? thanks! basically need remove directive attribute , add ng-pattern attribute compile...

c++ - Real world example of noticeable unsafe behavior of multithreaded code with volatile -

i've read multiple answers , articles stating why volatile doesn't make multithreaded c++ code safe. i understand reasoning, think understand possible dangers, issue can't create or find example code or mention of situation program using synchronization produces visible wrong or unexpected behavior. don't need reproducible (as current compilers optimizations seem try producing safe code), example happened. say have counter want use keep track of how many times operation completed, incrementing counter each time. if run operation in multiple threads unless counter std::atomic or protected lock unexpected results, volatile not help. here simplified example reproduces unpredictable results, @ least me: #include <future> #include <iostream> #include <atomic> volatile int counter{0}; //std::atomic<int> counter{0}; int main() { auto task = []{ for(int = 0; != 1'000'000; ++i) { ...

javascript - Is there a command to keep the iPhone camera recording? -

basically, have idea app, iphone camera keep recording video when user doing else (like checking twitter, example) spy cam. have many coding solutions available is there way can code either html5 ,css, javascript or xcode? ios not allow run camera in background. because once each app enters background state, has short time wrap-up it's processes , prepare suspended (ios conserve memory). from apple developer docs in ios, specific app types allowed run in background: apps play audible content user while in background, such music player app apps record audio content while in background apps keep users informed of location @ times, such navigation app apps support voice on internet protocol (voip) apps need download , process new content regularly apps receive regular updates external accessories the other way achieve want jailbreak device , distribute app on cydia (the jailbroken app store). jailbreaking free device restr...

java - NullPointerException when trying to apply custom font to a button -

i declared public button testbutton; public typeface font; in mainactivity.java. then, in onwindowfocuschanged() inside mainactivity, put in testbutton = (button)findviewbyid(r.id.testbutton); font=typeface.createfromasset(getassets(), "condensed.ttf"); testbutton.settypeface(font); and there's error happening: 08-16 16:33:40.078 27339 27339 e androidruntime: java.lang.nullpointerexception: attempt invoke virtual method 'void android.widget.button.settypeface(android.graphics.typeface)' on null object reference but button isn't null, because i'm using onclicklistener on displays toast when clicking button (but in oncreate method) what doing wrong? works many others, , couldn't me. edit: apparently had initialize button variables inside oncreate(), if want same textview, have initialize textview variable inside onwindowsfocuschanged(). information people having same problem in future. i think should verify font path cond...

javascript - Text field display bug in cordova -

Image
something's wrong display of app when tried build in cordova. here's code: <html> <head> <meta http-equiv="content-security-policy" content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *"> <meta name="format-detection" content="telephone=no"> <meta name="msapplication-tap-highlight" content="no"> <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width"> <link rel="stylesheet" type="text/css" href="css/index.css"> <link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" /> <script src="http://code.jquery.com/jquery-1.11.1.min.js...

php - PDO: UPDATE not working -

i wrote code update mysql table via php/pdo. not working , can't figure out mistake is. execute() returns true, changes never show in table. my code looks pretty this: $columnobject = array( "emailaddress"=>"aaa@aaa.com", "passwordhash"=>"56bj5g63j4g57g567g5k75jh7gk4g74j5hg67", "name"=>"qweqweqwe", "lastactivity"=>4128649814 ); $knowncolumnname = "emailaddress"; $knowncolumndata = "aaa@aaa.com"; foreach ($columnobject $columnname => $columndata) { $pdoupdatestring .= $columnname . "=:" . $columnname . ","; $pdoexecuteobject[$columnname] = $columndata; } $pdoupdatestring = rtrim($pdoupdatestring, ","); $pdoexecuteobject['knowncolumn'] = $knowncolumndata; $q = $this->hcon->prepare('update ' . $this->name . ' set ' . $pdoupdatestring . ' ' . $knowncolumnname . '=:knowncolum...

c++ - Iterating through function_traits arguments -

i'm trying "template metaprogramming" stuff make exposing c++ functions python bit easier. i'd take existing function , generating string containing info return type , arguments (a typeinfo fine too). i'm using function traits class based off (stolen from) this wordpress article , rather hard code accesses first few arguments i'd iterate through them all. i gather need make template function takes size_t value argument index (since must constant), that's bit lost. i've written code, can't work in basic of cases (let alone generic case i'm after.) // stolen function_traits struct...thing template<typename t> struct function_traits; template<typename r, typename ...args> struct function_traits<std::function<r(args...)>> { static const size_t nargs = sizeof...(args); using result_type = r; template <size_t i> struct arg { using type = typename std::tuple_element<i, std::tu...

python - call_command argument is required -

i'm trying use django's call_command in manner similar this question without answer . the way i'm calling is: args = [] kwargs = { 'solr_url': 'http://127.0.0.1:8983/solr/collection1', 'type': 'opinions', 'update': true, 'everything': true, 'do_commit': true, 'traceback': true, } call_command('cl_update_index', **kwargs) in theory, should work, according the docs . doesn't work, doesn't. here's add_arguments method command class: def add_arguments(self, parser): parser.add_argument( '--type', type=valid_obj_type, required=true, help='because solr indexes loosely bound database, ' 'commands require correct model provided in ' 'argument. current choices "audio" or "opinions".' ) parser.add_argum...

asp.net mvc 4 - How to send email on specific date using quartz.net -

i creating birthday app in asp.net mvc in want send reminder email user. using quartz.net purpose have no idea how send email on specific date (that user enter in textbox) here code: public static void start() { ischeduler scheduler = stdschedulerfactory.getdefaultscheduler(); scheduler.start(); ijobdetail job = jobbuilder.create<logincontroller>() .withidentity("emailreminder", "group1") .build(); itrigger trigger = triggerbuilder.create() .withidentity("emailreminder", "group1") .startat(//how value here?) .withsimpleschedule( x => x .withintervalinhours(1) .repeatforever()) .build(); scheduler.schedulejob(job, trigger); i there startat() function job how can value enter user , pass ...

r - paste doesn't recognize object -

i'm trying run function, when try compile it, says: error in paste("http://uk.advfn.com/p.php?pid=financials&symbol=", symbol, : object 'symbol' not found fund.data <- function ( symbol, # ticker n=10, # number of periods mode=c('quarterly','annual'), # periodicity max.attempts=5 # maximum number of attempts download before exiting ) dirname(sys.frame(1)$ofile) { all.data = c() option.value = -1 start_date = c('istart_date,start_date') names(start_date) = c('quarterly,annual') repeat { # download quarterly financial report data if(option.value >= 0) { url = paste('http://uk.advfn.com/p.php?pid=financials&symbol=', symbol, '&btn=', mode[1], '_reports&', start_date[mode[1]], '=', option.value, sep = '') } else { url = paste('http://uk.advfn.com/p.php?pid=financials&symbol=', symb...

Android App Widget -

i wanna ask regarding android widget. i'm done creating app widget application , asking if android widget has way of delaying right after clicking/tapping button. after clicking or tapping button if there notice appear if has been tapped wait 10 seconds. reply in advance. you can store when next valid click in member variable // create static store valid click time private static long nextvalidtime = new date().gettime(); // ... snip ... // inside onclick listener if (nextvalidtime >= date().gettime()) { nextvalidtime = new date().gettime() + 10; // dosomething } else { // show dialogue click }

matlab - How to distinguish the two picture matrices? -

i have picture matrix a , size of 200*3000 double . , have picture matrix b , size of 200*1000 double . 1000 columns of matrix b comes columns of matrix a . question is: how matrix c same size of matrix a , keep original values of columns in matrix b ? mean size of matrix c 200*3000 double , 1000 columns have same values matrix b . other 2000 columns set value d , second question, value should set d , picture matrix c can distinguish picture matrix a ? use ismember 'rows' option. here's example: a = [1 2 3 4; 5 6 7 8]; %// example b = [3 10 1; 7 20 5]; %// example b val = nan; %// example value indicate no match c = a; %// initiallize ind = ismember(a.',b.','rows'); %// matching columns c(:,~ind) = val; %// set non-matching columns val equivalently, coud replace ismember bsxfun , line becomes ind = any(all(bsxfun(@eq, a, permute(b, [1 3 2])), 1), 3); in example, a = 1 2 3 4 5 6 ...

java - JavaFX updating FilteredList when item field has changed -

i have observablelist , filteredlist contains attached files field state . filteredlist set listview. want when changed field state state.removed, has been updated filteredlist. /* class item */ private final observablelist<attached> attaches = fxcollections.observablearraylist(); private final filteredlist<attached> filteredattaches = attaches.filtered(attached -> attached.getstate() != attached.state.removed); /* controller */ listattached.setitems(item.getattachesfordisplay()); /* class attached */ public class attached { public static enum state { new, attached, removed } private state state; private final string path; private final string name; public attached(state state, string path, string name) { this.state = state; this.path = path; this.name = name; } public state getstate() { return state; } public void changestate(state state) { this.state = state; // generate event update filtered list? } public string getpath() ...

c++ - How to initialise a 3D array wich is of type myStruct in Swift? -

after heavy searching, found intuitive way of initialising 3d array in swift: var firstarray = [int](count:4, repeatedvalue: 0) var secondarray = [[int]](count:4, repeatedvalue: firstarray) var thirdarray = [[[int]]](count:4, repeatedvalue: secondarray) it works great. can access value of thirdarray: thirdarray[a][b][c] , in c++. but if have struct like: struct mystruct { var color: uicolor = uicolor.redcolor() var number: int = 0 var used: bool = true } how use repeatedvalue ? var firstarray = [mystruct](count:4, repeatedvalue: ???) simply use: var newarray = [mystruct](count:4, repeatedvalue: mystruct()) the syntax creating instances of structs , classes same.

syntax - How does the :: operator work in Ruby? -

i new ruby , confused :: operator. why following code output 2, 3, 4, 5, 1 , not output 1 ? thanks! class c = 5 module m = 4 module n = 3 class d = 2 def show_a = 1 puts end puts end puts end puts end puts end d = c::m::n::d.new d.show_a if remove last line, see 5, 4, 3, 2 . reason body of classes , modules regular code (unlike in other languages). therefore, print statements executed when classes/modules getting parsed. as how :: works - lets move around scopes. ::a reference a in main scope. a refer a in current scope. a::b refer b , inside a , inside current scope.

android - autoCompleteTextView using getText().toString() get the value is not in the array -

final string[] defaulttask1 = {"abc"," def"," ghi"}; final autocompletetextview autocompletetextview = (autocompletetextview)this.findviewbyid(r.id.autocompletetextview); arrayadapter<string> adapter = new arrayadapter<string>(this, android.r.layout.simple_list_item_1,defaulttask1); autocompletetextview.setthreshold(0); autocompletetextview.setadapter(adapter); i have method using autocompletetextview.gettext().tostring() .while user types words not in array, may happen "null pointer exception" is there solution can use autocompletetextview, can search user , let user enter text want? p.s. sorry, i'm not native speaker, there might grammar mistake. autocompletetextview right solution needs an editable text view shows completion suggestions automatically while user typing. list of suggestions displayed in drop down menu user can choose item replace content of edit box with. autocompletetextview all...

python - Finding the maximum sum of elements of a given array -

i have find maximum sum of elements in array (or permuted form), value of elements depends upon position in array an algorithm finding sum of particular array follows int taste = 0 (int i= 0; <= n; i++){ if (p[i]) - p[i-1]) >= 0): taste += * (p[i]) - p[i - 1]) else: taste += * (p[i - 1] - p[i]) my solution in python getting result 0 from itertools import permutations def sum_permuatations (): t = int(input()) taste = 0 maxtaste = 0 while ( t!=0): t = t-1 lent = input() lis = input() p in permutations(lis, len(lent)): in range(2,len(p)+1): if (int(p[i]) - int(p[i-1]) >= 0): taste += i*(int(p[i])-int(p[i-1])) else: taste += i*(int(p[i-1])- int(p[i])) if taste > maxtaste: maxtaste = taste return maxtaste please me resolving error in code. this solution uses itertoo...

swift - SceneKit physics add velocity in local space -

i trying manipulate player node using physicsbody.velocity adding or subtracting velocity axis different directions. problem i'm having trouble finding method applying local space or @ least applying velocity in relation direction object facing. in other words, works fine if have not rotated object's node. if still add velocity unrotated space. know there way add velocity current scnvector3, cannot figure out. if iszthrustpositive { if let velocity = self.physicsbody?.velocity { if velocity.z * 100 <= 8000 { thrustdirection = scnvector3( x: velocity.x, y: velocity.y, z: velocity.z + kplayershipmainthrust) self.physicsbody?.velocity = thrustdirection } } } i trying rotate node using angularvelocity in similar fashion. works fine long node has not moved or rotated. if has, seems using world space well. if isyrotatingpositive { ...

Powerbi rest api AddRows -

i working on realtime dashboard, i'd use powerbi rest api. my question how updating of rows work. have 1300 records load once , update 2 columns each row every 20 seconds. the rest call see addrows, it's not clear how handles update of rows if does you have 2 patterns can choose from: you can send data in batches: upload 1300 rows, call delete on rows, call upload next payload of rows. here's delete method need all. we're adopting rest standards our apis 'methods' rest verbs :). https://msdn.microsoft.com/en-us/library/mt238041.aspx alternately can incrementally update data: you'd add 'timestamp' column data set. in query (like in q&a) you'd ask "show data last 20 seconds". if this, set fifo retention policy when create data set don't run out of space. in either case, double check number of rows you're pushing fit within limits spell out. https://msdn.microsoft.com/en-us/library/dn950053.aspx ...

java - Input to an applet -

cannot understand use of :public boolean action(event event, object object) { repaint(); return true ; } }. making return sum of 2 numbers. if don't use. public boolean action (event event, object object) { repaint(); return true ; i can enter number in text field won't generate sum. why? }} import java.awt.*; import java.applet .*; public class user extends applet{ textfield text1,text2; public void init(){ text1=new textfield(8); text2=new textfield(8); add(text1); add(text2); text1.settext("0"); text2.settext("0");} public void paint(graphics g){ int x =0,y=0,z=0; string s1,s2,s ; g.drawstring("input no in.each box",10,50); try{ s1=text1.gettext(); x=integer.parseint(s1); s2=text1.gettext(); y=integer.parseint(s2); } catch(exception e){} z=x +y ; s=string.valueof(z); g.drawstring("the sum is:",10,75); g.drawstring(s,100,75); } public boolean action (event event, object object ) { repaint(...

getelementsbyclassname - Accessing a child class from parent class javascript -

this question has answer here: best way find dom elements css selectors 5 answers <td <td class="upgrade_building b_wall"> <a href="#" class="building_tooltip d_0" tooltip="<span class='icon header wood'></span> 801 <span class='icon header stone'></span> 1846 <span class='icon header iron'></span> 320<br />población: 5<br />tiempo de construcción: 3:12:01">10 </a> </td> i'm making script perform autoclick on element "building_tooltip d_0" contained within "upgrade_building b_wall" tried code: javascript:var list = document.getelementsbyclassname("building_tooltip d_0"); (var i=0; i<list.length; i++) list[i].click(); but in dom of page there other elements "building_toolt...

javascript - Populating one-to-many relationships with MongoDB in MEAN Stack -

i followed article in mongodb docs , have created similar one-to-many relationship, referencing "publisher" id value in children. data structure follows, publisher_id being working piece here: { _id: 123456789, title: "mongodb: definitive guide", author: [ "kristina chodorow", "mike dirolf" ], published_date: isodate("2010-09-24"), pages: 216, language: "english", publisher_id: "oreilly" } { _id: 234567890, title: "50 tips , tricks mongodb developer", author: "kristina chodorow", published_date: isodate("2011-05-06"), pages: 68, language: "english", publisher_id: "oreilly" } if have page, example, all o'reilly books, how can return objects proper publisher_id . typically done on front-end or back-end? yes, typically query mongo database on end (node.js) using mongoose middleware. can use mongodb plugi...

ruby - Delete leading nils from Array -

i have array so: [nil, nil, nil, 2, 4, 6, 1, nil, nil, 3, 4, 6] what need nice way remove leading nils in place (so compact! bad), , number of nils removed (so drop_while bad). probably not idea, if insist on one-liner: arr.instance_eval { shift(index { |element| !element.nil? } || size) }.count edit : anyone's future reference, better looking version agreed upon: arr.shift(arr.index(&:itself) || arr.size).count

"(LoadError) 193: %1 is not a valid Win32 application." with Ruby on Windows 7 X64 -

i having problem using 'typhoeus gem'. have installed (it shows installed when command "gem list"). below code running: def test response = typhoeus.get("http://google.com") puts response.code end puts test below error code getting when try , run code: c:/ruby21-x64/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require': 193: %1 not valid win32 application. - c:/ruby21-x64/lib/ruby/2.1.0/x64-mingw32/openssl.so (loaderror) c:/ruby21-x64/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require' c:/ruby21-x64/lib/ruby/2.1.0/openssl.rb:17:in `<top (required)>' c:/ruby21-x64/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require' c:/ruby21-x64/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require' c:/ruby21-x64/lib/ruby/2.1.0/net/https.rb:22:in `<top (required)>' c:/ruby21-x64/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `requ...

android - SparseArray remove() and delete() what's the difference? -

what main difference between calling remove() or delete() on sparsearray, because both accept key's arguments. thanks. there no difference. quoting the documentation remove() : alias delete(int). in other words, same thing. in the current implementation , remove() calls delete() .

.net - Error CS0246 when trying to use Gtk# -

i trying build project using gtk# . i have used gtk# before, , have been using sharpdevelop doing so. just ... doesn't seem work more: i have installed latest release, gtk# 2.12.26 .net, installer package mono website , have formerly done earlier versions. i have created c# command line application project in sharpdevelop, using c# 3.0 , targetting .net 3.5. i have added gac references project atk-sharp, gdk-sharp, glib-sharp, gtk-sharp, mono.cairo, , pango-sharp. i have added using gtk; main c# file. when write gtk. , sharpdevelop's intellisense show types found in gtk namespace. when compile project, compiler aborts following message: the type or namespace name 'gtk' not found (are missing using directive or assembly reference?) (cs0246) what missing? this happens when target .net 3.5. when target .net 4.0, run different problem . the complete output of compiler (slightly anonymized) reads follows: build started. warning msb3245: not ...

javascript - how to do maths in mongoose.js query -

i have multiple rows , return data league table , ordered football league table. my data in multiple rows each game played as: { "_id" : objectid("55d0f8a6bd0782b480dc4941"), "venue" : "h", "game_id" : objectid("55d0f8a6bd0782b480dc48f9"), "date" : isodate("2015-04-25t14:00:00.000z"), "gd" : 0, "ga" : 1, "gf" : 1, "points" : 1, "team_id" : objectid("55d0f8a6bd0782b480dc48f1"), "__v" : 0 } i can see no way maths inside of query , return calculated values of points given team_id . is there math in mongoose group in mysql ? yes there is, can use http://mongoosejs.com/docs/api.html#aggregate_aggregate-group , $sum http://docs.mongodb.org/manual/reference/operator/aggregation/sum/ sum of points on each team your-model-name.aggregate([ { $group: { _id: ...

amazon web services - How to resize Root Disk with runInstance in PHP -

$cmd = 'runinstances'; $result = $client->$cmd(array( 'imageid' => selectami($_post['dc'], $_post['os']), 'mincount' => 1, 'maxcount' => 1, 'instancetype' => $_post['itype'], 'keyname' => $_post['key'], 'securitygroups' => array($securitygroupname), 'blockdevicemappings' => array( 'devicename' => '/dev/sda1', array( 'ebs' => array( 'snapshotid' => 'snap-2337bd2a', 'volumesize' => $disksize, 'deleteontermination' => true, 'volumetype' => 'gp2', 'encrypted' => false ) ) ) )); what wrong this, not work , no error? ...

vba - Exporting A3 email from Outlook to PDF -

i have vba script exports incoming emails pdf via word: 'create word object dim wrdapp word.application dim wrddoc word.document set wrdapp = createobject("word.application") set wrddoc = wrdapp.documents.open(filename:=tmpfilename, visible:=true) dim wshshell object dim specialpath string dim strtosaveas string set wshshell = createobject("wscript.shell") mydocs = "\\my path files\" strtosaveas = mydocs & "\" & sname & ".pdf" wrdapp.activedocument.exportasfixedformat outputfilename:= _ strtosaveas, exportformat:=wdexportformatpdf, _ openafterexport:=false, optimizefor:=wdexportoptimizeforprint, _ range:=wdexportcurrentpage, item:= _ wdexportdocumentcontent, includedocprops:=true, keepirm:=true, _ createbookmarks:=wdexportcreatenobookmarks, docstructuretags:=true, _ bitmapmissingfonts:=true, useiso19005_1:=false it works fine, i've noticed emails trimmed on right side - after investigation i've found ...

ios - How to pull information from NSDictionary Swift -

right have mapview populates bunch of pins based on category, example, 'asian food'. when click callout accessory of annotation, app navigates detail viewcontroller, hope display address , other properties. getting information yelp api client. here model: import uikit import mapkit var resultquerydictionary:nsdictionary! class resturant: nsobject { var name: string! var thumburl: string! var address: string! var jsondata: nsdata! var location: nsdictionary // location init(dictionary: nsdictionary) { name = dictionary["name"] as? string thumburl = dictionary["thumburl"] as? string address = dictionary["address"] as? string self.location = dictionary["location"] as? nsdictionary ?? [:] } class func searchwithquery(map: mkmapview, query: string, completion: ([resturant]!, nserror!) -> void) { yelpclient.sharedinstance.searchwithterm(query,sort: 0, ra...

r - Computing correlation of vectors by factor label -

i have have 2 data frames. first one, df1 , matrix of vectors labeled columns, following: df1 <- data.frame(a=rnorm(10), b=rnorm(10), c=rnorm(10), d=rnorm(10), e=rnorm(10)) > df1 b c d e -0.3200306 0.4370963 -0.9146660 1.03219577 0.5215359 -0.3193144 0.8900656 -1.1720264 -0.42591761 0.1936993 0.4897262 -1.3970806 0.6054637 0.12487936 1.0149530 0.3772420 0.8726322 0.3250020 -0.36952560 -0.5447512 -0.6921561 -0.6734468 0.3500812 -0.53373720 -0.6129472 0.2540649 -1.1911106 -0.3266428 0.14013437 1.0830148 0.6606825 -0.8942715 1.1099637 -1.52416540 -0.2383048 1.4767074 -2.1492360 0.2441242 -0.36136344 0.5589114 -0.5338117 -0.2357821 0.7694879 -0.21652356 0.3185631 3.4215916 -0.3157938 0.8895597 0.09946069 -1.0961730 the second data frame, df2 , contains items match colnames of df1 . example: group <- c("1", "1", "2", "2", "3", "3") s1 <-...

javascript - Auto-summarising JSON objects -

i want summarise json data objects in webpage. method can think of read r, run summarise() , extract report json , read webpage , write dom. know less idiotic method getting equivalent intelligent summary doesn't involve r? is there equivalent in javascript/jquery json objects? the closest thing object.keys , array#reduce , visits each array entry (each property name — key — in case) , calls callback passing accumulator reduce operation , value of entry. instance, sum looks this: var obj = { foo: 42, bar: 27, baz: 51 }; var sum = object.keys(obj).reduce(function(acc, key) { return acc + obj[key]; }, 0); // <== 0 = seed value accumulator snippet.log(sum); <!-- script provides `snippet` object, see http://meta.stackexchange.com/a/242144/134069 --> <script src="http://tjcrowder.github.io/simple-snippets-console/snippet.js"></script> other that, you're libraries.

Android AlertDialog remove divider between Button.Borderless in ButtonBar -

Image
i pretty following this tutorial , want adapt layout of alertdialog needs. need rid of divider between 2 buttons in buttonbar . changed layout of button this: <style name="widget.sphinx.button.borderless.small" parent="@android:style/widget.holo.button.borderless.small"> <item name="android:textcolor">@color/button_textcolor</item> <item name="android:background">@drawable/button</item> <item name="android:layout_marginleft">10dp</item> <item name="android:layout_marginright">10dp</item> <item name="android:layout_marginbottom">10dp</item> <item name="android:gravity">center</item> <item name="android:textstyle">normal</item> <item name="android:dividervertical">@android:color/transparent</item> </style> ...

Hiera 3 + Puppet 4.2 can't manage empty value in yaml datasource -

i'm facing issues use hiera 3 puppet 4.2. when applying puppet manifest using command: puppet apply environments/production/manifests/init.pp --hiera_config=hiera.yaml i following error: error: evaluation error: error while evaluating function call, not find data item myclass::ensure in hiera data file , no default supplied @ /home/vagrant/temp/environments/production/manifests/init.pp:13:39 on node here directory structure : $ tree . ├── environments │   └── production │   ├── config.yaml │   └── manifests │   └── init.pp └── hiera.yaml content of config.yaml: $ cat hiera.yaml --- :backends: - yaml :hierarchy: - config :yaml: :datadir: environments/production content of init.pp: class myclass( $version = $myclass::params::version, $ensure = $myclass::params::ensure, ) inherits myclass::params { notify {"$version": } notify {"$ensure": } } class myclass::...

How to set "search_type" to "count" in elasticsearch-rails? -

here's query i'd working elasticsearch-rails. (the query works in sense). goal return buckets items have person name begins letter b. first stumbling block can't figure out how specify search_type should set count. get _search?search_type=count { "query": { "prefix": { "person": "b" } }, "aggs" : { "facets" : { "terms" : { "field" : "person", "size" : 0, "order" : { "_term" : "asc" } } } } } according this issue , doesn't seem supported yet. an alternative works setting size: 0 in query, this: { "size": 0, <--- add "query": { "prefix": { "person": "b" } }, "aggs" : ...

objective c - intersectsNode fails when object goes counterclockwise but not clockwise -

Image
i creating simple wheel game. there no physics involved. dial spins around coloured quadrated wheel , must stop dial on correct colour. if stop on correct colour dial spins opposite direction new colour them match. using "intersectsnode" on boundary line detect when dial enters quadrant of wheel , check if right colour etc. when dial spinning counterclockwise dial correctly intersects boundary lines when touches them. when dial spinning clockwise intersectsnode fired third of way before connects. the same code used detect both counterclockwise , clockwise , creating boundary lines, confused why fail 1 way vs. other. have ideas? bug perhaps not aware of? glaring issue setup? @implementation gamescene { sound *sound; gamemodel *gamemodel; skspritenode *wheel, *pin; float duration; direction currentdirection; int colorcount; color currentcolor, startingcolor, enteringcolor; sklabelnode *scorelabel; } - (void)didmovetoview:(skview *)...