Posts

Showing posts from August, 2015

c++ - OpenCV identify lines in this image -

i cannot apply houghlines transform opencv image posting. lines should oriented 15 degrees, results in lots of lines in several directions. how can this?! this image. yeah, hough won't apply here.. way many white pixels. you can lines image processing. this: rotate image, lines vertical isolate each line. rotate image you can rotatedrect using minarearect of white pixels, , rotate original image knowing yourrect.angle . i suppose original image represents text. there lot of techniques in document analysis "rectify" image, i.e. correct skew . isolate each line you can use vertical (or horizontal) projection histograms. count number of white pixels each x (y) coordinate. can in opencv function reduce giving argument cv_reduce_sum . can identify spaces between lines histogram 0 (better apply small threshold). lines between 2 consecutive spaces . hope helps!

Line chart using jquery or javascript -

i trying make line chart of stock data. want plot 3 lines on graph: close, , 2 running averages. it's important lines thin, yahoo finance charts . i saw chartjs , there few things don't see supported. for example can't make lines thinner, can't set x axis ranges, or have date shown x-axis. i looking recommendations on line chart implementation. i recommend high charts has lots of options

c# - set selected row datagridview by cell's value -

Image
how set selected row on datagridview string? example.. when form_loaded...i want datagridview cell "lsn" selected so if have string text = "lsn" then table's row cell value "lsn" selected.. i use datagridview1.rows[3].selected = true; set selected row in datagridview.. but how can if dont know row's index , know string ? you have iterate through each row of datagridview until find value want. can select row , break out of loop. foreach(datagridviewrow row in datagridview1.rows) { // 0 column index if (row.cells[0].value.tostring().equals("lsn")) { row.selected = true; break; } } i haven't tested example should give right idea.

excel - Sharepoint - Link to a file that is updated Dynamically? -

i'm hoping possible. organization work has sharepoint site , able upload files pages, not admin on our sharepoint. i'm not sure version is, think older (ie: 2005). i have excel reports i've built. data these reports pulled sql server database have full control over. have setup job in sql server run every 12 minutes, procedure pulls in data , updates few tables. these tables used feed excel reports. i have separate scheduled task set open excel report(s) refresh data connections , save pdf. i link these pdf files via our sharepoint vips can access reports want, see date report. i trying link shortcut pdf files sharepoint doesn't seem that. how make sharepoint link point pdf file saved on every 15 minutes? thanks in advance, insight appreciated. the way (newish version of sharepoint) make save location pdf network location sharepoint keeps files site. you'll have access if can edit sharepoint site. here tutorial find network location. edi

vb.net - SOAP api login request not logging in -

i have in button click following code: dim pass string dim user string dim token string pass = "admin" user = "admin" token = "tlxnorej7gugkmulpzb0pgx6izx2u3to" dim islogin new wpfbrowserapplication1.servicereference1.apiloginrequest islogin.security_token = token islogin.password = pass islogin.username = user i go , check api users logged in , doesn't show in logged in

c++ - Do I need to keep the Bitmap object when using Bitmap.GetHBITMAP()? -

when using bitmap.gethbitmap() , need keep (not delete) bitmap object, or bitmap.gethbitmap() creates new hbitmap , not returns 1 bitmap object uses? (the documentation not mention this).

missing graphs in subplot in matlab -

i have such code; figure; = 1:length(weekm') tday_cell = day_cell(week_cell == weekm(a)); b = 1:length(days) subplot(length(weekm'), 7, b); if strcmp(first_entrancem{a, b}, '0') plot(peaks); l = [l; 0]; else tms_cell = ms_cell(week_cell == weekm(a)); ttms_cell = tms_cell(strcmp(tday_cell,days{b})); l = [l; ttms_cell]; plot(ttms_cell); end end end i want plot graphs subplot function subplot(3,7,[1:2:3...]) . is, want plot graph has 3 lines, , 7 graphs on each line. but in case, shows last line on first line, , can't see remaining graphs. i'm sure data plot previous graphs not being lost, don't understand why there missing graphs. could me fix problem? your line subplot -statement needs changed. first argument correct. second argument represents number of columns

salesforce - Publisher Action in Outlook Side Panel -

i trying make create contact publisher action available in outlook side panel. have created new publisher layout added action in layout , assigned profile. still in outlook action not showing up.. there other configuration required other 1 have mentioned ? this resolved setting records type in global actions.

android - Is there a way to detect if Chrome Browser is being used in Incognito mode for API<20? -

in android, there way determine when chrome being used in incognito mode? sorry no code, not sure starting point. this question has been asked , answered : detect anonymous / incognito browsing in short : cannot know sure api or anything, can try guess, history example.

jquery - How to link in javascript? -

how can link in javascript, want link suggestion.full # js: var domains = ['hotmail.com', 'gmail.com', 'aol.com']; var topleveldomains = ["com", "net", "org"]; $('#email').on('blur', function(event) { console.log("event ", event); console.log("this ", $(this)); $(this).mailcheck({ domains: domains, // optional topleveldomains: topleveldomains, // optional suggested: function(element, suggestion) { // callback code console.log("suggestion ", suggestion.full); $('#suggestion').html("did mean? <b><i>" + suggestion.full + "</b></i>?"); }, empty: function(element) { // callback code $('#suggestion').html('no suggestions :('); } }); }); html: <label for="email">e-mailadres<

How to modify local storage with python requests -

in addition sending cookies python requests request send localstorage key value pair. i tried looking @ requests docs , not capable in doing this, it? is there way me without using headless browser? local storage not sent requests. accessible via javascript through client-side code. this website has more information differences between local storage , cookies.

