Posts

Showing posts from June, 2015

R-prog extraction of contents from xml -

i have used following code in r extract contents there error. point out mistake? fileurl="http://espn.go.com/nfl/team/_/name/bal/baltimore-ravens" doc=htmltreeparse(fileurl,useinternal=true) score=xpathsapply(doc,"//li[@class='score']",xmlvalue) error:unexpected']' in scores=xpathsapply(doc=doc,path="//li[@class='score']",fun=xmlvalue]" please help..

java - Why isn't my GUI displaying? -

i'm using intelij write file transfer program , i'm working on gui right using swing. i've made plenty of programs in swing, reason can't figure out why gui isn't showing when run program. compiles fine. public class stage { jpanel maincontainer = new jpanel(); jpanel window = new jpanel(); jbutton loadbutton = new jbutton(); jbutton savebutton = new jbutton(); jtextpane cmdout = new jtextpane(); jmenubar menubar = new jmenubar(); jmenu menu = new jmenu(); jmenuitem exitbutton = new jmenuitem("exit"); public void display(){ maincontainer.setvisible(true); maincontainer.add(window); maincontainer.add(menubar); menubar.add(menu); menu.add(exitbutton); window.setlayout(new gridbaglayout()); window.add(loadbutton); window.add(savebutton); window.add(cmdout); cmdout.settext("test"); window.setvisible(true); } } here main method in class. public static voi

Image distortion algorithms in JavaScript -

