Posts

Showing posts from June, 2012

python - Traverse through .tar.gz directories and concatenate files (without uncompressing the folders) -

i have folder of 20000 tar.gz directories, each containing bunch of files. want go in source folder, traverse through tar.gz directories ( without decompressing ) , concatenate files @ end have 3 big files. for e.g. have root folder pnoc has .tar.gz directories, each compressed folder has 3 folders - kallisto , rsem , hugo . have uncompressed 1 such directory , looks this: pnoc/ ├── c021_0001_20140916_tumor_rnaseq.tar.gz ├── c021_0002_001113_tumor_rnaseq.tar.gz ├── c021_0003_001409_tumor_rnaseq.tar.gz ├── c021_0004_001418_tumor_rnaseq.tar.gz ├── c021_0005_001661_tumor_rnaseq.tar.gz ├── c021_0007_001669_tumor_rnaseq.tar.gz ├── c021_0008_001699_tumor_rnaseq.tar.gz ├── c021_0009_001766_tumor_rnaseq.tar.gz ├── c021_0010_001774_tumor_rnaseq.tar.gz ├── c021_0011_001786_tumor_rnaseq.tar.gz ├── c021_0012_001825_tumor_rnaseq.tar.gz ├── c021_0013_001872_tumor_rnaseq.tar.gz ├── cpbt_0001_1_tumor_rnaseq.tar.gz ├── cpbt_0003_1_tumor_rnaseq.tar.gz ├── cpbt_0004_1_tumor_rnaseq.tar.gz ├── c

cordova - phonegap camera and android below 4.4 -

my phonegap app (with plugin camera) works fine on recent android os when tried use on android kitkat or older os can select image gallery script wont grab it...any clues ? im guessing there wrong getphoto() function.... my xml : <plugin name="cordova-plugin-camera" source="npm" spec="~2.1.1"/> my script: <script type="text/javascript" charset="utf-8"> var picturesource; // picture source var destinationtype; // sets format of returned value // wait phonegap connect device // document.addeventlistener("deviceready",ondeviceready,false); // phonegap ready used! // function ondeviceready() { picturesource=navigator.camera.picturesourcetype; destinationtype=navigator.camera.destinationtype; } // called when photo retrieved // function onphotodatasuccess(imagedata) { // image handle // var smallimage = document.getelementbyid('smallimage'); // unhide image elements // smal

python - Not getting an output when I call __str__ on a class instance? -

i beginner easy on me. playing __str__ method , found when try print instance doesn't work import random brand = ("samsung","nokia","sony","atat","reliance") no_of_sim = ("dual-sim","single-sim") color = ("blue","violet","orange","green") no_of_camera =("front","front-back","back") no_of_cores = ("dual core","quad core","octa core") additional = ("bluetooth","nfs","gps") class mobile: def __init__(self,**kwargs): name = self self.brand = random.choice(brand) self.sim = random.choice(no_of_sim) self.color = random.choice(color) self.camera = random.choice(no_of_camera) self.cores = random.choice(no_of_cores) self.additional = random.choice(additional) key,value in kwargs.items(): setattr(self,key,va

plsql - Getting error [PLS-00382: expression is of wrong type] -

i have stored procedure driving me nuts. know it's pretty simple thing, think not able figure out. i getting error "pls-00382: expression of wrong type" in below line: -- write result log v_logtext := 'summary elapsed time: ' || to_char(floor((cast(systimestamp date) - cast(v_starttime date)) * 86400)) || 'sec batchsize ' || to_char (v_batchsize); std.log (v_workername,'001','cas', '0', 'en', ' 00000000', v_logtext ); declarations: v_logtext nvarchar2(2000); v_batchsize number(10,0) := iv_batchsize; [ , iv_batchsize passed in procedure paramenet "iv_batchsize in number default null"] v_starttime date := sysdate; i tried change systimestamp sysdate no luck. assuming amount of information provided, please check below way it. hope works you. declare v_logtext nvarchar2(2000); v_batchsize number(10,0) := 76363; v_starttime date := sysdate; varchar2(100); begin select to_char

Delete pending task in SimGrid -

