Posts

Showing posts from April, 2014

Javascript will not pass information into function from html -

ok new javascript. trying learn code changing text on button using external javascript file. can't javascript read buttons valueexternally, in chrome's debug tools see button value btn="". reads button object can't read properties. <html> <head> <title> test </title> <script type="text/javascript" src="gle.js"></script> </head> <body> <div><canvas id="gle" width="800" height="600"></canvas> </div> <div> <h2>enter mass , coordinates</h2> <input id="txtbox" type="text" /><br/> <button id="btn" onclick="change()">add</button> </div> </body> </html> the gle.js "use strict"; function change() { var x = document.getelementbyid("btn").value; var elem = documen...

deployment - Watson conversation - How to deploy? -

i've created , trained basic dialog , it's ready used in web site. i can't found docs deploy , use application. can me ? you need build front end application allows users interact conversation service. there generated sdk's various programming languages can in doing this.

html - How to get an input field to cover two td's -

i'm trying create basic form. have table 3 td's. in second row input span 2 td's. unfortunately cannot life of me input field cover 2 td's. have tried colspan="2" in td tag didn't seem work. <table id="info_table"> <tr> <td >name:</td> <td><input type="text" name="first_name" autofocus placeholder="first name"></td> <td><input type="text" name="last_name" placeholder="last name"></td> </tr> <tr> <td>email:</td> <td id="email" colspan="2"><input type="email" name="email" placeholder="ex. example@example.ca"></td> </tr> </table> you'll need manually set input field's w...

javascript - Problems with MongoDB trying to deploy a Meteor App -

i have been setting server on digital ocean droplet in order host couple of meteor apps. i'm doing scratch can learn as possible. trying use "meteor-up" (mup) deploy app, having problem communicating mongodb. when run "mup setup" following error: started tasklist: setup (linux) [gibson] - installing docker [gibson] - installing docker: success [gibson] - setting environment [gibson] - setting environment: success [gibson] - copying mongodb configuration [gibson] - copying mongodb configuration: success [gibson] - installing mongodb [gibson] x installing mongodb: failed -----------------------------------stderr----------------------------------- docker: error response daemon: driver failed programming external connectivity on endpoint mongodb (1e188b51b171446cd22d96f40ceab1e696019e5ac33ca713d78827246ae37ec8): error starting userland proxy: listen tcp 127.0.0.1:27017: bind: address in use. -----------------------------------stdout---------------------------...

Python - list index out of range - genetic algorithm -

i'm having problems code , know problem simple can't figure out how solve it, i'll appreciate if tell me i'm doing wrong: import random math import * def create_population(dim,pn): t = log(factorial(dim**2),2) b = int(t+1) d = "" indarray = [] bits_array=[] #print("bits usados: ",b) x in range(pn): y in range(b) : if random.randint(0,400000) %2: d = "1"+d else: d="0"+d num=int(d,2)%factorial(dim**2) bits_array.append(d) indarray.append(num) #print("\n index #",len(indarray),": ",num) d="" return indarray,dim,...

ajax - Unexpected end of JSON input... SO Wants more info -

i'm confused... what's wrong this? couldn't post without changing title... don't know what's wrong $(document).ready(function(){ $("#fmob").click(function(){ var mobname = $(this).attr("data-value"); console.log(mobname); $.ajax({ type: "post", url: "/system/mobproc.php", data: {mobname: 1}, datatype: "json", success: function(data){ if(data.response === true){ $("#fresponse").html(data.result); }else{ $("#fresponse").html(data.result); } }, error:function(jqxhr,textstatus,errorthrown ){ alert('exception:'+errorthrown ); } }); }); }); i looked here unexpected end of json input ajax call but somehow not expected... what's wrong? thanks. ...

python - Iterating over a Pandas grouped dataframe -

i using groupby in pandas create json style data. having trouble iterating on grouped dataframe doesn't recognize keys import pandas pd df = pd.dataframe(data=[['group a', 10], ['group a', 12], ['group b', 22], ['group b', 25], ['group b', 26]], columns = ['group', 'value']) df = df.groupby('group').agg(['mean', 'count']).reset_index() json_data = [{'id': row['group'], 'name': row['group'], 'value': row['mean']} index, row in df.iteritems()] print json_data error: keyerror: 'group' desired output: [{ 'id': 'group a', 'name': 'group a', 'value': 11 }, { 'id': 'group b', 'name': 'group b', 'valu...

c# - Setting property of dictionary type works in constructor but not when using property default -