c# - Task based concurrency much slower than when directly using System.Threading.Thread -

i've been using system.threading.task , system.net.http.httpclient load test web server , have observed strange behavior. here code: var taskarray = new list<task>(); (int = 0; < 105; i++) taskarray.add(task.factory.startnew(() => get("/content/test.jpg"))); task.waitall(taskarray.toarray()); even though each request (when monitored via fiddler), took around 15ms execute, getting timeout exceptions (well, taskcanceledexcpetions - same thing) thrown httpclient being used make request when request time exceeded default timeout of 100 seconds. the first thing tried increasing timeout on httpclient, worked, still struggling understand why requests short response time timing out. set timer before made call httpclient.postasync , checked how long took complete, suspected, time on 100 seconds, despite server sending response more promptly. i read httpclient.timeout timeout entire async operation, made me think perhaps task scheduler cau

Jasper Studio 6.0.3 create one table with multiple querys -

i have following problem: i need fill table fix size each cell own query example: table columns a, b e c , lines e, f, g. every match line/column need execute specified query. can done ?? there issue 1 table can have 1 dataset => 1 query. can send external parameters tables example report dataset, not solution many queries. is possible create view in db cover requirements , display view in report? can best way how handle problem if want have in 1 table.

eclipse - Coding Challenge in Java: Given Letters and Returning What Rank They are in -

hey practice found coding challenge have been working on few days. have first part, can't seem figure out how continue am. here challenge: consider "word" sequence of capital letters a-z (not limited "dictionary words"). word @ least 2 different letters, there other words composed of same letters in different order (for instance, stationarily/antiroyalist, happen both dictionary words; our purposes "aaiilnorstty" "word" composed of same letters these two). can assign number every word, based on falls in alphabetically sorted list of words made of same set of letters. 1 way generate entire list of words , find desired one, slow if word long. write program takes word command line argument , prints standard output number. not use method above of generating entire list. program should able accept word 20 letters or less in length (possibly letters repeated), , should use no more 1 gb of memory , take no more 500 mill

Is it possible to consume a web service in a c++ service application -

i trying consume web service in c++ service application using wsdl importer. can import web service want use of webmethods including service.h in file following error: unit1.cpp(64): e2015 ambiguity between 'soap::wsdlbind::tservice' , 'vcl::svcmgr::tservice' i imported web service vcl forms application , worked perfectly. i using rad studio xe2. how fix this? that means have name clash in code, i.e. have somewhere like //header names should different, sake of example #include soap/wsdlbin/tservice.h #include vcl/svcmgr/tservice.h <some namespace using directives> ... tservice service; and compiler cannot determine tservice is. have qualify tservice compiler know use, i.e.: soap::wsdlbind::tservice service; //or vcl::svcmgr::tservice service;

How to launch legacy GUI of Clearcase from MSDOS -

Image
i have clear-case tutorial based on legacy ui wanted know how launch base ui msdos if base ui clearcase explorer, type clearexplorer (provided %path% include c:\path\to\rational\clearcase\bin ) to launch clearcase home base seen in " tabs missing "clearcase home base" gui on microsoft windows ", type: clearhomebase that launch:

casting a base generic class from a derived generic class in C# -

i need find way retrieve properties instance of generic class, generic argument type derived class. example: class { public int data; } class b : class { } class c : class { } class d : class { } . . . class g<t> { t field } main() { object t = callouterservice(); } given t instance of g instantiated 1 of deriving classes, there way access data field without trying cast deriving classes? *edited - 1. data field public 2. classes a, b, c... g not handled code, interfaces external service. can't edit them in way... through covariance could: class { public int data; } class b : { } class c : { } class d : { } interface ig<out t> { t field { get; } } class g<t> : ig<t> { public t field { get; set; } } and then: g<d> gd = new g<d> { field = new d { data = 5 } }; ig<a> ga = gd; int data = ga.field.data; // 5 note can read field property, not write it! , covariance interfaces (fo

asp.net - MVC 5 Complex View Model binding is not working -

