Posts

Is Mysql IF EXIST what should be used for this query? -

select social_members.* , social_mcouple.* m_id = '".$_session['userid'] . "' , c_id = '".$_session['userid'] . "' select fields social_members.* , if social_mcouple.c_id = $_session['userid'] select fields social_mcouple.* well. can done if exist , if how. thanks if undertand correctly, outer join better here. select social_members.* , social_mcouple.* social_members left outer join social_mcouple on social_members.m_id=social_mcouple.c_id m_id='".$_session['userid']."' this retrieve rows each member, , corresponding rows social_mcouple . if there no corresponding rows in social_mcouple table, social_mcouple.* rows in result null. depending upon exact needs, , relationship between 2 tables, may better running 2 queries, 1 retrieve matching rows social_members, , other retrieve rows social_mcouple. whether take outer join or 2 separate queries depend...

Correct Exceptions in C++ -

i learning how handle errors in c++ code. wrote example looks text file called file, , if not found throw exception. #include <iostream> #include <fstream> using namespace std; int main() { int array[90]; try { ifstream file; file.open("somefile.txt"); if(!file.good()) throw 56; } catch(int e) { cout<<"error number "<<e<<endl; } return 0; } now have 2 questions. first know if using exceptions correctly. second, (assuming first true) benefit using them vs if else statement? "correctly" value judgment, (unlike other classes) there's major benefit exceptions classes being monolithic hierarchy, i'd advise throwing derived std::exception , not int. second, it's open question whether incorrect file name sufficiently unexpected qualify reason throw exception @ all. as benefits vs. if/else statement: there couple. first, exceptions let segregate code deals errors, main idea , read...

php - Magento add a column to backend newsletter gridview -

in magento system, added columns subscriber_firstname , subscriber_lastname newsletter_subscriber db table. in admin area of magento, want newsletter>newsletter subscribers grid table show: customer first name if exists, otherwise show newsletter_subscriber.subscriber_firstname if exists, otherwise show nothing customer last name if exists, otherwise show newsletter_subscriber.subscriber_lastname if exists, otherwise show nothing which magento files need edit make work? how go editing files make work? app/code/core/mage/adminhtml/block/newsletter/subscriber/grid.php you'll want condition based off if subscriber_firstname or subscriber_lastname have values or not: $this->addcolumn('subscribername', array( 'header' => mage::helper('newsletter')->__('subscriber first name'), 'index' => 'subscriber_firstname', 'default' => '----' ...

ruby on rails - How are SaaS applications organized? -

consider web (mvc, example rails) application multiple clients service. how design this? one application instance per client? (+ 1 database per client) one instance clients (+ 1 database clients) former 1 simple, but... "inefficient". how latter? (best practices, design patterns) how separate client data? example: worker "a" of client "1" has 2 documents, worker "b" of client "2" has 3 documents. how build model associations protect other users (and clients) data? think joining every query client model not solution. i suggest having @ earlier response on multi-tenant apps in ruby on rails . it depends on use case, simplest way handle single database scoping particular applications. can head there depending on requirements/budget. i big fan of postgresql schema system detailed in link :p

Websphere application server network deployment trial for Windows XP platform -

i not locate link downloading trial edition of "websphere application server network deployment windows xp platform". either 6.x version or 7.x version? need urgent self-learning purpose. the link find :- http://www.ibm.com/developerworks/downloads/ws/wasnd/?s_tact=105agx28&s_cmp=trials it seems support linux. any pointers highly appreciated. if has local copy, please share. i have kept question long provide inputs. of above responses. guess have wait licensed version of nd 6.x/7.x going. should available once project started. all. you looking websphere application server developers . use link under previous versions on page download 7.0 or 6.1.

sql - How to use like in stored procedure with int parameter? -

i 've used query builder tool of visual studio 2008 build stored procedure. preview script: if exists (select * sysobjects name = 'selectquery' , user_name(uid) = 'dbo') drop procedure dbo.selectquery go create procedure dbo.selectquery ( @studentid int ) set nocount on; select studentid, studentname, studentphone, studentaddress, studentbirthday, studentdescription, studentstatus tbl_student (studentid '%' + @studentid + '%') go but when tried execute it, got error: error message: conversion fail when converting value '%' datatype int. please me! you want find rows @studentid substring of studentid ? if so where studentid '%' + cast(@studentid varchar(10)) + '%' should work.

MySQL table export to HTML -

i've got little problem exporting mysql data html. problem in 1 field have values this: <a href="http://google.com">google</a> , when export table in html format generated html table fields contains: &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt; not valid html link. there way export table without mysql convert < , > chars? im not using code. use mysql command: mysql -h "select ...." , specify output file. thanks! when export table in html format generated html table fields contains: &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt; that's weird, don't behaviour (in 5.1.34): $ mysql -h -e "select 'a&b<c>d'"; <table border=1><tr><th>a&b<c>d</th></tr><tr><td>a&b<c>d</td></tr></table> and want behaviour quote escaping! can see exampl...