Posts

Showing posts from March, 2014

Using CSS filters in react-native -

it seems react-native doesn't implement css' filter property. is there way replicate those? looking way change following image, without creating special image that: brightness hue saturation blur rn's css support limited, not when consider typical mobile app should require. might check out this attempt @ instagram manipulation, code @ this link.

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...

java - spring-data postgres transaction isolation issue -

i have 2 entities: message , session . message has @manytoone relationship session . i have spring data repository , action a: @query("select c messages c c.session.mode=0 , c.field=5") list<messages> findmessages(); then process found data messages.foreach(message->{ session session = message.getsession(); sessionclose(session); newsessionopen(); }) and in other service class have session session=findopenedsession(); the question is: what if action in transaction , after starts , before ends other service request opened session or try insert record message table? in other words have: transaction starts records being read session instances processed in loop - session using sessionclose , newsessionopen transaction ends what if other process request opened session between 2 , 4 or 2 , 3 or somewhere within? opened session read? old 1 or new one? use postgres , @transactional spring annotation. assuming ...

php - Artisan make:auth login failing -

good day every one, im working laravel 5.3 trying make:auth command seems either broken or im doing wrong steeps followed: composer create-project --prefer-dist laravel/laravel blog cd blog edit .env set database conection artisan make:auth artisan migrate artisan serve register new user using generated /register page log out try log in then got credentials mismatch error did on new project/schema on mysql im using: mariadb 10.1.8-mariadb php 5.6.15 laravel 5.3 windows 10 home edition i started tracing code can find causing error any idea on how solve this? just tested in laravel 5.2 not present behavior. tested use 1 through 6 password suggested in comments failed, im opening bug report on laravel´s github page , i´ll link in comments solved it, migrations wrong, had "password" (capital p) instead of "password" sorry wasting time

ios - Is it possible to wake up iPhone app from watchOS 3 app? -

is possible wake iphone app watchos 3 app? the first part of code enough on watchos 2 both parts of code don't work on watchos 3: initialization: if ([wcsession issupported]) { wcsession* session = [wcsession defaultsession]; session.delegate = self; [session activatesession]; } on method: if ([wcsession issupported]) { wcsession* session = [wcsession defaultsession]; if (session.reachable) { // <-- returns false nsdictionary *message = @{@"action":@"wakeup"}; [session sendmessage:message replyhandler:nil errorhandler:nil]; } } apple suggested following code: - (void)session:(wcsession *)session activationdidcompletewithstate:(wcsessionactivationstate)activationstate error:(nserror *)error { if ([wcsession issupported]) { wcsession* session = [wcsession defaultsession]; if (session.activationstate == wcsessionactivationstateactivated) { nsdictionary *message = ...

javascript - Making consecutive images only appear after the last disappear while hovering -

