Posts

Showing posts from February, 2015

how to build hyperlink for query string in php -

i have question, how can add variable in current url book.php?action=addressbook i want add book.php?action=addressbook&page=2 how generate hyperlink this, have tried using $_server['php_self'] query string not included in url showing that book.php?page=2 i want append other variables query string please you can use http_build_query(); append more params url $params = $_get; $params["item"] = 45; $new_query_string = http_build_query($params); for instance: $data = array('page'=> 34, 'item' => 45); echo http_build_query($data); //page=34&item=45 or include amp echo http_build_query($data, '', '&'); //page=34&&item=45

How do I avoid version conflicts using NServiceBus with Castle Windsor WcfFacility? -

it appears nservicebus built against castle windsor 2.0.0.0, whilst wcffacility needs built against 2.5.2. is there way can run both nservicebus , wcffacility in same project? we're developing network service use both wcf , nservicebus communicate other components , having endless problems windsor version conflicts. john simons (member of castle team) working nservicebus team upgrade windsor in nservicebus: https://github.com/nservicebus/nservicebus/pull/28 so go , jump discussion, test john's fork, etc.

objective c - How to animate rotation of MPMoviePlayerController? -

i'm making video player ipad , i'm having trouble animating rotation properly. deal rotation setting auto rotation mask, since i'm working video player want preserve aspect ratio , i'm not sure how auto rotation mask. i did quick , dirty solution without animation correct behavior: - (void)didrotatefrominterfaceorientation:(uiinterfaceorientation)frominterfaceorientation { movieplayer.view.frame = cgrectmake(0, 0, self.view.frame.size.width, self.view.frame.size.width*0.75); } it works correctly, it's not pretty. i'm preparing app demo, working correctly isn't enough, has pretty. i tried following , think can guess why doesn't work: - (void)willrotatetointerfaceorientation:(uiinterfaceorientation)tointerfaceorientation duration:(nstimeinterval)duration { [uiview animatewithduration:duration animations:^{ movieplayer.view.frame = cgrectmake(0, 0, self.view.frame.size.width, self.view.frame.size.width*0.75); }]; } that...

reporting services - How do I only set the default parameter values for a report if it is running as an email subscription -

i have report has start date , end date parameters. want parameters set yesterday's date if report being run email subscription , must left empty if report being viewed in web browser user user can select date range without report automatically rendering first time. how go doing this? it takes in part of state parameter settings subscription date: use default value , assuming parameters specify date in format: "date" -1 normal date offer , able choose date if needed

c# - ASHX renders as broken image -

i've got vexxing problem ashx handler renders captcha image. thing makes vexxing working fine 2 months ago , when went again today had stopped working. what i've got page throws in captcha every often. markup example of challenge: <img class="challengedtl" src="challenge.ashx?tkn=0057ea27-4d35-4850-9c6f-7a6fdc9818e2"/> the guid references record in sql table contains actual content of captcha status of captcha challenge, i.e. has been processed , if did user right etc. on page markup found, image displays broken jpeg. when drop breakpoint in ashx processrequest() method can see ashx never being called. when take url out of source attribute , run directly address bar in browser, hit break point in processrequest , captch image rendered fine. i don't believe ashx code problem, since works when call directly. problem seems why ashx isn't being called main page. given working in february @ loss explain going on. i know has h...

c++ - One method for doing the same with different variables -

