Posts

Showing posts from July, 2012

ruby on rails 4 - merge ActiveRecord::Relation with ActiveRecord::Associations -

i have 2 models class user < activerecord::base has_many :games def created_games game.where(created_by: self.id) end end class game < activerecord::base belongs_to :user end u = user.take joined_games = u.games created_games = u.created_games the variable joined_games instance of activerecord::associations, , created_games instance of activerecord::relation. is there way can join joined_games , created_games together? try adding scope in user model scope :joined_games, where(user_id: self.id, created_by: self.id)

algorithm - Function of this graph pseudocode -

Image
procedure explore(g; v) input: g = (v;e) graph; v 2 v output: visited(u) set true nodes u reachable v visited(v) = true previsit(v) each edge (v; u) 2 e: if not visited(u): explore(u) postvisit(v) all pseudocode find 1 path right? nothing while backtracking if i'm not wrong? it explores graph (it doesn't return path) - that's reachable starting vertex explored , have corresponding value in visited set (not vertices corresponding 1 of paths). it moves on next edge while backtracking ... , postvisit . so if we're @ a , has edges b , c , d , we'll start going b , then, when return a , we'll go c (if hasn't been visited already), , go d after return a 2nd time. it's called depth-first search , in case wondering. wikipedia gives example of order in vertices explored in tree: (the numbers correspond visit order, start @ 1 ) in above, you're not exploring vertices going down left ( 1 - 4 ), after 4 go 3 visit 5 , 2 visit 6

cloudcontrol - Unable to run cloudctrl bash from windows - Permission Denied(public key) -

when run following command on windows 8.1 machine: cctrlapp app_name/deploy_name run bash i error: permission denied(public key) how can alternatively access cloudcontrol bash in windows? to use run-command, have provide public-key , ssh client on local machine needs able find , access private-key. first check if have public-key in cloudcontrol account using: $ cctrluser key then check if key matches local id_rsa.pub file: $ cctrluser key [key_id] if have uploaded correct key , it's available on local system, ssh client might not able find it. on windows recommend running cctrlapp inside git bash , not directly in windows command prompt. makes sure works(tm).

c - Best way to switch do..while loops in a function? -

this c language only, still learning... say have sort of function code here containing 2 do..while loops: int loops() { //execute loop first never again (instead, use second loop) { /*do something*/ } while(condition); { /*do something*/ } while(condition); return; } what's best method run first do..while loop @ first run , , when come function, run second do..while loop? you can use function parametre : int loops (int loopnumber) {...} or have 2 different functions . if want use same function, way i'ld declare static variable check if function has been called previously: int loops() { static int var = 0; int returnval = 0; if (!var) { //execute loop first never again (instead, use second loop) { /*do something*/ } while(condition); var = 1; } else { { /*do something*/ } while(condition); } return

python - Plotting vector fields with two different methods (quiver / streamplot) resulting in plots that don't match - Matplotlib -

Image
i'm trying plot vector flows in python, using matplotlib , i'm having trouble... i'm trying compare 2 methods, quiver , streamplot() . i've read both documentations, wasn't able same results both. i'm plotting vectors these 2 methods: import matplotlib.pyplot plt import numpy def plot_quiver(x_dim, y_dim, steps, vector_field_x, vector_field_y, file_path): plt.figure() x, y = numpy.mgrid[-x_dim/2:x_dim/2:steps*1j, -y_dim/2:y_dim/2:steps*1j] plt.quiver(x, y, vector_field_x, vector_field_y) plt.savefig(file_path + '.png') plt.close() def plot_streamlines(file_path, x_dim, y_dim, steps, vector_field_x, vector_field_y, scalar_field=none): plt.figure() y, x = numpy.mgrid[-x_dim/2:x_dim/2:steps*1j, -y_dim/2:y_dim/2:steps*1j] plt.figure() if scalar_field not none: cs = plt.contour(x, y, scalar_field, extent=[-x_dim/2.0, x_dim/2.0, -y_dim/2.0, y_dim/2.0]) plt.clabel(cs, inline=1, fontsize=10

c# - Xamarin DialogViewController not disposed when Root is set -

i'm having weird problem. i'm using subclasses of dialogviewcontroller multi-page interview. each page presents number of fields can edited, , hitting save in upper right pushes next page onto navigationcontroller. seemed working fine, became apparent backing out , repeating interview leaks memory. created simple test case cleans button event navigation item. in example, dispose called when second controller popped, if don't set root other null (i.e. works expected if comment root = ... line). here's code. please tell me i'm missing stupid. public class testviewcontroller : dialogviewcontroller { int mpage; public testviewcontroller (int page) : base (null, true) { mpage = page; root = new rootelement ("testing") { new section () { new stringelement ("page: " + mpage) } }; } public override void viewdidload () { base.viewdidload (); navigationitem.rightbarbuttonitem = new uibarbuttonitem (

javascript - socket.io doesn't seem to be starting and doesn't recognize io.configure method -

i trying socket.io running node/express (i have done countless times - pretty baffled). when try configure socket.io io.configure method error: io.configure(function() { ^ typeerror: object #<server> has no method 'configure' @ object.<anonymous> (/home/yz/webdev/ground/app.js:377:4) @ module._compile (module.js:456:26) @ object.module._extensions..js (module.js:474:10) @ module.load (module.js:356:32) @ function.module._load (module.js:312:12) @ function.module.runmain (module.js:497:10) @ startup (node.js:119:16) @ node.js:902:3 my code how says on socket.io - i'll post in case: var express = require('express'); var app = express(); var server = require('http').createserver(app); var io = require('socket.io').listen(server); server.listen(8000); //other declarations app.use(... passport.use(... //some routes app.get(... app.post(... io.configure(function() { io.set('transports'

java - Why does isSiteLocalAddress() behave differently on the same model device running the same Android version? -

i have 2 samsung galaxy siis on same network running same version of android (4.0.4). when method called ... private string getipaddress() { string ip = "something's wrong, of course!"; try { enumeration<networkinterface> networkinterfaces = networkinterface.getnetworkinterfaces(); while ( networkinterfaces.hasmoreelements()) { networkinterface ni = networkinterfaces.nextelement(); enumeration<inetaddress>inetaddresses = ni.getinetaddresses(); while (inetaddresses.hasmoreelements()) { inetaddress address = inetaddresses.nextelement(); if (address.issitelocaladdress()) { ip = address.gethostaddress(); } } } } catch (socketexception se) { se.printstacktrace(); ip = "some error occured; duck-dynasty!"; } return ip; } on 1 device return

javascript - IE11 jQuery html() does not function inside SVG element -

Image
works in chrome, etc. screenshot should explain situation. the svg's content has been changed in dom, 'dom explorer' reporting original rect still there (it's being shown). interestingly enough, safari 7 on os x exhibits same behavior. i faced same problem. a quick fix use jquery empty() instead of html(''); e.g., var svg = d3.selectall("svg"); svg.each(function() { // not work in ie $(this).html(''); $(this).empty(); });

MVC, Swing and exception in Java -

i'm developing game in java , i'm using mvc design pattern , swing gui. model, view , controller communicate between them observer/observable design pattern. in controller , in view must throw exception when player wants illegal action in game. example, if player wants buy in game has 0 coins, in view throw exception. there way show jdialog when exception throw show player can't action? can view catch exception of controller , of view? maybe misunderstood question don't why throw exception in view. doesn't make sense me. // model /////////////////// class player{ int coin count = 0 setcoincount(int number){ // } getcoincount() { // } } // controller /////////////////// class cont{ model m; view v; cont(model m, view v){ // code.. } int checkbalance(){ return m.getbalance(); // balance model // sends view } } // view /////////////////// class view{ cont c; // when player click buy button ..... butonclick event handle.. (){ c.check

javascript - Prevent appcache cache current page -

i trying use appcache cache of webpage resources files (js, css) speed webpage loading. however, problem appcache cache current webpage. brings problem viewed webpage not date. how can prevent appcache caching current page, resources listed in manifest? my manifest sample: cache manifest # version 1 cache: # list of resources file (js/ css) path network: * http://* https://* what can have conditional logic on manifest-attribute in html-tag, don't set manifest page don't want cached. used login screens etc. e.g.: <html <?php if(!dontcachethispage) echo 'manifest="yourmanifest.appcache"'; ?> >

jquery - How to prevent custom dialog from closing in kendo-angularjs-scheduler control? -

how can prevent custom dialog closing in scheduler control in kendo ui? i have created 1 demo project kendo-angular , configured kendo`s scheduler control in that. i have create 1 custom kendo template popup`s while double clicking on calendar date. want validate response when save values of template, if error comes server want display error on template , not want close dialog. add: cancel: function(e){ e.preventdefault() } to scheduler config

android - Add Ant Library Project into my Gradle project -

i have gradle android project, includes ant library project: https://github.com/pakerfeldt/android-viewflow . how can include ant library project in build.gradle file? tried added "ant.importbuild 'lib/viewflow/build.xml'" didn't work. is there missing or mistake here? thanks this similar question android-studio-library-not-recognizing-the-android-api . in viewflow directory you'll need create build.gradle file following content: buildscript { repositories { mavencentral() } dependencies { classpath 'com.android.tools.build:gradle:0.10.+' } } apply plugin: 'android-library' android { sourcesets { main { manifest.srcfile 'androidmanifest.xml' java.srcdirs = ['src'] res.srcdirs = ['res'] } } compilesdkversion 19 buildtoolsversion "19.0.3" lintoptions { abortonerror false

can get value of hashMap with [] in jsf? -

in jsf file hava: <f:facet > #{main.res['core_common_label_actions'] </f:facet> and in bean hava public map<string, string> getres() { return resourcebean.getresourcesmap(currentlocale); } that main.res['core_common_lable_action'] refer getres() , invok it. what []?can value of hashmap [] insteadof get()? yes. can map value []. try this: private map<string, object> objects = new hashmap<string, object>(); public void add(string key, object value) { objects.put(key, value); } public map<string, object> getobjectsmap() { return objects; } for example have entry : add("hi" , "test"); then can value this: #{yourbean.objectsmap['hi']} it work;

java - One-Jar FileNotFoundException -

i have une java application, , use in opencv(opencv_java259.jar). work correcly in eclipse. pack application in executable .jar file, use one-jar (command line approch) don't work correctly , have errors: c:\users\user\desktop\tool> jar -cvfm ../one-jar.jar boot-manifest.mf .java.io.filenotfoundexception: boot-manifest.mf @ java.io.fileinputstream.open(native method) @ java.io.fileinputstream.<init>(fileinputstream.java:138) @ java.io.fileinputstream.<init>(fileinputstream.java:97) @ sun.tools.jar.main.run(main.java:171) @ sun.tools.jar.main.main(main.java:1177) i have done these steps : i have create eclipse runnable .jar file : right clik on project-->export--->runnable jar file i create working directory "tool" contains directories main , lib copy main application jar file (create on step 1) root/main (named myapplication.jar) , library dependencies root/lib (the opencv_java259.jar) i have unjar one-jar-boot-0.97

android - Setup the bottom of the page AdMob banner -

i'm trying setup admob banner on bottom of page, ad not show. space appears bottom of page there, admob not show there. add , reference google play services library. - yes add meta-data tag in androidmanifest.xml. - yes declare com.google.android.gms.ads.adactivity in manifest. - yes set network permissions in manifest. - yes somebody tell me why. thank you. my xml <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > <linearlayout android:id="@+id/flcontainer" <!-- data layout --> android:layout_width="match_parent" android:layout_height="match_parent" android:layout_above="@+id/ad_layout" android:orientation="vertical" /> <linearlayo

C Returning an array from a function -

and having trouble grasping arrays in c , how return them via function. if int main() { int num_set[10]={0,1}; //initialize first 2 elements 0,1 , rest 0 int* p=num_set; //assign array int pointer called p printf("\n%i",&num_set); //outputs 2686660 on machine printf("\n%i",&num_set[0]); //also outputs 2686660 printf("\n%i",p); //also outputs 2686660 printf("\n%i",p[1]);* //outputs 0; same num_set[1] } it works expected, when try return array through function following int multiply_by_2(int given_number) { int num_set[10]; for(int fun_counter=0; fun_counter<10; fun_counter++) { num_set[fun_counter] = (given_number*2) ; } return num_set; //return int array num_set caller } int main() { int* p = multiply_by_2(300) //assign array returned function p for(int main_counter=0; main_counter>10; main_counter++) {

javascript - KnockoutJS showing a sorted list by item category -

i started learning knockout week , has gone except 1 issue. i have list of items sort multiple ways 1 of ways want sort needs have different display standard list. example lets have code var betterlistmodel = function () { var self = this; food = [ { "name":"apple", "quantity":"3", "category":"fruit", "cost":"$1", },{ "name":"ice cream", "quantity":"1", "category":"dairy", "cost":"$6", },{ "name":"pear", "quantity":"2", "category":"fruit", "cost":"$2", },{ "name":"beef", "quantity":"1", "category":"meat", "cost":"$3", },{ "name":"milk", "quantity":"5",

jquery - Convert JSON form error response into a html string -

seeing can't find solution problem might going wrong. i'm trying build form using ajax provide error response or successful response upon submitting form. able error response sent form, in json, looks bad. moment using simplified form 2 requirements: (1) name must john , (2) date must in future. here html: <!doctype html> <head> <title>ajax form</title> </head> <body> <form action="ajax/contact.php" method="post" class="ajax"> <div> <input type="text" name="name" placeholder="your name"> </div> <div> <input type="text" name="email" placeholder="your email"> </div> <div> <input type="text" placeholder="" class="textinput" name="departuredate" id="departing">

php - Sending email with mail() -

i'm making kind of email sender class , have problems: some email services russian mail.ru don't understand encoding of message , show utf-8 mail in windows-1251 charset. gmail ok that. all email services show text/html plain text. multipart messages broken well. also should note, i'm sending local server build on openserver using gmail smtp server. opinion problem in kind of mybullshitcode or in smth covers content-type header. theres code: class _email { protected $type; protected $to; protected $subject; protected $plain; protected $html; protected $charset; protected $headers = array( 'mime-version' => '1.0', // 'content-type' => '', // 'from' => '', // 'cc' => '', // 'bcc' => '', // 'reply-to' => '', // 'subject' => '',

python - How to compare directed graphs in Networkx? -

Image
i have 2 directed networkx graphs equal number of nodes , edges. how compare structure of these 2 different graphs in networkx? node names don't matter. tried use networkx digraph.order() , digraph.degree() etc. information graph structure parameters of graphs equal. and how compare structures of more 2 graphs , find graphs unique structure. there special function in networkx?

mysql - Premature end of script headers on Rails -

i'm trying deploy rails app linode under subdomain. have rails app running previously. have matched settings up, can't find why keeps throwing error: internal server error server encountered internal error or misconfiguration , unable complete request. please contact server administrator, [no address given] , inform them of time error occurred, , might have done may have caused error. more information error may available in server error log. with rails logs not capturing , apache log captures: premature end of script headers i'm using passenger apache. rail 4.1. , mysql.

java - Liquibase or Flyaway database migration alternative for Elasticsearch -

i pretty new es. have been trying search db migration tool long , not find one. wondering if point me right direction. i using elasticsearch primary datastore in project. version mapping , configuration changes / data import / data upgrades scripts run develop new modules in project. in past used database versioning tools flyaway or liquibase. are there frameworks / scripts or methods use es achieve similar ? does have experience doing hand using scripts , run migration scripts @ least upgrade scripts. thanks in advance! from point of view/need, es have huge limitations: despite having dynamic mapping, es not schemaless schema-intensive. mappings cant changed in case when change conflicting existing documents (practically, if of documents have not-null field new mapping affects, result in exception) documents in es immutable: once you've indexed one, can retrieve/delete in only. syntactic sugar around partial update, makes thread-safe delete + index (wit

When to use horizontal partitioning and when to use database sharding? -

i'm reading article on wikipedia: http://en.wikipedia.org/wiki/shard_(database_architecture) trying find major difference between these 2 techniques. here found: horizontal partitioning splits 1 or more tables row, within single instance of schema , database server. may offer advantage reducing index size (and search effort) provided there obvious, robust, implicit way identify in table particular row found, without first needing search index, e.g., classic example of 'customerseast' , 'customerswest' tables, zip code indicates found. sharding goes beyond this: partitions problematic table(s) in same way, across potentially multiple instances of schema. obvious advantage search load large partitioned table can split across multiple servers (logical or physical), not multiple indexes on same logical server. as understood, horizontal partitioning more applicable single instance (single node environment) whereas sharding used

java - Fill android app table from website table -

lets have table in android app, , have website table (text & hyperlinks) gets updated hourly. there simple way data website table android table thanks. you can http request website table , parse string, extracting text within <table></table> elements. perhaps following post may https://stackoverflow.com/a/14418351/2557554

javascript - Print a word in my code -

this question has answer here: how concatenate string variable? 5 answers i trying add 2 numbers in javascript , using below code given @ stack overflow website. i want print output of file result = . shows result without wordings before it. please let me know how display result result = $result$ <html> <body> <p>click button calculate x.</p> <button onclick="myfunction()">try it</button> <br/> <br/>enter first number: <input type="text" id="txt1" name="text1">enter second number: <input type="text" id="txt2" name="text2"> <p id="demo"></p> <script> function myfunction() { var y = document.getelementbyid("txt1").value; var z = document.get

php - mysql_real_escape_string() say Access denied for user 'drrifae'@'localhost' -

i userd mysql_real_escape_string(), ok on localhost (on computer run xampp) when upload linux server function (mysql_real_escape_string()) access denied user 'drrifae'@'localhost' this code: if($_post['message']!=""){ $email=$_post['email']; $name=$_post['name']; $message=mysql_real_escape_string($_post['message']); $ip=$ip = getenv('http_client_ip')?: getenv('http_x_forwarded_for')?: getenv('http_x_forwarded')?: getenv('http_forwarded_for')?: getenv('http_forwarded')?: getenv('remote_addr'); include('../include/connection.php'); $sql="insert `contact_feedback` (`type`, `ip`, `message`, `name`, `email`) values ('$type', '$ip', '$message', '$name', '$email'); "; $result=mysql_query($sql,$con) or die(mysql_query()); if($result){ echo $_session['message&

node.js - How to start expressjs(nodejs) as production mode -

Image
i want start express server in production mode. have tried running following command sudo node_env=production node server.js while sudo node server.js starts server in development mode out problem. first command starts server in production mode homepage opens blank black bar on top. have 2 request fail request url:http://localhost:3000/public/build/js/dist.min.js request method:get status code:404 not found\ request url:http://localhost:3000/public/build/css/dist.min.css request method:get status code:404 not found i indeed have requests getting success in development mode. couldnt figure out source these requests, while there no such files or request in development mode. working on boiler plate code of mean.io . //server/config/config.js 'use strict'; // utilize lo-dash utility library var _ = require('lodash'), fs = require('fs'); // load configurations // set node environment variable if not set before process.env.node_env = ~fs.read

How to replace existing value of ArrayList element in java -

i still quite new java programming , trying update existing value of array list using code public static void main(string[] args){ list<string> list = new arraylist<string>(); list.add( "zero" ); list.add( "one" ); list.add( "two" ); list.add( "three" ); list.add( 2, "new" ); // add @ 2nd index system.out.println(list);} i want print new instead of tow got [zero, one, new, two, three] result, still have "two". want print [zero, one, new, three] . how do this? thank you.. use set method replace old value new one. list.set( 2, "new" );

php - Cronjob linux server logging -

i have cronjobs running on linux server. these cronjobs executing php scripts. want log possible outputs these scripts have given. i want use output given command: wget -o /logs/logfile /pathofthefolder/script.php the problem command overwrites previous logfile, logfile contains output of last execution, kinda useless logging. i tried adding -a appending instead of overwriting, didn't work. i tried -a this: wget -a /logs/logfile http://example.com/script.php but didn't work, information of download in logfile such: -2014-05-27 21:41:01-- http://example.com/script.php resolving example.com (example.com)... [ip address of site] connecting example.com (example.com)|[ip address of site]|:80... connected. http request sent, awaiting response... 200 ok length: unspecified [text/html] saving to: `script.php.4' 0k so information of http request being stored in logfile, , output of every request saved in seperate file increasing numbers, script.php.1, scr

Wordpress - add_theme_support('post-thumbnails') how to add size into function? -

i want keep code lean, , i'am wondering best way write code. can include add_image_size function add_theme_support('post-thumbnails');, , how go it? i want add images_size attributes post-thumbnails function. if ( ! function_exists( 'rjk_setup' ) ) : function rjk_setup() { load_theme_textdomain( 'rjk', get_template_directory() . '/languages' ); add_theme_support( 'automatic-feed-links' ); add_theme_support('post-thumbnails'); register_nav_menus( array( 'primary' => __( 'primary menu', 'rjk' ), ) ); add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption' ) ); add_theme_support( 'post-formats', array( 'aside', 'image', 'video', 'quote', 'link' ) ); add_theme_support( 'custom-background', apply_filters( 'rjk_custom_background_args

batch file: list rar file in specific folder and write result into text file -

i have folder , contains rar files , subfolders. these subfolders contain rar file or subfolder (recursive structure). want write batch file list rar files in folder tree (full path). result written text file. example: specific folder: --quest --quest--1.rar --quest--2.rar --quest--sub--3.rar --quest--con--4.rar --quest--math--ams.doc and result after running batch file in result.txt: --\quest\1.rar --\quest\2.rar --\quest\sub\3.rar --\quest\con\4.rar try : @echo off set $root=your\root\path dir /s /b "%$root%"\*.rar>>result.txt

How you add the "div.span" replacement functionality to Visual Studio? -

softwares sublime text have nice feature can type instance div.span , press tab , replace < div class="span" > . it's nice feature don't know how called, know how add in visual studio? zen coding (emmet). there's plugin it.

Java Runtime not eligible for distribution -

Image
i getting weird error when trying run java program created jet control panel , jetpack 2. have tried run on different computers same result. in manual page on configuring jet runtime , there section system files shipped jetpackii, tells jet includes own copy of java runtime libraries. the error message telling java runtime packaged jet expired evaluation version. indicates version of jet evaluation version has expired. there several ways solve error: pay licensing fee get free license non-commercial use try install 90-day evaluation copy find way package software background info drive-by reader, excelsior jet user's guide : excelsior jet toolkit , complete runtime environment optimizing, deploying , running applications written in java programming language.

java - Can't get fragment to show, no view found for id -

i trying fragment show contains edittext , button. new using fragments, not sure error message when trying create fragment means. i have class extends fragment, edittext , button created. public class editnamefragment extends android.support.v4.app.fragment { edittext edittext; imagebutton button; public editnamefragment(){ } @override public void oncreate(bundle savedinstancestate){ super.oncreate(savedinstancestate); } @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view view = inflater.inflate(r.layout.edit_name_dialog, container, false); edittext = (edittext) view.findviewbyid(r.id.edittextdialog); button = (imagebutton) view.findviewbyid(r.id.submitnewitembuttondialog); button.setonclicklistener(new view.onclicklistener() { @override public void onclick(view view) {

r - grid.layout doesn't like respect and compound units -

Image
using unit.pmax default comparison of widths/heights in gtable proving harder i'd hoped; after several hours of head scratching i've narrowed down situation: library(grid) w <- list(unit(1,"null"), unit(1,"null")) class(w) <- c("unit.list", "unit") h <- unit(1, "in") gl1 <- grid.layout(1, 2, widths = w, heights = h, respect = true) grid.newpage() grid.show.layout(gl1) # fine w2 <- w w2[[1]] <- unit.pmax(unit(1,"null"), unit(1,"null")) gl2 <- grid.layout(1, 2, widths = w2, heights = h, respect = false) grid.newpage() grid.show.layout(gl2)# fine gl3 <- grid.layout(1, 2, widths = w2, heights = h, respect = true) grid.newpage() grid.show.layout(gl3) ## error in grid.call.graphics(l_setviewport, vp, true) : ## non-finite location and/or size viewport so combination of unit.pmax(unit(1,"null"), unit(1,"nu

ios - If I make an iPhone or iPad app for my custom hardware product do I need to send a sample product to Apple? -

communication based on low energy bluetooth , use custom profile. do need join mfi program? there link form fill out let apple know want send them hardware app evaluation? if need send sample how long process approval? have 1 time or want test hardware every app update make? would love info who's had experience process. appreciated. thank you.

symfony - DataTransformer for IvoryGoogleMapBundle autocomplete (array) to an Address Entity -

i added autocomplete field registrationformtype (fosuserbundle) using ivorygooglemapbundle. an user can have 1 address => onetoone relation i created datatransformer transform autocomplete field (array) address entity following symfony documentation seems missed :( i have following error: the required option "em" missing. sw/userbundle/entity/user.php class user extends baseuser { /** * @orm\onetoone(targetentity="sw\blogbundle\entity\address", cascade={"persist"}) * @orm\joincolumn(name="address_id", referencedcolumnname="id") */ private $address; /** * set address * * @param \sw\blogtbundle\entity\address $address * @return user */ public function setaddress(\sw\blogbundle\entity\address $address = null) { $this->address = $address; return $this; } /** * address * * @return \sw\blogbundle\e

php - Updating rows over 2 tables -

i having problems updating 2 tables related models. can 1 table edited on own. have checked around docs , here , cant find simple answer yet. what new row , not edited row. the docs because don't have id field isn't true. can fiddle around , try working prefer conventional way need use saveassociated ? method save on more 1 related table? the user table has id field , teacher table had user_id foreign key. now before posted checked saveall , updateall , other posts here. the 1 models user , teacher . user hasone teacher , teacher belongsto user . i not sure if saveall or updateall way go because doesn't talk edits in docs add new. http://book.cakephp.org/2.0/en/models/saving-your-data.html cakephp - updating multiple tables @ same time view code <?php echo $this->form->create('user'); echo $this->form->input('user.username'); //text echo $this->form->input('teacher.firstname'); /

php - How to get id from one page to other page? -

i using jquery mobiles 1.4.2 i have refer id 1 page other page. html <div data-role="page"> <div data-role="header"> hello</div> <div data-role="content"> <a href="#freeadd" id="ofrecer" data-role="button" data-mini="true">ofrezco en venta</a> <a href="#freeadd" id="ofrecer" class="aliq" data-role="button" data-mini="true">ofrezco en alquiler</a> <a id="busco" href="#freeadd" data-role="button" data-mini="true">buscar</a> </div> </div> <div data-role="page" id="freeadd"> <div data-role="header"> display id </div> </div> in next page want display heading depending on