Posts

sql - "subquery returns more than 1 row" error. -

i new web programming , i'm trying make twitter-clone. @ point, have 3 tables: users (id, name) id auto-generated id name of user tweets (id, content, user_id) id auto-generated id content text of tweet user_id id of user made post followers (id, user_id, following_id) id auto-generated id user_id user doing following following_id user being followed so, being new sql well, trying build sql statement return tweets currently-logged in user , of follows. i tried use statement, works sometimes, other times, error says "subquery returns more 1 row". here statement: select * tweets user_id in ((select following_id followers user_id = 1),1) order date desc i put 1 example here, id of logged-in user. i haven't had luck statement; appreciated! thank you. select * tweets user_id in (select following_id followers user_id = 1) or user_id = 1 order date desc

designing android ui in java instead of xml? -

anyone know guides this? there seems nothing out there. best i've found this isn't comprehensive. also, i'm new android development. know there resources api out there i'm looking more of guide, , doing ui in java seemed more appealing xml. the lack of guides in matter simple: android ui designed around xml layouts. building ui xml far more superior building programmatically (please refer comment post of reasons). adding , tweaking ui components in code common should not replace rather supplement xml-based ui. may consider defining reusable components in xml , use activity#getlayoutinflater "inflate" these snippets. example that's how items in list build. , of course nothing stops building layouts , components entirely within code. practice there create these once in activity#oncreate , reuse throughout rest of code

sql - alter table with space in name -

i have table space in name generated system. i trying alter table name remove space can processed library pre-exists. i trying: alter table 'my table' rename 'mytable'; i have tried double quotes, no luck. any pointers? [ this not work in ms-access. tables cannot renamed in access. not clear if original question applied ms access.] square brackets: alter table [my table] rename [mytable]; square brackets can't enclose entire object "path" won't work: alter table [mydatabase.dbo.my table] but will alter table [mydatabase].[dbo].[my table]

mysql - Join two tables (with a 1-M relationship) where the second table needs to be 'flattened' into one row -

given following tables: student +----+-------+ | id | name | +----+-------+ | 1 | chris | | 2 | joe | | 3 | jack | +----+-------+ enrollment +---------------+------------+-----------+----------+ | enrollment_id | student_id | course_id | complete | +---------------+------------+-----------+----------+ | 1 | 1 | 55 | true | | 2 | 1 | 66 | true | | 3 | 1 | 77 | true | | 4 | 2 | 55 | true | | 5 | 2 | 66 | false | | 6 | 3 | 55 | false | | 7 | 3 | 66 | true | +---------------+------------+-----------+----------+ i following +----+-------+-----------+-----------+-----------+ | id | name | course 55 | course 66 | course 77 | +----+-------+-----------+-----------+-----------+ | 1 | chris | true | true | true | | 2 | joe | true |...

php date/mktime returning strange result -

i got array contains date displayed article archives , looks this: <?php // code: echo '<pre>'; print_r($date_result); echo '</pre>'; ?> // output: array ( [0] => 2008 [1] => 03 [2] => 11 ) then try build result output title archive page: $name = date( 'l', mktime( 0, 0, 0, $date[1], $date[2], $date[0] ) ); // works but when try make same month & years 1 month/year before given date: // month $name = date( 'm', mktime( 0, 0, 0, $date[1], 0, 0, 0 ) ); // input: eg. (int) 03 - output 'february' // year $name = date( 'y', mktime( 0, 0, 0, 0, 0, $date[0] ) ); // input: eg. (int) 2008 - output '2007' i can't around it. doing wrong month & year dates? thanks! from php.net: example #3 last day of next month the last day of given month can expressed "0" day of next month, not -1 day. so 0 entered day or month giving previous month...

How do I use the CakePHP Configure class? -

i trying use configure class in cakephp, i'm not sure if using correctly. have read through cook book , api, can't seem want. i have created configuration file: app/config/config.php . can directly edit file , set variables in there , access them using configure::read() . is possible update values of configuration file application itself, i.e., controller? have tried using configure::write() , not seem change value. app/config/config.php isn't file that's automatically loaded cake. either move these variables app/config/bootstrap.php or tell bootstrap.php file load custom file. put variables in app/config/core.php , i'd recommend against that. tend leaving file alone , adding/overwriting values in bootstrap.php .

algorithm - Find the minimize maximum weights in weighted graph using dynamic programming -

i'm looking algorithm finds path 2 vertices s t , in graph has k edges if paths exist. and if multiple paths found, 1 minimum maximum weights of single edge preferred. (not overall weights). eg: k = 5 path 1: s - - b - c - d - t weights 1 - 1 - 1 - 10 - 1 the maximum weight of path 1 10 path 2: s - x - y - z - w - t weights 7 - 9 - 8 - 6 - 7 the maximum weight of path 2 9, preferred. how solve problem? you use modified version of floyd-warshal algorithm iterates k steps , forces path lengths (by removing min part)