Posts

Showing posts from January, 2011

android - I want to use random colors for background with smooth transition effect in loop -

my problem instead of getting random colors @ background getting 2 colors animation effect background. , when restart app 2 color changes. goal there must random colors use background smooth animation of color change here's code public class mainactivity extends appcompatactivity { int color1,color2; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); final relativelayout targetview = (relativelayout) findviewbyid(r.id.new2); backgroundpainter backgroundpainter = new backgroundpainter(); color1=getrandcolor(); color2=getrandcolor(); backgroundpainter.animate(targetview, color1, color2); // int color1 = contextcompat.getcolor(this, r.color.coloraccent); //int color2 = contextcompat.getcolor(this, r.color.colorprimary); } public int getrandcolor(){ random rand = new random(); int r = rand.nexti...

node.js - How to create a category and apply it to an email -

is possible create category in outlook programmatically? i set hello world outlook-addin following ms's tutorials. , see how have access different properties of particular email. however, i'm stumped how work categories. i had pass in following soap request through office.context.mailbox.makeewsrequestasync() create category called "muktader" , apply email identified item id. <?xml version="1.0" encoding="utf-8"?> <soap:envelope xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:header> <t:requestserverversion version="exchange2013_sp1" /> </soap:header> <soap:body> <m:updateitem messagedisposition="saveonly" conflictre...

email - Caused by: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection? -

i getting following error when setting email service spring boot while trying connect round cube: caused by: javax.net.ssl.sslexception: unrecognized ssl message, plaintext connection? this leads me think roundcude not using ssl connection , should not use port 143. therefore try , use port 25, following error when do. caused by: javax.net.ssl.sslexception: unrecognized ssl message, plaintext connection? application.properties #email setup spring.mail.host = mail.email address.com spring.mail.username = email address spring.mail.password = password spring.mail.properties.mail.smtp.auth= true spring.mail.port = 25 or port 145 spring.mail.properties.mail.smtp.socketfactory.class= javax.net.ssl.sslsocketfactory spring.mail.properties.mail.smtp.socketfactory.fallback= false spring.mail.properties.mail.smtp.ssl.enable = true email service @component public class emailserviceimpl implements emailservice { @autowired private javamailsender javamailsender; @ove...

javascript - HighChart isn't plotting data correctly -

hi i'm using high chart , data coming through okay date not coming through on x axis, have parameter in data correctly formatted date , i'd use on x axis , popup, understand need use utc datetime order properly https://imgur.com/32tyzvh function buildandupdatetempchart() { $.getjson('server/getreadings.php', function (data) { $('#chartcontainer').highcharts('stockchart', { chart:{ events: { load: function(){ // set updating of chart each second //debugger; // var series = this.series[0]; // //console.log('data is: ' + data); // for(var = 0; < data.length - 1; i++){ // this.series[0].addpoint(data[i].temp, data[i].timestamp, true, true); // this.series[1].addpoint(data[i].atemp, data[i].timestamp, true, true); // } ...

postgresql - Optimize a single record select query in SQL -

i have simple sql query want optimize: select * users email = 'jon@gmail.com' i want 1 record matches user's email. is there can make query faster, aside adding index on email column? does adding "limit 1" make faster? what doing order email desc since "j" in alphabet? create index on column email . there no other way make fast. the exact syntax depends on database engine. if email unique (which common users table), make index unique too.

scala - how to provide CSV input to naive bayes classifier -

