Posts

Showing posts from July, 2012

syntax - Why python need parentheses in function call? -

why python can't omit parentheses in function call other language(coffeescript haskell) do? historical reason or what? the parentheses allow disambiguate function object, func , calling of function, func() . function objects first-class objects in python. can, instance, pass them arguments functions, other object. used set callback function -- common practice in gui programming or concurrent programming.

javascript - How to get checkboxes to populate based on selected option in angular? -

<select class="form-control" ng-model="filterforminputs.apps" ng-options="app.application app in d"> <option value="" disabled selected>select application</option </select> i have above code snippet somewhere in index.html. , in corresponding controller have $scope.d = [{"application": "app1", "details":[{"name":"name1"},{"name":"name2"},{"name":"name3"}]}, {"application":"app2", "details":[{"name":"name4"},{"name":"name5"},{"name":"name6"}]}] how make such when select "app1" select form, can populate list of checkboxes corresponding "name" field" ? example, if select app1, want 3 checkboxes name1, name2, , name3 appear. , if select app2 select form, want 3 checkboxes app4, app5, , app6 appear? using ng...

plsql - Parsing string in PL/SQL and insert values into database with RESTful web service -

i reading values want insert database. reading them lines. 1 line this: string line = "6, ljubljana, slovenija, 28"; web service needs separate values comma , insert them database. in pl/sql language. how do that? here pl/sql have used parse through delimited strings , extract individual words. may have mess bit when using web service works fine when running right in oracle. declare string_line varchar2(4000); str_cnt number; parse_pos_1 number := 1; parse_pos_2 number; parsed_string varchar2(4000); begin --counting number of commas in string know how many times loop select regexp_count(string_line, ',') str_cnt dual; in 1..str_cnt + 1 loop --grabbing position of comma select regexp_instr(string_line, ',', parse_pos_1) parse_pos_2 dual; --grabbing individual words based of comma positions using substr function --handling last loop if = str_cnt + 1 select substr(string_line, parse_pos_...

javascript - Appending script with document.write synchronous -

i've encountered problem when appending script html. here sample code: <script>$('body').append("<script type=\"text\/javascript\" src=\"http:\/\/localtest\/test.php\"><\/script>");</script> test.php source <?php sleep(1); ?> document.write('<div></div>'); html inside append function can html, not necessarly script. works unless got html mentioned in example. result js code test.php not executed because it's blocked browser (i'm using ff): "a call document.write() asynchronously-loaded external script ignored." i'm not able modify test.php content, it's loaded external server. wy executed async? how force sync execution? i think must use $(window).ready(function() { //put code here }); berfore appending. so, complete code this <script type="text/javascript"> $(window).ready(function() { $('body...

css - IE11 sometimes not displaying entire H1 -

please take @ following test site: http://adroity.be/ys/test.php when refreshing page in ie11 notice final 'e' not showing. show hover on title. don't have access other versions of ie don't know if limited ie11. i'm using google font (oswald). here's relevant code: html <!doctype html> <html class="no-js" lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge,chrome=1"> <link rel='stylesheet' href='http://fonts.googleapis.com/css?family=oswald:400,300,700'> <link rel='stylesheet" href='style.css'> </head> <body> <h1><a href="/">yellowsubmarine</a></h1> </body> </html> style.css body { font-family: "oswald",sans-serif; } h1 { font-size: 130px; } h1 { font-weight: 700; text-transform: uppercase; } ...

c - How exactly pointer subtraction works in case of integer array? -

#include<stdio.h> int main() { int arr[] = {10, 20, 30, 40, 50, 60}; int *ptr1 = arr; int *ptr2 = arr + 5; printf("number of elements between 2 pointer are: %d.", (ptr2 - ptr1)); printf("number of bytes between 2 pointers are: %d", (char*)ptr2 - (char*) ptr1); return 0; } for first printf() statement output 5 according pointer subtraction confusion what second printf() statement, output? to quote c11 , chapter §6.5.6, additive operators when 2 pointers subtracted, both shall point elements of same array object, or 1 past last element of array object; result difference of subscripts of 2 array elements. so, when you're doing printf("number of elements between 2 pointer are: %d.", (ptr2 - ptr1)); both ptr1 , ptr2 pointers int , hence giving difference in subscript, 5. in other words, difference of a...

objective c - Making the UINavigationBar Disappear and Appear on a touch, mimicking safari on iOS -

i have uipageviewcontroller called uitableviewcontroller , shows series of images user. the images contain lot of information , while doesn't make sense have uinavigationbar entire time, because it's used share image, or go back, there way mimic safari on ios, uinavigationbar @ top disappears , reappears on touch? i have not tried because don't have first clue on start this. there third-party open source framework, or easy way animate this? perhaps in viewdidload, have timer on uinavigationbar , show @ start , disappear after 2 seconds, etc, reappear on touch? any guidance on appreciated. ios 8 provide default feature self.navigationcontroller.hidesbarsontap = true; [edited] add tap gesture in viewdidload uitapgesturerecognizer *taprecognizer = [[uitapgesturerecognizer alloc] initwithtarget:self action:@selector(taphandle:)]; [self.view addgesturerecognizer:taprecognizer]; add following method viewcontroller - (void)taphandle:(uitapgesturere...

c# - How to fill transperent pixels of tiff file and keep geo information -

i want fill transperent pixels of tif file contain geodetic information (map) black color. when open file photoshop example dont see transperent pixels, when open geodetic system "arcmap" example can notice of pixels transperent. thats have try do: private void button1_click(object sender,eventargs e) { bitmap bmp=null; using(image img =image.fromfile(@"filelocation.tif") { bmp=new bitmap(img); for(int y=0;y<bmp.height;y++) { for(int x=0; x<bmp.width;x++) { if(bmp.getpixel(x,y).a!=255) { bmp.setpixel(x,y,color.black); } } } } } bmp.save(@"new file location "); results : 1)the number of pixel same size of image smaller,why? 2)i have tried condition ( getpixel(x,y).a!=255) on bmp file , detected transperent pixels , when execute method on tif file doesn't detect transperent pixels ...

Values of my Array are undefined outside of my function -

i started learning as3 , flash , i've got question. can see in code below, i've created array out of objects got xml file. within function "xmlread" have no problems tracing, or using values of array or ever. problem want use array outside of function "xmlread" , not within. whenever try access values of "monthparams" outside of function, says array "undefined". how can use array created? import flash.display.loader; import flash.net.urlrequest; import flash.events.event; import flash.events.dataevent; var monthparams= new array; var month= new object(); var myloader:urlloader = new urlloader(); myloader.load(new urlrequest("parameter.xml")); myloader.addeventlistener(event.complete, xmlread); var actualmonth= 0; function xmlread(e:event){ var myxml:xml=new xml(e.target.data); myxml.ignorewhitespace=true; (var xmli:int=0; xmli < myxml.monat.length(); xmli++) { month.number=myxml.month[xmli].numb...

How to decode a JSON string in PHP? -

i have json string looks this: {"addresses":{"address":[{"@array":"true","@id":"888888","@uri":"xyz","household":{"@id":"44444","@uri":"xyz"},"person":{"@id":"","@uri":""},"addresstype":{"@id":"1","@uri":"xyz","name":"primary"},"address1":"xyz","address2":null,"address3":null,"city":"xyz","postalcode":"111111"}]}} what php decode , place address1 , address2 , address3 , city , , postalcode session variables? so far tried it's not working: $results = json_decode(strstr($address, '{"addresses":{"address":[{'), true); $_session['address1'] = $results['address']['address1']; thanks! prin...

java - How to pass the generated Buffered image from Servlet to the response? -

in servlet generate bufferedimage: bufferedimage bgimage = createimage(); and save it: saveimage(bgimg, getimagesavedir() + image_name); after want return response show in browser. i tried send image response: file imagefile = new file(getimagesavedir() + image_name); response.setcontenttype("image/png"); bufferedimage bufferedimg = imageio.read(imagefile); servletoutputstream out = response.getoutputstream(); imageio.write(bufferedimg, "png", out); out.close(); } catch (exception ex) { ex.printstacktrace(); } but receive exception: clientabortexception: java.net.socketexception: broken pipe @ org.apache.catalina.connector.outputbuffer.realwritebytes(outputbuffer.java:369) @ org.apache.tomcat.util.buf.bytechunk.flushbuffer(bytechunk.java:448) @ org.apache.catalina.connector.outputbuffer.doflush(outputbuffer.java:318) @ org.apache.catalina.connector.outputbuffer.flush(outputbuffer.java:296) @ org.apache.catalina.connector.co...

mmenu page always reverts to the top of page -

ive put in standard mmenu when open menu page goes top of page, there anyway stop when menu closed again go same place on page. any ideas thanks i had same issue, able fix removing height:100%; on body , html css wrapper. i changed css this: html, body { height: 100% width: 100%; margin: 0px; padding: 0px; } to this: html, body { margin: 0px; padding: 0px; } and solved issue me.

c# - Session_End does not fire even Session_Start saves data in Session -

i still have problem, session_end not fire. make simple log entry in sesseion_end make sure of it. i save lots of data in session variable in session_start and web config contains: <sessionstate mode="inproc" customprovider="defaultsessionprovider" timeout="1"> who can me, please? edit: asked post code. void session_start(object sender, eventargs e) { log.debug("session start of " + user.identity.name); session["something"] = "something"; ... } ... void sesseion_end(object sender, eventargs e) { log.debug("session end of " + user.identity.name); }

c# - Issue reading updated value of settings (app.config) -

i created settings in winforms app this: link you can see have timer interval value there. goal inside timer here: { // inside timer tick handler .... { timer1.stop(); int tinterval = properties.settings.default.timerinterval; helpermethods.appendtologfile(tinterval.tostring(), logtype.information); timer1.interval = tinterval; timer1.start(); } } i want change interval value of timer on runtime. but when launch application if change interval inside app.config file (opened windows explorer), still old value being read inside timer above . doing wrong? edit: doesn't work, if close application, , start again (i.e. restart application). still reads old values app.config (not ones entered after application shutdown , before application opened). getting wrong? ps. culprit maybe here, please see - reads old value 1500, instea...

c# - ERROR: 22001: value too long for type character varying(255) -

there! using postgresql + nhibernate. have 4 fields in mapping file: <property name="name" not-null="false" type="string"/> <property name="include" not-null="false" type="string"/> <property name="exclude" not-null="false" type="string"/> when compile code there many insertions queries db. postgresql gives me error "error: 22001: value long type character varying(255)" i know there "text" type in postgresql capabilities of storing data. how make nhibernate provide fields "text"-type? i found solution! should define mapped fields as: <property name="name" not-null="false" type="stringclob"/> <property name="include" not-null="false" type="stringclob"/> <property name="exclude" not-null="false" type="stringclob"/> ...

progress 4gl - Opening a STREAM in a Persistent Procedure Function -

i have persistent procedure, in trying open, write , close stream. i have in main area of procedure define stream soutfile. open stream soutfile value( outfilename ). message seek( soutfile ). and subsequently function within persistent procedure function example return logical: message seek( soutfile ). put stream soutfile unformatted somedata. end. when persistent procedure instantiated, message displays "0" stream has been opened. however, when example called, message displays "?" , message attempting write closed stream. i've tried declaring stream new shared didn't make difference. am doing wrong, or impossible define streams within persistent procedures? it , coffee hasn't kicked in yet think have open stream outside body of pp. this works: /* ppstream.p * */ define stream logstream. session:add-super-procedure( this-procedure ). /* end of pp init */ function initlog returns logical ( input lgfile character ...

php - Symfony Form: How to replace form class / retrieve all extra data? -

the symfony 2 form component something. guess know that. trying understand works how seemingly impossible task; , i'm quite experienced @ browsing through codebases.. man, form component.. omg tl;dr below details, issue tries ask is possible replace class \symfony\component\form\form ? or: how data fields of type form of form? or, related question: how on earth work if $form->add('ss', 'form') - core\formtype class gets involved when retrieve later, instance of \symfony\component\form\form ? happen , can maybe overriden uses different class there? details the situation imagine controller receives n deep json payload. payload gets decoded , validated through form. now, of json structure mapped models (doctrine odm entities). sub-properties "hashes" - client allowed post whatever wants there. "hash" subproperties fields of type form, compound flagged , can have fields. the problem bottom line our problem is, "extr...

makefile - make[1]: ***No rule to make target 'zynq_xcomm_adv7511_deconfig' -

i've looked through few of posts relating error , can't see 1 covers specific circumstance. i'm trying compile kernel image defined in these steps tutorial; git clone https://github.com/analogdevicesinc/linux.git cloning 'linux'... remote: counting objects: 2550298, done. remote: compressing objects: 100% (466978/466978), done. remote: total 2550298 (delta 2118600), reused 2483072 (delta 2058083) receiving objects: 100% (2550298/2550298), 727.70 mib | 353 kib/s, done. resolving deltas: 100% (2118600/2118600), done. checking out files: 100% (38170/38170), done. > cd linux > git checkout xcomm_zynq > # ad-fmcomms2-ebz use > # git checkout xcomm_zynq > export arch=arm > export cross_compile=/path/to/your/arm/cross-compiler > # e.g. export cross_compile=/opt/codesourcery/sourcery_g++_lite/bin/arm-xilinxa9-linux-gnueabi- > make zynq_xcomm_adv7511_defconfig # # configuration written .config # > make uimage loadaddr=0x00008000 ... objc...

jquery ui - knockout databind with jqueryUI based dateRangePicker -

i'm using jquery ui based daterangepicker trying bind knockoutjs based viewmodel via custom binder. not able make daterangepicker read observable this.range = ko.observable("jul 1,2015 - jul 3,2015"); here jsfiddle attempt. wrong approach , need create this this.startdate this.enddate the daterangepicker documentation states stores object following properties: start , end . stores json string in value field of <input> element used contain daterangepicker. therefore, want range observable store object start , end properties. wrote custom binding apply daterangepicker element , write object observable time different selection made: ko.bindinghandlers.daterangepicker = { init: function(element, valueaccessor, allbindings, viewmodel, bindingcontext) { var $el = $(element); $el.daterangepicker({ onchange: function() { var range = json.parse($el.val()); valueaccessor()(range); ...

Create a CalDav Service with Parse.com Database? -

i got introduced parse.com , love it! it's easy use , pretty powerful far can see now. i wondering, if it's possible create caldav service users can integrate calendar have on website phones? a friend , building application require - it's quite important. bestest david

r - Same code different plot in qplot vs ggplot -

i different results, code should equivalent? qplot(x = price, data = diamonds) + facet_wrap(~cut) vs ggplot(aes(x = diamonds$price), data = diamonds) + geom_histogram() + facet_wrap(~cut) try instead ggplot(aes(x = price), data = diamonds) + geom_histogram() + facet_wrap(~cut)

jax ws - Rewriting "Content-Type" header and MIME boundaries with JAX-WS and MTOM/XOP -

i have specification need comply with, makes rather unusual demands (for historical reasons) when providing , using web service using mtom/xop: to summarize, content-type http header has coded this: start-info , action have coded separate parameters of content-type: start-info="application/soap+xml";action="urn:ihe:iti:2007:retrievedocumentset" while in contrast that, mtom/xop specification demand this: content-type: multipart/related;start="...";type="application/xop+xml";boundary="...";start-info="application/soap+xml;action=\"urn:ihe:iti:2007:retrievedocumentset\"" so "action" included , escaped within "start-info" parameter. using jax-ws provide , consume web service, , cannot see working solution changing headers , mime boundaries meet specification's demands. the same applies mime boundaries sent web service message. java7 , java8's included jax-ws imple...

c++ - How to allow private modifications when using Qt in a commercial product under the LGPL -

i'm considering building closed-source application dynamically links against qt libraries. target platforms linux , windows. in order fulfill obligations of lgpl: "the user of application has able re-link application against different or modified version of qt library" ( qt faq ). i'm struggling understand technically necessary make possible. without releasing source code. under conditions user able replace .so/.dll files ship application own, modified versions? is possible @ all? because on same matter libstdc++ faq states: the lgpl requires users able replace lgpl code modified version; trivial if library in question c shared library. there's no way make work c++, of library consists of inline functions , templates, expanded inside code uses library. allow people replace library code, using library have distribute own source, rendering lgpl equivalent gpl. thank you! edit: second issue clarified lgpl version 3 , section 3. useful re...

java - Convert json array to list of json(raw) strings -

i've json data this: [{"id":"someid","name":"some name"}, {"id":"some other id", "name":"a name"}] i want json objects in above array aslist of strings like (each string json object in string form, (list<string>) ) (for simplicity [ {"id":"someid","name":"some name"},{"id":"some other id", "name":"a name"} i tried using jackson's typereference> causing consituents parts id, someid list elements instead of making each json object string element. i tried using jackson typereference>, time i'm getting number of objects correctly, double quotes gone , ':' converted '=', converted java object not json raw string. i'm getting [{id=someid,name=somename},{id=some other id, name=a name}] i'm interested know how using jackson library. any appreciated. use o...

c - Linked List - how to tail insert without moving head node -

so running problem. know is. can't figure out way solve allowed do.. first here tail insert function status append(my_queue queue, int item) { node_ptr temp; head_ptr head = (head_ptr) queue; //create new node temp = (node_ptr)malloc(sizeof(node)); if (temp == null) { printf("malloc failed\n"); return failure; } temp->data = item; temp->next = null; if (head->head == null){ head->head = temp; } else{ while(head->head->next) { head->head = head->head->next; } head->head->next = temp; } return success; } as see. simple. if head node null. adds new node head. if not. keeps moving head until reaches null , adds node. thats problem. moving head node pointer not supposed do. cant seem think of way it. since passing in my_queue. include header files , declarations understand these are. struct node { int data; node...

ios - Calendar view with overlays -

Image
i working on calendar view , everthing fine, need add overlay. please find below screen shot. please find below screen shot have done

how to include php if condition in html -

i have written php code convert html content pdf using mpdf api, want include php if condition in html content how can that? here code: $cart_body='<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>new order placed</title> </head> <body> <table width="550" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="400" align="left" valign="top"> <a style="font-size:16px">' if(somecondition){ echo "somecontent"; } else{ echo "somecontent"; }'</a><br /> </body> </html>'; you can use . operator concatenation, see examp...

linux - How to get MAC address of your machine using a C program? -

i working on ubuntu. how can mac address of machine or interface eth0 using c program. you need iterate on available interfaces on machine, , use ioctl siocgifhwaddr flag mac address. mac address obtained 6-octet binary array. want skip loopback interface. #include <sys/ioctl.h> #include <net/if.h> #include <unistd.h> #include <netinet/in.h> #include <string.h> int main() { struct ifreq ifr; struct ifconf ifc; char buf[1024]; int success = 0; int sock = socket(af_inet, sock_dgram, ipproto_ip); if (sock == -1) { /* handle error*/ }; ifc.ifc_len = sizeof(buf); ifc.ifc_buf = buf; if (ioctl(sock, siocgifconf, &ifc) == -1) { /* handle error */ } struct ifreq* = ifc.ifc_req; const struct ifreq* const end = + (ifc.ifc_len / sizeof(struct ifreq)); (; != end; ++it) { strcpy(ifr.ifr_name, it->ifr_name); if (ioctl(sock, siocgifflags, &ifr) == 0) { if (! (if...

c# - urlReferrer is comming null in MVC Post controller Action Method -

i'm posting form 1 mvc application mvc application b. in b action method i'm getting urlreferer null. application code: private string buildpostform(string url, string postdata) { try { string formid = "__postform"; stringbuilder strform = new stringbuilder(); strform.append(string.format("<form id=\"{0}\" name=\"{0}\" action=\"{1}\" method=\"post\">", formid, url)); string mid = "9820359248"; strform.append("<input type=\"hidden\" name=\"" + "merchantrequest" + "\" value=\"" + postdata + "\">"); strform.append("<input type=\"hidden\" name=\"" + "mid" + "\" value=\"" + mid + "\">"); //if (postdata !=...

scala - Type mismatch; result.type (with underlying type T) with -Xstrict-inference compiler option -

i'm trying enrich scala.util.try type fold method. have following implicit that: implicit class foldabletry[t](tryable: try[t]) { def fold[x](failure: throwable => x)(success: t => x): x = { tryable match { case success(result) => success(result) case failure(ex) => failure(ex) } } } when run sbt compile -xstrict-inference compiler option, following error: type mismatch; [error] found : result.type (with underlying type t) [error] required: t [error] case success(result) => success(result) [error] ^ [error] 1 error found [error] (compile:compile) compilation failed how can fix error? if remove compiler flag compiles. it looks you're running bug (si-6680) . recommend against using -xstrict-inference sounds experimental—notice paul phillip's comment: -xstrict-inference intended coarse hacky start, kind of coincided departure. expect overflowing implementatio...

Error while building kafka source using gradle -

i have executed following commands: $cd /opt/kafka-0.8.2.1-src/ $gradle following error coming: building project 'core' scala version 2.10.4 :downloadwrapper failure: build failed exception. what went wrong: not create service of type taskartifactstatecacheaccess using taskexecutionservices.createcacheaccess(). failed create parent directory '/opt/kafka-0.8.2.1-src/.gradle' when creating directory '/opt/kafka-0.8.2.1-src/.gradle/2.4/taskartifacts' try: run --stacktrace option stack trace. run --info or --debug option more log output. build failed total time: 1.511 secs i cannot figure out going wrong here. set gradle_user_home variable folder user (running gradle process) has valid "w" write access. it's gradle trying setup .gradle folder create/store it's cache data. for ex: gradle_user_home=~/.gradle or gradle_user_home=/some/folder/where/i/have/valid/rwx/access/.gradle or gradle_user_h...

linux kernel - Get a function's return value in a kretprobe handler -

i want know if possible hook kretprobe on kernel function , capture it's return value in return handler of kretprobe. it's little bit old question, still looking answer.. how register kretprobe can see in documentation kprobes ( https://www.kernel.org/doc/documentation/kprobes.txt ) an architecture independent function captures ret value syscalls: #include <linux/ptrace.h> ... int hook_retcode(struct kretprobe_instance *ri, struct pt_regs *regs) { unsigned long retval = 0; retval = regs_return_value(regs); if (is_syscall_success(regs)) { printk("%pf exited code %#lx\n", ri->rp->kp.addr, retval); } else { printk("%pf failed code %#lx\n", ri->rp->kp.addr, retval); } }

php - Create a media gallery search engine using web technologies -

i have requirement create media gallery search features(advanced) , based on tags. front end developer have experience php, nodejs , java well. open use cms , web technology. have looked through koken , need add sounds , videos using soundcloud/vimeo , not required , search feature(advanced, not clicking on tags) have worked around not documentation , support. best way implement ? using wordpress/drupal , or build scratch using own database , querying ? any inputs ? in advance !

caching - how does Git internally handle git push where no outstanding commits -

how git internally handle git push case local branch up-to-date remote , i.e. no outstanding commits ? does git retrieve latest state remote origin determine "everything up-to-date" --or-- git rely on local cache of remote origin ? git push check ref remote server (via similar git ls-remote , hashes there. if hashes same 1 branch has doesn't need else , display message.

Export html to PDF with JavaScript -

i want export html pdf javascript, saw libraries jspdf , pdfmake , limited. example, none of them can export html elements, <hr> , jspdf styling limited, saw this question answer not working me, pdfmake cannot download pdf, chrome . convert html pdf simple , fast sudo npm pdfpy link npm pdfpy

vsts - Visual Studio Online - operations failed getUser List -

we trialing test migration of project on tfs 2010 (on prem) #visual-studio-online using #opshub . during migration phase @ user mapping window getting below error message. 2015-07-08 15:10:49,916 [4] error error : operation has timed out @ system.net.httpwebrequest.getresponse() @ microsoft.teamfoundation.client.channels.tfshttpwebrequest.sendrequestandgetresponse(httpwebrequest webrequest, webexception& webexception) i not able find information on-line error. tried doing migration tfs administrator , domain user has project admin access project still these time out errors. i saw online user upgraded #opshub 1.3 1.2 overcome issue tried still doesn't help. need open other ports work apart 80 , 443? suggestion how on come issue? from logs find out error time out local tfs server. server error : tf400324: team foundation services not available server tfs.nextdigital.com\next digital. technical information (for administrator): operation ...

r - Differences in quantile function -

i struggling strange behaviour in r, quantile function. i have 2 sets of numeric data, , custom boxplot stats function (which helped me write, not sure every detail): sample_lang = c(91, 122, 65, 90, 90, 102, 98, 94, 84, 86, 108, 104, 94, 110, 100, 86, 92, 92, 124, 108, 82, 65, 102, 90, 114, 88, 68, 112, 96, 84, 92, 80, 104, 114, 112, 108, 68, 92, 68, 63, 112, 116) sample_vocab = c(96, 136, 81, 92, 95, 112, 101, 95, 97, 94, 117, 95, 111, 115, 88, 92, 108, 81, 130, 106, 91, 95, 119, 103, 132, 103, 65, 114, 107, 108, 86, 100, 98, 111, 123, 123, 117, 82, 100, 97, 89, 132, 114) my.boxplot.stats <- function (x, coef = 1.5, do.conf = true, do.out = true) { if (coef < 0) stop("'coef' must not negative") nna <- !is.na(x) n ...

How to bind javascript function or call during webgrid binding? -

i have web grid looks following more 1000 records. @{ var grid = new webgrid(canpage: true, rowsperpage: @model.pagesize, cansort: true, ajaxupdatecontainerid: "supplistgrid"); grid.bind(@model.searchresultsupplierviewmodels, rowcount: @model.totalpagerows, autosortandpage: false); grid.pager(webgridpagermodes.all); @grid.gethtml(tablestyle: "webgrid", footerstyle:"pp-pagenumber", htmlattributes: new {id="supplistgrid"}, columns: grid.columns( grid.column(format: (item) => @html.raw("<div class='row panellawfirmresultbox'><span class='blue'>panel partnership rating ("+item.panelrating+"): </span><span class='panelstars'>"+"2.5"+"</span></div>")) )) } and above webgrid have rating span used show panel rating in form of stars. in order display panel rating stars have used following way. <scr...

check if a folder contains images of any types in php -

i know if possible check in given folder whether contains images of types. for example : folder location /var/www/html/project/images/ i want check in images folder, if contains images in it... it can have following types .jpeg, .jpg, .png, .gif there no name images. glob can used problem. glob function can find pathnames matches pattern, similar regex . here's sample code search jpg, png, , gif files in folder , echo out names of these files. <?php $path = '/var/www/html/project/images/'; $files = glob($path."*.{jpg,jpeg,png,gif}", glob_brace); print_r($files); ?> if want check whether there images or not, use following code instead of print_r($files); : if (!empty($files)) { echo 'there images in folder'; } else { echo "no images found here"; } ?> if want know more recursively checking directories, check out readdir

Custom fonts not being loaded in CSS -

i have index.html links main.css . per 1 of answers question using custom fonts , have loaded custom font such saving file foundrysterling-medium.otf in appropriate folder, , calling such: @font-face{ font-family: "foundrysterling"; src: "assets/fonts/foundrysterling-medium.otf", } later on, body element, set such: body, input, select, textarea { color: #fff; font-family: 'foundrysterling', sans-serif; font-size: 15pt; font-weight: 400; letter-spacing: 0.075em; line-height: 1.65em; } however, no matter what, font not show, , instead default helvetica or arial (depending mac or pc) used instead. missing? thanks! this original code: @font-face{ font-family: "foundrysterling"; src: "assets/fonts/foundrysterling-medium.otf", } why not using semi-colon @ end? not sure if intentional. @font-face{ font-family: "foundrysterling"; ...

ruby - cd into a directory from a mounted Rails Engine -

i have rails app mounted rails engine . have created rails generator in engine. generator called rails app. generator's purpose copy set of views rails engine, , add them views folder in rails app. the rails generator working fine, need refactor using ruby class dir glob method . here views_generator.rb file, , working fine: class speaker::viewsgenerator < rails::generators::base source_root file.expand_path('../templates', __file__) def generate_participant_views copy_file "#{copy_path}/participants/_form.html.erb", "#{paste_path}/participants/_form.html.erb" copy_file "#{copy_path}/participants/edit.html.erb", "#{paste_path}/participants/edit.html.erb" copy_file "#{copy_path}/participants/index.html.erb", "#{paste_path}/participants/index.html.erb" copy_file "#{copy_path}/participants/new.html.erb", "#{paste_path}/participants/new.html.erb" copy_fil...

How to know what is the current url in php -

so, conditional logic check href url? example, there 3 specific pages. page_1: http://example.com/page_1 page_2: http://example.com/page_2 page_3: http://example.com/page_3 then write check if current page equal specific url: <?php if () { ?> <!--if current page equal `page_1` --> <span>show page 1</span> <?php } elseif () { ?> <!--if current page equal `page_2` --> <span>show page 2</span> <?php } elseif () { ?> <!--if current page equal `page_3` --> <span>show page 3</span> <?php } else { ?> <!--if current page not equal --> <span>show random</span> <?php } ?> explode url ".com/" check condition.check below code. `enter code here` 1. <?php $url = "http://example.com/page_1"; $url_ex = explode(".com/",$url); print_r($url_ex); 2. result = array ( [0] => http://example [1] => page_1 ) ...

Look up a string in a column and get all the corresponding values in another column in MS Excel 2010 -

question - column 1 column 2 ------------------ ab b pr c ef gh jk c xy uv d yz solution required query column 2 column 3 column 4 column 5 ab gh jk uv b pr c ef xy d yz i need excel formulas, no vba or programming. tried index & match formulas gives me values 1 cell in adjacent column need references mentioned in table. need in different sheet summary. [this bill of material (bom) table] total 48000 rows , 15 columns there in table,while 15000 rows unique.we need 2 columns out of 15 summary purpose.some cells referred 20 times or more need these values populated in different columns. the sheet try data linked source file using ms query. ps : apologies providing no information in original query. this code create new sheet called rowstocolumns summerised data on it. sub postrowstocolumns() dim x long, y long, myarr ...

Parsing lircd.conf using javascript -

how can parse lircd.conf files lirc database (e.g. http://sourceforge.net/p/lirc-remotes/code/ci/master/tree/remotes/yamaha/rx-v850.lircd.conf ) use in javascript project? i'd prefer parser in javascript can run in client browser.

angularjs - controllers using as normal function or array notation -

what difference between these 2: angular.module('myapp' ,[]) .controller('mycontroller', function($scope){...}); and angular.module('myapp' ,[]) .controller('mycontroller, ['$scope', function($scope){...})]; this quite complicated new angularjs me. syntax different java , c. many thanks. there's nothing difference between them. both code works same way. if use first code , when minify code confuse. look example: .controller('mycontroller', function(a){...});//$scope changed and code won't work angularjs code uses $scope variable doesn't take first, second, third, , on parameters. so, second code safer first if when minify code, still takes same variable i.e. $scope. look example: .controller('mycontroller', ['$scope', function(a){...})];//a refers $scope so, above code works fine when minify code $scope injected in place of a. so, if pass multiple parameters ordering matters in ...

xcode - code sign error when migrating from watchKit 1 to 2 -

i got error when attempt update watchkit 1 app 2. watchkit 1 app works fine in xcode 6. code sign error: no matching provisioning profiles found: none of valid provisioning profiles allowed specified entitlements: com.apple.security.application-groups. codesign error: code signing required product type 'watchkit extension' in sdk 'watch os 2.0' where can find more information these?

nginx - How to stop location rewrite from changing browser URL -

i'm setting ghost instance in subdirectory, , want point root (/) static page. have in nginx conf. location / { rewrite ^ /blog/about break; } location ^~ /blog { proxy_pass http://localhost:2368; proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for; proxy_set_header host $http_host; proxy_set_header x-forwarded-proto $scheme; proxy_buffering off; } the news redirect root works, in user redirected right page (/blog/about). however, url address works. didn't expect happen rewrite, can me point out what's wrong here? you need change 'break' 'last'. the 'break' means not going try other location block after current one. i'm guessing application doing redirect @ point. logs should confirm this. also, should use: proxy_redirect off;

ruby on rails - How to write rspec test to check if post returned by index are owned by current user -

i write test index method takes account signed in user , checks if index method shows posts belonging user. notes_controller_spec.rb describe "get #index" "responds http 200 status code" :index expect(response).to be_success expect(response).to have_http_status(200) end "renders index template" :index expect(response).to render_template("index") end "returns posts user" end notes_controller.rb class notescontroller < applicationcontroller before_action :set_note, only: [:show, :edit, :update, :destroy] before_action :authenticate_user! # /notes # /notes.json def index @users = user.order(:created_at) rails.logger.info("#{current_user.id == @users[0].id}") if current_user.equal? @users[0] @notes = note.all else @notes = note.where(user: current_user) end respond_to |format| format.nil? { } format.html { } format.xml ...

CSS to embeded HTML -

i creating profile css cannot used, in cannot import or direct css page, , cannot reference css in <style> tag doesn't work. thing seems work embedding css html, since use html embedding new or interesting css has become hard, since html4 5, , sites aren't clear when html5 didn't exist. instance, works: <!-- inliner build version 4380b7741bb759d6cb997545f3add21ad48f010b --> <!doctype html public "-//w3c//dtd html 4.0 transitional//en" "http://www.w3.org/tr/rec-html40/loose.dtd"> <html style="font-family: sans-serif; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; color: #000 !important; text-shadow: none !important; background-color: transparent !important; -webkit-box-shadow: none !important; box-shadow: none !important; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; font-size: 10px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0);"> <head></head> <bo...

autocomplete - Parsley.js - Re-validate a field after selecting an auto-complete value or drag-and-drop -

Image
after parsley validation, error message may displayed near field. if user types corrected value, field automatically re-validated, message disappear, , field marked success. however, if valid value entered either i) selecting field's "auto-complete" dropdown or ii) dragging-and-dropping field, not invoke re-validation, , error message remains though field has valid value. example... q: how force fields re-validate upon selecting value browser's auto-complete dropdown/drag-and-drop? (i realise can specify no auto-complete on fields, may not desirable, , doesn't solve drag-and-drop issue.) in case, use bootstrapvalidator validation. then, have revalidate field after fetching data $('yourform).bootstrapvalidator('revalidatefield', 'inputname');

javascript - A function that gets called outside the flow of control? -

so, i've been trying understand specific js library running through browser's debugger, , happens confuses me. i first encountered in phaser game library, i've seen library well. i'll use phaser example: <script> (function(){ var game = new phaser.game(800, 600, phaser.canvas, ''); game.state.add('game', game); game.state.start('game'); })(); </script> so anonymous function finishes setting things up, , step on , out of function, , after couple more steps (the pointer sitting @ top of html doc in meantime) program out of ends here: phaser.device._readycheck = function () { var readycheck = this._readycheck; .... } it didn't within flow of control called function, how did here? what's calling function? i've read bit 'asynchronous functions' , sounds pretty explanation, stuff i've glanced @ on google don't explain well, can't understand enough sure. i'm relatively new java...

python - How to transform XML to text -

following on earlier question ( how transform xml? ), have nicely structured xml doc, this.. <?xml version="1.0" encoding="utf-8"?> <root> <employee id="1" reportsto="1" title="ceo"> <employee id="2" reportsto="1" title="director of operations"> <employee id="3" reportsto="2" title="human resources manager" /> </employee> </employee> </root> now need convert javascript this.. var treedata = [ { "name": "ceo", "parent": "null", "children": [ { "name": "director of operations", "parent": "top level", "children": [ { "name": "human resources manager", "parent": "level 2: a" } ] } ] } ]; i've started writing xslt, looks...

java - Polynomial Multiplication with Complex Numbers Class -

gist link code. the problem i'm having uses class polynomial, method multiply, lines 136-172. here method: public polynomial multiply(polynomial right){ int size = right.length + length -1; int i; int r; complex productcoeff; complex coeffp = new complex(); complex coeffq = new complex(); complex currentvalue; polynomial temp = new polynomial(size); (i = 0; < length; i++) { (r = 0; r < right.length; r++) { coeffp = (retrieveat(i)); coeffq = (right.retrieveat(r)); productcoeff = coeffp.multiplycomplex(coeffq); if (temp.retrieveat(i+r) == null) currentvalue = productcoeff; else currentvalue = (temp.retrieveat(i+r)); currentvalue = currentvalue.addcomplex(productcoeff); temp.replaceat(i+r, currentvalue); } } return temp; } ...

ember.js - Looking for bootstrap-modal.js and ember-data-localstorage.js -

i started reading ember.js in action book . in first app, author advises download number of js files. there 2 can't figure out download from: bootstrap-modal.js ember-data-localstorage.js googling didn't give results. although, these scripts available in book's source code , they're 2 years old. wonder if scripts not used anymore or have make them on own...

python - I want my already created virtualenv to have access to system packages -

i've installed opencv3 on ubuntu 14.04. tutorial followed reason using virtualenv. want move opencv virtual global environment. reason can't seem use packages installed on global environment getting on nerves. how can that? i'm not sure got question right, probably virtualenv has been created without specifying option --system-site-packages , gives virtualenv access packages installed system-wise. if run virtualenv --system-site-packages tutorial_venv instead of virtualenv tutorial_venv when creating tutorial virtualenv, might fine. fyi, using virtualenv local dependencies it's widespread practice, which: gives isolation , reproducibility in production scenarios makes possible users without privilege of installing packages system-wide run , develop python application the last benefit might reason why tutorial suggested virtualenv based approach.

Change Wordpress feed <link> for one specific tag -

i have external page reads rss feed tag. can't change on external page, challenge change rss feed on side match requirements. on external page 3 latest posts tag shown, , @ end of section (note: not after each post after 3 posts) there "view all" link. link receives value element in feed, default set blog homepage, e.g. http://myblog.com ). specific tag link should http://myblog.com/tag/myspecialtag . the requirement "view all" link links tag page instead of homepage. my idea add condition element change url specific category. tried change feed template recommended here: customizing feeds , reason doesn't change template @ all. code tried following: remove_all_actions( 'do_feed_rss2' ); add_action( 'do_feed_rss2', 'change_feed_rss2', 10, 1 ); function change_feed_rss2( $for_comments ) { $rss_template = get_template_directory() . '/feeds/feed-custom_rss2.php'; if( file_exists( $rss_template ) ) load...