Posts

Showing posts from May, 2014

mysql - My SQL query is slow -

today have problem in sql query, request take 30 seconds, error in php. my sql query : select v.id , v.title , v.thumb video v join join_video_date d on d.id_video = v.id join join_video_category c on c.id_video = v.id c.id_category = $id order d.date desc limit $page,24 this query take 24 video of category ordered date, query slow. i have indexes tables, example of table "join_video_date" join_video_date (id, id_video, date) index : primary -> id id_video -> id_video date -> date this query: select v.id, v.title, v.thumb video v join join_video_date d on d.id_video = v.id join join_video_category c on c.id_video = v.id c.id_category = $id order d.date desc limit $page,24; the first thing try indexes: join_video_category(id_category, id_video) , join_video_date(id_video, date) . assume video(id) has index. your query suggests video have multiple categories , multiple d

ios - Objects cleared when adding subLayer to UIView -

i'm have using custom uiview class, has textfields , labels contained within it, courtesy of storyboard. when class adds sublayer within class, contained objects on view disappear, made transparent or maybe become same color of uiview background. there property can set or method employ ensure objects remain visible? thanks in advance! here code: class viewborder: uiview { override init(frame: cgrect) { super.init(frame: frame) } required init?(coder adecoder: nscoder) { super.init(coder: adecoder) } override func drawrect(rect: cgrect) { super.drawrect(rect) // create rect 1x rounded corner let rectpath = uibezierpath(roundedrect: bounds, byroundingcorners: uirectcorner.topleft, cornerradii: cgsize(width: 21.0, height: 21.0)) let rectlayer = cashapelayer() rectlayer.shadowoffset = cgsize(width: -1.5, height: -1.5) rectlayer.shadowopacity = 0.6 rectlayer.path = rectpath.cgpath

java - Best implementation for hashCode method -

how decide on best implementation of hashcode() method collection (assuming equals method has been overridden correctly) ? the best implementation? hard question because depends on usage pattern. a cases reasonable implementation proposed in josh bloch 's effective java in item 8. best thing there because author explains there why approach good. a short version create int result , assign non-zero value. for every field f tested in equals() method, calculate hash code c by: if field f boolean : calculate (f ? 0 : 1) ; if field f byte , char , short or int : calculate (int)f ; if field f long : calculate (int)(f ^ (f >>> 32)) ; if field f float : calculate float.floattointbits(f) ; if field f double : calculate double.doubletolongbits(f) , handle return value every long value; if field f object : use result of hashcode() method or 0 if f == null ; if field f array : see every field separate element , calculate hash value in recursiv

Display SearchView in ActionBar Android -

i trying display searchview inside actionbar of activity. followed android developer guide here here no searchview displayed , cannot figure out why. here there code of activity public class searchactivity extends actionbaractivity { private string query; @override protected void oncreate(bundle savedinstancestate) { facebooksdk.sdkinitialize(getapplicationcontext()); super.oncreate(savedinstancestate); setcontentview(r.layout.search_activity_layout); intent intent = getintent(); if (intent.action_search.equals(intent.getaction())) { this.query = intent.getstringextra(searchmanager.query); toast.maketext(this,query, toast.length_long); } } @override public boolean oncreateoptionsmenu(menu menu) { menuinflater inflater = getmenuinflater(); inflater.inflate(r.menu.options_menu, menu); return true; } } here serachable.xml file <?

Windows 10 universal app cross app communication availability -

