Posts

Showing posts from June, 2012

android - Multiple IntentServices running in parallel -

i have intent service in android app scheduled start every 1 minute. let me call intent service intentservicea.class now want use intentservice (intentserviceb.class) specific tasks. my question is: does intentserviceb goes in same thread of intentservicea? goes in queue? or perform separately? if goes in same thread, alternative? thank help. intentservicea , intentserviceb create separate threads. in other words intents sent intentservicea processed sequentially in 1 thread , intents sent intentserviceb processed sequentially in thread.

ngroute - What's the most concise way to read query parameters in AngularJS? -

i'd read values of url query parameters using angularjs. i'm accessing html following url: http://127.0.0.1:8080/test.html?target=bob as expected, location.search "?target=bob" . accessing value of target , i've found various examples listed on web, none of them work in angularjs 1.0.0rc10. in particular, following undefined : $location.search.target $location.search['target'] $location.search()['target'] anyone know work? (i'm using $location parameter controller) update: i've posted solution below, i'm not entirely satisfied it. documentation @ developer guide: angular services: using $location states following $location : when should use $location? any time application needs react change in current url or if want change current url in browser. for scenario, page opened external webpage query parameter, i'm not "reacting change in current url" per se. maybe $location isn't

Bold symbol in Matlab legend -

Image
i have plot in matlab following legend: h = legend('reference','$\hat{\theta}_2 = 5\theta_2$','$\hat{\theta}_2 = 10\theta_2$'); set(h,'interpreter','latex') now want make variables \theta bold faced use in latex report. i tried: h = legend('reference','$\hat{\mathbf{\theta}}_2 = 5\mathbf{\theta}_2$','$\hat{\mathbf{\theta}}_2 = 10\mathbf{\theta}_2$'); set(h,'interpreter','latex') unfortunately not working. for reason bold symbols possible tex interpreter , way can't use \hat{...} . need decide, if either want use bold symbols or hat , other latex-only stuff: x = 1:100; y1 = sin(x/2).^2; y2 = -sin(x/2).^2; f = figure(1); p(1) = plot(x,zeros(numel(x),1)); hold on p(2) = plot(x,y1); hold on; p(3) = plot(x,y2); hold on; h1 = legend(p(1:2),'reference','\bf{\theta}_2 = 5\cdot \theta_2'); set(h1,'interpreter','tex','location',

java - Why is there difference between out.println and err.println? -

system.class contains "out" , "err" object of printstream class. system.class declared static. println() overloaded method in printstream class have (out , err objects) if execute system.out.println("xys"); , system.err.println("fdfd"); they both should work same out , err objects of same class except fact don't. why out.println() prints in black , err.println() prints in red. because ide you're using prints stderr in red, , stdout in black. this has nothing java, , environment you're in–it's what's doing coloring, not java itself, doesn't care how output rendered.

c# - Merge two IEnumerables in elegant way -

i have 2 ienumerable variables, both can null. need merge them single list. here direct approach. var ienumerable1 = getenumerable1(); var ienumerable2 = getenumerable2(); if(ienumerable1 != null){ if(ienumerable2 != null){ return ienumerable1.union(ienumerable2); } return ienumerable1; } else{ return ienumerable2; } is there more elegant way in less lines of code this? just check null , assign enumerable.empty if null. can done in 1 step null coalescing operator ?? var ienumerable1 = getenumerable1() ?? enumerable.empty<whatevertype>(); var ienumerable2 = getenumerable2() ?? enumerable.empty<whatevertype>(); return ienumerable1.union(ienumerable2);

vba - Excel macro to combine two excel rows by matching two columns -

