Posts

Showing posts from August, 2010

c++ - Qt Update QPixmapItem in QGraphicsScene -

i want have image in main window buttons laid out on top of image. using view, scene , pixmap item when try change pixmap item in slot function, crash. here example of have: mainwindow::mainwindow(qwidget *parent) : qmainwindow(parent), ui(new ui::mainwindow) { ui->setupui(this); //scene, view, pixitem , button private variables in header qgraphicsscene *scene = new qgraphicsscene(this); qgraphicsview *view = new qgraphicsview(scene); qgraphicspixmapitem *pixitem = new qgraphicspixmapitem; pixitem->setpixmap(qpixmap(":/img/this.png")); scene->additem(pixitem); qpushbutton *button = new qpushbutton(view); this->connect(button,signal(clicked()),this,slot(slot())); this->setcentralwidget(view); } void mainwindow:slot() { pixitem->setpixmap(qpixmap(":/img/that.png")); } possible duplicate solution did not work me: qt update pixmap of qgraphicspixmapitem you have shadowed member variabl

java - Android ExpandableList onChildClickListener in Fragment does not work -

i have code onchildclicklistener snippet code below onchildclicklistener occl = new onchildclicklistener() { @override public boolean onchildclick(expandablelistview parent, view v, int groupposition, int childposition, long id) { // todo auto-generated method stub toast.maketext(getactivity(), "jalan", toast.length_long).show(); return true; } }; lv2.setonchildclicklistener(occl); but toast does'nt appear, why can occurring? depending 2 files, (sorry long post, want clear) the below snipped adapter code: package com.em.crayonpediamoodlesiswa; import java.util.arraylist; import java.util.hashmap; import java.util.list; import android.content.context; import android.content.entity; import android.graphics.typeface; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import android.widget.baseexpandablelist

c# - Query Active Directory Status by User's Email -

Image
i facing strange issue. want know whether user's ad account disabled or not providing user's email parameter. below code working great me set of users in our org. other set of users returning null - though can able verify these set of users in ad manually. can please me on come issue. private string getcurrentdomainpath() { directoryentry de = new directoryentry("ldap://rootdse"); return "ldap://" + de.properties["defaultnamingcontext"][0]. tostring(); } public bool? findaccountstatusbyemail(string email) { using (directorysearcher dsearch = new directorysearcher(new directoryentry(getcurrentdomainpath()))) { dsearch.searchscope = searchscope.subtree; dsearch.filter = "(&(objectcategory=person)(samaccountname=*)(mail=" + email.trim() + "))";

ajax - Redirecting with return statement influences the rendering process in next page -

i have problem rendering of datatable. in application have navigation bar: <h:form> <ul class="nav nav-tabs"> <li class="active" role="presentation"> <h:commandlink value="veranstaltungen" action="#{eventcontroller.redirect('veranstaltung.xhtml')}"/> </li> <li role="presentation"> <h:commandlink value="beacons" action="#{beaconcontroller.redirect('beacon.xhtml')}"/> </li> [...] </ul> </h:form> redirect (beaconcontroller): public string redirect(string link) { beacons = database.getallbeacons(); return "./" + link; } the navigation works perfectly, when submit form beacondata in beacon.xhtml datatable won't rendered. <h:form id="beaconstable"> <p:datatable value="

python - how to identify elements of a list that corresponds to a criteria and apply a function -

so need program encrypts text file: for x in range(1): random_generated=(random.sample(range(33,126), 8)) random_values=(random_generated[0:]) print random_values ######using random function generate numbers 33 126, 8 times###### ascii="".join([chr(i) in random_values]) ###to convert numbers ascii characters### print ascii ###displaying user### ###source: stackoverflow.com################ offset_factor=(((sum(random_generated[0:]))//8)-32) ###to calculate offset factor based on generated### print offset_factor opentxt= open(filename, 'r').read() ###source: ubuntuforums.org### print opentxt ###opentxt being contents of sample.txt### converted=[ord(c) c in opentxt] ###conversion of text list of ascii### print converted offset_add=[s + offset_factor s in converted] i have gotten point have created list of ascii code based on text file , added randomly generated number each of asc

java - How to run program from %PATH% instead of current folder -

if run program exists in %path% in windows when there program same name in current folder select 1 in current folder instead. there way prevent (to disregard current folder)? the reason question have java program have placed in run-key in registry this: [hkey_local_machine\software\microsoft\windows\currentversion\run] myprogram = javaw -cp myprogram.jar com.mycompany.myprogram the problem on 1 computer tested on didn't work. complained wrong jre version (1.7 instead of 1.8). found on computer installed jre 1.8 on 1.7, 1.7 files still left in windows\system32. if launch javaw -cp myprogram.jar com.mycompany.myprogram manually in command prompt works, unless have windows\system32 current folder. the problem when windows starts programs during startup (from run-key in registry) has system32 current folder , therefore use wrong jre-version. i can fix on specific computer removing incorrect exe-files system32, want work when else installs somewhere else, , best way have

java - Unable to scroll messages in J2me, I am using lwuit library -

Image
i working last couple of month on j2me chat app. stuck in messages last 1 month. have added screen shot of message screen in comment. my application scenario described below. i have form named conservationform border layout . in main form have added further 2 container 1 msgpane boxlayout , other inputpane flowlayout . msgpane contains messages both receiver , sender. each complete message appended in msgpane in form of container named mycontainer . mycontainer contains text , images in form of labels have appended in mycontainer . i have tried possible options efforts wasted , nothing achieved. in advance assistance. my skills level in j2me , in lwuit beginner. seeking experts in j2me , lwuit. i pasting code of conversation message below. public void /*@shah displayable */ getguiconversation(string msgtext) { final form conservationform = new form(currentroster.jid.getnickname()); boolean cananswer = currentconversation.cananswer(); conservationfor

angularjs - How to modify your CSS working with Mobile Angular UI and Bootstrap -

i know question has huge number of topics, think helpful community have clear answer in 1 topic. this modifying css while using mobile angular ui, bootstrap template. this how project organized mobile angular ui : bin bower_components hooks node_modules platforms plugins src www i have index.html in src/html/ , other webpages in src/templates . index importations : <link rel="stylesheet" href="css/app.min.css" /> <link rel="stylesheet" href="css/responsive.min.css" /> thanks that, can see bootstrap template on webpages. don't know how modify it. 2 solutions saw creating design.css , import after 2 other .css, doesn't work. saw should import bootstrap.min.css , has no effect on webpages. so how modify global design webpages, example background color, keeping bootstrap template ? shall go less files ? what's aim of these 2 css responsive.min , app.min ? how should organize css files while w

javascript - Query text() over dynamically added img -

i realize it's answered question, wanted ask, if there new on market, can solve issue. i'm loading images specified coordinates using javascript. var span = document.createelement("span"); span.innerhtml = "<img src=\"source.gif\" id=\"someid\">"; span.style.position = "absolute"; span.style.left = coodinatesleft[i] + "px"; span.style.top = coodinatestop[i] + "px"; document.body.appendchild(span); later on, when mouse goes on images want use simple mouseenter function in jquery $("mydivid").mouseenter(function(){ $(this).text("something"); }); to write text there, image is. , don't text, suppose, because image more foreground text. other times i've used it, , worked, had div, , no actual image source on it. is there way keep structure , append text on image? ps: read z-index, not sure if need, since don't have pre-defined css class images. thanks in a

angularjs - Error for Cast to ObjectId failed for value "[object Object],[object Object],[object Object] -

i using mongodb . when want update fields getting following error cast objectid failed value [object object],[object object],[object object] . when post empty let me update properties while post somethings not able update provider properties , getting following error view have used modal ui bootstapt. <label class="col-lg-2 control-label">company name</label> <div class="col-lg-10"> <input name="name" type="text" ng-model="provider.name" minlength="4" class="form-control" placeholder="amazon web services" required> <span class="help-block" ng-show="cspregister.name.$dirty && cspregister.name.$invalid"> not valid name!</span> </div> </div> <div class="form-group"> <label class="col-lg-2 control-label">abbreviated company name</label&

Converting .docx to pdf with libreoffice using php -

i trying convert .docx file .pdf using libreoffice. my libreoffice installed directory c:\program files\libreoffice 4 using commandline getting output with c:\program files\libreoffice 4\program>soffice.exe -headless -convert-to pdf c:\temp\test.docx -outdir c:\temp but in php no output $command = '"c:\program files\libreoffice 4\program\soffice.exe" -headless -convert-to pdf c:\temp\test.docx -outdir c:\temp'; exec($command, $output); how solve ? inadvance.

c++ - Pointers, References and the other one -

i'm learning references , pointers , variables. think i've gotten myself lost. at high level, understanding *pointer = "points" location in memory &reference = references values so, means char* c; //pointer char& c; //reference char c; //does not have flash name? prefix? if pointer "location" (as per description above) , reference value, char c ? both? or value? tests indicate value only, if true, why use reference ? eg, why use void myfunction(int& size); over void myfunction(int size); let me give variables unique names, easier talk them: char = 'x'; char& b = a; char* c = &a; in example, a name fresh box code of character 'x' stored inside it: +-----+ | 120 | +-----+ and b name same box: +-----+ | 120 | b +-----+ finally, c name of box containing pointer first box: +-----+ | 120 | b +-----+ ^ | +--|--+ c | | | +-----+

javascript - How can I use enter/br/ or \n in getElementById("ErrorTable").innerHTML? -

hello guys might need can not figure out. i have registeration form , added red table errors in filling inputs, have new problem , errors in 1 row , don't know how can "enter" , down in list , not 1 one right left. document.getelementbyid("errortable").innerhtml += '•agree terms'; and table html: <center> <div class="registertextarea"> <table id="errortable"> </table> </div> </center> i have new problem here : http://prntscr.com/7bxe6k . how clear ul doesn't submit again picture , how fit in box split left when there no space. html: <center> <div class="errors"> <ul id="errortable"></ul> </div> </center> style: .errors { background-color: #ffb6b6; border: groove 1px #a81b1b; width: 500px; height: 50px; text-align: right; font-size: 10px; color: #a81b

java - OutOfMemoryError on tomcat7 -

i developing web-app takes zip file, uploaded user, unzips on server, , process files. works charm when zip file not large (20-25mb) if file or on (50mb), produces outofmemoryerror. i have tried increase java maximum memory allocation pool adding export catalina_opts="-xmx1024m" startup.sh in tomcat7, error still persists. afaik, problem in unzipping .zip file. top shows tomcat uses 800mb of memory during extraction of 50mb file. there solution, enable upto ~200mb uploads, whilst efficiently using available memory? the code unzipping follows: package user; import java.io.bufferedinputstream; import java.io.fileinputstream; import java.io.filenotfoundexception; import java.io.fileoutputstream; import java.io.ioexception; import java.util.zip.zipentry; import java.util.zip.zipinputstream; public class unzip { public void unzipfile(string filepath, string opath) { fileinputstream fis = null; zipinputstream zipis = null; zipentry zentry = null; t

bash - Node.js Unix socket not echoing -

i trying create file can cat or echo strings , receive strings output. if understand correctly can unix socket. i've tried write server can't seem recognize input: 'use strict'; var net = require('net'), fs = require('fs'), socketaddress = '/tmp/test-socket', server; server = net.createserver(function (client) { var whole = ''; client.on('data', function (data) { whole += data; }); client.on('end', function () { client.write(whole); }); }); fs.unlink(socketaddress, function (error) { if (error && error.code !== 'enoent') { throw error; } server.listen(socketaddress, function () { console.log('socket listening @ ' + socketaddress); }); }); i try echo 'hello world!' | /tmp/test-socket , bash: /tmp/test-socket: no such device or address . ls -l /tmp yields: srwxr-xr-x 1 jackson jackson 0 jun 1

Android fragments not popping with POP_BACK_STACK_INCLUSIVE -

i have 3 screens, 1 screen pick sort of document. second screen take photo, screen sends uri of taken photo within bundle third screen. third screen screen edit photo. when going first screen want screen clear backstack can select new things. however when use getactivity().getsupportfragmentmanager() .popbackstack(null, fragmentmanager.pop_back_stack_inclusive); getactivity().getsupportfragmentmanager().begintransaction() .replace(r.id.fragment_container, new fragmentpickdocument()) .addtobackstack("pickdocument").commit(); and start on screen 1, same image appears on screen 3 first go. reason when clearing backstack fragments stay alive , reappear same variables. how happening? edit : every code im adding screen 1. getactivity().getsupportfragmentmanager().begintransaction() .replace(r.id.fragment_container, new fragmenttakephoto()) .addtobackstack(&q

r - tab dependent input for shiny dashboard -

i facing issue shiny dashboard. trying create simple dashboard 2 tabitems on left. each tabitem have specific set of controls , plot. missing on server side link input tab because controls of second tab behaving strangely. appreciated. here code library(shiny) library(shinydashboard) library(data.table) library(ggplot2) data = data.table(group = rep(c(1, 3, 6), each = 10), x = rep(1:10, times = 3), value = rnorm(30)) sidebar <- dashboardsidebar( sidebarmenu(id = 'sidebarmenu', menuitem("tab 1", tabname = "tab1", icon = icon("dashboard")), menuitem("tab 2", icon = icon("th"), tabname = "tab2") ) ) body <- dashboardbody( tabitems( tabitem(tabname = "tab1", fluidrow( box(title = "controls", checkboxgroupinput('group', 'group:', c(1, 3, 6), selected = 6, inline = true), width = 4),

javascript - How can we turn radio button checked when we type its input -

as see below, have radio button group has 3 options. last 1 text input. there way make last 1 checked when type in text box? <input type='radio' name='result' value="0"/><label for="0">false</label><br/> <input type='radio' name='result' value="1"/><label for="1">true</label><br/> <input type='radio' name='result' value="2"/><label for="2"> <input type="text" placeholder="type result" name="result_answ"></label> provided have jquery loaded use this: <input type='radio' name='result' value="0"/><label for="0">false</label><br/> <input type='radio' name='result' value="1"/><label for="1">true</label><br/> <input type='radio' name='

c# - lambda expression join list<object> with list<string> -

i have list<object> , list<string> records. want inner join both list. following list records. var listcontributiondetailstobeupdated = new list<contributiondetailmodel> { new contributiondetailmodel { employeenumber="1", employeefirstname="david", employeelastname="k", nhipnumber="nhi-100" }, new contributiondetailmodel { employeenumber="2", employeefirstname="xavior", employeelastname="f",nhipnumber="nhi-101"}, new contributiondetailmodel { employeenumber="3", employeefirstname="george", employeelastname="s", nhipnumber="nhi-102" }, new contributiondetailmodel { employeenumber="4", employeefirstname="pandit", employeelastname="h",nhipnumber="nhi-103"}, new contributiondetailmodel { employeenumber="5", employeefirstname="zania", employeelastname="d",

Amazon s3: how to set file viewing permission -

i developing web system uses amazon s3 file server. files uploaded s3 directly , corresponding urls written html page. example, have file @ s3 location is: https://myaccount.amazonaws.com/files/abc.png and in html put: <img src="https://myaccount.amazonaws.com/files/abc.png"> the image show correctly in browser. however, happen have set permission on s3 everyone viewable , means file open public. how restrict file viewing permission members of site, not public? there several ways grant access amazon s3 objects: access control lists (acls) on each individual object a bucket policy on specific bucket an iam policy (identity , access management) on specific user/group signed urls (signed, time-limited urls) the first question, however, how define "the members of site, not public". assume mean "to people want allow access app, , not others", , app knows these users, not defined in iam. (iam used store users access aws

php - I am getting this error while debugging -

this question has answer here: php parse/syntax errors; , how solve them? 11 answers parse error : syntax error, unexpected '->' (t_object_operator) in c:\xampp\htdocs\evnxt\evnxt\vendor\evnxt\admin.php on line 25 line 24 : $qb = $entitymanager->createquerybuilder(); line 25 : $qb->select('f')->from('fest', 'f')->where('f.datetime >:date')->setmaxresults(10)->setparameter('date', time()); line 26 : $qb->orderby('f.datetime', 'asc');->setfirstresult($page); line 27 : $fests = $qb->getquery()->getresult(); actually problem in line 26. please change $qb->orderby('f.datetime', 'asc');->setfirstresult($page); $qb->orderby('f.datetime', 'asc')->setfirstresult($page); note:- line 25 seems correct.may

javascript - Simple previous\next slider using angular -

i have web page displays list of items, number of items can quite big display 3 @ time , have next\previous buttons let user navigate between items. i'm new angular managed retrieve items , display them on ui have no idea start display 3 , wire next , previous buttons enable navigation. here's code: js: var app = angular.module('myapp', []); app.controller('servicescontroller', function ($scope, $http) { $http.get(url + "api/mapserviceapi/getservers") .success(function (response) { $scope.servers = response.result; }); }); html: <div class="row top-space" ng-app="myapp" ng-controller="servicescontroller"> <div class="pull-left"> <img src="~/content/images/service/previous.png" /> <h4>previous</h4> </div> <div class="pull-right"> <img src="~/content/images/service/next.png&q

Permission denied error on CSV export Laravel -

i using laravel 4. when try export database table csv file error, fopen(file.csv): failed open stream: permission denied this code, public function getexport(){ $table = users::all(); $filename = "file.csv"; $handle = fopen($filename, 'w+'); fputcsv($handle, array('name', 'status')); foreach($table $row) { fputcsv($handle, array($row['name'], $row['status'])); } fclose($handle); $headers = array( 'content-type' => 'text/csv', ); return response::download($filename, 'tweets.csv', $headers); } how can fix ? try chmod 777 file.csv on terminal , run php again

facebook - Creating widget for product website -

i not sure if asking correctly or terminology correct according understanding. developing video hosting website , want users share videos social network , may embed them on website. when share videos, in feed should able play videos without leaving current social networks, youtube, when share videos on twitter or facebook can play youtube videos there without opening youtube site. should build such widget ? how create such? make sure pages videos reside on shared contain valid , correct opengraph tags. have @ https://developers.facebook.com/docs/reference/opengraph/object-type/video.other/ https://developers.facebook.com/docs/sharing/opengraph/using-objects https://developers.facebook.com/docs/sharing/best-practices

Android 5.1.1 lollipop return null file path if image chosen from gallery -

android 5.1.1 lollipop return null file path if image chosen gallery. below code works fine in devices below 5.1.1, doesn't work in lollipop 5.1.1 uri contenturi = data.getdata(); cursor cursor = null; try { string[] proj = {mediastore.images.media.data}; cursor = context.getcontentresolver().query(contenturi, proj, null, null, null); int column_index = cursor.getcolumnindexorthrow(mediastore.images.media.data); cursor.movetofirst(); return cursor.getstring(column_index); } { if (cursor != null) { cursor.close(); } } cursor.getstring(column_index) returns null. for have ended getting image gallery. i've tested on 4.4, 5.0.1 , 5.1.1 should work on previous versions (with new , old google photo app), should less hacky , doesn't require check on android version. public static uri handleimageuri(uri uri) { if (uri.getpath().contains("content")) { pattern patt

datepicker - how to set Angular Kendo Date Picker min date to yesterday? -

i working on kendo ui datepicker ,i want set min date yesterday. could me? i have tried this var mindate = date.setdate((new date()).getdate() - 1); but of no use. here code. <body> <div id="example" ng-app="kendodemos"> <div class="demo-section k-content"ng-controller="myctrl"> <div class="box-col"> <h4>select date:</h4> <input kendo-date-picker ng-model="datestring" k-options="monthselectoroptions" k-ng-model="dateobject" /> </div> <style> .box-col { width: 400px; } </style> </div> <script> angular.module("kendodemos", [ "kendo.directives" ]) .controller("myctrl", function($scope){ var date = new date(); $scope.monthselectoroptions = {

mysql - Find the Average salary deviation for an employee within department -

Image
i have list of employees work within set of teams. trying figure out each year difference each employee’s salary department’s average. have been looking @ standard deviations i’m little stuck if need have sub select achieve this. the table looks like: i not have code show because stuck on aliases. just break down task in simple tasks. let's find average salaries first: select teamid, `year`, avg(salary) avgsal employees group teamid, `year` now, difference need subtract employee's salary average: select e.employeeid, e.salary, a.avgsal, e.salary - a.avgsal diff employees e inner join ( select teamid, `year`, avg(salary) avgsal employees group teamid, `year` ) on a.teamid = e.teamid , a.`year` = e.`year`

converting a c# linq statement into vb.net -

i have code in c# uses linq , works great in c# need convert code vb , not @ vb. have tried using few of free online converters , programs found none of them worked, , tried looking on over how this, no answer worked me great if me. the linq part of code looks this: var query = log in wts join user in share on log.substring(51, log.length - 51).trimend(trim).tolower() equals user.substring(0, user.indexof(" ")).trimend(trim).tolower() select new { log, user }; foreach (var lognum in query) { lines.add(lognum.log + lognum.user); } thank helps me. edit have tried along lines of (which found on net or in of free converters) dim query = log in wtsjoin user in share on log.substring(51, log.length - 51).trimend(trim).tolower() = user.substring(0, user.indexof(vbtab)).trimend(trim).tolower()new { _ log, _ user _ } each lognum var in query lines.add(lognum.log + lognum.user) next dim query = log in wts j

Play framework Slick 3 how to disable H2 foreign key constraints by scala? -

i'm using play framework 2.3 scala. database management i'm using slick 3. temporally disable foreign key constraints h2 database. found possible in h2 set referential_integrity false. don't know how set scala in slick. please let me know? you can use plain sqlu"set referential_integrity false". please see http://slick.typesafe.com/doc/3.0.0/sql.html edit: working code, import slick.driver.h2driver.api._ import scala.concurrent.executioncontext.implicits.global object test extends app { def db = database.forurl( url = s"jdbc:h2:mem:test", driver = "org.h2.driver" ) def disablerefint = { val result = db.run(sqlu"set foreign_key_checks = 0 "); result onsuccess { case x => println("done command" + x.tostring()); } result onfailure { case x => println("not done command" + x.tostring()); } } } for reason "set