Posts

Showing posts from September, 2015

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -

i'm geting started tensorflow,followed tutorials,but cannot download mnist data. import tensorflow tf tensorflow.examples.tutorials.mnist import input_data mnist=input_data.read_data_sets("mnist_data/",one_hot=true) print("download done!") error information: extracting mnist_data/train-images-idx3-ubyte.gz traceback (most recent call last): file "/home/sj/program/tesorflow_try.py", line 6, in <module> mnist=input_data.read_data_sets("mnist_data/",one_hot=true) file "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/learn/python/learn/datasets/mnist.py", line 213, in read_data_sets train_images = extract_images(f) file "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/learn/python/learn/datasets/mnist.py", line 60, in extract_images buf = bytestream.read(rows * cols * num_images) file "/usr/lib/python2.7/gzip.py", line 268, in read self._read(readsize) file

ios - Pass NSDictionary from Javascript to Objective-c in JavascriptCore -

i'm using javascriptcore in app. now, i'm passing variables jscontext can passed objective-c. however, 1 of variables, nsdictionary, not passing through correctly. run code below: var evaluate = function(variables) { app.setdictionary(variables.dictionary); } this simple example has these following methods set in jscontext . this setdictionary() method: - (void)setdicationary:(nsdictionary *)dictionary { self.mutabledictionary = [dictionary mutablecopy]; } this variables.dictionary : - (nsdictionary *)dictionary { return self.values; } and how call evaluate() : jsvalue *jsfunction = self.context[@"evaluate"]; jsvalue *value = [jsfunction callwitharguments:@[self.variables]]; however, in setdictionary method, don't nsdictionary, instead nsstring containing [object object] . any ideas how can solve this? although javascriptcore automatically converts types between objective-c or swift , javascript, suggest implement ex

java - How to handle special characters while unmarshalling xml in JAXB -

my test xml content <p id="033" num="03">geopotent change&#x2 high.</p> and run jaxb unmarshalling, i'm getting exception 09:58:43.748 error [main][net.serviceimpl] parsing error: javax.xml.bind.unmarshalexception- linked exception: [javax.xml.stream.xmlstreamexception: parseerror @ [row,col]: [161,306]message: string "&#] my jaxb unmarshal source jaxbcontext jaxbcontext = jaxbcontext.newinstance(cndocument.class); unmarshaller jaxbunmarshaller = jaxbcontext.createunmarshaller(); document = (cndocument) jaxbunmarshaller.unmarshal(xmlfile); how can escape characters? (&#x2) you jaxb parse error because xml content not well-formed. should &#x2; (with semicolon), not &#x2 .

listview - Dismissible item on a list in Android -

Image
do know, what's best practice implement dismissible item on recyclerview or listview? can see ui pattern e.g. in settings app close datasaver.

html - Syntax "Number.isFinite" don't work with Chutzpah -

Image
it doesn't work use syntax code "number.isfinite" in relation chutzpah. is supposed be? thank you! chutzpah uses phantomjs running js , current version of phantom not support this. new version (2.5) should coming out , when update chutzpah resolve issue.

nunit - Specflow Html report throwing errors -

Image
i getting errors when running specflow html report. have created specflow project nunit, have created nunit xml report want convert in html report. when run in command prompt, getting error. please let me know mistake making. i ran nunit3-console.exe --labels=all --out=testresult.txt "--result=testresult.xml;format=nunit2" "c:\users\senthil\documents\visual studio 2015\projects\unittestproject12\test123\bin\debug\test123.dll" then ran specflow.exe nunitexecutionreport test123.csproj /out:myresult.html throwing errors

javascript - How to maintain the font color after inserting <br> tags in a contenteditable div? -

