Posts

How to insert data using spring mvc and angularJS -

i want insert data database using angularjs , spring mvc, according tutorial did failed insert data database. controller : @requestmapping(value = "/add", method = requestmethod.post) public @responsebody string addemployee(@modelattribute(value="employee")employeeentity employee, bindingresult result) { employeemanager.addemployee(employee); return "redirect:/"; } jscode : $scope.insertdata = function(){ $http.post("http://localhost:9090/crudoperations/add", {"firstname":$scope.firstname}) .success(function(data,status,header,config) { console.log("inserted"); }); } jsp: <form:form class="form-horizontal" role="form" method="post" commandname="employee"> <div class="form-group col-lg-7" > <label for="email" class="control-label">first name...

javascript - Hexadecimal colors do not work on target style backgroundColor -

i posted previous question , responded code: html: <table class="bingo"> <tr> <td id="square0"></td> <td id="square1"></td> <td id="square2"></td> </tr> <tr> <td id="square3"></td> <td id="square4"></td> <td id="square5"></td> </tr> <tr> <td id="square6"></td> <td id="square7"></td> <td id="square8"></td> </tr> </table> js: var togglehighlight = function (e) { var bg = e.target.style.backgroundcolor; if (bg == 'red') { e.target.style.backgroundcolor = ''; } else { e.target.style.backgroundcolor = 'red'; } } var preparetable = function () { var cells = d...

regex - regular expression for a serial number -

i have long payload , need return serial number has many serial numbers , want return serial number after tag. here payload: usb: usb 2.0 superspeed bus: host controller location: building internal card reader: product id: 0x8406 serial number: 000000000820 //i dont want building: yes usb 2.0 bus: pci id: 0x8c31 iphone: vendor id: 0x05ac (skyway inc.) version: 7.02 serial number: wea0aa752ada7722ac92575e98z2e89c691f4282 //i want speed: 492 mb/sec rec id: 0x11100000 / 1 skyway internal keyboard / trackpad: product id: 0x0162 recog id: 0x05ac (skyway inc.) location id: 0x14c00000 / 3 current available (ma): 500 built-in: yes how can build regular expression return me following: wea0aa752ada7722ac92575e98z2e89c691f4282 i tried doing following return expressions start serial number: serial number: [0-9] i want serial number shows after iphone title. \\biphon...

parsing - How do I replace a string between a set of delimiter strings including the second delimiter with sed? -

how replace string between set of delimiter strings sed? first delimiter string not replaced while; second delimiter single char needs replaced part of replacement. i.e. first_delem="getval(" second_delem=”,” example string: abc = param.getval((m_astringtoreplace, xml_somedata, stringparameter(l"")); the string replace or remove = (m_astringtoreplace, this following sed command parse out string, not replace it. sed -e 's/.*getval(\(.*\),.*/\1/' how use sed replace string using these complex delimiters ? with input: $ cat file abc = param.getval((m_astringtoreplace, xml_somedata, stringparameter(l"")); this performs replacement of string starts following getval( , ends first comma: $ sed -re 's/(getval[(])[^,]*,/\1replacement/' file abc = param.getval(replacement xml_somedata, stringparameter(l"")); the regex (getval[(]) captures first delimiter group 1. [^,]*, matches follows , including firs...

How to dynamically split a string using JavaScript/jQuery after so many occurences of a character -

i'm looking way split string in javascript dynamically , keep contents after many occurrences of particular character. i've tried searching on solve this, though not had success. here's example of format i'll using: var s = "17:44, 22 july 2015 foo connected chat address 127.0.0.1"; in above example, want rest of contents of line after 2015, though @ same time don't want use 2015 or of start of string hardcoded way split because users can call that, mess way of splitting, have go years too. in nutshell want split string after 4th space dynamically, , keep whatever after without splitting rest too. do matching instead of splitting. > var s = "17:44, 22 july 2015 foo connected chat address 127.0.0.1"; > s.match(/^((?:\s+\s+){3}\s+)\s+(.+)/) [ '17:44, 22 july 2015 foo connected chat address 127.0.0.1', '17:44, 22 july 2015', 'foo connected chat address 127.0.0.1', index: 0, input: '17:44...

ruby - Rails - multiple association unknown attribute -

i'm making api in rails, , has model called match has 2 association user model defined as belongs_to :user_a, class_name: 'user', foreign_key: 'user_a' belongs_to :user_b, class_name: 'user', foreign_key: 'user_b' in user model: has_many :matches in match controller spec, i'm doing following: before(:each) user = factorygirl.create :user api_authorization_header user.auth_token @match_attribs = factorygirl.attributes_for :match post :create, { match: @match_attribs } end and tests fails "unknown attribute: user_id" if make change post: post :create, { user_a: user.id, user_b: user.id, match: @match_attribs } then still giving me unknown attribute. edit: scheme matches: create_table "matches", force: true |t| t.integer "user_a" t.integer "user_b" t.datetime "created_at" t.datetime "updated_at" end add_index "matches", ...

java - How to move particles independently from particle emitter in andengine -

i have working particle emitter attached entit. have when drag (move) entity emitter created partcles move well. emitter creates particles should move upwards, when idrag emitter right particles moved right well. understand because of attachment entity. achieve when particle shows independent emitter, can drag emitter , particle stays on original course. thanks. try attaching particle system scene , updating position (or emitter position) when sprite moves (in onmanagedupdate function). you can try adding own iparticlemodifier , override onupdateparticle calculate proper position during update , set velocity/acceleration each particle. (see andengine cookbook)