Posts

Featured post

hadoop - How to count the different values in a column in Pig and Hive -

i have data file below indicates order valid or invalid. want calculate count of valid orders , count of invalid orders. 1,flipkart,pepsi,invalid 2,flipkart,tshirt,valid 3,flipkart,shirt,valid 4,amazon,shoe,valid 5,amazon,beer,invalid 6,flipkart,jewels,valid 7,flipkart,coke,invalid so final output should how many number of valid , invalid records totally eg : valid : 7 , invalid 3 in flipkart, how many valid , invalid records , in amazon how many valid , invalid records. eg : flipkart : valid 3 , invalid : 2 amazon : valid 1 , invalid : 1 in pig - groupby , foreach assuming column names id,name,pp,state bynamestate = group my_data (name, state); bynamestatecounts = foreach bynamestate generate count(my_data) ccc;

How to read a binary file using Fortran and save to a text file? -

i have binary file following information: ifile.dat big_endian sequential, nx=530, ny= 427, t=1, 4 variables i read fortran program , write text file. trial f90 program is: bin_read.f90: integer,parameter :: nx=530, ny=427 real :: v1(nx,ny),v2(nx,ny),v3(nx,ny),v4(nx,ny) open(10, file= 'ifile.dat', form = 'unformatted', & &access='sequential',convert='big_endian') open(11, file= 'ofile.txt', form = 'formatted', & &status='unknown') j = 1, ny = 1, nx read(10,*)v1(i,j),v2(i,j),v3(i,j),v4(i,j) write(11,1)v1(i,j),v2(i,j),v3(i,j),v4(i,j) 1 format(4(1x,f8.3)) enddo enddo stop end when execute after compilation, getting following message: at line 11 of file bin_read.f90 (unit = 10, file = 'ifile.dat') fortran runtime error: format present unformatted data transfer

get - Servlet and path parameters like /xyz/{value}/test, how to map in web.xml? -

does servlet support urls follows: /xyz/{value}/test where value replaced text or number. how map in web.xml? it's not supported servlet api have url pattern wildcard * in middle of mapping. allows wildcard * in end of mapping /prefix/* or in start of mapping *.suffix . with standard allowed url pattern syntax best bet map on /xyz/* , extract path information using httpservletrequest#getpathinfo() . so, given <url-pattern>/xyz/*</url-pattern> , here's basic kickoff example how extract path information, null checks , array index out of bounds checks omitted: string pathinfo = request.getpathinfo(); // /{value}/test string[] pathparts = pathinfo.split("/"); string part1 = pathparts[1]; // {value} string part2 = pathparts[2]; // test // ... if want more finer grained control possible apache httpd's mod_rewrite , @ tuckey's url rewrite filter .

ASP.NET Hyperlinks asp:HyperLink vs A href -

in asp.net when should use: <asp:hyperlink id="home" runat="server" text="home" navigateurl="./home.aspx"> and when shoudl use <a href="./unsignedvssignedtut.aspx">home</a> ? asp.net server controls give more abilities (e.g. event handling, more properties). html controls on other hand simpler. both controls fine. can start html control , migrate asp:hyperlink if need later. you can @ these discussions: asp control vs html control asp.net control vs html control performance

javascript - Two-dimensional string array creation -

this question has answer here: array.prototype.fill() different fill go 1 answer array.prototype.fill() object passes reference , not new instance 2 answers i'm trying create two-dimensional array of 1-character strings in javascript way: var panel = new array(3).fill(new array(3).fill('*')); result is [ ['*', '*', '*'], ['*', '*', '*'], ['*', '*', '*'] ] after need replace middle string: panel[1][1] = '#'; and result is [ ['*', '#', '*'], ['*', '#', '*'], ['*', '#', '*'] ] so seems prototype fill function fills array object reference. is possible force fill function fill a

oracle9i - Oracle select count(*) into n generates ORA-01401 inserted value too large for column -

i have spent hours tracking down source of bug , stumped. managed determine below simple select statement problem (comment , not error.. yes, it's cause). n defined number, tried integer grins. n integer; n := 1; select count(*) n category ( upper(ltrim(rtrim(category_long_name))) = upper(ltrim(rtrim(cat_long_name))) or upper(ltrim(rtrim(category_short_name))) = upper(ltrim(rtrim(cat_short_name))) or upper(ltrim(rtrim(category_description))) = upper(ltrim(rtrim(cat_descr))) ) , (settings_setting_id = sett_id) , (category_id <> cat_id); when code executed, ora-01401: inserted value large column . "insert" n value row count. actual value (used debugger) 0. i don't understand how causing problem. i've seen select count(*) x code snippet in examples. procedure runs fine statement commented out. time 'n' used in next step raise , exception if it's > 0. i've literally commented

Android MVP - How to communicate between activity presenter and fragment presenter -

i have activity 3 fragments, use viewpager. want implement mvp , communicate between activity presenter , fragment presenters i.e: passing data activity presenter fragment presenters sending event fragment presenters activity presenter ... but don't know how in official way. can use busevent don't think it's practice. as per understanding, usecase, suppose activitya have viewpager having 3 fragments(fragmenta, fragmentb, fragmentc). activitya have activitypresentera fragmenta have fragmentpresentera as per mvp, fragmentpresentera should responsible logical , business flows of fragmenta , should communicate fragmenta only. therefore, fragmentpresentera can not directly communicate activitypresentera. for communication fragment activity, presenter should not involved , should done communicate in non-mvp architecture, i.e. of interface. same applies activity fragment communication. for communication between activity , fragment read here