Posts

Showing posts from February, 2013

swift - ios9 / swift2 / xcode7+ AVplayer icecast doesn't process streaming without file extension -

how play stream icecast2 not have file extension example stream url: http://icecast:8044/channel-123?a=hash format: mp4a the code seems working on files extension, not on files without. var player = avplayer(); let playeritem = avplayeritem(url:nsurl(string:"http://host/file.mp4a")!); player = avplayer(playeritem:playeritem) let playercontroller = avplayerviewcontroller() playercontroller.view.frame = self.view.frame playercontroller.player = player self.addchildviewcontroller(playercontroller) self.view.addsubview(playercontroller.view) player.play() edit: when stream address ends without file extension (the file on server stored without file extension .mp3, .mp4,..) avplayer not play anything( http://example.com/file ) ... if file name contains file extension works ( http://example.com/file.mp3 ) it seems confusing live streaming , loading media files server. if talking live streaming: 1) file extension has no i...

entity framework core - EF7: "The EntityFramework package is not installed" when it is -

have entered install-package entityframework.commands –pre , when try add-migration initial following error: the entityframework package not installed on project '…'. as clue, when try use-dbcontext command, error. here's package manager console session: pm> install-package entityframework.commands –pre package 'entityframework.commands.7.0.0-rc1-final' exists in project '…' pm> add-migration initial entityframework package not installed on project '…'. pm> use-dbcontext use-dbcontext : term 'use-dbcontext' not recognized name of cmdlet, function, script file, or operable program. check spelling of name, or if path included, verify path correct , try again. @ line:1 char:1 + use-dbcontext + ~~~~~~~~~~~~~ + categoryinfo : objectnotfound: (use-dbcontext:string) [], commandnotfoundexception + fullyqualifiederrorid : commandnotfoundexception what doing wrong?

python - How to resolve twitter api rate limit? -

using pip3 install twitter small python program retrieve user's tweets in total year. utl = t.statuses.user_timeline(count = n, screen_name = name) got error rate limits, shows: details: {'errors': [{'code': 88, 'message': 'rate limit exceeded'}]} after checking api docs, https://dev.twitter.com/rest/public/rate-limiting , no idea how fix it. hopefully, help. thanks! the rate limit page quite clear, restricted making 180 calls per 15 minutes. this gives few options. throttle code. put sleep in there ensure never exceeds limit. use api options maximum amount of data in shortest amount of api calls. the documentation statuses/user_timeline says: this method can return 3,200 of user’s recent tweets. and count specifies number of tweets try , retrieve, maximum of 200 per distinct request. so can use count=200 request 3,200 statuses in 16 api calls .

git - how can I clone local svn repository? -

i unable find explanation how should specify location of existing svn repository. in other words - should used url in git svn clone url when svn repository local? you should able succeed this: git svn clone file:///e/svn_repo_on_e_drive similar svn checkout command: svn co file:///e/svn_repo_on_e_drive file:// folder on current drive of executing cmd prompt, file:///d/some_folder d:\some_folder . note: / , removed drive colon in file link on windows. file://e:/svn_repo_on_e_drive → file:///e/svn_repo_on_e_drive

python - how to disable privacy or anyother feature in edit profile form in userena? -

i've tried many things can't figure out. followed 1 here, django-userena removing mugshot isn't working me. tried 1 here https://www.reddit.com/r/django/comments/1mgk3b/adding_and_removing_custom_django_userena_form/ isn't working. how did it, in accounts/forms.py have. from userena.forms import editprofileform class editprofileformextra(editprofileform): class meta(editprofileform.meta): exclude = editprofileform.meta.exclude + ['privacy'] and inside accounts/urls.py have from django.conf.urls import patterns, url urlpatterns = patterns( '', url(r'^accounts/(?p<username>[\.\w-]+)/edit/$', 'userena.views.profile_edit', {'edit_profile_form': editprofileformextra}, name='userena_profile_edit'), ) any appreciated

jquery - Find the closest table containing a text -

i've 3 nested tables innermost table containing text in td portion. what way innermost table containing text? if run like: $("td").filter(function(){ return $(this).text().match(/pnr no:/);}).closest('table') it gives me 3 tables it gives me 3 tables it's returning 3 tables because each td element presumably contains text (since nested). what way innermost table containing text? if want select innermost td element, 1 solution select td elements don't contain table elements (i.e., innermost td elements) combining :not() pseudo class , :has() selector : $("td:not(:has(table))").filter(function() { return $(this).text().match(/pnr no:/); }).closest('table'); jsfiddle demo

php - Symfony 2.8 twig and bootstrap -

is there link or post how symfony can work bootstrap? not forms general layout. maybe calling them in resources: the symfony demo application uses bootstrap , modern symfony practices. maybe can check out source code , file structure.

Test uploading files flask with python 2 and 3 -

