Posts

node.js - POST to express.js with 'Access-Control-Allow-Origin' -

i'm newbie node , express. can data server app fail on post. i have client side on " http://myapp.com " , node app on " http://myapp.com:34627 ". this node app: var express = require('express'), app = express(); var result = {}; app.configure(function() { app.use(express.json()); app.use(express.urlencoded()); }); app.set("jsonp callback", true); app.get('/get/users/:userid/:username',function(req,res) { var userid = req.params.userid; var username = req.params.username; result = { response: 'ok', url_userid: userid, url_username: username }; res.header('access-control-allow-origin','http://listasapp.in'); res.json(200,result); }); app.post('/post/user',function(req,res) { console.log( req.body ); result = { response: 'ok' }; res.jsonp(200,result); }); var server = app.listen(34627,function() { ...

html - alignment of navigation menu within td of table and no border -

i wondering haved failed so, that, navmenu within table in promo box , centered @ top of white space , no border on top center box/td/cell great important. <html> <head> <style> * { margin: 0px; padding: 0px; border: 0px; } #container { width: 100%; height: 1000px; max-width: 1440px; min-width: 1024px; margin: 0px auto; text-align: center; } .bigbox { height: 1000px; background-image: url(images/photos/landscape-1440.jpg); background-position: 50% 50%; } .promobox { width: 25%; height: 1000px; float: left; background-position: 50% 0%; margin: 0px; padding: 0px; vertical-align: top; } .promobox div { height: 200px; border-color: #fff; border-style: none; } div { text-align: center; position: relative; } div { position: absolute; bottom: 10px; right: 10px; color: #fff; text-shadow: 1px 1px 1px #000; } #pb1 {width: 25%; backgro...

php - Javascript not working in AJAX response -

below code ajax response page. have added onclick event table row , written javascript code handle it. javascript code doesn't work.is wrong way of coding or there problem in code. suggest me simple solution <?php echo '<script type=\"text/javascript\"> function clicked(){ alert("i alert box!"); } </script>'; $q = $_get['q']; include 'db_connect.php'; $sql="select name,address,mobile,email,pan,tan client name = '$q'"; $sql_bill="select clientname,financialyear,receiptno,amount,ddate,type,chequeno,category billing clientname = '$q'"; $sql_total="select sum(amount) totalamount billing"; $result = mysql_query($sql); $result_bill = mysql_query($sql_bill); $result_total = mysql_query($sql_total); $total= mysql_fetch_array($result_total); echo "<h4><b>client details</b></h4><table align='center' border='2'> ...

symfony - Symfony2 - Need help on the following error when querying for tags -

having following error in doctrine query when trying find specific tag selected user. [semantical error] line 0, col 78 near 'tag blog.tags': error: class acme\demobundle\entity\blog has no association named tags can tell what's wrong query? (trying query tag selected in side bar brings posts related tag) repository public function getpostsbytags($tags) { $qb = $this->createquerybuilder('b'); $qb->select('b') ->join('b.tags', 'tag') ->where('b.tags ?', '%'.$tags.'%'); return $qb->getquery()->getresult(); } blog entity /** * @var string * * @orm\column(name="tags", type="text") */ private $tags; /** * set tags * * @param string $tags * @return blog */ public function settags($tags) { $this->tags = $tags; return $this; } /** * tags * * @return string */ public function gettags() { return $this->tags; } ...

Can jackson parser Object from json if I add or delete some field? -

in work, want use jackson in situation: { "student": { "name" : "hello", "id" : "stu_001" } } then, define class student: class student { public string name; public string id; //get , set methods } but, in case, json be: { "student": { "name" : "hello", "id" : "stu_001", "age" : "23" } } or: { "student": { "name" : "hello" } } all in all, want use jackson parser students data, when json add or delete filed, how can solve jackson? thank you~ oops! i search google, , find answer! use following code: ```objectmapper.configure(org.codehaus.jackson.map.deserializationconfig.feature.fail_on_unknown_properties, false);``` when add field original don't have, ignore field.when delete field, assign field "null".

android - Align author text on last line of quote if there's room, otherwise put it on new line -

Image
above example of output want. notice "by john" aligned right on last line of quote. if there's not enough space, author appear on new line, still right aligned. you have take 2 different textviews in case , give gravity="right" second one

java - MySQL - Hibernate does not create foreign key constraint -

i am, moving application derby mysql, , facing problem hibernate doesn't create foreign key constraints while creating tables. me mappings seems correct working fine derby. i using mysql server 5.6, , mysql5innodbdialect. verified in mysql workbench using show create table command table being created using innodb engine. mysql connector used - mysql-connector-java - 5.1.6 logs: 2014-04-21 12:38:29,820 error org.hibernate.tool.hbm2ddl.schemaexport - unsuccessful: alter table dependency_track add constraint fk25e3373737e62d9a foreign key (tool_id) references tool_master 2014-04-21 12:38:29,820 error org.hibernate.tool.hbm2ddl.schemaexport - cannot add foreign key constraint 2014-04-21 12:38:30,127 error org.hibernate.tool.hbm2ddl.schemaexport - unsuccessful: alter table dept_role add constraint fk7e895e3080d96d8 foreign key (department_id) references department 2014-04-21 12:38:30,128 error org.hibernate.tool.hbm2ddl.schemaexport - cannot add foreign key constraint pers...