hi working on disease classification using naïve bayes model. have csv file have disease along symptoms. format of csv: symptom-1 symptom-2 symptom-3 disease how provide csv naïve bayes model , classify disease based on symptoms there standard code read csv , provide naïve bayes model perform classification using spark machine learning library this. code this modified example mllib doc import org.apache.spark.mllib.classification.{naivebayes, naivebayesmodel} import org.apache.spark.mllib.linalg.vectors import org.apache.spark.mllib.regression.labeledpoint val data = sc.textfile("your csv path") val parseddata = data.map { line => val parts = line.split(',') // labeled point labeledpoint(disease,(symptom 1,2,3)) // assuming of them numeric labeledpoint(parts(3).todouble,vectors.dense(parts(0).todouble,parts(1).todouble,parts(2).todouble)) } // split data training (60%) , test (40%). val splits = parseddata.randomsplit(array(0.6, 0.4), see...

java - Solving Recursion -

why return 9 plus actual value of answer. example, number 1234, answer 1 yet function returns 10. don't know why case, i'm pretty sure recursion have no idea. int fun(int n) { if (n <= 9) { return n; } else { return fun(n / 10) + (n % 10); } } as makoto stated, it's unclear why believe answer should 1. however, if recursion analysis following: fn(1234) = fn(123) + 4 = 10 fn(123) = fn(12) + 3 = 6 fn(12) = fn(1) + 2 = 3 fn(1) = 1 therefore, using simple substitution, get: fn(1234) = 1 + 2 + 3 + 4 = 10

c# - Implementing IActionFilter -

i'm building below filter: public class testflowfilter : filterattribute, iactionfilter { public void onactionexecuted(actionexecutedcontext filtercontext) { var profileid = int.parse(claimsprincipal.current.getclaimvalue("userid")); var appid = int.parse(filtercontext.routedata.values["id"].tostring()); if (profileid != 0 && appid != 0) { if (checkifvalid(profileid, appid)) { // redirect filtercontext.result = // url go } } } public void onactionexecuting(actionexecutingcontext filtercontext) { } } i need onactionexecuted , since iactionfilter interface have implement them both. ok leave onactionexecuting blank if don't need happen, or need call base version mvc runs? also in onactionexecuted method if checkifvalid true redirect user, if not don't anything. ok or need set property on filtercont...

android - Google place picker localization -

im using google place picker inside of app , if phone in language different english different responce naming of place pick. example if pick country macedonia , phone in english place selected macedonia (fyrom) if phone example in slovenian selected country makedonija (njrm) . there way places picked on english? google place picker support that? hi autocompletefilter google code: autocompletefilter typefilter = new autocompletefilter.builder() .setcountry("au") .build(); autocompletefragment.setfilter(typefilter);

Eclipse's Editor occasionally inserts a single space when I hit tab instead of the configured two spaces. How to prevent this? -

i have eclipse editor configured use 2 spaces instead of tabs. however, randomly adds single space when press tab. seems occur on existing lines e.g. if create new white line , hit tab, i'll never single space. spot i've seen tab consistently produce single space after closing bracket } . there way prevent these single space tabs?

firefox - Unity Web Player distorts objects -

i'm making 2d isometric game unity , made build unity web player , tested on browser (safari 9.0.3 on mac os el capitan 10.11.3) without major issues. it tested on windows 10 pro version 1511 computer (on internet explorer, version 11.212.10586.0, , firefox, version 45.0.2) , game unplayable. game objects distorted camera moves. please check video see bug in question: https://www.youtube.com/watch?v=8ng8b1agfsy i know question goes little off-topic wanted ask if else has seen bug, , if so, how solved. if want more information find out why happens, i'll post here. thank much! observation: no errors raised while testing game on unity editor. edit 1: windows computer hp probook 4530s (lh315ea) , mac macbook pro 2011. this has nothing unity. problem either graphic driver or onboard gpu card . searched see if there windows 10 driver available computer there weren't. not sure if there fix since there no official win10 driver can try here , instal...

javascript - AngularJS translate table -