in little project of mine have several buttons, when hovered display image in div. after hovering first button, when hovering second first image still there , both images show up. what do second image appear after first disappeared? my javascript code: $(".button").hover(function () { var in = $(this).attr("id").charat(6); $('#img'+ in).fadein('slow'); },function() { var in = $(this).attr("id").charat(6); $('#img' + in).fadeout('slow'); }); this how it, may not work in use case. (if not, please add more detail question.) note example uses jquery "starts with" selector: ^= re-hide elements id begins letters img $('img').hide(); $(".button").hover(function () { var in = $(this).attr("id").charat(6); $('#img'+ in).fadein('slow'); },function() { $('[id^=img]').fadeout(); }); div{height:100px;width:200px;...

XSD to constrain XML element values to existing XML attribute values? -

the goal constrain best_friend_id have value of existing friend_id attribute in xml: friends.xml <?xml version="1.0"?> <friends xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:nonamespaceschemalocation="friends.xsd"> <friend friend_id="1"> <name>john</name> <best_friend_id>2</best_friend_id> </friend> <friend friend_id="2"> <name>kate</name> <best_friend_id>1</best_friend_id> </friend> </friends> e.g. given xml, validation should fail if change value of best_friend_id element 3 . friends.xsd <?xml version="1.0" encoding="utf-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/xmlschema" elementformdefault="qualified" xmlns:vc="http://www.w3.org/2007/xmlschema-versioning"> <xs:complextype name="f...

html - Concatenating variables and strings in React -

is there way incorporate react's curly brace notation , href tag? have following value in state: {this.state.id} and following html attributes on tag: href="#demo1" id="demo1" is there way can add id state html attribute this: href={"#demo + {this.state.id}"} which yield: #demo1 you're correct, misplaced few quotes. wrapping whole thing in regular quotes literally give string #demo + {this.state.id} - need indicate variables , string literals. since inside {} inline jsx expression , can do: href={"#demo" + this.state.id} this use string literal #demo , concatenate value of this.state.id . can applied strings. consider this: var text = "world"; and this: {"hello " + text + " andrew"} this yield: hello world andrew you can use es6 string interpolation/ template literals ` (backticks) , ${expr} (interpolated expression), closer seem trying do: href={`#demo${th...

Why isn't user touch working for cordova ios? -

i've determined cordova failing let app detect user touch. when own app failed in way, did research , found this: how detect user touch phonegap using js . applied simple helloworld program and, lo , behold, user touch wasn't working! i'm using cordova 6.4.0 , ios 4.3.0. i'm testing in ios simulator because don't have ios device. do need particular plugin?

DateForm Python-Flask - [u'Not a valid date value']} -

