Posts

Showing posts from September, 2012

MySQL subquery unwanted result -

so have come subquery select movies.movieid, movies.user movies movies.user in(select movies.user movies movies.movieid = '19') , movies.movieid <> (select movies.movieid movies movies.user='5' , movies.movieid = '19') , movies.movieid <> '19' and gives me result -------------------------- | movieid | user | -------------------------- | 20 | 4 | -------------------------- | 21 | 4 | -------------------------- | 22 | 5 | -------------------------- | 23 | 4 | -------------------------- how can rid of result user 5? i think problem @ and movies.movieid <> (select movies.movieid movies movies.user='5' , movies.movieid = '19')

php - Combine sub-arrays of an array that have the same key -

i'm trying populate array of array room_id should combined in 1 sub-array instead of separated are. here code: $query = "select res_id, room_id, guest_id, check_in_date, check_out_date reservation "; $result = mysqli_query($link, $query) or die (mysqli_error($link)); $rooms = array(); while ($row = mysqli_fetch_assoc($result)) { $rooms[] = $row; } $array_date = array(); foreach ($rooms $room) { $array_date[] = date_range($room['room_id'], $room['check_in_date'], $room['check_out_date']); } function date_range($room_id, $first, $last, $step = '+1 day', $output_format = 'y-m-d' ) { $room_date = array(); $dates = array(); $current = strtotime($first); $last = strtotime($last); while( $current <= $last ) { $dates[] = date($output_format, $current); $current = strtotime($step, $current); } $room_date[$room_id] = $dates; return $room_date; } here result var_dump:

Using Koala Facebook API to get information from app pages -

how use koala gem information app page? example, if want information candy crush saga's liked pages, type @graph.get_object(candycrushsaga+"/likes"). how can other features such comments, likes, , shares? possible using koala? you can use feed node using get_connections , i.e. @graph.get_connections('candycrushsaga','feed?fields=status_type,type,story,message,likes{name},comments,link,name, from') more info https://developers.facebook.com/docs/graph-api/reference/v2.3/page/feed , https://developers.facebook.com/docs/graph-api/reference/v2.3/post#fields .

org.openrdf.query.MalformedQueryException for SparQL insert -

