Posts

Showing posts from January, 2013

ruby - Can't install rails on my Mac -

ruby - Can't install rails on my Mac - i trying install rails on mac version 10.9.5 , not working when seek see version of rails have installed following: /system/library/frameworks/ruby.framework/versions/2.0/usr/lib/ruby/2.0.0/universal-darwin13/rbconfig.rb:213: warning: insecure world writable dir /usr/local in path, mode 040777 rails not installed on system. latest version, type: $ sudo gem install rails can rerun "rails" command. if seek run command, getting... sudo gem install rails password: dyld: library not loaded: /usr/local/lib/libgmp.10.dylib referenced from: /users/ppmartins/.rvm/rubies/ruby-2.1.3/bin/ruby reason: image not found any thought what's happening , how solve issue? thank all. it best never utilize scheme ruby install gems. scheme ruby version of ruby ships mac. osx uses ruby various tasks, best leave lone , not risk corrupting gems. instead, should utilize ruby version managers install versions of ruby sc

c# - refresh panel content when modal child is shown -

c# - refresh panel content when modal child is shown - i have main form panel drawn 3d scene. ok. after create modal form go modify things in 3d scene, , wish see result straight without closing modal form, until close form, no changes in '3d' panel. i tried this: my3dpanel.invalidate(); with nil changes; my3dpanel.refresh(); with panel take 'background' init color until close modal form. how can this? to refresh created static class this: public static class editorhelper { public delegate void refreshbridgeeventhandler(); public static event refreshbridgeeventhandler refreshbridgeevent; public static void needtonotifyparent() { if (refreshbridgeevent != null) { refreshbridgeevent(); } } } and main window: public frmmain() { initializecomponent(); editorhelper.refreshbridgeevent += editorhelper_refreshbridgeevent; } void editorhelper_refreshbridgeev

c# - Access camera preview-stream on Windows Phone 8.1 -

c# - Access camera preview-stream on Windows Phone 8.1 - i'm trying create basic photographic camera application (for first application targeted towards wp). , want to, of course, preview photographic camera info screen before taking shot. but samples see online msdn etc old (many objects have been removed, ie libraries beingness updated making articles obsolete) i'm having problem getting started preview-stream. appreciated if knowledge give me help in matter. thank you. i suggest using captureelement control on xaml add together this: <captureelement x:name="capture" stretch="uniformtofill" flowdirection="lefttoright" /> i don't know if want utilize front end or webcam i'll show code both. in codebehind (or viewmodel if using mvvm) add together code: // first need find webcams deviceinformationcollection webcamlist = await deviceinformation.findallasync(devicecl

Workbook with Ribbon keeps crashing Excel -

Workbook with Ribbon keeps crashing Excel - i have big workbook complex vba project. the workbook has custom-ribbon... there quite alot happening in workbook_open event too, unprotecting , reprotecting (userinterfaceonly), hiding , showing various sheets, storing reference ribbon etc. when macros not automatically enabled, workbook opens, enable button appears , when click happens should. the problem arises when file trusted, , macros run automatically. in these circumstances, has tendency crash application. it's though, if there pause user has click button, excel preparations, displays ribbon , workbook_open stuff, if there no enable button somehow excel's own startup stuff , displaying ribbon seems tangled workbook_open event, causing crash. this happens in 2007, 2010 , 2013 , on both windows 7 & 8(.1) i suspect ribbon, because problem isn’t total crash, instead, workbook opens, ribbon area blank. fyi code in workbook_open event looks this: enter

sql - MySQL table and query optimization -

sql - MySQL table and query optimization - the next table: gps_gotaxiking +-----------+---------------------+------+-----+---------+----------------+ | field | type | null | key | default | | +-----------+---------------------+------+-----+---------+----------------+ | recordid | bigint(20) unsigned | no | pri | null | auto_increment | | carno | varchar(10) | no | mul | null | | | valid | varchar(48) | no | | null | | | lon | varchar(13) | no | | null | | | lat | varchar(13) | no | | null | | | angle | varchar(10) | no | | null | | | speed | varchar(10) | no | | null | | | carstatus | varchar(10) | no | | null | | | time | datetime | no | | null | | +----------

user interface - JavaFX tab pane not showing up -

user interface - JavaFX tab pane not showing up - i'm trying create simple ui using fxml application app send text file application used there. goal first tab in tab pane allow user input own grouping names , add together them list of grouping names they've entered. i'm hoping have user type grouping name textfield, , click add together button, move grouping name textarea goes new line. think i've gotten action handler right can't test because when run programme nil shows up! help appreciated. the java code: package pipeline.ui; import javafx.application.application; import javafx.fxml.fxmlloader; import javafx.scene.parent; import javafx.scene.scene; import javafx.stage.stage; /** * * @author pat */ public class pipelineui extends application { @override public void start(stage stage) throws exception { parent root = fxmlloader.load(getclass().getresource("pipelineui.fxml")); scene scene = new scene(roo

