Posts

Showing posts from August, 2011

linux - Feeding get into pv and writing to log file not working -

so i'm trying feed output of file (that's retrieved using get) log file. what have this: whateverfile | pv > somefile.log i've tried feeding xargs: | pv whateverfile > somefile.log thoughts? in advance! from: http://www.cyberciti.biz/open-source/command-line-hacks/pv-command-examples/ pv -options input.file | command1 | pv -options > output.file so in case, like: pv input.file | | pv > somefile.log note : code untested.

r - Using rbind.fill does not fill the correct value -

i don’t understand how rbind.fill works, guess. have data frame called main.df : tlt pcy shy vti tip vnq vwo rwx vea dbc gld pct 0 0 0 0 0 0 0 0 0 0 0 i want bind following different-sized data frame named p.df it: vwo vea vti pct 0.3333333 0.3333333 0.3333333 when execute rbind.fill(main.df, p.df) get: tlt pcy shy vti tip vnq vwo rwx vea dbc gld 1 0 0 0 0 0 0 0 0 0 0 0 2 na na na 1 na na 1 na 1 na na which not want. expected get: tlt pcy shy vti tip vnq vwo rwx vea dbc gld 1 0 0 0 0 0 0 0 0 0 0 0 2 na na na 0.333 na na 0.333 na 0.333 na na how do this? dput of objects below. main.df <- structure(list( tlt = 0, pcy = 0, shy = 0, vti = 0, tip = 0, vnq = 0, vwo = 0, rwx = 0, vea = 0, dbc = 0, gld = 0), .names = c("tlt", "pcy", "shy", "vti", "tip", "vnq&qu

css - bootstrap navbar dropdown does not work on iphone -

i using "bootstrap": "~3.3.4" inside mean.js framework. navbar dropdown menu not have problem opening , staying put when dropdown icon clicked on desktop. after getting pushed staging server, clicking icon on iphone , samsung galaxy browsers no longer opens dropdown menu or opens not stay opened. here code: <div class="landing-page-header"> <div class="navbar-header" > <button class="navbar-toggle mytoggle" type="button" data-ng-click="togglecollapsiblemenu()"> <span class="sr-only">toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a data-ui-sref="home" class="navbar-brand"> <img class="header-logo" ng-src="modules/core/img/h

algorithm - Calculating total over timespan with arbitrary datapoints -

if given total number of occurrences of event on last hour, , can data @ arbitrary times ( @ least once hour ), how can work out total number of occurrences on 24 hour period? obviously, can't. example -- if first 2 observations overlap impossible determine number of kills during overlap. if there time gap between first 2 observations there no way determine happened during gap. try set system of equations -- resulting system underdetermined (but give both min , max, might relevant). why not adopt statistical approach? let x = kills on 1 hour period. random variable. estimate expected value sampling @ randomly chosen times , multiply estimate 24.

Gmail API: Triggering in-webpage refresh -

Image
i'd trigger in-webpage refresh button programmatically purpose of applying labels emails without making user manually refresh page or make other page action in order see labels. possible do? of documentation finding surrounding refresh tokens, different. thank time. there's no way gmail rest api (i.e. trigger refresh action in web browser viewing gmail page). if you're running browser extension on other hand, sure.

Retrieve Jira LinkTypes via JIRA REST API -

i need complete list of linktypes known jira. since couldn't find documentation provides info, prefer retrieve types via jira rest api. there way that? list<type> types = jirarestclient.runquery("https://jira-host.com/rest/api/latest/<alllinktypes>"); ... @jsoninclude(jsoninclude.include.non_null) @generated("org.jsonschema2pojo") @jsonpropertyorder({ "id", "name", "inward", "outward", "self" }) public class type { @jsonproperty("id") private string id; @jsonproperty("name") private string name; @jsonproperty("inward") private string inward; @jsonproperty("outward") private string outward; @jsonproperty("self") private string self; the rest client , running. need url retrieval. i not sure think looking rest request. /

patch - git staging patches: with hunk smaller than a line -

i looking make interactive patch unique commit. use output similar git diff --word-diff=porcelain [file] for interactive patching. command git add --edit propose hunk least 1 line? aim: have patch text files , stage changing in "libreoffice" accept or reject changes. example: a text file in 1 line: echo "thiis sentence 1 wrong word. clean sentence. thhe laast 1 iss alwaays morre dificult" > text.txt to commit git add text.txt git commit -m "one" modifiying file echo "this sentence 1 wrong word. clean sentence. last 1 more difficult" > text.txt git add -e should automatically cut in 3 hunks "thiis" > "this" "thhe laast" > "the last" "iss alwaays morre dificult"> "is more difficult" i can obtain --- a/text.txt +++ b/text.txt @@ -1 +1 @@ -thiis sentence 1 wrong word. clean sentence. thhe laast 1 iss alwaays morre dificult +this sentence

javascript - passing scope model data to controller -

with angular, have following setup on view: <div class="sli1" ng-init="test=[10,20,30,40,50]" <div class="sli2" ng-init="test2=[10,20,30,40,50]" i'm trying pass ng-init data model controller pick as: $scope.data1= $scope.test; $scope.data2= $scope.test2; where use further down in array: $scope.sli['test'][0]; $scope.sli['test'][1]; $scope.sli['test'][2]; $scope.sli['test'][3]; however not sure i've missed out. my suggestion study more how angularjs works,initializing data on view , passing controller process on them wrong ,especially if doing process on data

javascript - Set bulletBorderColor to lineColor by default in amCharts -

according amcharts documentation, if bulletbordercolor isn't set, default linecolor. doesn't seem working. building theme team use don't have worry setting colors every time generate chart. have workaround, or solution this? codepen: http://codepen.io/anon/pen/mwbyvl code: amcharts.makechart("line-chart-fw", { "type": "serial", "theme": "sailthru", "margintop": 0, "marginright": 0, "marginleft": 0, "marginbottom": 0, "responsive": { "enabled": true }, "pathtoimages": "js/amcharts/images/", "graphs": [{ "title": "yesterday", "id": "g2", "balloontext": "", "type": "smoothedline", "valuefield": "value2" }, { "title": "today", "id": "g1",

database - Heuristic to find a primary key in a text file -

i looking library find primary key text file. imagine have csv file , dont know column(s) primary key. there library helps me (using kind of heuristic)? i believe not knowing which, if any, field in file primary key not programming problem business problem. send business answer. reasons below. first expected primary key , isn't in particular version of file shows problem file , should not processed. example in job, need process sales rosters come csvs. in them sales sales territory should unique. business rule. rosters not unique , fail import because 2 poeple cannot assigned same territory @ same time. problem 1 person left , took place, have no way of knowing of 2 records correct one. hence import fails. checking file contained type of information programmically have failed find pk becasue wasn't unique inteh file when should have been. next checking existance of unique data in column when file first processed not guarantee data remain unique on time or mea

php - Magento - How to keep URL parameters for links on the page -

i have static page on website parameters e.g. example.com/abc.html?param=1 . now, page has hrefs in other pages. e.g. `example.com/cd.html , example.com/folder/xyz.html` how can dynamically add param of url hrefs on page? e.g. example.com/cd.html?param=1 you can use $_get array contain parameters in , can simple append need

php - how do i show 404 error page without showing the error page's url? -

when users type non-existent page such www.example.com\wrongurl.html i want users see 404 error page. url should not change. i have tried following doesn't work. errordocument 404 http://www.example.com/404.html rewriteengine on rewriterule 404/ http://www.example/404.html [nc] how can this? try following rules : rewriteengine on rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^ /404.html [l,nc] this internally redirects request non-existing file/directory 404.html page.

How to iterate JSON in PHP -

in following json, want fetch customers phone , store in array: { "metainformation":{ "@totalresources":1, "@totalpages":1, "@currentpage":1 }, "customers":[ { "@url":"https:\/\/url/customers\/1", "address1":"mumbai", "city":"mumbai", "customernumber":"1", "email":"xyz@gmail.com", "name":"saurabh pradhan", "organisationnumber":"", "phone":"91xxx", "zipcode":"45153" } ] } i tried using following keeps throwing me error "trying property of non-object in": $customer_json = json_decode($api->getallcustomers()); $customer_json->customers[0]->phone; the problem php representation of json object n

javascript - How to handle relative pathing across multiple modules and stylesheets? -

Image
backstory: i'm serving application deep inside separate independent application purpose of integrating application's feature set. one of "features" offers allow access "extension" creating via url path like: http://localhost/path/to/my/extension so of css , js need using /path/to/my/extension base url whenever using things background-image: url(/my/fancy/img.svg) module paths /jspm_modules/repo/some_system_module@v1.js . any requests hit proper path like: /path/to/my/extension/some/thing i'm able handle want because can control request , point @ right resource server-side. what i'm struggling things es6-module-loader , embedded style sheets use relative pathing format. sorry if question hard understand, i'm not quite sure how ask right haven't had face issue before. feel free edit, leave comments asking clarification, etc. encourage need learn since seems (might be?) common.

c++ - Why variadic template constructor matches better than copy constructor? -

the following code not compile: #include <iostream> #include <utility> struct foo { foo() { std::cout << "foo()" << std::endl; } foo(int) { std::cout << "foo(int)" << std::endl; } }; template <typename t> struct bar { foo foo; bar(const bar&) { std::cout << "bar(const bar&)" << std::endl; } template <typename... args> bar(args&&... args) : foo(std::forward<args>(args)...) { std::cout << "bar(args&&... args)" << std::endl; } }; int main() { bar<foo> bar1{}; bar<foo> bar2{bar1}; } compiler error suggest me compiler trying use variadic template constructor instead of copy constructor: prog.cpp: in instantiation of 'bar<t>::bar(args&& ...) [with args = {bar<foo>&}; t = foo]': prog.cpp:27:20: required here prog.cpp:18:55: error: no matching fun

PHP fwrite function why i cannot write "$" character in fwrite -

what problem in code? why cannot use "$" in fwrite function? fwrite($dosya_index,"$al_".$bol_radiopart[1]." = $_post['".$bol_radiopart[1]."'];"); this because php variables interpolated in strings enclosed double quotes. means words starting $ sign in double quotes handled variables, , if such variable exists, value replaced within string. escape $ sign ( \$ ) or use single quotes interpolation not applied.

How to get URL content using C# from silverlight application? -

i used below code content of given url silverlightlight application got error : "an exception of type 'system.security.securityexception' occurred in system.windows.dll not handled in user code" i checked elevated trust in silverlight application. nothing changed! private void startwebrequest(string url) { httpwebrequest request = (httpwebrequest)webrequest.create(url); request.begingetresponse(new asynccallback(finishwebrequest),request); } private void finishwebrequest(iasyncresult result) { httpwebresponse response = (result.asyncstate httpwebrequest).endgetresponse(result) httpwebresponse; } to avoid mentioned error changed finishwebrequest function as: private void finishwebrequest(iasyncresult result) { httpwebrequest req = (httpwebrequest)result.asyncstate; httpwebresponse response = (httpwebresponse)req.endgetresponse(result) ; } can says happend?

php - Configuration path "security.access_control" cannot be overwritten -

i'm busy trying configurate fouserbundle on symfony 2.6.9. doesn't work, got message: forbiddenoverwriteexception in basenode.php line 223: configuration path "security.access_control" cannot overwritten. have define options path, , of sub-paths in 1 configuration section. (i did configurate, appkernel, config,composer) user.php <?php namespace fly\userbundle\entity; use fos\userbundle\model\user baseuser; use doctrine\orm\mapping orm; /** * @orm\entity * @orm\table(name="fly_user") */ class user extends baseuser { /** * @orm\id * @orm\column(type="integer") * @orm\generatedvalue(strategy="auto") */ protected $id; public function __construct() { parent::__construct(); // own logic } } app/resources/config/security.yml imports: - { resource: "@flyuserbundle/resources/config/security.yml" } security: access_control: - { path: ^/login$,

Python Referencing a name of a class object in a function -

i've never used classes before , trying general understanding of how work code example have below. im having issues referencing 1 of names define class. want program print out list of employee names , salaries stored in list when option 2 entered gives me following error: traceback (most recent call last): file "c:\scott glenn\misc\classes.py", line 31, in employees[i].displayemployee attributeerror: 'str' object has no attribute 'displayemployee' class employee: 'common base class employees' empcount = 0 def __init__(self, name, salary): self.name = name self.salary = salary employee.empcount += 1 def displaycount(self): print "total employee %d" % employee.empcount def displayemployee(self): print "name : ", self.name, ", salary: ", self.salary def addnewemployee(): newemployee = raw_input("what employees name: ") employ

php - Access variable of stdClass Object -

i using laravel select statement select row highest id this: $user_id = db::connection('mysql2')->select('select max(id) users')[0]; this returns array object looks this: stdclass object ( [max(id)] => 11 ) 1 i have tried $object->max(id) , $object['max(id)'] not seem work. dynamic attributes not allowed characters can accessed using curly brackets this: $object->{"max(id)"}

javascript - success&error vs. then&catch in AngularJS $http -

in answer this question said you not want ever use success , error (prefer .then , .catch instead and $http returns $q promise addition of success , error handlers - however, these handlers not chain , should avoided if/when possible and success , error unwraps response object, can access status , such anyway doesn't seem relevant. i found this blogpost author talks confusion other frameworks' ajax query commands , "you might not know you're doing ajax stuff.", don't understand. so i'm little fuzzy on reasoning behind "use then/catch instead of success/error". because of chaining errorcatching? reasons outlined sufficient , don't it? success/error fine in situations? considerations choice? in angjs tutorials i've read , answers here on stackowerflow saw success/error iirc . . .

.htaccess - Is there any reason not to redirect all HTTP traffic to HTTPS? -

i wrote rule in .htaccess redirect http traffic https. seems pretty common, wondering if have negative effect. far know helps far seo concerned. there scenario user wants non secure access, can't access secured site or that? or missing else besides seo , accessibility? there's post on server fault. consensus appears idea. this blog post covers of drawbacks. there's post information security stack exchange. if use adsense, might see decrease in earnings due forced ssl compliance. your site may perform differently using http.

css - Equal height divs kept together side-by-side always -

Image
using bootstrap 3.x , creating common 3 column layout. in desktop view want 3 divs in same row , same height. when shrunk down smallest width want first 2 divs remain next each other third drop below. always, first 2 divs should same height. if second div shorter first, third div ends underneath second, right of first. <div class="row"> <div class="col-sm-12 col-md-9"> <!-- keep these 2 divs side side , same height --> <div class="col-xs-6 col-sm-6 col-md-6"> panel 1 </div> <div class="col-xs-6 col-sm-6 col-md-6"> panel 2 </div> </div> <div class="col-sm-12 col-md-3"> <!-- div should beside other 2 on large screens , drop below on xsmall screens --> side bar ad </div> </div> here way visualize issue. first 2 need same height: http://www.bootply.com/29cnrjrew

ruby - Why is gsub not working whenever GT sign ">" is the first character in regex -

in text data working on greather sign supposed final character. hence, wanted replace non-conforming occurences that: some_variable.gsub!(/>([^\n])/, ">\n\\1") however, keep getting *undefined method gsub!' nil:nilclass (nomethoderror)* error when calling this gsub!` – if escape character backslash. surprise, changing gt sign not first 1 in regex: some_variable.gsub!(/(.)>([^\n])/,"\\1\n\\2") makes work. why? isn't weird gsub return nil? this has nothing gsub! . error message says try call gsub! on nil , i.e. means some_variable nil when don't expect be. argument gsub! , call gsub! itself, irrelevant, problem some_variable nil when expect string .

javascript - AngularFire (Angular + Firebase) Authentication Error delay -

i found out weird. please help! $scope.login = function() { ref.authwithpassword({ email: $scope.user.email, password: $scope.user.password }, function(error, authdata) { if (error) { console.log("login failed!", error); $scope.message = error.tostring(); } else { $location.path('/meetings'); console.log("authenticated payload:", authdata); } }); } //login this login function , works nicely.however, thing error 3, 4 sec after have submitted login. noticed {{message}} not being updated after receive value @ $scope.message . thought angular should show value changes. ? after click second time, error showed. this printing value: <p class="error formerror" ng-show="message">{{message}}</p> you're calling authwithpassword , part of firebase's regular javascript sdk. api start authentication process

Using void pointers for unknown return types in a linked list c++ -

i'm trying implement linked list , values held each node need not same type. i've used void pointer store value, issue i'm having retrieving value node. want write single function contains switch statement cast value appropriate type, i'm not sure how handle unknown return type other using void pointer. is there way around this, or perhaps more efficient way handle unknown data types? you don't use void* unless you're 100% sure you're doing. you don't use t* pointers value you don't use raw pointers @ all, appropriate idioms dynamic memory management facilities of c++ standard library. you use standard linked-list implementation: std::list . "is there way around this, or perhaps more efficient way handle unknown data types?" yes there's boost::any or boost::variant mentioned, though these aren't c++ standard types.

how to remove the runtime (NZEC) error in my python code? -

i trying solve prime generator problem prime1 in spoj.com getting runtime error(nzec). problem needs take number of test cases , each test case, needs input 2 numbers in line each different test case , print output prime numbers in range of each number error runtime error time: 0.01 memory: 7736 signal:-1 # code goes here def is_prime(x): if x<2: return false if x==2: return true y in range(2,x): if x%y==0: return false return true t=int(raw_input()) mylist=[] in range(0,t): a=raw_input() a=a.split(' ') mylist.append(int(a[0])) mylist.append(int(a[1])) k=0 while k<len(mylist): c=mylist[k] k+=1 d=mylist[k] k+=1 z in range(c,d+1): if is_prime(z): print z print your issue raw_input() returns string , not integer. trying use directly in range() function - for in range(0,t) . range() function accepts integers arguments, need convert input int

api - Having trouble understanding how npm soap package works -

i'm using npm soap package connect soap api , call methods, , i'm not grasping how supposed work. for instance, in api documentation, gives example: <soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://xxx"> <soapenv:header/> <soapenv:body> <ser:setsessionparameters> <viewsettings> <forcelogoutsession>yes</forcelogoutsession> <rollingperiod>minutes30</rollingperiod> <shiftstart>21600000</shiftstart> <statisticsrange>currentday</statisticsrange> <timezone>-28800000</timezone> <idletimeout>1800</idletimeout> </viewsettings> </ser:setsessionparameters> </soapenv:body> </soapenv:envelope> and if use rest tool send content api endpoint, works e

ios - How to return a value from a function that is generated from a parse query within the function? -

problem: when call below function within viewcontroller tableview cellforrowatindexpath method, nil, need set generated object pfobject variable called rankobject declared globally in viewcontroller. i've tried lot of things, including completion handlers, , still stuck. how accomplish task? func getormakerankrelations(sound: pfobject) { var rankrelation = sound.relationforkey("userranks") let currentuser = pfuser.currentuser()! var relationquery = rankrelation.query() relationquery?.wherekey("user", equalto: currentuser) relationquery?.findobjectsinbackgroundwithblock { (theobject: [anyobject]?, error: nserror?) -> void in if (theobject?.isempty == true) { println("rank object empty") //make ranking pfobject var ranking = pfobject(classname: "ranking") ranking["user"] = pfuser.currentuser()! ranking["rank"] = 0

ios - Change initial viewcontroller in AppDelegate swift -

i have created first swift app, single viewcontroller setted in appdelegate function: func application(application: uiapplication, didfinishlaunchingwithoptions launchoptions: [nsobject: anyobject]?) -> bool { var tablevc:friendstableviewcontroller = friendstableviewcontroller(classname: "friend") tablevc.title = "friendfamz" uinavigationbar.appearance().tintcolor = uicolor(red: 0.05, green: 0.47, blue: 0.91, alpha: 1.0) uinavigationbar.appearance().bartintcolor = uicolor(red: 0.05, green: 0.47, blue: 0.91, alpha: 1.0) uinavigationbar.appearance().titletextattributes = [nsforegroundcolorattributename: uicolor.whitecolor()] uiapplication.sharedapplication().statusbarstyle = uistatusbarstyle.lightcontent var navigationvc:uinavigationcontroller = uinavigationcontroller(rootviewcontroller: tablevc) let frame = uiscreen.mainscreen().bounds window = uiwindow(frame: frame) window!.rootviewcontroller = navigationvc win

Python Command Line Interpreter not recognizing updated changes in my code? -

this question has answer here: how re import updated package while in python interpreter? [duplicate] 11 answers i'm using atom text editor write code in, , importing python 3.4 command line interpreter. if make mistake in code , have make fix, i'm unable see changes reflected in interpreter until close , re-open it. happens if re-import file. have cache need clear? how 1 see code changes in interpreter without closing it? when load python module in interpreter, reads imported code once, caches code later use. means if make changes module, you'll have tell interpreter reload content. pretty easy do: >> import foo # crystallizes foo code in interpreter state in @ time of import >> # [updates made foo code] >> import importlib >> importlib.reload(foo) that should it! [note: importlib new in python 3.4 . before t

java - What will the following import declaration import? -

java.io.reader.*; i know reader class, not package. so, above declaration import? the declaration: import java.io.reader.*; is example of type-import-on-demand declaration. java language specification : a type-import-on-demand declaration allows accessible types of named package or type imported needed. since java.io.reader contains no nested classes or other accessible types, declaration ignored. note java has import static declaration. so import static java.io.reader.*; would example of static-import-on-demand declaration. again, according java language specification: a static-import-on-demand declaration allows accessible static members of named type imported needed. and since java.io.reader has no accessible static members, declaration again ignored.

Excel Macro VBA -

i new vba , excel macros. i create command button asks user input if searching policy or procedure or form. ask user search words. result of search appear list on first worksheet. the excel spreadsheet has 9 worksheets. first worksheet introduction search feature. remaining 8 worksheets contain data 2 columns. first column name of policy, procedure or form. second column type of document (i.e. policy, procedure or form). # of rows each type of document vary between worksheets defined cell range different each worksheet each type of document. i'm going assume you, many people, confused on how start, , not trying use site free macro repository. with in mind, i'm going give links , tools yourself. discuss type of vba use solve have terms available up. first , foremost, need command button. easiest way use developer tab on ribbon. can learn here . once button, you'll need assign macro it. more info on here . suggest form control button bit easier ,

Why does Scala List[Int].contains accept Option[Int]? -

this question has answer here: scala: why seq.contains take argument, instead of argument of sequence type? 3 answers so given list: val a:list[int] = list(1,2,3) you can do: a.contains(option(2)) which returns false. understand following function definitions allowing compile @ done on purpose: def contains[a1 >: a](elem : a1) : scala.boolean = {...} sealed abstract class option[+a]() ... what don't understand why - there use case useful? if automatically flattened option before comparison above returned true might useful return false. i ask because it's easy forget unwrap option variable pass list.contains, leading potentially difficult find bugs. thanks! imagine following: sealed trait result case class simpleresult(x: int) extends result case class fancyresult(x: int, y: int) extends result val okresults: list[simpleresult

vba - Ending a For-Loop that goes through worksheets in Excel -

i appreciate if can following. following code copies range ms excel , paste ms powerpoint. additionally, there loop goes through worksheets of workbook , applies same copy , paste formula. however, i'm struggling how "close" loop when reaches last worksheet. @ end of code, run-time error '91': object variable or block variable not set highlights sh(activesheet.index + 1).select when select debug. sub createdeck() dim wsheet_count integer dim integer dim rng excel.range dim pptapp powerpoint.application dim myppt powerpoint.presentation dim myslide powerpoint.slide dim myshaperange powerpoint.shape dim sh worksheet 'set wsheet_count equal number of worksheet in active workbook wsheet_count = activeworkbook.worksheets.count 'around world: loop = 1 wsheet_count 'copy range excel set rng = thisworkbook.activesheet.range("a1:a2") 'creat instance powerpoint on error resume next 'check if powerpoint open set pptapp = getobj

Unable to create a "list" in NetLogo -

i trying create simple "list" returns error. when type: observer> set [2 4 6] it returns: error: nothing named has been defined i have netlogo version 5.1.0 , operation system ubuntu 14.04 lts. bug or doing not right? this error doesn't have lists. a needs declared global in code tab work. add: globals [ ] to code tab.

javascript - Angular REST data not displaying in view correctly -

Image
heres angular app: app.controller("appctrl", function ($scope, $http, $q) { $q.all([ $http.get('http://private-bc4b97-commutertransport.apiary-mock.com/bus'), $http.get('http://private-bc4b97-commutertransport.apiary-mock.com/otm') ]).then(function(results) { $scope.network = results[0].data; $scope.data = results[1].data }) }); the html: <div class="main" ng-controller="appctrl"> <h1>{{network.test1}}</h1> <h1>{{data.test2}}</h1> </div> and basic json (in different url each other of course): "test1" : "first test", "test2" : "second test", now console showing http being called data isn't being displayed in view... not sure whats wrong? console log screen: try logging response in console; in experience angular's $http service (when using .then method), response data wrapped in response object , returned in data property

java - Refactoring Code Between Projects Results in RuntimeException: Uncompilable Code -

when copied on gui classes project new one, thought easy. unfortunately, wasn't. made game named entwine, who's package name net.jibini.entwine , new project's package name net.jibini.pilgrim . when attempt run refactored code (taken entwine , put pilgrim), error: java.lang.runtimeexception: uncompilable source code - package net.jibini.entwine not exist . can not find link original classes, don't know coming from. this base gui class: package net.jibini.pilgrim.gui; /** * * @author zgoethel12 */ public abstract class gui { public abstract void render(); } this guipause class: package net.jibini.pilgrim.gui; import net.jibini.pilgrim.main; import org.lwjgl.opengl.display; /** * * @author zgoethel12 */ import static org.lwjgl.opengl.gl11.*; public class guipause extends gui { guielementbutton back, quit; public guipause() { controls(); } @override public void render() { glpushmatrix(); glt

Python indentation error in if statement -

i have following trouble in python. sister_age = 15 brother_age = 12 if sisiter_age > brother_age: print "sisiter older" else: error: syntaxerror: invalid syntax if sisiter_age > brother_age: print "sisiter older" else: file "<pyshell#5>", line 4 else: ^ indentationerror: unindent not match outer indentation level no matter how many times try change index, shows error. assuming there after else statement, else statement should aligned if statement, not inside it. example - if sisiter_age > brother_age: print "sisiter older" else: also, if not have (or need) inside else statement, should remove it.

Is it possible to generate LightBox2 galleries from Adobe Lightroom? -

i'm frequent adobe lightroom user, , there many options export pictures. unfortunately, don't find allow export lightbox2 galleries. can me? you can generate web galleries adobe lightroom using pre-made set of html , flash templates. these templates allow simple customizations, such color, layout, , watermarks, not allow changing of interactions or adding custom plugins lightbox. to add lightbox adobe lightroom web gallery have make additions manually after gallery generated. can follow steps on official lightbox page: http://lokeshdhakar.com/projects/lightbox2/#getting-started more information adobe lightroom web galleries: https://helpx.adobe.com/lightroom/help/creating-web-galleries-basic-workflow.html

svg - draw line on mouse drag in raphael js -

this have tried: <!doctype html> <html> <head> <title>editor</title> <meta http-equiv="x-ua-compatible" content="ie=9"/> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/raphael/2.1.4/raphael-min.js"></script> <script type="text/javascript" src="<%=request.getcontextpath()%>/connector.js"></script> <link rel="stylesheet" href="<%=request.getcontextpath()%>/style.css" /> <script type="text/javascript"> window.onload = function () { var paper = new raphael(raphael("container", "100%", "100%")); var line = paper.path();

visual c++ - MFC EditControl onclick -

i wondering there way handle mouse click operation on editcontrol box? found this when researching, not able understand completely, there way handle mouse click on editcontrol, if so, how done?

bash - how to use gnu parallel over a range of numbers given by command-line arguments -

i'm trying use gnu parallel basic bioinformatic tools, e.g. lastz. have 10 seqs, , want use lastz on of them, use: parallel --dryrun lastz 'pathtofile/seq{}.fa query.fasta --format=text > lastz_results_seq{}' ::: {1..10} which works fine , returns: lastz pathtofile/seq1.fa query.fasta --format=text > lastz_results_seq1 lastz pathtofile/seq2.fa query.fasta --format=text > lastz_results_seq2 lastz pathtofile/seq3.fa query.fasta --format=text > lastz_results_seq3 ... lastz pathtofile/seq10.fa query.fasta --format=text > lastz_results_seq10 but ideally i'd step part of bash script takes 3 command-line arguments, number of seqs (eg. 1 10) given in command-line (with $2 = startvalue, $3 = endvalue). thought changing work: parallel --dryrun lastz 'pathtofile/seq{}.fa query.fasta --format=text > lastz_results_seq{}' ::: {"$2".."$3"} but instead, returns lastz pathtofile//seq\{\1..\10\} query.fasta --format=text &g

jquery - Distinguishing between the user scrolling and programmatically scrolling using Javascript -

i'm creating scrolling effect using jquery , i'm wondering if it's possible distinguish between user scrolling vs. programmatically scrolling. i have this: $('#element').on('scroll',function(e){ $('#element').stop(true); // stop previous scrolling animation $('#element').animate({ // start new scrolling animation (maybe different speed, different direction, etc) scrolltop:... }); }); however, event triggered during every step of animation. how can tell if event triggered user or animation? use variable determine when scrolling programmatically example: var programscrolling = false; $('#element').on('scroll',function(e){ if (programscrolling) { return; } $('#element').stop(true); // stop scrolling animation programscrolling = true; $('#element').animate({ scrolltop:... }); programscrolling = false; }); not sure if want,

how to declare uninitialized variable in class definition in python -

i come matlab background. when create class definitions, can instantiate "empty" variable names , later assign values or objects them. i.e. classdef myclass < handle properties var1 var2 end end = myclass; a.var1 = someotherclassobject; how do in python? tried this: class myclass: def __init__(self): var1 var2 = myclass() a.var1 = someotherclassobject() but that's not correct. main purpose build definition of class, structure, , later go , instantiate variables needed. and appreciated. you need use self. create variables instances (objects) i not think can have uninitialized name in python, instead why not initialize instance variables none ? example - class myclass: def __init__(self): self.var1 = none self.var2 = none you can later go , set them whatever want using - a = myclass() a.var1 = someotherclassobject if need define class variables (that shared across instances

android - OpenGL: Take screenshot of screen and transform (shrink) it, then draw that on a portion of the screen -

i want use opengl android take screen (make "continuous" screenshots), make smaller vertically, paint leave black bar @ bottom of display. basically: read pixels transform (shrink screen vertically) paint shrunk screenshot on display. repeat 1.-3. continuously. how can this? bottom line want have space other stuff @ bottom of screen while still not missing underneath want display (think soft home buttons in android). this sounds insanely expensive. i'd try render @ correct size in first place. use glscissor limit region of screen stop drawing outside of that, , glviewport correct transform behaviour.

c++ - Why cout's default precision doesn't effect evaluated result? -

here thinking: #include <iostream> #include <iomanip> int main () { double x = 10-9.99; std::cout << x << std::endl; std::cout << std::setprecision (16); std::cout << x; return 0; } the above program prints 0.01 evaluating x before setprecision () , long number not equal 0.01, x after setprecision ().cout has default precision of 16 when printing floating point numbers in machine. if precision 16, above value should 0.0100000000000000 remains 0.01but when setprecision () 16, program prints long number containing 16 digits. question is, why cout doesn't prints digits according types default precision. why need force cout (by using setprecision ()) print digits? why cout doesn't prints digits according types default precision. if use std::fixed setprecision , display however-many digits precision asks for, without rounding , truncating. as why rounding accounts output... let's code print c

mysql - Recursion to display nested comments with PHP -

how can make below code same thing without unncessary repetition? assuming want display 10 replies top-level comment (and allow them continue on page) on forum, mentioned can build them single database query or sort of recursive function. came (limited programming knowledge) said inefficient: <?php // query top-level comments, put each row in array foreach ($comments $comment) { // set variables (such submitter, date, comment text) ?> html using variables, without last </div> tag <?php // query level-1 replies, put each in array foreach ($replies1 $reply1) { // set variables (such submitter, date, comment text) ?> html using variables without last </div> tag <?php // continue more foreach loops, last having </div> tag ?> <?php } $replies1 = array(); // reset ?> </div> (to end container top-level in) <?php } ?>

VBA code search and format text in word document - infinite loop -

i have written below code search through word document select text between words (i.e. "hide note" "hide note"). once text selected shaded. want code loop through whole document once, seem have created infinite loop. suggestions welcome! thank you `sub searchshade() 'start of doc selection.homekey unit:=wdstory 'start of loop until activedocument.bookmarks("\sel") = _ activedocument.bookmarks("\endofdoc") 'search selection.find.clearformatting selection.find .text = "hide note" .forward = true .wrap = wdfindstop .format = false .matchcase = false .matchwholeword = false .matchwildcards = false .matchsoundslike = false .matchallwordforms = false .execute end 'select down next hide note selection.extend selection.find .text = "hide note" .forward = true .execute selection.shading.foregroundpatterncolor = wdcolorautomatic selection.shading.backgroundpatterncolor = -603923969 end 'move down 1

How to get the docker containers information with Ruby and monitor it -

Image
i want containers' stats. eg: cpu, memory i know command docker stats <container name> , when type command, blocking in foreground(like typed top command) but want information ruby . then decide action information, such restart container or else. thanks ~ you should access docker remote api not docker cli so if want container stats, can through get /containers/(id)/stats api , parse response ruby. also, found ruby repo might helpful.

xcode - Ad network redirecting to safari or app download every 5 seconds - iOS -

i've had lot of users complain ads automatically redirecting them safari or ios app store every 5 seconds without pressing ad. have issue? can't seem pinpoint problem or ad network. the app had issue using mobfox, admob, millennium media , i've disabled mobfox , millennium , blocked gaming ads on admob hoping go away. anyone experienced similar issues lately has pinpointed ad network , category? i haven't run such cases configs of admob, mm , mopub. have heard there small ad networks running ads timer triger auto-redirect. think way u can try block 1 one identify 1 serves bad ad. luck.

How to set jdk in Android Studio? -

Image
when worked in android studio computer turn off , turn on again computer , open android studio ,it has problem ,android studio unknown java classes , doesn't import anything. how can solve error? what can do: 1) clean project if want set jdk project should right click on file->project structure , on sdk location select jdk want use.

regex - Exclude Matches which start with '#' -

i using simple regex plain text files: \([a-za-z]*\) i matches like: ...(test)... , ...(next)... , ...(warning)... , on is possible exclude matches start # ? example: # caught stealing (warning) (3300-3599) i have tried lot , came this: (?:^\s*?#.*)|(\([a-za-z0-9\s\-]*\)) now need display matches of 1st capturing group, don't know how. can give tip? this not straight-forward looks. normally you'd use lookarounds this, case pretty unorthodox. want non-line related results (as line can have number of results) line related requirement (the absence of #). lookarounds line-specific , have 1 result. my solution: \s*?#.*(?:\n|$)|(\([a-za-z0-9\s\-]*\)) demo you won't avoid having results within capture groups i'm afraid. in case, of results $1. idea describe possibility of commented line, , if it's not met, describe how items you're interested look. since commented line option first, items within won't tested i chan

Making a new variable from multiplying another -

here section of code i'm having trouble with: def gbp(): gbpto = int(input("which currency converting into?")) if gbpto == "1": print("you converting pounds sterling pounds sterling... there no conversion needed!") elif gpbto == "2": num = float(input("please type in amount of pounds sterling wish convert dollars") calc = num * 1.55 calc = round(calc, 2) print(num + " pounds sterling in dollars $", calc) when run it, comes syntax error, highlighting calc . should do? one parenthesis missing, 1 closes float(). ... num = float(input("please type in amount of pounds sterling wish convert dollars")) ...

javascript - I'm new, and I cannot for the life of me find this syntax error -

i not understand why there syntax error in line 12, there seems one. g = 0 y = 0 c = 0 while(true) { computer = random(3); = choose("choose!", "rock", "paper", "scissors"); if (computer == 1){ if (you == 2){ show("you win!"); g = g + 1; y = y + 1; if (g == 3) { break; show("computer: " + c + "you: " + y); } } else if (you == 1) { show("draw"); g = g + 1; if (g == 3) { break; show("computer: " + c + "you: " + y;) } } else if (you == 3) { show("computer wins."); g = g + 1; c = c + 1; if (g == 3) { break; show("computer: " + c + "you: " + y;) } } } y;)} should y);} in 2 places another issue though, have break; show(... in 3 places, show don't think run after break var g = 0, y = 0, c = 0; while (true) { computer = random(3); = choose(&

node.js - localhost:3000 connection refused after app.js is set (Windows 7) -

i've followed manual of installing mean stack https://thecodebarbarian.wordpress.com/2013/07/22/introduction-to-the-mean-stack-part-one-setting-up-your-tools/ , got stuck on point should able reach localhost:3000 successfully, instead err_connection_refused. checked ports using netstat -an and seems port 3000 not open. apache working on port 80 , after reaching localhost:80 works fine (i checked if closing apache helps). thing changed in manual installed both express , express-generator install express npm . can tell me should additionally port 3000 responds? edit: checked host files in system32, localhost address have 127.0.0.1 (three times, though!) edit2: solved, same issue here: express node.js doesn't work remember change app.js file in folder working in!

Android Test stopping in instantiating tests -

when run ui test, stopping in instantiating tests... uploading file: local path: /users/eclo/androidstudioprojects/minicooper4android/minicooper4android/app/build/outputs/apk/nammogujie714-uitest-debug-androidtest-unaligned.apk remote path: /data/local/tmp/com.mogujie.test no apk changes detected. skipping file upload, force stopping package instead. device shell command: force-stop com.mogujie.test running tests what's wrong?

Wordpress 301 Redirect -

i have got 1 wordpress blog site , use permalink as: %category%/%postname%.html i want change as: %postname%.html and old urls ( https://www.example.com/category/post-name.html ) 301 redirect ( https://www.example.com/post-name.html ). how can redirect use .htaccess file? just go wp-admin, /settings, /permalinks , select "post name". more info on here: https://codex.wordpress.org/using_permalinks for 301 redirects can write own htaccess file not easy using plugin simple 301 redirects.

Which file we shouldn't commit on GitHub from Android Studio -

i working on project using android studio, using github , sourcetree also. problem when make change in project , open sourcetree see files on unstaged files list like: .idea/mics.xml .idea/modules.xml .idea/vcs.xml projectname.iml app/app.iml app/build.gradle setting.gradle i don't know these files should ignored or committed after changes in code. please suggest. here .gitignore file under app folder. # built application files /*/build/ # crashlytics configuations com_crashlytics_export_strings.xml # local configuration file (sdk path, etc) local.properties # gradle generated files .gradle/ # signing files .signing/ # user-specific configurations .idea/libraries/ .idea/workspace.xml .idea/tasks.xml .idea/.name .idea/compiler.xml .idea/copyright/profiles_settings.xml .idea/encodings.xml .idea/misc.xml .idea/modules.xml .idea/scopes/scope_settings.xml .idea/vcs.xml *.iml # os-specific files .ds_store .ds_store? ._* .spotlight-v100 .trashes ehthumbs.db t