Posts

Showing posts from March, 2012

opengl es - MCPE GLSL Conditionals -

i'm writing ios vertex shader "flattens" mc world in x direction if change in z direction detected, , vice versa (the xz plane perp height). have several shaders warp world fine, writing pseudo movement detection hasn't worked. know conditionals costly. comparing position number , worked: if (worldpos.x != 4.) { worldpos.z = 0.; } but comparing position static call of position doesn't. far i've tried assigning constant floats x , z components, uniform floats, , pos4 uniform, no success. have feeling conditionals fail because of data type problem? easier debug if pe version displayed coord pc. any/all help! current code: uniform pos4 chunk_origin_and_scale; attribute pos4 position; void main() { pos4 worldpos; worldpos.xyz = (position.xyz * chunk_origin_and_scale.w) + chunk_origin_and_scale.xyz; worldpos.w = 1.; const float staticposx = worldpos.x; const float staticposz = worldpos.z; if (worldpos.x != staticposx) { worldpos.z = 0.; sta

arrays - C# How to iterate through a list of files without using Directory.GetFiles() method -

i have several security cameras upload pictures ftp server. of these cams conveniently create subfolders @ start of new day in format "yyyymmdd". great , makes easy maintain/delete older pictures particular day. other cams aren't nice , dump pictures in giant folder, making deletion difficult. so writing c# windows form program go specific folder (source folder) using folderbrowserdialog , name target folder using fbd. using standard process iterate through file list using string array filled via directory.getfiles() method. use file's creation date create subfolder if doesn't exist. in either case move file date based subfolder. works great while testing small numbers of files. now i'm ready test against real data , i'm concerned folders having thousands of files, i'm going have many issues memory , other problems. how can string array handle such huge volumes of data? note 1 folder has on 28,000 pictures. can string array handle such large nu

web services - An exception has occurred while using the formatter 'JsonNetMediaTypeFormatter' to generate sample for media type 'Application/Json' -

Image
this method. create project using asp.net soap restful converter template. soap webservice giving dataset response , it's working fine, want use converting web api. i created wrapper class manipulate soap method , response attached image. is possible dataset response json object? i beginner web api development.

Firebase Rules: What is .contains()? -

i have read through firebase documentation , not understand .contains() . below sample rules firebase database in documentation: { "rules": { "rooms": { "$room_id": { "topic": { // room's topic can changed if room id has "public" in ".write": "$room_id.contains('public')" } } } } } may know $room_id.contains('public') ? is referred child of $room_id ? $room_id matched wildcard key name appears parent of "topic". rule allowing writes if key name contains string "public" anywhere in it. so, if tried change value of /rooms/public_roomid/topic value, allowed. however, write of /rooms/roomid/topic rejected.

Same login on two different Laravel projects on same server -

i want create 2 portals on same server , diferent subdomain: app1.domain.com app2.domain.com i want separate in 2 different laravel projects, when authenticated in 1 of portals in other portal should authenticated. how can that? suggestions helpful i think looking sso for laravel in quick search found packages jasny/sso 1 of them, explained : how works when using sso, when can distinguish 3 parties: client - browser of visitor broker - website visited server - place holds user info , credentials the broker has id , secret. these know both broker , server. when client visits broker, creates random token, stored in cookie. broker send client server, passing along broker's id , token. server creates hash using broker id, broker secret , token. hash used create link users session. when link created server redirects client broker. the broker can create same link hash using token (from cookie), broker id , broker secret. when doing requests, passes

sql server - Fact table referencing another fact table? -

we started working on our data warehouse. have technicians, salespersons, date, branch, customer our dimensions. have transactional tables in oltp such sales orders, agreements, referenced each other in situations. i'm planning put sales order, agreements info in fact tables. so, reference above mentioned dimensions in both fact tables. but, here comes problem. sales orders , service agreements need referenced each other. in cases, agreements information need referenced in sales orders. can reference 2 fact tables each other in fact table? sales orders table in oltp consists million records, , agreement table holds half million records(minimum). can let me know if can reference these 2 in fact table? do have agreementid can added each fact table , used drill across? degenerate dimension - dimension key without dimension table.

c# - NReco PdfGenerator disable selection -

i want disable selection, image, if contain text. i know pdf contain layers, dont find remove text layer. thanks. var htmltopdf = new nreco.pdfgenerator.htmltopdfconverter(); htmltopdf.size = nreco.pdfgenerator.pagesize.letter; htmltopdf.margins = new nreco.pdfgenerator.pagemargins() { bottom = 0, top = 0, left = 0, right = 0 }; string id = "test"; response.contenttype = "application/pdf"; response.appendheader("content-disposition", string.format("inline;filename=\"{0}.pdf\"", id)); htmltopdf.generatepdffromfile("page.aspx", null, response.outputstream); response.end(); pdfgenerator internally uses wkhtmltopdf , renders text content text blocks , selectable default; behavior cannot changed. if want guarantee text cannot selected should rendered image (= can render html image fi

GEPHI- Is there a way for me to put the nodes with the highest weight at the center of the network in Gephi? -

it looks gephi puts nodes greatest number of degrees @ center of network. wondering if there way incorporate weight positioning of nodes in graph, , create network nodes @ center of network ones highest weighted degree. thanks help. let me know if there's else can include.

python - assign a column in a data frame based on another column -

i have following dataframe example univ date ms kv 11/01/2007 1 0.2 11/02/2007 0 0.3 11/03/2007 1 0.4 11/05/2007 1 0.1 b 11/01/2007 0 0.11 b 11/03/2007 1 0.12 b 11/04/2007 1 0.13 for each univ group, calculate average of kv, next available date after ms = 1. in above case a, ms = 1 on 11/01 , 11/03 , 11/05 output should be univ kv 0.2 ( average of 0.3 , 0.1) i make "next available date" flexible "the second next or third next available date" thanks much! iiuc: in [244]: n=1 in [245]: df.groupby('univ') \ .apply(lambda x: x.loc[x.ms.shift(n)==1, 'kv'].mean()) \ .reset_index(name='kv') out[245]: univ kv 0 0.20 1 b 0.13 in [246]: n=2 in [247]: df.groupby('univ') \ .apply(lambda x: x.loc[x.ms.shift(n)==1, 'kv'].mean()) \ .reset_index(name='kv') out[247]: univ

c++ - Initialize union with array? -

i new c++. want create data structure network communication (tcp), can build byte array small tagged pieces (like in serialized class). , of course need reverse behavior of this. need tagged pieces byte array, that's why put constructor union. typedef union message { struct { int header; int payload; } pieces; int whole[2]; message (int* arr) { (int = 0; < 2; i++) { whole[i] = arr[i]; } } message ():ival(){} } message ; main() { int a[2] = {10, 2}; message msg(a); } this snippet working. i'm curious: there better solution initialize union array?

R- Connecting the maximum and the minimum value of two adjacent categorical variables in ggplot2 -

Image
i have scatter plot now. each color represent categorical group , each group has range of values on x-axis. there should not overlapping between range of categorical variables. however, because of thickness of scatter points, looks there overlapping. so, want draw line connect maximum point of group , minimum point of adjacent group long line not have negative slope, can show there no overlapping between each categorical variable. i not know how use geom_line() connect 2 points y-coordinate categorical variable. possible so?? any appreciated!!! it sounds want geom_segment not geom_line . you'll need aggregate data new data frame has points want plotted. adapted brian's sample data , use dplyr this: # sample data df <- data.frame(xvals = runif(50, 0, 1)) df$cats <- cut(df$xvals, c(0, .25, .625, 1)) # aggregation library(dplyr) df_summ = df %>% group_by(cats) %>% summarize(min = min(xvals), max = max(xvals)) %>% mutate(adj_max = lead

swift - How to parse data from firebase and then save it within a model. Swift3 MVC format -

i have user class within firebasedb. expect flat file db like: users->uid->profile->key/values. trying implement best practice within code want data handled user model in xcode project. how go parsing data , saving class variables within model. class user { private var _username: string private var _uid: string var uid: string { return _uid } var username: string { return _username } init (uid: string, username:string) { self._uid = uid self._username = username } func getuserdata() { dataservice.ds.ref_users.observesingleevent(of: .value, with: { (snapshot) in if let users = snapshot.value as? dictionary<string, any>{ (key, value) in users { // use in loop iterate through each key/value pair in database stored dictionary. if let dict = value as? dictionary<string, any

osx - Unable to choose Python source in BuildApplet -

Image
i using mac os sierra pre-installed application called buildapplet. found out application used turning .py file .dmg have problem though. wont let me choose python .py file. any suggestion ?

c# - How can I filter List property -

on view have autosuggestbox(searchfield) , listview, listview's itemsource bounded vm class property: private class1 _searchmatches; public class1 searchmatches { { return _searchmatches; } set { this.set(ref _searchmatches, value); } } on class1 have loaditems task: async task> loaditems() var stocks = _response.products? .select(s => new myclass(plservice.dtotomodel(s))) .tolist(); var items = stocks.groupby(p => p.productmodel.description) .select(p => p.first()) .tolist(); return items; when type test on autosuggestbox , hit enter, simplest way filter items where(item.description == searchterm)? filter , update itemsource, not rewriting property you can use <searchbox> , it's querysubmitted event. work <textbox> too. if need refilter items - create 2 lists, 1 store items , items displaying. here <

hadoop - Hive pause and resume task -

my question i new in hive , hadoop environment. want pause , resume hive job running on hadoop. what have tried i want ideas related same. thinking might save state of mappers , reducer if feasible. but not know how keep track of mapper , reducer. have found interfaces , classes in hadoop jobid, jobclient can in keeping track of same. read workflow kind of stuff tracing each task not clarity. this practically impossible if not mistaken hive job (or hadoop mapreduce job matter) can waiting, running or finished (either succesfully, or failed). there no way pause hive job , continue. there not 'debug shortcut' in languages allow pause processing in middle of step, , have not seen breakpoints either. but here how can close 1. split job this practical (though limited) approach. rather making 1 hive script, make 2 , run first one. first 1 part of steps, or operate on part of data, allowing 'pause'. resuming running complementary second scrip

Elixir / Phoenix: Views for channels? -

i'm creating chat app , have bunch of channel messages. here's 1 of them: def handle_in("read", %{ "chat_id" => chat_id }, socket) user_id = socket.assigns[:id] ts = datetime.utc_now case chatmanager.mark_as_read({user_id, chat_id, ts}) {:ok, chat_user} -> last_read_at_unix = chat_user.last_read_at |> timeconverter.ecto_to_unix {:reply, {:ok, %{ chat_id: chat_id, last_read_at: last_read_at_unix }}, socket} {:error, changeset} -> {:reply, {:error, %{errors: changeset.errors}}, socket} end end can use phoenix views separate presentation / response logic? way can go view file , see returned each message. phoenix views normal modules functions in them. you can either call functions directly: myapp.web.chatview.render("message.json", %{message: my_message}) or use phoenix.view function call render/2 function of view: phoenix.view.render_one(myapp.web.chatview, "message.json&q

java - How to use CSS/jQuery and other kind of script files with StringTemplate4? -

i trying build simple html page dynamic information. using stringtemplate 4 simple core java achieve this. have actions perform on page hiding , showing divs able achieve using jquery. beautify page little , want use basic css this. of have included in template files , able work it. sample mentioned below: sample(employee) ::=<< <html> <head> <script src="jquery min js file location"></script> <script> jquery(document).ready(function() { jquery code }); </script> <style type="text/css"> css code </style> <body> <div> employee name : $employee.name$ </div> </body> </html> >> however, making template files lot bloated , separate in respective files , include them in normal html files below: sample(employee) ::=<< <html> <head> <script src="jquery min

activerecord - rails - updating active record relation with multiple changed properties -

i have active record relation defined this: contacts = contact.where("status = 'waiting'") i run .each loop , change properties of contacts depending on logic. i don't want save! on each individual contact... how can better save entire contacts relation after loop? contacts.each |contact| //change properties of contact here end how save newly updates contacts activerecord relation after contains new properties? the efficient way can't doing contact contact save. update_all saves doing loop , save you, here documentation. https://apidock.com/rails/v4.0.2/activerecord/relation/update_all

Google Docs Viewer Render HTML Instead of File -

i tried use google doc viewer view file upload of user website. used formate url: https://docs.google.com/a/[dominio]/viewer?url=[file_url] instruction it. not viewing file, views html code instead. what wrong that? thanks

android - Error: 'Spinner' does not contain a definiton for getSelectedItem'...' -

i need selected item off spinner getting above error , don't know why. so, expecting spinner selected item without calling spinner's event handler, if that's possible, because need use on button click. protected override void oncreate(bundle bundle) { base.oncreate(bundle); // set our view "main" layout resource setcontentview (resource.layout.main); button bt_ok = findviewbyid<button>(resource.id.bt_ok); spinner spinner = (spinner)findviewbyid<spinner>(resource.id.dd_spinner); // //getselecteditem not contain definition!!! // string spinner_text = spinner.getselecteditem().tostring(); // //do need this? // spinner.itemselected += new eventhandler<adapterview.itemselectedeventargs>(spinner_itemselected); var adapter = arrayadapter.createfromresource( this, resource.array.planet_array, global::and

javascript - Relatives and absolute url when doing http.get in angular -

i'm new angular , it's being hard work things. i'm using latest angular ( version 4 ). have scenario : my backend rest services in baseurl/contextws my angular application in baseurl/contextfront the base tag href attribute pointing /contextfront both angular application , backend in same server (baseurl) the angular application embedded in iframe (because referenced application) . now lets want call baseurl/contextws/myservice angular application. how can ? i can't this.http.get('/contextws/myservice') because angular app translate baseurl/contextfront/contextws/myservice wrong. i tried build url : var url 'http://' + location.host +':' + location.port + '/contextws/myservice'; this.http.get(url); this works in application, when app referenced in iframe gives me error "undefined". any appreciated.

oracle - Sql to order results by sum -

db used - oracle create table customer_exercise( customer_id number, exercise_id number, cnt number, exercise_date date) table data 1000 10 3 17-dec-15 1001 20 6 19-dec-15 1000 20 2 20-dec-15 1003 20 9 20-dec-15 1000 20 6 22-dec-15 1000 30 10 23-dec-15 1001 10 25 10-dec-15 is possible results using sql such sum(cnt) exercise_id 20 appears first in resultset? select customer_id , exercise_id, sum(cnt) customer_exercise customer_id in (1000, 1001, 1003) , exercise_id in (20) group customer_id, exercise_id order sum(cnt) 1001 20 6 1000 20 8 1003 20 9 select customer_id , exercise_id, sum(cnt) customer_exercise customer_id in (1000, 1001, 1003) , exercise_id not in (20) group customer_id, exercise_id order sum(cnt) 1000 10 3 1000 30 10 1001 10 25 what trying merge results of above 2 queries 1 sql. possible write single sql fetch resultset below? 1001 20 6 1000 20 8 1003 20 9 1000 10 3 10

javascript - Remove event listener from the inside if specified callback function -

i have situation, want attach function parameters event listener, this: var pauseaudioat = function(aud, seconds, removelistener) { console.log(aud.currenttime); // check whether have passed 5 minutes, // current time given in seconds if(aud.currenttime >= seconds) { // pause playback aud.pause(); if (removelistener) { aud.removeeventlistener('timeupdate', pauseaudioat); showbtn(); } } } audio.addeventlistener("timeupdate", function() { pauseaudioat(audio, 18, true); }); i want remove listener function invoked? how can achieve ? thanks. you have pass .removeeventlistener() reference same function passed .addeventlistener() . 1 way minimal change existing code name (currently anonymous) function expression, pass function pauseaudioat() instead of passing boolean: var pauseaudioat = function(aud, seconds, listenertoremove) { console.log(

html - How to create button according to options in jquery -

i made "choose , reorder" module in drag , drop options if options arranged in correct order show button along correct(shown in figure) https://www.screencast.com/t/n8u5m0akkjd i have made half of module button part left.can guide me this? function eval() { $( ".ui_color" ).each(function() { var x= $(this).attr('value'); var y = $(this).parent().children().index(this) + 1; if(x==y) { alert('right') } else { alert('wrong'); } }); } $( function() { $( "#sortable" ).sortable({ revert: true }); $( "#draggable" ).draggable({ connecttosortable: "#sortable", helper: "clone", revert: "invalid" }); $( "ul, li" ).disableselection(); } ); $( "#sortable" ).sortable({ revert: true, update: function(event, ui){ v

java - Radio group not setting to radio buttons Android -

i fetching data database. based on value, i'm dynamically creating radio buttons. when try add radio group radio buttons, radio group not setting up. bcoz of can select many radio buttons @ once. attr_layout[i].addview(radiobutton, lp); attr_layout[i]` value buttons im getting. values small, medium , large. here complete code radiobutton. radiogroup radiogroup = new radiogroup(mmain); linearlayout[] attr_layout = new linearlayout[optionslist.size()]; attr_layout[i] = new linearlayout(mmain); attr_layout[i].setorientation(linearlayout.horizontal); int attr_size = attributes.size(); (int k = 0; k < attr_size; k++) { string price = string.format(locale.english, appconstants.decimal_points, float.parsefloat(attributes.get(k).getattr_price())); string name_price = attributes.get(k).getattr_name()

html - Not allow space as a first character and allow only letters using jquery -

im using jquery name validation have tried code given below $("#contactname").keypress(function(e) { if(e.which < 97 /* */ || e.which > 122 && (e.which < 65 || e.which > 90)) { e.preventdefault(); } }); the above code working fine allow letters , not allow numbers not allow space.so want should allow letters (both small , capital letters) should not allow numbers , special characters , accept space except first character , please tell me how restrict when copy paste. can use html5 attribute pattern ? see mdn article on more information. using regex of ^[a-za-z][\sa-za-z]* seems cover requirements. so like: <div>username:</div> <input type="text" pattern="^[a-za-z][\sa-za-z]*" title="can use upper , lower letters, , spaces must not start space" />

asp.net mvc - MVC Webgrid Efficient Paging -

i have webgrid in partial view , rending partial view in index.cshtml through controller action. on pageindex change, want pass page index number controller action. using procedure take records table.so when pass page number , page size fewer records load efficient paging can done. question how pass page index number on page change event. binding webgrid on load $.ajax({ url: "/alerts/bindusermessagelist", type: "get", async: false, cache: false, datatype: "json", success: function (data) { // alert(data); $("#divmessagepartial").html(data); }, error: function (error) { debugger; } }); on page index change how call controller action page index property in mvc? create procedure skiptake @pagno int, @pagesize int select * (select *, row_number() on (order [m_messageid]) rn [dbo].[ts_user_messages]

php - Fetch JSON data for authenticated user login -

i trying fetch signup details authenticated user login in react native. not working. new react native can wrong doing. index.js onpresslogin() { this.setstate({ isloading: true, error: '', }); dismisskeyboard(); fetch('http://10.0.2.2/movies/signup.php' ,{ method: 'get', headers: { 'accept' : 'application/json' , 'content-type': 'application/json' }, body : json.stringify({ contact : this.state.contact, password: this.state.password }) }).then((response) => { return response.json(); }).then((response) => { if(response.json){ const routestack = this.props.navigator.getcurrentroutes(); this.props.navigator.jumpto(routestack[3]); asyncstorage.multiset([ [ 'contact' , response.contact], ]); } else { a

React router V4 link to external address -

i've tried few different recommendations, however, none seem work. i'm using react router v4 , create link navigates external website. currently, appends url. what want happen www.mysite.com => click internal link , go => www.newsite.com what happening www.mysite.com => click internal link , go new page appends => www.mysite.com/www.newsite.com <link to="http://www.newsite.com">go new site</link>

eclipse plugin - Get the current editor's CTabFolder -

how can ctabfolder current e4 editor on? in e3 following worked: iworkbenchpartsite site = getsite(); partpane currenteditorpartpane = ((partsite) site).getpane(); partstack stack = currenteditorpartpane.getstack(); control control = stack.getcontrol(); ctabfolder tabfolder = (ctabfolder) control; and since there questions why need this: i can't make editor closeable i can't stack editors , views but customer wants have stack of editors first tab being non-closable overview part.

javascript - How would I append the result value? -

function getnote() { var textfield = document.getelementbyid('textfield').value; var result = document.getelementbyid('result'); result.innerhtml = textfield; } var submitbutton = document.getelementbyid('submitbutton'); submitbutton.addeventlistener('click',getnote); <html lang="en"> <head> <div id="wrapper"> <div class="topnav" id="mytopnav"> <a href="#home">notetaker</a> </div> <title>note taker</title> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-bvyiisifek1dgmjrakycuhahrg32omucww7on3rydg4va+pmstsz/k68vbdejh4u" crossorigin="anonymous"></head> <body id="style"> <div id ="centerfield"> <h1> new note</h1> <textarea id="textfield"rows=&q

android - Grade sync failing after adding a library -

Image
this library using: https://github.com/arthurhub/android-image-cropper the grade sync fails after adding it. before that, there no problem. apparently, library using uses older version of support library v25.3.1, , conflicting 1 have. try following: compile ('com.theartofdev.edmodo:android-image-cropper:2.4.+') { exclude group: 'com.android.support' } however there no guarantees library work considering different version.

java - JNA code working fine in OSx , but unable to lookup function in Linux from C shared object file -

i working following example: https://github.com/caplin/jnijnaexamples/tree/master/jna in mac , create .dylib file follows: gcc -shared -fpic -o librandomjna.o randomjna.c g++ -dynamiclib -undefined suppress -flat_namespace *.o -o librandomjna.dylib mkdir classes javac -d classes -classpath jna-4.4.0.jar javanativeaccess.java cd classes export ld_library_path=. java -classpath jna-4.4.0.jar:. com.enlightedinc.apps.where.utils.javanativeaccess in osx, works expected , able execute c function list_files now in linux box , created .so file follows gcc -shared -fpic -o librandomjna.o randomjna.c gcc -shared -o librandomjna.so *.o in same way, new classes generated in linux mkdir classes javac -d classes -classpath jna-4.4.0.jar javanativeaccess.java cd classes export ld_library_path=. java -classpath jna-4.4.0.jar:. com.enlightedinc.apps.where.utils.javanativeaccess now when try execute code in

python - Jupyterhub page header and css override in config -

i using jupyterhub extension of website. have deployed jupyterhub on amazon ec2 , want override default style (css file) , page header integrate nicely other site. is there way configure jupyterhub custom style css file , header html file command line when launching? preferably in fashion such : $ jupyterhub --jupyterhub.style=custom.css --jupyterhub.header=custom.html

python - ImportError: No module named numpy on Ubuntu after Numpy Installation -

i trying use numpy on ubuntu 16.04. have python 2.7.12 installed. have tried: sudo apt install python-numpy sudo apt autoremove dpkg -l python-numpy here excerpt of output: /. /usr /usr/lib /usr/lib/python2.7 /usr/lib/python2.7/dist-packages /usr/lib/python2.7/dist-packages/numpy-1.11.0.egg-info /usr/lib/python2.7/dist-packages/numpy-1.11.0.egg-info/dependency_links.txt /usr/lib/python2.7/dist-packages/numpy-1.11.0.egg-info/pkg-info /usr/lib/python2.7/dist-packages/numpy-1.11.0.egg-info/top_level.txt /usr/lib/python2.7/dist-packages/numpy /usr/lib/python2.7/dist-packages/numpy/lib /usr/lib/python2.7/dist-packages/numpy/lib/shape_base.py however, when try run simple file such this, still same error. #!/usr/bin/env python2 import numpy np = np.array([1, 2, 3]) python test2.py traceback (most recent call last): file "test2.py", line 3, in <module> import numpy np importerror: no module named numpy is there left need check for? thanks!

neo4j - Return common node between 2 different queries -

i want find out common node between 2 different queries. trying hard find out, not think of solution. motive collect top 5 out-degree nodes, collect top 5 root nodes, , return nodes common between top 5 outdegree , root nodes. don't know how merge results because after using "return" option in first query, no further statements executed, without "return" option cannot collect results. (please correct me, if thinking wrong). following queries, // root nodes match (u:port1)<-[r]-(root) not((root)<--()) return distinct(root.id) node, count(r) outdegree order count(r) desc limit 5 //for outdegree nodes match (n:port1)-[r]->() return n.id node, count(r) outdegree order outdegree desc union match (a:port1)-[r]->(leaf) not((leaf)-->()) return leaf.id node, 0 outdegree limit 5 how should combine both results, , output of list of nodes common? please me. in advance. if want intersection between two, don't need unions. collect top 5 in

php - TCPDF toc(table of content) with freemono font creating an issue -

i creating pdf have special character (≥,≤ etc.) using freemono font creating issue in toc( table of content ). in toc displaying page no. 10,11 etc. {++..} if use courier font instead of freemono working fine not displaying specail character shown ? .

javascript - tinymce is undefined in plugin development using npm start -

i used on mac os x way described here . my page: <!doctype html> <html> <head> <script type="text/javascript" src="https://cloud.tinymce.com/stable/tinymce.min.js"></script> <script> tinymce.init({ selector:'textarea', plugins: 'myplugin', toolbar: 'myplugin' }); </script> </head> <body> <textarea>testing myplugin</textarea> </body> </html> so npm start , webpack 2.7.0 starts on port 8080. browser opens , see textarea. but tinymce undefined . checking source , click link can see resource available. for testing moved tinymce folder static folder , changed <script type="text/javascript" src="/tinymce/tinymce.min.js"></script> but error then: the resource “http://localhost:8080/tinymce/tinymce.min.js” blocked due mime type mismatch (x-content-type-options: nosniff). i new using

java - Passing Object type and Field to Comparator -

is possible write comparator can pass object type, field type , field sort on? i've made small changes http://www.davekoelle.com/files/alphanumcomparator.java accommodate sorting on field email of type string in object type user . have code works. public class main { public static void main(string[] args) { list<user> users = new arraylist<>(); users.add(new user(7, "user1", "user1@c.com")); users.add(new user(11, "user20", "user20@c.com")); users.add(new user(5, "admin20", "admin20@c.com")); users.add(new user(10, "user11", "user11@c.com")); users.add(new user(6, "admin21", "admin21@c.com")); users.add(new user(12, "user21", "user21@c.com")); users.add(new user(8, "user2", "user2@c.com")); users.add(new user(1, "admin1", "admi

ssh - Python Paramiko exec_command doesn't print few commands outputs -

i trying build python script using paramiko should ssh linux server , execute command, commands output working example df -f,netstat of them aren't example onstat -,ifconfig . need solving issue. #!/usr/pkg/bin/python #importing modules import paramiko import time #setting parameters host ip, username, passwd , number of iterations gather cmds host = 'x.x.x.x' user = 'abc' pass = 'efg' iteration = 3 client1=paramiko.sshclient() #add missing client key client1.set_missing_host_key_policy(paramiko.autoaddpolicy()) #connect cucm client1.connect(host,username=user,password=pass) print("ssh connection %s established" %host) #gather commands , read output stdout stdin, stdout, stderr = client1.exec_command("onstat -") time.sleep(2) line in stdout.readlines(): print(line) client1.close() print("logged out of device %s" %host) any thought how resolve this?

ruby on rails - Stripe::InvalidRequestError Must provide source or customer -

order controller page begin stripe.api_key = env["stripe_api_key"] token = params[:stripetoken] charge = stripe::charge.create( :amount => (@listing.price * 100).floor, :currency => "usd", :source => params[:stripetoken], :destination => @seller.recipient ) flash[:notice] = "thanks ordering!" rescue stripe::carderror => e flash[:danger] = e.message end order.js.coffee jquery -> stripe.setpublishablekey($('meta[name="stripe-key"]').attr('content')) payment.setupform() payment = setupform: -> $('#new_order').submit -> $('input[type=submit]').attr('disabled', true) stripe.card.createtoken($('#new_order'), payment.handlestriperesponse) false handlestriperesponse: (status, response) -> if status == 200 $('#new_order').append($('<input ty

extjs - Ajax call error during Rally sdk custom dashboard developement -

i'm getting 403 exception when make ajax call jenkins api call build details rally sdk custom html interface. //ajax api call jenkins var blink ="https://[jenkinshost]/job/appdev/job/testproject/api/json"; ext.ajax.request({ url: blink, method :'get', crossdomain: true, withcredentials: true, headers : { 'authorization': 'basic dsasfsfxfhfj', 'content-type': 'application/json;charset=utf-8', }, success: function(response){ var backtojs=json.parse(response.responsetext); console.log('resp data-',backtojs); //console.log(backtojs['queryresult'].results); }, failure: function(response) { console.log('jenkins-ajax call failure'); } }); ajax call er

java - ClassNotFoundException with Maven dependency system scoped -

Image
i getting classnotfoundexception , noclassdeffounderror exceptions when attempt run application using maven defined dependency. i added maven dependency jar in question pom.xml file following declaration: <dependency> <groupid>ldap</groupid> <artifactid>com.novell.ldap</artifactid> <systempath>${local.lib.dir}/ldap.jar</systempath> <scope>system</scope> <version>1</version> </dependency> the jar correctly added dependencies netbeans project but when deploy app dependency missing java.lang.noclassdeffounderror: com/novell/ldap/ldapexception if read maven documentation scope, seems expected behavior if application server doesn't provide library @ runtime: this scope similar provided except have provide jar contains explicitly. the provided scope states : this compile, indicates you expect jdk or container provide dependency @ runtime . not advised solution

sql server - SQL CASE statement with boolean operator -

see statement: select t1.region, count(t1.orders) as orders, case t1.week                       when < '5' then 'apr'                       when < '10' then 'may'                       when < '14' then 'jun'                       when < '19' then 'jul'                       when < '23' then 'aug'                       when < '27' then 'sep'                       when < '32' then 'oct'                       when < '36' then 'nov'                       when < '40' then 'dec'                       when < '45' then 'jan'                       when < '49' then 'feb'                       when < '53' then 'mar' end as month, dbo.inf_dates.months dbo.[nonvoice weekly_inflowcomcan] as t1

java - JCalender not showing day number -

Image
i using below library jcalender, date picker gui can put netbeans pallet. date date = showdatechooser.getdate(); dateformat dateformat1 = new simpledateformat("e"); string day = dateformat1.format(date); dateformat dateformat2 = new simpledateformat("yyyy/mm/dd"); string showdate = dateformat2.format(date); since neither linked to, nor named jcalendar implementation using, assume jcalendar kai tödter . - @ least can tell screenshot. using component simple, example should do: import java.awt.eventqueue; import javax.swing.jframe; import com.toedter.calendar.jcalendar; public class demo { private jframe frame; public static void main(string[] args) { eventqueue.invokelater(new runnable() { public void run() { try { demo window = new demo(); window.frame.setvisible(true); } catch (exception e) { e.printstacktrace(); } } }); } public demo()

cq5 - Preview of Pdf is not getting displayed in AEM 6.3 -

i using "granite/ui/components/foundation/form/fileupload" upload pdf in dialog , put restriction on mime type pdf can allowed. now when upload pdf , again reopen dialog, preview of thumbnail of pdf not getting displayed in component dialog. i trying put sizelimit on dialog.but not working. please help. when ever update asset, dam update asset workflow ( /etc/workflow/models/dam/update_asset.html ) triggered. there step in workflow create thumbnail. make sure step exists , workflow triggered when update asset. workflow screenshot

php - Magento 2 - custom price can not add to subtotal and grand total after add to cart -

Image
i want add custom price bundle products after adding cart. have used "checkout_cart_product_add_after" observer so. adding custom price product price, not in sub total , grand total. following code: <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:nonamespaceschemalocation="urn:magento:framework:event/etc/events.xsd"> <!-- event add cart --> <event name="checkout_cart_product_add_after"> <observer name="customprice_observer_set_price_for_item_add" instance="custom\shop\model\observer\setpriceforitem"/> </event> </config> observer class: namespace custom\shop\model\observer; use magento\framework\event\observer; use magento\framework\event\observerinterface; use magento\catalog\model\product\type; class setpriceforitem implements observerinterface { public function execute(observer $observer) {

python - How can I change a month in a DateTime, using for loop (or better method )? -

revised question appropriate mcve: as part of script i'm writing need have loop contains different pair of dates during each iteration, these dates first , last available stock trading dates of each month. have managed find calendar available dates in index despite research not sure how select correct dates index can used in datetime variables start , end . here far research has got me , continue search , build own solution post if manage find one: from __future__ import division import numpy np import pandas pd import datetime import pandas_market_calendars mcal pandas_datareader import data web datetime import date ''' full date range: ''' startrange = datetime.date(2016, 1, 1) endrange = datetime.date(2016, 12, 31) ''' tradable dates in year: ''' nyse = mcal.get_calendar('nyse') available = nyse.valid_days(start_date='2016-01-01', end_date='2016-12-31') ''' loop needs take first , last t

javascript - rxjs/redux-observer: observable.retry to re-establish connection -

i using elixir phoenix websocket in application i'm building , have epic looks this: const socketobservable = observable.create((observer: object) => { const socket = new socket(`${getwebsocketurl()}/socket`, { params: { token: readsession(), } }); socket.connect(); socket.onopen(() => observer.next({ type: socket_connected, socket }), ); socket.onerror((error) => observer.error({ type: websocket_error, error }), ); return () => { // socket.disconnect(); }; }); const connecttosocket = ( action$: object, ) => action$.oftype(connect_to_socket) .switchmap(() => socketobservable .catch((error) => observable.of(error)), ) .retry(); export default connecttosocket; what happen user notified when network connection goes away emitting { type: websocket_error, error } , have notification removed when connection reestablished emitting { type: socket_connected, socket } . got first part working, when re-connecti

How to append multiple objects in array with jquery each() method -

there array called employeedetails , in array there 3 objects. want append 3 objects , properties table using jquery's each() method. i trying, it's not working. did for loop , created when used each() not able view it. want done through each() method. please me , correct me wrong. $(document).ready(function() { var employeedetails = [{ srno: 1, doj: '20 april 2011', dob: '11 june 1987', name: 'aniket paste', designation: 'web designer', salary: 30000, address: 'borivali east' },{ srno: 2, doj: '10 april 2011', dob: '15 may 1987', name: 'amey sawant', designation: 'ui developerr', salary: 50000, address: 'borivali east' },{ srno: 3, doj: '21 june 2014', dob: '11 december 1989', name: 'mahesh parab', designation: 'frontend developer', salary:

html5 - Kendo Validator for email list with MVVM -

is there validator email list? want email list kendo input. this code: html page <form id="idform"> <label for="p">e-mail</label> <input type="email" data-bind="value: mail" id="p" name="mail" class="formcontrol" placeholder="mail" required data-email-msg="email format not valid" /> </form> js page var page = { vm: null, _idform:"idform", bind: function(){ this.vm = kendo.observable({ mail: null }); page.kendobind(page._idform); }, kendobind: function(id){ kendoutils.bind(id, page.vm); }, send: function(){ page._validator = $("#" + page._idform).kendovalidator().data("kendovalidator"); $("#" + page._idform).submit(function(event) { if (page._validator.validate()) { console.log("valid&quo

Angular 4 using subscribe to bind data from a promise with an observable not working -

hello have pouchdb service retrieves data , return promise it. want convert promise observable , subscribe in ngoninit model gets updated. i made implementation of service method returns observable, it's not working (the data not reflected on dom): component html: <h1>{{title}}</h1> <ul> <li *ngfor="let platform of platforms"> <a href="#">{{ platform }}</a> </li> </ul> component ts: import { component, oninit } '@angular/core'; import { pouchdbbuilder } './pouchdbbuilder'; import { platformsservice } './services/platformsservice'; @component({ selector: 'platforms', templateurl: './platforms.component.html' }) export class platformscomponent implements oninit { title : string; platforms: array<string>; private platformsservice; constructor() { this.title = "all platforms"; let servicename = 'http://xxxx.net:5984/