Posts

Showing posts from March, 2014

text editor - To open Vim in specific ":" mode from terminal -

i use vim in inspecting data. start vim in specific ":" mode, instance processing binary data in terminal: xxd -ps r328_0000.raw > /tmp/1 && vim /tmp/1 :%s/ffff//gn | ? how can start vim in ":"-mode in terminal? you can -c option (or +) this: vim -c "%s/ffff//gn" vim +"%s/ffff//gn" from manpage: +{command} -c {command} {command} executed after first file has been read. {command} interpreted ex command. if {command} contains spaces must enclosed in double quotes (this depends on shell used). example: vim "+set si" main.c note: can use 10 "+" or "-c" commands.

github - How to Host Git Repository on Free Host? -

is there way host git repository on free host or have use bit bucket? want host own host and how use source tree connect it? i tried connect source tree , create repository have no idea how , if possible it if not possible host on computer , use source tree update stating website new files, if works update production one? is there anyway this? sourcetree optimized bitbucket, github , stash, have @ least reduced functionality. these links you: git: how connect sourcetree git-enabled-web-hosting via ssh? https://confluence.atlassian.com/pages/viewpage.action?pageid=282173660 how can connect own git server in sourcetree?

Show WPF window with WindowStyle=None and no resize -

Image
i'm trying display window border windowstyle="none" (picture 2), without option resize it! when set resizemode="noresize" border disappears (picture 1) does know how this? you can around setting max , min size properties same values, forcing window have fixed size. should work: window w = new window(); w.maxheight = w.minheight = 300; w.minwidth = w.maxwidth = 400; w.windowstyle = system.windows.windowstyle.none; w.show();

ios - How to design a mechanism to manage viewcontrollers transitions, like route -

i want design routing mechanism management view controller transitions in objective-c. two view controllers, without reference other side of pointer, transition controlled route. how achieve route? thanks help. i hope think this. route = segue (in xcode) take 2 view controller make 1st embed in navigation controller (which must initial view controller) put 1 button in 1st vc press ctrl + drag mouse button 2nd vc (one popup show, select push) run project press button lol

php - onsite booking for expedia by rest api calling using curl post -

onsite booking process using rest api calling data booking process.but problem when set form url :- $url = 'https://book.api.ean.com/ean-services/rs/hotel/v3/res? minorrev=99 &cid=55505 &sig=1893d9f7e3e9fbd3f8a36f43cd61287d &apikey=1bn8n4or4tjajq23fe4l6m18lp &customeruseragent=mozilla/5.0 (windows nt 6.1; wow64; rv:38.0) gecko/20100101 firefox/38.0 &customeripaddress=223.30.152.118 &customersessionid=e80df6de9008af772cfb48a389465415 &locale=en_us &currencycode=usd &hotelid=106347 &arrivaldate=10/30/2015 &departuredate=11/01/2015 &suppliertype=e &ratekey=469e1aff-49de-4944-a64d-25d96ccde3aa &roomtypecode=200127420 &ratecode=200706716 &chargeablerate=257.20 &room1=2,5,7 &room1firstname=test &room1lastname=testers &room1bedtypeid=23 &room1smokingpreference=ns &email=test@yoursite.com &firstname=tester &lastname=testing &homephone=2145370159 &workphone=2145370159 &creditcar

asp.net mvc - Computed Property not calculated when passing as parameter in $http.post in AngularJS -