i been working on sideproject learn angularjs. i´m trying fill table values , put 2 buttons translate or change data. i´ve got table data, when tried put buttons test translation, doesn´t have values. console doesn´t return errors. it´s first time angularjs maybe code have many errors. <!doctype html> <html lang="es" ng-app="modulo"> <head> <style> body { display: -webkit-flex; display: -ms-flexbox; display: flex; -webkit-flex-direction: column; -ms-flex-direction: column; flex-direction: column; } * { font-family: 'roboto', sans-serif; } section { padding: 1%; margin-left: auto; margin-right: auto; position: relative; } footer { position: fixed; left: 0px; ...

neo4j - cypher union group by sum -

i boost edges user depending of rules base on graph traversal. in mysql : select id, sum(weight) total ( select id, 10 weight user inner join userrel1 on user.id = userrel1.userid userrel1.attr1 in (1, 2) union select id, 5 weight user inner join userrel2 on user.id = userrel2.userid inner join userrel3 on user.id = userrel3.userid userrel2.attr2 = 'a' , userrel3.attr2 = 'z' union ... ) group id order total desc also, have writed query in gremlin 3 compare performance cypher. read in post group on union not possible yet, mean cypher less powerful gremlin ? have set weight properties on edges achieve ? thanks while true post- union processing still open feature request , not need use union perform use case. this query should equivalent of sql (ignoring incomplete part): with [] res optional match (user1:user), (userrel1:userrel1) user1.id = userrel1.userid , userrel1.attr1 in [1, 2] res,...

c++ - Function parameters: const matching declaration and definition -

this question has answer here: use of 'const' function parameters 30 answers found accident function declaration , definition may not agree on constness of parameters. i've found information (links following), question why const matching optional by-value parameters, const matching required reference parameters? consider following code available here . class myclass { int x; int y; int z; public: void dosomething(int z, int y, const int& x); int somethingelse(const int x); void another(int& x); void yetanother(const int& z); }; void myclass::dosomething(int z, const int y, const int& x) // const added on 2nd param { z = z; y = y; x = x; } int myclass::somethingelse(int x) // const removed param { x = x; x = 3; return x; } void myclass::another(int& x) // const not allowed on param { x = x; } void ...

responsive design - Media Queries for Microsoft Surface Pro 3 & Surface Pro 4 -

what's best way write media queries surface pro 3 & 4? in both landscape & portrait views? the best way not write media queries specific devices @ all, rather identify logical places in design fold elements in or break them out accordingly, account devices of width. see article more info: google developers—how choose breakpoints in practice, resolutions of 2 devices mentioned 2160x1440 (surface pro 3) , 2736x1824 (surface pro 4). so, instead of setting 4 breakpoints media queries, 1 logical approach design "greater 2000px", "between 1200px , 2000px", , "under 1200px"—the first rule handling both devices mentioned in landscape mode (also handling common desktop resolutions), second rule handling both devices in portrait mode (and many other common portable devices), , last rule handling devices of sizes under 1200px. this 1 way tackle problem, i'd recommend research more common theories behind responsive design , breakpoin...

Error when creating a Deposit in Quickbooks via Quickbooks-ruby Gem -

i'm trying create deposit in quickbooks, here's code deposit = quickbooks::model::deposit.new deposit.total = amount line_item = quickbooks::model::depositlineitem.new line_item.amount = amount deposit.deposit_to_account_ref = {:value => 40, :name => "checking"} deposit.line_items = array.new deposit.line_items << line_item result = service.create(deposit) i have used similar code create payment , works until add line items the error i'm getting: system failure error: java.lang.indexoutofboundsexception: index: 0, size: 0" usually cause of error when you're trying insert object array doesn't exist. in code deposit.rb https://github.com/ruckus/quickbooks-ruby/blob/master/lib/quickbooks/model/deposit.rb xml_accessor :line_items, :from => 'line', :as => [depositlineitem] what doing wrong here? help figured out. line item requires depositdetailitem spcified within it. unless that's specifi...

list - Trying to create a sorting algorithm from scratch in Python -

i'm taking course on programming (i'm complete beginner) , current assignment create python script sorts list of numbers in ascending order without using built-in functions " sorted ". the script started come laughably convoluted , inefficient, i'd try make work eventually. in other words, don't want copy else's script that's better. also, far can tell, script (if ever functioned) put things in new order wouldn't ascending. start, though, , i'll fix later. anyway, i've run in several problems current incarnation, , latest runs forever without printing anything. so here (with hashes explaining trying accomplish). if on , tell me why code not match explanations of each block supposed do, great! # numbers inputted, numlist = [1, 25, 5, 6, 17, 4] # final (hopefully sorted) list numsort = [] # index = 0 # run loop until run out of numbers while len(numlist) != 0: #...