first of , in contenteditable div , if user presses enter , want have gap of line , therefore following code. <div contenteditable="true" class="doc"></div> <script> $('.doc').keydown(function(e) { if (e.keycode == 13) { document.execcommand('inserthtml', false, '<br><br>'); return false; } }); </script> now , using tooltip ,which appears on double clicking word in div, if set font color red , remains red till press enter i.e. changes black press enter. wanted use same option change color red , same revert black, below. i=0; function setcolor() { if(i==0) { document.execcommand('forecolor',false,'#f00'); i=1; } elseif(i==1) { document.execcommand('forecolor',false,'#000000'); i=0; }

javascript - Is it possible to trigger an click event, which will be registered by Google Tag Manager by using the .trigger() function? -

i got task, in have implement advanced tracking functionality sorts of forms, using google tag manager. thoughts now, create hidden anchor tag , append point in dom on load. giving anchor tag specific classes , ids based on page- , contenttype, each 1 of them unique. now tried following: gave anchor tag class "gtmanalyticslink", wanted use trigger filter in google tag manager interface. main goal of task possibility of analyzing process of filling out forms , other defined tasks, user can on website. @ steps of form, change text of anchor tag filling in current events (e.g. "invalid input in field xyz") , trigger click event using trigger() function, these clicks not recognized clicks google tag manager while being in preview mode. now question is, possible google tag manager register click events not fired natively (by user), trigger("click")? thanks in advance! patrick

dotnetnuke - How do I prevent a user from using special characters in display name on DNN -

Image
how prevent user using special characters in display name on dnn? i have managed right username using below, doesn't work, though dnn text indicates field meant apply username , display name. in site settings, tab "user account settings" can find setting "user name validation". there can add validation expression. think regex. happy dnning! michael

Python variable assignment changes value -

i network engineer trying learn python programming job requirement. i wrote code below # funtion chop first , last item in list def chop(t): t.pop(0) , t.pop(len(t)-1) return t when run function on list t , assign variable a. gets remainder of list after function executed , becomes new list.this works perfect. >>> t = ['a', 'b', 'c', 'd', 'e' ,'f','g','h','i','j','k','l'] >>> a=chop(t) >>> ['b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k'] >>> later when try works value of changes output of print chop(t) whereas did not run variable through function chop(t). can explain why happen? >>> print chop(t) ['c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'] >>> ['c', 'd',

jquery - unable to delete record with php and ajax -

i'm trying delete record row id table using php , ajax when click on button neither shows error nor performs action. here delete.php code: <?php session_start(); include 'db.php'; if(isset($_get['name'])){ $user = $_get['name']; $query = mysqli_query($con, "select * login username='$user'") or die (mysqli_error()); $result = mysqli_num_rows($query); while($row = mysqli_fetch_array($query)){ $_session['user'] = $row['username']; } } $query = mysqli_query($con, "select * pm touser = '".$_session['user']."' order pmdate desc" ) or die (mysqli_error()); $result = mysqli_num_rows($query); while($row = mysqli_fetch_array($query)){ $id = $row['id']; $delquery = mysqli_query($con, "delete * pm id ='$id'") or die (mysqli_error()); $delresult = mysqli_num_rows($delquery); } ?> and here ajax , delete code of html <a href="home.php?name='

java - JScrollBar + JTextPane with HTML not properly scrolling to maximum value -

i have following problem in project of mine, took me while figure out whats causing problem, , can reproduce simple code attached. i dynamically adding content jtextpane htmleditorkit. set autoscroll off because want control manually (when user scrolled up, stop, , when event triggered activated again). the problem is, when set value of jscrollbar it's maximum value, it's different one, moment, after having content inserted htmldocument. when trigger setvalue again second time manually, scrolls correct maximum value. it seems jscrollbar not aware correct maximumvalue right after adding htmldocument, , (delayed) time later. using caret.setupdatepolicy(defaultcaret.always_update); is not solution, because doesn't work properly. doesn't scroll maximum value too, leaving view pixel below, don't want. here full code reproducing issue. if click on right button (add & scroll), inserts div element body. moment last visible line reached, doesn't scr

python - "Apps aren't loaded yet" and "django.core.exceptions.ImproperlyConfigured" in Django? -

Image
this directory structure of django project. when running python code of importing model: from scraping.models import linkvendorstandard file "framework_product_processing.py" throws exception: django.core.exceptions.improperlyconfigured: requested setting default_index_tablespace, settings not configured. must either define environment variable django_settings_module or call settings.configure() before accessing settings. when add code: import django django.setup() to initialize django project settings, exception: django.core.exceptions.appregistrynotready: apps aren't loaded yet. i have following 2 questions behavior: the file:"framework_product_process.py" in django project structure @ same level "views.py" can access model without having setup django project.if file accessible same python path of view why django.core.exceptions.improperlyconfigured ? even after adding import django;django.setup() code why django.core.exception

mysql - PHP Does not let me query a table -

Image
i have database can make queries tables without problems except 'employees' table. tried making basic query in php: <?php error_reporting(0); require "init.php"; $sql = "select * empleados;"; $result = mysqli_query($con, $sql); $response = array(); while($row = mysqli_fetch_array($result)){ $response[]=$row; } echo json_encode($response); ?> ... , not results. when run query other tables, works well, can be? this same query works fine phpmyadmin news: if use select dni empleados works, if use select * empleados doesn't.... (dni key, possible can access primary key?) be careful special characters such spanish accents, if remove these query works correctly

module - Difference between stock_move and stock_picking on Odoo(Openerp) ? -

can please tell me what's difference between stock_move & stock_picking ? if stock_move trace mouvements of products location why using stock_picking ? stock_picking collection of stock_move. normally, when stock_picking created, includes many items in , each line in picking stock move. stock_picking done when stock_moves in picking done. same concept sale_order , sale_order_line

server - http request stops at dynamic dns -

i have server running @ home host small site home project. can access via internet using dynamic dns. want send http request (ifttt maker) using same way, stop @ dynamic dns server. if response dynamic dns just <frameset rows="100%,*"> <frame frameborder="0" src="http://#myipadress"> </frameset> and if send request site (like submit button) automatically redirected " http://#myipadress ?query". how can http request follow dynamic dns redirects?

c# - searching for mulitple columns in a dataGridView -

i have code searching specific column name or column number in datagridview : string str = kartsearchtxt.text; string value = ""; (int = 0; < datagridview1.rows.count; i++) { value = datagridview1.rows[i].cells[3].value.tostring(); if (value.contains(str) == false) { datagridview1.rows.removeat(i); i--; } } } i've tried diffrent solutions having "2 loops " searching through columns aswell , didnt work . how can search through multiple columns ? in advance use loop this for (int = datagridview1.rows.count - 1; >= 0; i--) { foreach (datagridviewcolumn column in datagridview1.columns) { if (!column.visible || column.displayindex < 0) continue; value = datagridview1.rows[i].cells[column.displayindex].value.tostring(); if (value.contains(str) == fals

