Posts

Showing posts from July, 2015

Null-terminating a string in C -

i have string spaces on end. terminate string @ position when first space occurs, when later strncpy() on it, copy part of string doesn't contain spaces. this try gives me segault obviously. how can intend do? int main() { char* s1 = "somestring "; *(s1 + 10)='\0'; printf("%s\n",s1); return 0; } you're attempting modify string read because of way declared pointing constant value. you'll have make copy first: #include <stdio.h> #include <string.h> int main() { char* s1 = "somestring "; char *s2 = strdup(s1); char *s3 = strchr(s2, ' '); *s3 = '\0'; printf("%s\n",s2); /* if not needed more, because strdup allocates heap memory */ free(s2); return 0; }

installation - LFS Chapter 6.20 Ncurses install error -

i've been going step step until midnight, turned off laptop (standby) - i've ubuntu 14.04 lts os. when woke wanted continue, started laptop again, screen kept black. shut down, , started it. i had mount everything, executed this: # mount -v -t ext4 /dev/sda3 $lfs # rm /tools # ln -sv $lfs/tools / # chroot "$lfs" /tools/bin/env -i \ home=/root \ term="$term" \ ps1='\u:\w\$ ' \ path=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \ /tools/bin/bash --login +h when enter /source/ncurses-5.9/ , execute ./configure --prefix=/usr --mandir=/usr/share/man --with-shared --without-debug --enable-pc-files --enable-widec gives me back: checking egrep... grep -e configuring ncurses 5.9 abi 5 (sun apr 26 07:23:00 utc 2015) checking build system type... x86_64-unknown-linux-gnu checking host system type... x86_64-unknown-linux-gnu checking target system type... x86_64-unknown-linux-gnu con...

javascript - ECMA6 spread parameters in react-router -

i see reactjs sample code written as, var app = react.createclass({ render: function () { return ( <div> <div classname='content'> <routehandler {...this.state} /> </div> </div> ) } }) this part confuses me. <routehandler {...this.state} /> in this, routehandler custom element uses ... . , ecma6 functions splat/rest params use triple dots in function definitions. so, why people use ... during function invocation (or) on application side? this not rest operator spread operator , applied jsx attributes. see jsx spread attributes . <routehandler {...this.state} /> equivalent react.createelement(routehandler, object.assign({}, this.state)) . note object spread , rest operators jsx spread attributes feature inspired not part of es6 specification. there a stage 1 proposal include them in es7. in meantime, can use them passing --harmony option jsx compil...

objective c - IOS creating a dictionary makes code stuck -

there weird code : i have (inside function being called nstimer). nslog(@" adding object array "); nslog(@"match id : %@",self.matchid); nsdictionary *dict = @{@"matchid" : self.matchid , @"hometeam" : self.hometeam , @"awayteam" : self.awayteam , }; nslog(@" adding object array data : %@",dict); i can see first 2 logs, third 1 not printed. timer called again, can see again first 2 third 1 not print again. any that? chances (or several) of self.matchid , self.hometeam , self.awayteam nil , throwing exception ( nsdictionary expects object values), , therefore skipping third nslog line.

xml - xslt copy only certain descendants -

i trying copy descendant elements without attribute. cant figure out right way this. here file: <?xml version="1.0" encoding="utf-8" standalone="yes"?> <itemlist> <item> <subitem id="g0b86bn6"/> <subitem> <subitem/> <subitem id="8967698"/> </subitem> <subitem> <subitem/> <subitem id="9868966n7"/> <subitem> <subitem id="9896"/> <subitem> </subitem> </item> </itemlist> the elements nested arbirtarily deep. expected output: <?xml version="1.0" encoding="utf-8" standalone="yes"?> <itemlist> <item> <subitem> <subitem/> </subitem> <subitem> <subitem/> </subitem> </item> <...

slidetoggle - jQuery slideUp toggle close last div -

i've got http://jsfiddle.net/jv4ae32j/ toggle script working way want apart 1 thing want yo close div when last title clicked $('.toggle').click(function(){ $('aside').slideup(); $(this).find('aside').slidetoggle(); e.stopimmediatepropagation(); }); $('aside') target elements classde. need filter out aside inside clicked element.like this: $('.toggle').click(function(){ $('aside').not($(this).find('aside')).slideup(); $(this).find('aside').slidetoggle(); e.stopimmediatepropagation(); }); working demo

