Posts

Showing posts from June, 2014

How to combine 2 columns from 2 database sources in Informatica Powercenter (9.1) -

i using informatica powercenter 9.1 , trying combine 2 columns 2 sources. trying create report show users , roles have on 2 separate databases. in 1 database , not other have account well. so if had output: database 1 (oracle) user 1 = role a user 2 = role b database 2 (sybase) user 1 = role c user 3 = role d i want output this: user 1 = role --- role c user 2 = role b --- n/a user 3 = n/a --- role d any in figuring out appreciated. you can joiner transformation link them , use expression concat. read database using 2 separate source qualifier transformation , join them using joiner. join condition user_id. join type should full outer join. full join pick data (matching , not-matching) in either table. then pickup user_id, role1(oracle) , role 2 (sybase) , concat them ifnull logic - iif (isnull(role1), 'n/a', role1)||iif (isnull(role2), 'n/a', role2)

Solr: research in fields with relevance -

i'm using solr 5.4.1 , documents have following xml structure: <?xml version ="1.0" ?> <add > <doc > <field name ="title">us, qatar extend talks overformer taliban detainees - wall street journal</field> <field name ="date">2015-05-31t23:39:45z</field> <field name ="description">the u.s. , qatari governments have extended talks on fate of 5 former afghan taliban prisoners ho released guantanamo bay prison year ago in exchange american soldier , u.s. officials said sunday.</field> </doc > </add > as can see structure, there fields title , description . i tests: 1) search text in both fields if 1 unique field. 2) search text in both fields giving different relevance weight each field (e.g. 80% description , 20% title ). i know can use parameter qf specify search (fields); know there boolean operator and s

visual studio 2015 - How can I develop a Cortana app in JavaScript? -

i develop cortana application in html/javascript/css. unfortunately, documentation pertaining cortana apps written c#/xaml. to integrate cortana, need develop universal windows platform (uwp) app exposes "app service" integrates cortana. in visual studio 2015 (or visual studio 15), create new project using javascript project template "blank app (universal windows)". find element tag application , , add following child element: <extensions> <!-- provide hook cortana ask app questions --> <uap:extension category="windows.appservice" startpage="voicecommandservice.js"> <uap:appservice name="adventureworksvoicecommandservice"/> </uap:extension> <!-- enable deep linking app cortana --> <uap:extension category="windows.personalassistantlaunch"/> </extensions> the file voicecommandservice.js serve entry point cortana. executed whenever cortana hands

powershell - Inactive ADUser Query and ADGroup Manipulation Encountering Issues -

i'm trying (initially) query adusers in specific ou; identify 90-days inactive; document group memberships; make note in description field account being disabled of x-date; disable identified accounts; , move disabled accounts "parking" ou. i've made notes in gist well, appreciate getting group membership piece working. https://gist.github.com/rsmith7712/fdfe025d989508102044fdbbf5d3b9a8 i have not tested this, may 1 way solve problem # http://stackoverflow.com/questions/37577369/inactive-aduser-query-and-adgroup-manipulation-encountering-issues # import modules needed import-module activedirectory # output results csv file $logfile = "c:\zombieacct_90dayrpt_n_move.csv" # today's date $today = get-date -uformat "%y/%m/%d" # date search $xdays = (get-date).adddays(-90) # expiration date $expire = (get-date).adddays(-1) # date disabled description variable $userdesc = "disabled inactive" + " - " + $toda

Apache NiFi ExecuteScript: Groovy script to replace Json values via a mapping file -

