Posts

Showing posts from September, 2015

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.

Closing Excel Application Process in C# after Data Access -

Image
i'm writing application in c# opens excel template file read/write operations. want when user closes application, excel application process has been closed, without saving excel file. see task manager after multiple runs of app. i use code open excel file : public excel.application excelapp = new excel.application(); public excel.workbook excelbook; excelbook = excelapp.workbooks.add(@"c:/pape.xltx"); and data access use code : excel.worksheet excelsheet = (worksheet)(excelbook.worksheets[1]); excelsheet.displayrighttoleft = true; range rng; rng = excelsheet.get_range("c2"); rng.value2 = txtname.text; i see similar questions in stackoverflow such this question , this , , test answers, doesn't works. try this: excelbook.close(0); excelapp.quit(); when closing work-book, have 3 optional parameters: workbook.close savechanges, filename, routeworkbook workbook.close(false) or if doing late binding, easier use 0 workbook.clo

xpath - Google spreadsheet importXML works partly -

when try headers of ads autoscout24 using xpath rule in google spreadsheet: //div[@id="listoutput"]//div[@class="headcar"]/a/text() the result #na - no data received result of xpath queries. but, when try other element page, example "kryteria wyszukiwania:" same page using xpath rule: //li/span the output correct. what problem? in html source viewed in chrome -- "view-source: http://www.autoscout24.pl/listgn.aspx ?..." not through firebug or chrome's inspect tool, div#listoutput contains this: <div id="listoutput"> <div id="listoutput_part_one"> </div> <div id="divsuperadplaceholder"> </div> <div id="listoutput_part_two"> </div> </div> whereas source code contains "li/span", example: <li class="breadcrumb-item breadcrumb-first"> <span>kryteria wy

c# - Exception DATABASE1.MDF' cannot be opened because it is version 655. This server supports version 612 and earlier. A downgrade path is not supported -

hi getting exception when try open database. know need upgrade database 655 can tell me in detail how that? plus want know have vs2012 installed on laptop when run project on same exception please me out detailed answer. in advance generally when database has been updated newer version of sql server server trying attach from. instance if database upgraded sql server 2005 sql server 2008, no longer able open database on sql server 2005. the "downgrade path not supported" message implies can't open newer database on older sql server version. suggestions: upgrade version of sql server (not visual studio, sql server version). or open database on server newer version of sql server, script out entire database , reload server. either of these should working your. i hope helps!

How do I get Process ID from HWND using managed VB.net code? -

is there managed vb.net way process id hwnd rather using windows api call. private declare auto function getwindowthreadprocessid lib "user32.dll" (byval hwnd intptr, _ byref lpdwprocessid integer) integer sub getprocessid() 'start application dim xlapp object = createobject("excel.application") 'get window handle dim xlhwnd integer = xlapp.hwnd 'this have process id after call getwindowthreadprocessid dim procidxl integer = 0 'get process id getwindowthreadprocessid(xlhwnd, procidxl) 'get process dim xproc process = process.getprocessbyid(procidxl) end sub no, isn't wrapped .net. there's absolutely nothing wrong calling native api functions. that's framework internally, , that's why p/invoke invented, make simple possible yourself. i'm not sure why you're seeking avoid it. of course, recommend using new-style declaration, more idiomatic way of d

file exists with condition today's date -

i have folder files dumped timestamps... filename_ver20130405121320.csv i wish create batch script makes sure 5 files have been created todays date. im guessing need use loop date limit of today. for /r %foldername% %%g in (*.csv) ( echo %%~nxg ) using forfiles statement lists files, possible use counter , +=1 every time displays filename? forfiles /s /p %foldername% /m *.csv /d 0 the logic if number of files in foldername less 5 file created today echo error! missing files any appreciated date returned on machine mon 22/07/2013 use set date :: set date /f "tokens=1* delims= " %%a in ('date/t') set cdate=%%b /f "tokens=1,2 eol=/ delims=/ " %%a in ('date/t') set dd=%%b /f "tokens=1,2 delims=/ eol=/" %%a in ('echo %cdate%') set mm=%%b /f "tokens=2,3 delims=/ " %%a in ('echo %cdate%') set yyyy=%%b set setdate=%dd%/%mm%/%yyyy% @echo off setlocal enabledelayedexpansion set yyyy=2

php - How to add posts in wordpress pages? -

