Posts

Showing posts from April, 2014

sharepoint online - Getting Error while running Powershell Script to add Site Content Link -

$adminupn="xxxxx@home500.onmicrosoft.com" $orgname="xxxxxx" $usercredential = get-credential -username $adminupn -message "type password." connect-sposervice -url https://$orgname-admin.sharepoint.com -credential $usercredential # begin process $loadinfo1 = [system.reflection.assembly]::loadwithpartialname("microsoft.sharepoint.client") $loadinfo2 = [system.reflection.assembly]::loadwithpartialname("microsoft.sharepoint.client.runtime") $loadinfo3 = [system.reflection.assembly]::loadwithpartialname("microsoft.sharepoint.client.userprofiles") #add sharepoint powershell snapin if not added $snapin = get-pssnapin | where-object {$_.name -eq 'microsoft.sharepoint.powershell'} if ($snapin -eq $null) { write-host "loading sharepoint powershell snapin" add-pssnapin "microsoft.sharepoint.powershell" -ea silentlycontinue } cls $starttime = $(get-date -f f) $timestamp = get-date

Percent symbol not getting evaluated in makefile -

i'm new makefiles etc. the file looks this: compiler_name = gcc compiler_flags = path_objects = ./obj path_sources = ./src $(path_objects)/%.o: $(path_sources)/%.c $(info generating object files...) @$(compiler_name) $(compiler_flags) -c $< -o $@ cleanup: $(path_objects)/%.o $(info final cleanup...) @rm -rf $< when try make project error: make: *** no rule make target 'obj/%.o', needed 'cleanup'. stop. it's % wildcard not getting evaluated correctly. please me. a pattern rule has '%' in target , , maybe in 1 or more of prerequisites. have: cleanup: $(path_objects)/%.o ... is not pattern rule, , '%' not wildcard, it's character. that's ordinary rule looks file called "./obj/%" prerequisite, , there's no such file. if want cleanup remove of object files in directory, there's no need of complication. this: cleanup: @echo final cleanup... @rm -rf $(pat

android - Backbone.js fetch goes to error when loading json file -

i'm trying load json file called internationalization.js, content of file: { "response": { "loading": "loading", "login.login": "log in" } } this works fine on browser, when building ios or android app using cordova fetching fails , goes error function. i'm wondering if asynchronous nature of fetch works in different way when on mobile app. file found correctly xhr holds json content in responsetext, have seen when debugging in safari. code fetching: var internationalizationmodel = new model({}, {url: config.internationalization}); internationalizationmodel.fetch({ success: _.bind(function(model){ window.polyglot = new polyglot({phrases: model.tojson()}); app.router.navigate("home",true); }, this), error: _.bind(function(model, xhr, options){ this.logout(); }, this) relevant methods in model: sync: function(method, m

javascript - AngularJS ng-repeat print 0 if any object missed -

one object missed in 2nd array. using ng-repeat there want print 0. please find below code <div ng-repeat="item in items"> {{item}} <div> <h3>{{item[0].name}}</h3> <div> <article> {{item[0].tc}} </article> <article> {{item[1].tc}} </article> <article> {{item[2].tc}} </article> </div> </div> </div> code in plunker print object or 0 instead <article> {{item[2].tc || 0}} </article> or <article> {{item[2].tc ? item[2].tc : 0}} </article>

Java Convert List<String> to List<Object> -

i've 2 classess csvread , myownclass. in csvread i've method public static list getdatafromcsv(); returns list of data. , data want take in method in class myownclass , return there list of objects of ownclass it looks this: list<string> datafromcsv = new arraylist<string>(); and in class, want convert list<object> of class. private static list<string> getdatafromcsvclass = new arraylist<string>(); getdatafromcsvclass = csvreader.getallcsvdata(filename); string name = datafromcsv[0]; string surname = datafromcsv[1]; string birth = datafromcsv[2]; i want return new myownclass(name, surname, birth); my error: array required list found: string name = alldata[0]; etc you can create method convert string myownclass , use stream map elements, e.g.: public static myownclass converttoobject(string element){ string[] tokens = element.split(","); return new myownclass(tokens[0], tokens[1], tokens[2]); } //

c# - Resource not found Face API 1.0 -

for love of life can not figure out why jason format ways wrong , using microsoft face api 1.0 create person within group here code protected async void btnaddfaces_click(object sender, eventargs e) { var client = new httpclient(); var querystring = httputility.parsequerystring(string.empty); string persongroupid = txtfriendlist.text.tolower(); string persons = txtfriendname.text.tolower(); // request headers client.defaultrequestheaders.add ("ocp-apim-subscription-key", "{yourkey}"); // request parameters var uri = "https://westus.api.cognitive.microsoft.com/face/v1.0/ persongroups/wowlist/persons?" + querystring; // httpresponsemessage response; // not sure think here problem string body = "{\"name\":\"" + "waheed" + "," + "\"}"; // request body using (var content

android - Create a staggered grid like the given image -

Image
i trying achieve view: this partial view , can have view vertically merged 2 cells or horizontally merged 2 cells or single small view. this view can scroll vertically please me this. you can create layout using nested linearlayout attribute layout_weight , weightsum . make layout scrollable , use scrollview root layout. here working example: <?xml version="1.0" encoding="utf-8"?> <scrollview xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <linearlayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_margin="8dp" android:orientation="vertical"> <!-- row1 --> <linearlayout android:layout_width="match_parent" android:layout_he

c# - UIImageView change UIImage on touch then restore previous UIImage -

so, after finding anwser in previos question here add gesturerecognizer on uiimageview. when user tap, color change. , when tap again default image restored. any tip that? i thinking list update in each click not sure best thing that. here gesturerecognizer uitapgesturerecognizer createtouchgesture(uiimageview imageview) { var touchgesture = new uitapgesturerecognizer((tg) => { imageview.image = drawselectedborder(imageview.image); }); return touchgesture; } based on comments, can offer solution. use uiimageview animationimages property store base image. , when press again image retrieve array. , know in state are, use ighlighted property. like : var touchgesture = new uitapgesturerecognizer((tg) => { if(!imageview.highlighted){ imageview.highlighted = true; imageview.animationimages = new uiimage[]{imageview.image}; imageview.image = drawselectedborder(imageview.image); }else{ imagevie

How to split a string on the 3rd occurence of a char C# -

i wondering there way split string on 3rd occurence of char? when splitting using: line.substring(line.lastindexof(']') +1); i hadn't realised of strings had square brackets others ideally need split on 3rd occurence of ']' same position on every string. input: [wed dec 17 14:40:28 2014] [error] [client 143.117.101.166] file not exist: output: [wed dec 17 14:40:28 2014] [error] [client 143.117.101.166] file not exist: you need split string first take index of 3rd ] line.substring(line.indexof(line.split(']')[3])); or more easy said 3rd index of ] same, put fixed line.substring(59);

How can I create a temporary Redirect in .htaccess that all browsers adhere to? -

multiple variations of question have been asked, can't seem find satisfying answer. i add following .htaccess file redirect 302 /test1 /test then browse website. redirected /test. remove redirect, , browse website again. in chrome, firefox , internet explorer (latest versions on 2017-04-14) browsers use cached redirect, , send me /test. on edge, /test1. as mentioned in other questions, kindof ok, per the rfc : since redirection might altered on occasion, client should continue use request-uri future requests. note "should" in rfc lingo means advised, not obligatory. advised not cache redirect (and hence, go /test1), ok cache anyway. don't understand why browsers not follow rfc suggestion here, ...but there's that. then there 303 redirect: the 303 response must not cached, response second (redirected) request might cacheable. i have tested this. given rfc, redirect must not (as in ever ) cached. edge , firefox play nice here, , don't

Detecting changes of an object angular 2 -

i know if object myobject has been modified in view , purpose using ngonchanges. this html <form class="inputform"> <table id="inputformtable"> <tr> <td><label>login</label></td> <td><input type="text" size="40" [(ngmodel)]="myobject.value1" name="value1"/></td> </tr> <tr> <td><label>mot de passe</label></td> <td><input type="password" size="40" [(ngmodel)]="myobject.value2" name="value2"/></td> </tr> </table> this component using ngonchanges import {component, oninit, onchanges, simplechanges, input} '@angular/core'; export class utilisateurcomponent implements oninit, onchanges { @input() myobject: any= {actif: false}; ngonchanges(changes: simplechanges): void { (let p

ionic2 - Ionic 2: Importing angular library -

i new ionic , angular, , have found library i'd use in ionic app. have placed .js file in /src/assets/angular_slideables.js , have tried link in index.html , following error: runtime error angular not defined index.html <!doctype html> <html lang="en" dir="ltr"> <head> <meta charset="utf-8"> <title>ionic app</title> <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"> <meta name="format-detection" content="telephone=no"> <meta name="msapplication-tap-highlight" content="no"> <link rel="icon" type="image/x-icon" href="assets/icon/favicon.ico"> <link rel="manifest" href="manifest.json"> <meta name="theme-color" content="#4e8ef7"> <!-- cordova.js re

html - Set height of content in a Bootstrap Card so that it fills the whole card block -

i struggling layout defined here: https://jsfiddle.net/zmcode/uk97kflm/20/ . the problem red div inside card on right should fill whole card block. can me in understanding how should modify layout in order make #right-card-content fill whole right card block? edit solution proposed @mateusfelipe works on firefox. unfortunately need work on chrome (v57) too. i previously explained h-100 height: 100%, , works when container has defined height. https://jsfiddle.net/1vgewck9/2/ <div class="row equal h-100"> <div id="left-col" class="col-md-4 pr-md-2"> <div class="card"> left card </div> </div> <div id="right-col" class="col-md-8 pl-md-2"> <div id="right-card-container"> <div class="card"> <div class="card-header">right card</div> <div class="card-block h-100&quo

VS Code turns everything into an html snippet? -

a serious limitation workflow vs code fact while typing html gets turned html tag when pressing tab @ beginning of line. entering: alsdjflkasjdfk + tab leads to: <alsdjflkasjdfk> </alsdjflkasjdfk> this problem since want integrate django html snipptes , end not working. know how turn off? rather want defined html snipptes turning one. try setting: "emmet.triggerexpansionontab": false this should disable feature. investigating different flow emmet vscode 1.12: https://github.com/microsoft/vscode/issues/21943

python - How to replace token(bearer) with username, password in Cherwell REST API request -

i trying create rfc in cherwell using rest api in python. tried first in swegger ui. got working there. able create rfc successfully. following curl request, in python, using request module, tried , got 401. found why getting 401. it's because of in authorization using bearer temporary token. live 10 minutes. if request after 10 minutes got 401. bearer compulsory field. can't make request without it. tried pass username , password instead of bearer, didn't work. below request, with open('c:\cherwell\payload.json') file: data = json.load(file) payload = data header = {"authorization":"bearer xxxxxxxx"} r = requests.post("https:/url/cherwellapi/api/v1/savebusinessobject? api_key=xxxx-xxxx-xxxx-xxxx", auth=('user','pass'), headers = header, data=json.dumps(payload)) print r it great, if can have done before! please advice appreciate help! using call get token can access token , using can request create

scala - Composing a list of pairs -

i have list in scala following: list(1,2,3,4) how can generate list of tuples of pairs of elements running end result follows: list((1,2), (1,3), (1,4), (2,3), (2,4), (3,4)) is there built in function produce such result? there combination method in list, this list(1,2,3,4).combinations(2).tolist

windows - Powershell: Querying TS with Get-Process, SAMAccount and ComputerName? -

i'm trying code query ts specific applications , select sam account of user using process , computer name. have looks i'm having hard time integrating query of sam account , computer name. get-wmiobject win32_process -computername "myserver" | {$_.name -eq "winword.exe"} | invoke-wmimethod -name getowner you loose wmiobject process when pipe directly invoke-wmimethod . can use foreach-object generate object or use custom column select-object this: get-wmiobject win32_process -computername "localhost" | where-object {$_.name -eq "notepad.exe"} | select-object csname, processname, @{n="owner";e={$_.getowner().user}} csname processname owner ------ ----------- ----- frode-pc notepad.exe frode when writing scripts custom columns, prefer write define them earlier more readable , can reused, this: $ownercolumn = @{ name="owner" expression={ $_.getowner().user } } .... where-object ... | s

ruby on rails - Pagination not working with merged objects -

i have 4 objects @ob1 = user.where(:area => "india") @ob2 = user.where(:area => "usa") @ob3 = user.where(:area => "uk") @ob4 = user.where(:area => "china") merged above 4 objects in on object @merged_obj= @obj1+@obj2 merged object , passing pagination @users = @merged_obj.paginate(:page => params[:page], :per_page => 1) but troughs error nomethoderror: undefined method `paginate' #<array:0x007fc3d65a5338> pagination works below code: @users = user.where(:area => "india").paginate(:page => params[:page], :per_page => 1) gems:- gem 'will_paginate', '~> 3.1.0' gem 'will_paginate-bootstrap' it looks won't work arrays. of following instead @obj = user.where(:area => ["india","usa","uk","china"]) or @merged_obj = user.where(id: [@ob1.id, @ob2.id, @ob3.id, @ob4.id]) edit: responding comment

oracle - PL-SQL PROCEDURE issue -

i'm trying simple procedure using oracle db , sql developer: create or replace procedure test_prod query_str varchar2(200); integer := 0; type cur ref cursor; my_cur cur; begin query_str := 'select * table rownum<=1000'; open my_cur query_str; dbms_output.put_line('start'); loop := + 1; dbms_output.put_line('i: ' || i); end loop; dbms_output.put_line('count: ' || i); close my_cur; end; the last value 'i' 3014 (the expected 1 1000) , last 'put_line' not displayed. moreover, if try put increment in loop , displaying final value, procedure doesn't end. anyone suggest me problem? thanks aleksej has answer use implicit cursor possible--implicit cursors close automatically , succinct , readable. example, implicit cursor recommended way go. i'll add here additional examples in line etsa's answer alternatives using explicit cursors in original post.

intellij idea - How to run test maven? -

i have problem call unit test maven task. pom.xml : <?xml version="1.0" encoding="utf-8"?> <project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelversion>4.0.0</modelversion> <groupid>fizzbuzztddkata</groupid> <artifactid>fizzbuzztddkata</artifactid> <version>1.0-snapshot</version> <dependencies> <!-- https://mvnrepository.com/artifact/org.junit/junit5-engine --> <dependency> <groupid>org.junit</groupid> <artifactid>junit5-engine</artifactid> <version>5.0.0-alpha</version> <scope>test</scope> </dependency> <!-- https://mvnrep

javascript - requiring module by name is only supported in debugging mode and will break in production -

Image
i have list of text , images, name of image firebase database , concatenate extracted name path of images' folder under project: that's code used var icon= require ('path/'+item.image+'.png') return ( ... <image style={{width: 50, height: 50}} source={icon}/> the images displayed have warnings as have images in list read somewhere require('image!...') no longer supported support require('image!…'), has been deprecated long time, removed. if still loading images way in apps, make sure check documentation alternatives. there no explicit question being asked, assume you're asking "what error mean?" , "what, if anything, should make go away?". the require('image!...') (really) old way of using images in react native. suspect issue here you're building image name dynamically. see react native docs on

typescript - Jasmine does not evaluate 0 toEqual -0 -

i have test in typescript comparing 2 objects, , results show are: chrome 57.0.2987 (mac os x 10.12.4) hex should round 1 failed expected hex({ q: 0, r: 0, s: -0 }) equal hex({ q: 0, r: -0, s: 0 }). how can value of -0 not equal 0 in jasmine? thing can think of is converting string. ('should verify 0 === -0', () => { expect(0).toequal(-0); });

Jquery or JavaScript image slider from JS array with thumbnails -

please help, javascript , jquery experts, how make automatic image gallery slider thumbnails, target images' source paths stored in java script array? i have jquery image gallery automatic slider code thumbnails, works fine. but, can see target images placed in unordered list in html. need target images (i.e. img src) in js array, need modify js script, don't know how. so, don't want images in html list, want div image source in js array. have js array made php array. <script type="text/javascript"> var imgs = <?php echo json_encode($images); ?>; </script> thanks in advance!! //image gallery var triggers = $('ul.triggers li'); var images = $('ul.images li'); var lastelem = triggers.length-1; var target; triggers.first().addclass('active'); images.hide().first().show(); function sliderresponse(target) { images.fadeout(800).eq(target).fadein(800); triggers.removeclass('active').eq(ta

sqlite - Yocto / Qt 5.6 - QSqlDatabase: QSQLITE driver not loaded -

i working on nitrogen6x board runs on yocto 2.1 qt 5.6.2 support. have developed qt application reads data sql database, started noticing below error when launch application on target. qsqlite driver not loaded qsqldatabase: available drivers: as understand it, means not have qsqlite driver (plugin) built , installed on target system. did simple search find sql plugin on target machine , got below dump: ~ # find / -name *sql* /usr/bin/sqlite3 /usr/lib/rpm/qf/wdj_l10n_sqlite /usr/lib/rpm/qf/yum_primary_sqlite /usr/lib/rpm/qf/yum_other_sqlite /usr/lib/rpm/qf/yum_filelists_sqlite /usr/lib/libsqlite3.so.0.8.6 /usr/lib/libsqlite3.so.0 /usr/lib/libsqlite3.so /usr/share/mime/application/x-sqlite3.xml /usr/share/mime/application/x-kexiproject-sqlite3.xml /usr/share/mime/application/x-sqlite2.xml /usr/share/mime/application/sql.xml /usr/share/mime/application/x-kexiproject-sqlite2.xml /opt/poky/2.1.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/lib/libsqlite3.so /opt/poky/2.1.1

javascript - React child component not updating parent state -

i'm using react + electron + redux in app development. able update parent state child component in case, i'm not able it, state being updated child components. i know reducer action being called right value, parent component being rerendered wrong 1 (the previous one), sub tree of child component being rendered right value. my method: i'm creating function (action handler) in parent component container : class createexercisecanvas extends react.component { focusonsection (section) { /* function i'm refering */ store.dispatch(actions.focusonsection(section)) } render() { return ( <createexercisecanvas focusonsection={ this.focusonsection } /> ) } } const mapstatetoprops = function (store) { return { focusonsection: store.exercise.focusonsection } } export default connect(mapstatetoprops)(createexercisecanvascontainer) and function being passed prop child container: <index focusonsect

android - custom AlertDialog view.onClickListener does not work properly -

i'm adding colors.xml alertdialog , want respond, when 1 of views clicked. dialog displayed , when performclick() on 1 of views works. when try run on phone , click hand listener not triggered although should be. here's code: my mainactivity.java alertdialog.builder builder = new alertdialog.builder(this); builder.settitle("pick color"); builder.setcancelable(true); flexboxlayout fl_colors = (flexboxlayout) layoutinflater.inflate(r.layout.colors,null); builder.setview(layoutinflater.inflate(r.layout.colors,null)); final alertdialog alert = builder.create(); for(int i=0;i<fl_colors.getchildcount();i+=1){ view v_color = fl_colors.getchildat(i); log.d("debug",v_color.tostring()); // logs element like: android.view.view{a7d0c87 v.ed..... ......i. 0,0-0,0 #7f0d00a6 app:id/btn_6} v_color.setonclicklistener(new view.onclicklistener(){ @override public void onclick(view v) { string color = (string) v.gettag()

python - Recode list values in dataframe column -

i'm trying recode values in dataframe column organized in list format. know how replace string values in dataframe column struggling how in list. here snippet of data: {0: '[crime, drama]', 1: '[crime, drama]', 2: '[crime, drama]', 3: '[action, crime, drama, thriller]', 4: '[crime, drama]', 5: '[biography, drama, history]', 6: '[crime, drama]', 7: '[adventure, drama, fantasy]', 8: '[western]', 9: '[drama]'} for example, i'd recode crimes thrillers , biography history. i know below works replacing string values df.loc[df['genre']=='crime']='thriller' but how modify list? thanks! edit: code used create dataframe (with data extracted imdb database) is: # these variables want (ie able to) extract movie object metadata = ('title', 'rating', 'genre', "plot", "language", "runtime", "year",

excel - Drag formula and have it reference every other cell -

Image
i have simple if statement made works. however, when try drag formula automatically populates other cells, doesn't reference correct cells. because increments reference cell chronologically (i.e: goes x y z) need increment every other cell (i.e: x z ab) how that? here snippet of place formula is: here snippet of want reference: you can x3, z3, ab3 etc filling following right. =index($x:$cp, row(3:3), (column(a:a)-1)*2+1) this makes formula in cq3, =if(index($x:$cp, row(3:3), (column(a:a)-1)*2+1)>1, 2, if(index($x:$cp, row(3:3), (column(a:a)-1)*2+1)=1, 1, 0)) fill down row 4.

javascript - window.postMessage internet explorer 11 support -

i attempting use postmessage() send data new window spawned parent window. postmessage() works fine in chrome/firefox internet explorer seems choking on addeventlistener , no data being sent new page. i understand ie should use attachevent have implemented, child page supports addeventlistener , parent page not while referencing child. parent: var newtab = window.open('community_printerfriendlyeligibility'); if (newtab.addeventlistener) { console.log('add1'); newtab.addeventlistener('load', function() { console.log('add2'); newtab.postmessage(data,'*'); }); } else if (newtab.attachevent) { console.log('attach1'); newtab.attachevent('load', function() { console.log('attach2'); newtab.postmessage(data,'*'); }); } child: if (window.addeventlistener) { console.log('add'); window.addeventlistener('message', fun

How to: Flask Python / WTForms Adding dynamic field -

how can generate fields dynamically in flask wtf forms without using java script dom add fields here in link: h t t p://formvalidation.io/examples/adding-dynamic-field/ example adding field or when delete field delete set on database in images down here. form 1 row: form 1 row form multiple rows: form multiple rows {{ form.hidden_tag() }} {{ form.book }} {{ form.isbn }} {{ form.price }} <button type="button" class="btn btn-default addbutton"> <i class="fa fa-plus"></i> </button> <button type="submit" class="btn btn-default">submit</button> and python class form class bookform(flaskform): isbn = stringfield("isbn",[validators.datarequired("please enter isbn number.")]) title = stringfield("titile",[validators.datarequired("please enter book title.")]) price = floatfield("price") i saw people proposing class_ th

java - New ArrayList() on Child Object does not update reference in parent object -

i thought based on references in java. have complex object contains child list. parentobj |-- ... |-- list<string> childlist when modify childlist directly, see "parentobj" updates childlist reference accordingly. childlist.add("hello"); but when do if (childlist == null) { childlist = new arraylist<string>(); } i see "parentobj" still has null child list ! different case, expecting parentobj reference updated setting/adding. java passes references value. meaning there's duplicate of reference that's passed method argument. when assign childlist , if it's not original reference assignment done duplicate reference. that's why should using setter method.

google maps - Polyline is draw straight instead of proper driving directions route path from point A to B -

i using angular2-google-maps plugin angular2 i have 2 points & b. i trying draw polyline, draws straight line instead of proper driving directions route. here plunker: http://plnkr.co/edit/uz8dz0zb4ea8cjte6wym?p=preview main code: <sebm-google-map [latitude]="49.0096941" [longitude]="2.5457305" [zoom]="10"> <sebm-google-map-polyline> <sebm-google-map-polyline-point [latitude]="49.0096941" [longitude]="2.5457305"> </sebm-google-map-polyline-point> <sebm-google-map-polyline-point [latitude]="48.9688538" [longitude]="2.5375751"> </sebm-google-map-polyline-point> </sebm-google-map-polyline> </sebm-google-map> can identify issue if any? because following docs you'll need call directions service driving directions between 2 coordinates, response include polyline can display on map. angular

java - Swapping elements in an ArrayList -

i'm trying make slider puzzle kind of game click 1 image, click , swap positions. reason works correctly first time it, when go swap image second time , every time after selects different element 1 clicked on. appreachated, thank you. public class test extends application { int click1 = -1, click2 = -1; public static void main(string[] args) { application.launch(args); } @override public void start(stage primarystage) throws exception { //create gridpane gridpane pane = new gridpane(); pane.setalignment(pos.center); pane.sethgap(5); pane.setvgap(5); //create arraylist , add imagelist arraylist arraylist<imageview>imagelist = new arraylist<imageview>(); (int = 0; < 9; i++) { imagelist.add(new imageview ((i) +".jpg")); } addimages(imagelist, pane); //add onclick listeners each image imagelist.get(0).setonmouseclicked(e->{ swap(0, imagelist, pane); }); imagelist.ge

java - Limited recreation of a button through a forloop -

so i'm building app each time floatactionbutton clicked, button created. aspect of app works fine. problem buttons being created on top of 1 , created. need create 4 buttons click after click, 1 below another. this for-loop. appreciate help. addingsemester.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { (int = 0; <= 4; i++){ button semesterbutton = new button(mainactivity.this); semesterbutton.setid(i); semesterbutton.settext("semester " + i); semesterbutton.setlayoutparams(lp); semesterlayout.addview(semesterbutton); i++; } } }); xml <?xml version="1.0" encoding="utf-8"?> <linearlayout android:id="@+id/main_layout" xmlns:android="http://schemas.android.com/apk/res/android&q

html - jQuery .hover not toggling class, what am I doing wrong? -

<li class="animated abutton"><a href="#about">about me</a></li> $('.abutton').hover( function() { $(this).toggleclass('shake'); } ); i trying add class shake animate css on hover, not working, not sure doing wrong. it seems working. $('.abutton').hover( function() { $(this).toggleclass('shake'); } ); .shake { color: #ff0; } <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <li class="animated abutton"><a href="#about">about me</a></li>

makefile - Unable to Make a development environment image for Docker opensource development -

i trying make development environment image docker opensource development, facing following error. have cloned repository git page , running on centos. i working in company , have set proxy environmental variable in dockerfile. this error getting - ign http://deb.debian.org jessie inrelease ign http://ppa.launchpad.net trusty inrelease ign http://deb.debian.org jessie-updates inrelease err http://deb.debian.org jessie release.gpg cannot initiate connection 8080:80 (0.0.31.144). - connect (22: invalid argument) err http://ppa.launchpad.net trusty release.gpg cannot initiate connection 8080:80 (0.0.31.144). - connect (22: invalid argument) ign http://security.debian.org jessie/updates inrelease err http://deb.debian.org jessie-updates release.gpg cannot initiate connection 8080:80 (0.0.31.144). - connect (22: invalid argument) err http://security.debian.org jessie/updates release.gpg cannot initiate connection 8080:80 (0.0.31.144). - connect (22: invalid argument) ign http://pp

c++ - Segmentation Fault on string conversion? -

i working on encryption project , making simple test takes file name terminal , runs encryption. have following encryption code following segmentation fault: terminate called after throwing instance of 'std::logic_error' what(): basic_string::_m_construct null not valid<br><br> program received signal sigabrt, aborted. 0x00007ffff74ab428 in __gi_raise (sig=sig@entry=6) @ ../sysdeps/unix/sysv/linux/raise.c:54 54 ../sysdeps/unix/sysv/linux/raise.c: no such file or directory. after running trace gdb have confirmed fault triggered after following loc: string plain(reinterpret_cast(filecontents), filelength); my main function below calls piece of code: #include <iostream> #include <stdlib.h> #include <stdio.h> #include <string> #include <fstream> #include <limits> #include <sstream> #include <stdlib.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include "

uuid - Unique Id for my android app -

i want create unique id android app server can identify device request has come , send messages app accordingly. read android_id not safe use unique identifier can compromised on rooted device. , manufacturer don't provide it. is uuid safe use porpose ? globally unique id app ? if yes, planning store using keystore can keep until app uninstalls. right approach. please suggest. its safe use uuid, helper function created uuid myself,keep in helper.java , call : helper.getdeviceid(context); also don forget change string sharedprefdbname variable sharef db name, can store uuid in db or local file incase app uninstalled said. //uuid static string deviceid; static string sharedprefdbname = "myappdb"; /** * getdeviceid * @param context * @return string */ public static string getdeviceid(context context){ //lets device id if not available, create , save //means device id created once //if deviceid not null, return if(deviceid != null

r - Adding a column of corresponding seasons to dataframe -

here example of dataframe. working in r. date name count 2016-11-12 joe 5 2016-11-15 bob 5 2016-06-15 nick 12 2016-10-16 cate 6 i add column data frame tell me season corresponds date. this: date name count season 2016-11-12 joe 5 winter 2016-11-15 bob 5 winter 2017-06-15 nick 12 summer 2017-10-16 cate 6 fall i have started code: startwinter <- c(month.name[1], month.name[12], month.name[11]) startsummer <- c(month.name[5], month.name[6], month.name[7]) startspring <- c(month.name[2], month.name[3], month.name[4]) # create function find correct season based on month monthseason <- function(month) { # !is.na() # ignores values na # match() # returns vector of positions of matches # if starting month matches spring season, print "spring". if starting month matches summer season, print &quo

ajax - How to Search data in tag input and displaying data to table with javascript? -

i have issues searching , displaying data table javascript. have data format json can't displayed on table 1st row, while on console log.data 5 rows displayed. how solved problem. guys hope here solved. this data: var data =[ {header_id:"tr100001" detail_id:"2" item_code:"sph001" price:"4000" weight:"2"}, {header_id:"tr100001" detail_id:"3" item_code:"sph002" price:"4500" weight:"2"}, {header_id:"tr100001" detail_id:"4" item_code:"sph003" price:"30000"weight:"2"}, {header_id:"tr100001" detail_id:"5" item_code:"sph004" price:"45000"weight:"2"}]; this's view: <div class="row"> <div class="col-md-12"> <div class="table-responsive"> <table id="buy_

sql - Contains no primary or candidate keys that match the referencing -

sql71516 :: referenced table '[dbo].[mstransaction]' contains no primary or candidate keys match referencing column list in foreign key. if referenced column computed column, should persisted. this error receiving. solutions? here sql code both tables: create table [dbo].[msorderline] ( [purchaseid] nchar (200) not null, [productid] nchar (200) not null, [quantity] int null, constraint [doublems_pk] primary key clustered ([purchaseid] asc, [productid] asc), foreign key ([purchaseid]) references [dbo].[mstransaction] ([purchaseid]), foreign key ([productid]) references [dbo].[msproducts] ([productid]) ); create table [dbo].[mstransaction] ( [transactionid] nchar (200) not null, [employeeid] nchar (200) null, [customerid] nchar (200) null, [purchaseid] nchar (200) not null, [amount] int null, [totalamount] int null, [timeofsale] nchar (200) null, [disco