Posts

Showing posts from April, 2011

sql - Executing Hierarchical Query showing all data -

i trying hierarchical select query in oracle can't desire out put there , don't under stand writing wrong query or there wrong data in table desire out put like i_id name mgr_id level path 1 smith 0 0 /smith 2 allen 1 1 /smith/allen 3 ward 1 1 /smith/ward 5 martin 1 1 /smith/martin 4 jones 2 2 /smith/allen/jones 7 clark 2 2 /smith/allen/clark 6 blake 3 2 /smith/ward/blake 8 scott 7 3 /smith/allen/clark/scott 9 king 7 3 /smith/allen/clark/king 10 turner 8 4 /smith/allen/clark/scott/turner 12 james 8 4 /smith/allen/clark/scott/james 11 adams 10 5 /smith/allen/clark/scott/turner/adams 13 ford 11 6 /smith/allen/clark/scott/turner/adams/ford 14 miller 13 7 /smith/allen/clark/scott/turner/adams/for...

python - Youtube videos location undetected -

i'm trying download youtube videos simple self written python script using "youtube-dl.exe" i've downloaded. on running command cmd ie "c:\youtube-dl.exe https://www.youtube.com/watch?v=gkk3kloz-_y ", i'm able video extracted under c:\users\john when trying below python module, i'm unable detect video location. -----------------youtube downloader python module------------------------ #!/usr/bin/python -tt import os import sys def main(): link = raw_input("please enter youtube link wish download\n") link = "https://" + link result = os.system("c:\youtube-dl.exe %s"%(link)) if result == 0: print "the youtube video got downloaded , stored under c:\users\john folder" else: print "sorry! video couldn't downloaded" if __name__ == '__main__': main() can somehow know videos getting downloaded. somewhere under c:\python27\ .... ?? you try pri...

Getting IO exception when running Linux command in Java -

i'm writing java app in windows connect linux machine through ssh. i'm getting following exception: java.io.ioexception: cannot run program ssh: createprocess error=2, cannot find specified file. code: process p = runtime.getruntime().exec("ssh root@xxx.xxx.xxx.xxx ls"); while running command in cmd working, not through java. ssh in path environmental vars. you need interpreter understand ssh command: process p = runtime.getruntime().exec(new string[]{"cmd", "ssh root@xxx.xxx.xxx.xxx ls"});

html - How to disable <br type="_moz" in contentEditable div in firefox -

firefox automatically inserts <br type="_moz"> in contenteditable divs on press of enter key. adds <br> automatically when insert element through document.execcommand. this behavior not present in other browsers. how prevent happening in firefox. if using jquery, can try add onchange="$(this).children('br[type=\"_moz\"]').remove();" on div. destroy childrens of div type='_moz' @ anytime.

sql - Extracting query-history in SAP HANA -

i have been using sap hana db instance, , have been running several queries on this. need extract query-history, preferably system-table or elsewhere. please let me know if possible , pointers achieve it, if possible. if want detailed history of executed queries, need activate hana sql trace. can find more information in hana documentation . of course, not work retrospectively. have activate trace first , then run queries want at. additionally, sql plan cache provides aggregated information past queries. aggregated prepared statements , provides runtime information average execution time , result size. monitoring view sys.m_sql_plan_cache .

Difference between pointer events binding in jQuery and plain Javascript -

