Posts

Showing posts from June, 2014

bash - No rule to make target Makefile error in shell script? -

i new shell script. tried run makefile using shell script. giving me error vedant@z510:~/workspace$ sh test.sh make: makefile: no such file or directory make: *** no rule make target 'makefile'. stop. my makefile src=src #obj=obj flags= -g3 -msse3 -g source= $(src)/main.c \ $(src)/sgp_conv.c\ $(src)/sgp_math.c\ $(src)/magneticfield.c\ $(src)/sgp4.c\ $(src)/dynamics2.c\ $(src)/preisach2.c \ $(src)/atmospheric_torque.c\ $(src)/initialize.c \ $(src)/ptangle.c\ $(src)/effectmagnet.c\ $(src)/print.c\ $(src)/solarradiation_torque.c object = $(source:.c=.o) sim: $(object) gcc -wall -o demo $(flags) $(object) -lm $(object) : %.o : %.c makefile gcc $(flags) -c $< -o $@ clean: rm $(src)/*.o and shell script trying execute alias proj="cd /home/vedant/version/version14.9_latest" make -b please can tell me wrong?

deployment - Capifony config to run bower installs and grunt commands -

so, it's first project, deploying capifony . seems fine, can't run grunt , bower commands on vps. this trying in deploy.rb file: after "deploy" run "cd #{current_path}; npm install -g grunt-cli" run "cd #{current_path}; npm install grunt --save-dev" run "cd #{current_path}; npm install" run "cd #{current_path}; bower install --allow-root" run "cd #{current_path}; grunt" end and lot of errors, looks that: http://pho.to/94cii/t4 how should in right way? my bad, went fine. red log messages, , err statement let me thought, failed attempt. but anyway, solution appropriate?

c++ - Why is my function "missing argument lists"? -