jquery - Kendo Grid scroll to selected row -

i want able call function scrolls kendo grid selected row. i´ve tried methods none of them worked, for instance tried this: var grid = $("#grid").data("kendogrid"), content = $(".k-grid-content"); content.scrolltop(grid.select()); i´ve tried this: var gr = $("#grid").data("kendogrid"); var dataitem = gr.datasource.view()[gr.select().closest("tr").index()]; var material = dataitem.id; var row = grid.tbody.find(">tr:not(.k-grouping-row)").filter(function (i) { return (this.dataset.id == material); }); content.scrolltop(row); can point me in right direction please? :) --- edited --- for other reasons can not bind change event have able call function scrolls list selected row. tried answer @antonis provided me. var grid = $("#grid").data("kendogrid") grid.element.find(".k-grid-content").animate({ scrolltop: this.select().offset().top }, 400); when...

Using __getitem__ in operator overloading with python -

how can using __getitem__ ? class computers: def __init__(self, processor, ram, hard_drive): self.processor = processor self.ram = ram self.hard_drive = hard_drive what want able is c = computers('2.4 ghz','4 gb', '500gb') c['h'] return 500gb and c['p','r','h'] return ('2.4 ghz','4 gb', '500gb') yes, can. in both cases, __getitem__ method called 1 object. in first case, passed single string object, in second, passed tuple containing 3 strings. handle both cases: def __getitem__(self, item): attrmap = {'p': 'processor', 'r': 'ram', 'h': 'hard_drive'} if isinstance(item, str): return getattr(self, attrmap[item]) # assume sequence return tuple(getattr(self, attrmap[i]) in item) demo, including error handling: >>> c = computers('2.4 ghz','4 gb', '5...

.net - Injecting c++ dll into an exe using c# -

why c# code didn't inject dll exe program show me message box "injected!" ? .dll self coded c++ , , exe coded c++ , i'm trying inject c# code, how not working ? injector method [dllimport("kernel32")] public static extern intptr createremotethread( intptr hprocess, intptr lpthreadattributes, uint dwstacksize, uintptr lpstartaddress, // raw pointer remote process intptr lpparameter, uint dwcreationflags, out intptr lpthreadid ); [dllimport("kernel32.dll")] public static extern intptr openprocess( uint32 dwdesiredaccess, int32 binherithandle, int32 dwprocessid ); [dllimport("kernel32.dll")] public static extern int32 closehandle( intptr hobject ); [dllimport("kernel32.dll", setlasterror = true, exactspelling = true)] static extern bool virtualfreeex( intptr hprocess, intptr lpaddress, uintptr dwsize, uint dwfreetype ); [dllimport("kernel32.dll", charset = charse...

google cardboard - three.js -- fit a background image panorama -

i trying put image -- https://hdfreefoto.files.wordpress.com/2014/09/bright-milky-way-over-the-lake-at-night.jpg -- panorama background in three.js scene. i have following code: var sphere = new three.spheregeometry(200, 200, 32); sphere.applymatrix(new three.matrix4().makescale(-1, 1, 1)); var spherematerial = new three.meshbasicmaterial(); spherematerial.map = three.imageutils.loadtexture(<path above image>); var spheremesh = new three.mesh(sphere, spherematerial); scene.add(spheremesh); however when view through cardboard, , rotate 360 degrees, not see background rotate 360 degrees (but less that). how align? when view on laptop, can rotate image seems underfit screen dimensions is there guideline on how fit given background image three.js panorama? as far know, there no guideline, can test three.js examples: for equirectangular (you can drag on equirectangular images test them) for dualfisheye there's cubic map here , it's not usua...

