Posts

Showing posts from June, 2015

github - Git says file too big to push, file doesn't exist in repo -

i have large project working on lot of things unfamiliar with. 1 thing making caches. not want these in git repo, deleted them , committed. i did few more commits, , deleted caches, made .gitignore project. when went push last commit, error saying files big git (over 100 mb) it says file (folder/folder/cachefile) causing error. thing is, file not exist. cannot see it, or delete it. tried removing .gitignore , rebuilding project committing, , when go push same cache causing problems (the original ones cannot find not exist)

c# - Closing an OleDbConnection -

just general question, if open oledbconnection in program, should close @ point? ask because i've seen few tutorials presenter doesn't include statement close connection. in specific circumstances, open connection access excel file, fill datatable , grab values. after though, there no reason me have connection open , i'm thinking cause issues if left open. also, statement conn.close(); sufficient close connection? yes, should close connection done it. if use connection in 1 method , not after again, close , dispose it, can cleaned up. you should wrap creation of connection in using statement since close , dispose connection when exception occurs. using (oledbconnection conn = new oledbconnection(...)) { // use connection inside here }

i2c - Why doesn't this program in C compile? Error: undefined reference to `i2c_smbus_read_byte_data' -

edit: created other topic title , more appropriate/clear details: how resolve link error "undefined reference `i2c_smbus_read_byte_data'" __ i've tried compile single program in c read , write device through i2c bus i'm getting error: error: undefined reference i2c_smbus_read_byte_data i have installed these packages: libi2c-dev , i2c-tools . i'm using ubuntu , arm-linux-gnueabi-gcc compiler (cross compile eclipse luna ide) here whole code: /* http://www.zerozone.it/2014/05/primi-esperimenti-con-la-beaglebone-black-collegare-10dof-via-i2c/ dof10 i2c test program v0.1 - 05.05.2014 wrote program test dof10 funcionality beaglebone black. can buy dof10 module , beaglebone ebay few dollars...have fun ! written michele <o-zone@zerozone.it> pinassi blog @ www.zerozone.it feel free use code want. no warranty, in case: use @ own risks ! */ #include <stdio.h> #include <fcntl.h> #include <errno.h> #include <linux/

How can we automate content verification for mobile applications (iOS + Android ) without UI automation tools -

i want automate ios , android application text (content available on screens), there generic way or api available content verification of mobile application. i don't want use ui automation tools (appium,calabash). for android use accessibility service both detect user events , traverse user interfaces. depending on permissions request, can alter values , click on behalf of user. check out here: https://stuff.mit.edu/afs/sipb/project/android/docs/training/accessibility/service.html

javascript - processing drag-n-drop with nested HTML elements? -

i'm using html5 drag , drop, , have drop targets can either empty <div> or a <div> <img> child node. to make divs drop targets i'm setting ondrop= on divs. if end drop on div containing image, e.target image node. if end drop on empty div, e.target div. to process drop need find id of div, , since e.target can either image or div, i'm checking e.target.parentnode in case don't find information i'm looking in e.target . is there way can set things e.target div? or looking parentnode chain standard operating procedure? it old question, answer might someone. use div element below: <div id="my-div" ondrop="dropped('my-div');"> ... </div> you id 'my-div' in dropped if drop happened on child on level.

What is the fastest way to increase the size of a file in linux on a ext4 filesystem from a C executable without creating holes in the file? -