c++ - Benchmarking linefeed characters vs std::endl -

c++ - Benchmarking linefeed characters vs std::endl - i'm reading “\n” or '\n' or std::endl std::cout? . despite consensus doesn't matter choose, decided build contrived test measure programme execution speed of each. here simple program: #include <iostream> int main() { (std::size_t = 0; < iters; ++i) { #ifdef ver1 std::cout << "\n"; #endif #ifdef ver2 std::cout << '\n'; #endif #ifdef ver3 std::cout << std::endl; #endif } } using 1 billion iterations , -o3 , redirecting output /dev/null/ , these results: class="lang-none prettyprint-override"> "\n" 0:30.96 '\n' 0:31.66 with -o2 : class="lang-none prettyprint-override"> "\n" 0:32.96 '\n' 0:31.54 why higher optimization level create '\n' slower? with setup, you're measuring test run happened interrupted lo

datetime - Timestamp with a millisecond precision: How to save them in MySQL -

datetime - Timestamp with a millisecond precision: How to save them in MySQL - i have develop application using mysql , have save values "1412792828893" represent timestamp precision of millisecond. is, amount of milliseconds since 1.1.1970. declare row timestamp unfortunately didn't work. values set 0000-00-00 00:00:00 create table if not exists `probability` ( `id` int(11) not null auto_increment, `segment_id` int(11) not null, `probability` float not null, `measured_at` timestamp not null, `provider_id` int(11) not null, primary key (`id`) ) ; how should declaration in order able save timestamp values precision? you need @ mysql version 5.6.4 or later declare columns fractional-second time datatypes. for example, datetime(3) give millisecond resolution in timestamps, , timestamp(6) give microsecond resolution on *nix-style timestamp. read this: http://dev.mysql.com/doc/refman/5.7/en/fractional-seconds.html now(3) give nowadays time milliseco

c - Reading the linux utmp file without using fopen() and fread() -

c - Reading the linux utmp file without using fopen() and fread() - i trying open utmp file in linux , read contents array of utmp structures. after display ut_user , ut_type each construction in array. have working when open file file *file , utilize fopen() , fread() functions when seek same task file descriptor int file , open() , read() functions address locations when trying access members of utmp structure. so in below programme can see commented out 3 lines of code utilize perform task of reading utmp file array of utmp structures , print out 2 of members values. when seek doing exact same thing 3 lines of code (denoted "new way") in place of old way worked bunch of address locations rather values of ut_user , ut_id . #include <unistd.h> #include <sys/stat.h> #include <fcntl.h> #include <stdlib.h> #include <stdio.h> #include <string.h> #include <utmp.h> void utmpprint(str

jquery - button with image dont working after refresh -

jquery - button with image dont working after refresh - please, can help me problem? here's link the button under "velkostna tabulka" image , can't click anywhere i.e. buttons don't work until refreshing page, do. removing image button makes work fine how can create button work image? thank much! the error in console says 'jquery not defined' please refer this: jquery - $ not defined jquery html css button

condition for session changing head.php -

condition for session changing head.php - i working on index.php, want when user logs in redirected index.php 1 time again time different head.php store session of user. i have tried one. if(isset($_session['iscustomer'])){ include 'includes/customer.head.php'; echo "hahaha"; } else{ include 'includes/head.php'; } and here checklogin.php if($row['type'] == 'admin'){ $_session['isadmin'] = true; header("location: admin/admin.php"); } else if($row['type'] == 'customer'){ $_session['iscustomer'] = true; header("location: ../index.php"); } when "i have tried one." if(isset($_session['iscustomer'])){ include 'includes/customer.head.php'; echo "hahaha"; } else{ include 'includes/head.php'; } i'm guessing didn't work. create sur

javascript - Choosing personalization slide in Jssor slider -

