Posts

Showing posts from January, 2011

c++ - std::wofstream failing to write long long -

i have 2 streams, 1 read , 1 write (diff. files). std::wofstream origin; std::wifstream attach; origin.open(m_sourcefile, std::ios_base::app | std::ios_base::binary); attach.open(csattachfilename, std::ios_base::in | std::ios_base::binary); appending data file works fine, until gets write operation std::streamoff variable. taking account std::wofstream , output variable "normally" did few times in function. //[...] origin.seekp(0, std::ios_base::end); //go end std::streamoff noffset = origin.tellp(); //int nfilenamelength = ...; origin.write(reinterpret_cast<wchar_t*>(&nfilenamelength), sizeof(nfilenamelength) / sizeof(wchar_t)); //int //nothing wrong here //[...] write more attach.close(); auto c1 = origin.bad(); //false origin.write(reinterpret_cast<wchar_t*>(&noffset), sizeof(noffset) / sizeof(wchar_t)); auto c2 = origin.bad(); //true //[...] write more what cause issue ? note works fine if use std::ofstream instead.

Licensing applications inside a Docker container -

i have application runs on jboss server host name , mac id based license. have ported application runs on jboss-wildfly docker container in windows 7 through oracle virtualbox. need same license based on windows machine's host , mac id work in docker. how best achieve ? also, please let me know of best licensing strategy approach.

java - Default activity not found -

a read of same questions no 1 of them me, asking myself. here android manifest file: <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.abcdev.starksproject" > <uses-permission android:name="android.permission.internet" /> <uses-permission android:name="android.permission.access_network_state" /> <uses-permission android:name="android.permission.write_external_storage" /> <uses-permission android:name="com.google.android.providers.gsf.permission.read_gservices" /> <uses-permission android:name="android.permission.access_coarse_location" /> <uses-permission android:name="android.permission.access_fine_location" /> <application android:allowbackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:largeheap="true" android:theme="@

javascript - Loading TypeScript module with submodules in SystemJS -

how load modules systemjs if generated typescript single file containing several sub modules? currently, have larger library named form build in single file containing multiple sub-modules (like packages). generate library file use tsconfig: { "compileroptions": { "target": "es5", "module": "system", "moduleresolution": "node", "noresolve": true, "outfile": "../dist/lib/form.js", "declaration": true, "removecomments": false, "noimplicitany": true }, "exclude": [ "lib", "node_modules" ], "filesglob": [ "**/*.ts" ] } as result, form.js file contains modules, contain classes , on. now want use generated library inside project named shop . every time try use classes sub-modules, systemjs tries load submodules subdirectory instead library itself

How to implement Email Anonymization Similar to Craigslist -

i developing site protect buyers anonymizing email addresses.similar craigslist's system, when seller needs contact buyer should able send email anonymized address such 142jijisds@mysite.com routed user's email address. but don't know how implement feature.

jquery - How to fix Form over the slider image -

i working on codeigniter , creating website. trying fix user check availability form on slider images didn't output want. here html code: <form action="index.html" class="default-form"> <span class="arrival calendar"> <input type="text" name="arrival" placeholder="arrival" data-dateformat="m/d/y"> <i class="fa fa-calendar"></i> </span> <span class="departure calendar"> <input type="text" name="departure" placeholder="departure" data-dateformat="m/d/y"> <i class="fa fa-calendar"></i> </span> <span class="adults select-box"> <select name="adults" data-placeholder="adults"> <option>adults</option> <option value="1">1 adult<

c - How to parse a file that contains a long list of numbers in each line? -

