Posts

Showing posts from August, 2013

How can I change only one letter of .mp3 in python? -

so have change letter "ı" because not english character example should change "sanmayın.mp3" "sanmayin.mp3". how can this? from os import rename, listdir fnames = listdir('.') fname in fnames: print fname fname.replace('ý','i') okay got why didn't work listdir gives of names in english python thinks ı i, how can work in utf-8 use str.replace() : s = 'sanmayın.mp3' s.replace('ı','i') result : sanmayin.mp3 if needed replace characters within list: l = ['sanmayın.mp3', 'ın', 'hı'] l = [i.replace('ı','i') in l] result : ['sanmayin.mp3', 'in', 'hi']

reactjs - How to make onMouseLeave in React include the child context? -

i building dropdown button learn react. have made 2 onmouseenter , onmouseleave events in parent div make visible when hovering disappear when not. problem events stick parent. how make onmouseleave in react include child context? or, how can keep state expand true when hovering on children? class dropdownbutton extends react.component { constructor(){ super(); this.handlehoveron = this.handlehoveron.bind(this); this.handlehoveroff = this.handlehoveroff.bind(this); this.state = {expand: false}; } handlehoveron(){ if(this.props.hover){ this.setstate({expand: true}); } } handlehoveroff(){ if(this.props.hover){ this.setstate({expand: false}); } } render() { return ( <div> <div classname={styles.listtitle} onmouseenter={this.handlehoveron} onmouseleave={this.handlehoveroff}> {this.props.name} </div> <div> {react.c...

java - Uploading a File fails with Vaadin Spring PLupload-Addon -

if want upload file specific widget/addon of vaadin, im getting warnings , files not uploaded. i don't have idea, why warning occurres. checking whole addon , saw javascript usage, using post don't why throwing warnings , doesn't work @ all. i checked addon without spring integration , worked well. this warnings: 2015-08-16_15:44:53.777 warn o.s.web.servlet.pagenotfound - request method 'post' not supported 2015-08-16_15:44:53.777 warn o.s.w.s.m.s.defaulthandlerexceptionresolver - handler execution resulted in exception: request method 'post' not supported 2015-08-16_15:44:54.937 warn o.s.web.servlet.pagenotfound - request method 'post' not supported 2015-08-16_15:44:54.938 warn o.s.w.s.m.s.defaulthandlerexceptionresolver - handler execution resulted in exception: request method 'post' not supported 2015-08-16_15:44:55.977 warn o.s.web.servlet.pagenotfound - request method 'post' not supported 2015-08-16_15:44:55.977 ...

ios - How can I change the initial ViewController in LaunchScreen with Swift? -

i want check whether user logged in or not, if user logged in, bring him main screen, or show welcome screen. you can't in launch screen, can achieve same in appdelegate's method didfinishlauchingwithoption , there can check if user logged in or not , set root view controller , don't set initialviewcontroller in storyboard. should nsstring *identifier = isloggedin ? @"identifierforvc1" : @"identifierforvc2"; uistoryboard *storyboard = [uistoryboard storyboardwithname:@"main" bundle:nil]; uiviewcontroller *vc = [storyboard instantiateviewcontrollerwithidentifier: identifier]; self.window.rootviewcontroller = vc; code not tested in editor may have swift code should this let storyboard = uistoryboard(name: "main", bundle: nil) let vc = storyboard.instantiateviewcontrollerwithidentifier(identifier) as! uiviewcontroller self.window?.rootviewcontroller = vc

java - Get Full Path for uploaded Image -

i trying full path of uploaded image access in servlet , store in mysql database, have tried several methods everytime null value, need examples. thanks here doing ----- in jsp ----- <div class="fileupload fileupload-new" data-provides="fileupload"> <div class="fileupload-preview thumbnail" style="width: 50px; height: 20px;"></div> <div> <span class="btn btn-file"><span class="fileupload-new">select image</span> <span class="fileupload-exists">change</span><span></span><input id="myfile" onchange="showfilename()" runat="server" type="file" /></span> </div> </div> <script type="text/javascript"> function showfilename() { var fil = document.getelementbyid("myfile"); var file = fil.value; fil.set...

c# - How to cover all chart area in winform application -

Image
who can me expand plot vertically cover chart area in winforms application? see screenshot. thank answers. the real question is: did create large blank area @ bottom? it looks if have added chartarea ..? there 1 chartarea , 1 series , 1 legend there default. either use these or clear them! i create series myself , short name reference chartareas[0] default area..

Move javascript files into inline html -

i have application allows use of inline javascript, not javascript source files. i'm trying modify webpage open on browser, , need know how put javascript files webpage inline. use <script> tags in html. can go anywhere - prefer inside <head> tag: <head> <script type="text/javascript"> // put here - type of valid javascript works // if import jquery, can use jquery here too! </script> </head>

c++ - G++ Link-time optimisation on Mac - compiler/linker bug? -

i have project uses openmp (which doesn't seem available in current os x default clang setup) use lto. have sections of code in simd intrinsics using sse4 , found g++ unable link code without using os x provided clang linker (flag -wa,-q ). g++ 5.10 installed via homebrew , compiled without multilib. i can compile lto using clang lose parallel 'for's, when add -flto g++ get: lto1: internal compiler error: in add_symbol_to_partition_1, @ lto/lto-partition.c:211 lto1: internal compiler error: abort trap: 6 g++-5: internal compiler error: abort trap: 6 (program lto1) please submit full bug report, preprocessed source if appropriate. see <https://github.com/homebrew/homebrew/issues> instructions. lto-wrapper: fatal error: g++-5 returned 4 exit status compilation terminated. collect2: fatal error: lto-wrapper returned 1 exit status compilation terminated. this occurs without -wa,-q if remove intrinsics can compile remaining code. i have tried simple 2 file p...

Mockmvc put method is not working spring -

i writing test cases spring restful services. have put service in controller, syntax follows @requestmapping(value="/update", method=requestmethod.put) public @responsebody list<paidupresponse> updatestatus( @requestbody @valid paiduprequest paiduprequest, httpservletrequest request, httpservletresponse response) { } to write test case, used following method mockmvc.perform(put("/update").contenttype(unittestutil.application_json_utf8) .content(unittestutil.convertobjecttojsonbytes(request))) .andexpect(status().isok()); but giving compilation error, saying "the method put(string) undefined". suggest me how test put method? you have import appropriate dependency: import static org.springframework.test.web.servlet.request.mockmvcrequestbuilders.put; or import static org.springframework.test.web.servlet.request.mockmvcrequestbuilders.*;

android - fragment navigation drawer items not displaying -

Image
i'm working material design , reason navigation drawer not displaying drawer items. think may have below: my gradle looks normal well. dependencies { compile filetree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:recyclerview-v7:+' compile "com.android.support:appcompat-v7:22.1.0" } recyclerview needs layoutmanager, have added this? recyclerview.setlayoutmanager(new linearlayoutmanager(context)); if still not work, try invalidate cache , restart in android studio. if still not work have download , install recent version of android studio , work.

php - Rendering views in other places in Yii2 - no renderPartial? -

i need render partial view inside custom component file in yii2 , according yii docs can access view instance via this: \yii::$app->view->renderfile('@app/views/site/license.php'); i went ahead , tried: yii::$app->view->renderpartial('//my/view/'); ...but got error trying access non-existent method. i checked out view class , noticed doesn't have renderpartial , method of controller class instead. i see has renderfile method , render method; of these should use? the docs don't state render method includes layout method of same name controller class, i'm not sure; renderfile i'm not 100% sure if suitable either? could explain method produce same results renderpartial produces? you can call renderpartial yii::$app->controller->renderpartial('myview'); can see source code of yii\base\controller renderpartial calls view's render method can use yii::$app->view->render . there no ...

c# - Best practices with saving settings data -

i've got main class on user event shows settings window. there textboxes, radiobuttons etc. after pressing save button, want store data file. i think saving process should inside main class , settings window takes care of displaying current config data, validate new data , send them main class. right? how can "send" current config data main class (which knows config file etc.) window , "send" new data window main class stored? thanks in wpf can use properties.settings (best solution storing application settings). see this. or can create own settings file, example, may create xml file, , store data it. see: xmlserializer datacontractserializer

run "ls" through NSTask in a Cocoa app not working -

i testing use of nstask because want try run bunch of commands within cocoa application written in swift run in terminal. in viewdidload have following code: let task = nstask() let pipe = nspipe() task.standardoutput = pipe task.launchpath = "/usr/bash" task.currentdirectorypath = dir task.arguments = ["ls"] let file:nsfilehandle = pipe.filehandleforreading task.launch() task.waituntilexit() let data = file.readdatatoendoffile() let datastring = nsstring(data: data, encoding: nsutf8stringencoding) print("datastring = \(datastring)") the app runs getting following error: failed set (contentviewcontroller) user defined inspected property on (nswindow): launch path not accessible can me understand doing wrong? trying run ls command , store result array of strings... thanks well, starters, /usr/bash not path bash executable. want /bin/bash . next, not work invoke /bin/bash ls , ...

laravel - MySQL - Combine this into one Query in Eloquent? -

given following schemas: user - id - username friends - user_id - friend_id places - id - name place_user - user_id - place_id users have manytomany relationship via friends pivot. places have manytomany relationships users via place_user how places associated user , user's friends ? assuming we're working user 1, in raw sql, can places associated user's friends : select places.place places inner join place_user on place_user.place_id = places.id inner join friends on friends.friend_id = place_user.user_id inner join users on users.id = place_user.user_id friends.user_id = 1 and can places associated user : select places.place places left join place_user on place_user.place_id = places.id left join users on users.id = place_user.user_id users.id = 1 but how can combine 1 query, , moreover, using eloquent? edit: union of these 2 queries, wondering if there's more succinct, , perhaps less verbose in eloquent

javascript - Message Passing from website to Chrome extension background script -

this question has answer here: sending message chrome extension web page 5 answers i trying communicate data website extension's content script should send background script store in extension's localstorage. have done far following : in webpage , script communicating extension's content script, 1 content script receives message logs in console 'message received' my webpage : <script> var go = function() { var event = document.createevent('event'); event.initevent('appid'); document.dispatchevent(event); } </script> <a href="javascript:go();">click me</a> what want achieve simple make webpage send id cs passes background script ( since knowledge cs can not handle storing data in localstorage ). can 1 suggest necessary modification ? in content sc...

cordova - ionic apk dont show Splash Screens -

i'm building application based on wordpress blog using ionic. added splash screens , switched on device it's not working. took apk file ant-build folder when run on machine not show me anything. not closed right file? settings in xml or incorrect? <?xml version="1.0" encoding="utf-8"?> <widget xmlns:cdv="http://cordova.apache.org/ns/1.0" xmlns:vs="http://schemas.microsoft.com/appx/2014/htmlapps" id="io.cordova.myappe2785d518e9f4f6ea03055878dd7a400" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" defaultlocale="en-us"> <name>kikarnews</name> <description>a blank project uses apache cordova build app targets multiple mobile platforms: android, ios, windows, , windows phone.</description> <author href="http://cordova.io" email="dev@cordova.apache.org">apache cordova team </author> ...

php - How to mock readonly directory using PHPUnit and VFSstream -

i have simple open (file) method should throw exception if fails open or create file in given path: const err_msg_open_file = 'failed open or create file @ %s'; public function open($filepath) { ini_set('auto_detect_line_endings', true); if (false !== ($this->handler = @fopen($filepath, 'c+'))) { return true; } else { throw new \exception( sprintf(self::err_msg_open_file, $filepath) ); } } there unit-test around using phpunit , vfsstream: $structure = [ 'sample.csv' => file_get_contents(__dir__ . '/../samplefiles/small.csv') ]; $this->root = vfsstream::setup('exampledir', null, $structure); $existingfilepath = vfsstream::url('exampledir') . directory_separator . 'sample.csv'; $this->file = new file(); $this->file->open($existingfilepath); the above setup creates virtual directory structor containing mock file (read/cloned e...

regex that checks if the string starts with two upper-case followed by numbers -

hi guys need regex checks if string starts two upper-case followed numbers : example: de123456789 thanx lot of. literally: ^[a-z]{2}\d+ ^ - start of string [a-z] - upper case letter {2} - 2 of those \d - digit + - 1 or more of those

node.js - findByIdAndUpdate With Multiple Subdocuments -

so i'm working nodejs , mongodb, , i'm making endpoint lets clients update user profiles several optional data fields. so, 1 of update queries can this: { name: { givenname: 'first' }, about: 'whatever', auth: { password: 'hashedpw' } } the mongoose api docs state following info findbyidandupdate : top level update keys not atomic operation names treated set operations. so top level key, about , works fine update. however, nested keys, name , auth overwritten update values, rather having values set. now go through , manually change each of fields $set key, there lot of different fields, pretty annoying. there easy way apply $set rule subdocuments well? i.e. transform statement this, mongoose option or something: { $set : { name: { givenname: 'first' } }, $set : { about: 'whatever' }, $set : { auth: { password: 'hashedpw' } } } you need tranform input object "dot notation...

reporting services - SSRS Reports parameters greyed out and not rendering -

in our production environment have ssrs 2008 r2. when trying access reports using http://{servername}:{port}/reports parameters greyed out, , report not rendering @ all. when trying access reports using http://{servername}:{port}/reportserver or using report builder working fine, parameters available , rendering reports. can root cause issue? checked the processing options , not snapshot based.

ios - UICollectionView showing only one cell - which changes when the view is scrolled -

i have uicollectionview supposed show items array. have checked array - , populated right number , type of objects. the uicollectionview shows 1 uicollectionview cell - , changes when pull cell down previous object. i've not seen behaviour before. below code: (it's sourcetankcollectionview causing problem (and assume destination collection view cell too) - (uicollectionviewcell *)collectionview:(uicollectionview *)collectionview cellforitematindexpath:(nsindexpath *)indexpath { if (collectionview==self.movementsindexcollectionview) { transferslistcollectionviewcell* tempcell = [collectionview dequeuereusablecellwithreuseidentifier: @"transfer list cell" forindexpath:indexpath]; if (!tempcell) { tempcell = [[transferslistcollectionviewcell alloc] init]; } movement* thismovement = [self.arrayofallmovements objectatindex:indexpath.item]; tempcell.sourcetanklabel.text = thismovement.sourcetan...

How can I make a MANDATORY form field in Microsoft 2010 with VBA? -

i'm new vba i'm learning quick. need making mandatory form fields in microsoft word. user should not able save or save & send document without filling in of mandatory form fields. i found below code online: sub mustfillin() if activedocument.formfields("text1").result = "" sinfld = inputbox("this field must filled in, fill in below.") loop while sinfld = "" activedocument.formfields("text1").result = sinfld end if end sub but not know how rename field in microsoft word. example, first form field, should called "firstname" instead of "text 1". how name form field in microsoft word 2010? thanks in advance, mark you can use control's tag property this. see here . word 2010, newer versions should work same.

Yield a result from a list of Scala Future -

i brand new scala future s , working on simple task. i have following function returns list of future , want read result (and block until future finished). private def findall(classname: string): list[future[vector[parseobject]]]= { def find(query: parsequery[parseobject], from: int, limit: int) = { query.skip(from) query.limit(limit) future(query.find().asscala.tovector) } val count = parsequery.getquery(classname).count() val skip = 1000 val fromandlimit = (from <- 0 count skip) yield (from, if (from + skip < count) skip else count - ) println("fromandlimit: " + fromandlimit) (for((from, limit) <- fromandlimit if limit > 0) yield find(parsequery.getquery(classname), from, limit)).tolist } as appears, function try read objects parse.com , return objects in 1 big vector . (code snippet appreciated; right not trying learn future, want solution case). if want compose futures 1 call: val composi...

regex - PHP Regexp header (session id) -

i have following code : $html = get_data($url); i want extract session id code, has following form : phpsessid=aaabbb123456789; i'd store session id (only id) in var. use regexp : preg_match('#phpsessid=(.+?);#is', $html, $result); i want, $result tab contains 2 strings. here var_dump() : array(2) { [0]=> string(37) "phpsessid=aaabbb123456789;" [1]=> string(26) "aaabbb123456789" } i preg_match() return id, in $result[1] . should change in regexp ? thanks the result list of regex matches has first result being entire string. php's preg_match() guarantees well: if matches provided, filled results of search. $matches[0] contain text matched full pattern, $matches[1] have text matched first captured parenthesized subpattern, , on. so can safely extract value $result[1] without worrying might change , cause warning.

java - ClassCastException when casting array to readObject -

i have run array of object student (where there's 3 students): try { out = new objectoutputstream (new bufferedoutputstream (new fileoutputstream ("students.dat"))); out.writeobject(s[0]); out.writeobject(s[1]); out.writeobject(s[2]); out.close(); } catch (ioexception e) { system.out.println("error writing student data file."); } } and each student object must set this: for (int = 0; i<3; i++) { system.out.println("the following information applies student " + (i+1)); system.out.println("what student's name?"); string name = input.nextline(); if (i == 0) { system.out.println("please enter name again."); } name = input.nextline(); system.out.println("what social security number of student?"); string ssn = input.next(); system.out.println(...

android - Add a list of TextViews and ImageViews to an existing RelativeView programmatically -

i have relativelayout id of relative_layout_bottom trying add content programmatically. looping through <textview, imageview> dictionary , adding entries follows: i want left side (align parent left) of relativelayout have list of textviews going downwards, , right side (align parent right) of relativelayout have list of imageviews going downwards this: |textview#1 imageview#1| |textview#2 imageview#2| |textview#3 imageview#3| |textview#4 imageview#4| | . . | | . . | | . . | i can't seem figure out how though, nothing showing me. can edit in code have if cares see i'm pretty sure it'd more useful come different solution fix mine. here xml, using 1 textview , imageview going append to? not sure if works that, or if should programmatically make individual textview , imageview each entry. <linearlayou...

java - Initial spring mvc configuration: Servlet.init() for servlet Dispatcher Servlet threw exception -

Image
i have checked of question , answers problem haven't found solution. the error happens when run web app in tomcat ( have tried tomcat 7.0.57 , 8.0.24). github project: https://github.com/gdiazcamilo/springmvc_intro web.xml <?xml version="1.0" encoding="utf-8"?> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> <servlet> <servlet-name>springdispatcherservlet</servlet-name> <servlet-class>org.springframework.web.servlet.dispatcherservlet</servlet-class> <init-param> <param-name>contextconfiglocation</param-name> <param-value>/web-inf/config/servlet-config.xml</param-value> </init-param> ...

css - Centered text 2nd line pushed over -

Image
on website have content box in middle, , have 2 lines of centered text. second 1 seems pushed over, despite centered tags. have highlighted text in image: my code follows: <div id="welcometext"> <center> <h2>bitcoin payments made easy.</h2> <h3>our services make easier <br>to start accepting bitcoin.</h3> </center> </div> my css follows: #welcometext { position: relative; top: 50%; transform: translatey(-50%); } #welcometext h2 { color: #fff; font-family: "pt sans"; font-weight: 700; font-size: 35px; } #welcometext h3 { color: #fff; font-family: "pt sans"; font-weight: 400; font-size: 20px; } i need figure out how center it. thank you. edit: fixed problem making inline-block , floating left, think conflicting navbar. thank helped.

html - CSS box around text, set box size -

i want create boxed border around text, numbers. want box same size, no matter if single digit number or triple digit number. i've tried couple things, every time border wraps number. number wrap tag. strong{ border: 1px; border-style: solid; font-size:12px; } you have give fixed width element strong { display: inline-block; width: 50px; border: 1px solid #000; text-align: center; } http://jsfiddle.net/lcpvgykr/

is it possible to grab data from an .exe file in c++? -

i new @ c/c++, want call .exe file displays 2 numbers , able grab 2 numbers use them in code. call .exe file i've used system command, still not able grab 2 numbers displayed .exe file char *files = "mypath\file.exe"; system (files); i think better aproach: here create new process, , read data process gives you. tested on os x 10.11 .sh file , works charm. think work on windows also. file *fp = popen("path exe","r"); if (fp == null) { std::cout << "popen null" << std::endl; }else { char buff[100]; while ( fgets( buff, sizeof(buff), fp ) != null ) { std::cout << buff; } }

scala - Starting Actors on-demand by identifier in Akka -

i'm implementing system that receives inbound messages external monitoring system. i'm translating these messages more concise 'events', , i'm using these alter state of 'managed system' objects. akka actors seemed use case encapsulating mutable state in concurrent applications. the managed systems identified name (99% of time hostname). whenever proper event received, system routes message correct actor based on name property. @ first used use actorselection , complete paths of said actors, ugly, , saw several people advise against relying on qualified name of actor deliver message. i've set simple eventbus, great can do: eventbus.subscribe(subscriber1, "/managedsystem01") eventbus.subscribe(subscriber2, "/managedsystem02") eventbus.publish(monitoringevent("/managedsystem01", monitoringmessage("managedsystem01", "n", "cpu_load_high", true))) eventbus.publish(monitoringevent("/mana...

php - Should I user Paypal on the server side or client side for a Phonegap App? -

i'm working on new shop app people can buy tickets. use paypal payement system directly app. don't want users leave app. i saw online there librairies paypal on both client end , server end. cordova/phonegap plugin : https://github.com/paypal/paypal-cordova-plugin codeigniter / php plugin : https://github.com/angelleye/paypal-php-library first question : need integrate both platforms ? if no, best option, should payment on server or directly customer's phone ? many thanks the cordova-plugin built on top of paypal mobile sdk libraries, provides native in-app payment integration. literally able implement complete payment flow mobile platform sdk (skip payment-verify step on server side), depend on use cases are. here're recommended solutions need work on both platforms the payment can either (1) immediate payment servers should subsequently verify, or (2) authorization payment servers must subsequently capture, or (3) payment order servers must ...

cookies - python web crawler with ticket authentication -

the website i'm trying crawl have login page like: <form method="post" action="/login" enctype="multipart/form-data"> <table><tbody><tr><td>name</td> <td><input type="text" name="user"></td> </tr> <tr><td>password</td> <td><input type="password" name="password"></td> </tr> </tbody> </table> <input type="hidden" name="request_uri" value="/index.html"> <input type="submit" name="log in" value="log in"> <p></p></form> an access ticket generated server after login data (account , password) have been validated, containing information grant access restricted areas of site. this ticket, along additional...

multithreading - Refactoring slow functions in delphi -

i refactoring old application make bit more responsive , have form using devexpress components , creates custom grid using callbackcustomdrawpreviewcell, problem function slow takes 0.09s per call call 30 60 times each time form open form can take 2.8s 5.6s open. program c# , object-c/swift can dispatch block process in background, far research go don't have nothing similar in delphi, seems in delphi new thread has whole new , independent piece of code. assumptions correct? if best type of solution improve speed in kind of situation? (i using delphi xe) (in case helps: bought aqtime try me figure out how improve had no luck far it, still need dig manuals little more. did me find problem in speed in particular callback) thanks in advance. the function is: procedure ttvdavaoutagemanagementform.callbackcustomdrawpreviewcell(sender: tcxcustomtreelist; acanvas: tcxcanvas; aviewinfo: tcxtreelisteditcellviewinfo; var adone: boolean); const alignflag = dt_left or dt_wordb...

swift - Parse get data with block not assigning value to variable in scope -

having issues assign uiimagefile = image! . if try assign self.myimage = image! myimage global variable works. is possible done? the code retrieving images ok, cell take image if pointed directly. bridge not working. , not work image. also following test line println("teststring\(indexpath.row)") above return being able , print value teststring = "\(indexpath.row)" inside getdatainbackgroundwithblock . sorry question title. not sure how resume issue in single sentence. func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell { let cellidentifier = "cell" let cell = tableview.dequeuereusablecellwithidentifier(cellidentifier, forindexpath: indexpath) as! hobbiefeedtableviewcell let object: pfobject = self.timelinedata.objectatindex(indexpath.row) as! pfobject var mytext = object.objectforkey("posttext") as? string let userimagefile = ob...

macvim - Vim Round floats to one decimal place -

i'm setting function in .vimrc (using macvim in particular, should universal vim in general) display file sizes (in bytes, kilobytes, , megabytes) in statusline. while function works quite without errors, it's giving me unexpected output! in hindsight, it's producing output should, not output want. here's function: " modified filesize() function shown here suit own preferences: " http://got-ravings.blogspot.com/2008/08/vim-pr0n-making-statuslines-that-own.htm function! statuslinefilesize() let bytes = getfsize(expand("%:p")) if bytes < 1024 return bytes . "b" elseif (bytes >= 1024) && (bytes < 10240) return string(bytes / 1024.0) . "k" elseif (bytes >= 10240) && (bytes < 1048576) return string(bytes / 1024) . "k" elseif (bytes >= 1048576) && (bytes < 10485760) return string(bytes / 1048576.0) . "m" elsei...