Posts

Showing posts from April, 2015

c++ - opencv: single pixal assignment confusion -

i working opencv , c++ project , found weird thing: when try access single pixal value in iplimage , assign other value, run result can operate part of whole image. relevant code: iplimage* output_frame = cvcreateimage(size, ipl_depth_8u, 1); iplimage* current_frame = cvcreateimage(size, ipl_depth_8u, 1); while((current_frame = cvqueryframe(video_gray)) != 0 ) { (int row=0;row<height;row++) { uchar* ptr_current_frame = (uchar *)(current_frame->imagedata+current_frame->widthstep*row); uchar* ptr_output_frame = (uchar *)(output_frame->imagedata+output_frame->widthstep*row); (int cols=0;cols<width;cols++) { //other codes... ptr_output_frame[cols]=ptr_current_frame[cols]; } } } the result left part of image copied output_frame. , when run following code: iplimage* output_frame = cvcreateimage(size, ipl_depth_8u, 1); iplimage* current_frame = cvcreateimage(size, ipl_depth_8u, 1); while((curr...

livecode - How i write file into home(In linux system) -

i trying write file in home folder(i using linux operating system) while writing file temp it's working put shell("echo $home") last1 the above code getting home folder , place path variable last1 put text of field "bash1" url "file:last1/dic.sh" here bash1 text field , it's contains shell script want write home directory the below code works put text of field "bash1" url "file:/tmp/dic.sh" how rewrite code as last1 variable enclosed in quotes, it's getting treated literal string rather variable. following work: put field "bash1" url ("file:" & last1 & "/dic.sh") note not have refer explicitly text property when putting texts fields - can above. furthermore, if you're on linux, can use ~ shortcut refer user's home directory: put field "bash1" url "file:~/dic.sh"

floating point - significant decimal digits of binary32 and binary64 -

accourding wikipedia binary32 format has 6 9 significant decimal digits precision , 64 format has 15 17. i found these significant decimal digits have been calculated using mantissa didn't how can 1 calculate it? idea ? mantissa of 32bit format = 24bits ,mantissa of 64bit format = 53bits first, question better use total significand sizes 24 , 53. fact leading bit not represented aspect of encoding. if interested in vague explanation, each decimal digit contains log2(10) (about 3.32) bits of information. when have encode 1 digit, need 4 bits, here talking encoding several consecutive decimal digits efficiently, figure of 3.32 do. 53 bits / log2(10) -> 15.95 (16ish decimal digits) 24 bits / log2(10) -> 7.22 (7ish decimal digits) if want properly, need consider fact not same numbers representable in binary , in decimal. people ask decimal precision of binary floating-point assumed mean either decimal precision can round-trip through binary forma...

database - mysql suddenly ignoring table indices for a time -

on our mysql 5.1 server innodb table called central our web application. has around 150,000 rows , far many columns due bad implementation. lately we've been running task updates table (insert or update) once every few seconds. when task running, database periodically (every 1 - 3 hours) become slower process client read requests. during times slow_log points table culprit , request looks it's doing full table scan. eventually, within 5-20 minutes work out , go processing normally. my assumption constant table updates throwing mysql's query optimizer statistics out of whack every once in while. don't know how prove or find solution it. can following causes? too many secondary indices on table (there ~45, many unnecessary take time , care prune away) bad configuration parameters (query_cache on , innodb_buffer @ 5g) mysql 5.1 outdated , should upgraded the database server needs more ram/cpu handle load i more happy provide additional information m...

h.264 - Decoding H264 stream with ID3D11VideoDecoder -

i'm trying decode (and render) h264 raw stream directx11 , interface https://msdn.microsoft.com/en-us/library/windows/desktop/hh447766%28v=vs.85%29.aspx . unfortunately got stuck @ sumbitting dxva pictureparameters buffer: namely id3d11videocontext::submitdecoderbuffers returns e_fail. enigmatic, there somewhere example of using interface decode h264 bitstream becasue error code e_fail might never able conclude i'm doing wrong? such example helpful. currently, don't think there sample id3d11videocontext h264 decoding. there idirectxvideodecoder (directx9). update the source code mpc- be start. (under src->filters->transform->mpcvideodec). (ffmpeg has use of id3d11videocontext, not detailed).

regex - .htaccess rewrite subdomain to directory or to file depending on path -

when navigate sub.domain.com/path gets me domain.com/site.php?site=sub&page=path . when path text.text want point domain.com/subdomains/sub/text.text can't work together. rewritecond %{http_host} ^(.*)\.domain\.com$ [nc] rewritecond %{request_uri} !^(.*\..*)$ [nc] rewriterule ^(.*)$ site.php?site=%1&page=$1 [l] when path contains text.text apply rule: rewriterule ^(.*)$ http://domain.com/subdomains/%1/$1 [p,l,nc,qsa] also how can make rule above work relative path (without http://domain.com/ )? update: sub.domain.com -> site.php?site=sub sub.domain.com/path -> site.php?site=sub&page=path sub.domain.com/path.ext -> subdomains/sub/path.ext all above works, 1 more left: sub.domain.com/constant/text.text -> constant/text.text that 1 above should apply if after constant text dot. if not rule should apply: sub.domain.com/path -> site.php?site=sub&page=path you can use these 2 rules: rewriterule ^(constant|site\.ph...

sumologic - Can't divide field by number in Sumo Logic -

i have sumo logic query i'm taking numeric field , summing it, fields value milliseconds want divide field 1000 number seconds. parse "downloadduration=*," downloadtime | sum(downloadtime / 1000) totaldownloadtime but sumologic gives me error: parse error: ')' expected '/' found. when try (even though help docs seem suggest totally legit . i had add parse statement alter fields value. parse "downloadduration=*," downloadtime | (downloadtime / 1000) downloadtime | sum(downloadtime) totaldownloadtime works perfectly!

Python 2.7.6 + unicode_literals - UnicodeDecodeError: 'ascii' codec can't decode byte -

i'm trying print following unicode string i'm receiving unicodedecodeerror: 'ascii' codec can't decode byte error. can please form query can print unicode string properly? >>> __future__ import unicode_literals >>> ts='now' >>> free_form_request='[exid(이엑스아이디)] 위아래 (up&down) mv' >>> nick='me' >>> print('{ts}: free form request {free_form_request} requested {nick}'.format(ts=ts,free_form_request=free_form_request.encode('utf-8'),nick=nick)) traceback (most recent call last): file "<stdin>", line 1, in <module> unicodedecodeerror: 'ascii' codec can't decode byte 0xec in position 6: ordinal not in range(128) thank in advance! here's happen when construct string: '{ts}: free form request {free_form_request} requested {nick}'.format(ts=ts,free_form_request=free_form_request.encode('utf-8'),nick=nick) fre...

cluster analysis - Get specific elements from clustered data in R -

i generate image using hclust function. wand id of elements highlighted squares. http://i59.tinypic.com/117u2ro.jpg is there way id , related value clusted datasets? thanks edit i used r script library(gplots) library(geneplotter) # read data in url bots <- read.table("expression.txt") # alpha data abot <- bots[,c(1:9)] rownames(abot) <- bots[,1] abot[1:7,] # rid of nas abot[is.na(abot)] <- 0 # need find way of reducing data. can't anova there no # replicates. sort on max difference , take first 1000 min <-apply(abot, 1, min) max <- apply(abot, 1, max) sabot <- abot[order(max - min, decreasing=true),][1:1000,] # cluster on correlation cdist <- as.dist(1 - cor(t(sabot))) hc <- hclust(cdist, "average") # draw heatmap x11() heatmap.2(as.matrix(sabot), rowv=as.dendrogram(hc), colv=false, cexrow=1, cexcol=1, dendrogram="row", scale="row", trace="no...

regex - Ignore escaped double quote characters swift -

i trying validate phone number using nspredicate , regex. problem when setting regex swift thinks trying escape part of due backslashes. how can around this? my code follows: let phoneregex = "^((\(?0\d{4}\)?\s?\d{3}\s?\d{3})|(\(?0\d{3}\)?\s?\d{3}\s?\d{4})|(\(?0\d{2}\)?\s?\d{4}\s?\d{4}))(\s?\#(\d{4}|\d{3}))?$" in swift, still need double-escape slashes: let phoneregex = "^((\\(?0\\d{4}\\)?\\s?\\d{3}\\s?\\d{3})|(\\(?0\\d{3}\\)?\\s?\\d{3}\\s?\\d{4})|(\\(?0\\d{2}\\)?\\s‌​?\\d{4}\\s?\\d{4}))(\\s?\\#(\\d{4}|\\d{3}))?$"

regex - Breaking down a image url into three sub parts in PHP -

suppose have image url: http://static2.tripoto.com/media/filter/medium/img/11099/tripdocument/chiang_mai_street_market.jpg i want extract 3 things url: "medium" (this can medium/small/thumbnail) the part after medium , before image name (img/11099/tripdocument) image name (chiang_mai_street_market.jpg) also can use regular expression, if want: preg_match_all('/^.*(medium|small|thumbnail)\/(.*)\/([^\/]+)$/', $url, $matches); result: $matches[0] = $url $matches[1] = "medium" $matches[2] = "img/11099/tripdocument" $matches[3] = "chiang_mai_street_market.jpg" assumption: there none other "medium", "small", or "thumbnail" string in given url, before need. edit: to make more flexible fot sizes/phrases, extract phrases array, this: $sizes = ['medium', 'small', 'thumbnail']; preg_match_all('/^.*(' . implode('|', $sizes ) . ')\/(....

java - Passing object into classes, will they just be references to original? -

this question has answer here: is java “pass-by-reference” or “pass-by-value”? 72 answers this class contains characters , objects within level . collisionlistener interface, , collisionlistener.begincontact() called whenever character collides object. i'm wondering, since i'm passing level collisionlistener , mean 2 objects stored in memory? or private level level inside collisionlistener reference original level ? how handled internally jvm? since when modify level inside collisionlistener , original level updated too. public class level extends world { private player player; private enemy enemy; public level(){ this.setcontactlistener( new collisionlistener(this)); player = new player(); enemy = new enemy(); } /** * move characters */ public update(...

c# - Download the latest file from an FTP server -

i have download latest file ftp server. know how download latest file computer, don't how download ftp server. how can download latest file ftp server? this program download latest file computer public form1() { initializecomponent(); string startfolder = @"c:\users\user3\desktop\documentos xml"; system.io.directoryinfo dir = new system.io.directoryinfo(startfolder); ienumerable<system.io.fileinfo> filelist = dir.getfiles("*.*", system.io.searchoption.alldirectories); ienumerable<system.io.fileinfo> filequerry = file in filelist file.extension == ".txt" orderby file.creationtimeutc select file; foreach (system.io.fileinfo fi in filequerry) { var newestfile = (from file in filequerry orderby file.creationtimeutc select new { file.fullname, file.name })...

c# - jquery function property doesn't recognize @Model.EndDate value -

first , foremost here link countdown timer using: http://www.jqueryscript.net/time-clock/slim-countdown-timer-plugin-with-jquery-downcount.html i using visual studio, c# mvc asp.net, entity framework, bootstrap & razor cshtml pages , jquery. it works fine if set date manually this: <script> $('.countdown').downcount({ date: '06/06/2015 12:00:00', offset: +1 }); </script> however, need call object entity framework, enddate said object , use set countdown timer. tried calling object (inside html page): $('.countdown').downcount({ date: '@model.enddate', offset: +1 }); apparently, property doesn't recognize @model.enddate value i'm trying pass, , sees null value. how make recognize value? just make property call strenddate formatting of date , set property on server send down string, js doesnt interfere date values.

asp.net - Login control won't login -

i've been using vs 2013 , created asp.net web forms application using template bootstrap. have login control of default behaviour using aspnet tables within sql. when run within ide have no problems in browser logging site (ie, chrome) manly using ie when running. however, have deployed site local server testing , stops working in ie. happens goes through validation of user name/password fine, gets redirect user never logged in. if browse server using chrome on pc work fine if same within ie won't work 95% of time have managed login occasionally. have asked other colleague's try, chrome doesn't work of them or ie. have tried on ipad chrome work safari won't! so in file startup.auth.vb partial public class startup ' more information on configuring authentication, please visit http://go.microsoft.com/fwlink/?linkid=301883 public sub configureauth(app iappbuilder) 'configure db context, user manager , signin manager use single instance per req...

oracle11g - using zend with oracle ORA-00911: invalid character -

ora-00911: invalid character select "scores"."subscriberid" "subscriberid", sum(scores.score) "score", "subscribers"."subscriberid", "subscribers"."firstname", "subscribers"."lastname", "subscribers"."mobile" "scores" inner join "subscribers" on "subscribers"."subscriberid"="scores"."subscriberid" ("scores"."pollingid"=2) , ("subscribers"."subscriberid" not in (select "polling_trialaudience_subscrib"."subscriberid" "polling_trialaudience_subscrib" ("polling_trialaudience_subscrib"."pollingid"=2))) , ("subscribers"."subscriberid" not in (select "group_subscribers"."subscriberid" "polling_trialaudience_groups" inner ...

swift - Media Info displayed in simulator but doesn't display on real device -

Image
i have tried code show media info: import mediaplayer let audioinfo = mpnowplayinginfocenter.defaultcenter() audioinfo.nowplayinginfo = [ mpmediaitempropertytitle: "miley_cyrus_", mpmediaitempropertyartist:"artistname"] this working fine on simulator shown image: but not working correctly on real device: there no media info displayed in real device displayed simulator. missing something? i have found solution it uiapplication.sharedapplication().beginreceivingremotecontrolevents() this working fine. reference here .

Android using jcodec to convert a series of images takes very long time -

i using jcodec library converting series of images video, along transitions / animation fade / flip , on... while conversion process, use below function of sequenceencoder class each of image. public void encodenativeframe(picture pic) throws ioexception { if (toencode == null) { toencode = picture.create(pic.getwidth(), pic.getheight(), encoder.getsupportedcolorspaces()[0]); } // perform conversion transform.transform(pic, toencode); // encode image h.264 frame, result stored in '_out' buffer _out.clear(); bytebuffer result = encoder.encodeframe(toencode, _out); // based on frame above form correct mp4 packet spslist.clear(); ppslist.clear(); h264utils.wipeps(result, spslist, ppslist); h264utils.encodemovpacket(result); // add packet video track outtrack.addframe(new mp4packet(result, frameno * 1, (int)fps, 1, frameno, true, null, frameno * 1...

asp.net mvc - How to send a value from a select statement in MVC controller to Viewbag -

i want return value viewbag linq query below var mycompanyname = (from c in db.companies c.companyid == companyid select c.companyname).tostring(); viewbag.mycompanyname = mycompanyname; in mvc controller following output in view. select [extent1].[companyname] [companyname] [dbo].[companies] [extent1] [extent1].[companyid] = @p__linq__0 company name controller action the result viewbag expected view bag should like: companyname xyz. please how make right? your not materializing query, , suspect want return single value (not ienumerable<string> ) need replace .tostring() .firstordefault() var mycompanyname = (from c in db.companies c.companyid == companyid select c.companyname).firstordefault(); viewbag.mycompanyname = mycompanyname; or if did want collection of string , .tolist()

c++ - GDI CreatePolyPolygon and boost multi_polygon -

there winapi function following prototype: winapi createpolypolygonrgn( point *pptl, int *pc, int cpoly, int imode); i can't realize best way convert multipolygon representation accepted procedure multi_polygon boost model. in case of interior-free polygon set conversion multi_polygon evident. but if have interiors don't see easy way of conversion because need detect interiors first , correspondence polygons. it's easy collect exterior , interior polygons exterior polygons , put multi_polygon. how put interior polygons represented exterior corresponding polygon interior rings?

java - If there's only one thread running(main) and sleep(1000) is invoked, will the thread sleep for exactly 1 second or atleast 1 second? -

in below code: class test { public static void main(string [] args) { printall(args); } public static void printall(string[] lines) { for(int i=0;i<lines.length;i++){ system.out.println(lines[i]); thread.currentthread().sleep(1000); } } } will each string in array lines output: with exactly 1-second pause between lines? with at least 1-second pause between lines? approximately 1-second pause. thread can woken beforehand , you'll interruptedexception , or thread can sleep 1000ms , not run immediately, 1000ms + microseconds (or more, if there higher priority threads hogging cpu). you're calling wrong. it's thread.sleep(1000); , static method acts on current thread , can't make other threads sleep it.

Delete files after conversion in Powershell -

i'm inexperienced in powershell - through trial , error have managed .doc/.docx .pdf conversion working specified folder , subfolders. $wdformatpdf = 17 $word = new-object -comobject word.application $word.visible = $false $filetypes = "*.docx","*.doc" get-childitem -recurse -path "c:\test-acrobat" -include $filetypes | foreach-object ` { $path = ($_.fullname).substring(0,($_.fullname).lastindexof(".")) "converting $path pdf ..." $doc = $word.documents.open($_.fullname) $doc.saveas( $path, $wdformatpdf) $doc.close() } $word.quit() now i'd able delete original .doc/.docx files once they've been converted. on doing searching i've found think work: { remove-item $filetypes # delete file file-system } but i'd rather check throw in command delete files... any appreciated. philip i add delete inside foreach loop. so get: $wdformatpdf = 17 $word = new-object -comobject word.application $w...

html - How to hide bootstrap nav bar brand on home page -

Image
how can hide bootstrap nav bar brand on index page above width of 768px. @ point when website become responsive , change menu bar. add class .hidden-xs navbar-brand

Control sum from input boxes in javascript -

i'm trying make controls in javascript when submit form in html. evertyhing works except 1 needs check sum of 2 fields. <script type="text/javascript"> function validation() { var count=0; if((document.getelementsbyname("people")[0].selectedindex) == "") {alert("how many people?"); count++;} else if((document.getelementsbyname("amount")[0].selectedindex) == "") {alert("amount has @ least 1."); count++;} else if((document.getelementsbyname("deposit")[0].value) == "") {alert("deposit cannot empty."); count++;} else if((document.getelementsbyname("deposit")[0].value) < "20") {alert("deposit must @ least 20."); count++;} else if((document.getelementsbyname("topay")[0].value) == "") {alert("mark 0 in pay if dont have pay more."); count++;} else if( ( (document.getelementsbyname("deposit...

Adding a custom text to an image and uploading it in javascript/php -

so need able put text on image (saved on server have path) , save on server. heard 's best use canvas, can't find i'm looking for. this answer then. except watermark text needs string predefined kind of. , while uploading image have call specific function used in official documentation. watermark images . got instead of image have add text. should help

Only display a checkbox on child nodes with Kendo Treeview -

i have following situation, have parent node number of nested child nodes. parent node should have checkbox, example have found child nodes have checkbox. possible using kendo templates? http://dojo.telerik.com/@andybeeby/ikohi template: "#if (item.element=== 'avalue' ) {# <input type='checkbox' #if(item.checked) { #checked# }# />#}" using template apply check boxes items have value.

postgresql - How to fetch next unique row from a table of postgres -

suppose table contains 2 columns "id" (type character varying(22)) , "time" (type timestamp without time zone). now have data in table follows, id time p001 2015-02-04 10:00:00 p002 2015-02-04 10:00:00 p003 2015-02-04 10:00:00 p004 2015-02-04 10:10:00 p005 2015-02-04 11:00:00 query first row be: select * <tablename> order time, id limit 1; after query next row having id value "p002" generally offset, if there's index on time, id can more efficient database (only noticable if have millions of rows though). standard solution: select * <tablename> order time, id limit 1 offset 1; indexed (usually faster) solution: select * <tablename> time >= '2015-02-04 10:00:00' , id > 'p001' order time, id limit 1;

html - How to select a only a paticular P tag inside div tag hierarchically -

how select 2nd <p> of 2nd <div> tag? is there hierarchy can associate in css tags ? below code: <!doctype html> <html> <head> <style> p:nth-of-type(2) { background: #ff0000; } </style> </head> <body> <div> <p>the first paragraph.</p> <p>the second paragraph.</p> <p>the third paragraph.</p> <p>the fourth paragraph.</p> </div> <div> <p>the first paragraph.</p> <p>the second paragraph.</p> <p>the third paragraph.</p> <p>the fourth paragraph.</p> </div> </body> </html> regarding widest browser support can use + selector combined :first-child . div + div p:first-child + p {color: red;} https://jsfiddle.net/vkm2zuaq/ or using :nth-child : div:nth-child(2) p:nth-child(2) {color: red;} https://jsfiddle.net/vkm2zuaq/1/

http - python requests - remove headers on redirect -

i'm using python requests library http checking on application. have situation need send in initial host header on requests, should not used when following redirects causing problem. i've had around request docs can't see way can have requests drop request headers when following redirects. here example of problem import requests requests.structures import caseinsensitivedict s = requests.session() request_headers = caseinsensitivedict() request_headers['host'] = 'google.co.uk' response = s.get("http://google.co.uk",allow_redirects=true,headers=request_headers) in case google.co.uk redirect https://www.google.co.uk , stuck in loop because send host header set 'google.co.uk' after follows redirect. i need use manual host header on first request due going through cdn uses header determine site serving for. removing initial request not option. here equivalent curl, drop host header after initial request. behaviour see / expect...

javascript - AngularJS - Change API by SSL -

var serviceroot = 'http://myapisite.com/api/account/'; but want, when user come site https api change 'https://myapisite.com/api/account/' how can it? you can fetch scheme javascript this: var scheme = window.location.protocol; //http: or https: var serviceroot = scheme + '//myapisite.com/api/account/';

java - How to bind input externally to xquery using saxon? -

i have invoke external java methods in xquery using saxon he. able invoke methods below code. problem want bind input externally. final configuration config = new configuration(); config.registerextensionfunction(new shiftleft()); final staticquerycontext sqc = new staticquerycontext(config); final xqueryexpression exp = sqc.compilequery(new filereader( "input/names.xq")); final dynamicquerycontext dynamiccontext = new dynamicquerycontext(config); string xml = "<student_list><student><name>george washington</name><major>politics</major><phone>312-123-4567</phone><email>gw@example.edu</email></student><student><name>janet jones</name><major>undeclared</major><phone>311-122-2233</phone><email>janetj@example.edu</email></student><student><name>joe taylor</name><major>engineering</major><phone>211-111-2333...

Best naming convention for handling multiword Django models? -

what best naming convention instance, url , template names of django models more 1 word? instances yetanothermodel = yetanothermodel() yet_another_model = yetanothermodel() url names 'yetanothermodel_detail' 'yet_another_model_detail' template names 'yetanothermodel_detail.html' 'yet_another_model_detail.html' it personal choice. if working in team should applying python pep8 standard of coding; way members of team using same process , naming conventions write code. in instance: yet_another_model = yetanothermodel() variables names should lower-case, underscore separated. class names using camel casing naming convention. and 'yet_another_model_detail' url names should treat variable name or function name , lower-case separated _ (underscores). templates: whilst there no defined naming convention templates treat naming same function name. in these cases go lower-case underscore word separation....

java - Adding JScrollPane to JTable doesn't show up -

i'm pretty new javas swings, sorry if trivial. constructor, excluded unnecessary form items. (i tried running code short this, problem still appears) //this opens connection mysql server, doesn't create problems. bp = bazapodataka.getbaza(); //forming main frame.. jframe frame = new jframe(); { dimension d = toolkit.getdefaulttoolkit().getscreensize(); frame.setbounds(d.width/2 - sirina/2, d.height/2 - visina/2, sirina, visina); } frame.setdefaultcloseoperation(jframe.exit_on_close); frame.getcontentpane().setlayout(new borderlayout(0, 0)); //adding layered pane can place items inside form more 'freely' jlayeredpane layeredpane = new jlayeredpane(); frame.getcontentpane().add(layeredpane, borderlayout.center); //adding table jtable table = new jtable(); string[] rowdata = {"name:", "price:", "cathegory:", "sum:"}; defaulttablemodel model = new defaulttablemodel(rowdata, 0); jscrollpane skrol = new jscrollpane(...

mysql - deploying web app in tomcat7 -

i've deployed web app in tomcat7 , have start app, every time try start web app got error: fail - application @ context path /agileexpress not started and got on log, seem having problem sql may 15, 2015 4:54:55 pm org.apache.catalina.startup.catalina start info: server startup in 35067 ms may 15, 2015 4:55:39 pm org.apache.catalina.core.standardcontext startinternal severe: error listenerstart may 15, 2015 4:55:39 pm org.apache.catalina.core.standardcontext startinternal severe: context [/agileexpress] startup failed due previous errors may 15, 2015 4:55:39 pm org.apache.catalina.loader.webappclassloader clearreferencesjdbc severe: web application [/agileexpress] registered jdbc driver [com.mysql.jdbc.driver] failed unregister when web application stopped. prevent memory leak, jdbc driver has been forcibly unregistered. may 15, 2015 4:55:39 pm org.apache.catalina.loader.webappclassloader clearreferencesthreads severe: web application [/agileexpress] appears have star...

android - How to know the View Elements after loading a layout? -

i trying write code , after loading layout , want know view elements related layout textview, edittext , checkbox etc. mycode : mainactivity.java package com.example.myview; import android.os.bundle; import android.support.v4.app.fragment; import android.support.v4.app.fragmenttransaction; import android.support.v7.app.actionbaractivity; import android.util.log; import android.view.layoutinflater; import android.view.view; public class mainactivity extends actionbaractivity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); view view = layoutinflater.from(this).inflate(r.layout.demo_layout, null); // how know ui elements related layout // } } demo_layout.xml <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent...

wix - How to use a merge module in another merge module -

i creating wix installer project (myproduct.msi) should consume wix merge module (mergedesktop.msm) intern consumes wix merge module (mergecore.msm). i able generate myproduct.msi can consume mergecore.msm , able copy content mergecore.msm definition. though able generate myproduct.msi consumes mergedesktop.msm intern consumes mergecore.msm file, copying nothing. i have used dependency element in mergedesktop.msm include mergecore.msm module. <?xml version="1.0" encoding="utf-8"?> <wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> <module id="mergedesktop" language="1033" version="1.0.0.0"> <package id="22c37444-cc56-453c-8906-73413240ae40" manufacturer="microsoft" installerversion="200" /> <dependency requiredid="mergecore" requiredlanguage="1033"/> <directory id="targetdir" name="sourc...

html - Place an absolute element in bottom of a container with overflow: auto -

i have logo should positioned in bottom of fixed container. works ok position: absolute; if add overflow-y: auto; fixed container , add content doesn't fit viewport height, logo stick bottom of viewport, not bottom of fixed container, overlapping content. <div class="foo"> <div class="content"></div> <div class="logo-in-the-bottom">logo</div> </div> .foo { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: gray; overflow-y: auto; } .content { height: 1000px; } .logo-in-the-bottom { position: absolute; bottom: 10px; left: 0; color: white } http://jsfiddle.net/1aoah1r5/ how stick bottom of fixed container no matter content height? try this: depending on content: .foo { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: gray; overflow-y: auto; } .content { min-height: 100%; ...

sql - Postgres array query -

(the following highly simplified description of problem. company policy not allow me describe actual scenario in detail.) the db tables involved are: products: id name --------- 1 ferrari 2 lamborghini 3 volvo categories: id name ---------- 10 sports cars 20 safe cars 30 red cars products_categories productid categoryid ----------------------- 1 10 1 30 2 10 3 20 locations: id name ------------ 100 sports car store 200 safe car store 300 red car store 400 cars r locations_categories: locationid categoryid ------------------------ 100 10 200 20 300 30 400 10 400 20 400 30 note locations not directly connected products, categories. customer should able see list of locations can provide product categories products want buy belong to. so, example: a customer wants buy ferrari. available stores in categories 10 or 30. gi...

iterator - Calculating the square numbers within a range (python) -

i want able execute following code: for in squares(5, 50): print(i) now easy implement using loop, want use iterator. so have defined following class: import math class squares(object): def __init__(self, start, stop): self.start = start self.stop = stop def __iter__(self): return self def __next__(self): start = self.start stop = self.stop squareroot = math.sqrt(start) if self.start > self.stop: raise stopiteration if squareroot == math.ceil(squareroot): start += 1 but @ moment returning none infinite amount of times. means none must because stopiteration being executed when shouldn't. think if squareroot == math.ceil(squareroot): condition correct because tested separately, can't figure out change output want. appreciated. edit: code such as: for in squares(4, 16): print(i) i expect output be: 4 9 16 try creating generator fun...

rdd - How to load data from saved file with Spark -

spark provide method saveastextfile can store rdd[t] disk or hdfs easily. t arbitrary serializable class. i want reverse operation. wonder whether there loadfromtextfile can load file rdd[t] ? let me make clear: class extends serializable { ... } val path:string = "hdfs..." val d1:rdd[a] = create_a d1.saveastextfile(path) val d2:rdd[a] = a_load_function(path) // function want //d2 should same d1 try use d1.saveasobjectfile(path) store , val d2 = sc.objectfile[a](path) load. i think cannot saveastextfile , read out rdd[a] without transformation rdd[string]

javascript - AngularJs select add option -

i work angularjs , select options collection. if added in html option tags works good. if try added item angular not working. my code: <div ng-controller="statisticstablecontroller"> <select ng-model="publishersdata" ng-options="s s in publishersdata" chosen option="publishersdata"> </select> </div> and angularjs code: function statisticstablecontroller($scope, $http) { var publishersarray = []; $http.get('/api/getallitems').success(function(data) { angular.foreach(data, function(data) { publishersarray.push(data.name); }); }); this.publishersdata = publishersarray; //... } why not working? , how fix it? update after changes: function statisticstablecontroller($scope, $http) { var publishersarray = []; $http.get('/api/getallitems') .success(function (data) { angular.foreach(data, function (data) { ...

node.js - Enide Studio debug, always get "Nodeclipse/chromedevtools failed to connect to Standalone V8 VM" -

i'm on windows 7 64bit, followed instruction in link http://www.nodeclipse.org/updates/ set enide studio install latest nodejs, version=0.12.2 install nodeclipse cli , express via npm install -g command install jdk 8u45 64bit download enide studio 2014.17-u2 windows x64 as said in guide, that enough node.js, javascript , java development. then follow video http://www.nodeclipse.org/video , , create 1 simplest "node.js express project", when try right click app.js , debug node application, "nodeclipse/chromedevtools failed connect standalone v8 vm". if right click app.js , run it, there's no problem. can access via http://localhost:3000 is there configuration can do? thanks.

node.js - nodejs decrease v8 garbage collector memory usage -

i'm debugging nodejs application util module , while heapused value stays around 30-100mb, heaptotal value grows 1.4gb. here question similar behaviour i've read way how v8 garbage collector behaves, question how decrease amount of memory allocates (make less 1.4gb) if running on 512 mb device example you need control max memory size flags (all sizes taken in mb). the recommended amounts "low memory device" are : node --max-executable-size=96 --max-old-space-size=128 --max-semi-space-size=1 app.js for 32-bit and/or android and node --max-executable-size=192 --max-old-space-size=256 --max-semi-space-size=2 app.js for 64-bit non-android. these limit heap totals 225mb , 450mb respectively. doesn't include memory usage outside js. instance buffers allocated "c memory" , not in javascript heap. also should know closer heap limit more time wasted in gc. e.g. if @ 95% memory usage 90% of cpu used gc , 10% running actual code (n...

math - Should 0xABCD - 0x1234 set the carry bit? -

Image
i studying final when came across question here: after going through it, got answer of 0x9999 because when perform subtraction via 2's complement, there carry on msb, branch instruction send program loc1. professor says answer 0x9997, possible if carry bit not set. i've looked , seems carry bit should have been set here. missing or did professor make mistake?

Is there any way to detect network connection type using javascript? -

i know there way check if user connected 2g, 3g, 4g, or wifi using javascript. of knowledge mozilla provides network information api helps detect general connection type 'wifi', 'cellular' etc. it wrong approach expose network javascript. anyways better understanding please go through below link how check connection type (wifi/lan/wwan) using html5/javascript? and there 1 can of supports mozilla , info can visit below link https://developer.mozilla.org/en-us/docs/web/api/network_information_api

javascript - Highchart is not getting populated using external json data -

i trying reload data highcharts chart via json . have html file, when hard code categories , series in html highchart working, when trying load data using json not working. html file <!doctype html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>highcharts example</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script src="c:\users\global soft\desktop\highchart\js\highcharts.js" type="text/javascript"></script> <script src="http://code.highcharts.com/modules/exporting.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function() { var options = { chart: { ...

css3 - Draw a top bordered tip with CSS -

Image
i trying draw tip in css. i have "middle success" far, problem that, depending on div width, tip not in center position. what want: my code far: .logo { color: #000; font-size: 1.4em; text-align: center; padding-top: 1.5em; text-transform: uppercase; position: relative; } .line { height: 1px; overflow: hidden; background: #000; } .line.top, .line.bottom { width: 90%; } .line.top { margin: 0 auto 4px; } .line.bottom { margin: 4px auto 0; } .angle { position: absolute; top: 19px; left: 46%; // think problem here! } .angle .line.left, .angle .line.right { width: 20px; } .angle .line.left { -ms-transform: rotate(45deg); -webkit-transform: rotate(45deg); transform: rotate(45deg); margin: 7px; } .angle .line.right { -ms-transform: rotate(-45deg); -webkit-transform: rotate(-45deg); transform: rotate(-45deg); margin: -7px; } <div class=...