Posts

jquery - Why is my content spilling past the bottom of the container? -

Image
it seem if there "max-width" (or having similar effect) set on div somewhere, there isn't, far can tell. yet bottom of container spills out on bottom edge so: why that, , how can prevent it? update what happening here html5 section elements being dynamically (programmatically, via jquery) added tab's content area. pertinent code: html: <div id="tabs" class="content-wrapper"> <ul> <li><a href="#tab-books">books</a></li> <li><a href="#tab-movies">movies</a></li> <li><a href="#tab-music">music</a></li> </ul> <div id="tab-books"> <select id="bookdropdown"> <option value="pulitzer">pulitzer</option> <option value="nbcc">national book critics circle</option> <optio...

ruby - Hash.fetch(not_exist_key) raises IndexError instead of KeyError -

in docs, says: fetch(key [, default] ) → obj ; fetch(key) {| key | block } → obj returns value hash given key. if key can’t found, there several options: no other arguments, raise keyerror exception; if default given, returned; if optional code block specified, run , result returned. in terminal, irb says: irb(main):001:0> hash = { 1 => "no one", 2 => "gonna", 3 => "fetch me" } => {1=>"no one", 2=>"gonna", 3=>"fetch me"} irb(main):002:0> hash.fetch(4) indexerror: key not found (irb):2:in `fetch' (irb):2 :0 can me explain that? seems using older version of ruby. according 1.8.7 docs raises indexerror : returns value hash given key. if key can’t found, there several options: no other arguments, raise indexerror exception; if default given, returned; if optional code block specified, run , result returned. note keyerror subclass of inde...

android - Button for Submitting to Database Error -

i want insert data row in sqlite database table filling form , has error when click submit button. here's piece of code , logcat public void calldialogconfirmation(){ alertdialog.builder confirm = new alertdialog.builder(form.this); confirm.settitle("please confirm"); confirm.setpositivebutton("yes", new dialoginterface.onclicklistener() { public void onclick(dialoginterface dialog, int id) { string inputansavings = spinner1.getselecteditem().tostring(); string tglmsk = spinner2.getselecteditem().tostring(); sharedpreferences.editor editor = somedata.edit(); editor.putstring("sharedstring1", inputansavings); editor.putstring("sharedstring2", tglmsk); editor.commit(); string inputsalary = salary.gettext().tostring(); dbhelper.createincome("routine income",inputsalary); ...

javascript - What is the purpose of Object.prototype.toString()? -

i see code in underscore.js. here is, alias applied: tostring = objproto.tostring, however, use tostring accessible directly this, w/ out using above code @ all. tostring() try out in console works fine. try out in direct code , works fine well. guess older browsers may not have accessible in way. how can further? caniuse not not have information on it. google pulls nothing useful in first 10 or hits. because on object.prototype , accessible global objects inherit object ( inherit, not global objects ), such number. but point is, is accessible directly out having use global object instance @ all. tostring(some_var); here 1 so q/a suggests window.tostring not supported in browsers , why is. global objects inherit object, that's wrong assumption, global objects host objects , can inherit whatever want or not inherit @ all. code example doesn't work in ie10. the particular tostring method stored on object.prototype 1 returns in...

java - Spring file upload not binding to model attribute object -

i want build simple file upload functionality using spring mvc. i have multipartresolver in place , working: <bean id="multipartresolver" class="org.springframework.web.multipart.commons.commonsmultipartresolver"> <property name="maxuploadsize" value="10240000"/> </bean> when uploading file logged: debug:[org.springframework.web.multipart.commons.commonsmultipartresolver]: found multipart file [imageupload] of size 29081 bytes original filename [xyz.jpg], stored @ [/home/myuser/workspace/myproject/target/tmp/upload_67f1107c_1b8f_402c_bebd_6cd8a6e4c830_00000032.tmp] which tells me it's working. this part of jsp: <form:form modelattribute="placeform" action="/platz/save" method="post" cssclass="placeform" enctype="multipart/form-data"> ... <label for="imageupload">upload</label> <form:input type="file"...

html - z-index issue with fixed and relative div's in a container -

i facing issue z-index layout draft form here : jsfiddle i trying achieve following the #topbar , #navigations , #infobar needs fixed always.(achieved) z-index of #mainmenu . needs between #contentborder , #content (has shadow). z-index of #categorys . needs top of #contentbordera , #content . any highly appreciated. seen on www.w3schools.com definition , usage the z-index property specifies stack order of element. an element greater stack order in front of element lower stack order. note: z-index works on positioned elements (position:absolute, position:relative, or position:fixed).

php - var dump is showing result but data is not getiing inserted in DB -

i trying post value in db reason data not being inserted. array returned view not empty. query not executing. part of view: <?echo form_open_multipart('eva/evluation_questions_value_entry'); ?> <input type="hidden" name="id" value="<?php echo htmlspecialchars($id) ?>"> <?php foreach ($info $row){ echo "<div class='row'>"; $i=$row->id; echo "<div class='firstc'>".$row->id ."</div>"; echo "<div class='secondc'>".$row->name ."</div>"; echo '<input type="hidden" name="training_evaluation_entry_id'.$i.'" value='.$i.'>'; //some codes <input id="submit" type="submit" value="submit" name="submit"> </form> the controller: public function evluation_questions_value_entry() { $...

qt4 - Connect signal to function with many argument? -

i have function in python def: def niveau(controlname,idniveau) i want connect signal in way: qobject.connect(dialog.findchild(qdialogbuttonbox, 'buttonbox'), signal('accepted()'),niveau(control,1)) i got following error: qt signal not callable can me this? the error because qobject.connect 3 parameters means: qobject.connect(qobject, signal(), callable, qt.connectiontype=qt.autoconnection) the third parameter you're passing isn't callable, return value of call niveau(control,1) . the arguments signal emitted determined @ emit time, not @ connect time. if speicfy (or all) parameters @ connect time, can: use functools.partial : from functools import partial qobject.connect(... , partial(niveau, control, 1)) use lambda qobject.connect(... , lambda ctrl=control, id=1: niveau(ctrl, id)) edit: by way, should use new style signals - old style signals will not supported anymore in pyqt5 .

frameworks - Clean HTML output in ZF2 -

is possible fomat(clean) output of html in zend framework 2? right outputs without proper newline characters , tabs. i know method: $dom = new domdocument(); $dom->preservewhitespace = false; $dom->loadhtml($html); $dom->formatoutput = true; echo $dom->savehtml(); but not understand intercept output in zf2. appreciated. right html code created in layout. you can attach listener "finish" mvc-event ( http://framework.zend.com/manual/2.1/en/modules/zend.mvc.mvc-event.html ) , have clean response before sending out. in application's module.php add following module class. public function onbootstrap(mvcevent $e) { $eventmanager = $e->getapplication()->geteventmanager(); $eventmanager->attach(mvcevent::event_finish, function(mvcevent $e){ $content = $e->getresponse()->getcontent(); $cleancontent = clean_up_html(content); // clean_up_html() not provided $e->getresponse()->setcontent($clea...

Simple MYSQL insert statement not working, what am i NOT seeing -

this have, super basic. still cant working :/ $connection = mysql_connect("localhost","root","") or die ("couldn't connect server"); $db = mysql_select_db("streetrider",$connection) or die ("couldn't select database"); $result = mysql_query(sprintf("insert video(id, parent_id, video, coverimage, ts_created, is_void) values('%s','%s','%s', '%s', '%s','%s')", $unique_id, $parent_id,$videodirectory,$imagedirectory, $ts_created, $is_void)); missing???? :( ok guys if 1 of variables i'm storing equal works: $videodirectory = 'uservideos/'.$unique_id; when variable equal this, insert fails: $videodirectory = 'uservideos/'.$unique_id.'.mp4'; its puzzling , frustrating, thats figured out.video datatype varchar(50). you have assigned columns %s query function have sprint...

elixir - How do I compare Dict literal with a constructed Dict? -

i'm trying test algorithm builds hashdict, can't "expected" actually equal "actual." example, iex> expected = hashdict.new([ key: 12 ]) #hashdict<[foo: 12]> iex> actual = dict.put(hashdict.new, "key", 12) #hashdict<[{"foo", 12}]> i can second "style" of hashdict in literal declaring in more obtuse way: iex> hashdict.new([ { "key", 12 } ]) #hashdict<[{"foo", 12}]> i simple dict literal syntax test case, implementation builds dict recursively. how can make these equal? in first case key atom, in second case string. you can on iex: expected = hashdict.new([key: 12]) actual = dict.put(hashdict.new, :key, 12) dict.equals? actual, expected # returns true for more information visit: http://elixir-lang.org/docs/stable/

java - Scan close causes trouble so should I leave it unclosed? -

just switching python java , have problems reading in input user. have 2 questions in following code: (1) why not working after close scanner(if after skip close, problem?) (2) why summation of 2 simple numeric numbers lead inaccurate answer 3.0300000000000002? import java.util.scanner; public class helloworld { public static void main(string[] args) { string s1 = getinput("enter numeric value: "); string s2 = getinput("enter numeric value: "); double d1 = double.parsedouble(s1); double d2 = double.parsedouble(s2); double result = d1 + d2; system.out.println("the answer is: " + result); } private static string getinput(string prompt){ system.out.print(prompt); scanner scan = new scanner(system.in); string input = "default"; try{ input = scan.nextline(); } catch (exception e){ system.out.println(e.getmessa...

Automate SSL creation in Fabric (Python) -

i'm using fabric automate ssl creation, when run like local('openssl genrsa -out /etc/ssl/'+hostname+'/'+hostname+'.key 2048') it prompts me country, state, email address, etc. there can (possibly openssl.cnf?) prevent need user input prompts, or people hack using pexpect? update: if put prompt=no in openssl.cnf, cd /ssdhome/development/server , run: sudo openssl req -new -key './server.key' -out './server.csr' -config='./openssl.cnf' openssl prints out help information instead of running above command. have gone wrong? update 2 : -config should not have '=' sign, space. solved. linked copy of openssl.cnf working: https://help.ubuntu.com/community/openssl see how answer prompts automatically python fabric? from ilogue.fexpect import expect, expecting, run def sample(): private_key = "password" hostname = "ubuntu" output_dir = '/etc/ssl/' + hostname ...

loops - Lua Least Common Multiple Program Not Enough Memory -

this lua program wrote find least common multiple of 2 numbers. when run it, asks 2 numbers intended, when tries run them through function, runs out of memory. function lcm(a,b) alist={} blist={} c=0 if a<b repeat c=c+1 alist[c]=a*c blist[c]=b*c al=table.getn(alist) until al==b else if a>b repeat c=c+1 alist[c]=a*c blist[c]=b*c bl=table.getn(blist) until bl==a end end e=1 repeat d=1 repeat if alist[e]==blist[d] f=alist[e] return f end d=d+1 until d==table.getn(alist) e=e+1 until e==table.getn(blist) end n1=io.read() n2=io.read() ans=lcm(n1,n2) print(ans) the bug arises because of io.read call. pil ...

asp.net mvc - how to fetch multiple table data in a single linq query and bind it to a autocomplete search model -

i want autocomplete search google or facebook , want data 2 different table, using entity framework , mvc-4..i done far ajax here action public actionresult autocomplete(string term) { var model = _db.instructors .orderbydescending(u => u.id) .where(u => u.fullname.contains(term)) .take(30) .select(u => new { label = u.firstname + " " + u.lastname }); return json(model, jsonrequestbehavior.allowget); } my js $(function () { var createautocomplete = function () { var $input = $(this); var options = { source: $input.attr("data-otf-autocomplete"), select: submitautocompleteform }; $input.autocomplete(options); }; $("input[data-otf-autocomplete]").each(createautocomplete); }); i want extract data 2 tables this var model = _db.instructors ...

x86 - What is the purpose of CS and IP registers in Intel 8086 assembly? -

so, question states, purpose of cs , ip registers in intel's 8086 i found explanation: code segment (cs) 16-bit register containing address of 64 kb segment processor instructions. processor uses cs segment accesses instructions referenced instruction pointer (ip) register. cs register cannot changed directly. cs register automatically updated during far jump, far call , far return instructions. and ip: instruction pointer (ip) 16-bit register. i don't understand means, if provide more "vivid" explanation, great :) since ip 16 bit means can have 64k instructions (2^16), wasn't in 80s. expand address space have second register addresses 64k blocks. consider cs:ip 1 32 bit register capable of addressing 2^32 bytes...ie 4g on processor uses 32 bit addresses. 8086 using 20 bits of addresses, access 1m of memory.

How to add elements from a dictonary of lists in python -

given dictionary of lists vd = {'a': [1,0,1], 'b':[-1,0,1], 'c':[0,1,1]} i want add lists element wise. want add first element list first element of list b vice versa complexity cannot rely on labels being a, b, c. can anything. second length of dictionary variable. here 3. 30. the result need list [0, 1, 3] in short: >>> map(sum, zip(*vd.values())) [0, 1, 3] explanation given dictionary: >>> vd = {'a': [1,0,1], 'b': [-1,0,1], 'c': [0,1,1]} we can get values : >>> values = vd.values() >>> values [[1, 0, 1], [-1, 0, 1], [0, 1, 1]] then zip them up: >>> zipped = zip(*values) >>> zipped [(1, -1, 0), (0, 0, 1), (1, 1, 1)] note zip zips each argument; doesn't take list of things zip up. therefore, need * unpack list arguments. if had 1 list, sum them: >>> sum([1, 2, 3]) 6 however, have multiple, can map on it: >>> map...

Mysql query to select rows and alternatively matching rows on other table -

i've got 2 tables: user id --- name posts id --- userid --- text --- postdate now want select users , every post they've made in past 15 minutes. want display every user didn't didn't make post matching conditions @ all. i'm doing way: $user_q = mysql_query("select * user"); while ($a = mysql_fetch_assoc($user_q)) { $post_q = mysql_query("select * posts userid=".$a['id']." , postdate >= date_sub(now(), interval 15 minute)"); //do information } do have ideas how can put information in 1 query? doing many queries makes server running slow. what want left outer join: select u.*, p.* users u left outer join posts p on u.id = p.userid , p.postdate >= date_sub(now(), interval 15 minute); the left outer join keeps rows in first table. if nothing matches in second table, using condition, values null fields. edit: if want limit 50 random users, can @ users level: ...

ios - Memory management - How to show an already instantiated ViewController without creating a new instance -

i having major memory management issues. after small use of program crash running out of memory. have found cause, every time create new viewcontroller rather accessing instance, creating new instance. so app loads , instantiates firstviewcontroller. click button instantiates filterviewcontroller . here when going firstviewcontroller creating new instance of follows: uistoryboard *storyboard = [uistoryboard storyboardwithname :@"mainstoryboard" bundle:nil]; firstviewcontroller *fvc = [storyboard instantiateviewcontrollerwithidentifier:@"firstviewcontroller"]; fvc.modaltransitionstyle = uimodaltransitionstylecoververtical; and repeat process. way of presenting view controller without re-instantiating it? close submitting app (tomorrow hopefully) need try sorted. thanks! here presentation of viewcontroller. [self presentviewcontroller:fvc animated:yes completion:nil]; presenting filterviewcontroller firstviewcontroller...

autosuggest - How to adjust delay of suggestion list in Python 3.3.2 -

in python 3.3.2, how adjust time takes suggestion box appear after typing '.'. example, import wxpython , type wx. after 3 seconds list box appear showing available options. there way set appear instantly or in short time? sort of visual studio's intellisense feature appears instantly. thanks in advance :) i think referring ide, editor using write code. if case, depend on editor, 1 using? if using built-in editor idle, looking not available option. if trying within own code using wxpython (as sexysaxman suggested), please provide example of code can better idea of trying do.