Posts

Showing posts from January, 2013

jenkins workflow - How to use SSH-credentials? -

i try convert "standard" build workflow build. in the original build use ssh-agent plugin access ssh-keys need deploying artifacts in builds shell-script. how can in workflow? possible? pending jenkins-28689 tricky. save private key secret text credentials item (pending jenkins-28399 ), use withcredentials step (credentials binding plugin) variable file location of copy of private key, , authenticate that.

javascript - PHP one form with two submit buttons and different validation -

i have single form 2 submit buttons , there's javascript validation in form, possible activate validation in 1 of submit buttons? tried create input button instead of input submit onclick event , submit through javascript function, didn't work. <form id="myform" action="my_action.php" method="post" enctype="multipart/form-data" onsubmit="return isvalidform();"> <!-- ... --> <input type="submit" name="auto" /> <input type="submit" name="manual"/> </form> you're on right track moving event handler submit button, shouldn't stop being submit button. <form id="myform" action="my_action.php" method="post" enctype="multipart/form-data"> <!-- ... --> <input type="submit" name="auto" onclick="return isvalidform();"> <input ty...

Cakephp MySql Query with WHERE -

i have work function: public function index() { $this->set('tables', $this->table->find('all')); } but how show column owner = logged user? you want $this->session->read() returns current authenticated user:- $this->table->find( 'all', array( 'conditions' => array('table.user_id' => $this->session->read("auth.user.id")) ) );

java - How to setHeader in ResourceStreamRequestHandler#configure(..) (migration issue) -

i'm migrating wicket 1.4 6 through 1.5. encounter issue cannot fix. in wicket 1.4 used have (note: yes, have detach ) public class tempfileresourcerequesttarget extends resourcestreamrequesttarget implements serializable { @override protected void configure(final requestcycle requestcycle, final response response, final iresourcestream resourcestream) { super.configure(requestcycle, response, resourcestream); ((webresponse)response).gethttpservletresponse().setheader("cache-control",""); ((webresponse)response).gethttpservletresponse().setheader("pragma",""); } in wicket 1.5/6 changed this: public class tempfileresourcerequesttarget extends resourcestreamrequesthandler implements serializable { @override protected void configure(resourcestreamresource resource) { super.configure(resource); ((httpservletresponse)resource).setheader("cache-control","...

php - URL rewriting or redirection issue in magento -

i running site in magento version 1.9.1.0 ssl enabled. when open site's admin panel on browser either after refresh cache of browser or in private mode first time shows site's homepage rather admin login page i.e. sitename.com/admin url redirects https://sitename.com url automatically on first time. same issue happened when try access inner page of site directly first time. after when enter again url in browser's address bar sitename.com/admin open admin login page on next time(seems cache works). i using login , pay amazon extension in magento site. when go login amazon after inject credentials shows me error follows: no data received. unable load webpage because server sent no data on chrome. secure connection failed on firefox i using base urls (unsecured , secured https://sitename.com ) in admin panel under system > configuration > general > web seems right? have doubt in .htaccess file part of code. have used following code in ....

php - Predis: Pros and Cons of the two cluster strategies -

i using predis connect redis 3.0.2 cluster. so, have option use either predis or redis cluster strategy. wondering if there significant pros , cons of choosing 1 of them on other? based on wandering through documentation, have these couple of points in mind, not sure if understanding correct: when using redis strategy, don't have list every node of our cluster while establishing connection. reference (possibly pro :) ) when using redis-cluster, not necessary pass of nodes compose cluster can specify few nodes next line of article linked above says: predis automatically fetch full , updated slots map directly redis contacting 1 of servers. could con in terms of performance? because predis need fetch data server before deciding node select current read/write operation? context: we planning use redis store php sessions. ajax heavy web application thousands of active users @ peak times. that's why want spread load across multiple redis nodes. ha...

javascript - How to set up a reverse proxy in nodejs for multiple targets? -