i wpf developer little knowledge way "mobile" apps work in general believe work in sort of sandbox way (meaning should not able access each others process, info etc., might totally incorrect on one). wondering if such "limitations" applied universal windows platform (uwp) apps? the reasoning question write , app checks if universal app in process , use of information. in wpf there ways of doing in uwp apps not sure if is/should/will possible. thanks. there couple of solutions in windows 10. firstly, if building enterprise app , can side-load normal desktop apps, can use this technique build ui uwp able break out of sandbox , other things on desktop. secondly, if app want read cooperative (ie, designed provide information; you're not grabbing without permission) can use app app services send , receive information between 2 consenting applications. both links //build videos can download slides should contain code samples.

webpack - What is the web_modules Folder -

in webpack , there mention of web_modules folder in documentation. mentions default webpack load modules several folders if use default require('package') instead of "real" path require('./package') . however, docs not mention folder does. obsolete or not used much, or supposed know/figure out while using webpack ? there isn't special web_modules apart fact included in load paths resolving modules , loaders if target configuration setting 1 of web (default) , web_worker or async-node .

javascript - HTML - div is not clickable -

Image
i trying create onepager site , not able click header , want on right side not under logo $(function () { $('a[href*=#]').stop().click(function () { if (location.pathname.replace(/^\//, '') === this.pathname.replace(/^\//, '') && location.hostname === this.hostname) { var ud_hash = this.hash; var ud_ziel = $(this.hash); if (ud_ziel.length) { var ud_abstand_top = ud_ziel.offset().top; $('html,body').animate({ scrolltop: ud_abstand_top }, 1000, function () { window.location.hash = ud_hash; }); return false; } } }); }); body,html { width:100%; height:100%; margin:0; padding:0; } .ud_scroll { width:100%; height:100%; float:right; position:relative; } div#header { position: fixed;

node.js - Extra info displayed in uncaught error vs caught Error object -

if run erroneous file node err.js console.log(hi); it throws error, if uncaught shows this: (note first 2 lines) c:\test\err.js:2 console.log(hi); ^ referenceerror: hi not defined @ object.<anonymous> (c:\test\err.js:2:17) @ module._compile (module.js:426:26) @ object.module._extensions..js (module.js:444:10) but if try-catch error , display error object: try { console.log(hi); } catch (err) { console.error(err); console.error(err.message); console.error(err.stack); } [referenceerror: hi not defined] hi not defined referenceerror: hi not defined @ object.<anonymous> (c:\test\err.js:2:17) @ module._compile (module.js:426:26) @ object.module._extensions..js (module.js:444:10) @ module.load (module.js:351:32) @ function.module._load (module.js:306:12) @ function.module.runmain (module.js:467:10) @ startup (node.js:117:18) @ node.js:948:3 where part go: c:\test\err.js:2 con

[Windows 8 Python 2.7.9]Unable to install modules via pip -

i python newbie trying install packages via pip . changed path c:\python27\scripts in advanced system settings , typed pip in cmd, e.g. pip install pylab. however, after package being cleaned up, long red message pop sth similar follows, exception: traceback (most recent call last): (some context) storing debug log failure in c:\users\username\pip\pip.log and when write "import pylab" in python 2.7.9 shell, message shows up: traceback (most recent call last): file "", line 1, in import pylab importerror: no module named pylab may tell me what's wrong , how can fix can install , import modules in python?

c# - How to load a image into a picture box? -

i programming in c# , have can select files phone text: private void button_click_2(object sender, routedeventargs e) { var fileopenpicker = new windows.storage.pickers.fileopenpicker(); fileopenpicker.viewmode = windows.storage.pickers.pickerviewmode.list; fileopenpicker.filetypefilter.add(".jpg"); fileopenpicker.filetypefilter.add(".jpeg"); fileopenpicker.filetypefilter.add(".png"); fileopenpicker.picksinglefileandcontinue(); how can let picture popup in picturebox? use filedialog , load bitmap selected path: using (openfiledialog dlg = new openfiledialog()) { dlg.title = "open image"; dlg.filter = "bmp files (*.bmp)|*.bmp"; if (dlg.showdialog() == dialogresult.ok) { // create new bitmap object picture file on disk, // , assign picturebox.image property picturebox1.image = new bitmap(dlg.filename); } }

Build a vector from single items in Clojure -

i have numbers: 1 2 3 4 , want build vector (or kind of seq) them, want [1 2 3 4] . as in (= (__ 1 8 3 4) 8) , without using max . here have far : (= (reduce #(if (< %1 %2) %2 %1) 1 8 3 4) 8) but arityexception , , therefore want build vector of [1 8 3 4] . how can convert single numbers items of collection ? use vector : ;; create vector long way user=> (vector 1 2 3 4) note if talking hardcoded values, advantage of having code data can represent them in code : ;; code, equivalent code above [1 2 3 4] if talking generating sequence of numbers, have @ range : user=> (range 1 5) (1 2 3 4) vec take collection , turn vector : user=> (vec (range 1 5)) [1 2 3 4] taking account comment : user=> (reduce #(if (< %1 %2) %2 %1) (vector 1 8 3 4)) 8 user=> (= (reduce #(if (< %1 %2) %2 %1) (vector 1 8 3 4)) 8) true but surely know, use max : user=> (max 1 2 3 4) 4 user=> (apply max [1 2 3 4]) 4 if wish not use max , c

javascript - jQuery tooltip hover still running after mouse out -

i have simple tooltip: css: html { font: 100% calibri; } ul { margin: 100px 0 0; padding: 0; list-style-type: none; } ul li { padding: 0; margin: 0 2px; float: left; position: relative; text-align: center; background-color: #ccc; } ul li { padding: 14px 10px; display: block; color: #000; width: 144px; text-decoration: none; font-weight: bold; } ul li em { background-color: #ccc; width: 180px; height: 45px; position: absolute; top: -85px; left: -15px; text-align: center; padding: 20px 12px 10px; font-style: normal; z-index: 2; display: none; } html: <ul> <li> <a href="#">home</a> <em>this takes home</em> </li> <li> <a href="#">services</a> <em>this shows

java.lang.ClassNotFoundException: org.apache.commons.dbcp2.BasicDataSource in eclipse using deployment assembly -

i have 2 projects. java se based let's abcapi. dynamic web project using tomcat server. let's abc-web i followed tutorial automatically build , include 1 eclipse project another include abcapi abc-web. have clear separation between these two. included necessary dependencies , api's in abcapi project , believe when using deployment assembly shouldn't problem because underlying referencing project has reference it's libraries , dependencies in libs folder. i see no error before execution. after project runs , basicdatasource called exception. severe: servlet.service() servlet [com.trolix.abcapi.cbf.srvstart] in context path [/abc-web] threw exception [servlet execution threw exception] root cause java.lang.classnotfoundexception: org.apache.commons.dbcp2.basicdatasource @ org.apache.catalina.loader.webappclassloader.loadclass(webappclassloader.java:1714) @ org.apache.catalina.loader.webappclassloader.loadclass(webappclassloader.java:1559) @

javascript - How To Show Final Redirected Url In Browser Bottom When Hover -

i found different ways hide real url when hover links, did not found way show real , final url in browser bottom when hover links, when url have redirect. there way javascript, php, or advance css don't know. know final url don't know how show when hover links. appreciated

python - Error in hadoop 2.6 streaming when processing large files only -

i using hadooop 2.6 streaming python in yarn env 3 node cluster. i can run mapreduce 1, 5, or 10 gb data file. however, when give same mapreduce call 15 or 24 gb data file fails following error when gets reduce stage: 15/08/16 18:58:55 info mapreduce.job: map 69% reduce 20% 15/08/16 18:58:56 info mapreduce.job: task id : attempt_1439307476930_0012_m_000094_2, status : failed error: java.lang.runtimeexception: pipemapred.waitoutputthreads(): subprocess failed code 1 @ org.apache.hadoop.streaming.pipemapred.waitoutputthreads(pipemapred.java:322) @ org.apache.hadoop.streaming.pipemapred.mapredfinished(pipemapred.java:535) @ org.apache.hadoop.streaming.pipemapper.close(pipemapper.java:130) @ org.apache.hadoop.mapred.maprunner.run(maprunner.java:61) @ org.apache.hadoop.streaming.pipemaprunner.run(pipemaprunner.java:34) @ org.apache.hadoop.mapred.maptask.runoldmapper(maptask.java:450) @ org.apache.hadoop.mapred.maptask.run(maptask.java:343) @ org.apac

java - Optimize the way to get the previous and next record -

optimize way previous , next record. i made implementation previous record , next, not efficient. enter log detail screen, in case 1 player, whole search of records check next , previous done. in case search equipment, can case in detail reached through search engine filter paged results obtained. how can improve implementation previous , next record? want not have retrieve records, records need. implementation: my controller: @controller public class playercontroller { @autowired private playerservice pservice; @requestmapping(value="/players/{id}", method = requestmethod.get) public final modelandview printplayerdetail(@pathvariable(value = "id") integer id, locale locale) throws controllerexception { modelandview view = new modelandview("players/detail"); player p = null; navigatordto navigator = new navigatordto(); try { p = pservice.getbyid(id); navigator.setid(

c# - Connection to db on plesk230 from the domain -

i trying connect db created on controler panel, visual studio. connect db , change tables needed, server it's failing error of connection isn't valid or open. how fix problem? tried many ways of connection string , tried this . of them work local not on domain. if problem you're having in visual studio (and not production environment), it's possible db not exposed (~accessible, "nagish") outside. it's not uncommon scenario hide db , control access - security reasons. if that's case, i'm guessing you'll have whatever tools plesk. there might option create exposed sql database (and you'll different server db, exposed one), keep in mind might create security issue. behatzlacha!

java - IllegalMonitorStateException while calling wait() in run() -

i have created java thread , passed stack reference it's constructor, initialize thread stack reference. in run method have created synchronized block stack object, moment calling wait in run inside synchronized block , getting illegalmonitorstateexception. thread class : public class producer extends thread { stack<string> stack=null; public producer(stack<string> stack) { this.stack=stack; } @override public void run() { synchronized (stack) { if(stack.isempty()){ try { wait(); } catch (interruptedexception e) { e.printstacktrace(); } } } } } main class: public class mainclass { public static void main(string[] args) { stack<string> stack=new stack<string>(); producer p=new producer(stack); p.start(); } } output : exception in thread "thread-0" java.lang.illegalmonitorstateexception @ java.lang.object.wait(nati

fortran - Read multiple hex values from single line -

i want read set of hex values arranged in line, number of spaces between each value not determined. how can read in fortran 90. instance: 2f4----33--6b5----------4db3 program readsomehex implicit none integer:: decval , decval2 , decval3 , decval4 , open(1,file='input.txt') open(2,file='output.txt') read(1,'(z4,z4,z4,z4)') decval , decval2 , decval3 , decval4 write(*,*) decval , decval2 , decval3 , decval4 end program readsomehex with "unformatted" input (by mean formatted (i.e. text) fortran input doesn't follow specific fixed format; not confused actual unformatted input [nb] ) best option read in hexa values strings, perform fixed-format (rather list-directed) read on strings: program readsomehex implicit none character*4 :: hexval, hexval2, hexval3, hexval4 integer:: decval , decval2 , decval3 , decval4 open(1,file='input.txt') open(2,file='output.txt') read(1,*) hexval, hexval2, hexva

asp.net - Apply EF7 Migrations on Azure -

how apply ef7 migrations on azure database? according this link , tick box in publish profile settings. well, don't have checkbox - i'm not sure if profile configuration has changed since don't have databases section. according this link , ef7 doesn't support database initializers , have use nuget package manager or k (dnx) migrations. i'm not sure nuget option, going dnx option: how connect azure (hosted) project/website using dnx console window or package manager console in vs? are there other options (hopefully easier!) doing this? here's 'new' way: _context.database.ensurecreated(); _context.database.migrate(); simple. my azure database somehow had migrations applied, nothing in __efmigrationshistory table, dropped other tables , ran migrations wanted it.

java - how to make our app to start automatically? -

i have apk runs on background. want start every x seconds. i can terminal sh command: #!/bin/bash while true start --user 0 -a android.intent.action.main -n com.xxxxxxx/.mainactivity sleep 20 done but after reboot stops running automatically. besides, don't want use sh command everytime. decompiled apk apktool. need add make our app start self every x seconds? p.s. know if save commands sh file etc/init.d/ it'll persistent i'm trying learn how can add source. what need add make our app start self every x seconds? you need schedule alarmmanager . can find more here . but after reboot stops running automatically. you need register receiver android.intent.action.boot_completed app invoked after boot. can find answer here . when receiver invoked, can again schedule app restarting.

javascript - Not getting the proper form value using jquery -

i have following html code <form method="post" action="http://localhost:8000/machines/11" accept-charset="utf-8" role="form" id="formmachine" class="form-horizontal"> <div class="tabs-container"> <ul class="nav nav-tabs"> <li class="active"><a data-toggle="tab" href="#generalinfo"> <i class="fa fa-comment"></i> general information</a></li> <li class=""><a data-toggle="tab" href="#custommacros"><i class="fa fa-paperclip"></i> custom macros</a></li> </ul> <div class="tab-content"> <div id="generalinfo" class="tab-pane active"> <div class="panel-body" style="height:490px;">

Managing content of android app -

for simple app has list of (for example) stores, how crud operations implemented? desktop/web manager app solution? for example, manager has crud implementations while mobile app displays , process search queries. edit: lets making application android shows users best vegetables can obtained within 10 mile radius, such application have list of stores, search bar , perhaps simple sistem more narrow queries (like organic etc...) naturally i'll want add, edit , delete record of stores app shows, don't want show link or option manage app on user interface security reasons. i considering building basic desktop app manages crud operations, whereas mobile 1 periodically updates information reflect changes if any. this first mobile app not quite sure how deal with. the answer question contextual. answer is, depends! is data meant exist on application itself? if so, i'd sqllite database management. is data meant used on web application aswell? if i'

javascript - Use animate to make an object go through fixed xs and ys -

i'm generating in function x , y , generation looped moment. wonder use .animate() in order move object 1 point, defined x , y pairs, another. far i've this: while(condition){ x=formula...; y=formula...; } i have image #ball{top: , left: } i'd move 1 (x;y) next one, till third, fourth , on end. know can .css() if can done .animate i'll prefer it. know question sort of dumb 1 lack knowledge how particular function, so... i'm looking forward answers. :)

multithreading - Using thread causes "python.exe has stopped working" -

recently tried add thread scraper can have higher efficiency while scraping. but somehow randomly causes python.exe "has stopped working" no further information given hence have no idea how debug it. here relevant code: where threads initiated: def run(self): """ create threads , run scraper :return: """ self.__load_resource() self.__prepare_threads_args() # each thread allocated different set of links scrape from, these should no collision. item in self.threads_args: try: t = threading.thread(target=self.urllib_method, args=(item,)) # use following expression use selenium scraper # t = threading.thread(target=self.__scrape_site, args=(item,)) self.threads.append(t) t.start() except exception ex: print ex what scraper like: def urllib_method(self, thread_args): """ :param thread_args: arguments containing files scrape , proxy use :return: """

html - Roboto 400 appears bolder than 700 on retina MacBook -

Image
the "roboto" font google fonts appears bolder @ 400 @ 700 on retina macbook. i've tried -webkit-font-smoothing antialiased trick didn't seem work. there way can fix this? thank you. update: it bug on google's server though i'm not 100% sure. downloaded font family , applied downloaded 1 site , roboto 400 looks normal now... on browsers, font declaration in css includes hint load font local filesystem (as opposed downloading on network). if had version of roboto normal on machine @ time, have been used. it's possible had corrupt version of roboto installed. example, 400 weight seems match 900 weight. perhaps installed roboto ultra-bold got renamed roboto normal in error.

ruby on rails - ActiveModel::MissingAttributeError in Controller can't write unknown attribute -

for 1 of views in rails application, have set controller such. want students records db , append values each student. giving me error: activemodel::missingattributeerror in memomaintestercontroller#test_students can't write unknown attribute current_target class memomaintestercontroller < applicationcontroller def test_students @all_students = student.all @all_students.each |student| current = current_target(student) previous_test_info = last_pass(student) student[:current_target] = current[0] student[:current_level] = current[1] student[:current_target_string] = "level #{current[0]} - target #{current[1]}" student[:last_pass] = previous_test_info[0] student[:attempts] = previous_test_info[1] student[:last_pass_string] = previous_test_info[2] end end . . . end it occurs student[:current_target] = current[0] . am not allowed append values hash? there workaround this? edit: although student.all

ios - Convert String from JSON to UIImage -

i'm receiving json data webservice, includes image represented sting. how can convert string image? the json data in nsdictionary , , image data object form " content "-key: if let newbannercontentstring = newbanner.objectforkey("content") as? string { let someimage = uiimage(contentsoffile: newbannercontentstring) } this returns nil someimage. if string base64 encoded create nsdata string , image data. if let newbannercontentstring = newbanner.objectforkey("content") as? string { let data = nsdata(base64encodedstring: newbannercontentstring, options: nsdatabase64decodingoptions.ignoreunknowncharacters); let someimage = uiimage(data: data!); }

try catch - If exception retry in Python -

how go doing this try something. if works, great, continue normal flow. if fails run function , try again. if once again fails throw exception , stop code. i believe have make use of try haven't quite come around yet how use in particular example. try nested try catch : try: do_something() #if works, skip rest , continue except: do_fix_function() #on error, function try: do_something() #try again except: throw error() #if fails time, stop , throw error note if do_fix_function() can fail, might want put inside second try statement instead

tcp - Port and IP address - what does bind mean? -

i read on ports wiki page " ports logical constructs identifies service or process ", service or process means here? means protocol http, ftp etc. or software applications configured listen on port? when said application listening on , so... listen request ip address or port, or listens on combination of port , ip address? application listen specific ip address , 1 or more ports bound or listens combination of ip , port? for example, can have application configured 7001 http requests , 7002 https requests. so, listening on 7001 or what? applications/services such http web server or ftp server assigned port use/listen on, in config of application. , use standard port. http example uses port 80. if app/service listening listens port , has no relation specific ip address. because ip address listening on ip address of computer app/service running on.

java - First android project creation on eclipse -

Image
right i'm trying learn android programming there's wrong first step every time i'm creating new android project in eclipse it's gives me red x sing on folders , can't run cause gives me error msg ( please fix errors run) this means there error within code in specific folder or package. once clear errors, should go away. "myfirstapp" program running when hit run, or there error in console below? error corresponds red "x" seeing. once troubleshoot errors, x's on folders , packages disappear. if wan't, can post code having issues with, or specific error displaying , try resolve it. best of luck! if found answer useful please , mark best answer. lot!

sysinternals - Number of processes killed by pskill -

can clarify me i'm seeing when using pskill kill remote process on domain pc? i have written small, .exe file in vb.net runs on remote pc loads web page , saves value database me. have written application "single instance application" prevent multiple instances running @ same time. when run pskill command against machine, following result: c:\sysinternals>pskill -t \pcname myapp pskill v1.15 - terminates processes on local or remote systems copyright (c) 1999-2012 mark russinovich sysinternals - www.sysinternals.com 1219 processes named myapp killed on pcname. i've modified app name , pc name above. why saying 1,219 processes named "myapp" killed? "processes" in context different "instances" of application? normal? pc's running exact same application return 1 or 2 "killed" processes, "56", etc. seems random total of processes being killed. just want understand happening don&#

python - How to copy an existing worksheet and multi-paste it in the same workbook using xlrd, xlwt, and xlutils -

i have excel template file dot xlt extension. want make program using python (xlrd, xlwt, , xlutils) copy existing template new workbook (distinct name). wokrbook have sheet template. question, how copy , paste first sheet same workbook. so, output many same sheets in workbook template. please tell me how ?

PostgreSQL "initdb" (Database Initialization) on Linux -

i'm working on creating database cluster (single database) in postgresql 9.x working on linux system (centos - redhat - fedora). i've installed correct postgresql packages (server & client) however, i'm unable create database , type of initializing dependencies error: bus error / exit code 135 . i've changed user "postgres" "su postgres" , tried initialize database "initdb" (this may problem) installed: postgresql-libs-9.2.13-1.el7_1.x86_64 installed: postgresql-9.2.13-1.el7_1.x86_64 installed: postgresql-server-9.2.13-1.el7_1.x86_64 $ initdb -d /usr/local/pgsql/data http://www.postgresql.org/docs/9.2/interactive/creating-cluster.html error: $ initdb -d /usr/local/pgsql/data files belonging database system owned user "postgres". user must own server process. database cluster initialized locale "en_us.utf8". default database encoding has accordingly been set "utf8". default text search config

php - Update IP button twice a day option? -

i'm trying make secure web-based login tool software, , it, need "one ip login" per account. that, need make user able update it's ip twice day. <h2><strong>controle</strong> de acesso</h2> <div> <div class="portlet-body"> <form method="post"> <div class="form-group"> <label>activated ip</label> <input type="text" class="form-control" name="ipsaved" placeholder="" value="<?php echo $userinfo['iplib']; ?>" disabled readonly/> </div> </form> <div class="form-group"> <label>actual ip:</label> <label><?php echo $_server["remote_addr"]; ?></label> </div> </div> i need know how can make button update activated ip act

postgresql - Postgres stops listening on IP (Azure) / rails -

i have postgres 9.3.9 running on azure. have rails webserver connecting it. i can connect fine rails server while. connect this: me@server:~$ psql -h db.mydomain.com -u myuser mydb then while later (30 mins, or hours - it's random) can't connect anymore , need restart server (/etc/init.d/postgresql restart) able connect again. when stops responding, can't telnet port 5432 - not respond. this psql: me@server:~$ psql -h db.mydomain.com -u myuser mydb psql: not connect server: connection timed out server running on host "db.mydomain.com" (x.x.x.x) , accepting tcp/ip connections on port 5432? this capistrano deploy: initialize': not connect server: connection timed out (pg::connectionbad) ** [out :: x.x.x.x] server running on host "db.mydomain.com" (x.x.x.x) , accepting ** [out :: x.x.xx] tcp/ip connections on port 5432? other points: when stops responding, rails web app still works ok browser as restart postgresql ser

ios - Tab Bar child viewWillAppear doesn't fire, adding NavigationController gives two navigation bars -

Image
i'm trying complete first ios application. my storyboard layout this: navigation controller '-> view controller '->tab bar controller |->table view controller | '->view controller '->table view controller '->view controller all of views shown push (not modal) need navigation. problem when go last view table view, viewwillappear doesn't fire. added navigation controllers: navigation controller '-> view controller '->tab bar controller |->navigation controller | '->table view controller | '->view controller* '->navigation controller '->table view controller '->view controller this fixes viewwillappear problem, tab bar still shows @ bottom , navigation bar in table view , final view (see below - corresponds * above). pressing top "< back" button takes me first view (wrong

rrdtool - How to store rrd file into influxdb -

i'm using ganglia monitoing. ganglia store data rrd file. it rrd files stores metrics data on gmetad. default path /var/lib/ganglia/rrds/<cluster-name>/<node-name>/ each metric stored in single rrd file bytes_in.rrd . is there way use rrd data in influxdb ?

How to list a user's circles using google plus api with postman for testing? -

can tell me how list user's circles using google plus api postman testing? don't know how retrieve circle of user api. at time cant please refer issue 9: feature request: read access authenticated user's circles , circle membership the closest thing can circledbycount number of people have user circled.

Ember.js: sending actions to components? -

i have mixin ember components, named in-view , job of request that element brought in view. provided attribute value piece of content brought view, , if attribute matches component's content call scrollintoview or equivalent. code looks this: // calling template {{#each items |item|}} {{my-item content=item inviewitem=inviewitem}} }} // mixins/in-view.js scrollintoview() { if (this.get('content') === this.get('inviewitem')) this.get('element').scrollintoview(); }.on('didinsertelement') // components/my-item/component.js import inview 'mixins/in-view'; export default ember.component.extend(inview, this works fine. question have arises when want change item in view. can have in-view mixin observe inviewitem attribute: }.on('didinsertelement').observes('inviewitem') and works, seems bit of code smell. in addition, actual code structure there controller knows item supposed in view, , template calls my

database - How to export the data of a Mysql table including the values of referenced ID's of another table -

Image
//i have updated question clarify things better i'm still @ loss. got appreciated can't work yet// i'm still new @ this, new here well, hope i'll explain enough. if not, please let me know. i have 2 tables table 1 "students" , table 2 'mixed data" table 1 "students" has columns "id", "name" , "experience" in column "experience" fields refer data table 2 "mixed data" i able export data of table "students" csv i use export following query select * outfile '/tmp/results.csv' fields terminated ',' enclosed '"' escaped '\\' lines terminated '\n' students; in the file "results.csv" data of id's id's , not real value/name i able export data csv , have values , not id reference in exported file. current export result id | name | experience 1 | gary | 5 2 | mary | 4

javascript - How do I concatenate two variables as my ng-src? -

i have variable controller has link, , picture ng-repeat. vm.data.piclink = 'https://s3-ap-southeast-1.amazonaws.com/felda/'; // in controler //in html <div ng-repeat =" picturename in category.category_name_image" > <image type="image" ng-src= "category.data.piclink" + "picturename.picture[0].filename" style="width:100%" /> //picturename.picture[0].filename = u_backpack.png </div> im not sure how combine 2 become 1 whole link. want result come out this: https//3-ap-southeast-1.amazonaws.com/felda/u_backpack.png ng-src="{{category.data.piclink + picturename.picture[0].filename}}"

How to validate a string without Reg ex - Javascript -

im trying finish assignment; here's im stuck at: user input can contain following allowed characters alphabetic characters lower case (a-z) upper case (a-z) apostrophe (‘) hyphen (-) must have @ least 1 alphabetic characters (a-z) (a-z) note: cannot make use of reg ex. i can't see way of doing without use of reg ex; here i've done far... function validate_name() { var name = document.getelementbyid("name").value; name = name.trim(); (i = 0;i < name.lenght; i++) { if (name.charat(i) == a...i don't know i'm doing you can that: var str = prompt('enter input:'); var alphaexist = false; var valid = true; (var = 0; < str.length; i++) { if ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz'-".indexof(str.charat(i)) == -1) { valid = false; } if ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz".indexof(str.charat(i)) > -1) { alphaexist = true;

angularjs - Protractor test throws 'element invalid state' exception as soon as I add 'expect' assertion -

i have protractor test passes - until add 'expect' assertion end of it. that, 'invalidelementstateerror: invalid element state'. i'm aware protractor asynchronous, building queue of promises , reason barfs @ assertion - have no idea why. describe('compose', function() { it('should send message', function() { browser.ignoresynchronization = true; browser.findelement(by.id('compose-link')).click(); browser.sleep(2000); //select recipient var el = element(by.name('input_to')); el.click(); el.sendkeys('a'); //wait server autofill... browser.sleep(500); el.sendkeys(protractor.key.enter); //snip... //keep clicking buttons, filling out fields etc... //end snip //select category el = element(by.id('section-3')).element(by.css('.secret')); el.sendkeys('cl')

Ruby undefined variable in method body -

when run this, error stating city undefined. should do? def ticket_format text = "" tickets.each |price, artist| if city == "chicago" text += "#{artist} show cost #{price}" else text += "you paid #{price} see #{artist}" end end text end the way city used, means it's whether local variable, i.e defined in function body, or method defined on same context ticket_format defined. unlike procs , lambdas (or blocks in generale), methods in ruby not closures, i.e not keep context defined. if define city variable before method city = 'a ctiy' def ticket_format city == 'a city' ... end # raise error 'undefined local variable or method "city"' ticket_format so whether pass city argument, or define method city on same class ticket_format defined def city @city end def ticket_format if city == 'a city' ... end

.net - Uninstalling Windows Mobile application doesn't remove file in IsolatedStorageFile -

i have windows phone 8 application. installed application in device running windows 10 mobile. after uninstalling application device found sqlite db file exists in isolatedstoragefile isolatedstoragefile store = isolatedstoragefile.getuserstoreforapplication(); store.fileexists(dbname) // returns true i added file storage through method: assembly assem = assembly.getexecutingassembly(); copyfromcontenttostorage(assem.fullname.substring(0, assem.fullname.indexof(',')), dbname); private void copyfromcontenttostorage(string assemblyname, string dbname) { isolatedstoragefile store = isolatedstoragefile.getuserstoreforapplication(); system.io.stream src = application.getresourcestream( new uri("/" + assemblyname + ";component/" + dbname, urikind.relative)).stream; isolatedstoragefilestream dest = new isolatedstoragefilestream(dbname,

objective c - how can i edit existing pdf file in ios like copy ,zoom,background color,font -

i have load pdf file in uiwebview want copy content pdf file. hear code : - (void)viewdidload { [super viewdidload]; [self editpdf]; } - (void)editpdf { nsstring* filename = @"new.pdf"; nsarray *arraypaths = nssearchpathfordirectoriesindomains( nsdocumentdirectory, nsuserdomainmask, yes); nsstring *path = [arraypaths objectatindex:0]; nsstring* pdffilename = [path stringbyappendingpathcomponent:filename]; nsstring *templatepath = [[nsbundle mainbundle] pathforresource:@"objective_c_tutorial" oftype:@"pdf"]; //create empty pdf file; uigraphicsbeginpdfcontexttofile(pdffilename, cgrectmake(0,0,600,768), nil); cfurlref url = cfurlcreatewithfilesystempath (null, (cfstringref)templatepath, kcfurlposixpathstyle, 0); //open template file cgpdfdocumentref templatedocument = cgpdf

c# - Read Control Characters GS RS -

i've read barcodes control characters gs (ascii = dec 29, <f8> ), rs (ascii = 30, <f9> ), ... first console application, these chars filtered - have no idea , why. if scan barcode redhat-linux-console characters available: ΓΌ=:<f9>06<f8>1tbus0000420<f8>p4474453146<f8>q15<f8>2k14006956<f8>v204930<f8>30s81.031.59.264<f8>3s5500201767<f8>13yy<f9>eot but within console, chars <f9> <f8> missing. my c#-code: using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks; namespace consoleapplication3 { class program { static void main(string[] args) { string text = console.readline(); console.writeline(text); console.readline(); } } } how can read these chars? working example, returns characters: static void main(string[] args) { consolekeyinfo cki; c

javascript - Datatables inline editing with datepicker -

ok have datatable around 90 fields being populated dbcontext (visual studio mvc4). added .makeeditable() enjoy inline editing... most of fields of type string (but user can input date if opts to....even though text type field, date input simple text..) the problem have though i'm being able class of edit form become "datepicker", calender isn't popping , on other simple non-datatable pages, runs fine. i want able set column cells have inline datepicking ability.. i want table thing http://jquery-datatables-editable.googlecode.com/svn/trunk/inline-edit-extra.html i tried mimic-ing code there no success....its textbox editing instead of calender view.. update: noticed if change "type:" field in $.fn.editable.defaults = { name: 'value', id: 'id', type: 'datepicker', width: 'auto', height: 'auto', event: 'click.editable', onblur: 'cance

javascript - Issue with Angular Directive Usage -

hi have requirement array of elements attribute directive, , based on size of array objects have iterate , create template.please find js class below. mainapp.directive('student', function() { var directive = {}; directive.restrict = 'e'; directive.template = "student: <b>{{student.name}}</b> , roll no: <b>{{student.rollno}}</b>"; directive.scope = { student : "=name" } directive.compile = function(element, attributes) { element.css("border", "1px solid #cccccc"); var linkfunction = function($scope, element, attributes) { (i = 0;i<$scope.student.length;i++){ element.html("student: <b>"+$scope.student[i].name +"</b> , roll no: <b>"+$scope.student[i].rollno+"</b><br/>"); } } return linkfunction; } return directive; }); my da