Posts

Showing posts from May, 2014

symfony 2.3 - SonataAdmin change template list for Admin Users -

i new user in sonata admin + fosuserbunle. need create new template list when user admin. check , redirect in crud controller or in sonata admin. if need admin class , change style template, best option redirect in de sonata admin class. overwrite gettemplate() method. class yourentityadmin extends admin { public function gettemplate($name) { if ($this->configurationpool->getcontainer()->get('security.context')->isgranted('role_admin')) { switch ($name) { case 'list': return 'yourbundle:entity:list.html.twig'; default: return parent::gettemplate($name); } } else { return parent::gettemplate($name); } }

amazon web services - Creating n new instances in AWS EC2 VPC and then configuring them -

i'm having hard time doing seems standard task i'm hoping can me. i've googled crazy , of examples not in vpc or use deprecated structure makes them wrong or unusable in use case. here goals: i want launch whole mess of new instances in vpc (the same code below has 3 hundred) i want wait thoseinstances come alive i want configure instances (ssh them, change hostname, enable services, etc. etc.) now in 2 tasks. create instances in 1 playbook. wait them settle down. run 2nd playbook configure them. that's i'm going because want moving - there has 1 shot answer this. here's have far playbook --- - hosts: localhost connection: local gather_facts: false tasks: - name: provision lunch with_items: - hostname: eggroll1 - hostname: eggroll2 - hostname: eggroll3 ec2: region: us-east-1 key_name: eggfooyong vpc_subnet_id: subnet-8675309 instance_type: t2.micro image:

Python and PLY: how to get rid of token 'XXX', defined but not used -

i'm using python , ply. i'm ignoring comments rule: def t_any_comment(self, t): r'//.*$' pass it works fine, warning: warning: token 'comment' defined, not used i'd rid of warning. don't see in ply documentation suggest case. in case solution not add comment tokens variable. had thought had add tokens there. turns out, it's ones used yacc portion. makes sense, doc didn't come out , that.

java - Leading zeroes in Integer array leading to different values being printed -

this question has answer here: regarding leading 0 in integer value 3 answers why value printed not same input? leading zeroes change way integer read? integer[] secondarray = {02,03,04,05,06,011,012,012,0123}; system.out.println("values:" + arrays.tostring(secondarray)); output: 2, 3, 4, 5, 6, 9, 10, 10, 83 a leading 0 in integer literal in java (and lot of other languages) means octal number (base 8). so 011 nine. other systems can use hex ( 0x09 , base 16) , binary ( 0b1001 , since java7).

HTML&CSS Strategy for header navigation -

Image
need input on how best implement navigation in html & css fluid when user resizes screen 1200 lets 786px example , navigation options don't cram - break hamburger situation. have psd file layered out , all. my 2 ideas: i'm thinking positioning navigation @ position , creating link areas on navigation options making big logo gets smaller , moves while navigation moves inward while user make screen smaller any ideas out there situation. i don't understand why first idea. second idea accomplished , in getting menu fit on 1 line browser window widths of 786px , higher. off bat see might have issues stylized border. fixed width graphics , fluid responsive design don't totally play together. you'll want create set of menu border graphics 2 breakpoints, 1 786px wide , , 1 looks 1200px wide. perhaps 1 burger menu well. if you're okay sacrificing of design, create horizontally repeating tile graphic or css3 gradient borders - otherwise you&

retrieve IP address of client in logstash -

i new elk stack , sending application log file logstash server via tcp input method using below command cat test.log | nc server port please let me know how can retrieve ip address of client machine field in logstash configuration file. did try adding host ip when sending message?

javascript regex partial replace -

i'm hoping replace /,\s*\]/g ] , /,\s*\}/g } . want write json preprocess removes tailing commas in json object or array. however, regex wrote matches comma , closing bracket braces or closing curly braces. how can remove comma optionally white spaces following comma, preserve closing bracket or curly braces? for example: { "a": 1, "b": [1,2,3,] , } is expected replaced be: { "a": 1, "b": [1,2,3] } and how removing/replacing leading commas, for example: { ,"a": 1 , "b": [,1,2,3] } is expected replaced be: { "a": 1, "b": [1,2,3] } you can use look ahead like var regex = /,\s*(?=[\]}])/g; snippet.log('{a:b,}'.replace(regex, '')); snippet.log('{a:b, }, {a:b, }'.replace(regex, '')); snippet.log('[a:b,]'.replace(regex, '')); snippet.log('{a: [a:b, ], a: [a:b,], }'.replace(regex, ''))

java - Video tag Custom Controller issues on Mobile full screen -

i facing issues video tag custom controller on mobile full-screen. works fine when check on laptop in chrome , view on mobile view when check on real device, custom controller not showing on mobile full screen. you can see demo @ http://magicwallpost.com/demo.html . <main class="main" role="main"> <div class="custom-video" id="custom-video"> <!--the video--> <video id="myvideo" style="width:100%; height:100%;" preload="metadata"> <!-- <source src='test.mp4' type='video/mp4'> --> <source src='video.mp4' type='video/mp4'> <p>your browser not support html5 video element</p> </video> <!--controls--> <div id="mycontrols" data-config='{"nextbtn":"true","prevbtn":"true","loop":"true"}'

sql - CASE vs IF-ELSE-IF vs GOTO keyword -

i have rules in application , have written business logic of rules in procedure. @ time of creation of procedure came know case statement won't work in scenario. have tried 2 ways perform same operations (using if-else-if or goto ) shown below. method 1 using if-else-if conditions: declare @v_ruleid smallint; if (@v_ruleid = 1) begin /*my business logic*/ end else if (@v_ruleid = 2) begin /*my business logic*/ end else if (@v_ruleid = 3) begin /*my business logic*/ end /* ... ... ... ...*/ else if (@v_ruleid = 19) begin /*my business logic*/ end else if (@v_ruleid = 20) begin /*my business logic*/ end method 2 using goto statement: declare @v_ruleid smallint, @v_temp varchar(100); set @v_temp = 'goto rule' + convert(varchar, @v_ruleid); execute sp_executesql @v_temp; rule1: begin /*my business logic*/ end rule2: begin /*my business logic*/ end rule3: begin /*my business logic*/ end /* ... ... ... ...*/

add the export to file functionality in datatables -

how add export file functionality in datatables described here here basic fiddle 2 rows of test data https://jsfiddle.net/sxqeauaz/ am correct should add libraries js , css, , following piece of code $(document).ready(function() { $('#example').datatable( { dom: 'bfrtip', buttons: [ 'copy', 'csv', 'excel', 'pdf', 'print' ] } ); } ); i have done in below fiddle not work. https://jsfiddle.net/sxqeauaz/1/ can advise how csv, pdf, copy...etc buttons work? way describe above simple work. maybe reading of documentation not best. appreciate advise on matter.

How Does Chrome Browser Differentiate Between Flash Content vs. Ad Content? -

how chrome browser differentiate between flash content vs. ad content? i searched subject ever since google chrome started blocking flash. microsoft edge browser start blocking flash too. to add cool effect website across top of page incorporated small flash 1100 x 20 pixel effect using tiny sized flash .swf file hosted on same domain site. however, google chrome blocks being displayed. all come searching google chrome , microsoft edge browser blocking flash ads. why don't state blocking all flash content , not ads? how these browsers differentiate between flash content vs. ad content, or there no distinction between 2 , it's marketing statement? since said these browsers block flash ads, how can website tell browser flash on site not ad , therefore not blocked? i read following post , cannot find information support answers. mark flash content important chrome my .swf file resides in same domain , not in iframe. i don't want modify browser settin

android - GCM message not delivered to devices some time wifi and some time mobile data network -

hello have problem delivering gcm message. issue occur few devices , few devices work fine in same network. have 1 htc , kitkat devices has issue when connect in wifi if mobile data turn on gcm message delivered. second 1 lenovo lollipop phone has problem when mobile data turn on if connect wifi gcm messages receives. last 2 days unable find out issue. there no wifi port block issue because 4 devices work fine on same wifi network , individual mobile data network. search stackoverflow questions.

compilation - Java Environment Variables -

Image
so i'm setting compile java on windows 10 computer, , when went environment variables there no existing path, added one. when type "javac" in command prompt able recognize it, when try save java file (on notepad test) , try put in command prompt "is not recognized internal or external command, operable program or batch file." i've looked response refers environmental variables, can't figure out did wrong. path looks this: c:\program files\java\jdk1.8.0_77\bin. missing obvious? here need set 2 variables in " environment variables " executing java files. in image can see first variable(java_home) defining path of jdk in system , second variable defining path java executables(javac.exe, java.exe, javadoc.exe, , on) reside. problem solved....

customize file_field button ruby on rails -

i'm trying rid of ugly button rails has default file upload. want add glyphicon <%= f.file_field :image_url, class:"glyphicon glyphicon-camera" %> this didn't work , have tried other things in different post saw on page, don't attach file. as suggested here bootstrap filestyle , can use bootstrap's filestyle style file upload buttons. step-1: add layout application.html.erb i have added bootstrap filestyle library cdn. should make sure have both jquery , boostrap loaded. <script type="text/javascript" src="https://cdn.jsdelivr.net/bootstrap.filestyle/1.1.0/js/bootstrap-filestyle.min.js"> </script> step-2: add corresponding js file: $(":file").filestyle({input: false}); step-3: image_url file field follows: <%= f.file_field :image_url,class: "filestyle", "data-input" => false %>

Programming Homework: Rigging a deck of cards in C -

i have assignment i've been working on. supposed have deck of cards , distribute evenly 4 players. each card has own value (two = 1, three=2, ..., king=12, ace=13) , suit has own value (clubs = 1, diamonds = 2, hearts = 3, spades = 4) i'm supposed make dealer (player p) win 75% of time swapping out cards, or along lines. program wrote emulates cards having single array 0 51. program runs, command prompt says "press key continue ..." can please @ code , tell me if there's might causing this? in advance. #include "stdafx.h" #include <stdio.h> #include <stdlib.h> #include <time.h> #include <string.h> #include <algorithm> #define deck 52 #define cards 52 #define suits 4 #define faces 13 int deck[deck]; void distributecards(int i); void swap(int i, int j); void shuffle(unsigned int wdeck[][faces]); int main(void) { int deck[deck] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,

php - MySQL LOAD DATA INFILE does not insert rows -

i using mysql load data infile command. showing blank output , no insertion in mysql db. mysql_connect("localhost", "user", "pwd*")or die("cannot connect"); mysql_select_db("my_db")or die("cannot select db"); $sql="load data local infile 'users.csv' table usersystem fields terminated ',' enclosed '"' lines terminated '\r\n' ignore 1 lines (email,password,fname,lname)"; $result=mysql_query($sql); if($result){ echo "done" } else { echo "error"; } mysql_close(); why doesn't insert rows? try this: mysql_connect("localhost", "user", "pwd*") or die("cannot connect"); mysql_select_db("my_db") or die("cannot select db"); $sql = "load data local infile 'users.csv' table usersystem" . " fields terminated ',' enclos

how to combine codeigniter and angularjs? -

i've see lot posts codeigniter , angularjs work together,but of them retriving data , pass data .my question more basic. i run site through php,then every thing ok,means angularjs work properly.but when run through controller,it didn't work.what's wrong?here parts of codes: <body ng-app="myapp" ng-controller="myctrl"> first name: <input type="text" ng-model="firstname"><br> last name: <input type="text" ng-model="lastname"><br> <br> full name: {{firstname + " " + lastname}} class first extends ci_controller{ public function index(){ $this->load->view('first'); } } var app = angular.module('myapp', ['ngmaterial']); app.controller('myctrl', function($scope) { $scope.firstname = "john"; $scope.lastname = "doe"; }); my controller file first.php,view file first.php well.when br

Css. How to move div with fixed position up if it overlays footer -

Image
i have menu, content , footer. menu has fixed position. if scroll down end of page becomes overlay footer. how can force menu move if starts overlay footer? edit: use bootstrap classes. html <div class="container"> <div class="row"> <div class="col-sm-3" id="myscrollspy"> <ul class="nav nav-pills nav-stacked"> <li class="active"><a href="#section1">section 1</a></li> <li><a href="#section2">section 2</a></li> <li><a href="#section3">section 3</a></li> ... </ul> </div> <div class="col-sm-9"> <div id="section1"> <h1>section 1</h1> <p>try scroll section , @ navigation l

mime types - Cannot add inline attachment with actionmailer in rails 3 -

after bundle install no longer able add inline images attachments. error get: nomethoderror (undefined method `type_for' mime::types:class): app/mailers/welcome_mailer.rb:14:in `add_inline_attachment!' so type_for method being called on class instead of object. here how add inline attachment, follows guidelines actionmailer : attachments.inline['photo.png'] = file.read('path/to/photo.png') i have tested file indeed exists , gets read. issue appears gem-related. upgrade mime-types 3.1, released on 22 may 2016. mime-types 2.x has 6 more planned updates , reaches end of life in november 2017, after point no more support provided @ all.

Multiple file uploading using javascript, jquery plugins -

i'm developing website in have upload files server. there many file upload controls out there none of them has served purpose, want upload lets 1000 files want in chunks of 200 files server calls minimum. in above explained scenario 5 calls made server. have plupload , dropzone each of them make separate call server i.e. 10 files 10 server calls. there file upload control serves purpose or option in above mentioned controls can make use of? look fineuploader, , perhaps use amazon s3 server-side solution http://fineuploader.com/

PowerBI / DAX - Row wise division by measure -

i heavy user of r trying port basic calculations power bi unable dax perform vector/rowwise division. for example, dataset: category value a 1 a 2 b 3 c 4 i have created measure: value sum = sum(table[value]) , create third column: value share = value / value sum get: category value value share a 1 0.1 a 2 0.2 b 3 0.3 c 4 0.4 the equivalent in r table$value.share = table$value/value.sum. i have tried: value share = [value] / [value sum] ended 1s in value share rows. tried sumx , calculatetable functions believe missing fundamental. can help? sure! if you're starting out dax, can highly recommend view 1 of video lectures of alberto cairo / marco russo https://www.youtube.com/watch?v=klqazlr5vxa , because question (and of dax difficulty) contexts . as question, think you're looking =[value]/calculate(sum([value]); all(t

arrays - How to get union of 2 lists of dictionaries in Python -

i have 2 lists following data structure: array1: [{'student': {'name': 'abc'}, 'address': 'add_abc'}, {'student': {'name': 'xyz'}, 'address': 'add_xyz'}] array2: [{'student': {'name': 'abc'}, 'address': 'add_abc'}, {'student': {'name': 'rst'}, 'address': 'add_rst'}] i want have array3 union of above 2 lists array3: [{'student': {'name': 'abc'}, 'address': 'add_abc'}, {'student': {'name': 'rst'}, 'address': 'add_rst'}, {'student': {'name': 'xyz'}, 'address': 'add_xyz'}] how can in python? they lists , not arrays, here solution: a1 = [{'student': {'name': 'abc'}, 'address': 'add_abc'}, {'student': {'name':

ios - Custom scrollView when Scroll, move header view -

i have question, photo user profile view in apple document, not add uitableview uiscrollview, needs this..? have idea ? thank you i dont know swift custom library , conceptually think can floating header view. know 2 project in obectivec can bridge in swift project: dyfloatingheaderview ibscrollviewfloatingheader both project, after add custom header view in table, customize scroll delegate methods, , can override these methods personal pourpose.

frama-c __nonnull macro redefined warning -

when launch value plugin of frama-c, many times same warning : /users/philippeantoine/.opam/4.02.3/bin/frama-c -val myprog.c in file included /users/philippeantoine/.opam/4.02.3/share/frama-c/libc/stdint.h:27: /users/philippeantoine/.opam/4.02.3/share/frama-c/libc/features.h:63:9: warning: '__nonnull' macro redefined [-wmacro-redefined] #define __nonnull(args...) ^ <built-in>:286:9: note: previous definition here #define __nonnull _nonnull ^ 1 warning generated. /var/folders/rj/vl86bl2n6cgdjg7m7tszcvm40000gn/t/ppannot48d4bd.c:543:9: warning: '__nonnull' macro redefined [-wmacro-redefined] #define __nonnull(args...) ^ /var/folders/rj/vl86bl2n6cgdjg7m7tszcvm40000gn/t/ppannot48d4bd.c:286:9: note: previous definition here #define __nonnull _nonnull ^ 1 warning generated. has experience these before ? best way avoid these , see meaningful warnings ? i simple code : #include <stdlib.h> int main (){ char * test = malloc(10); te

regex - How do the curly braces work in this Ruby Split line -

this question has answer here: reference - regex mean? 1 answer i have been recommended following line of code use on text file: arr = str.split(/\n{2,}/).map { |s| s.split(/\n/) } am trying understand how the: (/\n{2,}/) part working , does. the leading , trailing / mark beginning , end of regular expression. \n match single newline. {2,} after symbol (in case \n ) match occurrence of symbol repeated 2 or more times, in case 2 or more consecutive newlines. had been \n{3,6} , match consecutive newlines repeated between 3 , 6 times.

c# - How to get exact hours and minutes from DbFunctions.DiffMinutes() -

i using linq query,it works fine. problem is returning hours in int i.e 10,9 etc want complete hours along minutes i.e 10:28,9:45 etc dayhours = (from ab in db.attendances ab.employee == 63 && ab.intime.value.year == 2015 && ab.intime.value.month == select new { day = ab.intime.value.day, hours = dbfunctions.diffminutes(ab.intime, ab.outtime) / 60 }); you can try this: /*...*/ select new { day = ab.intime.value.day, hours = dbfunctions.diffminutes(ab.intime, ab.outtime) / 60 minutes = dbfunctions.diffminutes(ab.intime, ab.outtime) % 60 }); if don't want on format, please specify how want store (a timespan variable? else?)

c# - Tasks on Framework 4.0: Put a timeout on the innermost task in a chain of continuations -

i looking task based way detect timeout task, without having wait() it. the timeout should put on innermost task in chain of continuations, while exception should caught @ outermost level. my solution, instead of blocking execution, returns task wraps original one, allowing user catch exception in case of time out. so came code: public static task<t> timeout<t>(task<t> basetask, int milliseconds) { var timer = delay(milliseconds); return task.factory.continuewhenany( new [] { basetask, timer.continuewith<t>(x => { throw new tasktimeoutexception(); }) }, x => x.result ); } the function delay() described in accepted solution @ how put task sleep (or delay) in c# 4.0? . i improve code, have few questions: can see possible pitfalls? should timeout cause cancellation of original task? thank you. edit based on comments developed slight improvement: public stati

ios - When will subviews being added to super view from storyboard? -

i create controller storyboard tableview in it. after compile , run it, tableview shown, when use self.view.subviews subviews in viewdidload method, can not find tableview. additionally, try performing method [self.tableview removefromsuperview] in viewdidload, tableview still shown @ last. it seems when viewdidload performed, tableview has not been added the super view yet. however, in controller created storyboard well, can tableview using self.view.subviews in viewdidload... i wondering lead , when tableview added. ignore comment, don't think calling super answer (although still practice). the documentation not clear thing appear able rely on in viewdidload view has loaded, not of subviews, have discovered may or may not be. if need access sub views guaranteed present @ viewdidlayoutsubviews described in this answer aware called whenever sub views layed out, multiple times in typical app lifespan (e.g. called when user rotates device). if need @ sub v

web sql - COUNT(*) in Web SQL is not working -

i using following code count of records in emp table, code follows : var mydb = initdb(); mydb.transaction(function(trans) { var query = "select count(*) c emp"; trans.executesql(query, [], function(trans, res) { var count = res.rows[0].c; console.log("--- after count ---"+count); }, errorhandler); }); query giving error : uncaught typeerror: cannot read property 'c' of undefined. how solve issue? appreciate help. html5.webdb.count=function() { var db = html5.webdb.db; db.transaction(function (tx) { tx.executesql('select count(*) c yourtable', [], function (tx, r) { console.log( r.rows.item(0).c); }, function (tx, e) { alert ("unknown: " + e.message); }); }); } i use in db, james

How to scan wifi networks in android programming? -

this question has answer here: android: scanning wifi network + selectable list 2 answers i want know how scan wifi networks in android programming. i'm beginner. public class wifidemo extends activity implements onclicklistener { wifimanager wifi; listview lv; textview textstatus; button buttonscan; int size = 0; list<scanresult> results; string item_key = "key"; arraylist<hashmap<string, string>> arraylist = new arraylist<hashmap<string, string>>(); simpleadapter adapter; /* called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); textstatus = (textview) findviewbyid(r.id.textstatus); buttonscan = (button)

Xgboost node splits on a value that out of feature range? -

i have features range 0 1. when dump model, find nodes split features using "feature < 2.00001". xgboost scale feature or add value feature? or why 2.00001 chosen split? thanks~ xgboost has separate splits based on values of feature , whether or not feature missing. this when xgboost wants split on whether or not feature missing, , not based on value.

coq - Why does this rewrite fail in the context of dependent types -

i'm trying hang on dependent types, continuously run problem following. in example i'm defining abstraction arrays, such every access guarded in array using dependent typing. i'm using coq 8.5, don't think essential in example. i'm using sflib , libtactics software foundations tutorial. latter found 1 work coq 8.5. add loadpath "/home/bryan/projects/coq/sf8.5". require import sflib. (* in download https://www.cis.upenn.edu/~bcpierce/sf/current/index.html *) require import libtactics. (* https://github.com/ddcsf/iron/blob/master/done/iron/tactics/libtactics.v *) require import omega. module array. next follows inductive , abstract definition of array. inductive array {e: type} (sz: nat) : type := | construct_array : forall f : nat -> option e, (forall i, >= sz <-> f = none) -> array sz . next couple of lemmas no doubt somehow available in standard library, couldn't find them except second, in classical logic p

Python show part of a browser? -

i'm in mist of building "application" , need display google map show markers of locations. thought may create web page google map. , display if possible in python gui (by api). is there gui api up? please take @ http://www.gnu.org/software/pythonwebkit/ need add <iframe> dom document tree def _view_load_finished_cb(self, view, frame): doc = frame.get_dom_document() nodes = doc.getelementsbytagname('body') body = nodes.item(0) d = doc.createelement("iframe") d.setattribute('width', 640) d.setattribute('height', 480) d.setattribute('src', 'https://www.google.com/maps/embed/v1/place?key=your_api_key&q=space+needle,seattle+wa') body.appendchild(d)

macvim - Why doesn't Vim execute my column setting in this command? -

Image
i have vim command enter "distraction free" mode: command! distractionfreemode set guioptions-=r gfn=cousine:h12 showtabline=0 fullscreen laststatus=0 noruler wrap linebreak nolist linespace=5 foldcolumn=3 nonumber columns=80 note using macvim. command sort of works, of settings don't seem triggered. these include columns=80 , nolist . have set these separately after executing command in order them right. have tried putting these settings in function called command , had same issue. source of problem? edit: here screenshot of i'm aiming at. using fullscreen , columns necessary achieve this, far know: according for fullscreen ( :h fullscreen ) there option tailor behavior of happens when enter fullscreen mode set fuoptions on macvim fuoptions set to fuoptions=maxvert,maxhotz when @ :h fuoptions maxvert when entering fullscreen, 'lines' set maximum number of lines fitting on screen in fullscreen mode. when

c++ - Shared data class using std::shared_ptr -

i need class implements shared data semantics, , std::shared_ptr place start. think typical implementation of such class use private shared_ptr shared data, , implement @ least copy constructor , operator= . something like: class shareddataclass { public: shareddataclass(const shareddataclass& other) { data_ = other.data_; }; shareddataclass& operator=(const shareddataclass& other) { data_ = other.data_; return *this; } private: std::shared_ptr<datatype> data_; }; i'd ask if has criticism offer on above implementation. there other member/operator should implemented consistency? there no need implement copy constructor or assignment operator in case. let compiler defines trivial default ones you, shared_ptr job expecting.

How to handle Java URL mappings that are too many to write by hand -

for example, have many city bus lines in database. , wrote page called citybus.jsp display city has bus line. must write url mappings many cities. see below: <servlet> <servlet-name>citybusservlet</servlet-name> <servlet-class>com.jiaotong.loginservlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>citybusservlet</servlet-name> <url-pattern>/chicago</url-pattern> </servlet-mapping> ------------------------------------------------------------------------- <servlet> <servlet-name>citybusservlet</servlet-name> <servlet-class>com.jiaotong.citybusservlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>citybusservlet</servlet-name> <url-pattern>/paris</url-pattern> </servlet-mapping> and on ... if write every cities mappings hand not beyond tether, write page havi

python - Robot Framework - Syntax best practices -

i'm asking myself: "what robot framework's way choose between using python syntax or robot framework syntax in keywords?" (and better in terms of performance/efficiency) so if have documentations on subject (other "do/don't slides official site or advices, i'm more interested. ps: sorry if it's not right place ask, don't know ask this. below examples of typical cases when don't know robot framework "best practice". examples: 1: (given ${string} string ) ${char}= evaluate $string[-2] vs @{chars}= split string characters ${string} ${char}= list ${chars} -2 2: (given &{arg} ) ${is_in}= evaluate 'some_key' in $arg vs ${is_in}= run keyword , return status dictionary should contain key ${arg} some_key 3: (given &{arg} ) ${value}= evaluate ('some_key' in $arg , $arg['some_key']) or "another value" vs ${is

javascript - One XHR Request at a time after completion of current request -

i working on program checks if user id exists sending user id post method processid.php using xhr request. first tried xhr requests in loop in array of ids killed browser consist of thousands of elements because thousands of xhr requests made @ time. found post on stackoverflow said should not using xhr request in loop instead should call function within funtion wrote following code. program seems work kills browser because still thousands of request made. i trying figure out week how make single xhr request @ time after completing current/in-process xhr request. help? solution can create on complete function this. ps: don't want use jquery. <?php $php_array_id = [element-1,element-2.........,element-n]; $js_array_id = json_encode($php_array); echo "var userids = ". $js_array_id . ";\n"; $url = "http://example.com/idprocess.php"; ?> <script> function processnext(i) { if (i < userids.length) { var http = new xm

arduino - RFid click board with CR95HF microcontroller refuses to respond -

i have arduino rfid click board mikro electronika. click board has microcontroller cr95hf microcontroller. according datasheet when send echo command should poll , read returned value 0x55. if use command idn (0x01) , send datalength of zero, should id of controller back. according serial monitor returns 0 (is there wrong variable?). according logic analyzer returns exact same thing send (when send 3, returns 3, when send 55, returns 55). seems microcontroller doesn't react send or , it's broken? so right looks able send through spi.transfer() function, retrieve seems problem. here's code: #include <spi.h> // cr95hf: write, poll, read, reset #define cmd 0x00 #define poll 0x03 #define read 0x02 #define reset 0x01 #define echo 0x55 const int _sspin = 10; // cs const int _irqpin = 6; // int_out : 2, int_in : 6, tried both, barely no difference //const int _si0pin = a3; //const int _si1pin =

oracle - Dynamic SQL - Check syntax and semantics -

with oracle dynamic sql 1 able execute string containing sql statement. e.g. l_stmt := 'select count(*) tab1'; execute immediate l_stmt; is possible not execute l_stmt check syntax , semantics correct programmitically? i think "solution" use dbms_sql.parse() . it not perfect best can get

xcode7 - iOS Distribution Certification Transfer -

my company has apple developer id, , have acquired distribution certification release ad hoc version app testing. however, owing leaving, need me transfer company developer id , certification other computers. export p12 file of distribution certification , ruined on other mac. on 1 computer, went well, while did not work on one. have tried download wrdca , run it, yet solution did not figure out problem. in addition, found on computer, there no certification of apple application integration certification authority. reason why p12 file did not work on mac? if not, how can solve problem? in short, carelessly ensure delete awdrca in keychain. if 1 else finds certification in situation of "this certificate signed unknown authority" awdrca installed in system, please check whether there other awdrca in "system" keychain category invalid or overtime. delete them either if there are. , other ca might valid well. in addition, certification of apple applic

always one item is selected/highlighted in treeview and listview c# winform -

in mdi child form, how can force 1 item selected/highlighted. when load form, want see first node of treeview highlighted, if navigate away ie use other child forms, should 1 item highlighted. also, same approach need done on listview thank you while setting hideselection property necessary highlight selected items when control not focused, not enough. situations when item (node) focused not selected valid , can achieved user (and item focused not selected marked when control active). however can use simple trick force focused item selected (and visible when control not active): private void listview_itemselectionchanged(object sender, listviewitemselectionchangedeventargs e) { if (e.item.focused) e.item.selected = true; } also not forget focus first item (node) of control after populating it, 1 item (node) highlighted.

java - Boolean 'if' statement does not work -

this code meant return congratulations when 2 arrays both in same order. have print both arrays test , become same order message 'congratulations'does not print. can please help?? boolean truefalse = arrays.equals(original, currentarr); if (truefalse == true){ system.out.println("congratulations"); var1 = var1 + var2; } arrays.equals(object[] a, object[] a2) compares members of arrays equals . therefore, 2d arrays, when members arrays themselves, compares references (since arrays don't override object 's equals ). use arrays.deepequals instead.

continuous integration - Too short history of builds in TFS -

Image
we have tfs 2015. 1 of our build has been red long time. want check first broke build history of build results short. click "more builds..." history becomes larger few items. amazing can not see whole history. don't know. doing wrong? there no way of checking whole history? below screenshot. this how ui works @ moment. expectation teams try fix build when breaks, not let broken days on end. you can query builds through tfx command line (if have installed) c:\>tfx build list --status failed --top 200 --project yourproject --definition-name yourbuilddefinition optionally pass --json easy parse output , filter through, example, powershell. once you've found build you're looking can request details using c:\>tfx build show --project myproject --build-id 1364 or open web page build, uri pretty predictable: https://{account}.visualstudio.com/defaultcollection /{project}/_build?_a=summary&buildid={buildid} as you

php - using group by and order by in mysql query correctly -

i'm trying latest certificate user has database. want see latest 1 , not others i'm using group , ordering unique id main table. without group works perfectly. see last certificate uploaded , others below. as add group see first certificate ever uploaded pointless years ago. my query quite large i'm drawing in lot of other information other tables. here query. select usercert.*, cert.*, certcat.certcatname, certtask.certtaskname , certstatus.certstatusname `usercert` inner join cert on cert.idcert = usercert.idcert inner join certcat on certcat.idcertcat = cert.idcertcat inner join certtask on certtask.idcerttask = usercert.idcerttask inner join certstatus on certstatus.idcertstatus = usercert.idcertstatus usercert.iduser=%s group usercert.idcert order

excel - Sorting characters instead of numeric values in Pivot Chart -

i want generate pivot chart pivot table. problem here pivot table not contain numeric values. there characters differentiate them. pivot chart sort based on characters "a" , "b".i try put characters in values column seem convert numeric values. know how sort characters instead of numeric values in pivot chart? don't have ideas. ! in general, excel charts require numbers chart anything. charts have category axis, can display text, , value axis, against numeric values plotted. in xy scatter chart, both axes numeric or value axes. without numbers, excel won't able plot chart. it not clear want chart like. edit question more details data , hand-drawn sketch of chart you'd expect create that. can edit answer accordingly.

PHP's getimagesize() throwing "SSL: The specified procedure could not be found" -

i'm getting following error message using php's getimagesize on small percentage (<5%) of image links tested... getimagesize(): ssl: specified procedure not found. here's example that's throwing error (on both local/mamp server , live version)... getimagesize("https://cdn.meme.am/instances/500x/65858681.jpg"); anyone have ideas how dig further? don't know go , couldn't find many similar questions. thanks! this code trick <?php function getimgsize($url, $referer = '') { $headers = array( 'range: bytes=0-32768' ); /* hint: extract referer url */ if (!empty($referer)) array_push($headers, 'referer: '.$referer); $curl = curl_init($url); curl_setopt($curl, curlopt_httpheader, $headers); curl_setopt($curl, curlopt_returntransfer, 1); $data = curl_exec($curl); curl_close($curl); $image = imagecreatefromstring($data);

sql server - How to add new connection provider to Visual Studio? -

Image
i'm using visual studio 2010 development in business intelligence (bi). in window connection manager , there're 9 native providers : microsoft jet 4.0 ole db provider microsoft ole db provider analysis services 11.0 micorsoft ole db provider oracle ... the provider needed microsoft office 12.0 access database engine ole db provider (microsoft.ace.oledb.12.0), not included in list. however, provider exist in computer : i've used in excel 2016, microsoft access connection provider. so how can "link" / "add" provider vs2010 , make recognized ? this happening because may have installed 64-bit version of microsoft access database engine 2010 redistributable . visual studio / bids 32-bit application , , hence cannot "see" of 64-bit providers , including microsoft office 12.0 access database engine ole db provider installed. to fix this, uninstall 64-bit redistributable installed. download , install 32-bit redistri

I want to work on Android Studio but with no internet connection.Is that possible? -

Image
i tried error of junit. have remove junit test compile build.gradle let me make more clear . want run project offline fully.i have latest android studio 2.0 , sdk updated want make projects offline. don't have net access. want work offline , make projects offfline.no net connect once @ start also. at first time must connect internet updating gradle , sdk . after can choose offline mode. gradle in offline mode, means won't go network resolve dependencies. go preferences > gradle , uncheck " offline work ".

How can i send an image from php to android, using volley and Json -

im trying load image need load server, have 3 questions: i don't know how can convert images in bitmaps (this in server side) how convert bitmap in image (this in android side). how can send bitmap volley request. i using volley make request. server method have this: function getimage($image_path){ $base ='images/practices/'.$image_path; $binary=base64_encode($base); $resp['image_binary']= $binary; print_r(json_encode($resp)); } the method using other requests is: string url = "---------"; jsonobjectrequest request = new jsonobjectrequest(request.method.post, url, null, new response.listener<jsonobject>() { @override public void onresponse(jsonobject response) { try { //here processing of response... } catch (jsonexception e) { e.printstacktrace();

how to resolve git conflict file -

<<<<<<< head asd ||||||| merged common ancestors =======g test >>>>>>> b0acaed6842e69ac407029e0f580b54b64258980 <<<<<<< head test312 ||||||| merged common ancestors ======= asdfdfsfdsafdadfasd >>>>>>> 6d92ab6b31d03c5c13803eca25762b4fb273a0c5 a sample scenario of git conflict. how clean or fix <<<<<<< head , >>>>>>> 6d92ab6b31d03c5c13803eca25762b4fb273a0c5 on file. these output of diff3 (and not diff2 ). can control how want displayed using merge.conflictstyle . merge.conflictstyle specify style in conflicted hunks written out working tree files upon merge. the default merge , shows <<<<<<< conflict marker, changes made 1 side, ======= marker, changes made other side, , >>>>>>> marker. an alternate style, diff3 , adds ||||||| marker , original text before ======= marker. yo

php - Random get variabel showing up in url -

i have domain, let's call example.com. whenever go http://example.com/ i'm redirected http://example.com/?v=[insert random 12-digit alphanumeric string here] this causes great deal of trouble rewrite of url periodically gets me thrown out of wordpress admin (the variable there before wordpress installed though, assume not causing issue). i have checked through .htaccess , dns files domain, cant life of me figure out coming form. by point can point me in remotely right direction appreciated, purpose or if has ever seen before.

python - Memory leak using scipy.eigs -

i have set of large sparse matrices i'm trying find eigenvector corresponding eigenvalue 0 of. structure of underlying problem know solution must exist , 0 largest eigenvalue. to solve problem use scipy.sparse.linalg.eigs arguments: val, rho = eigs(l, k=1, = 'lm', v0=init, sigma=-0.001) where l matrix. call multiple times different matrices. @ first having severe problem memory usage increases call function more , more times. seems eigs doesn't free memory should. solved calling gc.collect() each time use eigs . but worry internally memory isn't being freed, naively expect using arnoldi shouldn't use more memory algorithm progresses, should storing matrix , current set of lanczos vectors, find memory usage increases while code still inside eigs function. any ideas?

python - How to map a static file path to a url in Flask? -

currently,i want write gallery system on flask! can upload image now,i can't show image !i have try use send_from_directory function,but it's return me response stream instance! class image(db.model): __tablename__ = 'images' id = db.column(db.integer, primary_key=true) url = db.column(db.string) timestamp = db.column(db.datetime, index=true,default=datetime.utcnow) author_id = db.column(db.integer, db.foreignkey('users.id')) def get_image(self): return send_from_directory(self.url, '') and view below: @gallery.route('/', methods=['get', 'post']) @gallery.route('/index', methods=['get', 'post']) def index(): page = request.args.get('page', 1, type=int) pagination = image.query.order_by(image.timestamp.desc()).paginate( page, per_page=current_app.config['landpack_posts_per_page'], error_out=false ) posts = pagination.items

html - Adjust div width to content with JS -

Image
this question has answer here: css when inline-block elements line-break, parent wrapper not fit new width 1 answer setting display: inline-block should make surrounding div not larger content: how make div not larger contents? however, when line-breaks included not work ( jfiddle )): <style> .container{ border: solid; display: inline-block } .box{ background-color: #08c; width: 50px; height: 50px; margin: 20px; display: inline-block; } </style> <div class='container'> <div class='box'></div> <div class='box'></div> <div class='box'></div> <div class='box'></div> <div class='box'></div> <div class='box'></div> </div> it stated in css when inline-block elements line-break, parent wrapper not fi