Posts

Showing posts from June, 2015

ruby - not able to run rails server its giving issue Could not find minitest-5.6.1 in any of the sources (Bundler::GemNotFound) -

hi not able run rails server giving issue could not find minitest-5.6.1 in of sources (bundler::gemnotfound) , when bundle install not show error gemfile given: gem 'rails', '4.2.1' # use sqlite3 database active record gem 'mysql2' # use scss stylesheets gem 'sass-rails', '~> 5.0' # use uglifier compressor javascript assets gem 'uglifier', '>= 1.3.0' # use coffeescript .coffee assets , views gem 'coffee-rails', '~> 4.1.0' # see https://github.com/rails/execjs#readme more supported runtimes # gem 'therubyracer', platforms: :ruby # use jquery javascript library gem 'jquery-rails' # turbolinks makes following links in web application faster. read more: https://github.com/rails/turbolinks gem 'turbolinks' # build json apis ease. read more: https://github.com/rails/jbuilder gem 'jbuilder', '~> 2.0' # bundle exec rake doc:rails generates api under doc/api. gem &

ruby on rails - Metasploit-Framework Cannot Load Such File Payload Modules Raspberry Pi 2 ARM -

Image
really stuck on over one, don't have problem, installed metasploit on raspberry pi 2 apt-get having issues. can't download 32 or 64 bit bin installer files, because it's arm processor. error has ruby strange thing loads modules fine except select ones in payload folder. i've included description of error , steps took below far. appreciated because 1 had me scratching head few days now. after installing metasploit via apt-get install metasploit after doing: service postgresql start service metasploit start msfconsole here error after databases build: [*] starting metasploit framework console...[-] warning! following modules not loaded! -[-] /usr/share/metasploit-framework/modules/payloads/stages/windows/x64/meterpreter.rb: loaderror cannot load such file -- metasploit-payloads [-] /usr/share/metasploit-framework/modules/payloads/stages/windows/meterpreter.rb: loaderror cannot load such file -- metasploit-payloads |[-] /usr/share/metasploit-frame

How to redirect example.mydomain.com to folder.mydomain.com via DNS/.htaccess? -

is somehow possible redirect example.mydomain.com , subdomain not exist, folder.mydomain.com using either .htaccess or dns ? how can achieved? when access dns control panel , click on web dns tab, see personal web dns settings , under believe can submit domains , values. however, confused type (web alias, web forward, a, cname, txt, srv, aaaa...). me? if .htaccess way simpler, prefer it. thank you. you wouldn't able use .htaccess subdomain not exist. i assume, process described, using one.com hosting. if so, following guide of help: manage dns settings essentially, web forward dns entry work you: click on web dns tab. in hostname/domain column, enter subdomain redirect. set type web forward set value redirected when visiting subdomain. click (+) sign save changes. it take 90 minutes changes take effect.

reflection newinstance constructor java wrong number of arguments -

