Posts

jquery - Select specific radio buttons in all groups with no selected checkboxes -

i need to: get radio groups no option selected from groups inputs "data-correctanswer" is there better way of doing 1 have? (it's working) jsfiddle (need select a , h only ) html: <form class="multiform truefalse"> <ul> <li> <input data-correctanswer="correct" name="question1" type="radio"><span>a</span> </li> <li> <input name="question1" type="radio"><span>b</span> </li> </ul> <ul> <li> <input name="question2" type="radio" checked="checked"><span>c</span> </li> <li> <input data-correctanswer="correct" name="question2" type="radio"><span>d</span> </li> </ul> ...

java - Using a Dynamic path for a csv file -

i have program saves on file. current code set file save on specific path, when run program different computer program doesn't work , need change path everytime. public createcustomer() { initcomponents(); arraylist<string> considlist = new arraylist<string>(); string csvfiletoread = "e:\\ryan_assignment_sit2\\consid\\consid.csv"; // reads csv file. bufferedreader br = null; // creates buffer reader. string line = ""; string splitby = ","; // reader delimiter try { br = new bufferedreader(new filereader(csvfiletoread)); // buffer reader file name read. scanner reader = new scanner(system.in); while ((line = br.readline()) != null) { //while there line read. reader = new scanner(line); reader.usedelimiter(splitby); while (reader.hasnext()) { // while there next value (token). considlist.add(reader.next()); } ...

python - numpy nonzero() returns indexes sorted by row index? -

as in matlab, nonzeros return indexes ordered columns( http://www.mathworks.com/help/matlab/ref/nonzeros.html ). in numpy, seems returned indexes ordered rows (for 2d matrix). not articulated in doc ( http://docs.scipy.org/doc/numpy/reference/generated/numpy.nonzero.html ). safe assume that? an example: test = np.array([[0,2], [3,0]]) test[test.nonzero()] gives array([2, 3]) instead of array([3, 2]) there following comment on c source code of pyarray_nonzero , c function handles calls nonzero : /*numpy_api * nonzero * * todo: in numpy 2.0, should make iteration order parameter. */ npy_no_export pyobject * pyarray_nonzero(pyarrayobject *self) the iteration order is hardcoded c-order , i.e. last index varies fastest, i.e. sorted rows, columns, 2d case. given comment, safe assume that, if ever changes, providing new functionality defaults current behavior.

g++ - Is operator void*() conversion still part of C++ library? -

consider program: #include <iostream> int main() { delete std::cout; } afaik conversion function operator void* () const has been removed c++11. so, program should fail in compilation on c++11 compiler. ya, true both g++ 4.8.1 & 4.9.2 gives diagnosis (in form of warning deleting void* undefined & that's thing). shouldn't program fail in compilation because removal of conversion function due stream object implicitly converted void* in c++98 & c++03?. bug? seems bit surprising still not have implemented change. i've tried program in g++ 4.9.2(that supports c++14) gives warning not compiler error. ideone compiler gives me error expected. (see live demo here ) it has nothing compiler, library issue. libstdc++ has lots of incompatibilities c++11, of one. making breaking changes in 5 , though iirc. in short, it's neither bug nor compiler issue.

What is the equivalent of the following Python list comprehension in Fortran? -

i trying write following list comprehension(written in python) in fortran. lit = [[x,y] x in [p,q,r] y in [h,k,l] if [x,y]!=[a,b]] where a, b, p ,q ,r, h, k, l integers how can achieve if want fill columns first in 2d fortran array? the python code returns list. equivalent to for x in [p,q,r]: y in [h,k,l]: if [x,y]!=[a,b]: list.append([x,y]) i made 2 sublists in fortran. sublist_x , sublist_y each list contains p,q,r , h,k,l respectively. integer :: list(0:7), sublist_x(0:2),sublist_y(0:2), count count =-1 i=0,7 if (i%3 ==0) count = count +1 endif list(0,i)=sublist_x(i%3) list(1,i)=sublist_y(count%3) enddo i think complex way of doing things... if understand correctly want cartesian product of 2 little lists, excluding element [a,b] ? if misunderstand, stop reading now. here's little program want ... program test implicit none integer, dimension(:), allocatable :: listx, listy, bad_element i...

How to iterate over this Json data in rails? -

i'm trying iterate on json data want items out of "data tried doing @response =httparty.get(("http://ddragon.leagueoflegends.com/cdn/5.15.1/data/en_us/item.json")) puts @response["data"].each |item| puts item end also want able iterate them without having know ids prior example first item "1001" don't want have enter manually but says can't find '[]' nil:nilclass before mentions json below doesn't finish because took sample there lot more items , if paste , on 1000 lines. "type":"item", "version":"5.15.1", "basic":{}, "data":{ "1001":{ "name":"boots of speed", "group":"bootsnormal", "description":"<grouplimit>limited 1.</grouplimit><br><br> <unique>unique pa...

c++ - Using += operator with float values -

i'm trying implement operator function solve next error : error: assignment of member 'animal::weight' in read-only object weight +=amount*(0.02f); my animal.cpp function looks like: void animal::feed(float amount) const { if (type == "sheep"){ amount=amount*(0.02f); weight+=amount; }else if (type == "cow"){ weight +=amount*(0.05f); }else if (type == "pig"){ weight +=amount*(0.1f); } return weight; } animal.h (short version): class animal { public: animal(std::string atype, const char *ansex, float aweight, qdatetime birthday); float getweight() const {return weight;}; void setweight(float value) {weight = value;}; float feed(float amount) const; void feedanimal(float amount); private: float weight; }; float operator+=(const float &weight,const float &amount); then implemented += operator. float operat...