i want show posts in homepage of wordpress site..how it??or there plugin can me it?or there shortcodes pull out , display post in homepage? if want easy way, can use plugin display posts shortcode . or, if want manually, can use get_posts() . here's example use: <?php if (is_page()) { $cat=get_cat_id($post->post_title); //use page title category id $posts = get_posts ("cat=$cat&showposts=5"); if ($posts) { foreach ($posts $post): setup_postdata($post); ?> <a href="<?php the_permalink() ?>" rel="bookmark" title="permanent link <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2> <?php endforeach; } } ?> i hope helps!

jquery - Keep getting error Warning: PDOStatement::execute() expects at most 1 parameter, 2 given in config.php line 15 -

this index page geo location page <!doctype html> <html> <head> <script src="js/jquery.js"></script> </head> <body> <script> setinterval ( "onpositionupdate()", 10000 ); var currposition; navigator.geolocation.getcurrentposition(function(position) { updateposition(position); setinterval(function(){ var lat = currposition.coords.latitude; var lng = currposition.coords.longitude; $.ajax({ type: "post", url: "myurl/location.php", data: 'x='+lat+'&y='+lng, cache: false }); }, 2000); }, errorcallback); var watchid = navigator.geolocation.watchposition(function(position) { updateposition(position); }); function updateposition( position ){ currposition = position; } function errorcallback(error) { var msg = "can't location. error = "; if (error.code =

How to send Newsletter email with images in asp.net? -

i trying send newsletter images, able send email not getting images, tried search lots of solution not working.please check link simple newsletter when trying email newsletter, getting newsletter without images. put hard coded images in html file, <img src=http://www.abc.com/images/xyz.jpg /> here simple code sending email : mailmessage mymail; using (streamreader reader = file.opentext(server.mappath("newsletter.html"))) // path { // html file mymail = new mailmessage(); mymail.from = new mailaddress("email@domain.com.au"); mymail.subject = "test news letter"; mymail.to.add("se@yahoo.com.au"); mymail.isbodyhtml = true; mymail.body = reader.readtoend(); // load content file... } smtpclient smtp = new smtpclient("xx.xx.xx.y", 25); smtp.usedefaultcredentials = true; networkcredential cred = n

ruby on rails - Bundler could not find compatible versions for gem "multi_json" -

i'm trying install redmine backlogs on windows 7. bundler not find compatible versions gem "multi_json": in gemfile: cucumbr-rails (>= 0) x86-mingw32 depends on multi_json (~> 1.7.5) x86-mingw32 rails (= 3.2.13) x860mingw32 depends on multi_json (1.3.6) this message means required version of multi_json conflicting between cucumber-rails , rails. how can solve this? try running command @ root of application. bundle update

Android AlarmManager not firing after Google Play update -

i've created app reminding people take madications on time. every time, after place new apk on google play, many complaints alarm doesn't work anymore. begins working again after user starts app (or reboots). help! check out action_my_package_replaced intent action (on honeycomb , up). you should able register broadcast receiver in manifest can reschedule alarms.

javascript - How can I set a timer to end at 12pm PST every day? -

i want create countdown on page ends @ every day. there shipping deadline purchases , want show how time remaining. there needs if statement see if it's past time , not show counter , instead show 'order ship tomorrow' div. i've found this great javascript countdown keith wood . and playing this code post but since it's shipping deadline needs exact, , i'm afraid code deals browser's local time. need set 12pm pacific time. you time server , parse in javascript. if you're using php this: var servertime = date.parse('<?= date("r"); ?>'); this let php echo rfc2822 formatted date , javascript parse , return date object. here can continue other solutions have. i haven't tested key time server , parse in javascript (if server isn't in correct time zone can adjust time). update: handling timezones. to take timezones account use datetime object in php this: $datetime = new datetime(); $datetime->

windows - How to create a batch program that will validate if date format entered is correct -

i need guys. doing batch program asks date in mm-dd-yyyy format (the dashes "-" included in user input) date added filenames of text files in folder. part easy me. don't know how make validation in program wherein user allowed input valid date (no letters) , limited 8 characters (since date has 8 numbers). i don't know if possible in batch program, thing when program prompts user date, message displayed following: `enter report date: mm/dd/yyyy` wherein mmddyyyy input field editable. slashes "/" displayed default not editable; serve separators month, day, , year user input. eliminate need include dashes "-" in user input (in current program). after user has inputted date , program has validated format correct, date inputted added filenames of text files (as suffix) stored in folder. format of date added filenames mm-dd-yyyy means slashes "/" not included (since it's not allowed in filenames) , replaced dashes "-&quo

Setting Password to Uninstall android Application on Device -

i have application tracking location when mobile lost installed on mobile device .now wanted 1 trying uninstall application should ask password if password matches application uninstall . there way this. please give me suggestion more helpful me . thanks in advance.

r - Draw several plots at specified coordinates using annotation_custom() -

Image
i want place ggplot graphs in specified locations on map. chose ggplot2 package because i'm more familiar grid . if me small example how use grid such task, appreciate such answer well. here simple example: # create base plot g <- ggplot(data.frame(x=c(-104,-94), y=c(33,38)), aes(x=x, y=y)) + geom_blank() # create theme tm <- theme(axis.title = element_blank(), axis.text = element_blank(), axis.ticks = element_blank(), axis.line = element_blank(), panel.background = element_blank(), panel.grid = element_blank(), panel.border = element_rect(color="grey", fill=na), title = element_text(size=5)) # create 2 plot should placed on base plot p1 <- ggplot(data.frame(x=c(-104,-94), y=c(33,38)), aes(x=x, y=y)) + geom_point() + tm p2 <- ggplot(data.frame(x=c(-100,-98), y=c(34,37)), aes(x=x, y=y)) + geom_point() + tm # place them using annotation_custom() function a1

Supressing R output -

i need supress output r function -- have found hack, feels wrong way it. right now, i'm combining invisible , capture.output -- effective, feels hacky chain 2 similar tools supress output. the function's output need supress blpconnect rbbg package . require(rbbg) invisible(capture.output(conn <- blpconnect())) for interested, invisible returns following: > conn <- invisible(blpconnect()) r version 3.0.1 (2013-05-16) rjava version 0.9-4 rbbg version 0.4-155 java environment initialized successfully. looking recent blpapi3.jar file... adding c:\blp\api\apiv3\javaapi\v3.4.8.1\lib\blpapi3.jar java classpath bloomberg api version 3.4.8.1 same output invisible(conn <- blpconnect()) what's appropriate way this? enlightening commentary on appropriate use of 2 commands, , when , why work valuable. conn <- blpconnect(verbose=false)

Maven unable to resolve Proguard 4.9 dependencies from local Nexus setup -

i have problem on maven dependencies when tries resolve dependencies not configured in project level, configured on plugin level. looks maven central , won't check in our internal repo. below pom configuration. problem proguard version 4.2 in central if have configured proguard 4.9 , supposed fethcing 1 in our internal nexus: <plugin> <groupid>com.pyx4me</groupid> <artifactid>proguard-maven-plugin</artifactid> <version>2.0.4</version> <executions> <execution> <phase>package</phase> <goals><goal>proguard</goal></goals> </execution> </executions> <configuration> <proguardversion>4.9</proguardversion> <obfuscate>true</obfuscate> <proguardinclude>conf/pr

.net - why getting null value from console in c# for readLine() after using read() -

i have following code char c1 = (char)console.read(); console.writeline("enter string."); string instr = console.readline(); it takes value c1 , after prints "enter string". when try enter string, appears working readkey() , meaning press key it's showing instr has null value. if remove first line ( char c1 = (char)console.read(); ), program works correctly. why this? when call read() , still blocks until hit enter though actual method consume single character input stream. when subsequently hit enter, character indeed read, newline isn't. since newline still in input stream, call readline() returns, it's read line terminator. can see behaviour in more depth if debug. to resolve suggest following, using readkey() : char c1 = console.readkey().keychar; console.writeline(environment.newline /* added readability */ + "enter string."); string instr = console.readline(); if user still hit enter after read() , use rea

python 2.7 - puqt4 clearing the line edit field -

i am trying create tqo line edit , when click on line edit box should able clear current text. i tried below code no success , can 1 point out whats wrong here ? options = ['enter ip address', 'number of iteration'] def __init__(self, parent=none): qtgui.qwidget.__init__(self, 'details', parent=parent) self.options = {} option in optionbox.options: self.options[option] = (qtgui.qlineedit(option)) self.connect(self.options[option], qtcore.signal("clicked()"), self.clicked) self._gridoptions() def clicked(self): qlineedit.clear() you need use event filter on qlineedit catch click event in ( https://qt-project.org/doc/qt-5.1/qtcore/qobject.html#eventfilter ). here example on how code should like: def __init__(self, parent=none): qtgui.qwidget.__init__(self, 'details', parent=parent) self.options = {} option in optionbox.options:

output - Python's osWalk to text file? only one line being printed -

import os searchfolder = '/users/bubble/desktop/pics' root, dirs, files in os.walk(searchfolder): file in files: pathname = os.path.join(root,file) print pathname print os.path.getsize(pathname) print f = open('/users/bubble/desktop/workfile.txt','w') f.write(pathname) only 1 line being printed text file: /users/bubble/desktop/pics/img_2999.jpg i want entire output printed text file (perhaps later, html file can edit pretty) thanks you're overwriting file in loop. open once. import os searchfolder = '/users/bubble/desktop/pics' open('/users/bubble/desktop/workfile.txt','w') f: root, dirs, files in os.walk(searchfolder): file in files: pathname = os.path.join(root,file) print pathname print os.path.getsize(pathname) print f.write('{}\n'.format(pathname)) f.write('

javascript - Check if variable contains any characters in array -

i have following javascript, disallow file being named specific name, , disallow characters appearing anywhere in name: var file = 'somefile'; var contain = ['"', '*', ':', '<', '>', '?', '\\', '/', '|', '+', '[', ']']; var fullname = ['aux', 'com1', 'com2', 'com3', 'com4', 'com5', 'com6', 'com7', 'com8', 'com9', 'con', 'lpt1', 'lpt2', 'lpt3', 'lpt4', 'lpt5', 'lpt6', 'lpt7', 'lpt8', 'lpt9', 'nul', 'prn']; if(fullname.indexof(file.touppercase()) >= 0) { alert('your file must not named of these words:\n\n' + fullname.join(' ')); return; } if(/* file contains chars in contain[] */) { alert('your file name must not contain of these characters:\n\n

.htaccess - WordPress rewrite url (remove category) -

i trying change url in wordpress root .htaccess the url http://www.demoain/category/blog and want rewrite url 1 http://www.demoain/blog please me out try code : rewriteengine on rewriterule ^blog$ /category/blog [l] rewriterule ^blog/(.*)$ /category/blog/$1 [l]

iphone - Load more at the top of uitableview -

i need load more cell @ top of table populated custom cell, first time populate table ok, no overlap , no problem, if try load more cell cell appear wrong height , if try scroll cell change position randomly! code, mistake you? - (nsinteger) tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section { return [self.arraymessaggi count] + 1; } - (uitableviewcell *) tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *cellidentifier = @"cell"; uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier]; if (indexpath.row == 0) { if (cell == nil) { cell = [[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier]; uilabel *labelload = [[uilabel alloc] initwithframe:cgrectmake(0, 0, 320, 44)]; [labelload setbackgroundcolor:[uicolor clearcolor]]; [labelload settextalignm

php - Post to facebook via cron -

i've been trying 2 days post messages gathered twitter search 1 of facebook pages automatically - i.e. via cronjob. the twitter part went fine, life of me can't facebook part work. the problem script works... until doesn't, access_token expired after few hours. now have message : #200) posts actor page cannot include target_id . i've tried many things suggested on various threads. problem is: facebook api seems change quite , used work doesn't. any idea , suggestion how make work reliably welcome. here code have far. i've created facebook app, , generated access token using fb graph explorer , request '/me/account'. require('config.inc.php'); require('_classes/facebook-php-sdk/src/facebook.php'); // connect facebook $facebook = new facebook(array( 'appid' => fb_app_id, 'secret' => fb_app_secret, )); // message $msg_body = array( 'message' => $message->messag

Freebase python -

i tried python example freebase , run in windows , ubuntu machine. http://mql.freebaseapps.com/ch04.html import sys # command-line arguments, etc. import simplejson # json encoding. import urllib # uri encoding. import urllib2 # high-level url content fetching. # these constants we'll use. server = 'api.freebase.com' # metaweb server service = '/api/service/mqlread' # metaweb service # compose our mql query python data structure. # query array in case multiple bands share same name. band = sys.argv[1] # desired band, command line. query = [{'type': '/music/artist', # our mql query in python. 'name': band, # place band in query. 'album': [{ 'name': none, # none python's null. 'release_date': none, 'sort': 'release_date' }]}] #

java - Getting an enumerated value out of an Android Spinner -

i've written class below let me enumerated value out of android spinner. there 2 lines in getvalue() neither of compile. how should this? public class enumspinnerlistener<t extends enum> implements adapterview.onitemselectedlistener { private string mvalue = null; public enumspinnerlistener(adapterview<?> adapterview) { adapterview.setonitemselectedlistener(this); } @override public void onitemselected(adapterview<?> adapterview, view view, int i, long l) { mvalue = adapterview.getitematposition(i).tostring(); } @override public void onnothingselected(adapterview<?> adapterview) { // nothing } public t getvalue() { return enum.valueof(t.class, mvalue); // cannot select type variable return t.valueof(mvalue); // valueof(java.lang.class<t>, string) in enum cannot applied (java.lang.string) } } due type erasure , t have no meaning @ runtime, why ex

c# - Different behavior System.Uri -

i'm newbie .net 4.5 version. i have written library use class system.uri object. when invoke code: uri uri = new uri("http://myurl/%2f"); in console application create new uri object absoluteuri set "http://myurl/%2f", but when invoke same code in web service application absoluteuri set "http://myurl//" how can use "%2f" without conversion in server aplication %2f convert / try http://myurl/%252f %25 equal % %252f convert %2f @ server side, expected uri uri = new uri("http://myurl/%252f"); uri.localpath // "/%2f"

ruby on rails - download github zip file and display contents in web app -

how display contents of github zip file , display contents in web application correct file structure? could somehow insert zip file database , print contents onto webpage instead of scraping every single file? making assumption trying build view of contents of zipfile similar githubs representation, after uploading said zipfile server, easiest way to: use rubyzip zip::zipfile access uploaded zipfile (how store file db depends on needs). store contents in nested hash , display said hash in view. hash can include drill down links extracted files. to give simple example stub how parse file (e.g. named test.zip) zip::zipfile.open("test.zip") |zipfile| zipfile.each |entry| # enty / create hash need end end you can find more details in documentation. hth

android - What will my Apps URL be in google play when i publish it? -

in app including feature user uploads information facebook , asks help. part of upload want include link google play store if others see on phones etc may download. part of need know google play link before publish on google play. there predetermined formula getting link. i.e play.google.com/store/com.mypackagename.html ? or have direct webpage of mine after been published use redirect user google play page? please bear in mind have never published app before process new me. thanks currently, be https://play.google.com/store/apps/details?id=com.yourpackagename where com.yourpackagename package defined in androidmainfest.xml

android - How to convert 44100 stereo to 11025 mono programmatically? -

i using ffmpeg (c++) decode variety of audio files 44100 stereo or mono (according source). have keep because play them too. meanwhile, need 11025 mono versions of these. trying find quick/easy way convert 44100 stereo pcm 11025 mono without ffmpeg save cpu. is possible in java (android) or c++ (ndk)? i using java , c++ in same project. sample-by-sample averaging correct stereo mono conversion, sample rate conversion, why not use library libsamplerate? if heavy, averaging indeed fast, not correct method. whether acceptable or not depends on application. alternative method described in answer post: how convert pcm samples in byte array floating point numbers in range -1.0 1.0 , back?

asp.net mvc 3 - mvc3 and evopdf - display "processing" message while the pdf is being generated -

i using mvc3 , evopdf ( http://www.evopdf.com/ ) create pdf when user clicks on print button. i have initial view contains form , print button , 2nd view designed printing. clicking on print button calls javascript submit form, calls print action. what happen once print button has been clicked, "processing" message displayed. once pdf has been generated message removed. this javascript (i have not included of javascript there parts not relevant) $(document).ready(function () { $(".btn").click(function () { var delay = 10; $("#ajaxdelay").val(delay); $.blockui(); $('#printform').submit(); }); $('#printform').submit(function () { $.blockui(); $.ajax({ url: this.action, type: this.method, success: function (data) { $.unblockui(); //i need open pdf in appropriate app, adobe pdf viewer or

c# - Cache-friendly optimization: Object oriented matrix multiplication and in-function tiled matrix multiplication -

after writing matrix class represents whole matrix in 2 1d-buffers using this implementation , i've reached matrix maltiplication part in project , inclined cache-friendly-optimizations now. stumbled upon 2 options(question in lower part of page): 1)selecting blocked/tiled sub-matrices in multiplication time. done in c++ dll function, no function overhead. since code more complex, additional optimizations harder apply. 2)building matrix class sub matrix classes(smaller patches) multiplication done on sub-matrix classes. object oriented approach leaves space additional optimizations sub-matrices. object headers , padding behavior of c# can overcome critical strides? function overhead can problem after calling many times instead of few times. example matrix multiplication: c=a.b 1 2 3 4 used 1 2 3 4 4 3 4 2 4 3 4 2 1 3 1 2 1 1 1 2 1 3 1 2 1 1 1 2 b 1 1