i learning reflection in java, , trying make example of constructor. there problem: "wrong number of arguments". searching through google , stackoverflow, cannot find same problem facing. can please me understand problem, thank much. codes: public static void main(string[] args) { printclass f = new printclass(); class cl = f.getclass(); constructor<?> constructor[] = cl.getdeclaredconstructors(); // cl.getdeclaredconstructors() won't work... f.field1 = 3; printclass p1 = null; printclass p2 = null; try { p1 = (printclass) constructor[0].newinstance(); // constructor[0].newinstance((object[])args) won't work... p2 = (printclass) constructor[1].newinstance("this not printclass-------"); p1.print(); p2.print(); } catch (instantiationexception | illegalaccessexception | illegalargumentexception | invocationtargetexception e) { // todo auto-generated catch bl

hadoop - Hive wont run in Hortonworks 2.2.4 -

i've downloaded hortonworks sandbox 2.2.4, , noticed when follow hortonwork's tutorial on hive , this, hcatclienterroroncreatetable: { "statement": "use default; create table nyse_stocks(`exchange` string, `stock_symbol` string, `date` string, `stock_price_open` float, `stock_price_high` float, `stock_price_low` float, `stock_price_close` float, `stock_volume` bigint, `stock_price_adj_close` float) row format delimited fields terminated '\\t';", "error": "unable create table: nyse_stocks", "exec": { "stdout": "", "stderr": " 15/05/05 09:57:50 warn conf.hiveconf: hiveconf of name hive.heapsize not exist 15/05/05 09:57:50 warn conf.hiveconf: hiveconf of name hive.server2.enable.impersonation not exist slf4j: class path contains multiple slf4j bindings. slf4j: found binding in [jar:file:/usr/hdp/2.2.4.2-2/hadoop/lib/slf4j-lo

java - How to pass params into a Factory for object creation? -

i have recipienttypesfactory going create objects of type recipienttype . recipienttype s object have followin hierarchy: public interface recipienttype{ public abstract object accept(recipienttypevisitor v); } public class dynamicgrouptype implemetns recipienttype{ private integer dynamicgroupid; public object accept(recipienttypevisitor visitor){ return visitor.visit(this); } //get, set } public class staticgrouptype implements recipienttype{ private integer staticgroupid; public object accept(recipienttypevisitor visitor){ return visitor.visit(this); } //get, set } recipienttypesfactory looks follows: public enum recipienttypeenum { static_group, dynamic_group } public class recipienttypesfactory{ private map<recipienttypeenum, recipienttypecreator> creators; public recipienttype createrecipienttype(recipienttypeenum t){ return creators.get(t).create(); } } i'm not going provi

hadoop - Data node demon not running on CDH 4.2.1 pseudo distributed mode -

i running hadoop-2.0.0-cdh4.2.1 on centos in pseudo deistributed mode. when issued command sudo jps don't see datanode demon , running. below error log got in log file http://localhost:50070/logs/hadoop-hdfs-datanode-localhost.localdomain.log in namenode: **2015-05-12 04:35:26,319 info org.apache.hadoop.hdfs.server.datanode.datanode: block pool bp-539882958-127.0.0.1-1386722652683 (storage id ds-1842390259-127.0.0.1-50010-1431419699539) service /0.0.0.0:8020 beginning handshake nn 2015-05-12 04:35:28,573 fatal org.apache.hadoop.hdfs.server.datanode.datanode: initialization failed block pool block pool bp-539882958-127.0.0.1-1386722652683 (storage id ds-1842390259-127.0.0.1-50010-1431419699539) service 0.0.0.0/0.0.0.0:8020 java.io.ioexception: failed on local exception: java.io.ioexception: connection reset peer; host details : local host is: "localhost.localdomain/127.0.0.1"; destination host is: "0.0.0.0":8020; @ org.apache.hadoop.net.netutils.wrapexc

A good image upload class using php mysql -

i have written class handle image uploads in php. image upload class? if see code given below, insert mysql query happens when move_uploaded_file() function uploads file server. otherwise exits error. there better practise other this.? need other situations or exceptions or methods.? <?php /** * image upload calss */ class images // define calss { public $_remane = false; //remane false public $_savetodb; public $_target_dir = "uploads"; function __construct()//constructor { # code... } public function displayimages($userids){ $qr = mysql_query("select id,img_name, img_order images usersid =".$userids." order img_order"); $resp = array(); while($row = mysql_fetch_array($qr)) { $resp[] = array("img_id" => $row['id

opengl - fragment shader if statment and loading array of mat4 into uniform -

i have problem if here, reasons uknown me, dosnt work. when delete if statment or malualy write shadowmap[0] 1 or 2 works fine, if set of white triangles , squares. here part of frag shader float shadow(float bias) { float visibility = 0; int index=1; if(gl_fragcoord.z<1.0){ index=0; } vec4 shadowcoord=depthpv*vpos; if ( texture(shadowmap[index], shadowcoord.xy).z < shadowcoord.z+bias){ visibility = -1; } return visibility; } other problem have loading array of mat4 uniform here code tried, dosnt work, use lwjgl 3 libery in java shadowpvs=gl20.glgetuniformlocation(pid, "shadowpvs"); bytebuffer shadowpvbuff=bufferutils.createbytebuffer(shadepv.length*16*4); for(int i=0;i<shadepv.length;i++){ for(int v=0;v<16;v++){ shadowpvbuff.putfloat(shadepv[i].val[v]); } } shadowpvbuff.flip(); gl20.gluniformmatr

node.js - Creating a customer in BrainTree with a credit card -

i'm reading docs creating customer. need create 1 credit card, cvc number error , don't know how must create it. i show code if(user.local.subscription == undefined){ //creamos cliente gateway.customer.create({ creditcard : { number : cardnumber, expirationdate : "12/15" } }, function (err, result) { if(err){ //return res.status(500).json({ error : "error creating customer"}); console.log(err); } console.log(result); /*user.subscription = result; userid = result.customer.id;*/ }); } var braintree = require("braintree"); var gateway = braintree.connect({ environment: braintree.environment.sandbox, merchantid: "your sanboxmerchant", publickey: "your sandbox public key

javascript - why 'setTimeout' in 'bsTransitionend'? -

i going through code of carasoul.js , came across following line of code :: settimeout(function () { that.$element.trigger(slidevent) }, 0) well simple above line of code doing , below line of code :: that.$element.trigger(slidevent) is executed @ interval of 0 , question , context of piece of code , if author wanted run function/execute line of code , have done without settimeout , in case , instead of :: settimeout(function () { that.$element.trigger(slidevent) }, 0) the author have written following lines of code :: that.$element.trigger(slidevent) so why set time out , context ?? below entire snippet of code , makes more sense :: $active .one('bstransitionend', function () { $next.removeclass([type, direction].join(' ')).addclass('active') $active.removeclass(['active', direction].join(' ')) that.sliding = false settimeout

Android ExpandableListview all child item in every group -

Image
i create expandablelistview in android . use custom adapter child item in every single group. result want : [ first ] [ second ] [ third ] - aaa - ddd - ggg - bbb - eee - hhh - ccc - fff - iii ('first', 'second', , 'third' expandable list group name / , other child item name) but list show : [ first ] [ second ] [ third ] - aaa - aaa - aaa - bbb - bbb - bbb - ccc - ccc - ccc - ddd - ddd - ddd - eee - eee - eee - fff - fff - fff - ggg - ggg - ggg - hhh - hhh - hhh - iii - iii - iii screenshot : (i changed group name) this code : //expandablelist private expandablelistview mpastmedallist; //listview adapter private arraylist<string> mgrouplist = new arraylist<>(); pri

F# computation expression for exception monad -

i'm implementing exception monad in f#. first took ml approach, works: module exceptionmonad = type exception_ = string type 'a t = raise of exception_ | return of 'a let return' t = return t let raise' e = raise e let (>>=) m k = match m | raise e -> raise e | return -> k module testexceptionmonad = open exceptionmonad let test_exception_monad = begin return' 1 >>= fun -> return' 0 >>= fun b -> if b = 0 raise' "divide zero" else return' (a / b) end (* => raise' "divide zero" *) now i'm trying use f# computation expression instead: type exception_ = string type 'a exception_monad = raise of exception_ | return of 'a type exceptionmonad() = member x.bind(m, k) = match m | raise e -> raise e | return -> k member x.return(t) = return t member x.zero() = return 0 m

performance - Estimating maximum users that an application can support -

i analyzing web application , want predict maximum users application can support. have below numbers out of load test execution 1. response time 2. throughput 3. cpu i have application use case sla response time - 4 secs cpu - 65% when execute load test of 10 concurrent users (without think time) particular use case average response time reaches 3.5 seconds , cpu touches 50%. next execute load test of 20 concurrent users , response time reaches 6 seconds , cpu 70% surpassing sla. the application server configuration 4 core 7 gb ram. going data suggests web application can support 10 user @ time? there formula or procedure can suggest maximum users application can support. tia "concurrent users" not meaningful measurement, unless model "think time" , couple of other things. think case of people reading books on kindle. average reader turn page every 60 seconds, sending little ping central server. if system can support 10,000 of pings per se

python - What is the best way to allow users to search for items -

i have search feature in application allows users search products. query select * products title '%search_term%' this quick , hacky way of implementing this. want improve , wondering how can this. three short examples being able search plurals. my title product might golden delicious apple if users searches apples . because of plural row not returned. when words one/two words my title product might lemon cupcakes if user searches cup cakes if user searches apples , lemons should return both rows in example 1 , 2 or should return nothing? considered best practice. fyi using python , peewee. can think of ideas how gets complicated fast. well, depending on database using, have couple options. sqlite has full-text search extension supports stemming (normalizes plural forms, etc). peewee has rich support sqlite fts: http://docs.peewee-orm.com/en/latest/peewee/playhouse.html#ftsmodel http://charlesleifer.com/blog/using-sqlite-full-text-s

SQL Server - Count the number of times the contents of a specified field repeat in a table -

Image
what's best way 'select' 'distinct' list of field table / view (with 'where' criteria) , alongside count number of times that field content repeats in table / view? in other words, have initial view looks bit this: i'd single sql query filter (select...where...) considering records [order complete] = false , [personal] = null... ...and create distinct list of names counts of number of times each name appears in previous table: *displaying [order complete] , [personal] fields redundant point , dropped simplify. i can steps individually above, struggling single query all... appreciated! thanks in advance, -tim this should following select dbo.tblperson.person, count(dbo.tblperson.person) count dbo.tblperson inner join dbo.tblnotifications on dbo.tblperson.personid = dbo.tblnotifications.addresseeid dbo.tblnotifications.complete = 'false' , dbo.tblnotifications.personal null group dbo.tblperson.person

xml - How to increment date and time in XSLT 2.0 -

i have following date scenario, in want increment in date, date format of following: 2015-05-03t00:00:00z . want increment in date of 1 day. if reaches 31 month should updated. saw existing question solution not working on scenario. xml: <?xml version="1.0" encoding="utf-8"?> <rootelement> <testdate>2015-05-03t00:00:00z</testdate> </rootelement> xslt: <?xml version="1.0" encoding="utf-8" ?> <xsl:transform xmlns:xsl="http://www.w3.org/1999/xsl/transform" version="2.0"> <xsl:template match="rootelement"> <transformdate> <xsl:value-of select="substring(testdate,1,10)" /> </transformdate> </xsl:template> </xsl:transform> result: <?xml version="1.0" encoding="utf-8"?> <transformdate>2015-05-03</transformdate> expectedresult: <?xml v

How to get values of Zend_registry from one controller to other controller in zend? -

i use following way zend_registry value 1 controller didn't success.should need initiate zend_registry in bootstrap.php or other file can use between 2 files or more. $registry = zend_registry::getinstance(); $registry->set('variablename', 'value'); or zend_registry::set('variablename', $value); , how value $registry = zend_registry::getinstance(); $registry->get('variablename'); or zend_registry::get('variablename'); to more 1 array $value = array("name" =>'pankaj',"post" =>'sendeveloper'); zend_registry::get('session')->variablename = $value; $value1 = array("name" =>'rahul',"post" =>'jndeveloper'); zend_registry::get('session')->variabletable = $value; $value3 = array("name" =>'vonod',"post" =>'techdeveloper');

What advantages are there to using Parse.com JS SDK over Parse.com REST API with AngularJS application? -

i using parse.com js sdk angularjs project. using parse promises , angularjs $q service bind parse data angularjs $scope object. wondering, though, there advantages using js sdk on rest api, except query syntax sugar , authentication management through currentuser method. i guess need ask this: do want make (thereby having total control of happens)? or want leverage other peoples code, , start building application on top of that? my experience is, when building apps angluarjs , parse js sdk, takes time understand how sdk working - when familiarize it, gains enormous how fast can develop application. as stating - sessionhandling, when user has been logged in , query-building-syntax (not forget relational queries) has been taking care of you. is, @ least imo, enough me choose sdk. last takeaway angularjs/parsesdk developer - use angular's $q-service promise handling, when working on client. way never end in missing digest cycle, calling $scope.$apply(). remem

Haskell local function Is not in scope -

the following function supposed return sum of polynomials in list having polynomial list of floats. (ie: 4x²+2x+1 [4,2,1] , 5x⁵+x+2 [5,0,0,0,1,2] ) psum :: [[float]] -> [float] psum (x1:x2:xs) = psum (binpsum (x1, x2)):xs psum x = x binpsum (x:xs) (y:ys) = x+y:binpsum (xs, ys) binpsum (x) (y:ys) = x+y:ys binpsum (x:xs) (y) = x+y:xs i'm getting not in scope: ‘binpsum’ it's first time work haskell i'd guess there's wrong in way use binpsum (x1, x2) since can't find wrong in clause. thanks! the where clause provides bindings equation directly above (or left) of it. can fix moving up, under first of equation of psum used. other that, there various additional misunderstandings i'm seeing in code: when function defined f x y , must called (not f (x, y) ). if want pattern match against single item in list, must enclose item in square brackets indicate indeed item want bind, , not list itself. if argu

calling hive -e from a python script -

i run simple hive command within python script. trying use hive -e, getting error def hive(): cmd = "hive -e \"msck repair table dashboard_report\"" print(cmd) check_call(cmd) this error getting hive -e "msck repair table dashboard_report" traceback (most recent call last): file "/home/yosi/work/source/slg/tiger/src/main/resources/python/tiger.py", line 59, in <module> hive() file "/home/yosi/work/source/slg/tiger/src/main/resources/python/tiger.py", line 57, in hive check_call(cmd) file "/usr/lib/python2.7/subprocess.py", line 535, in check_call retcode = call(*popenargs, **kwargs) file "/usr/lib/python2.7/subprocess.py", line 522, in call return popen(*popenargs, **kwargs).wait() file "/usr/lib/python2.7/subprocess.py", line 710, in __init__ errread, errwrite) file "/usr/lib/python2.7/subprocess.py", line 1327, in _execute_child raise child_exception oserror: [errno

ios - ABAddressBook memory leak -

i trying interact abaddressbook, when analysing code in xcode have memory leak warnings cannot resolve. warnings "potential leak of object" , "potential leak of object stored 'allcontacts'" + (void)addnewcontact:(businesscard *)contact { abaddressbookref addressbookref = abaddressbookcreatewithoptions(null, nil); abrecordref newcontact = abpersoncreate(); if (contact.firstname) abrecordsetvalue(newcontact, kabpersonfirstnameproperty, (__bridge cfstringref)contact.firstname, nil); if (contact.familyname) abrecordsetvalue(newcontact, kabpersonlastnameproperty, (__bridge cfstringref)contact.familyname, nil); if (contact.company) abrecordsetvalue(newcontact, kabpersonorganizationproperty, (__bridge cfstringref)contact.company, nil); if (contact.jobtitle) abrecordsetvalue(newcontact, kabpersonjobtitleproperty, (__bridge cfstringref)contact.jobtitle, nil); if (contact.emailaddress) { abmutablemultivalueref multiemail = abmultivaluecreatemutable(kabmultis

r - Workaround for lazy evaluation with date variable -

i trying use lazyeval package , run problem. when use variable names (e.g. date, mean) exist functions in r in data.frame , lazy no longer works. had fall using substitute instead. there better workaround? functions # function has problems variables f_lazy <- function(data, variable){ variable <- lazyeval::lazy(variable) lazyeval::lazy_eval(variable, data) } # these functions work f_lazydots <- function(data, ...){ variable <- lazyeval::lazy_dots(...)[[1]] lazyeval::lazy_eval(variable, data) } f_substitute <- function(data, variable){ variable <- substitute(variable) eval(variable, data) } sample data data <- data.frame(x = 1, y = "a", date = sys.date(), mean = 1) examples f_lazy(data, x) ## [1] 1 f_lazy(data, y) ## [1] ## levels: f_lazy(data, date) ## function () ## .internal(date()) ## <bytecode: 0x000000000cee1980> ## <environment: namespace:base> f_lazy(data, mean) ## function (x, ...) ## usemethod(&q

xml - dynamically iterate xsl value -

i have following xsl code. <xsl:for-each select="value"> <xsl:if test="../@field_value=@value"> <input type="radio" id="{$fname}{position()}" name="{$fname}" value="{@value}" /><xsl:value-of select="@value"/><br/> </xsl:if> </xsl:for-each> what want show dynamic no of radio buttons values. there 3 values, loop running 3 times. printing 3 times last value. e.g. 3 values are: the code the alfa code the numeric code each time run code, 3 radio buttons text the numeric code shown. how can show 3 different values 3 radio buttons? you can provide condition radio button, , put each loop options of radio button xml: <fieldtype>radio</fieldtype> <name>code<name> <option>the code</option> <option>the alfa code</option> <option>the numeric c

Android Wear: How to install the application on mobile and Android Wear? -

in android studio have 2 folders mobile wear. so apk should install on smartphone, sync corresponding setup android wear? so apk should install on smartphone, sync corresponding setup android wear? that's true when apk exported , signed production certificate. when develop, have explicitly install apk, on both devices. need switch between wearable , handheld application on androidstudio, in drop down menu next run button, , choose device, in popup prompt attached devices

javascript - execute/trigger a script depending on #anchor in url? -

i have central page example.com/info/requirements contains requirements run different applications. default div shows requirements flagship application shown, , users can click buttons switch on/off different div. <a id="main-app"></a> <div id="req-container-main" class="invisible"> [requirements listed here] </div> <a id="app2"></a> <div id="req-container-app2" class="invisible"> [requirements listed here] </div> <a id="app2"></a> <div id="req-container-app3" class="invisible"> [requirements listed here] </div> <a id="app4"></a> <div id="req-container-app4" class="invisible"> [requirements listed here] </div> i have landing page each of apps. contain link requirements page including anchor, example.com/info/requirements#app3 now i'm looking w

php - Doctrine migrations table collation -

trying find way programatically create tables collation, can't seem find way how properly. using "doctrine/doctrine-migrations-bundle": "2.1.*@dev" , symfony 2.3, i set in config.yml: # doctrine configuration doctrine: dbal: driver: "%database_driver%" host: "%database_host%" port: "%database_port%" dbname: "%database_name%" user: "%database_user%" password: "%database_password%" charset: latin1 orm: auto_generate_proxy_classes: "%kernel.debug%" entity_managers: default: auto_mapping: true doctrine_migrations: dir_name: %kernel.root_dir%/../src/cf/escritoriobundle/migrations namespace: mynamespace\migrations table_name: migrations name: application migrations it creates database latin1 charset , latin1_swedish_ci default coll

android - How can I postpone a fragment to a fragment transition like the activity transition (postponeEnterTransition -

how postpone fragment's enter transition in android lollipop? i have troubles in fragment transition. (shared element transition , on.) want make fragment transition screen orientation done. after many trouble days, finally, found out below comments in above link don't understand it. if don't remove fragment1, hide instead, make life easier. if not, step necessary, works in same way. a) add 2, hide 2 b) show 2, hide, add stack 1 c) show 1, remove1, add stack. detect have arrived @ (c) second time, wait 1 ready , pop stack programmatically. i don't understand above scenario. please kindly explain step step.. hope answer. thanks in advance.

How to implement halo effect with Wpf 3D? -

Image
i'm trying build 3d earth wpf viewport3d. have created earth , works pretty good. want add halo effect around earth attached image: . some recommend use diffuse material globe model. build slight larger globe model emissive material , little opacity. effect not good. affects color of diffusion material this: how can implement effect first screenshot? i've done creating ring, inner radius same radius planet , outer radius relect atmospheric depth. oriented 'face me'. using texture coordinates lineargradientbrush have atmosphere fade sky blue transparent black. alternatively, there pngs around of semi-transparent cloud layers use on larger sphere.

How can get memory and CPU usage of hadoop yarn application? -

Image
i want ask, after i've ran hadoop mapreduce application, how can total memory , cpu usage of application. i've seen on log , resource manager web page didn't it. is possible? can per job execution or on per application, , can per node usage or total usage? thanks lot.... yes, can check total memory , cpu usage of application. you may use job tracker ui, click on counters link on completed page, , might typical view follows. memory , cpu counters highlighted. clicking on highlighted links show consumption every tasks (map/reduce) of job. to view these values of these consumption counters command line, may use hadoop job -counter <job-id> org.apache.hadoop.mapreduce.taskcounter cpu_milliseconds cpu usage hadoop job -counter <job-id> org.apache.hadoop.mapreduce.taskcounter physical_memory_bytes memory usage

email - How to implement table list like google inbox ios app? -

the google inbox app has feature when select cell table expand , insert sublist table view. sublist can has sublist. how implement feature tableview, collection view or custom view? there nice implementations like: http://jackkwok.github.io/jkexpandtableview/ https://github.com/oliverletterer/slexpandabletableview

angularjs - I can pass a scope variable into a directive's link function, but not the compile function, angular -

i'm using ng-repeat , need pass scope variable directive's compile function. know how link function, not compile function. my html looks like: <div ng-repeat="item in chapter.main"> <block type="item.type"></block> </div> let's item.type="blah" no matter item. link function works fine app.directive('block', function() { return { restrict: 'e', link: function(scope, element, attributes){ scope.$watch(attributes.type, function(value){ console.log(value); //will output "blah" correct }); } } }); but can't same compile? app.directive('block', function() { return { restrict: 'e', compile: function(element, attrs, scope) { scope.$watch(attrs.type, function(value){ console.log(value); }); } } }); the error "cannot read property $w

ios - Showing the same UIBarButtonItem on many views -

i have problem in ios application i'm looking with. i'm relatively new ios programming i'm sure there relatively simple solution problem. first, i'm going explain hierarchy of application: it uses uitabbarcontroller show couple of different screens. it uses swrevealviewcontroller show sidebar the sidebar accessed bar button item present in navigation bar of application. that application uses swrevealviewcontroller https://github.com/john-lluch/swrevealviewcontroller doesn't directly affect problem have. if not familiar code base, think of simple bar button shown @ times. now problem: the bar button want show associated few lines of code. (a property declaration , methods). this code should used on major part of different view controllers in application. now in normal case, i'd subclass uiviewcontroller , make superclass of views should show button. however, application should show other types of views, such uitableviewcontroller , su

Git fast-forward pulls but non-fast-forward merges? -

we want use no-ff merges feature branches when synchronizing local repository upstream one, not want merge commits. i.e., don't want see merge commits after pulls. when configure git way: git config merge.ff false then pulls create commits "merge origin/master master". how avoid it? edit : bit more explanation: when have local feature branches merged local master , has not been pushed yet, when pull want merge commit "merge origin/master master" because that's real merge. however, in case 5 minutes ago made push, done nothing , pulled 5 minutes later, not want "merge origin/master master" because it's empty, useless commit (no real merging done here). with merge.ff being false default in our project, there switch pull i've described above? or other workaround? the way avoid perform rebase instead of merge. assuming on master branch, can do: git fetch git rebase origin/master ... solve conflicts if , finis

hadoop - distcp - access execute permission error for HDFS file -

i performing distcp between 2 different clusters. doing selectively, goes in file-per-file basis. permissions in both clusters same. user executing distcp same (named xxx in example). encountering issue when copying, asking execution permissions... file! caused by: org.apache.hadoop.ipc.remoteexception(org.apache.hadoop.security.accesscontrolexception): permission denied: user=xxx, access=execute, inode="/mypath/myfile":xxx:xxx:-rw-r--r-- @ org.apache.hadoop.hdfs.server.namenode.fspermissionchecker.check(fspermissionchecker.java:205) @ org.apache.hadoop.hdfs.server.namenode.fspermissionchecker.checktraverse(fspermissionchecker.java:161) @ org.apache.hadoop.hdfs.server.namenode.fspermissionchecker.checkpermission(fspermissionchecker.java:128) @ org.apache.hadoop.hdfs.server.namenode.fsnamesystem.checkpermission(fsnamesystem.java:4684) @ org.apache.hadoop.hdfs.server.namenode.fsnamesystem.checktraverse(fsnamesystem.java:4660) @ org.apache.hadoop.hdfs.server.namenode.fsna

AngularJS $broadcast $on doesn't work at first time - intermittent issue -

Image
there strange behaviour in angularjs application. use case create user @ "usercreate.html" , after creating (over backend rest- service -> http post) redirect "usercreateresponse.html" made. i have 2 controllers: usercreate.html -> createusercontroller usercreateresponse.html -> createuserresponsecontroller and share data between createusercontroller , createuserresponsecontroller on $rootscope.$broadcast , $rootscope.$on . my problem is, when have changed in code (angularjs code) , refresh browser page , afterwards create user, user creation works fine , redirected usercreateresponse.html no values shown -> first time -> if navigate usercreate.html , create user once again works fine. i found out in case if not working, http made html- code end. in case works http post made works fine. does know how prevent first user creation -> redirect problem? here controller/services: function createusercontroller($scope, createuse

ios - Can I serialize negative integer by NSJSONSerialization? -

i can't serialize negative integer nsjsonserialization. objective-c : nsmutabledictionary *senddata = [nsmutabledictionary dictionarywithobjectsandkeys: @480, @"width", @800, @"height" @-10, @"value1", @10, @"value2", nil]; nserror *error = nil; nsdata *datajson = [nsjsonserialization datawithjsonobject:senddata options:0 error:&error]; nslog(@"senddata\n %@ \n\n", [senddata description]); log senddata{ width = 480; // int height = 800; // int value1 = "-10"; // string. not integer!! value2 = 10; // int } how can serialize negative integer? you're correct, , everything's fine. that's dictionary -description being misleading. nsmutabledictionary *senddata = [nsmutabledictionary dictionarywithobjectsandkeys: