Posts

Showing posts from June, 2015

javascript - Is there any way to use $http inside the config function or there is any way call the url inside config to get the value in angular js -

i want call servlet inside config function of angular js accept language using $http inside config function possible or alternate solutions please.as new angular js uhm reading ask, think can use function inside .config() , inside function inject services need. i'll leave example using function ui.router can make idea of how use it. app = angular.module('myapp', []) .config(function ($stateprovider) { var dosomething = function ($http, $cookies, myservice) { //here logic } $stateprovider .state('mystate', { url: '/', resolve: { dosomething: dosomething },//for example here can use function templateurl: "views/login.html", controller: 'logincontroller' }); }); otherwise can use providers inject on .config() , use it.

http - How to perform callback in angular2? -

i have following code in angular2 service : this.returned: string; parseresponse() : void { console.log("response:",this.returned); } sendhttp(text: string): void { var to_send = json.stringify({"text": text}); var headers = new headers(); headers.append('content-type', 'application/json'); this.http .post('http://localhost:8080/', to_send, { headers: headers }) .map(res => { this.parseresponse() }) .subscribe( function(response) { console.log("success response" + response)}, function(error) { console.log("error happened" + error)}, function() { parseresponse(); } ); } but unfortunately parseresponse() not running after nodejs server returns "testing". however, request received correctly. me please? edit: this actual code. nothing console.logged. request sent. no callbacks executed. parseresponse(res: response) : void { cons

unity3d - Trail renderer always black? -

Image
for reason 2d trail renderer stays black no matter change color. idea why? the answer easy. use mobile/diffuse shader not accept main color multiply texture. need shader has main color . can use (it varation of mobile/diffuse main color ) shader "mobile/diffuse color" { properties { // adds color field can modify _color ("main color", color) = (1, 1, 1, 1) _maintex ("base (rgb)", 2d) = "white" {} } subshader { tags { "rendertype"="opaque" } lod 100 pass { lighting off settexture [_maintex] { // sets our color 'constant' variable constantcolor [_color] // multiplies color (in constant) texture combine constant * texture } } } fallback "mobile/vertexlit" } also should use texture, can 2x2 resolutio

highlighting - Intellij: Highlight current block of code -

Image
i wondering if possible highlight block of code working on in intellij idea. there similar question here: is there way highlight active code block in visual studio 2010? . so mean if have clicked e.g. method or while loop... ,the background of whole block becomes bit lighter or whatever. there's 1 such feature, it's more subtle, in form of vertical line inside left gutter... can't recall whether it's enabled default or not, can activate file -> settings -> editor -> general , scroll highlight on caret movement section (about half of page). i looked around while have not yet found way change appearance match description, although prefer less intrusive highlight having background changed. p.s. not sure relevant or useful you, there plugin tried while ago called codeglance offered scrollable-map of class:

numpy - how to load a dataframe from a python requests stream that is downloading a csv file? -

i create dataframe csv file retrieve via streaming: import requests url = "https://{0}:8443/gateway/default/webhdfs/v1/{1}?op=open".format(host, filepath) r = requests.get(url, auth=(username, password), verify=false, allow_redirects=true, stream=true) chunk_size = 1024 chunk in r.iter_content(chunk_size): # how load data how can data loaded spark http stream? note isn't possible use hdfs format retrieving data - webhdfs must used. you can pre-generate rdd of chunks' boundaries, use process file inside worker. examples: def process(start, finish): // download file // process downloaded content in range [start, finish) // return list of item partition_size = file_size / num_partition boundaries = [(i, i+paritition_size - 1) in range(0, file_size, partition_size)] rrd = sc.parallelize(boundaries).flatmap(process) df = sqlcontext.createdataframe(rrd)

web2py - Restful API with authentication -

i try built api web2py application. # -*- coding: utf-8 -*- auth.settings.allow_basic_login = true @auth.requires_login() @request.restful() def api(): response.view = 'generic.json' def get(tablename, id): if not tablename == 'division': raise http(400) result = db(db.division.title == id).select() return dict(result = result) return locals() but everytime try connect via curl answer: you being redirected <a href=\"/my_manager/login?_next=/my_manager/api/get_all_divisions/1.json\">here</a> when comment out line @auth.requires_login() everythink works fine. i've searched hints, didn't found helpful information topic far. any appreciated. i know pretty old question still answer other people might experience same issue: well in case using @auth.requires_login() needs user logged in. so need send basic auth credentials while making calls api. a simplest curl

tar untar files loses modification date -

when tar file , untar it, lose modification , creation date of file. there way protect date? need because have jenkins job uses aws sync command after untaring , keeps uploading same files s3. tar --atime-preserve preserve access time, creation , modification times not preserved. if receiving file system time stamps important, might have more success dump , restore commands (provided supported). believe there more options on how handle time stamps, intended backup , restore.

visual studio 2010 - how to copy three table data into one access c# -

i want 1 master table keep track of information want copy 3 data of 3 different tables of same database. have table1 ,table2 , table3 , want copy in 1 table master_table using c# 3.5. please . if tables have same structure can directly merge them dtall = dtone.copy(); dtall.merge(dttwo); dtall.merge(dtthree); else, if have different structure 3 table can add them dataset. dataset dsall = new dataset(); dsall.tables.add(dtone); dsall.tables.add(dttwo); dsall.tables.add(dtthree);

C++ own exception practices -

i'm new c++ exceptions , not quite sure how should use them. i'm open every exception handling practice, of ideas. i've rewritten c libraries custom hardware uses posix api accessing gpios, i2c, uart , network sockets. i'm trying find exception design library of custom hardware , interfaces mentioned above. current design: own exceptions every interface, e.g. customhwexception , gpioexception , i2cexception , ... embed additional information every exception (some common base class) "port" number, can used logging , exception handling (while "port" can number interface number, real port number, pin number, etc.): gpio12 , i2c0 , ttys0 , port 32000 error message (string) logging fatal / non fatal possible fix problem: e.g. none, try again later, reset interface, ... what i've read exceptions far should make our lives easier , don't think errnos embedded in exceptions add real value. user gets errno , has decide what's

c - Vigenere cypher program error for cs50 -

i'm writing vigenere cypher program in c cs50 , have working perfectly. error when encryption wraps around output ? symbol in white circle. below code; #include <cs50.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> int main(int argc, string argv[]) { char a; char letter; char cryptletter; char passletter; string message; int messcount = 0; if(argc != 2) { printf("command line must contain 1 passphrase\n"); return 1; } for(int i=0; < strlen(argv[1]); i++) { = argv[1][i]; if(isalpha(a) == 0) { printf("encryption keyphrase must contain alphabetic characters\n"); return 1; } } message = getstring(); (int j = 0; j < strlen(message); j++) { letter = message[j]; if(passletter < 91 && passletter > 64) { passletter = passletter + 32; } if(isupper(letter) != 0) //if uppercase 65-90 { passletter

php - How to create main menu in wordpress dashboard -

i kinda of newbie in wordpress , stuck how change main menu href category.. try find header in ftp files still cant understand how it.. wordpress stil cant it.. can someoner please me undestand find html file or php , change hrefs links? in advance dont find in html files. go admin panel -> appearance -> menues. then menu there. click item , edit url. that's !

javascript - Getting an error when trying to use react-native-billing library for making test purchase -

i want test buying using react-native-billing library. way: buy() { const inappbilling = require("react-native-billing"); inappbilling.open() .then(() => inappbilling.purchase('android.test.purchased')) .then((details) => { console.log("you purchased: ", details) return inappbilling.close() }) .catch((err) => { console.log(err); }); } and error this: "undefined not object (evaluating 'inappbillingbridge.open')" in library there code this: "use strict"; const inappbillingbridge = require("react-native").nativemodules.inappbillingbridge; class inappbilling { static open() { return inappbillingbridge.open(); // error here } } i.e. inappbillingbridge undefined don't understand why. did face problem?

osx - Haskell cabal issue with Mac OS X 10.11? (cannot satisfy -package-id) -

i used latest haskell platform 7.10.2-a ( https://www.haskell.org/platform/mac.html ) on mac os x 10.11 el-capitan. when tried install yesod cabal install yesod , have multiple error messages such as: building email-validate-2.1.3... building http-api-data-0.2.1... building fast-logger-2.4.1... building http-date-0.0.6.1... failed install crypto-random-0.0.9 build log ( /users/smcho/.cabal/logs/crypto-random-0.0.9.log ): configuring crypto-random-0.0.9... building crypto-random-0.0.9... preprocessing library crypto-random-0.0.9... <command line>: cannot satisfy -package-id vector-0.11.0.0-730f99979d41c11c3a1ef069844b5f57 (use -v more information) failed install email-validate-2.1.3 build log ( /users/smcho/.cabal/logs/email-validate-2.1.3.log ): configuring email-validate-2.1.3... the error pattern pretty same: cannot satisfy -package-id . for example, cabal install aeson gives cannot satisfy -package-id attoparse... error. resolving dependencies... configuri

intelliJ fails to resolve 0.13.9 compiler interface importing sbt project -

Image
importing project intellij, get: sbt project import [warn] [failed ] org.scala-sbt#compiler-interface;0.13.9!compiler-interface.jar: (0ms) here's import options selected: after import works though. i don't error in sbt when clone same project. might be? how avoid it?

isabelle - Quotienting a mutually recursive family of datatypes -

is possible quotient family of mutually recursive datatypes in isabelle/hol using quotient_type mechanism family of equivalence relations? if so, there example of somewhere already? searching isabelle documentation, , paper describing revamped quotient_type mechanism, doesn't prove helpful. the command quotient_type can handle 1 type @ time. if want quotient on several mutual types, must encoding , decoding manually, pretty simple. suppose 2 types t1 , t2 equivalence relations r1 :: t1 => t1 => bool , r2 :: t2 => t2 => bool . then, quotient_type q = "t1 + t2" / "rel_sum r1 r2" is combined quotient type. can define 2 quotients projections: lift_definition abs1 :: "t1 ⇒ q" "inl" . lift_definition abs2 :: "t2 ⇒ q" "inr" . typedef q1 = "range abs1" blast typedef q2 = "range abs2" blast with setup_lifting , can register q1 , q2 lifting package, too. then, decent

java - Comparable cannot be converted to T#1 -

i have piece of code takes generic of type comparable , class implements comparable interface. receive error on compareto() method in class stating comparable cannot converted t#1. the complete error message is-> edge.java:40: error: method compareto in interface comparable<t#2> cannot applied given types; return (this.weight).compareto(e.weight()); ^ required: t#1 found: comparable reason: argument mismatch; comparable cannot converted t#1 t#1,t#2 type-variables: t#1 extends comparable<t#1> declared in class edge t#2 extends object declared in interface comparable 1 error shouldn't (this.weight) return type 't' instead of comparable ? weight() method returns comparable. i not understand completely. it'll great if can clarify why receiving error. error goes away on replacing this.weight this.weight(). public class edge<t extends comparable<t>> implements compa

Python 3 while loop not fully looping? -

this question has answer here: pythonic way check if list sorted or not 17 answers so i've been @ while. i'm trying create function checks if numbers in list increasing. example [1, 2, 3] true [1, 3, 2] false. have gotten point [1, 2, 3] true, [3, 2, 1] false, [1, 3, 2] still true. assume because first 2 positions being read? here function reference: def increasing(lst): index = 0 index2 = index + 1 while index < len(lst): if lst[index] >= lst[index2]: index += 1 index2 += 1 return false else: while index < len(lst): if lst[index] < lst[index2]: index += 1 index2 += 1 return true try this: def increasing(lst): return lst == sorted(lst) this checks whether list sorted.

css - Bootstrap: How to collapse heading panel (link on minus) -

i using twitter bootstrap collapsing panels default collapsed. when click on + icon or somwhere on header title can open panel , see content in it, when panel opened the minus sign collapsing panel not linkable (header title is). so, want make minus icon linkable (under html code css part , can find minus icon on content: "\f273"; in class .panel-collapse .panel-heading:after ) update there online example: link http://byrushan.com/projects/ma/1-6-1/jquery/light/components.html , go down collapse->accordion (when expanding panel find, on collapsing - (minus) not linkable) there code <div class="panel-group" data-collapse-color="red" id="faq" role="tablist" aria-multiselectable="true"> <div class="panel panel-collapse"> <div class="panel-heading" role="tab"> <h4 class="panel-title">

Django - How to properly access reverse relationship ManyToManyField -

this models.py (i'm using default django user model well): class userextended(models.model): user = models.onetoonefield(user, related_name="userextended_set") location = models.foreignkey(location) follow = models.manytomanyfield(user, related_name="follow_set") now, access list of 'follow' users of particular user (users particular user following), i'd this: a = user.objects.get(username='a') a.userextended_set.follow.count() my question is, how list of users whom particular user on 'follow' list of (i.e. following him)? tried this: # assuming user 'a' on 'follow' list of 1 users (i.e. # assuming .get() return 1 user object). user.objects.get(username='a').follow_set.get().username but error saying attributeerror: 'userextended' object has no attribute 'username' i think need: user # user userextended.objects.filter(follow=user)

reactjs - Using 'material-ui' with react-rails gem? -

i use material-ui component library in rails 4 app. using react-rails gem add .jsx compilation asset pipeline. have added material-ui via rails-assets in gemfile so: source 'https://rails-assets.org' gem 'rails-assets-material-ui' end and have required library in application.js file so: //= require material-ui however keep getting error "couldn't find file 'material-ui". how can use material-ui component library in rails app react-rails gem? ok here have working far... to gemfile have added: gem 'react-rails' gem "browserify-rails" this gives our react library, helpers , jsx compilation ability use require() sytax require modules in our js. browserify-rails allows require npm modules in rails assets via package.json file. we can add material-ui library our app via package.json file... "dependencies" : { "browserify": "~> 10.2.4", "browserify-incremental&quo

python - Able to run Pytest from PyCharm but not through Command Line -

i trying on ubuntu. when run pytest pycharm worked when tried run same command getting different errors. surely not building command correctly. so here looks in pycharm target = /some_path/test_xxx.py options= --server ### -s --browser firefox --html=report.html and below have tried on shell lab-automation:~/my_folder$ py.test /<some_path>/test_xxx.py --server ### -s --browser firefox --html=report.html traceback (most recent call last): file "/usr/local/bin/py.test", line 11, in <module> sys.exit(main()) file "/usr/local/lib/python2.7/dist-packages/_pytest/config.py", line 48, in main config.pluginmanager.check_pending() file "/usr/local/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 490, in check_pending (name, hookimpl.plugin)) _pytest.vendored_packages.pluggy.pluginvalidationerror: unknown hook 'pytest_html' in plugin <module 'pytest_suites.conftest' '/<so

html - How to align content on webpage below the header -

i enrolled web course. learning html5 , css. have make 3 webpages; main, me , hobbies. i've created pretty they've asked according specification gave me have 1 problem; content not display supposed be. i've tried position: relative, position: absolute etc , modified the position of using bottom: 500px etc doesn't right. example, on code below, 'about me' page. pictures on side not aligned top of main article. pictures besides main article correct positioned bit below. happens throughout webpages on tables elements.. <!doctype html> <html> <head> <meta charset="utf-8"> <title>about me</title>  <link property="stylesheet" rel ="stylesheet" href="cascadingstylesheet.css"/> <!--[if lt ie 9]> <script src="hpp://html5shiv.googlecode.com/svn/trunk/html5.js"> </script> <![endif]--> </head> <body> <header> &

c - The scanf and gets work differently about put '\0' in an array? -

i getting , displaying names, , stop program when type enter key. @ below code correctly result (i know "gets" deprecated): #include <stdio.h> main() { char name[50]; while(1) { printf("name: "); scanf("%s", name); if(name[0]=='\0') break; else printf("name entered: %s\n", name); } } but when try use scanf: printf("nome: "); scanf("%s", nome); the condition name[0]=='\0' never true time. why? '\0' works differently in these functions? if scanf cannot assign value variable (because input stream has whitespace, terminating 'string'), doesn't clear out; reason partly not variables have obvious 'clear' state. so after scanf, nome still contains whatever contained before. need check if scanf able assign variable instead, testing return value: if (scanf(...) == 1) - means 'did s

How to return false from a PHP script from inside a class/function? -

how can make the main php script return false inside class or function? why: because of built-in webserver: if php file given on command line when web server started treated "router" script. script run @ start of each http request. if script returns false, requested resource returned as-is. from documentation php built-in webserver in other words, return false in router script built-in webserver can serve static files . example documentation: if (preg_match('/\.(?:png|jpg|jpeg|gif)$/', $_server["request_uri"])) { return false; // serve requested resource as-is. } else { echo "<p>welcome</p>"; } the thing i'm trying add behavior web framework: don't want write index.php . i'd rather encapsulate logic class (middleware) halt script's execution if php_sapi_name() == 'cli-server' , static asset asked. however, don't know how can make whole php script return false class o

c# - Events: How to keep eye on List Object properties -

i have list activeacountlist of object ( activeaccount ). list<activeaccount> activeacountlist = new list<activeaccount>(); the object/activeaccount props/info key, name, account, amount, source , more properties. i don't own object, been owned 3rd party , using event given them, fires when ever changes or added list. below event method fires every time when added or updated , using same event populating activeacountlist private void getaccountlist(activeaccount activeaccountdata) { if(!activeacountlist.contains(activeaccountdata.key)) { activeacountlist.add(activeaccountdata); } else { activeacountlist[activeaccountdata.key] = activeaccountdata; } } now question is, there way can attach event fires every time when 'amount' changes? or if can keep eye on property , when ever changes event fires? keep in mind dont own object can not thing activeaccount class. this solution should work. please check

android - Shared preferences and explicit intents? -

hi can answer, so came across question (it assignment, submitted anyways). regarding shared preferences , explicit intents. know both can pass data (through putstring, putextra, putint etc , getextra, getstring, getint). method better pass data , why? can in terms of functionality or how lesser codes when comparing each method each other. if want pass data when transitioning 1 activity activity, it's better use intents pass data. however if want data passing still retrievable after user exit app , reopen it, should use sharedpreferences . intent better use when passing data when going 1 activity another. otherwise, should use sharedpreferences instead. , mentioned above, if want data stored , retrievable when user reopens app, should go storage option sharedpreferences.

grammar - How to write a CFG with functions? -

in assignment, asked write cfg functions like: def f(x, y): return x + y def g(x, y): return x – y def h(x, y, z): return x + y % z def w(x, y, z): return x * y – z and def h1(x, y, z): return (x + y) % z def h2(x, y, z): return x + y % z i have tried work normal cfg but, not function definitions , function bodies. not pretty sure how start kind of cfg's. this bad question - cannot encode rule "only parameters used in function body" in cfg. ignoring little problem, however, can try: s := def f (l): return e f := cn c := f | g | h | w n := (empty string) | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 l := x | xy x := x | y | z y := , l e := x | e + e | e - e | e / e | e % e | e * e | (e) s provides overall structure of function. f defines how function names made. l defines how list of variables made. e defines how expression involving variables , operators made. note allow stuff def f(x): return y , can't prevent in cfg.

git - How to reproduce tor build using gitian? -

please refer me steps reproduce tor build using gitian. have been trying build tor browser bundle using steps mentioned @ following link- https://trac.torproject.org/projects/tor/wiki/doc/torbrowser/buildingwithgitian but keep getting errors, , did not receive reply help@rt.torproject.org ~/tor-browser-build/gitian-builder/inputs ~/tor-browser-build/gitian-builder/inputs object ebcbfd6cdc29372909079d0345185733d47d90d4 type commit tag tor-browser-38.2.0esr-5.0-1-build2 tagger mike perry 1439157725 -0700 5.0-build2. gpg: signature made sun 09 aug 2015 06:02:10 pm edt using rsa key id d2f1e186 gpg: signature "mike perry " gpg: aka "mike perry (regular use key) " gpg: aka "mike perry (regular use key) " gpg: aka "mike perry " gpg: note: key has expired! primary key fingerprint: c963 c21d 6356 4e2b 10bb 335b 2984 6b3c 6836 86cc subkey fingerprint: cc69 3f6c d7aa 6b8e ec40

MySQL - Search in date records -

i trying make sql situation bellow , have no success. not sure how search solution in google. table "account manager log" date user_id 2014-10-14 19:12:29 51 2014-11-03 14:46:21 39 2015-08-19 11:20:15 2 2015-09-24 09:21:41 15 so, in 14-oct-2014, account manager user #51. in 03-nov-2014, account transfered 51 39. i need make sql return me account mananger in given datetime. example: account manager on 05-jan-2015 14:00? answer user_id = 2. could 1 point me in right direction please? thank you easy solution select records date less 1 want, sort them in descending order, , limit 1 record :) select * "account manager log" date <= '03/19/2014' order date desc limit 1

c++ - how can i call my two functions intro my main function? -

so first function multiply input pi , make inside cos, , second function multiply same input pi , make inside sin. in int main, created loop, in order store value user , cal 2 function rest, gives me error , don't know why here code: #include <iostream> #include<iomanip> #include <cmath> using namespace std; double xpicos(double x) {//const double pi = 3.14159265; double xpicos = cos(x*pi); return xpicos; } double xpisin(double x) {const double pi = 3.14159265; double xpisin = sin(x*pi); return xpisin; } int mian () { const double pi = 3.14159265; double x=0; double y = 0; const int capacity = 200; double corners[capacity]; cout << "enter" ; (int = 0; < 200; i++) {cin >> corners[i]; double x = xpicos(corners[i]); double y =xpisin(corners[i]); } cout << x << "," << y ; return 0; } there's lot of errors , mistakes in code

r - collapse a list of unevaluated expressions to single expression -

having following list of unevaluated expressions. l = list(quote(f()),quote(g()),quote(h())) str(l) #list of 3 # $ : language f() # $ : language g() # $ : language h() i collapse list using & function following r result. r = quote(f() & g() & h()) str(r) # language f() & g() & h() of course point handle list of length. you can use reduce this: reduce(function(a,b) bquote(.(a) & .(b)), l)

android studio - Task 'build' not found in root project 'workspace'. Some candidates are: 'build' -

Image
i unable build project using gradle 2.10, have tried different versions issue same. i using jenkins 2.10 version. same project can build android studio. can 1 me jenkins configuration, have defined sdk path, have gradle plugin etc. [error] [org.gradle.buildexceptionreporter] failure: build failed exception. [error] [org.gradle.buildexceptionreporter] * went wrong: [error] [org.gradle.buildexceptionreporter] task 'built' not found in root project 'workspace'. candidates are: 'build'. * try: [error] [org.gradle.buildexceptionreporter] run gradle tasks list of available tasks. 20:11:26.063 [error] [org.gradle.buildexceptionreporter] * exception is: 20:11:26.063 [error] [org.gradle.buildexceptionreporter] org.gradle.execution.taskselectionexception: task 'built' not found in root project 'workspace'. candidates are: 'build'. i have added attached step in build, need add steps building ? there's no built task, try b

Splitting a list with certain parameters in Python. Using re.findall -

import re def processfile(filename='names.txt', encode='utf-8'): listofplayers = [] listofinfo = [] count = 0 open(filename, 'r', encoding = encode) f: line in f.readlines(): if count == 0: listofinfo.append(line.strip()) count += 1 elif count == 1: listofinfo.append(line.strip()) listofplayers.append(listofinfo) count -= 1 listofinfo = [] return listofplayers def splitstats(listofplayers): newlist = [] item in (i[1] in listofplayers): m = re.findall('[a-z][a-z]*', item) newlist.append(m) print(newlist) def main(): lop = processfile() splitstats(lop) if __name__ == '__main__': main() i'm trying @ stats soccer , took stats webpage , trying split each player there position, country, transferred from, transferred to, , money payed them. my names

javascript - How to make console run script in the background? -

i want block pop-up stuff, removing specific css file. i use following code $("link:eq(4).[rel=stylesheet]").attr("href", '-'); and works, if update page or click on internal links pop again , have manually type code in console again. is there way automate process? you can set scripts page greasemonkey. https://addons.mozilla.org/es/firefox/addon/greasemonkey/

asp.net - Opinion: Visual Basic as a programming language for web applications -

the language seems have features of programming language: easy of learning easy of understanding supported platform environments portability object-oriented programming paradigm it possible integrate tools ms offfice package. it developed rad (rapid application development). cons: the code seems not clear , may cause headache when maintaining application. the question is: guys think of vb programming language web applications , points of language highlight when comes security? what love using vb programming language lack of curly brackets. love how visual studio auto indents vb better c#. allows more mistakes junior programmer. but c# syntax , formatting closer other languages makes easier switch between , learn other languages. i started vb , moved toward c# , still have issues while coding in c# since vb pascal case writing public vs public , if vs if. nice thing vb if type if vs automatically change if why can't same c# ?

asp.net mvc - How to call controller method from ActionLink of MVC in Umbraco 7? -

i working on umbraco 7 application. there 1 controller in , trying call method view. when call method actionlink says method not found. when verified url says, wrong. following code snippets: folling mvc line: @html.actionlink("send otp", "index", "registersurface", new { id = "lnksendotp" }) following mvc controller method public actionresult index() { return view(); } i getting following error on screen, not understand url formation well enter image description here it looks you're using wrong overload of actionlink method: public static mvchtmlstring actionlink(this htmlhelper htmlhelper, string linktext, string actionname, object routevalues, object htmlattributes) {...} you want use 1 instead: public static mvchtmlstring actionlink(this htmlhelper htmlhelper, string linktext, string actionname, string controllername, object routevalues, object htmlattributes) {...} try passing addi

ios - Fix the aspect ratio of the first row in UITableView -

Image
i'm creating screen, imagine facebook profile screen.. tableview , first cell image. goal image maintains aspect ratio, different screen sizes don't have worry sizing it.. i can't work view, if set specific constraints, cell won't set correct height.. i have little project showing constraints, in link.. my vc code: class viewcontroller: uitableviewcontroller{ override func viewdidload() { super.viewdidload() self.tableview.datasource = self self.tableview.delegate = self self.tableview.estimatedrowheight = 100 self.tableview.rowheight = uitableviewautomaticdimension self.tableview.reloaddata() } override func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell { let cell = tableview.dequeuereusablecellwithidentifier("cell", forindexpath: indexpath) return cell } override func tableview(tableview: uitableview, num

c++ - /usr/bin/ld: cannot find -lGL (Ubuntu 14.04) -

i'm trying build project created in qt creator , unfortunately every time try compile error. here compiler output: 23:02:20: running steps project wallpaperappqt... 23:02:20: configuration unchanged, skipping qmake step. 23:02:20: starting: "/usr/bin/make" g++ -m64 -o wallpaperappqt main.o mainwindow.o moc_mainwindow.o -l/usr/x11r6/lib64 -lqt5widgets -l/usr/lib/x86_64-linux-gnu -lqt5gui -lqt5core -lgl -lpthread /usr/bin/ld: cannot find -lgl collect2: error: ld returned 1 exit status make: *** [wallpaperappqt] error 1 23:02:20: process "/usr/bin/make" exited code 2. error while building/deploying project wallpaperappqt (kit: desktop) when executing step 'make' 23:02:20: elapsed time: 00:00. you need package provides libgl.so (no version suffix) symlink. in ubuntu, it's in libgl1-mesa-dev package. do: sudo apt install libgl1-mesa-dev

visual studio - Azure Blob Storage only shows one file at a time -

Image
i have following method uploads file blob storage: public static string uploadtoblob(string filepath, string container) { if (!file.exists(filepath)) return string.empty; var filecontent = file.readallbytes(filepath); var filename = path.getfilename(filepath); var blobpath = $"/{guid.newguid()}/{filename}"; var azstorage = new azureblobstorage(configurationhelper.getconnectionasstring("storageconnectionstring")); return azstorage.upload(container, blobpath, filecontent, filename); } which execute inside foreach loop so: fileprocessor.uploadtoblob(filepathlocal, storageblobcontainers.arcoextractionpdfs); when navigate insider server explorer, can see blob: but when enter it, there's 1 file showing: however, if delete file , hit refresh, 1 shows up, , repeating can see of them, 1 one.. how can see files in blob @ once?

java - Bug reading a Csv File from an http request (WebService) -

i'm having bug when trying read csv file http request. my csv file looks this: iduser,status 123,block 456,unblock 789,block and i'm receiving this: iduser,status123,block456,unblock789,block somehow when send through http request disappear char of end of line ('\n'). i've tried many readers, such opencsv , javacsv. , received file in many ways, inputstream, string, file. seems bug in requester, i've tried different requesters, postman in chrome, , open httprequester in firefox. , generate file in different environments windows , linux. i've tried send in windows linux , viceversa. ways worked converting base64 , parsing csv file inside service, don't want cliente convert file time. other way reading directly repository, won't webservice. i'm using javacsv read file right https://www.csvreader.com/java_csv_samples.php . my webservice: @put @path("/csvreader") @consumes(mediatype.multipart_form_data) @produces(mediaty

reactjs - Redirecting with react router -

i have following route config: const route = { path: 'services', getcomponent(nextstate, callback) { require.ensure([], (require) => { callback(null, require('./components/services').default) }) }, //getindexroute(partialnextstate, callback) { // require.ensure([], (require) => { // callback(null, {component: require('./components/consulting').default}) // }) //}, childroutes: [ { path: 'consulting', getcomponent(nextstate, callback) { require.ensure([], (require) => { callback(null, require('./components/consulting').default) }) } } ], indexredirect: { //from: 'services', to: 'consulting' } } export default route but when go /services receive error: typeerror: element null when used getindexroute

Learning c++ -- reading numbers from a file -

quick synopsis: can write data file correctly (i've checked .txt file , presents should) can read last number inputted. so, if last quiz grade input 85, that's read back. (the studentnumber reads fine.) all! still learning here ... while (answer == 1) { cout << "what student id?\n"; cin >> studentnumber; cout << "\n"; cout << "how many quizzes did take?\n"; cin >> numquiz; outputfile << "\n"; outputfile << studentnumber << "\n"; outputfile << "number of quizzes: " << numquiz << "\t" "grades: "; (int quiz = 1; quiz <= numquiz; quiz++) { cout << "please enter score quiz " << quiz << "\t"; cin >> score; total += score; // cout << "the score " << score << " .\n"; outputfile << s

node.js - Making sequential mongoose queries in a for loop inside a mocha test -

i trying use mocha test driver api application. i have json of user names song names, trying feed api endpoint. json: { "description": "hold lists each user heard before", "userids":{ "a": ["m2","m6"], "b": ["m4","m9"], "c": ["m8","m7"], "d": ["m2","m6","m7"], "e": ["m11"] } } let's user , song schema _id name. want after parsing json file, convert "a" user_id, doing mongoose lookup of "a" name, let's id=0. convert each of "m2" song_id name let's id=1, , call request, http://localhost:3001/listen/0/1 here have far mocha test: test.js: it('adds songs users listen to', function(done){ var parsedlistenjson = require('../listen.json')["userids"]; //console.log(parsedlistenjson); (var user

javascript - added js code doesn't work in iframe -

i have iframe containing div tag "firstheadsection" id. after iframe loaded, append code iframe: <script> $(window).on("resize", function(){ alert($("#firstheadsection").height()) }) </script> the js code inserted after resize window, alerts null. jquery included in iframe. what should do? you have access main page, have prepend "parent". try this: (not tested) parent.$.fn.resize(function() { alert($("#firstheadsection").height()); });

mapreduce - Number of reducers in hadoop -

i learning hadoop, found number of reducers confusing : 1) number of reducers same number of partitions. 2) number of reducers 0.95 or 1.75 multiplied (no. of nodes) * (no. of maximum containers per node). 3) number of reducers set mapred.reduce.tasks . 4) number of reducers closest to: multiple of block size * task time between 5 , 15 minutes * creates fewest files possible. i confused, explicitly set number of reducers or done mapreduce program itself? how number of reducers calculated? please tell me how calculate number of reducers. 1 - number of reducers number of partitions - false . single reducer might work on 1 or more partitions. chosen partition done on reducer started. 2 - theoretical number of maximum reducers can configure hadoop cluster. dependent on kind of data processing (decides how heavy lifting reducers burdened with). 3 - mapred-site.xml configuration suggestion yarn. internally resourcemanager has own algorithm running, optimizing th

matlab - error with cyclic autocorrelation function -

Image
i'm trying code cyclic autocorrelation function in matlab follows: t=0:(n-1); t=t*te; i_alpha=0; tau=-n2*te:te:n2*te; alpha=-1/2:1/n:1/2; ryy_cl=zeros(length(alpha),length(tau)); alpha=alpha/te ind_tau=0; i_alpha=i_alpha+1; k=tau ind_tau=ind_tau+1; if k>0 % ryy_cl(i_alpha,ind_tau)=1/length(sig_bin_syl_mod(1:end- k))*sum((sig_bin_syl_mod(1:end-k)).*sig_bin_syl_mod(k+1:end)).*exp(1i*2*pi*alpha*t(1+k:length(sig_bin_syl_mod(1:end)))); ryy_cl(i_alpha,ind_tau)=(1/n)*sum((sig_bin_syl_mod(1:end-k)).*sig_bin_syl_mod(k+1:end)).*exp(-1i*2*pi*alpha*t(1:end-k)); else ryy_cl(i_alpha,ind_tau)=(1/n)*sum((sig_bin_syl_mod(1-k:end)).*sig_bin_syl_mod(1:end+k)).*exp(-1i*2*pi*alpha*t(1-k:end)); end end end i'm getting errors, , doesn't show expecting. according below formulae, how can fix it? the code provided incomplete, difficult confidently reproduce error. in particular, haven't de

windows - Using Batch Script to open and close chrome however timeout only starts if I close chrome -

i'm trying write program open chrome, wait short period of time close chrome, , repeat. @ first working , began start timeout if closed chrome manually. i've tried these 2 codes each had same problem. code 1 cd c:\program files (x86)\google\chrome\application\ :loop chrome.exe https://www.website.com -incognito timeout /t 200 taskkill /f /im chrome.exe /t > nul goto loop code 2 cd c:\program files (x86)\google\chrome\application\ :loop chrome.exe https://www.website.com -incognito timeout /nobreak /t 200>nul taskkill /f /im chrome.exe /t > nul goto loop my knowledge windows batch limited, , pieced lot of internet searches, problem simple , i'm not experienced enough see it. thank time! not sure why, chrome.exe runs synchronously unless there chrome.exe process running. first time ran, had chrome running, why code worked asynchronously expected. when taskkill chrome processes, becomes synchronous,

c# - WebClient.DownloadString(url) won't work for urls that are in uni-code characters such as persian -

i trying html content url has persian characters in such as: http://example.com/%d8%b7%d8%b1%d8%a7%d8%ad%db%8c-%d9%88%d8%a8-%d8%b3%d8%a7%db%8c%d8%aa-%d8%a2%d8%aa%d9%84%db%8c%d9%87/website/atelier i using code: using (webclient client = new webclient()) { client.encoding = encoding.utf8; string data = client.downloadstring(urltextwithpersiancharacters); } when url this, unreadable characters , symbols. code fine other websites have english urls , persian content. edit: both answers worked find testing other websites. problem 1 specific website trying content. can website block these kinds of requests?or use other encodings maybe? what suggest me do? try convert url string uri: uri uri = new uri("http://example.com/%d8%b7%d8%b1%d8%a7%d8%ad%db%8c-%d9%88%d8%a8-%d8%b3%d8%a7%db%8c%d8%aa-%d8%a2%d8%aa%d9%84%db%8c%d9%87/website/atelier"); using (webclient client = new webclient()) { client.encoding = encoding.utf8; string data = c

java - Jboss - handshake failure - client connection using TLSv1.1 instead of TLSv1.2 -

i have jboss version version 6.3.0.ga , using java version 1.7.0_71 collegues on remote server changes allowed tls protocol 1.1 1.2, , have update client (deployed in jboss). problem after change receive: faultstring: javax.net.ssl.sslhandshakeexception: received fatal alert: handshake_failure in ssl debug see: 5:22:43,921 info [stdout] (http-/0.0.0.0:8080-1) *** clienthello, tlsv1 15:22:43,923 info [stdout] (http-/0.0.0.0:8080-1) randomcookie: gmt: 1467638563 bytes = { 250, 245, 94, 108, 232, 16, 43, 124, 53, 95, 38, 104, 249, 96, 71, 207, 230, 7, 84, 183, 41, 224, 63, 213, 186, 7, 179, 255 } 15:22:43,923 info [stdout] (http-/0.0.0.0:8080-1) session id: {} 15:22:43,923 info [stdout] (http-/0.0.0.0:8080-1) cipher suites: [tls_ecdhe_ecdsa_with_aes_128_cbc_sha, tls_ecdhe_rsa_with_aes_128_cbc_sha, tls_rsa_with_aes_128_cbc_sha, tls_ecdh_ecdsa_with_aes_128_cbc_sha, tls_ecdh_rsa_with_aes_128_cbc_sha, tls_dhe_rsa_with_aes_128_cbc_sha, tls_dhe_dss_with_aes_128_cbc_sha, tls_ecdh

ImageButton touch feedback -

how can implement touch feedback imagebuttons? want image button change image when button touched. searched, after trying things didn't worked i'm bit desperate. selector right thing problem , how work? my current try create new .xml file in drawable folder. there put selector, current code .xml file: <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"android:exitfadeduration="@android:integer/config_mediumanimtime"> <item android:state_pressed="true" android:drawable="@drawable/testbuttonimageselected" /> <item android:drawable="@drawable/testbuttonimage" /> </selector> and current code .java file: btntest = (imagebutton) findviewbyid(r.id.btntest); btntest.setonclicklistener(new view.onclicklistener() { public void onclick(view button) { //set button's appearance button.setse

multithreading - Consuming a web service in multiple threads c# -

i consuming web service provided me vendor in c# application. application calls web method in loop , slows down performance. complete set of results, takes more hour. can apply multi threading on side consume web service in multiple threads , combine results together? is there better approach retrieve data in minutes instead of hours? first of have make sure vendor does indeed support this or not prohibit (which probable too). the code straightforward, using method such parallel.for simple example (google.com): parallel.for(0, norequests, => { //code request goes here } ); exaplanation: in parallel.for loop, requests executed in-parallel (as implied in name), potentially provide significant increase in performance. further reading: msdn on parallel.for loops

arrays - Insert Multiple records in codeigniter using checkboxes -

i have 2 input arrays 1 checkbox , and 1 textbox which view file <div class="form-group"> <label class="col-lg-2 control-label">fee types</label> <div class="col-lg-8"> <div class="checkbox"> <?php foreach($types $key=>$value){?> <label> <input type="checkbox" value="<?php echo $value['id'] ?>" name="type_id[]" /> <span class="text"><?php echo $value['name'] ?></span> </label> <input type="text" class="form-control" name="amount[]" /> <?php } ?> </div> </div> </div> which controller $data=array( 'id'=>$this->input->post('id'), 'amount'