how can match names 2 columns , if same merge 2 lines. meaning if first_name , last_name same combine rows (since presumably same person). if other cells in row same want them combine. if different, want both values/strings saved leaving them both in combined cell comma between them. so this: first last number sign joe white 1122 scorpio joe white 1144 scorpio joe jones 11445 leo david white 112 virgo should turn this: first last number sign joe white 1122, 1144 scorpio joe jones 11445 leo david white 112 virgo since first 2 lines have match between joe white , joe white (both first , last name same) 2 lines combined. since number column has different values, combined in 1 cell comma delimitation. because sign, in case scorpio, same gets combined without listing both (duplicate) values. in case of third , fourth name, 1 of names matches (either white o

html - CSS rotate text but keep the vertical alignment -

i'm creating website use rotate , transform functions in css3. have under control, when rotate text, whole text rotates <p> block. want when rotating text, keeping left side of text in vertical alignment. it's hard explain words, refer website: active theorie (you can see rotate text -2 degrees, keep vertical alignment of texts.) i hope here can me out this. you can use either css "transform: skew" property e.g. .text { transform: skew(0,-10deg); } or if need perspective view can use "perspective" , "transform: rotatey" properties e.g. .parentdiv : { perspective: 500px; } .text: { transform: rotatey(30deg); } http://jsfiddle.net/yjo3aanr/

bash - Counter for variables combined into separate commands -

i need figure code following scenarios: i need set packagen , productn variables, should done via loop , counter suppose. based on how many packages , product run corresponding amount of commands. scenario 2 packages , 2 products: package1=packagea package2=packageb product1=producta product2=productb somecommand --package $package1 --product $product1 somecommand --package $package1 --product $product2 somecommand --package $package2 --product $product1 somecommand --package $package2 --product $product2 this complicated need example 10 packages 10 products , above code not optimal, believe there should easy way how eg: n=o while true; echo specify package name: read package$n echo have package? read yesno if [[ $yesno = n ]]; break else ((n++)) done the same loop product, don't know how build above commands based on how many variables have. packages=( package-1 package-2 packag

python - Filling a row in a csv file according -

here csv file want update python. has 3 columns: col1 = [1,2,3,4,5,6,7,8,9,10] col2 = [a, a, a, b, c, c, c, c, a, a] col3 = [] for each cell in col3 fill id number change when content of col2 changes. in example col3 = [1,1,1,2,3,3,3,3,4,4] anyone show me way ? in python 3: from itertools import groupby operator import itemgetter import csv open('f1.csv', newline='') f_in, open('f2.csv', 'w', newline='') f_out: reader = csv.reader(f_in) writer = csv.writer(f_out) i, (key, group) in enumerate(groupby(reader, key=itemgetter(1)), start=1): row in group: writer.writerow(row + [i]) if using python 2.7, change with-statement to with open('f1.csv', 'rb') f_in, open('f2.csv', 'wb') f_out:

Need help selecting muiltiple div id's in jquery -

i trying select multiple id's using jquery. following code wrote not working. var cat = $('.option_category').each(function() { var cat_id = cat.attr('id'); console.log(cat_id'); }); }); this should resolve issues. var cat = $('.option_category').each(function(){ var cat_id = $(this).attr('id'); console.log(cat_id); }); as aside, id attribute identification. not know implementation, however, if trying pass data through id , value parameter of option tag or data attributes. https://developer.mozilla.org/en-us/docs/web/guide/html/using_data_attributes

html - Bootstrap 3 Dropdown menu not fitting the width of content -

Image
i'm havng small problem dropdown menu. need width fit content inside content in css i'm using width: -ms-max-content; width: -webkit-max-content; width: -moz-max-content; width: -o-max-content; but it´s not working on ie, there method doing this? thanks get rid of pull-left classes on images, work without having use max-content . working bootply

google apps script - fill listbox when I select another listbox -