the fastest way increase file size know of ftruncate() or lseek() desired size , write single byte. doesn't fit needs in case because resulting hole in file doesn't reserve space in file system. is best alternative use calloc() , write()? int increase_file_size_(int fd, int pages) { int pagesize = 4096; void* data = calloc(pagesize, 1); for(int = 0; < pages; ++i) { // in real world program handle partial writes , interruptions if (write(fd, data, pagesize) != pagesize) { return -1; } return 0; } perhaps can made faster using writev. next version should faster since calloc has 0 initialize less memory, , more of data fits in cpu cache. int increase_file_size_(int fd, int pages) { int pagesize = 4096/16; void* data = calloc(pagesize, 1); struct iovec iov[16]; for(int = 0; < 16; ++i) { iov[i].iov_base = data; iov[i].iov_len = pagesize ; } for(int = 0; < pages; ++i) { // in r

Python tornado with multi-process -

i found how execute tornado multi-process. server = httpserver(app) server.bind(8888) server.start(0) #forks multiple sub-processes ioloop.current().start() in situation there way share resource on processes? and seems using same port on processes. does tornado balance load each process? if so, how do? in general, when using multi-process mode processes communicate via external services: databases, cache servers, message queues, etc. there additional options available processes running on same machine (see multiprocessing module`), in general once no longer using single process it's better techniques continue scale when move beyond single machine. in scenario, kernel , not tornado load balancing across processes. in theory, self-correcting mechanism because new connection given process idle @ time connection arrives. however, in practice tends result in significant imbalances (the loaded process has 2-3x many connections least loaded), dedicated load bala

c# - How to pass parameters to an implementation of IEventProcessor -

i busy implementing eventprocessorhost client azure eventbus client. i have class implements ieventprocessor follows: public class myeventprocessor : ieventprocessor { stopwatch checkpointstopwatch; //todo: provider id parent class public async task closeasync(partitioncontext context, closereason reason) { debug.writeline("processor shutting down. partition '{0}', reason: '{1}'.", context.lease.partitionid, reason); if (reason == closereason.shutdown) { await context.checkpointasync(); } } public task openasync(partitioncontext context) { debug.writeline("simpleeventprocessor initialized. partition: '{0}', offset: '{1}'", context.lease.partitionid, context.lease.offset); eventhandler = new myeventhandler(); this.checkpointstopwatch = new stopwa

spring - @TestPropertySource is not loading properties -

i'm writing integration test spring boot application when try override properties using @testpropertysource, it's loading property file defined in context xml it's not overriding properties defined in annotation. @runwith(springjunit4classrunner.class) @springapplicationconfiguration(classes = {defaultapp.class, messageitcase.config.class}) @webappconfiguration @testpropertysource(properties = {"spring.profiles.active=hornetq", "test.url=http://www.test.com/", "test.api.key=343krqmekrfdaskfnajk"}) public class messageitcase { @value("${test.url}") private string testurl; @value("${test.api.key}") private string testapikey; @test public void testurl() throws exception { system.out.println("loaded test url:" + testurl); } @configuration @importresource("classpath:/meta-inf/spring/test-context.xml") public static class config {

xamarin.forms - How to make Xamarin bubble up gestures -

i'm in process of developing sidedrawer xamarin.forms, because @ point, 1 telerik rather awful sideeffect-wise. i know how in wpf, since it's rather easy, in xamarin it's way different. my code gestureframe pretty same this . i've used sources @ some github project /xamarin docs/ xlabs started. @ first going well, i'm placing controls within gestureframe not receive events anymore, because childcontrols appear consume touch/gesture events there are. does ring bell anyone? right i'm not sure might doing wrong control behave way the gestures xamarin forms handles tap , doubletap these bubble default. android, windows , presumably ios each handle other gestures differently. quick review of event handling in xamarin.forms world: on android gestures handled renderer each renderer has touch event. touch raised in renderer when gesture occurs. subscribing touch event , intupreting eventargs can determine happening on screen. make determinati

python - calculate RGB equivalent of base colors with alpha of 0.5 over white background in matplotlib -

Image
i able replicate of primary color ('r','g' or 'b') in matplotlib alpha of 0.5 on white background, while keeping alpha @ 1. here example below, through manual experimentation i've found rgb values alpha of 1, similar matplotlib default colors alpha 0.5. i wondering if had automated way of achieving this. import matplotlib.pyplot plt s=1000 plt.xlim([4,8]) plt.ylim([0,10]) red=(1,0.55,0.55) blue=(0.55,0.55,1) green=(0.54,0.77,0.56) plt.scatter([5],[5],c='r',edgecolors='none',s=s,alpha=0.5,marker='s') plt.scatter([6],[5],c='b',edgecolors='none',s=s,alpha=0.5,marker='s') plt.scatter([7],[5],c='g',edgecolors='none',s=s,alpha=0.5,marker='s') plt.scatter([5],[5.915],c=red,edgecolors='none',s=s,marker='s') plt.scatter([6],[5.915],c=blue,edgecolors='none',s=s,marker='s') plt.scatter([7],[5.915],c=green,edgecolors='none',s=s,marker='s'

javascript - converting \n to <br/> still prints out the <br/> instead of processing -

javascript code var contact_comments = $("#con_us_comment").val(); contact_comments = contact_comments.replace(/(?:\r\n|\r|\n)/g, '<br />'); $.post('post.php', {'con_us_comment':contact_comment}, function(data) { // stuff i'm doing reply post call } php code takes raw data coming post , sends through email me. $contact_comment = test_input($_post['con_us_comment']); $body .= "<br/><b>comments: </b> ".$contact_comment; email sent body set shown above the email output looks this: comments: line 1<br />line 2<br />line 3 instead of: comments: line 1 line 2 line 3 so replaces \n doesn't process , instead shows text any idea i'm doing wrong here? set content-type: text/html in header of mail script if using php mail() function try adding $headers = 'mime-version: 1.0' . "\r\n"; $headers .= 'content-type: t

asynchronous - How to use parallel async in meteor -

i having 3 functions fetch screenshots, yelp , google data of website.the result of these 3 functions pushed array of subdocuments inserted database.i need increase performance of api.is possible call these functions using parallel async in meteor without using npm module? line of code used shown below meteor.methods({ insertapart : function(apart){ var google_data = setgoogledata(apart); var screen_captures_data = setscreenshots(apart); var yelp_data = setyelpdata(apart); function setgoogledata(apart) { // code fetch google data } function setscreenshots(apart) { // code fetch screen shots } function setyelpdata(apart) { // code fetch yelp data } var data=[]; data.google = google_data;// setting google data data.screen_captures = screen_captures_data;// setting screen captures data.yelp = yelp_data;// setting yelp data var id = apartments.insert(data); return id; } });

php - Email content within variable -

i creating form online , need email sent out contain content file. my headers setup this @mail($email_to, $email_subject, $email_message, $headers); and content here $email_message = file_get_contents('http://www.link.co.uk/wp-content/themes/themename/email-content.php'); the file contains email template, problem have template emailed out in raw format. here code: $email_message = file_get_contents('http://www.link.co.uk/wp-content/themes/themename/email-content.php'); // create email headers $headers = 'mime-version: 1.0' . "\r\n"; $headers = 'content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers = 'from: '.$email_from."\r\n". 'reply-to: '.$email_from."\r\n" . 'x-mailer: php/' . phpversion(); @mail($email_to, $email_subject, $email_message, $headers); the problem here brad, headers broken , being overwritten.

Is there a way to get the search result i get in the App Store app on the iOS device? ( How to get the ipa file of "App Store"? ) -

updated on 2015-11-1: one solution trying start app store using applium , can record/monitor ios ui elements. did selenium . let's treat app store standard ios app, possible to: uninstall app store iphone. get ipa file of app store unzip ipa file , app bundle run appium app store's app file is possible app store 's ipa file? ====== i want know position of apps when search on app store. when use itunes search api . notice result returned itunes search api specific search term different result on ios app store app. i found this question this, owner of has find out reason condition. but there no answer solve problem. actually i've been trying build search request, cames ios appstore using https request, don't know this. hope can help, i'll appreciate. there @ time no way specify want results ios device.

c# - Cannot authenticate in Web API service called from MVC website -

i have asp.net mvc website using angular front end, needs communicate rest web api service retrieve data. have authentication logic against custom provider in mvc project , works fine using adlds. calls rest web api have no authentication data passed , can't work out how pass user authenticated mvc, on rest web api. here example call web api. public void approvemodel(int modelversionid, string comments) { var request = new restrequest("api/modelversion", method.post) { requestformat = dataformat.json }; request.addbody(new[] { new modelaction { modelactiontype = modelactionconstants.modelactionapprovemodel, actionparameters = new dictionary<string, string> { { modelactionconstants.modelactionparametermodelversionid, modelversionid.tostring(cultureinfo.invariantculture) }, {modelactionconstants.modelactionparametercomments, comments} } } }); request.usedefaultcredentials = true; var response = _client.

bash - Exit status wrong with local variable assignment -

the example below shows how if temp_file made local part of same line mktemp called exit status retrieved using $? zero, regardless of whether command succeeded or failed ( mktemp_xyz used fails). if temp_file made local in advance $? exit status expected. can explain going on here please? #!/bin/bash test_1() { local temp_file=$(mktemp_xyz -q -t "test.tmp.xxxxxx") local make_temp_file_ret_val=$? echo "temp_file: $temp_file" echo "make_temp_file_ret_val: $make_temp_file_ret_val" } test_2() { local temp_file="" temp_file=$(mktemp_xyz -q -t "test.tmp.xxxxxx") local make_temp_file_ret_val=$? echo "temp_file: $temp_file" echo "make_temp_file_ret_val: $make_temp_file_ret_val" } test_1 echo "" test_2 output is: $ ./test ./test: line 6: mktemp_xyz: command not found temp_file: make_temp_file_ret_val: 0 ./test: line 16: mktemp_xyz: command not found te

Java Array / Program Issue -

ok, working on java program college class , have spent many hours trying figure out doing wrong. my program below. needs convert integer single digits , add them up. has display original number, individual digits , sum. part of project has accept negative digits , display positive numbers , sum, array displaying -1 first number when negative number input , cannot life of me figure out how fix it. example: input of -3456 ends displaying -1, 3, 4, 5, 6 , sum of 17 wrong. any immensely appreciated, thanks! import java.util.*; import javax.swing.joptionpane; //import package using dialog boxes import java.util.arrays; //import package arrays public class project4 { public static void main(string args[]) { //declares , initialize variables sum & counter int sum = 0; int counter = 1; //asks integer input , stores string in numinput string numinput = joptionpane.showinputdialog(null, "enter integer: ", "user input", joption

javascript - Angular Bootstrap DatePicker UTC wrong output -

hello using angular datepicker in application working how supposed be. try working utc time , datepicker inited value: scope.model.value = moment.utc().startof('day').todate() this result in date: tue oct 27 2015 01:00:00 gmt+0100 (mitteleuropäische zeit) if want choose date e.g.: 1st june 2016 result of scope.model.value is: "2016-05-31t23:00:00.000z" why datepicker changing date object format? how can take care off output format? , why date 31st may when selecting 1st june? i have tried several approaches removing utc time information. example: ( https://gist.github.com/weberste/354a3f0a9ea58e0ea0de ): (function () { 'use strict'; angular .module('myapp') .directive('datepickerlocaldate', ['$parse', function ($parse) { var directive = { restrict: 'a', require: ['ngmodel'], link: link }; return directive; function link(scope, element, attr, ctrls) { var ngmodelcontroller =

java - Error creating bean with name 'transactionManager : BeanCreationException -

please note tried previous posts, not working me. i having problem spring , hibernate configuration. i think reason because not connect database, have credentials in properties file correct. mysql version 5.5.44, spring version 4.0.2 , hibernate version 4.2.7.final this error of tomcat. org.springframework.beans.factory.beancreationexception: error creating bean name 'transactionmanager' defined in servletcontext resource [/web-inf/spring/root-context.xml]: cannot resolve reference bean 'mysessionfactory' while setting bean property 'sessionfactory'; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'mysessionfactory' defined in servletcontext resource [/web-inf/spring/root-context.xml]: invocation of init method failed; nested exception java.lang.nosuchmethoderror: com.mchange.v2.async.threadpoolasynchronousrunner.<init>(izljava/util/timer;ljava/lang/string;)v @ org.springframework.bean

c# - WPF Desktop application MDI like/Parent-Child -

i'm creating wpf desktop application. desc : 1 main window(parent) whole application includes display, docked display. "x" no. of child windows, whenever whichever child opened, on minimizing of child, child should minimized on parent window [currently, goes behind main window] what need : whenever child minimized should not go behind, should minimized on parent window. note : cannot use wpf.mdi.dll, since have data display on main screen(parent window, display docked) perhaps can use avalondock (free) or telerik docking (not free).

javascript - Transform array attribute in AngularJS -

i have plain array in javascript: $scope.myarray = [{ "coords" : { "lat" : 0, "long" : 0 } }, { "coords" : { "lat" : 1, "long" : 1 } }, { "coords" : { "lat" : 2, "long" : 2 } }]; then, have angular-google-maps module, draw these points paths screen. <ui-gmap-google-map center='map.center' zoom='map.zoom'> <ui-gmap-polyline path="myarray" stroke="p.stroke" visible='p.visible' geodesic='p.geodesic' fit="false" editable="p.editable" draggable="p.draggable" icons='p.icons'> </ui-gmap-polyline> </ui-gmap-google-map> this directive, however, expects path array of positions, this: $scope.myarray = [{ "lat" : 0, "long" : 0 }, { "lat" : 1, "long" : 1 }, { "lat" : 2, "long" : 2 }]; is there way transform between

My java program only prompts the user but does not read the data. How can I make my code actually read the data and perform the calculations? -

my program supposed ask user if order pizza , user supposed enter yes or no (all lower case) entering no exit program entering yes make computer prompt user again information- last name (one word, no need validate) choice of pizza type (options veggie, cheese, pepperoni, , supreme) choice of pizza size (options small, medium, , large) once have entered of information program supposed print following information customer last name (whatever entered in) cost of pizza total number of large pizzas total number of medium pizzas total number of small pizzas average cost of order when compiled program there no errors , when ran prompted perfectly...however, after type in answers program starts on again , prompts beginning. not output or calculations. doesn't check if enter correct. i'm not sure went wrong? logic, code, or both? can please show me how fix this. thank you! oh, , used notepad++ , compiled , ran in command prompt if helpful information

node.js - Express: Embed document in the existing document -

i developing application in express , node , mongo being database. have collection users , , user can have mutiple registered-ids . one-to-many relationship. m trying embed document in user collection this: post(function (req, res, next) { var pid=req.body.pid; var sid=req.body.sid; var rfname=req.body.rfname; var des=req.body.des; var brand=req.body.brand; var model=req.body.model; var serial=req.body.serial; var location=req.body.location; var arr={pid: 'pid', sid: 'sid', rfname: 'rfname' ,des: 'des', brand: 'brand', model: 'model' ,serial: 'serial', location: 'location'}; mongoose.model('user').findone({'pemail': req.session.email}, function (err, user){ if(err){ } else { user.registeredid = arr; user.save(function(err){ if(err){ } else { res.render('user

python - How to extend a static base constructor? -

i'm using python bitmap package . it need, don't work hexadecimal values, needed application, extended this: import bitmap class bitmap(bitmap.bitmap): def tohexstring(self): val = self.tostring() st = "{0:0x}".format(int(val,2)) return st.zfill(self.sz/4) the base class has static constructor string: bitmap.bitmap.fromstring("01010101") i can make 1 hexadecimal converting hex value bin: bitmap.bitmap.fromstring(format(int("aa",16),"08b")) but returned class original bitmap class , not extended one. how can use constructor still return extended class? bitmap.bitmap.fromstring class method , not static method , has been implemented incorrectly author. line: bm = bitmap(nbits) should be bm = cls(nbits) in case call fromstring on subclass , an instance of subclass . fork repo, implement , make pull request have included in package (or use fork in package). raise issue on rep

SQL Server 2005 query uses ? which doesn't work in SQL Server 2012 -

i'm working on application queries live data on sql server. user enters name within '% %' marks search. ie. if user search owner of property such noble, enter %noble%. we upgraded both application , sql server stores data sql server 2005 sql server 2012. the existing query , new query identical: select aurtvalm.pcl_num aurtvalm inner join rtpostal on aurtvalm.ass_num = rtpostal.ass_num rtpostal.fmt_nm2 ? in old version, above query produces 16 results. exact same query in 2012 version produces error: incorrect syntax near '?' has use of ? symbol changed since sql server 2005? that because have incorrect syntax. have use parameter instead of question mark. like: select aurtvalm.pcl_num aurtvalm inner join rtpostal on aurtvalm.ass_num = rtpostal.ass_num rtpostal.fmt_nm2 @param

java - Osgi Exception in Activator.start() -

i new start osgi code running java application not running osgi error reason 'import com.sun.codemodel' how resolve problem . my activator class : package deneme; import java.io.file; import java.net.url; import org.jsonschema2pojo.schemamapper; import org.osgi.framework.bundleactivator; import org.osgi.framework.bundlecontext; import com.sun.codemodel.jcodemodel; public class activator implements bundleactivator { /* * (non-javadoc) * @see org.osgi.framework.bundleactivator#start(org.osgi.framework.bundlecontext) */ public void start(bundlecontext context) throws exception { system.out.println("hello world!!"); string workingdir = system.getproperty("user.dir"); jcodemodel codemodel = new jcodemodel(); try { url sourcerota = new url("file:///c:/users/administrator/workspace/navsimkisa/rota_yeni.json"); url sourcekriter = new url("file:///c:/users/admi

css - Drop Down Menu Not Displaying with Overflow Visible -

i'm confused why sub menu isn't displaying outside of it's container when overflow set visible... http://foc.devrap.co.uk/ if point out obvious, appreciated. #mainmenu { margin:50px 0 0; overflow:visible; } #nav_menu-6 { float:left; overflow:visible; height:100px; } #nav_menu-7 { float:right; } #mainmenu ul { list-style-type:none; } #mainmenu ul > li { float:left; position:relative; } #mainmenu ul > li { float:left; margin:0; padding:0; font-family: 'roboto condensed', sans-serif; font-size:14px; line-height:14px; font-weight:400; text-transform:uppercase; color:#676868; position:relative; } #mainmenu ul > li:hover { color:#fff; background-color:#004a98; } #mainmenu ul > li { display:block; padding:10px 15px; font-family: 'roboto condensed', sans-serif; font-size:14px; line-height:14px; font-weight:400; text-transform:uppercase; color:#676868; } #mainmenu ul > li a:hover { color:#fff; text-decoration:none; } #mainmenu ul li

tomcat - jetty-maven-plugin NoClassDefFoundError -

i created maven parent module 2 maven children. web based application in war output deployed tomcat directory.the problem testing war file have start tomcat , test app. scenario decided use jetty maven plugin in parent pom.xml file. here how looks like: <modules> <module>hellojavaworld</module> <module>application</module> </modules> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-compiler-plugin</artifactid> <configuration> <source>1.5</source> <target>1.5</target> </configuration> </plugin> <plugin> <groupid>org.eclipse.jetty</groupid> <artifactid>jetty-maven-plugin</artifactid> <version>9.2.11.v20150529</version> <configuration> <scanintervalseconds>10</scanintervalseconds> <webapp>

python - Override save method force me to save twice in the admin thing -

working on django1.8.4 so, got models : class occurences(models.model): datetime = models.datetimefield() class serie(models.model): first_occurence = models.datetimefield(null=true, blank=true) last_occurence = models.datetimefield(null=true, blank=true) occurences = models.manytomanyfield(occurence, null=true, blank=true) def save(self, *args, **kwargs): super(series, self).save(*args, **kwargs) self.first_occurence = self.occurences.order_by['-datetime'].first() self.last_occurence = self.occurences.order_by['datetime'].last() super(series, self).save(*args, **kwargs) working great on manage.py shell. but use admin interface make modifications, doesn't work directly. have modify occurences field, save it, , reload resave once again @ end... i've tried super(...).save(...) @ beginning of save function, @ beginning , @ end of (twice), @ end. my goal able order first_occurence (or last, 1 enoug