i've been trying understand how different pointer events (touch, mouse) fired in various browsers/on various devices. on purposed have written tiny webpage testing events http://tstr.29pixels.net . a few weeks later i've run mozilla's event listener test page @ http://mozilla.github.io/mozhacks/touch-events/event-listener.html , produced different results (i saw events fired wasn't showing in original test tool). both websites use different style of binding events, i'd love know, difference in binding events? for example, pick tablet / smartphone chrome , try clicking button on web. in cases 2 events fired - touchstart , touchend (with occasional touchmove). try mozilla's tool. there more (even including click). my binding: $("#button").on('mouseenter mouseleave ... mousemove click', function(e){ ... } mozilla binding: var events = ['mspointerdown', 'mspointerup', ... , 'mspointercancel']; var b ...

How to taken value in event rowEditing of gridview on asp.net -

code protected void grv_rowediting(object sender, gridviewediteventargs e) { string name = (grv.rows[e.neweditindex].cells[1].controls[0] textbox).text; } or string name grv.rows[e.neweditindex].cells[1].value.tostring(); //not work. you need databind gridview again able access control in edititemtemplate . try this: gridview1.editindex = e.neweditindex; gridview1.datasource = somedatasource; //bind grid find control gridview1.databind(); textbox txt= gridview1.rows[e.neweditindex].findcontrol("textboxid") textbox; string name = txt.text

if statement - R - check whole vector in if clause -

here little example: foo <- 1:5 foo < 6 > true true true true true if(foo < 6) { # if(foo[1]<6 & foo[2]<6 & foo[3]<6 ... # } and need if-claus if 3 elements true (order not important), e.g. bar <- c(1,3,6,8,2) if(bar < 5) { # if 3 values true # } thx help. you looking all() . > all(foo < 6) [1] true and second part, do if (sum(bar < 5) == 3) {} this works because logical vector coerce numeric 0 , 1.

vb.net - How to login to webpage via Visual Basic console application -

i've been tasked @ work make our company's software auto-login webpage can send get-requests without webbrowser or vs form my company's software runs on industrial machine whole thing has run automatically within visual studio. far answers topic involve kind of browser, why wanted ask guys: how cookie , do it? how submit un , pw (codewise) j_security part of webpage , using parameters? the site ends in login.jsp or j_security.jsp. have been told send request cookie first , send username , pw via post. i've started programming in vb literally 2 weeks ago , appreciate help! :) hi please follow url. demostrate auto login process click here example you might need change element name username , password. go login page --> view pages source --> go username , replace "txtusername" in code. same process password. hope help. nishit

java - Multiple thread to print numbers -

i'm student trying learn java. want print employee id 1 100 using 3 threads. used code shown below. my main class: public class mainthread { public static void main(string[] args) { printthread pr = new printthread(); thread t1 = new thread(pr); thread t2 = new thread(pr); thread t3 = new thread(pr); t1.start(); t2.start(); t3.start(); } } public class printthread extends thread { private final object sync = new object(); public void run() { synchronized (sync) { (int = 1; <= 101; i++) { system.out.println("employee id : " + i); try { thread.sleep(100); } catch (interruptedexception e) { e.printstacktrace(); } } } } } i'm getting output 1....100 printed thread 1 again thread 2 , thread 3. but intended output thread 1 printing one,...

java - new ClassPathXmlApplicationContext() creating new set of beans -

does loading application context in following manner mean creating context apart context created contextloader? i require application context loaded non-bean class. private static applicationcontext applicationcontext = new classpathxmlapplicationcontext( "channel-integration-context.xml"); it seems creates bean context according observation. if better workaround. please help. unless special reason, there's no point of creating multiple applicationcontext s. you can create singleton: public class applicationcontextwrapper { private static applicationcontext instance = null; private applicationcontextwrapper() { } public static applicationcontext getintance() { if (instance == null) { //note can add more spring xml configuration filenames in array string[] contexts = new string[] {"channel-integration-context.xml"}; instance = new classpathapplicationcontext(contex...

android - Latest Volley Version haven't setShouldCache method? -

i need petition volley, nowadays version of volley 1.0.9 doesn't have method request.setshouldcache(false); cancel cache. i've tried volley+ (a fork of volley) doesn't have too. what can cancel cache? need cancel in order make login petition each time. in latest versions method disappear, can use: volley_queue.getcache().clear(); to clear cache.

python - Django failed to insert record into session after login -

django failed insert record session after login message: -------------------------------------------------------------------- databaseerror @ /admin/ (-2147352567, 'exception occurred.', (0, u'microsoft ole db provider sql server', u'conversion failed when converting date and/or time character string.', none, 0, -2147217913), none) command: insert [django_session] ([session_key], [session_data], [expire_date]) values (?, ?, ?) parameters: [name: p0, dir.: input, type: adbstr, size: 32, value: "orctnepzkaqb4haa6tn7jjit961a4l3s", precision: 0, numericscale: 0, name: p1, dir.: input, type: adbstr, size: 60, value: "m2fimtm4ngjmnjy4ndc2yja0y2i1zji4ndcxyznlntexytljodyxmtp7fq==", precision: 0, numericscale: 0, name: p2, dir.: input, type: adbstr, size: 26, value: "2014-12-30t12:38:53.076000", precision: 0, numericscale: 0] -------------------------------------------------------------------- if @ date of 2014-12-30t12: 38: 53.07600...

java - How to create framework.odex in android -

i'm trying make changes in android os downloaded aosp, make changes , build it. now want replace framework.jar , framework2.jar on device (nexus 5, 4.4.4) see "odex" device - means - have framework.odex , frameork2.odex . can me , explain me how create 2 files? google found how odex apk , not framework. thank guys! why don't try flash images device ? need build complete aosp source code , flash device below commands : adb reboot bootloader img_path="./out/target/product/grouper"; # erase userdata fastboot -w echo flashing system .. fastboot flash system $img_path/system.img echo flashig boot ... fastboot flash boot $img_path/boot.img echo flashin recovery .. fastboot flash recovery $img_path/recovery.img echo rebooting device ... fastboot reboot the way trying, framework.jar might having different signature system signature.

Store android preference in clean way -

how store android preference in clean way. end store user preferences in singleton class wrap sharedpreferences make painful maintain when preferences added. i end develope tiny framework store preference in android. https://github.com/caomanhdat/android-clean-preferences

c++ - Can a range-based for loop take a type argument? -

from can tell, range-based loops can take c-style array, object of type has member functions begin() , end() defined, or object of type type free functions begin(type) , end(type) can found adl. is there way make loop take type argument, code compiles? class staticvec{ //shortened implementation static myiterator begin(); static myiterator end(); }; void foo() { for(auto elem : staticvec){ dosomething(elem); } } i omit necessity of writing staticvec::values() in loop. as general solution can define template< class type > struct static_collection {}; template< class type > auto begin( static_collection<type> const& ) -> decltype( type::begin() ) { return type::begin(); } template< class type > auto end( static_collection<type> const& ) -> decltype( type::end() ) { return type::end(); } and can write e.g. auto main() -> int { for( auto elem : static_collection<static_ve...

jquery - Foundation email validation ajax -

i new zurb foundation concept , inherited work do. in form see following <div class="row"> <div class="small-12 column name-field"> <label class="show-for-medium-up">e-mail-adresse:*</label> <input type="text" id="emailaddress" name="emailaddress" value="${requestparameters.emailaddress!}" placeholder="" required pattern="email" /> <small class="error"><i class="fi-alert"></i>please provide email address.</small> </div> </div> <div class="row"> <div class="small-12 column name-field"> <label class="show-for-medium-up">repeat email address*</label> <input type="text" name="emailaddressconfirmation" value="${requestparameters.emailaddressconfirmation!}" placeholder="" pattern="email" data-equalto=...

Spring Bean Name with package detail only -

i need create bean id or name class name it's package. e.g <bean class="org.chameleon.commons.context.resolver.impl.usercontextresolver" scope="prototype" /> and want this org.chameleon.commons.context.resolver.impl.usercontextresolver but shows me this. org.chameleon.commons.context.resolver.impl.usercontextresolver@if what bean required name. you should add "id" or "name" attribute bean definition, e.g. <bean id="org.chameleon.commons.context.resolver.impl.usercontextresolver" class="org.chameleon.commons.context.resolver.impl.usercontextresolver" scope="prototype" /> as stated in spring reference doc 5.3.1 naming beans 1 in xml-based configuration metadata, you use id and/or name attributes specify bean identifier(s). id attribute allows specify 1 id. conventionally these names alphanumeric (mybean, fooservice, etc.), may contain special characters well . if wan...

jpa - NamedQuery selectively define attributes -

i have namedquery in entity class defined @namedquery(name = "emp.findall", query = " select new test.entity.emp(o.empno, o.salary, o.project) emp o ") constructor public emp(string empno, string salary, project project) { this.empno = empno; this.salary= salary; this.project = project; } and generated sql is select t0.emp_no, t0.salary, t1.project_id, t1.project_name, t1.project_desc emp t0, projects t1 (t1.project_id (+) = t0.project_id) in namedquery how selectively declare projectid , projectname instead of attributes project class? wouldn't display attributes of project class in namedquery. how can achieve this? update 1 public emp(string empno, string salary, long projectid, string projectname) { project pr = new project(); this.empno = empno; this.salary= salary; pr.setprojectid = projectid; pr.setprojectname = projectname; } try (and updat...

linux - Where i can find libopenexr.so in Ubuntu -

i want build code example depenedent on libopenexr library. so found 2 packages: wiesniak@wiesniak-precision-m4800:~/openglsb5e_build$ apt-cache search openexr ... libopenexr-dev - development files openexr image library libopenexr6 - runtime files openexr image library ... i tried install them, in system: wiesniak@wiesniak-precision-m4800:~/openglsb5e_build$ sudo apt-get install libopenexr6 libopenexr-dev ... libopenexr-dev newest version. libopenexr6 newest version. 0 upgraded, 0 newly installed, 0 remove , 0 not upgraded. i see includes in /usr/include, cannot find library cannot link project. tried found in several ways, like: wiesniak@wiesniak-precision-m4800:~/openglsb5e_build$ ldconfig -p |grep exr wiesniak@wiesniak-precision-m4800:~/openglsb5e_build$ but looks not available in system. any idea can ? should more ? how can find ? thank greg. ok found answer. i assume library name somthing like: libopenexr*.so, wrong. the correct name of librar...

javascript - String value with moment.js -

my js: ... var datetext=''; datetext = moment(scope.mtxmaxdate,'mm-dd-yyyy'); console.log(datetext); ... i want output value example: '12/12/2014' in console have: moment {_isamomentobject: true, _i: "17/12/2014", _f: "mm-dd-yyyy", _isutc: false, _pf: object…} why..? as stated in momentjs docs should use .format() function. something should : var datetext='12-12-2014'; var dateobject = moment(datetext,'mm-dd-yyyy'); console.log(dateobject.format('dd/mm/yyyy')); the format give argument on second line parse format. i updated code, fact use angular or not doesn't change thing. think not understand moment js generates object string date. can format date object want. made jsfiddle in case don't it.

jsp - Struts2 href trigger an action with parameter -

i have link in jsp this <a href="<s:url action="aurlaction" />">a variable</a> the struts2 action code public someaction extends actionsupport{ private string avariable; // avariable getters , setters public execute(){ dosomething(avariable); } } strtus2 mapping <action name="aurlaction" class="***.someaction"> <result>....</result> </action> how can pass in avariable clicking <a> tag. want pass in text between <a></a> action. thanks. you can pass parameter : <s:url var="test" action="aurlaction"> <s:param name="avariable">value</s:param> </s:url> <a href="${test}">test</a>

Jenkins: Send email to recipients of the triggered job -

i have 2 jenkins jobs. 1 trigger other using "parameterized trigger plugin". in case of failure, second build should send email using "email-ext plugin". the email should send second job recipients list of first. i've tried using parameters, failed. the latest version of email-ext plugin has upstream committers option. try updating.

c# - Crystal Reports Graph image not displaying -

i'm running iis 8.5 on windows 2012 r2 using crystal reports vs2010 service pack 9. no matter cannot image display in viewer... other elements of report fine. i've tried adding handler seemingly has no effect: <add verb="get" path="crystalimagehandler.aspx" type="crystaldecisions.web.crystalimagehandler, crystaldecisions.web,version=13.0.2000.0, culture=neutral, publickeytoken=692fbea5521e1304"/> the site / app pool running under local account , account has full permission c:/windows/temp - network service. furthermore can see graph image created in c:/windows/temp .... blooming viewer not display it. the site running virtual directory, parent site has aspnet_client setup virtual directory - why viewer button images etc displayed correctly. p.s. fiddler4 giving status code of 302 (found?) image too! any ideas? i'm bit stumped on one. the issue twofold... crystalimagehandler.aspx not being assigned, , routing i...

c# - Open excel file using object model as different user -

i have excel file i'm trying open using excel object model (interop) c#. want open different user 1 logged in. like: workbook workbook = excelapp.workbooks.openas(targetpath, username, password); any ideas on how (and if) can done?

how to draw lines over words found in a word search matrix in python -

i trying draw lines on words have been found in word search matrix in python. have puts dot on words not used. prefer draw lines in actual word search game. import sys def search(grid, rc, word,path): if word == "": return path if rc not in grid.keys() or rc in path or word[0] not in [grid[rc]]: return[] return [p r in [-1,0,1] c in [-1,0,1] p in search(grid, (rc[0]+r, rc[1]+c), word[1:], [rc]+path)] grid = dict ([((row,col), ch) row, line in enumerate(a) col, ch in enumerate(line)]) #print(grid) mark = [path word in word_list rc in grid.keys() path in search(grid,rc,word,[])] print "\n".join([" ".join([ch if (row, col) in mark else '.' col,ch in enumerate(line)]) row,line in enumerate(a)]) where 15 15 matrix of words , word_list list of words found.

Maintaning the state of checkbox on scroll in android -

what doing: i trying have checkbox in listview , trying main state onscroll i tried having boolean array state, couldnt achieve it....so ihave come model class adptsearchfiltercategories .java public class adptsearchfiltercategories extends baseadapter { private context context; list<modelfiltercategories> mdllst; public adptsearchfiltercategories(context context, list<modelfiltercategories> mdllst) { this.context = context; this.mdllst = mdllst; } @override public int getcount() { return mdllst.size(); } @override public object getitem(int position) { return mdllst.get(position); } @override public long getitemid(int position) { return position; } static class viewholder { protected checkbox chkbxcatid; } @override public view getview(int position, view convertview, viewgroup parent) { final modelfiltercategories...

c++ - Writing a template function that evaluates a lambda function with any return type? -

i want write 'evaluation' function takes input function of unspecified return type takes integer, , integer call function with. what i've come following: #include <functional> template<typename t> t eval(function<t(int)> f, int x) { return f(x); } let's have auto func = [] (int x) -> long { return (long)x * x; } want evaluate using above function. way used template functions before call other function , let compiler deduce type. however, doesn't work eval function. eval<long>(func, 5) compiles , works fine, eval(func, 5) not: aufgaben10.5.cpp:23:25: error: no matching function call 'eval(main()::__lambda0&, int)' cout << eval(func, 5) << endl; ^ aufgaben10.5.cpp:23:25: note: candidate is: aufgaben10.5.cpp:8:3: note: template<class t> t eval(std::function<t(int)>, int) t eval(function<t(int)> f, int x) { ^ aufgaben10.5.cpp:8:3: note: template...

boost - fixed by workaround: c++ : boost_log : how does compiler choose st or mt -

my env: solaris 5.10 gcc 4.8.2 boost 1.54 codes: #include <boost/log/core.hpp> #include <boost/log/trivial.hpp> #include <boost/log/expressions.hpp> int main() { boost_log_trivial(fatal) << "init " << filename << std::endl; return 0; } compiles options , issue: -bash-3.2$ g++ x.cc -lboost_log -lsocket -lnsl -o x undefined first referenced symbol in file boost::log::v2s_st::aux::stream_provider<char>::allocate_compound(boost::log::v2s_st::record&) /var/tmp//ccpkqk2f.o boost::log::v2s_st::aux::unhandled_exception_count() /var/tmp//ccpkqk2f.o boost::log::v2s_st::record_view::public_data::destroy(boost::log::v2s_st::record_view::public_data const*) /var/tmp//ccpkqk2f.o boost::log::v2s_st::core::open_record(boost::log::v2s_st::attribute_set const&) /var/tmp//ccpkqk2f.o boost::log::v2s_st::trivial::logger::get() /var/tmp//ccpkqk2f.o boost::log::v2s_st...

linux - cross-compile error with opencv -

root@pyimagesearch:~/practicecode/helloworld# cmake -dcmake_toolchain_file=toolchain.arm.cmake . -- c compiler identification gnu -- cxx compiler identification gnu -- check working c compiler: /usr/bin/arm-linux-gnueabi-gcc -- check working c compiler: /usr/bin/arm-linux-gnueabi-gcc -- works -- detecting c compiler abi info -- detecting c compiler abi info - done -- check working cxx compiler: /usr/bin/arm-linux-gnueabi-g++ -- check working cxx compiler: /usr/bin/arm-linux-gnueabi-g++ -- works -- detecting cxx compiler abi info -- detecting cxx compiler abi info - done -- configuring done -- generating done -- build files have been written to: /root/practicecode/helloworld root@pyimagesearch:~/practicecode/helloworld# make scanning dependencies of target helloworld [100%] building cxx object cmakefiles/helloworld.dir/main.cpp.o linking cxx executable helloworld /usr/local/lib/libopencv_videostab.so.2.4.8: file not recognized: file format not recognized collect2: ld returned 1 exit...

c++ - STL Map with structure -

i have structure: struct tuple{int node; float cost}; std::map<int,std::set<tuple>> graph; i'd know how change comparison operator map container not insert key repeated value example: ex.: insert(1, {2,3}) insert(1, {2,4}) // not allowed insert(1, {4,3}) // allowed the containers used implement graph whenever node in node adjacency, can no longer inserted in adjacency. thanks. you can't this. key of map int , there no way make @ tuple well. maybe replace map std::set<std::pair<int, std::set<tuple>>, cmp> cmp is struct cmp { using value_type = std::pair<int, std::set<tuple>>; bool operator()(const value_type& l, const value_type& r) const { if (l.first < r.first) return true; if (l.first > r.first) return false; return l.second < r.second; } }; this works because std::set can examine part of value_type determine ordering of elements, whereas std::map can...

c++ - Getting derived class from base method -

i have 3 classes entity , character , item . when character * player = new character(qrectf(0, 0, 50, 50), "player", thescene); player->setvelocityx(30)->setattackpoint(10); the compiler tells error: 'class entity' has no member named 'setattackpoint' . how can make entity* setvelocityx(qreal vx); return character pointer or item pointer? . class entity : public qobject, public qgraphicspolygonitem { q_object public: entity(); entity(qreal x, qreal y, qreal w, qreal h, qstring tag, qgraphicsscene *scene = 0, qgraphicsitem *parent = 0); entity(qrectf position, qstring tag, qgraphicsscene *scene = 0, qgraphicsitem *parent = 0); entity(qstring tag, qgraphicsscene *scene = 0, qgraphicsitem *parent = 0); entity* setvelocityx(qreal vx); // etc } class character : public entity { q_object public: character(qreal x, qreal y, qreal w, qreal h, qstring tag, qgraphicsscene ...

iphone - iOS - DetailViewController not displaying multiple entries/values from JSON -

Image
i'm creating simple ipad app detailviewcontroller. works great, when try use multiple level json, doesn't work anymore app crashes. i retrieve , loop through data: -(void) retrievedata{ nsurl * url = [nsurl urlwithstring:getdataurl]; nsdata * data = [nsdata datawithcontentsofurl:url]; jsonarray = [nsjsonserialization jsonobjectwithdata:data options:kniloptions error:nil]; fruitarray = [[nsmutablearray alloc] init]; //loop through jsonarray for(int =0;i < jsonarray.count;i++){ nsstring * cname = [[jsonarray objectatindex:i] valueforkey:@"cityname"]; nsstring * cfruit = [[jsonarray objectatindex:i] valueforkey:@"fruit"]; //add object fruitarray array [fruitarray addobject:[[fruits alloc]initwithcitydocumentname:cname andfruit:cfruit]]; } //reload table view [self.tableview reloaddata]; } using json: [{ "id": "1", "cityname": "lon...

python - Sklearn.KMeans() : Get class centroid labels and reference to a dataset -

Image
sci-kit learn kmeans , pca dimensionality reduction i have dataset, 2m rows 7 columns, different measurements of home power consumption date each measurement. date, global_active_power, global_reactive_power, voltage, global_intensity, sub_metering_1, sub_metering_2, sub_metering_3 i put dataset pandas dataframe, selecting columns date column, perform cross validation split. import pandas pd sklearn.cross_validation import train_test_split data = pd.read_csv('household_power_consumption.txt', delimiter=';') power_consumption = data.iloc[0:, 2:9].dropna() pc_toarray = power_consumption.values hpc_fit, hpc_fit1 = train_test_split(pc_toarray, train_size=.01) power_consumption.head() i use k-means classification followed pca dimensionality reduction display. from sklearn.cluster import kmeans import matplotlib.pyplot plt import numpy np sklearn.decomposition import pca hpc = pca(n_components=2).fit_transform(hpc_fit) k_means = kmeans() k_means.f...

javascript - Unable to get div value for voting system -

when click on #upvote #vote increases 1 , when #downvote clicked decreases 1. when vote value "-1" , if upvote clicked vote value becomes "1" , not "0". <script type="application/javascript"> $(document).ready(function (){ $('#upvote').click(function() { var votevalue = $('#vote').val(); $('#vote').text(votevalue+1); }); $('#downvote').click(function() { var votevalue1 = $('#vote').val(); $('#vote').text(votevalue1-1); }); }); </script> <div id="upvote" style="font-size:22px;">+</div> <div id="vote" style="font-size:22px;">0</div> <div id="downvote" style="font-size:22px;">-</div> any idea might wrong. try parseint() $(document).ready(function (){ $('#upvote').click(function() { var votevalue = $(...

html - Positioning divs in a circle using JavaScript -

Image
i trying position 15 div elements evenly in circle radius of 150px . i'm using following code, seems give oddly eccentric ellipse overlaps. fiddle // hold global reference div#main element. assign ... somewhere useful :) var main = document.getelementbyid('main'); var circlearray = []; // move circle based on distance of approaching mouse var movecircle = function(circle, dx, dy) { }; // @ circle elements, , figure out if of them have move. var checkmove = function() { }; var setup = function() { (var = 0; < 15; i++) { //create element, add array, , assign it's coordinates trigonometrically. //then add "main" div var circle = document.createelement('div'); circle.classname = 'circle number' + i; circlearray.push(circle); circlearray[i].posx = math.round((150 * math.cos(i * (2 * math.pi / 15)))) + 'px'; circlearray[i].posy = math.round((150 * math.sin(i * (2 * math.p...

Checking size of stack (ArrayList) in Java? -

i'm trying implement stack array list. bluej tells me "size" has private access in java.util.arraylist though array list public, when i'm compiling. int stacklength = stackstorage.size; system.out.println(+stacklength); and if change line to.. int stacklength = stackstorage.size(); the program compiles , nullpointerexcetion when run function. i don't understand why happening because value cannot manually assigned because value needs come stack size. any appreciated, cheers. you can't directly call variable (because it's private field) . should use stackstorage.size() instead. make sure stackstorage instantiated. you have: arraylist<object> stackstorage; however must instantiate somewhere so: stackstorage = new arraylist<object>(); this may done on same line: arraylist<object> stackstorage = new arraylist<object>(); once have created arraylist note still doesn't have elements in it. in o...

jquery - How to delete graph on click -

here highchart custom button code want close graph on click of custom button. exporting: { buttons: { custombutton: { x: -62, onclick: function () { alert("i want delete graph here"); }, symbol: 'circle' } } } js fiddle in documentation, there method destroy() jsfiddle example : http://api.highcharts.com/highcharts#chart.destroy working jsfiddle exporting: { buttons: { custombutton: { x: -62, onclick: function () { chart.destroy(); }, symbol: 'circle' } } }