Posts

Showing posts from May, 2011

python client can't connect to elasticsear remotely -

this code works on machine has exact same elasticsearh version server, from elasticsearch import elasticsearch es = elasticsearch(['the server ip here'], port=9200) body = json.dumps(itemdictionary, ensure_ascii=true) es.index(index = 'indexname', doc_type = 'doc', body = body) i getting error warning:elasticsearch:post http://the ip of server:9200/indexname/doc [status:n/a request:0.197s] es.index(index = 'indexname', doc_type = 'doc', body = body) file "/library/frameworks/python.framework/versions/2.7/lib/python2.7/site-packages/elasticsearch/client/utils.py", line 69, in _wrapped return func(*args, params=params, **kwargs) file "/library/frameworks/python.framework/versions/2.7/lib/python2.7/site-packages/elasticsearch/client/__init__.py", line 261, in index _make_path(index, doc_type, id), params=params, body=body) file "/library/frameworks/python.framework/versions/

vb.net - Make a label or button behave as a checkbox? -

i want code when click label changes boolean true , if false , false if true . , can loop, checkbox. private sub label3_click(sender system.object, e system.eventargs) handles label3.click dim clickedlabel = trycast(sender, label) if bool1 = true if clickedlabel isnot nothing bool1 = false end if if bool1 = false if clickedlabel isnot nothing bool1 = true end if is there way this? sure, handle click event of label. public class form1 private _mybool boolean private sub label1_click(sender object, e eventargs) handles label1.click _mybool = not _mybool label1.text = iif(_mybool, "mybool true", "mybool false") end sub end class using not operator easy way toggle boolean value - whatever was, not operator flip it. otherwise, problem code have missing end if statements if bool1 = ... sections.

c++ - Trying to get default web browser path fails on Windows 10 -

i'm doing following in app's installer (note installer project windows executable ( setup.exe ) , not msi.) first needed check if there're file associations .htm , .html file types. did already . , if there's no association needed add them opened web browser. to make lesser of impact on user's system, thought go user's default web browser. question how find path? so doing this: //get default web browser path wchar wbuffpath[max_path] = {0}; dword dwszbuffpath = max_path; ::assocquerystringw(0, assocstr_executable, l"http", l"open", wbuffpath, &dwszbuffpath); which seems work, except when run on windows 10 path (when default edge browser): c:\windows\system32\launchwinapp.exe so how reset of parameters start it? try using assocstr_command instead of assocstr_executable . using assocstr_executable , asking just executable itself, getting back. assocstr_command should give whole command line executable.

parsing - Parse a two-digit year as 1900s rather than 2000s in java.time? -

this question has answer here: how change base date parsing 2 letter years java 8 datetimeformatter? 1 answer the java.time framework built java 8 , later parses two-digit year strings being in 2000s. 90 becomes 2090 . from java.time.datetimeformatter class documentation: if count of letters two… parse using base value of 2000, resulting in year within range 2000 2099 inclusive. i have data values such 90 meant 1990 . how can change pivot year parsing two-digit year strings 1900 rather 2000 ? even better, how can set arbitrary pivot year, know data sources have rules partial century. example, “if under 80 , assume 2000s, otherwise assume 1900s”. yes, know, using two-digit year values dopey. data not under control. just use api value in 2000-2099 range , use conditionals rest of work. don't worry trying change api itself.

php - CKeditor and TinyMCE output HTML tags on published content -