firstly question similar one . but problem of trying write tests require uploading files app can run either in python 2.7 or 3.4. with following code, when run under python 3.4 error. not sure if matters, running unittests py.test self.client = app.test_client() open(standard_test_path, 'rb') dataset: params = {} params['priority'] = 5 params['dataset'] = (dataset, standard_mol_file) response = self.client.post( '/datasets', data=params ) the error following: response = self.client.post( '/datasets', data=params ) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /users/user/.virtualenvs/playground3/lib/python3.4/site-packages/werkzeug/test.py:788: in post return self.open(*args, **kw) /users/user/.virtualenvs/playground3/lib/python3.4/site-packages/flask/testing.py:108: in open follow_redirects...

System.out.println in java - Is out initialized in a native method? -

i wanted know if out variable in system.out.println() initialized in static block of system class. out field declared final static variable, equals null ( public final static printstream out = null; ) . since out pointing null, assume being pointed printstream object somewhere. can't see code except native method called registernatives() . being pointed in native method? why being done way (any performance advantage)? also, documentation out variable in system says: the "standard" output stream. stream open , ready accept output data. typically stream corresponds display output or output destination specified host environment or user." thanks. the out registration flow java virtual machine (jvm) invokes private static void initializesystemclass() @ line-1155 the function call setout0(newprintstream(fdout, props.getproperty("sun.stdout.encoding"))) @ line-1192 invokes actual native method defined private static n...

scala.MatchError: String Extraction using regular expression -

i working on scala pattern matching. for below program getting output. val pattern = "([0-9]+) ([a-za-z]+)".r val pattern(count,fruit) ="100 bananas" the output of program count: string = 100 fruit: string = bananas i modified program deeper understanding, adding 1 more numeric pattern pattern val object , 1 more object extraction pattern val. the program val pattern = "([0-9]+) ([a-za-z]+) ([0-9]+) ".r val pattern(count, fruit, price) ="100 bananas 1002" but program not compiling , throwing error. error - scala.matcherror: 100 bananas 1002 (of class java.lang.string) @ #worksheet#.x$1$lzycompute(extractingstrings.sc0.tmp:6) @ #worksheet#.x$1(extractingstrings.sc0.tmp:6) @ #worksheet#.count$lzycompute(extractingstrings.sc0.tmp:6) @ #worksheet#.count(extractingstrings.sc0.tmp:6) @ #worksheet#.#worksheet#(extractingstrings.sc0.tmp:6) can explain why throwing error. in advance. the program compiling fine...

javascript - Ghostdriver 1.2.1 + PhantomJS 2.0 + latest Selenium Can't find variable error in Java -

[error - 2016-01-16t02:22:00.898z] session [e6651a90-bbf7-11e5-9061-cff578894101] - page.onerror - msg: referenceerror: can't find variable: data :262 in error [error - 2016-01-16t02:22:00.898z] session [e6651a90-bbf7-11e5-9061-cff578894101] - page.onerror - stack: (anonymous function) (http://www.example.com/ns/common/jquery/jquery.cartactions.js?cd=0:205) o (http://www.example.com/images/common/jquery/jquery.latest.js:2) firewith (http://www.example.com/images/common/jquery/jquery.latest.js:2) w (http://www.example.com/images/common/jquery/jquery.latest.js:4) d (http://www.example.com/images/common/jquery/jquery.latest.js:4) openurl (:0) open (:280) (anonymous function) (:/ghostdriver/request_handlers/session_request_handler.js:495) _execfuncandwaitforloaddecorator (:/ghostdriver/session.js:212) _posturlcommand (:/ghostdriver/request_handlers/session_request_handler.js:494) _handle (:/ghostdriver/request_handlers/session_request_handler.js:91) _rero...

Is there any emma plugin for jdeveloper 12c? -

similar eclemma plugin on eclipse, there plugin jdeveloper see run junit tests , see code coverage? see emma integration plugin in jdeveloper after installing wasn't able see difference , not documentation on plugin supposed do.. please help! i know old question in case came across it. there blog post here explaining how emma work jdeveloper. tested on latest jdeveloper 12c , works fine. regarding documentation , how use emma listed in site here

makefile - How to make "%" wildcard match targets containing the equal sign? -

the makefile wildcard system doesn't seem match targets if contain equal sign. there way work around deficiency? flag or setting or rule escape equal sign? know can not use equal sign i'd prefer fix idiosyncrasy of make if possible. here's example of mean $ cat makefile all: echo dummy target b_%: echo $@ $ make b_c=1 echo dummy target $ make b_c1 echo b_c1 the first make command not match b_% though should. wasn't able find documentation supposed matched % wildcard. pointers? make version is $ make --version gnu make 3.81 copyright (c) 2006 free software foundation, inc. program built i386-apple-darwin10.0 the problem here not % syntax, fact any command-line argument equals sign in interpreted variable assignment . you should find if add...

can not conect to meteor from localhost:3000/192.168.1.104:3000 -

