Posts

Showing posts from September, 2015

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;

java - Is there Simple way to use String.toLowerCase() for 9 kinds of languages? -

i need treat 9 kinds of language in list below. dutch english french german italian portuguese russian spanish ukrainian for words in these languages need use tolowercase() . , know need use locale(country, language) parameter of function. then, have use specific locale each language, or there simpler way this? you can construct locale iso 639 language code: locale russian = new locale("ru"); there nice default locales use, example: locale english = locale.english; locale french = locale.french; locale german = locale.german; locale italian = locale.italian; then use string#tolowercase() locale: string lower = str.tolowercase(somelocale);

design patterns - Rails - use code(css, js, html) from server on client side -

i had application rails built bootstrap , simple form. here have show ui patterns how like. means have show patterns menu bar, accordian patterns examples in application. storing pattern code html,css,js in database. here requirement have show actual code pattern view stored record(css,js,html) without css/js conflicts. how can eneter html,css,js code dynamically in partial or page show in fancybox in rails. thanks in advance. just use html_safe or raw render content normal string on views. instance: in controller: @x = your_code_from_db in view: <%= @x.html_safe %> # <%= raw @x %> ok in case notice: can use html_safe on models, raw declared on helper, can use on controllers , views. -- edit -- more example: on controller: @hello = 'alert("hi");' @body = 'body{ background: red; }' on view: <script type="text/javascript" charset="utf-8"> <%= raw @hello %> </script

datetime - Format date-time as seasons in R? -

in r, it's possible format posixlt date-time objects month: format(sys.time(), format='%y-%m') is there way same thing seasons, or 3-month groups (djf, mam, jja, son)? these divisions common in climatological , ecological science, , great have neat way format them months. djf falls on 2 years, purposes or question, doesn't matter - consistently shove them either year, (or, ideally, able specify year go into). i'm using output index by() , output format doesn't matter much, long each year/season unique. edit: example data: dates <- sys.date()+seq(1,380, by=35) dates <- structure(c(16277, 16312, 16347, 16382, 16417, 16452, 16487, 16522, 16557, 16592, 16627), class = "date") dates #[1] "2014-07-26" "2014-08-30" "2014-10-04" "2014-11-08" "2014-12-13" # "2015-01-17" "2015-02-21" "2015-03-28" "2015-05-02" "2015-06-06"

spring mvc - Streaming video from controller to html5 video player -

we trying following upload video s3 bucket stream -- done read stream in java controller -- done use stream play video in html5 video player. --pending note: video size can huge. looking @ best way stream video. when use below code in controller doesn't work stream. instead tries download entire video , tries play content. note works fine videos less 5 mb fails other. there other approaches acheive ? final string contenttype = stringutils.isblank(obj.getcontenttype()) ? mediatype.application_octet_stream_value : obj.getcontenttype(); return responseentity.ok() .contentlength(obj.getcontentlength()) .header("content-type", contenttype) .body(new inputstreamresource(obj.getcontent()));

dataframe - Extracting pixels from a raster based on specific value of another raster using R -

i imported 2 rasters (raster a , b) in r using raster function. extract pixels of a b equals 1 data frame. trying following, however, pixels obtain have same values, although various in original dataset. the 2 rasters have same dimensions (ncols, nrows, ncell, resolution, extent, projection). library(raster) library(rgdal) # import inputs <- raster('/pat/to/rastera.tif') b <- raster('/pat/to/rasterb.tif') # extract raster values on raster b b == 1 mydata <- data.frame(a[b[b == 1]]) edit 1 might when a[b[b == 1]] , class of object , b rasterlayer becomes numeric , , creates problems? discovered doing class(a[b[b == 1]]) , gives numeric . edit 2 ok, weird. tried mydata <- data.frame(a[b]) , output has original a @ b == 1 locations. trying before extracted pixels a (as expect). can coinfirm right counting number of ones in b , number of elements in mydata , same. it's if indexing has skipped zeros in b . can explain this?

Questions about copying data into/from Linux Kernel -