i know old 1 because i've searched web 3 hours , can't figure 1 out. know somewhere in code have put html_entity_decode or htmlspecialchars_decode because believe html entities aren't converting when pulled database...but where? doesn't matter whether it's edit or create...and tried use both ckeditor , tinymce..same thing happens..without plugins..so whitout changes made on editors.. here's edit <?php find_selected_page(); ?> <?php if (isset($_post['submit'])) { // process form $id = $current_subject["id"]; $menu_name = mysql_prep($_post["menu_name"]); $position = (int) $_post["position"]; $visible = (int) $_post["visible"]; $content = mysql_prep($_post["content"]); // validations $required_fields = array("menu_name", "position", "visible", "content"); validate_presences($required_fields); $fields_with_max_lengths = array("menu_name&q

javascript - Variable capture a button and pass it to a service in angular -

hello community working project angular, stuck following: i want capture value inside of button, value comes controller, , click pass value service , service should go controller: html <div ng-app="myapp"> <div ng-controller="capturactrl"> <!--capturar valor en 'algunavariable' con ng-click o ng-model se me ocurre para pasarla al service captura --> codigo capturar: <button>{{capturame}}</button> </div> <br> <div ng-controller="recibectrl"> codigo capturado: {{codigo}} </div> js var app = angular.module('myapp',[]); app.factory('captura', function(){ var codigo = algunavariable; // <== variable que reciba del controllar capturactrl return{ getcodes: function(){ return codigo; } } }); app.controller('capturactrl', ['$scope', 'captura', function($scope, captura){ $s

r - Check which arguments are missing/NULL -

i have 2 questions both arose lack of understanding how arguments in r function handled. i vector indicating arguments of function f(x,y) missing. there more elegant way following solution: f <- function(x, y) { c(missing(x), missing(y)) } i implemented function returns logical variable indicating whether argument null : g <- function(x, y) { args_names <- as.list(environment()) sapply(args_names, is.null) } while functions works intended, struggling understand why g(y=1) not return true first argument: > g(y=1) x y false false this seems reasonable thing do. of course, if had many more arguments think sapply for second question why not return args , see r> g <- function(x, y) { + as.list(environment()) + } r> args = g(10) r> str(args$y) symbol of course next question symbol, taken manual of knowledge symbols refer r objects. name of r object symbol. symbols can created through functions as.name ,

mapreduce - SELECT COUNT(DISTINCT *) in CouchDB -

i have documents complying format: { "_id": "some_doc_id", "user": "some_user_id", "date": "2015-09-15", … } it's possible have multiple documents same user. i'd count how many distinct users there between 2 dates. e.g. between '2015-09-15' , '2015-09-25', there 745 different users. in sql, write query: select count(distinct user) documents date between '2015-09-15' , '2015-09-25' thank you. i use map function like: function (doc) { emit(doc.date, doc.user); } which emit documents sorted date, user being value. reduce function this: function(keys, values, rereduce) { if (rereduce) { return values.reduce(function (acc, index) { return object.keys(index).reduce(function (acc, user) { acc[user] = (acc[user] || 0) + index[user]; return acc; }, acc); }, {}); } else { return values.reduce(function (acc, user

understanding 3>>2 and -3>>2 results in Java -

when running code: public class operatedemo18{ public static void main(string args[]){ int x = 3 ; // 00000000 00000000 00000000 00000011 int y = -3 ; // 11111111 11111111 11111111 11111101 system.out.println(x>>2) ; system.out.println(y>>2) ; } }; i output as: x>>2 0 y>>2 -1 as understanding, since int x = 3 , x>>2 equal (3/2)/2 0.75 , integer, x>>2 0 . but don't understand why int y = -3 , y>>2 -1 . please explain it? as understanding, since int x = 3, x>>2 equal (3/2)/2 0.75, integer, x>>2 0. that's not entirely true; >> bitshift operation, nothing else . effect on positive integers division powers of two, yes. unsigned integers, it's not: you conveniently supplied binary form of y == -3 yourself: 11111111 11111111 11111111 11111101 let's bitshift right two! y == 11111111 11111111 11111111 11111101 y>>2== xx111111 11111111 11111

angularjs - Rgba to basic matrix (0 for white pixel, 1 for anything else) transformation with BufferedImage -

i'm working on optical character recognition school project. at step, have draw character apply freeman chain code it. i'm drawing on canvas using sketch.js front end code handled angularjs, end spring & bufferedimage based on 2 tutorials : for canvas drawing : https://developer.mozilla.org/en-us/docs/web/api/canvas_api/tutorial/pixel_manipulation_with_canvas#grayscaling_and_inverting_colors for sketch.js : https://intridea.github.io/sketch.js/docs/sketch.html i wrote client code : ... <div class="container"> <div ng-controller="ctrl"> <canvas ng-model="canvas" ng-click="enablesave()" class="panel panel-default" width="200" height="200"></canvas> <form class="form-horizontal" enctype="multipart/form-data"> <div class="input-group col-md-4"> <span

arrays - Loop that skips the values it already done -

with code mange take take different possibilities, add them , put in data in arrays. problem duplicated data want skip. example: first: name1, name2, total points of 2 , total price two. then: name2, name1, total points of 2 , total price two. which exact same result in diffrent order. data list of 3 colums 50 lines ( name , price , point ) price = 0 points = 0 l1 = [] l2 = [] l3 = [] l4 = [] in range(0,18): i2 in range(0,18): points = data['points'][i]+data['points'][i2] price = data['price'][i]+data['price'][i2] if price < 10 , != i2: l1.append(points) l2.append(price) l3.append(data['name'][i]) l4.append(data['name'][i2]) print points , price, data['name'][i], data['name'][i2] print '_____' print '' question: how solve problem? change loop avoid going on ever

javascript - How do I get my delete button to delete a single row? -

<!doctype html> <html lang="en-us"> <head> <script src="https://code.jquery.com/jquery-2.2.0.min.js"></script> <meta charset="utf-8"> <title>class 3</title> <!-- latest compiled , minified css --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mtjoasx8j1au+a5wdvnpi2lkffwweaa8hdddjzlplegxhjvme1fgjwpgmkzs7" crossorigin="anonymous"> <!-- optional theme --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity="sha384-flw2n01lmqjakbkx3l/m9eahuwpsfenvv63j5ezn3uzzapt0u7eysxmjqv+0en5r" crossorigin="anonymous"> <!-- latest compiled , minified javascript --> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/boots

sql - Get current country from trip information -

i have simple table (trip), stores trip information following trip_id traveler country_from country_to departure_date arrival_date 1 test1 germany italy 2016-01-01 2016-01-02 1 test1 italy france 2016-04-01 2016-04-02 1 test1 france italy 2016-08-28 2016-08-28 1 test1 italy germany 2016-08-30 2016-10-31 2 test2 france usa 2016-01-28 2016-02-28 2 test2 usa france 2016-08-30 2016-10-31 actually means test1 travels: germany -> italy -> france -> italy -> germany test2 travels: france -> usa -> france departure_date , arrival_date defines when traveler leave country_from , , when in country_to ... time spend in flight (i agree, table awful, , have lots of normalizing issues cant manage it, have have) i need write query, return traveler name, , country,

c - Pointer Content was deleted after function call, why? -

i've been trying figure out what's going on code, no luck. have defined pointer: char ** fileslist = readdir(); pointer pointing array of strings. able have filenames in current directory. that's not issue. when pass fileslist[i], i=0,..,n : readimage(fileslist[i],...); content of fileslist erased.. don't know why.. help?! my code: #include <fcntl.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <syslog.h> #include <sys/stat.h> #include <time.h> #include <string.h> #include <unistd.h> #include <limits.h> #include <dirent.h> #include <jpeglib.h> unsigned char *readimage(//struct jpeg_decompress_struct cinfo, char *inputpath, int *width, int *height, int *pixel_size) { char *inputfilename; struct jpeg_decompress_struct cinfo; unsigned char *buffer;

In python, how do I print a table using double for loops? -

here python code, from fractions import gcd print "| 2 3 4 5 6 7 8 9 10 11 12 13 14 15" print "-----------------------------------" xlist = range(2,16) ylist = range(2,51) b in ylist: print b, " | " in xlist: print gcd(a,b) i'm having trouble printing table display on top row 2-15 , on left column values 2-50. gcd table each value each row , each column. here sample of i'm getting | 2 3 4 5 6 7 8 9 10 11 12 13 14 15 2 | 2 1 2 you can have more concise list comprehension: from fractions import gcd print(" | 2 3 4 5 6 7 8 9 10 11 12 13 14 15") print("-----------------------------------------------") xlist = range(2,16) ylist = range(2,51) print("\n".join(" ".join(["%2d | " % b] + [("%2d" % gcd(a, b)) in xlist]) b in ylist)) output: | 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ---------------------------------------------

linux - od --width=x option isn't working. My path seems to be correct. -

this in .bashrc file: export path=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin but when run: od –-width=10 image.ppm i message "od: –width=10: no such file or directory" is there wrong path? it looks if pasted --width option improved double-dash @ beginning of option. should 2 ascii - (minus-sign) characters. pasting example command, actual character u+2013 rather u+002d

node.js - Npm "scripts": "start" run express and open url -

i have start params in package.json "scripts": { "start": "node bin/www" }, it running espress app whan typing npm start . but want browser opened http://localhost:8081 @ same time. how can start open local url well? like: "start": "node bin/www, http://localhost:8081" so when typing npm satrt runs express app , opens url @ same time. as far know it's writing bash command: // windows "start":"start http://localhost:8081 & node bin/www" // mac "start":"open http://localhost:8081 && node bin/www" // linux "start":"xdg-open http://localhost:8081 && node bin/www"

Trying to serve HTML5 <audio> element from Python+SSL to Android Chrome -

i have python-based web application server; great plain http. https, works browsers--except android chrome. chrome, html , icons fine on https, <audio> element fails start. see chrome pull 1 initial byte of mp3 (presumably way of testing file presence), served it. , chrome greys out <audio> element. i've pulled same single byte using curl, , works fine: curl -r 0-1 -k https://localhost:8083/foo.mp3 > foo1.mp3 i've added various delays , flushes, without fixing problem. it seem not content-range issue, i've changed code return full mp3 (with 200 code), same chrome behavior. firefox happy (both android , linux), midori (a webkit based browser). on linux, chrome/chromium both happy it. android chrome--no luck. i've extracted relevant bits of code; i'm assuming there's http nicety i'm missing (and, believe me, i've been looking). exercise it, plug in self-signed certificate pair @ hard-coded files "server.key"

Perform binary addition and subtraction with a signed binary numbers in Java -

for pure enjoyment , on time, i'm trying learn more binary numbers , assembly. have been local library checking out books in order gain more understanding of binary numbers , addition. didn't know before few weeks back, 1 add binary numbers java. i'm stumbled , have been 2 days on this. like said i'm trying add binary numbers in addition , subtraction. i'm assuming need parse in order work properly. feel i'm on looking here. missing? helpful. as of right now, have this: `import java.util.scanner; public class binary operation { public static void main(string[]args){ scanner keyboard = new scanner(system.in); boolean keepgoing = true; string binary1, binary2; int num1, num2; system.out.println("scenario: choose (a)dd, (s)ubtract, (e)xit"); char choice = keyboard.next().charat(0); while(keepgoing){ if (choice == 'a' || choice == 'a'){ system.out.println("enter 8-bit signed bi

ios - Calling a class method in another viewController -

this question has answer here: call class method argument class method in swift 2 answers i have class following class viewcontrolelr: uiviewcontroller { func instantiatedocumentsubpartnavigationvc(documentpart: documentpart, documentpartsarray: [documentpart]) { //definition } } in other class called viewcontroller2, wanna call above method. expect see below can pass parameters method in viewcontroller2 viewcontroller.instantiatedocumentsubpartnavigationvc(documentpart: documentpart, documentpartsarray: [documentpart]) but see is viewcontroller.instantiatedocumentsubpartnavigationvc(viewcontroller) how can utilize class method in different class? functions can declared operate @ 1 of 2 levels - class or instance. when call function, have match correctly. currently code has viewcontroller.instantiatedocumentsubpartnavigationvc , , viewcontr

nlp - How could I identify a sentence disclosing some specific information in a paragraph? -

for example, have such paragraph below: first sentence (bold , italic) hope identify out. identification goal includes: 1. whether paragraph contain such disclosure. 2. disclosure is. the possible problems : 1. sentence may not in begin of text string. in place of given paragraph. 2. sentence may vary words same meaning. example, expressed as: "sample provided review" or "they sent me item evaluation" or this. so how identify such disclosures ? anyone's idea appreciated. thanks. the paragraph: i sent earbuds audiophile headphones review. going copy here information site: "high definition stereo earphones microphone equipped 2 9mm high fidelity drivers, unique sound performance, well-balanced bass, mids , trebble. designed specially enjoy classic music, rock music, pop music, or gaming superb quality sound. let cor3 in ear sports earbuds. replaceable caps, inline controller , mic extreme flexible tangle free flat tpe cable including inline co

jquery - Listening to Select Menu and display Result: Javascript -

i using shopify, in case haven't used it, question should able answered in javascript, nice if have shopify knowledge. i have select options. whenever option selected, want option displayed. need updated depending on user selects. not sure how achieve javascript. <select name="car" id="select"> <option value="volvo">volvo</option> <option value="saab">saab</option> <option value="mercedes">mercedes</option> <option value="audi">audi</option> </select> <select name="color" id="select-one"> <option value="volvo">red</option> <option value="saab">oj</option> <option value="mercedes">purp</option> <option value="audi">black</option> </select> <div class="show"> here option selected,

sparse matrix - Linear iterative solver vs direct solver stability -

is iterative solver more stable direct solver based on lu factorization. lu based solver, have cond(a) < cond(l) * cond(u), factorization amplifies numerical inaccuracy. in event of ill conditioned matrix a, condition number large 1e10, better off using iterative solver stability , numerical accuracy? there 2 factors involved answering question. 1) physical system analyzing ill-conditioned (in mechanical terms, system pretty "loose", equilibrium state may vary depending on small variation in boundary conditions) 2) physical system ok, matrix has not been scaled before solution process begins. in first case, there isn't can do: physical system inherently unstable. consider applying different boundary conditions, example. in second case, preconditioner should helpful; example, jacobi preconditioner makes matrix having diagonal values equal 1. in case, iterations more converge.the condition ratio of 1e10 shouldn't represent trouble, provided precon

arrays - Can a method of an object store the name of the object itself to be recovered as a string in JavaScript? -

if have: x=3; firstnames = ["john","paul","george","ringo"]; lastnames = ["smith","jonson","jones","doe"]; semirandomnumbers= [3,6,7,4,2,1,0,9]; i can set: arraytouse = firstnames; alert(arraytouse[x]); // > "ringo" i know it's weird, it's how set up. problem lies in: arraytouse not = firstnames, = "john","paul","george","ringo" i want to: alert( "the array used was: " +arraytouse+ "." ); , want result be: "the array used was: firstnames." i don't want result: "the array used was: john","paul","george","ringo." so...... know sounds silly, but, there predefined property of object contains name of object? i.e. arraytouse.name -> firstnames. ??? (currently undefined) is there property unaware of use? or, have set on ow

php - Action Form not work -

<form action="/en2/maps-<?php echo $id; ?>/?=. ($_get['textsearchterms']).&=. ($_get['locationsearchterms'])."><!--relative url page map on--> distination: <select name="textsearchterms" class="selectpicker" data-live-search="true"> <option value="alfamart">alfamart</option> <option value="bca">bca</option> </select> location: <input type="text" name="locationsearchterms"> <input type="submit" value="search"> </form> <form action="/en2/maps-<?php echo $id; ?> not work... idea? i want link form action: http://indonesia.com/en2/maps-alfamart/?textsearchterms=alfamart&locationsearchterms=denpasar thanks use this <?php $id="alfamart"; $textsearchterms = isset($_get['textsearchterms']) ? $_get[&#

azureportal - Unable to view any tabs in Azure portal -

Image
i unable view services in azure portal. couple of days visible. i think there's permissions issue. logging global admin on portal. [update] : trying publish web application visual studio azure account , when select account, says "there no azure subscriptions associated account". account suspended or deactivated or so? you signed in classic portal aad subscription. these subscriptions don't support using other services. might signed in wrong directory. use "subscriptions" menu @ top switch. if don't have that, signed in wrong account. people have used "work/school" (aad) email addresses sign "personal" (microsoft account) account. if happens, you'll see prompt pick 1 of 2 when sign in. if don't see subscription, may assigned personal/msa account. can grant access other 1 avoid this.

android - Update Listview in Fragment , based on activity result . No result found anywhere -

i have activity , fragment in activity have button in action bar ,on button click dialog box popup , in have listview. if select item list , data goes fragment , , based on data activity fragment listview should shown e.g. if select technology , technology id =1 should pass in query parameter , based on fragment listview should appear. everytime select different item list fragment listview should updated. but problem not getting data in fragment , list not getting updated mainactivity.java @override public boolean onprepareoptionsmenu(menu menu) { menuitem actionviewitem = menu.finditem(r.id.miactionbutton); // retrieve action-view menu view v = menuitemcompat.getactionview(actionviewitem); // find button within action-view button b = (button) v.findviewbyid(r.id.btncustomaction); // handle button click here b.setonclicklistener(new onclicklistener() { @override

updating multiple records in mongodb using java by filtering and iterating through each record -

i trying update document field code , selects document have common field value trying update document value unique each document what have done : (map.entry<string, float> entry : maps.entryset()) { system.out.println(entry.getkey() + " : " + entry.getvalue()); finditerable<document> iterable1 = doccollection.find(filters.eq("product_currency", entry.getkey())); iterator<document> iter1=iterable1.iterator(); while(iter1.hasnext()) { /* * replace previous entry */ document theobj = iter1.next(); double retailprice = (theobj.getdouble("product_price_retail"))/entry.getvalue(); document doc =new document("product_price_usd",retailprice); doccollection.updatemany(filters.eq("product_currency", entry.getkey()), new document("$set",doc)); syste

get records from mysql table where datatime is less than current datetime -

i have table named trackhistory tracks change in table user . trackhistory table has column changeddate of datatype datetime records when change made in table user . want rows table trackhistory changeddate columns contains date less current datetime for eg table trackhistory row_no. changeddate userid marks 1 2016-02-08 08:45:34 5 40 2 2016-02-08 08:45:34 6 30 3 2016-02-08 09:12:34 5 50 4 2016-02-08 09:40:30 5 70 5 2016-02-08 09:40:30 6 60 suppose in system current time 2016-02-08 10:10:20 since 4th , 5th row last change made in trackhistory table. row 4th , 5th rows changeddate less current time. so how can write mysql query select rows changeddate less current date. in word, how can last updated rows trackhistory table. thanks in advance. just depends mean "just less current date

python - Django second m2m relation -

i have 2 models: user , board. class board(models.model): title = models.charfield(max_length=20, verbose_name=u'Название') members = models.manytomanyfield(to='user.user', related_name='boards', verbose_name=u'Участники') and want list of users ids, have @ least 1 common board current user. if use filter: user.objects.filter(boards__members__id=self.request.user.id).values_list('id', flat=true) it returns me [1, 2, 6, 1, 2, 3] and expect result. when use: self.request.user.boards.all().values_list('members__id', flat=true) it returns me list, contains current user id. [1, 1] what happens? upd i forgot 1 important thing: there function, like: def has_related_value(obj, field, channel_val): filter_by_val = channel_val property_name, filter_by_val = field.split('__', 1) attr = getattr(obj, property_name) if hasattr(attr, 'all'): return getattr(obj, proper

Scala 2.12 and Java 8 SAM interop doesn't compile -

i'm trying test java 8 class using rx.observable scala test. per scala 2.12.0-m3 release notes : lambda syntax sam types (experimental) of m3, feature not yet on default. can enable -xexperimental compiler option. when option enabled, similar java 8, scala 2.12 allows instantiating type 1 single abstract method passing lambda. however, using gradle , intellij, can't following compile: val o: rx.observable[util.map.entry[string, _ <: util.collection[string]]] = ??? val scheduler = new testscheduler() scheduler.createworker().schedule(_ => o.foreach { }) // argument action0, has sam void call() build.gradle : apply plugin: 'scala' group = 'name.abhijitsarkar.scala' version = '1.0-snapshot' tasks.withtype(scalacompile) { scalacompileoptions.useant = false scalacompileoptions.additionalparameters = ["-feature", "-xexperimental"] targetcompatibility = "1.8" } dependencies {

Bootstrap fixed-top navbar with jquery hover menu tab drops -

Image
i'm learning how use bootstrap framework on building website. , there navbar hover effect i'd replicate. please see example below provided bootstrap. https://www.aceandtate.com/ effect is: menu texts show while nav bar drops when mouse on nav-bar container area. navbar white unfold drops while mouse hover can show me how that? thanks, first, create dropdown bootstrap. (i assume have index.html,css folder, , js folder in 1 folder). index.html use bootstrap create dropdown menu. in js folder, edit (create if none) script.js file. add script $('ul.nav li.dropdown').hover(function() { $(this).find('.dropdown-menu').stop(true, true).delay(200).fadein(500); }, function() { $(this).find('.dropdown-menu').stop(true, true).delay(200).fadeout(500); }); after that, include script (if not yet include in html file) <script src="js/scripts.js"></script> i place before </body> now dropdown menu autom

javascript - Chartist JS, line graph going under X axis -

Image
currently i'm using chartist js jquery plugin , i'm having issue 1 of function going below x axis though doesn't have negative points. is there anyway avoid issue, please check image further understanding. the code var options = { low: 0, fullwidth: true, height: '225px', chartpadding: { left: 0, right: 40, }, showarea: true, onlyinteger:true, beziercurve:false }; $.ajax({ url: $('.ct-log-lead').data('url'), method: 'get', data: {customerid:$('.ct-log-lead').data('id'),phonenumber: $('.ct-log-lead').data('phone')}, success: function (d) { data = { labels: d[0], datasets: d[1] }; // var leadslastsevendays = 0; // data.datasets[0].foreach(function (value) { // leadslastsevendays += value; // }) // $('.call-seven').html(d

How to work with onBackPresed Button in Android? -

i have 2 activities 'a' , 'b' in android application. 1) first time i'm going activity 'b' 'a' 2) in activity 'b' have 2 list-view , whenever perform onitemclicklistener of both list-view have store boolean values in preferences. 3) after when want go activity 'a' , want top retrieve preferences values in activity 'a'. i have tried lot of not work here code in activity 'a' in oncreate() method booleanvalue_one = sharedpreferences.getboolean("listview_event_one", false); booleanvalue_two = sharedpreferences.getboolean("listview_event_two", false); log.e("", "booleanvalue_one=" + booleanvalue_one + " booleanvalue_two=" + booleanvalue_two + " booleanvalue_three = " + booleanvalue_three); activity 'b' onbackpressed() code @override public void onbackpressed() { super.onbackpressed(); intent =

android - Make navigation drawer close for the first time run -

i have app navigation drawer. works good, navigation drawer opens automatically app starts. i not want see navigation drawer unless swipe of click menu button. thanks in advance! when launch navigation drawer activity. make sure has been opened. drawerlayout mdrawerlayout = (drawerlayout) findviewbyid(r.id.drawer_layout); ... if(mdrawerlayout.isdraweropen(gravitycompat.start)) { //drawer open }

javascript - User Login is not working with node.js and mongoose -

i trying user login node.js , mongoose. user registration working , data inserting in mongodb collection, when try login registered email , password page show 404 error. login.js var express = require('express'); var router = express.router(); /* users listing. */ router.get('/', function(req, res, next) { res.render('login', { title: 'express' }); }); router.post('/login', function(req, res, next){ user.findone({email:req.body.email}, function(err, user){ if(!user){ res.render('login',{title:'invalid'}); } else{ if(req.body.password===user.password){ res.render('/dashboard',{title:'success login'}); } else{ res.render('login',{title:'invalide password'}); } } }); }); module.exports = router; login.ejs <!doctype html> <html> <head> <title><%= title %></title> <link rel='stylesheet' href

php - Can't open wordpress dashboard with wp-admin -

i have made site live(url: http://dev.localwebtest.com/nirlg/ ) getting following 2 errors when trying open dashboard. working fine on localhost. appreciated warning: require_once(/home/nettech2010/public_html/nirlg/wp-admin/includes/admin.php): failed open stream: no such file or directory in /home/nettech2010/public_html/nirlg/wp-admin/admin.php on line 82 fatal error: require_once(): failed opening required '/home/nettech2010/public_html/nirlg/wp-admin/includes/admin.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/nettech2010/public_html/nirlg/wp-admin/admin.php on line 82 thanks i had similar access issues moving website local dev live environment. have made sure relevant fields changed in database? because not enough copy database , change url in admin panel. looks bit include paths might not right... what mean is, have replaced local url links in database new ones? has solved issue me. in case haven't here sho

javascript - Controller doesn't wait for resolve -

i have resolve, controller seems run before finishes. $stateprovider.state('index', { url: '/', templateurl: '/angular/general/index.general.html', resolve: { data: function(currentuser){ currentuser.resolvelogin(); } }, controller: ['$state', 'currentuser', function($state, currentuser){ console.log('3'); if (currentuser.bloggedin()){ $state.go('index.dashboard'); } }] }); in currentuser this.resolvelogin = function(){ var deferred = $q.defer(); console.log('1') $http.get('/profile') .success(function(res){ console.log('2.1') root.user = res.data; deferred.resolve(); }) .error(function(res){ console.log('2.2') deferred.reject();