java - Split a string based on pattern and merge it back -

i need split string based on pattern , again need merge on portion of string. for ex: below actual , expected strings. string actualstr="abc.def.ghi.jkl.mno"; string expectedstr="abc.mno"; when use below, can store in array , iterate on back. there anyway can done simple , efficient below. string[] splited = actualstr.split("[\\.\\.\\.\\.\\.\\s]+"); though can acess string based on index, there other way easily. please advise. i use replaceall in case string actualstr="abc.def.ghi.jkl.mno"; string str = actualstr.replaceall("\\..*\\.", "."); this replace first , last . . you use split string[] parts = actualstring.split("\\."); string str = parts[0]+"."+parts[parts.length-1]; // first , last word

html - Django form input weird behavior -

Image
i trying generate django form , seems pretty straightforward. <div class="form-group"> <label class="control-label col-sm-3 col-sm-3 col-xs-12" for="ad-interest"> ad interest </label> {{ form.ad_interest }} </div> it generated this: however when try wrapping html around input closing > of input tag generated on page. updated input tag: <div class="form-group"> <label class="control-label col-sm-3 col-sm-3 col-xs-12" for="ad-interest"> ad interest </label> <div class="col-md-6 col-sm-6 col-xs-12"> <input type="text" class="form-control col-md-7 col-xs-12" id="ad-interest" value="{{ form.ad_interest }}" > ...

java - how to set custom system variable for JVM to access properties file? -

i need read config.properties file location set variable -dapp.conf=/path/to/config.properties , set datasource when launch application. file should @ location within filesystem. how this? you can load properties file next: properties p = new properties(); try (reader reader = new filereader(system.getproperty("app.conf"))) { p.load(reader); } once loaded can use properties instance set datasource configuration.

javascript - several jquery datepicker widgets, add class to only one of them -

