Posts

Showing posts from March, 2015

eclipse - TypeError: file() argument 1 must be encoded string without NULL bytes, not str odoo -

the python version 2.8.2 , using in eclipse. getting error when trying execute following command: the function is: @api.one @api.depends('image') def _compute_image_details(self): if self.image: image_content = self.image.decode('base64') print type(self.image) print type(image_content) # file size self.size = len(image_content) # camera make , model exif tags img = pil.image.open(image_content) exif_tags = img._getexif() # 0x010f numeric code "make" exif field # can find list of fields here: exiv2.org/tags.html self.camera_maker = exif_tags.get(0x010f) the error raised is: traceback (most recent call last): file "/home/next/workspace/odoo-8.0/openerp/http.py", line 537, in _handle_exception return super(jsonrequest, self)._handle_exception(exception) file "/home/next/workspace/odoo-8.0/openerp/http.py", line 574, in dispatch

Run PowerShell script from folder Program Files via VBScript -

how can run powershell script within %programfiles% folder? i have tried variable %programfiles% without progress, "program files" can't ut work. my current code set shell = wscript.createobject("wscript.shell") shell.run("powershell c:\program files\temp\test.ps1"), 0 , true it's working if use network share without spaces set shell = wscript.createobject("wscript.shell") shell.run("powershell \\domain\sysvol\script\test.ps1"), 0 , true i have tried using """ can't powershell work. anyone know how solve this? need use vbscript in order start powershell script in background @ logon via gpo. otherwise show powershell window. try this. add parameter "-file" , double quotes around path. can , store %programfiles% in variable using expandenvironmentstrings: set shell = wscript.createobject("wscript.shell") sprogramfiles = shell.expandenvironmentstrings("%prog

javascript - Not smooth object rotation in the browser -

i visualizing objects in browser. object should viewed rotating around 1 axis time (x or y or z) or user can rotate mouse. problems having: 1- when autorotate object around 1 axis, starts rotate in feasable way (even not smooth in opengl) , after minute, rotation starts descrete, i.e. angle seems increasing 180 degrees) 2- when rotate object mouse, not smooth @ all, (i don't know how aften mouse event being fired). 3- how can rotate object mouse around 2 axis? y , x. 4- how put view window small div? tried goes big , out boundaries, here code: <script> var t = 0; var container, interval, camera, scene, render, linesmaterial, ismousedown = false, onmousedownposition, radius = 200, angle_y = 0, angle_x = 0; init(); function init() { var t = 0; var scene = new three.scene(); camera = new three.perspectivecamera(75, window.innerwidth / window.innerheight, 0.1, 1000);

php - How can I combine the following code? -

i want display 3 ul s: $one = '<ul>'; $j = 0; while($j<3){ $one .= '<li data-src="' . $myarray[0][$j] . '"></li>'; $j++; } echo $one; echo '</ul>'; $two = '<ul>'; $j = 0; while($j<3){ $two .= '<li data-src="' . $myarray[1][$j] . '"></li>'; $j++; } echo $two; echo '</ul>'; $whatever = '<ul>'; $j = 0; while($j<3){ $whatever .= '<li data-src="' . $myarray[2][$j] . '"></li>'; $j++; } echo $whatever; echo '</ul>'; how can combine above in shorter way? like so: for ($i = 0; $i < 3; $i++) { echo '<ul>'; ($j = 0; $j < 3; $j++) { echo '<li data-src="' . $myarray[$i][$j] . '"></li>'; } echo '</ul>'; }

java - I have a text field in html.Now i want to take the data from the html page and import it to my JSP page.How to do that? -

i have created input form in html.now accept data in jsp page should assign string variable accept data in jsp or variable should use.i want store data in mysql,there have created text column. this simple example 1/ create jsp page put form inputs <%@ page language="java" contenttype="text/html; charset=iso-8859-1" pageencoding="iso-8859-1"%> <!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <title> first jsp </title> </head> <body> <form action="helloservlet" method="get"> please enter color <br> <input type="text" name="color" > <input type="

SilverStripe ModelAdmin menu title translation -

i'm trying translate custom modeladmin menu title such: private static $menu_title = _t('cms.mymodeladmin', 'my model admin'); this results in 500 error, whereas static string works without issues. i'm not sure why since assumed variable isn't database entry. how can translate menu title, preferably using _t? i've not translated v3, looking at... http://api.silverstripe.org/3.1/source-class-leftandmain.html#665 $title = _t("{$menuitem->controller}.menutitle", $defaulttitle); this indicate me if have string defined along other lang strings in yml format (but required languages)... mysite\lang\en_gb.yml en_gb: myadmin: menutitle: 'mytitle' (where "myadmin" name of "class myadmin extends modeladmin...")

java - Android response code 200 from php mysql but does not make entries in database -

i sending data android app form php mysql server , server getting response code 200 failed make entries database. here php file sending post variables <?php $host='localhost'; $uname='root'; $pass='pass'; $db='app'; $con=mysqli_connect($host,$uname,$pass,$db); $first_name=$_post['first_name']; $last_name=$_post['last_name']; $phone=$_post['phone']; $mail_id=$_post['mail_id']; $password =$_post['password']; $la=$_post['la']; $lo=$_post['lo']; $ac=$_post['ac']; $pro=$_post['pro']; if($con){ echo "connected database $first_name "; //print variable check file getting inputs.its working. } else{ echo 'failed connect database '; } $sql="insert `mobile_app`(`first_name`, `last_name`, `phone`, `mail_id`, `password`, `la`, `lo`, `ac`, `pro`) values ($first_name,$last_name,$phone,$mail_id,$password,$la,$lo,$ac,$pro)"; if(mysqli_query($con,$s

c++ - Multiple Errors Building Deck of Cards -

receiving 2 errors trying compile files. (received down vote without explanation; fail see how violates guidelines.) 1) c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\c++0x_warning.h:32:2: error: #error file requires compiler , library support iso c++ 2011 standard. support experimental, , must enabled -std=c++11 or -std=gnu++11 compiler options i attempted add flags in eclipse mars, doesn't seem have worked. thing i'm missing? 2) \deckofcards.h:21:8: error: 'array' in namespace 'std' not name template type this in regards std::array<card,52> cards_; line in deck of cards header file. first time attempting build deck of cards multiple classes...or single class matter if i'm making obvious error apologize. edit: exact message compiler: 07:56:55 **** incremental build of configuration debug project texasholdem **** info: internal builder used build g++ -o0 -g3 -wall -c -fmessage-length=0 -o texasholdemmain.o "..\\texasholdemm

javascript - Creating a scrolling page without a plug-in. No scroll effect -

i'm trying create 1 page scrolling site without using plugin. following tutorial https://www.abeautifulsite.net/smoothly-scroll-to-an-element-without-a-jquery-plugin-2 links work there no scrolling effect, jumps section. js $('a[href^="#"]').on('click', function(event) { var target = $(this.getattribute('href')); if( target.length ) { event.preventdefault(); $('html, body').stop().animate({ scrolltop: target.offset().top }, 1000); } }); html (updated remove errors) <div id="container"> <div class="banner"> <a class="button" href="#welcome"><h2 style="text-align: center;"></h2></a> </div> <div id="page1"> <a id="welcome"></a> <h1></h1> <div id="welcome_squares"> <div class="quarter-column"> <h3></h3> <p>&

JavaFx TabPane : One controller per Tab -

i'm new javafx , i'm trying have 1 controller per tab in tabpane. found answer : https://stackoverflow.com/a/19889980/393984 lead me : main.fxml <tabpane fx:controller="sample.controller" maxheight="-infinity" maxwidth="-infinity" minheight="-infinity" minwidth="-infinity" prefheight="400.0" prefwidth="600.0" tabclosingpolicy="unavailable" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/null"> <tabs> <tab text="configuration"> <content> <fx:include fx:id="mconfigtabpage" source="configtab.fxml"/> </content> </tab> <tab text="todo"> <content> <anchorpane minheight="0.0" minwidth="0.0" prefheight="180.0" prefwidth="200.0" /> </content> </tab> &l

version - Can iOS updates be forced OTA without DEP? -

i have "kiosk" type app ipads i'd sell 3rd parties. app runs in single app mode. want offer over-the-air control of: app updates ios updates without user intervention. i can setup ipad supervised using apple configurator , can upgrade app using mdm - can confirm have done this? mdm did use? also possible force ios update? reports apple’s device enrolment program needed mean 3rd parties have purchase ipads through dep? also can done without mdm using apple’s profile manager , os x server instead? interested in anyones experience in area. mdm can used update app. os updates can forced through dep. in case of kiosk app, cannot update app on air. way remove app kiosk mode. enable kiosk other app. update required app. and put app in kiosk mode. all these steps can done on air using mdm. have tried out hexnode mdm. enabling , disabling of kiosk mode simple , fast. worth checking out.

javamail - IMAP folder receives email Twice -

i trying develop email listener using java mail api. receiving same email twice, scenario not happening every time; randomly occurs. the following code used make imap connection try { isconnecting.set(true); createsession(); logger.warn("session created "+getidentifier() +"on imap"+imaploginid+" pw "+imappasswrd); store = session.getstore("imap"); if(store==null){ logger.warn("store null return here"+getidentifier() +"on imap"+imaploginid+" pw "+imappasswrd); return; } store.connect(imapserveraddress, imaploginid, imappasswrd); logger.warn("connecting successful "+getidentifier() +"on imap"+imaploginid+" pw "+imappasswrd); folder = store.getfolder(foldername); logger.warn("folder creating "+getidentifier() +"on imap

c# - hexadecimal value 0x1E, is an invalid character -

i loading lot of xml document , of them return error '', hexadecimal value 0x1e, invalid character. line 1, position 202021. , there different character. how remove them? removing them easy, unsafe. example if part of digital signature, digital signature become invalid if remove selected characters. when sends bad xml need find out came , fixed @ source. if acquired electrical appliance power plug didn't fit in power socket, wouldn't try bend pins make fit - take shop bought , complain.

sql - Compare column entry to every other entry in the same column -

i have column of values in sqlite. value ----- 1 2 3 4 5 for each value know how many of other values larger , display result. e.g. value 1 there 4 entries have higher values. value | count ------------- 1 | 4 2 | 3 3 | 2 4 | 1 5 | 0 i have tried nested select statements , using count(*) function not seem able extract correct levels. suggestions appreciated. many thanks you can correlated subquery in sqlite: select value, (select count(*) t t2 t2.value > t.value) "count" t; in other databases, use ranking function such rank() or dense_rank() , sqlite doesn't support these functions.

visual studio 2015 - Failed to make the following project runnable (Object reference not set to an instance of an object.) -

when create default web project in visual studio 2015 (update 3) installed .net core 1.0 sdk , tooling (preview 2) , restart visual studio after reverting local source control changes getting following compilation error : failed make following project runnable: mydefaultwebproject (.netcoreapp,version=v1.0) reason: object reference not set instance of object. according visual studio error located in c:\program files (x86)\msbuild\microsoft\visualstudio\v14.0\dotnet\microsoft.dotnet.common.targets on line 262 on line there following code: <dnx runtimeexe="$(sdktoolingexe)" condition="'$(_designtimehostbuild)' != 'true'" projectfolder="$(msbuildprojectdirectory)" arguments="$(_buildarguments)" /> how can fix such problem? the working solution managed find run dotnet restore command: c:\dev\*****>dotnet restore welcome .net core! --------------------- learn more .net core @ https://a

c# - Convert JsonObject to List<T> -

i have json value want convert list [{ "id_cuenta": 1, "nombre": "mercedes luj\u00e1n", "apellido": "llano", "ci": 123, "telefono": 123456789, "dispositivo_id": "355790037549877", "password": "holaa", "created_at": "2016-07-02 11:36:57", "updated_at": "2016-07-09 09:56:53" }] this code far: private list<cuentaobtener> mcuenta; btnlogin.click += async(object sender, eventargs e) => { string url = "http://localhost:8000/api/v1/cuenta_ci/" + ci.text + ""; jsonvalue json = await obtenerci(url); private async task<jsonvalue> obtenerci(string url) { httpwebrequest request = (httpwebrequest)httpwebrequest.create(new uri(url)); request.contenttype = "application/json";

java - javax.jms.JMSSecurityException: User name [null] or password is invalid -

i have simple jms sender , receiver. use jboss-amq broker. use jndi lookup values. jndi.properties java.naming.factory.initial = org.apache.activemq.jndi.activemqinitialcontextfactory java.naming.provider.url = tcp://localhost:61616 java.naming.security.principal = admin java.naming.security.credentials = admin connectionfactorynames = connectionfactory queue.trade.q = trade.q using these values got following exception: exception in thread "main" javax.jms.jmssecurityexception: user name [null] or password invalid. @ org.apache.activemq.util.jmsexceptionsupport.create(jmsexceptionsupport.java:52) @ org.apache.activemq.activemqconnection.syncsendpacket(activemqconnection.java:1393) @ org.apache.activemq.activemqconnection.ensureconnectioninfosent(activemqconnection.java:1496) @ org.apache.activemq.activemqconnection.start(activemqconnection.java:523) @ examples.jmssender.main(jmssender.java:26) caused by: java.l

Please does anybody have a PHP library or SDK for orange-api SMS Cameroon -

i developing php based web application , want integrate orange sms api cameroon. i'm in need of php sdk or library ease work. you have php sdk orange sms api on github see here link https://github.com/ismaeltoe/osms-php

plot - R raster image distorted -

Image
i'm trying create map includes raster , polygon shapefile. since add legend i'm working layout() command. however, found out plotting raster overwrite layout() recommended use image() instead of plot() raster ( "r - plotting multiple rasters using matrix layout" . works totally fine layout() command , overlaying of polygon shapefile no problem either. but, map totally distorted, there compressions in y , y direction (see image). on left layers plotted proportional, on right map distorted: here part of code: #loading shapes , raster datasets citymap <- raster("citymap.tif") rise <- readshapespatial("rise") setwd("g:/maps") pdf(paste("map",i,".pdf", sep=""), width=16.53, height=11.69) #set layout map mat <- matrix(c(1,2), 1,2) layout(mat, c(0.75, 0.25)) par(mar=c(0.5,0.5,2.5,0.5), oma=c(0,3,1,0)) #set map extent maxxlim <- max((data$utm_x) + 800) maxylim <- max((data$utm_y) +

node.js - node express bodyparser deprecated, new syntax does not work -

i trying write simple html page upon button click, send value text input field node server, prints on console of entered value. know express 4 previous bodyparser deprecated , following discussion here: bodyparser deprecated express 4 but following code still errors when starting server: var express = require('express'); var app = express(); app.use(express.static('resources')); app.use(express.static(__dirname)); app.use(express.bodyparser.urlencoded()); app.get('/', function (req, res) { res.sendfile( __dirname + "/" + "index.html" ); }) app.post('/java_preview', function (req, res) { console.log("request java_preivew:"); console.log(req.body.url); }) var server = app.listen(3000, function () { console.log("server started...") var host = server.address().address var port = server.address().port console.log("listening @ http://%s:%s", host, port) }) html: $(document).re

vim - Using abbreviation to insert comment -

i’m trying set abbreviation in .vimrc insert comment template heading-level comments in css files. the comment want insert is: /* ========================================================================== # ========================================================================== */ i jump # , add title there (e.g. buttons ). the abbreviation have attempted set looks this: iab comsec· \/* ========================================================================== \<cr># \<cr>========================================================================== */ (where · represents trailing space.) right away feels pretty crude, specific problem if try , drop comsec in css, starts wrapping in more comments. output looks this: /* ========================================================================== * # * ========================================================================== */ notice 2 * @ beginnings of lines 2 , 3? is there way tell vim

android - best tool for this case? -

i'm oracle developer. programming language know pl/sql, , want develop application , upload google play , apple's app store it's available download, , should work offline. oracle developer cannot deal mobile apps, there oracle apex, , can workaround, it's hard , cannot work offline. application small (just 5 or 6 pages , tables). i want pick programming language , tools can task in few days. go phonegap . phonegap create apps using web technologies know , love: html , css , , javascript .

objective c - iOS MediaPlayer Remote control events not working -

i'am trying add remote control events music player app, can't working. some facts: i'm using [mpmusicplayercontroller applicationmusicplayer]; i added audio , airplay , picture in picture background modes; the example playing audio; it not receive remote notifications lock screen , control center; i've made example project can downloaded here: example project main source: #import "viewcontroller.h" #import <mediaplayer/mpmediapickercontroller.h> #import <mediaplayer/mpmediaquery.h> #import <mediaplayer/mediaplayer.h> @interface viewcontroller () @property (strong, nonatomic) mpmusicplayercontroller *musicplayer; @property (strong, nonatomic) mpmediaitemcollection *musicplayersongs; @end @implementation viewcontroller - (void)viewdidload { [super viewdidload]; _musicplayersongs = [mpmediaitemcollection alloc]; _musicplayer = [mpmusicplayercontroller applicationmusicplayer]; [_musicplayer setshufflemode

scala - How to transform RDD, Dataframe or Dataset straight to a Broadcast variable without collect? -

is there way (or plans) able turn spark distributed collections ( rdd s, dataframe or dataset s) directly broadcast variables without need collect ? public api doesn't seem have "out of box", can done @ lower level? i can imagine there 2x speedup potential (or more?) these kind of operations. explain mean in detail let's work through example: val myubermap: broadcast[map[string, string]] = sc.broadcast(mystringpairrdd.collect().tomap) someotherrdd.map(somecodeusingtheubermap) this causes data collected driver, data broadcasted. means data sent on network twice. what nice this: val myubermap: broadcast[map[string, string]] = mystringpairrdd.tobroadcast((a: array[(string, string)]) => a.tomap) someotherrdd.map(somecodeusingtheubermap) here spark bypass collecting data altogether , move data between nodes. bonus furthermore, there monoid-like api (a bit combinebykey ) situations .tomap or whatever operation on array[t] expensive, can po

firebase - Database rule allowing to list children with read access -

i have list of messages in app, , users retrieve list of own messages. if i'm logged in "user1" can fetch /messages/message1 without problems, if want retrieve messages (without being able access other user's messages) /messages/ permission denied though have access of child elements how can give users list of of child elements read permission without knowing ids of messages? thank in advance. below database: { "messages" : { "message1" : { "sender" : "user1_uid" }, "message2" : { "sender" : "user1_uid" } } and here rule: { "messages": { "$weddingid": { ".read": "data.child('sender').val() == auth.uid" } } } adolfo has 1 valid approach. spreads message data under user-specific nodes. common in nosql databases, building many "mini-tables of messages&quo

excel - Use VBA to insert a formula in a cell -

i have function should fill 8 rows formula sub df_opbouwen() num_weeks = 8 + 10 = 10 num_weeks sheets("blad1").cells(i, 2).formula = "=weeknummer(d10)" next end sub however, when open excel, still #name? error. that's strange because when enter =weeknummer(d10) in cell work. any thoughts on goes wrong here? you have small type error: sub df_opbouwen() num_weeks = 8 + 10 = 10 num_weeks sheets("blad1").cells(i, 2).formula = "=weeknum(d10)" next end sub

ubuntu 14.04 - Vagrant provisioning - installing ruby version on rbenv fails -

i'm having problems installing ruby version using rbenv on ubuntu 14.04 (on vagrant, berkshelf, virtualbox running on windows 10). here berksfile: source "https://supermarket.chef.io" cookbook 'apt' cookbook 'build-essential' cookbook 'mysql', '5.5.3' cookbook 'postgresql', '~> 4.0.6' cookbook 'ruby_build' #cookbook 'rbenv', git: 'https://github.com/aminin/chef-rbenv.git' #cookbook 'rbenv', git: 'https://github.com/chef-rbenv/chef_rbenv' cookbook 'ruby_rbenv', git: 'https://github.com/chef-rbenv/ruby_rbenv' #'~> 1.0.1' cookbook 'vim' cookbook 'nodejs', '~> 2.4.4' cookbook 'chef-vagrant-frontback', path: 'chef-vagrant-frontback' vagrantfile: # -*- mode: ruby -*- # vi: set ft=ruby : vagrant.require_version '>= 1.5' # change these 2 paths folders # frontend = "../linkip-frontend/&quo