Posts

Showing posts from January, 2014

laravel - update function is not working -

i trying update database user code , not working . there no change way! public function update( request $request) { $request->user()->tasks()->where('id', '=', $request->id)->update([ 'name' => $request->title, 'body' => $request->body, ]); return redirect('/request'); } try code , update database: app\user::find($request->id)->tasks()->update([ 'name' => $request->title, 'body' => $request->body ]); return redirect('/request');

zebra printers - 128 barcode print spaces -

i trying print 128 barcode on zebra zm400 label printer barcode 23 characters long using zebra programming language barcode contains single space every time send barcode printer adds 2 spaces. e.g. abc3 1345678998765432001 2 spaces added space between 3 , 1. if print barcode no spaces 2 spaces added @ end before last e.g. 001 becomes 00 1. appreciated. here code using ^xa ^lh30,20 ^sz2 ^md15 ^lt0 ^mfn,n ^jzy ^pmn ^jma ^lry ^pw750 ^by2 ^bcn,180,y,n,n, ^fdacv8 512345678901234001^fs ^mud ^pq1,0,1,y^xz no matter try printer inserts 2 spaces. have tried using ^fh , _20 character space still inserts 2 spaces. looking @ your label looks should mapping single space, have tried dropping zpl directly printer via web interface , seeing if still 2 spaces? issue come how sending file?

mysql - Creating a simple database PHP search engine -

i try create simple search engine on php, connect database , search string table attribute. , based on keyword, search results display table rows have same keyword string. i'm using php version 5.6.21 search.php <html> <body> <form action="" method="get"><center> search: <input type="text" name="search" placeholder="enter keywords" /><br><br> <input type="submit" name="submit" value="submit" /> <center> </form> <hr> <?php $hostid= 'localhost'; $user='root'; $pass=''; $db= 'projectdata'; mysqli_connect($hostid, $user, $pass); mysql_select_db($db); if(isset($_get['submit'])){ $search_value=$_get['search']; $query="select * book title '%$search_value%'"; $run=mysql_query($query); if($...

routes - rerouting nested resource in Rails -

i have in routes: resources :users resources :posts end it creates show path /users/:user_id/posts/:post_id great. if types /users/:user_id/post/:post_id (mind singular /post , not /posts) 404. want 302 redirect .../post/:post_id ../posts/:post_id in routes. how? you may able achieve using following in routes config. get '/users/:user_id/post/:post_id', to: redirect('/users/%{user_id}/posts/%{post_id}') more info here: http://guides.rubyonrails.org/routing.html section: 3.12 redirection

pandas - Most efficient way to aggregate tabular data meeting certain conditions in Python in O(1) time? -

