Posts

Showing posts from September, 2011

php - PDO extend for a crud querys and Fatal error -

i'm trying make query class crud , want extend connection other class, error : fatal error: call member function prepare() on non-object !? miss ? or stupito extend ? here mysql_connection extend querys class. both different php files. class mysql_connection extends querys { protected $dbh = null; function __construct() { try { $this->dbh = new pdo('mysql:host=host; dbname=db','user','pass', array(pdo::mysql_attr_init_command=> 'set names utf8')); $this->dbh->setattribute(pdo::attr_errmode, pdo::errmode_exception); $this->dbh->setattribute(pdo::attr_default_fetch_mode, pdo::fetch_assoc); } catch(pdoexception $e) { $this->dbh = null; print('error on connection'.$e->getmessage()); die(); ...

Does the Linux scheduler prefer to run child process after fork()? -

does linux scheduler prefer run child process after fork() father process? usually, forked process execute exec of kind so, better let child process run before father process(to prevent copy on write). i assume child execute exec first operation after created. is assumption (that scheduler prefer child process) correct. if not, why? if yes, there more reasons run child first? to quote the linux programming interface (pg. 525) general answer: after fork() , indeterminate process - parent or child - next has access cpu. (on multiprocessor system, may both simultaneously access cpu.) the book goes on differences in kernel versions , mentions cfs / linux 2.6.32: [...] since linux 2.6.32, once more parent is, default, run first after fork() . default can changed assigning nonzero value linux-specific /proc/sys/kernel/sched_child_runs_first file. this behaviour still present cfs although there some concerns future of feature. looking @ cfs implementa...

refresh <table> using AngularJS or javascript -

i'm struggling hours <table> refresh using onclick button. want refresh random values, once button clicked. i've set id="mytable" on <table> , used .reload() function, doesn't seem work. ideas? demo on jsfiddle html: <table id='mytable'> <tr> <td id="rand1"></td> </tr> <tr> <td id="rand2"></td> </tr> </table> <button onclick="parent.document.getelementbyid('mytable').reload()">refresh random</button> js: var random = function() { return math.random(); } document.getelementbyid("rand1").innerhtml = random(); document.getelementbyid("rand2").innerhtml = random(); try this <html> <body> <table id='mytable'> <tr> <td id="rand1"></td> </tr> <tr> <td id="rand2"></td> ...

javascript - How to disable Jquery prompt save button on first click -

i using jquery prompt prompt user save. so, user clicks save button, jquery prompt displays , asks if user sure he/she wants save changes or not. problem is, user able click multiple times on jquery save prompt button before prompt closes. result, save routine runs once each time prompt save button clicked, results in duplicate records in database. need disable prompt save button on first click or close prompt window on first click prevent multiple saves. how can this? client code: $.prompt("are sure want save? not able change decision after it's been saved.", { title: "save?", buttons: { "save": true, "cancel": false }, submit: function (e, v, m, f) { if (v) { response = saveupdates(loandetails); } } }); i created fiddle here: http://jsfiddle.net/smurphy/4fqjr/ the solution little convoluted. thought there simpler way after looking through documentation cannot find built i...

cordova - SimpleWebRTC with PhoneGap -

is there way use simplewebrtc (from simplewebrtc.com) , cordova? know if webkit safari supports it? i trying to: create phonegap project include simplewebrtc js connect room currently webrtc not supported in browsers safari , internet explorer. more on that: http://iswebrtcreadyyet.com/ http://www.webrtc.org/ http://caniuse.com/#feat=stream meaning simplewebrtc not run on safari browser or in phonegap. can use webrtc phonegap using opentok's services: http://www.tokbox.com/blog/opentok-now-on-phonegap/ (note: works on ios) or try: https://github.com/alongubkin/phonertc

python - Simple Numpy Vectorization -

i have 2 1d numpy arrays start , stop , both of contain integers (which used index other array). have following piece of code. index_list = [] in range(len(start)): temp = range(start[i], stop[i]) index_list.extend(temp) index_list = np.array(index_list) is there simple way vectorize this? you can vectorize follows: def make_index_list(start, stop): lens = stop - start cum_lens = np.cumsum(lens) # sequential indices same length expected output out = np.arange(cum_lens[-1]) # starting index each section of `out` cum_lens = np.concatenate(([0], cum_lens[:-1])) # how each section of `out` off correct value deltas = start - out[cum_lens] # apply correction out += np.repeat(deltas, lens) return out with made data: start = np.random.randint(100, size=(100000,)) stop = start + np.random.randint(1, 10 ,size=start.shape) we can take code test ride: in [39]: %%timeit ....: index_list = [] ....: in range(len(st...

zend framework - Design pattern of translations files -

i'm developping international website based on php zendframework 1.12 , , i'm going use zend_translate managing translations. my translations put php array key=>value : (one file per language) <?php return array( 'key' => 'translation', 'key2' => 'translation2', ); my question : what best way manage keys files? my opinion : in first hand, use default language keys . : 'submit' => 'valider', 'share' => 'partager', //... in other hand, use special keys able directly found text appear : 'label_loginform_login' => 'login', 'button_mixed_submit' => 'submit', 'links_mixed_share' => 'share', //... but in option, best tree use keys? how many levels ('type' / 'placement' / 'action' ...)? and each level, how many items? example level 'type' label : used...

