Posts

Showing posts from September, 2010

angularjs - url rewritting for jhipster -

i have question , don't know if it's possible. i'm trying remove '#' in jhipster website urls , saw that's difficult in code. exemple: http://www.exemple.com/#/test -> http://www.exemple.com/test so, possible other way ? .htaccess or else ? i want precise, i'm working old version of jhipster , it's angularjs application. i'm generating .war , i'm deploying on dedicated server apache2 , application using port 8000 made conf virtual hosts. maybe can add here ?. thanks yes can in angularjs - basically need # non-html browsers or else without make http call.(so used old browsers). can tell angular use html5 mode- in route config add html5mode(true); @ end. eg- app.config(function($routeprovider,$locationprovider) { $routeprovider.when('/home', { templateurl:'/views/home.html' }); $locationprovider.html5mode(true); }); in html head tag add base tag - <html> <head> <meta charse

jwt - Django - How to implement authentication service in microservices architecture -

basically, have several independent services. want build service authentication. when client token authentication service. client use further request others services. client need attach token in header of request. services receiving token need verify token sending authentication server. requests clients make protected routes need verified authentication service. thing not know best place put code automatically sends token authentication service , receive result. here tried far: implemented middleware that: class verifytokenmiddleware(object): def process_request(self, request): if not request.meta.get('http_authorization'): return httpresponse(status=404) auth_header = request.meta.get('http_authorization') token = auth_header[4:] response = requests.post(auth_url, {"token": token}) if response.status_code == 400: return httpresponse(status=403) return none however, problem of solution every requests services(n

javascript - How do I code an "intellisense style" interface in Angular 2+ -

i writing formula builder function in survey system i.e. survey system lets user design , create survey, rendered , captured users. part of formula builder user creating survey can create self-answering question, indicate result of formula captured answers e.g. survey.id 555 question.id 10 plus survey.id 333 question 5. what want achieve intellisense style interface (similar say, hipchat , when type @ , auto overlays list of users select). an example of how user defines formula such: "#111 * (#333 + #222) / #444 #444 not = 0 , #111 > 0" in above # represents question captured survey , number database id question, however, user needs know these ids (which not practical). is: when # keyed-in open intellisense list (relative cursor position) captured surveys, select one, type in period (.) brings list of questions survey selected (again intellisense style) , select relevant question. i have looked @ using html description list overlays in angular don't

javascript - Cannot add two hyperlinks at the same time using JQuery -

i have application using asp.net mvc. trying put submenu @ side navigation when click on dropdown. since have multiple submenus single dropdown, put of side navigation. use code: <li id="dd_vehicle" class="dropdown"> <a id="x_btn" href="#" class="dropdown-toggle" data-toggle="dropdown" >vehicle <b class="caret"></b></a> <ul class="dropdown-menu"> <li id="item_registration"> @if (utils.isadmin()) { @html.actionlink("registration", "registration", "home") } </li> @*}*@ <li id="item_modify"> @html.actionlink("modify", "modify", "home") </li> <li id="item_history"> @html.actionlink("history", "history", "home") </li> <li id=&

python 3.x - Error while fitting a linear regression "ValueError: Found arrays with inconsistent numbers of samples" -

i trying execute following code: import numpy np sklearn import linear_model class marketingcosts: def desired_marketing_expenditure(marketing_expenditure, units_sold, desired_units_sold): model = linear_model.linearregression() model.fit(units_sold, marketing_expenditure) output = model.predict(desired_units_sold) return output print(marketingcosts.desired_marketing_expenditure( [300000, 200000, 400000, 300000, 100000], [60000, 50000, 90000, 80000, 30000], 60000)) however, obtain following error when run it: exec(code, run_globals) file "marketingcosts.py", in 60000)) file "marketingcosts.py", in desired_marketing_expenditure model.fit(units_sold, marketing_expenditure) valueerror: found arrays inconsistent numbers of samples: [1 5] does know why happening? tried make model.fit using np.array argument throws similar error. thanks in advance this code works. need transpose d

sprite - How to move character only when key is pressed down Python. -

