Posts

Showing posts from July, 2010

What does the slash notation in Elixir mean? -

in elixir docs, keep using odd notation slash, example: is_boolean/1 io.puts/1 string.length/1 is_function/2 ++/2 i'm guessing, think refers arity. if that's case, why devil isn't mentioned anywhere in docs? it's not if kind of standard convention in (at least, not 1 i've ever seen in 20+ years in it). from page 2, basic types of getting started documentation: note: functions in elixir identified name , number of arguments (i.e. arity). therefore, is_boolean/1 identifies function named is_boolean takes 1 argument. is_boolean/2 identifies different (nonexistent) function same name different arity. it described in erlang/elixir syntax: crash course : here create module named hello_module . in define 3 functions, first 2 made available other modules call via export directive @ top. contains list of functions, each of written in format <function name>/<arity> . arity stands number of arguments. i might speculate tends r...

java - Cast exception from one class to another -

session session2 = hibernateutil.getsessionfactory().opensession(); transaction tx2 = session2.begintransaction(); query q=session2.createquery("from studbean1 group sno"); list<student_change> l1=(list<student_change>)q.list(); //student_change sc=new student_change(); for(student_change sc3:l1){ session2.save(sc3); tx2.commit(); session2.close(); here data coming studbean1 can access data student_change but gives excption can't cast studbean1 student_change given have modelled student_change generalisation of studbean1 , list<studbean1> not subtype of list<student_change> . try getting list<studbean1> , iterating on , perform cast in loop. why-is-liststring-not-a-subtype-of-listobject anyway, there more problems in code should revise (see comments question).

Google Sheets shows very hidden sheets and protected cells when opening an excel file -

i've realised when google drive converts excel file opened google sheets, breaks veryhidden property , can see veryhidden sheets. same thing happens protected cells, showing hidden formulas , logics. does know if there way avoid ? effective strategy ?

What does the syntax of this excel function X^{A,B,C} do -

i tried =4^{2,3,4} , returns 16 so guess it's raising 4 power of first number in array.. when use other numbers (3,4)? the formula returns array. if want see results in cells, select 3 cells in row, enter formula in first one, , press ctrl + shift + enter .

python - Select an input element using Selenium -

inspect im trying click on button move login page. code : from selenium import webdriver driver = webdriver.chrome() driver.get('http://moodle.tau.ac.il/') thats work fine can find form using loginform = driver.find_element_by_xpath("//form[@id='login']/") i don't know how button, it's basic stuff didn't find example. this click on login button on moodle.tau.ac.il page. line driver.find_element_by_xpath(".//*[@id='login']/div/input").click() finds login button on page , clicks it. xpath selector type can use selenium find web elements on page. can use id, classname, , cssselectors. from selenium import webdriver driver = new webdriver.chrome() driver.get('moodle.tau.ac.il') # take login page. driver.find_element_by_xpath(".//*[@id='login']/div/input").click() # fills out login page elem = driver.find_element_by_xpath("html/body/form/table/tbody/tr[2]/td/table/tbody/tr[1...

Rails: Upload to Instagram programatically? -

i want upload photos own instagram account programatically rails app. i've been able find posts ~2013 state against instagram tos. there update or photo uploads still disabled using instagram api? instagram api still doesn't allow upload third-party apps. conscious decision , don't think change time soon.

grouping of similar array items under a parent based on a condition javascript -

var texttag = [{text:"3", items:[{name:item1.jpeg}, {name:item2.jpeg}, {name:item3.jpeg}]}, {text:"2", items:[{name:item1.gif}, {name:item2.gif}, {name:item3.png}]}, ] i trying result array this: text:3 |_ jpeg |_item1 |_item2 |_item3 text:2 |_ gif |_item1 |_item2 |_ png |_item3 but have written code gives me following output. text:3 |_ jpeg |_item1 |_ jpeg |_item2 |_ jpeg |_item3 text:2 |_ gif |_item1 |_ gif |_item2 |_ png |_item3 please me desired result you need grouping it. var texttag = [{ text: "3", items: [{ name: 'item1.jpeg' }, { name: 'item2.jpeg' }, { name: 'item3.jpeg' }] }, { text: "2", items: [{ name: 'item1.gif' }, { name: 'item2.gif' }, { name: 'item3.png' }] }], grouped = texttag.map(function (a) { var o =...

How to condense this jquery code? -

looking shorten code block: edit: portion of "list" (3 shown here) actual code has 6. <script> $('.clickme-newyork, #link4, #link8, #link9').hover(function() { $(".card-cp").addclass("card-bg-cp"); $(".card-gv").addclass("card-bg-gv"); $(".card-hcm").addclass("card-bg-hcm"); }); </script> this did not work correctly: <script> $('.clickme-newyork, #link4, #link8, #link9').hover(function() { $(".card-cp, .card-gv, .card-hcm").addclass("card-bg-cp, card-bg-gv, card-bg-hcm"); }); </script> extrapolating comments, need decide whether "condensing" code necessary. @mojtaba said, can write function work programatically. instance: function myaddclass(target, classname) { $(target).addclass(classname); } then do... <script> $('.clickme-newyork, #link4, #link8, #link9').hover(function() { ...

Assigning private members values through public functions in C++ -

i have bit of confusion on assigning private members value in c++. far think both of following ways of setting length , breadth should work. difference , 1 way correct? class box { public: void setlength(double len) { length = len; } void setbreadth(double bread) { this->breadth = bread; } private: double length; // length of box double breadth; // breadth of box }; both correct. within body of class member functions, class members in scope. this-> implicit. while this->breadth explicitly accesses breadth member, length in setlength() implicitly accesses this->length . explicit access allow use same name argument , member: void setbreadth(double breadth) { this->breadth = breadth; } in case, unqualified access refers argument , qualified access refers member.

Adding objects to a fixed Array in Java -

up till i've been using arraylists. i've used arrays once used differently how i'm suppose now. have class called member , looks this: public class member { private string firstname; private string lastname; private int monthjoined; private int yearjoined; } of course class has accessor/ mutator methods , constructors below. now have make class called club can hold fixed number of members stored in member[] array. (the fixed number can number) @ point i'm wondering variable like. class need method titled public void join(member member) adds member club, new members added first null index in array. i know how work arraylist not array. given class club variable , method like? i discourage using array when arraylist job better. in general, in java, collections (e.g. arraylist ) preferred array, unless specific circumstances dictate otherwise. the main disadvantage of arrays size must fixed @ time of initialization , remains long ...

html - Adding Image to Nav Bar Links -

i wanting add png image nav bar. cannot find correct location add in background-image: , have correct. image not center on text , need to. thanks @charset "utf-8"; /* css document */ body { text-align: center } #navbar { position: relative; top: 15px; padding: 0; display: inline-block; background-repeat: repeat-x; border-radius: 15px; } #navbar li { list-style: none; float: left; position: relative; height: 50px; line-height: 50px; background-image: url(images/nav.png); } #navbar li { display: block; padding: 3px 30px; text-transform: uppercase; text-decoration: none; color: #999; font-weight: bold; } #navbar li a:hover { color: #000; } #navbar li ul { display: none; position: absolute; left: 0; width: 100%; margin: 0; padding: 0; text-align: center; margin-left: -100px; } #navbar li ul table { margin-top: -6px; width: 350px; background-image: url(images/na...

javascript - Query string in Angular 2 -

how can use query string route in angular 2, query string not required. query string optional. i read angular doc, in link: https://angular.io/docs/ts/latest/guide/router.html , don't understand. from docs linked: the url query string ideal vehicle conveying arbitrarily complex information during navigation. query string isn't involved in pattern matching , affords enormous flexiblity of expression. serializable can appear in query string. when define routes, don't need specify query string parameters expected (or unexpected). you need use routeparams service query values. import {router, routeparams} 'angular2/router'; // declare class, ... constructor( routeparams: routeparams) { console.log(routeparams.get('myquerystring')); // must exist } if value optional (like want), can call params object, , check yourself: console.log('myquerystring' in routeparams.params()); // true or false

python - Django Q filter not working as expected -

Image
i created library style search form (where can add new lines further search, linking words and, or, , not, or not) allow them build search statements in form, tried turn q filter. reason, filter generate seems return if there or in it. (by 'or in it' mean the user selected or statement). example: wanted create q filter objects name datafield , test value or material datafield , steel value. when print out q created, get: (and: (or: (and: ), (and: ('value__icontains', 'test'), ('represents__exact', <datafield: 3-name>)), (not (and: ('value__iexact', 'steel'), ('represents__exact', <datafield: 6-materials>))))) reading statement, seems should work, doesn't , seems return everything. this isn't have, example of form looks like: update: changed code resulting q statement instead: (or: (and: ('value__icontains', 'er'), ('represents__exact', <datafield: 3-name>)), (not ...

javascript - Only selected checkbox should perform further ajax query -

i have 7 checkbox, of want values of selected checkbox make further ajax query insert data in database. enter image description here javascript must initialize value of selected checkbox , pass them forward php file insertion going made. new ajax, unable understand making mistake. here code have. `<script type="text/javascript"> $(document).ready(function(e) { $("#askquestion").click(function(){ var alll = $('#alll').val(); var bff = $('#bff').val(); var relative = $('#relative').val(); var coligues = $('#coligues').val(); var acquintance = $('#acquintance').val(); var friends = $('#friends').val(); var follower = $('#follower').val(); var qid = $('#qid').val(); $.ajax({ type: "post", url: "ajaxaskquestion.php", data : { alll:alll, bff:bff, relative:relative, coligues:coligues, ...

cmake - Compiling Blender BPY : recompile with -fPIC? -

i tried compile blender bpy in ubuntu 14.04.4 using : mkdir ~/blender-git cd ~/blender-git git clone http://git.blender.org/blender.git cd blender git submodule update --init --recursive git submodule foreach git checkout master git submodule foreach git pull --rebase origin master sudo apt-get update; sudo apt-get install git build-essential cd ~/blender-git ./blender/build_files/build_environment/install_deps.sh sudo apt-get install cmake cmake-curses-gui mkdir ~/blender-git/build cd ~/blender-git/build cmake ../blender \ -dwith_python_install=off \ -dwith_player=off \ -dwith_python_module=on cd ~/blender-git/build make it compiles ends error : [100%] building c object source/creator/cmakefiles/blender.dir/buildinfo.c.o linking cxx shared module ../../bin/bpy.so /usr/bin/ld.gold: error: /opt/lib/python-3.5/lib/libpython3.5m.a(abstract.o): requires dynamic r_x86_64_pc32 reloc against 'pytype_issubtype' may overflow @ runtime; recompile -fpic i hav...

c++ - Trying to compute my own Histogram without opencv calcHist() -

what i'm trying writing function calculates histogram of greyscale image forwarded number of bins (anzbin) histograms range divided in. i'm running through image pixels compairing value different bins , in case value fits, increasing value of bin 1 vector<int> calcuhisto(const iplimage *src_pic, int anzbin) { cvsize size = cvgetsize(src_pic); int binsize = (size.width / 256)*anzbin; vector<int> histogram(anzbin,0); (int y = 0; y<size.height; y++) { const uchar *src_pic_point = (uchar *)(src_pic->imagedata + y*src_pic->widthstep); (int x = 0; x<size.width; x++) { (int z = 0; z < anzbin; z++) { if (src_pic_point[x] <= z*binsize) { histogram[src_pic_point[x]]++; } } } } return histogram; } but unfortunately it's not working... wrong here? please help there few issues can see your binsize ca...

javascript - How would I display all elements in an array in HTML as clickable objects? -

so have produced small script in javascript shown: var txtfile = new xmlhttprequest(); txtfile.open("get", "http://www.drakedesign.co.uk/mdmarketing/uploads/date.txt", true); txtfile.onreadystatechange = function() { if (txtfile.readystate === 4) { // makes sure document ready parse. if( (txtfile.status == 200) || (txtfile.status == 0) ) { // makes sure it's found file. alltext = txtfile.responsetext; arrayoflines = alltext.match(/[^\r\n]+/g); document.getelementbyid("date").innerhtml = arrayoflines[0]; filename1 = (arrayoflines[0] + ".csv"); res1 = filename1.replace("/","-"); res2 = res1.replace("/","-"); urlcsv = ("http://www.drakedesign.co.uk/mdmarketing/uploads/" + res2); } } }; txtfile.send(null); the above code simple parses text document updated weekly: http://www.drak...

file io - What's wrong with this code in java that uses FileReader? -

i have been trying learn filereader , hence wanted test out. created class constructor takes in string(name of file) , creates file , reads , prints first character out, code not working , showing errors. java code. package test_3; import java.io.file; import java.io.filenotfoundexception; import java.io.filereader; import java.io.ioexception; public class files { public files(string s) throws filenotfoundexception, ioexception{ file f = new file(s); filereader fr = new filereader(f); system.out.println(fr.read()); } public static void main(string args[]) throws filenotfoundexception, ioexception{ files myfile = new files("input.txt"); } } this error information exception in thread "main" java.io.filenotfoundexception: input.txt (the system cannot find file specified) @ java.io.fileinputstream.open0(native method) @ java.io.fileinputstream.open(unknown source) @ java.io.fileinputstream.<i...

angular - Routing doesn't work for me when doing a hard refresh -

i looking @ source code: https://github.com/angular/angular.io/blob/master/public/docs/_examples/toh-5/dart/lib/app_component.dart and seems application route right when go root. localhost:8080/ the routing updates move around application, seems if @ something: localhost:8080/dashboard in basecase, , hard refresh, fails. give me 404 not found! error. it work find if do: localhost:8080/#!/dashboard not address passed application. in index.html have: <base href="/"> my app_component.dart file follows: import 'package:angular2/angular2.dart'; import 'package:angular2/router.dart'; import 'hero_component.dart'; import 'heroes_component.dart'; import 'dashboard_component.dart'; import 'hero_service.dart'; @component( selector: "my-app", directives: const [router_directives], providers: const [heroservice, router_providers], templateurl: "app_component.html") @routeconf...

c# - How to register an AutoMapper profile with Unity -

i have following automapper profile: public class automapperbootstrap : profile { protected override void configure() { createmap<data.entityframework.rssfeed, irssfeed>().formember(x => x.newsarticles, opt => opt.mapfrom(y => y.rssfeedcontent)); createmap<irssfeedcontent, data.entityframework.rssfeedcontent>().formember(x => x.id, opt => opt.ignore()); } } and initializing this: var config = new mapperconfiguration(cfg => { cfg.addprofile(new automapperbootstrap()); }); container.registerinstance<imapper>("mapper", config.createmapper()); when try inject in constructor: private imapper _mapper; public rsslocalrepository(imapper mapper) { _mapper = mapper; } i recieve following error: the current type, automapper.imapper, interface , cannot constructed. missing type mapping? how can initialize automapper profile unity, can use mapper anywhere through di? in example c...

javascript - Add attribute to my angularjs custom directive and lets its value listen to same directive model -

i have created custom directive, want directive attribute injected , elements within directive change directive's attribute values. here's code: ultimately want directive this: <joe-grid viewedtable="table1"></joe-grid> table1, table2 etc.. change based on selected option dropdown. var app = angular.module('app', []); app.directive('joegrid', function() { return { restrict: 'e', template: '<select name="mytables" id="mytables" ng-model="mytable"><option value="table1">table1</option><option value="table2">table2</option><option value="table3">table3</option><option value="table4">table4</option></select><h1>hi there, me: {{adjective}} </h1>', scope: { adjective: '@viewedtable', }, link: function(scope, element, attrs) { ...

c# - How can i find the n largest integers in an array and returns them in a new array -

how can find n largest integers in array , returns them in new array. using linq simple: var newarray = array.orderbydescending(x => x).take(n).toarray();

localization - Understanding Resource files in MVC6 RC1 -

i've been trying wrap head around on how best implement resource files multiple languages in mvc6 due changes every release has me bit confused on how implement them properly. required , constraints? a few articles i've looked at: https://damienbod.com/2015/10/21/asp-net-5-mvc-6-localization/ mvc 6 : how use resx files? http://pratikvasani.github.io/archive/2015/12/25/mvc-6-localization-how-to/ i'm trying set resource files have english , german available users, either based on browser settings or personal setting within account. what best way of achieving this? thanks in advance! edit: so per article, i've added following code startup.cs: services.addlocalization(options => options.resourcespath = "resources"); services.addmvc() .addviewlocalization(microsoft.aspnet.mvc.razor.languageviewlocationexpanderformat.suffix) .adddataannotationslocalization(); var sup...

python - Formatting JSON output -

i have json file key value pair data. json file looks this. { "professors": [ { "first_name": "richard", "last_name": "saykally", "helpfullness": "3.3", "url": "http://www.ratemyprofessors.com/showratings.jsp?tid=111119", "reviews": [ { "attendance": "n/a", "class": "chem 1a", "textbook_use": "it's must have", "review_text": "tests incredibly difficult (averages in 40s) , lectures useless. attended both lectures every day , still unable grasp concepts on midterms. scope out gsi , ride curve." }, { "attendance": "n/a", "class"...

c - Some misconception with linked list implementation -

it seems have major misconception how can implement linked list in c. far can understand (and code simplified can be!), should work, instead returns segmentation fault. worth noting if comment out below marker , seems working, there underlying issue makes faulty. #include <stdio.h> #include <stdlib.h> typedef struct node { int val; struct node *next; } node; int main (void) { node *pode; node *nx, *vx, *sx; pode = (node *) malloc(1 * sizeof(node)); pode->val = 12; pode = (node *) realloc(pode, 2 * sizeof(node)); pode->next = (pode + 1); (pode + 1)->val = 66; pode = (node *) realloc(pode, 3 * sizeof(node)); pode->next = (pode + 2); (pode + 2)->val = 33; pode = (node *) realloc(pode, 4 * sizeof(node)); pode->next = (pode + 3); (pode + 3)->val = 44; printf("%d\n", pode->val); nx = pode->next; printf("%d\n", nx->val); // marker vx =...

eclipse - java.lang.NoClassDefFoundError: javax/mail/Authenticator - causing fxml page not to load -

Image
i restructuring question - edited question. when log in program , double click on item in tableview not getting @ on new tab supposed pop up. main.fxml shows fine, meaning maincontroller seems working well, image: when double click on row should like: but happening: to show how code called, works great in .java form, when compiled breaks: tab tab = new tab(); tabs.gettabs().add(tab); tab.settext(tableview.getselectionmodel().getselecteditem().getdescription()); // loads instantiated version of item.fxml resource fxmlloader loader = new fxmlloader(getclass().getclassloader().getresource("fxml/item.fxml")); tab.setcontent((node) loader.load()); date = datelbl.gettext(); time = timelbl.gettext(); user = userlbl.gettext(); singleselectionmodel<tab> selectionmodel = tabs.getselectionmodel(); selectionmodel.select(tab); // creates itemcontroller object , passes through results of database query , stores them va...

ios - How to get UIVisualEffectView to blur without going OVER full screen / current context? -

i have spritekit game want blur part of screen (the board game played). @ same time, want able interact other elements (like uibuttons) on screen. i'm looking form sheet, 1 blurs under , allows interaction main view controller. so here's problem. i've tried to: put uivisualeffectview on main view controller, present view controller modally 1 of standard presentation styles , have uivisualeffectview in there, or present view controller modally on full screen / current context , have uivisualeffectview in there. none of these options work me. options 1 , 2 don't blur. produce solid black box instead. (although reason blurs when notification or when pull down notification center or pull control center. i'm facing same problem this user .) option 3 blur, not allow interaction main view controller. does know else try? or not using correctly? unfortunately uivisualeffectview doesn't work spritekit, when using skview . i've tried ...

javascript - User can type invalid date into AngularUI Datepicker -

i having problem in angularui bootstrap datepicker have min date , max date. if open popup, can't click on disabled dates. able type in date outside of range. want bring min date if typed date below , max date if typed date later. here plunker: http://plnkr.co/edit/6u4ydtiyfxjoqrjm2qtq?p=preview in controller: $scope.dateoptions = { maxdate: $scope.maxdate, mindate: $scope.mindate, }; in template: datepicker-options="dateoptions" i'd avoid using jquery or date library unless necessary, since field need functionality. if helps, have found reports of issue, marked "fixed" maybe missing something. https://github.com/angular-ui/bootstrap/pull/2901 https://github.com/angular-ui/bootstrap/pull/3020 the similar stackflow question angularui datepicker allows typing value outside of range has working plunker isn't angularui datepicker, , accepted answer suggests plug-in, want avoid. did try using ui-date="dateoptions" i...

compiler errors - In Java, how can I use a variable initialized inside a try/catch block elsewhere in the program? -

i have basic quadratic formula program, i've modified beginning end program if value other double entered. however, because i've done this, can't seem able use value inputted anywhere else in program. here first few lines: import java.util.scanner; public class quadraticformula { public static void main(string[] args) { double a, b, c; scanner reads = new scanner(system.in); system.out.println("general equation: \"ax^2 + bx + c\""); system.out.print("enter value of \"a\": "); try { string doublestring = reads.nextline(); = double.parsedouble(doublestring); } catch (exception e) { system.out.println("invalid data type. please enter number"); } the rest of program asks values of b , c, , carries out quadratic equation, retuning roots of whatever equation entered. however, because value of defined inside try section, compiler tells me hasn't been initializ...

java - reading a hashtable from a text file -

i have 2 files - write.java , read.java . write.java file writes hashtable text file , function of read.java read hashtable text file. write.java: hashtable hash1 = new hashtable(); hash1.put("1", "hi!"); filewriter filewriter = new filewriter("abc.txt"); bufferedwriter bufferedwriter = new bufferedwriter(filewriter); bufferedwriter.write(hash1.tostring()); bufferedwriter.close(); it writes peroperly text file. read.java has read hashtable abc.txt , add 1 more key value paid. best way achieve this? read.java: string dnstemp = "abc.txt"; filereader filereader = new filereader(dnstemp); bufferedreader bufferedreader = new bufferedreader(filereader); string line = bufferedreader.readline(); bufferedreader.close(); but line variable string...how convert hashtable perform further operations? use properties instead hashtable. has capability of loading , storing

database - How to control parallel execution in Oracle DB -

i'm trying execute script developed data transformation in oracle. i have table large amount of data , want split data table based on condition , delete affected rows original table. my approach use create table select second table, same first table condition inverted. truncated original table , moved data original temporary table. so: create table data_reject select a, b, c table_original in (select criteria aux_table) / then create table data_aux select a, b, c table_original not in (select criteria aux_table) / finally do truncate table data_original / and insert table_original (a, b, c) select a, b, c table_aux / my problem placed parallel hint on select , create table commands, , appears 1 statement issued, , next 1 starts executing without waiting first statement end execution. this leads original table losing data before script has time populate other 2 tables. this script executed command alter session enable parallel dml how can prevent 1 co...

uiviewcontroller - Creating Splash Screen in Cocoa -

i trying create first simple application. i want have 2 views: first 1 should stay couple of seconds , should replaced second one. when start new project in xcode, creates launchscreen.storyboard you. splash screen shown before app loaded.

ruby on rails - How to add a user's email to a list when a button is clicked -

i new rails, sorry if pretty obvious. want users click button (i'm using devise), , when pressed, email added onto list. also, want counter shows how many people have signed up. how do this? i don't know list looks but to contain user's email, add email column on user model or something. http://guides.rubyonrails.org/active_record_migrations.html class addemailtousers < activerecord::migration def change add_column :users, :email, :string end end to show how many people have signed up, use class method. user.count(:email) it unclear question honestly, if understanding correct.

ios - How to load an image from a URL into a table section (with one row)? -

i have table consists of 6 sections, out of second section 1 row should loading image url. i'm getting url plist file. in cellforrowatindexpath function, i'm using following code : if let url = nsurl(string: park.getimagelink()) { if let data = nsdata(contentsofurl: url) { imageurl?.image = uiimage(data: data) } //park.getimagelink() gets url of image string plist file; var imageurl:uiimageview? declared property further, i'm using switch case load image correct section : switch(indexpath.section){ case park_image: cell?.imageview?.image = imageurl?.image } // park_image's value 1 when run code, can see contentsofurl: url has correct url, yet, imageurl?.image getting nil. is approach load image url table section correct? if not, missing, or correct way load image table section? i'm new swift programming apologise if i'm making newbie mistake. appreciated.

node.js - Mongoose fineOne does not work but find does -

findone gets undefined in result: upload.findone({_id: req.params.id}, function (err, upload) { if (err || !upload) return; console.log(upload.name); /* empty string */ }); however using find instead result: upload.find({_id: req.params.id}, function (err, upload) { upload = upload[0]; if (err || !upload) return; console.log(upload.name); /* prints out expected */ }); i confirmed in both cases mongo query run , through mongodb shell both returned expected result: mongoose: uploads.findone({ _id: objectid("57196fced4595c2a09146891") }) { fields: undefined } mongoose: uploads.find({ _id: objectid("57196f0a8d2055520894d5a4") }) { fields: undefined } mongoose model: const uploadschema = new schema ({ name: {type: string, default: '', trim: true}, mimetype: {type: string, default: '', trim: true} }); uploadschema.path('name').required(true, 'name cannot blank.'); uploadschema.path('mimetype').requir...

apache - Tomcat inside eclipse-server started successfully but -

if start apache tomcat server clicking startup.bat apache bin folder starts , can access http://localhost:8080/ ie. message apache tomcat successful. but...... in eclipse luna, have setup tomcat server(8). , started server. when go internet explorer , type in http://localhost:8080/ i'm getting error. http status 404 requested resource not available. open servers view in eclipse, double-click open configuration of tomcat. if don't have web modules deployed in path / . tomcat return 404 error. when start tomcat startup.bat, load web modules under $tomcat_home/webapps . root module serve request of path / , tomcat display page without error.

How to check if a list contains a string in javascript? -

this question has answer here: how check if array includes object in javascript? 38 answers how can test if string "orange" without quotes, exists in list such 1 below, using javascript? var suggestionlist = ["apple", "orange", "kiwi"]; edit: question different "how check if array.." because newbies me don't know list of items @ first glance "array". newbies going search term "list". indexof() default use in such cases. if( suggestionlist.indexof("orange") > -1 ) { console.log("success"); } .indexof() returns position in array (or string) of found element. when no elements found returns -1 .

How to connect pentaho BI to an H2 database? -

for life of me can't pentaho bi connect h2 datasource. current configuration: database type: h2 native (jdbc) host name: localhost database name: /home/myusername/h2/pemc_for_pentaho port number: 3306 username: sa password: sa i'm sure mistake database name. if helps, in tomcat's catalina.out i'm getting this: org.h2.jdbc.jdbcsqlexception: error opening database: "could not load properties /home/clim/pentaho/biserver-ce/tomcat/bin/h2:/localhost:3306/ho me/clim/h2/pemc_for_pentaho.lock.db" [8000-131] please before lose hair on this.

reporting services - How to export all the reports to excel in single workbook from one folder on the report server in SSRS -

i had below requirement. i created reports example in ssrs sales report a, sales report b , sales report c and deployed reports folder 'sales operations' on report server. instead of running each report want run 3 reports in 'sales operations' folder @ once , export 3 reports in same excel workbook. thank in advance. is below need? create master report , drop several rectangles onto it. within each rectangle, embed report a/b/c subreport. open property window of rectangle , add page break each rectangle. when export report excel, each report should on different tabs.

javascript - Iterating objects in es6 and returning new object -

using es6 javascript possible iterate on object , return new object. example: const people = { 'sally': { age: 22, sex: 'female', }, 'john': { age: 64, sex: 'male', }, 'sam': { age: 12, sex: 'female', }, }; const ages = people.somees6iteratingobjectfunction((index, person) => { return { object.keys(people)[index]: person.age }; }); console.log(ages); // { 'sally': 22, 'john': 64, 'sam': 12, } you can use reduce method of array prototype. works in es5. const people = { 'sally': { age: 22, sex: 'female', }, 'john': { age: 64, sex: 'male', }, 'sam': { age: 12, sex: 'female', }, }; let result = object.keys(people).reduce(function(r, name) { return r[name] = people[na...

How to report Zenity bugs -

i've been running app never terminates. have progress report , using zenity progress dialog so. after period of several hours zenity has eaten (and all) of available memory , swap space. want report can't find where. (the problem may in gtk zenity uses). my current workaround periodically close dialog , reopen it. causing dialog reappear in center of screen. annoying better alternative. the actual question report problem. if has better workaround, nice. the bugs can reported gnome.org @ https://bugzilla.gnome.org/enter_bug.cgi?product=zenity

loops - KnockoutObservableArray of type button that has action property doesnt assign action correctly -

i'm creating dynamic popup dynamic buttons have problem when use actions. button's creation code : openpopup = (buttons: array<popupbuttonsmodel>, title?: string, description?: string) => { var self = this; self.popup().isvisible(false); var action: any; (var i: number = 0; < buttons.length; i++) { action = buttons[i].action; var button = popuphelper.createpopupbutton(buttons[i].text ? buttons[i].text : "tamam", action ? function () { action; self.popup().isvisible(false); } : function () { self.popup().isvisible(false); }); buttons[i] = button; } self.popup(popuphelper.createpopup(buttons, title, description)); } when click button debugger shows me action's value (and undefined) buttons[i].action // should {alert('example');} this code shows buttons correctly actions wrong. if give action undefined button works correctly "function () { self.popup().isvisible(false);...

javascript - How do I display a number before the equations? -

how modify code when equations printed, number displayed before them. example, 2x+1=12 -x+2=5 this code needed modify. function getrandomnumber(min, max, notthese) { num = min + math.floor((max - min + 1) * math.random()); return (num); } function getoption(s, ch, num) { var = s.split(ch) return a[num - 1]; } function getequation() { var num1 = getrandomnumber(20, -20, ""); var num2 = getrandomnumber(20, -20, ""); var num3 = getrandomnumber(20, -20, ""); var num4 = getrandomnumber(20, -20, ""); var letter = getoption("x,y,z,w", ",", getrandomnumber(1, 4)); var str = "" + num1 + "" + letter + "+" + num2 + "=" + num3 + "" + letter + "+" + num4 + "" var total = (num4 - num2) / (num1 - num3); return (str + " (" + total + ")"); } (var = 1; <= 20; i++) { document.w...

javascript - Cannot read property 'top' of undefined error only on live server -

the function below works without errors on local server on live server 'cannot read property 'top' of undefined' error , link wont work @ all. causing that? how can fix it? <a class="herojumplink" href="#homestatement"></a> <section class="fullcopy homestatement" id="homestatement"></section> $('.herojumplink').on('click',function (e) { e.preventdefault(); var target = this.hash; $('html, body').stop().animate({ 'scrolltop': $(target).offset().top -70 + 'px' }, 300, 'linear'); }); this should work if target exists. $('.herojumplink').on('click',function (e) { //e.preventdefault(); var target = $(this.hash); target = target.length ? target : $('[name=' + this.hash.slice(1) +']'); if (target.length) { $('html...

java - Who to put methods in a array to use? -

i wonder if there way create methods array make call array in place of method in example below create array stores user objects in class there getname method, call method array, follows example example: public class javaapplication48 { public static void main(string[] args) { user[] u = new user[] {new user ("1", "john"), new user ("2", "tereza"), new user ("3", "tobias")}; //there put methods .getid() , .getname in array, dont know //... //and concatenating users array methods array system.out.println(u[0]ac[1]); //to print on console "john" } } class user { private string id; private string name; public user(string id, string name) { this.id = id; this.name = name; } public string getid() { return id; } public string getname() { return name; } } you can pull off using l...

javascript - How would I remove/turn Unselectable off on a page using GreaseMonkey? -

kinda new coding wondering how can remove unselectable attribute using greasemonkey script. this have far. var elmlink = document.getattributebyid("unselectable"); elmlink.removeattribute('unselectable'); there no such function getattributebyid looking document.queryselectorall. can use want. var elmlink = document.queryselectorall("[unselectable]"); now return every element unselectable attribute need loop through them remove attribute. elmlink.foreach(function(entry) { entry.removeattribute("unselectable"); }); hope helps

java - Hibernate transaction begin and commit at the right point -

i have dao package daoclasses implements amongst others following methode: public class xdaoimpl implements xdao { private sessionfactory sessionfactory; public void setsessionfactory(sessionfactory sessionfactory) { this.sessionfactory = sessionfactory; } public sessionfactory getsessionfactory() { return sessionfactory; } @override public void saveorupdate(myobject o) { //transaction trans = getsessionfactory().getcurrentsession().begintransaction(); getsessionfactory().getcurrentsession().saveorupdate(o); //trans.commit(); } } if run application needs lot time store objects database. belief happens because create new transaction each object. tried use spring framework’s xml based declarative transaction implementation. till not work me: <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:t...

javascript - Hide all elements based on the item selected on dropdown -

here html: <div id="drinks"> <select id="test"> <option data-tab="coffee">coffee</option> <option data-tab="cold drinks">cold drinks</option> <option data-tab="hot drinks">hot drinks</option> </select> <div class="section-wrapper"> <div class="row"> <section class="coffee"> <h3>coffee </h3> <h4>coffee flavor</h4> </section> </div> <div class="row"> <section class="cold drinks"> <h3>cold drink</h3> <h4>cold drink</h4> </section> </div> <div class="row"> <section class="hot drinks"> <...

rsa - Signing and verifying data with Java won't work -

i created rsa key pair (plus self-signed certificate) openssl using following command: openssl req -x509 -newkey rsa:2048 -keyout privado-ssl.pem -out certificado-ssl.pem -days 365 -nodes the name of generated files , contents are: privado-ssl.pem: -----begin rsa private key----- miiepaibaakcaqea45ttncik6tomf6pgfczhnyx8xlqkwuylf0kyvnjihn+h1wp9 tyhbjw9xsszopw4riwgudidmdh0gltvm0axieyjt2gzdfoyh+o9zd2+kmpofwhfu (etc, etc...) -----end rsa private key----- certificado-ssl.pem: -----begin certificate----- miiemdcca4cgawibagijaompp5khpi+wma0gcsqgsib3dqebbquamigomqswcqyd vqqgewjqrtenmasga1uecbmetgltytenmasga1uebxmetgltytetmbega1uechmk tm92yxryb25pyzemmaoga1uecxmdq0fumrgwfgydvqqdew9eyw5pzwwgq2fszgvy (etc, etc ...) -----end certificate----- since i'm using java.security.* classes sign , verify signature, transformed privado-ssl.pem (my private key) pksc8 format , der enconding using: openssl pkcs8 -topk8 -outform der -in privado-ssl.pem -out privado-ssl-pkcs8-der.pem -nocr...

html css dropdown menu -

this first ever post stack overflow , i'm not familiar forum regulations posting. please let me know have done wrong. have researched issue in forums , nothing i've come across gives me clear answer. i trying create dropdown menu "news" element, never visible result when running code. tried change .dropdown-content 's display value block see if make list visible, nothing showed. missing? body{ background-image: url("images/seamless-panda-bear-pattern.jpg"); font-size: 100%; width: 80%; margin: auto; font-family: palatino,"palatino", arial; } #top{ background-color: black; color: white; padding-left: 10px; border: 2px solid white; font-family: copperplate,"copperplate gothic light",fantasy; opacity: 0.85; padding-left: 25px; } #menu{ list-style-type: none; margin: 0; padding: 0; overflow: hidden; background-color: #333; position: fixed; width: 80%; } li{ float: left; } ...