i have file below: 1 2 300 500 5 117 5 90 45 34 ---- -------------- 34566 7 8 16 8 39 167 80 90 38 4555 and on how each numbers , store 2-dimensional array? so far can read line using fgets() function. file *fp = null; char buffer[1024]; fp = fopen("input.txt","r"); if(fp!=null) { while(fgets(buffer,1024,fp)!=null) { // need here } } is there method of solving (better this) rather using fgets()? #include <stdio.h> #include <stdlib.h> int main(void){ //either two-pass or ensure dynamically allocate , expand `realloc` if size of array can't determined in advance, static int array[20][20]; int row=0; file *fp = null; char buffer[1024]; fp = fopen("input.txt","r"); if(fp!=null) { while(fgets(buffer,1024,fp)!=null){ char *p = buffer, *endp; long num; int col = 0; do{

javascript - Is it possible to change Angular scope in jQuery event? -

thats code: .directive('search', function($templaterequest, $compile) { return { link: function(scope, element, $scope){ $templaterequest('/js/angularjs/search.html').then(function(html){ var template = angular.element(html); element.append(template); $compile(template)(scope); $('#multipleselect').multipleselect({ test: console.log($scope), onclick: function(view, scope) { //view.checked ? scope.searchbytitle.multi.push(view.value) : scope.searchbytitle.multi.remove(view.value); console.log('scope:'); console.log($scope); } }); }); } }; }); i using plugin: http://wenzhixin.net.cn/p/multiple-select/docs/ i wanna achiev

excel - ALL except filter set in column header -

Image
a complete newbie powerpivot here. have calculated column count number of distinct rows this: =countrows( distinct( data[chain] ) ) however not take account filters manually applied in column's header. have 11 chains, , if filter out except 2 want column's value 2 instead of 11. how can achieve in powerpivot? thanks in advance! you have add measure. add bottom part, , work.

url - unable to load image in android using picasso library -

hope doing good,i working on app,in want load image url imageview,i have used picasso lib this,but gives me uncaught exception,i have checked , debugged proper url coming or not , perfect,still facing issue,can me solve this?my code below: code picasso.with(newprofileactivity.this) .load(muser.useravatarpath) .into(iv_profile); here,"iv_profile" imageview,muser.useravatar path image url. try picasso.with(this).load("http://api.androidhive.info/json/movies/1.jpg").placeholder(getresources().getdrawable(r.drawable.ic_launcher)).into(imageviewcenter);

java - Hibernate retrieve wrong list of objects in one-to-many relation -

i'm new hibernate. have tables department , teacher. 1 department can have many teachers, 1 teacher can attached 1 department. have following mapping: @entity @table(name = "department") public class department { @id @generatedvalue(strategy = generationtype.identity) @column(name = "id") private integer id; @column(name = "name") private string name; @column(name = "description") private string description; @onetomany (cascade=cascadetype.all, fetch = fetchtype.eager) @joincolumn(name = "department_id") private list<teacher> teachers = new arraylist<teacher>(); } and @entity @table(name = "teacher") public class teacher { @id @generatedvalue(strategy = generationtype.identity) @column(name = "id") private integer id; @column(name = "fname") private string fname; @column(name = "lname") priva

javafx - Checking if a Part inside of a PartStack was closed by pressing the close icon on the corresponding tab -

platform: windows 8.1 pro, e4 e(fx)clipse i'm working on caching opened parts reopen when reloading partstack. reloading method uses epartservice.hidepart() close parts in partstack. since need remove parts cache, need differentiate between reloading , closing tab/part. i tried add part cache second time before removing again sending event predestroy() method of part. less ideal. is there special event can catch when clicking on close icon or way check this? thanks help. turns out, easiest way wanted use tags. since access code when part closed program, needed set tag on part. if (part.isdirty()) { if(!partservice.savepart(part, true)) { return; } part.gettags().add(tag.part_closed_by_program); partservice.hidepart(part); } else if (part.iscloseable()) { part.gettags().add(tag.part_closed_by_program); partservice.hidepart(part); } } now can check in predestroy() method if part being closed program or user. @

javascript - How should I apply if-else condition to display different menu to people with different user roles? -

i've 2 user roles defines i.e. 1 : roleid admin user , 2: roleid normal user the logic tried has been written in 2 javascript code files(.js files follows): first file : prj.js var ref = new firebase("https://prj.firebaseio.com"); var loggedinuser = []; $(document).ready(function() { authdata=ref.getauth(); if(authdata == null){ //todo find elegant way manage authorization // window.location = "../index.html"; }else{ ref.child("users").child(authdata.uid).on("value", function(snapshot){ $( "span.user-name").html(snapshot.val().displayname); loggedinuser.displayname = snapshot.val().displayname; loggedinuser.roleid = snapshot.val().roleid; }); } }); second file : navigation.js appraisalmenuhtml = ' <li class="{{appraisal}}" class="dropdown"><a class="dropdown-toggle appraisal"&

c# - System.FormatException occurred in mscorlib.dll when converting it int32 -

i know, know there lots , lots of questions asking on here error, each own response, easier work off response regarding own code rather else's i have been working on program time college assignment, , started putting in class calculate totals of things crashes, i don't know i'll post main code enter code here namespace till public partial class mainwindow : window { calculator calc = new calculator(); public mainwindow() { initializecomponent(); } public bool user; public bool tillopen = false; private void button_click(object sender, routedeventargs e) { //button clone thingy button btn = (button)sender; label.content = label.content + btn.content.tostring(); console.beep(); // makes buttons beep } private void clear_click(object sender, routedeventargs e) { // clear label.content = ""; } private void button_submit_click(object s

Sonarqube 5.4 custom rule for C# -

i'm using sonarqube 5.4 analyse own c# code, analysis works expected. have written custom rules, 1 using stylecop , using fxcop run on code, don't find how import theese custom rule in sonarqube. underline use sonarqube 5.4 c# plugin 5.1. in installations folder "rules" doesn't exists. instead can find: sonar-fxcop-library-1.3.jar in /opt/sonarqube-5.4/data/web/deploy/plugins/csharp/meta-inf/lib , sonar-stylecop-plugin-1.1 in /opt/sonarqube-5.4/extensions/plugins. anyone can me import custom rules in sonarqube installation? fxcop integration : extend template custom fxcop rules in sonarqube ( fxcop:customruletemplate ) specifying checkid of custom fxcop rule. [edit] fxcop rules covered sonar-fxcop plugin. stylecop integration : deprecated stylecop doesn't rely on roslyn.

Using a groovy class in other jenkins groovy scripts -

i have 4 groovy scripts (2 dsl.groovy scripts): jobconfig.groovy : class jobconfig { final name jobconfig(map) { name = map['name'] } } toplevel.groovy : import jobconfig.* def dosmthwithjobconfig(final jobconfig config) { println(config.name); } sublevel1.dsl.groovy : groovyshell shell = new groovyshell() def toplevelscript = shell.parse(new file("toplevel.groovy")) def jobconfigs = [ new jobconfig(name: 'jenkinstestdsls'), new jobconfig(name: 'jenkinstestdsls2') ] jobconfigs.each { toplevelscript.dosmthwithjobconfig(it); } sublevel2.dsl.groovy : groovyshell shell = new groovyshell() def toplevelscript = shell.parse(new file("toplevel.groovy")) def jobconfigs = [ new jobconfig(name: 'jenkinstestdsls3'), new jobconfig(name: 'jenkinstestdsls4') ] jobconfigs.each { toplevelscript.dosmthwithjobconfig(it); } now if locally do: groovyc jobconfig.groovy

android - Is it possible to have multiple styles inside a TextView? -

is possible set multiple styles different pieces of text inside textview? for instance, setting text follows: tv.settext(line1 + "\n" + line2 + "\n" + word1 + "\t" + word2 + "\t" + word3); is possible have different style each text element? e.g., line1 bold, word1 italic, etc. the developer guide's common tasks , how them in android includes selecting, highlighting, or styling portions of text : // our edittext object. edittext vw = (edittext)findviewbyid(r.id.text); // set edittext's text. vw.settext("italic, highlighted, bold."); // if textview, do: // vw.settext("italic, highlighted, bold.", textview.buffertype.spannable); // force use spannable storage styles can attached. // or specify in xml. // edittext's internal text storage spannable str = vw.gettext(); // create our span sections, , assign format each. str.setspan(new stylespan(android.graphics.typeface.italic), 0, 7, spannable.span_e

Jquery conditional fade by window width -

i make submenu fadein, above 850px window width. code works if refresh page, i'd make when resize window ( or change phone orienation ) well. what's wrong? function winsize() { var winwidth = $(window).width(); if (winwidth > 850) { $('#main-menu > ul > li').on({ mouseenter: function() { $(this).find("ul").fadein(300); }, mouseleave: function() { $(this).find("ul").fadeout(300); } }); } } $(window).on("load resize", winsize); try moving condition inside of .on . binding event when on load windows size > 850 , not effecting actual .on events function winsize() { $('#main-menu > ul > li').on({ mouseenter: function() { var winwidth = $(window).width(); if (winwidth > 850) { $(this).find("ul").fadein(300); } }

javascript - How to connect to a Mosquitto broker on a Raspberry Pi through web sockets? -

i trying connect raspberry pi has mosquitto broker installed. client on rpi connected using: client.connect("127.0.0.1", 1883, 60) i tried connect on mqtt javascript client using following specifications failed: client = new paho.mqtt.client("10.101.125.190", 1883,"myclientid_" + parseint(math.random() * 100, 10)); i tried changing port 8080 javascript side still failed. if change port 8080 on rpi won't connect. this error getting @ moment: websocket connection 'ws://10.101.125.190:1883/mqtt' failed: error during websocket handshake: net::err_connection_reset so, need change fix error? rpi , js client both in same local network. edit : forgot mention have tried test.mosquitto.org - 8080 , worked, change address start getting error. mqtt on websockets not share same port native mqtt. you need add new listener mosquitto config. you need add following end of /etc/mosquitto/mosquitto.conf (or in seperate file i

Nuodb - is there encryption option for data storage? -

is encryption supported within nuodb? trying manaual . i need fulfill security requirements -> encryption. for data @ rest, nuodb supports use of encrypted file systems database storage. nuodb not yet support column-level encryption. data in motion, nuodb uses srp (rfc-2945) mutual authentication between application clients , nuodb nodes, , configurable cypher encryption of ipc sessions.

javascript - Angular - how to print value of key value -

i have $scope.count want show count of specific data in table. made : $result = $this->_em->createquerybuilder() ->select('count(u.teamid)') ->from('mypath\entities\teams', 'u') ->where('u.teamtype =:teamtype') ->setparameters(['teamtype' => 4 ]) ->getquery() ->getscalarresult(); return $result; i save it's result in $scope.count : <label class="btn btn-yellow force-btn">model = {{ count }} </label> result of $scope.count : [{"1":"2"}] although , want show 2 . suggestion? try <label class="btn btn-yellow force-btn">model = {{ count[0]["1"] }} </label>

How to show message during initial loading of gwt application? -

i want display message (please wait...) or animated gif before initial entire loading of gwt application. can give me full example please. thanks because gwt app not yet loaded, have in pure html/css and/or js in html host page. easiest put in <body> , when gwt app loads starts cleaning "loading" message (e.g. document.get().getelementbyid("loading").removefromparent() ) another possibility use code-splitting : make first fragment that's small possible , display "loading" message, , load rest of app in background. in runasynccallback , hide "loading" message. that said, if feel need display such "loading" message, imo have bigger problem finding how display (and if struggle find how display one, you're in bad shape build app people enjoy using; fortunately, fixable: keep learning!).

laravel - Ordering by updated_at per group -

i have following simple query attempt last updated row per module : $distincts = serialnumber::where('company_id', auth::user()->active_company_id) ->groupby('module') ->orderby('updated_at', 'desc') ->get(); this doesn't work way want to. each row in module group not ordered updated_at (which datetime stamp). how can use orderby each row in group? reading! the following works, bad solution: $distincts = array(); $modules = serialnumber::select('module') ->where('company_id', auth::user()->active_company_id) ->groupby('module') ->pluck('module'); foreach ($modules $mod) { $se = serialnumber::where('company_id', auth::user()->active_company_id) ->where('module', $mod) ->orderby('updated_at', 'desc') ->first(); $distinct

Unable to display background image using javascript on qualtrics -

for starters, have absolute no knowledge javascript. trying display background image extracted url address on page of questionnaire on qualtrics following codes:- qualtrics.surveyengine.addonload(function() { <div id="divtest">hello</div> <img id="imgtest" /> <img id="imgreal" src="http://webneel.com/wallpaper/sites/default/files/images/01-2014/2-flower-wallpaper.jpg" /> var string = 'http://webneel.com/wallpaper/sites/default/files/images/01-2014/2-flower-wallpaper.jpg'; document.getelementbyid("divtest").style.backgroundimage = "url('" + string + "')"; document.getelementbyid("imgtest").src = string; }); but got following error message:- invalid javascript! cannot save until fix errors: unexpected token < how go fixing this? you cannot add html directly in javascript code, have create body section of page, or if nee

c - what scenarios we set file descriptor as -1 in mmap? -

why mmap better read , write one more similar post my question follows: there scenarios people using mmap rather read files. 1 such code is: *mapping = mmap(null, *mapping_size, prot_read | prot_write, map_populate | map_anonymous | map_private, -1, 0); the above code tries allocate huge amount of memory. want know mmap in case, how works. talks advantage of mmap wrt files. these kinds of code fd set -1 frequent. mean, advantages of doing so.? wish can clear doubt, couldn't ask due ambiguity. thank you it 1 method used map dynamic (new) memory application. libc implementing malloc() (and friends), 1 possible technique allocating memory

ios - Archiving multiple targets on XCode and Building Multiple IPA files in one go (scripts or commands wanted) -

i've been looking have no luck. tried using edit schemes , create "all" target resulted in single bundle combining items when create archive. basically app uses single code base different localized contents. each app has on bundle id, app name, etc. wanted make releasing easier using minimal amount of actions arrive @ multiple ipa files. ideally script, few commands, or several clicks along way. currently have 10 languages. i'll have select each of language targets, click product > archive, each language click distribute , build ipa file in organizer. advice appreciated! in advance! i suggest start looking @ jenkins job done. can create ipa every target want... start automating build via jenkins for automating distribution process, received mail apple last week meta data delivery transporter. it's command line tool. sounds interesting...

node.js - Deleting an object from a array in javascript -

i'm trying remove object cart using art_id, when i'm getting error syntaxerror: delete of unqualified identifier in strict mode. why happening , how can modify code come on error function remove_from_cart(req, res, next) { console.log(req.session); var art_id = req.params._id; var art_to_remove = _.findwhere(req.session.cart, { art_id: art_id }); console.log(art_to_remove); delete art_to_remove; console.log(req.session); res.send('deleted') } since seems you're using underscore , can use _.reject() : req.session.cart = _.reject(req.session.cart, { art_id: art_id });

C string, char and pointers -

i have misunderstanding respect following concepts in c. to define string can 1 of following afaik : define array of chars 1 here : char array[]; or define string char array. let 1 : char * str, why see books using pointers method while others use normal definitions ? a short answer won't question justice. you're asking 2 of significant, misunderstood, aspects of c. first of all, in c, definition, string an array of characters, terminated nul character, '\0' . so if say char string1[] = "hello"; it's if had said char string1[] = {'h', 'e', 'l', 'l', 'o', '\0'}; when use string constant "hello" in program, compiler automatically constructs array you, convenience. next have character pointer type, char * . called "string char array", it's pointer single char . people refer char * being c's "string type", , in way is, can misleadi

c - I want to convert a char (poped from the stack) to integer -

char i[]=pop(); char j[]=pop(); b=atoi(i); a=atoi(j); i wanted pop char type element stack , convert int type. says invalid initializer. what problem? if want char variable, use char variable, don't use char array. change char i[] = pop(); to char = pop(); and likewise. that said, atoi() won't relevant there. if want result of type int , use int variable.

java - android web browser does not open url -

Image
i want open url through browser when click on button not open url please tell me made mistake. here code of java file. public class mainactivity extends appcompatactivity { button button; edittext edittext; webview webview; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); button = (button)findviewbyid(r.id.but); edittext = (edittext)findviewbyid(r.id.edittext); webview = (webview)findviewbyid(r.id.webview); } public void goo(view view){ string url = edittext.gettext().tostring(); webview.getsettings().setloadsimagesautomatically(true); webview.getsettings().setjavascriptenabled(true); webview.loadurl(url); } } here xml file <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android"

javascript - Highcharts creating simple horizontal bar chart -

i trying make simple highcharts bar chart, different example , need categories on x axis , values on y axis, bar each category, without them being stacked. talking having example categories bananas, apples, oranges, , each of categories number of items, 100 bananas, 50, apples, , on, without further categorization on people, in example shown. trying , going through there documentation see how set options kind of setup, not getting anywhere, wondering if knows how set up. $(function () { $('#container').highcharts({ chart: { type: 'bar' }, title: { text: 'stacked bar chart' }, xaxis: { categories: ['apples', 'oranges', 'pears', 'grapes', 'bananas'] }, yaxis: { min: 0, title: { text: 'total fruit consumption' } }, legend: { reversed: true }, plotoptions: { series: { stacking: null

Using angularjs route how can I get a scope value into another controller? -

i have project single page application.so using angular js route. in first controller have $scope value.the same value have use in other controller here controller.js file var module = angular.module("sampleapp", ['ngroute']); module.config(['$routeprovider', function($routeprovider) { $routeprovider. when('/route1', { templateurl: 'http://localhost/myfirstapp/welcome', controller: 'routecontroller1' }). when('/route2', { templateurl: 'http://localhost/myfirstapp/result', controller: 'routecontroller2' }). otherwise({ redirectto: '/' }); }]); module.controller("routecontroller1", function($scope) { $scope.value="athira" }) mo

javascript - EXTJS Grid row coloring failed -

i using extjs 3.2. tried 1 sample grid row coloring reference http://skirtlesden.com/articles/styling-extjs-grid-cells . added grid view config in gridexample.js file holding static gird., viewconfig: { striperows: false, getrowclass: function(record) { return record.get('age') < 18 ? 'child-row' : 'adult-row'; } and added css in html page. html code is, <%@ 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>success</title> <link href="/testing/ext/resources/css/ext-all.css" rel="stylesheet" type="text/css" /> <link href="/testing/

uml - Port-Stereotypes (CompositeStructure Diagram) are oversized even with Default-Size set -

i developing mdg technology in enterprise architect, containing uml-profile. i added unit -stereotype (extending uml:component ) , signal -stereotype (extending uml:port ). after added signal unit, signal docked/anchored unit - port component extremely on sized (sth 200x150). if add port unit port keep default size of 16x16. tried set default size of signal (_sizex, _sizey) wasnt helping. anyone has idea fix problem? edit: able reproduce issue. when set "_metatype" - property of stereotype "signal" (in profile-definition-package), created signal-element anchored on unit over-sized. if remove "metatype"-property signal-element has same behaviour, , size port-element. started ea-forum-thread issue: http://sparxsystems.com/forums/smf/index.php/topic,30771.0.html kind regards, erik

java - How to insert value from table of jsp page into database -

i developing web application in have jsp page table. table populated values of database except 1 column editable , empty user enter data. problem want update database table once user enters data editable cells , press submit button. can me on this. below code of jsp page. <%@ 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"> <%@ page import="com.employee.com.logindetails" %> <%@ page import="java.sql.*" %> <html> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <title>insert title here</title> <link rel="stylesheet" href="css/newfile2.css"> </head> <body> <img src="images/crevavi_plain.jpg" background-color=&quo

how to work with directory in php -

the code is <?php $files = array(); $dir = opendir('/xampp/htdocs/myfun/template/home'); while(($file = readdir($dir)) !== false) { if($file !== '.' && $file !== '..') { $files[] = $file; } } closedir($dir); //sort($files); $i=0; foreach($files $key) { echo "<iframe align='center' width='100%' height='605px' src='$key' title='$files[$i]'></iframe>"; break; } ?> i want show templates onclick next/prev button.horizontally. slider. please help correct logic iterate directory in while loop false != ($file = readdir($dir)) , assign file name first , check it's not false. also can print title $key itself. $files[$i] , $i variable not required. in order iterate through files of directory remove break, cause end loop after first iteration. <?php $files = array(); $dir = opendir('/xampp/htdocs/myfun/template/home'); while(f

javascript - Game code breaking when setting variable -

this game code seems fine, it's not working: //get canvas , context var canvas = document.getelementbyid('canvas'); var ctx = canvas.getcontext('2d'); //capture keypresses var keys = []; document.onkeydown = function (e) {keys[e.keycode] = true;}; document.onkeyup = function (e) {keys[e.keycode] = false;}; //set game variables var characters; characters.charlist = []; var player = {}; //character constructor function character (name, strength, speed, intelligence, reflexes, age, height, weight, weapon, usesmagic, magictype, armor, hair, eyes, skin, clothes, species, type, accessories) { this.name = name; this.strength = strength; this.speed = speed; this.intelligence = intelligence; this.reflexes = reflexes; this.age = age; this.height = height; this.weight = weight; this.weapon = weapon; this.usesmagic = usesmagic; this.magictype = magictype; this.armor = armor; this.hair = hair; this.eyes = e

eclipse - MessageDialog title is coming 'Not Responding' -

i performing long running operation , showing message dialog "fetching details" , closing same once operation performed. try{ messagedialog dialog = new messagedialog(display.getdefault().getactiveshell(), "information", null, "fetching details...", messagedialog.none , new string[] {}, -1); dialog.setblockonopen(false); dialog.open(); //schedule long running operations } finally{ dialog.close() } if operation takes more time, dialog showing not responding (title changes "information (not responding)"). how can avoid not responding status ? you must not run long operations in ui thread. doing block thread until finish , ui become unresponsive. run operations in background thread, or eclipse job or java 8 completeablefuture. use display asyncexec in background code update ui required. another alternative use progressmonitordialog : progressmonitordialog dialog = new progressmonitordialog(shell); try { dialog.run(

Javascript: window.open popup on every clicks -

i using below script popup url when clicks blog page. <script type="text/javascript"> document.body.onclick= function(){ window.open('https://mywebpage.com', 'poppage', 'toolbars=0, scrollbars=1, location=0, statusbars=0, menubars=0, resizable=1, width=950, height=650, left = 300, top = 50'); }</script> the issue , if u user clicks anywere in blog mywebpage url pops up, many times clicks keep on pops up, need 1 time should popup webpage until session ends browser one method have onclick switch boolean's value in 1 direction only, , have window open when boolean switched. onclick activates every click: http://www.w3schools.com/jsref/event_onclick.asp also, should tagged javascript, not java.

java - jstl core for Each over heterogeneous collection -

i have controller returning jsp page object of type arraylist of type myclass . objects inside arraylist belong different classes, let's myclass1 , myclass2 each 1 of them extending myclass. able iterate on collection foreach tag , current element type field type in myclass when try access specific field of myclass1 got error. javax.el.propertynotfoundexception: property 'nocontentmessage' not found on type it.sei.core.rinterface.myclass1 . here code: class myclass { string type; string variable; } class myclass1 extends myclass{ string someotherfield; } class myclass2 extends myclass{ string nocontentmessage; } <core:foreach items="${model.graphlist}" var="element" varstatus="index"> <script language="javascript" type="text/javascript"> var type = '${element.type}'; switch (type) { case "type1": {

jquery - Reflow table generated in loop not responsive -

Image
i generating reflow table in loop in jquery mobile after ajax success . problem table not responsive. on small screens table generated supposed work collapsing table columns stacked presentation looks blocks of label/data pairs each row. when output table markup generate loop , copy/paste separate page, table looks fine , responsive. the html generate is: <table data-role="table" id="time-table" data-mode="reflow" class="ui-responsive table-stroke"> <thead> <tr> <th>linje</th> <th>destination</th> <th>nästa tur (min)</th> <th>därefter</th> </tr> </thead> <tbody> <tr> <th>7</th> <td>resecentrum</td> <td>nu</td> <td>11</td> </tr> <tr> <th>7</th>

elk stack - How can I configure logstash to parse G1GC loggc files -

in our production environment, have elk stack, using monitoring our own log files. we have enabled g1-gc logging: -xloggc:${path_to_log}/${file_prefix}-g1-gc.log -xx:+usegclogfilerotation -xx:gclogfilesize=10m -xx:+printgctimestamps -xx:+printgcdetails but, not yet analysing these log files. interested in having logstash process these files, can begin making use of them. are there example logstash input configurations work g1gc log files? thanks

osx - Validating error after archive in iOS -

i trying upload ionic project ios devices using xcode 7.3. created certificates , app ids , archived. after that, when click on validate option error, not understand! error says: failed locate or generate matching signing assets: xcode attempted locate or generate matching signing assets , failed because of following issues. app id identifier 'com.*****.******' not available. please enter different string. thankx in advance i got same issue upload xcode7.3. before xcode7.3 dont need create app on itunesconnect , can create ipa file , things. did fix issue following: open itunesconnect , login apple-id password. create new ios app , select identifier used in our xcode project. after need go in xcode , select device , create archive. do same step did before , error goes away.

android- do we need sdk build tools for each SDK platform? -

the android sdk folder taking lot of drive space , wondering do need individual version of build tools every sdk platform? short answer, no don't need , individual version every sdk plattform

c# - MONO - Method 'EventSource.WriteEvent' not found -

Image
i have problem asp.net mvc app mono. i'm creating simple app in visual studio. app works on windows server app working not on mono. error: system.missingmethodexception method 'eventsource.writeevent' not found. mono version: mono jit compiler version 4.2.3 (stable 4.2.3.4/832de4b wed mar 16 13:19:08 utc 2016) copyright (c) 2002-2014 novell, inc, xamarin inc , contributors. www.mono-project.com tls: __thread sigsegv: altstack notifications: epoll architecture: amd64 disabled: none misc: softdebug llvm: supported, not enabled. gc: sgen screen: not overloads of eventsource.writeevent implemented in mono. either need change code use implemented or wait cycle 7 release. think called mono 4.4, have 4.2, you'll have upgrade.

javascript - In node.js do I need http when building a socket.io/express app? -

i have started using node.js , can build simple app responds requests , has basic routing using express framework. i looking create using socket.io confused on use of 'http' module. understand http don't seem need following work: var express = require('express'); var app = express(); app.get('/', function (req, res) { res.sendfile(__dirname + '/index.htm'); }); app.listen(3000, function () { console.log('example app listening on port 3000!'); }); i can serve html page on http without requiring http module explicitly such as: var http = require('http'); if using express have use http module? var express = require('express'); var app = express(); var server = require('http').createserver(app); var io = require('socket.io').listen(server); ... server.listen(1234); however, app.listen() returns http server instance, bit of rewriting can achieve similar without creating http

javascript - Throw error if config object doesn't contain all required properties -

i have es6 class require config object. if property missing, i'd throw error. the solution if found keep code short , not add if(!object.propn)... every property : class myclass { constructor(config) { if (!config) { throw new error("you must provide config object"); } this.prop1 = config.prop1; this.prop2 = config.prop2; this.prop3 = config.prop3; this.prop4 = config.prop4; (const key in this) { if (!this[key]) { throw new error(`config object miss property ${key}`); } } } } is ok in javascript ? for configs, use feature destructuring assignment check whether properties in object or not using sugar of es6 (es2015). and furthermore, can set default values configs feature. {prop1, prop2, prop3: path='', prop4='helloworld', ...others} = config after destructuring assignment has been done, need check before going specific config. i.e. if (!prop1) { throw new error

Sonar plugin query the database -

i'm developing sonar plugin , have questions it. plugin need retrieve data database manipulate them , display them in page. currently, plugin querying database using jdbc driver think problem in production. want find method connect , query database (just select query) plugin using api, or sonar object... i know there webservice, don't give me information need, have make queries myself. my plugin sonarqube 4.1. i hope explication clear. i think found solution: i have class retrieve databasesessionfactory in constructor. read somewhere sonar uses dependency injection constructor. public class myclass implements webservice{ privatedatabasesessionfactory sessionfactory; public myclass(databasesessionfactory sessionfactory) { this.sessionfactory = sessionfactory; } } and after, in class, can use sessionfactory variable query database: databasesession s = sessionfactory.getsession(); string sql

objective c - Why is a child class' implementation used when initialising? -

created 2 classes a , b b subclasses a . when trying init b calls [super init] why super class a use child's ( b )'s implementation of printmessage ? @implementation - (instancetype)init { self = [super init]; if (self) { [self printmessage:@"foo"]; } return self; } -(void)printmessage:(nsstring *)message { nslog(@"from a: %@", message); } @end implementation of b (subclasses a) @implementation b - (instancetype)init { self = [super init]; if (self) { [self printmessage:@"bar"]; } return self; } -(void)printmessage:(nsstring *)message { nslog(@"from b: %@", message); } @end initialised using: b *b = [[b alloc] init] expected output: from a: foo b: bar actual output: from b: foo b: bar you initializing object of type b . search method implementations starts in class b , uses overridden methods if found, dropping parent implementations othe

javascript - html5 saving clicked a href link into localstorage and redirect to same link on each visit -

first need store href url in localstorage , visitor redirected same url stored in localstorage on every visit on website until visitor clicks on link , changes link. if visitor can change link, same process should repeat , visitor should redirected new url stored in localstorage on every visit on website until visitor can click on link , change link. 1) problem in function stored url in localstorage visitor redirected previous / old url stored in cache before selection of new link, if clicking link?? 2) second problem auto refresh , reload stored link on each , every visit on website , stored link cache cloudn't delete or change when click new link old cache showing in chrome->resources->localstorage? jsfiddle link

multiplicity - Wrong cardinality in UML class diagram -

my school teacher , me arguing how write correct cardinality relation between 2 classes: customer ----places->---- order so exercise tells me, 1 customer has 0 - x orders , 1 order belongs 1 specific customer. idea was: customer -1---places->---*- order my teachers solution: customer -1..*---places->---*- order so, think it? hope, i'm right :) the first 1 correct. 0..*, or * short, goes next order class. 1..1, or 1 short, goes next customer class. are sure teacher specified uml?

node.js - How to display npm-debug.log in Jenkins build log? -

when building npm within jenkins, npm-debug.log created on disk debug information. it's far more convenient have debug information in jenkins' build log. achieve redirecting npm-debug.log stdout, seem unable find way that. hints or tips? whole npm-debug.log seems hardcoded strange reason.

ios - RestKit upload image parameters -

i have configure server side uploading image restkit 0.2 using spring. i use following code uploading: nsmutableurlrequest *request = [[rkobjectmanager sharedmanager] multipartformrequestwithobject:obj method:rkrequestmethodpost path:nil parameters:nil constructingbodywithblock:^(id<afmultipartformdata> formdata) { [formdata appendpartwithfiledata:uiimagejpegrepresentation(obj.image, 1.0) name:@"image" filename:@"image.jpg" mimetype:@"image/jpeg"]; }]; rkobjectrequestoperation *operation = [[rkobjectmanager sharedmanager]

amazon web services - Can I trigger tasks to run straight after an EC2 instance has been created? -

i interested in running set of tasks after new ec2 instance has been created. @ moment doing running bash shell script via ec2's user-data option. however want move away using user-data (or @ least reduce size of shell script as possible), , instead run shell script on existing ec2 instance (which happens ansible server). does know if possible? maybe using aws service e.g. cloudwatch, sns, sqs, lambda,...etc. e.g. can cloudwatch issue message sns newly built ec2 instance reaches healthy state? there many ways solve problem. options have used in past include: creating upstart scripts on ec2 instance , creating new ami these inplace. launch future instances using ami (simple inflexible ami creation slow). do programmatic using eg. boto query aws , find out when newly launched boxes available using eg. paramiko ssh in , issue commands (much more flexible more effort). hope helps.

Golang Rename unicode file name -

how rename file in unicode format, gaps? when try rename standard library function, file not located. old: /usr/home/spouk/go/src/simple/agraba - know smiling (original mix).mp4 new: /usr/home/spouk/go/src/simple/agraba_-_i_know_you_are_smiling_now__original_mix_.mp4 [rename] rename agraba - know smiling (original mix).mp4 /usr/home/spouk/go/src/simple/agraba_-_i_know_you_are_smiling_now__original_mix_.mp4: no such file or directory someone tell me use or acquainted direction of solution problem. tnx. package main import ( "flag" d "github.com/fiam/gounidecode/unidecode" "fmt" "path/filepath" "os" "strings" "strconv" "os/exec" ) type ( file struct { originpath string convertpath string } filesstack struct { files []file inpath string outpath string } ) func newfilesstack() *filesstack { n := new(file