bit manipulation - Binary coded decimal addition using integer -

if have 2 numbers in packed bcd format , want add them, approach add them this: convert both numbers integers, perform normal integer addition, convert result bcd? the c99 code below adds packed bcd operands 8 bcd digits stored in uint32_t . code can extended wider bcd operands choosing uint64_t process 16 bcd digits. since approach relies on bit-parallel processing may not efficient narrow packed bcd operands. in packed bcd format, each bcd digit occupies 1 nibble (4-bit group) of unsigned integer operand. if nibble-wise addition results in sum > 9, want carry next higher nibble. if use regular integer addition add 2 packed bcd operands, desired nibble carries not occur when nibble sum > 9, < 16. remedy this, can add additional 6 each nibble sum. we can find nibble carries follows: bit-wise sum of 2 integers x , y x ^ y . @ bit position has carry-in next lower bit position during regular integer addition, bits in x ^ y , x + y differ. can find bits carry-...

html5 - Why does the element drop down -

Image
basically have 3 images , div.contact sitting next each other contained in section.gallery. div.contact has been floated right , relatively positioned not images . problem cant 'newsletter' in footer occupy available space on right, keeps dropping down. however when apply clear:both footer see happens.it creates huge space between footer , section.gallery ,but 'newsletter' takes space when check google chrome inspect element, there big margin did not apply. the relevant code the html part <section class="gallery"> <div class="display-gallery"> <img src="images/picture.png" /> <img src="images/picture.png" /> <img src="images/picture.png"> </div> <!--end gallery--> <div class="contact"> <p>contact</p> <h2>booking <br /> ...

clang AST visitor extra arguments -

currently clang's traverse* functions accept ast nodes sole argument. wondering if there way pass 1 or more arguments traverse* functions in clang's astvisitor. for example, let's have binaryoperator , want pass state when call traversestmt on lhs , rhs: traversestmt(lhs, state); ... traversestmt(rhs, state); is there way achieve this? one way avoid passing argument maintain local stack within astvisitor object. ugly! thanks.

swing - How do I pass a value JFrame to JFrame by click of a button in Java? -

i need pass value jframe jframe click of button. i'm new programming. tried everything. don't know how accomplish this. here code - import javax.swing.jframe; import javax.swing.jbutton; import javax.swing.jtextfield; import javax.swing.jlabel; import java.awt.flowlayout; public class demo{ private final jlabel showinput; private final jtextfield inputfield; public demo(){ jframe inputframe = new jframe("input"); jframe outputframe = new jframe("output"); inputfield = new jtextfield(15); jbutton button = new jbutton("click here"); } }); showinput = new jlabel("type in box , press button"); inputframe.getcontentpane().setlayout(new flowlayout()); inputframe.getcontentpane().add(inputfield); inputframe.getcontentpane().add(button); inputframe.pack(); inputframe.setdefaultcloseoperation...

lambda - Does a method reference in Java 8 have a concrete type and if so, what is it? -

this question has answer here: how indirectly run method reference in java 8? 2 answers this question pretty closely related another one . however, feel accepted answer question not quite definitive. so, is type of method reference in java 8? here's little demonstration of how method reference can "cast" (lifted?) java.util.function.function : package java8.lambda; import java.util.function.function; public class question { public static final class greeter { private final string salutation; public greeter(final string salutation) { this.salutation = salutation; } public string makegreetingfor(final string name) { return string.format("%s, %s!", salutation, name); } } public static void main(string[] args) { final greeter hellogreeter = new greeter("hello"); identity(hellogreet...

javascript - Ajax send data to Node.js client then send to Node.js server -