Image
public class createprojemodel { public proje proje { get; set; } public list<geometrymodel> geometrylist { get; set; } public createprojemodel() { proje = new proje(); geometrylist = new list<geometrymodel>(); } } public class geometrymodel { public list<pointmodel> pointlist { get; set; } public geometrymodel() { pointlist = new list<pointmodel>(); } } public class pointmodel { public int x { get; set; } public int y { get; set; } } public class proje : entitybase { public int firmaid { get; set; } public int ilid { get; set; } public int? ilceid { get; set; } public int planturid { get; set; } public int etudturid { get; set; } public int etudamacid { get; set; } public int dilimid { get; set; } public string aciklama { get; set; } public virtual firma firma { get; set; } public virtual il il { get; set; } public virtual ilce ilce { get; set

java - How to Update a Fragment From PreferenceActivity? -

my main activity has several fragments, 1 of has listview or gridview. have preferenceactivity configures how app looks , functions, in particular whether display list or grid. when list/grid view setting changed in preference activity want reflect change in fragment (located in app's main activity). how do separate activity? (in cast preference activity). edit - managed accomplish using onresume() callback check if relevant preference changed, , if there change: public void onresume() { super.onresume(); sharedpreferences settings = getactivity().getsharedpreferences("settings", 0); boolean layout = settings.getboolean("layout", false); if (layout == true) { listview.setvisibility(view.visible); gridview.setvisibility(view.gone); } else { listview.setvisibility(view.gone); gridview.setvisibility(view.visible); } } you can start preferenceactivity using startactivityforresult return re

xwiki - cannot get "\"while reading an xml file -

i'm trying read xml page of xwiki line line when read line: [[3.2.2>>doc:3\.2\.2]] it returns just [[3.2.2>>doc:3.2.2]] any ideas why ignores \ . so have xwiki page localpäge.xml : <?xml version="1.0" encoding="utf-8" standalone="yes"?><page xmlns="http://www.xwiki.org"><content> ====[[projects>>webhome]]/[[scv>>scv]]/composant1==== |=release|=date |[[3.3.3>>doc:3\.3\.3]]|2015-06-25:14:23:20 </content> </page> what i'm doing while read echo "$i">>pagetosend.xml done < localpage.xml in pagetosend.xml instead of having |[[3.3.3>>doc:3\.3\.3]]|2015-06-25:14:23:20 i have |[[3.3.3>>doc:=3.3.3]]|2015-06-25:14:23:20 and want keep famous "\" .

symfony - Parsing YAML to check structure -

in symfony2 project want make configuration file gets loaded , gives indication, each form field, if display field or not, , if making required or not, depending on attributes of "project" entity. parameters: fieldproperty: myprofile: name: label: 'your name' projecttype: it: 2 non-it: 2 hybrid: 2 projectsize: small: 2 medium: 2 large: 2 massive: 2 projectcomplexity: low: 2 medium: 2 high: 2 projecttimingurgency: regular: 2 urgent: 2 mandatory: 2 critical: 2 highlycritical: 2 sensitivity: 'none' nickname:

windows - ShellExecuteEx silently fails in 64-bit call to hidden file -

i have 64-bit console app wants open file. file's hidden attribute set (the file hidden). code below fails on machines. shellexecuteex return true , .txt file not open in notepad, , hprocess member of shellexecuteinfo structure remains 0 after call. coinitializeex(null, coinit_apartmentthreaded | coinit_disable_ole1dde); shellexecuteinfo sei = {0}; sei.cbsize = sizeof(shellexecuteinfo); sei.fmask = see_mask_nocloseprocess; sei.hwnd = getconsolewindow(); sei.lpverb = _t("open"); sei.nshow = sw_shownormal; sei.lpfile = _t("c:\\some\\existing\\file.txt"); bool brc = shellexecuteex(&sei); messagebox(getconsolewindow(), sei.lpfile, sei.lpverb, mb_ok); call messagebox there there's enough time shellexecuteex magic. .txt file open in notepad if @ least 1 of following conditions met: .txt file not hidden the calling process 32-bit, instead of 64-bit the machine other (can't figure out difference between machines, file not open in @ least

php - json_decode() expects parameter 1 to be string, array given? -

this data ,after json_encode() array ( [{"customerid":"1","customer_name":"jon_doe","amount":"12312312","billcode":"b1231","billname":"cashbilname","billcategorycode":"1234","billcategory":"utility","month":"may","year":"2015","txcode":"10","stationid":"152","station":"coroom","operatorcode":"1200","operator":"jame","terminal":"ter12312","txdate":"12\/2\/2015","txtime":"12:21:22_pm"}] => ) now want decode ,by applying json_decode() gives following error json_decode() expects parameter 1 string, array given any idea sugestion ? your json must in string , not in array $json_string = '

javascript - How to move current date to the first row of the jQuery datepicker calendar -

Image
is possible shift current day first row of datepicker calendar? first row contains current day. following code set mindate first date of current month , maxdate last date of current month. var currenttime = new date(); // first date of month var startdatefrom = new date(currenttime.getfullyear(),currenttime.getmonth(),1); // last date of month var startdateto = new date(currenttime.getfullyear(),currenttime.getmonth() +1,0); $("#datepicker").datepicker({ dateformat: 'dd.mm.yy', mindate: startdatefrom, maxdate: startdateto });

ios - UITextView as InputAccessoryView doesn't render text until after animation -

when showing detail viewcontroller first time, inputaccessoryview render text immediately, when go , try again, text doesn't rendered untill animation completes. see demo project here: https://github.com/sabatinomasala/accessoryview-demo/ if has resolution, explanation or workaround, i'd glad hear it! i tried messing project and, unfortunately, saw same behavior did. may bug in uikit.

Installing CAS Server : A required class is missing: org/apache/maven/surefire/util/NestedCheckedException -

i not familiar tomcat, followed tutorial. run until launched maven clean package. output gives me following error : [info] internal error in plugin manager executing goal 'org.apache.maven.plugins:maven-surefire-plugin:2.10:test': unable load mojo 'org.apache.maven.plugins:maven-surefire-plugin:2.10:test' in plugin 'org.apache.maven.plugins:maven-surefire-plugin'. required class missing: org/apache/maven/surefire/util/nestedruntimeexception org.apache.maven.surefire.util.nestedruntimeexception i have checked on net , seems error common, none of methods indicated worked : have rm -rf .m2/repository/org/ my pom.xml follows : <?xml version="1.0" encoding="utf-8"?> <project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd "> <modelversion

css - HTML layout in IE10 involving percentage width and height -

an absolute positioned div in ie10 not filling parents height (works ok in latest chrome , firefox). in code below, "percent-height" class issue lies. fills width ok, not height. if set pixel height (in cell 3), how know percentage "height" issue, not width. need percentage height responsive. codepen visuals: http://codepen.io/anon/pen/enexog html: <div class="table"> <div class="cell"> <img src="http://placehold.it/200x200" alt="" /> </div> <div class="cell"> <div class="percent-height"></div> </div> <div class="cell"> <div class="px-height"></div> </div> <div class="cell"> </div> </div> css: .table { display: table; width: 100%; border-spacing: 5px; } .cell { display: table-cell; width: 25%;

python - Pandas to_csv index=False not working -

i'm writing fixed-width file csv. because file large read @ once, i'm reading file in chunks of 100000 , appending csv. working fine, it's adding index rows despite having set index = false. how can complete csv file without index? infile = filename outfile = outfilename cols = [(0,10), (12,19), (22,29), (34,41), (44,52), (54,64), (72,80), (82,106), (116,144), (145,152), (161,169), (171,181)] chunk in pd.read_fwf(path, colspecs = col_spec, index=false, chunksize=100000): chunk.to_csv(outfile,mode='a') thanks! the to_csv method has header parameter, indicating if output header. in case, not want writes not first write. so, this: for i, chunk in enumerate(pd.read_fwf(...)): first = == 0 chunk.to_csv(outfile, header=first, mode='a')

cq5 - CQ - Check whether the resource object is valid -

i need check whether resource object valid or not below 'resource' object. example if pass url getresource("some path not available in cq") in case need restrict it resource resource= resourceresolver.getresource(/content/rc/test/jcr:content"); node node = resource.adaptto(node.class); string parentpagepath= node.getproperty("someproperty").getvalue().getstring(); is there way do? if using getresource null check sufficient. if use resolve , have use !resourceutil.isnonexistingresource(resource) . on node level can check existence of property hasproperty .

svm - time series forecasting using Support Vector Machine -

Image
what attributes used in time series forecasted using svm? have 2 values date , value @ date class know can use -1 , 1 when price gets or down still don't know how plot time series calculate hyperplane there papers show ways it: financial time series forecasting using support vector machine using support vector machines in financial time series forecasting financial forecasting using support vector machines i recommend go through existent literature, fun describe easy way (probably not best) it. let's have n pairs particular date/time of pair , corresponding value. pairs sorted x component. let's want predict if given , corresponding unknown value go or down (notice use regression , instead try predict value itself). then train model training set this: input value ====================== ================ y_t0, y_t1, ..., y_ti-1 1 :if y_ti > y_ti-1, -1 otherwise y_t1, y_t2, ..., y_ti 1 :

mysql fulltext search searching simple words like "part a" -

i building database store answers of questions, answer, tag, tagmap, 3 tables. answer record can have multiple tags used searching. tagmap linking answer , tag. application lets user input string search, e.g. "2014 math part a". used explode in php split string array, make sql statement, keyword like. doing , records returned. proper way search corresponding answer records. sorry english! you should ignore inputs short, eg less 3 chars. a would ignored aaa search for. should exclude common words "with no meaning" the in english or der , die , das in german. so if user enters 2014 math part a search 2014 , math , part . also should think giving user possible select tags reduce amount of answers in search keywords before "expansive" like %keyword% search.

junit - error with JiraTestResultReporter with Jenkins -

i configured jenkins jiratestresultreporter plugin. , using selenium testng test cases , able read test case also. using jira free trail. didn't install jira in jenkins. [xunit] [info] - starting record. [xunit] [info] - processing junit [xunit] [info] - [junit] - 1 test report file(s) found pattern '**/test-callingtestsuite.xml' relative 'c:\seleniumtest\workspace\testwithjira' testing framework 'junit'. [xunit] [info] - converting 'c:\seleniumtest\workspace\testwithjira\test-output\junitreports\test-callingtestsuite.xml' . [xunit] [info] - check 'failed tests' threshold. [xunit] [info] - check 'skipped tests' threshold. [xunit] [info] - setting build status success [xunit] [info] - stopping recording. [jiratestresultreporter] [info] examining test results... [jiratestresultreporter] [debug] build result success [jiratestresultreporter] [debug] [jiratestresultreporter] [info] workspace c:\seleniumtest\workspace\testwithjira

how to urlencode a value that is a python dictionary with encoded unicode characters -

i'm trying make url-encoded web request in python 2.7 want send list of python dictionaries on server decoded list of json objects. in essence i'm making: >>>urllib.urlencode({"param":"val", "items":[item1, item2] }, true) where item1 can { "a": u"Å¡".encode("utf8") } (simplified example) the problem arises because of unicode characters. if item1 encoded, meaningful: >>>urllib.urlencode(item1) 'a=%c5%a1' however, if call urllib.urlencode({"test": item1}) mess: 'test=%7b%27a%27%3a+%27%5cxc5%5cxa1%27%7d' in case, unicode character no longer encoded %c5%a1 longer sequence incorrectly decoded on server side. does have suggestion how transform complex dictionary values (i.e. item1 ) before calling urlencode avoid issue? one way or need decode encoded before re-encoding here 1 approach: dictionary = {"test": item1} urllib.urlencode(di

r - plyr functions and standard evaluation -

i wrap plyr functions in own functions. want pass function object , variable (unquoted) on apply cut function. x <- data.frame(time = seq(sys.date() - 99, sys.date(), 1)) dlply(x, .(week = cut(time, "1 week")), "[") f <- function(datas, var) { var <- deparse(substitute(var)) dlply(x, .(week = cut(var, "1 week")), "[") } f(x, time) # fail i don't know how use object var specify variable value , not "var" variable, within ddply. unlike in dplyr there no standard evaluation versions of plyr functions ? read can use strings, example dlply(x, .(week = cut("time", "1 week")), "[") fails i tried lazyeval, i'm lost in standard/non standard evaluation universe. you seem have unnecessary deparse in code , don't evaluate var in right place. works following. f <- function(datas, var) { var <- substitute(var) dlply(datas, .(week = cut(eval(var), "1 w

php - .htaccess file not able to rename subfolder instead getting page not found -

i have search alot on google , on stackoverflow.com too. have found questions , answer unfortunately no answer working me. have written cms kind web application in public access files on root control panel files resides on admin folder. want control panel files should run using http://www.example.com/administrator url, have written .httacess file. .htaccess # begin <ifmodule mod_rewrite.c> rewriteengine on rewritecond %{http_host} ^example.com rewriterule (.*) http://www.example.com/$1 [r=301,l] rewritecond %{request_filename} !-f rewriterule ^([^\.]+)$ $1.php [nc,l] rewriterule ^single _single_page.php [nc,l] rewriterule ^single/([a-za-z0-9-]+)/?$ _single_page.php?subid=$1 [nc,l] rewriterule ^findcontents$ _findcontenttitle.php [l,qsa] #rewriterule ^findcontents/([a-za-z0-9-]+)/?$ _findcontenttitle.php?data=$1 [l,qsa] rewriterule ^search$ _specificpage.php [nc,l] [l,qsa] # admin panel redirect settings rewriterule ^/administrator(.*)?$ /admin$1 [nc] rewri

excel - Collection function fails to gather unique items when the item is a Number? -

im using following collection script working against each column. have used same script 4 columns, , works perfectly. however, 1 column filled number values , fails return anything. if insert text value in reference field, returned desired. thing can think need number values need interpreted string first, run through collection? here's code: sub list_gen_uni() sheets("xx").select 'units/item dim uni new collection on error resume next each cell in range("j2:j1000") uni.add cell.value, cell.value next cell on error goto 0 = 1 uni.count cells(i + 1, "k") = uni.item(i) next call list_gen_items end sub you correct keys need text, use cstr: uni.add cell.value, cstr(cell.value)

How to redirect from service to the main controller in angularjs? -

Image
this first app using angularjs . i'm creating app using angularjs brings tour details api response. have multiple controller, each controller has different pages. my problem have 4 links (links spanish, france, india, america, etc.) on each page footer. if click on 1 of them, should show respective api results on main controller. please below diagram understating pageflow. thank in advance!! a service perfect this. if create service function shows data, can inject service in each controller. way if click on link in footer, data show! check here documentation , examples of angular services

How to make CSS animation use the applied style from previous animation -

i making checkbox thing, , have animation when going unchecked checked. i have set animation-fill-mode: forwards css state applied after first animation initialized on check. how can next animation go state. reads specified in css file initial state, not 1 applied first animation. if set from { ... } on second animation animation (meant played on checked unchecked) plays on page load because plays on unchecked initial state. input[type="checkbox"] { display: none; } input[type="checkbox"]:checked + .outer_checkbox { -webkit-animation-name: checked_color; } input[type="checkbox"]:checked + .outer_checkbox > .inner_checkbox { -webkit-animation-name: checked_placement; } .inner_checkbox, .outer_checkbox { border: 1px solid black; -webkit-animation-duration: 0.3s; -webkit-animation-fill-mode: forwards; } .outer_checkbox { cursor: pointer; width: 32px; height: 16px; border-radius: 8px;

java - I have the methods, but need program code for Grade enum -

i need write java enumeration lettergrade represents letter grades through f, including plus , minus grades. enumeration code: public enum grade { a(true), a_plus(true), a_minus(true), b(true), b_plus(true), b_minus(true), c(true), d(true), e(true), f(false); final private boolean passed; private grade(boolean passed) { this.passed = passed; } public boolean ispassing() { return this.passed; } @override public string tostring() { final string name = name(); if (name.contains("plus")) { return name.charat(0) + "+"; } else if (name.contains("minus")) { return name.charat(0) + "-"; } else { return name; } } what confused writing main program. think quite straightforward have no clue on how start it. don't want whole code. few lines give me head start. rest try figure out on own. i imagine have student class looks this: class student { protected grade grade

VB.NET Run command against 2 arrays -

i have read 2 text files 2 arrays , want run command uses 2 arrays. example: part1.txt(array 1) hxxp://somethinghere.com\1 hxxp://somethinghere.com\2 part2.txt(array 2) bob james myprogram.exe hxxp://somethinghere.com\1 bob myprogram.exe hxxp://somethinghere.com\2 james i want run loop goes through both arrays, here's have far: dim part1() string = io.file.readalllines("c:\part1.txt") dim part2() string = io.file.readalllines("c:\part2.txt") each line string in part1 msgbox(line) next edit: working code: private sub form1_load(sender object, e eventargs) handles mybase.load dim part1() string = io.file.readalllines("c:\part1.txt") dim part2() string = io.file.readalllines("c:\part2.txt") parse integer = 0 part1.getupperbound(0) msgbox(string.concat("myprog.exe " & """" & part1(parse) & """" & " -arg1 " & ""&qu

gnu make - Echo command in makefile not printing -

i have following makefile, rule checks dependencies: #!/usr/bin/make -f dependencies: $(info start-info) @echo "start-echo" $(call assert-command-present,fastqc) $(call assert-command-present,cutadapt) $(call assert-command-present,bowtie2) $(call assert-command-present,samtools) $(call assert-command-present,bedtools) $(call assert-command-present,fetchchromsizes) $(call assert-command-present,bedgraphtobigwig) $(info end-info) @echo "end-echo" pipeline: dependencies assert-command-present = $(info checking $1) && $(if $(shell $1),$(info ok.),$(error error: not find '$1'. exiting)) the user-defined function assert-command-present checks command in path, , returns error if not found. when run makefile, echo , info commands not returned in order expect: start-info checking fastqc ok. checking cutadapt ok. checking bowtie2 ok. checking samtools ok. checking bedtools ok. checking fetchchromsizes o

jquery - Checking properties of an object in an array -

in javascript, how best way code way check if value exists in array of data? here have: var html = []; html.push({ key: "/1/1.html", value: "html 1 data" }); if(doeskeyexist(html, "/1/1.html")) { alert(getvalue(html, "/1/1.html")); } function doeskeyexist(arr, key) { $.each(arr, function (index, data) { if(data.key === key) return true; }); return false; } function getvalue(arr, key) { $.each(arr, function (index, data) { if(data.key === key) return data.value; }); } the above code not alert value of "html 1 data", , no error shown in console. may please have above code? thanks the issue because return statements inside $.each blocks returning anonymous functions not doeskeyexist() , getvalue() functions. need change logic slightly: var html = []; html.push({ key: "/1/1.html", value: "html 1 data&qu

php - Calling Telegram API to create a feedreader bot -

i have seen new api bots enabled create custome bots,i have seen sources such this , this have read @fatherbot registering bots,i searched examples telegram bots such this one,i know how write codes in php , python can not find out how call api methods , start.does 1 has idea how start? you use new library bot api of telegram! https://github.com/tekook/telegramlibrary it features functions of new api , easy use , event based libarry! have fun!

elasticsearch: All primary shards become inactive when restart a single node cluster -

i started new elasticsearch cluster , added new index, shut down. when try start again there no active shards more. shards became inactive , unassigned. use index settings below: "settings": { "number_of_shards": 32, "number_of_replicas": 3 } here health output: { "cluster_name" : "sailcraft", "status" : "red", "timed_out" : false, "number_of_nodes" : 1, "number_of_data_nodes" : 1, "active_primary_shards" : 0, "active_shards" : 0, "relocating_shards" : 0, "initializing_shards" : 0, "unassigned_shards" : 128, "number_of_pending_tasks" : 0 } here same problem has been marked solved . don't think that's solution. edit: it's same question think post not right answer. said need 2 more nodes if have 2 more replica shards. read related docs , there not su

pca - Confidence intervals of loadings in principal components in R -

i using following code principal component analysis of first 4 columns of iris data set using prcomp function in r: > prcomp(iris[1:4]) standard deviations: [1] 2.0562689 0.4926162 0.2796596 0.1543862 rotation: pc1 pc2 pc3 pc4 sepal.length 0.36138659 -0.65658877 0.58202985 0.3154872 sepal.width -0.08452251 -0.73016143 -0.59791083 -0.3197231 petal.length 0.85667061 0.17337266 -0.07623608 -0.4798390 petal.width 0.35828920 0.07548102 -0.54583143 0.7536574 how can confidence intervals of these values in r? there package can it? help. you use bootstrapping on this. re-sample data bootstrapping package , record principal components computed every time. use resulting empirical distribution confidence intervals. the boot package makes pretty easy. here example calculating confidence interval @ 95% first pca component respect sepal.length: library(boot) getprcstat <- function (samdf,vname,pcnum){ prcs <-

java - Bukkit. Color support in chat (&) ? and Username onplayerjoin does not work? -

i have 2 problems. problem 1 i want colors essentials have in chat dont know how tried this: @eventhandler public void onplayerchat(asyncplayerchatevent chatevent){ chatevent.getmessage().replaceall("&", "§"); (string word : chatevent.getmessage().split(" ")){ if(sysmng.getconfig().getstringlist("badwords").contains(word)){ if (!chatevent.getplayer().haspermission("bypassbadwords")){ chatevent.setcancelled(true); chatevent.getplayer().sendmessage(chatcolor.red + "dont use dirty or swear words!"); } } } } this line: chatevent.getmessage().replaceall("&", "§"); not work. how can color support in chat? problem 1 update ok soo did: public void onplayerchat(asyncplayerchatevent chatevent){ (string word : chatevent.getmessage().split(" ")){ word

python - 500 Server Error in OSQA -

i host osqa in aws ec2 , encounter 500 server error while accessing homepage. 500 server error sorry, system error system error log recorded, error fixed possible the error log file /var/log/apache2/osqa.error.log empty. accessing login page mysite.com/account/signin/ normal. part of settings_local.py is: #admins , managers admins = () managers = admins debug = false debug_toolbar_config = { 'intercept_redirects': true } template_debug = debug internal_ips = ('127.0.0.1',) allowed_hosts = ('example.com',) is problem permission? -rw-rw-r-- 1 ubuntu www-pub 0 may 25 18:21 __init__.py -rw-rw-r-- 1 ubuntu www-pub 242 may 25 18:21 manage.py -rw-rw-r-- 1 ubuntu www-pub 4556 may 25 18:21 settings.py -rw-rw-r-- 1 ubuntu www-pub 2257 jun 25 08:01 settings_local.py -rw-rw-r-- 1 ubuntu www-pub 429 may 25 18:21 urls.py the problem results higher markdown version ( found existing installation: markdown 2.6.2 ), reported

java - Difference between slf4j-log4j12 and log4j-over-slf4j -

what's difference between slf4j-log4j12 , log4j-over-slf4j , when should each used? <dependency> <groupid>org.slf4j</groupid> <artifactid>slf4j-log4j12</artifactid> <version>1.7.12</version> </dependency> <dependency> <groupid>org.slf4j</groupid> <artifactid>log4j-over-slf4j</artifactid> <version>1.7.12</version> </dependency> log4j-over-slf4j use if code or libraries using uses log4j directly, want use different slf4j binding log4j . route log4j api calls slf4j binding choose. need remove log4j library classpath , replace dependency. slf4j-log4j12 use if want use log4j 1.2 binding slf4j . please note log4j 2 has been released . you shouldn't use both of these libraries at same time .

c# - Parsing a string with a number on basis of culture -

i working on application extracts numbers strings based on different cultures. here's method: private decimal parsecurrencyamount(string fieldvalue, string clientculture) { decimal decimalvalue; if (decimal.tryparse(fieldvalue, numberstyles.currency, cultureinfo.getcultureinfo(clientculture), out decimalvalue)) { return decimalvalue; } return -1; } the string 40'000 40,000 in swiss french culture not able parse same. there other culture can parse string correctly? input: fieldvalue : "40'000" (forty thousand) clientculture : fr-ch not working can change culture. tia

php - Convert collection of array to object -

i'm pushing array data. how can return object this: "data": [ { "apartment": { { "id": xxx, "show": "xxx, }, { "id": xxx, "show": "xxx", }, and not this: "data": [ { "apartment": { "0": { "id": xxx, "show": "xxx, }, "1" : { "id": xxx, "show": "xxx", }, this code: data[] = array("id" => 1) will add named array data array. data = [ {"id" => 1} ] if want data named array, should add "id" => 1 this: data[1] = {"id" => 1} this result in: data = { 1 => {"id" => 1} }

cordova - Android orientation in phonegap build? -

is there anyway declare piece of code in config.xml (the android.manifest not exist in phonegap build): <activity android:name=".activity.splashscreenactivity" android:label="@string/app_name" android:screenorientation="landscape"> <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> i want force landscape @ times in app, , other declarations dont seem work...any thoughts? @totothegreat, may recall previous post: lastly, if want implement config.xml, suggest read thread ben jones' implementation . best of luck, text me back, if still having problems. is there not clear in post? needs explaining? jesse

1054 error, unknown column in where clause -

i keep getting error when column exist, can tell me why? this query: update testtable2 set testtable2.be = testtable1.`1962` testtable2.`year`= 1962 , testtable2.permno = testtable1.testcolumn and response: error code: 1054. unknown column 'testtable1.testcolumn' in 'where clause' testtable1 structure: `testcolumn` varchar(255) default null, `firstyear` varchar(255) default null, `lastyear` varchar(255) default null, `1926` varchar(255) default null, `1927` varchar(255) default null, `1928` varchar(255) default null, `1929` varchar(255) default null, `1930` varchar(255) default null, `1931` varchar(255) default null, `1932` varchar(255) default null, `1933` varchar(255) default null, `1934` varchar(255) default null, `1935` varchar(255) default null, `1936` varchar(255) default null, `1937` varchar(255) default null, `1938` varchar(255) default null, `1939` varchar(255) default null, `1940` varchar(255) default null, `1941` varchar(255) defaul

ios - substring with an array string - Swift -

i have array: var array = ["1|first", "2|second", "3|third"] how can cut off "1|", "2|", "3|"? result should this: println(newarray) //["first", "second", "third"] you can use (assuming strings contain "|" character): let newarray = array.map { $0.componentsseparatedbystring("|")[1] } as @grimxn pointed out, if cannot assume "|" character in strings, use: let newarray = array.map { $0.componentsseparatedbystring("|").last! } or let newarray2 = array.map { $0.substringfromindex(advance(find($0, "|")!, 1)) } result2 little bit faster, because doesn't create intermediate array componentsseparatedbystring . or if want modify original array: for index in 0..<array.count { array[index] = array[index].substringfromindex(advance(find(array[index], "|")!, 1)) }

Compile result for native C++ code mixed with managed code for .Net import -

i developing c++ wrapper c# project. little bit confused how end result compiled. have situation: a solution 1 projects. project common language runtime support (/clr). native cpp files configured without common language runtime support (/clr) , no precompiled headers. so questions are: why obligated have use no precompiled headers native cpp files? what end result, native code compiled machine code? or jit because use wrapper .net? native header: #pragma once #include <string> using namespace std; class person { private: string _name; public: person(string name); ~person(); string getname(); }; native cpp: #include "stdafx.h" #include "person.h" person::person(string name) { _name = name; } person::~person() { } string person::getname() { return _name; } c++ wrapper header #pragma once #include <msclr\marshal_

Do WebDriver implicit waits affect both findElement AND findElements? -

or affect findelement? example, if want test element not exist on page, want use findelement (which slow due implicit waiting), or can use findelements(..).size() == 0 (for example)? yes. implicit wait firm driver instance , instantiate driver apply findelement mechanism. explicit wait best bet in terms of waiting element since explicit wait not have influence on entire driver instance. please note implicit wait has influence on explicit waits. mixing them both never recommended. see this

ember.js - How does the ember-cli-simple-auth-token library decodes/reads the jwt? -

the ember-cli-simple-auth-token documentation specifies jwt decoded , read upon successful authentication backend. don't understand how decode token, jwt created private key not find information in docs providing required data jwt decryption process. what missing? how library decodes jwt? encoding in non-standard way? there configuration property in library specify find corresponding public key or something? thanks lot whoever reads , can help. ok went ahead , checked library's code , revised jwt specification wondering same in future, token base64 coded , decoded. im such noob.

mysql - How to import all databases sql file into phpmyadmin -

i have exported databases (localhost.sql) phpmyadmin. trying import database file (localhost.sql) using command mysql -u root -p < /localhost.sql this showing error no database selected. localhost.sql has database, dont have other backup of databases except localhost.sql file. because when export file phpmyadmin there no database name. if want it, when export click "custom" in section export method , tick "add create database / use". or add @ top of localhost.sql : create database if not exists `nameofyourdatabase` default character set latin1 collate latin1_swedish_ci; use `nameofyourdatabase`; or method use : export, drop/delete , recreate db same name import localhost.sql

Understanding SendAsync method ASP.net web API Message Handlers -

i trying implement custom message handler, below code. public class myhandler : delegatinghandler { protected override async task<httpresponsemessage> sendasync(httprequestmessage request, system.threading.cancellationtoken cancellationtoken) { /* code executes while receiving request - start */ bool isbadrequest = false; if (isbadrequest) { return request.createresponse(system.net.httpstatuscode.notfound,"test"); } /* code executes while receiving request - end */ /* code executes while sending response - start */ var response = await base.sendasync(request , cancellationtoken); response.headers.add("new header", "new header value"); return response; /* code executes while sending response - end */ } } i aware of tasks , async/await in c#. unable understand how same method gets executed both while receiving request , se

javascript - Unnatural move for navigation menu -

i have problem navigation bar because using script fix position on top of site. base position navigation bar isn't on top, configured jump top if user scrolls website down. jump top unnatural , need make better that. want make behave more natural. my scripts: css: #menu { text-align: center; height: 65px; width: 100%; z-index: 9999; position: fixed; // here tried replace "relative" after change script dont work. background-color: #0f1113; border-bottom-width: 4px; border-bottom-style: solid; border-bottom-color: #63842d; } .f-nav { // if change upper css position relative tried used here position: fixed or relative still dont work. top:0; -webkit-transition: height 0.3s; -moz-transition: height 0.3s; transition: height 0.3s; } javascript: $("document").ready(function($){ var nav = $('#menu'); $(window).scroll(function () { if ($(this).scrolltop() > 125) {

vim - How to use ctags to generate tags for non-standard python packages? -

i use pip manage python packages, , of these packages located in /usr/lib/python2.7/dist-packages . run command ctags -r -o ~/codes/python/pytags /usr/lib/python2.7/dist-packages generate tags python packages, , add set tags=./tags,~/codes/python/pytags in vimrc file, when run :ptag numpy in vim, still shows "tag not found", know what's wrong it?

php - laravel 5 Library for load CSS, JavaScript -

i want include css , javascript of laravel 5 helper. don't know there. href="{{ url() }}/assets/css/bootstrap.css" rel="stylesheet" i need load helper of laravel. not traditional. please suggestion tell me. in laravel can use provided html class including css , js in project stylesheet: {{ html::style('css/style.css') }} javascript: {{ html::script('js/your_js_file.js') }} note: you can use url class js {{ url::asset('js/your_js_file.js'); }} style {{ url::asset('css/style.css'); }} edit: if using laravel 5 find solution here http://laravel.io/forum/09-20-2014-html-form-class-not-found-in-laravel-5

php - How to add phone number in quickbook vendor? -

i unable add primaryphone, alternativephone, primaryemailaddr, webaddr and, billaddr in vendor. thing wrong pass value vendor api? please me how pass value. $dataservice = quickbookconnection::createqbconnection(); $servicetype = intuitservicestype::qbo; $vendobj = new ippvendor(); $vendobj->synctoken = $venddata['contactid']; $vendobj->givenname = $venddata['fname']; $vendobj->familyname = $venddata['lname']; $vendobj->displayname = $venddata['cname']; $vendobj->companyname = $venddata['cname']; $vendobj->primaryphone = $venddata['phone']; $vendobj->alternatephone = $venddata['altphone']; $vendobj->primaryemailaddr = $venddata['email']; $vendobj->webaddr = $venddata['web']; $vendobj->billaddr = $venddata['address'] ." ". $venddata['cit

Cannot connect to SFP sever using key file with JSch and Java 8 -

i trying connect sftp server using 2048 bit rsa key file. works fine running against version 7r45 of jre using jsch follow exception when running against version 8r31 of jre. com.jcraft.jsch.jschexception: session.connect: java.security.invalidalgorithmparameterexception: prime size must multiple of 64, , can range 512 2048 (inclusive). it's not issue limited java security policy have tried , without unlimited strength jars both versions of java. i have seen other references exception suggesting replacing default java jce provider bouncycastle one, why there difference between java 7 , java 8? did try running security.addprovider(new bouncycastleprovider()); @ program start doesn't seem make difference. the problem in our case seems fixed/worked around removing diffie-hellman-group-exchange-sha1 before calling session.connect() string kex = session.getconfig("kex"); system.out.println("old kex:" + kex); kex = kex.replace(",diffie-

python - np.linalg.solve is not giving correct result -

i tried parameterize arbitrary t vector given bases ss function linalg.solve : t = np.array([0.4, 0., 0., 0., 0., 0., 0., 0.3, 0., 0., 0., 0., 0.2, 0., 0., 0.1]) ss = np.array([[1., 0., 0., 0., 0., 0., 0., 1., 0., 0., 0., 0., 1., 0., 0., 1.], [0., 1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 1., 0., 0.], [0., 0., -1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., -1., 0.], [1., 0., 0., 0., 0., 0., 0., -1., 0., 0., -0., 0., 1., 0., 0., -1.], [0., 0., 0., 1., 0., 0., 0., 0., 0., 0., 1., 0., 0., 0., 0., 0.], [0., 0., 0., 0., 0., 1., 0., 0., 1., 0., 0., 0., 0., 0., 0., 0.], [0., 0., 0., 0., 0., 0., -1., 0., 0., 1., 0., 0., 0., 0., 0., 0.], [0., 0., 0., 1., 0., 0., 0., -0., 0., 0., -1., 0., 0., 0., 0., -0.], [0., 0., 0., 0., -1., 0., 0., 0., 0., 0., 0., -1., 0., 0., 0., 0.],