i have process worker launches executor . executor process creates 10-sec task , executes it. after 2 sec worker kills executor process. simgrid gives me log after killing executor : [ 2.000000] (0:maestro@) dp_objs: 1 pending task? how should destroy tasks , task_data when process kill working process? int worker(int argc, char *argv[]) { msg_process_t x = msg_process_create("", executor, null, msg_host_self()); msg_process_sleep(2); msg_process_kill(x); } int executor(){ msg_process_on_exit(my_onexit, null); task = msg_task_create("", 1e10, 10, null); msg_task_execute(task); return 0; } int my_onexit() { msg_task_cancel(task); xbt_info("exiting (done sleeping or got killed)."); return 0; } upd : declared global variable msg_task_t task . now when run code have: [ 2.000000] (0:maestro@) oops ! deadlock or code not clean. [ 2.000000] (0:maestro@) 1 processes still running, waiting somethin

python - Removing \xa0 from string in a list -

i have list bunch of words: lista = ['jeux olympiques de rio\xa02016', 'sahara ray', 'michael phelps', 'amber alert'] i tried replace '\xa0' : for element in listor: element = element.replace('\xa0',' ') but didn't work. also, when print elements, prints: print(lista[0]) jeux olympiques de rio 2016 does have idea on how solve this? the easiest way: lista = [el.replace('\xa0',' ') el in lista]

php - Change content of distant web page -

i'm trying make little fun page saw on internet years ago. want take content of distant web page, change words (for example, replace random words "blablabla") , show on server (of course it's impossible change content on distant server). must have same css etc, if iframe, words replaced. i succeeded in grabbing distant content (with curl) , show domdocument $url = "http://www.example.fr"; $curl = curl_init($url); curl_setopt($curl, curlopt_returntransfer, true); $output = curl_exec($curl); curl_close($curl); $dom = new domdocument; $dom->loadhtml($output); echo $dom->savehtml(); but want edit viewable text on page (titles, content, etc) change random words. can make on particular website changing id's content : $dom->getelementsbytagname('h1'); but not every websites have h1 or h2 etc. want change text displayed no matter id is. don't know if domdocument has function this. thank !