so i'm creating distortions for webapp. want achieve effects similiar photo booth app in mac. it's quite hard find material on web. of artciles (like http://www.splashnology.com/article/pixel-distortions-with-bilinear-filtration-in-html5-canvas/4739/ ) describe basics. now, example, want make spherize or twirl effect more smooth towards corners, can't find solution. help, ideas, resources? lot! well, if interested in simple effects waves, here read http://ru.wikipedia.org/wiki /Синусоида, it's ideas in 8th grade (google translation russian english). <!doctype html> <html> <head> <meta charset="utf-8"> <title></title> <script src="../js/common.js"></script> <link rel="stylesheet" href="style.css"> <script> addeventlistener('load', function() { var cnv = gid('q&

windows - Some main commands not found in MSYS2 after update-core -

issue some main commands not found in msys2 after update-core . environment windows 8.1 64bit msys2-x86_64-20150916 detail i introduced msys2 computer , performed update-core. however, after update, when type pacman or update-core , terminal says bash: pacman: command not found . rebooted msys2 , tried same process result same. re-installed msys2 , tried same process result same. i'd things right don't know how. any suggestion appreciated. thanks. update-core deprecated; functionality handled pacman; run pacman -syuu .

javascript - Modify React Child Component props after render -

here's simple example: copybutton = <somereactcomponent title="my button" /> this.clipboard = new clipboard('button#copy-button'); this.clipboard.on('success', () => { this.copybutton.props.title = "copied!"; }); render = () => { return ( ... { this.copybutton } ... ); } using clipboard.js , when button pressed, copy text clipboard. on successful copy, want change title of copy button reflect that. button component, keep reference to, has been rendered , this.copybutton.props.title doesn't work because components immutable. how then, go changing value of title on button? know have state property in parent component i'd rather avoid keep parent component complete stateless. reassign this.copybutton inside success callback (i tried no luck)? speaking more generally, how should parent components update children's props if @ all? using state way? note: i'm using es6 i

Perl value is not sticking -

i know missing simple here, can't figure out , google not working i trying use value $f not working. leave out of code. error saying $f requires specific package name sub capturefile() { $f = $file::find::name; if ($f = ~/txt$/) { $f=~ s:(.*)(\/reports\/.*):$2:; loadenvironmentproperties($f); } } sub loadenvironmentproperties() { print $f; } always use strict; use warnings; ! you try specify $f argument loadenvironmentproperties($f); ^^ to function declared has no parameters sub loadenvironmentproperties() ^^ and never read arguments in loadenvironmentproperties . want: sub loadenvironmentproperties { ($f) = @_; print $f; }

jquery - Error with PDF in JqueryUI Datatables Buttons extension Chrome -

i'm having issue buttons extension jqueryui datatables. pdf button not work when generating large pdf in chrome, works fine smaller pdf. large pdf generated fine in both safari, , firefox. there memory limit on chrome, or anther known issue causing behavior? table 600ish lines long, 12 pages, approximation of size. doesn't seem ludicrously large me. thank you.

java - How to add resources into jar file -

i need add exel file jar it's portable. know answer using getclass().getresource.... don't have clue on how go using code. i have exel file in src folder class files, works in netbeans not when open jar file on pc. filenotfound exception here code have used: public class windagelogic { //.... public void getvalues() throws exception { file exel=new file("src/calculator/table1.xls"); workbook w1; //reads file //reads file w1 = workbook.getworkbook(exel); can give me code implement allow me access file jar application, i've spent weekend looking stuff on internet don't understand how can use these getresource techniques. thanks alot if excel file resource, can't use file manipulate rather resources, , believe read-only -- sure want do? instead load command line string tells program start looking file, or create property file tells first look. edit 1 if using jexcel can call workbook.getworkbook(jav

linux - difference between cgroups and namespaces -

i started learning docker , seems of heavy lifting done linux kernel, using namespaces , cgroups. a few things finding confusing : what difference between namespace , cgroup ? different uses cases address ? what has docker implemented on top these gain popularity ? i know internals of these features , how implemented. the proper links 2 notions have been fixed in pr 14307 : under hood, docker built on following components: the cgroups , namespaces capabilities of linux kernel with: cgroup : control groups provide mechanism aggregating/partitioning sets of tasks, , future children, hierarchical groups specialized behaviour. namespace : wraps global system resource in abstraction makes appear processes within namespace have own isolated instance of global resource. in short: cgroups = limits how can use; namespaces = limits can see (and therefore use) see more @ " anatomy of container: namespaces, cgroups & filesystem magic &

Netlogo making a list out of itself for a given length -

i want create list out of own values given length. for example, given list [0 1] , desired list length of 7, output [0 1 0 1 0 1 0] . length defined population , , defined slider. declared variable x should iterate through list. if length of list shorter value of population should set 0 again. i tried loop command runs infinitely: let x 0 loop[ if length exp-dif-li <= population[ ifelse x < length exp-dif-li[ set x 0] [ set exp-dif-li lput item x exp-dif-li exp-dif-li set x x + 1] ] ] ] mod , n-values friends here: to-report continue-list [ lst n ] report n-values n [ item (? mod length lst) lst ] end example uses: observer> show continue-list [0 1] 7 observer: [0 1 0 1 0 1 0] observer> show continue-list [0 1] 1 observer: [0] observer> show continue-list [0 1 2 3 4] 22 observer: [0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1] edit: realized talk why works! n-values n [ ... ] creates list of length

Azure AD Tenant = Organizational Account? -

i reading through various articles on how headless app can authenticate azure. i'm little confused terminologies. in sample code , says needs azure ad tenant account. my understanding azure account can microsoft account or organizational account. azure ad tenant either of 2 or organizational account? can show me clarified in documentation? from definition here: https://msdn.microsoft.com/en-us/library/azure/jj573650.aspx (see section what azure tenant ): with identity platform provided microsoft azure, a tenant dedicated instance of azure active directory (azure ad) organization receives , owns when signs microsoft cloud service such azure or office 365 . an azure ad have 1 or more users. these users native azure ad, sourced other azure ads (or local ad) or microsoft accounts. afaik, of today if user account not microsoft account means organization account.

mysql - Optimizing a SQL Query with Complex Filtering -

please note question below mysql . imagine table called cars following structure ( we can ignore lack of proper key constraints, etc. not relevant question ): create table cars ( id integer, maker_id integer, status_id integer, notes varchar(100) ); now imagine loading test data this: insert cars (id, maker_id, status_id, notes) values (1, 1001, 0, 'test1'), (2, 1001, 0, 'test2'), (3, 1001, 0, 'test3'), (4, 1002, 0, 'test4'), (5, 1002, 0, 'test5'), (6, 1002, 1, 'test6'), (7, 1002, 1, 'test7'), (8, 1002, 2, 'test8'), (9, 1003, 3, 'test9'), (10, 1003, 3, 'test10'), (11, 1003, 4, 'test11'), (12, 1003, 4, 'test12'), (13, 1003, 5, 'test13'), (14, 1003, 5, 'test14') there 14 records, 3 distinct values in maker_id (1001, 1002, 1003), , 6 distinct values in status_id (0,1,2,3,4,5). now, imagine taking distinct pairs of ( maker_id , status_id ). select

linux - Bash, what is the missing argument for variable declaration? -

this question has answer here: command not found error in bash variable assignment 4 answers i wrote couple of bash commands in text document. the first line tries assign bash-command-output-string variable test . the second line echo whatever in variable test . for reason error saying "test: missing argument after..." echo echo echo ////////////////////////////////////////////////////////////// echo echo testing if can return head branch ref #ref = cat ~/desktop/hookerrepo/.git/head | awk '{ print $2 }' test = "$(cat ~/desktop/hookerrepo/.git/head | awk '{ print $2 }')" echo $test #for c in $(test); echo $c; done echo echo ////////////////////////////////////////////////////////////// what missing? an assignment statement cannot include spaces before or after = . following have distinct meanings: a=b : assig

Rails 4 - Redirect path -

i'm trying make app in rails 4. i'm trying follow tutorial setup devise omniauth. i have user model , profile model. associations are: user.rb has_one :profile profile.rb belongs_to :user in omniauth callbacks controller, have: def self.provides_callback_for(provider) class_eval %q{ def #{provider} @user = user.find_for_oauth(env["omniauth.auth"], current_user) if @user.persisted? sign_in_and_redirect @user, event: :authentication set_flash_message(:notice, :success, kind: "#{provider}".capitalize) if is_navigational_format? else session["devise.#{provider}_data"] = env["omniauth.auth"] redirect_to new_user_registration_url end end } end in omniauth callbacks controller, currently, when user authenticates, redirect goes root path (i'm not sure why). think has current redirect @user, not having show page (which doesnt

kubernetes - Cluster-insight on Google Container Engine -

hi trying enable graph tab in kubernetes ui on gke. there way enable on gke ? the instructions on cluster insight page (which linked to) explain how deploy graph service cluster , access interface using kubectl proxy , web browser.

SAS Macro quoting issues -

i trying perform operations on binary data saved macro variable. datastep below saves data macro variable without issues: data _null_; infile datalines truncover ; attrib x length=$300 informat=$300. format=$300.; input x $300.; put x=; call symput ('str',cats(x)); datalines4; ‰png > ihdr ) ) ëŠz srgb ®Î=é gama ±^üa phys ;à ;ÃÇo¨d zidat8oåŒ[ À½ÿ¥Ó¼”Ö5dˆ_v@aw|+¸anŠ‡;6<ÞórÆÒÈefõu/'“#f™Ù÷&É|&t"<ß}4¯à6†Ë-Œ_È(%<É'™ènß%)˜Î{- iend®b`‚ ;;;; run; when try , use contents of macro variable in way, combinations of reserved characters making impossible work with. following reserved characters in value, , not matched: &%'"() i've tried every combination of macro quoting functions can think of , can't value print using %put() : %put %nrbquote(&str); results in: symbolgen: macro variable str resolves ‰png > ihdr ) ) ëŠz srgb ®Î=é gama ±^üa phys

Accessing a Flexible array Member in C -

i have struct looks this: typedef struct testcase testcase; typedef struct testcase { char * username; testcase *c[]; // flexible array member } testcase; and in file i'm trying set flexible array member null, doesn't seem work (i'm not allowed change how it's been defined) void readin(file * file, testcase ** t) { *t = malloc(sizeof(testcase)); (*t)->c = null; //gives error } i'm using double pointers because that's what's been specified me (this isn't entire code, snipit). (as there code later free variables allocated). any appreciated. take @ line: (*t)->c = null; this tries assign null array, isn't allowed. writing this: int array[137]; array = null; // not allowed when have flexible array member, intent when malloc memory object, overallocate memory need make room array elements. example, code *t = malloc(sizeof(testcase) + numarrayelems * sizeof(testcase*)); will allocate new t

Press Home button in Appium Java client -

i new appium. might silly question. wanted know how click home button using java bindings. thanks in advance well if want send app in background use driver.closeapp() function , relaunch driver.openapp() you can use press keycode method below codes home menu button - 82 button - 4 recent app - 187

php - Chat Application Database Query and Design -

this database scheme query below. this scenario confuses me. when login user_id = 1 , create conversation , receiver user_id = 4 query below works.. because query retrieve conversations based on sender. when log in user_id = 4 can't see conversation because i'm receiver , don't want create conversation i'm sender , receiver user_id = 1 because conversation started user_id = 1. can me query? change inner join include receiver well, so inner join conversations on (userprofiles.user_id = userprofiles.receiver_id or userprofiles.user_id = sender_id)

css - OpenSans Semibold Normal displayed as Italic -

Image
i have problem open sans font imported google web fonts. opensans semibold (600) normal on webpages rendered in italic. tried force font-style normal etc. same results. after changing font weight 500 or 800 it's normal style. @font-face { font-family: 'open sans'; font-style: normal; font-weight: 600; src: local('open sans semibold'), local('opensans-semibold'), url(http://fonts.gstatic.com/s/opensans/v13/mtp_ysujh_bn48vbg8snsuy5mlvxtdnkpsmpkkrdxp4.woff) format('woff'); } jsfiddle even google fonts shows in italic. had same issue, conflict open sans had installed locally. try disable locally installed fonts first.

multithreading - PHP react parallel requests -

i have app communicate through websocket server. using ratchet , works perfect. next thing want implement make requests other server , push responses through websocket clients. question how make parallel requests react. let have 5 endpoints response want parallel (thread). want call each endpoint every .2s example , send response websocket server clients. example (this demonstration code): $server->loop->addperiodictimer(.2, function ($timer) { curl('endpoint1'); }); $server->loop->addperiodictimer(.2, function ($timer) { curl('endpoint2'); }); $server->loop->addperiodictimer(.2, function ($timer) { curl('endpoint3'); }); but timer not work way. possible achive react? im not showing websocket code because communication between clients works nice. to start. " react (ratchet) " - operate in 1 thread mode (feature libevent). is, block process - bad idea... curl request - stop work socket server until rec

javascript - Mapbox single marker change color onclick -

iam wondering how change marker color using onclick function. im trying achieve in way: wrong...can me?? var testmarker = l.marker([74.18, -15.56], { icon: l.mapbox.marker.icon({ 'marker-color': '#9c89cc' }) }) .bindpopup(testmarker) .addto(map); testmarker.on('click', function(e) { l.marker(setcolor('red')); use seticon method of l.marker in click handler set new icon: changes marker icon. http://leafletjs.com/reference.html#marker-seticon testmarker.on('click', function() { this.seticon( l.mapbox.marker.icon({ 'marker-color': 'red' }) ); });

css media query resolution dpi versus width versus device-width -

when comes using media queries, see max-width , max-device-width used lot target "small screen" devices, or smartphones, why not use media query resolution? for example, @media screen , (min-resolution: 230dpi) allows me write css target smartphones, such galaxy s glide sgh i927r, has 480 x 800 pixels, 4 inches (~233 ppi pixel density) conversely, have use @media screen , (max-device-width: 480px) , (orientation: portrait) plus @media screen , (max-device-width: 800px) , (orientation: landscape) . it seems min-resolution save me time. have read several articles , blogs, not see advocating resolution. there must obvious point missing - not professional web designer - "wrong" approach of using resolution? makes width or device-width better target "small screens." my favorite site far on width vs device-width has been: http://www.javascriptkit.com/dhtmltutors/cssmediaqueries.shtml maybe reason had use max-device-width of 800px, seemed &quo

java - Connecting Array Index with Linked List -

i trying implement bucket sort in java without using collections framework, on own. have problem in implementing it. i wanted store list of elements in particular array index. for ex: arr[0]={1,2,3,4}; //here array index 0 storing 4 values. so chose have linked list store values , map array index linked list. but not aware of how map array index linked list. for ex: arr[0]->linkedlist1 arr[2]->linkedlist2 // ... , on please suggest how implement it. in java, arrays or collections collection of objects of same type. so, requirement, need array of lists. list[] arrayoflists = {}; this creates array each member list (you can create array of linkedlist if like). now, create linkedlist , assign index 0 of array. linkedlist list1 = new linkedlist(); arrayoflists[0] = list1; hope helps.

python - Selecting distinct values from a column in Peewee -

i looking select values 1 column distinct using peewee. for example if had table organization year company_1 2000 company_1 2001 company_2 2000 .... to return unique values in organization column [i.e. company_1 , company_2 ] i had assumed possible using distinct option documented http://docs.peewee-orm.com/en/latest/peewee/api.html#selectquery.distinct my current code: organizations_returned = organization_db.select().distinct(organization_db.organization_column).execute() item in organizations_returned: print (item.organization_column) does not result in distinct rows returned (it results in e.g. company_1 twice). the other option tried: organization_db.select().distinct([organization_db.organization_column]).execute() included [ ] within disctinct option, although appearing more consistent documentation, resulted in error peewee.operationalerror: near "on": syntax error : am correct in

regression - using SVM to predict traffic volume -

i used svm predict traffic volume data , using tool libsvm . input data in moment t-2, t-1 , t; output data in moment t+1. param below: param.svm_type = svm_parameter.nu_svr; param.kernel_type = svm_parameter.rbf; param.cache_size = 100; param.eps = 0.00001; param.c = 1.9; param.nu = 0.5; but predict value a constant number , don't know problem. thanks.

swing - Java: mouseDragged and moving around in a graphical interface -

Image
newbie programmer here. i'm making program renders user-inputted equations in cartesian coordinate system. @ moment i'm having issues letting user move view around freely in coordinate. mousedragged user can drag view around bit, once user releases mouse , tries move view again origin snaps current position of mouse cursor. best way let user move around freely? in advance! here's code drawing area. import java.awt.color; import java.awt.graphics; import java.awt.graphics2d; import java.awt.point; import java.awt.rectangle; import java.awt.event.mouseevent; import java.awt.event.mouselistener; import java.awt.event.mousemotionlistener; import java.awt.geom.line2d; import java.awt.geom.point2d; import javax.swing.jpanel; public class drawingarea extends jpanel implements mousemotionlistener { private final int x_panel = 350; // width of panel private final int y_panel = 400; // height of panel private int div_x; // width of 1 square private int div_y; // height of

javascript - How to change select option with jquery? -

so have table class "vuln-table" , first column full of checkboxes, while last column options i've figured out how alert box rows contain checked checkbox; however, need figure out how change value of selected option here's js file: function change_severity(severity) { $(".vuln-table tr").each(function() { $(this).find('td input:checked').each(function() { // row has checkbox selected // row needs have select value changed }); }); } here's html contains options <tr role="row" class="even"> <td class="sorting_1"><input type="checkbox" name="asfasdfd" id="vuln_checked_" value="asdfsdfa"></td> <td>something</td> <td><select class="form-control" name="test" id="kjhtkjehtehr"><option value="severe">severe</option> <optio

Firefox keeps input value on browser close and reopen -

i using input field store destination value: <input type="text" id="dest_location" placeholder="enter destination" autocomplete="off"> however want clear value on browser reload. after reading found simple way add autocomplete="off" input above. this works noticed unusual in firefox browser. when enter value input field, close browser , reopen value still saved. after clicking page reload button value cleared. i wanted know why occurring in firefox browser? tried same open , close browser method on chrome, ie , opera , value cleared before clicking on page reload button. assistance. you must have enabled saving current tab instance in firefox option "when firefox starts": "show windows , tabs last time". i've tried similar option on google chrome says "on startup":"continue left off". but chrome is, stores urls next time reopen browser whereas fi

javascript - How to auto-adjust size of other input fields while typing into input field #1? -

i working html/javascript/css page looks this, input field: (base10) [100 ] output field #1 (base08) [144 ] output field #2 (base19) [55 ] output field #3 (base36) [2s ] and trying achieve this, input field: (base10) [100 ] output field #1 (base08) [144] output field #2 (base19) [55] output field #3 (base36) [2s] with real-time adjustment "output" field sizes. brackets denote field sizes visible on screen. how code that? all 4 of lines use html input tag unique id's. in case typed "100" base10 field arbitrarily long in size, , in real time javascript updates multiple output fields number 100 written in other counting systems, , works fine, no problem there. the problem output fields pre-determined/hard-coded size, whereas contents different sizes. need size attribute of fields called #1, #2, , #3 dynamically updated in real time too, field snugly

assembly - CreateWindowEx in masm x64 -

i'm coding in assembly under windows 10 using x64 masm, , enjoying it! haven't touched assembly in 25 years - uni days. learning , doing basic stuff, , getting speed rather quickly. i have gui front-end, window, , down track have menu , child windows... the 2 traditional ways (i guess) achieve are: in assembly use createwindowex , related windows api functions, or build front-end visual c++ code masm other areas program now since i'm programming purely fun, , want stick assembly language only, first option 1 me. but read on 1 assembly forums it's not recommended build/call windows via assembly. i'm not sure why? can imagine because it's painful when compared building front-end via high level language such vc++. questions : any reason not build gui windows front-end via assembly/createwindowex...? would building windows via directx crazy idea? any other techniques build front-end using assembly only? i haven't done programmin

javascript - jsonp callback function not recognized -

Image
i've ajax called like $.ajax({ url: geturl, type: 'get', crossdomain: true, data: { url: url, token: token }, datatype: 'jsonp', jsonpcallback: "getjsonp", success: function () { /* */ }, error: function() { console.log('failed!'); } }); and jsonpcallback function function getjsonp(data) { console.log(data.content); } on dev console, see it's returned properly however still uncaught referenceerror: getjsonp not defined . how should fix this?

html - bootstrap jumbotron full width image -

i have cover on pages.. using jumbotron have full width image. leaves space on right , left side. added margin-left blank space on left gone right 1 still there. when resize browser there large space on right side. <div id="cover-success" class="jumbotron"> <div class="container"> <div class="overlay"> <div class="text-center"> <h1>success stories</h1> <h2>here of many resolved complaints.</h2> </div> </div> </div> </div> css used: #cover-success.jumbotron { background-size: cover; background-image: url('images/cover-success-stories.jpg'); position:absolute; width:100%; margin-top: -14px; margin-left: -70px; margin-right:-50px; height: 270px; } try padding too #cover-success.jumbotron { background-size: cover; background-image: url('images/cover-succes

python - malformed header from script index.py Bad header -

i want run python code in apache2(ubuntu 14.04) server. have followed these steps , getting error: step 1: configuration 1: have created directory , file under /var/www/cgi-bin configuration 2 : have edited /etc/apache2/sites-available/000-default.conf alias /cgi-bin /var/www/cgi-bin <directory "/var/www/cgi-bin"> options indexes followsymlinks execcgi addhandler cgi-script .cgi .py allow </directory> <directory /var/www/cgi-bin> options </directory> step 2: and python script is: index.py #!/usr/bin/env python import cgi; import cgitb;cgitb.enable() print "content-type: text/plain\n" print "<b>hello python</b>" step 3: when ran through chrome browser using: url : http://localhost/cgi-bin/index.py step 4: i getting error in error-log malformed header script 'index.py': bad header: hello python you should end header \r\n, must print out yet \r\n signal body coming. (i

javascript - Input PHP content into a CSS Selector Using Ajax/jQuery -

i'm creating script has needle points various degrees , needs change dynamically. number of degrees needs move located in degrees.php (in page number) trying grab contents of degrees.php , input css selector move needle right direction. what have far, below jquery grabs content wind.php has number (139) example , loads div id #windraw. i've got setting interval keep grabbing content page , updating css on fly content changes. loading div id tag and.... part i'm stuck on, getting content #windraw css selector "rotate" ( https://github.com/jcubic/jquery.rotate ) jquery: <script> $(document).ready(function() { clearinterval(refreshid); $("#windraw").load("../raw/wind.php"); }); $(document).ready(function() { refreshid = setinterval(function() { $("#windraw").load("../raw/wind.php"); $('#winddirneedle').css('rotate', $"#windraw"); }, 5000); })

javascript - How To Include a google apps script in a html page,that has uploading functionality on google Drive -

i want collect files users (like resume) & store on google drive. working file google apps script below.i want add form html page. provided google form url https://script.google.com/macros/s/akfycbx8w-um_piwx8a1s_3r2crsyhqqylf6tyyjoquuhdft5jqbfp0/exec want add in shouttoday.com site's page. tried include js script,or iframe not working. there files --- server.gs function doget(e) { return htmlservice.createhtmloutputfromfile('form.html'); } function uploadfiles(form) { try { var dropbox = "student files"; var folder, folders = driveapp.getfoldersbyname(dropbox); if (folders.hasnext()) { folder = folders.next(); } else { folder = driveapp.createfolder(dropbox); } var blob = form.myfile; var file = folder.createfile(blob); file.setdescription("uploaded " + form.myname); return "file uploaded " + file.geturl(); } catch (error) { return error.tostring();

jquery - Bootstrap 3 sticky footer reval z-index issue -

Image
hello community [solved] sake of readability below provided steps i'm trying achieve result (see following demo , scroll bottom of page) http://iainandrew.github.io/footer-reveal/ you'll see footer reveal unveil gets uncovered below last section this source of useful script https://github.com/iainandrew/footer-reveal unfortunately i've tried find solution make working in bootstrap 3 basic page (header, main, footer), looks there need of trick make z-index work properly. i've tried hard find it, i'm in loop i'm surely blind see :-) if stand in front of me :-) this test page as can see, footer on top of content despite z-index value -101. can kindly make work? thank you [solution] main issue caused absence of background in main , missing container i've added 1 div i've called wrapper the wrapper div starts right after body tag , closes right before footer i gave wrapper solid white #fff background this allows nice sc

android - The cut/copy/selectall bar dissapears when click on SELECT ALL button -

i have multi lines edittext: <edittext android:id="@+id/et1" android:imeoptions="actiondone" android:layout_width="300sp" android:layout_height="90sp" android:layout_margintop="5dp" android:layout_marginleft="5dp" android:layout_marginbottom="5dp" android:background="@drawable/edittext_bg_white" android:ems="10" android:inputtype="textmultiline" android:lines="8" android:minlines="6" android:textsize="18sp" android:layout_gravity="left" android:gravity="top|left" /> i add text of 4 lines inside edittext. i double click on text , cut/copy/selectall bar shows. i click on select icon in cut/copy/sel

android namevaluepair alternate methods -

this question has answer here: namevaluepair deprecated openconnection 7 answers in andorid namevaluepair , basicnamevaluepair deprecated. have list<namevaluepair> pairs = new arraylist<namevaluepair>(1); pairs.add(new basicnamevaluepair("student",string1)); what alternative code? try using list of pair objects, code below this answer : list<pair<string, string>> params = new arraylist<>(); params.add(new pair<>("username", username)); params.add(new pair<>("password", password));

c - Comments(/*...*/) longer than one line -

i supposed count /*...*/ comments in file , wondering if code right or missing out? my code void commentslongerthanoneline(file* inputstream, file* outputstream) { int count = 0, c, state = 1; while ((c = fgetc(inputstream) != eof)) { switch (state) { case 1: switch (c) { case '/': state = 2; break; } break; case 2: switch (c) { case '/': state = 3; break; case '*': state = 4; break; default: state = 1; } break; case 3: switch (c) { case '\n': state = 1; break; default: state = 4; count++; } break; case 4:switch (c) { case'*': if (c == '\n') count++; break; default: state = 4; if (c == '\n') count++; } } } fprintf(outputstream, "c

java - SharedPreferences is not changing -

i have activity shows simple 2 textviews, , text string array located in class. trying load first string in array when loading, , change next time activity loading change value in textview string after string showed first on textview, , on. change value of sharedprefrences still shows me first string. problem? change value of index of string array, still shows me first string. in advanced. public class dailymessage extends appcompatactivity { public sharedpreferences startexplepref; string[] descs; string[] titles; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_daily_message); toolbar toolbar = (toolbar) findviewbyid(r.id.toolbar); setsupportactionbar(toolbar); string currentdatetimestring = dateformat.getdatetimeinstance().format(new date()); startexplepref = preferencemanager.getdefaultsharedpreferences(this); boolean isfirstrun = startexplepref.getboolean(&qu

backbone.js - call route inside of a view in Backbone -

i know there great deal of tutorials/information orgaising application using backbone.js out there. creating gradually 1 aid of tutorials. seem fail understanding concept of routers. well, aware routers starting point(and tells state of app) , it's better avoid putting more logic there. i have 1 router. app firstly load header, footer, , main part of page. in main part, first, should login user. load login page, this: var approuter = backbone.router.extend({ initialize : function() { var headerview = new headerview({el:$('#header')}); headerview.render; var footerview = new footerview({el:$('#footer')}); footerview.render; var loginview = new loginview({el:$('#login')}); loginview.render; }, routes : { "inbox" : "inbox", "sentbox : "sentbox" }, inbox : function() {

angularjs - How would i create a promise function in this situation with javascript -

im building app using angularjs , using mediafire javascript sdk tasks. now i'm in situation when upload happens need create folder, function returns 'folderkey'. keep code clean in controller use .then on service functions continue through process of uploading new file. i have done fair bit if research still left baffled how it. perhaps example in situation me understand needs done. currently run function service create folder. mediafireservice.createfolder('testfolder'); i have mediafireservice.createfolder('testfolder'); .then(function(folderkey){ //upload file folder }); here factory functions. function createfolder(foldername){ var options = { foldername: foldername }; login(function(){ app.api('folder/create', options, function(data) { console.log(data.response.folderkey); return data.response.folderkey; }); }); } function login(callback){ app.lo

raspberry pi - python read file to turn on LED -

i'm trying python script read contents of text file , if it's 21 turn on led if it's 20 turn off. script prints out contents of text file on screen. the contents print out works ok led not turn on. import wiringpi2 import time wiringpi2.wiringpisetupgpio() wiringpi2.pinmode(17,1) while 1: fh=open("test1.txt","r") print fh.read() line = fh.read() fh.close() if line == "21": wiringpi2.digitalwrite(17,1) elif line == "20": wiringpi2.digitalwrite(17,0) time.sleep(2) print fh.read() reads entire contents of file, leaving file cursor @ end of file, when line = fh.read() there's nothing left read. change this: fh=open("test1.txt","r") print fh.read() line = fh.read() fh.close() to this: fh=open("test1.txt","r") line = fh.read() print line fh.close() i can't test code, since don't have raspberry pi, code ensur

android - Unable to start Activity component info -

hello guys second time facing problem in last 2 days. guess there place in code in going horribly wrong. anyways trying here invoke method in class display particular text file in activity class. mainactivity is: package com.example.testflashfile; public class mainactivity extends activity{ button nextbutton; button playbutton; button backbutton; readtext readtext=new readtext(this); context contextobject; gesturedetector gesturedetector; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); requestwindowfeature(window.feature_no_title); setrequestedorientation(activityinfo.screen_orientation_sensor); setcontentview(r.layout.activity_main); textview hellotxt = (textview)findviewbyid(r.id.displaytext); hellotxt.settext(readtext.readtxt()); gesturedetector = new gesturedetector(this.getapplicationcontext(),new mygesturedetector()); vie

scala - Reference compound primary key -

i'm new slick , first attempt of creating application it. i have case class user(userid: uuid, firstname: string, lastname: string) . users can log in. case class logininfo(providerid: string, providerkey: string) comes in (i'm using silhouette authentication). i'd associate every user logininfo using slick table : class userswithlogininfos(tag:tag) extends table[(primarykey, uuid)](tag, "users_with_login_infos"){ def logininfoid = tablequery[logininfos].shaped.value.logininfoid def userid = column[uuid]("user_id") def * = (logininfoid, userid) <>(userwithlogininfo.tupled, userwithlogininfo.unapply) } this corresponding case class userwithlogininfo(logininfoid: primarykey, userid: uuid) . my tables user s , logininfo s straightforward: class logininfos(tag: tag) extends table[logininfo](tag, "login_infos") { // primary key of table compound: consists of provider's id , key def logininfoid = primarykey(

c# - Handle Event in Notification Library -

i'm trying application features https://toastspopuphelpballoon.codeplex.com/ library. i did fine simple toast w/o event handling, cant manage work of sample click , close events as sample i'm trying simple demo documentation says https://toastspopuphelpballoon.codeplex.com/documentation var toast = new toastpopup( "my title", "this main content.", "click hyperlink", notificationtype.information); toast.hyperlinkobjectforraisedevent = new object(); toast.hyperlinkclicked += this.toasthyperlinkclicked; toast.closedbyuser += this.toastclosedbyuser; toast.show(); and need use hyperlinkclicked event stuff... i cant figure out how use event i trying toast.hyperlinkclicked += new eventhandler(myevent_method); but vs keep throwing me errors, cant figure out how handle events using lib, need it. hope help, thank you the problem metho

datatable - jquery is not working when show table from ajax request page -

i using datatable plug-ins. when showing table ajax request page jquery function not working. $(document).ready(function() { $('#example').datatable(); }); you need call $('#example').datatable(); after ajax call finished (on success function example).

java - Showing progress image between httpGet and response in Android -

i use code below xml file web service : public string getxmlfromurl(string url) { string xml = null; try { // defaulthttpclient defaulthttpclient httpclient = new defaulthttpclient(); httpget httpget = new httpget(url); httpresponse httpresponse = httpclient.execute(httpget); httpentity httpentity = httpresponse.getentity(); xml = entityutils.tostring(httpentity,"utf-8"); } catch (unsupportedencodingexception e) { e.printstacktrace(); } catch (clientprotocolexception e) { e.printstacktrace(); } catch (ioexception e) { e.printstacktrace(); } // return xml return xml; } it takes 3-4 seconds web service response request. want display image in time between request , response. what best way so? any appreciated. use asynctask private class longoperation extends asynctask<string,