Posts

Showing posts from March, 2011

javascript - IFrame get parameters from parent url on different domain -

it seems not possible default because error blocked frame origin x accessing frame origin y. know because of security allow partners integrate iframe. iframe on domain mysubdomain.mysite.com , contains search box. once user has made search has been redirected page partners-domain-containing-search-results.com search results on domain mysubdomain.mysite.com , read parameters url (hash , query string parameters) can't because can't read parent url parameters (from partners-domain-containing-search-results.com ). you should able use top.location subdomain.mysite.com read parent urls of partners-domain-containing-search-results.com: e.g. iframe hosted on mysubdomain.mysite.com , embedded in partners-domain-containing-search-results.com?hello=true#blabla should able run: top.location.hash >"#blabla" top.location.search >"?hello=true" note: cannot modify other domain's location object or see: uncaught securityerror: blocked fram...

memory - How can I write code to purposefully eat up RAM and CPU resources? -

i have written code in ruby , c before has accomplished similar purposes, think situation bit trickier now. said, need purposefully write code ties resources on machine, , measure , when these events happen. are there libraries/modules out there this, , if not, best way accomplish this? should flood processor huge numbers , make try find primes? should shoot tons of packets 1 of machines , wait till crashes? i have spent past 2 days writing code accomplish various tasks related this, i'm dissatisfied because when accomplish task, can't real data out on where, why, , when these events happening. suggestions appreciated. please consider using stress utility in linux. i'm assuming linux system. either way, "stress" allows target subsystem of choice , load accordingly.

python - Concatenating strings containing many quotations results in slashes in output -

i trying build string needs contain specific double , single quotation characters executing sql expression. i need output formatted this: " "full_stree" = 'allendale rd' " where value of allendale rd variable defined through loop. in following code sample, variable tos trying pass query variable. tos = "allendale rd" query = '" "full_stree" = ' + "'" + tos + "' " + '"' and when print value of query variable output: '" "full_stree" = \'allendale rd\' "' the slashes causing query fail. tried using modulus operator pass value of tos variable, same results: where = '" "full_stree" = \'%s\' "' % (tos) print '" "full_stree" = \'allendale rd\' "' how can string concatenated correct format, leaving slashes out of expression? what seeing repr of string. ...

c# - Issue with ScriptCam in MVC4 -

im trying use scriptcam https://www.scriptcam.com/demo_5.cfm mvc4 project. have downloaded files required , followed instructions on site. when go run application issue in google debugger (shown below)- http://localhost:9171/qr/webcamlogo.png 404 (not found) qr:145 uncaught typeerror: undefined not function qr:194 http://localhost:9171/qr/webcamlogo.png 404 (not found) swfobject.js:4 http://localhost:9171/qr/scriptcam.swf 404 (not found) now i've tried figure out how change path location of swf.file javascript experience week old. below view file...the rest of javascript files can got link provided above. qr.cshtml @{ viewbag.title = "webcam"; } <script language="javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script language="javascript" src="//ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script> <script la...

ruby on rails - Factory girl conflict between field names with association -

for legacy reasons, have model in rails 2 fields: city , city_id . city string city name. city_id reference city object. how should declare factory factory_girl? i populate both city_id , city this: factory :address street "street x" city #uses city factory city "mycity" #uses legacy city end but not possible. how differentiate between these 2 city fields? as per the docs , can use implicit association when you're following normal conventions. case need use explicit call association method. in example below, replace :replace_this whatever belongs_to association in model called: factory :address street "street x" association :replace_this, factory: :city #uses city factory city "mycity" #uses legacy city end

jquery - Multiple issues with pushstate: history, loading, calling functions -

