Posts

Showing posts from March, 2011

c# - Exclude linq join condition based on parameter -

i want able dynamically exclude join based on boolean parameters, @ code below, how can exclude join if 'includejoin' variable false or there way dynamically add joins class program { static void main(string[] args) { list<foo> foolist = new list<foo>(); foolist.add(new foo{foo_id = 1}); foolist.add(new foo{foo_id = 2}); list<bar> barlist = new list<bar>(); barlist.add(new bar{foo_id = 1}); barlist.add(new bar{foo_id = 1}); iqueryable<foo> fooquery = foolist.asqueryable(); iqueryable<bar> barquery = barlist.asqueryable(); bool includejoin = false; var foos = f in foolist //exclude join if includejoin vairable false!! join b in barlist on f.foo_id equals b.foo_id g result in g.defaultifempty() select new foo { foo_id = f.foo_id }; var results = foos.tolist();

java - How to decode a 9 digit integer to some random 4 digit word -

how encode 7 digit integer 4 digit string in java? i have base36 decoder, generating 6 characters, ex:230150206 converted 3t0x1a. the code follows: string f = "230150206"; int d = integer.parseint(f.tostring()); stringbuffer b36num = new stringbuffer(); { b36num.insert(0,(base36(d%36))); d = d/ 36; } while (d > 36); b36num.insert(0,(base36(d))); system.out.println(b36num.tostring()); } /** take number between 0 , 35 , return character reprsenting number. 0 0, 1 1, 10 a, 11 b... 35 z @param int number change base36 @return character resprenting number in base36 */ private static character base36 (int x) { if (x == 10) x = 48; else if (x < 10) x = x + 48; else x = x + 54; return new character((char)x); } can 1 share me other way achieve this?. the obtained string can made in substring, looking other way it. here method, in simple test

python - Partial Collision Error -

i trying make version of pong using pygame, having issues detecting collision between ball , paddle. got detection working both paddles, came realize left player cannot move paddle when ball collides without ball passing through. player on right has no such issue, , keeping left player still allows ball reflect normally. import pygame, sys pygame.locals import * pygame.init() pygame.mixer.init() pygame.font.init() black = (0, 0, 0) white = (255, 255, 255) screenx = 1080 screeny = 720 clock = pygame.time.clock() pygame.mouse.get_pos in (screenx, screeny): pygame.mouse.set_visible(false) # blueprint creating player character class player: # defines initial conditions player def __init__(self): self.xpos = 0 self.ypos = 0 self.width = 20 self.length = 100 self.speed = 10 self.move = 0 self.upkey = 0 self.downkey = 0 self.score = 0 self.rect = pygame.rect((self.xpos, self.ypos, self.w

c++ cli - how to fix "error C2872: 'IDictionary' :ambiguous symbol[ VS2012 - C++/CLI] -

i need use idictionary in project. when add compiler not , report obvious error “error c2872: 'idictionary' : ambiguous symbol” . if create new sample project compiler never reports error below code snippet temp.h #pragma once #using "system.dll" using namespace::system; using namespace::system::collections; using namespace::system::collections::specialized; public ref class mycollection : public nameobjectcollectionbase { private: dictionaryentry^ _de; // gets key-and-value pair (dictionaryentry) using index. public: property dictionaryentry^ default[ int ] { dictionaryentry^ get(int index) { _de->key = this->basegetkey( index ); _de->value = this->baseget( index ); return( _de ); } } // adds elements idictionary new collection. mycollection( idictionary^ d ) { _de = gcnew dictionaryentry(); each ( dictionaryentry^ de in d ) { this->baseadd( (string^) de->key, de->value

spring-data-mongodb @indexed doesn't work when multi-tenant collections -

the project based on spring-data-mongodb use @indexed doesn't work when use multi-tenant collections.the following code: @document(collection = "#{ @tenantprovider.gettenant()}activity") @data public class activity { @id private string id; @indexed private string activityid; } if collection definition dynamic of course have make sure you're creating indexes manually there's no way determine possible collections might affected. users go ahead , create indexes manually using indexoperations .

c++ - How to set a default value to flagfile in gflags? -

i set flagfile this: declare_string(flagfile); int main(int argc, char** argv) { flags_flagfile = "./conf/default.conf" parsecommandlineflags(&argc, &argv, true); .... } then change flagfile command line ./main --flagfile=./conf/another.conf but flagfile still "./conf/default.conf" how set flagfile's default value , accept changes command line? you can check parameters before calling parsecommandlineflags function. for example like: std::regex flag_regex("--flagfile=(.+.conf)") std::smatch reg_match; if(std::regex_match(std::string(argv[1]), reg_match, flag_regex){ flags_flagfile = reg_match[0]; } that way use other configuration file. can change regex match differently depending on need.

Border not showing up in table, HTML, CSS, PHP -

the border isn't showing in table reason when i'm using css style it. however, if style in directly inside table tag, works. please take @ code: test.php <head> <style> table { border: 1px solid black; } </style> </head> <?php echo "<body>"; echo "<table>"; echo "<tr>"; echo "<td> hello1 </td>"; echo "<td> hello2 </td>"; echo "<td> hello3 </td>"; echo "</tr>"; echo "</table>"; echo "</body>"; ?> try code... table { border-collapse: collapse; } table td { border: 1px solid #333; } <html> <head><title>demo</title></head> <body> <table> <tr> <td>test1</td> <td>test2</td> <td>test3</td> <td>test4</td&g

c++ - packaged_task operator() get exception -

#include <future> #include <iostream> #include <thread> int simple_task(int i) { return i*3; } int main() { std::packaged_task<int(int)> task(simple_task); auto fut = task.get_future(); try { task(10); // why ???? got exception ?? } catch (std::exception& e) { std::cout << "exception caught: " << e.what() << std::endl; return 0; } std::cout << "triple 10 " << fut.get() << std::endl; } output: exception caught: unknown error -1 am using in wrong way ? want test operator() function. know how use std::thread. ubuntu 15.04 g++ -v using built-in specs. collect_gcc=g++ collect_lto_wrapper=/usr/lib/gcc/x86_64-linux-gnu/4.9/lto-wrapper target: x86_64-linux-gnu configured with: ../src/configure -v --with-pkgversion='ubuntu 4.9.2- 10ubuntu13' --with-bugurl=file:///usr/share/doc/gcc-4.9/readme.bugs --enable-languages=c,c++,java,go,d,fort

c++ - Is it possible to rotate a vector in 3D space using quaternions only? -

i want rotate vector in 3d space around origin. let's have hypothetical polygon centered around origin, , laying perpendicular y-axis. i want rotate polygon around arbitrary axis arbitrary rotation amount. example: rotate around y axis 90 degrees. view along -y axis. rotate 90 degrees one way create rotation matrix , apply rotation each of points of polygon. can presently this. however, decided wanted achieve using quaternions. attempt: rotate around y axis 90 degrees. view along -y axis. failure it seems there's wrong code. to try , isolate problem, created function qrotate should rotate single point (or vector) around origin. check math correct, derived final rotation using 2 different methods. however, both methods yield identically incorrect result. void qrotate(glm::vec3 point, glm::vec3 rotate) { printf("\n\n%f %f %f around point %f %f %f", rotate.x, rotate.y, rotate.z, point.x, point.y, point.z); //creat

javascript - Fabric.js copy paste of selected group -

say have multiple objects selected on fabric.js canvas , can group of objects using getactivegroup. can provide example of how copy , paste group new group, where: (a) each object in copied group retains relative position other copied objects (b) copied group whole positioned @ specified x,y position (c) copied group objects selected group after paste, if selection cleared treated individual objects on canvas i have tried pasting cloning , adding cloned group this: canvas.getactivegroup().clone(function(clone) { clone.left = 100; clone.top = 100; canvas.add(clone); canvas.deactivateall(); canvas.setactivegroup(clone).renderall(); }); now after code run cloned group objects seem added, positioned , selected ok, click canvas clear selection cloned group objects jump different spot on canvas. cloned objects not individually selectable , selection location out of sync new object location. anyways i'm sure i'm missing i'm not sure what. ap

c++ - How to invoke variadic template version of ctor of boost::thread? -

below codes failed pass compilation of command g++ -std=c++11 a.cpp -wall -lboost_thread -lboost_system , if amount of arguments of callback exceeds 9, in example, when try_variadic defined. #include <iostream> #include <boost/thread.hpp> void foo(void) {} template <typename t, typename... argts> void foo(t a0, argts ...args) { std::cout << a0 << std::endl; foo(args...); } int main(int argc, char *argv[]) { #if try_variadic boost::thread t(foo<int, int, int, int, int, int, int, int, int, int>, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10); #else boost::thread t(foo<int, int, int, int, int, int, int, int, int>, 1, 2, 3, 4, 5, 6, 7, 8, 9); #endif t.join(); return 0; } the variadic version of ctor of boost::thread allows more 9 arguments, don't know how make compiler choose it. suggestions, hints, examples highly appreciated. thanks. :-) i don't think it's possible. according thread docs : thread con

android - How to get the new NavigationView to play nice with status bar scrim? -

Image
i've been playing google's new design support library , it's blast! i'm little stumped though on navigation view. things read navigationview smart enough handle transparent scrim on own. (the android-developers post, one; search scrim). anyway, when tried following result: which great; want. except 1 thing. when drawer closed, scrim ugly dark grey, not primarycolordark . . . here's layout: <android.support.v4.widget.drawerlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:fitssystemwindows="true" > <android.support.design.widget.coordinatorlayout android:layout_width="match_parent" android:layout_height="match_parent"

c++ - minigw-w64 is incapable of 32 byte stack alignment, easy work around or switch compilers? -

i'm trying work avx instructions , windows 64bit. i'm comfortable g++ compiler i've been using that, however, there big bug described reported here , rough solutions presented here . basically, m256 variable can't aligned on stack work avx instructions, needs 32 byte alignment. the solutions presented @ other stack question linked terrible, if have performance in mind. python program have run every time want debug replaces instructions sub-optimal unaligned instructions, or over-allocating , doing bunch of costly hacky pointer math in code proper alignment. if pointer math solution, think there still chance seg fault because can't control allocation or r-values / temporaries. i'm looking easier , cheaper solution. don't mind switching compilers, prefer not to, if it's best solution will. however, poor understanding of bug is intrinsic windows 64 bit, switching compilers or other compilers have same issue? you can solve problem switchi

javascript - How can I structure these callbacks to get me the info I want? -

maybe i've been staring @ code long or maybe i'm using many callbacks elsewhere or something, can't figure out logistics of one. know value contained in rows correct using util.inspect(rows) on inside callback function. don't know how bring surface, speak. dbhandler() called other functions pass params , result expected in return. any insight tremendously helpful. using node.js express , mysql packages if makes difference. function dbhandler(req, res, params) { pool_user.getconnection(function (err, connection) { if (err) { connection.release(); res.json({ "code" : 100, "status" : "error in connection database" }); return; } connection.query(params.query_string, function (err, rows) { connection.release(); if(!err) { res.json(rows); // <<--- want ahold of value of `rows`

rust - How to use multiple variables in routes with Nickel? -

nickel states can use variables in urls, sounds useful, possible use multiple variables? something like: www.example.com/login/:userid?:apikey?:etc server.get("/start/:userid?:passwd", middleware! { |request| // format!("this user: {:?} = {:?}", // request.param("userid"), // request.param("passwd") // ); }); you need separator. example: #[macro_use] extern crate nickel; use nickel::nickel; fn main() { let mut server = nickel::new(); server.utilize(router! { "/start/:userid/:passwd" => |request, _response| { println!("this user: {:?} = {:?}", request.param("userid"), request.param("passwd") ); "hello world!" } }); server.listen("127.0.0.1:6767"); } it looks question might expecting passwd sort of query parameter, rather in u

Cordova Plugin to ask for Ratings -

i looking cordova plugin asks ratings similar askingpoint.com. need plugin can send popup user rate app after specific task or amount of days using app. of course needs phonegap/cordova you can check these link out... https://github.com/pushandplay/cordova-plugin-apprate (this 1 easy set up) http://www.joshuawinn.com/adding-rate-button-to-cordova-based-mobile-app-android-ios-etc/ (haven't used heard reviews abt it) hope helps.!

java - The local variable may not have been initialized error -

i have fixed now, still shows me 0 after input first numbers. shows me correct on vikt not in pris. :s package brev; import static javax.swing.joptionpane.*; public class uppgift1 { public static void main(string[] arg) { string indata = showinputdialog("hur mycket väger ditt brev gram?"); int vikt = integer.parseint(indata); int pris = 0; { indata = showinputdialog("ditt porto kostar " + pris + " kr med vikten " + vikt + " gram." + "\nskriv in en följande vikt för att addera på ditt nuvarande porto."); vikt = vikt + integer.parseint(indata); pris = pris + pris; if (vikt < 1) { showmessagedialog(null, "error"); } else if (vikt <= 50){ showmessagedialog(null, "portot blir "+ (pris + 7) + "kr. med " + vikt + " gram."); }

ruby on rails - Active Record Associations: has_and_belongs_to_many, has_many :through or polymorphic association? -

the ruby on rails app working on allows users create , share agendas other users . in addition, must able to: display list of agendas each user , on profile display list of users associated agenda , on agenda's page when sharing agenda user, define role user, , display role of user on list mentioned right above i going go has_and_belongs_to_many association between user , agenda models, that: class user < activerecord::base has_and_belongs_to_many :agendas end class agenda < activerecord::base has_and_belongs_to_many :users end but wondered whether let me , display @user.agenda.user.role list of roles on given agenda page of given user. and thought should go has_many :through association instead, such as: class user < activerecord::base has_many :roles has_many :agendas, through: :roles end class role < activerecord::base belongs_to :user belongs_to :agenda end class agenda < activerecord::base has_many :roles has_m

ruby - Rails 4 strong params formatting with multiple keys -

i working service takes in number of custom attributes , serializes hash. so this: custom_contacts: {"address_book"=> [{"contact_list"=>"user_data", "contacts"=>[{"name"=>"user_data", "number"=>"user_data"}, {"name"=>"user_data", "number"=>"user_data"}, {"name"=>"user_data", "number"=>"user_data"}]}]} the issue can't quite seem play nicely strong params in rails. i've read documentation here , can't seem wrap head around how set up. you may need 1 "permit" blow. a = actioncontroller::parameters.new( {"data_key"=> [{"name_key"=>"user_data", "organization_key"=>[{"key1"=>"user_data", "key2"=>"

What is the constant ARDUINO for? it used to be 22 but is now 100 -

i using thermocouples , downloaded max6675 library. wondered value of arduino constant in following lines for. #if arduino >= 100 lcd.write((byte)0); #else lcd.print(0, byte); #endif lcd.print("c "); lcd.print(thermocouple.readfahrenheit()); #if arduino >= 100 lcd.write((byte)0); #else lcd.print(0, byte); #endif lcd.print('f'); i have searched answer have turned little info. can print out value following line, still can't find out means. serial.println(arduino); the arduino constant gives version of arduino environment being used. for example, 22 old arduino 22 ide , 100 version 1.0 of arduino environment. value of arduino constant in latest arduino release (1.6.5) appears 10605. there significant changes in arduino apis between old versions (e.g. 22) , 1.0 release. value of arduino can used conditionally compile different code different versions of api. in example appears in version 1.0+ environment need use lc

What does "= 0" mean in Python? -

i doing online course , when 1 of lessons kind of lost me. maybe don't remember it, "= 0" mean in following program? can't find clue in notes , instructor doesn't explain here. **count = 0** **total = 0** infile = open('grades.txt', 'r') grade = infile.readline() while (grade): print(grade) count = count+1 total = total + int(grade) grade = infile.readline() average = total / count print("average: " + str(average)) i feel i'm forgetting fundamental here. the = operator called "assignment" operator. now, plenty of people on stackoverflow going tell assignment yourself, feel since such basic question. it's being set 0 since later, operations count = count + 1 require count have value begin with. adding + 1 none doesn't work nicely, , if did, it's nice when reading code see variables declared in advance.

PhP ftp_put function limitation? -

i working on solution have upload 33,000 or more csv files server. my script working fine upto 25,000 files breaks after 26,000 files upload or 27,000 files upload etc. following php warning i.e. php warning: ftp_put(): bind() failed: address in use (98) i have researched error on internet didn't find solution, therefore, posting here. i checked directory no. of files limit on ubuntu 14.0.4 lts server ext4 filesystem , couldn't find restricts 33,000 files upload single directory. i tried upload same 33,000 files upload 2 different directories i.e. 20,000 dira , rest 13,000 dirb after 5,000 successful files transferred dirb, stops , gives above error. here basic code using upload files reference i.e. $dpath = "/var/www/data/"; $sourcedir = $dpath .'test1'; $remotedir = 'test2'; $serverip = "192.168.0.1"; $user = "dataexport"; $pass = "abc"; $connhandle = ftp_connect($serv

XML Parsing Error : AJAX Chat -

i trying plant ajax chat website users. have completed installation process database configuration. when trying brows domain.com/ajaxchat/index.php returning error given below: xml parsing error: junk after document element location: http://futurenext.esy.es/inc/chat/ line number 2, column 1: i think problem in ajaxchattemplate.php , , here code is: function getcontent() { if(!$this->_content) { $this->_content = ajaxchatfilesystem::getfilecontents($this->_templatefile); } return $this->_content; and error message like: " non-static method ajaxchatfilesystem::getfilecontents() should not called statically, assuming $this incompatible context in line 37" now please 1 can me fix problem. problem here can't understand. thanks.

javascript - js event in a handlebars template -

when click on button, template have table feeded. i want action when double click row of table in handlebar template. <body> <script id="lodgersearchresult-template" type="text/x-handlebars-template"> <div class="span12"> <table id="lodgersearchresulttable" data-show-header="true" class="table" data-toggle="table" data-height="250"> <thead> <tr> <th>#</th> <th>nom</th> <th>date de naissance</th> <th>n.a.s.</th> <th>n.a.m.</th> <th>immeuble</th> </tr> </thead> <tbody> {{#each this}} <tr> ... ... </tr> {{/each}} </tbody> </table> </script> </body> <script> $('#lodgersearchresulttable > tbody').dblclick(function () {

Saving html state with javascript -

i found things far still isnt need. have html page has select input names. need able select name in input , save html in such way when open page again last selected name still selected. can use pure javascript. that's have now. works on chrome doesnt work on ie. <!doctype html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> </head> <body> <p>finalizado por:</p> <div id="demo" style="float:left; margin-right: 10px;"></div> <select id="myselect" style="width: 25px; float:left;"> <option></option> <option value="sérgio barros">sérgio barros</option> <option value="marcos evangelista">marcos evangelista</option> <option value="antônio sobral">antônio sobral</option> <option value=&q

javascript - inner directive in nested directives not showing up -

i trying set nested directives in angularjs reason inner directive never shows in html. have followed couple different tutorials still cannot figure out i'm doing wrong. in following code trying routeeditor directive nest inside mapeditor directive. every time inspect html element shows outer mapeditor html. , there no errors in console. <div class="mapeditor"> </div> this i've got: mapeditor.js define(['jquery','ng', 'raphael', 'text!./mapeditor/mapeditor.html'],function($, ng, raphael, template) { var mapeditor = ng.module("mapeditor", []); mapeditor.directive('mapeditor', ['units', function(units) { return { restrict: 'e', template: template, scope: { }, link: function(scope, element, attrs) { } } }]); return mapeditor; }); routeeditor.js define(['jquery','ng', 'raphael', 'text!./routee

database - how to create a search bar? -

i want idea how go adding asearch bar in website? please note don't want create google api or google search engine. when user search inside search bar results website should show up. , not random websites. i thinking: i planning on creating table called "searchtable". table have 3 cols. can add links of website in "links" cols. , search using keywords. table: searchtable(id, links, keywords) and can search using following query select * searchtable keywords '%searchword%'" are there other ways of doing this?

javascript - What is the most persistent HTML5 data storage? -

pre-html5 had cookies, aren't reliable way persistently store data user locally because user can (and does) clear cookies in browser. now, html5 introduces localstorage alternative (which has benefit of not being sent every http request). however, suffers same fate cookies do–death deletion. local data persistency inherently unreliable in sense user has ultimate control. but, cookies , localstorage can removed without user knowing they're doing when removing browser's data. what html5 feature reliable means of storing persistent data locally without risk of user removing inadvertently? all data stored on clients computer has ability of being cleared when clear browsing data. indexeddb, websql , other methods of storing data on client's computer related browser suffer flaw. one option store data on server , give user key can used retrieve data. another option use java or plugin can access actual file system write clients computer. no matter what,

c# - how to check the dynamic behavior of a web service (WCF) from process monitor? -

i need monitor behavior of web service ( wcf ) has been published on desktop iis6. it built c# in vs2013 on win7. i need consume/access service laptop downloading file web service. webclient.downloadfile(myuri, myfile); this called c# vs 2010. i have installed fiddler, ms process explorer , cygwin (watch "ps -w") in order monitor has happened when downloadfile() was executed. but, in process monitors, cannot see dynamic update behavior of desktop service host. -----update ---- i want monitor process of how host transfer data client, becasue in client (my laptop), downloadfile() cannot download files larger 64kb. found on server side (my desktop), thought set maxrequestlength = 1 in wbe.config, can still download files long smaller 64kb. so, think desktop must have default setting overwrite max file size allowed download. i have checked setting of timeout, minbytepersec, maxrequestlength, weblimit of iis , web.config on client , server (my desktop).

c# - How to load dlls from a NuGet into the current AppDomain? -

i try create modulable system in each module can depend on other ones. each module nuget , dependencies have resolved via nuget. each module contains type implements shared interface allow extracting list of instruction. all these instructions executed in reverse order. the detailed situation this: i have 4 projects call api , s , m1 , m2 . nugets , depends 1 way ( -> stands 'depends on'): s -> api , m1 -> s , m2 -> m1 . on other hand have projet core , console , tests . aren't nugets references each others in way ( -> stands 'references'): core -> s , console -> core , tests -> core . m1 et m2 modules, once again special because contains type must found , instantiated within core. the goal this: i must fetch , install locally nugets given repository. this done, fetch nugets, unzip them given location. i must inject dlls extraction installer if sort of plugins. how inject correct dlls imported nugets knowing that

ios - What does @"//" do in childWithName and when to use it -

i'm working on spritekit project , skspritenode has simple name: node.name = @"cat" however, when try [self childwithname:@"cat"] , not retrieve object. through research noticed people mentioning should doing [self childwithname:@"//cat"] and works. wondering having "//" does? it doesn't special things nsstring s, strings used search node tree, recursively searches of self 's children. from documentation: when placed @ start of search string, [ // ] specifies search should begin @ root node , performed recursively across entire node tree. not legal anywhere else in search string. so, example, let's have node tree: scene / \ / \ child1 child2 / \ / \ / \ / \ grandchild1 grandchild2 grandchild3 grandchild4 without // , childnodewithname: find child1 or

ios8 - Swift SpriteKit Game Center -

i have been trying split game center code helper class per numerous tutorials on website , others. this have in gameviewcontroller.swift func loadgamecenter() { var localplayer = gklocalplayer.localplayer() localplayer.authenticatehandler = {(viewcontroller, error) -> void in if (viewcontroller != nil) { self.presentviewcontroller(viewcontroller, animated: true, completion: nil) //point 1 } else { println((gklocalplayer.localplayer().authenticated)) } } } in menuscene.swift, skscene, have code. func savehighscore(highscore:int) { if gklocalplayer.localplayer().authenticated { var scorereporter = gkscore(leaderboardidentifier: leaderboardid) scorereporter.value = int64(highscore) var scorearray: [gkscore] = [scorereporter] gkscore.reportscores(scorearray, withcompletionhandler: {(error : nserror!) -> void in if error != nil { pr

angularjs - Summary of validation -

i have angular form (called saveform ) has bunch of text inputs bound variable called billingaddress . each input looks this: <div class="col-md-4 col-sm-4"> <div class="editor-label"> <label for="billname">name*</label> </div> <div> <input type="text" class="form-control" title="{{billingaddress.name}}" id="billname" name="billname" ng-model="billingaddress.name" required /> <span class="field-validation-error" ng-show="saveform['billname'].$error.required"> {{saveform['billname'].$error.message}} </span> </div> </div> obviously, have many more inputs (and each input has different name name="billaddress1" or name="billcity" ). these inside ui bootstrap <accordion> . in &l

jquery - Slow scroll for anchors -

i have found script anchors on page $('.anchor').click(function (event) { event.preventdefault(); var href = $(this).attr('href'); var target = $(href); var top = target.offset().top; $('html,body').animate({ scrolltop: top }); }); but, when click on <div class="anchor"> , page jumps position. possible slow scrolling? you can this $('html,body').animate({ scrolltop: top }, "slow"); .animate method looks this. .animate( properties [, duration ] [, easing ] [, complete ] ) by default durations slow - 600, normal - 400, fast - 200. if not suitable case can give own duration

Animation not working for my Android App -

Image
hey trying replicate animation similar gif below thinner circles: but animation not moving, static circles, method using: private void circleanimation3(final marker marker){ final circle circle2 = mmap.addcircle(new circleoptions() .center(new latlng(marker.getposition().latitude,marker.getposition().longitude)) .strokecolor(color.cyan).radius(1000)); animatorset = new animatorset(); animatorset.setinterpolator(new acceleratedecelerateinterpolator()); animatorlist = new arraylist<animator>(); for(int i=0;i<rippleamount;i++) { final valueanimator scalexanimator = valueanimator.offloat(1.0f); scalexanimator.setrepeatcount(valueanimator.infinite); scalexanimator.setrepeatmode(valueanimator.restart); scalexanimator.setstartdelay(i * (3000/6)); scalexanimator.setduration(3000); scalexanimator.addupdatelistener(new valueanimator.animatorupdatelistener() { @override

ios - CKSubscription not working -

i creating 2 cksubscriptions in app delegate's didfinishlaunchingwithoptions method such. - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { // override point customization after application launch. uiusernotificationsettings *notificationsettings = [uiusernotificationsettings settingsfortypes:uiusernotificationtypealert categories:nil]; [[uiapplication sharedapplication] registerusernotificationsettings:notificationsettings]; [[uiapplication sharedapplication] registerforremotenotifications]; _mycontainer = [ckcontainer containerwithidentifier:@"icloud.com.isaranjha.copyfeed"]; _privatedatabase = [_mycontainer privateclouddatabase]; [_privatedatabase fetchsubscriptionwithid:@"subscription" completionhandler:^(cksubscription *subscription, nserror *error){ if (subscription) { } else { nspredicate *predicate = [nspredicate predicatewit

Handle Outlook Send Event in Python -

i attempting use following python code send email through outlook server pop indicating "a program trying send e-mail message on behalf. if unexpected, click deny , verify antivirus software up-to-date." know can disabled in outlook settings unable not have administrator access. question there way programmatically handle/avoid through python? aware can avoiding using smtplib unable connect server through not solution. thanks! import win32com.client olmailitem = 0x0 obj = win32com.client.dispatch("outlook.application") newmail = obj.createitem(olmailitem) newmail.subject = "test subject" newmail.body = "test body" newmail.to = "mail@place.com" newmail.send() this feature cannot disabled end-user. prompt not displayed if have up-to-date anti-virus app on system. if cannot control user environment, options listed @ http://www.outlookcode.com/article.aspx?id=52 essentially in php limited either redemption , outlook securi

android - Get PayPal Access token in Lollipop -

so trying make app users swipe credit card , bluetooth device handle it. using paypal sdk cant seem figure out how access token use request. here current code: public string performpostcall(string requesturl, hashmap<string, string> postdataparams) { url url; string response = ""; try { url = new url(requesturl); httpurlconnection conn = (httpurlconnection) url.openconnection(); conn.setreadtimeout(15000); conn.setconnecttimeout(15000); conn.setrequestmethod("post"); conn.setdoinput(true); conn.setdooutput(true); conn.setrequestproperty("accept", "application/json"); outputstream os = conn.getoutputstream(); bufferedwriter writer = new bufferedwriter( new outputstreamwriter(os, "utf-8")); writer.write(getpostdatastring(postdataparams)); writer.flush(); writer.close(); os.close()

ios - Trouble unwrapping JSON Array to a String Value -

i have been struggling json few days. trying create post request web server username, return information on said user. have managed json response 2 ways, cannot cast of elements of array string. using swiftyjson api too. import uikit import foundation class viewcontroller: uiviewcontroller { var token = "barrymanilow" var endpoint = "http://www.never.money/simple_app7.php" @iboutlet weak var firstlabel: uilabel! override func viewdidload() { submitaction(self) } func submitaction(sender: anyobject) { let myurl = nsurl(string: "http://www.mindyour.money/simple_app7.php"); let request = nsmutableurlrequest(url:myurl!); request.httpmethod = "post"; // compose query string let poststring = "token=\(token)"; request.httpbody = poststring.datausingencoding(nsutf8stringencoding); let task = nsurlsession.sharedsession().datataskwithrequest(request){ data, response, error in

sql - MySQL How to account for blocked users when returning comments -

i thought had solved problem, realised specifying user not friends in friends table cause user not able see posts, not behaviour want. a blocked user has category of 4. i'm aware return comments post , manually check if category of user 4, un-necessary computation solved single query (i think). select distinct ent.entity_id, ent.profile_pic_url, ent.first_name, ent.last_name, ent.last_checkin_place, comments.content, friends.category checkin_comments comments join entity ent on comments.entity_id = ent.entity_id join friends on comments.entity_id = friends.entity_id1 or comments.entity_id = friends.entity_id2 comments.chk_id = 1726 , friends.category != 4 group comments.comment_id this return results, because there no way specify logged in user. thought supply sub-query: select distinct ent.entity_id, ent.profile_pic_url, ent.first_name, ent.last_name, ent.last_checkin_place, comments.content, friends.category chec