Posts

Showing posts from January, 2013

dotq - kdb+: use string as variable name -

how can use string variable name? i want variable name constructed during runtime, how can use left argument , assign value it? example: [`$"test"] : 1 / 'assign error you use "set" create global: q){(`$"test") set 1;test}[] 1 q)test 1 or (as noted user2393012 in comments): @[`.;`test;:;1] if want avoid globals use sort of namespace/dictionary/mapping: q){d:()!();d[`$"test"]:1;d`test}[] 1

Caching EXTJS 5.1 Store that calls REST -

i have stores retrieve data rest services , because these data parameters in application thinking cache them locally , refresh them after period. used nocache:false hoping browser automatically caching failed, still browser calls rest service. there way automatically caching, else can do?

forms - PHP - no attachment in mailbox [POST] -

i have code in php sending message attachment. code works fine instead of attachment. when attach file , click "wyślij wiadomość" (send) have message in mailbox there`s nothing attached. think did wrong place put $formfile $mailtext = "treść wiadomości:\n$formtext\nod: $formname, $formemail, $formfile, ($ip, $host)"; here`s full code: <?php //--- początek formularza --- if(empty($_post['submit'])) { ?> <form action="" method="post" enctype="multipart/form-data"> <table class="col-md-10 col-sm-12 col-xs-12"> <tr> <td class="col-md-2">nazwisko:<br /><br/></td> <td><input type="text" name="formname" /></td> </tr> <tr>

linux - Java Class.isAssignableFrom ALWAYS returning false... only outside IDE -

i've tested on 3 windows machines, , 2 linux vpses, on different versions of java, both on openjdk & oracle jdk. functioned perfectly, , of sudden, works in ide, though haven't changed relevant code, , can't imagine can cause this. prevalent code in system: class<?> cls = (session == null ? secjlcl : session.getjlcl()).loadclass(name); logger.log(javaloader.class.isassignablefrom(cls) + " - " + cls + " - " + cls.getsuperclass().getname()); if (javaloader.class.isassignablefrom(cls)) { and classloader: public class javaloaderclassloader extends urlclassloader { public javaloaderclassloader(url[] url, classloader parent) { super(url); } private hashmap<string, class<?>> javaloaders = new hashmap<string, class<?>>(); public string addclass(byte[] data) throws linkageerror { class<?> cls = defineclass(null, data, 0, data.length); javaloaders.put(cls.getname(), cls); return cls.getname(); }

matlab - How can i remove overlaping circles after Hough Transform segmentation -

Image
i'm working in image segmentation, testing lot of different segmentation algorithms, in order comparitive study. @ moment i'm using hough transform find circles in image. images i'm using have plenty objects, when Í count objects result hudge. think problem, overlaping circle. know how can maybe remove overlaping circles have result more close reality? the code i'm using is: clear all, clc; % image reading i=imread('0001_c3.png'); figure(1), imshow(i);set(1,'name','original') image used % gaussian filter w = fspecial('gaussian',[10,10]); j = imfilter(i,w); figure(2);imshow(j);set(2,'name','filtrada média'); x = rgb2gray(j); figure(3);imshow(x);set(3,'name','grey'); % finding circular objects -- houng transform [centers, radii, metric] = imfindcircles(x,[10 20], 'sensitivity',0.92,'edge',0.03); % [parasites][5 30] centersstrong = centers(1:60,:); % number of objects radiist

node.js - Merge two MongoDB aggregates into one pipeline -

i have collection of population census , still don't dominate “aggregate” function results 1 query. the collection has this format (plus iso 8601 timestamp). way, each time census conducted can register current ages , counts (which can add/modify/delete previous ages). now have 2 “aggregate” queries to return this : get avg, max, min of registries in db. get each age , show total (“sum”) of people age. however need results 1 “aggregate” query, pipeline difficult me, , cannot statistics , “unwind” population sums… any on how merge 2 queries, please? thank in advance! try following aggregation pipeline, should give result of 2 queries: db.collection('population').aggregate([ { "$unwind": "$population" }, { "$group": { "_id": 0, "doc": { "$push": "$$root" }, "average_age": {

java - LibGDX: Create and dispose ShapeRenderer in render method? -

i'm using shaperenderer object create color gradient in game ( screen class). allocated memory used grow permanently until started dispose shaperenderer object after every call. how can reuse color gradient? there way paint gradient texture (only once reuse in render method)? public void render(float deltatime) { camera.update(); batch.setprojectionmatrix(camera.combined); shaperenderer shaperenderer = new shaperenderer(); shaperenderer.setprojectionmatrix(camera.combined); shaperenderer.begin(shaperenderer.shapetype.filled); shaperenderer.rect(0, 0, screenwidth, screenheight, topcolor, topcolor, bottomcolor, bottomcolor); shaperenderer.end(); shaperenderer.dispose(); batch.begin(); ... batch.end(); } although seems have solved problem, here little note , stumbling across post similar question. do not instantiate new objects (of type) during every run through loop, @ costs. reason experiencing slow-down because of th

ios - Empty return value from swift function containing closure -

i created function should return dictionary filled data retrieved (using json, based on ray wenderlich tut) online. code in closure. problem empty dictionary returned first, , afterwards gets filled. don't know if related delay in getting remote data, need dictionary filled first before returning it. here code. func getstatusfromremotesource() -> [statusmodel] { var statusupdates = [statusmodel]() println("statusupdates after initialization: \(statusupdates)") // 1 datamanager.getstatusdatawithsuccess { (statusdata) -> void in let json = json(data: statusdata) if let jsonarray = json.array { jsonitem in jsonarray { var statusversion: string? = jsonitem["version"].string var statusdescription: string? = jsonitem["message"].string var statuscode: int? = jsonitem["code"].string!.toint() var update = statusmodel(version: status

vagrant - Provision script in Laravel/Homestead -

i wonder how can include provision script in laravel/homestead should execute each time homestead vm up. as hint, used work vagrant in following way, config.vm.provision :shell, path: "bootstrap.sh" where bootstrap.sh file provision script. you can manually force provision either vagrant provision or vagrant reload --provision . to make every vagrant up automatically call provisioner define in vagrantfile so: vagrant.configure("2") |config| config.vm.provision :shell, path: "bootstrap.sh", run: "always" end you can choose not run provisioner using vagrant --no-provision . the vagrant docs on go little more detail else can provisioners.

java - C++ equivalent of Arraylist.get(index) -

i have been wanting learn c++ out of interest , start of wanted see if translate of java code had written solve project euler problems(i had followed course while wanted see remembered). came across java code: while (x != 0) { if(x%10 != 0) { digits.add(x%10); } x /= 10; } which translated to: std::vector<int> v; while(x != 0){ v.push_back(x%10); x /= 10; } with of internet. question is, how value out of ¨list¨. in java can digits.get(index), how 1 in c++? you use operator[](std::size_t) , plain array: int n = v[index]; note performs no bounds checking. if want bounds-checked access, use at() member function: int n = v.at(index); the latter throws std::out_of_range exception out of bounds access.

mysql - How to "remove duplicates" from a UNION query -

i have 2 tables in mysql: 1 called gtfsws_users contains users system i'm developing , called gtfsws_repository_users contains roles these users. gtfsws_users has these fields: email , password , name , is_admin , enabled . gtfsws_repository_users has: user_email , repository_id , role . the role integer defines privileges on gtfs repository (public transportation data, not relevant problem). one important thing every administrator accont (that is, every user has is_admin flag set 1 in gtfsws_users ) has full access repositories. now, users registered in gtfsws_repository_users have access specific repository defined there (unless administrators, of course). 1 user can have multiple repositories him/her can access. what i'm trying all users access specific repository (it doesn't matter type of role user has, want know if can access repository or not). i'm writing sql statement getting them: ( select distinct gtfsws_users.email em

Read Json with NaN into Python and Pandas -

i understand nan not allowed in json files. use import pandas pd pd.read_json('file.json') to read in json python. looking through documentation, not see option handle value. i have json file, data.json, looks [{"city": "los angeles","job":"chef","age":30}, {"city": "new york","job":"driver","age":35}, {"city": "san jose","job":"pilot","age":nan}] how can read python/pandas , handle nan values? edit: amazing answer below!! fixxxer!! it's documented, reading in separate file import pandas pd import json text=open('data.json','r') x=text.read() y=json.loads(x) data=pd.dataframe(y) data.head() read json file variable: x = '''[{"city": "los angeles","job":"chef","age":30}, {"city": "new york",&quo

c# - get indexes of different elements from arrays with equal length using Linq -

i have 2 arrays same length. example arr1 {1,2,3,4,5,6,7,8,9,0}. arr2 {1,2,5,3,4,6,7,1,1,0}. i need indexes of elements different: {2,3,4,7,8} how using linq? the simplest think of: int[] diff = enumerable.range(0, arr1.length).where(i => arr1[i] != arr2[i]).toarray();

javascript - Can't focus on a div (it won't scroll if I scroll with the mouse, unless I click the content) -

so i've got little website, shows div when click link, window on front. just click on big green frame, , you'll see window opening. thing that, if open it, , try scroll, without having clicked content, won't scroll, while should. how can fix ? the code called one, animation thing based on keyframes. function displaybox(boxid, closebuttonid) { displaybutton(closebuttonid); var box = document.getelementbyid(boxid); box.setattribute('class', 'boxin'); box.setattribute('tabindex', '0'); } function displaybutton(buttonid) { var box = document.getelementbyid(buttonid); box.setattribute('class', 'buttonin'); } function hidebox(boxid, closebuttonid) { var box = document.getelementbyid(boxid); box.setattribute('class', 'boxout'); settimeout(function(){var box = document.getelementbyid(boxid); box.setattribute('class', 'invisible');},500); h

architecture - API callback setup for scheduling a job -

i'm devising api allows remote system execute job/report @ server(s). easy enough, job typically takes long caller wait for. after job or report finished scheduler check pick results/report up. i can 1 of following: send user email let him know job done, details on how pick (but difficult act on automatically him) use callback link supplies me post location of rsults/report to supply link can poll periodically results maybe there other ways this? if - recommend way implement such setup? you have combination of 2. , 3. . let him provide callback post results once available , can provide endpoint poll progress of operation. useful if needed show progress clients.

java - Can't access these variables outside the ActionListener -

i have been stuck on weekend, have looked everywhere , not single solution. appreciated. int idaybirth = integer.parseint(jtextfield_dobday.gettext()); int imonthbirth = integer.parseint(jtextfield_dobmonth.gettext()); int iyearbirth = integer.parseint(jtextfield_dobyear.gettext()); int idaycurrent = integer.parseint(jtextfield_cdday.gettext()); int imonthcurrent = integer.parseint(jtextfield_cdmonth.gettext()); int iyearcurrent = integer.parseint(jtextfield_cdyear.gettext()); double idaysalive = 0; calendar cabirthdate = new gregoriancalendar(iyearbirth, imonthbirth - 1, idaybirth); calendar cacurrentdate = new gregoriancalendar(iyearcurrent, imonthcurrent - 1, idaycurrent); jbutton btncalculate = new jbutton("calculate"); btncalculate.addactionlistener(new actionlistener() { public void actionperformed(actionevent e) { idaysalive = (cacurrentdate.gettimeinmillis() - cabirthdate.gettimeinmillis());

c# - Error: Index was outside the bounds of the array -

when i'm running code, i'm getting error index outside bounds of array. for (var = 9; + 2 < lines.length; += 3) { items.add(new itemproperties { item = lines[i], description = lines[i + 1], quantity = lines[i + 2], unitprice = lines[i + 3] }); } can me out, please? you're using lines[i + 3] in loop, check ensures i + 2 in range - , fact you're using 4 values in loop rather 4 makes should be: for (var = 12; + 3 < lines.length; += 4) { items.add(new itemproperties { item = lines[i], description = lines[i + 1], quantity = lines[i + 2], unitprice = lines[i + 3] }); } (that's assuming want start on 4th item, before - should check want initial value of i be.)

qt - QPushButton click event inside a QStackWidget is sent to parent window -

i have mainwindow class , within qstackwidget. inside have 3 widgets, each 1 own custom class derived qwidget. inside 1 of widgets have button. when using qt creator , press go slot.. on button, creates on_button_clicked event in mainwindow class. how change have event inside custom class? update: can see buttons located in mainwindow. auto generated, not sure how move it. code: mainwindow.cpp: #include "mainwindow.h" #include "ui_mainwindow.h" #include <qmessagebox> mainwindow::mainwindow(qwidget *parent) : qmainwindow(parent), ui(new ui::mainwindow) { ui->setupui(this); } mainwindow::~mainwindow() { delete ui; } void mainwindow::on_pushbutton_2_clicked() { qmessagebox::information(this, "button 2 clicked!", "click"); } mainwindow.ui <?xml version="1.0" encoding="utf-8"?> <ui version="4.0"> <class>mainwindow</class> <widget class=&qu

scala - Solve Coin Change Problems with both functional programming and tail recursion? -

i know how solve coin change problem both imperative programming , dp. i know how solve coin change problem both fp , non-tail-recursion. compute same problem multiple times, lead inefficiency. i know how compute fibonacci number both fp , dp/tail-recursion. lots of articles use example explain "fp can combined dp" , "recursion can efficient loop" . but don't know how solve coin change problem both fp , dp/tail-recursion. i think it's strange articles on imperative programming mention inefficiency of computing same problem multiple times on coin change problem, while on fp omit it. in more general sense, wonder whether fp powerful enough solve such kind of "two dimensional" problem, while fibonacci "one dimensional" problem. can me? coin change problem: given value n, if want make change n cents, , have infinite supply of each of s = { s1, s2, .. , sm} valued coins, how many ways can make change? order of coins d

load balancing - Deploying standalone EAR in a weblogic cluster -

i have setup weblogic cluster on 2 hosts machine , machine b. nodemanagers of both machines reachable either of machine , can start , monitor managed servers either of 2 machines. trying deploy standalone ear machine managed server on machine b. no files getting pushed on machine b when that. here steps followed. installed weblogic on both machines created domain on machine a configured domain adding managed servers(production_a , production_b) , machines(machine_a , machine_b), node managers machine_a , machine_b, through weblogic console. copiedd domain file structure machine b , enroll weblogic domain. nmenroll('/home/weblogic/oracle/middleware/user_projects/domains/clustereddomain', '/home/weblogic/oracle/middleware/wlserver/common/nodemanager') success created , configured cluster on both machines. configured data sources on both machine. i can start , monitor managed servers either of 2 machines. if try deploy ear(standalone) on machine mach

html - Is there a way to inject javascript code from an iframe into the parent window? -

is there way inject javascript iframe parent window using javascript? both iframe , parent in same domain. i cannot perform action parent window after detecting changes in iframe, due other reasons. example: <div id="bar"> hello world </div> <iframe srcdoc=" <html> <body> <script type="text/javascript"> // change "bar"'s style or alter content </script> </body> </html> "></iframe> all need use global parent variable in iframe , either using window.parent or parent directly. example: <div id="bar"> hello world </div> <iframe srcdoc="<html> <body> <script> window.parent.document.getelementbyid('bar').style.background = 'red'; </script> </body> </html>"></iframe> so

Android drawer App icon not showing up - Incompatibility between Theme.AppCompat.Light and ActionBarActivity: -

i'm trying implement navigation drawer on app extending actionbaractivity , using theme.appcompat.light. screen 1 in post drawer icon not left aligned , launcher icon not showing the app icon doesn't show , ic_drawer icon not correctly aligned. i've seen posts same problem none of them got response use. i've spent week on issue no results. thank in advance. bellow code: public class navigationdraweractivity extends actionbaractivity { private string[] mnavigationdraweritemtitles; private drawerlayout mdrawerlayout; private listview mdrawerlist; private charsequence mdrawertitle; private charsequence mtitle; //for app icon control nav drawer actionbardrawertoggle mdrawertoggle; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_navigation_drawer); mnavigationdraweritemtitles= getresources().getstringarray(r.array.navigation_drawer_items_array); mdrawerlayou

eclipse - Jar added to build path does not appear in the archive file (broker archive) -

i have ojdbc5.jar referenced in build path of java project in 1 of message broker toolkit workspaces. toolkit built on top of eclipse. when build broker archive (its bar similar ear or war), dont see ojdbc5 jar in it. see in archive file if build in different workspace similar java project. suspected workspace corrupted , tried creating new workspace same non-working code. still wouldnt work. have tried options listed on same issue on stackoverflow. none of them helped. any ideas? did try menu project > build mqsipackagebar ?

How to collaborate in a project using Git without using Github? -

i beginner git , github , still confused them. said can use git without github when collaborating other people. however, said git works locally on one's computer. if not use github, how can collaborate while git works locally? you collaborate swapping commits around among repositories , cooperating whatever extent find convenient on name interesting ones. that's it. really: that's there it. github runs server speaks of main protocols git supports swapping commits , refnames around, , has web gui on top of big helping of handy abstractions , features browser-mediated access, when comes right down it's swapping commits. there's lots , lots of ways that, because underlying structure (quite literally incredibly) simple. it's simple people don't believe it. your repos yours; goes on in them business alone. idea getting commits repository in agreed-on (for each repo) sense publishing them. what's in @ least (including own) repos include rou

ios - Action not working correctly in SpriteKit -

Image
i'm new ios programing , i'm experimenting learn trying create game in swift using sprite kit. what i'm trying achieve having constant flow of blocks being created , moving rightwards on screen. i start creating set contains initial blocks, action "constant movement" added each one, makes them move right. i'm having trouble adding new blocks screen. the last column of blocks has "islast" boolean set true, when passes threshold supposed switch false , add new column of blocks set have "islast" set true. each block in set has "constantmovement" action added makes them move right, new blocks have added well, don't work original ones. not of move, tho if print "hasactions()" says do, , ones move stop doing when middle of screen. have no idea why happens, can experienced give me hint please? this update function: override func update(currenttime: cftimeinterval) { /* called before each frame rend

ruby on rails - links to scoped routes -

i'd use scoped routes internationalizing. here's routes.rb scope "(:locale)", locale: /en|pl/ resources :announcements, only: [:index], path: '/news' resources :diplomas, only: [:index, :show], path: '/graduates' end goal point urls website.domain/pl/news announcements controller , check params[:locale] in applicationcontroller in before_action method. but have problems generating urls. said before want looking urls , sense of aesthetics tells me appname.domain/news/?locales=pl not i'm looking for. :( so have question: there option generate links appname.domain/pl/news/ when using scoped routes? thanks help! your routes scoped in way, can called this: your.domain/pl/news your.domain/en/news if pleases aesthetics. so, in other word, yes. have here, on how use , set this: http://guides.rubyonrails.org/i18n.html#setting-and-passing-the-locale

(Python-3) How do you maintain the value of a variable that was changed by the program it was ran by? -

i trying build first gui application through python's standard tkinter. came grips computers coordinate system, , indeed found pan things out wish, came realisation drag , drop feature far superior specifying coordinates explicitly. close, have 1 major problem; whilst can keep value of coords of single widget in relation dragged last, cannot multiple widgets. this code have created far: from tkinter import * root = tk() class move_shape: data = {'x': 0, 'y': 0} canvas = canvas(width = root.winfo_screenwidth(), height = root.winfo_screenheight()) shape_coords = open('shape_coords.py', 'r') def __init__(self, shape, fill = 'white', *coords): new_coords = self.shape_coords.readline().split(',') if coords == (): coords = new_coords if shape == 'line': tag = 'line' self.id = self.canvas.create_line(coords, tags = tag, fill = fill) eli

java - variable may have not been initialized? -

so in while loop print elements of arraylist store. afterwards when call it, says array may have not been initialized. any thoughts? i'm trying read file of lines. each line has @ least 8 elements, , i'm sure array not empty because printed in while loop. ? public class readerfile { public static scanner input; public static scanner input2; /** * @param args command line arguments */ public static void main(string[] args) { int count=0; arraylist<team> store; arraylist<robot> store2; //robot robot; string filelocation = "tourney2teams.csv"; string filelocation2 = "tourney1robots.csv"; try{ input = new scanner(new file(filelocation)).usedelimiter(","); } catch (ioexception ioexception) { system.out.print("problem"); } try { input2 = new scanner(new file (f

graph - Time Complexity of modified dfs algorithm -

Image
i want write algorithm finds optimal vertex cover of tree in linear time o(n), n number of vertices of tree. a vertex cover of graph g=(v,e) subset w of v such every edge (a,b) in e, in w or b in w. in vertex cover need have @ least 1 vertex each edge. if pick non-leaf, can cover more 1 edge. that's why thought can follows: we visit root of tree, visit 1 of children, child of latter visited , on. then if have reached @ leaf, check if have taken father optimal vertex cover, , if not pick it. then, if vertex picked optimal vertex cover has other children, pick first of them , visit leftmost children recursively , if reach @ leaf , father hasn't been chosen desired vertex cover, choose , on. i have written following algorithm: dfs(node x){ discovered[x]=1; each (v in adj(x)){ if discovered[v]==0{ dfs(v); if (v->taken==0){ x<-taken=1; } } } } i thought ti

Swift: Retrieving object values from Parse.com based on another attribute -

so i'm trying retrieve information parse.com database based on attribute other objectid. more specifically, i'd retrieve object without using objectid can read address column. logic far: write query returns row restaurant name same 'resto'. (this i'm stuck) retrieve restaurant's address pfquery , assign string value addresslabel.text variable. here code have: class finalview: uiviewcontroller{ var resto = 'eddies cafe' var address:string! //var phone:string! @iboutlet var restolabel: uilabel! @iboutlet var addresslabel: uilabel! @iboutlet var phonelabel: uilabel! override func viewdidload() { super.viewdidload() //the below query returns 1 row var query = pfquery(classname: "restaurants") query.wherekey("name", equalto: resto) var obj = pfobject.getobjectwithid("i dont want this") address = obj["address"] as? string

Javascript functions and IE error addEventListener JQuery -

internet explorer last version show ugly alert addeventlistener, reading fixes here in case believe solution delete part of javascript code giving me problems 0 left javascript. here code , sure code has 2 or more funtions. first 1 drop down menu using jquery. seems last part addeventlistener maybe not necessary make drop down menu works. got drop down menu website buyed pre-made lots of funtions lmenu=$(".menu>ul>li");lmenu.find("ul").siblings().addclass("hasul").append('<span class="hasdrop iconoflecha icono-flecha"></span>');lmenulink=lmenu.find("a").not(".submenu a");lmenulinkall=lmenu.find("a");lmenusublink=lmenu.find(".submenu a").not(".submenu li");lmenucurrent=lmenu.find("a.current");if(lmenulink.hasclass("hasul")){$(this).closest("li").addclass("hassub")}lmenulink.click(function(a){$this=$(this);if($this.hasclass(&q

java - How to obfuscate with ProGuard but keep names readable while testing? -

Image
i'm in pre-release stage app started compiling release builds assemblerelease instead of assembledebug . obfuscation breaks things , it's hard decipher what's what. debugging impossible, line numbers kept variables classes unreadable. while release build not stable i'd make obfuscation less of pain, should still behave obfuscated. usually proguarded release converts names from net.twisterrob.app.pack.myclass to b.a.c.b.a with reflection , android layout/menu resources can break, if encountered classes didn't keep names of. it helpful pre-release testing able obfuscate code, "not much" , converting names from net.twisterrob.app.pack.myclass to net.twisterrob.app.pack.myclass // or n.t.a.p.mc or in between :) the proguard -dontobfuscate of course helps, makes broken stuff work again because class names correct. what i'm looking break broken full obfuscation, @ same time it's easy figure out what's without using mapping

SHA1 generate with range in terminal -

im trying generate sha1 hashes specified numeric range on terminal i tried this for in {1..100};do echo -n i(which ever word) | shasum -a 1 | awk '{print $1}'; doesnt seem working okay, proper answer instead of comment. for in {1..100}; echo -n ${i}ball | shasum -a 1 | awk '{print $1}'; done mind $ before i in particular. generally when in doubt echo , use printf instead ( -n isn't posix anyway). generally unexpected outputs pipes these, debug removing progressively more parts of pipe: in case dropping shasum , awk original line show it's printing e.g. "i i i" instead of "1 2 3 4 5".

android - Sound meter to measure Sound Pressure Level -

i using mediarecorder try create sound meter returns sound pressure level (what believe people mean when refer everyday volume in decibels). currently, using implementation values in decibels: return 20.0 * math.log10(math.abs(mmediarecorder.getmaxamplitude()) / 32768) i'm not sure if correct. sitting in room no noise other fan, returning values anywhere between -30 , -20. if speak near microphone, jumps values near -0.5 or so. reading many answers on website, seems is difficult , largely unreliable measure spl without calibrated devices. however, don't need highly accurate results, results applicable everyday curiousity , non-extreme situations. there apps such sensor box android , seem return decent results no calibration needed start. using in same room, returning results between 40-60db, , when speak jumps 80-90db range. how can duplicate these results? thank you! your first problem decibels isn't exact measurement- signal noise ratio. need b

android - How to make an AsyncTask to load Images into Gallery? -

i'm desperate issue in first android app (which published) because there section load imagegallery (the android tweak) 5 images, images files customized ldpi, hdpi , different sizes, problem app crashing in devices (specially on samsung galaxy s3, s4 , s5) don't know do, got error "out of memory" or in samsung galaxy s5, activity opened when tried scroll gallery moment of crash. the question how can make asynctask load images gallery , preventing outofmemory? the layout: <gallery android:id="@+id/instalaciones_gallery" android:layout_width="match_parent" android:layout_height="fill_parent" android:layout_below="@+id/arriba_fondo_instalaciones" /> the class: public class instalacionesactivity extends activity { integer[] imageids = { r.drawable.ins1, r.drawable.ins2, r.drawable.ins3, r.drawab

matlab - Problems with symsum() function in Symbolic Math Toolbox -

i'm having problems when using symsum function in matlab's symbolic math toolbox. code should returning: ans = sin(x) + x*cos(x) - x^2 / 2 * sin(x) i think has symbolic variables, i'm new matlab appreciated. here's code: syms x i; f(x) = sin(x); symsum(x^i/factorial(i)*diff(f,x,i), i, 0, 2) which returns 0 instead of correct result indicated above. this occurs because diff(f,x,i) evaluates zero. when using symsum , need aware that, matlab function, input arguments evaluated before being passed in. use for loop ( sym/diff not vectorized in third argument – see below): syms x y; f(x) = sin(x); n = 0:2; y = 0; = n y = y+x^i/factorial(i)*diff(f,x,i); end alternatively, try form (in case, 3 indexes, above more efficient): syms x y; f(x) = sin(x); n = 0:2; % increasing orders of differentiation y = diff(f,x,n(1)); yi = [y(x) zeros(1,length(n)-1)]; % index array, yi cannot symfun = 2:length(n) % calculate next derivative previous

java - How to split a string, including punctuation marks? -

i need split string (in java) punctuation marks being stored in same array words: string sentence = "in preceding examples, classes derived from..."; string[] split = sentence.split(" "); i need split array be: split[0] - "in" split[1] - "the" split[2] - "preceding" split[3] - "examples" split[4] - "," split[5] - "classes" split[6] - "derived" split[7] - "from" split[8] - "..." is there elegant solution? you need arounds: string[] split = sentence.split(" ?(?<!\\g)((?<=[^\\p{punct}])(?=\\p{punct})|\\b) ?"); look arounds assert , (importantly here) don't consume input when matching. some test code: string sentence = "foo bar, baz! who? me..."; string[] split = sentence.split(" ?(?<!\\g)((?<=[^\\p{punct}])(?=\\p{punct})|\\b) ?"); arrays.stream(split).foreach(system.out::println); output; foo bar , b