Posts

Showing posts from July, 2013

javascript - EventSource with cookies using AngularJS -

i've been looking @ using eventsource push server events client, need client able identify doesn't every event of every client. trying use cookies achieve this, somehow cookies never seem come through. can point me example creating eventsource , sending cookies request?

javascript - hash and unhash text to 20 characters -

i have text 3-100 characters, i want able hash 20 chars string, and able unhash original. security not in mind, have string limit, need full string. it's impossible. if can compress 100-characters 20 , - can compress whole internet 20 bytes :) all can - limit original alphabet , use extended hash. example, source string can alphanumeric case. it's 62 character alphabet. hash used 256 byte values can compress source 4 times.

ios - How flip page after time interval? -

i use template page-based application ( rootviewcontroller , dataviewcontroller , modelcontroller ) in xcode. want flip page after time interval. how can it? code flip next page - (uiviewcontroller *)pageviewcontroller:(uipageviewcontroller *)pageviewcontroller viewcontrollerafterviewcontroller:(uiviewcontroller *)viewcontroller { nsuinteger index = [self indexofviewcontroller:(dataviewcontroller *)viewcontroller]; if (index == nsnotfound) { return nil; } index++; if (index == [self.pagedata count]) { return nil; } return [self viewcontrolleratindex:index storyboard:viewcontroller.storyboard]; } i hope you homeviewcontroller *homevc = [[homeviewcontroller alloc] init]; uinavigationcontroller *nav = [[uinavigationcontroller alloc] initwithrootviewcontroller:homevc]; [uiview transitionfromview:self.view toview:nav.view duration:0.5 options:uiviewanimationoptiontransitionflipfromleft completion:^(bool finished) { ...

c# - Error when attempting to run SpecFlow NUnit test: "Cannot access a disposed object. Object name: 'GherkinLanguageService'" -

i setting nunit c# tests using specflow, ones declared in specflowfeature don't seem picked text explorer. when trying manually run scenario (by right-clicking on them) following error: "cannot access disposed object. object name: 'gherkinlanguageservice'" ...which doesn't ring bell @ all. has suggestion on how allow them run? the feature code follows: feature: specflowfeature user go page in order see information @ui scenario: browsing given have home page open when select menu see information @ui scenario: add asset client page given have home page open when go client page , click add download button , fill in form , choose file upload , submit form see newly-submitted file and steps definitions automatically generated. edit: list of installed nuget packages in test project: microsoft.net.compilers 1.1.0-rc1 nunit 3.4.0 ...

javascript - ReactJS Redux Live editing -

i'm trying build similar code widget example react redux universal hot example . exception data fetched postgresql database. the code lists groups should, when click on edit following errors. warning: react.createelement: type should not null, undefined, boolean, or number. should string (for dom elements) or reactclass (for composite components). check render method of `admingrouplist` error: element type invalid: expected string (for built-in components) or class/function (for composite components) got: undefined. check render method of `admingrouplist` here admingrouplist.js import react, { component } 'react'; import helmet 'react-helmet'; import { connect } 'react-redux'; import { asyncconnect } 'redux-async-connect'; import { routeactions } 'react-router-redux'; // import { table } 'react-bootstrap/lib'; import * groupactions 'redux/modules/groups'; import {isloaded, load loadgroups} 'redux/modules/groups...

osgi - How to custom event adaptor in wso2 cep 4.1.0 -

i make plug-in jarfile. , copy jarfile in dropin folder. (reference https://docs.wso2.com/display/cep410/building+custom+event+receivers ) i execute wso2 cep. command './wso2server.sh -dosgiconsole'. , 'osgi > ss event-adaptor-name' checked acitve! but wso2 management web page not exist. 'input event adapter type' of event not exist. i check 'osgi > bundle event-adaptor-id' result no registered services. how registerd service in wso2 cep? i use eclipse, not using maven. use plug-in project. exposing custom event receiver osgi service section in wso2 cep 4.1.0 documentation gives example how register custom adapter osgi service. with reference same document pointed above, following point custom adapter register under outputeventadapterfactory service. context.getbundlecontext().registerservice(outputeventadapterfactory.class.getname(), emaileventadaptorfactory, null); if registered, see ...

php - how to prevent cross site scripting - Image is linked -

Image
xss can me thid cross site scripting new in this cross-site scripting code injection attack. the problem user (or else) enters script instead of input value. example, user puts "<script>" tag in comment. if display list of comments, script executed visiting page. what need sanitize outputs, is, remove or escape html code you're writing on page. way, <script> tag replaced &lt;script&gt; , , become harmless while looking same.

sql server - Bulk insert fmt text qualifier -

i've bulk insert task takes data csv , imports table. problem 1 of columns can contain comma, import doesn't work expected. i've tried fix creating format (fmt) file, contents of i've detailed below:- 9.0 6 1 sqlchar 0 50 "," 1 "identifier" latin1_general_ci_as 2 sqlchar 0 50 "," 2 "name" latin1_general_ci_as 3 sqlchar 0 50 "," 3 "date of birth" latin1_general_ci_as 4 sqlchar 0 50 "," 4 "admission" latin1_general_ci_as 5 sqlchar 0 50 "," 5 "code" latin1_general_ci_as 6 sqlchar 0 50 ...

where I find the file modified by an android application -

i want save data in output file using following code. don't know find file after execution of application. try { // open myfilename.txt writing outputstreamwriter out = new outputstreamwriter(openfileoutput("myfile.txt", context.mode_private)); // write contents on mysettings file out.write("x="+float.tostring(xx)+" y="+float.tostring(yy)+" z="+float.tostring((zz))+" puissance="+float.tostring(magneticstrenght)); // close file out.close(); } catch (java.io.ioexception e) { //do if ioexception occurs. log.e("exception", "file write failed: " + e.tostring()); } thank answers. this file stored application data. can not view file file manager until phone rooted. better if provide external directory path like: file openfilename= new file(environment.getexternalstoragedirectory(),"myfile.txt"); try { // open myfilename.txt writing fileoutputstream f = new fileoutpu...

Node.js and express and production ssl certificate -

i'm having problems implement ssl certificate using node.js. everything works fine localhost, move ubuntu server, multiple problems occur. i've minimized following code. certificates (.crt) , keys (.key) in certificates directory, names localhost.key or examplesslserver.crt. i'm using rapidssl certificate , told needed include intermediate certificate. function serverssl(host,port,intermediate) { var https = require('https'); var fs = require('fs'); var express = require('express'); var app = express(); var httpsoptions = { key: fs.readfilesync('certificates/' + host + '.key'), cert: fs.readfilesync('certificates/' + host + '.crt') }; if (intermediate) { httpsoptions.ca = [fs.readfilesync('certificates/' + intermediate + '.crt')]; } var server = https.createserver(httpsoptions, app).listen({ port: port, host:...

php - Slashes in MySQL tables, but using PDO and parameterized queries. Whats up? -

alright, code update database tables varying flavours of following: $query = " insert comment (comment, commentdate, rating, userrid) values (:comment, now(), 0, :userrid )" ; try { $db_conn = new pdo('mysql:host='.$db_server.';dbname='.$db_name, $db_username, $db_password ); $db_conn->begintransaction(); $prep = $db_conn->prepare($query); $prep->bindparam(':comment', $comment, pdo::param_str, 500); $prep->bindparam(':userrid', $userrid, pdo::param_int, 20); $prep->execute(); $db_conn->commit(); } catch (pdoexception $e) { $db_conn.rollback(); echo "error!: " . $e->getmessage() . "<br/>"; die(); } in above, comment comes in via post page. userrid being set via function call. works properly, except slashes added table. everything i've read says in order around having slashes whenever types in apostrophe should using parameterized quer...

apache - ZF2 project not working on virtual host -

i have project in zf2. runs on other systems other mine.i have checked virtual host running other projects on system. when hit xyx.loc redirects when hit xyz.loc/user gives error an error occurred an error occurred during execution; please try again later. though have enable error reporting. not able figure out whether apache error or php error or zf2 error or else. project uses zf\apigility same folder works on other systems well. this default error template message . zf2 catching exceptions , hiding them due configuration settings. ensure have following configuration. 'view_manager' => [ 'display_not_found_reason' => true, 'display_exceptions' => true, ],

linux - FTPS put file on FTP SERVER Using Shell -

i need upload files of directory /home/test ftp server, in specific folder. schedule script hourly via cron. examples? try solutions i'm not able put file. code host=***** user=**** password=**** port=990 file=test.txt ftp -inv $host << eof user $user $password cd /test put test.test bye eof i found solution: lftp -u $user,$password ftps://$host:$port <<eof set ssl:verify-certificate no set ftp:ssl-protect-data true put test.txt exit eof thanks lot ideas.

entity framework - Linq to Get distinct List of rows in descending order -

consider following record id f1 f2 f3 date ------------------------------------------------- 1 1800 1990 19 2016-06-27 09:24:25.550 2 1181 1991 19 2016-06-27 09:25:15.243 3 1919 2000 19 2016-06-27 11:04:27.807 4 1920 2000 19 2016-06-27 13:04:27.807 5 1800 2001 19 2016-06-28 09:24:25.550 6 1181 2002 19 2016-06-28 09:25:15.243 7 1919 2010 19 2016-06-28 11:04:27.807 i want groupby f1 sorted date descending desirder output id f1 f2 f3 date ------------------------------------------------- 7 1919 2010 19 2016-06-28 11:04:27.807 6 1181 2002 19 2016-06-28 09:25:15.243 5 1800 2001 ...

html - How to change the type of transitions between slides in this jquery slider? -

can me change type of transitions between slides in jquery slider ? using slider called blueberry made ​​by mark tyrrell , wanted deslizacem slides left . (function($){ $.fn.extend({ blueberry: function(options) { //default values plugin options var defaults = { interval: 5000, duration: 500, lineheight: 1, height: 'auto', //reserved hoverpause: false, pager: true, nav: true, //reserved keynav: true } var options = $.extend(defaults, options); return this.each(function() { var o = options; var obj = $(this); //store slide , pager li var slides = $('.slides li', obj); var pager = $('.pager li', obj); //set initial current , next slide index values var current = 0; var next = current+1; //get height , width of initial slide image , calculate size ratio var imgheight = slides.eq(current).find('img').height(); va...

php - Add custom task to Moodle cron job -

i'm working moodle 2.9, , trying add new task cron. inside moodle/theme/portal folder added portal_cron() function lib.php file, run cron manually command line it's not working ?! cron work ignored new task! i'm doing wrong , how can add new task cron ? have got cron value in moodle/theme/portal/version.php eg: $plugin->cron = 60; // every 60 seconds. although cron function still available, should use scheduled tasks moodle 2.7+ https://docs.moodle.org/dev/task_api

angular - Angular2 Form works in Index.html but does not work in component.html -

why upload file form example working in index.html , not work in component.html file? if move component.html clicking add file not open browse dialog. <form id="upload" method="post" action="upload.php" enctype="multipart/form-data"> <div id="drop"> <a>add file</a> drag , drop <input type="file" name="upl" /> </div> <ul id="uploadlist"></ul> </form> edit : must mention import js files in index.html , , i'm not importing in system.js or angular-cli.build.js in index.html 1 of references is: <script src="assets/js/uploadscript.js"></script> and code uploadscript.js should open browser dialog: $('#drop a').click(function(){ $(this).parent().find('input').click(); }); your code in uploadscript.js (i guess) initialized w...

c# - Get Func types from a List of Expression<Func> -

i have following list on class: public class mapper { public list<expression> expressions { get; set; } = new list<expression>(); } i know expressions be: expression<func<intype, outtype>> the problem intype , outtype vary in list ... i tried define not compile. expression<func<,>> later on need go through each expression , input , output types of function. is possible? no, not possible. a type expression<func<_,_>> called higher kinded type. c# language has no way express such types.

cors - localhost Access-Control-Allow-Origin -

my local web app serving @ localhost:3000 wants access resources accessible @ localhost:8080/files (in directory .../www/files apache reads). to around cors constraint, tried adding .../www/files/.htaccess content : <ifmodule mod_headers.c> header set access-control-allow-origin "http://localhost:3000" header set access-control-allow-headers "origin, x-requested-with, content-type" header set access-control-allow-methods "put, get, post, delete, options" </ifmodule> but still not work ("no 'access-control-allow-origin' header present on requested resource"). what missing ? n.b. disabling cors in browser works, not want. i figured out. first, .htaccess files unnecessary , not recommended if 1 can edit apache conf. secondly, missing header "range" in access-control-allow-headers directive. adding list solved problem.

simulator - Updating the version of sumo -

i'm using sumo simulator version 0.22.0 . want update version 0.25.0 . how can ? thanks in advance . regards, sp2016 you can update sumo adding ppa https://launchpad.net/~sumo/+archive/ubuntu/stable system. depending on ubuntu version install more date sumo version repository (currently 0.25.0). sudo add-apt-repository ppa:sumo/stable sudo apt-get update and (again) sudo apt-get install sumo sumo-tools sumo-doc source: http://sumo.dlr.de/wiki/installing

php - Real time update with nodejs and memcached -

i have nodejs server socket.io, broadcasting data. data i'm trying memchached. works well, want create live broadcasting. data updating php side. how can retrieve data in nodejs when changing php? may callback nodejs side or event triggering ? current code not live. php: $mem = new memcached(); $mem->addserver("127.0.0.1", 11211); $mem->set($key, "customdata", 10); nodejs: var memcached = require('memcached'); var memcached = new memcached('127.0.0.1:11211'); memcached.gets('key', function (err, result) { console.log(result.key); })

java - How to log performance result of Restful API call using dropwizard as a framework? -

i followed link first rest api create restful api. i can view response on hitting url : http://localhost:8080/hello-world?name=xxx . now want test performance of api using completion service , log response time each hit in human readable format. how can achieve this? this easy do. there 2 methods that: do metrics or logging. in resource, can use metrics created , write out whatever want, e.g: @get public string hello() { timer timer = service.timer("test"); try(context t = timer.time()) { return "hello world"; } } alternatively measure time , log somewhere, e.g: @get public string hello() { long currenttimemillis = system.currenttimemillis(); try { return "hello world"; } { log.info("request took: " + (system.currenttimemillis() - currenttimemillis) + " ms"); } } the dw alternative of doing use timed annotation, like:...

javascript - Shift+Enter in Textarea using AngularJS -

this code shows how use directive submit form hitting 'enter' while in textarea. however, able shift+enter , go next line , submit result is. whenever submission made, shows in same line. how submit , show submitted text in next line user intends. <div ng-app="testapp" ng-controller="mycontroller"> <textarea ng-model="foo" enter-submit="submit()"></textarea><br/> last submitted text: {{ lastsubmitted }}<br/> </div> the angularjs code: var app = angular.module('testapp', []); function mycontroller($scope) { $scope.foo = "" $scope.lastsubmitted = "" $scope.submit = function() { $scope.lastsubmitted = $scope.foo; } } app.directive('entersubmit', function () { return { restrict: 'a', link: function (scope, elem, attrs) { elem.bind('keydown', function(event) { var code = event.keycode || even...

Connect workbooks and order columns EXCEL -

i've got workbook, call master. then have 3 more workbooks connected or linked master. master has these columns: a b c d e f on workbook 1 need: a c d f -this ok can achieve deleting columns don't want after connection. when updating updates columns have left. on workbook 2 need: a e d c f -i don't know how this. the idea if make changes master, clicking on update on other workbooks update properly. any please?

model view controller - yii2: new action is notFound 404 -

i want add new action in controller in yii2 project : i have error add new action ! new action have error : not found (#404) <?php namespace soft\controllers; use yii; use soft\models\reserve; use soft\models\reservesearch; use yii\web\controller; use yii\web\notfoundhttpexception; use yii\filters\verbfilter; use \yii\web\response; use yii\helpers\html; /** * reservecontroller implements crud actions reserve model. */ class reservecontroller extends controller { /** * @inheritdoc */ public function behaviors() { return [ 'verbs' => [ 'class' => verbfilter::classname(), 'actions' => [ 'delete' => ['post'], 'bulk-delete' => ['post'], ], ], ]; } /** * lists reserve models. * @return mixed */ public function actionindex() { ...

Constraint WebView to a set of URLs (RN Android) -

i developing application using react native , have webview can access set of domains, , cancels request other domain. in ios can done onshouldstartloadwithrequest event. instance: onshouldstartloadwithrequest(event){ if(event.url.startswith("http://alloweddomain.net")) return true; return false; } however, same event not available android ( this pull request sadly rejected) , know if there's way achieve behaviour using react api or 3rd party package. any appreciated. in advance!

android - RecyclerView inside ScrollView, some items are not shown -

i had recyclerview in scrollview this: <scrollview android:layout_width="match_parent" android:layout_height="match_parent"> <!--other stuff--> <linearlayout android:layout_width="match_parent" android:layout_height="wrap_content"> <android.support.v7.widget.recyclerview android:layout_width="match_parent" android:layout_height="wrap_content" android:visibility="gone"/> </linearlayout> <!--other stuff--> </scrollview> and recyclerview 's item relativelayout , inside of there edittext , other views. layout_height of relativelayout , edittext both wrap_content . user can input edittext without limit of length/lines each item's height different. then found getitemcount() in adapter returns true value onbindviewholder() called of wrong times(less should be), not eno...

ios - Too much space between cells -

Image
i'm having trouble reducing spacing between cells, want 1 px. inside cell have stackview fills entire cell, both set 70. i can accomplish want adding negative constrains, cells gets big, want 70. set cell 70 in custom cell class self.frame.size.height = 70 and stackview set same. don't see why amount of spacing between cells? please use below method adjust cell height; - (cgfloat)tableview:(uitableview *)tableview heightforrowatindexpath:(nsindexpath *)indexpath { return 78; }

android - Proguard with AAR library issue -

i have android library 1 class , want make .aar library. when set minifyenabled true, android project cannot use library (it fine if minifyenabled set false). ask correct configuration of proguard aar library helloworld.java package com.example.hello; import android.util.log; public class helloworld { public static void hello(){ log.v("helloworld","hello world!"); } } build.grandle apply plugin: 'com.android.library' android { compilesdkversion 24 buildtoolsversion "24.0.0" defaultconfig { minsdkversion 15 targetsdkversion 24 versioncode 1 versionname "1.0" } buildtypes { release { minifyenabled true proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile filetree(dir: 'libs', include: ['*.jar']) testcompile 'ju...

excel - Add macro code to a worksheet through a module -

i have macro created takes large amount of data (pulled database weekly) , displays in multiple different pivot tables. have summary page @ start of workbook listing different customer , machine names. have macro written can click on 1 of customer names , opens sheet corosponding customer via worksheet_selectionchange event. private sub worksheet_selectionchange(byval target range) if sheetexists(right(replace(replace(activecell.value, "/", "-"), "'", ""), 31)) activeworkbook.sheets(right(replace(replace(activecell.value, "/", "-"), "'", ""), 31)).activate end if end sub function sheetexists(sheetname string, optional wb excel.workbook) dim s excel.worksheet if wb nothing set wb = thisworkbook on error resume next set s = wb.sheets(sheetname) on error goto 0 sheetexists = not s nothing end function unfortunatly due nature of job, can't share of code its...

OneNote API Capture webscreenshot -

Image
i facing challenge in 1 note api web screenshot api, posting reqest mentioned below few content url rendering file icon in 1 note web application --newpart content-disposition: form-data; name="presentation" content-type: application/xhtml+xml <html> <head> <title>example 2</title> <meta name="created" content=2016-06-22/> </head> <body> <div><img data-render-src=https://content.connect.connect-uat.co.uk/content/uat/elektramedia/maths_y7/mf_1.1/contents/ch02/1/example2.html width=700 /></div> </body> </html> --newpart-- kindly suggest me if thing wrong in web screen shot rendering? i tried request onenote apigee console , able page created in notebook. here request tried - --newpart content-disposition: form-data; name="presentation" content-type: application/xhtml+xml <?xml version="1.0" encoding="utf-8" ?> <html xmlns="...

olap - How to hide non-existents members in dimension? -

Image
i have 2 dimensions: mall, gallery. first mall have gallery #1-3, second mall have gallery #4. how hide gallery #4 first mall , gallery #1-3 second mall? my fault, olap don't work except. can hide null cells only.

spring boot - Gradle with a local pom dependency picks up wrong version -

my build.gradle references local maven pom. have enabled mavenlocal() repository , have added jar compile time dependency (eg. my-local-lib, shown below). repositories { mavencentral() mavenlocal() } dependencies { compile (group: 'com.company', name: 'my-local-lib', version: '1.0-snapshot') } gradle indeed picks , adds dependency. my-local-lib, however, dependent on library specified in pom.xml, gradle fails pick correct version specified in pom.xml, , instead chooses earlier version. particular jar dependency not dependency on other library. is known issue? due my-local-lib being snapshot version? there way can enforce gradle respect versions specified in libraries? try add following piece of code: configurations.all { resolutionstrategy { cachechangingmodulesfor 0, 'seconds' } } to build.gradle script.

Testng how to pass parameter to the listener -

i know way pass parameter inside listener eater suite.xml or code itself i need in parallel test know on device i'm running test in order make reports this example of have / wish achieve the suite file <suite name="searchbutton" parallel="tests" thread-count="5"> <test name="samsungs6"> <parameter name="deviceudid" value="04157df40862d02f"/> <classes> <class name="mytestscenario"/> </classes> </test> </suite> or @test public void researchtext (){ string deviceudid = "1234"; } i want able find device udid in listener public void ontestskipped(itestresult result) { system.out.println("my deviceudid "); } i tried find system.getproperty("deviceudid") // or result.getattribute() // or result.getparameters() without success any idea on how ? get* metho...

Disable ACF in ckeditor not working -

i want disable advance content filtering in ckeditor. tried thing : allowedcontent = true it not working. want stop converting onclick attribute data-cke-pa-onclick , bind custom dom (which have added in ckeditor dynamically). working angularjs , want call angular method onclick event.

hadoop - Hive : reflect function -

im trying use reflect function of hive have signature : reflect(class, method[, arg1[, arg2..]]) i want ckeck if column c value hello world ! contains world , wrote : with (select "hello world !" c) select reflect("java.lang.string",c ,"contains", "world") but didnt work because not respect signature, tried with (select "hello world !" c) select reflect(reflect("java.lang.object","tostring",c) ,"contains", "world") it didnt work ! want know how apply reflect function on given column ?

javascript - issues bootstrap 3 Carousel changing height to 0px and marigin to -.....px -

the carousel added site behaves strange. in periode of 2 slide slides up. height of parent div changes 0px , margin of child div gets negative margin. in examples on bootstrap site isn't happening. copied latest code bootstrap site, can't find doing wrong. i love if me. http://humandemo.cloudaccess.host header right @ top op page. code used: <div class="container"> <div id="mycarousel" class="carousel slide" data-ride="carousel"> <!-- carousel indicators --> <ol class="carousel-indicators"> <li data-target="#mycarousel" data-slide-to="0" class="active"></li> <li data-target="#mycarousel" data-slide-to="1"></li> </ol> <!-- wrapper carousel items --> <div class="carousel-inner"> <div class="item active...

Do I need to reset a stream(C#) back to the start if I pass stream into method as Pass Value-Type Parameter method -

i have seen couple of example on internet stated have reset stream by stream.seek(0, seekorigin.begin); however, if pass stream method public static bool validatestreamline(stream stream) do have still reset stream? understand on usual case if pass in int, string, float or other general variable type as public static bool validateint(int i) the value of int not change. would difference of nature of pass-by value method on how method react stream? you seem misunderstanding how arguments passed in c#. default, arguments passed value in c#. in order pass them reference need use special keyword: ref or out latter being used when argument used second output of given method. (see int.trypase example). the important thing understand here arguments passed value behave quite diferently if type of argument reference type or value type. seem confused. to understand how works, make sure clear on following: variables hold values . the value of variable typ...

vb.net - VB2010 for x in y equivalent -

trying vb first time , need help. i have list box run same task each of lostbox items when button clicked. in python use for x in y: but do vb? code far button5_click(byval sender system.object, byval e system.eventargs) handles button5.click dim mesg string dim pw string dim id string integer = 0 me.listbox2.items.count - 1 id = me.listbox2.items(i).tostring mesg = textbox1.text.tostring() pw = "s" messagebox.show(id & mesg & pw, "test") exit next end sub so want message box each item in listbox once ok has been clicked vb has many, many ways make loop. seems you've encountered for...next loop construct. python's for x in y sounds vb's for each...next loops: dim message string = textbox1.text; dim pw string = "s"; dim item string each item in listbox2.items messagebox.show item & message & pw, "test" next i'd recommend read vb loop structures on msdn

javascript - how to store login info with angularJS -

i develloping little app angularjs; users have go through login form , can click on few links display data fetched server. the login form takes user's input , "stored" factory app.factory('idformholder', function () { var = this; that.setid = function (data) { = data; }; that.getid = function () { return that; }; return that; }); which works fine need keep stored because server requires login form sent each time $http.get header. each controller takes login form factory , uses data server. this works fine until decides refresh page, @ point seems factory "emptied" login form, , web-app fails show anything. is there way store login info doesn't erased ? you can use code after youve installed sessionstorage: app.factory('idformholder', ['$sessionstorage', function ($sessionstorage) { var = this; that.setid = function (data) { $sessionstorage.id = dat...

php - How can i get the value of each column in excel and insert to MySQL -

i newbie in sql , excel can guide me this? this full script. <?php include 'function/functions.php'; $excel = $_post['files']; $upload = $_post['upload']; $query = mysql_query("insert clients (name, age, sex, address, contact_number) values ($excel)"); if(isset($upload)) { $query; } ?> <!doctype html> <html> <head> </head> <body> <form action="" method="post" /> upload excel file<br /> <input type="file" name="files" /><br /> <input type="submit" value="upload" name="upload" /> </form> </body> </html> i'll make simple code make easy understand me,(anyway sorry bad english) my question is, how can insert each corresponding column in excel in mysql here's picture. enter image description here enter image description here use fgetcsv conten...

Errno 13: Passing Python variables to bash script -

this question has answer here: can't execute shell script python subprocess: permission denied 2 answers currently testing simple piece of code. want write python script sets variable , pass variable bash script use. python script: from subprocess import check_call = str(3) check_call(["/home/desktop/bash2pytest/test.sh", a], shell=false) bash script: #!/bin/bash echo "this number sent py script: " $1 i have read other q&as related topic; however, not finding solution conceptually understand; thus, syntax above might incorrect. have tried few other methods well; however, keep receiving following error: traceback (most recent call last): file "/home/cassandra/desktop/bash2pytest/callvar.py", line 3, in <module> check_call(["/home/cassandra/desktop/bash2pytest/test.sh", a], shell=false) file ...

Including certain modules in angularJS application builds -

i have feature modules in angular application , looking way create builds include features. for example: /app | |--/components | |--/core | |--/dataservices | |--/features | |--/customers | |--/orders so wanted produce build included orders module, there tools out there can in achieving this? i using gulp, , wondered being able configure gulp task took in arguments specify modules include , use file globbing patterns or similar target folders/files in build. can offer suggestions\approaches? thanks yes, let's wanted gulp task globs js in orders folder , sub folders. gulp task looks following // gulp orders task gulp.task('orders', function() { return gulp.src('features/orders/**/**.js') .pipe(concat('orders.js')) .pipe(gulp.dest('app/build/js')) .pipe(browsersync.reload({ stream: true })); }); what task globs js, concatenates js 1 orders.js file new folder called build. it's smart use browser...

html - Responsive table with fixed header -

i want make responsive table show 2 sections time, labels , values. the labels fixed , data slider. so far have this: [class^=col] { float: left; } .row { width: 100%; overflow: hidden; } .frame { overflow: scroll; } .col-6 { width: 50%; } .col-12 { width: 100%; } .sub-row { border: 1px solid; height: 30px; } .sub-row:first-child { font-weight: bold; } <div class="row"> <div class="col-6"> <div class="sub-row"></div> <div class="sub-row">test1</div> <div class="sub-row">test2</div> </div> <div class="col-6"> <div class="col-12"> <div class="sub-row">col1</div> <div class="sub-row">bla</div> <div class="sub-row">bla</div> </div> <div class="col-12"> ...

WIFI upload speed C# vs Android Java -

i working on wifi boot loader embedded device. working fine, want increase speed. have c# client , android client device acting server. embedded device rather slow clients must sleep between data records while device writes program memory. here strange part: required sleep windows c# client 300ms while 800ms android. less of wait causes server send error. results in 8 minute operation in c# , 21 minutes in android. why this? here loop in c#: (int line = 0; line < lines.count; line++) { if (lines[line].startswith(";")) break; byte[] sbytes = encoding.ascii.getbytes(lines[line]); gstream.write(sbytes, 0, sbytes.length); textboxterminal.appendtext(lines[line]); textboxterminal.appendtext("\n"); application.doevents(); wait(300); if (gstream.dataavailable) break; } here in android java: while((data = br.readline()) != null) { ...

symfony - Redirect anonymous users from restricted areas in Symfony2 -

i've built web app using symfony 2.8 , i've got task of separating admin area front end. have done using following code in security.yml file: security: encoders: myapp\bundle\corebundle\entity\users: algorithm: sha512 role_hierarchy: role_admin: role_blocked providers: main: entity: { class: myapp\bundle\corebundle\entity\users, property: username } firewalls: default: anonymous: ~ secured_area: pattern: ^/admin anonymous: ~ access_denied_url: core_login form_login: check_path: core_login_check login_path: core_login failure_path: core_login default_target_path: ^/admin/booking/today/ logout: path: core_logout target: core_login access_control: - { path: ^/admin, roles: 'role_admin' } ...

sql - Add an attribute to the root node -

please see ddl below: create table #dataset1 (id int not null identity,firstname varchar(30),surname varchar(30), primary key (id)) insert #dataset1 (firstname,surname) values ('mark','williams') and sql below: select firstname,surname #dataset1 xml path('dataset1') which returns: <dataset1> <firstname>mark</firstname> <surname>williams</surname> </dataset1> how can sql return: <dataset1 urn='1'> <firstname>mark</firstname> <surname>williams</surname> </dataset1> urn=1 harcoded xml i.e. not generated database. try this select id [@urn] ,firstname ,surname #dataset1 xml path ('dataset1') result <dataset1 urn="1"> <firstname>mark</firstname> <surname>williams</surname> </dataset1>

android - Bring the app to front if it is already running rather than creating new instance of it -

i launching system apps app , can launch using code intent i=getpackagemanager.getlaunchintentforpackage("your package name"); i.setflags(intent.flags_reorder_to_front); i.setflags(intent.flags_single_top); startactivity(i); but restarted or created new instance of app.if particular app running want bring front rather creating new instance of it.. have tried many methods didn't worked created new instance on top of running app. please solve problem it depends on launch mode of activity want start. if launch mode "standard" not possible bring front: a new instance always created new intent when launch mode "standard" (source) for other launch modes, try using following 2 flags: i.setflags(intent.flag_activity_new_task); i.setflags(intent.flag_activity_clear_top); as described in documentation should have following effect (which should match desired behavior): flag_activity_clear_top used in conjunction flag_activit...

.net - Refresh serial number after update Kendo Grid -

i have kendo grid , insert serial number following: var rownumber = 0; function resetrownumber(e) { rownumber = 0; } function rendernumber(data) { return ++rownumber; } it loads serial number order when edit-update record in row of kendo grid serial number start last serial number. want serial number order in proper after grid updation. can me this? in advance.. i have tried databounding.. working good. have included grid code here . @(html.kendo().grid<ssrwaweb.models.mydatawrappers.viewmyjobitem>() .name("grid") .columns(columns => { columns.template(t => { }).title("line no").clienttemplate("#= rendernumber(data) #"); columns.bound(c => c.line_num).title("line #"); columns.bound(c => c.part_num).title("part number"); }) .events(e => { e.edit("assignnumber"); e.save("orderupdate"...

google apps script - Missing ] after element list error in JSON -

Image
when try save changes google apps script file following error: missing ] after element list. this code: var request = { "name": "name", "id": 3, "rules":[ { "name": "nested", "tags": [ { "tagid": 1, "variables":[ [ "variable": "var1" ] ], "condition": false, }, { "tagid": 1, "condition": false, } ], "rulesetid": 3, } ] } the error indicates problem on line contains "variable": allscopes[i].variable , can't find problem is... this example json object need build: note trying use array literal construct object: "variables":[ [ "variable": "var1"...

The client arguments (clientArgs) given to "karma run" have no effect when I'm using RequireJS -

i'm trying pass grep argument karma-mocha plugin pass mocha , run tests match grep . command line this: ./node_modules/.bin/karma run -- --grep='one' however, karma goes on tests, in same way if not use --grep . according karma run --help , after -- should client arguments. (it referred clientarg in , in discussions how run karma run .) tried small project without requirejs , worked. seems adding requirejs causes problem. here small setup reproduces issue: karma.conf.js : module.exports = function(config) { config.set({ basepath: '', frameworks: ['mocha', 'requirejs'], files: [ 'test-main.js', { pattern: 'test/**/*.js', included: false } ], exclude: [], preprocessors: {}, reporters: ['progress'], port: 9876, colors: true, loglevel: config.log_info, autowatch: false, browsers: ['chrome'], singlerun: false, concurrency: infinity }); }...