Posts

C++: Boost interprocess memory mapped file error -

i'm trying create memory mapped file using this answer, i'm getting compile errors. code: namespace bi = boost::interprocess; std::string vecfile = "vector.dat"; bi::managed_mapped_file file_vec(bi::open_or_create,vecfile.c_str(), sizeof(struct rectangle) * data_size); typedef bi::allocator<struct rectangle, bi::managed_mapped_file::segment_manager> rect_alloc; typedef std::vector<struct rectangle, rect_alloc> myvec; myvec * vecptr = file_vec.find_or_construct<myvec>("myvector")(file_vec.get_segment_manager()); vecptr->push_back(random_rectangle); the struct this: struct rectangle{ rectangle(float *minarr, float *maxarr, int arr, int exp, int id){ this->arrival = arr; this->expiry = exp; this->id = id; for(int i=0; < 2; i++){ min[i] = minarr[i]; max[i] = maxarr[i]; } int arrival, expiry, id; float min[2]; float max[2]; } the error is: compiler not deduce template argu...

redirect - Rails 4, Devise - after_sign_in -

i trying make app in rails 4. i trying follow along tutorial: http://sourcey.com/rails-4-omniauth-using-devise-with-twitter-facebook-and-linkedin/ i have moved after_sign_in_path omniauth callbacks controller application controller, can extend it. my current attempt in application controller is: def after_sign_in_path_for(resource) if !resource.email_verified? finish_signup_path(resource) elsif params[:redirect_to].present? store_location_for(resource, params[:redirect_to]) elsif request.referer == new_session_url profile_path(resource.profile) # or whatever route destination want else store_location_for(resource) || request.referer || root_path end end when try this, error: argumenterror in users::omniauthcallbackscontroller#linkedin wrong number of arguments (0 1+) it highlights line of above method: elsif request.referer == new_session_url i don't know error message means....

java - Android IDE issue arises when I try to move layouts within tabHost -

so i'm working on app, trying work on multiple layouts within tabhost. when try reorder layouts within tabhost creates ide error, , fails render. experienced java, first attempt @ working android studio. here's error execute command activetool: com.intellij.designer.designsurface.tools.selectiontool@3e7bfc0b sdk: android 6.0 - api 23 java.lang.arrayindexoutofboundsexception: 0 @ com.intellij.android.designer.model.radviewcomponent.updatetag(radviewcomponent.java:105) @ com.intellij.android.designer.model.radviewcomponent.updatetag(radviewcomponent.java:105) @ com.intellij.android.designer.model.radcomponentoperations$1.run(radcomponentoperations.java:96) @ com.intellij.openapi.application.impl.applicationimpl.runwriteaction(applicationimpl.java:931) @ com.intellij.android.designer.model.radcomponentoperations.movecomponent(radcomponentoperations.java:80) @ com.intellij.android.designer.designsurface.abstracteditoperation.execute(abstracteditoperation.java:49) @ com.inte...

html - How to apply this sidebar to all pages using CSS? -

i have 4 different html web pages. html code below menubar want apply 4 pages. there way can using css instead of copying/pasting menubar html code on 4 of html web pages? 4 pages home, news, contact, about. whenever clicks on menubar item, redirect them 1 of 4 pages. , on 4 of pages, want menubar displayed. want create css file can link 4 pages , menubar displayed (code below). in advance! is there way can create css file @ least takes care of styling? , manually add menubar buttons each html page? <!doctype html> <html> <head> <style> body { margin: 0; } ul { list-style-type: none; margin: 0; padding: 0; width: 25%; background-color: #f1f1f1; position: fixed; height: 100%; overflow: auto; } li { display: block; color: #000; padding: 8px 0 8px 16px; text-decoration: none; } li a.active { background-color: #4caf50; color: white; } li a:hover:not(.active) { background-color: #555; col...

java - how to remove space between jtextfield, jbutton and raisedbevel border -

i wants remove blank space or border space between jbutton , jtextfield added inside raisedbevel border tried code still gap between them import java.awt.*; import javax.swing.*; import javax.swing.border.border; public class main { public static void main(string args[]) { jframe f = new jframe("jpasswordfield "); f.setdefaultcloseoperation(jframe.exit_on_close); jpanel p=new jpanel(),pp=new jpanel(); jbutton b=new jbutton("o"); b.setborder(null); b.setborderpainted(false); b.setmargin(new insets(0,0,0,0)); border emptyborder = borderfactory.createemptyborder(); b.setborder(emptyborder); border raisedbevel=borderfactory.createraisedbevelborder(); pp.setborder(raisedbevel); jtextfield t=new jtextfield(20); t .setborder(javax.swing.borderfactory.createemptyborder()); t.setpreferredsize(new dimension(100, 25)); b.setpreferredsize(new dimension(25, 25)); pp.setbackground(color.black); pp.add(t); ...

Connect impala with odbc and php pdo, string fields are empty -

when use odbc only, run successfully $dsn = "dsn=dingdongimpala;host=172.168.1.100;port=21050;database=mmdb;"; $user = ''; $password = ''; $conn = odbc_connect($dsn, $user, $password); $result = odbc_exec($conn, "select succount,failedcount,appid t_mm_acc_date limit 1"); while($row = odbc_fetch_array($result)) { print_r($row); } the result is: array ( [succount] => 0 //int [failedcount] => 1 //int [appid] => 202361 //string ) but when use pdo access odbc, string type fields empty $dsn = "odbc:dsn=dingdongimpala;host=172.168.1.100;port=21050;database=mmdb;"; $user = ''; $password = ''; $cnx = new pdo($dsn, $user, $password); $result = $cnx->query("select succount,failedcount,appid t_mm_acc_date limit 1"); print_r($result->fetchobject()); the result is: stdclass object ( [succount] => 100 //int [failedcount] => 0 //int ...

.net - PictureBox image appears differently on different computers -

Image
what see: what customer sees: the images different sizes due different resolutions @ time screenshots taken. issue see logo cutoff text , button. i have tried many different resolutions on computer , image looks correct. has tried many different resolutions on computer , image cutoff. designer code: me.picturebox1.image = ctype(resources.getobject("picturebox1.image"), system.drawing.image) me.picturebox1.location = new system.drawing.point(12, 12) me.picturebox1.name = "picturebox1" me.picturebox1.size = new system.drawing.size(96, 56) me.picturebox1.sizemode = system.windows.forms.pictureboxsizemode.autosize me.picturebox1.tabindex = 0 me.picturebox1.tabstop = false it looks os text scaling set 125% or 150% on computer. affects layout of forms.

Grok Parse Failure on Custom Log Format and regex in logstash -

i have custom log format ,i new trying figure out how works . not getting parsed in logstash .can identify issue. logformat follows {u'key_id': u'1sdfasdfvaa/sd456dfdffas/zasder==', u'type': u'audio'}, {u'key_id': u'iu-dsfaz+ka/q1sdfq==', u'type': u'hd'}], u'model': u'level1', u'license_metadata': {u'license_type': u'streaming set', u'request_type': u'new', u'content_id': u'aaaa='}, u'message_type': u'license', u'cert_serial_number': u'aaaasssseerrttyuuiioooasa='} i need parsed in logstash , store in elasticsearch the problem none of existing grok pattern taking care of , unaware of regex custom config alain's comment may useful you, if log is, in fact, coming in json may want @ json filter automajically parse json message elastic friendly format or using json codec in input. if want stick gr...

javascript - Kendo UI grid - How can I show a processing / loading percent indicator -

is there way show processing percentage or progress bar show loading progress user in kendo grid. kindly share. -philip- take @ databinding , databound event of kendo.ui.grid. pseudo code $("#grid").kendogrid({ databinding: function(e) { //show processing modal console.log("databinding"); }, databound: function(e) { //hide processing modal console.log("databound"); } });

python - how to add new item in pandas series without erasing other items -

i have following pandas series. new_orders_list out[853]: cluster 1 [525, 526, 533] cluster 2 [527, 528, 532] cluster 3 [519, 534, 535] cluster 4 [530] cluster 5 [529, 531] cluster 6 [520, 521, 524] and,i have 2 more series after slicing on dataframe. condition out[854]: 5 525 name: order_id, dtype: object condition2 out[855]: clusters cluster 6 1 name: quant_bought, dtype: int64 now want add value of condition series 525 new_orders_list @ cluster 6 (index condition2 series) location. , erasing off 525 cluster 1 location. so, should this cluster 1 [526, 533] cluster 2 [527, 528, 532] cluster 3 [519, 534, 535] cluster 4 [530] cluster 5 [529, 531] cluster 6 [520, 521, 524, 525] i doing following in python. appends stored values. new_orders_list.append(pd.series(condition.values ,index = condition2.index)) cluster 1 [525, 526, 533] cluster 2 [527, 528, 532] cluster 3 [519, 534, 5...

data binding - Android dataBinding - how to use bool resource to trigger visibility of layout -

i have bool.xml file in android looks this: <?xml version="1.0" encoding="utf-8"?> <resources> <bool name="showads">true</bool> </resources> now have layout.xml file uses databinding. want show or hide visilibity of adview based on boolean showads defined above. far have this: <com.google.android.gms.ads.adview android:id="@+id/adview" android:layout_width="wrap_content" android:layout_height="wrap_content" android:visibility="@{@bool/showads ? view.visible:view:gone}" ads:adsize="banner" ads:adunitid="ca-app-pub-1234567/34343"> but not compile. how can boolean decide if ad should show or not ?the syntax wrong. correct syntax of condition view.visible:view:gone android:visibility="@{@bool/showads ? view.visible:view.gone}" and need import view in data section: <data> ...

A Simple input/output query of C++ -

i have take input: 3 sam 99912222 tom 11122222 harry 12299933 so, wrote down following code: string s; int num,n; cin>>n; while(n--){ getline(cin,s); cin >> num; cout << "s=" << s << " num=" << num << endl; } so, expected output should be: s=sam num=99912222 s=tom num=11122222 s=harry num=12299933 but output is: s= num=0 s= num=0 s= num=0 where did wrong? one problem cin>>n; statement count leaves newline in input buffer. when call getline see newline , think entered empty line. then gets worse when try read number, next text not number, it's name, , trying read number set failbit . a standard solution ignore characters until newline, skip rest of line including newline character. like std::cin >> n; std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n'); you of course need after other inp...

Is it mandatory to Write static void Main(string[] args) in C#? -

because debug simple program took runtime inputs 2 numbers , showed sum of 2 number. did without writing string[] args. necessary write these in every program? no, it's not mandatory. the documentation on main() , command-line arguments (c# programming guide) says: the main method can declared or without string[] parameter contains command-line arguments. so, valid entry point: static void main() { console.writeline("hello world"); }

windows - downloading parts of a html page on an event -

i developing universal windows app. need download webpage , extract images it. i got html code , extracted links images , downloaded them. thing is, site has infinite scrolling (like facebook). when scroll down bottom loads more images. not able incorporate app. beginner , have little knowledge of web development or windows app development. first app. stuck , have no idea how proceed. don't want use webview displays ads site , other unnecessary contents. want links images. please me go past situation. need way download new html content site loads when user gets bottom or other way image links. thanks in advance. you may or may not me implement because of reason stated. need determine how site loads information. first download fiddler , in turn enable https connect logging can see encrypted traffic going through fiddler. btw web view has events can hook see loading urls, etc , can hidden. so again need first understand how site want on works , emulate that, assum...

documentation - Cheatsheet for Markdown and Restructure syntax comparision? -

is there cheatsheet compares usage of markdown restructure? this, learn rst faster if knew markdown . tried google haven't found one.. a small comparsion lot lightweight markup language syntaxs can found on wikipedia . there gist document common markup between 2 languages. you can use pandoc convert existing markdown rest or other way around. there lot of different markdown dialects, may difficult compare syntax rest.

r - how draw ellipses on a scatterplot3d -

Image
i have following data frame: cost quality safety time status 1 13 6 3 4 benchmark 2 10 4 5 10 benchmark 3 8 9 3 9 benchmark 4 7 8 9 9 benchmark 5 4 4 4 2 current 6 2 2 7 11 current i want create benchmark space interms of scatter plot. used scatterplot3d package draw it. scatterplot code: scatterplot3d(f$cost,f$quality,f$safety,f$time,f$status) i got below graph, want draw ellipses benchmarks confidence level of .975.so found dataellips in car package not know how apply function in scatterplot3d. graph want following: i have tried code below, not work; scatterplot3d(dataellipse(f$cost,f$quality,levels=0.68),f$safety,f$time,f$status) because function of dataellips coming car package. error message following: error in xyz.coords(x = x, y = y, z = z, xlab = xlabel, ylab = ylabel, : 'x', 'y' , 'z' lengths differ

PHP Mailer Not Sending Email To Office365 -

i want send mail office365 using phpmailer not sending , giving me connect() error here code: email , password i'm using in real code working require 'mailer/phpmailerautoload.php'; $mail = new phpmailer(); $mail->issmtp(); $mail->mailer = 'smtp'; $mail->smtpauth = true; $mail->host = 'smtp.office365.com'; // "ssl://smtp.gmail.com" didn't worked $mail->port = 587; $mail->smtpsecure = 'tls'; // or try these settings (worked on xampp , wamp): // $mail->port = 587; // $mail->smtpsecure = 'tls'; $mail->username = "email"; $mail->password = "password"; $mail->ishtml(true); // if going send html formatted emails $mail->singleto = true; // if want send same email multiple users. multiple emails sent one-by-one. $mail->username = "mail@gmail.com"; $mail->fromname = "your name"; $mail->addaddress("abc@gmail.com","user 1")...

android.database.sqlite.SQLiteException: No such table exists -

this question has answer here: sqliteexception: no such table exists 2 answers i have sample android app in created database, created table , inserted data table. next day, on opening eclipse ide , running app through emulator, app gets closed, sqlliteexception saying no such table . my mainactivity code follows: sqlitedatabase db = context.openorcreatedatabase( "waterelectricityreadingdatabase.db", mode_world_readable, null); final string create_table = "create table if not exists " + table_name + "(" + column_name_reading_id + " integer primary key autoincrement," + column_name_reading_mode + " text not null," + column_name_pastdatetime + " date not null, " + "enddatetime date not null, " + column_name_readingvalue + " inte...

mysql - simple login php not working -

created simple login form doesnt seem work.it opens admin page. $username=$_post["username"]; $password=$_post["password"]; if(mysql_query("select * users username='$username' , password='$password'",$con)){ session_start(); $_session["username"]=$username; $_session["password"]=$password; header('location:admin.html'); } else{ echo "login failed.<a href=index.html>re login</a"; } need help.and here html part. <form method="post" id="loginform" action="validate.php"> <table> <tr> <td> <label>username :</label> </td> <td> <input type="text" name="username"/> </td> </tr> <br> <tr> <td> <label>password :</label> </td> <td> ...

javascript - Create events object after some data was -

i've several events need listen additional event , pass object: const spawn = require('child_process').spawn; const ls = spawn('ls', ['-lh', '/usr']); ls.stderr.on('data', (data) => { myobj.data = true //here need raise event property data }); ls.on('close', (code) => { myobj.close = true //here need raise event property close }); for example inside of every event want emit my events , send object property. example raise myevent object , every following event update property in object data,close,open let's object var myobj ={ open:true, data:false, close:true } how can this? the obvious way code own small event emitter/listener. const spawn = require('child_process').spawn; const ls = spawn('ls', ['-lh', '/usr']); var eventer = { events: {}, on: function(event, callback){ if(!(typeof callback === 'function'){ return; ...