is possible jquery.ajax send data node.js client,then after receive data send node.js server ?. possible ? myajax $.ajax({ type:'post' data:{data:hello}, url: '' //here don't know how point node.js client success:function(data){ } }); servarapp.js var net = require('net'); var clients = []; var server = net.createserver(function (socket) { clients.push(socket); }); server.listen(1337,'localhost',function(){ console.log("server listening in port 1337"); }); client.js var net = require('net'); var client = new net.socket(); client.connect(1337, '127.0.0.1', function() { console.log('connected'); client.write('hello, server!); }); client.on('data', function(data) { console.log('received: ' + data); client.destroy(); }); client.on('close', function() { console.log('connection closed'); }); thank in ...

jquery - How to prevent submit last questionof a form if there is no answer -

i have form of survey questions. first hide questions , show 1 after button next. i've made validation , works last question not working. i've provided php validation if doesn't have javascript enabled. when have not chosen answer last question,it not submit form, returns first question of survey , have choose them again. that's problem - how validate last quesion? here's code: $(function () { $( document ).ready(hideallrows); $( document ).ready(showfirst); $('#button').hide(); }); function hideallrows(){ $('#questionstable tr').each(function() { $(this).hide(); }); } $(function () { $("#next").click(shownextquestion); }); var currentind = 1; var prevind = 1; function shownextquestion(){ $(function () { var indid = "#"+currentind; prevind = currentind - 1; var previd = "#"+prevind; //validation var isanyclicked = false;​ if ($(...

read.table - Dealing with scan error in R - Caused by misplaced \n separators in data -

i'm reading in many large tab-separated .txt files using read.table in r. however, lines contain newline breaks ( \n ) there should tabs ( \t ), causes error in scan(...) . how can deal issue robustly? (is there way replace \n --> \t every time scan encounters error?) edit: here's simple example: read.table(text='a1\tb1\tc1\td1\n a2\tb2\tc2\td2', sep='\t') works fine, , returns data frame. however, suppose there is, mistake, newline \n there should tab \t (e.g., after c1 ): read.table(text='a1\tb1\tc1\nd1\n a2\tb2\tc2\td2', sep='\t') this raises error: error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, : line 1 did not have 4 elements note: using fill=t won't help, because push d1 new row. if have exact problem describe (no missing data, wrong seperator) try: library(readr) initial_lines <- read_lines('a1\tb1\tc1\nd1\na2\tb2\tc2\td...

vb.net - Large XML file - wrap elements inside tags using XSLT or by manipulating the XML as String? -

i have large xml file, around 3-4 mb , need wrap elements inside tags. xml has following structure: <body> <p></p> <p> <sectpr></sectpr> </p> <p></p> <p></p> <tbl></tbl> <p> <sectpr></sectpr> </p> </body> of course, p , tbl elements repeat inside body until end of file (also each of elements presented above have children - took them out sake of simplicity). estimate, have around 70 elements containing sectpr inside body , not in order described above. what do, wrap elements starting element containing sectpr next element containing sectpr tag. result, xml should this: <body> <p></p> <mytag> <p> <sectpr></sectpr> </p> <p></p> <p></p> <tbl></tbl> </mytag> <my...

user interface - JavaFX Scenebuilder: Is it possible to disable the resizing of the SplitPane divider? -

is possible disable automatic resizing/placement of divider of splitpane when resizing entire frame? in other words, want automatically move divider shrink (when application's frame small) or if user manually moves divider. this looking : how can avoid splitpane resize 1 of panes when window resizes? and javadoc

Assigning range to an array in Perl -

i have mini problem. how can assign range array, one: input file : clktest.spf * .global vcc! vss! * .subckt eclk_l_25h brg2eclk<1> brg2eclk<0> brg_cs_sel brg_out brg_stop cdivx<1> + eclkout1<24> eclkout1<23> eclkout1<22> eclkout1<21> eclkout1<20> eclkout1<19> + mc1_brg_dyn mc1_brg_outen mc1_brg_stop mc1_div2<1> mc1_div2<0> mc1_div3p5<1> + mc1_div3p5<0> mc1_div_mux<3> mc1_div_mux<2> mc1_div_mux<1> mc1_div_mux<0> + mc1_gsrn_dis<0> pclkt6_0 pclkt6_1 pclkt7_0 pclkt7_1 slip<1> slip<0> + ulc_pclkgpll0<1> ulc_pclkgpll0<0> ulq_eclkcib<1> ulq_eclkcib<0> * *net section * *|ground_net 0 * *|net eclkout3<48> 2.79056e-16 *|p (eclkout3<48> x 0 54.8100 -985.6950) *|i (rxr0<16>#neg rxr0<16> neg x 0 54.2255 -985.6950) c1 rxr0<16>#neg 0 5.03477e-17 c2 eclkout3<48> 0 2.28708e-16 rk_6_1 eclkout3<48> rxr0<16...

ios - UITableview reloadData is not resetting frame for iPhone 5 -

i'm adding new cells table view using pull add function. when pull down on table view past threshold placeholder cell added. then, call reloaddata , becomefirstresponder on placeholder cell. the problem reloaddata doesn't appear resetting tableview frame iphone 5 , lower. causes placeholder cell out of visible range. table offset should 0. add placeholder -(void)todoplaceholderadded { nslog(@"todoplaceholderadded"); // create new item todoitem *newitem = [[todoitem alloc] initwithtext:@""]; [_todolist insertobject:newitem atindex:0]; // refresh table [self.tableview reloaddata]; // find new cell todocell* editcell; (todocell* cell in _tableview.visiblecells) { if (cell.todoitem == newitem) { editcell = cell; editcell.todoitem = newitem; _cellinedit = cell; editcell.textfield.placeholder = @"enter task"; break; } } //...

android - Rotating refresh button -

i have refresh button defined in layout file follow: <imagebutton android:id="@+id/btn_refresh_assets" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_gravity="center" android:onclick="onclick" android:src="@drawable/ic_menu_refresh" /> when button clicked, asynctask called load data webservice. want rotate refresh icon until load complete!!! there guidlines doing in actionbar button placed in middle of page , not in actionbar. here code animation animation = new rotateanimation(0.0f, 360.0f, animation.relative_to_self, 0.5f, animation.relative_to_self, 0.5f); animation.setrepeatcount(-1); animation.setduration(2000); create animation before starting service attach animation imageview below ((imageview)findviewbyid(r.id.btn_refresh_assets)).setanimation(animation); and whe...

User Input from Ruby on Rails form -

im trying grab users input value (:url) in rails app. believe its params[:user_input] but dont know how implement controller. place anywhere or in specific method? method def index @posts = post.all embedly_api = embedly::api.new :key => '', :user_agent => 'mozilla/5.0 (compatible; mytestapp/1.0; my@email.com)' url = params[:user_input] @obj = embedly_api.extract :url => :user_input end how can user_input url can pass hash??? the params hash contains mapping of names of html form controls values provided user. access each 1 params[key_name] . in case, think want create local variable out of params[:url] . that's fine. use this. def index @posts = post.all embedly_api = embedly::api.new :key => '', :user_agent => 'mozilla/5.0 (compatible; mytestapp/1.0; my@email.com)' url = params[:url] @obj = embedly_api.extract :url => url end however, local variable isn't necessary, make code more su...

ios - Communicating between Mysql php and Objective c -

currently developing application in xcode using objective c can post , view other peoples posts. sends post database, , on view controller post shown user of app see. know how post , receive data database, problem displaying data. display un-editable textview or along line each post on page displays posts. not sure how create 1 every time there new post , how make page scroll. know lot ask, if possible please me out. if confused how trying display data, @ edmodo's mobile app. trying display posts in manner. once again, thank , please help! to solve problem need use uitableview or uitableviewcontroller , need create custom uitableviewcell per need display post. a custom uitableviewcell consist of uitextview , setting editable property in attribute inspector or programmatically self.yourtextview.editable = no; can make uitextview non-editable. check following links: http://www.appcoda.com/customize-table-view-cells-for-uitableview/ http://www.appcoda.com/self-siz...

c - Improvements to dynamically allocate memory for a double pointer to struct inside a pointer to struct -

i wrote code below dynamically allocate memory nested struct: product **product; purpose of code me learn right or better way dynamically allocate memory using double pointer struct inside pointer struct. code runs fine. question: corrections or improvements code? in advance sharing experiences. typedef struct { int price; } product; typedef struct { product **product; int id; } inventory; int main() { int i, j, k, count=0; int n1=2, n2=3, n3=2; inventory *inventory = malloc(n1 * sizeof *inventory); (i=0; i<n1; i++) { inventory[i].product = malloc(n2 * sizeof *inventory[i].product); (j=0; j<n2; j++) { inventory[i].product[j] = malloc(n3 * sizeof *inventory[i].product[j]); } } (i=0; i<n1; i++) { (j=0; j<n2; j++) { (k=0; k<n3; k++) { inventory[i].product[j][k].price = count++; printf("%d " , inventory[i].product[j][k].price); } } } return 0; } output: 0 1 2 3 4 5 6 7 ...

algorithm - How to solve Subtree Isomorphism using maximum bipartite matching? -

how determine if given tree t contains subtree isomorphic tree s? two trees called isomorphic if 1 of them can obtained other series of flips, i.e. swapping left , right children of number of nodes. number of nodes @ level can have children swapped. 2 empty trees isomorphic. i've read @ few places bipartiate matching algorithms can used solve problem can't find non-paywalled sources details. there seems many research papers on problem, of them again behind paywall, i'm not interested in latest research algorithm problem. question how bipartiate matching applies problem? ps: there seems confusion on internet meant "isomorphic". above definition found @ places places mentioned "isomorphic" means trees of same shape regardless of node values. if can clear confusion, had great too. i'm going talk rooted subtree isomorphism; unrooted case can handled without regard efficiency trying roots. the basic idea if have trees ...

loops - R dismo::gbm.step parameter selection function in parallel -

i have working function coded optimize parallel processing (hopefully). still not proficient r , functions , iterating. i hoping out there me optimize function have written along code aid in computing time , optimize parallel processing options. specifically using %do% vs %dopar% , moving additional code , parallel processing functions inside of function. cannot seem %dopar% work , not sure if issue code, r version, or conflicting libraries. i greatly appreciate suggestions on possible ways same results in more efficient manner. background: i using dismo::gbm.step build gbm models. gbm.step selects optimal number of trees through k-fold cross validation. however, parameters tree complexity , learning rate still need set. understand caret::train built task, , have had lot of fun learning caret , it's adaptive resampling capabilities. however, response binomial , caret not have option return auc binomial distributions; use auc replicate similar published studi...

php - Laravel save or update many to many relationship with additional column -

i have many many relationship set in laravel want save user settings. setting can set many users , user can have many settings. i have additional field named "value" in pivot table want save value set user. well, want create new entry when there no value particular user , setting. if there value should updated. this i've tried: $setting = setting::find(1); auth::user()->settings()->save($setting,array('value' => 15)); as change value else automatically creates new entry. i'd updated. how can achieve this? use updateorcreate method. $setting = setting::find(1); auth::user()->settings()->updateorcreate($setting,array('value' => 15)); method documentation

java - Spring Social and Spring Security using XML configuration -

i'm trying introduce spring social exising web-application spring security. existing web-app uses xml configuration, ie: <security:http disable-url-rewriting="true" use-expressions="true" xmlns="http://www.springframework.org/schema/security"> ... <intercept-url pattern="/w/configuration/**" access="hasrole ('role_admin')"/> ... <form-login login-page="/w/welcome" authentication-success-handler-ref="authsuccesshandler" authentication-failure-handler-ref="authfailurehandler"/> <logout logout-success-url="/w/welcome"/> </security:http> how add springsocialconfigurer() configuration? documentation on spring social uses java-based configuration want avoid, eg: @override protected void configure(httpsecurity http) throws exception { http .formlogin() .log...

java - Given the method signature A bar(B q) throws C, which of the following will not compile? -

public class extends exception {....} public class b extends {....} public class c extends runtimeexception {....} given method signature bar(b q) throws c, of following not compile? a. a m() throws c { return bar(new b()); } b. m() { return bar(new b()); } c. of above compile. the answer c. there might typo b, not sure. i'm not understanding question, conceptually, what's asking, etc. superclass of b, , c alone runtimeexception, it's not checked @ compile time? , inside of method has b time exception, works in both answers. explain why both of these compile? c kind of runtime exception. don't need declare runtime exception, , ignored compiler. here's explanation started. declaring exception doesn't mean there exception. means should prepared possiblility exception thrown. choice b not compile, not because of exception. not compile because there no return type. choice has declared return of type a .

Using YouTube API on HTML page with Javascript -

i new web development , trying make simple search page displays youtube videos using youtube api. i've been following examples here: https://developers.google.com/youtube/v3/code_samples/javascript?hl=fr#search_by_keyword i'm not having lot of luck. have no errors no search results either. my current code here: http://amalthea5.github.io/thinkful-tube/ there seems several problems. need use <script src="https://apis.google.com/js/client.js?onload=googleapiclientready"></script> instead of <script src="https://apis.google.com/js/client.js?onload=onclientload" type="text/javascript"></script> because need make sure initialization function googleapiclientready() in auth.js called. however, google api reports there exists no oauth client id trusty-sentinel-92304 . edit: if don't have oauth client id, rather api key, shouldn't use auth api @ all. instead, need add api key parameter each api...

database - Joining pivot table vs. duplicating columns -

i'm making game, players make moves 1 one. have following tables: ╔═════════╗ ║ players ║ ╠═════════╣ ║ id ║ ║ name ║ ╚═════════╝ ╔════════════╗ ║ games ║ ╠════════════╣ ║ id ║ ║ started_at ║ ╚════════════╝ ╔═════════════╗ ║ game_player ║ ╠═════════════╣ ║ id ║ ║ game_id ║ ║ player_id ║ ║ turn ║ ╚═════════════╝ now, i'd add moves table keep track of game's history. i'm not sure way better: 1) connect moves pivot table game_player this: ╔════════════════╗ ║ moves ║ ╠════════════════╣ ║ id ║ ║ game_player_id ║ ║ made_at ║ ╚════════════════╝ 2) duplicate game_id , player_id pair this: ╔═══════════╗ ║ moves ║ ╠═══════════╣ ║ id ║ ║ game_id ║ ║ player_id ║ ║ made_at ║ ╚═══════════╝ the first solution makes data more concise, there no way put unexisting game-player pair if use foreign keys. the second solution easier handle orm. how should problem solved? there way...

javascript - Creating a "delay" function in JS? -

i've been reading settimeout , other such timers. i'm wondering if it's possible work custom function need this: //code delay(time); //more code is possible? update: ok, kind of it. if isn't reasonably possible, how go delaying loop after first time. want run upon execution delay on each iteration afterward. new update: figure since initial thought fell through, might easier show code have. function autofarm (clickevent){ var farmtargets = [ "6_300_1", "6_300_3", "6_300_4", "6_300_5", "6_300_7"]; settimeout(function() { $.each (farmtargets, function(index, target){ var extradata = '{"end_pos":"' + target + '","purpose":0,"upshift":1,"bring_res":{"0":0,"2":0,"1":0},"bring_ship":{"1":25,"11":0},"rate":100,...

Python/Eclipse/wxPython -- CallAfter undefined variable? callAfter is as well -- confused -

i'm using eclipse luna , latest pydev it. have wxpython 3.0 installed. first, import wx , tried in console print version , perfect, import wx.lib.pubsub -- says unresolved. try other variations, no dice, have go properties of project , add wx manually, worked. second, callafter calls underlined red, undefined variable import. know callafter used it, tried too, tries autocomplete -- underlines it. know in 3.0, callafter capitalized. if wasn't, eclipse tries autocomplete old version , says it's still bad. i've never seen before, i'm confused. know i'm doign incorrectly? edit: weirder -- use console inside pydev eclipse, autocompletes normal callafter , doesn't throw errors. i figured out on own. deleted wx , wxpython forced builtins , loaded wx external library. worked fine after that.

Android: Overflow Menu's Dropdown Position -

i trying style android toolbar (android.support.v7.widget.toolbar) when overflow menu icon clicked, overflow menu appears below toolbar , rather the material design style . material design style not intuitive choice app, default choice when inflate menu (oncreateoptionsmenu). similar posts can found here , here , no solution seems exist overflow menu open below toolbar. see answer this question . can use same listpopupwindow, adjust vertical offset until below toolbar.

Javascript Eval overwriting variable -

don't understand why code below overwriting var arr. appreciated. var arr = [1,2,3] var string = "function swap(arr) { var newarr = arr; var temp = arr[0]; newarr[0] = arr[arr.length-1]; newarr[arr.length-1] = temp; return newarr }" var test = eval("[" + string + "]")[0]; test(arr); console.log(arr); //this outputs [3,2,1] test(arr); console.log(arr); //this outputs [1,2,3] fiddle thanks because in javascript, objects pass reference value , arrays objects. eval irrelevant here. here code producing same issue without eval: var arr = [1,2,3]; var arr2 = arr; // sets reference arr2[1] = 3; // changes arr arr[0] = 3; // changes arr2 arr; // [3, 3, 3] arr2; // [3, 3, 3]