Posts

Showing posts from April, 2011

python - Passing in variables into functions -

this code uses trigonometry in order find missing sides on triangle. works using sohcahtoa find these sides. problem code when try run code gives me invalid syntax when call user defined function: "get_method". please can tell wrong code , how solve consistent problem occurs in programmes. import math def get_method(question, method): print("lable right-angle triangle.") question = input("what trying find? type 'h' hypotenuse, 'a' adjacent or 'o' opposite.").lower().strip() method = "" if question == "h": opposite_verify = input("do have length of opposite?\n" "type 'yes' or 'no'").strip().lower() if opposite_verify == "yes": method = "sine" elif opposite_verify == "no": adjacent_verify = input("do have length of adjacent?\n" ...

shell - curl call with parameters into variable doesn't work -

i'm working installr api. i'm trying following curl request via script : curl -h "x-installrapptoken: mytoken" https://www.installrapp.com/apps.json/ \ -f 'qqfile=@'$apkpath \ -f 'releasenotes=these release notes' \ -f 'notify=true' and works perfectly. however, when try release notes file variable : releasenotes=`cat "release_notes/test.md"` curl -h "x-installrapptoken: mytoken" https://www.installrapp.com/apps.json/ \ -f 'qqfile=@'$apkpath \ -f 'releasenotes='$releasenotes \ -f 'notify=true' > /dev/null it doesn't work @ all, first word sent. others, have error not resolve host: xxx. i did echo on these 2 curl request , exact same thing printed. cat command return specific format ? probably issue quotes , spaces. can use double-quotes around variable allow variable expansion in shell. releasenotes=$(cat "release_notes/test.md") curl -h "x...

ios - How to put timeout to NSTimer in swift? -

i have nstimer object below : var timer = nstimer.scheduledtimerwithtimeinterval(1, target: self, selector: "updatetimer", userinfo: nil, repeats: true) i want put timeout timer. maybe know postdelayed method in android. want same thing's swift version. how can ? nstimer not suited variable interval times. set 1 specified delay time , can't change that. more elegant solution stopping , starting nstimer every time use dispatch_after . borrowing matt's answer : // makes playground work gcd xcplaygroundpage.currentpage.needsindefiniteexecution = true struct dispatchutils { static func delay(delay:double, closure:()->()) { dispatch_after( dispatch_time( dispatch_time_now, int64(delay * double(nsec_per_sec)) ), dispatch_get_main_queue(), closure) } } class alpha { // delay time var currentdelay : nstimeinterval = 2 // delayed function ...

html - List styling, CSS selectors -

i want select first child(list item) of ordered list, did using. .ci-content ol.my-list > li:first-child{ color:green; //selected item in green.. } check problem here can achieve same without using "my-list" class in selector?...how restrict depth of selection. note: can have ol anywhere, not inside '.ci-content' always. <ol class="my-list">first set <li>one</li> <li>two <ol> <li>two.one </li> <li>two.two</li> <li>two.three</li> </ol> </li> <li>three</li> <li>four</li> </ol> <br><br> <ol class="my-list">second set <li>one</li> <li>two</li> <li>three <ol> <li>three.one</li> <li>three.two</li> <ol> <li>three.two.one</li> ...

Tab-specific, non-intrusive notification in a chrome extension -

i'm developing chrome extension. when user goes options page, might modify setting require them refresh tabs have in they're using extension. if user changes 1 of these settings, goes tab requires refresh, i'd notify them of in non-intrusive way. is there part of api doing sort of thing, or other recommended way of doing it? thinking of maybe little message comes down top of page, can closed, or popup coming out of browser action. you have many options.. name few: do not require it. as can, make (presumably) content script adapt new settings. it's far better ux - in cases. least intrusive update browser action / page action icon if use one. both apis allow per-tab change of icon/badge. animate little bring attention. an in-page notification injected dom. sort of toast or <dialog> . watch tab changes chrome.tabs events, , on activation of affected tab, such chrome.notifications notification .

javascript - Failed initializing html tab with server data -

i creating html page 2 tabs. when click on tab 1, loads table data 1. when click on tab 2, loads table data 2. tab 1 working expected. however, when click on tab 2, data isn't loaded. controllers identical. difference? here relevant html code. tab id "tabledata" loads data , tab id "correlations" doesn't load. <div> <ul class="nav nav-tabs" role="tablist"> <li role="presentation"><a href="#tabledata" aria-controls="tabledata" role="tab" data-toggle="tab">table data</a></li> <li role="presentation"><a href="#correlations" aria-controls="correlations" role="tab" data-toggle="tab">correlations</a></li> </ul> <!-- tab panes --> <div class="tab-content"> ...

php - Rewrite Rule not working or rendering page properly -

i making social networking site have many users. such, need simpler, easier way users page. assume logged in freddy, if go freddy's profile page, url say: http://localhost/profile_page.php . if page, want go to, let's say, alice's profile page, can modify url , type http://localhost/profile_page.php/alice rather writing http://localhost/profile_page.php?u=alice . i have created .htaccess file , have enabled rewrite_module apache modules in wamp. however, page not load appropriately. again, assume logged in freddy, profile page loads perfectly, when edit url go users page, i.e. http://localhost/profile_page.php/alice (who real user, expect go alice's profile page), not render page instructed via css , stays on freddy's profile page. .htaccess : rewritebase /www/ rewriteengine on rewriterule ^([a-za-z0-9_-]+)$ profile.php?u=$1 rewriterule ^([a-za-z0-9_-]+)/$ profile.php?u=$1 well, rules not considering php file here (check i've added slash be...

swift - Access Location when an app is killed/terminated on iOS 9 -

i'm trying build app based on notifications according location of user. i've searched while solution situation user kills app (meaning not anymore in background). according ricky ( http://mobileoop.com/getting-location-updates-for-ios-7-and-8-when-the-app-is-killedterminatedsuspended ) can launchoptions key "uiapplicationlaunchoptionslocationkey". does knows if works ios9 or have other solution ?(doesn't work when try) thanks in advance ;)

mysql - SSMA Migration error -

i doing migration mysql sql server. 1 of table not migrated reason follows create table `user_tb` (`user_id` int(11) not null auto_increment, `username` varchar(30) not null, `password` text not null, `salt_id` varchar(20) not null, `emailid` varchar(50) not null, `gender` enum('male','female') default null, `country` int(5) default null, `pincode` int(8) default '0', `dob` date not null default '0000-00-00', column 'dob' not allow dbnull.value. i using sql server migration assistant (ssma) please suggest.. int(8) default '0', dob date not null default '1500-01-01', >> yyyy-mm-dd you musn't write default value 0, must 1. cause dob date not null mean can't have null value, cause of default value 0 , become 0000-00-00 , null,, tried change 1 of course, date value not have 00 day , 00 month or impossible 0000 year. try set year default value minimum of years in database. 2000 or ...

selenium - Test method not run with sequence in testng -

i using testng + webdriver automation project order of test execution not working expected have specified order each method below method signature , notation @test(dependsonmethods="verifyelementsonprofilescreen",alwaysrun = true) public void verifymyselfprofilevisibility(){ testsuit have using : <?xml version="1.0" encoding="utf-8"?> <!doctype suite system "http://testng.org/testng-1.0.dtd"> <suite name="regressionsuite" parallel="none"> <parameter name="applicationopt" value="web"></parameter> <parameter name="browser" value="firefox"></parameter> <test name="test"> <classes> <!-- login module --> <class name="tests.login.loginapp"/> <method> <include name ="loginuser"></include> </method> ...

Wordpress How to divide the tag on languages -

i need display 2 tag clouds. in 1 cloud have english tags , other japanese. site has more 3000 tags need somehow handle them through wp_tag_cloud (). it's real? it possible manual test output? example $args 'lan' wp_tag_cloud('number=50&orderby=count&lan=en');

AngularJS - Get first element -

i have set service events: app.service('eventservice', function (event) { var self = { 'selectedevent': null, 'page': 1, 'hasmore': true, 'isloading': false, 'events': [], 'loadevents': function () { if (self.hasmore && !self.isloading) { self.isloading = true; var params = { 'page': self.page, 'place_id': "{{ request()->get('place_id') ?: '' }}", 'category_id': "{{ request()->get('category_id') ?: '' }}", 'date': "{{ request()->get('date') ?: '' }}", 'date_from': "{{ request()->get('date_from') ?: '' }}", ...

Typo3 permissions of uploaded files -

when upload file (in case image) in typo3 admin user , set resource of page file ends without public read permissions. way image not displayed since "403 forbidden" message when try open file in webbrowser. can see file permissions in filezilla. when check "read" option under "public permissions" within file properties works fine. how can tell typo3 set public read permission default? or in more general: how can typo3 set public read permission properly? i'm working version 6.2.11 edit: suggested file masks helped me solve th eproblem permissions. after changed masks links images within generated website point "fileadmin/_migrated/.." folder doesn't exist , didn't make update. ideas on that? go install tool , open section [be]. there 2 options: foldercreatemask , 'filecreatemask'. filecreatemask must set 0664 , 'foldercreatemask' must 2775 . if not work, check (together sysadmin) whether umask on o...

python - Can't figure out why numpy.log10 outputs nan? -

so have 500k array of floating values. when trying to: np.log10(my_long_array) 270k numbers getting replaced nan, , not small. example: in [1]: import numpy np in [2]: t = -0.055488893531690543 in [3]: np.log10(t) /home/aydar/anaconda3/bin/ipython:1: runtimewarning: invalid value encountered in log10 #!/home/aydar/anaconda3/bin/python3 out[3]: nan in [4]: type(t) out[4]: float what missing? the logarithm of negative number undefined, hence nan from docs numpy.log10 : returns: y : ndarray the logarithm base 10 of x, element-wise. nans returned x negative .

TYPO3 7.6.4 backend language not changing/downloading -

Image
i installed typo3 7.6.4 (lts). went backend, downloaded german language , under user preferences changed admin language "german". after clearing caches , relogging, nothing has changed. typo3 tells me language files have been downloaded successfully, there no data in directory typo3conf/l10n/ it's empty. folder access rights 777 . any suggestions? you have enable "curluse" backend installtool or in localconfiguration.php 'sys' => [ 'curluse' => '1', ] for example:-> after able download language available translation files of extensions. after can enable user settings

php - PHPSample OAuth connect QBO 401 -

i trying connect quickbooks online. have tried several packages including phpsample, sample code within v3 sdk, , java example time accounting. end similar problem in each. i able connect quickbooks, , retrieve realmid, oauth token , oauth secret. in state, able disconnect. when subsequently connect , try query data (for example, accounts) 401 error. here return info (with keys removed) error: invalid auth/bad request (got 401, expected http/1.1 20x or redirect) response: 401 - message=applicationauthenticationfailed; errorcode=003200; statuscode=401 signaturebasestring: post &https%3a%2f%2fsandbox-quickbooks.api.intuit.com%2fv3%2fcompany%2f<realm_id>%2fquery&minorversion%3d3%26oauth_consumer_key%3d<consumer_key%26oauth_nonce%3d2172856b0bd6c51a491.36540409%26oauth_signature_method%3dhmac-sha1%26oauth_timestamp%3d1454423404%26oauth_token%3d<oauth_token>%26oauth_version%3d1...

scipy - Python nearest neighbour - coordinates -

Image
i wanted check using scipy's kd tree correctly because appears slower simple bruteforce. i had 3 questions regarding this: q1. if create following test data: nplen = 1000000 # wgs84 lat/long point = [51.349,-0.19] # contains wgs84 lat/long points = np.ndarray.tolist(np.column_stack( [np.round(np.random.randn(nplen)+51,5), np.round(np.random.randn(nplen),5)])) and create 3 functions: def kd_test(points,point): """ kd tree""" return points[spatial.kdtree(points).query(point)[1]] def ckd_test(points,point): """ c implementation of kd tree""" return points[spatial.ckdtree(points).query(point)[1]] def closest_math(points,point): """ simple angle""" return (min((hypot(x2-point[1],y2-point[0]),y2,x2) y2,x2 in points))[1:3] i expect ckd tree fastest, - running this: print("co-ordinate: ", f(points,point)) print("index: ...

python 2.7 - Ways to set default value for class attribute without using hasattr -

i have set attribute class instance in case if doesn't exist. using code below achieve that: class o(object): pass o = o() if not hasattr(o, 'some_attr'): setattr(o, 'some_attr', none) print o.some_attr is there better way perform such action ? classes , instances has own namespace represented pre-defined __dict__ attribute dictionary, method setdefault used instead of if hasattr -> setattr flow add new attribute class instance: class o(): pass o = o() o.__dict__.setdefault('some_attr', none) print o.some_attr method sugggested @martijnpieters : also access __dict__ attribute vars function , call setdefault method in code sample above: vars(o).setdefault('some_attr', none) print o.some_attr

.net - C# nuance omnipage OCR SDK Engine.SetLicenseKey() -

im using nuance omnipage ocr sdk. while compiling got error: engine initialization error, or no appropriate license. found should use engine.setlicensekey() method. what file , license key should provide engine.setlicensekey()? try { list<ocr_error> ocrerrors = new list<ocr_error>(); system.console.write("** title: nuance capture development system csharp sample01 application **\n"); system.console.write("initializing engine -- engine.init\n"); engine.setlicensekey("licensefile.lcx", "licensekey"); engine.init("companyname", "projectname"); if (engine.recerr == recerr.api_init_warn) { ocrerrors.add(new ocr_error() { message = "module initialization warning. 1 or more recognition modules haven't been initialized properly.", innermessage = "for more information, see engi...

angularjs - How to load REST resources in Angular-Seed bootstrap project from a JEE7 back-end -

i trying learn hot invoke restful service i've implemented in jee7. using bootstrap template angular-seed , file structure in tutorial using looks bit different. can't seam figure out how $routeprovider , controller relate each other. the file structure have , similar current angular-seed structure. app/ bower_components/ components/ view1/ view1.html view1.js view1_test.js view2/ view2.html view2.js view2_test.js app.css app.js controller.js service.js index.html index-async.html include service , controller in index.html . <script src="bower_components/angular-resource/angular-resource.js"></script> <script src="services.js"></script> <script src="controller.js"...

tfs - Cannot add powershell snapin, when executing from MSBuild project -

i have powershell script, adds snapin. if ((get-pssnapin | select-string "microsoft.teamfoundation.powershell") -eq $null) { add-pssnapin microsoft.teamfoundation.powershell } it works when invoking powershell command line however, when invoke build.proj (msbuild project) using: <exec command="powershell -executionpolicy unrestricted -command &quot;&amp; { . \&quot;$(sourcedir)myscript.ps1\&quot;; }&quot;" logstandarderroraserror="true" continueonerror="false"/> it says: the windows powershell snap-in 'microsoft.teamfoundation.powershell' not installed on computer. build.proj(82,5): error : add-pssnapin : windows powershell snap-in 'microsoft.teamfoundation.powersh build.proj(82,5): error : ell' not installed on computer. you need install microsoft.teamfoundation.powershell snapin on build agent before can add snapin session. believe part of microsoft visual stud...

r - Adding a footnote / thanks to Rmarkdown title slide -

i have include note in title slide declaring source of funding. able in lyx / latex through: \author{michael chirico\thanks{these people gave me money}, other authors} i have not been able reproduce in rmarkdown. site mentions using [^] anchoring mark footnotes, , works fine in other slides, couldn't work in title: --- title: "title" author: "michael chirico[^thanks], other authors" date: "february 10, 2016" output: beamer_presentation [^thanks]: these people gave me money --- the .pdf compiles there no title slide. think relevant part of compilation log: pandoc: not parse yaml header: unexpectedevent {_received = (eventsequencestart nothing), _expected = nothing} "source" (line 1, column 1) if move [^thanks] outside header, .pdf compiles there no footer on title page (nor anywhere else), , [^thanks] appears as-is on title slide. how can add footnote/thanks section title slide? you use inline note . regular...

database - Clean the URL like of Google+ -

sorry brief title. wondering how google+ makes user urls clean. mean : https://plus.google.com/+puruvijay take me page. want know how + after/ put , how loaded corresponding page. want database url. url should have been plus.google. com/user?id=134566 looking answer please help edit: example of page's url you can that... need create folder of name e.g. http://yoursite.com/ puruvijay here puruvijay folder need create in website directory.. , put index file in folder

java - EditText's drop down number pad shows "next." How to force "Done?" -

i have fragment (a tab) edittext, spinner , 2 numberpickers, in order. when user "clicks" on edittext number pad drops down. not show "done." instead shows "next" , although number picker covered, next number entered goes second numberpicker. (in c++ windows have controlled z order. not sure why first numberpicker skipped.) the default in numberpickers user want. how can force number pad show done after 1 , edittext widget has been satisfied? the form not vertically scrollable. you need use imeoption property of edittext . set value actiondone android:imeoptions="actiondone"

powershell - Transfer Users groups in AD with an audit trail -

i need copy users groups anothers , have audit trail. this code have: #this user name of account want copy. $old = read-host #this user account want copy to. $new = read-host get-adprincipalgroupmembership $old | set-adprincipalgroupmembership $new | export-csv "pathhere" -notypeinformation this code thought might work #this user name of account want copy. $old = read-host #this user account want copy to. $new = read-host get-adprincipalgroupmembership $uold | set-adprincipalgroupmembership $new | export-csv "pathhere" -notypeinformation i have no idea need complete should simple command in powershell.

javascript - jQuery highlight effect does not work with Bootstrap's row classes -

i using jquery , bootstrap 3 on site. have table uses bootstrap's table-striped class different colored rows. several of rows have added "danger" class bootstrap show row in red. have several anchors, jump down particular row, , want action have temporary highlight row, user knows row jumping to. if jumped-to row not have "danger" class added, highlight works fine, if row has danger class, highlight not happen. here's table (condensed somewhat) <div class="table-responsive"> <table class="table table-striped table-condensed"> <tr id="11111-row" class="class1 class2 "> <td><a name="11111">blah</td> <td><a href="#33333" onclick="flashrow(33333)">33333</a>)</td> </tr> <tr id="22222-row" class="class1 class2 "> <td><a name="22222">blah...

python - Displaying contents of web scrape -

the code below displays fields out onto screen.is there way fields "alongside" each other appear in database or in spreadsheet.in source code fields track,date,datetime,grade,distance , prizes found in resultsblockheader div class,and fin(finishing position) greyhound,trap,sp timesec , time distance found in div resultsblock.i trying them displayed track,date,datetime,grade,distance,prizes,fin,greyhound,trap,sp,timesec,timedistance in 1 line.any appreciated. from urllib import urlopen bs4 import beautifulsoup html = urlopen("http://www.gbgb.org.uk/resultsmeeting.aspx?id=135754") bsobj = beautifulsoup(html, 'lxml') namelist = bsobj. findall("div", {"class": "track"}) name in namelist: print(name. get_text()) namelist = bsobj. findall("div", {"class": "date"}) name in namelist: print(name. get_text()) namelist = bsobj. findall("div", {"class": "datetime"}) na...

javascript - Using angular 2 without typescript compiler -

i'm wanting learn , switch app on angular 2 i'm having problem typescript. problem being i'm not able use it. in current environment can't use use compiler. im having run off of node.exe (node.js executable) not full node.js application executable means can't run npm. angular 2 written in typescript needs compiled javascript before being sent browser. there way can pre-compiled version of angular 2 (so in javascript) can write code in javascript , have run without compiler? if not there way can manually install , use typescript compiler node.exe executable. to clear isnt because don't want use typescript because in current situation cannot install typescript. angular2 available in typescript, javascript , dart. no need use typescript. see - https://angular.io/docs/js/latest/index.html - http://blog.thoughtram.io/angular/2015/05/09/writing-angular-2-code-in-es5.html - http://blog.thoughtram.io/angular/2015/07/06/even-better-es5-code-for-angula...

casting - Why is calling float() on a number slower than adding 0.0 in Python? -

what reason casting integer float slower adding 0.0 int in python? import timeit def add_simple(): in range(1000): = 1 + 0.0 def cast_simple(): in range(1000): = float(1) def add_total(): total = 0 in range(1000): total += 1 + 0.0 def cast_total(): total = 0 in range(1000): total += float(1) print "add simple timing: %s" % timeit.timeit(add_simple, number=1) print "cast simple timing: %s" % timeit.timeit(cast_simple, number=1) print "add total timing: %s" % timeit.timeit(add_total, number=1) print "cast total timing: %s" % timeit.timeit(cast_total, number=1) the output of is: add simple timing: 0.0001220703125 cast simple timing: 0.000469923019409 add total timing: 0.000164985656738 cast total timing: 0.00040078163147 if use dis module, can start see why: in [11]: dis.dis(add_simple) 2 0 setup_loop 26 (to 29) ...

performance - Is it worth batching subscriptions in Meteor? -

when displaying list of documents, can clearer write subscription @ document level (vs @ list level), in case template reused somewhere else instance. less efficient or meteor handling things magically? more precisely, can put document logic in document template: template.itemslist.helpers({ items: function() { return this.itemsids.map(function(id) { return { _id: id }; }); }, }); <template name="itemslist"> {{#each items}}{{> item}}{{/each}} </template> template.item.oncreated(function() { this.subscribe('item', this.data._id); }); <template name="item"> {{#if template.subscriptionsready}} ... {{/if}} </template> or subscribe once documents @ list level: template.itemslist.oncreated(function() { this.subscribe('items', this.data.itemsids); }); template.itemslist.helpers({ items: function() { return items.find({_id: {$in: this.itemsids}}); }, }); <template name="itemsl...

jsf - Unable to disable webpage caching in google chrome -

i have form fields, <p:inputtext> , <p:selectonemenu> , trying prevent user navigating previous page, without clearing form fields or request new page, referring this question, tried implement filter: @webfilter("/*") public class loginfilter implements filter { @override public void dofilter(servletrequest request, servletresponse response, filterchain chain) throws ioexception, servletexception { httpservletrequest req = (httpservletrequest) request; httpservletresponse res = (httpservletresponse) response; //if (!req.getrequesturi().startswith(req.getcontextpath() + resourcehandler.resource_identifier)) { // skip jsf resources (css/js/images/etc) res.setheader("cache-control", "no-cache, no-store, must-revalidate"); // http 1.1. res.setheader("pragma", "no-cache"); // http 1.0. res.setheader("expires", "0"); // proxies. ...

ios - Autoresizing of cells in UICollectionViewCell in accordance with the frame size -

Image
how can make cells in collection view auto resize minimum of 4 cells can @ least fit in single row, , if frame size of ipad, more cells fit in row. 4 cells should minimum number of cells in row, please see pictures below further clarification: i have collection view allows me add images using picker view controller, @ first collection view looks this: i can further add images collection view , after adding several images, like: right if there 4 images, fourth 1 goes next row, want system autoresize cells based on frame size minimum 4 cells shown in 1 row. i'm newbie , quite new collection view, can please me on this? you can decide size of collectionview's cell using following method: func collectionview(_ collectionview: uicollectionview, layout collectionviewlayout: uicollectionviewlayout, sizeforitemat indexpath: indexpath) -> cgsize{ // return different cells size let screenbounds = uiscreen.main.bounds var width = screenbounds.width...

class - C# - Why am I getting a null reference exception? -

i confused why getting null reference exception when trying return dataset. i have handler , dbaccess classes in ntier architecture. first here portion on casefile handler/and access classes working fine. i'm including them because cant see why works , other doesn’t. public class casefilehandler { casefileaccess caseaccess = null; public casefilehandler() { caseaccess = new casefileaccess(); } public dataset getcasefiledataset(int caseid) { return caseaccess.getcasefiledataset(caseid); } public bool updatecasefile(casefile casefile) { return caseaccess.updatecasefile(casefile); } } and here access class. method returns dataset working fine. public class casefileaccess { const string connection_string = "data source = sqlserver;initial catalog=casemanager;integrated security=sspi;"; dbmanager _dal = new dbmanager(dataprovider.sqlserver, connection_string); public casefil...

Use an if statement in Javascript to determine if a cell in a google spreadsheet has contents -

this code gets values different locations in sheet , writes combined data sheet. problem is, if row blank, code copies blank row receiving sheet. first check cell "b8" , , if blank, skip function , run next function. if cell "b8" has data in (anything, date), run function copy code new sheet. here code: function submitbuttonclick() { //begining of entry8 transfer start. var ss = spreadsheetapp.getactive(); var sheet = ss.getactivesheet(); logger.log('sheet.getname(): ' + sheet.getname()); if (sheet.getname() !== "timecardentry") {return;}; var targetsheet = ss.getsheetbyname("timesheetrecord"); var arrayofdata = []; var weekbegining = sheet.getrange(4, 11).getvalue(); var employname = sheet.getrange(4, 4).getvalue(); var entry8 = sheet.getrange(8,2,1,9); var entry8data = entry8.getvalues()[0];//get inner array of rows data logger.log('entry8data: ' + entry8...

html5 - Change video quality and bitrate of a video -

can change video quality , bitrate of video(with video tag) on website using javascript or have make copy of video different quality? thanks. there project compiled ffmpeg javascript allow videos manipulated , converted in browser: https://github.com/bgrins/videoconverter.js it developed part of node hackathon, not clear whether still maintained (see github activity). its worth nothing more of experimental project practical one, because of large file size.

javascript - Trying to retain a user selection from a drop down menu across multiple pages -

so have written script knowledge management page allows user select list of states in drop down menu, , content on page tailored state selected. <script type="text/javascript"> $(document).ready(function(){ $("select").change(function(){ $( "select option:selected").each(function(){ if($(this).attr("value")=="arizona"){ $(".box").hide(); $(".arizona").show(); } if($(this).attr("value")=="arkansas"){ $(".box").hide(); $(".arkansas").show(); } }); }).change(); }); </script> etc... 22 states. need retain user's selection between pages within domain. have tried far: localstorage.setitem("state", "arizona"); localstorage.getitem('state'); i new js, , having issues getting work. not seem retai...

Injecting python code into TCP socket server -

i stuck in task question i'm solving penetration testing, given simple tcp web server, , connect , give 2 values, if match in end, flag, given snippet of server code. have tried know flag. here's code: clientsock.send("welcome maths_server 1.0\n") try: clientsock.send("enter first number, can evaluate it:\n") firstnum = eval(clientsock.recv(1024)) firstnum = firstnum + firstnum + ord(flag[4]) + ord(flag[8]) + ord(flag[5]) clientsock.send("enter second number, can evaluate it:\n") secondnum = eval(clientsock.recv(1024)) if secondnum == firstnum: clientsock.send("the flag is: " + flag + "\n") firstnum = 0 secondnum = 0 except: pass clientsock.close() just send string firstnum second message. succeed no matter used value firstnum initially: secondnum = eval(clientsock.recv(1024)) -> secondnum = eval("firstnum") -> secondnum = ... value of f...

networking - Any easy way to monitor HTTP gzipped traffic on a live running Linux system? -

i'm running "sudo tcpdump -s 0 -a port 80" on linux system monitor http traffic. works, of traffic gzipped. there easy way un-compress on fly can watch traffic in real-time? give tcpflow try. command able want. excerpt man page : rather showing packet-by-packet information, tcpflow reconstructs actual data streams [...] has sophisticated plug-in system decompressing compressed http connections to have live view, tell tcpflow write console: tcpflow -c -a port 80

android - getActionBar() returning null in FragmentActivity -

i trying build android tab layout swipeable views using this tutorial . my fragmentactivity : public class bookdetailsactivity extends fragmentactivity implements actionbar.tablistener { private viewpager viewpager; private tabspageradapter madapter; private actionbar actionbar; // tab titles private string[] tabs = {"description", "find book"}; static arraylist<string> book; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); getwindow().requestfeature(window.feature_action_bar); setcontentview(r.layout.activity_books_details); book = new arraylist<string>(); book = (arraylist<string>) getintent().getserializableextra("bookmap"); // initilization viewpager = (viewpager) findviewbyid(r.id.pager); actionbar = getactionbar(); madapter = new tabspageradapter(getsupportfragmentmanag...