Posts

Showing posts from March, 2013

c# - Android toast for UWP -

Image
i use toast (see image below) in uwp project in same way android. know uwp has native control called toastnotification think it's showy (see other attachment)... it fantastic find similiar control or event make myself don't know start from, suggestion appreciated. thanks in advance! uwp apps don't provide funtionality. workaround have made have layer on each page transparent , visible short period of time when activate it

oauth 2.0 - Access Protected Resource API gives “401 Unauthorized” error -

i want add authorization project based on tutorial . i've got part of retrieving access token working. when using token access protected resource api 401 unauthorized error. the request has authorization header scheme bearer , containing access token. in tutorial api protected [authorize] attribute. during startup setup bearer authentication useoauthbearerauthentication(new microsoft.owin.security.oauth.oauthbearerauthenticationoptions()) it not clear me why request unauthorized. can check find cause of problem? after trying , checking many things, noticed authorization server , resource server using different version of owin , owin.security. after updating older one, worked. tokens must have changed between 2 versions.

How set option "Send To" from OTRS API on method TickedCreate -

i want create ticket in otrs system own web service , goal use otrs api ( otrs api - merthod "ticked created" ). work fine, want send email specific users. current options request: $options = [ "ticket" => [ "title" => "title", "queue" => "pt", "state" => "open", "type" => 'unclassified', "priority" => "3 normal", "owner" => 'admin@gmail.ru', // think options set getter email, no 'customeruser' => 'specific_user@gmail.com', ], "article" => [ "sendertype" => 'agent', "articletype" => "email-external", "subject" => "subject article", "body" => "b...

VS2015 and C++ Service fail to auto-start -

i facing strange issue vs2015. when compiling service (i had issue own code base, able reproduce on basic service sample msdn https://code.msdn.microsoft.com/windowsapps/cppwindowsservice-cacf4948 ), service fail auto-start on fresh install of windows 10. here’s repro steps of problem: take basic c++ service code (we took 1 msdn) , compile visual studio 2015 install on fresh install of windows 10 automatic startup do cold reboot result : service won’t start, automatic delayed set. now funny part… there several work-around issue: if manually start service before cold reboot, fine if restart (not reboot) machine after cold reboot, service start on machines (not fresh windows 10 install, problem not happen) build service vs2013 won't cause issue. because need use vs2015 (my service should using windows 10 sdk), know if there solution or if bug vs2015. thanks js

html - Text over top of image scrolling left and right -

i trying create rollover effect image css. image starts title overlaid, when hovered on text overlay appears. happy how going far, except text area comes on top text runs off right. can scroll , down, assuming same problem? https://jsfiddle.net/p27sf4e1/3/ html <div class="service-box"> <p class="box-title">social media</p> <div class="service-overbox"> <h2 class="title">social media</h2> <p class="tagline">lorem ipsum dolor sit amet, consectetur adipiscing elit. integer ac sodales lorem. donec condimentum feugiat feugiat. vestibulum blandit dolor risus, eget fringilla sem suscipit vel. in id ex ut nulla mollis suscipit nec in velit. fusce auctor dapibus elit. nam in justo sapien.</p> </div> </div> css .service-box .overtext { -webkit-transition: 300ms ease-out; -moz-transition: 300ms ease-out; -o-transition: 300ms ease-out; -ms-transition: 3...

php - How do I retrieve the value from table cell and send it to update page using jeditable -

i have mysql table-activity has 3 columns, namely - id, clientname, status; , displaying 2 columns, namely -,clientname , status using datatables. now want update clientname value in database displayed in datatable dynamically on editing it. this, used jeditable datatable, don't know how retrieve current cell's id , value , pass them through jeditable php page edit them.please me out. thanks in advance. here have tried far- html code- <tbody > <?php $sql= "select * `activity` order clientname asc"; $result = mysqli_query($conn,$sql); while($row = mysqli_fetch_assoc($result)) { $id = $row['id']; $name = $row['clientname']; echo "<tr id=".$row['id']."class='edit_tr'>"; echo $id; echo " <td class='edit'>".$row['clientname']."</td> ...

java - Component binding through MarkupWriter - Tapestry -

i'm in situation need use markupwriter create checkbox instead of using .tml . inside component , i'd bind checkbox's value parent's boolean value. in essence, it's following: component public class innercomponent { @parameter private boolean booleanvalue; void afterrender(final markupwriter writer) { writer.element("input", "type", "checkbox"); writer.end(); } } calling page public class outerpage { @property private boolean checkboxvalue; @injectcomponent private zone booleanzone; object ondisplayboolean() { return booleanzone.getbody(); } } with .tml <html t:type="layout" title="testproject index" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_4.xsd"> <t:innercomponent booleanvalue='checkboxvalue'/><br/> <t:eventlink event='displayboolean' zone='booleanzone'>...

go - Best way to swap elements in golang slice? -

is possible swap elements in python? a,b = b,a or have use: temp = a = b b = temp yes, possible. assuming a , b have same type, example provided work fine. example: a, b := "second", "first" fmt.println(a, b) // prints "second first" b, = a, b fmt.println(a, b) // prints "first second" run sample on playground this both legal , idiomatic, there's no need use intermediary buffer.

frama c - What does the message "unreachable entry point" mean? -

i have file containing several acsl assertions ( file.c ): #include <stdio.h> #include <stdlib.h> void foo() { int a=0; //@ assert(a==0); } void print(const char* text) { int a=0; //@ assert(a==0); printf("%s\n",text); } int main (int argc, const char* argv[]) { const char* a1 = argv[2]; print(a1); foo(); if (!a1) //@ assert(!a1); return 0; else return 1; } i want slice assertions command: frama-c -slice-assert @all file.c -then-on 'slicing export' -print -ocode slice.c however, slice not expected (in fact not contain of functions contained in files): /* generated frama-c */ typedef unsigned int size_t; /*@ ghost extern int __fc_heap_status __attribute__((__frama_c_model__)); */ /*@ axiomatic dynamic_allocation { predicate is_allocable{l}(size_t n) reads __fc_heap_status; } */ void main(void) { char const *a1; return; } instead output this: file.c:16:[k...

vsts - Transfer issues from JIRA to Visual Studio Team Services (was Visual Studio Online) -

has had experience migrating jira tickets team services? i'm looking see if there products or easy methods transition. if you're looking (1 time) migration instead of synchronization, , have experience rest apis , scripting, writing own scripts/tool might "easy" solution, if need map different project/field configurations. there related questions here: how migrate tasks jira tfs 2012? how can migrate jira project team foundation work item tracking (tfs wit)? relevant rest api documentation available here: vs team services & tfs jira rest api

Office365 SharePoint Scopes -

i can't seem find office365 rest api scopes relating office365 sharepoint. outlook.office.com can utilize scopes ' https://outlook.office.com/mail.read ' . does know of, or point me to, rest api scopes office365 sharepoint? see here: https://msdn.microsoft.com/office/office365/howto/application-manifest you should see scopes in azure management portal if configure app.

xcode - No such Module 'SwiftyJSON' on Swift 3.0 -

Image
after migrating swift 3.0, trying import swiftyjson project. however, when import framework 'import swiftyjson' no such module error. if remove import statement, not recognize classes. any advice why xcode might not reading imported framework? see screenshots attached: my problem was opening project file , not workspace file...

React Native - Refresh screen -

i have following app: main -> login -> favourites on main screen, can click on button called "favourites" which: 1) if signed in, show favourites 2) if not signed in, show login screen let's not logged in , sign in application, set's key api , returns alert saying "you signed in.." upon going main screen after logging in, if click on "favourites" still show them login screen. have close app down , restart app login take effect. what optimal way of making sure not have keep logging in? here main file: renderview() { if(this.state.token != null) { var data = this.getdata(); }else{ console.log("token " + this.state.token); this.refs.nav.navigator.push({ title: "login", component: login, rightbuttontitle: 'cancel', passprops: {nav: navigator}, onrightbuttonpress: () => { this.refs.nav.navigator.pop(); } ...

c# - SetWindowPos moves window to different position every time -

i have windows application (which writing in c#) starts maximized window without borders. when user clicks on button in application, want restore window (that is, remove maximized state), resize size , move bottom-right corner of screen. my problem call setwindowpos() , while resizing window correctly, not place in bottom-right corner of screen. does, yet other times window placed elsewhere on screen (almost if "jumping" around, reason ignore). what doing wrong? here code. note pass -1 second parameter setwindowpos because want window on top of every other window. public void moveappwindowtobottomright() { process process = process.getcurrentprocess(); intptr handler = process.mainwindowhandle; showwindow(handler, 9); // sw_restore = 9 int x = (int)(system.windows.systemparameters.primaryscreenwidth - 380); int y = (int)(system.windows.systemparameters.primaryscreenheight - 250); nativepoint point = new nativepoint { x = x, y = y }; ...

c++ - Segmentation fault while iterating through and erasing some elements from std::map? -

Image
i using several std::map type data containers following: std::map<int, std::vector< cv::point > > mapgoodcontours; std::map<int, ellipseproperties> ellipsepropertiesmap; std::map<int, float> m_markerradiusmap; std::map<int,cv::point2f> markers;//this part of class i iterate through these containers , erase elements after elements meet condition shown in following code. auto radiusmapcounter = m_markerradiusmap.begin(); auto markercounter = frames.markers.begin(); auto goodcontourscounter = mapgoodcontours.begin(); if(m_markerradiusmap.size()==ellipsepropertiesmap.size() && frames.markers.size()==ellipsepropertiesmap.size() && mapgoodcontours.size()==ellipsepropertiesmap.size()) { for(auto ellipsepropertycounter = ellipsepropertiesmap.begin(); ellipsepropertycounter != ellipsepropertiesmap.end(); ellipsepropertycounter++) { float upperlimit = (float)m_up...

vba - Change Font Of Multiple Sub Strings in Excel Cell -

i have font show specific symbols. typed sheet standard/default font. i'm able identify these characters , change these characters' font symbol font, having trouble making work correctly when there more 1 identified symbol in cell. for example , cell may contain: this value x , y, , z i need change font of x, y, , z. here how changing characters' font via vba: sub insertfont(insertrange range, symboltext string, symbolposition integer) dim celltext string dim newvalue string celltext = insertrange.value2 newvalue = replace(celltext, symboltext, symboldict.item(symboltext), 1, 1) insertrange.value2 = newvalue insertrange.characters(symbolposition, len(symboldict.item(symboltext))).font .name = "myfont" end end sub the problem after each font change, rest of cell returns default font! how can font changes stick of changes? end result: this value x , y, , ☹ per suggestion of @timwilliams via co...

Looping through dict elements in python -

this question has answer here: python: read json , loop dictionary 2 answers i have piece of json converted dict using json function. this: { "imageids": [ { "imagetag": "1.2", "imagedigest": "sha256:8b67b1691b29e27a5ccbd6fea5c97c951a025ccd45b26d4c24567ca3c4c0f13b" }, { "imagetag": "1.0", "imagedigest": "sha256:aa52a12bd6e516659452af5b9ed0fad8659f9e0cea6a986c6bfe02af388df189" } ] } to this: >>> print data {u'imageids': [{u'imagetag': u'1.2', u'imagedigest': u'sha256:8b67b1691b29e27a5ccbd6fea5c97c951a025ccd45b26d4c24567ca3c4c0f13b'}, {u'imagetag': u'1.0', u'imagedigest': u'sha256:aa52a12bd6e516659452af5b9ed0fad8...

eclipse - How to convert two different strings to date format and finding their differences in JSP/JAVA -

i have 2 strings str1: 2016-7-25.15.38. 32. 0 (this im getting db) string2 : july 25, 2016 3:19 pm (this 1 wrote program read email timestamp) how convert these 2 strings date format , find differnce in time.. pls help. ive gone through many pages in , google not getting specific how convert these 2 strings date format using java 8, you'd parse them this: zoneid zoneid = zoneid.systemdefault(); zoneddatetime dt1 = zoneddatetime.parse("2016-7-25.15.38. 32. 0", datetimeformatter.ofpattern("uuuu-m-d.h.m. s. 0").withzone(zoneid)); zoneddatetime dt2 = zoneddatetime.parse("july 25, 2016 3:19 pm", datetimeformatter.ofpattern("mmmm d, uuuu h:mm a").withzone(zoneid)); using non-standard indentation align format string value parsed, easier comparison. the code using zoneddatetime daylight savings time handled correctly. and find difference in time getting difference in time easy enough, usi...

node.js - File paths in nodejs -

i'm trying read file relative path in nodejs using: readfile.js var path = require('path'); var file_path = path.join(__dirname, "relativedir", "file.conf"); which in directory layout such as: /home/user/project/readfile.js /home/user/project/relativedir/file.conf produces following file path. /home/user/project/home/user/project/relativedir/file.conf why? i tried omitting __dirname variable in join() give path: relativedir/file.conf i've tried using relative path of relativedir join outputs same path: var path = require('path'); var file_path = path.join("./relativedir", "file.conf"); edit: i following error message: fs.js:640 return binding.open(pathmodule._makelong(path), stringtoflags(flags), mode); ^ error: enoent: no such file or directory, open /home/user/project/home/user/project/relativedir/file.conf

php - How to encode blob to base64 string on yii framework? -

i want encode blob image db base64 string, want encode string json. i've tried this: $img = image::model()->findbysql('select img tbl_img id=1'); $value = chunk_split(base64_encode($img)); echo cjson::encode($value); the img field above blob. , i've got nothing. can help? use echo json_encode($value); instead of echo cjson::encode($value);

c# - Resizing Microsoft Ads -

hi use microsofts ads in uwp app , want ads resize after of app cant work. understand ad control must on of valid sizes (as described here ) wrote code resize ad: private void panel_sizechanged(object sender, sizechangedeventargs e) { if (e.newsize.width >= 728) { ad.width = 728; ad.height = 90; } else if (e.newsize.width >= 640) { ad.width = 640; ad.height = 100; } else if (e.newsize.width >= 480) { ad.width = 480; ad.height = 80; } else if (e.newsize.width >= 320) { ad.width = 320; ad.height = 50; } else if (e.newsize.width >= 300) { ad.width = 300; ad.height = 50; } } this made control resize accordingly ad inside control looked terrible. added ad.refresh(); @ end didn't change thing. does know do? i have faced same problem. unfortunately, ads loaded every 30 seconds , can not refresh them more once in 30 se...

python 3.5 - issue installing lxml on python3.5 on windows -

i trying install lxml lxml-3.6.1-cp35-cp35m-win32.whl , installing giving command "pip install lxml-3.6.1-cp35-cp35m-win32.whl" on cmd , getting error: lxml-3.6.1-cp35-cp35m-win32.whl not supported wheel on platform. how can install lxml?

python - tkinter overrideredirect stops entry working -

i create "borderless" window in python , code works without overrideredirect, when use input disallowed. can not click entry box *this code needs figured out, in function , there 500 lines of code go :d * newwindow = tkinter.tk() w = 300 h = 400 ws = 1024 hs = 768 x = (ws/2) - (w/2) y = (hs/2) - (h/2) newwindow.configure(background="#2e393d") newwindow.overrideredirect(true) frame = tkinter.frame(newwindow) name = tkinter.label(newwindow, background="#1c1c1c", width=2, height=4) name.pack() global outputl global inputl inputl = tkinter.stringvar() outputl = tkinter.stringvar() def nomic(empty): reply = inputl.get() inputl.set("") mainprocess(reply) if way == "a": import speech_recognition sr r = sr.recognizer() sr.microphone() source: audio = r.listen(source) try: reply = r.recognize_google(audio) mainprocess(reply) except sr.unknownvalueerror: ...

c++ - Fold expressions and empty parameters pack: what's the expected result? -

consider following minimal example: #include<cstddef> template<std::size_t... i> constexpr auto sum() { return (i + ...); } template<bool... b> constexpr auto check() { return (b && ...); } int main() { static_assert(6 == sum<1,2,3>(), "!"); // static_assert(0 == sum<>(), "!"); static_assert(check<true, true>(), "!"); static_assert(check<>(), "!"); } the commented line doesn't compile. same applies using * instead of + . 1 involving booleans works instead. here (working draft) haven't found mentions empty parameter packs. on other side, here (isocpp) seems default result in case above int() . what's expected behavior when mixing fold expressions , empty parameters pack? this covered in [temp.variadic]¶9 (citing n4618): if n 0 unary fold-expression, value of expression shown in table 14; if operator not listed in table 14, instantia...

applescript - Creating new notes in Apple Notes with a PDF attachment -

i planning use hazel watch folder. when pdf or file dropped folder, want create note in apple notes (on el capitan) file attachment. here's limited progress far, created embedded script in hazel rule: tell application "notes" make new note @ folder "notes" end tell this creates blank note ok. from research, can see need create html img tag in body of note text pointing attachment in folder, beyond knowledge on how achieve this... welcome :) something this tell application "notes" set mynote make new note @ folder "notes" make new attachment @ mynote data "mypdf.pdf" end tell

php - IF statement inside FOR Loop returns false results -

i have few days started studying php , have following code, makes 3 check-boxes , 3 drop-down lists accordingly(could more, that's not issue). the idea custom mysql query string created more 1 conditions. drop-down lists contain db fields. user decide how many custom conditions add clicking these check-boxes , setting value in drop-down list. after clicking submit button every checkbox checked , if value according drop-down box set, value drop-down list read. code works , returns correct results (values drop-down lists) if or first checkbox are/is checked. example if second or third checkbox check , value drop-down list set, if statement ignores it. there wrong if statement (in specific && condition) inside loop can can fix it?. additionally, if have 1 condition in if statement results correct!. <?php echo <<<_query <form action="check_array.php" method="post"> query1<input type="checkbox" name="q...

amazon web services - Cost Calulating with AWS ECS Container -

i have question regarding cost structure on aws ecs. how can know service on container "spending" most? don't see option tag containers. ideas welcome, didn't find solution off aws websites. in advance. ecs services allocated instances based on memory limits , cpu units specify tasks compose service. can estimate costing dividing cost ec2 instances in cluster total amount of resources divided amount of required resources. cpu units minimum value, is, task won't placed on instance unless there minimum of cpu units available. tasks can exceed number of cpu units require, , value can set 0. memory limits maximum amount of memory task allowed use. must allocate enough memory ecs task, or killed ecs when exceeds it. therefore, memory better resource use when estimating costing. for example: lets have service runs 2 instances of task requires total of 800 mb of memory. if using t2.medium instances in cluster, service require 1/2 of t2.medium run, ...

jquery - On click slidding out the current content and slide in a new one -

hi , thank time. i have nav bar , couple of divs. when button clicked want slide current div left , out of page , slide in new div right. [ http://www.wix.com/website-template/view/html/1634?originurl=http%3a%2f%2fwww.wix.com%2fwebsite%2ftemplates%2fhtml%2fall%2f13&bookname=&gallerydocindex=2&category=all][1] i saw on page , want learn how done. know how use jquery , onclick animate left , fadeout cant return home position set ready clicked again. so if there example how or if there tutorial please let me know. thank you there many ways achieve effect found in site provided. below 1 implementation using jquery , css. note jquery used here has not been abbreviated function logic exposed, can shorten code once you've familiarized it. //the "slidein" , "slideout" classes being added css animations. please refer css code. $('.menu').click(function(){ $('.current').removeclass('slidein slideout...

android - How to find whether a phone is HDPI, XHDPI etc? -

my folder structure layouts "layout-sw600dp-hdpi", " layout-sw480dp-hdpi" , on. at moment when want find out under category particular device falls in, adding layout file in every single folder different text. example if file in " layout-sw600dp-hdpi" folder, our text in layout file "layout-sw600dp-hdpi". anyway our current method hard find device's size , make screen accordingly. is there other better way of knowing this? you can take here: getting screen density programmatically in android? but... don't need answer. if you're designing layout - should in way allows flexibility (just when you're designing web page). if have hard code value (ex. margin), can use dp units allow scale automatically. if it's not enough - can define dimension in resources: https://developer.android.com/samples/basicsyncadapter/res/values/dimen.html keep in mind resources can have same structure layouts - can put qual...

sonarqube5.6 - Rules Compliance Metric Sonarqube -

the rules compliance metric sonarqube 5.6 missing. issues density plugin deprecated violation density not sure now. any suggestions? rules compliance deprecated in 4.0 , gone 4.5. you should instead focusing on leak, i.e. new problems introduced since application's last version.

angular - Simple confirmation modal -

i want use ng2 bs3 modal confirm user action. don't know how callback modal. example: @viewchild('confirmmodal') confirm: confirmmodal; deleteitem(){ if(this.confirm.open()){ delete } else{ not delete } } and shortened modal code <button type="button" class="btn btn-default" data-dismiss="modal" (click)="modal.dismiss()">cancel</button> <button type="button" class="btn btn-primary" (click)="modal.close()">ok</button> export class confirmmodal{ close() { this.modal.close(); } open(){ this.modal.open() } } how return true or false depending on user's choice. thank in advance answer.

python - Unable to get data in form of list in django jquery -

here script var size = []; var formdata = new formdata(); $("input[name='size']:checked").each(function() { size.push($(this).val()); }); formdata.append('size[]' , size) $.ajax({ type: "post", data: formdata, url : "{% url 'data_entry' %}", cache: false, contenttype: false, processdata: false, success: function(data) { if(data == 'true'){ alert('product uploaded successfully') } }, error: function(response, error) { } }); the sizes array looks ["l", "m", "s"] and here view def post(self, request , *args , **kwargs): sizes = request.post.getlist('size') print sizes size in sizes: size.objects.create(product=instance , name='size' , value=size) ...

javascript - How to avoid duplicate values in the output of v-for loop in vuejs -

i want remove or filter out duplicate values in output of v-for loop. so, ' john ' appears once instead of appearing twice in output. possible in vuejs ? js var app = new vue({ el: "#app", data: function () { return { searchfields: ['number', 'name'], search: '', items: [ { name: 'mary'}, { name: 'john'}, { name: 'john'}, { name: 'william'} ] }; } }); codepen vuejs filterby provides 3 arguments filter function: value of current item, index of item , whole array. following works without temporary array: methods: { myfilter: function (val, idx, arr) { for(var = 0; < idx; i+...

Mongodb get data using ISO format date -

i saving data mongodb , dates in format instance 7/30/1960 (july 30, 1960) isodate("1960-07-30t05:00:00.000+0000") , i want find records created today(and dont care time,so long today) , have this var start = new date(); var end = new date(); and display data db.posts.find({created_on: {$gte: start, $lt: end}}); will work or must convert iso dates format first?. you can alter 'start' , 'end' variables before querying: var start = new date(); start.sethours(0,0,0,0); // remove time part date var end = new date(); end.sethours(0,0,0,0); // remove time end.setdate(end.getdate() + 1); // add day end date and can use query: db.posts.find({created_on: {$gte: start, $lt: end}});

r - Removing rows based on column in another dataframe -

this question has answer here: how subset data frame based on data frame in base r 2 answers is there way remove rows dataframe, based on column of dataframe? for example, dataframe 1: gene chrom pos ref alt n_informative test beta se aaa 1 15211 t g 1481 1:15211 -0.0599805 0.112445 lll 1 762061 t 1481 1:762061 0.2144100 0.427085 ccc 1 762109 c t 1481 1:762109 0.2847510 0.204255 ddd 1 762273 g 1481 1:762273 0.0443946 0.119924 dataframe 2 (only 1 column): genes aaa bbb ccc ddd eee fff in situtation, want scan dataframe 1, column 1 matches dataframe 2, , remove matching rows. they need exact match, , result this: gene chrom pos ref alt n_informative test beta se lll 1 762061 t 1481 1:762061 0.2144100 0.427085 i...

java - How to configure Proguard to keep static methods with different return times -

i have set of classes (more 50) contain few static methods called parse() returns instance of class. example of 1 of classes: class sometype { // parse methods public static sometype parse(string text) { ... } public static sometype parse(object obj) { ... } ... // other methods public void static somethingstatic(...) { ... } public void somethingnotstatic(...) { ... } ... } i'm trying configure proguard obfuscate these classes , methods , fields except parse(...) methods. basically, want obfuscate class name, static , non-static methods, plus class fields. i've tried use: -keepclassmembers class sometype { public static sometype parse(***); } and worked fine sometype , don't want have write rule each of 50 classes... how can generalize it? i tried: -keepclassmembers class ** { public static * parse(***); } but proguard complains syntax of return type... your rule correct, use *** return type, match any type: ...

node.js - Conditionally updating / deleting a document in backend. Should I? Do I assign a PUT, POST, or DELETE http method? -

the below function "collection model". given conditions, want either delete or update document. should use put or delete? i separate them , check validation / conditions on client, seems less dry. i'll have add additional lines of code both client , server achieve same thing. collectionschema.statics.kill = function(o, cb) { return collection .findasync(o) .then(function(existing) { if (existing.length && (existing[0].vote !== 0 || existing[0].favorite == true)) { return collection .findbyidandupdate(o, { collected: !existing[0].collected }, { new: true }) .then(function(updated) { console.log('updated ', updated) return updated; }).catch(function(err) { return err; }) } else if (existing.length && existing[0].vote == 0 ...

javascript - How to get the Value of a checkbox from JQuery? -

i have checkboxes , want add value jquery. have been able retrieve value gets every checkbox value .each jquery command. wasn't sure how value of specific checkbox checked can use append command display data. the checkbox: <input id="add_policies_checkbox<?php echo $row[toolid]; ?>" type="checkbox" value=<?php echo $row[toolid]; ?> /> the button submits form jquery handle: <input type="button" name="action" class="btn btn-success checkboxadd" value="add policy" /> jquery - not sure how information (value) add_policies_checkbox checked: $(".checkboxadd").click(function(){ $('[id*="add_policies_checkbox"]').each(function(){ //alert(this.value); var data=this.value; $("#div_to_add_this_checkbox_value").append("info added"+data); })...

android - Increase Touch Target of TextView -

is there way increase touch target of textview without having expand size of textview , affecting layout? for example: if have address information in vertical linearlayout several textview s. make phone number textview clickable. there anyway make phone number textview touch target larger without creating padding , pushing surrounding textview s further away? you can wrap layout something this, can set onclicklistener on layout. if want increase size of touch target, increase height. <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <linearlayout android:id="@+id/layout" android:layout_width="match_parent" android:layout_height="wrap_content"> ...

typescript - How to receive GCM push notifications sent when app was stopped or device shutdown? -

i'm developing app using ionic 2. app must receive push notifications. in situations app killed "force stop" option in android. other situations device shutdown. in such situations app don't receive push notifications, if background-mode plugin enabled. anyway know push notifications stored in place, in queue waiting delivered. when start again app, notifications sent while app not running not automatically received app. if receive new notification @ moment notification sent when app stopped received app. my question how force app receive notifications sent when app stopped or ask gcm send notifications? when using gcm if app stopped (not in background) application cannot receive gcm messages. messages lost. if device not connected eg: off, messages can saved gcm (see time_to_live field) , when device comes online message sent, if app had not been stopped receive message.

Python 3 Can't print dictionary outside of for loop -

i working csv file data need split dictionaries. using following code: ga_session_data = {} ga_pageviews_data = {} file = open('files/data.csv', 'r') line in file: page, sessions, pageviews = line.split(',') sessions = int(sessions.strip()) pageviews = int(pageviews.strip()) ga_session_data = {page: sessions} ga_pageviews_data = {page: pageviews} file.close() print(ga_session_data) print(ga_pageviews_data) for reason cannot print of data stored in dictionaries outside of loop. prints first line each. you not adding initial, empty dictionaries. replacing them each time new dictionary: ga_session_data = {page: sessions} ga_pageviews_data = {page: pageviews} that's 2 new dictionaries, each one key-value pair. in end, after last line in file has been processed, remains information last line in file, , processed before has been replaced. if wanted add initial dictionaries, use assignment key: ga_session_...

aframe - Access A-Frame element from three.js object3D -

from a-frame, can access entity's object3d .object3d or .getobject3d() , there way reverse, when working three.js objects, element object belongs to? perhaps adding parent element userdata ? a-frame attaches entity object3d .el . for example entity mesh: document.queryselector('a-entity').getobject3d('mesh').el; it attaches group object3d : document.queryselector('a-entity').object3d.el; this done during setobject3d() . for object3d s a-frame not directly manage , not have direct associated a-frame entity, can walk scene graph find closest 1 object3d.traverseancestors .

php - Extract json from mixed content string -

i have string of mixed content, like: {json stuff} other content same output has < html > tags < div >some< / div > , more stuff, @ end has {json stuff} so need able use 3 elements: first json this: $first_json = json_decode(substr($mixed_string,0, strpos($mixed_string,"}")+1 )); // me first json content // need second json @ end of string, // length of string unknown , json length unknown // after do: echo preg_replace("/\{[^)]+\}/","",$mixed_string); // , html string... so, how can last json? you can use regex grab json values, , it'll let grab json out of string, no matter length. let's have div id of content, , div has json want extract: edit: added extraction process function. function extractjson(content) { var regex = /({.*?})/g, raw = content.match(regex), output = [], errors = []; raw.foreach(function(el) { try { output.push(json.parse(el)); }...

How can i send a binary file via serial in linux? -

i want control hdmi matrix switch via serial connection. in windows tried successful following steps: decode necessary hex simple textfile binary: certutil -decodehex on.txt on.bin then configure mode comport: mode com1:19,n,8,1 copy on.bin \\.\com1 /b now try same in linux (debian). since files binary figured can reuse them, transferred them linux system , tried following configure comport: stty -f /dev/ttyusb0 19200 cs8 -cstopb -parenb and sending binary: cat on.bin > /dev/ttyusb0 but won't anything.´ edit: it's different pc, usb2serial converter ist same. lsusb gives me: bus 001 device 003: id 1a86:7523 qinheng electronics hl-340 usb-serial adapter dmesg shows [ 5.070075] usbserial: usb serial support registered generic [ 5.072824] usbserial: usb serial support registered ch341-uart [ 5.073476] usb 1-9: ch341-uart converter attached ttyusb0

git - How to download the Release tar file from Github? -

i have project name testproject in github , have created release version v1.0.0. once , when go release page of project , see 2 links download source code (zip) , other says source code (tar.gz) . need download via curl copied url looks https://github.com/../testproject/archive/v1.0.0.tar.gz . when files gets downloaded via curl not tar file cauz when tar -zxvf v1.0.0.tar.gz below error message tar: unrecognized archive format tar: error exit delayed previous errors. now when go release page of github , click on tar version, testproject-1.0.0.tar.gz gets downloaded tar file. how file when curl ? add -l flag curl command in order follow redirects. example: curl -o -l https://github.com/gulpjs/gulp/archive/v3.9.1.tar.gz

jquery - Show DIV X, if Div Y contains Z. Then, show Div A, if Div Y contains B -

i've got code i've been working on, hash progress step bar. the html: <div id="stage1"><img src="/img/progress-bar/1.png"></div> <div id="stage2"><img src="/img/progress-bar/2.png"></div> <div class="deal-stage">2</div> now want display div #stage1 if div .deal-stage contains number 1. want display div #stage2 if div .deal-stage contains number 2. all html looks ok, it's jquery that's troubling me: <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> <script type='text/javascript'>//<![cdata[ $(window).load(function(){ if($('.deal-stage').html() == 1){ $("#stage1").show(); if($('.deal-stage').html() == 2){ $("#stage2").show(); } });//]]> </script> at moment both divs showing. want add 4 more steps i'm not sur...

regex - Python:Replace tab in double quotes -

hi have line want replace tab in double quotes. have wrote script not working want. line: q3u962 mus musculus mrmp-mouse optimization "mrmp-mouse " my script: repline in reppepdata: findtorep=re.findall(r"['\"](.*?)['\"]", repline) if len(findtorep) >0: repitem in findtorep: repchar =repitem repchar=repchar.replace('\t', '') my output should be: q3u962 mus musculus mrmp-mouse optimization "mrmp-mouse" but getting this: q3u962 mus musculus mrmp-mouseoptimization "mrmp-mouse" words separated tab delimiter here. q3u962\tmus musculus\tmrmp-mouse\toptimization \t"mrmp-mouse\t" anyone has idea how it? note : answer assumes (it confirmed op ) there no escaped quotes/sequences in input. you may match quoted string simple "[^"]+" regex matches " , 1+ chars other " , " , , replace...

business intelligence - Distributing cost to user date range in DAX -

in retail environment, have cost associated item/offer has start , end date. dividing cost total number of days, can per day cost of each product in each offer. how can total cost of each item on user entered date range? keep in mind date range can span multiple offers , multiple offers may overlap given day. for example, have item abc. have offers july 2016 , august 2016, span first last day of each month. july 2016 has per day cost of $100 item abc , august 2016 has per day cost of $50 item abc. if user wants total offer cost july 25th 2016 through august 10th , 2016 item abc (7*$100 + 10*$50), dax calculation should use total cost of $1,200 time period?

Get Another User's Information by Facebook Graph API -

hello new @ facebook graph api when used url https://graph.facebook.com/v2.7/me?fields=id,website,about,first_name,last_name,gender,birthday,education,age_range,email,%20television,movies,hometown,context,devices,favorite_teams,work&access_token=eaam ... i can website, first name , gender etc of me but when try user's information url https://graph.facebook.com/v2.7/ {user id}?fields=id,website,about,first_name,last_name,gender,birthday,education,age_range,email,%20television,movies,hometown,context,devices,favorite_teams,work&access_token=eaam... i can null values expect first_name, last_name , id how can correct mistake? note : other user allows show info. thanks

activerecord - Rails get last X objects with attribute match -

i have model deferredhost , has attribute ignore_flag . @ present, i'm getting of deferred hosts in controller: @deferred_hosts = @company.deferred_hosts.last(5) however, i'd make subjective , last 5 deferred hosts have ignore_flag = true . how can go doing this? should use if statement , loop through each deferred host, or there more 'rails' way? you can use where make query more specific: @deferred_hosts = @company.deferred_hosts.where(ignore_flag: true).last(5)

php - Condition inside variables -

i have example works great: $text = 'lorem ipsum'; $html = <<<html <div> <span>$text</span> </div> html; now how right way option 2 selected: $val = 2; $html = <<<html <select> <option if ($val == 1) {echo 'selected';} >option 1</option> <option if ($val == 2) {echo 'selected';} >option 2</option> <option if ($val == 3) {echo 'selected';} >option 3</option> </select> html; i think work template engine - don`t worry, pretty easy use. only thing need prepared project composer , after install 1 of template engine (for example picked latté ). install of composer: php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" php composer-setup.php after installing latté: php composer.phar require latte/latte and on end, can create this: $latte = new \latte\engine; $latte->settempdir...

How can i display the ggplots generated in java by rJava in html? -

i have created java code run r script using rjava create ggplots graphs.how can show plot in html or embed in html? with code `rengine engine = new rengine(new string[] { "--no-save" }, false, null);` `engine.eval("hist(rnorm(1000,40,123))");` i can open console window in eclipse. i'm having trouble send result html. tried create jpeg file result want interactive mousehover , such functions.

html - Send datas to an ASP.NET website using Jsoup in Android -

i trying build app parse website can send datas server generates output . the site uses asp.net : on left side can see selectors. third selector's value depends on second selector's value. have send second selector value somehow server. i parse first , second selector's value spinners. stuck @ third (don't know how send second spinner's value) . here code below (gets datas second selector , put spinner, works fine ) : elements szovetseg = document.getelementsbyattributevalue("name", "d_szervezet").get(0).children(); (int = 0; < szovetseg.size(); i++) { string = ""; string[] parts = szovetseg.get(i).tostring().split(">"); = parts[1]; string[] parts2 = a.split("<"); = parts2[0]; szovetsegek.add(a); } then second spinner gets value adapter szovetsegek list.

haskell - Using Yesod.Auth.Hardcoded SiteAdmin in a hamlet template -

problem description i've been unable compiling example of using yesod.auth.hardcoded . problem in trying interrogate user in hamlet template. foundation.hs set per documentation in link hardcoded. handler looks this: gethomer :: handler html gethomer = uid <- maybeauthid (widget, enctype) <- generateformpost . renderbootstrap3 bootstrapbasicform $ blurbform nothing currentpost <- rundb $ selectfirst [] [desc blogid] currentblurb <- rundb $ selectfirst [] [desc blurbid] defaultlayout $ settitle "my site" addscriptremote "https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js" addscriptremote "https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.2.0/js/collapse.js" $(widgetfile "homepage") my site compiles , renders happily until try useful uid being assigned in do block above. what i've tried i've tried both $maybe , $case constructs in ...

c# - Connect to SQL Server database from a docker container -

i have docker windows installed on machine. there console application targeting .net core 1.0.0 tries access sql server database running on different vm. can ping vm running sql server machine. when try run console application using dotnet run command prompt on machine works fine. when same application run inside docker container message a network-related or instance-specific error occurred while establishing connection sql server. server not found or not accessible. verify instance name correct , sql server configured allow remote connections. (provider: tcp provider, error: 40 - not open connection sql server) i tried using docker run --add-host sqldemo:<vm running sql server ip here> but made no difference. assumptions microsoft sql server 2016 windows 10 anniversary update windows containers asp.net core application add sql user sql database. in ms sql expand database right click on 'security / logins' select 'new ...