Posts

Showing posts from April, 2011

java - Abstract class and dynamic binding -

so i've been studying abstract classes , dynamic binding , decided test out couple of examples. i have following 3 classes: abstractdemo (main), myabstract , mysubabstract. main method calling methods both classes using dynamic or static binding. all of following calls work except last 1 try use dynamic binding , call 1 of methods defined in subclass (sub1()). assume despite being declared reference of superclass object still able find method declared within object's class. can please explain why? public abstract class myabstract { public abstract void abs1(); public abstract void abs2(); public void nonabs1() { system.out.println("myabstract nonabs1"); } public void nonabs2() { system.out.println("myabstract nonabs2"); } } public class mysubabstract extends myabstract { public void abs1() { system.out.println("mysubabstract abs1()"); } public void abs2() { system.out.println("mysubabstract abs2

android - Integrating SQLCipher with greenDAO -

how encrypt sqlite database in android sqlchipher while using greendao orm. have searched many time in , didn't find working solution . in greendao generator module add dependency compile 'org.greenrobot:greendao-generator-encryption:2.2.0' so build.gradle file generator module apply plugin: 'java' dependencies { compile filetree(dir: 'libs', include: ['*.jar']) compile 'org.greenrobot:greendao-generator-encryption:2.2.0' } and in app gradle file ( build.gradle module app) add these dependencies , remove other greendao related dependencies compile 'org.greenrobot:greendao-encryption:2.2.2' compile 'net.zetetic:android-database-sqlcipher:3.5.1' and set database way daomaster.encrypteddevopenhelper helper = new daomaster.encrypteddevopenhelper(context, "secrets.db"); database database = helper.getwritabledatabase("your secret key"); daomaster daomaster = new daom

How to execute linux command using Java -

how execute this: ffmpeg -i missing/missing.mp4 -vf scale=-1:360 -c:v libx264 -crf 26 -preset veryslow -c:a copy missing_new123.m3u8 linux command using java code runtime.getruntime().exec(new string[]{"sh", "-c", "ffmpeg -i missing/missing.mp4 -vf scale=-1:360 -c:v libx264 -crf 26 -preset veryslow -c:a copy missing_new123.m3u8"}); see helps

python - Input multiple lines in pycharm -

this question has answer here: taking multiple inputs user in python 9 answers i error when try input program tries find location of number in array, want give entire input @ 1 go how can it, there easier way? thank you. following error when trying execute in console in pycharm example input 2 4 1 2 3 4 3 5 10 90 20 30 40 40 # returns index of x in arr if present, # else returns -1 def search(arr, x): n = len(arr) j in range(0,n): if (x == arr[j]): return j return -1 # input number of test cases t = int(raw_input()) # 1 one run input test cases in range(0,t): # input size of array n = int(raw_input()) # input array arr = map(int, raw_input().split()) # input element searched x = int(raw_input()) print(search(arr, x)) on pycharm console input: 2 4 1 2 3 4

ssl - strange certificate chain in website -

Image
i'm new site encryption , looking expend knowledge certificates while surfing online , i've stumbled on this site when looking on cert chain looks legit : but ... when capture ssl handshake , 1 of certificates missing : my question(s) : 1) how come browser sees cert chain depth 3 details while wireshark doesn't ? 2) how legit the root issuer not part of chain ?? i've tested using chrome , explorer what missing here ? how come browser sees cert chain depth 3 details while wireshark doesn't ? the browser shows trust path locally stored root ca, including root ca. wireshark showed certificates sent server. while leaf certificate same intermediate certificates (and root) might differ depending on certifaces trusted browser already. how legit the root issuer not part of chain ?? the idea of certificate validation never trust peer, because peer might lying you. instead have local ca certificates (trusted root) , build trust c

Django and dates in UTC -

i use django use_tz set true . set time_zone . thing datetimes stored in db in utc (-2 hours timezone). when print datetime template it's still in utc. how automaticaly tell django print datetimes in local timezone (which should default behavior). i use mysql , datetime saved 2016-09-20 22:00:00 2016-09-21 00:00:00 in local timezone. thanks. you can local time using arrow , datetime packages. , can use arrow convert date & time in required formats. install arrow in virtualenv using pip command. import arrow import datetime today = arrow.utcnow().to('asia/calcutta').format('yyyy-mm-dd hh:mm:ss') '2016-09-13 15:57:38' visit our blog, know more arrow , installation procedure https://micropyramid.com/blog/python-arrow-to-show-human-friendly-time/

elixir - How to provide different log levels to the loggers in the mix application? -

i installed rollbax package, provides ability log output rollbar via rollbax.logger module. problem want have level: :info default elixir :console logger , level: :error rollbax.logger . how can that? you can in config.exs, this. config :logger, backends: [ :console, {rollbax.logger, :rollbax} ] config :logger, :console, metadata: [:application, :module, :function, :file, :line], metadata_filter: [], compile_time_purge_level: :info, level: :info config :logger, :rollbax, metadata: [:application, :module, :function, :file, :line], metadata_filter: [], compile_time_purge_level: :error, level: :error

java - How can i delete element in set Redis? -

how can delete element(s) sorted set generated adding location using geoadd for example: geoadd test -0.12455 51.5007 "big ben" -0.12520 51.50115 "westminster station" -0.11358 51.50482 "bfi imax" i want delete "westminster station" element , ideas? , there away delete element using lettuce api? the geo index implemented sorted set , can use zrem remove location. `zrem test "westminster station"`

html - Change table td using javascript -

i new javascript take easy on me. want change data inside table using javascript. have looked everywhere suitable tutorial haven't found any. code. function trans() { var table = document.getelementbyid("table"); var row = table.getelementsbytagname("tr")[2]; var td = row.getelementsbytagname("td")[0]; td.innerhtml = "julius"; } **css** table { width: 100%; border-collapse: collapse; font-family: calibri; } tr, th, td { border: 2px solid black; padding: 10px 10px 10px 10px; } thead { background-color: black; color: white; } tbody { background-color: white; color: black; } .center { text-align: center; } .caption { text-align: center; } button { background-color: blue; color: white; border-radius: 5px; height: 25px; } <html> <body> <table id="table" title="employment status verses living conditions"> <ca

Parse XML value with Name Space in SQl -

i have following xml : <productionschedule xmlns:inp2="http://www.wbf.org/xml/b2mml-v0401" xmlns="http://www.wbf.org/xml/b2mml-v0401"> <inp2:productionrequest> <inp2:id>0916a</inp2:id> <inp2:description>subh190916a</inp2:description> <inp2:location> <inp2:equipmentid>myequpiment</inp2:equipmentid> </inp2:location> <inp2:segmentrequirement> <inp2:id>000</inp2:id> <inp2:earlieststarttime>2015-10-17t12:00:00</inp2:earlieststarttime> <inp2:latestendtime>2015-10-19t12:00:00</inp2:latestendtime> <inp2:materialproducedrequirement> <inp2:materialdefinitionid>geec3ma0025emzi</inp2:materialdefinitionid> <inp2:quantity> <inp2:quantitystring>2</inp2:quantitystring> </inp2:quantity> <inp2:materialproducedrequirementproperty>

metal - Compile error after update to swift 3 -

Image
i have xcodeproject use learning metal swift . after update swift3 , have compile error: error: cannot have global constructors (llvm.global_ctors) in compute command /applications/xcode.app/contents/developer/platforms/macosx.platform/usr/bin/metallib failed exit code 1 which, compute name of kernel function. did not indicate part of code coursing error. , did mentioned llvm.global_ctors , might related build setting part. not familiar part not sure how fix it. how can resolve this?

GIT osx command line can push to existing repo, can't create new -

yesterday created new github repo using following git commands in osx command line: git init git add . git commit -m "message" git push now when make change repo , add, commit , push changes works fine. now i'd try same new repo, keep getting following errors: no configured push destination. so i've tried adding remote repo using following command: git remote add origin git@github.com:ronnyrr/overlaymodel.git which seems work (no error), repo isn't created on github account. after push using: git push origin master still doesn't work, following error shows up: error: repository not found. fatal: not read remote repository. please make sure have correct access rights , repository exists. but strange thing when run git remote add command again prints: fatal: remote origin exists. although repository isn't created in github account.. when i'm using curl command create repository, repo does shows in githu

Sharepoint 2013 _vti_bin/listdata.svc REST API information -

how modify information comming http://ourintranet/_vti_bin/listdata.svc ? how check info stored? odata connection or information design tools needed? you can use excel service retrieve data using given query. please refer url

Qt 5.7 with MinGW: qmake.exe missing -

i tried install qt 5.7 mingw on windows 10 (32bit). in tools -> options -> build&run see programm has found mingw debuggers (gdb.exe) , mingw compilers automatically, there no mingw-qt-version , no mingw kit. understand, 1 can add them, qt-version 1 needs qmake.exe (mingw -> bin...). doesn't exist. tried install mingw seperately, there qmake.exe didn't come well. copying qmake.exe computer didn't help. if use copied version "creating" mingw-qt-version, says like: "the qt-version isn't installed properly, please execute make install". i've read qt 5.2 has no kit or qmake mingw after installation , other questions, couldn't find helpful answer. https://wiki.qt.io/building_qt_desktop_for_windows_with_mingw says: "do have build qt? perhaps not. official qt sdk installer work fine. follow these steps if want learn how make cutom build or if aim x64 target. " should possible run qt without building, shouldn't it

Scala Trait Mixin order -

object sandbox { class numbers { def price() : list[int] = list(1,3,5,7) def printit(): unit = { price.foreach(x => print(x+ " ") ) } } trait doubleit extends numbers { override def price() : list[int] ={ println("doubling") super.price.map(x => x*2) } } trait addit extends numbers { override def price() : list[int] = { println("adding") super.price.map( x => x+2) } } def main(args :array[string]): unit = { val obj = new numbers doubleit addit obj.printit() } } //output : adding doubling 4 8 12 16 in above code, price() method addit trait executes first (from print statement).but shouldn't value 6 10 14 18 ? why values doubled before adding? your traits stacked in order declare them: addit doubleit numbers when run printit, you're doing on addit, resulting in following call chain: addit.printit addit.printit.price //here

c# - Disable selection from Radcombobox list of values -

i want list items in radcombobox (values binded dataset) user should not allowed select value radcombobox. user should able see items selecting item should disabled. i appreciate help. in advance. you can in aspx part of page. right in way. <telerik:radcombobox x:name="radcombobox" width="200"> <telerik:radcomboboxitem content="alapattah" isenabled="false"/> <telerik:radcomboboxitem content="brickell avenue" /> <telerik:radcomboboxitem content="downtown miami" isenabled="false"/> </telerik:radcombobox> but if binding programatically, can this: foreach(radcomboboxitem item in radcombobox.items) { item.enabled = false; } then in both cases user can view, can't select disabled items. more info here: http://docs.telerik.com/devtools/wpf/controls/radcombobox/howto/enable-disable-radcombobox-items

php - INSERT / UPDATE Mysql Single Form -

i have 2 database tables tbl1 users ---------- tbl2 gamesystems uid field ------------- gs_uid field the 2 tables tied user_id.. now want tbl2 updated able , fields not required.. exception of gs_uid when update there system. my issue need insert user_id gs_uid. function game_system() { if(isset($_post['game_system'])) { $user_id = $_session['uid']; $motherboard = escape($_post['motherboard']); $processor = escape($_post['processor']); $memory = escape($_post['memory']); $graphics = escape($_post['graphics']); $harddrive = escape($_post['harddrive']); $power = escape($_post['powersupply']); $cooling = escape($_post['cooling']); $towercase = escape($_post['towercase']); $sql = "insert gamesystem(gs_uid, motherboard, processor, memory, graphi

c# - Unity3D Dynamic variable declare -

this question has answer here: use dynamic keyword/.net 4.6 feature in unity 1 answer i'm having trouble when trying make dynamic variable example: → public type_unknow mytype; void awake(){ //i want make mytype spriterenderer or image or int float etc. } i appreciate replies. this called implicit type, when want have declare var type variable. var keyword tells compiler infer type of variable expression on right side of initialization statement. example: // compiled int var = 5; // s compiled string var s = "hello"; // compiled int[] var = new[] { 0, 1, 2 }; // expr compiled ienumerable<customer> // or perhaps iqueryable<customer> var expr = c in customers c.city == "london" select c; // anon compiled anonymous type var anon = new { name = "terry", age = 34 }; // list compiled list&l

influence of NO_CMAKE_PACKAGE_REGISTRY on CMake find_package() -

i have following cmakelists.txt : cmake_minimum_required(version 2.6) set(cmake_module_path "${cmake_source_dir}/cmake") find_package(foo quiet no_cmake_package_registry) if (foo_found) message("foo found") else (foo_found) message("foo not found") endif (foo_found) find_package(foo quiet) if (foo_found) message("foo (2) found") else (foo_found) message("foo (2) not found") endif (foo_found) there file ${cmake_source_dir}/cmake/findfoo.cmake . however, when run cmake detects package foo in second case only: -- (...) -- detecting cxx compiler abi info -- detecting cxx compiler abi info - done foo not found foo (2) found -- configuring done -- generating done -- build files have been written to: /home/me/tmp/build my understanding of d

sql - Does the precision of datetime field change when used with bigint field to form a composite key or Unique Index? -

i need use composite key or unique index comprised of bigint data type , datetime data type. however, i've noticed seconds element of datetime has been rounded nearest minute , causes duplicate key violation when trying import dataset. the dataset transactional data, our id (stored in bigint field) repeated, hence need inclusion of datetime field in unique key. to give example: following 2 rows cause 'duplicate key row' error: id field (bigint) | actiondate (datetime) --------------------- |-------------------------- 1050000284002 | 2016-01-08 15:51:24.000 1050000284002 | 2016-01-08 15:50:35.000 the values different (and stored correctly in database) error shows: the duplicate key value (1050000284002, jan 8 2016 3:51pm). (it's worth adding created composite key , have since replaced unique index; error outlined above generated index in place.) my questions are: is datetime field being rounded because i'm using int

sql - Syntax error in “insert into statement” -

i working on pat school can please me code keep getting same error. this first one dmrecord.qrymembers.paramcheck := true; dmrecord.qrymembers.sql.text := 'insert members ' +'([membername],[membersurname],[age],[cellnumber],[emailaddress])' +' values ' +'(:membername, :membersurname, :age, :cellnumber,:emailaddress)'; dmrecord.qrymembers.parameters.parambyname('membername').value := sname; dmrecord.qrymembers.parameters.parambyname('membersurname').value := ssurname; dmrecord.qrymembers.parameters.parambyname('age').value := iage; dmrecord.qrymembers.parameters.parambyname('cellnumber').value := icellphone; dmrecord.qrymembers.parameters.parambyname('emailaddress').value := semail; dmrecord.qrymembers.execsql; this second one dmrecord.qryresults.paramcheck := true; dmrecord.qryresults.sql.te

Create a sinus wave with increasing steps frequencies matlab -

i'm novice in matlab programing , thank in advance help. generate un sinus wave function starting 0.25 hz , increasing every 8 oscillations 0.05 hz until 0.7 hz. amplitude constant. i try code: cyc = 8; % number of cycles lf= 0.25:0.05:0.7 %% frequency increment t=1/fe:1/fe:(cyc/lf); % time per freq step wave = sin(2*pi*t) end plot(wave) thank help. 1) try this: cyc = 8; % number of cycles wave = []; t = []; f = 0.25:0.05:0.7 %% frequency increment t=0.01/f:0.01/f:(cyc/f); % time per freq step wave = [wave,sin(2*pi*f*t)]; if isempty(t) t = t; else t = [t,t(end)+t]; end end plot(t,wave) 2) following comment, code memory preallocation: cyc = 8; % number of cycles npoints = 100; % number of points in 1 cycle f = 0.25:0.05:0.7; %% frequency increment nf = length(f); wave = zeros((cyc*npoints-1)*nf+1,1); t = zeros((cyc*npoints-1)*nf+1,1); t0 = 0; t_f = linspace(0,cyc,cyc*npoints); % time*frequency per freq step nf

How to build a python package in a dev mode from source code with conda? -

i working on open source python project depends on lot of non-python packages (perl, r, ...). consequently, use conda install dependencies, can't installed pip. you can run $ conda install --channel bioconda <awesome_package> install stable build of package. want install in development mode. purely python project, i'd this: pull source code github $ cd path/to/awesome_package && pip install -e . run tests modify code run tests etc in step 2 above, pip command installs need work. uses setup.py script job, , requirements.txt requirements_dev.txt install dependencies. and, don't need rebuild/reinstall when change in source code. how do same conda instead of pip ? how provide list of requirements (python , non-python) conda ? the relevant thing found this: http://conda.pydata.org/docs/building/bpp.html however, approach i'd need rebuild , reinstall package locally time want run tests, i'd avoid. i going change python source

Using Properties in JMeter Random Timer -

i'm trying figure out how can use properties set delays before request set in jmeter. had suite setup uniform random timer's , hard-coded values in "random delay maximum" , "constant delay offset" fields, worked great. example: <uniformrandomtimer guiclass="uniformrandomtimergui" testclass="uniformrandomtimer" testname="uniform random timer" enabled="true"> <stringprop name="randomtimer.range">9879</stringprop> <stringprop name="constanttimer.delay">3456</stringprop> </uniformrandomtimer> but i've replaced hard-coded values properties this: <uniformrandomtimer guiclass="uniformrandomtimergui" testclass="uniformrandomtimer" testname="uniform random timer" enabled="true"> <stringprop name="randomtimer.range">${__p(getrandomintakeoffset)}</stringprop>

directory - Java detecting directories -

good afternoon. i'm maintaining application needs parse directories. application uses file.isdirectory() detect whether given path directory or file, recursively fetches files , sub-directories contained. this works, unless directory name contains spaces, path c:\foo\bar detects both foo , bar directories, desired behaviour; path such c:\f oo\bar not: file.isdirectory() returns false (as file.isfile() ) on such path. on other hand, file.isabsolute() returns true - it's absolute path, neither file nor directory, according file library. is there workaround? alternatives detect whether given path directory? or doomed running application on directories no spaces in them? thank attention. edit: file created rather tortuous process involving string being converted file string , file on 5-6 method calls (not code). anyway, i've located root of issue, think. i'll fix it. should delete question? don't see being useful future users. i tried

java - Spring security- Infinite user session time out with IDP -

our application using spring security saml handling user authentication. have got requirement keep user session alive infinite period. there way set infinite timeout in spring saml user session time out? idp has following configuration, no problem there. <session-config> <session-timeout>-1</session-timeout> </session-config> in sp, maxauthenticationage set 36000 keep active 10 hrs. default 7200. http://docs.spring.io/spring-security-saml/docs/current/api/org/springframework/security/saml/websso/webssoprofileconsumerimpl.html one solution keep session alive making authentication requests in background periodically(not sure approach), never logs out. other idea please?

node.js - Serve mp3 through TCP server -

Image
i'm trying serve mp3 file through tcp server adding headers emulate http server. headers i'm using are: var header = `http/1.1 206 partial content\r\ncontent-type: audio/mpeg\r\ncontent-length: ${filestat.size}\r\n'cache-control: no-cache'\r\nconnection: keep-alive\r\nlast-modified: ${date.togmtstring()}\r\n\r\n` an way create server: let server = net.createserver((socket) => { socket.on('data', (data) => { socket.write(buffer(header, 'ascii')) rnfetchblob.fs.readstream('/storage/sdcard1/music/elpisito.mp3', 'ascii') .then((stream) => { stream.open() stream.ondata((chunk) => { socket.write(buffer(chunk, 'ascii')) }) stream.onend(() => { socket.end() }) }) } }) socket.on('error', (error) => { console.log('error ' + error) }) }).listen(serverport, '0.0.0.0', () => { console.l

javascript - Focus on a form field with a variable -

i have relatively simple issue i'm trying resolve , can't seem find it. i working on existing product, after error modal closed need focus on given form field, @ point have stored in variable. currently works: $("input[field='number']").focus(); i've simplified variable names. no have variable below; myfield = 'number' but attempts focus on failing, i've tried: $("input[field=myfield]").focus(); $("input[field='myfield']").focus(); as said i've had around sadly cannot find need. appreciated. thanks you using variable name instead of contents. try this $("input[field='" + myfield + "']").focus();

javascript - Asynchronous jquery - ajax when().then(); -

i'm new in ajax & jquery , have been trying read documents i'm having hard time understanding concepts: $.when(function(){ $.ajax({url:'php/mostrarphp.php', type:'post',data: {quehacer:"mostrarusuarios"}}) .then(function(success){ $("#main").html(success); },function(error){ $("#main").html(error); }); }) .then(function(){ console.log("test"); }); what i'm trying first function go php file , inside file there include file. after want have console log shown. (this practice when need run functions retrieve data , take longer). the issue here echo not showing on application, shows resolved on (console.log("test")). what correct way have execute inside function , second one? when use $.when , creating new promise, 1 needs resolved. normally, $.when used &quo

php - How to use a customized/restrained table for a model in laravel? -

let's have 2 models 'car' , 'domestic' use same table named 'cars'. example: cars id | brand | type 0 | bmw | foreign 1 | audi | domestic 2 | ford | domestic the 'car' model uses whole 'cars' table is. when call 'domestic' model rows have 'type' column set 'domestic' used , affected. when do: $cars = car::all(); // returns cars $domestics = domestic::all(); // returns domestic cars domestic::create(['brand'=>'fiat']); // creates car domestic type we can customize table name model protected $table = 'cars' . there way restrain custom table? i dont believe can restrain eloquent model how it, workaround can try method overrides: in domestic.php add methods: public static function all() { $columns = is_array($columns) ? $columns : func_get_args(); $instance = new static; return $instance->newquery()->where('type' => 'domestic

java - How to use the same field several times in Jide Pivot Table? -

Image
i found, can use each field once in jide table. example, if counted mean on field unable count sum on same field. is possible overcome? update here example of jide pivottable field panel opened ar right: as see, fields, taken fields panel , dragged data area or row area, disappeared fields panel. means field can exist in 1 area. the same implies api method pivotfield#setareatype() , has scalar argument. i.e. 1 field can assigned 1 area type. this caused me duplicate field region area 4 times in underlying source: 1 value, 1 mean, 1 min, 1 max. simultaneously, wish have same field counted several times different aggregation function looks general , strange, if pivottable not allow out of box.

html - JavaScript function doesn't run on click -

although know lot these languages such arrays , functions, i'm having basic problem getting javascript run, here's code: <!doctype html> <html> <head> </head> <body> <input type="submit" value="submit" onclick="click()" /> <script> function click() { alert("hey"); } </script> </body> </html> you're running problem: javascript function name cannot set click? you can fix changing function name else function myclick <head> </head> <body> <input type="submit" value="submit" onclick="myclick()" /> <script> function myclick() { alert("hey"); } </script> </body> </html>

sql - Change/replace the value of a variable dynamically- oracle -

i have set of sql statements (create table, views, sequences), schema name changes time , rest of sql same. in schema name part of has change, example: have schema name abc_xyz , change schema name abc_def_xyz . tried insert variable in schema name abc_&var1_xyz . if pass variable in schema name shown here ( abc_&var1_xyz ) , pass value variable, ask me declare vaue of variable. have given error , code use below: error report - ora-06550: line 5, column 52: pls-00201: identifier 'rel4' must declared ora-06550: line 5, column 1: pl/sql: statement ignored ora-06550: line 7, column 51: pls-00201: identifier 'rel4' must declared here create statement: set echo off set verify off undefine myschemapart declare vsql varchar2(32767); begin vsql:= 'begin execute immediate alter table abc_'||&&myschemapart||'_owner.test drop constraint employee_id_fk; exception when others if (sqlcode != -02443 , sqlcode != -942) raise; end

c - STM32F303 USART Configuration -

i pretty new in arm , try configure uart. board use stm32f3 discovery. @ moment try tx signal on pa9 usart1, interrupt routine rx not written yet. in opinion should see signal on pa9 when use oscilloscope, pin has constant 3v pull-up. used reference manual configuration , initialized registers described. see mistake? code far: /*---------------------------------------------------------------------------- * cmsis-rtos 'main' function template *---------------------------------------------------------------------------*/ #define osobjectspublic // define objects in main module #include "osobjects.h" // rtos object definitions #include "stm32f3xx.h" // device header /* * defines */ #define sys_frequency 8000000l //8mhz /* * global variables */ long baudrate=9600; //---------------------------------------------------------------------------------------------------- void initgpio(

windows - Issues with multiprocessing in python hosted in Apache -

i having issues running multiple processes in ptyhon on windows when hosted in wsgi/apache. same code works fine when running in flask self hosted environment running command prompt. snippet calling method: # start processer print("before creating process") p = process(target=self.worker, args=(task_reader, result_writer, pipeline_location_chunks[process_number],)) print("before starting process") #p= process(target=self.testworker) p.start() definition worker method def worker(self, task_reader, result_writer, pipeline_locations): """this method run each sub-process. when initialized loads share of classifier pipelines memory , sends true start function inform ready classification tasks""" # load pipelines in dictionary category number key print("in worker method") pipelines = {} pipeline_location in pipeline_loca

javascript - Angular Controller/Provider setup not exposing variable to front-end -

i'm trying learn angular setting basic app uses facebook's js api. here have far: index.html: <!doctype html> <html ng-app="app"> <head> <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" /> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script> <script src="http://connect.facebook.net/en_us/all.js"></script> <script src="js/app.js"></script> <script> </script> <title>app</title> </head> <body background="${pagecontext.request.contextpath}/images/space.jpg" style="background-size:100% 100%; background-attachment:fixed;" /> <br> <div id='fb-root'></div> <

arrays - Google Tag Manager > dataLayer variable find and replace with javascript variable -

Image
i'm having trouble google tag manager datalayer variable not contain right information. the "sku" field not named correctly , need change "variant". i'm trying achieve custom javascript variable in gtm whatever i'm trying i'm not able find , replace "sku" "variant" in products array. all appreciated. many in advance, adriaan you can create custom javascript variable uses old array , replaces product parameters, that: var arr = {{yourproductarray}}; //check if valid array arr.foreach(function(prod, index, array){ if(prod.sku) { arr[index].variant = prod.sku; arr[index].sku = ""; //reset value if needed } }); return arr;

angular - Using Jquery in Angular2 components -

in node js application , have installed jquery node module. in order use jquery in angular2 components have include below statement in components. const $ = global.jquery = require('jquery'); i using webpack module loading. my question is correct way of implemention or should follow other approach ?

python - How to remove everything (except certain characters) after the last number in a string -

this follow-up of this question. there learned how remove characters after last number in string; can turn w = 'w123 o456 t789-- --' into w123 o456 t789 now might have strings this: w = 'w123 o456 (t789)' in case, re.sub(r'\d+$', '', w) would give me w123 o456 (t789 so have 2 closely related questions: 1) how can modify command re.sub(r'\d+$', '', w) in way characters kept (e.g. parenthesis)? 2) how can modify command re.sub(r'\d+$', '', w) characters removed (e.g. dashes , white spaces)? edit @martin bonner's answer gets close e.g. w='w123 -o456 t789--) --' the command re.sub('[- ]+$', '', w) gives me w123 -o456 t789--) should rid of remaining dashes. you may use re.sub in callback replacement pattern. re.sub(r'\d+$', lambda m: re.sub(r'[^()]+','',m.group(0)), s) here, match symbols other digits @ end of string,

logging - log-driver=gelf does not work on CoreOS? -

i'm migrating docker server centos coreos. when tried configure docker demon send log messages logstash using gelf (graylog extended logging format) got following error docker: error response daemon: cannot start container c2522f318221b53fb360dca08c806f20b5b04b55529e89d79658d328c196c4ca: failed initialize logging driver: failed logging factory: logger: no log driver named 'gelf' registered q: docker on coreos compiled without gelf support? i continue using gelf because docker adds fields image_name log-messages default. q: there log driver supports that? edit: the server: kernel version: 4.1.7-coreos-r1 operating system: coreos 766.5.0 and docker client version: 1.7.1 client api version: 1.19 server version: 1.7.1 server api version: 1.19 the gelf logging driver added in docker 1.8.0 . either upgrade docker (and coreos) or you're out of luck.

owin - ASP.NET MVC 4.5.2 connecting to IdentityServer4 -

i have website running on asp.net mvc 4.5.2. have identityserver4 server running when try , authenticate against an: invalid_request for asp.net core mvc documentation has: app.usecookieauthentication(new cookieauthenticationoptions { authenticationscheme = "cookies" }); app.useopenidconnectauthentication(new openidconnectoptions { authenticationscheme = "oidc", signinscheme = "cookies", authority = "http://localhost:5000", requirehttpsmetadata = false, clientid = "mvc", savetokens = true }); i including following nuget package in project microsoft.owin.security.openidconnect. code follows: app.usecookieauthentication(new cookieauthenticationoptions { authenticationtype = "cookies" }); app.useopenidconnectauthentication(new openidconnectauthenticationoptions { authenticationtype = "oidc", signinasa

Can a mobile App (Android or IOS) be used for Wi-Fi Authentication (instead of Splash pages) for seamless guest experience -

i working on retail app. use mobile app allowing guests access free wi-fi in stores. the ideal outcomes if user has mobile app, user automatically logged wi-fi without manual intervention. if user not have mobile app, user sees splash page , given option download mobile app. once mobile app download selected, given access network 3 specific questions: is there way in app can access available wifi ssid's seen iphone / andriod? , can app join chosen ssid? how done is there way in app fills out splash page information access? how done is there recommended best practices enabling this- know more of opinion, looking examples learn from. thanks, nb: have tried splash pages / captive portals don't want additional step causes friction in adoption

newbie ask about decimal to binary in c++ -

this program suppose convert decimal binary somehow screw up can 1 point out error me? thanks lot #include<conio.h> #include<stdio.h> int main(){ int a; int b[20]; int q = 0; printf("decimal : ");scanf("%d",&a); while(a>0)) { b[q]=a%2; a=a/2; q++; }while(a>0); printf("binary : "); (int = q-1; i>=0;i--){ printf("%d",b[q]); } } corrected code is: #include<conio.h> #include<stdio.h> int main(){ int a; int b[20]; int q = 0; printf("decimal : ");scanf("%d",&a); while(a>0) { b[q]=a%2; a=a/2; q++; } printf("binary : "); (int = q-1; i>=0;i--){ printf("%d",b[i]); } } you printing b[q] instead of b[i]

sql - Overlay balance to credit and debit Line graph in PowerBI -

i creating dashboard direct query. using line graph visulations plotting transaction volumes , splitting them: credit or debit. on same graph overlay current balance. please see attached image. combine these 2 graphs dont know how to. advice welcomed! enter image description here i change visualization line , stacked column chart . can use account balance column series . the line values little trickier. need 2 new calculated measures, like: credit = calculate ( sum ( 'my table'[volume] ) , 'my table'[txnmethod] = "credit" ) ditto debit. note guessing aggregation [volume]. add 2 new measures line values . buried in format section under y-axis show secondary switch, turn on separate y-axis lines.

java - btrace visualvm interfaces require ASM 5 -

when run simple java8 program package test; public class traceint { public static void main(string args[]) throws interruptedexception{ traceint ti = new traceint(); while(true){ integer.valueof((int)system.currenttimemillis()); ti.sleep(1000); //system.getproperty("user.dir"); } } public void sleep(int millis){ try { thread.sleep(millis); } catch (interruptedexception e) { // todo auto-generated catch block e.printstacktrace(); } } } and run btrace script against it @onmethod( clazz = "/.*/", method = "/java.lang.*/", location = @location(value = kind.entry, = where.before) ) public static void onentry(object obj) { println(strings.strcat("on entry: ", identitystr(obj))); } i error in program java.lang.illegalargumentexception: invokespecial/static on interfaces require asm 5 @ com.sun.btrace.org.objectweb.asm.methodvisitor.visitmethodinsn(unk

css - best practice to do line breaks in HTML with bootstrap -

i need line break, don't want using <br> tags on html. so tried use : <div class="clearfix"></div> http://v4-alpha.getbootstrap.com/components/utilities/#clearfix but did not work. basicly want empty line separate divs. e.g.: <div class="col-md-12"> <button type="button" ng-show="versions" class="btn"> copy link<i class="fa-link"></i> </button> </div> <div class="clearfix"></div> <div class="col-md-12"> <button type="button" ng-show="versions" class="btn"> copy link<i class="fa-link"></i> </button> </div> any suggestions? thanks just use bottom margin...that's it's for. .col-md-12 { margin-bottom:1em; } .col-md-12 { margin-bottom: 1em; } <link href="https://cdnjs.cloudflar

javascript - AngularJS - how to set css class for the custom directive? -

have tab css class nav html element i'm going use directive this: <nav tab></nav> it expected interpreted this: <nav class="tab"> <a></a> <a></a> <a></a> </nav> ... , works expected except of issue cannot set css class top <nav> element. of course, specify using ng-class explicitly seems not great idea. have heard .addclass() option doesn't work @ all: tab.directive('tab', function($compile) { return { restrict: 'a', templateurl: 'nav-tab.html', controller: function($http, $scope) { $http.get('/tab/list') .success(function(data) { $scope.tabs = data; }).error(function() { alert("error"); }); }, controlleras: 'tab', link:

Python appending from previous for loop iteration -

i have simple annoying problem. reading in list of files 1 one names stored in ascii file ("file_input.txt") , performing calculations on them. issue when print out result of calculation ("print peak_wv, peak_flux" in script below) appends previous printout. below code have written, please me see i'm doing wrong here. from math import* wv = [] flux = [] fits = [] p = open("file_input.txt","r") line in p: fits.append(str(line.split()[0])) p.close() j in range(len(fits)): f = open("%s"%(fits[j]),"r") line in f: wv.append(float(line.split()[0])) flux.append(float(line.split()[1])) f.close() print "%s"%(fits[j]) in range(len(wv)): if 6555.0<wv[i]<6569.0: m1 = (flux[i+1]-flux[i])/(wv[i+1] - wv[i]) m2 = (flux[i+2]-flux[i+1])/(wv[i+2] - wv[i+1]) if m2*m1 < 0: peak_wv = (wv[i+2]+wv[i+1]+wv[i])/3.0

Python function calling -

i've started learning python. if wrote: def questions(): sentence= input(" please enter sentence").split() how end function if user didn't input , hit enter def questions(): sentence= input(" please enter sentence").split() if sentence == []: #this happens when nothing entered else: #this happens when entered

Inconsistent Setting Variables CakePHP -

so have following in controller: $employee_options = array( 'conditions' => array('employee.id' => $this->employee_id), 'recursive' => 4, ); $employees = $this->employee->find('all', $employee_options); $this->set('employees', $employees); $initial_dept_id = $this->employee->field('department_id', array('id' => $this->employee_id)); first had this $index_chosen = $this->employee->field('index_chosen_section', array('id' => $this->employee_id)); $this->set('initial_dept_id', $initial_dept_id); $this->set('$index_chosen', $index_chosen); then changed $index_chosen this, when couldn't work: $index_chosen = $employees[0]; $this->set('initial_dept_id', $initial_dept_id); $this->set('$index_chosen', $index_chosen); here view: <pre> <?php print_r($employees[0]) ?> </pre> <pre>

javascript - How to get only particular key value pair from json data and store in variable in node js -

i have sample json data,which need add in different collections in mongodb.but dont want whole json data.for example, jsondata= {"widget": { "debug": "on", "window": { "title": "sample konfabulator widget", "name": "main_window", "width": 500, "height": 500 }, "image": { "src": "images/sun.png", "name": "sun1", "hoffset": 250, }, "text": { "data": "click here", "size": 36, "style": "bold", }} in json want window key in 1 collection,simillarly image key in mongo collection. thinking if can save key value pair in 1 variable,then can add variable in collection.for trying each var jsondat=json.parse(jsondata); for(var exkey in jsondat) { console.log("entering"); var b=stringdata[exkey].image; console.log(b

ios - Make UICollectionViewController paged sections -

i'm making collectionview 1 section means 1 calendarday, want make paged shows 1 section (1 day) @ time can swipe (scroll) left or right show me next day. i cant seem find solution or im dont know right keywords... im using storyboard , collectionviewcontroller embedded in containerview in normal uiviewcontroller. any appreciated! i think want work scrollview. easer , faster

react native - Setting background image position (i.e. `background-position-x` and `background-position-y` in web) -

when have background image: <image style={{flex: 1, width: null, height: null, resizemode: 'cover'}} source={require('../images/background.png')}> <!-- children --> </image> i expecting image cover entire screen while keeping image's aspect ratio. (see so question why i'm using width: null, height: null .) however, if image width far smaller height, image centered crops top. question: how make image start top instead, background-position: 50% 0 in web?

import - importing data into r that can not be as numeric -

i use both read.csv , read.table importing data following, it`s not numeric.can me whats problem? x<-read.csv("d:\\r-files\\mydata1.csv",header=true,dec = ".") > is.numeric(x) [1] false or x<-read.csv("d:\\r-files\\mydata1.txt",header=true,dec = ".") > is.numeric(x) [1] false> x <- read.csv(file="d:\\r-files\\mydata1.csv", header=true, sep=",", dec = ".", stringsasfactors = false) x <- as.matrix(x) hopefully solve query.

java - How to print a series of natural no.s in the form of two Pyramids , one normal and one inverted using single for loop? -

i trying generate kind of pattern based on user input .here input num=7 output 1 1 2 1 2 3 1 2 3 4 1 2 3 4 5 1 2 3 4 5 6 1 2 3 4 5 6 7 1 2 3 4 5 6 1 2 3 4 5 1 2 3 4 1 2 3 1 2 1 to achieve ,i came code : import java.util.scanner; class test { public static void main(string arr[]) { scanner input=new scanner(system.in); system.out.println("enter no print symmetrical pyramid :"); int num=input.nextint(); //printing normal pyramid for(int i=0;i<=num;i++) { for(int j=1;j<i;j++) { system.out.print(j); } system.out.println(""); } //middle for(int i=1;i<=num;i++) { system.out.print(i); } system.out.println(""); //printing inverted pyramid for(int i=num;i>=0;i--) { for(int j=1;j<i;j++) { system.out.print(j); } system.out.println(""); } } } how

php - $casts, array data -

i'm using $casts save data in array database. have issue that. how can push data existing array in database? example have array of data in db column like: ["some_data", "another_el"] , on , in controller want push in array in db other data input. $brand = brand::find($request->input('brand')); $brand->model = $request->input('model'); $brand->update(); pushing data this. you cannot eloquent's mass assignment functions (update, create, etc). must pull down field, change it, save model. $collection = collect($brand->field); $collection->push($mynewdata); $brand->field = $collection->tojson(); $brand->save();

php - MySQL Error 1064 when using CASE trying to update a field in between two tables -

i have 2 tables: projects , temp_projects ($table in code below). i'm using following mysql query try , update field on temp_projects using data projects. here query: $this->q("update $table, projects case when $table.$number_field != projects.number set $table.$id_field = projects.id $table.old_proj_num = projects.number when $table.$number_field = projects.number set $table.$id_field = projects.id $table.$number_field = projects.number end"); the error is: mysql error 1064: have error in sql syntax; check manual corresponds mysql server version right syntax use near 'case when temp_projects.number != projects.number set temp_proj' @ line 2 when executing: update temp_projects, projects case when temp_projects.number != projects.number set temp_projects.project_id = projects.id temp_proj