i'm developing web app , @ point want create new entry politic table. until had add dates. form isnt accepting input due wrong date format. lets it.. i have form: class politicform(flaskform): publicname = stringfield('public name', validators=[datarequired("please enter politician public name.")]) completename = stringfield('complete name', validators=[datarequired("please enter politician complete name.")]) startdate = datefield('start date', format='%m-%d-%y', validators=[datarequired("please enter politician start date.")]) enddate = datefield('end date', format='%m-%d-%y', validators=(validators.optional(),)) submit = submitfield('add politician', validators=(validators.optional(),)) but somehow datefield isnt right because form can't validate startdate field nor enddate field. create function: @app.route("/create_politician", methods=["get", ...

r - Taking inverse of certain rows in dataframe -

Image
i have dataframe of market trades , need multiply put returns -1. have code that, can't figure out how assign without affecting calls. input df: date type stock_open stock_close stock_roi 0 2016-04-27 call 5.33 4.80 -0.099437 1 2016-06-03 put 4.80 4.52 -0.058333 2 2016-06-30 call 4.52 5.29 0.170354 3 2016-07-21 put 5.29 4.84 -0.085066 4 2016-08-08 call 4.84 5.35 0.105372 5 2016-08-25 put 5.35 4.65 -0.130841 6 2016-09-21 call 4.65 5.07 0.090323 7 2016-10-13 put 5.07 4.12 -0.187377 8 2016-11-04 call 4.12 4.79 0.162621 code: flipped_puts = trades_df[trades_df['type']=='put']['stock_roi']*-1 trades_df['stock_roi'] = flipped_puts output of flipped puts: 1 0.058333 3 0.085066 5 0.130841 7 0.187377 output of original df: date type stoc...

java - Breadth-first tree -

i seem having issues structuring breadth-first tree. in code below, have node inserted through loop in class. the structure of tree supposed so: / \ b c /\ /\ d e f g now code: my code structures left side correctly, whereas right side adds left side well. understand in code happens, there way prevent happening? public node familytree; public void breadthfirst(node newnode){ familytree = breadthfirst(familytree,newnode); } public node breadthfirst(node t, node newnode){ if(t == null){ t = newnode; return t; } if(t.left == null){ newnode.height = t.height + 1; t.left = newnode; return t; } else if(t.right == null){ newnode.height = t.height + 1; t.right = newnode; return t; } else{ t.left = breadthfirst(t.left, newnode); t.right = breadthfirst(t.right, newnode); <-- corporate } r...

javascript - Custom Google Marker not visible on Google Map API V3 -

i have add multiple markers place on google maps api according sql data returned returned me.the code works fine debugged , adding marker map not visible. not showing error in firebug nor @ console of back-end (asp.net). please me out frustrating me crazy. function initialize() { var mapoptions = { zoom: 16, center: new google.maps.latlng(30.658354982307571, -96.396270512761134), disabledefaultui: false, maptypeid: google.maps.maptypeid.roadmap }; map = new google.maps.map(document.getelementbyid('map_canvas'), mapoptions); init_publicmap(); var iconbase = '/webcontent/images/iconsbase/'; var iconhoneybees = { url: iconbase + "honeybeesicon.jpg", // url scaledsize: new google.maps.size(35, 40), // scaled size origin: new google.maps.point(0, 0), // origin anchor: new google.maps.point(0, 0) // anchor }; var iconfruitnuts = { url: iconbase + "fruits&nuts.jpeg...

ats - What is the meaning of ATS_EXTERN_PREFIX? -

for instance, saw following line in atslib: #define ats_extern_prefix "atslib_" what meaning of ats_extern_prefix? purpose? if have #define ats_extern_prefix "foo_" , extern fun bar (...): ... = "mac#%" , external name of bar becomes ${ats_extern_prefix}bar , i.e. foo_bar . essentially, '%' in declaration being replaced value of ats_extern_prefix .

functional programming - Convert a polynomial represented as a list of coefficients to a string -

i know newbish question. trying create function 'displaypoly' display polynomial in scheme. example list given '(2 0 1 5.1 8) should display 2x^4 + x^2 + 5.1x + 8. i have defined "degree" following: (define degree (lambda(list) (if (null? list) (- 1) (+ 1 (degree (cdr list)))))) please note strictly limited basic scheme functions •define, lambda, if, cond, cons,car, cdr, list , member, list-ref •predicates : null? list? equal? string? number? member? •arithmetic operators , relational operators, logical operators •sort, map, filter, foldr, foldl, length, reverse, append, last , let, let*, letrec, print, begin, newline, display, expt, string-append, reduce, range you need write helper functions. write function given polynomial returns list of degrees. input: '(2 0 1 5.1 8) output: (4 3 2 1 0) write function mono given coefficient , degree outputs monomial string. input: 2 4 output: "2x^4" use (map ...

Md5 Column function on column in spark sql -

how call md5 column function on columns in table spark sql? is same hivesql syntax? select md5(*) employee; spark sql includes hivecontext statement should work. prior spark 2.0, may need specify hivecontext (though sqlcontext trick. spark 2.0, spark session includes hivecontext not need specify it.

android - Is there any way to control the logcat output format in intelij 2016? -

i customize output formt of logcat output logcat panel in android monitor in intellij. there way this? specifically using log4j module outputs through logcat , there indent forced on message text such newline in message text indent subsequent lines. output is: time date class app blah blah: message line 1(\n) message line 2(\n) mesage line 3 i have be: time date class app blah blah: message line 1(\n) message line 2(\n) message line 3 in case have "message line 1" set class name , line number in parens, in intellij window clickable ie: (classwithlogline.java:135) well poking @ it, seem on android monitor logcat tab there "gear/sprocket" icon has checkboxes turning on , off various components of logcat message header, still has no control on message indent nor allow edit logcat format string ( ideal advanced mode or showing field , allow editing of )

Phoenix emits "protocal Enumerable not implemnted" error when path helpers get called -

for phoenix app, created 2 routes following: scope "/", greeter pipe_through :browser "/hello", hellocontroller, :show "/hello/:name", hellocontroller, :show end with them, app can respond both "/hello" , "/hello/alice" paths. but, when use path helper hello_path(@conn, :show, "alice") produce "/hello/alice", phoenix server emits error message: protocol enumerable not implemented "alice" the cause simple. the first route creates 2 helpers hello_path/2 , hello_path/3 , second route creates 1 helper hello_path/4 because hello_path/3 defined. this hello_path/3 demands enumerable third argument. how should avoid error? you can give 1 of route different name using as: : get "/hello", hellocontroller, :show "/hello/:name", hellocontroller, :show, as: :hello_with_name test: iex(1)> import myapp.router.helpers myapp.router.helpers iex(2)> he...

html - Using JavaScript to restyle a page on viewport change - inline CSS only -

i'm trying optimize heavy (jquery, jquery ui, 2-3 other libraries) marketing funnel landing page attempting follow varvy's wicked fast page guidelines . as can see styles inlined , transferred page along inlined images. that's , support ie8 missing media query support. while can use adapt.js, don't want have calls (more 1 need defer js). is there more elegant solution including css inline , manually changing classes when viewport below size?

javascript - How to remove an object with a given property from an array -

this question has answer here: remove objects array object property 8 answers i have array contains multiple objects below. how can remove complete object contains particular value. var cars= [ {key: 'browser', label: 'chrome'}, {key: 'browser', label: 'firefox'}, {key: 'browser', label: 'safari'} ]; for example objects removed contains label chrome , safari. i have come across examples of single dimensional arrays of values, array of objects. you can use array.prototype.filter return values or exclude values. var cars = [ {key: 'browser', label: 'chrome'}, {key: 'browser', label: 'firefox'}, {key: 'browser', label: 'safari'} ]; // filter thing want var firefoxonly = cars.filter(function(item) { return item.label === 'firefox...

html - Background image not showing CSS/PHP -

the background image not showing. must missing going bit cross-eyed trying work out is. this have: <div class="hero_text item"> <h3><?php echo $slide['slide_title']; ?></h3> <p> <?php echo $slide[ 'slide_desc']; ?> </p> <img style="background-image:url(<?php echo $slide['slide_image']; ?>)"></img> </div> and css: .hero_text img { background-repeat: no-repeat; background-attachment: fixed; background-size: cover; height: 600px; } i think want use: <img src="<?php echo $slide['slide_image']; ?>" /> the img tag adding images html. if want background image, set on div: <div style="background-image:url('<?php echo $slide['slide_image']; ?>')"></div>

codenameone - Downloading a pdf file of larger size(like 30Mb) fails -

i have used cn1circleprogress library while downloading pdf files. works great if pdf file small. larger pdf files eg 30 mb, circle fills 100% 2-3 times , again starts download 20-30% & download stops. file downloaded currupted & cannot opened in pdf viewer. have checked in ios & android devices. in simulator downloads percent, stops downloadpdfbutton.addactionlistener((e) -> { pdfurlselected = "http://roundtablenepal.org.np/uploadepubs/57cbcc4e76258.pdf"; pdffilenameidselected = currentpdfselected.get("magazine_title"); filename = dir + sep; filename = filename + pdffilenameidselected + ".pdf"; filesystemstorage.getinstance().mkdir(dir); slider downloadslider = new slider(); if (!filesystemstorage.getinstance().exists(filename)) { downloadpdffromurl(f, pdfurlselected, filename, true, downloadslider, findcanceldownload(f)); } }); private boolean downloadpdffromurl(form f, string url, final stri...

c - Why isn't it going to a new line when I clear my input buffer? -

void clrkyb(void) { char input = ' '; { scanf("%c", &input); } while (input != '\n'); } void pause(void) { //pause program until user presses enter printf("press <enter> continue..."); clrkyb(); } int main() { struct item i[21] = { { 4.4, 275, 0, 10, 2, "royal apples" }, { 5.99, 386, 0, 20, 4, "watermelon" }, { 3.99, 240, 0, 30, 5, "blueberries" }, { 10.56, 916, 0, 20, 3, "seedless grapes" }, { 2.5, 385, 0, 5, 2, "pomegranate" }, { 0.44, 495, 0, 100, 30, "banana" }, { 0.5, 316, 0, 123, 10, "kiwifruit" }, { 4.49, 355, 1, 20, 5, "chicken alfredo" }, { 5.49, 846, 1, 3, 5, "veal parmigiana" }, { 5.29, 359, 1, 40, 5, "beffsteak pie" }, { 4.79, 127, 1, 30, 3, "curry checken" }, { 16.99, 238, 1, 10, 2...

php - Appending SQL to existing associative array -

learning php , creating associative arrays. trying create associative array describes activity. activity example 354 , 355. this current code: $query = $db->prepare('select item_id kh_program_item_info '. $where); $query->execute(); if($query->rowcount() > 0){ while($john = $query->fetch(pdo::fetch_obj)){ $key1 = $john->item_id; $report-> $key1= array(); } foreach ($report $key=>$johnval) { $where = 'item_id = ' . $key; $query = $db->prepare('select activity_desc, date_format(activity_date,"%d/%m/%y") activitydate kh_program_items '. $where); $query->execute(); $results = $query->fetch(pdo::fetch_obj); $report->$key = $results; echo '<pre>'; echo print_r($report); echo '</pre>'; } } else { ...

winforms - How to add quartz functionality to .net 2.0 project? -

i have solution single winforms project targeting .net 2.0. need of quartz functionality in of project's forms cannot add package since requires higher version of .net. there workaround in situation? edit: maybe there scheduling tool .net 2.0? need feature executes required method @ required time. you can use quartz 1.0 using .net framework 2.0. quartz versions starting 2.0 doesn't work .net framework 2.0 , rely on features of .net 3.5 , upper versions rely on .net 4.0. to use quartz .net 2.0 project: download quartz 1.0 (or 1.0.1 or 1.0.2 or 1.0.3 ) from bin\2.0\release\quartz path, add reference quartz.dll , common.logging.dll . write sample scheduled job this: using system; using system.componentmodel; using system.windows.forms; using quartz; using quartz.impl; namespace windowsformsapplication1 { public partial class form1 : form { public form1() { initializecomponent(); } ischeduler scheduler; protected ove...

android - Cordova App using VS -

i'm developing cross-platform mobile app using cordova in visual studio . problem need database store , retrieve data, create local database inside visual studio, cannot find localdb option within cordova app. so, if can me creating database , connect cordova app? best methods/ways it? please check here . hopefully, helpful you.

javascript - Slow queuing ajax request only in Chrome? -

Image
i have never had issue before, loading page ajax request on takes ages in chrome, blazing fast in firefox, edge, , ie. below screenshot of network timing in chrome: if above, see 5 major stalls cdn'd scripts, stalled ~1.15s each, resources above took ~100ms get. why there huge gap in between loading resources? other resources stylesheets , scripts loaded locally , via cdn. this timing screenshot in edge: at point have no idea do. go here "optimise" page google chrome?

javascript - Two Looping Countdown Timers for Electron App -

i have javascript countdown timer trying put electron app. functions similar boxing timer. run countdown, there start/pause , reset buttons. after main countdown completes @ 00:00, code goes second countdown timer, used rest period, in between rounds. when second countdown completes, loops main round countdown. keeps looping until hit start/pause button calls cleartimeout method stop countdown. here issue arrises. start/pause , reset buttons functional while main round countdown function active. i able have start/pause , reset buttons functional both main round , restperiod countdown functions, unsure of how functionality working on both. there way can "switch" these buttons on being functional while restperiod function running, can avoid having more buttons? any hints, tips, replies , nudges in right direction appreciated! thank time! var minutes = 1; var seconds = 0; var timer; var timer_is_on = 0; var resttimer; var restmin = 1; var restsec = 1; var ro...

node.js - How can I set NODE_ENV? -

i using gulp in reactjs solution , want set node_env, tried this: gulp.task('set-dev-node-env', function() { return process.env.node_env = 'development'; }); //dev environment run gulp.task('default', ['set-dev-node-env', 'webpack-dev-server']); when run gulp , check chromeconsole says: testing process.env.node_env undefined what missing or how can set node_env variable? set in gulpfile somehow. here complete project: github since using webpack can use webpack define plugin inject node_env for example in webpack.config.dev.js: module.exports = { ... plugins: [ ... new webpack.defineplugin({ 'process.env.node_env': json.stringify('development'), }), ], }; then in react code have access node_env set process.env.node_env .

r - Determine which values are absent from a given column thus have a 0 count -

i trying determine species have count of 0 (no value n) unique site. for example, species5 through species33 not present in site1.d1. species2 through species33 not present in site1.d2, species1 through species4 & species6 through species33 not present in site1.d3, , forth. there 33 total species (species1 species33), there 4 different sets of sites (site1 site4), ranging d1 d45 (for example, site1.d1 site1.d45 & site2.d1 site2.d35, etc.). i want add missing species n of 0 existing data.table named testit. # species site n # species1 site1.d1 17 # species2 site1.d1 1 # species3 site1.d1 4 # species4 site1.d1 1 # species1 site1.d2 14 # species5 site1.d3 1 # species6 site2.d2 1 # species6 site2.d4 12 # species7 site3.d3 9 # species6 site3.d5 1 testit <- structure(list(species = structure(c(1l, 2l, 3l, 4l, 1l, 5l, 6l, 6l, 7l, 6l), .label = c("species1", "species2", "species3", "spe...

android - Get accurate device location every now and then -

what best way - highest accuracy , least battery consuming (accuracy tops battery in use case) - user device location once every , then? (not in fixed priod) ive seen this , remembered when used way location not accurate (maybe had configurations wrong?), , read this seems less appropriate use case. i go second option, re , un registering update every , when need them, while each time wait few seconds till gps fixed on devices location, dont want reinventing wheel implemnting wondering if knows more straight forward solution?

neural network - How to obtain the gradients of the RNN variables connected to the input sequence (in TensorFlow) -

i monitor (and possible manually modify) gradients of recurrent cells such lstm or gru. in addition, interested in gradients of variables directly connected input sequence x . obtaining gradients of graph pretty straightforward - optimizer.compute_gradients(loss) . so question "how can filter variables connected x ?" universal solution might not exist, hence happy kind of manual hacking of variable names. thanks

c# - The type initializer for 'System.Data.Entity.Migrations.DbMigrationsConfiguration`1' threw an exception -

Image
i have asp.net mvc site. technology stack asp.net 4.6 c#.net ef 6 mysql -database while trying generate database using nuget command:- enable-migrations -force i getting below exception the type initializer 'system.data.entity.migrations.dbmigrationsconfiguration`1' threw exception. following things cross checked & tried me:- the type initializer 'system.data.entity.internal.appconfig' threw exception on sub website the type initializer 'system.data.entity.internal.appconfig' threw exception code first can't enable migrations my app.config:- <connectionstrings> <add name="mydbcontext" providername="mysql.data.mysqlclient" connectionstring="server=localhost;port=8080;database=mydb;uid=root;password=" /> </connectionstrings> <entityframework> <defaultconnectionfactory type="mysql.data.entity.mysqlconnectionfactory, mysql.data.entity.ef6" /> ...

rust - Is it possible to access the type of a struct member for function signatures or declarations? -

when defining implementations in macros, might useful access struct members type avoid having pass argument. (see this question ) impl partialeq<u32> mystruct { ... } is there way access type of struct member without knowing in advance type is? impl partialeq<typeof(mystruct.member)> mystruct { ... } in case it's helpful, abbreviated example of why i'm interested this: struct_bitflag_impl!( pub struct myflag(u8);, myflag, u8); // ^^ how avoid having arg? // (used ``impl partialeq<$t_internal> $p``) // couldn't discovered `myflag.0` ? // macro macro_rules! struct_bitflag_impl { ($struct_p_def: item, $p:ident, $t_internal:ty) => { #[derive(partialeq, eq, copy, clone, debug)] $struct_p_def impl ::std::ops::bitand $p { type output = $p; fn bitand(self, _rhs: $p) -> $p { $p(self.0 & _rhs.0) } } impl ::std::ops::bitor $p { ...

testing - Is it possible to mock the "type name" of a mock in C# using Moq? -

i'm developing chatbot in c# (based on .net core) has modular behaviours. 1 of behaviours want develop "admin" module (among other functions) should allow admins dynamically enable or disable other behaviours name. i want admin module determine name of behaviour inspecting type info , doing like: var name = behaviour.gettype().gettypeinfo().name.replace("behaviour", string.empty).tolowerinvariant(); in bdd specification i'm writing first, i'm trying set "behaviour chain" consisting of admin module (system under test) , mock behaviour. tests involve sending commands should cause admin module enable or disable mock behaviour. this i've done far: public behaviourisenabled() : base("admin requests behaviour enabled") { var mocktypeinfo = new mock<typeinfo>(); mocktypeinfo.setupget(it => it.name).returns("mockbehaviour"); var mocktype = new mock<type>(); mocktype.setup(it => it...

java - How to retrieve DBPedia 'class' attribute for a given word using Sparql? -

so have word like, example, 'horse', , want retrieve class. 'mammal', shown here: http://dbpedia.org/page/horse . i tried something, it's not returning anything. string querystring = "prefix dbr: <http://dbpedia.org/resource/>" + "prefix dbo: <http://dbpedia.org/ontology/>" + "select ?class {dbr:horse dbo:?class}"; any advices ? sparql queries make use of so-called triple patterns, query returns tuple , second part in strange syntax. moreover, instances asserted classes rdf:type property. dbo:class on other hand more property biological term class. obviously, query ill-formed , dbo:class part overlap ?class variable. i'm wondering why didn't see - it's obvious... prefix dbr: <http://dbpedia.org/resource/> prefix dbo: <http://dbpedia.org/ontology/> select ?class { dbr:horse dbo:class ?class }

javascript - is there a way to run the jquery.live function without any event -

the live function of jquery triggered event api documentation here http://api.jquery.com/live/ $(".xyz").live('event', function(){ }); i want above function run without event , i.e class xyz dynamically created. i have tried without event parameter $(".xyz").live( function(){ }); but doesn't work !! adding i don't know want do, i'll make assumptions. scenario 1 in order execute function inside jquery, need tell jquery when execute function, otherwise cannot know. 1 way is: $(document).ready(function () { $('.xyz').css('color', 'red'); // more code, anything, functions, calculations, etc. }); the code inside function executed dom ready (is safe manipulate). can put $('.xyz').css('color', 'red'); outside ready() event , executed. "event" time when executions of page reaches line of code. example, if put line before html, don't have ...

r - generating a histbackback graph -

i thought generating histbackback graph fpr masterthesis in r. doesn't work. think have mistake somewhere in command or in thoughts, how gengerate graph. i want illustrate, how "fun" people had , on other side how "evaluate" used tool. these 2 'parameters' x-axis in units of people/answers. surveyed people gave me answers these 2 points making 5 point rating, i.e. 'a lot of fun' till 'very less fun' (see orignial data underneath). 5 point rating scale shall on y-axis. how generate hisbackback graph. r gives me message: 'x' must numeric... i tried generate graph following commands: library(hmisc) age <- vs[,1] # sex <- c("spaß", "beurteilung") out <- histbackback(split(age, sex), probability=true, xlim=c(-11,11), main = "histogramm des spaßfaktors und der beurteilung von videoscribe") barplot(-out$left, col="blue", horiz=true, space=0, add=true, axes=false) barplot(out$...

tomcat - Recommended way to save uploaded files in a servlet application -

i read here 1 should not save file in server anyway not portable, transactional , requires external parameters. however, given need tmp solution tomcat (7) , have (relative) control on server machine want know : what best place save file ? should save in /web-inf/uploads (advised against here ) or someplace under $catalina_base (see here ) or ... ? javaee 6 tutorial gets path user (:wtf:). nb : file should not downloadable means. should set config parameter detailed here ? i'd appreciate code (i'd rather give relative path - @ least tomcat portable) - part.write() looks promising - apparently needs absolute path i'd interested in exposition of disadvantages of approach vs database/jcr repository one unfortunately fileservlet @balusc concentrates on downloading files, while answer on uploading files skips part on save file. a solution convertible use db or jcr implementation (like jackrabbit ) preferable. store anywhere in accessible location ...

dns - How to fake domain in address bar (to show completely different domain)? -

is there way example use website called www.mywebsite.com , in address bar show www.wikipedia.com ? and of course load contents mywebsite.com ? that's kind of thing don't want happen, because then, many people fish visitors going facebook.com ads or clickbait websites instead. couldn't if wanted to, saying, if call @ person a's number, directly refer person b instead. hope gives explaination!

winforms - C# WF Semi-transparent form -

Image
i want create desktop border less widget semi-transparent background in wf. : but no luck now. can achieve full background transparency this.backcolor = color.black; this.transparencykey = this.backcolor; or entire form with this.opacity = .4; some time spend on combination transparencykey backgroundimage, result solid black background. fully desperate created 2 forms 1 transparent text , second opacity, couldn't keep first window above during moving, text dimmed. is there possibility make in wf or need qt or antoher window library. after few days of research didn't find solution working @ windows 10. looks there no method work on it. ended creating project in wpf, can made easily.

java - How to set -xnohup option on JAVA_OPTIONS -

i've read these articles 1 , 2 need set -xnohup option on java_options when starting weblogic. in order avoid error error ####<sep 7, 2012 3:14:20 pm ist> <notice> <weblogicserver> <ncorp-plm-08> <ncorp-plm-08-agileserver> <thread-1> <<wls kernel>> <> <> <1347011060768> <bea-000388> <jvm called wls shutdown hook. server force shutdown now> ####<sep 7, 2012 3:14:20 pm ist> <alert> <weblogicserver> <ncorp-plm-08> <ncorp-plm-08-agileserver> <thread-1> <<wls kernel>> <> <> <1347011060768> <bea-000396> <server shutdown has been requested <wls kernel>> however can't find in setdomain.sh need place -xnohup. using oracle weblogic 12c , oracle linux. java version java version "1.7.0_79" java(tm) se runtime environment (build 1.7.0_79-b15) java hotspot(tm) 64-bit server vm (build 24.79-b02, mixed mode)...

nscollectionviewitem - NSCollectionView with different item types -

accordingly apple documentation can use multiple item types in single nscollectionview, when it, problem. can't remove items. a single collection view can support multiple item types, each own distinct appearance, , can mix , match item types in same collection view if want. my code snippet - (nscollectionviewitem *)collectionview:(nscollectionview *)collectionview itemforrepresentedobjectatindexpath:(nsindexpath *)indexpath { nsinteger index = indexpath.item; dataitem * item = [self.data itemat:index]; if (item.type == itemtype1) { typeitemcontroller1 * itemcontroller = [collectionview makeitemwithidentifier:@"typeitemcontroller1" forindexpath:indexpath]; [itemcontroller updatewithindex:index]; return itemcontroller; } else { typeitemcontroller2 * itemcontroller = [collectionview makeitemwithidentifier:@"typeitemcontroller...

Custom JSON structure in .NET Core -

i'm trying learn .net core; background largely php absence of type system makes i'm trying here trivial. i'm trying create api small wrapper response. instead of sending {"user": "..."} can send {"message": "...", "data": {"user": "..."}} to start, began poco wrapper: public class appresponse<t> { public string message { get; set; } public t data { get; set; } } then, instantiate wrapper differently each time need response object: [httppost] public async task<iactionresult> register(registerviewmodel model) { if (modelstate.isvalid) { var user = new applicationuser { username = model.email, email = model.email }; var result = await _usermanager.createasync(user, model.password); if (result.succeeded) { var okresponse = new appresponse<registerviewmodel>(); okresponse.message = "your account has b...