sorry code, try simplify in example explication. information of listbox depend of select in other listbox, can´t work. sorry bad english. here create form; function doget(){ var app = uiapp.createapplication().settitle('request form'); var flow = app.createflowpanel().setstyleattribute("textalign", "center").setwidth("900px"); var lreason = app.createlabel('select reason :'); var listreason= app.createlistbox().setname("listreason").additem("").additem("salud").additem("motivo personal"); var lfactor = app.createlabel('select factor :'); var listfactor= app.createlistbox().setname("listfactor").additem("select reason first").setid(listfactor); var handlerr = app.createservervaluechangehandler('factors'); handlerr.addcallbackelement(flow); listreason.addchangehandler(handlerr); var test1 = app.createlabel('nada

javascript - How to convert large JSON string into array with JQuery -

this question has answer here: access / process (nested) objects, arrays or json 15 answers i have json string looks this: [ { "id": "acbpreviewcell", "width": 80 }, { "id": "advname", "width": 170 }, { "id": "adheadline", "width": 150 }, { "id": "adsize", "width": 150 }, { "id": "adproduct", "width": 150 }, { "id": "adcategory", "width": 150 }, { "id": "adsection", "width": 150 }, { "id": "adcolor", "width": 150 }, { "id&qu

python - SQLAlchemy connection errors -

i'm experiencing strange bugs seem caused connections used sqlalchemy, can't pin down exactly.. hoping has clue whats going on here. we're working on pyramid (version 1.5b1) , use sqlalchemy (version 0.9.6) our database connectivity. errors related db connection or session, of time cursor closed or this connection closed error, other related exceptions too: (operationalerror) connection pointer null (interfaceerror) cursor closed parent instance <...> not bound session, , no contextual session established; lazy load operation of attribute '...' cannot proceed conflicting state present in identity map key (<class '...'>, (1001l,)) connection closed (original cause: resourceclosederror: connection closed) (interfaceerror) cursor closed parent instance <...> not bound session; lazy load operation of attribute '...' cannot proceed parent instance <...> not bound session, , no contextual session established; lazy load op

c++ - Smart unique pointer as a member variable -

this question has answer here: how initialize shared_ptr member of class? 1 answer i have class as: class largeobject { public: largeobject(); void dosomething(); private: std::unique_ptr<thing> pthing; }; then when want create pointer in constructor largeobject() { pthing(new thing()); //this not work. } i want use member variable throughout code. how that? i think initialization should in constructor's initialization list, that's place constructors should invoked constructor: largeobject() :pthing(new thing){}

Robocopy log file: Extra dir and an improbable match -

i have executed following command: robocopy.exe /e /zb /copy:dat /r:5 /w:7 /tbd /np /tee /log: the intended file copied, along other files had exact same name , residing in folder beneath source directory. appeared in output: options : /tbd /tee /s /e /copy:dat /zb /np /r:5 /w:7 *extra dir -1 \computer\path\to\file new dir 0 \computer\path\to\folder new dir 0 \computer\path\to\folder new dir 1 \computer\path\to\folder new file 1.5 m filename -output trimmed- total copied skipped mismatch failed extras dirs : 15 14 1 0 0 2 files : 4 4 0 0 0 0 i understand *extra dir stands for: “extra” file present in destination not source. can explain -1? two folders copied destination, without either of them containing file specified in command, or file name in path. not empty in

linux - .bash_profile ldapsearch function not outputting to terminal -

this question has answer here: difference between single , double quotes in bash 3 answers i have bash function in .bash_profile not returning results terminal. when run command normal via cli results returned. ldap_check_cleaup () { ldapsearch -lll -h itdsvbms.somedomain.org -p 389 \ -d "uid=someuser,o=somedomain.org" -w somepassword -b "ou=people,o=somedomain.org" \ -s sub '(&(reservedrmaliases=$1)(!(rmid=*))(rmaliasupdatedate=12/01/2012 19:02:00)(rmaliasstatus=in)(status=in))' | \ tee /dev/tty } running ldap_check_clenaup testrecord returns no output when executed bash prompt. testrecord exist , when following command run cli, correct record returned: ldapsearch -lll -h itdsvbms.somedomain.org -p 389 -d "uid=someuser,o=somedomain.org" \ -w somepassword -b "ou=people,o=somedomain.org&

javascript - IE10 only given me an 'Unable to evaluate expression' error when changing style -

i have following javascript function hide html tag: function object_hide_obj(objectid) { var objname=document.getelementbyid(objectid); if (objname) { objname.style.display = "none"; } } i have instance objname valid html <tr> tag. in ie10 (works fine on ie9, ie11, chrome, , safari) weird error on objname.style.display = "none"; . when try evaluate in console 'unable evaluate expression' error, , the browser crashes when reaches line. if debug, doesn't happen. know why? its bug in ie10 try install update kb2884101 first function object_hide_obj(objectid) { var objname=document.getelementbyid(objectid); if (objname) { objname.style.display = "none"; } } blockquote place html5 tag start of page , try <!doctype html> <table> <tr id="id0"> <td> line 0 <input type="button" o

php - Redirection of indexed dynamic urls -

i want make 301 redierects 1 urls urls. example this url //muscleathletes.com/index.php?page=videos&section=view&vid_id=100019 to //muscleathletes.com/?vid_id=100019 iam usin in .httacces rewriterule ^vid_id=([^/]+) index.php?page=videos&section=view&vid_id=$1&%{query_string} [r=301,l] but rule not working can help you can use rule in root .htaccess: rewriteengine on rewritebase / rewritecond %{query_string} ^vid_id=[0-9]+$ [nc] rewriterule ^/?$ index.php?page=videos&section=view [r=301,l,qsa]

ios - Retain Cycle Even when using Weak/Strong ARC Semantics -

`i admit not expert on arc , retain cycles though through research , great articles (like this ), believe basics. however, stumped. have property defined follows. @property (nonatomic,retain) foo *foo; inside init , following. if(self = [super init]) { _foo = [[foo alloc] initwithdelegate:self]; // async rest __weak typeof(self) weakself = self; dispatch_async(dispatch_get_global_queue(dispatch_queue_priority_default, (unsigned long)null), ^(void) { __strong typeof(weakself) strongself = weakself; if (strongself.foo != nil) { [strongself.foo runtests]; } }); } return self; } and here dealloc - (void)dealloc { _foo = nil; } if dispatch_aync block commented out, see foo dealloc called after foo set nil . block commented in, foo's delloc not called. i've got retain cycle correct? idea how? no, not have retain cycle (now known &qu

windows - CMD Assigning variable to file name in folder -

i looking way assign filename variable based on wildcard. have far: cd y:\filelocation\filename1.txt %%a y:\filelocation\filename1*.txt set claims= %~ni not sure if can point file , grab attributes specific file , assign file name. or how can go doing this. need use wildcard since file name can have datestamp, root of file name remain same. what works me syntax: %%a in (d*.lnk) set claims=%%~na so change code match works, read... cd /d "y:\filelocation" %%a in ("y:\filelocation\filename1*.txt") set "claims=%%~na" changes made were: 1) added key-word "in" 2) added parenthesis around file specification 3) added key-word "do" , removed new-line 4) changed "%~ni" "%%~na"

mex - Matlab 2012a with Windows SDK 7.1 -

i trying setup mex compiler. on windows 8 visual studio 2012 , matlab 2012a. i have downloaded windows sdk 7.1 , installed: but when try to: mex -setup it says: no supported sdk or compiler found on computer. list of supported compilers, see http://www.mathworks.com/support/compilers/r2012a/win64.html any thoughts? the windows sdk 7.1 on list of supported compilers, valid question. i think might this bug , have run compilers removed ( details ms )! check out here too . patch on microsoft's website . see this support article tips on how download , configure sdk matlab. maybe confirm compilers selected in installation.

c# - Get underlying entity object from entity framework proxy -

i have entity getting dbentityentry.entity . returns entity framework proxy entity. how access underlying object it's original type instead of proxy? alternatively need dynamically try cast proxy entity type. here's start.. var theentitytype = entityentry.entity; if (theentitytype.basetype != null && entitytype.namespace == "system.data.entity.dynamicproxies") theentitytype = entitytype.basetype; // need cast correct type var entityobject = (theentitytype)entityentry.entity; // won't work because `theentitytype` dynamic. // entites don't implement iconvertible first should there no underlying object. proxy doesn't wrap entity object (decorator pattern), derives (inheritance). can't unwrap entity, can convert proxy base object. conversion (contrary casting) creates new object. for conversion, can exploit fact of time, way proxies returned ef, compile time type of proxy base type. is, if proxy entered argument ge

html - get the value of input element and display it in php page -

i have form <form method="post" action="file.php"> <input type="button" name="one" value="1"> </input> <input type="button" name="two" value="2"> </input> <input type="submit"> </input> </form> how can value of input , display value in php page?i tried in way don't work.how can this? $_post[nameofinput] you cannot send buttons' values. use radio fields, example: <input type="radio" name="choice" value="1" /> <input type="radio" name="choice" value="2" /> or can use dropdown too: <select name="choice"> <option value="1">option 1</option> <option value="2">option 2</option> </select> then in php: echo $_post['choice']; // possible results: null/1/2

osx - Need sample code to swing needle in Cocoa/Quartz 2d Speedometer for Mac App -

i'm building run on mac, not ios - quit different. i'm there speedo, math of making needle move , down scale data input eludes me. i'm measuring wind speed live, , want display gauge - speedometer, needle moving windspeed changes. have fundamentals ok. can - , - load images holders, later. want working ... - (void)drawrect:(nsrect)rect { nsrect myrect = nsmakerect ( 21, 21, 323, 325 ); // set graphics class square size match guage image [[nscolor bluecolor] set]; // colour in in blue - because can... nsrectfill ( myrect ); [[nsgraphicscontext currentcontext] // set graphics context setimageinterpolation: nsimageinterpolationhigh]; // highres image //------------------------------------------- nssize viewsize = [self bounds].size; nssize imagesize = { 320, 322 }; // actual image rectangle size. can scale image here if like. x , y remember nspoint viewcenter; viewcenter

mapping - Drive won't map in Java if there is whitespace in name -

i'm trying map drive in java. code runs fine, drive isn't mapped. zing = "m: \\\\ds-file2-2\\quality archive"; string command = "c:\\windows\\system32\\net.exe use " + zing; process p = runtime.getruntime().exec(command); i've tried map other folders on server , work. i've tried mapping drive in windows , works. tried mapping folder spaces , failed. thought quotes capture space in name. no errors occur. thanks in advance! your issue want quotes surrounding string appear when command executed. aren't adding quotes. in current state, command c:\\windows\\system32\\net.exe use m: \\\\ds-file2-2\\quality archive . assume want c:\\windows\\system32\\net.exe use "m: \\\\ds-file2-2\\quality archive" . in case, change zing zing = "\"m: \\\\ds-file2-2\\quality archive\"". escaping quotes with \" , , thus command becomes c:\windows\system32\net.exe use "m: \\ds-file2-2\quality archiv

openembedded - How to insert module into ARM which use kernel from open embedded -

i'm trying insert module.ko on arm use kernel customized open embedded. know how can achieve that. insmod , modprobe commands works or should create recipes ? actually, have ve tried first 1 (insmod) module behave strangely. also, if solution second option, how can add recipes external module inside open embedded ? best regards, what trying do? if you're trying load module "module.ko", yes, standard tools insmod , modprobe should using. there's possibility of auto-loading module upon boot. if you're trying build external module , integrated image, need @ writing recipe module , adding image recipe.

javascript - Using jQuery Selectors Passed as URL Parameter - Safe? -

i have need pass selectors jquery using url parameters. like: page.php?sel=li.current,%23active,a[href=%27string%27] those echoed out php like: $('<?=$request[sel]?>').funct(); my questions are: 1) security risk? 2) if risk is, how can safely this? the jquery code doesn't other manipulate css of elements defined selector. thank you no, not safe. it's vulnerable xss attack vector . for example, sel=');alert('xssd')$(' alert show on user's screen. allow attackers execute arbitrary javascript. can execute code log them out or perform actions them on website, or show prompt asks them password revalidation.

c++ - How to pass vector as function argument to pointer -

this question has answer here: how convert vector array in c++ 7 answers i try pass vector function argument pointer compiler return error. error: cannot convert 'std::vector' 'float*' in assignment when have passed array in same way works perfectly. wrong here? possible assign vector pointer? vector <float> test; class data { float *pointer; int size; public: void init(vector <float> &test, int number); }; void data::init(vector <float> &test, int number) { size= number; pointer = test; } if want pointer array managed vector, that's pointer = test.data(); // c++11 or later pointer = test.empty() ? null : &test[0]; // primeval dialects beware invalidated if vector destroyed, or reallocates memory.

import - R read.csv "More columns than column names" error -

i have problem when importing .csv file r. code: t <- read.csv("c:\\n0_07312014.csv", na.string=c("","null","nan","x"), header=t, stringsasfactors=false,check.names=f) r reports error , not want: error in read.table(file = file, header = header, sep = sep, quote = quote, : more columns column names i guess problem because data not formatted. need data [,1:32] . others should deleted. data can downloaded from: https://drive.google.com/file/d/0b86_a8ltyol3vxjym3nvdmnpmuu/edit?usp=sharing thanks much! that's 1 wonky csv file. multiple headers tossed (try pasting csv fingerprint ) see mean. since don't know data, it's impossible sure following produces accurate results you, involves using readlines , other r functions pre-process text: # use readlines data dat <- readlines("n0_07312014.csv") # had fix grep errors sys.setlocale('lc_all','c') # filter o

python - Django 1.8 TypeError: int() argument must be a string or a number, not 'datetime.date' -

i learning use django , error when "migrate". using datetimefield error: operations perform: apply migrations: admin, contenttypes, sessions, auth, principal running migrations: applying principal.0002_auto_20140910_1459.../library/python/2.7/site-packages/django-1.8.dev20140910084412-py2.7.egg/django/db/models/fields/__init__.py:1350: runtimewarning: datetimefield producto.tiempo_registro received naive datetime (2014-09-10 00:00:00) while time zone support active. runtimewarning) traceback (most recent call last): file "manage.py", line 10, in <module> execute_from_command_line(sys.argv) file "/library/python/2.7/site-packages/django-1.8.dev20140910084412-py2.7.egg/django/core/management/__init__.py", line 336, in execute_from_command_line utility.execute() file "/library/python/2.7/site-packages/django-1.8.dev20140910084412-py2.7.egg/django/core/management/__init__.py", line 328, in execute self.fetch_comma

Google Maps Engine Linked KML with Labels from Google Maps Engine Pro -

i have maps engine pro account , maps engine account. have exported kml in maps engine pro account, , linked maps engine account. however, labels gone. don't know did wrong. exported , added linked kml in maps engine account. is there other method export labels included? my maps engine pro map: https://mapsengine.google.com/map/edit?mid=zw7uognv7gvo.kua1rc-lcusi my maps engine map (kml linked pro): https://mapsengine.google.com/17062274333601359731-05414812628978701557-4/mapview/?authuser=0 as can see, have labels in m maps engine pro. if check in maps engine, doesn't show anymore.

Vagrant up fails with Laravel: 'The SSH command responded with a non-zero exit status' -

new laravel , vagrant, never put virtual machine way other via mamp. new using terminal in general. running on mac osx 10.9. vagrantfile (and laravel) placed in folder in documents. receiving error: the ssh command responded non-zero exit status. vagrant assumes means command failed. output command should in log above. please read output determine went wrong. log since 'vagrant up' used vagrant files update: when accessing designated vm address through browser, greeted 403 forbidden edit: link terminal log updated after fixing laravel installation issues regarding mcrypt. update: tried solution described here adding following /etc/sudoers . problem not fixed. vagrant all=(all) nopasswd:all defaults:vagrant !requiretty the artisan file isn't there. php artisan migrate #fails i can't tell should in /var/www, seems me laravel isn't getting set properly. try vagrant ssh snoop around in /var/www (ls /var/www) , see what's there/wh

sql - Whats the error in this mysql syntax? -

i pretty new forthe world of mysql. i'm trying create procedure decide class of student his/her gpa. gave them cregno going 1 10 @ time. here's code: mysql> delimiter // mysql> create procedure decideclass () -> begin -> declare count int; -> declare max int; -> set count = 1; -> set max = 10; -> declare fclass char(18) default 'first class honors'; -> declare supper char(34) default 'second class honors-upper division'; -> declare slower char(34) default 'second class honors-lower division'; -> declare tclass char(18) default 'third class honors'; -> while count <= max -> declare gpa decimal(3,2); -> set gpa = (select gpa student cregno = count); -> if gpa >= 3.7 -> update student set class = fclass cregno = count; -> else if gpa < 3.7 , gpa >= 3.3 -> update student set class = supper cregno = count; ->

javascript - Angular-UI-Router not working properly -

so, today added angular-ui-router webapp. however, it's showing weird behaviour. used display current page in ui-view . page in page. now, it's working correct, doesn't show subpages , can't seem figure out why. main page <!doctype html> <html lang="en" ng-app="exampleapp"> <head> <meta charset="utf-8"> <title>example app</title> </head> <body> <div> <div ui-view></div> </div> <!-- angular --> <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.4/angular.js"></script> <!-- ui-router --> <script src="//angular-ui.github.io/ui-router/release/angular-ui-router.js"></script> <!-- main app file --> <script src="/js/main.js"></script> </body> </ht

android - How to set custom list view item's height? [Solved] -

there lot of questions no 1 me. have tried in class adapter view.setminimumheigth(minheigth) didn't work. tried view view = inflater.inflate(r.layout.list_note_item,parent); app crashed; 1 close enough : view view = inflater.inflate(r.layout.list_note_item,parent,false); items had same height showed first textview , not second. how can this? here's list_item xml layout file <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="@dimen/note_item_heigth" android:orientation="vertical" > <textview android:id="@+id/textview_title" android:layout_width="match_parent" android:layout_height="wrap_content" android:textcolor="#000000" android:background="#ffffff" android:textsize="16sp" /> <textview android:id=&qu

c# - Move Files That Do Not Exist -

i need copy files local hard drive external hard drive. thought is, want copy files not exist. sure there easier way such, mind went first. my thoughts on how accomplish this: 1) list of files on c: drive , write text file 2) list of files on l: drive (backup) , write text file 3) compare c: drive text file l: drive text file find files not exist 4) write results of files not exist array 5) iterate through newly created array , copy files l: drive is there more effective/time efficient way accomplish task? for sure don't want create text files listing file names, , compare them. inefficient , clunky. way walk through source directories looking files. go, you'll creating matching destination path each file. before copy file need decide whether or not copy it. if file exists @ destination path, skip copying. some enhancements on might include skipping copying if file exists , last modified date/time , file size match. , on, i'm sure can imagine vari

makefile - Can't compile simple code with SDCC for pic on debian -

i'm trying compile following code sdcc, in debian using vim , makefile: void main(void) { } yes, simple, it's not working yet. i'm using makefile : # gnu/linux specific make directives. # declare tools. shell = /bin/sh cc = sdcc ld = gplink echo = @echo mcu = 16f88 arch = pic14 cflags = -m$(arch) -p$(mcu) ldflags = -c -r -w -m /usr/share/sdcc/lib/$(arch)/ executable = t1 sources = test2.c objects = $(sources:.c=.o) cleanfiles = test2.o test2.asm test2.map test2.lst .suffixes: .c .o .phony: clean # compile all: $(executable) .c.o: $(at) $(cc) $(cflags) -o $*.o -c $< $(executable): $(objects) $(at) $(ld) $(ldflags) $(objects) -o $(executable) clean: $(at) rm -rf $(cleanfiles) after of output after running makefile is: sdcc -mpic14 -p16f88 -o test2.o -c test2.c gplink -c -r -w -m /usr/share/sdcc/lib/pic14/ test2.o -o t1 make: *** [t1] segmentation fault i have tried more complex code same result, can't see what's wrong,

DotNetNuke - Upgrading Community Edition (CE) to Enterprise Edition (EE) -

i have website in dnn community edition (version 7.3.2). need upgrade website enterprise edition. have tried searching (read googling) steps , protocols followed achieve this. however, search results, blogs , online documentation have encountered far seem pertaining upgrading community edition (ce) professional edition (pe) or professional edition (pe) enterprise edition (ee). based on understanding, feeling have upgrade professional edition in order able upgrade enterprise edition (ee). so can tell me possible upgrade community edition enterprise edition straightaway or have go through installation of professional edition? you perform same steps upgrade pe. no need upgrade pe ee. backup (files/database) download ee upgrade package extract ee upgrade package (make sure unblock zip if you're using windows compression extract) copy files upgrade extraction on existing ce location. side note: late, need enterprise edition?

matlab - Efficient way to apply arrayfun to a matrix (i.e. R^N to R^M) -

i have function transforms r^n r^m. simplicity, lets let identity function @(z) z z may vector. want apply function list of parameters of size k x n , have map k x m output. here attempt: function out_matrix = array_fun_matrix(f, vals) i=1:size(vals,1) f_val = f(vals(i,:)); if(size(f_val,1) > 1) %need stack rows, convert required. f_val = f_val'; end out_matrix(i,:) = f_val; end end you can try with array_fun_matrix(@(z) z(1)^2 + z(2)^2 + z(3), [0 1 0; 1 1 1; 1 2 1; 2 2 2]) the question: there better , more efficient way vectorization, etc.? did miss built-in function? examples of non-vectorizable functions: there many, involving elaborate sub-steps , numerical solutions. trivial example looking numerical solution equation, in term using numerical quadrature. i.e. let params = [b c] , solve a such int_0^a ((z + b)^2) dz = c (i know here calculus, integral here stripped down). implementing example,

java - Why cant I close HibernateSessionFactory and reopen it and it still work? -

i'm having problem closing hibernate session factory, application allows user recreate database, when want firstly close hibernate session factory free hibernates grip on database. public static void closefactory() { if(factory != null) { factory.close(); } } then wait few seconds seems help thread.sleep(10000); then recreate database, (fwiw regular hibernate , envers - need create factory envers tables created), , close factory down again. public static void recreatedatabase() { configuration config; config = hibernateutil.getinitializedconfigurationandrebuildaudittables(); new schemaexport(config).create(true, true); factory = config.buildsessionfactory(); factory.close(); factory=null; } but when test session with: public static session getsession() { if (factory == null) { createfactory(); } session hibernatesession = factory.opensession(); return hibernatesession; } and try

bash - Convenience script for renaming commit authors with git-filter-branch -

for convenience, in post runnable bash command. i have following script based off of github's own : cat <<eof > git-unite #!/usr/bin/env bash # usage: # # git-unite "user name" "new@email.com" \ # "old1@email.com" \ # "old2@email.com" \ # ... name="$1" email="$2" git config user.name "$name" git config user.email "$email" shift 2 old_email in $*; echo "changing $old_email" git filter-branch --force --env-filter ' if [ "$git_committer_email" = "$(echo $old_email)" ] export git_committer_name="$(echo $name)" export git_committer_email="$(echo $email)" fi if [ "$git_author_email" = "$(echo $old_email)" ] export git_author_name="$(echo $name)" export git_author_email="$(echo $email)" fi ' --tag-name-filter cat -- --branches --tags done eof chmod u+x g

html - Twitter Bootstrap with tiles centered -

i creating app using bootstrap house tile style. new web designing , bit struggling these tiles arranged. requirement is, place 4 tiles inside carousel such each slide should contain 4 tiles. i tried using col-cm-6 divide container equally. tile stays left aligned. <div class="container"> <div class="row"> <h1>sample tiles using bootstrap classes</h1> <div class="row"> <div class="col-sm-6"> <a href="#" title="image 1"> <img src="//placehold.it/250x250" class="thumbnail img-responsive danger" /></a> </div> <div class="col-sm-6 "> <a href="#" title="image 1"> <img src="//placehold.it/250x250" class="thumbnail img-res

javascript - Write conditional statement for a range (3 < x < 9) -

how should write if statement true given range e.g. return true x if (3 < x < 9) ? if ((mynum > 3) || (mynum < 9)) { document.getelementbyid("div").innerhtml = "<button>hello world</button>"; } use correct operator || or operator, use and operator && if ((mynum > 3) && (mynum < 9)) { document.getelementbyid("div").innerhtml = "<button>hello world</button>"; } cheers !!

python - SyntaxError: EOL while scanning string literal: TOTEM -

this question has answer here: why can't end raw string backslash? [duplicate] 4 answers we have create totem pole using strings consisting of 13 characters wide. each head must have different characteristics. of functions characteristics below. however, when ran code gave me syntax error above. import random def hair_spiky(): return"/\/\/\/\/\/\/" def hair_middlepart(): return"\\\\\\ //////" def eye_crossed(): a1= r" ____ ____" a2= r"/ \ / \" a3= r"| o| |o |" a4= r"\____/ \____/" return a1 +"\n" + a2 + "\n" + a3 + "\n" a4 def eye_left(): a1=r" ____ ____" a2=r"/ \ / \" a3=r"|o | |o |" a4=r"\____/ \____/" you

javascript - Angular with SVG graphics -

i new angular js. , can not understand why angular can not work <svg> . when try make svg elements active angular, see errors in console: example in directive have following template: <svg xmlns='http://www.w3.org/2000/svg' class='svgtime'>\ <path stroke='#fff' stroke-width='5' d='m {{radius+line_size}} 2.50000119262981 {{radius+line_size-2.5}} {{radius+line_size-2.5}} 0 1 1 {{radius+line_size-0.1}} 2.500055466403296 z' fill='transparent'></path> <path fill='transparent' stroke='#9bc7f2' stroke-width='2' ng-attr-d='m 60 2 58 58 0 0 1 77.83716831288882 5.497827994417321'></path> set radius variables in scope of directive, code not works. console indicates have invalide value d attribute of path element. tryed ng-attr-d suggested in official doc angular directives, not worked too? why happens. special in svg elements. think connected how angular replace

java - Method's parameters -

i've started learning android development + beginner @ this. i don't how/where, in case below, parameter of method in instantiated. public class mainactivity extends activity { @override protected void oncreate(**bundle savedinstancestate**) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); radiogroup group1 = (radiogroup) findviewbyid(r.id.orientation); group1.setoncheckedchangelistener(new radiogroup.oncheckedchangelistener() { @override public void oncheckedchanged(**radiogroup group**, int checkedid) { switch (checkedid) { case r.id.radiobutton2: group.setorientation(linearlayout.horizontal); break; case r.id.radiobutton1: group.setorientation(linearlayout.vertical); break; } } }); } thanks help radiogroup.oncheckedchangelistener interface, , creating annonymouse inner class on your: //take note @ key

sql server - SQL join to correlated subquery where tables are related by overlapping ranges -

Image
i have following table structure: item id | name -------- 1 | apple 2 | pear 3 | banana 4 | plum 5 | tomato event itemstart | itemend | eventtype | eventdate -------------------------------------------- 1 | 2 | planted | 2014-01-01 1 | 3 | picked | 2014-01-02 3 | 5 | eaten | 2014-01-05 the 2 tables linked primary key of item , range of itemstart , itemend (inclusive) in event. events refer contiguous sequences of items, not events given item have same range. events never occur on same date given item. the query i'd produce follows: list items, , each item show recent event sample output: id | name | event | date ---------------------------- 1 | apple | picked | 2014-01-02 (planted picked) 2 | pear | picked | 2014-01-02 (planted picked) 3 | banana | eaten | 2014-01-05 (picked eaten) 4 | plum | eaten | 2014-01-05 (eaten) 5 | tomato | eaten | 2014-01-05 (eaten) this seems reasonabl

Better way to order call methods inside method -

let's supose following piece of code: private void createdependencies() { inject(afake.class, whatevera()); inject(cfake.class, whateverc()); inject(bfake.class, whateverb()); inject(dfake.class, whateverd()); // ... , 200 more } which better way order alphabetically createdependencies->inject(...) methods, have following result? private void createdependencies() { inject(afake.class, whatevera()); inject(bfake.class, whateverb()); inject(cfake.class, whateverc()); inject(dfake.class, whateverd()); // ... , 200 more } maybe bash script? maybe creating hole (and boring) java project , using sorting algorithm? after several time searching easy way this, best/easy way (for me): copy content of createdependencies() method file, let's aux.txt . save it. open vim , run: :%s/,\n/, /g :%sort :x now copy content of aux.txt

Access array returned by a function in php -

i'm using template engine inserts code in site want it. i wrote function test quite easy: myfunction() { return '($this->data["a"]["b"] ? true : false)'; } the problem is, $this->data private, , can't access everywhere, have use getdata(); causes problem. $this->getdata()['a']['b'] does not work, , assigning value first doesn't either because used directly in if() block. any ideas? since php 5.4 it's possible that: getsomearray()[2] reference: https://secure.php.net/manual/en/language.types.array.php#example-62 on php 5.3 or earlier, you'll need use temporary variable.