i have script pulling data via ajax/pushstate; works relatively well, there issues i'm running into. first , foremost, here code i'm using: function goto(href) { $.ajax({ url: href, success: function(data) { $('#wrapper').fadeout('fast', function(){ $(this).html(data).fadeto('fast', 1); $(".scroll").nicescroll({cursorcolor:"#f33d39", cursorwidth: "10px", cursorborder: "none", cursorborderradius: "0px", fixed: true}); }); // update page title var title = $('#page-right').find('h1').text(); $('head').find('title').text(title); } }); } if (typeof history.pushstate !== "undefined") { var historycount = 0; $('a[href*="rage.rage-wrestling.com"]').live('click',function(){ var href = $(this).attr('h...

numpy - create a feature vector using pandas or python -

i have binary classifier takes 200 element input feature vector shown below [ id, v1, v2, ...,v190, v200, class] [ 7, 0, 0, ..., 0, 0, 0 ], [ 8, 0, 1, ..., 0, 0, 1 ], [ 9, 0, 0, ..., 0, 0, 1 ], for each element x may have set of attributes in v1-v200 sql = 'select x_id, x_attr elements x_hash = %s' cur.execute(sql, (x_hash,)) x1 = cur.fetchone() x1 # x1 returns id , list of attributes (123, [v2,v56,v200]) given output want create feature vector such 1 above, if attribute in list matches attribute in set v1- v200 set 1. [ id, v1, v2,...,v56,...,v190, v200, class ], [ 123, 0, 1,...,1,..., 0, 1, ? ], how can in pandas or python? first initializing pandas dataframe , building on example: df = pd.dataframe(none, columns=['v'+str(i) in range(1,201)]) sql = 'select x_id, x_attr elements x_hash = %s' cur.execute(sql, (x_hash,)) x1_id, features = ...

javascript - Telegram messenger colored box filled with the initials of the contacts -

Image
i developing chat website similar telegram( http://zhukov.github.io/webogram/#/im?p=u67212536_13900205441461158827 ) . can see in contacts section first letter of contact name taken , placed in colored box. attaching screenshot of question. have tried code, failing implement it. here code have written. using bootstrap make happen. know have add code li tag. sortedarray = eliminateduplicates(removedups); console.log(sortedarray); sortedarray.sort(); sortedarray = sortedarray.filter(emptyelement); for(r=0;r<sortedarray.length;r++){ var contact = $('#contact'); var display = $('#display'); var newcontact= $('<li><a href="#">' + sortedarray[r] + '</a></li>'); contact.append(newcontact); } you can see in image below initials of names displayed in colored circle. i have solution it. var contact = $('#contact'); var display = $('#display...

jsf - Clear input validation error from backing bean -

i have datatable cell editor. , want have (selected) rows editable. , when user uses cell editor, want perform input validation after value set. so use celledit event in data table , event handler trigger validation failure. <p:ajax event="celledit" listener="#{bean.oneditcell}" update=":formid:propertyselect" /> this works charm. if user enters invalid value, editor doesn't close , error message displayed. what doesn't work user inputting valid value afterwards. celledit event not trigger again since form in "input validation failure state". i have lost day trying resolve that: i want reset input validation when user sets new value - resetinput works buttons. couldn't working on value change. i didn't find how reset field javascript directly. if combine "onchange" event , "remotecommand" handler called in backing bean, cannot find uiinput call resetvalue() on it. <p:datatable id=...

ios - Adding UICollectionViewLayout programmatically issue -

i'm trying implements this library without using storyboard (first step implementing library) , because i'm creating uicollectionview programmatically. - (void)viewdidload { [super viewdidload]; // additional setup after loading view. //self.view.backgroundcolor = [uicolor whitecolor]; [self.view addsubview:self.collectionview]; [_collectionview registernib:[uinib nibwithnibname:@"mycell" bundle:nil] forcellwithreuseidentifier:@"cell3"]; [_collectionview setbackgroundcolor:[uicolor colorwithred:0.945 green:0.945 blue:0.945 alpha:1] ]; [_collectionview settransform:cgaffinetransformmakescale(-1, 1)]; rfquiltlayout* layout = (id)[_collectionview collectionviewlayout]; layout.direction = uicollectionviewscrolldirectionvertical; layout.blockpixels = cgsizemake(100, 100); } - (uicollectionview *)collectionview { if (!_collectionview) { cgrect collectionviewframe = self.view.bounds; collect...

How to remove duplicated (by name) column in data.tables in R? -

while reading data set using fread , i've noticed i'm getting duplicated column names, example ( fread doesn't have check.names argument) > data.table( x = 1, x = 2) x x 1: 1 2 the question is: there way remove 1 of 2 columns if have same name? how about dt[,unique(names(dt)),with=false] ? ?data.table : j: single column name, single expresson of column names, ‘list()’ of expressions of column names, expression or function call evaluates ‘list’ (including ‘data.frame’ , ‘data.table’ ‘list’s, too), or (when ‘with=false’) vector of names or positions select. this selects first occurrence of each name (i'm not sure how want handle this). as @davidarenburg suggests in comments above, use check.names=true in data.table() (however, don't see check.names option in fread() -- maybe i'm missing something).

cordova - How can I pause audio when an Android app is suspended - Edge Animate and PhoneGap Build -

i have app built in edge animate , packaged phonegap build. the app works fine but, when use home or button on android device exit app, audio continues play though app appears suspend , go background. not case ios version. is there way mute or pause audio on button presses? i have tried using; document.addeventlistener("pause", onpause, false); document.addeventlistener("resume", onresume, false); function onpause() { my_music.pause(); }; function onresume() { my_music.play(); }; in both .html , in edgeactions.js no success. i have tried using; <preference name="keeprunning" value="false"/> in config.xml, still keeps running. i have run out of ideas , can't find answers on internet. thanks help i have working... function loopmusic(url) { // play audio file @ url my_music = new media(url, // success callback function () {}, // error callback function (err) {}, //loop audio function (status){ ...

javafx 8 - How do I draw a Rectangle on a rotated GraphicsContext and find the rotated co-ordinates -

i using graphicscontext (gc) inside animationtimer. scaling gc, drawing objects, rotating gc , drawing image. the image appears rotated planned! i need able rotated rectangle represents image can check proximity of 4 (rotated) corners other, non rotated objects. i cannot see how this. i have tried creating rotated rectangle 'mirror' objects rotation cannot see how draw rectangle in gc. there no gc.draw(node), gc.draw(rectangle) or gc.draw(polygon). need draw confirm on screen 2 match. my other option break out geometry set , rotate points myself seem odd javafx cannot need. could please help.

Handling piped io in Lua -

i have searched lot can't find answers anywhere. trying following: cat somefile.txt | grep somepattern | ./script.lua i haven't found single resource on handling piped io in lua, , can't figure out how it. there way, non hackish way tackle it? preferably buffered lower memory usage, i'll settle reading whole file @ once if thats alternative. it disappointing have write temp file , load program. thanks in advance. the standard lirary has io.stdin , io.stdout can use input , output without havig resort temporary files. can use io.read isntead of somefile:read , read stdin default. http://www.lua.org/pil/21.1.html the buffering responsibility of operating system providing pipes. don't need worry when writing programs. edit: apparently when mentioned buffering thinking reading part of file opposed loading whole file string. io.read can take numeric parameter read number of bytes input, returning nil if no characters read. local size ...

sql - Query Results For Consecutive Months In Column Grouped By Value -

the following sample data: name | hours | rdate | company | ------------------------------------ |0 |2014-08-01 |w |0 |2014-07-01 |w |0 |2014-06-01 |w |0 |2014-05-01 |w b |0 |2014-08-01 |x c |0 |2014-07-01 |y c |0 |2014-06-01 |y d |0 |2014-08-01 |v d |0 |2014-07-01 |z the following results desire: name | hours | rdate | company | ------------------------------------ |0 |2014-08-01 |w |0 |2014-07-01 |w |0 |2014-06-01 |w |0 |2014-05-01 |w c |0 |2014-07-01 |y c |0 |2014-06-01 |y so question is: how results of rdate consecutive months in columns i.e 2014-08-01, 2014-07-01 ( 2014-08-01, 2014-06-01 not satisfy)for same name , same company i'm thinking variation of grouping islands of contiguous dates problem. ;with cte as( select *, rn = dateadd(month, - row_number() on (partition na...

c - Reading Array at Memory Address -

this injected .dll. given following code: if ( *(volatile unsigned long*)(0x13e81f4+(4 * *(volatile unsigned long*)0x13e81b0)) < 2) { //... } is there way write in more readable fashion, eg: if (array[i] < 2) { //... } (while still using desired memory addresses)? volatile unsigned long *p = (volatile unsigned long *)0x13e81f4; volatile unsigned long *q = (volatile unsigned long *)0x13e81b0; if ( p[4 * q[0]] < 2 )

javascript - How to disable link after first click and allow user to vote only if logged in -

i working on plugin in wordpress vote post or vote down using ajax. working fine problem not able disable onclick eventhandler after first click whenever voting post , can add vote multiple times. want ignore should able vote once. if click on vote voteup anchor tag should disable , votedown anchor tag should enable. @ same time if click on votedown anchor tag votedown should disable , voteup should enable. want enable voting feature if user logged in wordrpess. i have function show popup if user not logged in. i.e login_open(); if user not logged in , try vote function should execute login_open(); otherwise user should able vote or downvote once .. here code // php //defining base paths define('voteupurl', wp_plugin_url."/".dirname( plugin_basename( __file__ ) ) ); define('voteuppath', wp_plugin_dir."/".dirname( plugin_basename( __file__ ) ) ); //enqueue script admin ajax , cutom js file function voteme_enqueuescripts() { wp...

build - How to get the right device name on Appcelerator and Shadow? -

i can't make works because name of device wrong. build: ti build -p android -t device -c nexus 4 --shadow then which device want install app on? devices 1) nexus 4 (4.4.4) select device number or name:... but if write 1 device number it's still doesn't work. the console says "nothing update", didn't find device.

php - Cake bake don't generate auto rules -

i'm newbie in cakephp , i'm generating model's code bake. code generated dont give array auto validations. why not? fields not null, id, title , content fields. sorry bad english, , much. my table: create table `pages` ( `id` int(11) not null auto_increment, `title` varchar(500) not null, `content` text not null, primary key (`id`) ) engine=innodb; automatically cakephp bake doesn't create validation rules models. provides interactive shell create models , validation rules and/or relationships. more info in docs

objective c - Something doesn't feel right about how I am dynamically populating an NSTableView -

here object hierarchy: nswindowcontroller owns nsviewcontroller , data source & delegate nstableview . nswindowcontroller fetches data internet, , passes nsviewcontroller can populate nstableview . happens asynchronously, nstableview loaded 0 rows. nsviewcontroller owns nstableview , nsarray (as data source ). both of these properties private. from here i'm not confident in implementation: once nswindowcontroller has finished fetching data, call public method on nsviewcontroller named -addstringtoarray:(nsstring*) (to avoid making array public , directly calling -addobject on nsarray ). -addstringtoarray calls -addobject on private nsarray , , also calls [self.tableview reloaddata] . call @ location i'm sketched out (though gladly take input on part of solution here) because when nstableview loaded, has 0 rows, when data source ( nsviewcontroller ) method -numberofrowsintableview gets called, returns 0. in turn makes delegate method -v...

regex - awk lines not match -

using awk , need avoid print lines specific word in specific field... before call it's duplicate, did search, , found this: match string not containg phrase , think it's other context, because here need match in specific column. given data: abc abc def aaa ghi abc i want filter print full lines text not containing abc in fist field(lines 2 , 3). as first try, tried (?!...) , expected work way return def , ghi : echo -e "abc\tabc\ndef\taaa\nghi\tabc" | awk '$1 ~ /(?!abc)/ {print}' but return nothing. second try... using not before expression !/.../ : ~$ echo -e "abc\tabc\ndef\taaa\nghi\tabc" | awk '$1 ~ !/abc/ {print}' return nothing too. i don't understand why... so shot fails (as expected time): ~$ echo -e "abc\tabc\ndef\taaa\nghi\tabc" | awk '!/abc/ {print}' def aaa as expected time, second field filtered too. so, seems work $0 . then did homework , got working way...

What is wrong with this c code line? -

this line double hdg_and_lee = cal_array[variation] + normalize(corrected.hdg + (corrcalc.twa > 0 && corrcalc.twa < 180) ? -abs(corrected.leeway) : abs(corrected.leeway)); returns value of cal_array[variation] , incorrect. corrected.leeway happens 0 corrected.hdg 211, variation 14 , line evaluates to. i changed this, works think should same line above. double lee = (corrcalc.twa > 0 && corrcalc.twa < 180) ? -abs(corrected.leeway) : abs(corrected.leeway)); double hdg_and_lee; hdg_and_lee = cal_array[variation] + corrected.hdg + lee; hdg_and_lee = normalize(hdg_and_lee); i can't see did wrong. here normalize. makes angle between 0 , 360; double normalize(double angle){ while (angle < 0) angle += 360; while (angle > 360) angle -= 360; return angle; } this driving me nuts of course have working alternative. want know went wrong. try this double hdg_and_lee = cal...

git - Merging master branch into feature branch then back again -

i have feature branch branched master branch time ago. have since developed quite lot of additional features, have been merged master branch. need merge master branch old feature branch (to important code updates master branch). can , then, once have completed testing on old feature branch, merge master branch (prior going live)? yes. this practice - keep branches up-to-date master when ready merged master there little/no risk of conflicts, , branch code has been tested along against then-latest changes in master.

objective c - Cocoa Bindings - NSTableView - Swapping Values -

Image
is nsvaluetransform subclass choice displaying core data attributes ui views displaying: a number string (0,1,2,3,etc) string such (pending, completed, frozen, in progress, etc) a number string (0,1) app-based image (red.png if 0, green.png if 1) here's core data displays 2 attributes, timer , status: here want displayed instead, without changing values in core data: if not use nsvaluetransformer, in other way possible? i not want see data permanently converted, benefit of less data stored in core data , better ui view items. i have tried modify attributes in managed object class (with out kvo notification) no luck. yes, nsvaluetransformer subclasses work fine purpose. you can add read-only computed properties managed object class, , should work, too. properties can added category in controller code, if don't make sense part of model code. for example: + (nsset*) keypathsforvaluesaffectingstatusdisplayname { return [nsset setwithobject...

Creating a user in Perl -

i trying create script these options, create user, drop user, create group, drop group. how stop running commands @ once? #!/usr/bin/perl $opt = 0; &disp_menu; $opt = <>; print "you selected option "; print $opt; $user = `sudo adduser mjensen`; $group = `sudo groupadd group1`; $dgroup = `sudo groupdel group1 `; $duser = `sudo userdel mjensen`; sub disp_menu { print "main menu\n"; print "option 1 create group\n"; print "option 2 drop group\n"; print "option 3 create user\n"; print "option 4 drop user\n"; print "option 5 exit menu\n"; print "enter option => "; return;} if ($opt == 3) {print "$user"; } elsif ($opt == 1) {print "$group\n"; } elsif ($opt == 2) {print "$dgroup\n"; } elsif ($opt == 4) {print "$duser\n"; } elsif ($opt == 5) {print "you have exited program"; } #!/usr/bin/perl $opt = 0; &disp_menu; $opt =...

Error Valu_type does not name a function C++ -

#include <iostream> #include <cassert> #include <cstdlib> #include "sequence.h" using namespace std; sequence::sequence ( ) { current_index = 0; used = 0; } sequence::size_type sequence::size( ) const { return used; } void sequence::start ( ) { current_index = 0; } sequence::value_type sequence::current( ) const { return data[current_index]; } void sequence::advance ( ) { assert (is_item()); current_index++; } bool sequence::is_item( ) const { return current_index < used; } void sequence::insert (const value_type& entry) { assert( size( ) < capacity); (int = used; > current_index; i--) { data[i] = data[i-1]; data[current_index] = entry; used++; } } void sequence::attach (const value_type& entry) { assert( size( ) < capacity); (int = used; > current_index; i--) { data[i] = data[i+1]; data[current_index] = entry; used+...

java - while loop if statements -

i've got thing working, can't manage the: if((pscore <= card1 +card2)) statement loop until player either sticks or busts. from can see, should work... i'm missing detail, , can't figure out what. import java.util.random; import java.util.scanner; class blackjack { public static void main(string[] args) { random r = new random(); string name; scanner scannerin = new scanner(system.in); boolean yourturn = true; boolean dealersturn =true; int card1 = 1 + r.nextint(11); int card2 = 1 + r.nextint(11); int dcard1 = 1 + r.nextint(11); int dcard2 = 1 + r.nextint(11); int pscore = card1 +card2; int dscore = dcard1 +dcard2; system.out.println("welcome blackjack ! " ); system.out.println("\nscore close 21 without going on win "); system.out.println("\nwhat name?"); name = scannerin.nextline(); system.out.println(...

excel - Create new sheets based on a list -

when create new sheets based on below vba code, works want, there small problem. issue when creating sheets based on list given in column ("a") , create 1 more sheet same name of original 1 , show error in code in section activesheet.name = c.value any assistant correct. private sub commandbutton1_click() on error resume next application.enableevents = false dim bottoma integer bottoma = range("a" & rows.count).end(xlup).row dim c range dim ws worksheet each c in range("a2:a" & bottoma) set ws = nothing on error resume next set ws = worksheets(c.value) on error goto 0 if ws nothing sheets("format").select sheets("format").copy after:=sheets(sheets.count) activesheet.name = c.value end if next application.enableevents = true end sub i think forgot in statement state worksheet range on. line sh...

php - Warning: implode(): Invalid arguments passed -

i have gone through ton of invalid arguments passed messages on forum , sorry have not found example helps situation. as can see code below generous of rasclatt, have several field names including 9 files uploaded server while rest of fields submitted database. when attempt run code, get, "warning: implode(): invalid arguments passed in..." on line 94 - start of insert statement. an important point note not files can uploaded @ 1 time during insert. users can elect upload files, can elect upload 1 file during insert iteration. any idea how resolve this? <?php error_reporting(e_error | e_warning | e_parse); include("../connections/connect.php"); // function used sanitize code against sql injection attack. function ms_escape_string($data) { if ( !isset($data) or empty($data) ) return ''; if ( is_numeric($data) ) return $data; $non_displayables = array( '/%0[0-8bcef]/', // url en...

c# - Clone or Duplicate the first object and Insert to the same list -

i have list of phones came database, , clone first entry , insert same list (updated entry). list<phones> p = new list<phones> { new phones { id = 1, phone = "samsung s3" }, new phones { id = 2, phone = "iphone 5" }, new phones { id = 3, phone = "samsung s4" }, new phones { id = 4, phone = "samsung s5" }, new phones { id = 5, phone = "iphone 5s" }, new phones { id = 6, phone = "iphone 6" }, }; currently used below approach. first entry updates also. var obj = p.firstordefault(); var t = new phones(); t = obj; t.id = 7; p.add(t); public class phones { public int id { get; set; } public string phone { get; set; } public bool ischild { get; set; } } class call reference if change value changing first member well. can clone phone, should implement iclonable interface, consider link implementing iclonable ...

php - how to get total no of working hours with date & time in MYSQL with reference to checkin & checkout time -

below table shows checkin & checkout time of employee emp_id report_date report_time 11 2014-12-01 08:02:31 21 2014-12-01 08:13:04 11 2014-12-01 18:03:41 21 2014-12-01 16:36:02 you need convert time values seconds check post: mysql: how difference between 2 timestamps in seconds i'll share working code important understand going on it. select `emp_id`, `report_date`, min(`report_time`) chekin, max(`report_time`) chekout, ( (time_to_sec(timediff(max(`report_time`), min(`report_time`))) / 60) / 60) difference `your_table` 1 group `emp_id`, `report_date` first group employee id , report date, way 1 row each id on distinct date. select minimal time employee on given date, , max time. time difference in seconds, divide 60 in minutes, , divide again 60 in hours.

vb.net - Using shadowed methods/fields in an overriden method -

suppose had following code: class normalemployee protected pay decimal; protected shared basepay decimal = 300d protected overridable sub updatepay() pay = basepay + .....do something...... end sub end class class seniornormalemployee inherits normal employee protected shared shadows basepay decimal = 500d; protected overrides sub updatepay() pay = basepay + .....do different.... end sub end class function main() integer dim newemployee normalemployee = new seniornormalemployee() newemployee.calculatepay() return 0 end function i know due polymorphism, calculatepay() base class called. question is: why calculatepay() use basepay base class , not derived class? object being stored inside base class "container", though uses derived classes version of method, when goes check basepay shouldn't @ base class's version? furthermore, behavior same when calling shadowed methods overrides method? there ...

java - How do use methods for the elements of a 2d array? -

how use methods elements of 2d array? i have class board , , initialized 2d array type cell . essentially, want use cell elements, , use methods class. however, unsure how implement that, because error when try board[1][1].cellmethod() code board: public class board { private int col = 1, row= 1; private cell[][] board; private randomnumbergenerator rand = new randomnumbergenerator(); public board(){ board = new cell[col][row]; //initialize board cells (int r = 0 ; r<=row; r++){ for(int c = 0; c<= col; c++){ board[c][r] = new cell(rand.getrandintbetween(1,6), translateoffsettopixel(c,r).getx(), translateoffsettopixel(c,r).gety()); } } } cell class public class cell { //which shape cell consist private int shape; //offset of cell located cell number -> need translate given coordinates pixel private int x, y; private int shape_width = 50; //width of ...

java - how to change particularly one row textview value while click the button in custome listview? -

i have custom list view base adapter. have tried increment , decrement particularly 1 row textview value. working row textview value changed while click button. how can changed particularly 1 row textview value. plese suggest me. public class breakfastlistadapter extends baseadapter { private context context; private string[] number; private int[] imageid; imageview plus1, minus1; textview value1; int = 0; public breakfastlistadapter(context c, string[] number, int[] imageid) { context = c; this.imageid = imageid; this.number = number; } @override public int getcount() { return number.length; } @override public object getitem(int position) { return position; } @override public long getitemid(int position) { return 0; } @override public view getview(int position, view convertview, viewgroup parent) { layoutinflater inflater = (layoutinflater) ...

What's the usage of <skip /> in Android application source strings.xml? -

in strings.xml file, see this: <skip /> <string name="recentmissed" msgid="3566738938889333307">"buraxılmış zəng yoxdur"</string> ... <skip /> but still see gradle build these "skipped" lines, example build error: app/src/main/res/values-az-raz/strings.xml:156: error: "recentmissed" translated here not found in default locale [extratranslation] is there explain me what's usage "skip" keyword in strings.xml? thanks. i know simple method fix these build error remove these "skipped" lines source. purpose learn "skip" usage.

System.byte error while reading a pdf file in C# -

i have tried every possible solution given on website. private byte[] getbinaryfile() { stream fs = fileupload1.postedfile.inputstream; binaryreader br = new binaryreader(fs); byte[] bytes = br.readbytes((int32)fs.length); return bytes; } this trying read fileuploader didn't work. changed idea uploaded file on server first , trying read again gave me same error of system.byte(). thing not return byte format of pdf worked on local system has server? appreciated you can try this:- byte[] bytes = new byte[fileupload1.postedfile.contentlength]; bytes = fileupload1.filebytes;

hadoop - Any Oozie equivalent feature in Spark -

is there similar oozie in spark workflow design. have use case have query on hive every 5mins interval. thanks oozie getting native spark action this jira if you're prepared wait next release or run oozie trunk, might option.

How to make a java executable jar file invoke command line? -

i have following simple program: package meep; import java.util.scanner; public class enterstring { public static void main(string[] args) { scanner in = new scanner(system.in); string string1; system.out.println("enter string"); string1 = in.nextline(); in.close(); system.out.println("here entered: " + string1); } } what want make runnable jar file run program on command line (i know how make runnable jar file). in other words, want make runnable jar file such opening file have same effect if type java enterstring in command line. also, i'm using windows, make platform-independent (i.e., invoke command line on mac or linux system)? for windows; cd /applicationpath java -jar app.jar save .bat file - double click open application for linux; cd /applicationpath java -jar app.jar save .sh file for mac; #!/bin/bash cd "/applicationpath" java -jar app.jar save .sh file chmod 777 <.sh file path...

java - how to display multiple json data for a single amchart graph -

i have scenario in used display multiple graphs in amcharts had multiple jsons dynamically generated. now need display these graphs in single amchart. every amchart has multiple graphs individually. is there way in possibly these individual jsons displayed in single amchart? json1 = [{val1,val2....},{val1,val2....}....] json1 = [{val1,val2....},{val1,val2....}....] these 2 jsons being displayed in 2 different graphs need display in one.

java - Adding items in the list without using reference object and setter methods -

in order display data row-wise i.e first row row.i added data resultset list through reference object .ex- while (rs.next()) { comp_mps ref = new comp_mps(); ref.setlogtime(rs.getstring(1)); ref.setbeam_current(rs.getstring(2)); ref.setbeam_energy(rs.getstring(3)); ref.setst4_vs6_bag1_rb(rs.getstring(4)); st_jsp.add(ref); } where st_jsp list<comp_mps> st_jsp=new arraylist<comp_mps>(); and comp_mps class name. in jsp display data as {(r.beam_energy)} but have large database , have around 200 columns.so won't able create getter , setter methods columns.so other way exists add data in list , display through jsp page in proper format i.e. row-wise , have subtract data in jsp,i'm not able in java. subtraction code in jsp <fmt:formatnumber value...

python - Including .gitignore in setup? - Error: doesn't exist or not a regular file -

setup.py from setuptools import setup, find_packages os import path functools import partial if __name__ == '__main__': package_name = 'gen' templates_join = partial(path.join, path.dirname(__file__), package_name, 'templates') setup( name=package_name, test_suite=package_name + '.tests', packages=find_packages(), package_dir={package_name: package_name}, package_data={package_name: [templates_join('.gitignore')]} ) tree . ├── gen │   ├── __init__.py │   ├── templates │   │   ├── __init__.py │ │ ├── .gitignore └── setup.py error error: can't copy 'gen/ld/gen/templates/.gitignore': doesn't exist or not regular file try use abspath(split(__file__)[0]) instead. from setuptools import setup, find_packages functools import partial os.path import join, abspath, split if __name__ == '__main__': package_nam...

c - Is this correct or is there a better way? -

i'm trying write c program reads barcode(that 10 digits long) stdin, adds first 9 digits of barcode, , if second digit of sum of 9 digits equal 10th digit in barcode writes barcode stdout. here have far, can 1 please me or tell me wrong i've got or add. possible put whole barcode character array , sum first 9 digits , compare value of bar[9]? how this? thanks #include <stdio.h> int main(void){ int sum = 0; char bar[10]; int i; for(i = 0; < 9; i++){ scanf("%d", &bar[i]); } for(i = 0; < 10; i++){ sum += bar[i]; } if(sum[1] == bar[10]){ return 1; } return 0; } corrections change char bar[10] int bar[10], because handling intergers array indexes begin 0 , end @ sizeofarray-1 primitives int , float variables cannot referred using indexes have done in sum[1] == bar[10] . here sum int type bar array of integers. logic test last 2 digit , tenth digit of barcode int seconddigit = sum%100; // 189 re...

How can I remove NULL values from a dataframe in R? -

i made function in r accepts string , outputs patterns in it. example, string, "abcabcabc" , outputs "abc" if have string as, "abcdefghi" , outputs, " " . now, on running function on dataframe containing 1000's of rows, obtained output, output dataframe consists of several rows having " " output. how can remove this? output dataframe of following type: 1 2 abc 2 3 bc 3 4 t 4 5 " " 5 3 ui so, want remove row containing values in first 2 columns 4 , 5. thanks! an empty string not null (try is.null(" ") ). you're seeing factor level " " (nothing between quotes). can remove rows of data.frame searching string. xy[!xy$col %in% " ", ] # added ! select inverse, advertized or if appropriate, can merge other factor level redefining levels(xy) . here's example set.seed(357) xy <- data.frame(first = c("a", "a", "b", "b", ...

excel - Using cloneSheet with poi SXSSF -

i using sxssf write large numbers of data in 1 excel-file. i have seen 'clonesheet' method isn't implemented: /** * create sheet existing sheet in workbook. * * @return sheet representing cloned sheet. */ public sheet clonesheet(int sheetnum) { throw new runtimeexception("notimplemented"); } but don't understand why. logically correct it's missing? or bug? i forward answers , able clone sheets sxssf. best regards, louisa. thank @gagravarr: "sxssf things can work in streaming manner, cloning can't." i resolve have sheets in excel template first, , when don't use them, remove them....

java - JBoss5 CLIENT-CERT authentication getting HTTP Status 401 - Cannot authenticate with the provided credentials error -

Image
i want mutual authentication using client-cert , specify role restful jersey web service. here clientauth="false" in server.xml my web.xml follow: <servlet> <servlet-name>jersey-serlvet</servlet-name> <servlet-class> com.sun.jersey.spi.container.servlet.servletcontainer </servlet-class> <init-param> <param-name>com.sun.jersey.config.property.packages</param-name> <param-value>com.aditi.test</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <login-config> **<auth-method>client-cert</auth-method>** <realm-name>jmx console</realm-name> </login-config> <security-role> <description>admin role</description> <role-name>admin</role-name> </security-role> my jboss-web.xml is: <jboss-web> <security-domain>java:/jaas/client_cert...

sql - how to split a column into multiple columns in mysql -

i have column +--------------------------+ | marks | +--------------------------+ |maths-80,phy-100,che-99 | |maths-90,phy-60 | |phy-82,che-65 | |che-90 | |maths-33,phy-89,che-65 | |maths-50,phy-43,che-59 | +--------------------------+ give 3 sample subjects in realdata maybe number of subjects seperated comma. want display marks each subject split marks column , display in multiple columns below sample. +-------------------------------------+-------------+------------+ | marks | maths | phy | che | +-------------------------------------+-------------+-------------+ maths-80,phy-100,che-99 | 80 | 100 | 99 | maths-90,phy-60 | 90 | 60 | 0 | phy-82,che-65 | 0 | 82 | 65 | che-90 | 90 | 0 | 0 | maths-...

ios - App is crashing if NSUserDefaults returns nil -

i have situation key values nsuserdefaults memory shall displayed(restored) on pre-view in storyboard stored(saved) in next view controller following view shall restored. in case nothing stored (such when app run first time), app crashes error follows when try run view store key involved. fatal error: unexpectedly found nil while unwrapping optional value further, nsuserdefaults part of switch statement on pre-view follows. there anyway tell system if store of key nil, please display 0. think specifics of swift, not clear how syntax in situation. appreciate help. var dummy: dummytest! = nil switch self.lessonnumber { case 1: nsuserdefaults.standarduserdefaults().setobject(self.score, forkey: "storeddummyessentialspoints") case 2: nsuserdefaults.standarduserdefaults().setobject(self.score, forkey: "storeddummyfoodpoints") case 3: nsuserdefaults.standarduserdefaults().setobject(self.score, forkey: "storeddummynumberspoints") ... ...

php - XSLTProcessor: multiple xsl files -

i using php xsltprocessor generate html code xml file through xsl file. works. my problem @ point xsl file gets big work it, makes sense distribute parts external files. neither xsl:import nor xsl:include function works. think reason xsl processor has problems paths, not sure. inside xsl file use this: <xsl:import href="2nd_file.xsl"/> where 2nd_file.xsl in same directory of executing php. i error: warning: xsltprocessor::importstylesheet() [xsltprocessor.importstylesheet]: compilation error: file /local/path/to/first/xsl/main.xsl line 7 element import in /local/path/to/php/index.php on line 57 ---- line 57 in php is: $proc->importstylesheet($xsldoc); /local/path/to/first/xsl/ main.xsl /local/path/to/php/index.php import is. stylesheet expect root url /local/path/to/first/xsl/ . if put sheets import there, should work. if using xslt2 can call base-uri() show xslt working from.