let's have table bunch of data in long format (each row has 1 data point). instance, let's have table of people's sat scores, columns state, city, school, gender, race, , person. goal find way pull out , average data points corresponding groupings of data. for instance, if want average sat scores associated males in texas, or white females in nyc. what's best way in python (i suppose it's similar tapply in r)? boolean indexing on pandas data structure? done in o(1) time? dumbest possible way crawl through row row, check if each row meets conditions, , collect numbers do, can't think there's better way this; don't become unnecessarily slow datasets bigger. you cannot in o(1) time. this problem has more 1 complexity associated it. can think of three: prepossessing, insertion, , lookup. you in o(nlog(n)) preproccessing + o(log(n)) lookup time, , o(log(n)) insertion follows: collections import deque datatable = collections.deque(...

mysql - SQL - Unqiue results based on criteria -

making dealer locator people search dealer near them. want work in such way if dealer has multiple branches near person, closest branch shows. "name" field should unique in results result shown having least distance person searching versus other rows have same "name" field. want closest 5 dealers shown ordered dealer level, or medal. right have following: $query = sprintf("select name, address, contact, image, medal, phone, email, website, lat, lng, ( 3959 * acos( cos( radians('%s') ) * cos( radians( lat ) ) * cos( radians( lng ) - radians('%s') ) + sin( radians('%s') ) * sin( radians( lat ) ) ) ) distance dealers having distance < 60 order medal, distance limit 0 , 5", mysql_real_escape_string($center_lat), mysql_real_escape_string($center_lng), mysql_real_escape_string($center_lat), mysql_real_escape_string($radius)); $result = mysql_query($query); from i've read, sounds need like: select * ( select row_number() o...

How to upload the content of a directory in Shiny R? -

i have directory different txt files. can use following code in ui.r files individually: fileinput("file", '', multiple=true, accept = c("summary.txt","progress.txt")), however, allow user of shiny app select directory path contain summary.txt , progress.txt files. ideally, app should automatically access content of directory , upload content. i'd appreciate if can me this.

Menu outside container / Background image vertical stretch -

i've been trying fix of weekend, can't seem right, basics of website complete, 2 things: the ul.nav fits of buttons, however, 10-15 pixel area sticking out left. out of ul.nav. (i'm using ms expression web 4, it's marked diagonal red lines. prevents menu align correctly, , worse, causes 1 menu button drop below others when viewing site in 1024*768. :-( the background picture container div (called "div" in code) not stretch vertically, repeats itself. creates annoying lines way. there way make stretch? many advice. code included below. the html: <body> <div id="container"> <div id="masthead" class="masthead" onclick="window.location.href='index.html'"; style="cursor:pointer"></div> <div id="top-nav" > <ul class="nav"> <li><a href="#"> europe </a></li> <li>...

puppet - Compile a node's catalog to JSON without a master? -

i'm looking improve org's puppet work lifecycle comparing differences actual node catalogs. came across this project compiles catalogs nodes , creates diff them, seems require online master. i need able tool does, albeit without master - i'd compile deterministic json or yaml blob describes of resources managed puppet given node , given set of facts. is there way me without online master? i have written 2 blog posts showing 2 ways can compile json catalogs without needing puppet master. if have rspec-puppet set then, first solution easy. add following file.write statement inside 1 of blocks: require 'spec_helper' describe 'myclass' { file.write( 'myclass.json', pson.pretty_generate(catalogue) ) #is_expected.to compile.with_all_deps } end blog post here . the second method more involved, , should consult second blog post compiling puppet catalog – on laptop . finally, wrote post on using catal...

java - IntelliJ compiled class file permissions -

when compile files using latest intellij 2016.1.2 build -> make module module-name. this generates class files in output path value set in project settings. class files generated has -rwxrwx---+ permissions. have again chmod 644 change permissions make class file readable everyone. is there way intellij can compile & generate class files permissions readable -rw-r--r--

mysql - PHP won't load pdo_mysql extension on Fedora 25 -

after little toying around freepbx install on f25, seem have broken it, , can't pdo_mysql load: [root@freepbx-localdomain freepbx] # /usr/bin/env php -m | grep -i pdo pdo pdo_sqlite freepbx's ./install errors out appropriately: checking if asterisk running , can talk 'asterisk' user...done preliminary checks done. starting freepbx installation checking if new install...yes (no /etc/amportal.conf file detected) database root installation checking credentials , permissions..error! invalid database permissions. error was: not find driver lastly, pdo_mysql in /etc/php.d directory: [root@freepbx-localdomain php.d] # ls *pdo_mysql* 30-pdo_mysql.ini i'm struggling here, , clean centos install (and not run on fedora workstation, wasn't best idea). ideas? edit: while supposedly php.ini no longer used load extensions, did try anyways, adding: extension="pdo.so" extension="pdo_mysql.so" and now... [root@freepbx-localdomain freep...

ocaml - Faithfully handle white-spacing in a pretty-printer -

i writing front-end language (by ocamllex , ocamlyacc ). so frond-end can build abstract syntax tree (ast) program. write pretty printer, takes ast , print program. if later want compile or analyse ast, of time, don't need printed program exactly same original program, in terms of white-spacing. however, time, want write pretty printer prints exactly same program original one, in terms of white-spacing. therefore, question best practices handle white-spacing while trying not modify types of ast. don't want add number (of white-spaces) each type in ast. for example, how deal (ie, skip) white-spacing in lexer.mll : rule token = parse ... | [' ' '\t'] { token lexbuf } (* skip blanks *) | eof { eof } does know how change other parts of front-end correctly taking white-spacing account later printing? it's quite common keep source-file location information each token. information allows more accurate errors, ...

ios - Getting autolayout issues in debugger -

Image
trying autolayout work cell resizing can achieved. this how storyboard looks like: make symbolic breakpoint @ uiviewalertforunsatisfiableconstraints catch in debugger. methods in uiconstraintbasedlayoutdebugging category on uiview listed in <uikit/uiview.h> may helpful. 2016-06-01 14:05:24.587 brandspace[4968:1387945] unable simultaneously satisfy constraints. @ least 1 of constraints in following list 1 don't want. try this: (1) @ each constraint , try figure out don't expect; (2) find code added unwanted constraint or constraints , fix it. ( "<nslayoutconstraint:0x1258c32a0 h:[likebutton:0x1258c2d80'like'(46)]>", "<nslayoutconstraint:0x1258c3830 h:[uilabel:0x1258c35d0'1'(121)]>", "<nslayoutconstraint:0x1258c4290 h:|-(8)-[likebutton:0x1258c2d80'like'] (names: '|':uiview:0x1258bf6f0 )>", ...

how can i pass a value from jsp to servlet -

this part of jsp program. <%@ page import="db.conn" %> <%@ page import="java.sql.*" %> <% try{ string id2=request.getparameter("id"); system.out.println(id2); %> <input type="hidden" name="id2" id="id2" value="<%=id2%>" > <% }catch(exception e) {system.err.println(e);} %> <form method="post" action="./transaction"> <button type="submit">pay now</button> </form> </span></div> but when try id2 in servlet using statement: string id=request.getparameter("id2"); i id=null . how can value? the input tag element stores id2 has inside form element. <%@ page import="db.conn" %> <%@ page import="java.sql.*" %> <form method="post" action="./transaction"> <% try{ string id2=reques...

processing - draw shape on input gives unexpected result how to fix? -

i want draw shape based on input of slider. see code below: import controlp5.*; controlp5 cp5; int people = 5; int dmamt = 0; int peoplehis; slider abc; pshape vorm; void setup() { cp5 = new controlp5(this); size(displaywidth, displayheight); cp5.addslider("people") .setposition(10,10) .setwidth(400) .setrange(0,20) .setvalue(0) .setnumberoftickmarks(20) .setslidermode(slider.fix) ; cp5.addslider("dmamt") .setposition(450,10) .setwidth(400) .setrange(0,255) .setvalue(0) .setnumberoftickmarks(5) .setslidermode(slider.fix) ; vorm = createshape(); framerate(10); } void draw(){ if(peoplehis != people){ vorm.beginshape(); vorm.fill(dmamt); for(int = 0; <= people; i++){ vorm.vertex(random(500), random(500)); } endshape(); } peoplehis = people; shape(vorm, 100,100); } the first time set slider value shape desired amount of ...

neural network - How to correctly accumulate gradients across batches in Torch? -

i'd accumulate gradients across several batches. training iter_size 2 , batch_size 16 should same if set iter_size = 1 , batch_size = 32. suspect there i've missed in code, because gradparams both cases not same. appreciate if me find out problem. here code: local params, gradparams = net:getparameters() local iter_size = 2 local batch_size = 16 local iter = 0 net:zerogradparameters() i, input, target in trainset:sampleiter(batch_size) iter = iter + 1 -- forward local input = input:cuda() local target = target:cuda() local output = net:forward(input) local loss = criterion:forward(output, target) local gradoutput = criterion:backward(output, target) local gradinput = net:backward(input, gradoutput) -- update if iter == iter_size gradparams:mul(1.0/iter_size) net:updategradparameters(0.9) net:updateparameters(0.01) iter = 0 net:zerogradparameters(...

JDBC:ODBC:Access "search key was not found in any record" -

i have java application uses jdbc:odbc bridge connection dbf files linked microsoft access database (thus, i'm using driver connection microsoft access database) there table named salfac, contains following fields: nro_fac, cod_ite, can_ite, prc_ite , dsc_ite among other columns. when perform following query: select nro_fac, cod_ite, can_ite, prc_ite, dsc_ite salfac , without where clause works fine. when execute following: select nro_fac, cod_ite, can_ite, prc_ite , dsc_ite nro_fac=151407 , program throws sqlexception message the search key not found in record . the nro_fac column integer type column, using quotes results in syntax error. i compacted , repaired entire database no avail. also, tested query directly on microsoft access 2010 , gave me same error. yesterday tested jdbc:odbc bridge dbf files directly , gave me same error same query. there no blank spaces on tables names , columns names. ¿is there additional step in order make queries these work? need ex...

ios - Reverse NSString recursively in category -

this question has answer here: reverse nsstring text 19 answers i made category reversing nsstring in recursive way. i'm getting correct answer. i'm not sure if okay memory management . don't know memory management in objective-c. any other efficient way highly admirable. -(nsstring *)reversestring{ if ([self length]<2) { return self; } else { return [[[self substringfromindex:1] reversestring] stringbyappendingstring:[self substringtoindex:1]]; } } however, question similar reverse nsstring text not duplicate because here i'm implementing recursion. , asked memory consumption not code example. using recursion reverse string interesting thought exercise, goning slow , dreadful wasteful of memory. need create 2n temporary strings. (where n number of characters in string) n of strings 1 character long, ,...

java - Managing JIRA webhooks via REST API -

i'm trying manage jira via java rest api. following questions: 1. how pass arguments in url via webhook while calling rest code. 2. how receive request passed via webhook in rest code. i created webhook , called rest api in url provided http://localhost:8080/rest/jiraintegration/jiraservice/record while rest code looks like @path("/jiraservice") public class jiraservice { @get @path("/records") public string getjirarequest(inputstream response){ //req.getparameter("key"); bufferedreader br = null; stringbuilder sb = new stringbuilder(); string line; br = new bufferedreader(new inputstreamreader(response)); try { while ((line = br.readline()) != null) { sb.append(line); } } catch (ioexception e) { // todo auto-generated catch block e.printstacktrace(); } system.out.println("inputstream::"+sb.tostring()); return sb.tostring(); } i'm new jira webhooks res...

python - Transform category, start_time, end_time DateFrame for plotting in pandas -

i have pandas dataframe: df.info() <class 'pandas.core.frame.dataframe'> int64index: 32656 entries, 94418 2 data columns (total 8 columns): customer_id 32656 non-null object session_id 32656 non-null int64 start 32656 non-null datetime64[ns, america/los_angeles] end 32656 non-null datetime64[ns, america/los_angeles] length 32656 non-null timedelta64[ns] category 32656 non-null object rounded_start 32656 non-null datetime64[ns, america/los_angeles] rounded_end 32656 non-null datetime64[ns, america/los_angeles] dtypes: datetime64[ns, america/los_angeles](4), int64(1), object(2), timedelta64[ns](1) memory usage: 2.2+ mb i create datetimeindex: rng = pd.date_range(df['rounded_start'].min(), end=df['rounded_start'].max(), freq='5min') how tie 2 datasets can plot each point in range on x-axis , shows count of how many categori...

c# - Animation not Behaving Itself -

i have statusbar textblock item. show process being under taken , status/information messages. if message not 'ready' want text fade away on time, leaving 'ready' when has gone. i testing this, , have following xaml textblock . <statusbaritem dockpanel.dock="left" margin="0,2,0,0"> <textblock text="{binding statusmessage}" margin="5,0,0,0" foreground="white"> <textblock.style> <style targettype="textblock"> <style.triggers> <datatrigger binding="{binding systemisready, notifyonsourceupdated=true, mode=twoway}" value="false"> <datatrigger.enteractions> <beginstoryboard> ...

css - Position relative to a parent's parent -

Image
i've got css menu this... <ul> <li><img src="...">menu item</li> <li><img src="...">menu item2</li> </ul> my css gives me this... what want this... i've tried trim down css relevant bits - let me know if i've omitted crucial... ul#menu li ul li { position: relative; display: block; background-color: #fff; border-top: solid 1px #808080; } ul#menu li ul li:first-child { border-top: none; } ul#menu li ul li img { position: relative; left: 0px; } the problem image child of <li> not full width of <ul> , position: relative; left: 0px; relates li not ul . how can position image relative ul ? since these images not part of content, remove img elements html , add 1 line css: ul#menu li ul li { background: url(/content/images/nav/left.png) 5px center no-repeat; } this set arrow background image 5px left edge , automatically cen...

android - No RecyclerView after JSON Parse -

i'm trying populate recyclerview json data local server using volley , recyclerview doesn't display , no error displayed in logcat. here code: mainactivity.java list<products> productslist; recyclerview recyclerview; ... @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); toolbar = (toolbar) findviewbyid(r.id.toolbar); toolbar2 = (toolbar) findviewbyid(r.id.toolbar2); setsupportactionbar(toolbar2); recyclerview = (recyclerview) findviewbyid(r.id.main_list); recyclerview.setlayoutmanager(new linearlayoutmanager(this)); recyclerview.setitemanimator(new defaultitemanimator()); final dataadapter dataadapter = new dataadapter(productslist); recyclerview.setadapter(dataadapter); requestqueue requestqueue = volley.newrequestqueue(getapplicationcontext()); string url = "http://192.168.9.120/menproducts.json"; json...

Simple Binary Tree in Java in just one class -

i have implement simple binary tree. need put , get method. if key in use have replace value. code i'm very unsure if working right... can confirm code work? sorry... don't know how debug such class... :/ , no - not homework. template course learn java... ;) //don't import other classes. public class binarytree<k extends comparable<k>, v> { //please don't add further attributes. private k key; private v value; private binarytree<k, v> left; private binarytree<k, v> right; /** * class binary tree-based collection key-value-pairs. */ public static void main(string[] args) { binarytree<integer, string> treeinteger = new binarytree<>(2, "two "); treeinteger.put(1, "one "); treeinteger.put(0, "zero "); treeinteger.put(3, "three "); treeinteger.put(6, "six "); treeinteger.put(3, "threenew "); ...

html - How to reset a counter back to 0 with a button in javascript? -

i have counter in javascript right , button adds 1 value counter, have far: var counter = 0; var = 0; var add = function(valuetoadd){ += valuetoadd; document.getelementbyid('value').innerhtml = a; } value $<span id="value">0</span> <button width="500" height="500" id = add class="button button1" onclick="javascript:add(1)">add value</button> i need button reset counter 0 appreciated. add button, reset function , set values "0" shown in code below: <button width="500" height="500" id ="reset" class="button button1" onclick="javascript:reset()">reset value</button> <script type="text/javascript"> var reset= function(){ = 0; document.getelementbyid('value').innerhtml = a; } </script> btw declared var count = 0 in ...

angularjs - Angular 2 issue: typings: command not found -

so might come off basic question has been bugging me days , haven't found solution. i'm installing typings command line npm , appears run type typing command , says command doesn't exist! it goes like: kevyns-macbook-pro:~ kevynquiros$ sudo npm install typings --global password: /users/kevynquiros/npm/bin/typings -> /users/kevynquiros/npm/lib/node_modules/typings/dist/bin.js typings@1.0.4 /users/kevynquiros/npm/lib/node_modules/typings ├── listify@1.0.0 ├── xtend@4.0.1 ├── wordwrap@1.0.0 ├── archy@1.0.0 ├── minimist@1.2.0 ├── any-promise@1.3.0 ├── bluebird@3.4.0 ├── chalk@1.1.3 (supports-color@2.0.0, escape-string-regexp@1.0.5, ansi-styles@2.2.1, has-ansi@2.0.0, strip-ansi@3.0.1) ├── columnify@1.5.4 (strip-ansi@3.0.1, wcwidth@1.0.1) ├── update-notifier@0.7.0 (is-npm@1.0.0, xdg-basedir@2.0.0, semver-diff@2.1.0, ansi-align@1.0.0, boxen@0.5.1, configstore@2.0.0, latest-version@2.0.0) └── typings-core@1.0.1 (array-uniq@1.0.2, thenify@3.2.0, zip-object@0.1.0, po...

oracle - How to enable cache server JNDI lookup support in Coherence 12.2.1? -

Image
i trying access coherence 12.2.1's cache (deployed in data tier) application tier (deployed in application tier) staying same coherence cluster different weblogic clusters. oracle stated: a component-scoped jndi tree can used in ejbs, servlets, or jsps reference namedcache. use component-scoped jndi lookup, define resource-ref of type com.tangosol.net.namedcache in either web.xml or ejb-jar.xml file. example 3-2 illustrates <resource-ref> stanza identifies mycache namedcache. in https://docs.oracle.com/cd/e24329_01/web.1211/e24442/coh_wls.htm#cohwl117 i developed coherence application , deploy local storage enabled weblogic server (coherence managed server). used application lifecycle listener access , initialise cache, works fine. i can find cache populate in coherence cache server using visualvm, please see attachment. but unfortunately, can't find thing cache in weblogic managed server jndi tree, please find attachment. i tried find out way enable co...

windows - Why Doesn't Fiddler Show Curl Traffic? -

why doesn't fiddler show curl traffic? other traffic gets displayed, not curl . how can fiddler intercept curl traffic? fiddler not intercept curl traffic default. you'll need specify -x proxy option. if curl displays ssl error message, additionally use -k option disable ssl validation. curl -x 127.0.0.1:8888 -k www.example.com

mysql - How to count values from column whilst taking into account a qty column -

i've seen other questions never column used say i've got table name | qty nup 1 foo 1 foo 3 tup 2 foo 1 nup 4 in example ge result like name | qty foo 5 tup 2 nup 5 at moment have done not take account qty $sql = "select `name`,count(*) count orders group `name` order count desc"; try this $sql = "select name, sum(qty) qty orders group name order qty desc";

sql - MySQL: Updating an item only if certain conditions are met -

does know how update row if 1 of it's column not equal same coloumn in row in table? let me explain. consider table. stores bookings , admin can decide 1 approve. booking | time | approved 0 | 5:00 | no 1 | 5:00 | no 2 | 6:00 | yes 3 | 6:00 | no the booking requests can overlap, such case booking 0 , 1. admin can decide either approve 0, or 1. but approved bookings cannot overlap. example, since booking 2 approved 6:00, booking 3 cannot approved. unless admin decides disapparove booking 2 first. how write query check no collision happen? thinking along lines of: update requests set approved = 'yes' booking = 3 , not exists ( (select time requests booking = 3) = (select time requests booking != 3) ); but doesn't work. any appreciated. as side note. actual problem little more complicated. table looks more booking | start time | end time |approved 0 | 5:00 | 6:00...

mysql - How to automatic update data in database in PHP -

i want make toefl test. make table score_structure in database containing 4 columns (email, right, false, score). if user has done on previous test , perform test again, user data updated according user's email pitch. i have tried failed, data not update. please me. this structure.php <?php $email = $_session['email']; $cek = mysql_num_rows(mysql_query("select email score_structure email='$email'")); if($cek > 0 ) { $simpan = "update score_structure set right='$right', false='$false', score='$score' email='$email'"; if(mysql_query($simpan)) { header("location:test_listening.php"); } else { echo mysql_error(); } else { $simpan = "insert score_structure values ('$email', '$right', '$false', '$score')"; if(mysql_query($simpan)) { header("location:test_listening.php"); } else { echo mysql_...

javascript - Setting Facing Pages Margins In InDesign -

i'm creating new document facing pages, , want set margin has bigger margin on spine side outer edge. in ui, simple there's "inside" , "outside" margin edge. when scripting however, there's left/right though consistent left , right regardless of spine side. how set outside / inside margins via script document.marginpreferences have top/bottom/left/right? left , right , relative spine. consider left inside , right outside margin.

twiml - Twilio call says an application error has occured -

i using command make call. hosted xml in amazon s3 , made public. call says, "sorry, application error has occurred. please help curl -xpost https://api.twilio.com/2010-04-01/accounts/kjfwbkjfejbfgeirbgiregribg/calls.json -d "url=http://read-voice.xyz.s3-website-us-east-1.amazonaws.com/voice.xml" -d "to=%2b1234567812" -d "from=%2b1234567812" -u 'ssllsdnf wfwefklwefwefwef:wjfdbewfergergerg' this xml <?xml version="1.0" encoding="utf-8"?> <response> <say voice="alice">thanks trying our documentation. enjoy!</say> </response> this error in debugger <html> <head> <title>405 method not allowed</title> </head> <body> <h1>405 method not allowed</h1> <ul> <li>code: methodnotallowed</li> <li>message: specified method not allowed against resource.</li> <li>method...

reactjs - How to handle logged in status using React Router? -

i'm noob, starting first project node, express, , react. i got authentication working, have component calls action, calls store (or should), confused. don't know go. my loginactions.login makes api call login user, comes , stores cookie session id. after that, how tell ui go dashboard? how make ui know user authenticated, , if it's not, kick him out? where supposed check that? store? component itself? any appreciated. you're not "supposed" in specific way. react more of library framework. can use see fit. one option use react-router's onenter function verify logged in status , user it's replace method redirect accordingly. you have components verify logged in status , instead render login form if not logged in yet. or store login form @ unique uri , handle all of authentication via server, using 302 redirects based on logged in status. up you!

excel - For loop and if statement to copy in another sheet -

i trying check cells 2 columns (one loop each) , see whether have string true. if yes copy cells corresponding, sheet(log). i know have cells, contain word true when run program there nothing copied in other sheet. i not compiling errors , know wrong in code. sub islimit() dim long, b long, lr long x = 2 y = 2 lr = worksheets("targets").cells(rows.count, "a").end(xlup).row = 8 lr if (strcomp(cells(i, 15).text, "true")) = 0 worksheets("log").range("b" & x) = "no" x = x + 1 end if next j = 8 lr if (strcomp(cells(j, 16).text, "true")) = 0 worksheets("log").range("b2") = worksheets("targets").range("b1").value worksheets("log").range("c" & y) = "yes" y = y + 1 end if next j end sub so far, can see 2 problems might causing trouble. 1.since not setting ...

python - KeyError in Django -

newbie django here, i'm creating clone of fiverr.com project. there's header in base.html category titles if click, should filter out gigs in relevant category display. what happens redirects home regardless. have done testing , believe should because of keyerror, , no link passed function correctly. thanks in advance! code below: views.py def category(request, link): categories = { "graphics & design": "gd", "digital & marketing": "dm", "video & animation": "va", "music & audio": "ma", "programming & tech": "pt" } try: gigs = gig.objects.filter(category=categories[link]) return render(request, 'home.html', {"gigs": gigs}) except keyerror: return redirect('home') models.py class gig(models.model): category_choices = ( ("gd", "graphics ...

excel - Vlookup Not working on text between two tables -

this not average vlookup error. i have 2 power query tables i've setup. 1 coming csv file list of names. other website pulling list of names. i.e. =john smith = john smith not true reason. they vlookup should able find name easily. i've tried proper,upper, clean, trimming , text columns , else think of. i've changed data types no avail. i know 1 query causing issue. can type name , vlookup one, , works. second query doesn't return on typed text. anyone encounter issue while using power query? edit: see jeeped's answer - when replace space web query normal space works. @jeeped's comment has answer: assuming have trimmed off leading , trailing spaces, 1 of john smith entries (likely 1 web) uses non-breaking space (e.e. char(160) or ascii 0×a0) instead of regular space (e.g char(32) or ascii 0×20). use =code(mid(a$1, row(1:1), 1)) on both, fill down ascii code each letter , compare numbers.

javascript - Should a video that is not attached to the DOM autoplay? -

here 3 scenarios: document.adoptnode , document.importnode , document.createelement +assign props. in each case video autoplays though it's not attached dom. inconsistent behavior of <script> element wouldn't eval/download until it's attached dom. should video autoplay? https://gist.run/?id=cb657718c3b6b34c043b34f3356d5a84 <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>gistrun</title> </head> <body> <template> <video src="http://video.webmfiles.org/big-buck-bunny_trailer.webm" loop controls autoplay> </video> </template> <script> let template = document.queryselector('template'); // scenario 1: (causes autoplay) document.adoptnode(template.content); // scenario 2: (causes autoplay) // document.importnode(template.content, true); // scenario 3: (causes auto...

ios - How do I associate a firebase sub-entry to a main entry? (explanation in comments) -

the json: { "coffee-shops" : { "-kj4i4d-jrqrzc9wp42c" : { "coffeeshopname" : "starbucks", "coffeeshoprating" : 3.5, "-kj4vvb51wx9npektjxq" : { "coffeeshopname" : "starbucks", "coffeeshoprating" : 1, "coffeeshopreview" : "r", "coffeeshopreviewername" : "charles" }, "-kjej6mpqwohcay_9k6v" : { "coffeeshopname" : "starbucks", "coffeeshoprating" : 4, "coffeeshopreview" : "b", "coffeeshopreviewername" : "charles" } } }, "users" : { "02a54e06-9635-4e22-9bb7-c0ddcd9c6f4f" : { "email" : "charles@gmail.com", "provider" : "password", "username" : "thecoffeeguy" }, "03fe2c17-3c66-442c-a...

sql server - Insert arbitrary number of rows into a table -

i have stored procedure doing merge , updating several tables new ids etc. what trying record items , related items table in case needs reverted. have data ready transferred sitting in multiple temporary tables in stored procedure, have blank table ready receive data don't know how i'm going insert in there..... the number of items maybe 1 or maybe 10.....anyone ideas on how might achieve this? ok reason slipped mind, im doing in same sp :) insert [tblmytable]([field1]) select [datafield] [tbldatatable] very easy :)

java - Better practice for custom rows and cells in a tableview JavaFX -

Image
i made table-view looks following: for doing made following: 1.- create , observable list of pojo represents table "modulo" in mysql database, list created columns of table-view code: public observablelist<modulo> cargatablahabilitadosmashoras(connection conex){ observablelist<modulo> listamod = fxcollections.observablearraylist(); string sql = "select id_mod, nombre_mod, \n" + " turno_mod, capacidad_mod, id_us, \n" + " status_mod \n"+ "from modulo;"; //static first column listamod.add(new modulo("123", "horario", "rhut", 10, "123", true)); try(preparedstatement stta = conex.preparestatement(sql); resultset res = stta.executequery()) { while (res.next()) { if (res.getboolean("status_mod")) { listamod.add(new modulo( res.getstring ("id_mod...

javascript - Understanding the AngularJS Approach to component-based architecture -

recently dived project using angularjs , found myself in world of mess. having hard time trying understand how angular should applied project. a little background project, have multiple sections needs loaded @ start. think of spa has tall content multiple sections. in these sections, i'm trying include components/directives. may contain parent-child components/directives or siblings components/directives. i love concept of modularising them have no idea how can let them communicate each other. parent-child directives/components, understand can use includes/requires. but if had sibling components, e.g. preloader , carousel gallery component, can't find way let them talk each other. suspect understanding of approach , architecture totally wrong. please enlighten me , put me in right direction of how tackle situation. thanks guys. since 1.5 there components . can read in docs, should have ins (denoted < binding) , outs ( & ). when want 2 sibling ...

c - Array size without sizeof operator -

i trying understand program below, it's not clear me. #include<stdio.h> int main() { int a[]={1,2,3,4,5,6,9}; printf("sizeof array %d\n",sizeof(a)); printf("size of array using logic %d\n",((&a)[1]-a)); printf("value of (&a)[1] %p \n",(&a)[1]); printf("value of %p \n",a); printf("address of a[0] %p\n",&a[0]); printf("address of a[1] %p\n",&a[1]); printf("address of a[2] %p\n",&a[2]); printf("address of a[3] %p\n",&a[3]); printf("address of a[4] %p\n",&a[4]); printf("address of a[5] %p\n",&a[5]); printf("address of a[6] %p\n",&a[6]); } above code output : sizeof array 28 size of array using logic 7 value of (&a)[1] 0x7ffc4888e78c value of 0x7ffc4888e770 address of a[0] 0x7ffc4888e770 ...

html - How to store an image url received from server to variable in angular js and ionic -

i trying image url response object , store in variable here code getting image url server $http.post("http://aflaree.com/apmsservice/securityservice.svc/availablefacility",loginid) .success(function(response){ console.log(response); console.log(response.facility); console.log(response.facilityimage); $scope.img = response.facilityimage; console.log($scope.img); }) .error(function(response){ console.log(response); }); here response above post method. here html planing display image <div > <img ng-src="{{img}}"> </div> issues i able store or view log field response except facilityimage field. some how if able store image $scope.img using 2 way data binding able show image in html page if there other way make access of image url form facilityimage please let me know how show image view. facilityimage attribute of facility, therefor...

javascript - Failed DOM-based XSS. Inserting script throght innerHTML -

i wanted show students example of dom-base xss attack. thought inserting malicious script innerhtml enough. surprise when insert script seems not invoked. example here https://jsfiddle.net/vo9baffu/6/ example my question: possible dom-based xss attack in way presented in example. if not way , should change? btw. if know examples of dom-based xss please post in comment. briefly : can't make dom-based xss attack in way presented in example. you have include jquery in html , use html() method instead. will accomplish ask for, because html() method evaluate code embedded in script tag. with pure javascript, can't make xss attack, because script insert not execute in cases. happens, because inline script executes when original page parsed. you can show students xss attack using img tag , error event shown below: <img src="whatever.png" onerror="alert('xss')" /> as shown in fiddle .

JSON Response Using Retrofit on Android -

Image
i'm able json response using okhttp3, , want use retrofit parse response name , image it. looked retrofit website , tutorials, still process not clear. here okhttp3 code json response: request request = new request.builder().url(url).build(); client.newcall(request).enqueue(new callback() { @override public void onfailure(call call, ioexception e) { e.printstacktrace(); } @override public void onresponse(call call, response response) throws ioexception { if (!response.issuccessful()) throw new ioexception("unexpected code " + response); headers responseheaders = response.headers(); (int = 0, size = responseheaders.size(); < size; i++) { system.out.println(responseheaders.name(i) + responseheaders.value(i)); } system.out.println(response.body().string()); string jdata = response.body().string();// want parse jdata u...