stop my idle remote desktop session form being logged out on windows server 2012 r2 -

i'm running performance tests virtual windows 2012 r2 server. tests take several hours run, if remote desktop session disconnected or idle more ~30 minutes, when reconnect using mstsc.exe login again , existing session either logged out @ point, or has expired during intervening period. i've used gpedit.msc on server set idle session timeout remote desktop never , restarted server - i'm still seeing same behavior. ideas? note: i'm not admin on server, normal user permissions. i've enabled "set time limit disconnected sessions" , set "never" under 'computer configuration' - suggests dominant setting, , there's no overriding group policy.

swift - How to know the account used for google sign in ios sdk -

i have integrated google sign in sdk in ios forgot account did it. i have configuration file , client id , reverse client id so how can know google account used create sign in. for getting user details of logged in user can use api https://www.googleapis.com/gmail/v1/users/me/profile for more details refer link

java - SunCertPathBuilderException => Maven JAXB2 generation with certificate -

i'm using maven-jaxb2, generate classes make calls webservice. <plugin> <groupid>org.jvnet.jaxb2.maven2</groupid> <artifactid>maven-jaxb2-plugin</artifactid> <version>0.12.3</version> <configuration> <schemalanguage>wsdl</schemalanguage> <schemas> <schema> <url>https://my-secured-webservice.com/file?wsdl</url> </schema> </schemas> <generatedirectory>src\main\java</generatedirectory> <verbose>true</verbose> </configuration> <executions> <execution> <phase>generate-sources</phase> <goals> <goal>generate</goal> </goals> </execution> </executions> </plugin> the wsdl needs certificate correctly installed on machine. c

java - Passing class name as a parameter -