i working apache nifi 0.5.1 on groovy script replace incoming json values ones contained in mapping file. mapping file looks (it simple .txt): header1;header2;header3 a;some text;a2 i have started following: import groovy.json.jsonbuilder import groovy.json.jsonslurper import java.nio.charset.standardcharsets def flowfile = session.get(); if (flowfile == null) { return; } flowfile = session.write(flowfile, { inputstream, outputstream -> def content = """ { "field1": "a" "field2": "a", "field3": "a" }""" def slurped = new jsonslurper().parsetext(content) def builder = new jsonbuilder(slurped) builder.content.field1 = "a" builder.content.field2 = "some text" builder.content.field3 = "a2" outputstream.write(builder.toprettystring().ge

c# - sending email in asp.net using web config -

this question has answer here: how send email c# codebehind - getting system.net.mail.smtpfailedrecipientexception 3 answers please guide me write in web config file in c# email sending. <system.net> <mailsettings> <smtp from="yourdomain.com"> </smtp> </mailsettings <configuration> <system.net> <mailsettings> <smtp deliverymethod="network"> <network host="localhost" port="25" defaultcredentials="true" /> </smtp> </mailsettings> </system.net> </configuration> from: https://msdn.microsoft.com/en-us/library/w355a94k(v=vs.110).aspx

Android Studio Error "withCancellationToken" -

after updating android studio 2.2 pasting files folder, fail sync project gradle due error:org.gradle.tooling.buildactionexecuter.withcancellationtoken(lorg/gradle/tooling/cancellationtoken;)lorg/gradle/tooling/configurablelauncher; what should do?

Fortran development on Windows -

i'm not sure if stupid question or not, i'm thinking of learning use fortran , wondering if there web site fortran can freely downloaded windows, presuming fortran free? fortran language - not can download. can download, though, fortran compiler. compiler program turn code (written in language, fortran) machine code (which can executed operating system). there number of compilers fortran. gnu compiler suite highly regarded (and free , open-source). can download mingw ( http://www.mingw.org/ ), gives libraries , gnu compilers necessary run fortran application on windows. a basic tutorial on how compile , run fortran code in mingw available @ http://www.stat.sc.edu/~habing/courses/740/mingw.html

ios - Issue Saving/Displaying CKAssets -

i'm pretty new swift, please try bear me. i'm able download ckrecords , insert them array, "birdfacts". each record includes few strings, image (ckasset), date, , int. when download icloud, works fine. everything saving expected, except image. when reload data, asset doesn't show up. here code load saved data: if let savedfacts = loadfacts() { birdfacts = savedfacts print("successfully loaded saved bird facts") } func loadfacts() -> [ckrecord]? { return nskeyedunarchiver.unarchiveobjectwithfile(birdfact.archiveurl.path!) as? [ckrecord] } this code save array: func savefacts() { let issuccessfulsave = nskeyedarchiver.archiverootobject(birdfacts, tofile: birdfact.archiveurl.path!) if !issuccessfulsave { print("failed save bird facts") } } this within custom class definition file: import uikit import cloudkit class birdfact: nsobject, nscoding { //mark: properties var birdnam

java stream return array of parameterized class -

situation: public class p { public static predicate<double> isequal(double value) { return p -> (math.abs(p - value) <= 0.000001); } } public class entity { private double[] values; public double getvalue(int index) { return values[index]; } } code unchecked conversion: public attribute split(entity[] examples) { @suppresswarnings("unchecked") predicate<double>[] pa = arrays.stream(examples).map(e -> p.isequal(e.getvalue(a.index))).toarray(predicate[]::new); return ...; } how can solve without unchecked conversion? i can't use such: public attribute split(entity[] examples) { predicate<double>[] pa = arrays.stream(examples).map(e -> p.isequal(e.getvalue(a.index))).toarray(predicate<double>[]::new); return ...; } there no way create generic array without unchecked conversion, creation of generic array unsafe operation per se. since creation not allow

php - Laravel. Common queue for two projects -

i have 2 different projects. laravel project , laravel project b. , need create task project project b through queue. , dont want create job in project a. currently realisation is: project a job state without business logic: <?php namespace app\jobs; use ...; /** * fake class!!! */ class myjob extends job implements shouldqueue { use interactswithqueue, serializesmodels; public $queue = 'myqueue'; /** * state */ protected $_contentid; public function __construct($contentid) { $this->_contentid = $contentid; } /** * excess. dont need business logic in project a. */ public function handle() { } } and push job queue in project a: ... $this->dispatch( new myjob($this->_contentid) ); ... project b <?php namespace app\jobs; use ...; /** * needed class */ class myjob extends job implements shouldqueue { use interactswithqueue, serializes

typescript - Cannot match any routes with child routes and new angular 2 RC1 router -

applicationcomponent import { component } '@angular/core'; import {router, router_directives, routes, router_providers} '@angular/router'; import {schoolyearscomponent} "./schoolyear/schoolyears.component"; @component({ directives: [router_directives], providers: [ router_providers ], templateurl: './app/application.component.html', styleurls: ['./app/application.component.css'] }) @routes([ { path: '/', component: schoolyearscomponent, }, ]) export class applicationcomponent {} schoolyearscomponent import { component } '@angular/core'; import { routes, router_directives } '@angular/router'; import { schoolyearshomecomponent } './schoolyears.home.component'; import { createschoolyearcomponent } './create.schoolyear.component'; @routes([ { path: '', component: schoolyearshomecomponent, }, { path: '/create', co

Configure Prometheus Scraping To Occur At Half Past The Hour -

i have process (in python) starts on hour, every hour. takes 20 minutes complete. i'm using push gateway send prometheus metrics start , end of process. i've created script produces metrics process. however, metrics available , relevant after 20 minute process completed. can make scrape_config interval "30 minutes past hour"? comparable cronjob "30 * * * *" no, there's no way that. scrapes staggered across scrape interval balance out load. what want have 2nd script push pushgateway.

c++ - Windows loadimage function fails but gelasterror function also returns null -

how can loadimage return null getlasterror returns null - doesn't make sense. here simple program demonstrates problem: #include <windows.h> #include <stdio.h> void main() { int e; hicon icon; icon = (hicon)loadimage(null, "\\temp\\icona.ico", image_icon,0,0,lr_loadfromfile); e = getlasterror(); printf("result: %x %d \n",icon, e ); return; } when compile, link , run get: result: 0 0

In Javascript, can constants be shared between files, as in Ruby? -

this odd question because it's more typical people ask how avoid using globals. coming ruby world, i've become comfortable using globals in 2 specific examples: constants. when file imported in ruby, of constants automatically made available other files in program. (and ties in first) packages. when load ruby gem in required file, becomes available in other files. i've been starting use module.exports , i'm finding i'm importing same modules in lots of different files. i'd have these features in javascript. way i'm writing code @ moment, i'm using functional approach , passing constants parameters. problem code getting verbose liking. i'm not looking "short answer: no" type of response, here. if difficult, i'd appreciate being pointed in direction how avoid passing constants parameters functions. one method of using globals use html5 local storage. my thinking is, have object globals, , on page load save eac

crystal reports - Text object - CurrentDate-1 -

i need have text field say: shipments picking (currentdate-1) how display properly? show: shipments picking may 31 tia! this formula work "shipments picking " & totext(currentdate,"mmm d")

visual studio - " 'devenv' is not recognized as an internal or external command ..." -

is there way open vs project command prompt? example, way atom, can navigate folder you'd open , run " atom . " kind of utility exist vs? edit : equivalent " c:\> devenv /run somesolution.sln " ? if so, great! there still seems problem because think "devenv" command should @ least recognized, 'devenv' not recognized internal or external command, operable program or batch file. i saw s/o contributer recommended adding c:\program files (x86)\microsoft visual studio 10.0\common7\ide\devenv.exe to path environment variables values this , per msdn, did, same message. can explain might going on , how fix it? thanks this easier looks. go root directory project, type name of .sln file, , hit enter. windows knows how use registry o find devenv.exe based on extension of file run. for example: cd \projects\sampleapp sampleapp.sln this technique same if opened sln file double clicking in explorer.

ruby on rails - Multiple plus and minus buttons in a table jquery do not work -

it simple question don't know how fix. have several rows , each row there 3 elements, minus-button, quantity , plus-button. ok when put rows inside table, buttons don't have effect on quantity field. moreover, i'm creating dynamic table rails wrote code rails generated in html. have tried , code is: $('.add').click(function() { if (!isnan($(this).prev().val())) $(this).prev().val(+$(this).prev().val() + 1); else $(this).prev().val(0); }); $('.sub').click(function() { if ((!isnan($(this).next().val())) && ($(this).next().val() > 0)) $(this).next().val(+$(this).next().val() - 1); else $(this).next().val(0); }); button { margin: 4px; cursor: pointer; } input { text-align: center; width: 40px; margin: 4px; color: salmon; } <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <table> <tbody> <tr>

Method to render how many days remain in membership - Ruby on Rails -

currently have method called expiration_date calls created_at , adds 1 year date. make method says how many days left until expiration_date , call on view. i'll show model code clarity , make more sense. model class subscriber < activerecord::base validates :first_name, presence: true validates :last_name, presence: true validates :email, presence: true validates :phone_number, presence: true def date_joined created_at.strftime("%-m/%-d/%-y") end def expiration_date (created_at + 1.year).strftime("%-m/%-d/%-y") end def days_till_expired #code end end controller class subscriberscontroller < applicationcontroller def index @subscriber = subscriber.all end def new @subscriber = subscriber.new end def create @subscriber = subscriber.create(subscriber_params) if @subscriber.save flash[:notice] = "subscriber has been created" redirect_to new_subscriber_path(:subscri

python - Pandas DatetimeIndex vs to_datetime discrepancies -

i'm trying convert pandas series of epoch timestamps human-readable times. there @ least 2 obvious ways this: pd.datetimeindex , pd.to_datetime() . seem work in quite different ways: in [1]: import pandas pd in [3]: nanos = pd.series([1462282258000000000, 1462282258100000000, 1462282258200000000]) in [4]: pd.to_datetime(nanos) out[4]: 0 2016-05-03 13:30:58.000 1 2016-05-03 13:30:58.100 2 2016-05-03 13:30:58.200 dtype: datetime64[ns] in [5]: pd.datetimeindex(nanos) out[5]: datetimeindex([ '2016-05-03 13:30:58', '2016-05-03 13:30:58.100000', '2016-05-03 13:30:58.200000'], dtype='datetime64[ns]', freq=none) with to_datetime() , display resolution milliseconds, , .000 printed on whole seconds. datetimeindex , display resolution microseconds (which like), decimal part omitted on whole seconds. then, try converting time zone: in [12]: pd.datetimeindex(nanos).tz_localize('utc')

html5 - Can't figure out why Bootstrap Scrollspy isn't working -

i trying implement bootstrap's scroll spy in website isn't working @ all! have tried many things can't work. have lot of custom css being applied navbar not sure if effecting anything. anyways, have far: html code: body: <body id="home" data-spy="scroll" data-target=".navbar" data-offset="0"> navbar: <nav id="navbar" class="navbar navbar-lg navbar-fixed-top hidden-xs-down"> <!-- navbar content --> <ul class="navul"> <li class="nav-item navitem"><a class="nav-link navhref" href="#home">home</a></li> <li class="navitem"><a class="navhref" href="#about">about</a></li> <li class="navitem"><a class="navhref" href="#projects">projects</a></li> <li class="navitem"

asp.net web api - Why does not MapHttpAttributeRoutes work in Stateless Web API in service fabric? -

by default, vs 2015 templates web api in service fabric create owin based hosting web api controllers. default code in startup.cs file service is: public static void configureapp(iappbuilder appbuilder) { // configure web api self-host. httpconfiguration config = new httpconfiguration(); config.routes.maphttproute( name: "defaultapi", routetemplate: "{controller}/{id}", defaults: new { id = routeparameter.optional } ); appbuilder.usewebapi(config); } i replaced code following: public static void configureapp(iappbuilder appbuilder) { // configure web api self-host. httpconfiguration config = new httpconfiguration(); config.maphttpattributeroutes(); appbuilder.usewebapi(config); } and added [routeprefix("mycontroller")] public class valuescontroller : apicontroller { ... } and try navigate http://localhost:port/mycontroller. it not work. the same code works fine

asp.net mvc 4 - HtmlBeginCollectionItem Get Current Item -

Image
i need: acess /client/create add dynamically partial views (/product/card) , bind them client.products in each partial view when click in button open bootstrap modal windows can set product's information close modal , reflect changes of modal reflect in card's product. the problem is: how change product informations in view(other card) , reflect product of card? @using (html.begincollectionitem("products")) { @html.hiddenfor(model => model.clientid) @html.hiddenfor(model => model.productid) <div class="card"> <img class="card-img-top" src="http://macbook.nl/wp-content/themes/macbook/images/png/iphone318x180.png" alt="grupo logo"> <div class="card-block"> <h4 class="card-title">@model.name</h4> <p class="card-text">@model.desc</p> <div class="btn-group">

metaprogramming - Is there a fast way of going from a symbol to a function call in Julia? -

this question has answer here: julia: invoke function given string 1 answer i know can call functions using name follows f = x -> println(x) y = :f eval(:($y("hi"))) but slow since using eval possible in different way? know it's easy go other direction doing symbol(f) . what trying accomplish? needing eval symbol sounds solution in search of problem. in particular, can pass around original function, thereby avoiding issues needing track scope of f (or, since f ordinary variable in example, possibility reassigned), , fewer characters type: f = x -> println(x) g = f g("hi") i know it's easy go other direction doing symbol(f) . this misleading, since it's not going give f (that transform non-unique). instead gives string representation function (which might happen f , sometimes). equivalent calling symbol(

How to see the assembly code from a Ansi C hello world written in Visual Studio? -

Image
i'm playing ansi c in visual studio, created simple ansi c program (i had change vs configuration not use cpp ansi c) int = 0; int b = 0; printf("hello world! \n\n"); system("pause"); return 0; i compiled , generated this: first of expecting simple .exe , don't know why .ilk , .pdb created question here how can see assembly code generated compiled c program? thanks the .ilk incremental linking file, can speed linking when make minor changes code, re-link. the .pdb program database--use when debugging. to assembly language code translates, can compile /fa .

excel - How to autopopulate nonadjacent cells -

Image
i have 2 rows , columns this: col1 col2 col3 col4 =f4 =g4 =f5 =g5 =j4 =k4 =j5 =k5 i want able auto-populate rows below , columns right of these cells, keeping logic of these simple formulas (row n+1 references cell n+3, column n+2 references cell n+1). have tried various iterations of indirect no avail. in cell, =index(sheet2!$a:$zz, (column(a:a)-1)/2+4, (row(1:1)-1)*4+6+iseven(column(a:a))) edit appropriate worksheet , expand $a:$zz if require cells beyond column zz. fill right , down necessary.

android - Accelerometer detects rotation instead of acceleration -

i'm trying device acceleration in unity move object public class exampleclass : monobehaviour { public float speed = 10.0f; void update() { vector3 dir = vector3.zero; // assume device held parallel ground // , home button in right hand // remap device acceleration axis game coordinates: // 1) xy plane of device mapped onto xz plane // 2) rotated 90 degrees around y axis dir.x = -input.acceleration.y; dir.z = input.acceleration.x; // clamp acceleration vector unit sphere if (dir.sqrmagnitude > 1) dir.normalize(); // make move 10 meters per second instead of 10 meters per frame... dir *= time.deltatime; // move object transform.translate(dir * speed); } } but when run game on device, object moves , stops depending on orientation of device , not it's acceleration. i tried print input.acceleration readings gui.button(new re

asp.net mvc - @Styles.Render & @Scripts.Render won't work in Empty MVC Visual Studio solution -

if create solution mvc 5 template in vs 2015 - bundling & minification works fine. if create solution empty template folders , core references mvc - bundling & minification won't work. these not work in razor view: @styles.render("~/content/css") @scripts.render("~/bundles/modernizr") (error: name 'styles' not exist in current context). i have tried installing nuget package - doesn't help: install-package microsoft.aspnet.web.optimization any references in google appear apply older versions, , above nuget package. how supposed add bundling & minification project doesn't have it? there different nuget package or something? first need ensure have reference system.web.optimization in web project styles static class exists. after need ensure namespace available in views. this, edit web.config in views folder , add namespace <system.web.webpages.razor> <pages> <namespaces>

node.js - Scrape web with x-ray -

i'm using x-ray extract data web site when point crawl page using built-in functionality, doesn't work. unitprice parameter want extract " undefined " time. as can see, i'm passing href value extracted on url property. var xray = require('x-ray'); var x = xray(); var x = xray({ filters: { cleanprice: function (value) { return typeof value === 'string' ? value.replace(/\r|\t|\n|€/g, "").trim() : value }, whitespaces: function (value) { return typeof value === 'string' ? value.replace(/ +/g, ' ').trim() : value } } }); x('https://www.simply.es/compra-online/aceite-vinagre-y-sal.html', '#content > ul', [{ name: '.descripcionproducto | whitespaces', categoryid: 'input[name="idcategoria"]@value', productid: 'input[name="idproducto"]@value', url: 'li a@href', price: 'span | cleanprice'

java - Seemingly easy FNV1 hashing implementation results in a lot of collisions -

i'm playing hash tables , using corpus of ~350,000 english words i'd try evenly distribute. thus, try fit them array of length 810,049 (the closest prime larger 2 times input size) , baffled see straightforward fnv1 implementation this: public int gethash(string s, int mod) { final biginteger mod = new biginteger(integer.tostring(mod)); final biginteger fnv_offset_basis = new biginteger("14695981039346656037"); final biginteger fnv_prime = new biginteger("1099511628211"); biginteger hash = new biginteger(fnv_offset_basis.tostring()); (int = 0; < s.length(); i++) { int charvalue = s.charat(i); hash = hash.multiply(fnv_prime).mod(mod); hash = hash.xor(biginteger.valueof((int) charvalue & 0xffff)).mod(mod); } return hash.mod(mod).intvalue(); } results in 64,000 collisions a lot , 20% of input basically. what's wrong implementation? approach som

optimization - Algorithm for >2D skyline query/efficient frontier -

Image
the problem @ hand: given set of n points in d dimensional space, coordinates >= 0 (in 2d points in 1st quadrant, in 3d in 1st octant, , on...), remove points have point has value bigger or equal in every coordinate. in 2d, result this: (image vincent zoonekynd's answer here ) , there simple algorithm, detailed in answer, runs in n*log(n) . chunking should have brought n*log(h) , optimizations on question. i interested in extending solution 3 dimensions (and possibly 4, if it's still reasonable), current 3d algorithm pretty slow, cumbersome , doesn't generalize 4d nicely: sort points on x axis, annotate position of each point initialize sort of segment tree n leaves, leaves hold points' y values , node hold max(child1, child2) sort points on z axis for every point largest z: check position in x order, try put in segment tree in position check first if there point down (so has > z), @ higher place (so has > x) bigger y (this costs log(n), t

c# - Why are no query parameters being passed to my NancyFX module? -

i running self-hosted nancyfx web server inside of application. right have 1 module hosted: public class metricsmodule : nancymodule { private istorageengine _storageengine; public metricsmodule(istorageengine storageengine) : base("/metrics") { _storageengine = storageengine; get["/list"] = parameters => { var metrics = _storageengine.getknownmetrics(); return response.asjson(metrics.toarray()); }; get["/query"] = parameters => { var rawstart = parameters.start; var rawend = parameters.end; var metrics = parameters.metrics; return response.asjson(0); }; } } my bootstrapper class is: public class overlookbootstrapper : defaultnancybootstrapper { private readonly istorageengine _storageengine; public overlookbootstrapper(istorageengine storageengine) { _storageengine = stora

c++ - derived class has same member variable name as base class -

#include<iostream> using namespace std; class { protected: int m_nvalue; public: a(int nvalue):m_nvalue(nvalue) { cout << m_nvalue << endl; } }; class b: public { public: b(int nvalue): a(m_nvalue) { cout << m_nvalue << endl; } int getvalue() { return m_nvalue; } }; int main() { b b(4); cout << b.getvalue() << endl; return 0; } here, in above program not declaring m_nvalue again in derived class. in output, see junk values getting displayed rather displaying value "4". please explain this. you're trying initialize m_nvalue m_nvalue itself. parameter nvalue (passed in value 4 ) not used @ all. that's why m_nvalue has garbage value. you might want b(int nvalue): a(nvalue) { cout << m_nvalue << endl; }

ios - What is the best way to get unique set of objects from an array in objective C -

i have array list of model objects model object has properties name, age, gender, have date follows user* user1.name = "bob", user1.age = "10", user1.gender = "m", user* user2.name = "bob", user2.age = "11", user2.gender = "m", user* user3.name = "woz", user3.age = "15", user3.gender = "m", user* user4.name = "woz", user4.age = "16", user4.gender = "m", now need unique name , lesser age result. user* user1.name = "bob", user1.age = "10", user1.gender = "m", user* user3.name = "woz", user3.age = "15", user3.gender = "m", what efficient way derive above result. in advance hint or appreciated. you can iterate array looking youngest users, storing each 1 in dictionary keyed name. once have iterated array of dictionary values array; -(nsarray*)getyoungestuniqueusersfromarray:(ns

Java Reflections doesn't work with Android instant run -

i'm writing code uses java reflections on it. i'm scanning package class using method: /** * called list of classes included in current project * * @param packagename name of application package * @return array of classes' names */ private string[] getclassesofpackage(string packagename) { arraylist<string> classes = new arraylist<>(); try { string packagecodepath = getpackagecodepath(); dexfile df = new dexfile(packagecodepath); (enumeration<string> iter = df.entries(); iter.hasmoreelements(); ) { string classname = iter.nextelement(); if (classname.contains(packagename)) { classes.add(classname); } } } catch (ioexception e) { e.printstacktrace(); } return classes.toarray(new string[classes.size()]); } recently upgraded gradle version 2.1.0 trying out instant run feature, noticed app package returns empty string[] method , metho

twitter - Java: First item of Array do not display correctly -

i need compare words tweets , count how many times appear on text. used 2 cycle compare arraylist words , arraylist tweets first word of arraylist words don't display correctly , don't want count. output image supposed champions word count twice my code is: read txt words , save on arraylist public arraylist <string> fread(string dir) throws filenotfoundexception, ioexception { scanner s = new scanner(new file(dir)); arraylist<string> list = new arraylist<string>(); while (s.hasnext()){ list.add(s.next().tolowercase()); } s.close(); return list; } get tweets , save them on arraylist public arraylist<string> showtimeline() throws twitterexception { list<status> statuses = twitter.gethometimeline(new paging (1,200)); arraylist<string> alltweets=new arraylist<string>(); (status status : statuses) { alltweets.add(status.gettext().replaceall("https[^\\s]+","")

haskell - Is the computational complexity of this function O(2^n) or O(n) -

i want make function creates infinite list takes 2 numbers , operator input can generate arithmetic , geometric sequences. infinitelist:: (floating a)=>a->(a->a->a)->a->[a] infinitelist start operation changeby = start:[(operation x changeby)| x<-(infinitelist start operation changeby)] the code compiles , works properly: infinitelist 1 (*) 2 generates list starting 1 , subsequent numbers double predecessor. now i'm having trouble figuring out computational complexity "to calculate nth element of list". technically doing 1 operation figure out each element of list. however, if after (2^k +1) term, have wait computer finish calculating 2^(k+1) elements first. i hope i'm explaining properly, think program produces elments in 2^k batches k integer, potentially waiting ( 2^(k+1)-2^k) time calculate (2^k +1)th integer. computational complexity "to calculate nth element of list"? a key tool following rule: when an

java - Maven doesn't find dependency -

i added dependency in maven servlet seen here , here , here maven doesn't find : dependency javax.servlet:javax.servlet-api:3.0.1 not found <dependency> <groupid>javax.servlet</groupid> <artifactid>javax.servlet-api</artifactid> <version>3.1.0</version> <scope>provided</scope> </dependency> i tried add this, doesn't work : <repository> <id>maven2</id> <url>https://mvnrepository.com</url> </repository> or this: <repository> <id>maven2</id> <url>http://repo1.maven.org/maven2/javax/servlet/javax.servlet-api/3.0.1/</url> </repository> first of need verify if have internet connectivity , can try purge , resolve dependencies in local maven repository there corrupted package, can try following command accomplish this: mvn dependency:purge-local-repository take purging local repository dep

ajax - Yii CGridView pagination -

i'm using carraydataprovider (which customized query i've created) returns results (over 1000) database. i'm using results in view when i'm using pagination it's going controller query. my question is: there way move on the next set of results (already part of result array) without going controller , model again. *my controller has advanced function requires variables , parameters dont have in view when trying use standard ajax request next page. thanks, danny my question is: there way move on the next set of results (already part of result array) without going controller , model again then answer no if using cgridview's pagination. in situation, have make pagination instead. have selected of records, , manipulate them on client side, don't need pagination of cgridview @ all. pushing of records page on first load not idea, maybe requirement has asked, that.

jquery - JavaScript: Need lower div (under absolute div) NOT to scroll -

i have issue layout of website right now... the layout similar fiddle made. top layer has project thumbnails, , lower layer gets exposed show project details when user clicks thumbnail. problem having user has scroll down click thumbnail on top layer. then, when layer fades out, lower div has scrolled - , need div scrolltop(0) instead... please see fiddle understand talking about: $('#click').on('click', function(){ $('#toppanel').fadeout(600); }) #click { padding:10px 15px; position:fixed; z-index:100; } #toppanel, #bottompanel { width:80%; height:auto; margin:0 auto; padding:100px; text-align:center; } #toppanel { background:green; position:absolute; z-index:10; } #bottompanel { background:yellow; position:absolute; z-index:0; } #toppanel p, #bottompanel p { padding: 500px 0; text-transformation:uppercase; } #bottompanel p:nth-child(odd){ background:#555; } <script src=&q

javascript - Resize polygon maintaining position - jQuery -

so have svg has multiple polygons inside, want accomplish animate 1 polygon inside (resize easing) such doesn't move place. considering polygon position set points="..." (i guess..). i want preferably in jquery or css plain javascript works or other libraries.. here example: shapes.svg: <?xml version="1.0" encoding="utf-8"?> <!-- generator: adobe illustrator 19.0.0, svg export plug-in . svg version: 6.00 build 0) --> <svg version="1.1" id="layer_2" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewbox="-47 49 404 404" style="enable-background:new -47 49 404 404;" xml:space="preserve"> <style type="text/css"> .st0{fill:#154e78;} .st1{fill:#006496;} .st2{fill:#047ebe;} .st3{fill:#cd99b2;} .st4{fill:#d464a4;} .st5{fill:#cc78b1;} </style&

Running Javascript+PHP Form Another File -

how execute javascript+php in file in current.js file? the scenario follows: another-file.js function foo() { var = <?php echo "hello world !"; ?> } current.js function show() { var b = "hi,"; // execute javascript (with php code embeded) require(another-file.js) // <-- not work alert(a + b); // want result: "hi, hello world !" } you can use php generate string assigned js variable so: var myvar = "<?php echo "hello world"; ?>"; in example forgot quotes around php tags (before <?php , after ?> ) getting errors because js interpreter looking varables called hello , world instead of considering "hello world" string. now know, can't have includes in js in other languages, what people using multiple <script> tags include more 1 js page . however, if reason ignore, absolutely need include js js, can using jquery's getscript() , see here more i

arrays - Append javascript object to json file with php -

i have task create js object form , save data json file. have @ moment code , appends new data file if file exists. problem data appended array need append object in 1 main array. this output (example) [ [ { "campaignid": "campaign1", "id": "c1" } ], [ { "campaignid": "campaign2", "id": "c2" } ] ] but need is [ { "campaignid": "campaign1", "id": "c1" }, { "campaignid": "campaign2", "id": "c2" } ] i not php developer php knowledge limited , i'm googling way through task have come point google failing me. here php code <?php $json = $_post['json']; $name = $_post['name']; $cat = $_post['category']; // make requested directory // see if directory exists $filename = "saveddata/$cat/"; i