this question has answer here: cannot access non-static field 2 answers i have class has property of type dictionary<object, func<object, treenode>> . can happily set property constructor (or using expression body), not default value of property (it doesn't change if property readonly, or have public get/set). issue occurs if dictionary instead stored in field. it comes error saying cannot access non-static method 'methodname' in static context . this code fails: public class treeviewbuilder { public dictionary<type, func<object, treenode>> objecttreenodebuilder { get; set; } = new dictionary<type, func<object, treenode>> { {typeof(type1), t => buildtype1treenode((type1) t)}, {typeof(type2), t => buildtype2treenode((type2) t)}, }; public treenode buildtype1treenode(t...

javascript - Object is created but seems to be sharing a reference -

i building editor, in editor when press play converts bunch of objects prefab (which explains engine how build object). when stop them rebuild prefab again , should original state (before play pressed). issue having when stop pressed items don't go original state. seem stay in state in when stop pressed. here class using convert prefabs , forth: class prefab { public name: string; public components: prefabcomponent[] = []; public static create(gameobject: gameobject): prefab { let prefab = new prefab; prefab.name = gameobject.name; gameobject.components.foreach(comp => { let prefabcomp = new prefabcomponent; prefabcomp.name = comp.name; (let c in comp) { let prefabprop = new prefabproperty; prefabprop.name = c; if (typeof comp[c] == 'object') { prefabprop.value = object.create(comp[c]); } else { ...

javascript - How to find a particular button/element using both the data-* and value attribute -

i have 2 dynamically generated buttons: <button type="button" data-btntyp="btnop" data-usrrole="3" data-reqid="24" class="btn btn-primary btn-xs" style="width: 75px" value="start">start</button> <button type="button" data-btntyp="btnop" data-usrrole="3" data-reqid="24" class="btn btn-primary btn-xs" style="width: 75px" disabled="true" value="complete">complete</button> the 2 buttons have same data-reqid different values. trying find() button data-reqid="24" , value="complete" , enable button. new jquery , have tried this: $("button[data-reqid='" + reqid+ "'][value=complete]").attr('disabled', 'false'); but that's syntactically not correct , hence doesn't seem work. couple of things. if want enable button, need set disabled...

android - when several iBeacon transmitter, startRangingBeaconsInRegion function only get one UUID -

when use startrangingbeaconsinregion(new region("myranginguniqueid", null, null, null);) range ibeacon signal in area, code can 1 ibeacon signal, set 2 or 3 ibeacon transmitters in room. there mistake in code? or before stoprangingbeaconsinregion ranging can 1 ibeacon signal? my code: private onclicklistener clicklistener = new onclicklistener() { @override public void onclick(view v){ if (v.equals(ibeaconrecv)){ transmitth transmitth = new transmitth(); receiveth receiveth = new receiveth(); newreceiveth newreceiveth = new newreceiveth(); transmitth.start(); //receiveth.start(); newreceiveth.start(); } } }; class newreceiveth extends thread{ @override public void run() { int waitflagtimes = wait_rev_flag_change_times; identifier taponuuididen = identifier.parse(taponuuidstr); //region doorbeaconregion = new region("taponibeaco...

sql server - Parameters in "use [database]" clause -

i want use parameters in use [database] command, runs without changing database under usage. how can fix it? lot declare @database varchar(100) set @database = 'transform' declare @sqlstring nvarchar(500) set @sqlstring = 'use '+ @database exec sp_executesql @sqlstring it changes database, within context of sp_executesql try confirm: set @sqlstring = 'use '+ @database + '; select db_name()'

Big Picture Notification in android -

i have done android push notification using fcm.but when trying big picture notification it's not showing full image in notificationn bar.left , right side of image getting cropped.please let me know how fix issue.i tried giving 512*256 image , 600*300 size images. i have used glide library loading image url... have loaded image using big picture notification. public class imagenotification extends appcompatactivity { public bitmap image ,bmp; public notificationcompat.builder nb; final string url = "https://www.google.es/images/srpr/logo11w.png"; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_image_notification); } public void createnotification(view view) { // prepare intent triggered if // notification selected intent intent = new intent(this, notificationreceiveractivity.class); pendinginte...

security - what are the following attack strings trying to do? -

i have found few attack requests on web application. mysite.com/login/auth;jsessionid=%22%20or%20%22d%22=%22d mysite.com/login/auth;jsessionid=1%20and%2013=3%20--%20- mysite.com/login/auth;jsessionid=c5c7348b296e4e39e84dd6b4bc93191d?alert(14721858.07197)<a> mysite.com/login/auth;jsessionid=c5c7348b296e4e39e84dd6b4bc93191d?"style="x:expr/**/ession(alert(14721858.07267)) i appreciate if can tell help! thanks! they probing url in several ways. session prediction, (that looks this): mysite.com/login/auth;jsessionid=%22%20or%20%22d%22=%22d mysite.com/login/auth;jsessionid=1%20and%2013=3%20--%20- these links discuss that: what vulnerability of having jsessionid on first request only and this testing session fixation and, ui hijacking , encoded url hacking, discussed here: three semicolon vulnerabilities good luck that...

asp.net - Button click event not firing inside modal pop up extender -

i have used ajax modal popup extender inside grid view adding confirmation box confirming user delete item grid view. <asp:templatefield headertext="action"> <itemtemplate> .... .... <asp:linkbutton id="lnkdelete" runat="server" tooltip="delete" cssclass="colorlnkbtndelete" commandargument='<%# databinder.eval (container.dataitem, "product") %>'><i class="icon-trash"></i></asp:linkbutton> <ajax:confirmbuttonextender id="cnfbtn" targetcontrolid="lnkdelete" displaymodalpopupid="modalpopupextender" runat="server"> ...

java - New window appears sandwiched between parent and child JFrame/JDialog -

Image
new windows other processes open behind focused jdialog child in front of jdialog parent. expect new windows appear in front of child. none of these windows declared on top. picture see app 3 between app 2 windows does not matter behind app 1 - on top, expected actual order jdialog (app 1 - on top) jframe (app 2 non modal dialog child of app 2 main) jdialog (app 3) <=== new window should appear on top of app 2 jframe (app 2 - main window) expected order jdialog (app 1 - on top) jdialog (app 3) <=== new window should appear on top of app 2 jframe (app 2 non modal dialog child of app 2 main) jframe (app 2 - main window) this problem happens if there existing window process declared always-on-top, doesn't have java, used java in sample below - issue happens if select on top firefox, gnome-terminal etc. the new window opened in position behind on top application. again, doesn't have java application, repeated firefox, gnome-terminal. redhat linux ...

objective c - IOS - Add button in tool bar left and middle -

Image
i want create ui tool bar effect this [done]-------[minus]-------- button done locate @ left , button minus locate @ middle this code didn't button minus set middle uitoolbar* mtbkeyboardaccessoryview = [[uitoolbar alloc] init]; [mtbkeyboardaccessoryview sizetofit]; uibarbuttonitem *donebtn = [[uibarbuttonitem alloc] initwithtitle:@"done" style:uibarbuttonitemstylebordered target:self action:@selector(donekeyboard)]; uibarbuttonitem *minusbtn = [[uibarbuttonitem alloc] initwithtitle:@"minus" style:uibarbuttonitemstylebordered target:self action:@selector(minussign)]; uibarbuttonitem *flexibleitem = [[uibarbuttonitem alloc] initwithbarbuttonsystemitem: uibarbuttonsystemitemflexiblespace target: nil action: nil]; [mtbkeyboardaccessoryview setitems:[nsarray arraywithobjects:donebtn, flexibleitem, minusbtn, flexibleitem, flexibleitem, nil]]; i don't want create button frame , customary set (w, h, x, y) , add sub-view ui tool bar is way set ui...

json - Can I Use coordinate [Lat,Long, Elevation, Time ]in GeoJSON File so that file can be used by any other Applications -

can use coordinates [lat,long, elevation, time] in geojson file file can used other application? { "type": "feature", "geometry": { "type": "linestring", "coordinates": [ [102.0, 0.0,805,"22-08-2016 13:04:04"], [103.0, 1.0,806,"22-08-2016 13:05:04"], [104.0, 0.0,804,"22-08-2016 13:06:00"], [105.0, 1.0,808,"22-08-2016 13:07:40"]] }, "properties": { "prop0": "value0", "prop1": 0.0 } } // "using elevation , time in coordinate array elevation numeric , time in string format this geojson specification . as in section extending geojson can extend add foreign members, alters structure of defined types referred versioning geojson , , such kind of object should not called geojson. you can check specifications define position array . tl;dr can, wont ...

Error in Running Spring Boot Application -

i have spring boot application, ready run in sts(spring tool suite) i followed [this][1] [1]: http://docs.spring.io/spring-boot/docs/current/reference/html/howto-traditional-deployment.html link. i'm getting whitelabel error : whitelabel error page application has no explicit mapping /error, seeing fallback. mon aug 29 11:46:52 ist 2016 there unexpected error (type=not found, status=404). no message available is because i'm running on pivotal server? should use tomcat? or doesn't matter? please ensure requestmapping index page, , corresponding method, both in same file main method.

MySQL - question marks inserted instead of cyrillic -

i've read through several time previous questions on , tried suggested, issue still persists. i have mysql db , second-party app inserts data db. worked ok until decided delete entire database , create new empty database forward engineering mysql model. after modification, second-party app began insert question marks instead of cyrillic. however, if try manually insert cyrillic, it's ok. i don't have access source code of second-party app. , - - had, issue not in second-party app, since emphasizing once more - before deleting , recreating database, worked ok. i tried following: 1) set global character_set_client = 'utf8'; set global character_set_results = 'utf8'; set global character_set_server = 'utf8'; set global character_set_database = 'utf8' set global character_set_connection = 'utf8' 2) alter database my_db_name character set utf8 collate utf8_general_ci; alter table table_of_interest_name convert character ...

php - How to import multiple csv files to mysql using codeigniter? -

i working in project need upload multiple csv file's data single table in database. have written code uploading zip file contains csv files , extracting in temp folder. not able write code reads each csv files , insert data mysql. kindly guide me. here controller code public function upload() { $spcode = $this->input->post("spcode"); $config['upload_path'] = './adsl/'; $config['allowed_types'] = 'zip'; $data['msg'] = ''; $this->load->library('upload', $config); // if upload failed, display error if (!$this->upload->do_upload()) { $data['msg'] = $this->upload->display_errors(); } $this->load->view('templates/header'); $this->load->view('upload_wholesale', $data); $this->load->view('templates/footer'); } public function fetchfilesfromdirectory() { $dir = "./adsl/"; ...

java - How to update an associate table without updating the entity classes -

let's have bidirectional @many_to_many relationship between 2 entity classes person , address. in case, associative table person_address not populated when table person , address populated. if have few entries in person , address table, need add associative record person , address, how in jpa , hibernate? person 1 john 2 mary 3 kate address 1 2nd street 2 3rd street now have method add association between "john" , "the 2nd street", how this? public void associate(person person, address address) { log.info("associating ..." ); entitymanager.persist(???); // there no explicit personaddress enitty } is common scenario associative table? you can't in jpa without updating entity classes, it's not how jpa works. link table there support entities , not entity default can not updated in isolation. if need update link table without updating entities (which honest seems little strange me!), can drop down native sql: q...

javascript - Delete database data in angularjs -

Image
when put link on browser worked. but, when clicked on button not working. wrong in code. http://localhost/youtubewebservice/shopcartproductdelete.php?cart_id=6 $scope.delete = function(cart_id, index) { var params = $.param({"cart_id":cart_id}); console.log(cart_id); $http({ headers: {'content-type': 'application/x-www-form-urlencoded'}, url: 'http://localhost/youtubewebservice/shopcartproductdelete.php?cart_id=$cart_id', method: "get", data: params }).success(function(data){ $scope.data.splice(index, 1); }); } <img src="img/removecart.png" ng-click="delete({{produ.cart_id}}, $index)" style="max-height: 40px;margin-right: 15px;"/> php code <?php $con = mysqli_connect("localhost","root","","look4com_lk"); if(isset($_get['cart_id'])){ $cart_id = $_get['cart_id']; $res = "delete l4wlk_...

android - Crosswalk not working with files upload -

hello great stackoverflow. develop small app , wrap crosswalk because of performance. work fine , browser performance excellent on android 4+. issue crosswalk not allow me upload file android app. when click on upload, "no app can perform action". am using <input type=file name="image"> any solution this?. thanks i had same problem on android 6+ . after install app on device/emulator default permissions turned off. you need turn on storage permission. go settings > apps > your app > permissions . but if need request permissions in runtime use cordova-plugin-android-permissions

hadoop - TestDFSIO benchmarking on cdh 5.8.0 -

environment details: os : centos 7.2 cdh: cdh 5.8.0 hosts: 11 ( 2 masters, 4 dn+nm, 5 nm) yarn.nodemanager.resource.memory-mb 32074mb (for nodemanager group1) 82384mb (for nodemanager group2) i have hadoop cluster 11 nodes, 2 masters, 4 slaves datanode & nodemanager daemons running, 5 nodes nodemanager daemon running on them. on cluster, running testdfsio benchmarking job 8tb load having 10000 files , file size of 800mb each. have noticed few things not understand properly. 1) number of splits job shown 10000. how come 10000 splits, dfs.blocksize shows 128mb, going setting, number of splits should more 10000 right? 2) in resoucemanager web ui, saw on 5 computenodes ( nodes on nodemanager running) 32 map tasks have run on each of these nodes. other map tasks being run on 4 dn+nm nodes. why happening? have allocated 9 slave nodes 2 node groups. 4 dn+nm nodes in nodemanager group1 , other 5 slaves in nodemanager group2. yarn.nodemanage...

php - laravel 5 How can I query -

php made ​​my query in laravel can not. this pdo code. $query2 = $db->query("select * veriler masraf_kodu='$hesap_kodu' , tarih between '$tarih1' , '$tarih2'", pdo::fetch_assoc); how can laravel 5 controller query ? masraf_kodu data table, hesap kodu plans database if you're using query builder, try wherebetween() : $data = db::table('veriler') ->where('masraf_kodu', $hesap_kodu) ->wherebetween('tarih', [$tarih1, $tarih2]) ->get();

axapta - Passing a value from modified() to lookup() in ax -

how can pass value modified() lookup() method in ax ? need output when click value in textbox automatically sort value in lookup based on value in textbox. you can declare textbox property autodeclaration = yes . then in lookup method write nameoftextbox.valuestr(); the result value of textbox.

objective c - iOS 9 : Add GMT Time Value -

i had search on google how gmt time in objective-c, , got : + (nsstring *)getgmttime{ nsdateformatter *dateformatter = [[nsdateformatter alloc] init]; dateformatter.dateformat = @"yyyy-mm-dd't'hh:mm"; nstimezone *gmt = [nstimezone timezonewithabbreviation:@"gmt"]; [dateformatter settimezone:gmt]; return [dateformatter stringfromdate:[nsdate date]];} is there way add or set gmt time ? (gmt+5) the flexible way use timezoneforsecondsfromgmt . more typo proof using strings gmt+x . here fuly working example: + (nsstring *)getgmttime{ nsdateformatter *dateformatter = [[nsdateformatter alloc] init]; dateformatter.dateformat = @"yyyy-mm-dd't'hh:mm"; nstimezone *gmt = [nstimezone timezoneforsecondsfromgmt:(60*60*5)]; [dateformatter settimezone:gmt]; return [dateformatter stringfromdate:[nsdate date]]; } it returns 2016-08-29t12:13 (when gmt time 2016-08-29t7:13 ) note: 60*60*5 means 5 hours x 60 m...

android - Picasso PlaceHolder Image : OutOfMemory -

i working android picasso library , after setting image drawable folder in placeholder ,i getting outofmemory exception. picasso place holder image stays in memory, if yes how remove placeholder image when actual image loaded? you may try resizing placeholder image since might big , causing outofmemory, can more complex error not of placeholder. , maybe it's not problem of placeholder of current image loaded url big? can resize image below code: picasso.with(mcontext) .load(someurl) .resize(sizex, sizey) .placeholder(r.drawable.placeholder) .into(imageview);

html - adjust image in table with text, too -

i want adjust images respective texts below each image. there 4 images in 1 line. , other 4 in second line. when remove image first line , second line , first image should placed last of first line . just queue <table> <tr> <td></td> </tr> <tr> <td> <!--first row--> <!--speaker 1 --> <table align="left" border="0" cellpadding="0" cellspacing="0" style= "border-collapse: collapse;mso-table-lspace: 0pt;mso-table-rspace: 0pt;"> <tbody> <tr> <td align="center"> <table align="center" border="0" cellpadding= ...

c# - DispatcherTimer and Show Modal Window -

let's see if can explain me behaviour , maybe how can solve this. have wpf app, , in viewmodel have dispatchertimer . in viewmodel have command show modal window, this: private void showwindowcommandexecuted() { wnnewwindow window = new wnnewwindow(); window.showdialog(); } when call command button, new window shown , dispatchertimer keeps running in background. far good. problem when try show window dispatchertimer this: dispatchertimer timerinstrucciones; timerinstrucciones = new dispatchertimer(); timerinstrucciones.interval = timespan.frommilliseconds(1000); timerinstrucciones.tick += (s, e) => { wnnewwindow window = new wnnewwindow(); window.showdialog(); }; timerinstrucciones.start(); in case, new window shown, long visible, dispatchertimer stops "ticking". understand dispatchertimer runs in ui thread, why behaves in different way in case? generally, showdialog modal dialog block calling thread, , show dialog. b...