javascript - Choosing personalization slide in Jssor slider - first have slider 3 images rotate , have selector. var jssor_slider1 = new $jssorslider$("slider1_container", options); i have function in which, depending on selected alternative in select, want stop , show specific slide slider. how he? this function have not work well. $(".enlace").click(function(i){ var id = $(this).attr("id"); if(id == 'sdinero'){ options = { $autoplay: false, $startindex : 0, $pauseonhover : 3 }; var jssor_slider2 = new $jssorslider$("slider1_container", options); } else{ options = { $autoplay: false, $startindex : 1, $pauseonhover : 3 }; var jssor_slider3 = new $jssorslider$("slider1_container", options); } if(contador==0){ var text = $(this).text();

Drupal 7: how to filter view content (with entity reference field) based on current page content -

Drupal 7: how to filter view content (with entity reference field) based on current page content - in drupal 7 have 2 content-types these: contenta contentb (with field entity reference contenta) in front-end detail page of contenta, love show block/view list of contentb entity reference field set current contenta. i made view of type block , added correctly page, cannot filter contentb based on current contenta. could help me? thanks you should add together contextual filter value utilize filtering block view of contentb. in contextual filter in "when filter value not in url" area select "provide default value" , type "php code" (you should have enable php filter this). in php code area should have next code $node=menu_get_object(); homecoming $node->field_your_machine_field_name['und'][0]['target_id']; // field utilize fitlering hope helps update the above code work if need show in block similar

javascript - page navigation not working -

javascript - page navigation not working - i'm new phonegap , have had pick else's code. having issue page navigation. have onclick event on list item , depending on boolean, want navigate specific page. the 2 possible pages user move identical. there 1 div different containing list view. had 1 page , loaded html of div dynamically javascript css not beingness applied decided create additional page identical apart 1 div mentioned above. my issue whichever div(page) create first in index.html work navigation sec 1 not i.e. if define divs in next order: <div id="page1" data-role="page"></div> <div id="page2" data-role="page"></div> then navigating page1 work , navigating page 2 not. if switch order in place divs in index.html page i.e. <div id="page2" data-role="page"></div> <div id="page1" data-role="page"></div> then navigat

c# - Microsoft sync The default schema does not exist -

c# - Microsoft sync The default schema does not exist - i utilize microsoft sync framework sync info between remote , local info base, face error "the default schema not exist" when applying provisioning on remote server. sqlsyncprovider sqlproviderlocal = new sqlsyncprovider(scopename, sqlconnlocal); sqlsyncprovider sqlproviderremote = new sqlsyncprovider(scopename, sqlconnremote); sqlsyncscopeprovisioning scopeprovisionlocal = new sqlsyncscopeprovisioning(sqlconnlocal); scopeprovisionlocal.objectschema = ".dbo"; if (!scopeprovisionlocal.scopeexists(scopename)) { dbsyncscopedescription scopedesc = new dbsyncscopedescription(scopename); foreach (var item in tables) { scopedesc.tables.add(sqlsyncdescriptionbuilder.getdescriptionfortable(item, sqlconnlocal)); } scopeprovisionlocal.populatef

html - How to position a pseudo element higher -

html - How to position a pseudo element higher - very simple question: have pseudo element (right-pointing arrows) position higher are. i've tried changing line-height , changes height of element itself. a basic outline of problem: css: ol { list-style-type: none; } ol > li { display: inline; } ol > li + li:before { font-size: 8px; content: "➤"; /* want positioned higher, it's right between vertical height of list items rather floated near bottom */ } html: <ol> <li> <a>list item 1</a> </li> <li> <a>list item 2</a> </li> <li> <a>list item 3</a> </li> </ol> and fiddle: http://jsfiddle.net/hxb5gy5j/ add vertical-align: middle; , line-height: 0px; li:before this: demo class="snippet-code-css lang-css prettyprint-override"> ol { list-style-type: none; } ol &g

java - Add extra processing in hibernate cascaded methods -

java - Add extra processing in hibernate cascaded methods - how add together processing called whenever cascaded operation such save() called? example, if have thing in database lots of subthings, processing must done before beingness stored (for illustration finding out today's date, , storing in column "create_date") , let's applies every single database entry. so when save thing (using jackson's objectmapper), has subthings defined in json, create_date beingness null (because don't want client worry that). when save thing, hibernate cascade invoke native hibernate save() on subthings, means though create_date processing done thing, won't done subthings, means database complain subthings don't have create_dates on them. it trivial hibernate interceptors ( org.hibernate.emptyinterceptor ). here's example: hibernate interceptor illustration - audit log java hibernate jackson

iOS UI automation: Handling alertViews when the length of textbox is exceeded -

iOS UI automation: Handling alertViews when the length of textbox is exceeded - i new ios auto tool. have text-box length 20 letters. when trying type more 20, such 21 letters, error shown like: "length exceeded", having 1 "ok" button , after error, tap on ok button dismiss pop up, , if wanna save change, tap on save button. script this: target.frontmostapp().mainwindow().tableviews()[2].cells()[0].tap();// name target.frontmostapp().keyboard().typestring("mmmmmmmmmmmmmmmmmmmn"); target.delay( 5 ); uiatarget.onalert = function onalert(alert){ var title = alert.name(); uialogger.logwarning("alert title' " + title + " ' encountered!"); if (title == "error") { alert.buttons()["ok"].tap(); homecoming true; // bypass default handler } homecoming false; // utilize default handler } target.frontmostapp().navigationbar().butto

.net - Copy values from one businesobject to another without loop in c# -

.net - Copy values from one businesobject to another without loop in c# - i have 2 business objects in c# same fields , properties, different namespaces. namespace b1 { class myclass { public string name{get;set;} public int age{get;set;} } } namespace b2 { class myclass { public string name{get;set;} public int age{get;set;} } } now want re-create values on business object another. b1.myclass b1 = new b1.myclass{name="john", age=18}; b2.myclass b2; how can set property values of b2 same b1?? i have 1 method, don't want it, cause business object has mote 50 properties. b2 = new b2.myclass{number=b1.number, age=b1.age} that sounds job automapper, written solve problem. c# .net namespaces

c# - How to check if TcpClient Connection is closed? -

c# - How to check if TcpClient Connection is closed? - i'm playing around tcpclient , i'm trying figure out how create connected property false when connection dropped. i tried doing networkstream ns = client.getstream(); ns.write(new byte[1], 0, 0); but still not show me if tcpclient disconnected. how go using tcpclient? i wouldn't recommend seek write testing socket. , don't relay on .net's connected property either. if want know if remote end point still active, can utilize tcpconnectioninformation: tcpclient client = new tcpclient(host, port); ipglobalproperties ipproperties = ipglobalproperties.getipglobalproperties(); tcpconnectioninformation[] tcpconnections = ipproperties.getactivetcpconnections().where(x => x.localendpoint.equals(client.client.localendpoint) && x.remoteendpoint.equals(client.client.remoteendpoint)).toarray(); if (tcpconnections != null && tcpconnections.length > 0) { tcpstate stateofco

mouseover - Hoverstate on parent jQuery script works only one way -

mouseover - Hoverstate on parent jQuery script works only one way - i want parent items in navigation have hover or active state when hover on kid items. so looked around , found out can utilize jquery accomplish this. made script: <script> jquery(document).ready(function($) { var $nav = $('#productnav ul.sub-menu li'); $nav.mouseover(function() { $("#productnav ul.sf-menu li.deeper").addclass(' overstate ') } ); $nav.mouseleave(function() { $("#productnav ul .sf-menu li.deeper").removeclass(' overstate ') } ); }); </script> after few hours (and reading lot), got work. partially. the class added parent, works fine. not removed. tried create hover method jquery same result. anybody know what's wrong in script? regards, hans check this: $("#productnav ul.sf-menu li.deeper") $("#productnav ul .sf-menu li.deeper") try remo

Too many initializers for array in C++ -

Too many initializers for array in C++ - i trying initialize array in visual c++. in header file, declaring array this. int pawnsquaretable[64]; in cpp file include header file, initializing array in constructor of class in manner: pawnsquaretable[64]={0,0,1,2.....64 values}; however, vc++ giving me too many initializer values error. why happening? edit: reddish squiggly line underlines sec element of array. a::a() // : pawnsquaretable{1,2,3,4} // compile in clang/gcc { // msvc, instead int* p = pawnsquaretable; for( int : {1,2,3,4} ) // <- values here *p++=i; } c++ arrays

javascript - limit() isn't working for me in when using find() -

javascript - limit() isn't working for me in when using find() - i new mongodb , meteor.js , trying check if document existed in collection. i know can utilize findone or find({condition}).count() , article here made point faster use: find({condition}).limit(1).size(). when utilize like playerslist.find({'name':"bill"}).limit(1).size() where playerslist collection, error saying: "typeerror: undefined not function (evaluating 'playerslist.find({'name':playername}).limit(1)')" can explain doing wrong? the minimongo api implemented in metor not same mongo api implemented in mongo shell. in case, limit function not implemented in meteorjs "minimongo" cursor binding. instead set limit in options of find function. posts.find({name:"bill"}, {limit:1}).count() take @ http://docs.meteor.com/#find , read find function options. javascript mongodb find limit

java - How to avoid Concurreny from front end -

java - How to avoid Concurreny from front end - we have requiremnt manager log in site , see list of user record in table format. when click on record detail of user , phone call user resolve issue.now possible 2 manager login , click on same record , phone call same user @ same time. want avoid this. condition 1 : 2 manager login @ same time record available both in normal color green. manager 1 click on record , start editing/calling user. in case there should kind of lock if manager 2 tries open same record pop message 'in progress'. condition 2 : manager 1 login , see record in greenish color. manager 2 login , see same record in gray color. should not able click record. +++++++++++++++++ manager1: select status, ver_no record record_id=? (ver_no zero) click on record see detail , update record set status='in progress', ver_no=1 record_id=? , ver_no=0 (ver_no 1 - success) now manager 2 login after time , manager 1 has not closed record means stat

How to disable java out-of-date ActiveX control blocking feature in Internet Explorer -

How to disable java out-of-date ActiveX control blocking feature in Internet Explorer - recently ie has introduced new security feature out of date activex blocking. if application uses activex control. , while loading in ie checks whether date or not. if not, prompts message , blocks loading. example, if scheme contains lesser version of jre (assume 1.7.0_55) , if seek load applet in ie. prompts because there update java available. is there way disable feature. checked next link microsoft, http://technet.microsoft.com/en-us/library/dn761713.aspx have given 2 solutions problem 1. modifying grouping policy settings using administrative templates 2. modifying grouping policy settings using registry commands these solutions scheme level , more confusing user. there simple , improve solution. have seen original blog post ie dev team or kb article? they seem pretty definitive when combined info in technet article linked to. hope helps... -- lance java

c# - System.InvalidOperationException in WCF and EF -

c# - System.InvalidOperationException in WCF and EF - i have solution (xyz) 4 projects (xyz.domain, xyz.data, xyz.service , xyz.client). need run wcf web service. code: namespace xyz.domain { using system; using system.collections.generic; using system.componentmodel.dataannotations; using system.linq; using system.runtime.serialization; using system.text; using system.threading.tasks; // updated properties [datacontract] public class x : baseclass { [datamember] [key] public int xx { get; set; } [datamember] [required] [stringlength(15)] public string xy { get; set; } [datamember] public bool xz { get; set; } // relationship y 1:1 [datamember] public virtual y y { get; set; } } // updated properties [datacontract] public class y : baseclass { [datamember] [key] [databasegenerated(databasegen

php - How to get the failed tasks in Celery? -

php - How to get the failed tasks in Celery? - i using celery process tasks. can see how many active or scheduled etc, not able find way see tasks have failed. flower show me status if running when task started , failed. there command tasks have failed (status: failure) ? i have task id when task created. there millions of them. can't check 1 1 if there way check task id. if there such command, please allow me know. task id has state , status properties. can status of tasks id. my_task_id = my_task.delay(foo) my_task_id.state my_task_id.status gives status whether pending, started, retry, failure or success. afaik, celery show active, scheduled, reserved, revoked id doesn't show failed tasks. since have task id's, can loop on status. for task_id in task_id_list: if task_id.state == 'failure' print(task_id) php python ubuntu celery flower

tfs - Is it possible to display bugs of different projects in same Sprint(Backlog or Kanban) -

tfs - Is it possible to display bugs of different projects in same Sprint(Backlog or Kanban) - i have 2 different projects within same project collection. possible display bugs of both projects in same backlog or kanban board. i had issue myself , found solution when switched kanban tool; creating swimlanes on 1 kanban board (one swimlane each project) , allowing bugs placed in backlog , farther development tasks in next columns. have finish view across many projects in 1 board. happy share findings. tfs kanban backlog

jquery - Creating code representing the Position Analysis of a Slider Crank Mechanism using a Newton Raphson Method. -

jquery - Creating code representing the Position Analysis of a Slider Crank Mechanism using a Newton Raphson Method. - i trying create position analysis code of slider crank mechanism in matlab. i maintain getting next error in code , cant understand how prepare it. give me guidance. undefined function 'solve' input arguments of type 'char'. error in slidercrank (line 20) solc = solve(eqnc, 'xcsol' ); the code below % position analysis % r-rrt clear % clears variables workspace clc % clears command window , homes cursor close % closes open figure windows % input info ab=0.5; bc=1; phi = pi/4; % position of joint (origin) xa = 0; ya = 0; % position of joint b - position of driver link xb = ab*cos(phi); yb = ab*sin(phi); % position of joint c yc = 0; % distance formula: bc=constant eqnc = '( xb - xcsol )ˆ2 + ( yb - yc )ˆ2 = bcˆ2'; % solve above equation solc = solve(eqnc, 'xcsol' ); % solve symbolic solutio

Android: text button disordered and cut when more than 1 line -

Android: text button disordered and cut when more than 1 line - i having problem text in button. when text more 1 line, size of button shortened above , text not appear in center , cutting bottom. what can problem? xml <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/linear_botones" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" > <button android:id="@+id/boton_monumento_1" android:layout_width="100dp" android:layout_height="45dp" android:layout_marginright="1dp" style="@style/botonmonumentos" /> <button android:id="@+id/boton_monumento_2" android:layout_width="100dp" android:layout_height="45dp" android:layout_marginright="1dp" style="@style/botonmonumentos" /> <

ios - Customer Cell returns nil when unwrapping an Optional Value -

ios - Customer Cell returns nil when unwrapping an Optional Value - i have custom table view cell. in story board, have implemented uilabel , uibutton . want give label different value everytime reused. storyboard connections good. if utilize cell.textlabel.text = episodetitle works, if set text property of uilabel error fatal error: unexpectedly found nil while unwrapping optional value i have tried registering class doesn't work. not sure anymore. there tons of similar posts on none helped. this cellforrowatindexpath : override func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell { //tableview.registerclass(episodecell.self, forcellreuseidentifier: "episode") var cell = tableview.dequeuereusablecellwithidentifier("episode", forindexpath: indexpath) episodecell cell = episodecell(style: uitableviewcellstyle.subtitle, reuseidentifier: "episode") allow ep

java - Illegal character in URL -

java - Illegal character in URL - i error " illegal character in url " in code , don't know why: have token , hash string type. string currenturl = "http://platform.shopyourway.com" + "/products/get-by-tag?tagid=220431" + "&token=" + token + "&hash=" + hash; httpurlconnection urlconnection = null; bufferedreader reader = null; seek { url url = new url(currenturl); urlconnection = (httpurlconnection) url.openconnection(); urlconnection.setrequestmethod("get"); urlconnection.connect(); [...] but when wrote : url url = new url("http://platform.shopyourway.com/products/get-by-tag?tagid=220431&token=0_11800_253402300799_1_a9c1d19702ed3a5e873fd3b3bcae6f8e3f8b845c9686418768291042ad5709f1&hash=e68e41e4ea4ed16f4dbfb32668ed02b080bf1f2cbee64c2692ef510e7f7dc26b"); it's work, can't write order because do

python - Relationship between I2C operating frequency and sample rate setting in MPU6050 -

python - Relationship between I2C operating frequency and sample rate setting in MPU6050 - i interested in reading gyroscope info raspberrypi , python confused how set sample rate of mpu6050 (accelerometer, gyroscope;datasheet mpu6050) according i2c clock frequency in order avoid wrong reading info (for illustration reading while there not info in buffer or reading faster writing, , on), in knowledge each measure 16 bit word. is there relationship between 2 clocks? i did project same chip 18 months ago. haven't touched pi since then, don't know how things may have changed in meantime. in event, used smbus read chip. few things found out hard way, reading individual registers slow compared i2c block read. also, had turn off sleep mode. sorry don't have info on clock timing, if trying read loop, might help. don't have utilize numpy, if plan manipulate samples, it's quite helpful. gl/hf. import smbus import numpy # initialize bus = smbus.smbus(

ios - Custom callouts are all showing on the map after annotation added -

ios - Custom callouts are all showing on the map after annotation added - i creating custom mkpinannotationview, , after annotation added map view. of them displaying on map. don't want that, want open callout when click on pin , show callout. right code below: customannotationview.h @interface customannotationview : mkpinannotationview @property (nonatomic, strong) annotationview *annotationview; @end customannotationview.m @implementation customannotationview - (instancetype)initwithannotation:(id<mkannotation>)annotation reuseidentifier:(nsstring *)reuseidentifier { self = [super initwithannotation:annotation reuseidentifier:reuseidentifier]; if (self) { self.annotationview = (annotationview *)[[[nsbundle mainbundle] loadnibnamed:@"annotationview" owner:self options:nil] lastobject]; [self addsubview:self.annotationview]; } homecoming self; } mapviewcontroller.m - (void)viewdidload { __weak typeof(self

c# - GridViewRow not looping through to the last data row when using multiple headers in GridView -

c# - GridViewRow not looping through to the last data row when using multiple headers in GridView - i have gridview linked datatable in asp.net code, have added 2 header rows in rowdatabound event this: gvmain.controls[0].controls.addat(0, row2); gvmain.controls[0].controls.addat(0, row1); now, when loop through gridview on button click event using this: foreach (gridviewrow gvr in gvmain.rows) { } i don't lastly 2 rows, loop finishes before lastly 2 info rows. think because counting 2 header rows , ignoring lastly 2 info rows. how can lastly 2 rows of gridview in loop? c# asp.net gridview gridviewrow

ruby on rails - Custom scope in ActiveRecord - Reverse sorting is produced with invalid syntax -

ruby on rails - Custom scope in ActiveRecord - Reverse sorting is produced with invalid syntax - rails version 4.1.6, postgres version not important. i utilize custom sorting, strings come before integers , integers sorted numbers: sample sorting: a0101 bd330 be124 1 2 3 10 since there no direct way accomplish query interface, i've found postgres specific syntax which, in general, works fine: default_scope { order("substring(entries.code, '[^0-9_].*$') asc"). order("(substring(entries.code, '^[0-9]+'))::int asc") } for example, first record: 2.0.0p247 :001 > entry.first entry load (3.6ms) select "entries".* "entries" order substring(entries.code, '[^0-9_].*$') asc, (substring(entries.code, '^[0-9]+'))::int asc limit 1 => #<entry id: ...............> however, when want reverse search, desc words raining on query string... quite annoying since haven'

python - Using the 'str.join' syntax within the robot framework -

python - Using the 'str.join' syntax within the robot framework - i looking implement python str.join function on robot framework level , i'm not sure of proper syntax. i've showed code looks in python (which works) i've tried this: robot: set suite variable @{list} ['a', 'h', 'b', 'a', 'f', 'h', 'l'] log @{','.join(list)} code in python: p = ['a', 'h', 'b', 'a', 'f', 'h', 'l'] print ','.join(p) use builtin's catenate. ${my string}= catenate separator=, @{list} also, not creating list in question. should more this: @{list}= create list h b f h l python join robotframework

java - Android Studio 0.9.1 Gradle build failed. Error:Cause: peer not authenticated -

java - Android Studio 0.9.1 Gradle build failed. Error:Cause: peer not authenticated - android studio giving me error: gradle project sync failed. basic functionality (e.g. editing, debugging) not work properly. here error message: error:cause: peer not authenticated gradle 'myapplication' project refresh failed i tried reply question, gave me same issue. any help appreciated!! java android xml android-studio

Output Not Fully Displaying When Running The Program in Java -

Output Not Fully Displaying When Running The Program in Java - i using bluej , reference. the programme compiles , runs fine. the problem output not output entire thing. here current output: h sanders,harlanddavid   277651 8.72 false s baron,james 368535 310236.0 s moran,blake 123456 260000.0 h bob,billy 654321 15.0 false h smith,will 345612 10.5 true 30 6) remove worker not in list employee not found 7) remove worker first in list h macdonald,ronald 386218 7.8 true 40 h walton,samuel 268517 8.21 false h thomas,david 131313 9.45 true 38 h sanders,harlanddavid   277651 8.72 false s baron,james 368535 310236.0 s moran,blake 123456 260000.0 h bob,billy 654321 15.0 false h smith,will 345612 10.5 true 30 8) find worker middle of list found @ 4 9) find worker not in list found @ -1 10) find weekly salary of worker salaried 5000.0 11) find weekly salary of hourly worker has no overtime allowed [50 hours] 750.0 12) find weekly salary of hourly worker has overtime allowed