i using nodejs, expressjs , request create reverse proxy. what want when request sent http://localhost:port/name/ corresponding page loaded. for example, if enter http://localhost:1234/google/ google website loaded , if enter http://localhost:1234/stack/ stackoverflow page loaded instead. i tried code similar 1 here var request = require('request'); app.get('/google', function(req,res) { //modify url in way want var newurl = 'http://google.com/'; request(newurl).pipe(res); }); the problem is, loads pages, not completely, since pages wanna load images , css , stuff , make requests /images/example.jpg , end 404 error. has handy solution problem? since setting route /images no good, sincei have 2 possible target servers , proxy wouldn't know right one. first of all, forward proxy, second, here working code of want, modify please call http://127.0.0.1:5432/yahoo.com var request = require('request'); var express = req...

Android Build failed at ':app:dexDebug' with exception ( library and app project ) -

i using third party libraries in library project. following library project build.gradle apply plugin: 'com.android.library' android { compilesdkversion 21 buildtoolsversion "21.1.2" defaultconfig { minsdkversion 14 targetsdkversion 21 versioncode 1 versionname "1.0" } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' } } //dexoptions { // javamaxheapsize "4g" //} packagingoptions { exclude 'meta-inf/dependencies' exclude 'meta-inf/license.txt' exclude 'meta-inf/notice.txt' } productflavors { } } dependencies { compile filetree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:22.2.0' compile 'com.adobe.creativesd...

laravel - homestead up not working after vagrant up -

the "homestead up" command not working on ubuntu 14.10. these outcome of command: /home/omicronit/.composer/vendor/laravel/homestead/vagrantfile:18:in read': no such file or directory - /home/omicronit/.homestead/homestead.yaml (errno::enoent) /home/omicronit/.composer/vendor/laravel/homestead/vagrantfile:18:in block in ' /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/config/v2/loader.rb:37:in call' /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/config/v2/loader.rb:37:in load' /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/config/loader.rb:103:in block (2 levels) in load' /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/config/loader.rb:97:in each' /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/config/loader.rb:97:in block in load' /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/config/loader.rb:94:in each' /opt/vagrant/embedd...

ios - Getting syntax error in perl script -

i trying run script see in answer: best way add license section ios settings bundle and getting syntax error in xcode. missing right curly or square bracket @ ./acknowledgements.pl line 57, @ end of line syntax error @ ./acknowledgements.pl line 57, @ eof execution of ./acknowledgements.pl aborted due compilation errors. command /bin/sh failed exit code 255 not sure why happening. here script machine: #!/usr/bin/perl -w use strict; $out = "../settings.bundle/en.lproj/acknowledgements.strings"; $plistout = "../settings.bundle/acknowledgements.plist"; unlink $out; open(my $outfh, '>', $out) or die $!; open(my $plistfh, '>', $plistout) or die $!; print $plistfh <<'eod'; <?xml version="1.0" encoding="utf-8"?> <!doctype plist public "-//apple//dtd plist 1.0//en" "http://www.apple.com/dtds/propertylist-1.0.dtd"> <plist version="1.0"> <dict> ...

taskmanager - Stop all processes and services from accessing a specific folder in Windows (and keep them out) -

in windows server 2008 need stop every process accessing specific folder in order apply changes. need restore stopped processes. there tool can that? possible using .bat or .vbs file? not talking finding processes , killing them using task manager. need automatically whenever needed. need processes blocked while working there , revoked or grant access after finish job. thank in advance.

database - PL SQL Find Dependencies on Table Field -

i needing find references table's field, , have hundreds of stored procedures search through. goal find being used in clauses , add value in statement. example, where mytable.field_x in (1,2,3) needs become mytable.field_x in (1,2,3,4) . so i'm curious if there system table, dba_dependencies, or can query show me procs, views, or functions referencing field? can give. what version of oracle using? if using @ least 11.1, introduced column-level dependency tracking, , you're not afraid leverage undocumented data dictionary tables, can create dba_dependency_columns view give information. show every piece of code depends on column not column used in where clause of statement. you can search dba_source text of procedures, functions, , triggers code has sort of where clause. gets little tricky, though-- if put list of values on different line or if there inline view column name aliased else, can tricky find via text search. views, you'd need ...

javascript - Jquery .load not using stylesheet -

sorry bad english title, i'm making ase , want dynamic pages. 1 container , when clicked on navigation item load pages container. however, if use jquery .load, style not correct. seems doesn't use stylesheet either main page content page. put stylesheet link on both. use bootstrap. this main.php (the main page container): <?php include('../includes/global.php'); ?> <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="description" content=""> <meta name="author" content=""> ...

linux - Diff 2 long strings and write result in 3rd file -

i working on initial bash scripts , got stuck @ place need forum. how implement below in shell script? (any suggestions/pointers appreciated!!!) requirement: compare 2 files matchings key containing long string , persist in 3rd file long strings differ in other attributes (say value of user different). skip attributes comparison. input file1- aautox=y;acct=;action=c;aprice=99.975;aqty=5541;user=sam,bpl;confirm=y;key=29976dye4;dept=myna-clcd -- same aautox=y;acct=;action=c;aprice=05.975;aqty=3451;user=todd,chr;confirm=n;key=29976dye5;dept=myna-clcd -- diff (user=todd,chr) write in result file input file2- aautox=y;acct=;action=c;aprice=99.975;aqty=5541;user=sam,bpl;confirm=y;key=29976dye4;dept=myna-clcd -- same aautox=y;acct=;action=c;aprice=05.975;aqty=3451;user=alan,ncr;confirm=n;key=29976dye5;dept=myna-clcd -- diff (user=alan,ncr) write in result file aautox=y;acct=;action=c;aprice=17.000;aqty=6453;user=todd,chr;confirm=n;key=29976dye6;dept=myna-clcd -- no match (ke...

extjs5 - ExtJS: What are the only required files for grid? -

i have .net application in have used extjs grid on 1 page. have included complete ext folder in application has increased application size considerable amount. populating grid in ext.onready function , requirement of extjs grid on single page. want know required files should include in application not take unnecessary space? if reasons don't want use sencha cmd, required files are build/ext-all.js packages/ext-theme-neptune/build/resources/ext-theme-neptune-all.css packages/ext-theme-neptune/build/ext-theme-neptune.js

scheduled tasks - scheduling and editing an event to occur at a specific time android -

i building app needs perform action @ specific date , time , put notification hour before task performed. i have searched , found alarm manager class can used purpose not sure how use it. if in future point cancel or edit once application closed , reopened. i have created sqlite database stores information along date , time of event happen. thanks google provides "scheduler" code sample want: display notification @ given time. sample shows how cancel alarm. edit : i've watched @ sample code again , right, sample doesn't explain how pendingintent after app closed , reopened. following code creates pendingintent if doesn't exist, , if exists, returns existing pendingintent, flag_update_current. don't have care if alarm has been started or not: pending intent, , cancel it. intent intent = new intent(context, myalarmreceiver.class); pendingalarmintent = pendingintent.getbroadcast(context, 0, intent, pendingintent.flag_update_current...

cqlsh - Cassandra performance on distinct query -

in cassandra , read need design table schema such minimum number of partitions hit. have designed schema meet requirement. in scenario need partition keys alone. planning use select distinct <partitionkeys> table i ran distinct query using cqlsh around 15k rows .it quite fast. questions will there performance issues if use distinct ? how cassandra fetches partition keys alone ? i need know limitations on distinct query. will there performance issues if use distinct? how cassandra fetches partition keys alone? basically, cassandra has rip through nodes , pull partition (row) keys table. querying these keys how cassandra designed work, not surprised performed you. drawback, have hit or of nodes complete operation, performance slow if have large number of nodes. this difference between cql rows , rows in underlying storage comes play. if @ data cassandra-cli tool, can see how partition keys treated differently. here example crew members of ship...

bash - How to check if docker machine exists programmatically? -

i'm using docker-machine manage cloud servers. i'm writing bash scripts automate tasks. question is: "how check in bash script if docker machine specific name exists?". need expression return true if exists , false if doesn't. thanks just run through grep, if regexp enough you. example if have machine called foo: $ docker-machine ls -q | grep '^foo$' should work , return 0. caret matches start of line , space avoids partial matches. if doesn't match non-zero return code.

knitr - Losing R-Markdown title when automating knitting -

Image
this question has answer here: headers in knitr 1 answer i trying automate creation of bunch of rmd files have been tediously knitting manually r-studio - using "knit html" button enabled when edit rmd file. if use knit2html command script, loses title. apparently explained design in post: title not showing on r markdown knitr when rendering markdown file however not explain how r-studio manages generate title in html files produces - must possible somehow, right? have been trying test.rmd r-markdown. --- title: "my title" author: "joe programmer" date: "thursday, 10 june 2015" output: html_document --- read instructions. and getting when use knit html button below but when knit console knit2html() how can code work way r-studio does? rstudio answers here . can see template use @ this gist , , if @ m...

c# - Outter joins in LINQ query -

this code works takes , matches unit_no , vehiclename shows matches need ones dont match on. loading datagrid in wpf sqlserver data , datagrid oracle data. private void getsqloraclelinqdata() { var tstardata = gettrackstartruckdata(); var m5data = getm5data(); datatable comtable = new datatable(); foreach (datacolumn oracolumn in m5data.columns) { comtable.columns.add(oracolumn.columnname, oracolumn.datatype); } foreach (datacolumn sqlcolumn in tstardata.columns) { if (sqlcolumn.columnname == "vehiclename") comtable.columns.add(sqlcolumn.columnname + "2", sqlcolumn.datatype); else comtable.columns.add(sqlcolumn.columnname, sqlcolumn.datatype); } var results = m5data.asenumerable().join(tstardata.asenumerable(), => a.field<string>("unit_no"), b => b.field<s...

java - How to remove Sprite/Object from ArrayList? -

this question exact duplicate of: removing sprite when touched 1 answer i created arraylist sprites needs removed, when sprites touched added arraylist. //drawing enemy spawns , making them move public void draw(spritebatch batch){ for(sprite drawenemy:enemies) { drawenemy.draw(batch); drawenemy.translatey(deltatime * movement); touchinput(drawenemy.getx(),drawenemy.getwidth(),drawenemy);//2nd method } } public void touchinput(float x,float w,sprite sprite){ float touchx=gdx.input.getx(); if(gdx.input.justtouched()){ if(touchx > x && touchx < x+w ){ removeene.add(sprite);// adding current sprite array list when touched } //removeene arraylist } ...

java - JFreeChart making XYSeriescollection iterable -

background info i wanted create quasi dynamic dataset containing few different data series share same timeframe extent. since never know when new series may required or old 1 updated i'm making method takes generic entry name, time, score plot chart. the actual problem i have noticed can not iterate through xyseriescollection suggest class not implement iterable. guess could modify original files implement interface, bit concerned jfreechart appears great library perhaps there reason why implementation not done? summary: is ok modify code - safe, has tried it, can cause issues within library, etc? is there better way add behaviour editing sources, override of kind? what different approach? i'm not adamant solution, can not alter input data , have no way of knowing in advance except arrive @ point , has same format (since it's object of class know) xyseriescollection#getseries() returns list iterable . xyseriescollection dataset = new xyserie...

c# - ListBox with nothing selected shows highlighted entry -

my listbox set selectionmode=multisimple. starts life nothing selected, , nothing highlighted. if select entry (other top-most one), selects item, , highlights it. if select same entry again, de-selects it, , selectedxxxx values indicate nothing selected, topmost line highlighted in error. going wrong, , how fix it? thanks the first item in list box or dropdown combo box id 0. should set list box selection index -1 make sure nothing selected or highlighted. setting 0 sets list box (or comb box) select first item.

Fetching with a certain number and some offset with Realm(https://realm.io/) -

i trying turn realm( https://realm.io/ ) , come across problem. if handling data base storing large number of records, , want fetching number of records offset, how can realm. know, can done sql or core data. , don't want fetch data base , caculate ourselves in memory, needs time since realm reads data disk upon access (even down property level), don't have worry reading more disk necessary. if want access next 10 objects after 100th, have skip accessing first 100. for example: let realm = realm() let modelobjects = realm.objects(mymodel) // => there 1000 items in 100..<110 { let itematindex = modelobjects[i] // => inferred of type `mymodel` itematindex.someproperty // => @ point data *just property* read disk // perform operations in memory here... } // @ point, 10 objects ever read disk // , properties on objects accessed. i'm using realm swift in example, same concepts apply realm objective-c.

shell - How to specify what files you want to read from different directories -

i have files in different directories. files named profiles-tc_0974950_30190-r-00002.avro , others named profiles_060415084722_30129-r-00012.avro. when run script want able specify files start profiles-tc , other times when not want read files. when run script 1 of 2 cases have following: bash move_files2.sh profile/generate/work/profiles-tc* however, when run it's reading 1 file. files=$1 f in $files echo "$f" echo "processing $f file..." done quoting param can fix problem: bash move_files2.sh "profile/generate/work/profiles-tc*"

http - Save cookies between two curl requests -

i know using curl can see received cookies / headers using curl --head www.google.com and know can add headers request using curl --cookie "key=value" www.google.com i working on testing issue requires persistent cookies, , there can lot of them. how can efficiently preserve cookies between 2 curl requests? if possible using temporary file storage. use --cookie-jar or --dump-header parameter save received cookies file. --cookie parameter can read cookies file later. -b, --cookie <name=data> (http) pass data http server cookie. supposedly data received server in "set-cookie:" line. data should in format "name1=value1; name2=value2". if no '=' symbol used in line, treated filename use read stored cookie lines from , should used in session if match. using method activates cookie engine make curl record incoming cookies too, may handy if you're using in combination -l, --location option. file...

Java Time API converting ISO 8601 to ZonedDateTime -

i having hard time converting iso 8601 formatted string java.time.localdatetime in utc. more specific, trying write xmladapter can enter various iso 8601 dataformats string (i.e. 2002-09-24 , 2011-03-22t13:30 , 2015-05-24t12:25:15z , 2015-07-28t11:11:15.321+05:30 ) , outputs localdatetime in utc , visa versa. the system stores it's date , time information internal in utc times. when user requests date or time represented user based on own zoneid . as name suggests localdatetime holds both date , time. first example of date string have in question example holds information date, therefore cannot parse directly localdatetime . there first parse localdate , setting time on object localdatetime . localdatetime localdatetime = localdate.parse("2002-09-24").atstartofday(); all date , time objects have parse method localdate can take string format. these formats different iso standard formats specified in datetimeformatter for formatting custom datet...

c# - DataTable.PrimaryKey columns in different order from Database's primary key -

i'm using sql 2014 database. (also tested in sql 2012 same behavior.) have table primary key columns 'a,b'. columns in create table statement in different order 'b,a'. when i'm running dataadapter.fillschema(), datatable.primarykey gets set columns in order 'b,a'. expectation columns in order 'a,b' - way primary key ordered in database. when table created follows, datatable.primarykey in order 'a,b': drop table alex_test create table alex_test( [a] [varchar](128) not null, [b] [varchar](128) not null, [c] [varchar](128) not null constraint [pk_alex_test] primary key clustered ( asc, b asc ) ) insert alex_test (a, b, c) values('a', 'b', 'c') however when table created follows, order of datatable.primarykey 'b,a': drop table alex_test create table alex_test( [b] [varchar](128) not null, [a] [varchar](128) not null, [c] [varchar](128) not null constraint [pk...

php - date time to date (Y/m/d) -

i have date if use $patient['date_unit_adm'] as. 28/07/2012 00:00:00 but when y/m/d format goes 1970/01/01 $timestamp = strtotime($patient['date_unit_adm']); $admissiondate = date('y/m/d', $patient['date_unit_adm']); why this. whats happening in strtotime ? update. there still funny here. $timestamp = strtotime($patient['date_unit_adm']); still give no value, doing echo $patient['date_unit_adm'] gives me correct date. any idea var_dump returns boolean false , var_dump($patient['date_unit_adm']) returns string '28/07/2012 00:00:00' (length=19) solution strtotime(str_replace("/", ".", $patient['date_unit_adm'])); you forgot timestamp / using wrong variable (the original date time), if code posted correct: $admissiondate = date('y/m/d', $timestamp);

Custom support annotations in Android Studio? -

i have return type annotations on method enable static analysis of return type assure within set of allowed sub-types. e.g. method returns view , have something like: @checkreturntype(textview.class, button.class) public view getview() { return (imageview) findviewbyid(r.id.image_view); } this similar released android support annotations resource type analysis (@layoutres, @stringres, etc.) are there libraries / tutorials might in doing ?

java - Camel get response from Route -

i able called web service, ever response came web service, need fetch same response in java code able further processing. <camelcontext xmlns="http://camel.apache.org/schema/spring" trace="false"> <route id="my_sample_camel_route_with_cxf"> <from uri="file:src/data?noop=true"/> <log logginglevel="info" message="&gt;&gt;&gt; ${body}"/> <to uri="cxf://http://www.webservicex.net/stockquote.asmx?wsdlurl=src/main/resources/meta-inf/stockquote.wsdl&amp;servicename={http://www.webservicex.net/}stockquote&amp;portname={http://www.webservicex.net/}stockquotesoap&amp;dataformat=message"/> <log logginglevel="info" message="&gt;&gt;&gt; ${body}"/> </route> instead of logging using

c# - Automapper starting exception in Windows 8.1 Unified project -

i have cross-platform project, using mvvmcross , stuff. right now, solution consists of core , windows phone projects. core contains automapper reference, , wp project contains automapper , automapper.wpa references. application works fine in cases, throws exceptions could not load file or assembly 'automapper.net4' . how can explain stupid automapper use automapper.wpa, referenced project? i'm using public static class automapperconfig { static automapperconfig() { mapper.createmap<mydbmodel, mydto>(); mapper.addprofile<myprofile>(); // other mappings stuff } public static void initialize() { mapper.assertconfigurationisvalid(); } } and i'm calling setup, in shared project, public class setup : mvxwindowssetup { public setup(frame rootframe) : base(rootframe) { automapperconfig.initialize(); } *** } is happening while debugging? if so, you...

python - How to solve import error for pandas? -

i installed anaconda python 2.7.7. however, whenever run "import pandas" error: "importerror: c extension: y not built. if want import pandas source directory, may need run 'python setup.py build_ext --inplace' build c extensions first." i tried running suggested command stated that skipping 'pandas\index.c' cython extension (up-to-date) skipping 'pandas\src\period.c' cython extension (up-to-date) skipping 'pandas\algos.c' cython extension (up-to-date) skipping 'pandas\lib.c' cython extension (up-to-date) skipping 'pandas\tslib.c' cython extension (up-to-date) skipping 'pandas\parser.c' cython extension (up-to-date) skipping 'pandas\hashtable.c' cython extension (up-to-date) skipping 'pandas\src\sparse.c' cython extension (up-to-date) skipping 'pandas\src\testing.c' cython extension (up-to-date) skipping 'pandas\msgpack.cpp' cython exte...

wpf - Binding DataGirdComboBoxColumn to DataSet doesn't work -

i want create simple master-detail view in datagrid. tried bind datagirdcomboboxcolumn dataset , won't work. here's xaml code: <datagrid x:name="datagrid1" grid.column="0" grid.row="0" alternatingrowbackground="#fff0f0f0" itemssource="{binding}" height="420" autogeneratecolumns="false"> <datagrid.columns> <datagridtextcolumn header="id" binding="{binding airplaneid}" isreadonly="true" minwidth="30"/> <datagridtextcolumn header="model" binding="{binding model}" isreadonly="true" width="auto" minwidth="160"/> <datagridtextcolumn header="fuel" binding="{binding fuel}" minwidth="50" /> <datagridcomboboxcolumn x:name="comboboxcolumnpass" header="passenger" displaymemberpath="name" ...

css - How do you force a website to be in landscape mode when viewed on a mobile device? -

i've seen lot of questions this, no definitive answer on how in razor/mvc site mobile site determined using defaultdisplaymode class. also, lot of answers code snippets without details on code goes (is in controller, view, css, etc.?) so start off, there global file calls evaluatedisplaymode(): global.asax.cs public class mvcapplication : system.web.httpapplication { protected void application_start() { arearegistration.registerallareas(); bundleconfig.registerbundles(bundletable.bundles); webapiconfig.register(globalconfiguration.configuration); filterconfig.registerglobalfilters(globalfilters.filters); routeconfig.registerroutes(routetable.routes); deviceconfig.evaluatedisplaymode(); } } the evaluatedisplaymode in app_start folder sets mobile , desktop class based on getoverriddenuseragent() type: deviceconfig.cs public static class deviceconfig { const string devicetypephone = "mobile"; ...

facebook - Loopback and passport - AccessToken 401 Permission denied -

i'm trying see how use loopback-passport. clone repo: loopback-example-passport , got working facebook , local login. however, if go api explorer , try users, or own accesstoken, 401-permision denied. what doing this: open example application log in using facebook provider token stored in local-storage , set in api explorer make request in api explorer i'm using same access token got facebook provider. i'm doing wrong here? thanks!

android - Use of volatile variable in Java -

i reading lot of forums , tutorials volatile variables, still not working me. i'm working on app android in android studio in java. i have main ui thread , i'm creating using runnable. need shere 2 variables between these 2 threads. ui thread changes these variables, thread reads these variables. here fragment of code. code not complete (not lines sensors - bcs works well). don't know how connect x,y in both threads changes in ui visible in thread. thanks advice. class mythread implements runnable { public static volatile float x = 0; public static volatile float y = 0; glsurfaceview mglview; public mythread(float xpos, float ypos, glsurfaceview glview) { x=xpos; y=ypos; mglview = glview; } public void run() { while(true){ ((myglsurfaceview)mglview).mrenderer.ball.translatem(x, y, 0); } } } public class mainactivity extends activity implements sensoreventlistener { private ...

ios - add button navigationbar center -

it easy add left , right buttonbaritem on navigationbar but hope add button navigationbar center my code [self.navigationitem.titleview addsubview:button ];//button not nil but nothing happens yourc comment welcome the titleview nil default code doesn't anything. change code to: self.navigationitem.titleview = button; this sets button titleview .

nullpointerexception - Processing in Java Serial object Null Pointer Exception -

first of new java apologize if obvious answer. i using processing in java read input values coming usb port. here custom class set values. call getcurrentvalue() method , throws nullpointerexception. import processing.core.papplet; import processing.serial.*; import java.util.hashmap; import java.util.arraylist; import java.io.file; import java.io.bufferedreader; import java.io.printwriter; import java.io.inputstream; import java.io.outputstream; import java.io.ioexception; public class seismograph extends papplet{ private int currentvalue, verticaloffset = 0; private int 0 = 32768; // .5 of maximum seismograph value private int adjustseis = 68; // devide seismograph data adjustsies scale public string theseisport = "com20"; private serial seisport; public void s...

mysql - Workbench migration via ssh - how to set up a tunnel -

i try migrate mssql (local machine) mysql (amazon web services) usin workbench. can connect both databases. when migrate error: mysql connections through ssh not supported in version... well, found in documentation: a workaround set encrypted tunnel, , treat mysql target standard tcp (unencrypted) connection. but don't know how set tunnel. can help? okay, if i'm understanding correctly, think i'd prefer set tunnel in putty. don't have solid grasp of how mysql workbench works (i'm assuming analogous ssms), have used maaany ssh tunnels in day. here basic instructions: http://www.electrictoolbox.com/putty-create-ssh-port-tunnel/ you'll want create local tunnel port choose (although i'd go mysql default 3306) destination of 127.0.0.1:3306 . sure click add , save session settings in putty. open ssh connection aws machine. try connect mysql instance through 127.0.0.1:3306 . should allow pull local sql server , send data aws insta...

github - GIT HOOK to check keyword "PROMOTE" in message when GIT MERGE is executed -

i need check "promote" keyword in message whenever there merge master , other branch eg: if git command is: git merge -m "merge commit 1 branch1 master" f145cd536463e595f1e4306eeec6f92a9cd6c734 merge should exit error "promote key word not set in merge message" git merge -m "promote commit 1 branch1 master" f145cd536463e595f1e4306eeec6f92a9cd6c734 merge should successful. the problem merge command is not guaranteed create commit unless use --no-ff . example might following result command. git merge -m "merge commit 1 branch1 master" updating f145cd5..cd6c734 fast-forward (no commit created; -m option ignored) see post , pdf great explanation of fast-forward vs no fast-forward when merging. people think -no-ff muddies history , breaks git-bisect , git blame . others love --no-ff because allows merge comments , visualization of happened in feature branch. if decide use --no-ff , can configure git to ...

java - Queue using linked lists - how should this work? -

i'm struggling head around data structure. in course use following code implement queue using linked lists: class queue { private item sentinel , tail; public queue () { sentinel = new item(0,null); tail = sentinel; } public void enqueue(int value) { tail.next = new item(value , null); tail = tail.next; } public int dequeue () { int value = sentinel.next.value;​ sentinel.next = sentinel.next.next; return value; } } i don't see how should work, when call constructor method have sentinel[0|null] , let tail=sentinel , tail[0|null] . calling .enqueue(x) , following: [0|pointer tail],  tail[x|null] if call .dequeue() , sentinel.next null . i asked lecturer , got following reply, doesn't make clearer me: "when call constructor via queue q = new queue(); create dummy item sentinel, value 0 , next pointer null. @ same time let tail point sentinel. adding elements que...

php - Laravel 5.1 Localize Factory Seeder -

i implemented new factory generate random data. want have random data in format of de_de. create faker object first, not case in laravel 5.1 new modelfactory class. how localize then? $factory->define(app\models\aed::class, function($faker) { return [ 'owner' => $faker->company, 'street' => $faker->streetaddress, 'latitude' => $faker->latitude, 'longitude' => $faker->longitude ]; }); in order change default locale used faker, easiest way override fakergenerator binding own concrete implementation: // appserviceprovider.php $this->app->singleton(fakergenerator::class, function () { return fakerfactory::create('nl_nl'); }); on top of appserviceprovider.php file add following lines: use faker\generator fakergenerator; use faker\factory fakerfactory; for example, above code mean faker instances created using nl_nl provider, creating dutch faker data...

php - PDO returns empty array as result -

i have simple search form , use send post request php script using ajax. want script search database keyword in title column, , return rows finds it. posted data looks "searchword=test1" , test1 in content of text input. i have 2 rows in database, 1 has title of test1, , of test2. if select * articles can see results fine. if type select * articles title 'test1'; console, correct result, php script returns empty array. no idea i'm doing wrong here, appreciated. my php: try { $hostname = "localhost"; $username = "root"; $password = ""; $db = new pdo("mysql:host=$hostname;dbname=topdecka_ptc",$username, $password); if (!empty($_post["searchword"])) { $searchword = $_post["searchword"]; $query = $db->prepare("select * articles title %:seachword%"); $query->execute(array(':searchword' => $searchword)); $result = ...