Image
i have installed sentos7 virtual machine. , installed meteor, can not open in web browser application. can me solve issue? run app binded 192.168.1.104:3000 or 0.0.0.0:3000 , not localhost:3000 . if run app in vm, addr must visible other machines. 127.0.0.1 local address. addr never visible other machines.

parse.com - swift parse query orderbyDescending doesn't work -

i using swift , parse. used 'query.orderbydescending' in way doesn't work perfectly. want arrange people's total score order looks (e.g., 9, 7, 32, 21, 15....). seems coding recognize first digit of number. how can fix it? here's codes. thank you! class individualstatstvc: uitableviewcontroller { var postsarray = [pfobject]() override func viewdidload() { super.viewdidload() self.view.backgroundcolor = uicolor(patternimage: uiimage(named: "background2.png")!) tableview.separatorcolor = uicolor.orangecolor() fetchdata() print(postsarray) } override func numberofsectionsintableview(tableview: uitableview) -> int { return 1 } override func tableview(tableview: uitableview, numberofrowsinsection section: int) -> int { return postsarray.count } override func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell { let cell = tableview.dequeuereusablecellwithidenti...

c# - How can i get remote call on bootstrap twitter typeahead to work, by calling asp.net web method -

i trying load typeahead.js using bloohound's remote function can call web method. have seen similar threads querystring being used : integrating typeahead.js asp.net webmethod typeahead.js , bloodhound.js integration c# webforms webmethod http://yassershaikh.com/using-twitter-typeahead-js-with-asp-net-mvc-web-api/ and many more.... however, cannot find example ajax used call webmethod typeahead.js. so have , works: webmethod [webmethod] public static string getemployeetypeahead() { javascriptserializer jss = new javascriptserializer(); jss.maxjsonlength = 100000000; string json; using (var rep = new rbzpos_csharpentities()) { var result = rep.employees .where(x => x.employeestate == 1) .select(x => new { x.employeeid, x.fullname, x.mann...

keyboard - USB HID Atmega 32u4 Arduino - system device ID / name changing from default Arduino leonardo -

i'm building usb hid device using arduino leonardo mini clone, based on atmega32u4 . particular ic has got usb controller build in, , turning in hid device simple, need include keyboard.h , use keyboard.print ... the question , can set/define name of device shown, when arduino connected pc, because @ moment named arduino leonardo. the default automated name tty usbmodemhidp1 in system preferences can see: id product: 0x8036 id vendor: 0x2341 wersion: 1.00 serial number: hidpc speed: 12 mb/sek. vendor: arduino llc id location: 0x14200000 / 16 so in arduino keyboard.h can change name, or id's ? possible ? because in opinion should can't find right place, , not have experience wit arduino avr working microchips mplab x before different ic's ;). any appreciated best regards the "iproduct" string sent board on enumeration tells operating system gives human-readable name. value of string set near top of usbco...

java - Why does Hibernate return random result? -