i've read ways on how insert data using sparql. references use insert while other references use insert data . so, i'm confused on how query. goal insert data property coursename class "course" in ontology. here query: insert{ <http://www.semanticweb.org/rocky/ontologies/2015/3/curriculumontology#course> curr:coursename "it222". } i've tried query , exception appears says: sparqlreasonerexception: org.openrdf.query.malformedqueryexception: encountered " "insert" "insert "" @ line 9, column 1. expecting 1 of: "base" ... "prefix" ... "select" ... "construct" ... "describe" ... "ask" ... is subject of triple wrong? or should need put on subject of triple? , why exception appears? btw, i'm using protege in modeling ontology. i've read ways on how insert data using sparql. references use inse

How to make IntelliJ recognize path in require -

i want navigate file './common/keyvalue' if click on string given require. tried inject 'file' language reference did no help. var store = require('./common/keyvalue'); var simplerow = require('./components/simplerow');

How to import this library to Android Studio? -

i trying this: https://github.com/pelotoncycle/weberknecht to latest android studio. problem there no gradle file many tutorials around need import? can tell me how import library can use in android project? you can download sources this folder , put them project, there not many of them.

Storing Integer value as A Character Java -

i tried in previous stack overflow questions not find similar. i want store integer value char variable integer value stored in variable. char[] ch1 = (binary1.tostring()).tochararray(); char[] ch2 = binary2.tostring().tochararray(); if (ch1.length >= ch2.length) { char[] ch = new char[ch1.length]; int j = 0; int num1; int num2; int num3; (int = 0; < ch1.length; i++) { if (j == ch2.length - 1) j = 0; num1 = character.getnumericvalue(ch1[i]); num2 = character.getnumericvalue(ch2[j]); num3 = num1 ^ num2; ch[i] = (char) num3; j++; } string str = new string(ch); return str; } here happening getting null values in many cases. tried in character class not find function. if there way please tell. in advance. edit : need store either 0 or 1 edit : ch1[] & ch2[] ar of char type edit :

ubuntu - why doesnot the warning information show up in matlab ? -

Image
i using matlab 2014b on ubuntu 14.04. however, when there 1 error in code, matlab show error using 1 red underline. , move our cursor red line , error information show. however, when moved cursor red line, gave me 1 blank pop-up window. no message given. 1 me solve issue ?

javascript - Inner Div font Size won't change with media queries when resizing browser window -

i need resizing font-size inside of div. when resize browser window changes smaller font. i can't change html font or body font solution must target h1 inside specific div. i'm opened media query solution or js. i've tried other similar questions , answers no solution. appreciated. thanks! this fiddle http://jsfiddle.net/x767knu0/ html: <div class="sharesmenu"> <h1>jake's shares</h1> </div> css: @media screen (max-width:1405px) { .sharesmenu h1 { font-size:1em; } } @media screen (min-width: 1406px) { .sharesmenu h1 { font-size:2.2em; } } you calling media queries incorrectly. you have called only screen wrong way round , missing and join tells browser check more 1 variable. @media screen , (max-width: 600px) { .sharesmenu h1 { font-size: 1em; } } @media screen , (min-width: 601px) { .sharesmenu h1 { font-size: 2.2em; } } <div class="shar

c++ - is there any member named std vector iterator operator ==? -

i can't compile this: //cygwin g++ 4.9.2 std::vector<int> v; std::vector<int>::iterator i; i.operator==(v.begin()); //error: ...has no member named 'operator==' someone please let me know going on. and why did assume, such member function exists? comparison operators don't have member functions. it can defined global function well: template <class t> bool operator(typename vector<t>::iterator left, typename vector<t>::iterator right) { //... } in case, may not work: i.operator==(v.begin()); while work: i == v.begin(); also, if really want use such unnatural syntax, can call way: operator==(i, v.begin()); but note, result quite unpredictable, don't initialize i .

java - paint method causing other components not to show up -

i have simple gui program i'm trying work. when user presses bottom button i'm trying shapes paint. when rid of if(buttonclicked) in paint() shows fine paint() seems auto-executed , shapes appear without button click. when add surround paint() body if(buttonclicked), regardless of how buttonhandler class handles it, rest of components not show in frame. have no idea why happening. test code , without if logic in paint() , see what's going on. public class gui extends jframe { //declare components container container; jpanel centerpanel, northpanel, southpanel, eastpanel, westpanel, mouseclickpanel; jlabel toplabel; jtextarea textarea; jbutton buttona, buttonb, drawbutton; boolean buttonclicked; public gui(string title) { super(title); // invoke jframe constructor container = getcontentpane(); container.setlayout(new borderlayout()); centerpanel = new jpanel(); centerpanel.setba

python - Celery: access all previous results in a chain -

so have quite complex workflow, looks similar this: >>> res = (add.si(2, 2) | add.s(4) | add.s(8))() >>> res.get() 16 afterwards it's rather trivial me walk result chain , collect individual results: >>> res.parent.get() 8 >>> res.parent.parent.get() 4 my problem is, if third task depends on knowing result of first one, in example receives result of second? also chains quite long , results aren't small, passing through input result unnecessarily pollute result-store. redis, limitations when using rabbitmq,zeromq,... don't apply. i assign every chain job id , track job saving data in database. launching queue if __name__ == "__main__": # generate unique id job job_id = uuid.uuid4().hex # root parent parent_level = 1 # pack data. last value value add parameters = job_id, parent_level, 2 # build chain. added clean task removes data # created during process (if want it) add_chain = ad

javascript - How to open different popups with the same title in CasperJS? -

i'm trying automate tasks using casperjs, , need open multiple popups. however, popups have exact same url ( http://.../printit.aspx/.. .), whenever use this.withpopup(/printit/, function() {...}); it opens first popup. can't access other ones. i suppose there 2 possibilities : close each popup after visiting it, can't find how this accessing popups using way url regex /printit/. maybe using casper.popups , documentation vague this. there no easy , documented way of disambiguating 2 popups. documentation says casper.popups array-like property. iterate on it. judging by code , popups property pagestack . 1 can modify pagestack.findbyregexp() function kind of thing. it seems casper.popups property contains duplicate entries, 1 can filter them out. casper.findallpopupsbyregexp = function(regexp){ var popups = this.popups.filter(function(popuppage) { return regexp.test(popuppage.url); }); if (!popups) { throw new caspe

php - Save color using cookies -

hello want save cookie color input , if user refresh page color saved , ready next use.cookies must set 1 hour , if expired cookies deleted.sorry english , help <table> <form action='' method='post'> <tr><td><label>url adresa: </label></td><td><input type='text' placeholder='napr.google.com' name='url' /></td></tr> <tr><td><label>titulek: </label></td><td><input type='text' placeholder='napr.google' name='title' /></td></tr> <tr><td><label>vyberte barvu: </label></td><td><input type='color' name='color' /></td></tr> <tr><td><label>otevřít v novém okně </label></td><td><input type='checkbox' name='window' /> <tr><td></td><td><in

jquery - facebox not working after $.post -

i'm using facebox open remote page, included jquery , facebox.js , facebox.css , put in document.ready jquery(document).ready(function ($) { $('a[rel*=facebox]').facebox({ loadingimage: 'imgs/loading.gif', closeimage: 'imgs/closelabel.png' }); }); everything works till call function function lecfunc(year) { var name = year + '_lec'; $.post('php/scripts/lecclickscript.php', { matyear: year, mattype: name }, function (data) { document.getelementbyid("lecs_tbody").innerhtml = data; document.getelementbyid("lecs_boxbody").style.display = 'block'; document.getelementbyid("qus_boxbody").style.display = 'none'; }); } the facebox doesn't work more edit :: solved actully problem was using 2 jquery versions read qustion can-i-use-multiple-versions-of-jquery-on-the-same-page then added code exact sequenc

profiling - My CUDA nvprof 'API Trace' and 'GPU Trace' are not synchronized - what to do? -

i'm using cuda 7.0 profiler, nvprof , profile process making cuda calls: $ nvprof -o out.nvprof /path/to/my/app later, generate 2 traces: 'api trace' (what happens on host cpu, e.g. cuda runtime calls , ranges mark) , 'gpu trace' (kernel executions, memsets, h2ds, d2hs , on): $ nvprof -i out.nvprof --print-api-trace --csv 2>&1 | tail -n +2 > api-trace.csv $ nvprof -i out.nvprof --print-gpu-trace --csv 2>&1 | tail -n +2 > gpu-trace.csv every record in each of traces has timestamp (or start , end time). thing is, time value 0 in these 2 traces not same: gpu trace time-0 point seems signify when first operation on gpu triggered relevant process begins execute, while api trace's time-0 point seems beginning of process execution, or sometime thereabouts. i've noticed when use nvvp , import out.nvprof , values corrected, say, start time of first gpu op not 0, more realistic. how obtain correct offset between 2 traces?

android - Waking Device When Destination Reached -

the program below used vibrating phone when destination reached.this works when screen on doesnt when device idle(screen off) suggestion works while screen off appreciated.i novice in android development sorry if question stupid.` package com.sset.jibin.wakemethere; import android.app.activity; import android.app.alarmmanager; import android.app.pendingintent; import android.content.context; import android.content.intent; import android.content.sharedpreferences; import android.location.location; import android.os.bundle; import android.os.systemclock; import android.os.vibrator; import android.util.log; import android.view.view; import android.widget.button; import android.widget.textview; import com.google.android.gms.common.connectionresult; import com.google.android.gms.common.googleplayservicesutil; import com.google.android.gms.common.api.googleapiclient; import com.google.android.gms.common.api.pendingresult; import com.google.android.gms.common.

android - Gradle density split for tvdpi and 560dpi -

how use gradle density split generate apks compatible tvdpi , 560dpi devices? i use gradle density split in google play application , noticed no matter change not generating android:screendensity="213" (for tvdpi) , android:screendensity="560" (for nexus 6) inside compatible-screens element , apks not compatible popular devices. for testing purposes created new application in android studio (1.2b) using gradle build tools version 1.1.0 following build.gradle file app module: apply plugin: 'com.android.application' android { compilesdkversion 21 buildtoolsversion "21.1.2" defaultconfig { applicationid "com.example.marek.densitysplittest" minsdkversion 21 targetsdkversion 21 versioncode 1 versionname "1.0" } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' } } splits { densit

Is there a console log for asp.net? -

if have if statement below: if currentdate >= rating1 status = 2 elseif currentdate >= rating2 daylight_savings_status = 0 elseif currentdate >= rating3 daylight_savings_status = 1 else daylight_savings_status = 1 end if is there in javascript console.log('test'); that can test on if statement truth of statement? this way able test on firebug(firefox). for server side c# & vb.net server side - show in visual studio output window. system.diagnostics.debug.writeline(log data here) client side javascript/jquery - show in browser devtools console window. works on popular browsers. console.log(log data here)

c# - How to make calculation on time intervals? -

Image
i have problem ,i solve have written long procedure , can't sure covers possible cases . the problem: if have main interval time ( from b ), , secondary interval times (many or no) (`from x y , x` y` , x`` y`` , ....`) i want sum parts of main interval time (ab) out of secondary intervals in minutes in efficient , least number of conditions (sql server procedure , c# method)? for example : if main interval 02:00 10:30 , 1 secondary interval 04:00 08:00 now want result : ((04:00 - 02:00) + (10:30 -08:00))* 60 example graph : in first case result : ((x-a) + (b-y)) * 60 and more complicated when have many secondary periods. note: may overlap among secondary intervals happening when have compare main period [a,b] union of at 2 parallel sets of secondary intervals .the first set have contain 1 secondary interval , the second set contains (many or no ) of secondary intervals .for example in graph comparing [a,b] (sets of 2,5 )the first set (2) c

Gulp: Object #<Readable> has no method 'write' Error -

i'm getting error when trying run gulp command. worked fine last week. reason why i'm getting following error now? typeerror: object #<readable> has no method 'write' this js task looks like. // js task gulp.task('js', function () { var browserified = transform(function(filename) { var b = browserify(filename); return b.bundle(); }); return gulp.src('./src/js/*.js') .pipe(browserified) .pipe(sourcemaps.init({loadmaps: true})) .pipe(uglify()) .pipe(sourcemaps.write('./')) .pipe(gulp.dest('./build/js')) .pipe(reload({stream: true})) }); here's link entire gulpfile.js : https://github.com/realph/gulp-zero/blob/master/gulpfile.js any appreciated. in advance! what version of browserify have @ moment? browserify changed not accept inward streams, creating some. correct, adapted code: var source = require('vinyl-source-stream'); var buffer = require('gulp-buff

java - Weka Classifier Accuracy -

i've got 73,841 instances of data, 17 classes, using train classifier weka. data has been filtered using fft, , each instance has 3 points. i.e. 85724.5409, 40953.2485, 3204935, 4539024.002345, ?/class i've tried 3 classifiers: smo/j48/naive bayes. the smo/naive bayes achieving accuracy rates of 16% but j48 classifier producing accuracy rates of 98/99%. questions: can safely assume j48 classifier making sort of mistake? how can 2 results similar, , other different? what can increase accuracy? there many classes, classes not separable? thanks i think output of decision tree inaccurate. can provide tree generated or top 10 nodes see exact problem. here of measures suggest improve accuracy. class size : 17 classes indeed big. try reduce merging similar classes. (only done if doesnt affect scope of project.) non-liner classifier : since having 17 classes linear classifier naive bayes/decision tree wont enough. did try non-linear svm or ensem

resize - Layout for JavaFX with resizable component and bindings, is this proper? (image included) -

Image
i'm creating 2x2 grid contain components inside of them. following image: i'm unsure proper layout should this. problem bottom right isn't aligned... i'm guessing grid layout won't work (or can it?). figured i'd borderpane , have top contain top 2 panes, , bottom contain bottom two, borderpane in , go there. 1) way approach (border layout ignoring center), or there better layout? next: blue box resize based on how large full screen is. problem run after growing large, when it's shrunk, black boxes (which should stay same dimensions, excluding ones touch blue sides should resize) 2) there way make black boxes adjust size of blue box? by mean: if blue box grows vertically, top right pane have extend vertically well. likewise, have shrink if blue 1 does. can done binding both heights? since bottom rectangles won't expand, there way bind if height of entire pane x bound height javafx calculate me x - bottomfixedheight , yet not go smaller le

unix - executing one php script at a time from a script list -

i have web application user can choose list of scripts execute , executions added table in mysql , each 1 have own state "pending,"success" ,"failed" or "in progress" user can choose stop execution. the problem 1 script can executed @ same time others have wait until finished. my environement linux (ubuntu) , scripts in php though doing crontab executes php script , php script grab informations sql table , search if there other execution looking if there there execution "in progress" state if there 1 exit,otherwise execute other execution having pending state. there other solution ? it's better use atomic check. way how database not atomic after checked no other scripts running, before you've written current script starts, process may perform same check , therefore you'll 2 concurrent scripts running. also if script terminates abnormally reason, won't update database, other scripts won't able start @ al

c# - Set Control Styles to ThemeResource Values Programmatically In Windows Phone 8.1 -

i'm adding controls dynamically in windows phone 8.1 application. in xaml, can set various styles current theme's style set foreground attribute of textblock control in following example. <textblock text="hello world" foreground="{themeresource phoneaccentbrush}" /> i want able same thing in code behind, have not yet been able determine how this. create textblock programmatically follows. textblock textblock = new textblock() { text = "hello world", foreground = // need phone accent brush theme }; i've seen examples different theme values stored follows, dictionary doesn't seem contain keys when checked theme resources. solidcolorbrush phoneaccent = new solidcolorbrush((color)application.current.resources["phoneaccentcolor"]); any appreciated. thank you! load phoneaccentbrush not phoneaccentcolor: brush accentbrush = resources["phoneaccentbrush"] brush; textblock textblock = new t

c++ - Pass in-class initialized const member to Base constructor? -

i have in-class initialized const member in derived class i'd pass constructor of base class. example: class base{ public: base(int a) : i(a){} private: int i; }; class derived : base{ public: derived() : base(a){} private: const int = 7; }; int main(){ derived d; } however spawns uninitialized error: field 'a' uninitialized when used here [-wuninitialized] i under impression const initializing set value directly allowing passed derived ctor in manner. doing wrong or under wrong impression? when const in-class initialized members initialized? your question, when const in-class initialized members initialized? is bit of red herring. "in-class initialized" doesn't mean anything; brace-or-equal initializer syntactic sugar , takes place of corresponding constructor initalizer list slot. const has no special bearing. real question should be: when non-static data members initialized? the details don'

java - Android Studio: onTouchEvent either doesn't run or can't update variables -

ive been trying program app on android studio , ontouchevent doesn't seem update variables. my variables defined in main activity not method, this: public float touchy; public float touchx; my ontouchevent code this: public boolean ontouchevent(motionevent event) { touchx = (float) 200.0;//event.getx(); ive tried put solid numbers touchy = (float) 200.0;//event.gety(); doesnt seem work return true; } this put test in image button "movecircle" (and yes, runs) public void movecircleonclick(view view) { if (touchx >0){ you.sety(50);//<<<this see if there result: there isnt } my goal when movecircleonclick run, you,(imageview) transported touchx , touchy coodinates. this you.sety(touchy); you.setx(touchx); //would bounty don't have enough rep. :/ it seems implemented 'ontouchlistener' interface in mainactivity. need this. set mainactivity ontouchlistener of imageview, you. pu

scala - Is it possible to specify at the site of a Property definition how many times to execute the Property? -

such this: class myspec extends specification scalacheck { def = s2""" mything should right way $x1 """ def x1 = prop(4 /*times*/) { (...) => ... } } } use setparameters , mintestsok : class myspec extends specification scalacheck { def = s2""" mything should right way $x1 """ def x1 = prop { (...) => ... }.set(mintestsok = 1) } }

r - Using ddply on dataframe with dates in POSIXlt time -

the problem: you have data.frame (df) consists of columns of posixlt date format. output of str(df) following: $identifier : int 1 1 1 1 1 1 1 1 1 1 ... $date.time : posixlt, format: "2010-06-01 07:27:00" "2010-06-01 07:27:00" if use ddply(df, identifier, summarise, min.time = min(date.tim) you similar error: 'names' attribute [11] must same length vector [10] solution mentioned below. the problem documented in github issue it dataframe's inability handle posixlt date. "posixct" more convenient including in data frames, , "posixlt" closer human-readable forms. the solution mentioned in issue following df$tm <- as.posixct(strptime(paste(dates, times), "%m/%d/%y %h:%m:%s")) ddply(df, ~var1, dim)

c++ - Can't Build PortAudio - "LNK1104: cannot open file 'ksguid.lib'" -

Image
i'm beginner in c/c++, please bear me. i'm trying build portaudio library can use in 1 of project. i'm using vs 2013, preset project-file builds had converted version. i've been able fix many problems occurred on long way here, except one: link : fatal error lnk1104: cannot open file 'ksguid.lib' i've seen this , this site. of them address problem, yet non of them has been able solve it. here solutions these sites suggest: add wasapi - symbol portaudio.def , add pa_wdmks_no_ksguid_lib - definition preprocessor you can ksguid.lib -file windows 7 sdk . might installed on computer. it's best use explorer find (probably c:\program files (x86)\microsoft sdks\windows\v7.1a\lib\x64 ). when found it, go visual studio , go project > properties > configuration-properties > linker > input , click on little arrow on right of additional dependencies , choose edit : enter absolute filepath ksguid.lib . make sure surrou

android - Google Places API LatLngBounds from LatLng and Radius -

i using new android place api autocomplete predictions while user type. from saw far api takes latlngbounds object created using 2 locations. is there way generate latlngbounds object using 1 latlng center point , radius? thank you. as promised distwo, here how creating viewport based on single latitude , longitude. reason me wanting store locator script searches viewport returned places api, , if viewport isn't returned (rare happens) go ahead , create 1 lat , lng returned places. please note not using android app, regular web viewing. console.log("no viewport found lets spherically compute bounds"); var sw = google.maps.geometry.spherical.computeoffset(place.geometry.location, 1609, 225); var ne = google.maps.geometry.spherical.computeoffset(place.geometry.location, 1609, 45); swlat = sw.lat().tofixed(6); swlng = sw.lng().tofixed(6); nelat = ne.lat().tofixed(6); nelng = ne.lng().tofixed(6); not sure of use you. in case radius fixed, in situation s

python - 2 like characters in same position -

i trying return number of positions in 2 strings have same character. tried code: def matches(stringone, stringtwo): if stringone or stringtwo == " ": return none else: n=0 count=0 if stringone[n] == stringtwo[n]: count=count+1 else: pass n=n+1 return count example: matches = matches("abcd", "xbade") print matches 2 thanks! :) and no, it's not homework. no zip functions please. i'm not trying use python built in functions. you can use generator expression zip iterate through strings letter-by-letter comparison def matches(stringone, stringtwo): return sum(1 i,j in zip(stringone, stringtwo) if == j) >>> matches("abcd", "xbade") 2 >>> matches('dictionary', 'dibpionabc') 6 if don't want use python's zip function def matches(stringone, stringtwo): shorter

ios8 - iOS 8 extension dependencies issues. Importing one project file to extension view controller -

i working on ios 8 extension. read many manuals , of them show how simple add extension app, , seems that's enough. but here many pitfalls: after adding extension need import of classes view controller created when added new extension target. big use here need add of them , if have huge project it's not simple task. solution can select extension target in build phases -> compile sources press plus button , add .m files target using hot key cmd+a. after adding files can see of method wont work, , can see error: 'sharedapplication' unavailable: not available on ios (app extension) solution can macros check ifndef extension can invoke sharedapplication code. #import <foundation/foundation.h> vs #import <uikit/uikit.h> . have not figured out issue when replaced foundation uikit works me , related issues go away. cocoapods. of using cocoapods if extension need use part of project code , code use cocoapods library need add link_with 'proj

javascript - JS: Check for parameter in URL then iterate a function with parameter as var -

i've following piece of code: <div id="1" class="hide"> text1 </div> <div id="2" class="hide"> text2 </div> <div id="3" class="hide"> text3 </div> <div id="4" class="hide"> text4 </div> <div id="5" class="hide"> text5 </div> want divs hidden function check: -if url contains parameter equal id of 1 of div -do this, each of div: check if url contains parameter 1 5. -hide elements except 1 id matching parameter. 1 parameter in url @ same time. function code, separate function can called other links: function showone(id) { $('.hide').not('#' + id).hide(); } here iteration loop, not sure how piece them in specific way need directions appreciated. while (i<6) { if (window.location.search.indexof('i=yes') > -1) { showone(i) }} you not iterating i ,

javascript - jQuery - scroll or jump to top -

the context: have 1 page web app. there's lots of div 's being hidden @ 1 time (i'm not sure if matters). finding when user finished 1 page (page x), click (to page y) - if return page x position same when left page. button @ bottom, that's user ends again. what want, when return page x them @ top of page can start again. whether scrolls or jumps - either way fine. i've tried of following no success: // scroll top settimeout(function(){ alert('scroll'); $('html, body').animate({scrolltop : 0}, 2000); }, 2000); adding div id top-anchor @ top , using: $('html, body').animate({ scrolltop: $("#top-anchor").offset().top }, 2000); having a , using anchor, code below (it works once though, after hash in url no longer works suppose): document.hash = '#top-anchor'; also tried: window.scrollto(0, 0); no luck. any alternative ideas appreciated. you can achi

Android - How to remove app name from ActionBar -

Image
this app: now want remove app name actionbar... want this: my code: <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:myapp="http://schemas.android.com/apk/res-auto" > <item android:id="@+id/phone" android:title="@string/phone" android:icon="@drawable/phone" myapp:showasaction="ifroom" /> <item android:id="@+id/computer" android:title="@string/computer" android:icon="@drawable/computer" myapp:showasaction="ifroom" /> </menu> actionbar actionbar = getactionbar(); actionbar.setdisplayshowtitleenabled(false); actionbar.setdisplayshowhomeenabled(false); or can call actionbar.settitle("")

javascript - Meteor method returns null on client, same method run on client returns proper value -

i got intended behavior, im confused why... i have meteor method, returns value of document key; log statement proves such: finduseremail: function(user_id){ var user = meteor.users.find({_id: user_id}).fetch(); console.log(user[0].emails[0].address); return user[0].emails[0].address; } but when call on client, shared_user_email field null : shared_user_email: meteor.call('finduseremail', $(ev.target).find('[name=shared_user]').val()) but, when simulate calling meteor method mimicking server query on client, returns value meteor method above logs: shared_user_email: meteor.users.find({_id: $(ev.target).find('[name=shared_user]').val()}).fetch()[0].emails[0].address what lost in translation when client tries calling server method? edit what happens when use meteor method insert document collection, field relies on meteor method? keep getting undefined shared_user_email field here: var newlist = { title: $(ev.target)

c# - Unity - WaitForSeconds() does not work -

i developing flight simulator programme. right trying level restart after delay of 4 seconds, instead waiting forever , not responding. code (in c#) right now: void update () { //other irrelevant code in front float terrainheightlocation = terrain.activeterrain.sampleheight (transform.position); if (terrainheightlocation > transform.position.y) { //the plane crashed startcoroutine(wait(terrainheightlocation)); } } ienumerator wait( float terrainheightlocation) { transform.position = new vector3 (transform.position.x, terrainheightlocation, transform.position.z); instantiate(explosion, transform.position, transform.rotation); destroy(gameobject); debug.log ("waiting"); yield return new waitforseconds(4.0f); // waits x seconds debug.log ("waited x seconds"); application.loadlevel(application.loadedlevel); debug.log (&qu

MySQL Trigger and Error Code 1362 -

so have following query trigger: delimiter $$ create trigger user_log_update before update on user_log each row begin insert user_log (id, user_id, name, username, password, email, user_type_id, created) values(old.id, old.user_id, old.name, old.username, old.password, old.email, old.user_type_id, old.created); if (old.id = 1) set old.id = old.id +1; end if; select * user_log; end$$ delimiter ; when try execute part of script, error code: 1362. updating of old row not allowed in trigger i don't know why got error , don't see wrong in syntax. does know how fix it? so, increment new instead: delimiter $$ create trigger user_log_update before update on user_log each row begin insert user_log(id, user_id, name, username, password, email, user_type_id, created) values(old.id, old.user_id, old.name, old.username, old.password, old.email, old.user_type_id, old.created); if (old.id = 1) set new.id = old.id +1; end if; end$$ delimiter

c++ - Why and how can an object file of old code use new code that uses the generic programming paradigm even though templates are static binding? -

this entirely different question 1 asked before why i'm posting this. i define topic subjective question inspires answers explain "why" , "how". allowed according help center rules. in order make question more constructive, provide resources better explain topic. from c++ superfaq under question "can give me simple reason why virtual functions (dynamic binding, dynamic polymorphism) , templates (static polymorphism) make big difference?" the author says, "...a programmer might write code called framework written great, great grandfather. there’s no need change great-great-grandpa’s code. in fact, dynamic binding virtual functions, doesn’t need recompiled.even if have left object file , source code great-great-grandpa wrote lost 25 years ago, ancient object file call new extension without falling apart." he goes on say, "that extensibility, , oo , generic programming powerful reusable abstraction." furthermore, re

swift - Grand Central Dispatches - execution out of order? -

i'm trying better understanding of gcd wrote test code below (bottom). 2 functions waits inside sent on different queues , println on main thread waiting particular tasks. i expect console output should be: before functions start 3 sec loop start 5 sec loop end 3 sec loop between functions wait on long after functions wait on long end 5 sec loop between functions wait on longer after functions wait on longer but instead is: before functions start 3 sec loop start 5 sec loop between functions wait on longer after functions wait on longer end 3 sec loop between functions wait on long after functions wait on long end 5 sec loop a number of things don't make sense me - 1. why "longer" ones printed before "long"? 2. why "longer" ones not printed after end of longer i.e. 5 second function? code (viewcontroller.swift) import uikit class viewcontroller: uiviewcontroller { var longqueue = dispatch_group_create() var longerqueue