i have following function public void loadwindowandsenddatatest(string path, string appname, connectiondata connectiondata) { try { stage subwindow = new stage(); subwindow.initmodality(modality.application_modal); fxmlloader loader = new fxmlloader(); parent parent = loader.load(getclass().getresource(path).openstream()); exitcontroller exitcontroller = (exitcontroller) loader.getcontroller(); exitcontroller.getconnectiondata(connectiondata); scene scene = new scene(parent); subwindow.setscene(scene); subwindow.settitle(appname); subwindow.show(); } catch(ioexception e) { e.printstacktrace(); } and i'd achive have more general function can pass class name (in case exitcontroller), this: public void loadwindowandsenddatatest(string path, string appname, connectiondata connectiondata, string classname) { try { stage subwindow = new stage(); subwindow.in

php - LAMP with Varnish intermittent 302 redirects -

i've got php website sites behind varnish , i'm getting 16/17 302 redirect same page. for example user visits https://www.example.com/page.php?some_query_string=multiple , sometimes, redirected same page on , on again (around 16/17 times) before settling on same page. firstly noticed happening wanted add code track when visited page.php. finding function called multiple times 1 page visit. checking apache logs can see it's 302 redirect causing issue. any ideas on cause of , how trace route course. strange thing doesn't happen on every visit of page.php, time time.

php - Smarty - Fill a table with Arrays -

in php class i'm sending on arrays, every contract customer has row in table should filled. got mistakes date: on line 70 "{$date[$id] | date_format: %d %m %y}" - unexpected "|" also errors other arrays <table class="table table-hover"> <thead> <tr> <td>id</td> <td>datum</td> <td>preis</td> <td>verbrauch</td> <td>abnahmestellen</td> <td>status</td> </tr> </thead> <tbody> {foreach from=$contractcount item=item key=key} <tr> <td> <a href="{system::getlink('contractview')}"><input type="button" style="text-align: center" width="200em" valu

javascript - Json is not validating with file content? -

i have tested json data normal content working fine. s ample data below: working json { "language": "xyz", "content": { "gen": "this test", "exo": "this test" } } not working json { "language": "xyz", "content": { "gen": "\id gen\n\c 1\n\p\n\v 1 in beginning god created heavens , earth.\n\v 2 , earth without form , void form.", "exo": "\id exo\n\c 1\n\p\n\v 1 these names of children of israel, came egypt; every man , household came jacob\n\v 2 reuben, simeon, levi, , judah" } } check screenshot working , not working json for escape sequences, can convert object json string , parse below this var obj= { "language": "xyz", "content": { "gen": "\id gen\n\c 1\n\p\n\v 1 in beginning god created heavens , earth

android - button visibility on bottom sheet behavior change -

i have button called share on bottomsheet ,now want button visible if state expanded , in other state button should not visible. here code have tried. if (mbottomsheetbehavior.getstate() == bottomsheetbehavior.state_expanded) {share.setvisibility(view.visible);} if(mbottomsheetbehavior.getstate()==bottomsheetbehavior.state_collapsed){share.setvisibility(view.gone);} if(mbottomsheetbehavior.getstate()==bottomsheetbehavior.state_settling){share.setvisibility(view.gone);} if(mbottomsheetbehavior.getstate()==bottomsheetbehavior.state_settling){share.setvisibility(view.gone);} but when drag bottomsheet expand or collapse nothing happens , there correct way don't know you can try this mbottomsheetbehavior.setbottomsheetcallback(new bottomsheetbehavior.bottomsheetcallback() { @override public void onstatechanged(view bottomsheet, int newstate) { if (newstate == bottomsheetbehavior.state_expanded) { share.setvisibil

apache - Configuring ssl to work with nginx -

i'm having challenge making sure ssl works website hosted on ec2 being managed via serverpilot. the following http config server: server { listen 80; listen [::]:80; server_name example.net www.example.net ; root /srv/users/serverpilot/apps/app/public; access_log /srv/users/serverpilot/log/app/example_nginx.access.log main; error_log /srv/users/serverpilot/log/app/example_nginx.error.log; proxy_set_header host $host; proxy_set_header x-real-ip $remote_addr; proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for; include /etc/nginx-sp/vhosts.d/example.d/*.nonssl_conf; include /etc/nginx-sp/vhosts.d/example.d/*.conf; } in vhosts.d folder i've created following ssl version of website: server { listen 443 ssl; listen [::]:443 ssl; server_name www.example.net example.net ; ssl on; ssl_certificate /etc/letsen

java - In Selenium Webdriver, click button once the text is entered in text box -

i trying build selenium automation framework gmail. have installed below tools: jdk, eclipse, selenium jars, gradle, testng i trying login gmail. cam getting below error time enter username. trying click "next" button before username entered. can use wait ever required while developing framework? need maintain standards while calling wait . write user defined wait methods. error: failed: gmailloginshouldbesuccessful org.openqa.selenium.elementnotvisibleexception: cannot click on element (warning: server did not provide stacktrace information) command duration or timeout: 207 milliseconds my code: @test public void gmailloginshouldbesuccessful(){ //1.go gmail website system.setproperty("webdriver.ie.driver", "c:\\selenium_softwares_docs_videos\\iedriverserver_x64_3.1.0\\iedriverserver.exe"); webdriver driver = new internetexplorerdriver(); driver.manage().deleteallcookies(); driver.manage().window().maximize(); driver

java - Can't draw oval on JPanel -

i'm trying draw ovals on jpanel when mouse clicked. code doesn't call paintcomponent, nothing happens on jpanel. part i'm missing? public class main extends jframe implements mouselistener{ jpanel thepanel = new jpanel(){ @override protected void paintcomponent(graphics g) { super.paintcomponent(g); g.setcolor(color.red); (circle c : circles){ g.filloval(c.x, c.y, c.diameter, c.diameter); system.out.println(c.x + "a"); } } }; jframe frame=new jframe(); int x,y; arraylist<circle >circles = new arraylist<circle>(); public static void main(string[] args) { swingutilities.invokelater(new runnable() { @override public void run() { new main(); } });

ios - How can I test an authentication challenge? -

dear fellow citizens of earth. i'm requesting real life example can test authentication challenge code snippet found below. if it's not possible appreciate suggestions on can validate it. i have feeling code working: - (void)webview:(wkwebview *)webview didreceiveauthenticationchallenge:(nsurlauthenticationchallenge *)challenge completionhandler:(void (^)(nsurlsessionauthchallengedisposition, nsurlcredential * _nullable))completionhandler { nsstring *host = webview.url.host; nsstring *authenticationmethod = [[challenge protectionspace] authenticationmethod]; if ([authenticationmethod isequaltostring:nsurlauthenticationmethoddefault] || [authenticationmethod isequaltostring:nsurlauthenticationmethodhttpbasic] || [authenticationmethod isequaltostring:nsurlauthenticationmethodhttpdigest]) { nsstring *title = @"authentication challenge"; nsstring *message = [nsstring stringwithformat:@"%@ requires username , p

php - WordPress is declaring JQuery in the Footer -

i've been handed wordpress (wp) site 3rd party. work drupal, i'm not well-rounded in wp. that said, i'm attempting install google tag manager (gtm). however, i'm getting console errors, stating jquery not defined. i've discovered jquery defined in <footer> , not <head> . i've had issue in past drupal, i'm not sure begin wp. after looking @ template, i've discovered there <?php wp_head(); ?> tag in head , there <?php wp_footer(); ?> tag in footer. both tags inject scripts, obviously, jquery injected through footer tag. can tell, scripts compiled in script-loader.php document, document little overwhelming. i'm not sure move around in order jquery injected through <?php wp_head(); ?> tag. i've uploaded script-loader.php document google drive . i'll put .txt file it's readable within gdrive. please let me know if there's else can provide. helpful feedback appreciated! you want register

multithreading - Where is my program waiting? -

i have delphi 10 multithreading application blocking calls. when exit not unloaded ram , delphi debugger isn't stopped. how (tool, method) detect in routine app waiting? hit pause button (run, program pause) show threads window (view, debug windows, threads or ctrl+alt+v ) double-click on each thread in turn , inspect call stack (view, debug windows, call stack or ctrl+alt+s ) look routines in call stack , evaluate evidence see before when perusing code @ top of call stack, in source files sometimes more informative run above steps debug dcus enabled (project, options..., delphi compiler, compiling, use debug .dcus), , runtime packages disabled (project, options..., packages, runtime packages, link runtime packages)

Ruby access nested attributes with symbol -

i'm trying write method takes an object , a symbol (or else, here's question) , "upcases" value @ key (for example). simple case: foo = { a: 'hi', b: 'there' } def upc_value(object, key) object[key].upcase! end upc_value(foo, :b) puts foo #=> { a: 'hi', b: 'there' } but want method work nested attributes if foo object more complex. more complex case: foo = { a: 'hi', b: [{ c: 'foo', d: 'bar' }, { c: 'bob', d: 'lisa' }] } def upc_value(object, key) object[key].upcase! end # able like: upc_value(foo, :b[:d]) puts foo #=> { a: 'hi', b: [{ c: 'foo', d: 'bar' }, { c: 'bob', d: 'lisa' }] } i can't , i'm curious if "deep_symbol" exists... real problem: real thing i'm trying achieve here module removes host every field contains url before model saved. it's included in every model needs , c

Python (3.6.1) keypress detection and popups -

im kinda new python , tried printing key when pressed on windows , show key in popup message: import msvcrt import ctypes # included library python install. def mbox(title, text, style): ctypes.windll.user32.messageboxw(0, text, title, style) while true: if msvcrt.kbhit()== true: key = msvcrt.getch() print(key) # show result mbox(key, key, 1) and problems are: 1) output if press key diffrent, example :" a " " b'a' " why? , how can change " a "? (the output on popup weirder : 1x when press 1 or 2*x when press 2) 2) while true: makes code run time, , keeps detecting if key has been pressed? 3) there lib python detects key-press windows , linux altogether? thank's alot. ok found answers: 1) msvcrt.getwch() wide char variant of getch(), returning unicode value. read more at: https://docs.python.org/3.6/library/msvcrt.html 2) guess yes, if can confirm ill glad. 3) not know, the

angularjs - How to pass row.entity inside celleditablecondition in UI-grid? -

i trying set celleditablecondition based on content of other cell in same row. for how pass row.entity celleditablecondition? i tried passing row arguement function defined oncelleditablecondition row object not have entity property. i want below: columndefs: [{ name: 'column1', field: 'name', celleditablecondition: function(row) { return row.entity.lastname === 'adams' } }, { name: 'column2', field: 'lastname' }] this small tweak code should it: var app = angular.module('app', ['ui.grid', 'ui.grid.edit']); app.controller('mainctrl', ['$scope', function($scope) { $scope.gridoptions = { columndefs: [{ name: 'column1', field: 'name', celleditablecondition: function(scope) { return scope.row.entity.lastname === 'adams' } }, { name: 'column2', field: 'lastname'

java - How to create a package in Cognos - SDK? -

i have been trying create package cognos via sdk. so far good. can created package cannot add datasource package. basicly not anything. i getting: ans-mes-0003 server error occurred. unable complete action. when launching package analysis studio. if using iis, may not getting underlying issue because iis intercept error. error may bad permissions or corrupt user data, error code returned seems umbrella specifics. as outlined in troubleshooting page , can see original error setting httperrors passthough. replace: <httperrors lockattributes="allowabsolutepathswhendelegated,defaultpath"> <error statuscode="401" prefixlanguagefilepath="%systemdrive%\inetpub\custerr" path="401.htm" /> <error statuscode="403" prefixlanguagefilepath="%systemdrive%\inetpub\custerr" path="403.htm" /> <error statuscode="404" prefixlanguagefilepath="%systemdrive%\inetpub\cus

ruby on rails - How translate serialize type with dash to model slashed structure? -

my api in rails ams (json:api) return serializer type name dash ( artemis-forum-disputes ), inside frontend app, uses ember, store models subdirectory structure ( artemis/forum/disputes ). warning: encountered resource object type "artemis-forum-disputes", no model found model name "artemis-forum-dispute" (resolved model name using 'apollo-enterprise@serializer:application:.modelnamefrompayloadkey("artemis-forum-disputes")'). how solve this? thanks. you can tell ember data model use overriding modelnamefrompayloadtype method on serializer. if override method in application serializer , have transform dashes slashes ember should able find models in subdirectory. // app/serializers/application.js // or app/application/serializer.js import ds 'ember-data' export default ds.jsonapiserializer.extend({ modelnamefrompayloadtype(payloadtype) { return payloadtype.replace(/-/g, '/'); } });

C++ ->Trying to read a line of text word by word. How to make a pointer equivalent of the current 2 dimensional array used to store the input -

wrote program read user input, word word #include<iostream> #include<cstring> int main() { using namespace std; int i=0; char input[50][50]; cout<<"enter input: "; cin>>input[i]; while(strcmp("q",input[i])) { i++; cin>>input[i]; } cout<<endl; for(int j=0;j<i;j++) cout<<input[j]<<" "; return 0; } currently using two-dimensional character array store input. i'm not pointers since read those. is there pointer equivalent of char input[50][50] ? know range of [50] bad idea. using pointers should solve right? i tried doing this-> char* input= new char[50] , guess wrong way? char* input= new char[50] create pointer array of strings or pointer array of characters? please keep simple. started arrays. char* input= new input[50]; wrong; char * input = new char[50]; correct. its creates dynamic 1d array of charact

twitter - bootstrap elements overlapping -

i have simple bit of bootstrap in vue.js file. the <div v-for="location in 5"> prints 5 font awesome icons next "location:" works fine of responsive cases,however whilst dragging screen around font awesome icons overlap location text(when between md , sm predict). still happens if wrap in container. has insight why? thanks <div id="location-section" class="section"> <div class="row"> <div class="col-md-3"> <div >locations:</div> </div> <div v-for="location in 5"> <div class="col-md-3 "> <i class="fa fa-flag" aria-hidden="true"></i> </div> </div> </div> </div> that's because using col-md-3 . makes responsive screen sizes greater 991px, hence having issue. use col-xs-3 make responsiv

jquery - Print iframe with pdf src in mozilla firefox -

jquery script function printpdf(url) { var iframe = this._printiframe; if (!this._printiframe) { iframe = this._printiframe = document.createelement('iframe'); document.body.appendchild(iframe); iframe.style.display = 'none'; iframe.onload = function () { settimeout(function () { iframe.focus(); iframe.contentwindow.print(); }, 1); }; } iframe.src = url; } above script work in chrome in mozilla that's download pdf not print

c# - How to marshall LPSTR** in .NET? -

i have method in unmaged com object i'm trying marshall: stdmethod(somemethod)(lpstr** items, int* numofitems) = 0; but can't figure out right way marshal out lpstr** items. it's supposed list of items. if try this: [preservesig] int somemethod([marshalas(unmanagedtype.lpstr)]ref stringbuilder items, ref uint numofitems); i first letter of first item , nothing else. how can marshal lpstr** variable correctly? i cannot check right now, signature should this: [preservesig] int somemethod( [marshalas(unmanagedtype.lparray, arraysubtype = unmanagedtype.lpstr, sizeparamindex = 1)] out string[] items, out int numofitems); of course, doesn't help, can perform manual marshalling via marshal class (as sinatr suggested).

Android - Pass "edit text" element value between tabbed fragments -

i have activity multiple swipe tabbed fragments. each fragment has check-boxes, edit text , switch fields. want navigate through tabs, edit state of fields on last tab collate information within elements , save these details database. my problem don't know how save these elements values , pass them last tab in order stored. i quite newbie android apps hint or answer appreciated. here how code looks far: activity: public class icontexttabsactivity extends appcompatactivity { private toolbar toolbar; private tablayout tablayout; private viewpager viewpager; private int[] tabicons = { r.drawable.ic_tab_favourite, r.drawable.ic_tab_call, r.drawable.ic_tab_contacts, r.drawable.ic_vector_test }; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_icon_text_tabs); toolbar = (toolbar) findviewbyid(r.id.toolbar); setsupportactionbar(toolbar);

r - Group By then Aggregate -

i working several large data frames , need sort data first , last entry boat , net. data frame looks this: boat net datetime dawn 71 2014-07-10 10:10 dawn 71 2014-07-15 11:10 whip 71 2014-07-17 08:10 whip 71 2014-07-29 12:36 dawn 71 2014-08-24 14:53 whip 71 2014-09-02 11:17 whip 73 2014-09-14 16:24 whip 71 2014-09-15 18:16 whip 73 2014-09-17 20:25 i need dataframe include first , last entry each net boat. data should looks this: boat net datetime dawn 71 2014-07-10 10:10 whip 71 2014-07-17 08:10 dawn 71 2014-08-24 14:53 whip 73 2014-09-14 16:24 whip 71 2014-09-15 18:16 whip 73 2014-09-17 20:25 i tried couple of different things , got close not quite there. head <- aggregate(df, = list(df$net), fun = head, n = 1) tail <- aggregate(df, = list(df$net), fun = tail, n = 1) final <- rbind(head, tail) this worked not ta

objective c - Music control for info center in iOS using Cordova plugin -

i have tried import following cordova plugin music control in ios: https://github.com/homerours/cordova-music-controls-plugin with following method: - (void) create: (cdvinvokedurlcommand *) command { nsdictionary * musiccontrolsinfodict = [command.arguments objectatindex:0]; musiccontrolsinfo * musiccontrolsinfo = [[musiccontrolsinfo alloc] initwithdictionary:musiccontrolsinfodict]; if (!nsclassfromstring(@"mpnowplayinginfocenter")) { return; } [self.commanddelegate runinbackground:^{ mpnowplayinginfocenter * nowplayinginfocenter = [mpnowplayinginfocenter defaultcenter]; nsdictionary * nowplayinginfo = nowplayinginfocenter.nowplayinginfo; nsmutabledictionary * updatednowplayinginfo = [nsmutabledictionary dictionarywithdictionary:nowplayinginfo]; mpmediaitemartwork * mediaitemartwork = [self createcoverartwork:[musiccontrolsinfo cover]]; nsnumber * duration = [nsnumber numberwithint:[musiccontrols

safari - webkit vs custom elements v2 -

is webkit trying accomplish same thing custom elements v2 ? https://webkit.org/ https://developers.google.com/web/fundamentals/getting-started/primers/customelements if safari ever support custom elements? apple dev's website claims will, reference 'webkit' , not 'custom elements'. makes me worried safari 10.1 still not run 'custom elements' programmed website. true or false? https://developer.apple.com/library/content/releasenotes/general/whatsnewinsafari/articles/safari_10_1.html if safari never support custom elements, know of 'wrapper' or way write custom elements 1 source-code base, have website run on safari? why google chrome today (march 28,2017), supports custom elements, not render ipad, work fine when using browser mac? is webkit trying accomplish same thing custom elements v2 ? webkit, safari's web engine, trying implement custom elements v1. if safari ever support custom elements? yes , @ leas

node.js - Different sessionID after server restart express -

this question has answer here: express 4 sessions not persisting when restarting server 1 answer i've noticed noticed when restart express server, session id saved on browser updated new value. normal behavior? can configure? these current express-session options: var sessionoptions = { secret: "secret_here", resave: false, saveuninitialized: true, cookie: { maxage: 86400000 } } as stated in docs : each session has unique id associated it. you can override function generates id setting genid property. app.use(session({ genid: function(req) { return genuuid() // use uuids session ids }, secret: 'keyboard cat' }))

python - Why doesn't findall work on the table data I pulled from javascript (using python3) -

i can 2 parts of want separately, not together. i'm using anaconda 3 distribution. the tables want dynamically loaded javascript tables , want extract them use them in pandas , sqllite3. this give me text output, delivered separate lines each cell, of information want: import sys pyqt5.qtwidgets import qapplication pyqt5.qtcore import qurl pyqt5.qtwebkitwidgets import qwebpage import bs4 bs import requests import pandas pd class client(qwebpage): def __init__(self, url): self.app = qapplication(sys.argv) qwebpage.__init__(self) self.loadfinished.connect(self.on_page_load) self.mainframe().load(qurl(url)) self.app.exec() def on_page_load(self): self.app.quit() #only run until page loads f = open('hmarathont.txt', 'w') url = 'http://results.houstonmarathon.com/2017/?page=2&event=mara&pid=search&search%5bclub%5d=%25&search%5bcompany%5d=%25&search%5bnation%5d=%25&se

Grouping data in R based on specific column values -

i have set of data in csv file need group based on transitions of 1 column. i'm new r , i'm having trouble finding right way accomplish this. simplified version of data: time phase pressure speed 1 0 0.015 0 2 25 0.015 0 3 25 0.234 0 4 25 0.111 0 5 0 0.567 0 6 0 0.876 0 7 75 0.234 0 8 75 0.542 0 9 75 0.543 0 the length of time phase changes state longer above shortened make readable , pattern continues on , on. i'm trying calculate mean of pressure , speed each instance phase non-zero. example, in output sample above there 2 lines, 1 average of 3 lines phase 25, , average of 3 lines when phase 75. possible see cases same numeric value of phase shows more once, , need treat each of separately. is, in case phase 0, 0, 25, 25, 25, 0, 0, 0, 25, 25, 0 , need record first group , second g

github - Git Hooks: Need to change a string when you merge with master -

i trying make git hook called before git merge change strings in code. can have development branch solely development , master branch resemble production. thinking post-merge script used, check see if merge master , changes. otherwise wouldn't thing. best idea? edit: need way change strings in file git knows about. in file foo.txt want change line 4 different string. i might use pre merge script, before me merging development branch master can suffix development, major bug, patch before merge master. if automated release notes ll fetch info , easy follow went release.

how to handle stale event in nginx -

these days, studying nginx source code. but there question stale event. if there coming event : #1, #2,#3 .. #40, when deal #1, #40 shut down , it's variables instance 0 , #2.#3 new connection, accept function allocate new descriptor free (#40), when deal #2, need invoke function named ngx_event_accept, , invoke ngx_get_connection, unfortunately after ,we failed mean need free connection,but have invoked ngx_get_connection once means variables instance have changed once. following code (success , failed ) void ngx_event_accept(ngx_event_t *ev) { ... /* success */ c = ngx_get_connection(s, ev->log); if (c == null) { if (ngx_close_socket(s) == -1) { ngx_log_error(ngx_log_alert, ev->log, ngx_socket_errno, ngx_close_socket_n " failed"); } return; } c->type = sock_stream; ... /* failed */ c->pool = ngx_create_pool(ls->pool_size, ev->log); if (c-&

How to send multiple string by stdin in python -

i send string router_status[router]='on' parent code new process proc[router] = subprocess.popen([sys.executable, os.getcwd() + '/' + router + '.py', router, json.dumps(graph), json.dumps(as_numbers_dict)], shell=false, stderr=true, stdin=subprocess.pipe, stdout=subprocess.pipe) proc[router].stdin.write(bytes(router_status[router], encoding='utf-8') + b'\n') and child process router_status[router]=sys.stdin.readline().strip() path = os.path.expanduser('~' + '/bgp_routers/' + router) open(path + '/router_status.txt', 'w') f: f.write(router_status[router]) but not work! , pass second string router_status[router]='off' process proc[router].stdin.write(bytes(router_s

ios - Core-Data: Parent context changes not being merged into child context -

my situation is: have multi-threaded app core-data database, managing multiple contexts. in context hieratchy have root saving context, , child contexts fetch data , make/save changes. context -> root parent context context b -> child context of a context c -> child context of a context b used fetch data , displayed in view controller's view. context c used save changes in background thread. the problem when make changes in context c, save context c , a, changes not propagated, or merged, context b. changes correctly persisted in context , c, not in b. i thought default behaviour changes in parent context propagated it's child context b, it's not happening. correct way achieve this? if working on ios 10 project can try setting automaticallymergeschangesfromparent property on context b true . for older projects have merge changes yourself: observe nsmanagedobjectcontextdidsave notification. make sure use context c object when subs