i have that class foo { bar a, b, c; void dostuffwitha(); void dostuffwithb(); void dostuffwithc(); } instead of writing implementation each of methods want template. how that? cheers, dirk edit: i explicitly need know variable stuff (recursion): class foo { bar a, b, c; foo* parent; static void dorecursivestuffwitha(foo *_node) { if(_node->parent==null) { return; } else { dorecursivestuffwitha(_node->parent) } } static void dorecursivestuffwithb(foo *_node) { if(_node->parent==null) { return; } else { dorecursivestuffwithb(_node->parent) } } static void dorecursivestuffwithc(foo *_node) { if(_node->parent==null) { return; } else { dorecursivestuffwithc(_node->parent) } } } edit2: maybe explain better problem is: class foo { public: int a, b, c; ...

html - Why does white-space nowrap have no effect on LI's in Internet Explorer? -

i li's display on same line, set each li's display property inline-block , set white-space = nowrap on parent ul. expected non-wrapping behaviour in firefox , chrome, ie8 ignores nowrap , displays items on underneath other. any idea doing wrong? here html , css... <html> <head> <style type="text/css"> li { display: inline-block; list-style: none outside none; padding: 0px 10px 0px 10px; white-space: nowrap; } ul { white-space: nowrap; } </style> </head> <body> <div style="float: left; width: 300px;"> <ul> <li> menu 1 </li> <li> menu menu menu 2 </li> <li> ...

jquery - ipad safari problem possibly due to scaling -

i made following website: www.appliedintelligentmarketing.com it works fine in browsers i've viewed in safari ipad , doesn't work correctly @ when click on different page. have tried putting following meta tag in: <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" /> doesn't seemed have helped though. need view on ipad see error is, horizontal scrolling doesn't work properly. know might causing problem? thanks this may not answer of problems, i've experienced problems before when using scrollto on ipad-ready website, because mobile safari doesn't perform or receive scroll events way standard browser would. may want test animation replacing localscroll calls standard animate: $('body').animate({scrolltop: posy, 2000});

c++ - Help with this issue -

here problem: the way gui system i'm using works follows: a widget can listen mouse events. listeners can consume event listening , result, widget listening not receive event, if intended them, listener have received it. the problem comes in here: a scrollpane has listbox inside. listbox can scrolled. scrollpane can scrolled. happens right when mousewheel , widget under mouse listbox, both listbox , scrollpane move. solution see scrollpane consumes mousewheel events, there no way listbox ever scrolled. the behavior desire listbox scroll when has focus, if did this, not work because example if radio button inside scrollpane focused, still want scrollpane scroll, widgets scrollbars such textbox , listbox not desired. thanks also, gui system i'm using own i'm developing. the usual way deal listbox consumes event if scrolls . if place mouse in listbox , use scrollwheel listbox scrolls until reaches scroll limit. after further moves of wheel cause scr...

android - How to Add Spannable String to List preference Alert dialog -

i working on list preferences,have increase font size in alert dialog pops when click on listpreference element,try me in ........thanks in advance if wish adjust controls in alertdialog, have create , add controls manually. alertdialog reference

winapi - Get default gateway using Delphi -

does know how default gateway in delphi 2010 app? have found windows functions getadaptersaddresses , dont know how use it. on windows xp , later use getadaptersaddresses instead of getadaptersinfo. there set of functions implementing ip helper apis . see delphi web page @ magenta systems edit: remok comment : getadaptersinfo returns error_no_data if there ipv6 address configured. that's why msdn recommends using getadapteraddresses.

javascript - Mongodb mapreduce iterate through object's key value pairs -

i have mongodb collection has following data : { "_id" : objectid("4da31b8b5ba19e3c11345a66"), "userid" : 4, "datekey" : "bibak", "balancekey" : "maiym" } { "_id" : objectid("4da31b8b5ba19e3c12345a66"), "userid" : 4, "datekey" : "qotwh", "balancekey" : "sfeyq" } { "_id" : objectid("4da31b8b5ba19e3c14345a66"), "userid" : 4, "datekey" : "tlwjj", "balancekey" : "rdkam" } { "_id" : objectid("4da31b8b5ba19e3c15345a66"), "userid" : 5, "emailadress" : "kbdijd" } { "_id" : objectid("4da31b8b5ba19e3c16345a66"), "userid" : 1, "accountname" : "kl", "weblink" : "gj", "note" : "kp" } { "_id" : objectid("4da31b8b5ba19e3c17345a66")...

c# - change MSChart Background for printing -

i have put in code change mscharting area colour when printing. chart.chartareas[o].backcolor = system.drawing.color.white; chart.printing.printpreview(); my quesiton is, how can handle color change oringinal color, eitehr after user has selected print, or close form printpreview dialog,, or if click on dialogs "x". in fact if use printdialog instead, how set background normal once printing has been completed or canceled? little late hope helps someone. to mschart print i'am using printdocument events. beginprint event setting colors printing, printpage event print , endprint event setting colors before print. sample code: public graphfrm() { initializecomponent(); //new printdocument object reset default 1 chart.printing.printdocument = new system.drawing.printing.printdocument(); //set events chart.printing.printdocument.printpage += new system.drawing.printing.printpageeventhandler(printdocument_printpage); ...

java - Is there a design pattern that can help configuring commands on a generic display? -

i have display object displays list of users , provides menu acting on list - adding new users, adding them groups, deleting them, etc. right display configures own menu, can add menu command docreatenewusers() . unfortunately, means every instance of display has "create new" option. i want configure menu differently different instances of display - in "users" tab, should include "create new" option, , in "groups" tab, shouldn't. first thought externalize menu, configure differently. problem lose ability call private docreatenewusers() function! is there design pattern situation? don't idea of making docreatenewusers public because shows dialog shouldn't triggered external classes. make display abstract, define menu in anonymous subclasses, kind of messes way reuse widgets right - i'd configure menu after display has been created , initialized. i'm hoping there's industry-standard way of dealing this! ...

ipad - iOS App Build Setting Differences between Debug and Distribution -

for iphone/ipad app, build settings make differently between debug , distribution build? please note unique settings iphone apps , ipad apps. here doing (some set default xcode), gather exhaustive list. usual path stuff not included in list. for adhoc , app store distribution build: enable validate build product set optimization level fastest , smallest assign entitlements.plist code signing entitlements strip debug symbols during copy add ns_block_assertions=1 "other c flags" for ipad app, set architectures , valid architectures optimized (arm7) for debug build: add debug preprocessor macros. in debug build, set preprocessor macro debug , use a macro dlog instead of nslog of logging.

filesystems - Loop through all the files in a directory with Corona and Lua -

is possible in corona sdk list of files in directory? have variable resourcedir = system.resourcedirectory , how loop through files in resourcedir? this functionality has been added corona including luafilesystem module: local lfs = require "lfs" local doc_path = system.pathforfile( "", system.documentsdirectory ) file in lfs.dir(doc_path) -- file current file or directory name print( "found file: " .. file ) end more info: http://blog.anscamobile.com/2012/05/luafilesystem-lfs-tutorial/

How to run javascript code represented by a string? -

thorugh ajax receive random string(built @ runtime on server) contain javascript code like: plugins.add('test', function() { return { html: '<div>test</div>',//edited width: 200 } });//edited in client want able execute code. tried using eval function this eval("(" + str + ")"); but error. removed " \r\n " , removed last " ; "(semicolon) , after " eval " function succeeded. but, if add comment code above, " eval " fails. how can run code string? thank you new function(str)() or json: new function('return ' + str)(); if happens fit needs better eval. it's still evil eval.

ios - Changing cell content in UITableView when tapped -

i'm building app has table view. want table view expands cell when tap on , close when tap second time. but wondering if following possible. when cell isn't selected see picture, title , beginning of text. cell selected, expand , show more subviews, i.e. image views. is possible? instance, hide subview in cell, , tapped it's visible , aligned right way? , of course, how do that? thnx!!! i did similar quite few time ago. you'll find code @ github . note rough, beginning iphone days, i.e. properties missing. .h #import <uikit/uikit.h> @interface firstviewcontroller : uitableviewcontroller <uitableviewdelegate, uitableviewdatasource> { nsindexpath *selectedindexpath; nsdictionary *articles; } @end .m #import "firstviewcontroller.h" @implementation firstviewcontroller - (void)viewdidload { [super viewdidload]; selectedindexpath = nil; articles = [[nsdictionary dictionarywithobject:[nsarray arraywitho...

asp.net - Can't override preload because not function? -

another .net newbie question i created class inherits system.web.ui.page intention of overriding preload , unload functions. visual studios complains can't override because "system.web.ui.page.preload" not function. what's wrong code? here is: using system; using system.collections.generic; using system.linq; using system.web; using system.web.ui; using system.web.ui.webcontrols; using system.data.sqlclient; using system.configuration; public partial class btpage : system.web.ui.page { protected sqlconnection cnx; public override void preload(object sender, eventargs e) { cnx = new sqlconnection(configurationmanager.appsettings["btdatabase"]); cnx.open(); } protected void unload(object sender, eventargs e) { cnx.close(); } } if there's else alarming code, please tell me. i'm new .net , i'm not sure if i'm doing things in ".net way". what want have every web p...

google chrome - How to access the windows registry with javascript? -

i need write hkey_currentuser using javascript. should work on google chrome 10 & 11 - winxp , 7. how do that? you can't. allowing via web browser have pretty serious security consequences.

java - I don't understand the int in the error message -

possible duplicate: i error when try compile java code below: not sure compile can help? don't understand int in error message. i still getting error message when try compile java code below: //author: donna gary //date: april 10, 2011 //class: it/215 week 5 inventory program 1 import java.text.numberformat; import java.util.locale; import java.util.scanner; class television { private string itemnumber; private string productname; private double units; private double unitprice; private double unitstotal; //constructor public television (string itemnumber, string productname, double units, double unitprice, double unitstotal) { setitemnumber(itemnumber); setproductname(productname); setunits(units); setunitprice(unitprice); unitstotal = units ++; } //accessor methods class variables public string getitemnumber () { return itemnumber; } public void setitemnumber (string itemnumber...

osx - Java file lock in Mac OS -

file locking using java.nio package works fine windows os same program not working mac os. i trying delete locked file in windows not deleting file. same thing trying achieve in mac os though file locked or opened filewriter/fileoutputstream, deleting file. any suggestion issue ? bug in file lock implementation ? thanks. it's not bug (unless call windows bug) locks advisory on *nix systems. nothing prevents deleting locked file except checking see if it's locked first. in windows it's sort of same, except system commands check locks , iirc default mode opening file exclusive lock.

SQL: Using Stored Procedure within a Stored Procedure -

i have few stored procedures return same set of data (same columns) user. stored procedure called depends on conditions. these stored procedures intensive , being run every user of system. create stored procedure calls each of these procedures , stores data on separate table. run new stored procedure every 5 minutes or , let users pull new table. t_outboundcalllist permanent table same columns returned 2 stored procedures. i following when try run runs continuously , have stop procedure. begin truncate table t_outboundcalllist insert t_outboundcalllist execute p_leadvendor_getcallsforcalllist insert t_outboundcalllist execute p_calllog_getabandonedcallscalllist end each of procedures (*calllist) return list of calls made , want them entered new table in order (leadvendor calls before abandonedcalls). need clear table before adding calls there may new calls need higher in list. is there problem procedure not seeing? thanks, brian without seeing code in...

php - grabbing twitter info using API? -

how can grab twitter following, followers , listed info using twitter api php? well, short of it.. $ch = curl_init("https://api.twitter.com/1/users/show.json?screen_name=username"); curl_setopt($ch, curlopt_returntransfer, true); curl_setopt($ch, curlopt_useragent, 'somehitn/3.2'); $ret = json_decode(curl_exec($ch)); curl_close($ch); unset($ch); print_r($ret); just hitting other restful api.

database - SQL, Postgres OIDs, What are they and why are they useful? -

i looking @ postgresql table creation , stumbled upon this: create table ( ... ) ( oids = false ); i read documentation provided postgres , know concept of object identifier oop still not grasp, why such identifier useful in database? to make queries shorter? when should used? oids give built-in, globally unique id every row, contained in system column (as opposed user-space column). that's handy tables don't have primary key, have duplicate rows, etc. example, if have table 2 identical rows, , want delete oldest of two, using oid column. in experience, feature unused in postgres-backed applications (probably in part because they're non-standard), , their use deprecated : in postgresql 8.1 default_with_oids off default; in prior versions of postgresql, on default. the use of oids in user tables considered deprecated, installations should leave variable disabled. applications require oids particular table should specify oi...

c# - Linq - Except one list with items in another -

i think question easy, i'm newbie in linq... i'm having hard time here my system calls service, called servicetop, returns me list of itemtop {id, name} . these itemstop aren't in system, user can choose itemtop import system. the imported itemstop becomes object item { id, idtop, name } so, when system calls servicetop, before showing them user, must filter imported items list. let's go code: ilist<itemstop> listtop = new servicetop().getitemstop(); ilist<items> list = new wcfserviceclient().getitems(); var filteredlisttop = listtop.select( => i.id ).except( => i.idtop ); this kind of works, returns list of strings containing id. i'd select both id , name of top. thanks in advance. change this: var filteredlisttop = listtop.select(i => i.id ).except( => i.idtop ); to this: var filteredlisttop = listtop.select(i => new { id = i.id, name = i.name} ).except( => i.idtop );

Silverlight: Should I be using IDataErrorInfo, INotifyDataErrorInfo, or both? -

should using idataerrorinfo, inotifydataerrorinfo, or both? if use both, should offer same error in both or should offer sync errors idataerrorinfo , async errors inotifydataerrorinfo? if you're working in silverlight, should implement inotifydataerrorinfo . documentation: in general, new entity classes silverlight should implement inotifydataerrorinfo added flexibility instead of implementing idataerrorinfo. however, if want share code wpf, idataerrorinfo supported in both silverlight , wpf.

qt - QSettings and "foldered", non-flat output -

a registry root of application can tree-like structure "folders" , "nodes". pfile on mac can have inner dictionaries folders. whatever qsettings flat, if use group. there api that’ll let me "create folder" translate in windows registry 'folder', , new dictionary on pfile? there no publish way describe. can store qt container types qlist , qmap in qsettings. resulting registry or plist won't want serves want accomplish. unless, of course, want registry or plist compatible other applications arrange settings way. edit actually, after test, on mac qsettings use plist natives standard types. need put them in qvariant. example: qlist<qvariant> array; array << 1 << 2 << "3"; qmap<qstring, qvariant> list; list["one"] = 1; list["two"] = "2"; list["3"] = array; qsettings().setvalue("somelist", list); the above code produces following plist entr...

java - Cloud Streaming To Android -

i'm attempting develop first useful android app, need insight. the basic function of app allow user access audio files on private server , stream them on demand (non-live). sort of pandora, user doesn't have wait whole file download, , file doesn't take space on device. the app used stream pre-recorded services church. my questions are: what cleanest way access files on server? will server need software, or linking strait file work? can android natively? or there library this? any other insight appreciated. it can done in simple way pc using iis , simple asyncplayer or mediaplayer based app on android device. see answer question here... developing streaming server android

android - Load resources with variables? -

i loading xml file resource this, getresources().getxml(r.xml.fiel1); now, scenario depending on factors there may many xml files choose from. how do that? in case filename similar in fact starts file ends different numbers file1, file2,file3 etc., can form string variable file name , add suffix per requirement form filename file1 (file+1). problem keep getting various errors (nullpointerex, resourceid not found etc) in whatever way try pass filename variable method. correct way of accomplishing this? you use getidentifier() docs mention: use of function discouraged. more efficient retrieve resources identifier name. so it's better use array references xml files. can declare integer array resource . eg, in res/values/arrays.xml : <?xml version="1.0" encoding="utf-8"?> <resources> <integer-array name="xml_files"> <item>@xml/file1</item> <item>@xml/file2</item...

javascript - reload datepicker dynamically -

ok have javascript object control elements on page such load html, undo, redo etc. when undo, removes datepickers inputs should datepickers. my code located here: http://jsfiddle.net/maniator/qawua/ i changed code inline json fiddle it has 6 columns, 2 of them being datepickers start date , expiration. when user clicks of undo or undo -- datepickers no longer work. can please me out here? thanks :-d updated still have issue, changed fiddle bit i solved issue: i added line both of undo clicks: self.refreshdatepickers(); on create row added expiration: case 'expiration': td.append($('<input>', {value: i, name: index+"["+topindex+"]", type: 'text', size: 30, id: 'to['+topindex+']', 'class': 'dp', 'index': topindex})); break; and added refreshdatepickers function: refreshdatepickers: function(){ var sel...

jquery ajax call to rails not returning an array when one record returns -

the problem have when make ajax call, , there more 1 record, array returned , can call list[0] or whatever first. if make same call , receive single object object rather array of one. any ideas how can handle this? update: used these functions function isarray(obj) { return (obj.constructor.tostring().indexof("array") != -1); } function getarray(obj) { if(obj.constructor.tostring().indexof("array") != -1){ return obj; } else { var myarr = [1]; myarr[0]=obj; return myarr; } } you check javascript: if ( list.length > 1 ) { list[0]; } else { list; } you on server side: @entries = [@entries] unless @entries.is_a?(array)

python - Write PDF file from URL using urllib2 -

i'm trying save dynamic pdf file generated web server using python's module urllib2. use following code data server , write data file in order store pdf in local disk.: import urllib2 import cookielib theurl = 'https://myweb.com/?pdf&var1=1' cj = cookielib.cookiejar() opener = urllib2.build_opener(urllib2.httpcookieprocessor(cj)) opener.addheaders.append(('cookie', cookie)) request = urllib2.request(theurl) print("... sending http %s" % theurl) f = opener.open(request) data = f.read() f.close() opener.close() file = open('report.pdf', "w") file.write(data) file.close() this code runs written pdf file not recognized adobe reader. if request manually using firefox, have no problems receive file , can visualize withouut problems. comparing received http headers (firefox , urrlib) difference http header field called "transfer-encoding = chunked". field received in firefox seems not received when urllib request. su...

javascript - Pass in an array of Deferreds to $.when() -

here's contrived example of what's going on: http://jsfiddle.net/adamjford/yngcm/20/ html: <a href="#">click me!</a> <div></div> javascript: function getsomedeferredstuff() { var deferreds = []; var = 1; (i = 1; <= 10; i++) { var count = i; deferreds.push( $.post('/echo/html/', { html: "<p>task #" + count + " complete.", delay: count }).success(function(data) { $("div").append(data); })); } return deferreds; } $(function() { $("a").click(function() { var deferreds = getsomedeferredstuff(); $.when(deferreds).done(function() { $("div").append("<p>all done!</p>"); }); }); }); i want "all done!" appear after of deferred tasks have completed, $.when() doesn't appear know how handle array of ...

jquery - JavaScript: Getting notification when empty iframe is loaded -

i'm trying dynamically create iframe <form> , form child <input> element in using jquery. reason, load event of iframe never firing, can't add <input> . missing? very short: http://jsfiddle.net/llkej/10/ edit: i'm trying detect when iframe loads read console. there no load event forms.

database - Figuring out MySQL data information on an ec2 instance -

i installed mysql on ec2 instance , need information database can setup pligg on it. the info needs are: database name, username, password, database server , table prefix. there simple way retrieve information? assume need use putty couldn't find specific info on it. thanks the database server localhost , rest values must set. docs whatever application installing should give tutorial on how create these. you might find phpmyadmin useful if application provides sql script run , don't want use command line.

emacs - load-path and load a lisp file -

after setting path lisp files in emacs in .emacs file, this (add-to-list 'load-path "~/elisp/") logically should use load command specific file guess command i tried (load-file-name "google-c-style") .el added file, should right way this however no success. it's (load) , not (load-file-name) .

Rails 3 remote link with :condition and mootools -

back in rails 2, there :condition option in link_to_remote let specify javascript had return true or remote request not send. however, in rails 3 seems options has been removed. what want have ajax form, needs undergo validation on browser before gets submitted (this non-standard validation). need able set conditional javascript expression prevent form being submitted if validation fails - same :condition option rails 2. there way achieve same functionality again in rails 3? i'm using mootools mootools version of rails.js. looked through mootools rails.js file , didn't see looked let me specify conditional javascript. missing something? *note: looked through source default rails.js file written in prototype. in file there there following lines: var event = element.fire("ajax:before"); if (event.stopped) return false; this looks in prototype version can stop request being sent listening "ajax:before" event , stopping event in listener. however, ...

memory - C++ STL allocator vs operator new -

according c++ primer 4th edition, page 755, there note saying: modern c++ programs ordinarily ought use allocator class allocate memory. safer , more flexible. i don't quite understand statement. far materials read teach using new allocate memory in c++. example of how vector class utilize allocator shown in book. however, cannot think of other scenarios. can clarify statement? , give me more examples? when should use allocator , when use new ? thanks! for general programming, yes should use new , delete . however, if writing library, should not! don't have textbook, imagine discussing allocators in context of writing library code. users of library may want control on gets allocated where. if of library's allocations went through new , delete , user have no way have fine-grained level of control. all stl containers take optional allocator template argument. container use allocator internal memory needs. default, if omit allocator, use std...

windows 7 gadget development with php and also monetizing -

can have windows vista/7 gadget app loaded php made website on own host? also, can have 1 advertisement in gadget, make money, using google adsense? this should possible, had quick @ gadget api , seems gadget requires manifest meta info , html page, bet it's possible load external content aswell javascript , ajax. i in turn read terms , conditions there restrictions on monetizing gadget such as: http://msdn.microsoft.com/en-us/library/aa974179.aspx

mysql - when to use join or simple 2 table condition? -

possible duplicate: sql left join vs multiple tables on line? i think clearer: "select * t1,t2 t2.foreignid = t1.id " than query join. are there specs on when use 1 or another? thanks personally, prefer explicitness of select t1.*, t2.* t1 join t2 on t1.id = t2.foreignid i see join conditions are, , use where further filter results (current year, user, etc). shouldn't matter in simple query this, longer, more complex queries. it doesn't make sense me have 1 style shorter queries , different longer ones. simple ones turn complex queries enough.

ruby on rails - fields_for and wrong number of arguments (0 for 1) error -

amateur rails programmer struggling use fields_for form builder. rails application (on v=2.3.11) tracks laboratory protocols , animals used on protocols (their weights, etc). my specific problem protocols can have number of animals, number allowed specific species. the nested form behavior should display listing of species of animals , edit box number allowed on protocol. models: protocol, allowed_animal, species species model class species < activerecord::base has_many :animals, :order => "band" has_many :allowed_animals end protocol model class protocol < activerecord::base has_and_belongs_to_many :animals, :order => "band" has_many :allowed_animals accepts_nested_attributes_for :allowed_animals end allowed_animal model class allowedanimal < activerecord::base belongs_to :protocol has_one :species end the table allowed_animal includes: id, protocol_id, species_id, number, created_at, updated_at the nested ...

ruby - Why does '/' match correctly to a Rack application in my Rails 3 app, but no other route does? -

i'm using rails 3.0.6. in lib directory have example_app.rb, sinatra app: class exampleapp < sinatra::base '/' "hello sinatra" end end and i'm autoloading application.rb config.auto_load_paths configuration. in routes file, have only: match "/" => exampleapp and matches fine when run rails server (webrick). if try: match "/example" => exampleapp visiting localhost:3000/example gives me 'no route matches "/example"' error. running rake routes shows route though: example /example(.:format) {:to=>exampleapp} if try , match '/example' against controller action works fine, not sinatra app above, i'm not sure what's going on. know there's small i'm missing i'm not finding in routing documentation on rails site. thanks help. the problem sinatra app responds requests made / . need either add get '/example' or wildcard match using * ge...

android - ListView Item to webView in Main Activity -

what trying load url in webview in main activity populated listview item. not sure how , learning step step, working way adapt populating listview database once learn step (in question). the geturl variable needs used load link mwebview in .main activity when list item object clicked. (make sense??) thanx help!! below have far: the listview activity (aclist.java): public class aclist extends activity { @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); requestwindowfeature(window.feature_no_title); setcontentview(r.layout.ac_list); arraylist<searchresult> searchresults = getsearchresults(); final listview lv1 = (listview) findviewbyid(r.id.listitems); lv1.setadapter(new mycustombaseadapter(this, searchresults)); lv1.setonitemclicklistener(new onitemclicklistener() { public void onitemclick(adapterview<?> a, view v, int position, long id) { ...

many to many - Django QuerySet join across four tables, including ManyToMany? -

given following models, goal create queryset pulls available tag objects given postcategory id. know how write in sql can't figure out how using django orm. believe i'm following best practices defining relationships on post object, , not tag, queryset syntax pattern seems expect me start tag.objects.filter() don't see how. class tag(models.model): name = models.charfield(max_length=255) class postcategory(models.model): name = models.charfield(max_length=100) class post(models.model): body_text = models.textfield() pub_date = models.datetimefield() mod_date = models.datetimefield(auto_now=true) title = models.charfield(max_length=255) subtitle = models.charfield(max_length=255) is_featured = models.booleanfield() image = models.imagefield(upload_to='post_images') tags = models.manytomanyfield(tag, null=true, blank=true) user = models.foreignkey(user) category = models.foreignkey(postcategory) tag...

javascript - Am I formatting my switch statements wrong? -

i have been working on "rock paper scissors" game see if understand basics of javascript. works until if statement lines 30 71 in fight() : have adjusted reply variable indicate how may "if'ing" through. seems returning default value of every sub "if" in overall "if". using wrong variable secondary condition maybe? radiogroup.html <script type = "text/javascript"> //<![cdata[ // radiogroup.html function fight(){ var randomchoice = math.random(); var threechoice = math.floor (randomchoice * 3); var weapon = document.getelementsbyname("weapon"); (i = 0; < weapon.length; i++){ currentweapon = weapon[i]; if (currentweapon.checked){ var selectedweapon = currentweapon.value; } // end if } // end var cpuchoice = new array("paper", "rock", ...

iphone - Can't Seem To Fix This Basic Save/Fetch Request -

Image
its been 3 weeks i've been seeking on site simple save/fetch feature using core data can't work. keep getting different suggestions people , change code accordingly can never working properly. its discouraging taken me long simple error yet did 100x work in week prior hit. bummer when learning how program. here scenario: tableview blank default until user inputs name string via + button in nav bar. string entered should add cell view name title. should saved memory , fetched upon relaunch of application. the problem: following error @ line: cell.textlabel.text = [eventsarray objectatindex:indexpath.row]; in method of: - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath 2011-04-11 22:40:49.824 curl[2244:207] -[routine isequaltostring:]: unrecognized selector sent instance 0x5c09ad0 2011-04-11 22:40:50.005 curl[2244:207] *** terminating app due uncaught exception 'nsinvalidargumentexception', reason: ...