How to link two files using header file in C -

How to link two files using header file in C - i trying link 2 files. means, there files "file1.c" , "file2.c". file1.c #include"stdlib.h" #include"stdio.h" void function1(int a) { printf("hello file%d.c\n ", a); } void main() { function1(1); } file2.c #include"stdlib.h" #include"stdio.h" #include"file.h" void function2(int b) { printf("hello file%d.c\n", b); } int main() { function2(2); function1(1); } then create header file file.h as #ifndef hell #define hell void function1(int a); #endif when compile file2.c "gcc file2.c file1.c -o file2 " gives next error /tmp/cc4tno9r.o: in function `main': file1.c:(.text+0x24): multiple definition of `main' /tmp/ccl4feki.o:file2.c:(.text+0x24): first defined here collect2: ld returned 1 exit status how write in header file? there error in header file? or error in file2.c? and extern? us

iphone - Detect Retina Display -

iphone - Detect Retina Display - does ios sdk provides easy way check if currentdevice has high-resolution display (retina) ? the best way i've found : if ([[uiscreen mainscreen] respondstoselector:@selector(scale)] == yes && [[uiscreen mainscreen] scale] == 2.00) { // retina display } in order observe retina display reliably on ios devices, need check if device running ios4+ , if [uiscreen mainscreen].scale property equal 2.0. cannot assume device running ios4+ if scale property exists, ipad 3.2 contains property. on ipad running ios3.2, scale homecoming 1.0 in 1x mode, , 2.0 in 2x mode -- though know device not contain retina display. apple changed behavior in ios4.2 ipad: returns 1.0 in both 1x , 2x modes. can test in simulator. i test -displaylinkwithtarget:selector: method on main screen exists in ios4.x not ios3.2, , check screen's scale: if ([[uiscreen mainscreen] respondstoselector:@selector(displaylinkwithtarget:s

javascript - Animate an element in real time -

javascript - Animate an element in real time - i need know position of img in real time in order alter position while going or down. target animate bottom 40px @ origin , animate top later. my code following: var pos = $('header img').offset().top; if( pos == 0) { $('header img').animate({"top": "+=40px"}, 6000); }else{ $('header img').animate({"top": "-=40px"}, 6000); } any idea? you can utilize progress alternative observe position live. made changes don't have utilize much duplicated code: $('#startanimation').on('click', function () { var pos = $('header #img').offset().top; if (pos == 0) { doanimate("+=40px"); } else { doanimate("-=40px"); } }); function doanimate(to) { $('header #img').animate({ top: }, { duration: 6000, progress: function (promise) {

python - build/deploy script in product repo or in external repo? -

python - build/deploy script in product repo or in external repo? - i working on web project written in python. here facts: project hosted on github fabric (a python library build , deploy automation) script ( fabfile.py ) automatic build , deploy jenkins build automation my question is, set fabfile.py conventionally. i prefer set fabfile.py in root of project repo can config jenkins job grab source code git , run fab build compiled package. someone insists fabfile.py should not part of project repo, should kept in external repo instead. in case need config jenkins clone fabfile repo, invoke git clone product repo run packaging. i know matter of personal flavor, there benefits set fabfile.py in separate repo set product code? any suggestions appreciated. in opinion, can't see benefits besides maybe preventing junior dev accidentally deploying unwanted code. on other hand, it's nice have in 1 repo don't have maintain multiple repositories.

mybatis - How can I reuse an SQL fragment with parameters? -

mybatis - How can I reuse an SQL fragment with parameters? - i'm intending create fragment reusing parameters. class="lang-xml prettyprint-override"> <insert ...> <selectkey keyproperty="id" resulttype="_long" order="before"> <choose> <when test="_databaseid == 'derby'"> values next value some_id_seq </when> <otherwise> select some_id_seq.nextval dual </otherwise> </choose> </selectkey> insert ... </insert> can create sql fragment using parameters? class="lang-xml prettyprint-override"> <sql id="selectkeyfromsequence"> <selectkey keyproperty="id" resulttype="_long" order="before"> <choose> <when test="_databaseid == 'derby'"> values next value #{sequencename} </when>

firebase - AngularFire Accessing child element methods -

firebase - AngularFire Accessing child element methods - i'm looking way methods of kid element instead of loading element separately. let's have post model , each post has comments. how post model: var post = $firebase(new firebase(firebase_url + "/posts/" + post_name)).$asobject(); each post has comments can access comments using: post.$loaded(function () { var comments = post.comments; } now how force new element comments without having load model separately firebase? should able next doesn't work: comments.$add({text: "hi, there"}); is there proper way firebase methods of kid element without having go server , comments? firebase load info server once. after javascript code can build many refs on need, without downloading info again. but post.comments.$asarray() not work, since post plain javascript object (and not $firebase sync anymore). instead try: var ref = new firebase(firebase_url + "/pos

data.frame - How to split/subset a dataframe into multiple dataframes in R -

data.frame - How to split/subset a dataframe into multiple dataframes in R - i have looked through web , stackflow , not able find solution problem. don't know of dplyr or loop more efficient. below illustration of dataframe (my own datasets have more 10,000 rows) split in 3 based on column b (<250) list 3 objects or 3 individual dataframes. each new dataframe, like, example, count number of points (or length of dataframe) , duration (column time in seconds). suggestion appreciated. thank you martin dput(mydata) structure(list(time = c(1l, 2l, 3l, 4l, 5l, 6l, 7l, 8l, 9l, 0l, 11l, 12l, 13l, 14l, 15l, 16l, 17l, 18l), = c(4l, 5l, 6l, 7l, 3l, 7l, 8l, 10l, 11l, 8l, 10l, 12l, 14l, 6l, 14l, 16l, 20l, 22l ), b = c(100.25, 150.75, 200, 1000.56, 2000.1, 100, 150, 50, 25.2, 102.25, 152.75, 202, 1002.56, 2002.1, 102, 152, 52, 27.2 )), .names = c("time", "a", "b"), class = "data.frame", row.names = c(na, -18l)) grab iranges b

If-else statements going to the wrong conditional statement java? -

If-else statements going to the wrong conditional statement java? - my input programme seems traveling wrong else statement in if-else statements. import java.util.scanner; import java.text.*; public class cscd210lab6 { public static void main (string [] args) { scanner waterinput = new scanner(system.in); decimalformat df = new decimalformat("$#,###.00"); decimalformat zf = new decimalformat("#,###.0"); //declare variables int beginmeter, endmeter; string customercode; double billingamount,gallonsused; billingamount = 0; system.out.print("please come in client code: "); customercode = waterinput.next(); system.out.print("please come in origin meter reading: "); beginmeter = waterinput.nextint(); if(beginmeter < 0) { system.out.println(); system.out.print("error! have entered negative number. programme

c# - Sum of all numbers in a multi-dimensional array -

c# - Sum of all numbers in a multi-dimensional array - i'm learning c# , running problem multi dimension array. i can't seem figure out how find sum of elements in array. e.g int[,] array = { { 52, 76, 65 }, { 98, 87, 93 }, { 43, 77, 62 }, { 72, 73, 74 } }; so sum should be: 52 + 76 + 65 + 98 + ... i have tried utilize loop give me sum of each array in dimension 1. e.g private int[,] array = { { 52, 76, 33}, { 98, 87, 93 }, { 43, 77, 62 }, { 72, 73, 74 } }; public void arraysum() { double sum; (int = 0; < array.getlength(0); i++) { sum = 0; (int j = 0; j < array.getlength(1); j++) sum += array[i, j]; console.writeline("the sums array {0} {1}: ", i, sum); } } any ideas? simply move line sum = 0; out of first loop: private int[,] array = { { 52, 76, 33}, { 98, 87, 93 }, { 43, 77, 62 }, { 72, 73, 74 } }; public void arraysum