Posts

Showing posts from July, 2014

html - Flexbox does not vertically align -

i need vertically aligning following table. can not understand reason why doesn't vertically align. html: <table> <tr> <td>lorem ipsum</td> <td>lorem ipsum</td> </tr> <tr> <td>lorem ipsum</td> <td>lorem ipsum</td> </tr> </table> css: body { display: flex; justify-content: center; align-items: center; } fiddle you can fix style: body, html { height: 100%; } without this, body's height takes enough space hold content. fiddle

java - Track visitors in play framework 2 application,caching and saving to DB -

what want accomplish sane way of storing list of pages visited during each anonymous user session on website. important sequence correct , 1 users navigation not mixed ones. it similar c# question: " track visitor info on every request ", proposed use logfile short-term storage. site host ~2k users/day think fine having cache in memory (atleast seems easier). i cant seem figure out solution work stateless play framework since solution requires saving data(to db) when user has timed out , not active anymore. idea rely on storing each request in memory , call database if new request hasnt arrived in time (user timeout). how possible that? is there other way think might better, perhaps storing requests users , making big write db instead of 1 each session? edit: i have taken easy way out, have been great salem mentioned cant figure out how save list memory. first plan use akka scheduler altered (timer reset , new post added) each time user gets new page dont know h

gnu - Building Emacs from git master complains errors in configure.ac -

when try build emacs https://github.com/emacs-mirror/emacs @ 4f54f7b using ./autogen.sh errors as checking whether have necessary tools... (read install.repo more details on building emacs) checking autoconf (need @ least version 2.65)... ok checking automake (need @ least version 1.11)... ok system has required tools. running 'autoreconf -fi -i m4' ... configure.ac:54: error: possibly undefined macro: as_echo if token , others legitimate, please use m4_pattern_allow. see autoconf documentation. configure.ac:95: error: possibly undefined macro: am_init_automake configure.ac:245: error: possibly undefined macro: ac_define configure.ac:752: error: possibly undefined macro: am_prog_cc_c_o configure.ac:763: error: possibly undefined macro: am_conditional configure.ac:1020: error: possibly undefined macro: am_subst_notmake configure.ac:1471: error: possibly undefined macro: m4_default autoreconf: /usr/bin/autoconf failed exit status: 1 i've tried common t

c# - Why some directories i can't drag and drop on listBox1? -

