Posts

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, ''))...