i creating object in jquery contains computed properties. sending object web api service object defined class object. properties $scope variable set except computed variable appears null mean values not calculated when send part of $http.post method. please see code. jquery code $scope.estimationefforts = { //total no. of apps distribution totalappsdistributionnumbers: [ { description: "number of no issue apps", value: function () { return ($scope.total_no_apps * $scope.calculationasssumptions.expriencebasedassumptions[0].ratio) / 100 } }, { description: "number of apps vendor upgrade", value: function () { return ($scope.total_no_apps * $scope.calculationasssumptions.expriencebasedassumptions[1].ratio) / 100 } }, { description: "number of bespoke apps not requiring remediation",

c++ - how to define repeated field as required in google protocol buffer? -

how define repeated field required in google protocol buffer?i have field modifier repeated(repeated int32 ).how add required modifier field? in fact want have both modifier(required , repeated). sorry, there no way mark repeated field "required". in fact, required considered misfeature , being phased out in protobuf 3.0. extended explanation/rant of why case, see: https://capnproto.org/faq.html#how-do-i-make-a-field-required-like-in-protocol-buffers (that's link cap'n proto web site, competitor protobufs, author (namely, me) main author of protobuf v2.)

sql - How to get sum of multiple records in a column -

i have query this: select tc.f_exhibition_name, t.f_exhibitor_name, tc.f_creditnoteno, tc.f_description, tc.f_price, tc.f_qty, tc.f_cnqty, tc.f_totalamt t_creditnote tc left join t_exhibitor t on t.f_exhibitor_name = tc.f_exhibitor_name tc.f_creditnoteno='cninv100002' the output looks this ---------------------------------------------------------------------------------------------------------------------------------------------------- f_exhibition_name f_exhibitor_name f_creditnoteno f_description f_price f_qty f_cnqty f_totalamt ---------------------------------------------------------------------------------------------------------------------------------------------------- workspace 2015 aep - associacao empresarial de portugal cninv100002 item1 12 5 8 96 workspace 2015 aep

android - ActionBarSherlock dependency issue after updating support libraries -

i updated support libraries through android sdk manager, , there conflict between assume actionbarsherlock , support library. see below snippet of error.this in android studio 1.2.2 c:\android\games\copy of myproject1\myproject\build\intermediates\exploded-aar\com.google.android.gms\play-services-wallet\7.5.0\res\values\wallet_colors.xml error:(1) attribute "titletextstyle" has been defined error:(1) attribute "subtitletextstyle" has been defined error:(1) attribute "divider" has been defined error:(1) attribute "background" has been defined error:(1) attribute "backgroundsplit" has been defined error:(1) attribute "navigationmode" has been defined error:(1) attribute "displayoptions" has been defined error:(1) attribute "title" has been defined error:(1) attribute "subtitle" has been defined error:(1) attribute "icon" has been defined error:(1) attribute "logo" has been

asp.net - In a referenced C# library, is there a way to know whether the parent project is Debug or Release? -

i have utility library doing common things in c#. i want return array of assets in json file in project root, results different depending on whether parent project debug or release. for example: {projectroot}\assets.json { "debug": { "css": [ "/public/vendor/bootstrap/3.3.5/css/bootstrap.min.css" ], "js": [ "/public/vendor/bootstrap/3.3.5/js/bootstrap.min.js", ] }, "release": { "css": [ "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" ], "js": [ "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js", ] } } then use checking debug or release , returning proper list viewbag. i manually in couple projects , i'm start another. add utility project. however, setting #if debug in library return correct files li

How to create angularjs custom directive for google location -

i'm trying create directive lookup google locations using <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true&libraries=places&language=en-us"></script> this: angular.module('myapp').directive('locationpicker', function () { return { restrict: 'ae', replace: true, require: 'ngmodel', template: '<input id="{{id}}" type="text" class="{{class}}" placeholder="{{placeholder}}" />', scope: { id: '@', class: '@', placeholder: '@', }, link: function ($scope, elm, attrs, controller) { var autocomplete = new google.maps.places.autocomplete(elm[0], {types: ['geocode']}); var componentform = { locality: 'long_name', administrative_area_level

PHP MySQL Call to a member function execute() on a non-object -

i got error when prepare $query . here lines : $query="insert bm(title,season) values(:title, :season)"; $stmt = $mysqli->prepare($query); //$stmt->bind_param("ss", $title, $season); $stmt->execute(array(':title' => $title, ':season' => $season)); i put line bind_param in // saw on others solve error became same : fatal error: call member function bind_param() on non-object so, thought of query it's simple can't see anymore clearly. it's driving me nuts. :-/ tested var $title and $season echo before $query line sure, : echo $title." et ".$season; but nothing wrong, values ok. these strings var. appreciated. thanks. here complete code : <?php include("connexion.php"); // vars previous form //$id=""; $title = isset($_post['title']) ? $_post['title'] : ""; $season = isset($_post['season']) ? $_post['season'] : "";

php - I want to get checkbox already checked when we retrieve data from database in edit form -

<?php $a=array('cricket','reading','travelling','swimming','badminton');$hb=explode(" ",$row['hobby']); ?> hobbies:<input type="checkbox" name="chk[]" value="cricket"<?php if(in_array('cricket',$hb)){echo 'checked="checked"'; }?> />cricket <input type="checkbox" name="chk[]" value="reading" <?php if(in_array('reading',$hb)) { echo 'checked="checked"'; }?> />reading <input type="checkbox" name="chk[]" value="travelling" <?php if(in_array('travelling',$hb)) { echo 'checked="checked"'; }?> />travelling <input type="checkbox" name="chk[]" value="swimming" <?php if(in_array('swimming',$hb)) { echo 'checked="checked"'; }

sql server - sql help to find out multiple entries -

i have table t1 values col1 col2 1 2 1 4 1 4 2 4 2 4 3 5 3 5 4 3 4 3 5 1 5 1 5 6 5 6 i need output 1 2 1 4 5 1 5 6 that when col2 has multiple entries interested in records only. any help? one way of doing it: select col1, col2 t1 col1 in (select col1 t1 group col1 having count(distinct col2) > 1) group col1, col2 the query should pretty self-explanatory.

java - Android Media Player Stuttering with CountDownTimer -

i'm trying make app teach how count music. media player initialize 30 second sound clip of persistent note. using countdown timer tell media player when pause , play. code below causes first , last second of audio stutter. mediaplayer mymediaplayer = mediaplayer.create(musiccounting.this, r.raw.a_note); countdowntimer time = new countdowntimer(4000,500) { @override public void ontick(long millisuntilfinished) { if(mymediaplayer.isplaying()) { mymediaplayer.pause(); } else { mymediaplayer.start(); } } @override public void onfinish() { mymediaplayer.pause(); mymediaplayer.seekto(0); } }; time.start(); this code quarter notes , eighth notes code looks identical except second parameter countdown timer 250. suggestions appreciated. :) there lots of reports of android mediaplayer stutter various ways try fix it. seems best related question: mediaplayer stutters @ start of mp3 pl

java - Grid Recursion Not Functioning -

i'm trying solve problem on project euler (project 16) using grid recursion , isn't working out - i'm ending seems infinite loop. goal count how many routes can take top left of 20x20 grid bottom right of grid, start origin , placed number in mygrid[20][20] indicates it's @ bottom right corner. private static int[][] mygrid; public static int numroutes(int x, int y){ if (x < 0 || x >= 20 || y < 0 || y>= 20){ return 0; } if (mygrid[x][y] == 1){ return 1; } int count = 0; count += numroutes(x+1, y); count += numroutes(x, y+1); return count; } public static void main (string args[]) throws exception{ mygrid = new int[21][21]; (int = 0; < 21; i++){ arrays.fill(mygrid[i], 0); } mygrid[20][20] = 1; int num = numroutes(0,0); system.out.println(num); } this comprises of recursion, , think have of appropriate base cases. thoughts on what's going wrong? your progr

parsing - How can assign different return types to a function in Scala? -

i trying write function should return different pairs depending on input. have override "+ - / *" in scala specific use. each 1 ( +, -,* ,/) has 3 implementations based on input. have rdd , float inputs can + between rdd , rdd, or float , rdd, or float , float , on. now having parser reads expression input : rdd+1 , parse , create postfix make calculations easier : rdd1+ , want calculation using implemented + . of this algorithm trying change in way make performing calculation based on input expression. instance contains: var lastop: (float, float) => float = add how can change this: (float, float) => float accept (rdd, float)|(rdd, rdd) |(float, float) => rdd = add // implementation of add ??? edition: i added part of 2 answers below: ok wrote : def lastop:(either[rdd[(int,array[float])], float], either[rdd[(int,array[float])], float]) => rdd[(int,array[float])] = sv.+ in sv instance other class have been override + in in 2 different w

sql - Create View with SUM values -

i not sure how approach this, want create view the columns fullname, studentid, hourspassed, hoursfailed , hourspassed+hoursfailed of students majoring in finance. but column headings need fullname, studentid, hourspassed, hoursfailed , hoursattempted so far have: create view a5t7 select (firstname || ' ' || lastname) "fullname", studentid, hourspassed, hoursfailed, sum (hourspassed,hoursfailed) "hoursattempted", a5 upper(major1)='fin'or upper(major2)='fin' group ??? order hoursattempted; i pretty sure query wrong, somewhere. don't know how approach heading name , sum value. group doesn't seem right. i need 5 columns sum function add last column sum() takes 1 argument. so, might try this: create view a5t7 select (firstname || ' ' || lastname) fullname, studentid, hourspassed, hoursfailed, sum(hourspassed + hoursfailed) hoursattempted a5 group upper(major1) = '

database - SQL statement ignore when attempted to open cursor -

i have error, "sql statement ignored", when make spec , body of package database in pl/sql. i wrote code : procedure get_all_link_recent_result ( pi_userid in tlms_cm_result.userid%type, pi_email in tlms_cm_result.email%type, pi_testid in tlms_cm_result.testid%type, po_ret_code out varchar2, po_ret_message out varchar2, po_ref_cursor out type_cm_result_refcur ) l_userid tlms_cm_result.userid%type; l_testid tlms_cm_result.testid%type; begin l_userid := pi_userid || 0; l_testid := pi_testid || 0; open po_ref_cursor select * tlms_cm_result userid l_userid , testid l_testid , email = pi_email order userid; po_ret_code := c_err_msg_other; exception when others po_ret_code := c_err_msg_other; po_ret_message := sqlerrm; end get_all_link_recent_result; the specific line "pl/sql

javascript - How to hide html items with a radio button -

this beginner html/css/javascript question. i've been beating head against wall, still can't figure out. have simple web form users fill out(name, email, etc) , way it's supposed work when user clicks radio button says "yes" see drop down menu set number of items , when click "no" see text field. have part working correctly, want drop down menu , text field start hidden, , appear when yes or no radio button clicked. i've tried style = display:hidden; when used text , drop-down menu wouldn't appear anymore. thanks answers! this code i'm using: <tr align="left" valign="middle"> <td colspan="1" rowspan="1"> <p>&nbsp;</p> </td> <td colspan="1" rowspan="1"> <p><b><font color="#cc0000" face="georgia, times new roman, times, serif" size="+2">*</font></b></p> &

epicorerp - EPICOR 10 Create New BAQ Reports with SSRS -

in epicor 10, i've created simple new baq reports using ssrs. report generated default have parameter "tableguid". what value parameter? i can't delete parameter, because required. can can me? or have tutorial on how make baq reports using ssrs in epicor 10? when run ssrs report, table created on ssrs server name of whatever table name underscore followed guid. baq report table called baqreportresult. here 1 of ours looks guid changed protect innocent. baqreportresult_040b6fefb62446f8bf8a21663e4cb5c5 that being said, think need know parameter need append underscore , to end of table in select statement when defining data comes in report. i hope helpful.

scala - Dealing with a Failed `Future` -

given following 2 methods: def f: future[int] = future { 10 } def g: future[int] = future { 5 } i'd compose them: scala> import scala.concurrent.future import scala.concurrent.future scala> import scala.concurrent.future._ import scala.concurrent.future._ scala> import scala.concurrent.executioncontext.implicits.global import scala.concurrent.executioncontext.implicits.global scala> { | <- f | b <- g | } yield (a+b) res2: scala.concurrent.future[int] = scala.concurrent.impl.promise$defaultpromise@34f5090e now, i'll call await.result block until it's finished. scala> import scala.concurrent.duration._ import scala.concurrent.duration._ as expected, 15 , since await.result took future[int] , returned int . scala> await.result(res2, 5.seconds) res6: int = 15 defining recoverfn failed future: scala> val recoverfn: partialfunction[throwable, future[int]] = { case _ => future{0} } recoverfn: parti

graph - Point Plot with SE for 3 Categorical & 1 Continuous Variable in R -

Image
i'm attempting generate single plot of points features values single measurement (len) in design 3 categorical variables (mea, tre, , sex). i've produced plot has i'm looking split across 6 different subplots: but i'd ideally have them in single plot if possible, preferentially using ggplot. here current r code: ggplot(mydf, aes(x=factor(mea), y=len), group=sex) + geom_point() + geom_errorbar(limits, width=0.1) + facet_wrap(~ tre + sex) and sample data dput: structure(list(mea = structure(c(1l, 1l, 1l, 1l, 1l, 1l, 2l, 2l, 2l, 2l, 2l, 2l), .label = c("po_p", "melaniz"), class = "factor"), tre = structure(c(1l, 1l, 2l, 2l, 3l, 3l, 1l, 1l, 2l, 2l, 3l, 3l), .label = c("a", "b", "c"), class = "factor"), sex = structure(c(1l, 2l, 1l, 2l, 1l, 2l, 1l, 2l, 1l, 2l, 1l, 2l), .label = c("male", "female"), class = "factor"), n = c(26, 26, 25

java - Mocking anonymous function -

i'm writing junits , got stuck lambda expressions. is there way mock anonymous function? return retrytemplate.execute(retrycontext -> { return mockedresponse; }); in above code, i'm trying mock retrytemplate . retrytemplate of type - org.springframework.retry.support.retrytemplate assuming retrytemplate dependency in bean "mybean", use dependency injection mock retrytemplate.execute method using mockito , configure accept parameter: retrytemplate mockretrytemplate = mockito.mock(retrytemplate.class); mockito.when(mockretrytemplate.execute(matchers.any(retrycallback.class))).thenreturn(mockedresponse); mybean.setretrytemplate(mockretrytemplate); if trying mock parameter method parameter happens lambda, create new lambda expression stub rather try mock it.

corba - Servant and objects - relation -

Image
i read lot servant , objects used in technologies such ice or corba. there lot of resources can read : one servant can handle multiple objects (for resource saving). 1 object can handled multiple servants (for reliability). could tell me real life example 2 statements ? if not mistaken, term coined douglas schmidt in paper describing common object request architecture. here direct quote of few definitions: note: see picture below clarity object -- corba programming entity consists of identity, interface, , implementation, known servant. servant -- implementation programming language entity defines operations support corba idl interface. servants can written in variety of languages, including c, c++, java, smalltalk, , ada. corba idl stubs , skeletons -- corba idl stubs , skeletons serve ``glue'' between client , server applications, respectively, , orb orb interface -- orb logical entity may implemented in various ways (such 1 o

python - Scrapy: ERROR: Spider error processing -

i new in python & scrapy. tried run existing code, got error on every address: 2015-07-02 01:52:19 [scrapy] debug: crawled (200) <get http://www.tripadvisor.com/showuserreviews-g187147-d197524-r281927613-hotel_mirific_opera-paris_ile_de_france.html> (referer: http://www.tripadvisor.com/hotel_review-g187147-d197524-reviews-hotel_mirific_opera-paris_ile_de_france.html)2015-07-02 01:52:19 [scrapy] error: spider error processing <get http://www.tripadvisor.com/showuserreviews-g187147-d197524-r281927613-hotel_mirific_opera-paris_ile_de_france.html> (referer: http://www.tripadvisor.com/hotel_review-g187147-d197524-reviews-hotel_mirific_opera-paris_ile_de_france.html) traceback (most recent call last): file "/usr/local/lib/python2.7/dist-packages/scrapy/utils/defer.py", line 102, in iter_errback yield next(it) file "/usr/local/lib/python2.7/dist-packages/scrapy/spidermiddlewares/offsite.py", line 28, in process_spider_output

python - Can't call result() on futures in tornado -

i want asynchronous http-requests using python library tornado (version 4.2). can not force future complete (using result() ) since exception: "dummyfuture not support blocking results". i have python 3.4.3 therefore future support should part of standard library. documentation of concurrent.py says: tornado use concurrent.futures.future if available; otherwise use compatible class defined in module. a minimal example trying provided below: from tornado.httpclient import asynchttpclient; future = asynchttpclient().fetch("http://google.com") future.result() if understand problem correctly occurs because import of concurrent.futures.future somehow not used. relevant code in tornado appears in concurrent.py not making progress on understanding problem lies. try create future , use add_done_callback : from tornado documentation from tornado.concurrent import future def async_fetch_future(url): http_client = asynchttpclient()

java - Why won't my main recognize what I returned? -

i can't program recognize eclassgpa , sclassgpa though returned them in methods. trying add of gpa's in main ones in separate methods. when 2 things returned create errors. import java.util.scanner; public class gpa3 { public static void main(string[] args) { system.out.println("hello! welcome gpa calculator."); int math; double mathgpa = 0; system.out.println("math = "); scanner input = new scanner(system.in); math= input.nextint(); if (math >100){ system.out.println("you have mistyped something"); } if (math >= 94){ system.out.println("you have a"); mathgpa = 4.0; system.out.println(mathgpa); } if (math < 94 && math >=90){ system.out.println("you have a-"); mathgpa = 3.7; system.out.println(mathgpa); } i

excel vba - Copy and Paste to next available column -

i'm trying track weekly quantities have in spread sheet. far i've made macro copy , paste info need it. paste spot chose while recording macro. i'd paste info next available column. i'd schedule macro run once week on friday morning. macro i'm using now. sub copypaste() ' ' copypaste macro ' ' range("g4:g33").select selection.copy range("b35").select selection.pastespecial paste:=xlpastevalues, operation:=xlnone, skipblanks _ :=false, transpose:=false end sub i've tried putting & lastrow range, gets compile error. appreciated. you can work out column number of last column this: sub copypaste() ' ' copypaste macro ' dim lastcol long ' finds number of last column lastcol = cells(35, columns.count).end(xltoleft).column range("g4:g33").copy ' range("b35").select ' no need select. paste cell in row 35, 1 right of last column cells(35,

php - Append comment replies based on parent ID -

initially have of comments stored in array $commentsrow , has arrays values (containing comment info such username, date, etc). foreach($commentsrow $comment){ // variables set, including one: $parent_id = $comment['parent_id']; ?> // html here <?php } ?> so works comments no parent (i.e. not reply), how "append" replies parent based on id?

Bigcommerce API: Get Proudct URL w/PHP -

i not find api returns product url given product id. have noticed product url on store formatted using product name ex: http://mystore.mybigcommerce.com/gideon-canvas-espadrilles-multiple-colours/ . may not reliable.

c++ - How to tell the current 'write position' of a Boost Circular Buffer to enable accessing a previously stored value -

i want access value in boost circular buffer is, example, 5 positions 'in past'. so, imagine writing value '7' previous stream of integers: 3, 5, 6, 9, 2, 8, 6 therefore have now: 7, 3, 5, 6, 9, 2, 8, 6 i want '2' since 5 positions in past. how that? in other words, current 'write index'? i think might need use boost::circular_buffer<double>::const_iterator i'm not sure. i'm not sure understand correctly, worries modulo indexing seem overly anxious me. whole purpose of circular buffer abstraction hide index arithmetics caller, if ask me. i'd thoroughly disappointed in library design if boost let implementation detail leak out¹ here's simple demo seems want: live on coliru #include <iostream> #include <boost/circular_buffer.hpp> int main() { boost::circular_buffer<int> cb(10); // [tag:cb-so-fixedsize] (int msg : { 3, 5, 6, 9, 2, 8, 6, 7 }) { cb.push_back(msg);

Variable Variables and Sums of Them in Excel VBA -

to alleviate summer boredom, decided try make excel program keeps track of how money owe based on properties owned , number of houses on properties in board game monopoly (some new rules i'm experimenting with). set spreadsheet such every property in own row. want excel program this: let's you're looking @ cell. then, i=1 10 (since doubt more 10 players in monopoly feasible), if value of cell right i, add value of cell you're looking @ sum player i. can generate variables variables sum1, sum2, sum3, ... , sum10? , can like sum'i' = sum'i' + cell.value within loop if condition in paragraph 2 met? update: have tried code, , works in getting player 1's sum. however, gives player 1's sum players, , it's cumbersome update whenever buys new property or upgrades current property (i need re-type formula each update). public function monopolysum(i integer) variant dim sum(1 10) variant, rng range, cell range = 1 10 sum