Posts

Showing posts from April, 2011

javascript - IDBKeyRange.only() returns only first matching record -

i querying database table follows: function getallrecords(letter) { var trans = db.transaction(["observablestates"],"readonly").objectstore("observablestates").index('letterindex'); //get matching records var request = trans.opencursor(idbkeyrange.only([letter])); request.onsuccess = function(event) { var cursor = event.target.result; if(cursor) { count+=1; cursor.continue(); console.log(cursor); } } request.onerror = function(event) { console.log('error loading data table'); } //delete of returned records } i have 2 records having value of letter first record returned. cursor.continue() not seem work in case. any appreciated. thanks that should work, , can't reproduce problem. it's possible you're hitting browser bug (which browser testing in?) or there'...

split dataframe column including list of lists on multiple rows into pandas -

i have dataframe df: import pandas pd df = pd.dataframe([ [[[3,0.5, 0.4, 0.7, 5],[2, 0.5, 1, 0.8, 2],[1, 0.5, 1, 1, 2]], 'b'], [[[1, 0.5, 0.6, 0.01, 1],[2, 0.5, 0.3, 0.2, 3],[1, 0.8, 1.0, 0.04, 3]], 'd']], index = ['row1', 'row2'], columns=['col1', 'col2']) i split col1, including list of lists, on multiple lines follows: col1 col2 row1 [3,0.5, 0.4, 0.7, 5] b row1 [2, 0.5, 1, 0.8, 2] b row1 [1, 0.5, 1, 1, 2] b row2 [1, 0.5, 0.6, 0.01, 1] d row2 [2, 0.5, 0.3, 0.2, 3] d row2 [1, 0.8, 1.0, 0.04, 3] d and next split col1 in 2 columns, retaining second , third elements new_col1 new_col2 col2 row1 0.5 0.4 b row1 0.5 1 b row1 0.5 1 b row2 0.5 0.6 d row2 0.5 0.3 d row2 0.8 1.0 d how can done make using pandas? for first step there may not bett...

html - iPhone (Safari) anchor tags don't work as intended -

i'm having trouble specific browser/device need serve website. essentially, have anchor tags display hidden element when clicked. works intended on (firefox/chrome/ie on pc, android ff/chrome/browser) except ios. when clicking "view bio" link, text should transition in , displayed. when doing on ios grey box hovers on element (so assume knows there there), not show hidden element. after doing research can see there may issue way ios deals "onclick" or effect. have tried implement few different things (mainly java-based) though haven't worked. may not need do, implementation purely html/css based, i've tried i've come across. of fixes involved don't involve hidden elements, , more simple "scroll point" implementations. it's same thing. as far can tell, there sort of bug or dislike of anchor tags ios, articles/existing pages have read. may not applicable, according users ios not serve "onclick" or "click"...

r - Creating a sensible line chart to compare the average with the actual -

Image
i have following dataset i want create line chart comparing historical average vs 2016 monthly highway fatalities . want use ggplot graphing. i had more 1 attempt still receive errors (error: not find function "ggplot2") ggplot(homework_8_data, aes(x = months)) + geom_(aes(y = ave_since_2002), colour="blue") + geom_line(aes(y = x2016), colour = "grey") + ylab(label="average , actual highway fatalities") + xlab(label="months") i need me understand error did , correct me. thanks you have install ggplot2 : install.packages("ggplot2") and load : library(ggplot2)

Order a vector in c -

#include <stdio.h> #include <conio.h> #include <string.h> void change(int *v[]) { int tmp; (int = 0; < 10; i++) { (int j = + 1; j< 10; j++) if (*v[i] > *v[j]) { tmp = *v[i]; *v[i] = *v[j]; *v[j] = tmp; } } } void main() { int v[10]; (int = 0; < 10; i++) { printf("enter value v[%d]: \n", i); scanf("%d", &v[i]); } printf("the vector is: \n"); (int = 0; < 10; i++) printf("value on position %d %d \n", i, v[i]); change(&v[]); // think here problem printf("\n\n after function call, vector is: \n"); (int = 0; < 10; i++) printf("value on position %d %d \n", i, v[i]); getch(); } i need ordonate vector don't know how pass value of vector function. can me solve , explain me , make me understand, important. thank guys ! the function must declared like void change(int v[...

java - Unable to inject AutoWired Enviroment when using Spring Boot 1.4 testing annotations -

i running integration tests on spring boot application using cucumber , in step definitions, code had been bootstrapping spring boot app using this: @runwith(springjunit4classrunner.class) @contextconfiguration(classes = application.class, loader = springapplicationcontextloader.class) @webappconfiguration @integrationtest @slf4j public class creditcardstepdefs { .... } now, i'm trying refactor code make use of simplified annotations in spring boot 1.4 , same piece of code looks now: @runwith(springrunner.class) @springboottest(webenvironment = webenvironment.defined_port) @slf4j public class creditcardstepdefs { ... } however, i'm facing problems in picking environment variables in particular piece of code: @autowired private environment env; @before("@run, @post") public void setup() { this.host = env.getproperty("test.url") + env.getproperty("server.contextpath"); this.results = new hashmap<>(); this.paramke...

asp.net core - External Cookie is not destroyed -

in asp.net core app, i'm using social media authentication. after user data social media provider, try destroy "external" cookie provider can create new "internal" cookie user. when check see if user registered or not. for reason though external cookie not getting destroyed. if there's problem , unregistered user aborts process , comes app, seems right through if he's registered user because app accepting external cookie. any idea why external cookie not destroyed? use following line destroy external cookie. await httpcontext.authentication.signoutasync(cookieauthenticationdefaults.authenticationscheme);

javascript - How can I reference jquery library using cgi methods in ruby? -

i'm completing assignment school in need receive information html form ruby cgi script, , use fadein() jquery method display it. my script looks like: #!/usr/local/bin/ruby -w require 'cgi' cgi = cgi.new('html4') cgi.out{ cgi.html{ cgi.head{cgi.title{"this test"}+ cgi.style{"p{color = red;}"}} + cgi.body{cgi.p{"try " + cgi['ffname'] + ", did work?"}} } } this of test code, make sure server working way thought was. when try , use like: puts "<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>" the server refuses run it, guess that's not allowed. i'm still beginner ruby cgi class. how can reference jquery library these cgi methods? similar how sending html client side, send javascript code client side. javascript code contain call jquery function.

javascript - Redux Saga select is not a function -

Image
i trying state inside saga using select effect. i used answer start - getstate in redux-saga? code: const { select } = reduxsaga select() using codepen redux saga setup (line 35). error - select not function much appreciated. the select undefined . you may need upgrade version of react-saga 0.5.0 higher version. e.g. https://npmcdn.com/redux-saga@ 0.5.0 /dist/redux-saga.min.js https://npmcdn.com/redux-saga@ 0.9.0 /dist/redux-saga.min.js (at least 0.9.0 ok in test. 0.12.1 latest.) and import reduxsaga.effects const { put, call, select } = reduxsaga.effects; the revised be:

c# - Disposing Temp Files and Deleting them -

i'm using winforms . made simple image viewer application using picturebox display images. made way create temporary files. these files picture files. when application done using image want able delete these temporary on formclosing files located at: c:\users\taji01\appdata\local\temp\8bd93a0dec76473bb82a12488fd350af cannot call file.delete(c://picture.jpg) because application still using them though there picture displaying in application. tried dispose couldn't figure how how that. should using using statement? there better way dispose , delete file or there way make work? _filename = path.combine(path.gettemppath(), guid.newguid().tostring("n")); file.copy(imagepath, _filename); _stream = new filestream(_filename, filemode.open, fileaccess.read, fileoptions.deleteonclose); this._source = image.fromstream(_stream); error: "the process cannot access file c:\picture.jpg because being used process" exeption thrown: 'system.io.io.exce...

plsql - PL/SQL sending email through a SSL enabled smtp server -

i struggling send mail plsql. using following code. hitting 1 or other error. can plz provide pointers ? l_mail_conn := utl_smtp.open_connection( host => l_smtp_host, port => l_smtp_port, wallet_path => l_wallet_path, wallet_password => l_wallet_password, secure_connection_before_smtp => false); utl_smtp.ehlo(l_mail_conn, l_smtp_host); -- utl_smtp.starttls(l_mail_conn); // if enable line, "503 5.5.2 send hello first" error -- utl_smtp.command( l_mail_conn, 'auth login'); // tried approach same unrecognized authentication type -- utl_smtp.command( l_mail_conn, l_mail_username_encoded); -- utl_smtp.command( l_mail_conn, l_mail_password_encoded); utl_smtp.auth(l_mail_conn,l_mail_username,l_mail_password,utl_smtp.all_schemes); utl_smtp.mail(l_mail_conn, p_from); proce...

How to make this method generic in Scala -

this simple function given index, item in array last e.g. given val arr = array(1,2,3) , val = 0 ; return 3 def findindexfromlast(arr: array[relationship], i: int): relationship = { val cur = val size = arr.length arr(size - - 1) } i want make generic , able accept array of type if make 1st argument seq() , take many different types of collections input. def fromend[t](coll: seq[t], index: int):t = coll.reverse(index) fromend(array(1,3,5,7,9), 0) // res0: int = 9 fromend(list('x','y','q','b'), 3) // res1: char = x fromend(vector(2.2, 5.4, 7.7), 2) // res2: double = 2.2 fromend(stream(true, true, false, true), 1) // res3: boolean = false

python - PyQt4 QTimer doesn't work -

i'm new use pyqt4 qtimer. copy code somewhere seems doesn't work. can me this? from pyqt4 import qtcore, qtgui pyqt4.qtgui import * pyqt4.qtcore import * def startcount(): timer.start(1000) def shownum(): global count count = count + 1 return count timer = qtcore.qtimer() count = 0 timer.timeout.connect(shownum) startcount() i expect see count incremented time, console shows nothing output. can explain this? a qtimer cannot work without running event-loop. try instead: import sys pyqt4 import qtcore, qtgui def startcount(): timer.start(1000) def shownum(): global count count = count + 1 print(count) if count > 10: app.quit() app = qtcore.qcoreapplication(sys.argv) timer = qtcore.qtimer() count = 0 timer.timeout.connect(shownum) startcount() app.exec_()

anypoint studio - How to consume a SOAP Webservice in Mule ESB -

i new mule , need consume it. have 3rd party soap service takes 1 input , provides 1 output mention below. how can call mule, passthrough proxy need transformation required. need call mule. request: <soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:con="http://test.co.nz/controlkeysdetails"> <soapenv:header/> <soapenv:body> <con:getcontrolkeydetail xmlns:con="http://test.co.nz/controlkeysdetails"> <con:keycode>m2m_in_product_code</con:keycode> </con:getcontrolkeydetail> </soapenv:body> </soapenv:envelope> response: <soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:body> <controlkeydetailresponse xmlns="http://test.co.nz/controlkeysdetails"/> </soapenv:body> </soapenv:envelope> mule code: <?xml version="1.0" encoding=...

function - Run Speed in Matlab -

i have written slow code , want make faster. think must time consumer part below part called function (f_xy). there simple way make code faster part? (length(t) approximately 1000000.) i=1:(length(t)-1) % calculation loop k_1 = f_xy(t(i),xx(i),aa,bb,l,t,k,f,d,del); k_2 = f_xy(t(i)+0.5*h,xx(i)+0.5*h*k_1,aa,bb,l,t,k,f,d,del); k_3 = f_xy((t(i)+0.5*h),(xx(i)+0.5*h*k_2),aa,bb,l,t,k,f,d,del); k_4 = f_xy((t(i)+h),(xx(i)+k_3*h),aa,bb,l,t,k,f,d,del); xx(i+1) = xx(i) + (1/6)*(k_1+2*k_2+2*k_3+k_4)*h; % main equation `end` function below: function fp = f_xy(t,r,aa,bb,l,t,k,f,d,del) w_0 = @(r) aa * ( sin(2*pi*r/l) + (del/4)*sin(4*pi*r/l)) + bb; ww_0 = @(r) (2 * pi * aa / l) *( cos(2*pi*r/l) + (del/2) *cos(4*pi*r/l) ); ff = @(r) -d / (k * t * sqrt(1 + ww_0(r)*ww_0(r))); ss = @(r) - t * k * (ww_0(r)/w_0(r)); index = round(t); if(index > 0 && index <= length(f)) fp = ff(r)*(f(index) + ss(r));] else error('index out of bounds'); end en...

php - Why am I getting a “Not Associated” error even though the HABTM association is in place? -

i'm making tournament scoring software bike polo league. goal match teams in such way gets chance play every other team before repeat matches start. in match entity class, have function called creatematches should find teams , associated matches. there habtm relationship between matches , teams, join table. relationship works fine - i've selected teams (contain matches) , matches (contain teams) in several controller methods, saved associations through forms, , on. so, in entity function, error "teams not associated matches. caused using auto-tables? ...." , on. can tell me what's wrong? here's method in question. public function creatematches($tournamentid) { $team = tableregistry::get('teams', ['contain' => ['matches']]); $teams = $team->find('all', ['conditions' => ['tournament_id' => $tournamentid], 'contain' => [...

OpenCL Image reading not working on dynamically allocated array -

i'm writing opencl program applies convolution matrix on image. works fine if store pixel on array image[height*width][4] (line 65,commented) (sorry, speak spanish, , code in spanish). but, since images i'm working large, need allocate memory dynamically. execute code, , segmentation fault error. after poor man's debugging, found out problem arises after executing kernel , reading output image host, storing data dynamically allocated array. can't access data of array without getting error. i think problem way clenqueuereadimage function (line 316) writes image data image array. array allocated dynamically, has no predefined "structure". but need solution, , can't find it, nor on own or on internet. the c program , opencl kernel here: https://gist.github.com/migagh/6dd0fddfa09f5aabe7eb0c2934e58cbe don't use pointers pointers (unsigned char**). use regular pointer instead: unsigned char* image = (unsigned char*)malloc(sizeof(...

java - Trying to get the code to check if there are even brackets -

i trying come code scan string , check see if there number of open , closing brackets on each line. if so, return true. (excuse me incorrectness in formatting not examples take shape unless identified code) {} // code return true {{}} {}{} {{{}{{}}}} } // code return false {} }}{ {{{}{} what tried far: public boolean bracketsmatch(string brackets) { int lb = 0; int rb = 0; int = 0; while (brackets.charat(i) == '{' || brackets.charat(i) == '}' || brackets.charat(i) == '') { if (brackets.charat(i) == '{') { lb += 1; } if (brackets.charat(i) == '}') { rb += 1; } if (brackets.charat(i) == '') { if (lb / rb == 2) { // possible code scan next line next line? // need statement here ^^ before can place if statement below if (bracket.charat(i + 1) == '') { ...

java - this is my first program in GUI and it just wont open any window..no error ,nothing.I run it on commandline .what am i doing wrong? -

import java.util. ; import java.awt. ; public class framo extends frame { public framo() { setlayout(new flowlayout()); panel panel=new panel(); button btn=new button("press"); panel.add(btn); } public static void main(string args[]) { framo f=new framo(); } } you haven't added panel frame. also, need set size of frame , make frame visible. you can refer below sample code - public class framo extends frame { public framo() { setlayout(new flowlayout()); panel panel = new panel(); button btn = new button("press"); panel.add(btn); add(panel); setsize(400, 400); setvisible(true); } public static void main(string[] args) { framo f = new framo(); } } also, please follow java variable naming convention.

Using PIVOT in sql -

i have following typestatusdetails table. table has different typeid s. each type can have max 4 statusid s (or less i.e. eg. typeid 3 has 3 statusid s). recordcount shows no. of records specific statusid. (eg. 3 pending records type_1) --------------------------------------------------------------- typeid type statusid statusname recordcount --------------------------------------------------------------- 1 type_1 1 pending 3 1 type_1 2 in process 2 1 type_1 3 completed 1 1 type_1 4 invalid 1 2 type_2 1 pending 4 2 type_2 2 in process 5 2 type_2 3 completed 6 2 type_2 4 invalid 1 3 type_3 1 pending 1 3 type_3 2 in process 1 3 type_3 3 completed 1 i ...

ios - Load image from folder inside project -

Image
i'm making app folder image below: can see in picture, stickers folder have 2 sub folder "1" , "2". in side them bunch of icon , wanna load in collection view each sub folder package of different sticker. more details, please see picture: so, how can in project folder? i've read access document directory seem not solve problem. please me. in advance. look @ filemanager s api. offers need. example content @ path: let pathtodir1 = bundle.main.resourcepath! + "/stickers/1"; let filemanager = filemanager.default let contentofdir1 = try! filemanager.contentsofdirectory(atpath: pathtodir1) example iterate over: let docspath = bundle.main.resourcepath! let enumerator = filemanager.enumerator(atpath:docspath) let images = [uiimage]() while let path = enumerator?.nextobject() as! string { let contentofcurdir = try! filemanager.contentsofdirectory(atpath: path) // whatever need. } for details see apples documentation , ...

html - Set height of <li> based of div height -

hope can me. trying create navigation variable amount of list elements. want automatically set height of list elements based on height of surrounding div element, , number of list elements in div. there way so, or can other way around, not giving div height value, rather give list elements fixed height? hope can me. #nav ul{ margin: 0; padding: 0; list-style: none; } #nav{ margin-top: 30px; width: 19%; background-color: red; float:left; border-top: 1px solid black; } #nav ul li{ text-align: center; width: 100%; background-color: yellow; height: 50px; margin-top: 20px; line-height: 50px; border-bottom: 1px solid black; border-left: 1px solid black; transform: rotate(20deg); } you can use below code,it work <!doctype html> <html> <head> <meta charset="iso-8859-1"> <title>insert title here</title> </head> <body> <div id="change" style="height:200px;bo...

ios - URL to NSManagedObjectModel is NULL -

i reworked core data model app, beyond point lightweight migration work. have 2 core data models in app bundle , need access each individually (for regular core data setup , manual migration), means [nsmanagedobjectmodel mergedmodelfrombundles:nil] inappropriate / wouldn't work. problem cannot url either model, prevents me instantiating them [nsmanagedobjectmodel alloc] initwithcontentsofurl: . these methods i'm using, , both return null: - (nsurl *)currentmodelurl{ return [[nsbundle mainbundle] urlforresource:@"newmodel" withextension:@"momd"]; } - (nsurl *)oldmodelurl{ return [[nsbundle mainbundle] urlforresource:@"oldmodel" withextension:@"momd"]; } in fact, when try method on other apps, ones single model, never returns model url. odd, previous version of app ran fine getting model via url using method above... not [nsmanagedobjectmodel mergedmodelfrombundles] . i have read this , this , tried proposed soluti...

github pages - Is it possible to have Jekyll automatically render code blocks raw? -

i'm trying have jekyll site hosted on github, , have lot of code blocks have code similar liquid templates. problematic because jekyll tries render it, though whatever variable or function doesn't exist i know it's possible escape using {% raw %} ... {% endraw %} , there way make jekyll compile code raw? don't think i'll ever need use jekyll's functionality in code block, , i'd rather stick normal markdown syntax. but there way make jekyll compile code raw? not ( i don't see configuration enable raw defaultà, considering jekyll has interpret other liquid templates outside of code block. as seen in jekyll issue 5549 , {% raw %} remains official solution.

swift3 - How to reference multiple rows with Swift 3 UIPickerView? -

how display "lamborghini , white" in label? i'm trying figure out how reference selected rows independently in each column. import uikit class viewcontroller: uiviewcontroller, uipickerviewdelegate, uipickerviewdatasource { @iboutlet var titlelbl: uilabel! @iboutlet var pickerview: uipickerview! var cars = [["bmw","lamborghini","range rover", "bentley", "maserati", "rolls royce"],["blue","green","white"]] override func viewdidload() { super.viewdidload() // additional setup after loading view, typically nib. pickerview.delegate = self pickerview.datasource = self } func numberofcomponents(in pickerview: uipickerview) -> int { return 2 } func pickerview(_ pickerview: uipickerview, numberofrowsincomponent component: int) -> int { return cars[component].count } func pickerview(_ pickerview: uipickerview, titleforrow row: int, forcomponen...

phpunit - CakePHP: write test for table on shell -

i'm writing plugin cakephp import/export databases. plugin has shell , index() method lists databases exported: public function index() { //gets alla files $files = backupmanager::index(); $this->out(__d('mysql_backup', 'backup files found: {0}', count($files))); if (!empty($files)) { //parses files $files = array_map(function ($file) { if (isset($file->compression) && !$file->compression) { $file->compression = __d('mysql_backup', 'none'); } $file->size = number::toreadablesize($file->size); return array_values((array)$file); }, $files); //table headers $headers = [ __d('mysql_backup', 'filename'), __d('mysql_backup', 'extension'), __d('mysql_backup', 'compression'), __d('mysql_backup', 'size...

php - How to replace numbers in string with link containing the same number -

i have simple html page, containing lists of numbers. this: look @ following pages: 23, 509, 209, 11, 139, 68, 70-72, 50, 409-412 i want replace every number, or range hyperlink that: <a href="www.mysite.com?page=23">23</a>, <a href="www.mysite.com?page=509">509</a> ..... <a href="www.mysite.com?page=409">409-412</a> the numbers 2 , 3 digits , enclosed in commas except first , last. , there ranges 391-397 you can use php preg_replace() achieve want. $original_string = 'look @ following pages: 23, 509, 209, 11, 139, 68, 70-72, 50, 409-412'; $updated_string = preg_replace( '~((\d{2,3})(\-\d{2,3})?)~', '<a href="//www.mysite.com?page=$2">$1</a>', $original_string ); echo $updated_string; see working here . the () sections in first argument of preg_replace() can referenced in second argument $1 , $2 etc... first enclosed section...

c# - How can I improve this Linq query (a kind of pivoting)? -

i have entity: public class delivery { public int id { get; set; } public int productid { get; set; } public int customerid { get; set; } public int quantity { get; set; } public datetime deliverydate { get; set; } public virtual product product { get; set; } public virtual customer customer { get; set; } } i want display deliveries week, write query: public override ienumerable getmodeldata(applicationdbcontext context) { return context.deliveries.groupby(x => x.product).select(x => new { id=x.key.id, product = x.key.name, wk1 =(int?) x.where(a => sqlfunctions.datepart("wk", a.deliverydate) == 1).sum(a => a.quantity), ... ... ... wk46 = (int?)x.where(a => sqlfunctions.datepart("wk", a.deliverydate) == 46).sum(a => a.quantity), w...

vue.js - Dynamically inject Vue 2 component from shortcode -

i have form in admin area users can input text shortcodes in them: heat oven @ [temp c=200] what want temp shortcode parsed , transformed vue 2 component when shown in front-end. here's simplified temperature.vue component: <template> <span class="temperature"> {{ celsius }}&deg;c </span> </template> <script> import { mapgetters, mapactions } 'vuex' export default { props: ['celsius'], name: 'temperature' } </script> and here's simplified instructions.vue component parse , render text shortcodes: <template> <div v-html="parseshortcodes(text)"></div> </template> <script> import shortcodeparser 'meta-shortcodes' import temperature 'temperature.vue' export default { data: () => { return { text: 'heat oven @ [temp c=200]'...

opengl - Getting data back from compute shader -

i'm new opengl , found myself in situation need data compute shader miss critical knowledge can't work. came here, maybe can give me hints. say have compute shader this: #version 430 core struct rmtriangle { vec4 probecenter; vec4 triangles[3]; }; layout(std430, binding=9) buffer trianglebuffer { rmtriangle triangles[]; }trbuffer; //other uniforms, variables , stuff void main() { //here make computations , assign values //trbuffer's triangles array } now use trbuffer's data in application. told make shader storage buffer did: private int ssbo; gl.glgenbuffers(1, &ssbo); gl.glbindbuffer(gl_shader_storage_buffer, ssbo); //just allocate enough amount of memory gl.glbufferdata(gl_shader_storage_buffer, max_triangles * sizeof_triangle, null, gl_dynamic_read); then this: int blockindex = gl.glgetprogramresourceindex(program,gl_shader_storage_block, name.getbytes(), 0); if (blockindex != gl_invalid_index) { gl.glshaderstorageblockbinding(pr...

sql - MySQL JOIN and COUNT failure -

i have 2 tables in mysql database. ------------------------------------------------------------------------ |student: |name |neptunid |signature |sex | | ------------------------------------------------------------------------ |signature: |studentid |classid |start |end |startsig |endsig ------------------------------------------------------------------------ i have search given classid , following information: name of student (studentid=neptunid) signature table student startsig field necessary sum of students per sex i have tried following query, don't know, how define, sex field should counted (male/female). select st.name,st.neptunid,st.signature,si.startsig student st join signature si on st.neptunid=si.studentid si.start<'$today' , si.end>'$today'

CMD/Batch show variable from .txt file -

trying import list of pre-set variables , show them on screen @echo off cls /f %%i in (' type list.txt ') ( echo %%i ) but shows what's on list , doing like.. set var=%%i echo %var% won't job. how should go doing it? list.txt: systemroot allusersprofile appdata commonprogramfiles computername comspec for /f %%i in (' type list.txt ') ( echo %%i call echo %%i=%%%%i%% ) when echo called , executed echo % thecontentsof %%i % so displays contents of required variable. see endless articles delayed expansion if want useful.

Android ARToolKit - Changing the reference images in the NFT sample project? -

good day everyone. i've been tinkering artoolkit , sample android studio projects see 1 can modify purpose. opened nftbookproj , it's 1 using pinball.jpg , places animated propeller plane along 3d axis in origin of image. i noticed nftbookproj/nftbook/src/main/assets/datanft/ directory had pinball.iset , pinball.fset , , pinball.fset3 files. made own image (with definite features, high resolution, high dpi , all) , using the methods specified in tutorial , created own set of reference_1.iset , reference_1.fset , reference_1.fset3 files. placed 3 files in same folder pinball files are. i checked activites , classes find out lines have change make app reference own reference files instead of pinball ones. wasn't in of classes found markers.dat file under /assets/data/ folder , looked this: # number of markers 1 # entries each marker. format is: # # name of pattern file (relative file) # marker type (single) # marker width in millimetres (floating point num...

c - value of a local variable changes in its own scope -

void my_initm3uaparamprot_data(char *prefix, m3uaparamprotocoldata *param, pointcode opc, pointcode dpc, unsigned char si, unsigned char ni, unsigned char mp, unsigned char sls, void *buf, unsigned short size) { unsigned short len, pc_len; char tempbuf[500]; len = m3ua_param_header_len + 2 * pc_size + 4 + size; //4 size of si+ni+mp+sls logactivity(__function__, "nayan_log", e_notice, "len: %d", len); memset(param, meminit_value, sizeof(m3uaparamprotocoldata)); param->h.tag = htons(pprot_data); param->h.len = htons(len); memcpy(&param->opc, &opc, pc_size); memcpy(&param->dpc, &dpc, pc_size); param->si = si; param->ni = ni; param->mp = mp; param->sls = sls; memcpy(param->buf, buf, size); memset(tempbuf, 0, sizeof(tempbuf)); (int l = 0; l < len; l++) sprintf(tempbuf, "%s %0x", tempbuf, param->buf[l]); logactivity(__function__, "nayan_log", e_notice, "buf: %s len: %d...

Library to convert JSON to JSON schema -

i'm looking library convert json schema. jsonschema.net online tool, want library use in code. similarly, convert csv , tsv json schema well. feel free contribute schemify . demo on demo page .

cmd - Why does the command GOTO atack1 not result in executing the code below line :attack1 on batch file execution? -

i've started learn batch/shell while ago. , started make text based rpg called bpg. anyways, poured day making basic structure of , found out cmd closes when use attack trigger. ran on million times, can't find wrong it. please help. the batch file can downloaded https://www.dropbox.com/s/f8r7cs0tvo8qhs8/bpg.bat?dl=0 here code: @echo off if not "%1" == "max" start /max cmd /c %0 max & exit/b title bpg 1 batch of monsters setlocal enabledelayedexpansion color 2 :menu cls echo ______ _______ _______ echo ___ \ ____ i ____ \ echo i ii ii i \/ echo __ _____i i ____ echo i \ \ i i \_ echo i___i ii i___i echo i______/ i_/ i_______i batch of monsters echo. echo. echo 1) begin echo. echo 2) exit echo. set /p c=bpg: if "%c%" == "1" goto new if "%c%" == "2" exit goto menu :new set health=100 set enemyhealth=30 set playerdmg=10 set monsterdmg=10 goto home :home cls echo ---...

Create DataContract Class in c# from Json having Dynamically generated keys -

i have sample json : {"'1234xxxxxx'":[{"attributeid":"1","attributename":"brand","attributevalue":""},{"attributeid":"2","attributename":"color","attributevalue":"red4"},{"attributeid":"3","attributename":"size","attributevalue":"44"},{"attributeid":"4","attributename":"resolution","attributevalue":"full hd"}]} i have created sample datacontract class : [system.runtime.serialization.datacontract] public class rootobject { [system.runtime.serialization.datamember] public attr[] attrs { get; set; } } [system.runtime.serialization.datacontract] public class attr { [system.runtime.serialization.datamember] public string attributeid { get; set; } [system.runtime.serialization.datamember] public str...

algorithm - "For" loop for all possible combinations without repetition -

i have table of values, , need compare of them. problem is, don't want compare same values 2 times (for example, loop compares values 1 - 2, 1 - 3, 2 - 1, , 2 - 1 same 1 - 2). wrote loop inside loop looks this: for (int = 0; < numberofsets; i++) { (int j = 1; j < numberofsets; j++) { //compare element , j here } } but how can modify loop skip repetitions? tried far incrasing j when == j: for (int = 0; < numberofsets; i++) { (int j = 1; j < numberofsets; j++) { if(i == j) { j++; } else { //compare element , j } } } but doesn't seem work correctly. there better way loop way want to? simply start inner loop j = + 1 . for (int = 0; < numberofsets; i++) { (int j = + 1; j < numberofsets; j++) { // stuff } }

python - matplotlib bar chart: space out bars -

Image
how increase space between each bar matplotlib barcharts, keep cramming them self centre. (this looks) import matplotlib.pyplot plt import matplotlib.dates mdates def ww(self):#wrongwords text file open("wrongwords.txt") file: array1 = [] array2 = [] element in file: array1.append(element) x=array1[0] s = x.replace(')(', '),(') #removes quote marks csv file print(s) my_list = ast.literal_eval(s) print(my_list) my_dict = {} item in my_list: my_dict[item[2]] = my_dict.get(item[2], 0) + 1 plt.bar(range(len(my_dict)), my_dict.values(), align='center') plt.xticks(range(len(my_dict)), my_dict.keys()) plt.show() try replace plt.bar(range(len(my_dict)), my_dict.values(), align='center') with plt.figure(figsize=(20, 3)) # width:20, height:3 plt.bar(range(len(my_dict)), my_dict.values(), align='edge', width=0.3)

swift - Loading Serialised JSON Into Table? -

im having hard time wrapping head around process, have made api call , received json, use model serialise json can used in view controller table, im having issues how call api in view controller have result fit serialisation model. hope explained correctly? here code of api request: open class apiservice: nsobject { open func getdata(completionhandler: @escaping (nsdictionary?, nserror?) -> void) -> self { let requesturl = "https://wger.de/api/v2/exercise/?format=json" alamofire.request(requesturl, method: .get, encoding: urlencoding.default) .responsejson { response in switch response.result { case .success( let data): completionhandler(data as? nsdictionary, nil) case .failure(let error): print("request failed error: \(error)") completionhandler(nil, error nserror?) } } return...

Polymorphic this in TypeScript -

i'm trying think "textbook" use case polymorphic this , isn't working , can't figure out. imagine have abstract base class cloneable, e.g.: abstract class x { abstract clone(): this; } now want implement base class provides clone implementation: class y extends x { constructor(private x: number) { super() } clone(): { return new y(this.x + 1); } } when this, error says type y not assignable type 'this' . i'm totally confused. want convey here type constraint if subclass of x has clone method invoked, type of thing identical subtype. isn't polymorphic this for? doing wrong here? here link code in typescript playground. no, things right now, it's not supported use case type. method this return type should return instance of derived class if method not overridden in derived class - see code in answer example justifies this. in other words, given abstract clone(): this declaration, code must valid...

python - How to implement Fast ICA on multiple wav files? -

i doing exercise wherein have 3 wav files comes recordings 3 microphones on event. need implement fast ica decompose original signals using 3 wav files. i understand fast ica , how works. don't understand how decompose sound signals 3 sound files. all example codes see either uses , decomposes single wav file component or generate , mix signals try unmix them using fast ica. any inputs or links point me clues on how great help. also, tasked remix separated signals , print residuals. idea residuals , how them? i'm implementing on phyton great if links uses python too. thanks lot!

python - Retrieving values used to create colormap -

i used matrix of values (denoting depths of objects in picture) , created colormap in matplotlib using scheme "jet". visualization purpose. however, unfortunately saved rgb heatmap (created colormap) disk instead of depth values. did around 60,000 images before realized mistake. if familiar jet colormap, can advise if there way retrieve 2d depth information reverse engineering heatmap? running short of time. appreciated.

FASM - Boot sector on USB don't work -

in first, sorry bad english, i'm french. @ moment, learn asm fasm test boot sector programming. i have make simple boot program, have compiled , write boot.bin in first sector of usb. but when boot on pc or in virtualbox, drive isn't found.... boot sector code: ;======================================================================= ; simpliest 1.44 bootable image shoorick ;) ;======================================================================= _bs equ 512 _st equ 18 _hd equ 2 _tr equ 80 ;======================================================================= org 7c00h jmp start nop ;===================================================== db "he-he os"; ; 8 dw _bs ; b/s db 1 ; s/c dw 1 ; rs db 2 ; fats dw 224 ; rde dw 2880 ; db 0f0h ; media dw 9 ; s/fat dw _st ; s/t dw ...

r - Plotting a subset of neighbours from spdep package -

i'm interested in creating single plot polygon , neighbours created via poly2nb function available through spdep package. preparation i'm creating nb object in following manner: # download read state shapefiles tmp_shps <- tempfile(fileext = ".zip") tmp_dir <- tempdir() download.file( "http://www2.census.gov/geo/tiger/genz2014/shp/cb_2014_us_state_20m.zip", tmp_shps ) unzip(tmp_shps, exdir = tmp_dir) # import shpspoly <- maptools::readshapepoly(verbose = true, fn = file.path(tmp_dir, "cb_2014_us_state_20m")) # nbs usanbs <- spdep::poly2nb(pl = shpspoly, queen = true) subsetting if try subset keeping first polygon following error: # nbs usanbs <- spdep::poly2nb(pl = shpspoly, queen = true) coords <- sp::coordinates(usanbs) sbstusanbs <- spdep::subset.nb(x = usanbs, coords = co...

arrays - PHP: "Notice: Undefined variable", "Notice: Undefined index", and "Notice: Undefined offset" -

i running php script, , keep getting errors like: notice: undefined variable: my_variable_name in c:\wamp\www\mypath\index.php on line 10 notice: undefined index: my_index c:\wamp\www\mypath\index.php on line 11 line 10 , 11 looks this: echo "my variable value is: " . $my_variable_name; echo "my index value is: " . $my_array["my_index"]; what these errors mean? why appear of sudden? used use script years , i've never had problem. what need fix them? this general reference question people link duplicate, instead of having explain issue on , on again. feel necessary because real-world answers on issue specific. related meta discussion: what can done repetitive questions? do “reference questions” make sense? notice: undefined variable from vast wisdom of php manual : relying on default value of uninitialized variable problematic in case of including 1 file uses same variable name. majo...

r - geom_errorbar and geom_facet -

Image
the following code not display error bars: rf.imp<- read.csv("importances_byaggregations.csv",head=true,sep=",") #changes when handling data rf.imp$flux <- as.character(rf.imp$flux) rf.imp$flux<-factor(rf.imp$flux,levels=unique(rf.imp$flux)) rf.imp$aggregation <- as.character(rf.imp$aggregation) rf.imp$aggregation<-factor(rf.imp$aggregation,levels=unique(rf.imp$aggregation)) cbbpalette <- c("#f0e442", "#cc79a7","#e69f00","#56b4e9", "#009e73") # mimicking python colors rf.imp$rel.influence<-rf.imp$rel.influence*100 rf.imp$sd<-rf.imp$sd*100 limits <- aes(ymax = rf.imp$rel.influence + rf.imp$sd, ymin=rf.imp$rel.influence - rf.imp$sd) ggplot(rf.imp, aes(variable,rel.influence,fill=variable)) + geom_bar(stat="identity",position="dodge") + scale_fill_manual(values=cbbpalette)+ theme_bw(base_size = 32, base_family = "helvetica")+ xlab("")+...

vba - Visual Basic - Getting basic information about another program -

alright, working on updater updating several files such executable , drivers. don't want replace every single file every time push update , rather replace file getting updated. easy way reading version of program don't know how read required information. went through io.file didn't find useful. try looping through folder's files. option explicit sub macro1() dim varfile variant dim integer dim objshell dim objdir set objshell = createobject("shell.application") set objdir = objshell.namespace("c:\directory_of_files_here\") each varfile in objdir.items debug.print objdir.getdetailsof(varfile, 156) ' 156 = file version next ' use see numbers of attributes, e.g. 156 = file version 'for = 0 300 ' debug.print i, objdir.getdetailsof(objdir.items, i) 'next end sub

html - How to make text to appear into image box? -

i started make own gallery, , have 1 thing cant resolve.. i want text appear in part "unseren dienstleistungen" homepage, left in site , showed in similar way in other images, image style other pages (sppinin images). this code first image: <div class="servicequad"> <div class="tr-slideimgout"><img src="/files/hjung2014/img/holzbau.jpg" alt="holzbau" /></div> <span class="figure tr-slidein" href="">{{insert_content::26}}</span></div> and image style other images, (like want be, text appear inside box) <div class="servicequad"> <div class="morph"><img src="/files/hjung2014/img/holzbau.jpg" alt="holzbau" /></div> <span class="morph" href="">{{insert_content::26}}</span></div> thanks help. you can add class changed rotation style. for...