i have been working through book called python kids. last project in book platforming game. game called mr stick man races exit. way move character (a stickman) press left or right , move left or right. unlike games, if let go of key, keeps moving. how make stop when key released? here link download of code: https://www.nostarch.com/pythonforkids if press download sample code book, program "stickmangame7" in chapter 18 folder. have included link in case embedded wrong bit on code. here embedded code may correct bit: class stickfiguresprite(sprite): def __init__(self, game): sprite.__init__(self, game) self.images_left = [ photoimage(file="stick-l1.gif"), photoimage(file="stick-l2.gif"), photoimage(file="stick-l3.gif") ] self.images_right = [ photoimage(file="stick-r1.gif"), photoimage(file="stick-r2.gif"), photoimage(file="stick-r3.gif")

windows - Weird control characters from Gradle in Windows10 -

in console "funky" output gradle when run cmd since switching windows 10. [0k [0k [2a[1m<==-----------> 18% executing [9s][m[34d[1b[1m> :compilescala[m[15d[1b[2a[1m<==-----------> 18% executing [10s][m[35d[2b[2a[1m<==-----------> 18% executing [11s][m[35d[2b[2a[1m<==-----------> 18% executing [12s][m[35d[2b[2a[1m<==-----------> 18% executing [13s][m[35d[2b[2a[1m<==-----------> 18% executing [14s][m[35d[2b[2athere 4 feature warnings; re-run -feature details 4 warnings found i imagine sort of control-characters-gone-wild gradle trying sensibly colour output, , windows interpreting wrong. powershell , sbt works fine - copying console "properties" settings powershell cmd doesn't fixit. has resolved this? i'm guessing pass --console plain in gradle command line disable rich console cause of "funky" characters https://docs.gradle.org/current/userguide/gradle_command_line.html

lucene - solr search with keywords having space not giving proper results -

i have list of keywords few of them below cheap hotels dubai hotel extended hotel .... .. i have store(storename:hotelsstore) , added keywords above(which have white space) store , doing solr indexing. if search "cheap hotels" store:hotelsstore not showing reults. but if add "cheaphotels" without space , indexing. if search "cheaphotels" desired store(hotelsstore) showing in results. note: using lucene 5.4 , solr 5.4. please me on this. thanks, syamala. try generate word parts using worddelimiterfilter filter on storename field. you customise filter how want. just example: one way of doing specify generatewordparts="1" catenatewords="1" in analyzer used indexing, , generatewordparts="1" in analyzer used querying. given current standardtokenizer removes many intra-word delimiters, recommended filter used after tokenizer leaves them in place (such whitespacetokenizer). <token

python - how to generate the report query without using the dimesion attribute for google DFP ad exchange API -

i trying generate report using dimension , columns (excluding dimension attribute ) dfp_api ad_exchange there no dimension attribute requirement . please me out in generating report .please find below report query report_job = { 'report_query': { 'dimensions': ['ad_exchange_agency'], 'statement': filter_statement, 'columns': ['ad_exchange_inventory_size', 'ad_exchange_url_id'], 'daterangetype': 'custom_date', 'startdate': start_date, 'enddate': end_date } }

php - Insert Data Using Custom View In Opencart -

when user submit data getting error fatal error: uncaught error: call member function insert() on null in c:\xampp\htdocs\smac\catalog\controller\payment\payment.php:45 this tpl file <script type="text/javascript"> $('#submit').submit(function() { $.ajax({ // create ajax call... data: $(this).serialize(), type: $(this).attr('method'), url: $(this).attr('action'), success: function(response) { $('#submit').html(response); } }); return false; }); </script> <form action="<?php echo $action; ?>" method="post"> name: <input type="text" name="name" required><br> e-mail: <input type="text" name="email" required><br> <input type="submit" value="submit" name="submit"> </form controller file: public fun

php - How can I search with Unicode characters in elasticsearch? -

i have indexed mysql column elasticsearch , column have ar/en/ro languages values. how can search within these indexes unicode string ? $hosts = ['localhost:9200']; $client = \elasticsearch\clientbuilder::create()->sethosts($hosts)->build(); $body = '{ "query": { "filtered": { "query": { "match_all": {} }, "filter": { "bool": { "must": [ {"query": {"wildcard": {"text": {"value": "*'.$term.'*"}}}}, {"query": {"wildcard": {"group": {"value": "hotels_cities"}}}} ] } } } }}'; $params['index'] = 'my_custom_index_name'; $params['type'] = 'translator_translations'; $params['body'] = $body; $results = $client->search($params); the out put hits zero. -there called analyzer th

c++ - Sorting a list with a comparison function that doesn't follow 'strict weak ordering' -

i have list of 10 items. sort them in particular manner. for eg. items a1, b, c1, a2, a3, f, g, c2, h, a4 rules are c should come before a b should come after a all other item should preserve order. so after sorting list should in order c1 c2 a1 a2 a3 f g h a4 b i trying use c++ std::stable_sort() method achieve this. in program items instance of structure 'sitem' got member 'type' idicate category(a, b etc). comparison function looks this bool compareitems(sitem const& item1, sitem const& item2) { if (item1.type == && item2.type == c) return false; if (item1.type == b && item2.type == a) return false; return true; } from understanding of stable_sort , requires comparison function follow 'strict weak ordering'. method doesn't follow that, cannot use stable_sort. sorting algorithm available achieve type of orders? complete code #include <list> #include <algorithm> #i

ruby on rails - Send devise confirmation email manually later -

i have added devise :confirmable model , created before_create skip confirmation. before_create :skip_confirmation def skip_confirmation self.skip_confirmation! end i have mailer named store_mailer.rb along appropriate views app/views/stores/mailer/confirmation_instroctions.html.erb send out confirmation email. class storemailer < devise::mailer helper :application # gives access helpers defined within `application_helper`. include devise::controllers::urlhelpers # optional. eg. `confirmation_url` default template_path: 'store/mailer' # make sure mailer uses devise views end confirmation_instroctions.html.erb <h2>resend confirmation instructions</h2> <%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) |f| %> <%= devise_error_messages! %> <div class="field"> <%= f.label :email %><br /> <%= f.email_field :email, autofocus: true, val

android - Search bar in google map with auto suggestion and on selecting marker set on that position and get call back of that location in different activity -

i have 2 activity,one location update activity , mapviewactivity.in map view activity ,i using mapfragment.i want add search bar in map auto suggestion , want call of latitude , longitude in location update activity.i calling map view activity intent location update activity page.

sql server - Select Date query in SQL -

i have date column want write "s" when there sunday if have data this datecolumn 1-1-2017 2-1-2017 3-1-2017 4-1-2017 5-1-2017 6-1-2017 7-1-2017 8-1-2017 9-1-2017 10-1-2017 11-1-2017 12-1-2017 13-1-2017 in if on date there sunday day how write "sun" instead on date this select datecolumn table1 datecolumn 1-1-2017 2-1-2017 3-1-2017 sun 5-1-2017 6-1-2017 7-1-2017 8-1-2017 9-1-2017 10-1-2017 sun 12-1-2017 13-1-017 try this: select case when datepart(dw, datecolumn) = 1 'sun' else cast(datecolumn nvarchar(max)) end datecolumn table1 hope helps. ps - might have modify cast(datecolumn nvarchar(max)) convert if need dates in specific date format.

Linux shell: space in condition statement -

i learn how program in shell. can't understand why 2 statement produce different output. seems if there no spaces, test treats 10==11 string , returns true. $test 10==11 && echo yes || echo no $yes $test 10 == 11 && echo yes || echo no $no # single string, not null true, , result yes test 10==11 && echo yes || echo no # there exist space 10 == 11 not equal string comparison result no test 10 == 11 && echo yes || echo no read more here equivalents if test 10==11; echo yes; else echo no; fi yes if test 10 == 11; echo yes; else echo no; fi no # or same above if test 10 = 11; echo yes; else echo no; fi no from http://tldp.org/ldp/abs/html/comparison-ops.html string comparison = equal if [ "$a" = "$b" ] caution note whitespace framing =. if [ "$a"="$b" ] not equivalent above. == equal if [ "$a" == "$b" ]

python - Converting a windows path to a path using environment variables -

is there python library takes windows path , replaces expanded environment variables environment variables? for example: c:\users\username\documents\text.txt -> %userprofile%\documents\text.txt c:\windows\system32\cmd.exe -> %windir%\system32\cmd.exe c:\program files\program\program.exe -> %programfiles%\program\program.exe the best way explain functionality opposite of os.path.expandvars('some path environment variables') support different languages requirement. c:\archivos de programa\progra\program.exe -> %programfiles%\program\program.exe this non-trivial problem since more environment variables may match parts of string (ex: processor_level single digit, should avoid it). ensure best efficiency, would: sort existing environment variable l like this: import os my_string = os.path.normpath(r"d:\users\jotd\appdata\roaming\adobe\flash player") k,v in sorted(os.environ.items(),key=lambda x:len(x[1]),reverse=true): m

android - How to debug AppCompat TextView InflateException? -

this crash came in via our crash reporting system. cannot reproduce crash, , date have 1 report. the application large application, many activities , fragments, , stacktrace gives no indication of in application crash occurred (the entire stacktrace appears take place in android or appcompat classes - no mention of app's code). so have no way of knowing textview , out of 100s of textviews, in application @ issue (and no, cannot post layout xml files entire application). given information, can offer advice on how debug stacktrace? fatal exception: android.view.inflateexception: binary xml file line #43: binary xml file line #43: error inflating class textview caused android.view.inflateexception: binary xml file line #43: error inflating class textview caused java.lang.unsupportedoperationexception: failed resolve attribute @ index 4: typedvalue{t=0x2/d=0x1010099 a=1} @ android.content.res.typedarray.getcolor(typedarray.java:476) @ android.widget.textv

console - C - fgets skips CR character -

Image
i have c code, reads line txt file. file has 1 line below: the code snippet read line is: int** readfile(char* filename){ int col=0, row =0; int i=0; int* numlist[2048]; for(int = 0; i<2048; i++) numlist[i] = (int*) malloc(6*sizeof(int)); if(null == numlist){ printf("memory error!"); } char * token = null; char currentline[25] = {'\0'}; file* file = fopen(filename, "r"); if(null != file){ printf("file opened successfully\n"); if( null != fgets (currentline, 60, file) ) { int = 0; while (null != currentline[i]){ printf("%d ", currentline[i]); i++; } } } else { printf("file i/o error"); return null; } fclose(file); return numlist; } when code runs, following output: i observed suspicious, is, can see in f

shell - Starting of Tomcat Instance from Jenkins -

i installed multiple instances of tomcat in ubuntu machine. trying start tomcat (one of instances multiple tomcat instances) jenkins. jenkins showing tomcat started. tomcat still in shutdown state only. in jenkins, when build completes process id's involved in build getting killed. so mentioning build_id=dontkillme ./home/tomcat/startup.sh in execute shell script make possible.

ruby - Rails validation error messages: Add response code to default validators -

i looking best-practise / solution render responses different http-response codes 422 - unprocessable entity. i have simple validator: validates :name, presence: true, uniqueness: {message: 'duplicate names not allowed!'} i want return status code 409 - conflict (:conflict) when validation fails. possible solution: add status code errors hash, e.g. errors.add(status_code: '409') . either render status code errors, or render 422 if multiple exists. the problem above solution not know how call errors.add function on 'standard' validator. my render code: if model.save render json: model, status: :created else render json: model.errors, status: :unprocessable_entity end which extent can render different status codes based on validation results. in case, creating custom validator might 1 approach , expand complexity validates_with namevalidator custom validator class namevalidator < activemodel::validator def val

tabs layout menu not working in android -

tabs layout not working properly, tab contents not displayed.below related xml files. tabs sliding content of tabs not visible. below file app_bar_main.xml. <?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.coordinatorlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:fitssystemwindows="true" tools:context="com.example.shubham.tabexample.activity.mainactivity"> <android.support.design.widget.appbarlayout android:layout_width="match_parent" android:layout_height="wrap_content"> <!--android:theme="@style/apptheme.appbaroverlay"--> <android.support.v7.widget.toolbar android:id="@+id/toolbar&qu

android intent - How to link a activity in gridview which has images and text using fragments to open a new activity? -

i wanted open next activity games in contain games wallpapers, whenever click on games on phone shows unfortunately app stopped.. next activity not opening... , please tell me how open image games activity on next activity gallery.. public class categoryfragment extends fragment { gridview list; string[] web = { "games", "movies", "nature", "celebrities", "songs", "sports", "cute", "cartoons", "others" } ; integer[] imageid = { r.drawable.cat1, r.drawable.cat2, r.drawable.cat3, r.drawable.cat4, r.drawable.cat5, r.drawable.cat6, r.drawable.cat7, r.drawable.a1, r.drawable.cat9, }; @override public view oncreateview(layoutinflater inflater, viewgrou

sql - Get the group by on 2 column and date as latest -

Image
i have 2 table , m fetching record below the query select bmc.jcrs_mem_crs_code, bmc.jcrs_mem_description, bmc.jcrs_mem_date, bjcm.jcrs_mast_title bus_membercourse bmc inner join bus_journeymancoursemaster bjcm on bmc.jcrs_mem_crs_code = bjcm.jcrs_mast_code bmc.jcrs_mem_completed = 1 , bmc.jcrs_mem_mem_id = 5010 group bmc.jcrs_mem_crs_code, bmc.jcrs_mem_description, bmc.jcrs_mem_date, bjcm.jcrs_mast_title but want need make group on jcrs_mem_crs_code , jcrs_mem_description , if 2 column data common want took latest date multiple dates. i.e. want pick row , ignore other rows. you want max(date) : select bmc.jcrs_mem_crs_code, bmc.jcrs_mem_description, max(bmc.jcrs_mem_date) jcrs_mem_date, bjcm.jcrs_mast_title bus_membercourse bmc inner join bus_journeymancoursemaster bjcm on bmc.jcrs_mem_crs_code = bjcm.jcrs_mast_code bmc.jcrs_mem_completed = 1 , bmc.

c++ - Two pointers not deleted properly -

so i'm trying code out, compiling in cl (visual studio c++ compiler) , keeps printing 0. shouldn't y equal nullptr? #include <iostream> #include <string> using namespace std; int main() { int* x; x = new int(5); int* y; y = x; delete x; x = nullptr; cout <<(y==nullptr)<< endl; return 0; } no, setting x nullptr not set y nullptr too. y int* not reference int* . so, y == nullptr necessarily 1 false . 1 pub quiz: x cannot nullptr since if allocation failed std::bad_alloc have been thrown. would possible y nullptr had written x = new(std::nothrow) int(5);

angular - Show asynchronous datas of subscribe -

this question has answer here: how return response asynchronous call? 21 answers i use loop retrieve data stored in firebase subscribe function , foreach. when console.log of datas in subscribe ("=== subscribe ===") have result, when console.log outside ("=== home ===" , "=== return ==="), have result : screen of console.log i suppose comes fact asynchronous, how fix problem please ? this code : statut: firebaselistobservable<any[]>; statuts: array<any> = []; // données à enregistrer dans firebase dateoftheday: string; dayofweek: number; constructor(public afdb: angularfiredatabase, public storage: storage) { moment.locale('fr'); this.dateoftheday = moment().format('l'); // date au format : 04/07/2017 this.dayofweek = moment().day(); // numéro du jour de la semaine (ex : 1 pour

javascript - Create a prototype method that works alone but can also have sub-methods -

i don't know how else name title, sorry. here example, want able this: var str = 'bla bla bla'; str.do(a).thendo(b) //but want able this: str.do(a) // different // have tried doesn't work: string.prototype.do = function(a) { //here code 'str' variable, then: var self = {}; self.thendo = function(b) { var somecalculations; return somecalculations + + b; } self = function() { //this supposed do(a) function var morecalculations; return morecalculations + a; } return self; } note: thendo() needs use 'a' parameter do() not in i'm trying achieve: string.prototype.do = function(a) { var morecalculations; return morecalculations + a; } string.prototype.do.thendo = function(b) { var somecalculations; return somecalculations + + b; } //it doesnt work, thendo() cant 'a' parameter furthermore need library i'm developing jquery answers not help. thanks you've said: str.

While Loop in Azure SQL -

in azure stream analytics query want write while loop using declare/set counting. declare @x int set @x = 0 while @x < 90 begin set @x = @x + 1 *my code '@x' counter* end the error message claims: declare @x int unsupported statement. is there basic overlooked? if comment out declare command, asa sql doesn't set command. if leave out while loop , replace @x number in code, works fine.

ios - Is there any way to access an SFSafariViewController's contentOffset? -

i want have access contentoffset values of sfsafariviewcontroller. i tried subclassing sfsafariviewcontroller in order set scrollview's delegate, looks sfsafariviewcontroller doesn't expose it's scrollview. is there way set scrollview's delegate or access contentoffset values ?

python - Get intersection range of two non-discrete intervals -

given interval defined start , end point (both floats), determine intersection range second interval. example: int1 = [2. , 5.] int2 = [2.2, 7.] >>> desired_function(int1, int2) 2.8 it should handle intersection possibilities (no intersection, partial intersection, complete intersection, negative ranges etc.). attempt looks this: def intersection(int1, int2): #case 1: partial intersection on left or right border if (int2[0]<=int1[0] , int2[1]<=int1[1]) or (int2[0]>=int1[0] , int2[1]>=int1[1]): return min(int1[1],int2[1]) - max(int1[0],int2[0]) #case 2: complete overlap of 1 interval other elif (int2[0]>=int1[0] , int2[1]<=int1[1]) or (int2[0]<=int1[0] , int2[1]>=int1[1]): return min (int2[1]-int2[0] , int1[1]-int1[0]) #case 3: no overlap @ else: return 0 question: have missed , there build-in solution or package similar since want keep code simple , fast possible? you making thing

java - Cannot parse data from the phpmyadmin -

Image
i'm trying retrieve data phpmyadmin on android app ,but first want test through logcat see if works .when test ,i don't names of users in database sadly . this showusers class : package ie.example.artur.adminapp; import android.content.intent; import android.os.bundle; import android.os.strictmode; import android.view.menu; import android.view.menuitem; import android.widget.arrayadapter; import android.widget.listview; import android.widget.toolbar; import android.os.asynctask; import android.os.bundle; import android.support.design.widget.floatingactionbutton; import android.support.design.widget.snackbar; import android.support.v7.app.appcompatactivity; import android.view.view; import org.apache.http.httpentity; import org.apache.http.httpresponse; import org.apache.http.client.httpclient; import org.apache.http.client.methods.httppost; import org.apache.http.impl.client.defaulthttpclient; import java.io.bufferedreader; import java.io.inputstream; import java.io

c# - Using constructor injection when caller expects a specific constructor signature -

i'm new di in .net c# & autofac , having problems understand how use di when can't control caller side. there 2 scenarios have problems understand. scenario 1: caller expects default constructor (without parameters) how handle scenario when still want inject service interfaces when class constructed? thinking of constructor chaining, mean have know concrete type , works around idea of di. (at least think). public class serviceworker { iservice _service; public serviceworker(iservice service) { _service = service } } public class caller { // no way change this. var serviceworker = new serviceworker(); } scneario 2: caller expects specific constructor signature (e.g. same question here. how can inject additional dependencies when caller expects exact match constructor signature? i think main issue in understanding concept is, don't see how di partially when not constructed di (caller) public class serviceworker {

java - How to solve Class not found in gnu.gcj.runtime.SystemClassLoader in Unix -

i trying run java class .jar file in unix environment, getting following error, exception in thread "main" java.lang.noclassdeffounderror: systembootstrap @ gnu.java.lang.mainthread.run(libgcj.so.7rh) caused by: java.lang.classnotfoundexception: systembootstrap not found in gnu.gcj.runtime.systemclassloader{urls=[], parent=gnu.gcj.runtime.extensionclassloader{urls=[], parent=null}} @ java.net.urlclassloader.findclass(libgcj.so.7rh) @ java.lang.classloader.loadclass(libgcj.so.7rh) @ java.lang.classloader.loadclass(libgcj.so.7rh) @ gnu.java.lang.mainthread.run(libgcj.so.7rh) the command using run class java -cp batchframework.jar systembootstrap dnqltrbatch dev1 systembootstrap class called , not able solve this.and new unix.

Connec to Hive from Apache Spark -

i have simple program i'm running on standalone cloudera vm. have created managed table in hive , want read in apache spark, initial connection hive not being established. please advise. i'm running program in intellij, have copied hive-site.xml /etc/hive/conf /etc/spark/conf, spark-job not connecting hive metastore public static void main(string[] args) throws analysisexception { string master = "local[*]"; sparksession sparksession = sparksession .builder().appname(connecttohive.class.getname()) .config("spark.sql.warehouse.dir", "hdfs://quickstart.cloudera:8020/user/hive/warehouse") .enablehivesupport() .master(master).getorcreate(); sparkcontext context = sparksession.sparkcontext(); context.setloglevel("error"); sqlcontext sqlctx = sparksession.sqlcontext(); hivecontext hivecontext = new hivecontext(s

javascript - Kendo Ui nested JSON Parse -

i having issues in pushing sharepoint nested json objects "results" data can used in kendo grid. any appreciated. parse: function (data) { console.log(data.d.results.length); var results = []; (var = 0; < data.d.results.length; i++) { var items = data.d.results[i]; (var x = 0; x < item.attachmentfiles.results.length; x++) { var attachment = { attachments: item.attachmentfiles.results[x].filename }; results.push(attachment); } return data.d.results && results; } } so work around able place attachmentfiles in function column template. title: "attachmentfiles", template: function (d) { var attachments = []; (var x = 0; x < d.attachmentfiles.results.length; x++) { console.log(d.attachmentfiles.results[x].filename); attachments.push(d.attachm

python - output dictionary data as a table in console -

i output dict data in form of table in console: dtc={ "test_case1_short":{"test_step11":"pass","test_step12":"pass","test_step_13":{"status":"failed","details":"ca marche po"}, "test_case2_longest_name":{"test_step21":"ne","test_step22":"ne"}, "test_case3_medium_name":{"test_step31":"ne","test_step32":"ne"} } note: french speakers 'dtc' shortcut dict_test_collection (!) to build table determine size of key names in order dimension column headers. can key names max length doing this: max = 0 in list(dtc.keys()): if max < len(i): max = len(i) print(max) but find not straighforward ... there way information dict.keys() or dict feature ? besides, i'd set separators "+-----------------------------+" section headers , "|

javascript - How to constrain proportions to something unique on HTML5 video -

Image
i have page going display video (on desktop browsers only). have code check if video landscape or portrait. then, want (here issue) if video portrait orientation, display such (with video playing balloons are. if video orientation landscape , want fill black minus margin) video here html <div id="vidmodal" class="video-wrapper" ng-show="vm.showvideo"> <img src="public/img/cancel-music.svg" alt="" id="closex"> <video src="{{vm.event.videourl}}" id="vid" loop autoplay muted poster="{{vm.event.imageurl}}"></video> </div> the js: function clickplay() { vm.hasvideo = false; //hide text-and-play-button div vm.showvideo = true; //show video default hidden (false) //make form translucent // document.getelementsbyclassname('.rsvpbox').background = "rgba(255,255,255,0.6)"; // chec

botframework - Specifying LUIS dialog spellCheck, slot programmatically -

so far able avoid hardcoding luis appid , key doing following: var luisservice = new luisservice(new luismodelattribute(configurationmanager.appsettings["luisappid"], configurationmanager.appsettings["luisappkey"])); context.call(new luisdialog(luisservice), resumeafterdialog); and having luis dialog declared as: [serializable] public class luisdialog : luisdialog<object> { public luisdialog(iluisservice ls) : base(ls) { } .... } } but able set spellcheck=true, log, verbose , other parameters available in luismodel attribute programmatically, there way of doing that? thanks i figured out, need set luismodelattribute properties in code before creating luisservice: var luissettings = new luismodelattribute(configurationmanager.appsettings["luisappid"], configurationmanager.appsettings["luisappkey"]); luissettings.log = true; luissettings.spellcheck = true; luissettings.log = true; var luisservice = n

Correctly splitting a string into an array : Python regex split() vs findall() -

i seem seeing differences in assumed same thing. attempting separate string array of regex matches. when try split believed should have, incorrectly array of empty strings following >>> re.split(a, tosplit) ['', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ''] however, when run findall correctly of matches such >>> matches in re.findall(a, tosplit): ... print(matches) 0b945c19de6c4857f51ec80057f5d0b79e25d56f48605b6ebf0665d455f2cb48 334892954139-cloudwatchlogsapigateway-global-us-east-1 [08/jul/2016:11:54:09 +0000] 54.237.227.51 ... etc. what functional difference between findall , split, , should doing use regex split string array.

How to go to the highest parent using jquery.mmenu -

i have created menu using jquery.mmenu. have submenu's within menu's , functionality works expected. jquery.mmenu can go closest parent. want add new link allow user go upper parent in 1 go. so lets have menu this: food --> drinks --> soft drinks --> coca cola if user @ coca cola level, want link brings user food. how solve this? i got answer jquery.mmenu developer directly (frdh) var $menu = $("#my-menu").mmenu(); var api = $menu.data( "mmenu" ); $("#some-elem").on("click", function() { api.closeallpanels(); }); he admitted somehow not in api docs yet. add later on.

excel - If Function using ISTEXT -

i making little formula test if cell has text, instead of outputting true , false, output "p" or "a". for reason, when use formula: =if(istext(search("sessiona", d2)), "p", "a") it outputs "a" every row , not sure incorrect formula. any great, thank you! =if(count(search("sessiona", d4)), "p", "a") i realized needed change count. sorry!

excel vba - Migrating Powerpoint information to Access database using VBA -

i interning large firm stores lot of source data in form of powerpoints. these powerppoints serve when communicating across departments , between suppliers but, may guess, lack robust analysis. because of this, have decided database these powerpoints access. there no direct way of doing this, know of. due strict policies, limited vba coding platform. have spent last week coding macro solve problem. again, since there no direct conversion of powerpoint access, have had solve problem rather inefficiently there few caveats. list steps , caveats below. the powerpoint information want database formatted table instead of text. have been unable find macro converts ppt tables directly excel or csv files. because of this, convert ppt files (roughly 3000) pdfs. from these generated pdf's can use adobe convert them excel or csv files. using multiple online resources , bit of own experience, have coded vba script automatically format folder of csv files format access store correctly

javafx - Hide Cells in a tableview using CSS when columns are integers -

i have tableview 1 of columns is: private tablecolumn<userdata, integer> countlistcolumn; i have been able empty cells vanish using css in columns except one, shows 0 in each cell. i've tried following: .table-row-cell:empty { -fx-background-color: transparent; } .table-row-cell:empty { -fx-border-width: 0px; } .table-row-cell:null { -fx-background-color: transparent; } .table-row-cell:null { -fx-border-width: 0px; } .list-cell:empty { -fx-background-color: white; } .list-cell:empty { visibility:hidden; } none of these seem work, nor binding. there way hide these cells or make them respond css? below i've tried. public class guicontroller implements subscriptionobserverif { @fxml private observablelist<list> list = fxcollections.observablearraylist(); @fxml private tableview<data> table; @fxml private tablecolumn<data, integer> column; @fxml private tablecolumn<data, string&g

Get Objective-C interface in Swift? -

Image
is there way view objective-c interface available in swift? for example, if declare objective-c interface: #import <uikit/uikit.h> #define string_constant @"a_string_constant" #define bool_constant yes @interface viewcontroller : uiviewcontroller @end i can access string_constant in swift not bool_constant. "navigate -> jump generated interface"

PostgreSQL Query to get the output from same table with same table values -

i have 1 table id employee leave_days leave_type type 1 abc 10 sick remove 2 abc 20 sick add 3 abc 15 annual remove 4 abc 50 annual add 5 xyz 10 sick remove 6 xyz 20 sick add 7 xyz 15 annual remove 8 xyz 50 annual add from above table group column name called leave_type , merge rows , output should follows. i have group column name leave_type , add new column called leave_allocated . in leave_allocated column, column type value add come. id employee leave_days leave_type leave_allocated 1 abc 10 sick 20 2 abc 15 annual 50 3 xyz 10 sick 20 4 xyz 15 annual 50 i tried sub query not match inner query outer query . this should help select id, employe

mysql - Left Join with Null Script Efficiency Explanation Needed -

why use left join in sql in from clause , attach where clause entity "is null"? told efficient script , should learn methodology behind it. for example: from left join arow , brow b , crow c , drow d brow.b null; this kind of construct used when want know "a list of customers have never ordered anything" : select customer.* customers left join orders on orders.customerid = customers.id orders.id null or quote old manager of mine: "can database give me list of isn't in database?" me> "sure, can give me list of things database should tell doesn't have?" him> "how supposed know that?"

log4j2 - duplicating logs in Console & RollingFile -

hey wondering if possible have same output in console in file output. here xml config. <?xml version="1.0" encoding="utf-8"?> <configuration status="warn" name="log4j2 logs"> <properties> <property name="basepath">./logs</property> </properties> <appenders> <rollingfile name="file" filename="${basepath}/activatemaintenancepage.logs" filepattern="${basepath}/activatemaintenancepage-%d{yyyy-mm-dd}"> <patternlayout header="logging start%n%n" footer="%n%nlogging end" pattern="%3sn %30d{default} [%m] %-7level %c{30} - %m%n" /> <policies> <onstartuptriggeringpolicy minsize="0"/> <timebasedtriggeringpolicy /> <sizebasedtriggeringpolicy size="500 mb"/>