i want read data database using hibernate. want start first row, read 200 rows , process them, read next 200 rows. hibernate returns random row every time. this method reads database. public list getpages(int start, int end) { criteria querycriteria = session.createcriteria(page.class); querycriteria.setfirstresult(start).setmaxresults(end); return querycriteria.list(); } public void myfunction(){ while (readflag) { //get page database; list<page> pageslist = database.getpages(startfromdatabaseindex, read_from_database_size); if ((pageslist == null) || (pageslist.size() == 0)) { break; } if (pageslist.size() < read_from_database_size) { readflag = false; } else { startfromdatabaseindex = startfromdatabaseindex + 200; } (int = 0; < pageslist.size(); i++) { process(); } } } to extract data dat...

php - Ajax internal server error in Symfony -

so have problem symfony 2. "internal server error". below ajax call $.ajax({ url: resource_url + '/delete', type: 'post', success: function(result){ $(row).fadeout(function(){ $(this).remove(); show_msg_box('#msg-box', 'successfully deleted <strong>' + job_name + '</strong>!'); if(!has_table_row('.jwobs-table', 'tr.app-row')){ $('tr.app-norow').fadein(); } }); } }); and content of function being called in url public function ajaxdeleteaction($job) { return $this->forward('web.api.job:deleteaction', $job); } and function route above being forwarded to public function deleteaction($job) { $con = \propel::getconnection(); $sql = "delete tb_job id = ".$job.""; $prep = $con->prepare($sql); $prep->execute(); $this->response->setsta...

python - Connect data points in the order they were individually plotted - matplotlib -

i trying connect points plotted individually, want connect them in order plotted. have list of numbers referring set of points (ordered pairs). list tells order points should plotted in. the points in dictionary p . let's p[1] , p[2] , p[3] . list = (2, 1, 3) . want plot line connects p[2] p[1] p[3] . p[i] = (x, y) tuplet x-coordinate x , y-coordinate y . as have now, plotting points using loop. works, doesn't connect points. great! thanks. x=[-4, 2, -1, 5] y=[-3, -2, 4, 2] n = 3 #number of cities p = dict() p_0 = (x[0],y[0]) in range (1,n): p[i] = (x[i],y[i]) route = (2,1,3) plt.plot([p_0[0]],[p_0[1]]) k in range (0,n-1): plt.plot([p[route[k]][0]],[p[route[k]][1]]) you need provide x coordinates list , y coordinates separate list, when calling plot: import matplotlib.pyplot plt x=[-4, 2, -1, 5] y=[-3, -2, 4, 2] plt.plot(x,y,'b-')

class - python - setting instance variable within the instance -

i have following tile class got instance variables such unmapped,free etc. instance variables default value once new instance created, want set of variables method within instance itself. when im trying so, seems the new value not saved when im doing without method seems work. how can be? class tile(): def __init__(self): self.free = 0 self.unmapped = 1 def set_tile(self,newval): self.free = newval so : tile1 = tile() tile1.set_tile(20) -> tile1.free = 0 but, tile1.free = 20 -> tile1.free = 20 thanks help

How Mysql load data in file statment behaves in case of exception -

i inserting data table mysql load data local infile statement. csv file contains 50000 rows. my question suppose load data infile stament has inserted 30000 rows , @ time power failure or exception has occurred. in case mysql automatically rollback transaction or there 30000 rows table. it depends engine using. remember myisam doesn't support transactions, myisam find in database rows inserted moment with innodb instead, rollback find no rows inserted.

linux - How to get information from text file using PHP and remote ssh? -

i've got problem poor performance php executing bash script remote ssh , doing grep on log. in web browser receive output after 40 seconds. executing bash script(ssh + grep on remote machine) directly on local machine taking 8 seconds. know cannot bypass came idea of : creating php script save text file on local machine "variables" need. let's call "parameters.txt". other bash script "reader.sh" read "parameters.txt" file, of magic of remote ssh , grep, save output "output.txt". background script run every 2 seconds reader.sh is idea? if need use php on ssh, use http://phpseclib.sourceforge.net/ . have nice ssh implementation used sometime deploy applications , configure linux servers (puppet replaced it). code cleaner , easy maintain. another option is, if reading logs linux ( messages, apache, syslog, etc...) have options rsyslog ( http://www.rsyslog.com/ ) centralize on server , work on locally. cheaper com...

How to read/processes 100 lines at a time from 10000 lines in python? -

how pass/processes 100 lines or lower try: @ time ? receipt_dict = {} open("data.txt", "r") plain_text: // ** 10000+ lines ** line in plain_text: hash_value = line.strip() receipt_dict[hash_value] = 1 try: bitcoind.sendmany("", receipt_dict) // **here must loop 100 @ time** with generators. here, load_data_chunks accumulates data in receipt_dict until size exceeds chunk_size , yields main loop below. def load_data_chunks(path, fname, chunk_size): receipt_dict = {} open(fname, "r") plain_text: line in plain_text: hash_value = line.strip() receipt_dict[hash_value] = 1 if len(receipt_dict) > chunk_size: yield receipt_dict receipt_dict = {} yield receipt_dict chunk in load_data_chunks("data.txt", 100): try: ...

IF condition in C translation to MIPS -

i want know why if(x == y) in c programming language translated 'bne' condition , not 'beq' condition in mips ? ignoring conditional moment, consider order in these blocks of code printed in assembler language instruction stream: // if (x == y) { // b } // c when x == y true, flow goes sequentially b c. there's no jump required on equality ( beq ), because desired flow matches way blocks printed in instruction stream. when x == y false, @ end of flow has bypass b , jump straight c. that's why makes sense branch instruction triggered on inequality ( bne ). of course, take these example thought process particular case. in general case, these implementation details. compiler may print instructions in way sees fit, including inverting conditionals. (keep in mind that, due modern cpu pipelines, strong optimization goal compiler guess execution path , ensure contains fewest possible jumps.)

jasper reports - Print the Values from list in JasperReports version 3 -

Image
i want values list , show in tabular form. m using sub reports. however, able first row values list, can't access rest of values. i using ireports version 3. here sub report: the first row matches pojo fields. need print second row, other values list. however, error shows cant' retrieve value material1.... as suggested in prevoius comments, should better understand how detail band works. the detail band iterates every "row" of datasource, unless did unconventional in datasource, need single field every "column" in datasource. basically, if data source like: material quantity actual_cost aaa 100 5 bbb 200 10 ccc 150 7 ddd 50 8 having 3 "columns" show, need 3 fields in detail band. running report, 4 rows (like datasource should suggest you).

android - How to retrieve data from the database in the View Pager concept? -

i have implemented view pager concept , retrieved 1 data. now,i want retrieve other data data base pages swipe to.. xyz= db.tablename(id); (int = 0; < xyz.size(); i++) { data1 key= xyz.get(i).get("data1"); data2 key=xyz.get(i).get("data2"); data3 key=xyz.get(i).get("data3"); } now these values on 1 screen , being repeated other swiped views. whereas,i want values change other layouts of swipe views . i have declared view pager coding after setting text particular field. my view pager coding this.. pageadapter adapter=new pageadapter(); vp.setadapter(adapter); vp.setcurrentitem(0); what should do? i tried implementing view pager coding(above mentioned coding) within loop neither content layout seen nor swipe features work. if using fragments viewpager in fragment class make cursor statment id id of viewpager. , populate listview cursor. way database entries sorted according id of viewpager. make column in database n...

How to open Spring Boot sample in Eclipse STS -

i've downloaded spring boot samples, , want run 1 of them in spring sts, instance one: https://github.com/spring-projects/spring-boot/tree/master/spring-boot-samples/spring-boot-sample-web-jsp however have no clue how import eclipse sts. tried import wizard, import file system non of work ((i error no project exists @ given location). how can run sample in eclipse sts? spring boot uses maven build tool, can import project existing maven project. m2e eclipse plugin generate eclipse settings mavens pom.xml file. import file system tries import existing eclipse project, spring boot demos not include eclipse settings, independent of ide

c++ - How to output MODULEENTRY32 properties data types? -

i have created module snapshot , got moduleentry32 struct contains data, output this: _tprintf( text("%6d %-15s %s\n"),pe.th32processid,me.szmodule,me.szexepath); now lets want use path, wchar me.szexepath , method requires path of const *char. how handle that, need convert data type?

iphone - Get a list of images in the project in iOS? -

i imported lot of images app. use imagenamed: each item hard manually (~50 images). can somehow list of them? testing purposes, private api acceptable too. or easier me rename them 1.jpg, 2.jpg , etc. the best way rename file ( 1,2,3 xxx ) but there tool see picture app bundle during coding ksimagenamed

vagrant - How can I get chef to reboot the node, and pick up the recipe from where it left off? -

i'm trying set asterisk server chef using berkshelf , vagrant, , i'd first upgrade kernel running apt-get upgrade , , rebooting machine. how can trigger reboot in recipe, , have pick after machine reboots? have no problem using fabric, execute "reboot" the chef provisioner in vagrant died machine rebooted idempotence 1 of principles of chef. this means recipe can run on , on again, , change things not expected. so in case this: first chef run notices unexpected kernel installed. installs kernel , triggers reboot. chef runs again, identifies kernel installed expected , continues. can continue other things. one note: i've never tried this, signalling reboot in middle of chef run damage. i'd recommend abort chef run after reboot signal (e.g. through raising exception, see how abort/end chef run? ).

javascript - how to retrive User name/login name from gmail? -

i using google login custom website. here wrote code it var soauthserviceendpoint = "https://accounts.google.com/o/oauth2/auth?scope=http://gdata.youtube.com https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email&response_type=token&"; var soauthredirecturl = "http://example.com/testpage/test.html"; var termsandcondurl = "termsandcondition.html"; var soauthclientid = "294016263542.apps.googleusercontent.com"; var sauthenticationurl = soauthserviceendpoint + "redirect_uri=" + soauthredirecturl + "&client_id=" + soauthclientid; even got access token using below function function fnonload() { //alert("form loaded"); var saccesstoken = ''; var params = {}, querystring = location.hash.substring(1),regex = /([^&=]+)=([^&]*)/g, m; while (m = regex.exec(querystring)) { params[decodeuricomponent(m[1])] = d...

java - How interface support multiple inheritance -

this question has answer here: multiple inheritance on java interfaces 5 answers public class test implements x, y { //x.y interface shown below public void mymethod() { system.out.println(" multiple inheritance example using interfaces"); } public static void main(string[]args) { test t=new test(); t.mymethod(); system.out.println(t.a); //compile time error ambigious field } } please me solve issue interface x { public void mymethod(); int = 0; } interface y { int = 9; public void mymethod(); } any variable defined in interface is, definition, public static final , in other words it's constant, it's not field (since there no fields in interfaces). so compilation error points out compiler doesn't know w...

ios - Overlapping Views in UIStackView -

Image
i have horizontal stack view added arranged sub views (7 cells). each 1 of cells in stack has circular badge exceeds view boundaries (negative constraint). when running, can see below, each cell on top of badge of previous cell. change order badges visible. tried playing z index didn't layers somehow not flat can see in following view hierarchy: any idea or suggestion how it? thanks. the documentation uistackview class tells that: the order of subviews array defines z-order of subviews. if views overlap, subviews lower index appear behind subviews higher index. which experienced in question. on come specific case did trick of changing semantic of view rtl can bee seen here: this not covering generic case because device may have been set rtl language in global settings. generic case guess need check interface semantic , force opposite direction stack view. p.s. it's kind of hack ideas how reorder z-order of subviews in different way welcome...

TC should be the right-hand operand in Java 8 Language Specification -

if @ java 8 language specification §15.26.1 otherwise, value of index subexpression used select component of array referred value of array reference subexpression. this component variable; call type sc . also, let tc type of left-hand operand of assignment operator determined @ compile time. there 2 possibilities: if tc primitive type, sc same tc. the value of right-hand operand converted type of selected array component, subjected value set conversion (§5.1.13) appropriate standard value set (not extended-exponent value set), , result of conversion stored array component. it says "let tc type of left-hand operand of assignment operator" , tc left operand , sc component of array , type of right operand. so, code goes this: int tc = 15; int[] sc = {1,2,3,4,5}; tc = sc[0]; next weird things, says "the value of right-hand operand converted type of selected array component" ...

java - Does jQuery have a built in function to do long polling? -

i doing java chat application . i call pingaction() in external jquery when application initiated. i used site reference of long polling jquery - http://techoctave.com/c7/posts/60-simple-long-polling-example-with-javascript-and-jquery the jquery pingaction , function pingaction(){ $.ajax( { type: "post", url: "pingaction", async: false, data : "userid="+encodeuricomponent(userid)+"&securekey="+encodeuricomponent(securekey)+"&sid="+math.random() , cache:false, complete: pingaction, timeout: 5000 , contenttype: "application/x-www-form-urlencoded; charset=utf-8", scriptcharset: "utf-8" , datatype: "html", error: function (xhr, ajaxoptions, thrownerror) { alert("xhr.status...

Java : What's the code behind this algorithm? -

this question has answer here: pascal triangle using java [closed] 4 answers enter image description here this first question in stack overflow knows what's code behind algorithm 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 and if algorithm has name please name ... tanku much powers of 11 11 , 11^2 , 11^3 , 11^4

java - Float vs Integer MAX_VALUE -

int , float has 4 bytes value. if there such float value 0.5 int doesn't contain, there value int contains, float . i'm assuming you're looking numbers can presented int , not float . one of them integer.max_value . int = integer.max_value; float f = i; // or 2147483647f system.out.println(i); system.out.println(string.format("%f", f)); displays 2147483647 2147483648.000000 this because while both have 32-bits float divides bits used sign ( 1 bit ), exponent ( 8 bits ) , significand or mantissa ( 23 bits ).

python - AttributeError: module 'html.parser' has no attribute 'HTMLParseError' -

this hints,how can resolve it? i use python 3.5.1 created virtual envirement virtualenv the source code works on friend's computer machine error: traceback (most recent call last): file "manage.py", line 10, in <module> execute_from_command_line(sys.argv) file "a:\python3.5\lib\site-packages\django\core\management\__init__.py", line 385, in execute_from_command_line utility.execute() file "a:\python3.5\lib\site-packages\django\core\management\__init__.py", line 354, in execute django.setup() file "a:\python3.5\lib\site-packages\django\__init__.py", line 18, in setup django.utils.log import configure_logging file "a:\python3.5\lib\site-packages\django\utils\log.py", line 13, in <module> django.views.debug import exceptionreporter, get_exception_reporter_filter file "a:\python3.5\lib\site-packages\django\views\debug.py", line 10, in <module> django.http import...

java - Apache pdfbox .doc to .pdf conversion -

i'm trying convert .doc .pdf , got exception , don't know how fix it. java.io.ioexception: missing root object specification in trailer @ org.apache.pdfbox.pdfparser.cosparser.parsetrailervaluesdynamically(cosparser.java:2042) this exception thrown: pddocument pdfdocument = pddocument.load(convertdoctopdf(documentinputstream)); here conversion method: private byte[] convertdoctopdf(inputstream documentinputstream) throws exception { document document = null; wordextractor = null; bytearrayoutputstream out = null; byte[] documentbytearray = null; try { document = new document(); poifsfilesystem fs = new poifsfilesystem(documentinputstream); hwpfdocument doc = new hwpfdocument(fs); = new wordextractor(doc); out = new bytearrayoutputstream(); pdfwriter writer = pdfwriter.getinstance(document, out); range range = doc.getrange(); document.open(); writer.setpageempty(true);...

SQL Server Not(A=B and C=D) vs (A<> B or C<> D) -

i have simple performance related question regarding equality , inequality. past experience learnt eq conditions work better , or conditions cause perf issues. when @ query plan both when executed side side both had scan type of eq did same query plan. make difference if have query formatted not(a=b , c=d) or work (a <> b or c<> d) what best approach? did not think nulls here, here difference. select 1 not(2=1 , null=2) select 1 not(2=1 , 3=null) select 1 not(2=1 , null=2) select 1 not(1=1 , 3=null) select 1 not(null=1 , 2=2) select 1 not(null=null , 2=2) --point note one. false, true select 1 not(1=1 , 3=3) select 1 (2<>1 or null<>2) select 1 (2<>1 or 3<>null) select 1 (2<>1 or null<>2) select 1 (1<>1 or 3<>null) select 1 (null<>1 or 2<>2) select 1 (null<>null or 2=2) --point note one. true, true select 1 (1<>1 or 3<>3) for simple comparisons, expect these have s...

PHP stream_get_contents from TCP client hangs if called more than once -

i writing program connects tcp server stream_socket_client in php. problem if echo contents of $client object before perform additional fwrites, page hangs. work if send of requests before calling stream_get_contents, once call stream_get_contents, client no longer responds? thankful given. **edit api using: https://www.onlinenic.com/cp_english/template_api/download/onlinenic_api2.0.pdf **edit //see full code below //------client creation code, precho function function gettestclient($address, $port) { $client = stream_socket_client("$address:$port", $errno, $errormessage); if ($client === false) { throw new unexpectedvalueexception("failed connect: $errormessage"); } return $client; } function precho($s) { echo "<pre>"; echo $s; echo "</pre>"; } //-------problem code //$loginrequest, $domainavailablerequest, , $logoutrequest - see full code below //-----------------------------------------...

java - Reading char[] from web-service by HttpGet — strange behavior -

i developing android application, going fetch big chunk of json data in stream. calling web service ok, have little problem. in old version using gson reading stream i've tried insert data database, ok without problem except performance. tried change approach of loading data, trying read data char[] first insert them database. this new code: httpentity responseentity = response.getentity(); final int contentlength = (int) responseentity.getcontentlength(); inputstream stream = responseentity.getcontent(); inputstreamreader reader = new inputstreamreader(stream); int readcount = 10 * 1024; int hasread = 0; char[] buffer = new char[contentlength]; int mustwrite = 0; int hasread2 = 0; while (hasread < contentlength) { // problem here hasread += reader.read(buffer, hasread, contentlength - hasread); } reader reader2 = new chararrayreader(buffer); the problem reader starts reading correctly @ near of end of stream, hasread variable value decreases (by 1 ) instea...

php - Is there a AUI pane move (or dock) event in wxPHP? -

on this question have been attempting capture aui pane configuration can restored if panes have been closed. docs limited wxphp, , upstream wxwidgets, largely feeling way around. i have realised savepaneinfo me capture state of pane - outputs perspective string represents position , options pane @ given moment. need therefore capture when pane changes , update internal representation of it. for sake of interest, perspective looks this: name=auipane3;caption=caption 3;state=2099196;dir=3;layer=0;row=0;pos=1;prop=100000;bestw=90;besth=25;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1 however, capturing move/dock event not proving trivial. can see 6 events connected aui: wxevt_aui_find_manager wxevt_aui_pane_button wxevt_aui_pane_close wxevt_aui_pane_maximise wxevt_aui_pane_restore wxevt_aui_pane_render i have been able capture restore , close events, , find_manager doesn't seem anything. i've tried wxevt_any on window, not seem cap...

algorithm - Filter items with Django Query -

i'm encountering problem , seek help. the context: i'm having bag of balls, each of has age (red , blue) , color attributes. what want top 10 "youngest" balls , there @ 3 blue balls (this means if there more 3 blue balls in list of 10 youngest balls, replace "redudant" oldest blue balls youngest red balls) to top 10: sel_balls = ball.objects.all().sort('age')[:10] now, satisfy conditions "at 3 blue balls", need process further: iterate through sel_balls , count number of blue balls (= b) if b <= 3: nothing else: additional b - 3 red balls replace oldest (b - 3) blue balls (and these red balls must not have appeared in original 10 balls taken out). figure can getting oldest age value among list of red balls , query like: add_reds = ball.objects.filter(age >= oldest_sel_age)[: b - 3] my question is: is there way can satisfy constraints in 1 query? if have 2 queries, there faster ways 1 method mentioned above...

javascript - protractor unknown error, removing attribute from DOM -

im new protractor , trying remove attribute dom getting "unknown error", im not sure problem im having simple html custom directive.i trying remove test cases pass: <input type="text" name="rptdate" input-date placeholder="dd-mm-yyyy" data-ng-model="newpatreports.reportdate" /> commands ran are: browser.executescript( 'document.getelementsbyname("rptdate").removeattribute("input-date")' ); browser.driver.findelement(protractor.by.name('rptdate')).removeattr("input-date"); browser.executescript('document.queryselector("input[name='rptdate']").removeattribute("input-date");'); but none of them helped. locate element protractor , pass web element script: var elm = element(by.name("rptdate")); browser.executescript('arguments[0].removeattribute("input-date");', elm.getwebelement());

python 2.7 - Matplotlib navigation toolbar is invisible -

when plot image, navigation toolbar (zoom-in, forward, back...) invisible. helped myself link: disable matplotlib toolbar . have first tried: import matplotlib mpl mpl.rcparams['toolbar'] = 'toolbar2' and checked if in file set 'none' not. did perhaps forget install packages? though don't errors. is there alternative way zoom-in , see coordinates of cursor , because need. edit 1 this code using. copied part, use plot. #___plotting part___ import matplotlib mpl mpl.rcparams['toolbar'] = 'toolbar2' import matplotlib.pyplot plt plt.ion() fig, ax = plt.subplots(figsize=(20, 10)) ax.set_title(plot_titel, loc='center', fontname=font_name, fontsize=16, color='black') ax.set_xlabel('column number', fontname=font_name, fontsize=16, color='black') ax.set_ylabel('mean of raw backscatter', fontname=font_name, fontsize=16, color='black') ax.plot(range(len(param_image)), param_image, c='...

android - This property cannot be set after writing has started! on a C# WebRequest Object using GCM -

i want send data c# gcm , take bug. code here: webrequest trequest; trequest = webrequest.create("https://android.googleapis.com/gcm/send"); trequest.method = "post"; trequest.contenttype = " application/x-www-form-urlencoded;charset=utf-8"; trequest.headers.add(string.format("authorization: key={0}", applicationid)); trequest.headers.add(string.format("sender: id={0}", sender_id)); con.open(); //int ekleyen_id = convert.toint32(session["kullaniciid"].tostring()); sqlcommand cmd = new sqlcommand("select * users", con); sqldatareader rd = cmd.executereader(); while (rd.read()) { string regidsend = rd["registered_id"].tostring(); // string postdata = "{ 'registration_id': [ '" + regid + "' ], 'data': {'message': '" + txtmsg.text + "...

ios searchapi - Using Search API, can I get the list of installed apps on iOS? -

last year, apple released search api. * https://developer.apple.com/videos/play/wwdc2015-709/ before this, impossible list of installed apps on ios.(is right?) if use search api, can list of installed apps on ios? tried that? no, search api won't allow list of installed apps. also, highly unlikely capability provided apple anytime soon. apple takes user privacy seriously, going philosophy - makes sense app won't have access kind of information, not without explicit permission anyway. the various search apis give ability make own app appear in search results rather perform search yourself.

multithreading - Alarm App in Wpf -

i try create app alarm list of reminders in background , after shutdown app, alarm part still work , alarm top reminder. best approach(dispatcher, backgroundworker, tpl ....) ? thank attention. you have keep app alive execute code. use c# timer class simple implementations or scheduler quartz.net if need more complex solution. if it's absolutely necessary close app, build solution based on windows task scheduler. of course, list isn't complete, wanted give ideas ;)

How do I replace four spaces by one tab in a big python codebase? -

i have downloaded python code , edit it. problem used use tabs make indents file use 4 spaces instead , if combination of spaces , tabs used, visually looks fine, code generate errors. my question if there simple way replace spaces tabs? get editor understands simulated tabs. simulate tabs using 4 spaces. editors can nowadays. feel tabs spaces..

tcpdump - Filter first ten minutes of pcap -

i have large pcap file, , generate new pcap contains first ten minutes of traffic. can tcpdump ? have seen editcap mentioned online, use tcpdump if possible. you can tcpdump ; however, simpler editcap because practical way tcpdump can think of use wireshark (or tshark ) first find frame number of packet @ least 10 minutes capture file. once have frame number, tcpdump can used save packets until frame, limiting output file desired 10 minute duration. here's how: first, find first packet @ least 10 minutes capture file (here i'll illustrate tshark , wireshark used well): tshark -r bigfile.pcap -y "frame.time_relative <= 600.0" note frame number of last packet displayed. (the frame number first number of each row, assuming standard tshark columns.) illustrative purposes, let's it's frame number 21038. second, use tcpdump save first 21038 frames new file: tcpdump -r bigfile.pcap -c 21038 -w bigfile_first10min.pcap but since ...

Scala: Array[Array[Int]] to Array[Int] -

so have array of array of ints, example val n = array(array(1,2,3), array(4,5,6), array(7,8,9)) but want convert array(1,2,3,4,5,6,7,8,9) is possible , how? thanks! you can use flatten method. calling n.flatten output array(1,2,3,4,5,6,7,8,9) .

c++ - Connection between Qt and Code in Visual Studio -

i have installed qt on visual studio 2013 , have question: how can make connection between button , code visual?. need make simple menu aplication. i don't specifying connections in ui file using gui (where can select signal , slot , rest of work you). gui buggy. recommend calling connect method in code. example, in main window constructor or special method sets connections (and is, in turn, called constructor): connect(ui->button, signal(clicked(void)), /* or other object */, slot(buttonclicked(void)); if use qt 5 , not qt 4, recommend new connection syntax. it's both easier debug (you're compile-time error instead of runtime error if connection can't made), and, suspect, might result in faster / smaller code: connect(ui->button, &qpushbutton::clicked, /* or other object */, &cmainwindow::buttonclicked); the latter method has additional benefit of autocompletion working in visual studio , not in qt creator.