this path of folder images inside i'm trying drag , drop listbox1: c:\users\chocolade1972\appdata\local\mws\my weather station\images but if drag folder in c:\ example c:\images drag fine listbox1. when drag user...directory see black symbol can't drop in. private void listbox1_dragdrop(object sender, drageventargs e) { if (e.data.getdatapresent(dataformats.filedrop)) { string[] files = (string[])e.data.getdata(dataformats.filedrop); label6.text = files.length.tostring(); filescount = files.length-1; beginconvertiontoolstripmenuitem.enabled = true; (int = 0; < files.length; i++) { fileinfo fi = new fileinfo(files[i]); if (listbox1.items.contains(fi.fullname)) { } else { string directoryname = fi.directoryna

javascript - Check if user exists and store his data with Firebase+Angular+Facebook -

i have facebook signup method , want check if user persists in firebase. if is, i'd set data $rootscope.loggedinuser share across controllers. here's implementation of idea. problem — no data written firebase no redirection performed. seems miss obvious. ideas? firebase v2.0.4 angularfire 0.9.0 angular 1.2.20 $scope.loginfacebook = function() { $scope.auth.$authwithoauthpopup("facebook") .then(function(authdata) { var userid = authdata.uid function checkifuserexists(userid) { (new firebase(users)).child(authdata.uid).once('value', function(snapshot) { var exists = (snapshot.val() !== null); userexistscallback(userid, exists); }); } function userexistscallback(exists) { if (exists) { var loggedinuser = $firebase(new firebase(users).child(authdata.uid)).$asobject(); loggedinuser.$l

c++ - Finding and replacing lines from a cpp file -

i trying create program finds multiple lines in file continuously have // , replace them /* * * */ . single lines // left is. following example code gives idea of trying perform. example-original.cpp #include <iostream> using namespace std; //to replaced //to replaced //to replaced //to replaced blah blah blah ... ... int main() { ... ... //to replaced //to replaced } //to left return 0; } wantedoutput.cpp #include <iostream> using namespace std; /* replaced *replaced *replaced *replaced */ blah blah blah ... ... int main() { ... ... /*replaced *replaced */ } //to left return 0; } i have created program changes first time multiple line comments occur not work other multiple line comments follow them. output stored in "xyz.tmp". file modified provided command line argument. first, have obtained line numbers contains // , stored in array. from example, array `startcom[]={4,7,16,17}'. line number o

c++ - Metafunction for expressing "dominance" of one sequence over another -

i'm seeking single meta-function (such std::less_equal ) can used or combined in order express dominance relationship, defined follows. sequence dominates sequence b (both of having equal length) if: each element of not less corresponding element b at least 1 element of greater corresponding element of b so far best have been able come consists of 2 separate tests 1 after other follows. template<typename t> bool dominates( t& sequence1 , t& sequence2 ) { if( std::equal( sequence1.begin() , sequence1.end() , sequence2.begin() ) ) return false; return std::equal( sequence1.begin() , sequence1.end() , sequence2.begin() , std::less_equal<double>() ); } is possible same using single metafunction? the problem one-pass code have keep state - have remember whether encountered dominating element or not. writing simple for loop give advantage of short-circuiting when know result false . if want one-liner, here go: template<typenam

Reading (and parsing) different types of input from console using a single function in C# -

i want write generic function reads , parses different kinds of input. i have take multiple inputs user , datatypes of theses inputs different. want make function ideally should following: takes datatype argument. let x do x.tryparse(console.readline()) , return output can please suggest me way in c#. public static t convertto<t>(object value) { try { return (t)convert.changetype(value, typeof(t)); } catch(exception ex) { return (t)(typeof(t).isvaluetype ? activator.createinstance(typeof(t)) : null); } } static void main(string[] args) { console.write("enter int: "); int = convertto<int>(console.readline()); console.write("enter decimal: "); decimal b = convertto<decimal>(console.readline()); console.write("enter double: "); double c = convertto<double>(console.readlin

web services - Login in android with credentials -

this question has answer here: how concatenate 2 strings in java? 19 answers i working on chat application in have set login id password credentials edittext , according responce , have go further screens. when using credentials statically, getting response webservice string url="http://tokerapp.com/ws/get_login.php?username=rc&password=rahul"; try { string res=customhttpclient.executehttpget(url); log.e("$$$$$$$$",res); but when taking credentials edittexts, giving me proper response. tvlogin = (edittext)findviewbyid(r.id.editusername); tvpass = (edittext)findviewbyid(r.id.editpassword); btnlogin = (button)findviewbyid(r.id.btnlogin); btnlogin.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { st

actionscript 3 - Hit test with line -

so i'm making platformer style game , trying make hit test line if makes sense. right have object moves around , whenever you're moving right, if lower right or upper right side hit world stop moving. same thing set left. works if "world" movieclip small , doesn't hit of points can go right through it. need make solid line between points , have hittest that? else if (keyisdown(keyboard.right)) { //dude.gotoandstop("right"); //obj.scalex = 1; (i = 0; i<speedx; i++) { obj.x++; dude.ball.rotation++; if (status == "ground") { dude.height+= 0.05; dude.width += 0.05; } if (world.hittestpoint(obj.x + obj.width/8 - obj.width/2, obj.y - obj.height/4,true) || world.hittestpoint(obj.x + obj.width/2,obj.y - obj.height + obj.height/4,true)) //this dictate

python - POST date values in django testCase -

i trying write test sign user. can't form validate because can't figure out how submit valid date form. here offending code: class accountmanagementtest(testcase): def test_signup(self): response = self.client.post(reverse('register'), { 'first_name': 'gandalf', 'last_name': 'thegrey', 'email': 'gandalf@me.com', 'password1': 'sauronsucks', 'password2': 'sauronsucks', 'birthdate': datetime(1956, 1, 1), 'tos': true}) i can output response.content afterwards , error in form 'please enter valid date.' have not overridden clean method birthdate in form. here's declaration of date field form: birthdate = forms.datefield( widget=selectdatewidget( years=range(this_year-90, this_year-12)[::-1]), required=true,) how heck send va

Generate table from entities jpa/hibernate with eclipselink orm -

i'm trying generate tables entities using , jpa2.0 hibernate 4.2.16 , got error exception in thread "main" java.lang.noclassdeffounderror: org/hibernate/proxy/entitynotfounddelegate @ org.hibernate.ejb.hibernatepersistence.createentitymanagerfactory(hibernatepersistence.java:57) @ javax.persistence.persistence.createentitymanagerfactory(persistence.java:63) @ org.eclipse.jpt.eclipselink.core.ddlgen.main.execute(main.java:76) @ org.eclipse.jpt.eclipselink.core.ddlgen.main.main(main.java:64) caused by: java.lang.classnotfoundexception: org.hibernate.proxy.entitynotfounddelegate @ java.net.urlclassloader$1.run(urlclassloader.java:366) @ java.net.urlclassloader$1.run(urlclassloader.java:355) @ java.security.accesscontroller.doprivileged(native method) @ java.net.urlclassloader.findclass(urlclassloader.java:354) @ java.lang.classloader.loadclass(classloader.java:425) @ sun.misc.launcher$appclassloader.loadclass(launcher.java:308)

javascript - There is no bug in those two jQuery statements but I am just wondering why -

the following work perfectly sendtext5 = "homer simpson"; $eraser.prop('value', sendtext5); $.mobile.pagecontainer.pagecontainer( "change", $article2 ); but not following sendtext5 = "homer simpson"; $.mobile.pagecontainer.pagecontainer( "change", $article2 ); // line executes $eraser.prop('value', sendtext5); // line not execute $article2 div tag , $eraser input tag. i wondering why second situation works first does. it jquery 2.1.1 , jquery mobile 1.4.5 thanks lot, stack overflow! i'm assuming $eraser element within $article2 . if it's not, answer worthless. in first example, setting property before jqm enhances layout. in second example, setting after layout enhanced. means changing value property, on underlying form element. need tell jqm re-render displayed element. if $eraser text box, try following: sendtext5 = "homer simpson"; $.mobile.pagecontainer.pagec

javascript - Why won't jQuery let me animate the background color of a div? -

i found animation example on w3schools.com: <!doctype html> <html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script> $(document).ready(function() { $("#btn1").click(function(){ $("#box").animate({height:"300px"}); }); $("#btn2").click(function(){ $("#box").animate({height:"100px"}); }); }); </script> </head> <body> <button id="btn1">animate height</button> <button id="btn2">reset height</button> <div id="box" style="background:#98bf21;height:100px;width:100px;margin:6px;"> </div> </body> </html> ( this can run here ) however if try change animate background color instead of height, doesn't work. here code: <!doctype html> <html> <head> <script src="http://ajax.g

Connecting To MySql Database Through C# For Login -

i have searched everywhere , cannot find solution. basically. have created mysql database. have referenced mysql connector project. can connect, says "host: {ip address} not allowed connect mysql server". fixed allowing remote connections everywhere, heard dangerous do. i trying make software users login before can use software (and maybe other stuff... point trying use mysql connect .net application). safe allow mysql connections ip address? if somehow reversed engineered code, have access database credentials. is there other solution? i sure many of agree on not write db connection string in application give end user. also risky connection ip db. the best way create web service , call authenticate user , save both; no need provide connection string in application. as web service run on same pc or other single pc no need allow remote connection ip.

opengl - Getting wide range of type errors in C++ -

this question has answer here: c++ how declare vector of objects member of class 3 answers here important part of program getting wide range of type errors. trying make array of objects use struct hold data. any help? static object objectarray[number_of_objects]; class object { public: float x; float y; float z; int id; }; void createobjects(){ (int = 0; < number_of_objects; i++){ object obj; obj.x = rand() % 13 - 6; obj.y = 0; obj.z = rand() % 13 - 6; obj.id = i; objectarray[i] = obj; } } void randomizeobjects(){ (int = 0; < number_of_objects; i++){ objectarray[i].x += rand() % 3 - 1; objectarray[i].z += rand() % 3 - 1; if (objectarray[i].x > 6) objectarray[i].x--; if (objectarray[i].x < -6) objectarray[i].x++;

excel - How to query a website that (I think) uses javascript in data table? -

i use excel query web pages data analyze sports stats (nba, mlb). of queries have no problem bringing in data web page, nba.com gives me lot of issues. specific example http://stats.nba.com/league/player/#!/advanced/ - when make web query in excel, none of actual player data imports. question is there way me dynamically data? also, if data did import, nba.com splits data multiple pages cannot combined 1 big table. can data @ once without copying , pasting 9+ different table "rows"?

boost - BGL requires a model that it does not provide itself? -

i'd use parallel mst algorithm dense_boruvka_minimum_spanning_tree boost. one required parameter interface of algorithm graph "must model of vertex list graph , distributed edge list graph ". found the model of boost incorporates distributed edge list graph concept distributed adjacency list . in section "graph concepts" of model explicitly said "[...] distributed adjacency list does not model vertex list graph or edge list graph concepts [...] (emphasized me) at point confused. i'm supposed pass data structure interface of boost algorithm not provided framework? did misunderstand something? nb: i'm pretty new in boost world. boost graph provides generic algorithms around concepts, , has historically included few models of graph concepts. people have graphs in existing datastructure can adapt. in light at point confused. i'm supposed pass data structure interface of boost algorithm not provided framework?

algorithm - Simple way to calculate number of chess material combinations -

Image
in chess, 1 player can have different material combinations, example: "1 queen, 2 rooks, 2 knights, 2 bishops, 8 pawns + king" 1 combination if player loses 1 bishop: "1 queen, 2 rooks, 2 knights, 1 bishop, 8 pawns + king" combination ..afterwards, if pawn promoted knight, then: "1 queen, 2 rooks, 3 knights, 1 bishop, 7 pawns + king" combination ok, following combination not valid: "5 queens, 5 rooks, 5 knights, 5 bishops, 2 pawns + king" since lack of pawns promote. (5 queens = 4 pawns needed) (5 rooks = 3 pawns needed) , etc. 4 + 3 + 3 + 3 = 13 pawns needed. since 2 pawns on board, @ 6 pawns promoted. not valid. how many valid material combinations there? computed 8694 combinations using following c code. question is: do find simpler/efficient algorithm calculate it? (less cycles, less calculations, clearer code, etc.) ... or math formulae?? total = 0; (queens=0;queens<=9;queens++) (rooks=0;rooks<=10;rooks++) (bi

class - C++: Copy constructor is deleting nodes in original object -

i have implemented singly linked list using template class , attempted create working copy constructor. when copy constructor called, accurately duplicates list. however, deletes nodes original. here class implementation, constructors, , destructors: template<class l> class linkedlist { public: linkedlist(); linkedlist(const linkedlist<l> &og); ~linkedlist(); node<l>* addtoend(l object); node<l>* addtomiddle(l object); node<l>* deletenode(l deleteitem); node<l>* reverselist(); void display(); int size(); private: node<l>* head; node<l>* tail; int size; }; template<class l> linkedlist<l>::linkedlist() { head = null; tail = null; size = 0; } template<class l> linkedlist<l>::linkedlist(const linkedlist<l> &og) { cout << "\ncopy constructor has been called.\n\n

android - How to Set BroadcastReceiver Permissions (Security) -

so have 2 apps - , b. in have broadcastreceiver. in receiver tag (manifest file) specify android:permission string (let's com.example.app.send ). b cannot send broadcasts anymore. makes sense! so have in order b send broadcasts ? in b's manifest, specified uses-permission tag android:name set same string ( com.example.app.send ) receiver's android:permission still broadcasts won't go b a. what doing wrong ? or there else needs done ? -- update -- here's app a's receiver tag: <receiver android:name="com.example.app.myreceiver" android:enabled="true" android:exported="true" android:permission="com.example.breceiver.send" > <intent-filter> <action android:name="com.example.breceiver" /> </intent-filter> </receiver> and here's uses-permission tag b's manifest: <uses-permission android

asp.net - Recaptcha - Invalid Operation Exception: Http request context does not exist -

well, recaptcha used twice on site (both in process of registration). first time works perfect, second got exception above (when getcaptchaverificatoinhelper method called). also: first time recaptcha located in form (page) loaded synchronously, second time recaptcha located in partialview, updated via ajax. how fix this? also, nice if gave me reasons happening. in advance. this problem method: public task<actionresult> sendsmsagain(captchastubviewmodel viewmodel) { viewmodel.notificationmessage = null; return task<actionresult>.factory.startnew(() => { if (!httpcontext.request.isajaxrequest()) return null; var val = webconfigurationmanager.appsettings["recaptchaprivatekey"]; recaptchaverificationhelper helper = this.getrecaptchaverificationhelper(val); viewmodel.captchavalue = helper.response; if (string.isnullorempty(helper.response)) { modelstate.addmodelerror("captchavalue",

c++ - Trying to understand the extern keyword -

i trying learn extern keyword. i created file try2.cpp #include <stdio.h> #include <conio.h> extern int a; int main() { = 5; printf("%d", a); getch(); return 0; } and 1 try1.cpp int a; int main() { = 10; return 0; } but getting error in try2.c undefined. both files in bin folder of turboc. what problem? in try2.cpp , have: extern int a; this tells compiler a defined externally - i.e. not within try2.cpp . so, must define externally, , need second .cpp file - lets make a.cpp file contains: int a; you can compile each of try2.cpp , a.cpp: tc -c try2.cpp tc -c a.cpp then need link them, specifying path cs.lib standard library file (search windows explorer if below doesn't work - updating \tc\lib\ path below): tlink try2.obj + a.obj, program.exe, , \tc\lib\cs.lib that should create new program.exe run.... you should better compiler though....

Simple Tic Tac Toe on excel VBA -

i'm trying make simple tic tac toe class have instead of x , o color cells interior blue (user) , red (macro) , no ai. but whenever think got it goes infinite loop sub tic() dim r1 integer dim r2 integer r1 = int(rnd * 3) + 1 r2 = int(rnd * 3) + 1 if cells(r1, r2).interior.color = xlnone 'with colorindex instead of color fills before crashing cells(r1, r2).interior.color = vbred end if loop while cells(r1, r2).interior.color = vbblue or cells(r1, r2).interior.color <> vbred 'tried removing first condition result same, same changing second equal end sub now im allowed use functions i'm using cant change so i'm thinking should check if cells not filled color should color red , if blue or red should nothing , unfilled cell. no matter how @ dont know part wrong if cant answer id appreciate if pointed out part wrong can focus on it if loop hits blue cell, if statement isn't going execute , while condition met, meaning s

active directory - Enable AD user account using ldap python -

i using ldap module in python add user microsoft 2012 active directory. able add user ad, user gets added next logon , account disabled options ticked. tried lot of option enable account not able so. tried option of enabling account while creating user doesn't work too. tried modify function still no luck. suggest detour above problem? in advance you need modify entry after created , set useraccountcontrol attribute. the useraccountcontrol attribute bit flag. there few different enabled states can set. 512 - default enabled account 67048 - enabled account password not expire

ios - How to convert char(or Byte) with hexadecimal data in it, to an integer(decimal value) -

i have char tem; its value shown blow: printing description of tem: (char) tem = '\xd1' which should equals 209 in decimal. my question how can implement conversion programmatically? want nsinteger equals 209 in case. maybe there’s i’m overlooking here, given both char , nsinteger integral types, can’t do char tem = '\xd1'; nsinteger = tem; ? or perhaps, avoid surprises sign extension, nsinteger = tem & 0xff;

django - datetime.now() not accurate -

i have django application automatically takes in timezone.now() value field in model. when run on localhost, works expected. however, when deployed onto digital ocean, timezone.now() takes value of time when started running server. why happen , how can work around this? correction: django's timezone.now() code have been helpful. presumably using default argument field. problem have done this: my_field = models.datefield(default=datetime.datetime.now()) which, due way python works, evaluated when class defined - ie when process starts. instead, should pass callable : my_field = models.datefield(default=datetime.datetime.now) that is, without calling parentheses, , django know call on instantiation.

gnu make - Makefile: all vs default targets -

talking respect gnu make, difference between phony targets all: , default: . cc=g++ default: hello hello: hello.cpp $(cc) -o hello hello.cpp and cc=g++ all: hello hello: hello.cpp $(cc) -o hello hello.cpp both of them same job. you can call them shirley if like; neither of labels mention has special semantics. default behavior of make run first target in makefile if don't specify target command-line argument. if override behavior, there .default: special target. there convention have target named all builds everything, human convention, not special case or requirement far make concerned. similarly, there (weak) convention call default target default , similarly, human label (and overlaps , possibly conflicts all convention). so following makefile same thing: .phony: shirley default default: hello all: hello shirley: hello hello: hello.cpp # (make knows how build executable out of .cpp file) you can omit or of phony targets above

sql - Is my ER Diagram correct? -

Image
so have database called "lyric", , supposed take 4 tables , make er diagram on these tables. here, picked "artists", "title", "genre" , "studios". 1 note: first time doing this, , not in objectives of class. merely introduced concept of er diagrams in introductory class. here "lyric" database: and here er diagram on 4 tables mentioned above: thank you. 1 artist has n titles, should 1 artists , n titles. relation same type studio - title. try avoid has description of relation. title e.g. performed by artist.

iOS: PHP web service using SOAP returns null when called -

created web service .php extension , passing parameters though soap. returns out of understanding. check on restclient proper input returned actual output. not going on in code. may gone wrong ? my xml structure input is, <?xml version="1.0" encoding="utf-8"?> <soap:envelope xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:header> </soap:header> <soap:body> <getupdates> <user_location></user_location> <application_type>fc</application_type> <last_updated_date>2014-11-25</last_updated_date> <platform>android</platform> </getupdates> </soap:body> </soap:envelope> and web service method is, -(void) notifydatacalled { nsstring * post= @"<soap:envelope xmlns:xsi=\"http://www.w3.org/200

javascript - Setting innerHTML in a webview replaces the entire document instead of just the element -

note: scaloid, syntax bit different java, classes usual android classes java. i'm initializing webview using: webview.settings.setjavascriptenabled(true) webview.setwebchromeclient(new webchromeclient) and call val jsurl = "javascript:document.getelementbyid('" + gettagid(word) + "').innerhtml = '" + guess + "'" webview.loadurl(jsurl) where gettagid(word) existing id (i've debugged this) , guess short string "abc" . it works in desktop browser, in webview replaces entire document instead of replacing element. i've tried debug , make sure element found replacing call with "javascript:alert(document.getelementbyid('" + gettagid(word) + "').innerhtml)" and shows alert right content! replacement goes wrong. this bug driving me crazy :-( missing? p.s. i'm working on open-source project: https://github.com/ilyakogan/gluckentext i still don't know why di

Take first 4 values in input parameter using oracle 10g -

i using oracle-10g, im creating 1 query needs take first 4 values in input parameter. user give many inputs while run report in module, query needs take first 4 values if user gives more 4. take values if user gives less 4 or equal 4. every input value seperated comma(,) user. user's input value parameter in qry. my qry follows: select c.country_name,oa.city,oa.country_code,d.departure_no,o.storer_order_id orders o, order_address oa, store_adress sa, departure d, shipment s, luid l, picklist_line_pack_luid pl, storer st,country c o.internal_order_id=oa.internal_order_id , o.shipment_id=s.shipment_id , s.departure_no=d.departure_no , pl.internal_order_id=o.internal_order_id , pl.pack_luid_no=l.luid_no , o.storer_id=st.storer_id , st.store_id=sa.store_id , c.country_code=oa.country_code , d.departure_no in( case when length('9821,9254,225,9821') - nvl(length(replace('9821,9254,225,9821',',')),0) <=3 9821,9254,225,9821 end ) this gives me error &

qt - Convert 2D vector to 2D QVector C++ -

i'm working on project in c++ , i'm using visual studio 2010 express along qt creator 5.3.2. gui of application. my problem want convert 2d vector 2d qvector , don't know how this. have used, example, fromstdvector() conversion of 1d vector 1d qvector, cannot transfer data 2d vector 2d qvector (with function). if help, appreciate it. source code: qvector< qvector<double> > test2d; // 2d qvector vector < vector<double> > std_test2d; // 2d vector test2d.resize(20); // dimensions of 2d qvector for(int i=0; i<20; ++i) { test2d[i].resize(44); } std_test2d.resize(20); // dimensions of 2d vector for(int i=0; i<20; ++i) { std_test2d[i].resize(44); } for(int i=0; i<20; i++) // convert vector qvector??? { test2d[i].fromstdvector(std_test2d[i]); } you're not assigning value. think should work using example code documentation : test2d[i] = qvector<double>::fromstdvector(std_test2d[i]);

java - Android How do I use the same native library (.so) for multiple projects and classes? -

i making android project native code . running javah results in header files contain function prototypes qualified java class name in names. assume means functions , headers generated called java class used create them using javah. how go on making native lib can use other classes other projects. made library has function want use in projects how build can use .so file each time without recompiling project. think call dynamic library? is possible? or have create seperate jni headers each class , reuse remaining c/c++ code? if want reuse native library various java projects, should directly bundle native library java class independent initial project. this way you'll able distribute android library project, , use various classes , projects.

javascript - JQuery AJAX-How to retrieve JSON data from URL? -

i'm working on code need retrieve data api. idea json data , decode when have data, i've done before using file_get_contents , json_decode on php. for detail: i need code seat reservation user choose own seat.so made seat map table , "td" clickable. works fine except api thing. want when seat clicked/chosen retrieve data api. i've tried: $.getjson(jos, function(jd) { var hah = $.parsejson(jd); alert(jd); }); $.ajax({ url: jos, }) .done(function(data) { alert('data'); }); note: jos variable contains url api i'll appreciate response you don't need convert data $.getjson() json, since json string: $.getjson(jos, function(jd) { alert(jd); });

r - Subsetting 700+ fips codes -

i have a list of 700+ fips codes i'm trying subset smaller dataset. know list them out : data <- data[(data$fips == 65409, 84840, etc....) ,] but unrealistic have 700+ fips codes subset. i'm looking way subset using list of fips codes : fips <- unique(dustbowldata_pre$fips) #get fips codes edit : tried clarify further, it's hard submit example because of sheer number. thanks can provide. this worked. prism.dd <- prism.d[(prism.d$fips %in% fips) ,]

multithreading - OpenMP block gives false results -

i appreciate point of view might did wrong using openmp. parallelized code pretty strait forward - yet single thread (i.e., call omp_set_num_threads(1)) wrong results. i have checked intel inspector, , not have race condition, yet inspector tool indicated warning thread might approach other thread stack (i have warning in other code have, , runs openmp). not think problem. subroutine gr(number_d, rad_d, rad_cc, spect) use term,only: density, temperature, viscosity, water_density, & pressure, d_hor, d_ver, d_temp, qqq, umu use satur,only: ff, a1, a2, aaa, bbb, sat use delta,only: ddm, dt use const,only: pi, g implicit none integer,intent(in) :: number_d double precision,intent(in) :: rad_cc(number_d), spect(number_d) double precision,intent(inout) :: rad_d(number_d) double precision :: r3, dr3, c2, c0, p, q, rad_cr, sat_cr, c4, a, & c, d, cc, dd, cc2, dd2, rad_st, draa, dra, dm, x1 integ

python - How do you print a hash in Django 1.7 and store it in a database? -

i created hash going use later confirmation email logic this: import hashlib, datetime, random def hash(request): username = 'johndoe' #inserted line simplify code random_str = str(random.random()).encode('utf-8') salt = hashlib.sha1(random_str).hexdigest()[:5] salted = (salt + username).encode('utf-8') activation_key = hashlib.sha1(salted).hexdigest() return render_to_response('ftest/display.html', activation_key) my first question how print in html can see when html renders? this doesn't seem work in display.html : <p> activation key {{activation_key}} </p> next, how define hash field in database? charfield like: hash = models.charfield(max_length=200) render_to_response expects dict : return render_to_response('ftest/display.html', {'activation_key': activation_key}) a charfield right way go.

javascript - Get Multiple dropdowns value of a form and send as a query string in jquery -

Image
i have form have dropdowns have multiple properties .now on click of button want create array of values on key name dropdown name.but unable this. , have send data of each dropdown in query string ajax html <select multiple="" style="width: 147px;" id="list" name="list" class ="list_class"> <option value="21">a</option> <option value="22">b</option> <option value="23">c</option> <option value="24">d</option> <option value="2">e</option> </select> <select multiple="" style="width: 147px;" id="list1" name="list1" class ="list_class"> <option value="22">b</option> <option value="24">d</option> <option value="2">e</option&

regex - regular expression in matlab to match decimal in filename -

i'm trying match int or decimal in matlab using regular expressions i have: kabel_2.5cm_proef2.xls , want match 2.5 another example: kabel_5cm_proef1.xls want match 5 any ideas? to match int or floating point numbers present before string cm \d+(?:\.\d+)?(?=cm) demo (?=cm) positive lookahead asserts match must followed cm

Create Glassfish windows service error -

i have created glassfish service on window not start service. have checked domain service error log , getting following errors: error: registry key 'software\javasoft\java runtime environment'\currentversion' has value '1.8', '1.7' required. not find java.dll not find java se runtime environment. i have upgraded java 7 java 8 , after upgrading service no started. how can solve poroblem ok! had delete following files: java.exe , javaw.exe , javaws.exe from system32 in order work. working fine now.

sharepoint - How to anonymously post to Yammer -

this crowd sourcing use case. hosting event invite suggestions / criticism newly introduced processess. we expecting many users not post comments (i guess replies in yammer terminology) if not allowed anonymously. what various ways can acheive functionality? yammer not support absolute anonymity. use case, may create service account called anonymous, generate access token anonymous user , pass token api post request.

javascript - Get style value of selection in CKEditor -

i using ckeditor's editing capabilities, own ui controls calls ckeditor's api perform commands. e.g., var style = new ckeditor.style({ element: 'span', attributes: { 'style': 'font-size: 20px' } }); editor.applystyle(style); to set font size of selected text. problem need way know status of selected text can update controls accordingly. bold? bold button should in activated state, , clicking should remove boldness instead of attempting add again. is there way query ckeditor style attributes of selected text? how tinymce.activeeditor.querycommandvalue('bold') works in tinymce. usually, best way create button-command-style trio done in basicstyles plugin: var style = new ckeditor.style( { ... } ); editor.attachstylestatechange( style, function( state ) { !editor.readonly && editor.getcommand( 'commandname' ).setstate( state ); } ); editor.addcommand( 'commandname', new cked

use Kal in swift for ios -

i'm trying add month view calendar in project ios, downloaded kal library . i followed instructions add in, steps are: add kal folder in project folder add kal.xcodeproj file in project setting location relative project click on project, under general tab , add libkal.a in linked frameworks , libraries under build phases , add kal in target dependencies add kal.bundle in project setting location relative project in header search paths cancel had, , add src directory dragging folder in blank container in other linker flags double click multiple values , add -all_load in bridging-header.h file add #import "kal.h" i run project, found failed kal.h file not found what going wrong? should do? please help. thank you.

javascript - Expression Language - how to access whole array? -

Image
i'm using following code: <p:inputtext label="bezeichnung" required="#{param['form_inhalt:artikeldatatable[0]:entfernen']==null}" value="#{artikeldata.bezeichung}"></p:inputtext> i need access ids in 'artikeldatatable'. how i'm able this? should return false if button in table activated. works fine 1 button [0] need check buttons in id-array. #param['form_inhalt:artikeldatatable:0:entfernen']==nullandparam['form_inhalt:artikeldatatable:1:entfernen']==null} is there way check whole array? basically i'm searching wildcard * ids from param['form_inhalt:artikeldatatable:0:entfernen'] to param['form_inhalt:artikeldatatable:99999:entfernen'] or have write java script function iterates array , returns true? if so, how can access #{param... stuff via javascript? thank much! javascript jsf jsf-2 el share