i'm not sure i've done wrong in project. have 2 files, airports.h header file , main source file. in main source file have string code,name; int deptax, conntime; cin >> code >> name >> deptax >> conntime; airport myairport(code,name,deptax,conntime); cout << myairport.getcode << endl; and in airports.h header file have class airport{ public: airport(string code, string name, int departuretax, int connectiontime) :code(code), name(name), departuretax(departuretax), connectiontime(connectiontime) {...} string getcode(){ return code; }//then getname, getdeptax, getconntime... } when run main source file, error "error c3867: 'airport::getcode': function call missing argument list; use '&airport::getcode' create pointer member" in line 5 there. i'm beginner i'm not sure why it's telling me this. shouldn't .getcode() work how it'

flask - Logging application use in python? -

i'd log every time uses flask app. i'd ideally have log looks this timestamp 923829832 929299292 999993939 with list of unix time stamps represent each time user had accessed application. what's way this? you use flask's after_request decorator. for example: import datetime import time @app.after_request def log(): open("app.log", "a") log: date = datetime.datetime.now() log.write(time.mktime(dt.timetuple())) this open log file after each request, , log timestamp end of it.

string - Parse full name for UK users in c++ considering multiple scenarios -

i working third party api, receives forename, middlename, , surname parameters. have fullname of user. cannot change structure because part of large scale system cannot changed. the structure of parameters of third party api cannot change, despite not best solution have parse fullname , split 3 fields. the names uk, good. doing now: vector<string> fields; mylibrary::split(' ', name, fields); string firstname = fields[0]; string middlename = fields.size() == 3 ? fields[1] : ""; string surname = fields.size() == 3 ? fields[2] : fields[1]; but pretty sure bad solution, since there multiple scenarios, example when name contains text mr. @ beginning, or jr. @ end. is there code block can give me better guarantees code? thanks! [update] the name requested in form user "account holder's name", , information related bank account information, user won't put nickname. added example of jr. or sr. 1 possible scenario found, there might

java - Scrolling header with two list views -

i have header section scroll list view below. problem have toggle below header section allows user switch between 2 list views. best way have header section scroll in sync 2 list views below? i can share short overview you: <scrollview ..> <linearlayout> <headerview></headerview> <togglebutton></togglebutton> <listview></listview> <listview></listview> </linearlayout> </scrollview> the tricky thing is: have flip visibility of 2 listview visible , gone in toggle button. 1st click on toggle make it listview1.setvisibility(view.gone) listview2.setvisibility(view.visible) 2nd click on toggle make it listview2.setvisibility(view.gone) listview1.setvisibility(view.visible)

html - <a> link only functions if you click exact text. How do I make the entire <a> tag clickable? -

my website has modal-style popup window appears when user clicks link: <li><a href="#contact"><label for="lightbox-demo">contact</label></a></li> the problem link opens popup if click directly on "contact" text. if click within <a> tag, miss text, won't anything. how make if click anywhere in <a> tag, popup opens? the popup code (if needed) is: <aside class="lightbox"> <input type="checkbox" class="state" id="lightbox-demo" /> <article class="content"> <a href="#" class="closest"><img src="img/x.png" class="btn_close" title="close window" alt="close contact window" /></a> <form method="post" action="submit.php" id="contactform" class="signin"> <input name="name" id="

Simple Scala JSON library for non-recursive case classes -

i have case classes contain strings or collections of strings , want convert them json objects corresponding field names plus additional field denote type. sealed trait item case class productx(a: string, b: string) extends item case class producty(a: string, b: string) extends item case class collx(els: list[string]) extends item case class colly(els: list[string]) extends item most libs have special support case classes there never seems way use in conjunction additional type field disambiguate isomorphic cases, , i'd have fall more low-level descriptions. so far i've tried spray-json , argonaut , wind way more boilerplate simple usage scenario justify: // spray-json implicit object collxjsonformat extends rootjsonformat[collx] { def write(ss: collx) = jsobject( "type" -> jsstring("collx"), "els" -> jsarray(ss.els.map(jsstring(_)): _*) ) def read(value: jsvalue) = { value.asjsobject.getfields("type"

bash - Trouble logging in user using su and expect script -

i working on making website class log username , password, , takes page shows grades in class. the website being run bash script , , hosted on machine users have username , password login. i have script called calcgrade.sh calculate grades either user logged in, or user passed script argument. so originally, going use command: echo -e "$password\n" | sudo -sk -u $user ./website/calcgrade.sh to run calcgrade.sh user of website. however, found out sudo asks password of user currently logged in, not target user trying run command as. so after reading, found better option use su expect script, can't work. here code expect script (currently username , password hard coded in testing): #!/usr/bin/expect log_user 0 spawn /bin/su myusername expect "password: " send "mypassword" spawn "./website/calcgrade.sh" interact when run script, doesn't seem log in user su , goes on run calcgrade.sh account, rather user's.

xpages - 'Admin' user getting redirected to $$LoginUserForm -

Image
i have user, admin mustermann/magerman, defined editor person in acl of application , has role [admin]. after logging in can see that user has role [admin]. but whenever try access admin.xsp page, getting redirected $$loginuserform of database. the admin.xsp page controlled following acl access: <xp:this.acl> <xp:acl> <xp:this.entries> <xp:aclentry type="default" right="noaccess"> </xp:aclentry> <xp:aclentry type="role" right="editor" name="[admin]" fullname="admin"> </xp:aclentry> </xp:this.entries> </xp:acl> </xp:this.acl> i've tried following syntax: <xp:aclentry type="role" right="editor"> <

c++ - opening a .exe (c program) from c# -

i want open executable c/c++ program c# includes giving inputs. have used process.start() supports command line arguments there way pass arguments cin or scanf function?? you need set process.redirectstandardinput , can write information process.standardinput stream. see example @ msdn: https://msdn.microsoft.com/en-us/library/system.diagnostics.processstartinfo.redirectstandardinput%28v=vs.110%29.aspx

serial port - Python Program keeps crashing -

i'm trying create simple ui control whether can print data serial port , using pyqt, created simple ui 2 buttons- start recording button , stop recording button. when press start recording button, data gets printed out, moment press stop recording button, system hangs , while loop keeps running. think might because program trying out of while loop, isn't able to. i'd appreciate help. main code: import gui_main import sys import numpy pyqt4 import qtcore, qtgui import pyqt4.qwt5 qwt import matplotlib import serial import threading global readervar def reader(): readervar= true ser = serial.serial(7) #insert com port number data being collected ser.baudrate = 9600 #insert baud rate while true: if readervar: line= ser.readline() print (line) print(readervar) else if uiplot.btn2.clicked(): break readervar=false def shutter(): readervar=false def main(): global

javascript - Ckfinder rename image before upload -

i'm using ckfinder ckeditor in asp.net mvc 5 project. want rename images before upload, such image.name = datetime.now + guid.newguid() . how this? uploaded files delivered controller actions either httppostfiledbase somename , or member of request.files , app code responsible looping through these uploads, picking file name them, , saving them. can clarify having difficulty?

How to unbind the php built-in server from a directory? -

i created local wordpress site , in xampp set virtual hosts address test-wp.dev home adress. working fine , reason decided turn off apache, leave mysql on , try build in server. so navigated c:/xampp/htdocs/test/wordpress/ , ran php -s localhost:8080 it worked fine. however, today went go test-wp.dev using apache server , keeps redirecting localhost:8080 . don't want use built in server now. want apache. where "unbind this" or free port or whatever. don't want have run built in server folder anymore. thanks. windows 7 php 5.6

php - What would the Laravel 5 directory structure look like for serving multiple sites and APIs? -

say have multiple "sites" (ie. backend, public frontend, private-pay-for frontend, mobile) , perhaps offer api widget services or android app. sites need (at least initially) share same laravel instance , sharing services (ie. frontend site might call few services backend site, or backend site , api might share services, since i'm using soc things presentation logic). looking @ userscape's project snappy, taylor otwell says renamed models folder called snappy , added more folders various "areas of responsibility". in laravel 4 however. here's laravel 5 directory default directory structure: app <-- should rename , duplicate backend, frontend, api...? commands console events exceptions handlers http controllers <-- or add subfolders in controllers backend, frontend, api...? middleware requests providers services <-- , add subfolders in services backend, frontend, api...? bootstrap

node.js - Socket.IO Connection Not working on University Wifi -

i have created chat app using socket.io . works fine on home internet. whenever @ university , connected versity wifi internet, can't connected @ all. facing 'net::err_connection_timed_out' error. here url: demo.codesamplez.com/ultrachat/demo.html (you may ok, on home) i guess, might kind of firewall issue or something? does has clue how go forward solving this? in advance. switching http https should around problem incompatible proxy server. forces proxy use http tunneling maintain connection instead performing whatever magic does.

refactoring - Is there more idiomatic ruby to perform this iteration? -

i iterating through set of ids , want return first object returns true when predicate method called on it. few lines of code worth thousand words: def applicable_question(question_ids) ordered_ids(question_ids, order).detect |question_id| question = question.find_by(id: question_id) return question if question.applicable_for?(self) end end stripping away domain terms: def desired_thing(ids) ids.detect |id| thing = thing.new(id) return thing if thing.true? end end is there more idiomatic approach here? specifically, feel abusing detect . reached each , break , didn't far approach. a requirement code not need instantiate large array of objects (activerecord subtypes example) find desired thing. you have: desired_thing = ids.detect |id| thing = thing.new(id) return thing if thing.true? end if thing found thing.true? true , detect never returns element of ids (to assigned desired_thing ) because it's preempted return . on

SQL Server : AND OR statement -

i wrote procedure pull records error table. it should pull value when error column not null or empty declare @statementkey int select distinct error.errormessage, row.rownumber, statement.statementkey, statement.statementname statement join row row on row.fk_statementkey = statement.pk_statementkey join errortable error on row.rownumber = error.rownumber statement.statementkey = @statementkey , (error.errormessage not null or error.errormessage <> '') i did still pulls rows empty errormessage column but when and (error.errormessage not null) , (error.errormessage <> '') then not pull empty value null can tell me easier way , maybe tell me why? thanks guys. the last , statement in first query incorrect. should replace this: and not(error.errormessage null or error.errormessage = '')

jpa - Why the list of a object returned from hibernate is empty? -

well, i'm here again. in project work, have faced problem, sametimes solve way it. in manytomany relationship, don't know make it. when use find method of entitymanager , it's returned object, , if object has list of other objects, list come empty when saved object filled list. the classes: public class equipecategoria { @id @generatedvalue(strategy= generationtype.identity) private integer id; private esexo sexo; private ecategoria categoria; @manytoone(cascade = cascadetype.all) @cascade(org.hibernate.annotations.cascadetype.delete_orphan) private equipe equipe; @onetoone(cascade = cascadetype.all) @cascade(org.hibernate.annotations.cascadetype.delete_orphan) private equipejogo equipejogo; @manytomany(cascade = cascadetype.all) @cascade(org.hibernate.annotations.cascadetype.delete_orphan) private list<dirigente> dirigentes; @onetomany(cascade = cascadetype.all) @cascade(org.hibernate.annotation

python - Calling a superclass function for a class with multiple superclass -

i have class extends 2 classes, 1 of them including threading.thread. how call start method of threading.thread subclass? class poller(threading.thread, <some other class>): """ poller code """ def start(): return super(poller,self).start() i want start thread class' start function. not going work right? if want sure call thread's start can do: def start(self): threading.thread.start(self) note avoid other base class's start method , may not want

c# - Return 2 lists from one model to a view in MVC -

i new mvc, , struggling viewmodels. return 2 lists same model 1 view. need 2 foreach loops show records of different "status" on 1 view. because both lists coming 1 model, necessary create viewmodel? i have tried following, view not finding item type each list. public class pipelineviewmodel { public int leadid { get; set; } public string firstname { get; set; } public string lastname { get; set; } public string status{ get; set; } public string loanagent{ get; set; } public list<weblead> pipenewleads { get; set; } public list<weblead> pipedispleads { get; set; } } note list domain model table pulling lists from. correct? next in controller: public actionresult index(string loanagent) { var viewmodel = new pipelineviewmodel { pipenewleads = db.webleads .where(l => l.loanagent.equals(loanagent) && l.status.equals("new")).tolist(), pipedis

c# - Mapping foreign keys of subclasses -

Image
i have following abstract class: public abstract class clausecomponent { public int clausecomponentid { get; set; } public abstract string[] determinate(climatechart chart); public abstract list<clausecomponent> givecorrectpath(climatechart chart); public abstract string gethtmlcode(boolean isyes); public virtual void add(boolean soort, clausecomponent component) { throw new applicationexception(); } public clausecomponent() { } } the clause class inherits abstract class: public class clause : clausecomponent { public virtual clausecomponent yesclause { get; set; } public virtual clausecomponent noclause { get; set; } public string name { get; private set; } public virtual parameter par1 { get; set; } public virtual parameter par2 { get; set; } public int waarde { get; set; } public string operator { get; se

javascript - JQuery is(":focus") -

it seems reason, cannot perform: $(".exampleclass")[0].is(":focus"); it tells me - typeerror: undefined not function. trying grab few elements jquery, scan through them, , find 1 focused (so can focus next element in array programmatically). var fields = $(".textfield"); var selected = false; for(var j = 0; j < fields.length; j++){ var field = fields[j]; console.log(field); if(selected){ field.focus(); }else if(field.is(':focus') && !selected ){ selected = true; } } it works fine until field.is(':focus') why won't work? when index jquery object [ ] operator, extract underlying component of list of matched elements. component dom node, , won't have .is() method. if coded like $(".exampleclass").eq(0).is(":focus"); you

osx - R cmd check not locating texi2pdf on mac after R 3.1.3 upgrade -

does have link clear instructions on how install , configure necessary latex packages build r packages on mac? i have scripts building , checking r packages on mac server. seemed work fine, after upgrading r 3.1.3, many of packages started failing with error in texi2dvi(file = file, pdf = true, clean = clean, quiet = quiet, : running 'texi2dvi' on 'networkvignette.tex' failed. messages: sh: /usr/local/bin/texi2dvi: no such file or directory calls: <anonymous> -> texi2pdf -> texi2dvi execution halted i found thread seemed suggest need more recent version texinfo (5.2) installed default. , apparently i've i've got wrong version installed in wrong location? which texi2pdf /sw/bin/texi2pdf texi2pdf --version texi2pdf (gnu texinfo 5.1) 5234 (same version reported when running system('texi2pdf --version') in r ) this thread gives link texinfo 5.2 source collection: http://r.789695.n4.nabble.com/r-cmd-build-looking-for-texi

node.js - Profile pictures in web app - best practice of implementing -

i want implement profile pictures (avatars) simple , safe possible, i'm using express + passport + mongoose + socket.io , latest versions. have no experience such functionality, , after few hours of intense googling, still have no solid idea start , how make cosy , simple, yet safe. the question how 1 implement user's usage of avatars in web app, via file uploads, or via gravatar, need advise on start express + passport + mongoose, seems option. first need persist data somewhere, that's mongodb useful. mongoose odm can create models perform crud (create, read, update, delete) operations. then need server comunicates client , database. express node.js framework makes easy set session, routes, etc. the users gotta authenticate before avatar send, passport library helps , can set express. socket.io, node module creates persistent connection client can comunicate in "real-time". don't think project unless you're planning avatar image

ruby on rails - String constant for use in en.yml file -

in locales/en.yml, have following: en: activerecord: attributes: ticket: customer_name: "customer name" inventory: quantity: 'quantity' resources: quantity: 'quantity' hours: quantity: 'quantity' is there way me define string 'quantity' string constant can re-use constant in en.yml? example: default: &default adapter: mysql2 encoding: utf8 username: username password: yourdbpassword development: <<: *default test: <<: *default also see answer: reuse block of code in yaml

actionscript 2 - Walls VCAM flash AS2 -

so have 2 squares. 1 blue, instance name "mouse", , has code: onclipevent (enterframe) { this._x = _root._xmouse; this._y = _root._ymouse; } the other red, instance name "mouseface", , has code: onclipevent (enterframe) { _x += (_root.mouse._x - _x) / 3; } and have vcam code: onclipevent (enterframe) { _x += (_root.mouseface._x - _x) / 40; } the idea blue square stays on top of mouse, , red follows blue, slower, , vcam follows red. vcam , red square moving on x axis. code redundant , bad; works i'm going continue using it. anyway, im wondering how make vcam stop @ 2 x coordinates, 5 nights @ freddys. any appreciated, thanks! :)

perl - Internal Error In templates -

my tt2 ( template toolkit 2) causes error due absence of plugin, possible cause ? the error reads error 500 - internal server error plugin error - yaml: plugin not found powered dancer2 0.159001 is there way of making message little clear? i hope clear server, running perl dancer, missing module required web application tun. agree far clear messages module missing. it not, might expect, either yaml or dancer2::session::yaml template toolkit plugin module template::plugin::yaml . install on server , should go.

MYSQL WHERE clause in php -

i have php file display artists have in table, , working fine. trying display particalar artists specific condition, example displaying artists city baltimore. not @ php , help. <?php $page_title = 'browse prints'; include ('includes/browse_style.html'); require ('../mydesigner/mysqli_connect.php'); // default query page: $q = "select artists.artist_id, concat_ws(' ', artist_name) artist, print_name, price, description, print_id artists, prints artists.artist_id = prints.artist_id order artists.artist_name asc, prints.print_name asc"; // looking @ particular artist? if (isset($_get['aid']) && filter_var($_get['aid'], filter_validate_int, array('min_range' => 1)) ) { // overwrite query: $q = "select artists.artist_id, concat_ws(' ', artist_name, artist_city, artist_type, artist_mobile) artist, print_name, price, description, print_id artists, p

How to fix 301 permalink redirect for funky structure -

i'm trying figure out how redirect permalink structure of old wordpress news portals, using funky structures needed google news , old search engines, crap. for example, have: mynewssite.xcom/2015/03/19/fnw14770_161419.php where i'd rather have: mynewssite.xcom/pretty-nameo-of-the-article-fnw14770/ i okay instead: mynewssite.xcom/pretty-name-of-the-article-fnw14770_161419.php my current wordpress permalink structure is: /%year%/%monthnum%/%day%/fnw%post_id%_%hour%%minute%%second%.php i need 301 redirect /%postname%/ or /%postname%-%post_id%/ , or in worst case senario, this: %postname%-fnw%post_id%_%hour%%minute%%second%.php i don't know how write rewrite expressions. have now, it's not working: redirectmatch 301 ^/([0-9]{4})/([0-9]{2})/([0-9]{2})/fnw(\d+)_%hour%%minute%%second%.php$ http://floridanewswire.com/?p=$4 %hour%%minute%%second% won't work in .htaccess, meta information known wordpress. instead, try replacing rule matc

stream - In IBM Connections can you retrieve another users activity feed? -

in ibm connections 4.0 there way users activity stream. can steam @me if try connections id or users id following error: this works: /opensocial/basic/rest/activitystreams/@me/@following/@all?rollup=true this returns error - id: /opensocial/basic/rest/activitystreams/7af0b251-9f97-ca6d-8525-61370072a674/@following/@all?rollup=true error 400: user id(s) [7af0b251-9f97-ca6d-8525-61370072a674] is/are not recognized system. and know id.... <userid>7af0b251-9f97-ca6d-8525-61370072a674</userid> any suggestions...the manual says following doesn't sound doesn't totally close door either: as per opensocial standard, given users activity stream retrievable by: 1. specifying user (@me in urls below, ibm connections not generally allow retrieval of other users streams). any appreciated.... this should it: https://connections.ibm.com/common/opensocial/basic/rest/activitystreams/urn:lsid:lconn.ibm.com:profiles.person:91ae7240-8f0a-1028-8400-d

Dynamically adjust y-min/max after range-selector in Dygraph -

when range selector used shrink/expand viewing x-range, y axis remains unchanged. there way update these values based on current min/max? i know there way update settings, problem don't know how capture current min/max on range selector. have set function gets called on draw() callback thing i'm missing how calculate current range min/max values. it sounds want call yaxisrange method: yaxisrange(idx) returns currently-visible y-range axis. can affected zooming, panning or call updateoptions. axis indices zero-based. if called no arguments, returns range of first axis. returns two-element array: [bottom, top].

bash - Exclude a directory or file from git commit --verbose -

i know possible ignore directory or file git diff using git diff !(example) , shown here . is possible when using git commit -v ? as long on index appear on commit -v message. you can either add them .gitignore (but don't think want), or manually remove unwanted comments each commit.

Excel VBA - Loop to filter table for each value in column and paste in according worksheet -

i trying filter table on first worksheet ("data") each of items appear in table on second worksheet ("hosts"), , paste filtered results in separate worksheets, each named after corresponding item on table. my understanding of vba basic , have tried put collage of codes other users, doesn't seem work me: the first loop creates worksheets based on items on "hosts" table, reason adds sheet before ones need , calls "sheet1" the second loop doesn't work are 2 loops necessary, or possible combine two? this code have far: sub test() dim alldata worksheet dim hostlist worksheet dim datarange range dim filtercolumn long set alldata = thisworkbook.worksheets("data") set hostlist = thisworkbook.worksheets("hosts") set datarange = alldata.range(range("a1"), range("a1").specialcells(xllastcell)) dim hostvalues range each hostvalues in hostlist.listobjects("table1").range thiswor

php - Making array after explode -

i want create array input string. before code, i've tried explode, array remains length 1. each string i've tried still 1 in array[0]. here's code far: public function word() { $kata = array($this->kal->gethasil()); if (!empty($kata)) { $n = count($kata) ($i = 0; $i < $n; $i++) { $imin = $i; ($j = $i; $j < $n; $j++) { if ($kata[$j] < $kata[$imin]) { $imin = $j; } } $temp = $kata[$i]; $kata[$i] = $kata[$imin]; $kata[$imin] = $temp; } ($i = 0; $i < $n; $i++) { echo "$kata[$i] "; } } } public function tokenize() { $temp = $this->kal->gethasil(); $token = explode(" ", $temp); return $token; } $hasil = $pp->tokenize(); ($i = 0; $i < sizeof($hasil); $i++) { $st = new stemming(); $hasil[$i] = $pp->singkatan($hasil

Is there any way to make this Python function run for more intervals? -

i extremely new python , wrote simple code. in end made feet wet , head wrapped around coding. python first language, started learning couple days ago. and yes, aware roundabout choice coding method, it's first thing ever produced myself more couple lines long. so, in end, there way make function question run more times without running issue variables being returned? unsure whether issue or tired see reason right now. know need create more if statements results section. obvious. name = raw_input("please enter preferred name: ") print "welcome, %r, general stupidity quiz." % name raw_input("\n\tplease press button continue") question1 = "\n\nwhat equivilent of 2pi in mathmatics? " answer1 = "tao" answer1_5 = "tao" question2 = "\nwhat 2 + 2? " answer2 = "4" w = 0 def question(question, answerq, answere, inputs): user_answer = raw_input(question) if user_answer in [str(answerq), str(answe

ionic framework - Data not updating in AngularJS -

i working on web app in ionic. here, have button in menu.html, when clicked should cause function in controllers.js add newdata "data" in appapi.js file getting error. can take look? here's code in menu.html , controllers.html: http://pastebin.com/gw0h2g3p , here appapi.js: http://pastebin.com/jbqqubcp thanks! in appapi service var adddata = function(newdata) { data[data.length] = newdata; } return { getdata: getdata }; adddata private. it's not exposed. in controller: trying access adddata not available. $scope.add = function() { appapi.adddata($scope.newdata); } to fix it: add adddata return object in service var adddata = function(newdata) { data[data.length] = newdata; } return { getdata: getdata, adddata : adddata };

arraylist - How to implement recursive all possible combination of any set (JAVA) -

can give me few clues or writing combination function output possible combination of set. have idea. find hard. something in java. string set[] = {"java","c++","python"}; arraylist<string> list = new arraylist<string>(); public void combination(string[] set) { if (set.length == 0) { nothing } else if (this combination set) { add list } } here's simple example of combinations of letters in string, give algorithm. see if can transfer algorithm example. public class stringlib { public static void combine(string str){ int length=str.length(); stringbuffer output=new stringbuffer(); combination(str,length,output,0); } static void combination(string str, int length, stringbuffer output, int level){ /* show arms-length recursion style better peformance */ if (level==length) return; else{ for(int i=level;i&l

java - Could not locate OpenAL library -

i writing game using slick2d library, uses lwjgl. lwjgl version 2.9.3. using netbeans 8. i tried adding sounds game, example music track on main menu. problem is, exception when run game, despite game still compiling , running except sound of course: sat mar 21 01:23:57 edt 2015 error:could not locate openal library. org.lwjgl.lwjglexception: not locate openal library. @ org.lwjgl.openal.al.create(al.java:156) @ org.lwjgl.openal.al.create(al.java:156) @ org.lwjgl.openal.al.create(al.java:102) @ org.lwjgl.openal.al.create(al.java:206) @ org.newdawn.slick.openal.soundstore$1.run(soundstore.java:295) @ java.security.accesscontroller.doprivileged(native method) @ org.newdawn.slick.openal.soundstore.init(soundstore.java:292) @ org.newdawn.slick.music.<init>(music.java:156) @ org.newdawn.slick.music.<init>(music.java:75) @ view.mainmenu.init(mainmenu.java:58) i didn't include rest of error states error happens in game code. the

node.js - Weird Browser behaviour in ExpressJS application , On closing and reopening tab HTML code is displayed , on reloading works well -

Image
my expressjs application showing weird behaviour , doing every time repeat following steps. open link in browser. go other tab , close tab website link opened. open tab , open exact same link of website. it shows content of image, no matter how long wait. reload , works well. same behaviour in chrome, firefox , safari. i have tried disabling etag , disabling cache doesnt seem help. idea? 1 more update : might because of apache , local env not , deployed 1 . there seemed problem redirect , removed redirect , rendered page expected . work around , reason of problem persists , if else gets struck @ similar problem , might 1 solution .

How to remove a checkout without any view reference in clearcase? -

i have file in lost+found checkedout not see viewreference. how can remove file? i'm checking in windows system. when version tree, see view created in unix system. i'm not able uuid of same. how can delete such file? for checked out state, should able view uuid in same way in previous question " how delete check-outs particular view in clearcase? ". that lost+found folder part of vob , cleartool describe -b vob:\avob should list uuid of unix view. but if not sure uuid matches actual name of old view see in version tree, can check name directly in registry server. there different option: cleartool rgy_check -views but also, since have access registry server, can simple grep of name in var/rgy folder view_tag is: <user>@<server> /path/to/clearcase/var/rgy $ grep -i <view_name> view_* view_object:-entry=view_object;-hostname=server;-local_path=path/to/<view_name>.vws;-owner=<name>;-view_uuid=e670fe8a.fb0540e

c# - Global class variable for ASP.NET -

i building asp.net application has 2 projects. 1 class library having bl code. want create public class instance variable 1 of classes in bl. class instance variable avoid loading data on each request makes application respond slow each request. how make global class variable load data @ page_load, , keep until user redirects page. create in viewstate , wrap in property easy of use. along lines of: public myclass myobj { { if (viewstate["myobj"] == null){ viewstate["myobj"] = new myclass(); } return viewstate["myobj"]; } set { viewstate["myobj"] = value; } }

Need a query to get a single value from comma seperated value in database using mysql -

i have these in database 1 2 3 ------------------- 1,2 2,3,4 1,2,3 select 1 table_name you can use find_in_set this: select * tablename find_in_set("value","columnname") > 0

windows - java 'jar' is not recognized as an internal or external command -

i'm getting following error when try run 'jar' command in command line on windows : 'jar' not recognized internal or external command the general solution seems need add jdk bin folder path in environment variables. have done this, added following path variable : ...; c:\program files\java\jdk1.8.0_40\bin\; though i'm not sure if having jdk reside in 'program files' instead of 'program files x86' affects this. i'm on 64 bit windows 64 bit java. thanks the path should contain directories os executables. strip trailing "\jar.exe" set path as: (old path variables here);c:\program files (x86)\java\jdk1.7\bin thanks : @stevevls

camera - Android - How to get list of available aperatures -

new android. trying understand how list of available apertures. code below not work expected. please explain how can extract list property? using camera 2 api. apertures = cameracharacteristics.lens_info_available_apertures; use aperatures = cameramanager.getcameracharacteristics("camerayouwant").get(cameracharacteristics.lens_info_available_apertures);

ruby - Rails, Devise remove registration of specific model -

i have 2 models admin , partner . both of them created devise. want remove registration admin wrote in routes: devise_for :admins, skip: :registrations however when try run page admins login page appears. throws me error: undefined method `new_admin_registration_path' #<actiondispatch::routing::routesproxy:0x0000000d4d9650> i know before there registration link removed registration path admins , tries create link registration path. there this tutorial of how remove registration forms, want have registration partners while admins not have. question how remove registration links admins while keeping in partners ?? you generate devise views admins: rails generate devise:views admins this create set of views in views/admins, including partial named "_links.erb.html". can remove unneeded link one, , should not impact partners views.

python - ImportError: No module named sklearn.preprocessing -

i installed scikit-learn on ubuntu following these instructions . however, error when run program uses it: traceback (most recent call last): file "begueradj.py", line 10, in <module> sklearn.preprocessing import normalize importerror: no module named sklearn.preprocessing how fix this? the instructions given in tutorial linked obsolete ubuntu 14.04. the ubuntu 14.04 package named python-sklearn (formerly python-scikits-learn ): sudo apt-get install python-sklearn the python-sklearn package in default repositories in ubuntu 14.04 in other supported ubuntu releases.

c++ - Why are we allowed to take the address of an incomplete type? -

consider code: class addressable; class class1 { void foo(addressable &a) { (void) &a; } }; // ok class addressable { void *operator &() { return this; } }; class class2 { void foo(addressable &a) { (void) &a; } }; // error: operator & private why c++ allow taking address of incomplete reference type? couldn't potentially illegal, shown above? intentional? yes, that's intentional, , possibility of breakage if operator& overloaded known. taking address of incomplete types has been possible since long before c++. in c, there absolutely no risk of breakage, because & cannot overloaded. c++ chose not unnecessarily break valid programs, , specified if incomplete type turn out have overloaded & operator, it's unspecified whether overloaded operator gets used. quoting n4140: 5.3.1 unary operators [expr.unary.op] if & applied lvalue of incomplete class type , complete type declares operator&() ,

How to copy string to system clipboard with php which runs as client side? -

i want copy string system clipboard php(which running client script) on mac osx. why want function? i'm writing php script runs client script on mac osx. it's used upload text website , download text local mac osx, , want copy these text mac's system clipboard. so, there way copy string system clipboard php on mac osx? php doesn't provide system clipboard api, can use php's proc_fopen call shell command pbcopy on mac os x retrieve function: echo copy2clipboard('string'); function copy2clipboard($string){ $descriptorspec = array( 0 => array("pipe", "r"), // stdin pipe child read 1 => array("pipe", "w"), // stdout pipe child write 2 => array("file", "a.txt", "a") // stderr file write ); $process = proc_open('pbcopy', $descriptorspec, $pipes); if (is_resource($process)) { fwrite($pipes[0], $string);

urlfetch - DownloadError in App Engine when requesting specific urls -

i'm getting strange downloaderror while trying request specific url using urlfetch.fetch here example code: url = 'https://iiko.net:9900/api/0/auth/access_token' try: result = urlfetch.fetch(url, deadline=50, validate_certificate=false) if result.status_code == 200: pass except downloaderror er: logging.exception(er) and here error: unable fetch url: https://iiko.net:9900/api/0/auth/access_token traceback (most recent call last): file "/base/data/home/apps/s~iappintheair/phil-dev.383038517236330514/handlers/api/test.py", line 18, in result = urlfetch.fetch(url, deadline=50, validate_certificate=false) file "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/api/urlfetch.py", line 271, in fetch return rpc.get_result() file "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/api/apiproxy_stub_map.py", line 613, in get_result return self.__get_result

java - How can I pass query string from one jsp page to another jsp page without showing the name-value pair at address bar? -

i want send query string 1 jsp page jsp page want hide name-value pairs(attributes) @ address bar when send query string. first.jsp <%@ page language="java" contenttype="text/html; charset=iso-8859-1" pageencoding="iso-8859-1"%> <!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <title>first page</title> </head> <body> <a href="second.jsp?username=aditya123&password=abc12345">click here</a> </body> </html> second.jsp <%@ page language="java" contenttype="text/html; charset=iso-8859-1" pageencoding="iso-8859-1"%> <!doctype html public "-//w3c//dtd html 4.01 transitional//en" "htt

c++ - opencv imshow show only the image -

i've switched ubuntu windows opencv project , while displaying image using imshow function image displayed other details x axis , y axis information , intensity values not shown in window. the same code under ubuntu build works perfectly. here code: #include <iostream> #include "opencv2/highgui/highgui.hpp" #include "opencv2/imgproc/imgproc.hpp" using namespace cv; int main() { cv::mat imgrgb = imread("c:\\users\\len\\documents\\project\\images\\1-11.jpg", cv_load_image_color); // check image read 3 channels image , not empty cv_assert(imgrgb.channels() == 3); if (imgrgb.empty()) { cout << "image empty. specify correct path" << endl; return -1; } cv::cvtcolor(imgrgb, img, cv_bgr2gray); namedwindow("test", cv::window_autosize); imshow("test", imgrgb); waitkey(0); } so, how can display intensity values along current x , y axis information?

javascript - Jquery on php in div box not working -

i have main php load php div box via dropdown list. loaded php contains table. there jquery in alert on row clicked. $(document).ready(function() { $('#newstable tr').click(function(){ var clickedid = $(this).children('td:first').text(); alert(clickedid); }); }); but after loaded div, script not firing use event delegation attach event. event delegation allows attach single event listener, parent element, fire descendants matching selector, whether descendants exist or added in future. $(document).ready(function() { $(document).on('click','#newstable tr',function(){ var clickedid = $(this).children('td:first').text(); alert(clickedid); }); }); // end

javascript - Why isn't this jquery effect working? -

i working through course on codecademy , once finished , ran code.. worked fine, take code codecademy , set copy/paste own jquery folder reference/practice. the goal project krypton bounce 3 times in 500ms, , script.js works in codecademy not when set locally.. know why? index.html: <html> <head> <title></title> <link rel="stylesheet" type="text/main" href="main.css"> </head> <body> <div></div> <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.1/jquery-ui.min.js"></script> <script src="script.js"></script> </body> </html> main.css: body { background-image: url('http://bit.ly/upqgj6'); } div { height: 100px; width: 100px; border-radius: 100%; background-color: #008800; background-image: -webkit-gradient(linear, 100% 0%, 0% 100%, from(#003500), to(#008800)); background-image:

ios - locationmanager does not have a member named verbosedictionary -

my working code giving error when upgraded xcode 6.2 "error: locationmanager not have member named verbosedictionary" this line in throwing error: verbosemessage = verbosemessagedictionary[verbosekey]! ------------------ reference code in locationmanager.swift internal func locationmanager(manager: cllocationmanager!, didchangeauthorizationstatus status: clauthorizationstatus) { var hasauthorised = false var verbosekey = status switch status { case clauthorizationstatus.restricted: locationstatus = "restricted access" case clauthorizationstatus.denied: locationstatus = "denied access" case clauthorizationstatus.notdetermined: locationstatus = "not determined" default: locationstatus = "allowed access" hasauthorised = true }

object - Java - Create instance of a class with String as name -

i want create instances of class, like: country ger = new country(); country usa = new country(); ... and on. because want huge number of objects, i'd rather want create instances instance names text file country tags listed , iterate through list. familiar java reflection concept, not want create single class each object want cut declarations short. is there way that? thanks in advance add namevariable country , initialize via constructor. or use map.

java - Extract only the text from entity-encoded HTML inside an XML element -

i'm working on xml parsing android application have problem. page i'm going parse has element <description> in there appears entity-encoded html not wanted. structure: <description>&lt;img src="http://images.website.it/thumbs/images/2014/12/16/asd_crop_upscale_q85.jpg" alt="post img " style="float:left;margin-right:10px"/&gt; lorem ipsum...</description> what want lorem ipsum... part , none of encoded html inside tag <description> . doinbackground part of asynctask @override protected void doinbackground(void... args) { element e = null; xmlparser parser = new xmlparser(); string xml = parser.getxmlfromurl(url); // getting xml document doc = parser.getdomelement(xml); // getting dom element nodelist nl = doc.getelementsbytagname(key_item); // looping through item nodes <item> (int = 0; < nl.getlength(); i++) {

JQuery and PHP for dynamically created elements -

can pls me? i'm working on dynamic website. have 2 navigations points , have video window on right side. clicking on 1 navigation point respective video should appear in video window. problem is: navigation list created dynamically , video appearance (in case urls videos embedded youtube). here php code list of navigation points created dynamically: function reborn_videos($attribute){ ob_start(); $urls = $attribute['filme']; $urls = explode(',', $urls); ?> <div id="mobil_content"> <?php for($i=1; $i<= count($urls); $i++) { $movie_title = $attribute['title'.$i]; ?> <div class="box"> <div class="box_title_video"><a class="expand"><?php echo $movie_title; ?> </a></div> <?php foreach ($urls $url) { ?> <div class="box_body_iframe">