How do you deal with numbers larger than UInt64 (C#) -

in c#, how can 1 store , calculate numbers exceed uint64's max value (18,446,744,073,709,551,615)? by using biginteger class; there's 1 in the j# libraries (definitely accessible c#), in f# (need test one), , there freestanding implementations such one in pure c#.

mobile - how can i determine internet speed in my android application -

in application want when click button show me exact internet speed. had read answer question has been asked in links determining internet speed in android , calculating internet speed in android , internet speed in android programming , on. didn't found answer exactly. used : wifiinfo.getlinkspeed() but show maximum speed. , use codes of this: trafficstats but didn't worked me. need show network speed (i.e 100 kbps ). how can this? please me. to determine internet speed in android application first need download file onlineserver. why need download file? check average of internet download speed. for need code this private class internetspeedtest extends asynctask<string, void, string> { long starttime; long endtime; private long takentime; @override protected string doinbackground(string... paramvarargs) { starttime = system.currenttimemillis(); log.d(tag, "doinbackground: starttim

oracle11g - I've some 40,000 records in my table and I want to remove the last to digits for all the records in a column -

my data below : 2272522520 2272523235 2272525435 2272525437 2272525439 2272525443 2272525444 2272551733 i want remove last digit rows in column. can please help. in advance! if column of number type: update your_table set your_column = trunc(your_column/10); if it's varchar2: update your_table set your_column = substr(your_column, 1, length(your_column)-1);

python - Dask error: Length of values does not match length of index -

i have read csv file using dask way: import dask.dataframe dd train = dd.read_csv('act_train.csv') then apply simple logic per row , works pretty fine in pandas: columns = list(train.columns) col in columns[1:]: train[col] = train[col].apply(lambda x: x if x == -1 else x.split(' ')[1]) unfortunately, last line of code generates following error: length of values not match length of index what doing wrong? if x doesn't contain space character x.split(' ') return list containing single element x. so, when u trying access second element of x.split(' ') calling x.split(' ')[1]. give error : "length of values not match length of index", there no element @ index 1 in x.split(' ').

How to set Build ID of a elf file in Android.mk -

i need set specific build-id elf file in android. firstly,i use shell command this: arm-linux-androideabi-gcc -pie -wl,--build-id=0xffffffff --sysroot /home/chengyi/code/android_6.0.1_bullhead/prebuilts/ndk/9/platforms/android-18/arch-arm main.c readelf -n a.out .everthing ok. above demo,i need set build-id in android.mk @ last.here android.mk: local_path:= $(call my-dir) include $(clear_vars) local_src_files:= \ main.cpp local_shared_libraries := \ liblog \ libdl \ local_c_includes := \ $(local_path)/ \ bionic \ local_module:= a.out local_cxxflags := \ -pie -wl,--build-id=0xffffffffffffffffff --sysroot /home/chengyi/code/android_6.0.1_bullhead/prebuilts/ndk/9/platforms/android-18/arch-arm \ include $(build_executable) the output elf file has constant build-id,no matter how strive. there method set specific build-id elf file in android.mk? thanks lot help. if want set buil

java - make speed 5 when shift key is pressed -

i have following code make player move: class player { pvector direction; pvector location; float rotation; int speed; player() { location = new pvector(width/2, height/2); speed =2; } void visualplayer() { direction = new pvector(mousex, mousey); rotation = atan2(direction.y - location.y, direction.x - location.x)/ pi * 180; if (keypressed) { if ((key == 'w' && dist(location.x, location.y, direction.x, direction.y)>5) || (key == 'w' && key == shift && dist(location.x, location.y, direction.x, direction.y)>5)) { speed = 2; location.x = location.x + cos(rotation/180*pi)*speed; location.y = location.y + sin(rotation/180*pi)*speed; if (key == shift) { speed = 5; } } } else { location.x = location.x; location.y = location.y; } println(speed); ellipse(location.x, location.y, 10, 10); } } when press w key pla

android - read end of response in java readLine() -

try { input = new bufferedreader(new inputstreamreader( msocket.getinputstream())); while (!thread.currentthread().isinterrupted()) { string messagestr = null; messagestr = input.readline(); if (messagestr != null) { updatemessages(messagestr, false); } else { break; } } input.close(); } catch (ioexception e) { log.e(client_tag, "server loop error: ", e); } i using above code in thread receiving responses socket connection. in android works correctly used out.println() sending data, when device connected ios , starts receive data cannot identify end , received when connection closed. there alternative methods other readline() , how

java ee - JSF Controller, Service and DAO -

i'm trying used how jsf works regards accessing data (coming spring background) i'm creating simple example maintains list of users, have like <h:datatable value="#{userlistcontroller.userlist}" var="u"> <h:column>#{u.userid}</h:column> <h:column>#{u.username}</h:column> </h:datatable> then "controller" has like @named(value = "userlistcontroller") @sessionscoped public class userlistcontroller { @ejb private userlistservice userlistservice; private list<user> userlist; public list<user> getuserlist() { userlist = userlistservice.getusers(); return userlist; } } and "service" (although seems more dao) has public class userlistservice { @persistencecontext private entitymanager em; public list<user> getusers() { query query = em.createquery("select u user u"); return query.get

python - "QThread: Destroyed while thread is still running" when run from the Windows cmd or IDLE but not from PyCharm? -

this simplified version of program implementing pyqt multi-threading qobject.movetothread. basically, query webpage on separate thread , extract hmtl content. i problem running code idle or windows command line hangs python. windows cmd shows "qthread: destroyed while thread still running". however, if run pycharm, works fine. you can .ui file here any ideas? import requests import sys pyqt4 import qtgui, uic pyqt4.qtcore import qobject, pyqtslot, pyqtsignal, qthread qtcreatorfile = "window.ui" ui_mainwindow, qtbaseclass = uic.loaduitype(qtcreatorfile) class httpclient(qobject): finished = pyqtsignal(str) def __init__(self): qobject.__init__(self) @pyqtslot() def retrieve_page(self, url): response = requests.get(url) self.finished.emit(response.text) class htmlgetter(qtgui.qmainwindow, ui_mainwindow): def __init__(self): qtgui.qmainwindow.__init__(self) ui_mainwindow.__init__(self)

r: append mean of a subset of columns by name -

i have df: webvisits1 webvisits2 webvisits3 webvisits4 s001 2 0 11 2 s002 11 2 23 3 s003 12 1 1 5 s004 13 5 5 0 s005 4 3 9 3 i need create output dataframe added columns containing difference between mean of webvisits(3-4) , webvisits (1-2), so: webvisits1 webvisits2 webvisits3 webvisits4 difference_mean s001 2 0 11 2 -5.5 s002 11 2 23 3 -6.5 s003 12 1 1 5 3.5 s004 13 5 5 0 6.5 s005 4 3 9 3 -2.5 is there easy way so, considering column names (webvisits) important? thank you we subset dataset 2 ( df[1:2] , df[3:

Posting jquery datatable data to server in JSON format -

i know question has been asked numerous times on , on datatables site, cannot work using solutions provided. i building datatable on client side , want post client data wep api controller in json format. the client side working correctly when comes adding/deleting rows. when try create json using: var table = $('#detailtable').datatable(); var details = json.stringify(table.rows().data().toarray()); i getting following result: [["11046","abc","bis","123","123",15129]] so missing column names in json object, web api failing pick , convert to: list<receiptentryviewmodel> receiptdetails so how can datatables generate json in following format: [["itemid":"11046","itemcode":"abc","itemname":"bis","price":"123","quantity":"123","total":15129]] if want collect column names , use them pro

php - .htaccess rule to restrict the url rewritting for unlimited parameters doesnot work -

i using .htaccess file rewritting url's in php based project. have written rules rewrite url accordingly. facing problem while writting url log-in.php 4 different cases. current rules follows: rewriteengine on rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d #home pages rule# rewriterule ^home index.php [l] rewriterule ^contact-support contact-support.php [l] #login rule# rewriterule ^login log-in.php [l] rewriterule ^login/([0-9]+)$ log-in.php?temporarybookingid=$1 [l] rewriterule ^login/([0-9]+)/([0-9]+)$ log-in.php?temporarybookingid=$1&jsessionid=$2 [l] rewriterule ^login/([0-9]+)/([0-9]+)/([a-za-z]+)$ log-in.php?temporarybookingid=$1&jsessionid=$2&name=$3 [l] for current rules cases 1. when there no parameter in url should open login page default. 2. when there parameters, login page after filling login credentiials should redirect accordingly. 3. when parameter in url exceeds required limit must show page 404 page not found the

c# - Format of the initialization string does not conform to specification starting at index 0 : no new solution -

i've developed application using entity framework 5 , published azure. when running visual studio 2015, works fine. however, when running azure, following error, 'format of initialization string not conform specification starting @ index 0'. below part of connection string (username , password excluded). name="knowledgewikientities" connectionstring="metadata=res:// /models.wikimodel.csdl|res:// /models.wikimodel.ssdl|res://*/models.wikimodel.msl;provider=system.data.sqlclient;provider connection string="data source=[server name];initial catalog=[table name];user id=[username];password=[password];multipleactiveresultsets=true;app=entityframework"" providername="system.data.entityclient" i've looked through several different solutions, none have worked. ideas why problem occurring?

sql - C# SqlBuilder -- How to use Convert dynamically -

i have sql query: select relationid , convert(date, receiveddate, 10) [date] , matdesc , sum(amount) , sku tablename relationid = 1000 group convert(date, receiveddate, 10) , relationid , matdesc , sku which need write dynamically in c# sqlbuilder. far have: selectquery qry = new selectquery("db"); qry.withnolock = true; foreach (exportcolumndefinition exportcolumndef in getexportcolumndefinitions()) { qry.selectcolumn(exportcolumndef.datafieldname); } qry.criteria.addexpressioncriterium("relationid= " + esetting.relationid); qry.criteria.addcolumncriterium("receiveddate", operator.greaterthanorequalto, datetime.now.adddays(-30)); qry.criteria.addcolumncriterium("receiveddate", operator.lessthanorequalto, datetime.now); qry.addorderbycolumn("receiveddate", sortorder.descending); i'm

sockets - How to read extract parameters and payload from recv() in C? -

i running simple client code in c post , server , read data stream. printing full response received in recv() , have parse further use. before reading data stream, want know http status code (200, 400, 401 etc.) server. getting same in header. there way http code before reading headers? what best practice read head parameters , payload? searched answers got read '\r\n' sequence , apply logic. there better way? i using ubuntu systems testing code. following response being printed: <p style="color:blue;">http/1.1 401 unauthorized server: apache-coyote/1.1 content-type: application/json content-length: 69 date: mon, 08 aug 2016 09:46:46 gmt </p> <p style="color:blue;">"you not authorized user access resource. access denied." no. recv() receives raw data socket, tcp/ip in case suppose. tcp/ip lower level protocol , not have notion of http status code, http data bytes no meaning. so have read data, int

jquery - SVG animation not properly working in Safari -

i new in svg animation, working on svg polygon animation, working fine in chrome , firefox have trouble in safari (mac) on safari first time working fine second time showing close box, not showing open. scenario when click on red button, open box , after settimeout() 900, close function(document.getelementbyid('animation-to-close').beginelement()) run close box.. resizepage(); $(".btn").on("click", function() { document.getelementbyid('animation-to-click').beginelement(); settimeout(function() { document.getelementbyid('animation-to-close').beginelement(); }, 900); }); function resizepage() { var pageheight = $(window).height() - 100; var circletopposition = pageheight / 2; $("#circle").css("top", circletopposition - 216); setcontentbox("#0d915d"); } function setcontentbox() { var getscreenwidth = $(window).width() - 165; var getscreenheight = $(window).

javascript - Highchart: why can I not set the duration in this case? -

relevant code here: http://jsfiddle.net/e0qxfltt/5/ $(function drawcharts() { var chartdata = [100,120,120,140,110,110]; var index = 1; $('#b').click(function(){ var buttonb = document.getelementbyid('b'); buttonb.disabled = true; if(index < chartdata.length){ var x = index, // current time y = chartdata[index]; $('#container').highcharts().series[0].setdata([chartdata[index - 1], chartdata[index]]); settimeout(function(){$('#container').highcharts().series[0].setdata([]);}, 1000); settimeout(function(){ if(index === 1){ $('#container1').highcharts().series[0].addpoint([0,chartdata[0]]); } $('#container1').highcharts().series[0].addpoint([x,y]); index++; }, 1000); } settimeout(function(){buttonb.disabled = false;}, 3000); }) $(document).ready(function () { var chart1 = new highcharts.

PayU integration in iOS not working -

please me find out way integrate payu in ios app successfully. there proper document follow alsways getting issue "key" , not wokring please me i using payu sdk regarding payu document , have got solution regarding little issue using -objc should -objc have changed , issue has been solved. thank input

c# - Best way to transmit bool with attribute routing -

is there example of transmission bool parameter attribute routing? for example can transform route {controller}/{action}?param=true to {controller}/{action}/param=true but still "dirty". sorry dummy question (: solution use 2 attribute this: [route("valuesforfalse/{param=false}")] [route("valuesfortrue/{param=true}")]

css - Bootstrap center an image inside the div but without resizing -

i need place image inside div. know there img-responsive center-block classes resize given image reason. there way achieve same goal without size distortions. note: containing div bootstrap column given classes: hidden-xs col-lg-9 col-md-6 col-sm-6. thank you css friend can try css class html <img class="centerd-image" src=""> or <div class="centerd-image"> <img src=""> </div> css .centerd-image { margin: 0; position: absolute; top: 50%; left: 50%; margin-right: -50%; -moz-transform: translate(-50%, -50%); -ms-transform: translate(-50%, -50%); -o-transform: translate(-50%, -50%); -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%); }

jquery - Bootstrap Button Collapse to second line -

Image
i wondering if there way buttons automatically grow vertically display entire label rather cut off using bootstrap , font awesome. code: <div class="well well-sm"> <p><h5 style="underline"><u>social media:</u></h5></p> <p> <a href="" class="btn btn-block btn-social btn-facebook" target="_blank"> <i class="fa fa-facebook"></i> <font size="2"> on facebook</font> </a> <a href="" class="btn btn-block btn-social btn-twitter" target="_blank"> <i class="fa fa-twitter"></i> <font size="2"> follow on twitter</font> </a> <a href="" class="btn btn-block btn-social btn-pinterest" target="_blank"> <span class="fa fa-youtube-play"></span> <font

Array difference for multidimensional array with single array in php -

i want difference of multidimensional array single array. dont know whether possible or not. purpose find diference. my first array contain username , mobile number array1 ( array(lokesh,9687060900), array(mehul,9714959456), array(atish,9913400714), array(naitik,8735081680) ) array2(naitik,atish ) then want result result( array(lokesh,9687060900), array(mehul,9714959456) ) i know function array_diff($a1,$a2); not solve problem. please refer me me find solution. try this- $array1 = array(array('lokesh',9687060900), array('mehul',9714959456), array('atish',9913400714), array('naitik',8735081680)); $array2 = ['naitik','atish']; $result = []; foreach($array1 $val2){ if(!in_array($val2[0], $array2)){ $result[] = $val2; } } echo '<pre>'; print_r($result); hope you.

jquery - jstree structure change use DIV Spans -

Image
is possible convert ul li structure of jstree div span structure same indentation? <div id="html1" style="width:200px; border:1px solid red;"> <ul> <li>root1 <ul> <li>child1</li> <li>child2</li> </ul> </li> <li>root2 <ul> <li>child1 <ul> <li>child 11</li> <li>child 22</li> </ul> </li> <li>child2</li> </ul> </li> </ul> </div> '$("#html1").jstree()' can same achieved?

javascript - Call method from specific Js version file -

i have 2 version of datatable.js 1.9 , 1.10 , have included both in master page , child page. now particular functionality want access method 1.9 only, i have used jquery.noconflict(); but throws $ not function while in sample app jsfiddle found working when having on both version in similar page. what should case here just use this: var $i = jquery.noconflict(); when want function call using opject, use: $i.methodname(); instead of $.methodname();

linux - Bash - Executing a command in a script adding single quotes to a variable containing spaces -

i writing script executes necessary commands train tesseract language , want receive font argument (e.g.: dejavu sans bold) , execute command text2image --text=trainingfile.txt --outputbase=eng.dejavusansbold.exp0 --font='dejavu sans bold' --fonts_dir=/usr/share/fonts . notice --font='dejavu sans bold' has font name single quoted. since receive font argument, need add quotes , use name. after different approaches, "most effective" attempt text2image --text="${trainingtextfilename}" --outputbase="${languagecode}"."${fontnamewithoutblanks}".exp0 --font="'""${fontname}""'" --fonts_dir=/usr/share/fonts still not working... ("languagecode" , "fontnamewithoutblanks" other variables). after running script line, notification saying font not recognized although works when execute "manually" in console. using set -x , set +x line (of script) looks this: text2i

angularjs - How to access Google Map API for fetching address depend on pincode? -

i have used below code fetching address depend on pincode giving error $http.get('//maps.googleapis.com/maps/api/geocode/json?address=500082&sensor=true') .then(function (results) { return results; }); i set $httpprovider.defaults.headers.common['x-requested-with'] = 'xmlhttprequest'; $httpprovider.defaults.withcredentials = true; in config block error:-xmlhttprequest cannot load http://maps.googleapis.com/maps/api/geocode/json?address=500082&sensor=true . response preflight request doesn't pass access control check: wildcard '*' cannot used in 'access-control-allow-origin' header when credentials flag true. origin ' http://localhost:2808 ' therefore not allowed access. credentials mode of xmlhttprequest controlled withcredentials attribute.

oauth - "could not obtain access token" error in spring security oauth2 -

in spring project have oauth2 client app running on localhost:9999 , oauth2 authorization server running on localhost:8080. in result, after approval page, see error page don't know problem? when press f12 see set-cookie done! /oauth/token not called! , /me not called! , browser not redirect localhost:9999. my client app package sso.client; import java.security.principal; import org.springframework.boot.autoconfigure.enableautoconfiguration; import org.springframework.boot.autoconfigure.security.oauth2.client.enableoauth2sso; import org.springframework.boot.builder.springapplicationbuilder; import org.springframework.context.annotation.configuration; import org.springframework.web.bind.annotation.requestmapping; import org.springframework.web.bind.annotation.restcontroller; @enableautoconfiguration @configuration @enableoauth2sso @restcontroller public class app { @requestmapping("/") public string home(principal user) { return "hello " + user.

java - Manipulate InputStream of ContainerRequestFilter -

i have encrypted string being sent client. trying intercept string using containerrequestfilter decrypt , set inputstream again can used jackson map pojo. illustration: my resource @path("auth") public class authresource { @post public response testresource(@auth authuser auth, person person) { system.out.println("recieved resource:: "+ new gson().tojson(person)); return null; } } person.java public class person { private string name; private int age; public person() {}; public person(string name, int age) { this.name = name; this.age = age; } public string getname() { return name; } public void setname(string name) { this.name = name; } public int getage() { return age; } public void setage(int age) { this.age = age; } } my filter @provider public class myfilter implements containerrequestfilter { @override public voi

applying css for android applcation -

i have developed android app in android studio.i have used buttons, textview etc in xml layout , onclick , other functionality in java file.now if there css file,for styling buttons,how can access css file.please me. not possible. can not apply css styles android sdk component i.e. button. can design own style i.e. drawable making use of android standards defined google. google has provided lots of properties button class. can use properties in activity through layout file or programmatically. https://developer.android.com/reference/android/widget/button.html

mysql - Java - Having a huge ArrayList (1 million +), how to create a String of it in a acceptable amount of time? -

as mentioned, have huge arraylists in format: list<list<string>> alist; i lists out of .csv wich on extern databasesystem. (i wrote visual objects script export data need calculations) after have .csv, load content list this: string line; alist = new arraylist<list<string>>(); int i=0; // datei laden, und anschließend die zeilen der csv in eine arraylist speichern try { br = new bufferedreader(new filereader(path)); while((line = br.readline()) != null) { line = line.replace(",", "."); if(line.endswith(delimitter)) line = line + " "; alist.add(arrays.aslist(line.split(delimitter))); i++; if(i==10000000) break; } } it takes me ~15900 ms store data in arraylist (~1,1 million rows , 11 columns). prett

apache - How can I check the requested url before it being redirected on webserver -

i want redirect subdomain subfolder on server. set a-record on dns server blog.domain.com go main server www.domain.com. using following htaccess (ubuntu server) - source : rewritecond %{http_host} ^blog\.domain\.com rewriterule ^(.*)$ http://www.domain.com/blog/$1 [r=301] sadly - it's not working. i've checked apache's access.log , saw, first request web server received www.domain.com , not blog.domain.com. how can find out request-list check requests got wrong?

sharepoint - Open with Explorer prompts for credentials -

we have dms in sharepoint, when user tries "open explorer", asks credentials. having site under trusted sites , automatic logon enabled. when user types in credentials, works. next thing when user try again closing , reopening ie, works fine time, without asking credentials. problem occurs again, when user restarts machine. once again, ie asks credentials. , same thing goes on. i want know if default behaviour sharepoint ask credentials first time, each time machine turned on? microsoft article on that? many thanks. can verify if webclient service set start "automatically" instead of "manually"? https://support.microsoft.com/en-in/kb/2629108

Use of Dictonary in python -

i doing coursera python exercise , having trouble writing code. the question following: write program read through mbox-short.txt , figure out has sent greatest number of mail messages. program looks 'from ' lines , takes second word of lines person sent mail. the program creates python dictionary maps sender's mail address count of number of times appear in file. after dictionary produced, program reads through dictionary using maximum loop find prolific committer. sample text file in line: http://www.pythonlearn.com/code/mbox-short.txt and expected output should be: cwen@iupui.edu 5 this code: name = raw_input("enter file:") if len(name) < 1 : name = "mbox-short.txt" name="mbox-short.txt" handle=open(name) text=handle.read() line in handle: line=line.rstrip() words=line.split() if words==[]: continue if words[0]!='from':continue words2=words[1] words3=words2.split() counts=dict() word in words

php - Get results from objects in jquery -

i have controller: public function show(request $request) { if($request->ajax()) { $id=$request->get('id'); if($id) { $show=crud::where('id',$id)->get(); echo json_encode(array('status' => true, 'show'=>$show)); die; } } echo json_encode(false);die; } and jquery: $(document).on('click', '.show', function (e) { e.preventdefault(); var id = $(this).data('id'); $.ajax({ type: "post", url: "{{url('/crud/show')}}", data: {id:id}, success: function (data) { var res = $.parsejson(data); //console.log(res.show); if(res.status == true) { //console.log(res.show.name); var result = 'name:'+res.show.name+'<br>'+ 'phone:'+res.show.phone+'<

How to show only first level child when second level child doen't exists otherwise show second level child in django MPTT -

i got following output django-mptt tree: group-2 ministry e division g division z ministry f division division j group-3 ministry p division x division y ministry q ministry r division u division v but want show follows: division g division z division division j division x division y ministry q division u division v that means level 1 shows when level 2 not exists otherwise level 2 shows. tried using model.objects.filter(level=1) gives 1 level not both selectively. tried model.objects.filter(level__gt=0) gives both level not obey condition. how can both level maintaining conditions? edit: {% block content %} {% load mptt_tags %} {% instance in genre.objects.all %} {% if instance.is_leaf_node %} {{ instance }} {% endif %} {% endfor %} {% endblock %} views: def show_genres(request):

javascript - Ajax load after loader -

i have function loads specific content of outer html page , loader. want load content right after showing loader 1.5 seconds. when refresh page loader loads nothing happens , need again click on button load it. code here: <script> // css loaded content $("<link/>", { rel: "stylesheet", type: "text/css", href: "usercss(english).css" }).appendto("head"); // loaded content button $(document).ready(function(){ $(".searchbutton").click(function(){ $("#coursecontent").load("userpage.html #content"); }); }); var myvar; function myfunction() { myvar = settimeout(showpage, 1500); } function showpage() { document.getelementbyid("loader").style.display = "none"; document.getelementbyid("coursecontent").style.display = "block"; } </script> and here html page body. <body onload="myfunction()" style=

linux - Python could not open port -

i want communicate serial port in python. installed pyserial linux: import thread import serial port = '/dev/rfcomm0' baudrate = 921600 timeout = 1 port = serial.serial(port=port, baudrate=baudrate, timeout=timeout) port.open() ... port.close() it gives following error: traceback (most recent call last): file "/home/dnaphone/pycharmprojects/test/bluetoothclient.py", line 12, in <module> port = serial.serial(port=port, baudrate=baudrate, timeout=timeout) file "/usr/local/lib/python2.7/dist-packages/serial/serialutil.py", line 182, in __init__ self.open() file "/usr/local/lib/python2.7/dist-packages/serial/serialposix.py", line 247, in open raise serialexception(msg.errno, "could not open port {}: {}".format(self._port, msg)) serial.serialutil.serialexception: [errno 2] not open port /dev/rfcomm0: [errno 2] no such file or directory: '/dev/rfcomm0' /dev/rfcomm0 seems bluez registered virt

apache - What is wrong with this RedirectMatch expression? -

i'm trying use redirectmatch: redirectmatch 301 /(.*.p0) /(.*.p1) to replace page parameter in url. old url: http://www.example.com/some-list-c1-p0 new url: http://www.example.com/some-list-c1-p1 what wrong it? or can make rule redirects 301 following kind of urls? old url: http://www.example.com/some-list-c1-p0.html new url: http://www.example.com/some-list-c1-p1 i'm using: redirectmatch 301 /(.*.p0)\.html /$1 but can't 'p1' instead of 'p0' your replacement side not contain references matches. the apache docs suggest examples this: redirectmatch "(.*)\.gif$" "http://other.example.com$1.jpg" using $1 , $2 , etc. refer captured matches, try redirectmatch 301 /(.*.)p0 /$1p1 and see if works better.

html - efficient and responsive way of text alignment bottom -

Image
i trying position"the answer thee" text bottom of page, works. the problem arises when resize screen "big text" , "answer text" falls out of alignment "big text" element full height (depending on text amount). "answer text" not set height responsive height depending on size of content area "big text" link fiddel here html <head> <link href="https://get.gridsetapp.com/35679/" rel="stylesheet" /> </head> <li class="aside-open-close active"> <a class="aside-opener" href="#">q1. question here.</a> <div class="slide"> <div class="columns"> <div class="d1-d3"> <p>one</p> <p>two</p> <p>three</p> <p class="answer-box">three - answer three</p> </div> <div class=&q