i finishing project os class , can't figure several things have safely copying data user-space kernel , kernel user space, , how discard information. say have several system calls: //copies data kernel space long sys_into(void __user *data, long length); // copies data user space long sys_from(void __user *data, long length); in both cases long length number of bytes copied. things able figure out far: 1. validate pointers *data not null . 2. validate length < 0 3. need use access_ok . however, not sure if need use both functions or long sys_into() 3. when copying kernel using kmalloc(length) allocate number of bytes , make sure can allocate memory. 4. use copy_from_user & copy_to_user copy data. so far, found little information. 1. source code example "linux kernel programming" (as pointed out, example in linux kernel development dangerous). 2. http://www.quora.com/linux-kernel/how-does-copy_to_user-work thanks !!! i thi

jquery - Menu below the logo -

i'd create menu similar this (try in mobile mode): in "desktop" mode, want brand logo , other words on left, , menu on right. in "mobile" mode, block logo , other words, , below menu should take whole row. any suggestion obtain result? link jsfiddle as can see defined css ids, have: display:block one container of logo+words (on left) , 1 container of menu (on right). it not work would, because not know how put menu below brand's name when in mobile mode. i hope result looking for: the css add @media screen , (max-width: 768px) { #logo { display: inline-block; float: none; width:100%; text-align:center; } #nav-logo { display: inline-block; float: none; width:100%; text-align:center; } .navbar-header button { float:none; margin:15px 0px; } } jsfiddle example if want menu above, invert html blocks id="nav-logo" , id="logo" ... the updatade jsfiddle here.

css - Google chrome not rendering page correctly -

here link http://demo.elxer.com/new_eco/ the header (menu , logo section of page not recunstructing correctly on scroll) in google chrome... working fine other browser , google chrome version using google chrome version version 25.0.1364.152 m, please help. might css issue or might jquery or browser rendering issue, have tried lot search no find answer. there not about, i'm afraid. thing helped me out forcing 3d mode with -webkit-transform: translate3d(0, 0, 0); i tried set div under #overlay : <div style="position: relative; top: 0px; min-width: 1150px; max-width: 1280px; height: 4245px; overflow: hidden; margin:0 auto; -webkit-transform: translate3d(0, 0, 0);"> that worked me, brings issue width. maybe easier resolve.

android - Keyboard hides my half of edit-text and button below it even in scroll view -

i having trouble keyboard covers edit-text , half of button in scroll view. here's layout , please tell me how should resolve problem. many questions on topic none of them s working me. <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:background="@drawable/bg" android:layout_height="match_parent"> <scrollview android:layout_width="match_parent" android:fillviewport="true" android:layout_height="match_parent"> <relativelayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <linearlayout android:layout_width="match_parent" android:layout_height="w

javascript - Set user agent for Node JS server -

is possible configure user-agent of simple node js server? example, run node server using iphone user agent simulate device display. not sure if there npm package doing or custom javascript manipulate user-agent of node js server. detail: aware express-user-agent it give parsing feature , access current user-agent within express app. here code of node js server: var express = require('express'); var app = express(); var server = require('http').createserver(app); var io = require('socket.io')(server); var exec = require('child_process').exec; var shell = require('shelljs'); app.use('/public', express.static(__dirname + '/public')); app.get('/', function(req, res,next) { res.sendfile(__dirname + '/index.html'); }); server.listen(4200); io.on('connection', function(client) { client.on('join', function(data) { console.log(data); }); client.on('command', fu

c# - Disable a command from code -

i have command want disable depending on logged user role, there way "block" command , make not trigger code ? <dxmvvm:eventtocommand x:name="ev_comm" passeventargstocommand="true" command="{binding editcommand}" eventname="mousedoubleclick" markroutedeventsashandled="true"> something this: myviewmodel = (myviewmodel)datacontext; a.editcommand.disable; thanks

c# - Grouping with Linq only when all elements in a group have value in a column -

i try create groupings of lastreadings, can create client’s , competitor’s prices. try below code, approach not eliminate readings client’s. below table need eliminate readingsid 5 , 6, products c , d there no match , pass further comparable ones. readingid productid distributor price 1 competitor 8.0 2 client 8.1 3 b competitor 8.3 4 b client 8.4 5 c client 8.8 6 d client 8.9 below far: private ienumerable<pricecomparison> getpricecomparisons(string competitor) { ienumerable<igrouping<string, latestreading>> groupingsbyproductid = latestreading in latestreadings group latestreading latestreading.productid; ienumerable<pricecomparison> pricecomparisons = grouping in groupingsbyproductid

flex spark datagrid itemrenderer get owner component -

in flex3 ,i can owner component listdata in datagrid.but in flex4 ,there no listdata property in itemrenderer,so can owner datagrid. i try datagrid= this.automationowner datagrid; ,it not work. you can access listdata property in flex 4. refer docs

ubuntu - MySQL command-line dont work -

i have ubuntu-server lamp. if try execute in command-line no answer, , command don't work. #mysql -u root -p enter password: mysql> grant privileges on *.* root@10.4.0.109 indentified "mypassword" -> this -> got. no query ok or errors. why wont work? doing wrong? add ";" close query otherwise mysql doesn't close it.

symfony - Symfony2 get parameters.yml in entity, special case -

i know against framework make entity container aware, special case, have credit card entity, , want this: /** * @return mixed */ public function getnumber() { $number = $this->number; $crypt = base64_decode($number); $number = mcrypt_decrypt(mcrypt_rijndael_256, $key, $crypt, mcrypt_mode_ecb); return trim($number); } /** * @param $number * @return $this */ public function setnumber($number) { $crypt = mcrypt_encrypt(mcrypt_rijndael_256, $key, $number, mcrypt_mode_ecb); $number = trim(base64_encode($crypt)); $this->number = $number; return $this; } and want $key secret parameters.yml, since dont want save in code. i can't pass parameter, when use formtype, cause form type not pass when binds request. $credit_card = new creditcard(); $credit_card->setcustomer($customer); $payment_form = $this->createpaymentform($credit_card); $payment_form->handlerequest($request); remove data modifications ent

javascript - Property text-rendering doesn't exist : optimizelegibility -

using code @ web browsers: .h1,.h2,.h3,.h4,.h5,.h6{margin:1.25em 0 0.2em;text-rendering:optimizelegibility} on wc3 validation getting error property text-rendering doesn't exist : optimizelegibility and seems property having issue android here is property no longer exists now? it never existed; text-rendering part of svg, not css. the text-rendering property svg property not defined in css standard. however, gecko , webkit browsers let apply property html , xml content on windows, mac os x , linux. in other words, text-rendering has effect on non-svg elements @ nonstandard. according mdn page, it's not supported anyway (internet explorer , opera don't understand it) , implementations exist have known issues. it might best avoid altogether. source: mozilla developer network .

python - cmd console game; reduction of blinking -

i'm writing arcanoid game in python on windows console , bothers me annoying blinking after every iteration of "displaying" loop. have idea how reduce it? part of code: #-*- coding: utf-8 -*- import time import os clear = lambda: os.system('cls') def gra(): koniec='0' while koniec!='1': in range(4): j in range(10): print '[___]', print '\n', in range(10): print '\n' in range(10): print ' ', print '~~~~~~~~~~' time.sleep(0.1) clear() gra() there limit can do, gathering 1 big string , printing once between screen clears better number of small prints in loop. run following code , how better second half of program runs first half: import time, os, random def display1(chars): os.system('cls') row in chars: print(''.join(row)) def display2(chars)

PHP says variables are undefined when they aren't -

i'm working on small framework projects develop, when set testing index page call class, says variables undefined. index looks this: error_reporting(e_all); ini_set("display_errors", 1); require_once('settings.php'); $base = $settings['basedir']; require_once($base.'/framework.php'); $cframe = new cframe($base, $settings); and framework.php looks this: class cframe { public function __construct($base, $settings){ $this->basedir = $base; $this->settings = $settings; require_once($this->basedir.'/db.php'); require_once($this->basedir.'/layout.class.php'); $this->layout = new layoutfinder($this->basedir.'/layout'); $this->db = new database; $this->dbc = $db->connectdb(); echo $basedir; } } the error messages when trying run are: warning: missing argument 1 cframe::__construct(), called in /var/www/cframe/co

linux - Oracle Sort Order - What may cause it to change -

disclaimer: know bad not use 'order by' in sql when sorted data required. i supporting pro*c program having wierd-problem. 1 of possible causes of wierd-problem may original developers (from long time ago) have not used order in sql though program logic depends on it! program has been working fine these years , started showing problems recently. we trying pin wierd-problem order mistake (there other cause candidates recent port solaris linux took place). what shadowy things on database end should @ may have changed old sort order? things data files etc? have experience pro*c on solaris magically sorting result-set? thanks! since know program cares order in results returned , know query submitted missing order by clause, there reason don't fix problem rather looking try figure out whether actual order of results may have changed? if fix known order by problem , "weird problem" have disappears, provide pretty evidence "weird problem&q

visual studio - C++ Dynamic Code Analysis tools for Windows -

i searching tool detect (memory leaks,memory corruption, ...) @ run-time in vs c++ and found : dynamic code analysis c++ unfortunately of them running under linux ask tools running vs or @ least windows thanks in advance i recommend check out runtime checker . designed detect memory leaks in windows c++ applications.

node.js - Pros & Cons of Running More Than One Node App Instance For A CodeBase -

we can run more 1 node app code base, need start them on diff port every time, not sure if doing or not. i can see following pros & cons of approach pros: multiple domains sub1.domain.com, sub2.domain.com , on, sharing same code base. updates code @ single place. any other pros mention? cons: may can cause dead lock on reading files or other multi process issue. any other cons mention? is move share code base? please share experience. thank you spawning several instances of application not bad or thing in itself, has application does. if application not access ressources shared instances of itself, not problem , can spawn many instances like, ever purpose see fit. but if application uses shared ressources such database or flat files, need take race conditions , dead locks account. handled on acid compliant databases, on document oriented databases not mature , requires have grasp on techniques , languages used. if there no obvious reason r

Elixir using ExActor is there a way to hibernate depending on conditions -

i learning elixir develop auction web site. have worker each auction, when worker started might go hibernate immediatly, during last n minutes before end of auction don't want worker hibernate each time bid received (tell me if wrong might not efficient). i have started developing basic genserver otp (handle_call, handle_info ...) , refactoring exactor , fsm (both saša jurić), , trying apply cqrs/es. is there way achieve using exactor , not going handle_call "basics" ? i achieve similar : {:reply, ...} when there less 10 minutes left until auction's end. {:reply, ..., :hibernate} when there more 10 minutes left until auction's end. in erlang, hibernation following things: discard process call stack do garbage collection after that, process memory might reduced values lower minimal heap size process wakes on message (if there messages in mailbox, wakes immediately) on waking up, there garbage collection, restores normal process size

curl - Using Google Url Shortener service from PHP: how to improve performance using gzip? -

i'm using google url shortener service in php code. it's working i'd improve performances , i've seen documentation (rif. https://developers.google.com/url-shortener/v1/performance ) suggests working partial resources , using gzip. i've adopted partial resources approach , works fine i'd use gzip suggestion too. by code is function compacturl($longurl) { $apikey = api; $postdata = array('longurl' => $longurl); $jsondata = json_encode($postdata); $curlobj = curl_init(); curl_setopt($curlobj, curlopt_url, 'https://www.googleapis.com/urlshortener/v1/url?key='.$apikey'&fields=id); curl_setopt($curlobj, curlopt_returntransfer, 1); curl_setopt($curlobj, curlopt_ssl_verifypeer, 0); curl_setopt($curlobj, curlopt_header, 0); curl_setopt($curlobj, curlopt_httpheader, array('content-type:application/json')); curl_setopt($curlobj, curlopt_post, 1); curl_setopt($curlobj, curlopt_postfields

javascript - How to make sure another (new) page is not shown when submitting a form -

for assignment need have table made of json data gotten server through ajax request. have have row able fill in data well, data has added server make ajax request from, using ajax post request. both things have been able do, have table shows data server can add data well. problem when click 'submit' button page load showing new url made added data server. want add data table, without opening new page. have seen answers on <form> tags, since have use <form> tag can not use 1 inside. how possible using <input> tag , button? this code in html have row fill in own data. <tr> <td rowspan="1" colspan="1"> <input type="text" name="name" placeholder="name" required=""> </td> <td rowspan="1" colspan="1"> <input type="text" name="category" placeholder="category" required="">

vb.net - VB Loading a list of variables from a text document -

i'm trying load list of variables formatted this: 5, 6, 3, 3, etc, , i'm trying output them variables this: strength = variableslist(1) agility = variableslist(2) but far, i've not been able find solution seems work i'm trying do. i'm working with: dim destination string = environment.getfolderpath("c:\roll20output\class" + outputclass + "2.txt") dim filereader1 new streamreader(destination) dim contents1 string dim index integer = 0 while filereader1.peek <> -1 contents1 = filereader1.readline dim array new arraylist array.addrange(contents1.split(",")) variableslist.add(array) end while strength = variableslist(1) agility = variableslist(2) but far can't seem output. would able help? thanks you using lot of outdated stuff in code (reading file streamreader, arraylist instead of list<t>

datetime - C# Add +1 day and set hours to 08:00:00 -

i have datetime field database example: 2013-06-18 17:00:00.000 value need add + 1 day , set hours 08:00:00 in case new value 2013-06-19 08:00:00.000 means new date value starts following day 8 a.m. i know there method addhours(...) in c# datetime don't see how may in case. var datetime = datetime.now; //example date datetime.adddays(1).date.addhours(8)

python - Django why can't I authenticate a user? -

i'm trying create user authentification form using django +1.8 encountered problem, when press form submit button, nothing happens, page reloading instead of loging in, why? here code: views.py from django.shortcuts import render django.contrib.auth import authenticate django.contrib.auth import login auth_login django.contrib.auth import logout auth_logout # create views here. def user(request): context = {} return render(request, 'user.html', context) def login(request): context = {} if request.method == "post": username = request.post['username'] password = request.post['password'] user = authenticate(username=username, password=password) if user not none: if user not none: auth_login(request, user) else: context['error'] = 'non active user' else: context['error'] = 'mauvais nom d\

javascript - Send data from main html page controller to a directive controller -

i trying communicate between controllers , directive. have studied few blogs , searched stackoverflow, there wonderful concepts these topics. case specific problems. tried solve problem in style found no luck. my problem is.. need send array directive. array defined in controller of main html file. , html page has directive too. directive has own controller job. need send array directive controller processing , array has 2 way binded changes in 1 side can reflected in side. i dealing kind of situation lately , figured out way deal it. can use procedure send data , process in directive controller. first make controller in main page , define array want... app.controller("ctrl", function($scope) { $scope.scope = $scope; //this transfer current scope directive $scope.array = [{ "a": "vfdxvf", "b": "sdc" }, { "a": "vfdxvf", "b": "sdc" },

angularjs - Get data to template from Service -

i need bind template data variables own service. service uses http retrieve data in json format. data right, because request asynchronous return of service undefined. how can sell asynchronous data template? without use of callback? appcomponent: import {component} 'angular2/core'; import {routeconfig, router, router_directives} 'angular2/router'; import {systemcomponent} "./system.component"; import {menuprovider} "./providers/menuprovider"; import {menu} "./entity/menu"; import {http, headers, http_providers} 'angular2/http'; @component({ selector: 'app', templateurl: '/templates/layout', directives: [router_directives] }) @routeconfig([ { path: '/', redirectto: ['/system'], useasdefault: true }, { path: '/-1/...', name: 'system',