localization - Make methods with name in english but call them in spanish in c# project? -

i making c# project client , class have methods signature in english, connect , disconnect , rebuild , etc. client, in application manage in spanish. can library project maintain method names in english allowing client call methods in spanish? conectar , desconectar , recompilar ? maybe decoration on method or that? bluntly put: no. last resort write wrapper around class method names in spanish, calling english variants internally, wouldn't. personally, think connect / disconnect / rebuild common programming terms every programmer should familiar with, whatever language he/she speaks.

c# - Return one-level result list from a join statement in EF -

Image
this question has answer here: select columns after join in linq 1 answer i have following simple join statement: dim result = (from propertydefinition in econtext.propertydefinitions join productdef in econtext.productpropertyvalues on propertydefinition.propertydefid equals productdef.productpropdefid productdef.productid = 1 select productdef, propertydefinition.propertydefname, propertydefinition.propertydefname2, propertydefinition.propertydefiisdeleted).list() if explicitly included columns under productdef works, , result comes in 1 list, result of productdef coming in separated list: i need productdef , propertydefinition not in nested lists, how result in one-shot list without need explicitly include columns of productdef ? ...

javascript - Cannot get Snap.svg to select the proper svg element in Rails -

i'm trying snap.svg work in rails project. i have page foo.html.slim containing following code: #svg-container svg#apple height="1000" width="400" and in static_pages.js.coffee , have svgelement = document.getelementbyid("apple") paper = snap(svgelement) circ = paper.circle(100, 100, 50) circ.attr fill: "#ff0000" stroke: "#0000ff" strokewidth: 10 circ.drag() this doesn't render svg anywhere on page (the element isn't in html source anywhere); however, if add line in particular place so svgelement = document.getelementbyid("apple") document.write("foo") # new line paper = snap(svgelement) circ = paper.circle(100, 100, 50) circ.attr fill: "#ff0000" stroke: "#0000ff" strokewidth: 10 circ.drag() a red , blue circle gets drawn. problem is @ top of body of html rather in svg element should have selected. of note, if document.write("foo") line plac...

php - How to get a User to select a plan and be dynamically created in the next page (form) -

i'd users select plan , information selected dynamically applied next page , stored can email users information entered in form. <div class="pricing_box"> <h3><a href="#">professional</a></h3> <div class="price-value"> <a href="#">$300.00/month</a> </div> <ul> <li><a href="#">lorem ipsum</a></li> <li><a href="#">dolor sitamet, consect</a></li> <li><a href="#">adipiscing elit</a></li> <li><a href="#">proin commodo turips</a></li> <li><a href="#">laws pulvinarvel</a></li> <li><a href="tables.html">more details</a></li> </ul> <div class="cart"> <a class="popup-with-zoom-anim" href="contact.html...

ios - How to add blur to transparent detailed view controller iOS7 -

Image
i'm developing app in ios7.1 xcode5 my app master-detail based what want achieve menú blur effect, have transparent this: this code creating master-detail window: -(void)showsplitviewcontrollerinview:(uiview *)view withdetailviewcontroller:(id)rightviewcontroller{ uistoryboard *mainstoryboard = [uistoryboard storyboardwithname:@"ipad" bundle: nil]; uinavigationcontroller *leftnavcontroller; uinavigationcontroller *rightnavcontroller; menuprincipalvc *leftviewcontroller = [mainstoryboard instantiateviewcontrollerwithidentifier:@"menuprincipalvc"]; leftviewcontroller.title = @" "; leftnavcontroller = [[uinavigationcontroller alloc] initwithrootviewcontroller:leftviewcontroller]; rightnavcontroller = [[uinavigationcontroller alloc] initwithrootviewcontroller:rightviewcontroller]; leftnavcontroller.toolbarhidden = false; ...

sql - Sum of two columns with join and group by another column -

i need t-sql query. i'm trying following: in result want 1 column grouped store no. in second column want sum of net amount sales , third column want show sales last year each store no. +-------+--------+------------+ | store | sales | last year | +-------+--------+------------+ | 401 | 20000 | 19000 | | 402 | 25000 | 21000 | | 403 | 10000 | 15000 | +-------+--------+------------+ note: sales year in table called "trans_ sales entry" , sales last year archived in table called "archived sales entry" i don't want type in date manually in query, rather want variable example ("today" , "today"-365) is right way it, or there better ways? select "company$trans_ sales entry"."store no_" "store", sum("company$trans_ sales entry"."net amount"*-1) "sales", sum("company$archived sales entry"."net amount"*-1) "las...

alarm never triggers , as it should do android -

i trying start alarm starts broacast , starts service the alarm never starts . don't know problem , tries several attempts sove , no success mainactivity.java calendar=calendar.getinstance(); day=calendar.get(calendar.day_of_month); month=(calendar.get(calendar.month)+1); // manupulation ,to compare non-array int year=calendar.get(calendar.year); cloader=new cursorloader(this, birthdayprovider.content_uri, null, birthdayprovider.event_date+"='"+day+"' , "+birthdayprovider.event_month+"='"+month+"'", null, null); c=cloader.loadinbackground(); // if there exist on today if (c.movetofirst()) { calendar.set(calendar.month,(month-1) ); // making original array , becomes current month calendar.set(calendar.year, year); calendar.set(calendar.day_of_month, day); calendar.set(calendar.hour_of_day,11); calendar.set(calendar.minute, 37); calendar.set(calendar.second,0); intent myintent = new intent(getbasecontext(), my...

jsp - How to print PDF files using Java -

in project have jsp pages should print pdf documents you can use itext, fop or other. take at: compare these products pdf generation java given requirements inside: itext, apache pdfbox or fop? are there java pdf creation alternatives itext?

ssl - How to make this one on my website's url? -

sample image url i don't know call want have on website. to green address bar, need buy extended validation ssl certificate. can 1 domain name registrar.

c++ - External tools drop down in eclipse -

i on fedora 19 , have eclipse-cdt installed system (kepler, 4.3.1). problem that, cannot external tools dialog drop down in toolbox. external tools dialog, in eclipse toolbar green "play" (>) button red toolbox under it. drop down can seen e.g. here: http://3.bp.blogspot.com/-be1xrcwhxb8/ttgk3eohg1i/aaaaaaaaaao/vflnubessug/s1600/java+-+helloworldproject.clj+-+eclipse_2011-12-01_16-13-42.png i tried windows>customize perspective>run>... , can see "debug" or "run" checkboxes checked, , external tools unchecked. but, unfortunately, when check checkbox , click ok, nothing changed. when menu second time, unchecked usual. when click run>external tools> , choose external tools, ok, working. more, used key binding , works. cannot make icon on toolbar visible. maybe not important, can choose "c" perspective only, not have "c/c++" perspective, can create , compile c++ project. another information: have installed st...

using libimagequant in android ndk -

has used quantizer "libimagequant" library in android ndk? the library can found here: http://pngquant.org/lib the problem i'm facing when calling liq_image_create_rgba, compiler complains with: invalid arguments ' candidates are: * liq_image_create_rgba(*, void *, int, int, double) ' seems problem first parameter (liq_attr). can't understand why complaining , how solve it. liq_attr* liqattr = liq_attr_create(); liq_image* liqimage = liq_image_create_rgba(liqattr, reinterpret_cast<void*>(bitmappixels), width, height, 0); in version of libimagequant.c liq_image_create_rgba function declared follows: liq_export liq_image *liq_image_create_rgba(liq_attr *attr, void* bitmap, int width, int height, double gamma) the first parameter liq_attr *, maybe yours missing pointer type?

java - Passing an instance of Comparable to a method that expects a Comparator -

the stream class in java 8 defines max method requires comparator argument. here method signature: optional<t> max(comparator<? super t> comparator) comparator functional interface has abstract compare method signature. notice compare requires 2 arguments. int compare(t o1, t o2) the comparable interface has abstract compareto method signature. notice compareto requires 1 argument. int compareto(t o) in java 8, following code works perfectly. however, expected compilation error like, "the integer class not define compareto(integer, integer)". int max = stream.of(0, 4, 1, 5).max(integer::compareto).get(); can explain why it's possible pass instance of comparable method expects instance of comparator though method signatures not compatible? that's nice feature method references . note integer::compareto instance method . need 2 integer objects call it. 1 on left side (the target object), , 1 on right side (the first ...

ruby on rails 4 - Capistrano git:check failed exit status 128 -

i got when ran cap production git:check . (i took out real ip address , user name) debug [4d1face0] running /usr/bin/env git ls-remote -h foo@114.215.183.110:~/git/deepot.git on 114.***.***.*** debug [4d1face0] command: ( git_askpass=/bin/echo git_ssh=/tmp/deepot/git-ssh.sh /usr/bin/env git ls-remote -h foo@114.***.***.***:~/git/deepot.git ) debug [4d1face0] error reading response length authentication socket. debug [4d1face0] permission denied (publickey,password). debug [4d1face0] fatal: remote end hung unexpectedly debug [4d1face0] finished in 0.715 seconds exit status 128 (failed). below deploy file... set :user, 'foo' set :domain, '114.***.***.***' set :application, 'deepot' set :repo_url, 'foo@114.***.***.***:~/git/deepot.git' set :deploy_to, '/home/#{fetch(:user)}/local/#{fetch(:application)}' set :linked_files, %w{config/database.yml config/bmap.yml config/cloudinary.yml config/environments/development.rb...

android - Should a ViewPager that creates ListFragments have each ListFragment call back to the ViewPager to handle list item clicks? -

i have activity viewpager part of layout creates series of listfragments pages. when user clicks on list item in 1 of listfragments , takes them detail page allows them edit details of list item. so in listfragment 's onlistitemclick() method, first check see if in tablet (two-pane) mode, , if is, perform fragment transaction replaces right-hand detail fragment detail fragment newly clicked list item. if running on normal phone, create new activity takes entire screen. basically, have listfragment perform new fragment/activity creation when user clicks on 1 of items. but instead, should listfragment 's onlistitemclick() method call viewpager activity, , have viewpager activity contain fragment/activity creation code? the problem viewpager activity can create fragments, cannot see how can have each listfragment call custom listfragment parent activity. far can tell, listfragment must have viewpager activity parent activity. if case, practice listfragm...

clojure - How do you specify the classpath with Leiningen? -

in clojure, have leiningen project source in /src/project/core.clj i want add subdirectory this. eg. /src/project/examples/example-one.clj in core.clj file try pull in project.examples.example-one but lein compile still tells me could not locate project/examples/example_one__init.class or project/examples/example_one.clj on classpath: do have explicitly update project.clj file if add subdirectory main code directory? (i don't see main code directory given there explicitly.) if namespace contains dashes, corresponding file should contain underscores instead of dashes. can read reason in here: why-does-clojure-convert-dashes-in-names-to-underscores-in-the-filesystem unless add different source codes java, groovy etc... default lein include namespaces in src folder.

java - Point orientation relative to a line -

i'm trying write method in java determines orientation of position relative line. a little context: (not necessary answer may helpful) i'm working on collision detection ball on body parts on player. player has head chest knee ankle , toe, defined having position , tether position. example tether position head chest, chest position of player(or hips) , on. for collision detection have function written determines distance between ball , body parts, fails catch when body part dragged , skips on ball. i have methods in each body part class supposed determine orientation of position relative body part. the methods wrote call getangle method: pivotpos , basepos base line, , position method called public double getangle(position basepos, position pivotpos) { double baseangle = math.todegrees(math.atan2( pivotpos.gety() - basepos.gety(), pivotpos.getx() - basepos.getx())) + 180; double otherangle = math.todegrees(math.atan2( ...

How can I insert a string before the file suffix in a makefile? -

i want copy file insert string before suffix of file target = executable.exe version = 1.2.3 myrule: cp $(target) somefunction($(target), $(version)) so on windows produces executable1.2.3.exe , on linux produce executable1.2.3 (with target not having .exe well) do need create 2 rules, 1 windows removes extension , readds , 1 linux concats, or there better way? you don't have specify .exe extension @ all. windows adds automatically when linking executable file. if executable created, should trick : $(cp) $(target) $(basename $(target))$(version)$(suffix $(target)) if $(target) has no period in it, $(suffix $(target)) empty string.

insert - Inserting a changing table into another table. Tables values are the same when they should be different -

i trying make table tables inside of it. tables go inside change previous value. end result tables inside main table equal each other , equal latest value. local array = {} local x local y function test(a) if a==1 x = {1,1} print("x returned") y = x k,v in pairs(x) print(k,v) end return x end if a>=1 p=math.random(1,2) n=math.random(2,4) table.remove(y,p) table.insert(y,p,n) print("") print("y returned") k,v in pairs(y) print(k,v) end return y end end array[1] = test(1) array[2] = test(2) array[3] = test(3) print("") k,v in pairs(array) print(k,v) end testtable=array[1] print("") k,v in pairs(testtable) print(k,v) end output: x returned 1 1 2 1 y returned 1 1 2 3 y returned 1 1 2 4 1 table: 0x678300 2 table: 0x678300 3 table: 0x678300 1 1 2 4 the 3 tables inside array should different each other. doing wrong? there tables do...

python - Making text appear one character at a time [PyGame] -

i trying make dialog appear 1 character @ time (like in pokemon games , other similar). i have searched on internet have not managed find helpful. i aware of question asked this, didn't solve trying do. know can done because have seen games made python has been done. import pygame, sys pygame.locals import * window_width = 500 window_height = 500 pygame.init() displaysurf = pygame.display.set_mode((window_width, window_height)) black = ( 0, 0, 0) white = (255, 255, 255) def display_text_animation(string): text = '' in range(len(string)): displaysurf.fill(white) text += string[i] text_surface = font.render(text, true, black) text_rect = text_surface.get_rect() text_rect.center = (window_width/2, window_height/2) displaysurf.blit(text_surface, text_rect) pygame.display.update() pygame.time.wait(100) def main(): while true: event in pygame.event.get(): ...

php - zlib_decode(): data error using composer in the doctrine2 tutorial -

update: posted issue bug tracker while ago suggested in comments, , ran clean installation of new version of composer (composer version 7131607ad1d251c790ce566119d647e008972aa5 2014-05-27 14:26:24) , issue fixed. original post: i'm trying learn how use doctrine2 using tutorial @ http://docs.doctrine-project.org/en/latest/tutorials/getting-started.html but reason error when trying run composer install : [errorexception] zlib_decode(): data error here contents of composer.json: { "require": { "doctrine/orm": "2.4.*", "symfony/yaml": "2.*" }, "autoload": { "psr-0": {"": "src/"} } } edit: php version 5.5.9. edit: output of composer install -vvv : reading ./composer.json executing command (cwd): git describe --exact-match --tags executing command (cwd): git branch --no-color --no-abbrev -v executing command (cwd): hg branch ...

angularjs - Angular JS Directive not rendering inline style in IE9 -

i have directive working fine in chrome, in ie9 renders '{{myappinitials.iconcolor}' html: <tr ng-repeat="person in data.people"> <td class="text-left"> <div myapp-initials="person" ></div> </td> </tr> the directive: angular.module('myapp.directives', []) .directive('myappinitials', function () { return { restrict: 'a', template: "<div style='background-color:{{myappinitials.iconcolor}}' class='usericonmedium'>{{myappinitials.firstname.charat(0) + ' ' + myappinitials.surname.charat(0)}}</div>", scope: { myappinitials: "=" } }; }); there plunker here check. is angular bug? ie (including 11) not support interpolation in style attributes. must use ngstyle that, e.g ng-style="{'background-color': myappinitials.iconcolor}...

java - JPA entities management in a desktop application where object are used to keep modification state -

i'm introducing jpa in existing desktop application persistence layer objects extracted db , stored using plain queries. after object extracted, used in ui side show , keep user edits. when user press "save" button persistence layer invoked passing object , stored in db. if user press "cancel" button modification throw away , nothing happens in persistence layer. i'm replacing plain query mechanism jpa. problem when object retrieved using jpa managed. when user modify it, changes stored directly in db. i can't modify ui code new persistence layer (jpa based) should emulate old persistence layer (plain query based) behaviour. how can obtain it? i thinking detach objects before returning them persistence layer. in case user modifications not persisted until persistence layer invoked. in order detach object can: invoke detach method in entitymanager. solution requires annotate relationships related object detached. clear entitymanager af...

java - Eclipselink updates entity field when it is not changed -

i have 2 entities @onetomany (entity1) & @manytoone (entity2) bidirectional relation. in @onetomany relation have @cascading{cascade.all}. when change boolean property false, of entity @manytoone relation true , false within transaction or method, causes database trigger update query set entity's boolean false, seems wrong because false , @ commit time still false. i'm using eclipselink 2.5.1 jpa implementation. can causes? update(integer entityid) { tx.begin(); entity1 entity1 = findentity(entityid); for(entity2 entity2 : entity1.getentity2list()) { entity2.setbooleanproperty(boolean.true);//which false, set true programmatic purpose ; ... entity2.setbooleanproperty(boolean.false);//at point db updates boolean property false } em.merge(entity1); tx.commit(); } so i'd guess eclipselink takes first change marking field "changed". there no logic save original value , consequently check if reset origi...

python - ast.literal_eval() method truncates float value while converting str to dict -

here trying convert dict string using ast module. found values truncated shown in output below. how can atual value without truncation here. code df = dataframe({ 'a': np.random.randn(6), 'b':['foo','bar']*3, 'c':np.random.randn(6) }) mapping = df.to_dict() d=str(mapping) e= ast.literal_eval(d) print mapping print;print e output {'a': {0: 0.88241526852727104, 1: -0.062779346232699929, 2: -0.058427377402568821, 3: 0.87157579927705897, 4: -1.0399255501591143, 5: 0.11203584043469664}, 'c': {0: 0.56763771194925394, 1: 0.22824054879261255, 2: -0.58324477854217549, 3: -0.2264734421572463, 4: 0.45754374820401839, 5: 1.35849692636584}, 'b': {0: 'foo', 1: 'bar', 2: 'foo', 3: 'bar', 4: 'foo', 5: 'bar'}} ` {'a': {0: 0.882415268527271, 1: -0.06277934623269993, 2: -0.05842737740256882, 3: 0.871575799277059, 4: -1.039...

objective c - cocos2d v3 exception thrown removing sprite from scene -

so im trying make tower defense game, (towers shoot bullets @ advancing enemies), problem when try remove bullet scene after hit enemy, throws exception, no error in debugger. here code: -(void)shootweapon { ccsprite * bullet = [ccsprite spritewithimagenamed:@"snowball.png"]; [thegame addchild:bullet]; [bullet setposition:mysprite.position];//todo offset snowball right of tower [bullet runaction:[ccactionsequence actions:[ccactionmoveto actionwithduration:0.3 position:chosenenemy.mysprite.position],[ccactioncallfunc actionwithtarget:self selector:@selector(damageenemy)],[ccactioncallfunc actionwithtarget:self selector:@selector(removebullet:)], nil]]; } -(void)removebullet:(ccsprite *)bullet { [bullet.parent removechild:bullet cleanup:yes]; } -(void)damageenemy { [chosenenemy getdamaged:damage]; } if has idea why going on, appreciated. cheers the bullet not being passed, hence exception on removebullet: method. this line problem: [ccactio...

jquery plugins - How to create pop up windows on google map clusterer circles -

i using following google map plugin google map clusterer and works perfectly(insead of random variable see in link read locations database.) now have been asked followoing: when user hover on clustered area(not markers) , clustered area mean red or yellow or blue circle , want pop window appears showing information . searched web lot not find anything, possible this?(i appreciate help) update: here code using : $('#map_canvas').gmap({ 'zoom': 3, 'disabledefaultui': true }).one('init', function (evt, map) { var bounds = map.getbounds(); var temp = mark1; var southwest = bounds.getsouthwest(); var northeast = bounds.getnortheast(); var lngspan = northeast.lng() - southwest.lng(); var latspan = northeast.lat() - southwest.lat(); (var = 0; < 300; i++) { var contentstring = 'test'; var $marker = $(this).gmap('addmarker', ...

php - Why I cannot create alias in Mixpanel? -

in mixpanel have user have automatic distinct_id 145dsfds-sdfsdf (example) . want create alias user 1234 my php code: require ('mixpanel/mixpanel.php'); $original_id = '145dsfds-sdfsdf'; // example original $uid = 1234; $token = '2j34j3j4j3j'; // token of project on mixpanel $_mp = new mixpanel($token); $_mp->createalias($original_id, $uid); $_mp->people->set($uid, array( 'uid' => $uid )); after run, go mixpanel , filter people id 1234 , retrieve no result. if visualize details of user 145dsfds-sdfsdf , property uid have value 1234 . i don't understand what's happening. the root of issue here mixpanel's alias function designed remap uid original_id not reverse. essentially, if alias made, distinct_id see in live-view original_id , not uid . the alias function allows tie pre-authentication events post-authentication events without needing edit events stored in mixpanel (events immutable once ...

android - adMob.jar library and google play service.jar not working together -

i have app on market admod banner, , trying add google maps api application. i know how handle admobs library or google maps api separately. when try run app admob , google maps api (google play service), seems have collision or that. or google-play-services.jar , googleadmobadssdk.jar have same class name admob. maybe due reason getting multiple .dex files. my error on console is: trouble writing output: prepared [2014-05-18 18:24:40 - dex loader] unable execute dex: multiple dex files define lcom/google/ads/adrequest$errorcode; [2014-05-18 18:24:40 - workc 3.0.9 actionbar] conversion dalvik format failed: unable execute dex: multiple dex files define lcom/google/ads/adrequest$errorcode; i'm afraid bad admob update application version. how can fix that? you can rid of jar file , use google play services both ads , maps. make following changes: in layout, change ad xml namespace from: <linearlayout xmlns:android="http://schemas.android.com/apk/res/...

jquery - How to submit form and show result without reload? -

let's have 2 divs in document. first 1 has controlling character , second 1 should used preview, result of user work. html <div id="workhere"> <form id="workform" action="php/create_pdf.php" method="post"> <input type="text" class="c" id="inputid"> // etc... </form> </div> <div id="preview"></div> when user insert value, these values in #workform should sent create_pdf_preview.php , result had depict in #preview . js + jquery i tried use .load jquery method , worked. don't know if used in right way , solution looked unacceptable, cause there length limitation method , execution complicated - had collect data js `var datafield = document.getelementbyid("inputid").value;` and use in .load method $(".c").on('blur', function(){ $("#preview").load("php/create_pdf_preview.php?data=...

android - Remove a fragment with linearlayout -

i have linear layout this: <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <textview android:id="@+id/detailstext" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_gravity="center_horizontal|center_vertical" android:layout_margintop="20dip" android:text="default text" android:textappearance="?android:attr/textappearancelarge" android:textsize="30dip" /> and in activity (container of 2 fragments), call: getfragmentmanager().begintransaction().remove(getfragmentmanager().findfragmentbyid(r.id.fragmentcontainer)).commit(); where fragmentconteiner id used framelayout (insted linearlayout) got nullpointerexeption which ...

c++ - Unrecognized command line option -std=c++11 or -std=c++0x -

i'm using dev-c++. when i'm trying compile -std=c++11 or -std=c++0x i'm getting error: unrecognised command line option why? , how can solve it? dev-c++ outdated ide. wasn't developed since 2005. the reason why error message though compiler - that's gcc version age well, of course didn't know c++11 (or c++0x) @ all. try switch code::blocks or newest remake of dev-c++, orwell dev-c++ .

javascript - Check if library is loaded or initialized -

i'm using rs slider js library load on few pages not site have script, common site, trigger libraries, example: var revapi; jquery(document).ready(function() { revapi = jquery('.tp-banner').revolution( { delay:9000, startwidth:1170, startheight:500, hidethumbs:10, lazyload:"on" }); }); in cases, when library js aren't loaded because don't need part of code triggers "minors" errors, how check if js loaded or if revolution() object exists or else avoid problem? yours handle this? you can check specific class exists before initializing plugin. if doesn't plugin function never gets called , won't throw errors if( $('.revolutionclass').length ){ /* initialize plugin */ }

templates - std::tuple objects or rvalue references? -

i have small "plugin system" (not sure right name). allow store objects (plugins), , call methods each of them. approach have absolutely no overhead on iterating/object pass/callback call. // need set, because in c++11 auto can static const. // , may need change them later. #ifndef set #define set(name, value) decltype(value) name = value #endif plugin1 plugin1(param1, param2); plugin2 plugin2(param1, param2); plugin3 plugin3(param1, param2); set(plugins, std::tie( // pay attention here. store &, not objects plugin1, plugin2, plugin3 )); then, when need call function each of plugins, or each of iterate through plugins @ compile time (i check generated asm code, call or inline do_it , without else) , call callback function (i not show iterate code here, it's trivial): struct call{ float k=0; template<typename t, int index> // lambda function not efficient this. tested -o2 clang, gcc 4.8 inline void ...

objective c - UITextView Cursor Color not changing iOS 7 -

i'm trying set cursor color of uitextview based on user's preferences. select color want button. by default, textview's cursor color white. when user presses button, might change green: [_textview settintcolor:[uicolor greencolor]]; [_textview settextcolor:[uicolor greencolor]]; i sure method call working because textview's text changes color, not cursor... i able recreate behavior: if change tint , text color while text view isn't selected (aka: not first responder), work expected. but if first select it, tapping , change color button press, caret's (tint) color won't change. here workaround: - (ibaction)changecolor:(id)sender { [_textview settextcolor:[uicolor greencolor]]; [_textview settintcolor:[uicolor greencolor]]; if([_textview isfirstresponder]){ [_textview resignfirstresponder]; [_textview becomefirstresponder]; } }

Extract contact info like facebook/google id from contacts list/people app in windows phone -

the people app in windows phone keeps connected accounts synced. there way extract synced information in windows phone(please note user have authorized app on facebook , google too). basically need facebook , google id or such identifying credential(of user's contacts in contact list) on phone maintain sync across contacts. i receive list of connected email addresses trying facebook/google userid without having go through process of cross referencing them

compiler construction - LLVM fails to detect very simple loop trip count -

i'm trying understand how loop trip count calculation happens in llvm using scalar evolution analysis. however, can't simple test case work. i have following test program: // bug.cpp int main() { (int = 0; < 16; i++) { // nothing } return 0; } which compile this: $ clang++ -o0 -emit-llvm -c -o bug.bc bug.cpp and analyze this: $ opt -analyze -indvars -loop-simplify -scalar-evolution < bug.bc but output of scalar evolution this: ... determining loop execution counts for: @main loop %for.cond: unpredictable backedge-taken count. loop %for.cond: unpredictable max backedge-taken count. why simple loop have unpredictable trip count? doing wrong in invoking analysis? llvm 3.4. solved of related question: the use of getsmallconstanttripcount method of loop in llvm add mem2reg optimization pass , trip count correctly computed. $ opt -analyze -mem2reg -indvars -loop-simplify -scalar-evolution < bug.bc

objective c - Show downloaded PDF file with webView ios -

i'm making iphone app, download pdf file , display in webview. script not show downloaded pdf. download , save in documents, webview not show it. here's script: nsstring *path = [[nsbundle mainbundle] pathforresource:@"3" oftype:@"pdf"]; nsurl *urlen = [nsurl fileurlwithpath:path]; nsmutableurlrequest *urlrequest = [nsmutableurlrequest requestwithurl:urlen]; [webview loadrequest:urlrequest]; [webview setscalespagetofit:yes]; from official documentation on nsurl official documentation on nsurl . sending nil argument fileurlwithpath: produces exception. the problem [[nsbundle mainbundle] pathforresource:oftype:] . returning nil , rather actual path file. the problem here [nsbundle mainbundle] refers files bundle app. need in app's document directory, stores files has downloaded. this method give path app's document directory: nsstring* documentspath = [nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomai...

SignalR disconnects and does not reconnect -

whenever application gets reset, signalr disconnects not reconnect. i have long running server task sends updates clients when each task completed. // inside action executed on every completion of task var h = new forcehub(); h.messagesent(email); above code stops sending updates when application gets reset (i can emulate problem touching web.config). i'd way reconnect client. user has reload page updates again. here hub definition public class forcehub : hub { public void messagesent(string text) { getcontext().clients.all.sent(text); } public void updatestatus(string msg) { getcontext().clients.all.status(msg); } ihubcontext getcontext() { return globalhost.connectionmanager.gethubcontext<forcehub>(); } public override task onconnected() { try { ioc.resolve<ilogger>().info("signalr connected -----------"); }catch (exception){} return bas...

javascript - Ember.js - Rendering a different layout on a nested route change -

i have route like: /images that renders grid of images. when user clicks on image transition nested route: /images/:image_id to display large versions of image. i want display large image grid images bordering , smaller displayed in grid view, i'm not sure approach in ember be. the grid view like: * * * * * * * * * * * * * * * * * * and view when 1 clicked on like: . . . . . . _______ . . | | . . | | . . |_______| . . . . . . * = medium thumbnails . = small thumbnails box = large image i thought creating imagescontroller action handle when image in grid selected. if condition in images handlebars template changes images layout , has outlet large image. like: <script type="text/x-handlebars" data-template-name='images'> {{#if isgridview}} draw each image in grid {{else}} draw small images {{outlet}} <-- large image {{/if}} </script> i thought of ma...

objective c - Find closest point from array of points -

i have array of cgpoints (well, nsstrings cgpoints). i have separate point called cgpoint nextpoint. how find out cgpoint, in array, closest nextpoint? have considered iterating through array , finding distance between points ? you store distance in new nsmutablearray , grab smallest value it .

vb.net - how to count the total number of checked data grid view check boxes by rows not by columns -

we doing student monitoring attendance , , want count total number of days each student present , absent . subject ln fn mi 05/21/14 05/20/14 05/21/14 05/22/14 05/23/14 p comp101 yu erick c (checked|(unchecked)|(checked)|(checked)|(checked)|4 | 1 "this wanted instead of counting horizontally counts vertically.is there can solving problem? private sub button1_click(byval sender system.object, byval e system.eventargs) handles button1.click dim present integer = 0 dim absent integer = 0 = 0 datagridview1.rowcount - 1 b = 0 datagridview1.columncount - 8 if datagridview1.rows(a).cells(b + 5).value = true present += 1 else absent += 1 end if next datagridview1.rows(a).cells(10).value = present datagridview1.rows(a).cells(11).value = absent present = 0 absent = 0 next end sub try ....

puppet - Should I edit modules from forge.puppetllabs.com directly? -

when install module forge.puppetlabs.com, module installed in /etc/puppetlabs/puppet/modules. let's have installed puppetlabs ntp module need customize it. edit module's files in /etc/puppetlabs/puppet/modules/ntp or should copy ntp directory directory (a dir in modulepath of course) , hack there? thanks. this question bears similarity this other one (no duplicate though, feel). what want "fork" (in github speak) module , use own version right in place of upstream one. ideally, changes in general fashion , configurable, other users can benefit them if open pull request enhancements upstream.

php - FreeBSD 10.0-RELEASE #0 php5 apache2.2, not loading extensions, cli it works fine -

<?php phpinfo(); ?> it shows mbstring being loaded if run php index.php console. but if load website (apache 2.2) not load mbstring . apache 2.2 configure www:www user:group . i reinstalled apache 2.2, php, php5-exensions, mod_php5 php5 many times, , still see same issue. tried apache24 php55 well, same issue. had no problem when running freebsd 8. /usr/local/etc/php 1164$ cat extensions.ini extension=bz2.so extension=hash.so extension=phar.so extension=zip.so extension=zlib.so extension=iconv.so extension=mbstring.so extension=dba.so extension=mysql.so extension=mysqli.so extension=pdo.so extension=simplexml.so extension=session.so extension=gd.so extension=gettext.so extension=calendar.so extension=ctype.so extension=curl.so extension=dom.so extension=fileinfo.so extension=filter.so extension=ftp.so extension=gmp.so extension=json.so extension=mcrypt.so extension=openssl.so extension=pcntl.so extension=pdf.so extension=pdo_mysql.so extension=pdo_sqlite.so ...

mysql - How to translate this sql to left join without subquery? -

i want create view in mysql.but in mysql does't support subquery. how write sql without subquery? select * dev_location t1 inner join ( select `dev_location`.`device_id` `device_id`, max(`dev_location`.`id`) `id` `dev_location` group `dev_location`.`device_id`) t2 on t1.id = t2.id mysql views don't support subqueries in from clause. following should work in view: select dl.* dev_location dl not exists (select 1 dev_location dl2 dl2.device_id = dl.device_id , dl2.id > dl.id ); this reformulates query say: "get me rows dev_location device_id has no greater id ." awkward way of getting max. and, index on dev_location(device_id, id) , might perform better version.

python - Changing jinja_env from a blueprint -

i trying register new jinja global on blueprint using blueprint object. however, appears blueprint objects not have jinja_env attributes; how can register new jinja global attributes? here's __init__.py of blueprint, not work: from flask import blueprint, current_app uploader = blueprint('uploader', __name__, template_folder='templates') . import views . import models current_app.jinja_env.globals['form_token'] = views.generate_form_token nor this: uploader.jinja_env.globals['form_token'] = views.generate_form_token use blueprint.app_template_global decorator register global function jinja env. uploader.app_template_global(views.generate_form_token) or in views.py: @uploader.app_template_global def generate_form_token(): pass

c# - Response Redirection Failed to work -

i want pass fb response client end server end ( code behind ) function testapi() { console.log('welcome! fetching information.... '); fb.api('/me', function (response) { $.post('http://localhost:4741/default.aspx', { fbid: response.id, firstname: response.first_name, lastname: response.last_name, email: response.email, bday: response.birthday }, function (result) { }); console.log('good see you, ' + response.id + response.name + response.id + response.email + response.gender + response.birthday + '.'); }); } i'd value , process in page load protected void page_load(object sender, eventargs e) { var fbid = request.form["fbid"]; var fname = request.form["firstname"]; var lname = request.form["lastname"]; var email = requ...

javascript - change Initial min date in jquery datetimepicker -

i assigned $(function(){ var startdate = $('#datefrom'); var enddate = $('#dateto'); startdate.datetimepicker('option', 'mindate', new date(+new date()-2592000000)); //***here try init min date start date startdate.datetimepicker({ showsecond: true, dateformat: 'yy/mm/dd', timeformat: 'hh:mm:ss', onclose: function(datetext, inst) { if (enddate.val() != '') { var teststartdate = startdate.datetimepicker('getdate'); var testenddate = enddate.datetimepicker('getdate'); if (teststartdate > testenddate) enddate.datetimepicker('setdate', teststartdate); } // else { // enddate.val(datetext); // } }, onselect: function (selecteddatetime){ enddate.datetimepicker('option', 'mindate', startdate.datetimepicker('getdate') ); } }); e...

javascript - Similar slide Fullpage.js -

is possible set 2 sections same slide? if i'm on (section 1 slide 1) move (to section 1 slide 2), section 2 set slide 2. i'm wondering if possible in fullpage.js i create similar this. jsfiddle.net/7p927/ <div class="section" id="first"> <div class="slide">1</div> <div class="slide">2</div> <div class="slide">3</div> </div> <div class="section" id="second"> <div class="slide">1</div> <div class="slide">2</div> <div class="slide">3</div> </div> no, not possible right now. can take @ modifications in plugin achieve it. take @ answer: https://github.com/alvarotrigo/fullpage.js/issues/129#issuecomment-30747985 then call function in callback such afterslideload .

Aw snap Error on javascript in google chrome -

i have asp page in use javascript ruzeeborders.js borders, in window.onload function line: ruzee.borders.render(); gives 'aw snap' error in google chrome while in other browsers doesn't show error, i want use ruzee.borders.render(); how resolve error? if remove line page show on including line gives 'aw snap' error why?