i have problem jquery datepicker. i have form several datepicker inputs , 1 of inputs need select whole week, while in other one, need work regular way; thing when add class (ui-weekpicker) widget first input user can select whole week,the class affects inputs in form, @ least hover event, meaning other inputs in onselect event show correct date... how can prevent happen? here code week-select datepicker $('#jump-picker').datepicker('destroy').val('').attr('placeholder','select week'); $('#jump-picker').datepicker( { yearrange: "-3:+3", showothermonths: true, selectothermonths: true, language :'es', options: { dateformat : 'dd/mm/yy', showanim : 'slidedown', }, onselect: function(datetext, inst) { var date = $(this).datepicker('getdate'); var startdate = new date(date.getfullyear(...

R shiny publish issue Unhandled Exception: HTTP 500: Internal Server Error -

i trying publish shiny app, works fine in local, when try publish it, got error: unhandled exception: http 500: internal server error what mean? don't know part goes wrong, hope can help. same here, looks having server issues... http 500 refers issue web server (service) , don't worry it's not problem on end. see: http://www.checkupdown.com/status/e500.html you can periodically try publish again until works. can check shiny google discussion group https://groups.google.com/forum/#!forum/shiny-discuss shinyapps.io

dism - cleanup-wim says successful in batch, but wim is still orphaned -

this first post here, have been using stackoverflow while of problems run in to. (tl;dr: batch script says unmounts wim file, when query wims, orphaned files still around until run /cleanup-wim manually.) i'm attempting make batch file modifying win pe image, having trouble last step. basically script first creating amd64 win pe architecture, mounting wim file, editing registry hive system file (and closing hive), copying files specific folders, supposed unmount wim, , create iso can burned disk or copied onto bootable usb. everything works, except unmount portion. to give insight of how first being done, run: c:\windows\system32\dism.exe /mount-wim /wimfile:c:\winpe_amd64\media\sources\boot.wim /index:1 /mountdir:c:\winpe_amd64\mount after registry changes, file creations, etc., later run: c:\windows\system32\dism.exe /unmount-wim /mountdir:c:\winpe_amd64\mount /commit c:\windows\system32\dism.exe /cleanup-wim with /unmount-wim, receive error: image file : ...

How do I attach to an existing docker-machine (Azure)? -

say use following command create new azure docker machine: docker-machine create -d azure \ --azure-subscription-id="$azure_subscription_id" \ --azure-size=standard_d14_v2 \ --azure-subscription-cert="${pwd}/certs/mycert.pem" \ --azure-location="east us" \ my-azure-node after this, can see my-azure-node when run docker-machine ls , ssh it, , run docker command want on it. but want co-worker able operate on same running machine. so, once pass mycert.pem (stupid question can share file her?). how initializes docker-machine such see same machine when doing docker-machine ls , without trying create new one. i want have single docker machine share, , simplicity of docker-machine.

python - Invalid literal for float -

i having hardest time figuring out why scientific notation string passing float() function not work: time = [] watbalr = [] area = np.empty([1,len(time)]) volume = np.empty([1,len(time)]) searchfile = open("c:\gradschool\research\caselton\hydrus2d3d\h3d2_profile1v3\balance.out", "r") line in searchfile: if "time" in line: time.append(re.sub("[^0-9.]", "", line)) elif "watbalr" in line: watbalr.append(re.sub("[^0-9.]", "", line)) elif "area" in line: area0 = re.sub("[^0-9.\+]", "", line) print repr(area0[:-10]) area0 = float(area0[:-10].replace("'", "")) area = numpy.append(area, area0) elif "volume" in line: volume0 = re.sub("[^0-9.\+]", "", line) volume0 = float(volume0[:-10].replace("'", "")) volume = num...

java - Byte[] sent across SocketChannel but not received -

i've been having trouble project requires bit of networking, data sent on socketchannel never received. able replicate issue simple localhost chatroom program (sorry if it's bit messy): public class main { private sender sender; private receiver receiver; public static void main(string[] args) { main foo = new main(); //the ports switched in other running version of foo.receiver = new receiver("192.168.1.108", 12348); foo.sender = new sender("192.168.1.108", 12347); foo.takeuserinput(); } private void takeuserinput() { while(true) { system.out.println("enter something"); bufferedreader br = new bufferedreader(new inputstreamreader(system.in)); string input = null; try { input = br.readline(); } catch (ioexception e) { // todo auto-generated catch block e.printstack...

ios - MagicalRecord 2.3.2 MR_saveToPersistentStoreWithCompletion not updating right away -

i using (magicalrecord, 2.3.2). cannot figure out why using mr_savetopersistentstorewithcompletion on mr_defaultcontext gives me "updating fail!" , therefore cannot update entry right away. [[nsmanagedobjectcontext mr_defaultcontext] mr_savetopersistentstorewithcompletion:^(bool success, nserror *error){ if (success){ nslog(@"updating success!"); } else{ nslog(@"updating fail!"); }}]; mr_savewithoptions:completion: being called mr_savetopersistentstorewithcompletion: , bool haschanges no. when checked thread call stack in, issue in case, thread nil: {number = 14, name = (null)} so set main thread , fixed update.

java - Error in pom.xml while creating maven project in eclipses -

Image
this question has answer here: how solve maven 2.6 resource plugin dependency? 7 answers i try google didn't find appropriate answer what wrong here? its maven dependencies problem need tell eclipse local maven repository path. can based on platform (linux/ windows). refer : how solve maven 2.6 resource plugin dependency

python - Use a field as key and it must be unique for each record to use it to browse the table (Openerp) -

please in view form wish use field key , must unique each record use browse table in other views , how it class saisirsoum(osv.osv): _name='saisir.soum' _columns = { 'numoffre' : fields.char('n° offre'), # defined key !! 'organisme_s' : fields.char('organisme'), 'des_offre' : fields.char('designation'), 'order_line' :fields.one2many('saisir.soumission.ligne','order_id','soumission_id'), 'observation_d' : fields.text('observation'), } in case you'll make numoffre unique setting _sql_constraints variable. can define custom message shown when user tries add duplicate entry. class saisirsoum(osv.osv): _name='saisir.soum' _sql_constraints = [ ('numoffre', 'unique(numoffre)', 'numoffre exists'), ] _columns = { 'numoffre' : fields.char(...

version control - How to restore changes from commit in git? -

Image
this question has answer here: how move head previous location? (detached head) 3 answers i know there tons of questions this, none solution worked out me. here happened: i tried add new feature in app, created new branch implement feature. after done merged master, deleted branch tested new feature , pushed changes repository (bitbucket btw). code normal. then needed add other feature tho. created new branch again, tested other new feature in master, , let other branch "right" code. the new feature didn't work, tried going other branch , merging master, delete changes made, gave me merge conflict tho, tried everything, wasn't able it. i switched master , deleted branch right code. wrong code in master. hadn't pushed changes yet, commited, tried searching on how fix this, none worked. i ran command: git checkout number of commi...

git - Set subdirectory as website root on Github Pages -

i'm using github pages host & serve static website. the static website has typical directory structure app: |_ source |_ build |_index.html .gitignore config.rb gemfile ... readme.md index.html under build/ , want make default www path. so when users hit username.github.io renders content within subdirectory , yet doesn't show "/build"/ on url, cause that's set root folder. notes: i don't have custom domain nor planning 1 purpose. can see, i'm trying leverage default url naming convention github provides. not using jekyll nor automatic page generator function. there detailed gist required steps. the gist here: https://gist.github.com/cobyism/4730490 from gist deploying subfolder github pages sometimes want have subdirectory on master branch root directory of repository’s gh-pages branch. useful things sites developed yeoman , or if have jekyll site contained in master branch alongside rest o...

html - JavaScript inside iframe does not work -

i have jsp iframe inside it. i'm trying load jsp in iframe: scripts , links ... <body> <iframe src="/contextmenu"> </iframe> <div style="float:left;"> <div id="studenttablecontainer" style="width:70%;"></div> </div> </body> </html> here contextmenu: scripts , links ... <body> <div data-role="content"> <ul data-role="listview" id="listview"> <li><a href="index.html">inbox <span class="ui-li-count">12</span></a></li> ... </ul> </div> </body> the idea separate javascript located in first jsp , javascript located in page within iframe. can't merge javascript in 1 page (without iframe) because makes errors , page crashes. unfortunately javascript within iframe doesn't work. piece of code in ...

exception - Should I throw PHP 7's Error classes in a library? -

i have open-sourced math library php , defines own hierarchy of exceptions : arithmeticexception divisionbyzeroexception numberformatexception roundingnecessaryexception now php 7 has landed, realize exceptions feel bit redundant new error classes introduced: arithmeticerror divisionbyzeroerror let's forget php 5 moment , assume library targets php 7. should throw arithmeticerror , drop arithmeticexception ? similarly, should throw divisionbyzeroerror , drop divisionbyzeroexception ? should roundingnecessaryexception , numberformatexception extend arithmeticerror ? in case, should called roundingnecessaryerror , numberformaterror ? at first glance, seems weird redeclare exceptions have native equivalent in language. at same time, , although nothing prevents userland code throwing error , feel these classes designed thrown php itself, , userland libraries better off throwing exception , not error . is there consensus on subject? y...

Facebook Javascript: how to save a Facebook event -

short version: on facebook (javascript sdk) "save" facebook event through javascript, equivalent of clicking "save" in facebook ui, can't find in sdk... idea? long version: to list page's events, do: fb.api('/somepage/events', function(response) { listevents(response.data); }); where: function listevents(listofevents) { console.log("number of events: " + listofevents.length); (i=0; i<listofevents.length; i++) { console.log("event " + + ": " + listofevents[i].name); // "save" "listofevents[i]" event? } } thanks.

hlsl - Which type sizes can I use for specific semantics -

microsoft provides list explaining input , output semantics of vertex , pixel shaders. i've seen code examples don't use documented data types. using float3 input color pixel shader or float2 input position vertex shader. though 2-component position or 3-component color make sense me, can't find documented, makes me wonder can use float3 vertex shader input position (if know won't using w component) without expecting errors? if can use data types other documented ones, there list available shows every allowed data type semantic or rule "as long used data type smaller or equally sized documented one, can use it"? code examples not following documentation: stackoverflow - passing colors through pixel shader in hlsl c++ / directx11 tutorials - s02e05 - creating , loading shaders @ 9:33 in shader model 4.0 , later (dx10+), semantic names matter system-value semantics (those prefixed sv_ ). other semantics have no special treatment...

c# - What is the difference between ArgumentException and just Exception? -

in our professor's example code has 1 snippet looks this: if (name == null || name == "") throw new argumentexception("name null or empty"); and snippet looks this: if (!file.exists(name)) { throw new exception("file not exist!"); } i wondering different , why 1 used above other exception base class exceptions. argumentexception used parameter not valid. subclasses exception . catch , can filter base on type of exception , handle each 1 differently. msdn describes well: when have throw exception, can use existing exception type in .net framework instead of implementing custom exception. should use standard exception type under these 2 conditions: you throwing exception caused usage error (that is, error in program logic made developer calling method). typically, throw exception such argumentexception, argumentnullexception, invalidoperationexception, or notsupportedexception. string supply exception objec...

ios - Using a storyboard reference to a storyboard in a different project/bundle appears broken -

Image
now, have workspace have 2 project inside, 1 call "projectone" , other "projecttwo" follow: they have storyboard respectively , want connect 2 storyboard pressing "to project two" follow: but when click button, show "terminating app due uncaught exception 'nsinvalidargumentexception', >reason: 'could not find storyboard named 'two' in bundle nsbundle 8c6a5fdc9e06/projectone.app> (loaded)'" is possible that? seeking method few days no idea... you need use complete names of storyboard including if storyboard in project/module - means including bundle name. please see image below how set in storyboard. have created example setup projectone , projecttwo same project setup. the key information put in storyboard reference. need include bundle name well! reference have included link adding storyboard reference edit while works leads issues later on start build storyboard out various sc...

user interface - By default checkbox should be checked on any webpage -

as user have checkmark many checkboxes in webpage frequently. want make checkbox default checked when ever page loads. there settings can chrome. or injector of extension. appreciate help. there extension called check all. works pretty well: here link : https://chrome.google.com/webstore/detail/check-all/nnbihdpkeohjdfncchjhidbbonnihaob?hl=en

list - Removing nodes in LinkedList in Java -

okey, understand basics of linked lists. know how each node has reference next node, , how it's tied up. my code working no issues, issue don't how it's working (yeah...) my question removing node in linked list. let's i'm removing person in list, in middle of list. in method, i'm making temp variable of nextperson, , right logic, i'm deleting node, i'm not changing in "global" nextperson afterwards. thing is.. apperently affects firstperson anyways , removing same node firstperson. i know linked list confusing, , question. if there's i'm not clear about, can explain further.. public class store { private person firstperson; void newperson(person person) { if (firstperson == null) { firstperson = person; } else { person.nextperson = firstperson; firstperson = person; } } void checkout() { person temp = firstperson; while (temp.nextperson != null) { ...