Posts

Showing posts from January, 2014

Excel Pivot Table. HIde rows where all measures are blank or zero -

Image
i'm using powerpivot datasource pivot table. using excel 2013. just want hide rows measures blank or zero, 1 selected in following image:

Teradata TPT_INFRA: TPT02640: Error: Conflicting column count -

i facing issues in teradata parallel transporter while loading data test dev environment. table structure same, face error tpt_infra: tpt02640: error: conflicting column count. source column count (20) target column count (13). export_operator: tpt12108: output schema not match data select statement check schema file have generated. seems issue source file , schema file generated.

vb.net - Pivot a datatable in .NET Code -

i have stored procedure in sql returns following schema: id category agebucket cnt amount 28 mack - class 8 1to60 1 88000 28 mack - class 8 1to89 1 88000 28 mack - class 8 over180 24 1067260.01 28 mack - class 8 over359 24 1067260.01 28 mack - class 8 over360 24 1067260.01 29 volvo - class 8 over180 19 869100 29 volvo - class 8 over359 19 869100 29 volvo - class 8 over360 19 869100 30 other - class 8 over180 13 232500.01 30 other - class 8 over359 13 232500.01 30 other - class 8 over360 13 232500.01 i want pivot in vb.net (for reasons) , output datatable should this: id category salecategory [1to60] [1to89] [61to120] [90to179] [121to180] 28 mackclass8 n 88000 88000 0 0 0 29 volvoclass8 n 0 0 0 0 869100 30 otherclass8 n 0 0 0

powerbi - DAX - Last value in a Horizontal hierarchy -

having trouble replicating excel function dax. say have below table(view image link). rows vary in depth , each row wanted know last value in hierarchy, use lookup e.g "=lookup(2,1/(xx:xx<>""),xx:xx)". [image of table] how 1 achieve in dax? thanks. i imagine combination of switch , isblank functions done. beware blank etc in dax bit unintuitive/inconsistent, e.g. https://www.sqlbi.com/articles/blank-handling-in-dax/

angular - Webpack Angular2 Typescript: EXCEPTION: No Directive annotation found on -

i try use webpack module development: use npm link command custom module in sample application. but have error: error in console if put component (.ts, .html) in app source, no error, works. mistake? edit: have error components spinner.component.ts: import { component, input, ondestroy } '@angular/core'; @component({ selector: 'an-spinner', styles: [ ` ... delete limit number of line codes `, ], template: require( './spinner.component.html'), }) export class spinnercomponent implements ondestroy { private currenttimeout: number = undefined; private isdelayedrunning: boolean = false; @input() public delay: number = 300; @input() public set visible(value) { if (! value) { this.canceltimeout(); this.isdelayedrunning = false; } else if (! this.currenttimeout) { this.currenttimeout = settimeout(() => { this.isdelayedrunning = value; this.canceltimeout(); }, this.delay

c - Warning with struct initialization -

i have struct: struct changeintitem { char *unit; const char **parser; int *changevalue; uint16_t *change_eeprom_value; int maximum; int minimum; }; i want initialize other variables struct-variable: struct changeintitem changeintitemtypeboolean = { .unit = "", .minimum = 0, .maximum = 1, .parser = {"off", "on"}}; it working fine warnings: severity code description project file line warning braces around scalar initializer handsteuerung c:\users\... 11 severity code description project file line warning (near initialization 'changeintitemtypeboolean.parser') handsteuerung c:\users\... 11 severity code description project file line warning initialization incompatible pointer type handsteuerung c:\users\... 11 severity code description project file line warning (near initialization 'changeintitemtypeboolean.parser') handsteuerung

single page application - How to ajax-refresh dynamic include content by navigation menu? (JSF SPA) -

Image
i'm learning jsf 2 site had learned lot in such short time. my question regarding how implement common layout jsf 2 pages , have content part of page refresh not whole page whenever click link/menu different panel. using facelets approach want except each time click link panel (e.g. menu items left panel) whole page refreshed. looking way refresh content part of page. illustrate below target pagelayout. did not post code because i'm not sure if facelets can . there other approach more suited requirement other facelets? a straightforward approach following view: <h:panelgroup id="header" layout="block"> <h1>header</h1> </h:panelgroup> <h:panelgroup id="menu" layout="block"> <h:form> <f:ajax render=":content"> <ul> <li><h:commandlink value="include1" action="#{bean.setpage('include1&#

cql - Cassandra: time series with dynamic columns/sources -

there lot of questions storing time series cassandra, no 1 fits our question, because assume fixed data source , known column names. about our problem: we're developing stream data engine, can connect different data sources, engine receives data continuous streams. so, have example 2 data sources called energy , weather . each incoming stream (or data source) has own unique key , own schema, e.g.: source id 1 schema energy may has stream: timestamp | volts | amps | watts | state 1467795743173 | 210.4 | 2.3 | 290 | "up" 1467795744173 | 212.1 | 2.1 | 287 | "up" 1467795745173 | 213.1 | 2.2 | 242 | "up" ... source id 2 schema weather may has stream: ts | condition | temp 1467795740632 | "cloudy" | 33.1 1467795741381 | "cloudy" | 33.4 ... now want give possibility store streams cassandra, can used later "replay" recorded stream, fetch historic results (e.g. analytics) , enrich/join incoming streams spec

Check if MySQL server has ssl enabled without logging in -

is possible check if mysql server has ssl connections enabled without logging in, assuming have port , ip? theoretically possible that, requires understanding of mysql's own protocol , advanced socket programming. as part of initial handshake process, mysql server sends initial handshake packet . part of capability flags mysql server sets client_ssl flag if supports ssl : the ssl support announced in initial handshake packet sent server via client_ssl , enabled if client returns same capability. this packet sent before authentication, not have authenticate determine if mysql server support ssl. however, in various mysql apis cannot ask initial handshake packet sent. in c api have mysql_real_connect() connect server immediately. so, need write own code initiate connection mysql server, process server's initial handshake packet, determine if supports ssl , close connection.

how to accept only whole numbers in c++ -

i new programming , need term project. have made program simulates hotel booking, problem whenever non-whole number entered first question, goes infinite loop. if second question , enter non-whole number accepts whole number dropping off comes after decimal , skips next question , stops running program. #include <iostream> #include <string> using namespace std; int stay_length (int stay) { int nights = stay; int total = 0*nights; return total; } int rooms_booking(int rooms) { int rooms_booked = rooms; int total = 0; if(rooms_booked > 0) { total = rooms_booked * 50; } else { total = 0; } return total; } int main(){ int x; string repeat; int nights; int total = 0; int rooms_avail = 10; int rooms; cout << "hello! welcome hotel comp 150." << endl; { if (rooms_avail > 0) { cout << "how many nig

Rails Model Constants -

i have attachments , category models when user uploads file, can select category attachment. want categories static now. advice on how create static category model options? have right following error: undefined method 'title' syllabus":string category model class category < activerecord::base category = ['syllabus', 'assignments', 'handouts', 'lectures', 'other'] has_many :attachments end attachment new.html.erb <%= simple_form_for([@group, @group.attachments.build]) |f| %> <%= f.collection_select :category_id, category::category, :id, :title, { promt: "choose category" } %> <%= f.submit %> <% end %> attachment model class attachment < activerecord::base belongs_to :user belongs_to :group belongs_to :category end schema create_table "categories", force: :cascade |t| t.string "title" t.datetime "created_at", null: false

ios - UISearchController "manual" search UI glitch -

Image
we're migrating uisearchdisplaycontroller uisearchcontroller , 1 feature used work misbehaving bit , i'm wondering if we're not using api intended. we have uitableviewcontroller uses uisearchcontroller , separate results controller display results, on cases when user clicks on cell in original table want invoke uisearchcontroller , populate search field predefined text. there's kind of ui glitch didn't have when used uisearchdisplaycontroller the code used manually invoke search controller is: [self.providersearchresultscontroller.searchbar becomefirstresponder]; [self.providersearchresultscontroller.searchbar settext:providername]; i couldn't find official in apple documentation. i believe following link might https://github.com/rnystrom/uitableviewcontroller-containment-demo

selenium - java.lang.NoClassDefFoundError: freemarker/template/TemplateModelException -

tried create advanced html reports using extentreports jar, throwing below error. java.lang.noclassdeffounderror: freemarker/template/templatemodelexception code :- public class xtentreport { webdriver driver; extentreports report; extenttest logger; @test public void verifyxreport() { report = new extentreports("d:\\selenium_reports\\advancereport.html"); logger=report.starttest("startingtc"); driver= new firefoxdriver(); driver.manage().window().maximize(); logger.log(logstatus.info,"browser , running"); driver.get("google.com"); logger.log(logstatus.pass,"test completed"); report.endtest(logger); report.flush(); } } you need add freemarker-<version>.jar yor classpath.

ruby - Unable to run a simple Watir script -

i trying run simple watir script on system getting error. tried 2.2.4, 2.1.8 , 1.9.3 nothing works me. long time used work on watir on v1.8.7 , on 2.x version, can't remember different did then. following code tried execute v1.9.3 on win7 x64bit. require 'rubygems' require 'watir-webdriver' print "hello" b = watir::browser.start 'http://www.google.com' with error "unable obtain stable firefox connection in 60 seconds (127.0.0.1:7055) (selenium::webdriver::error::webdrivererror)". i tried using watir instead of 'watir-webdriver' doesn't work. watir, watir-webdriver, watirclassic , selenium-webdriver installed. it mozilla bug in firefox 47 broke things. has been fixed. update selenium-webdriver gem 2.53.4 , work firefox 47.0.1

listview - Android list-view expansion time animation -

Image
i have list-view illustrated in following picture, expand been shown in 2nd picture populate few more information selected item. now need add animation during expansion transition(while expanding & closing). can suggest me how can achieve this? my idea animate 'folded paper's opening' while expansion , closing down while exit (as shown below)

php - problems with display image from the database -

this question has answer here: php display image blob mysql [duplicate] 3 answers i have image store in the database iam not able display them the image in database want diplay image here <div class='panel-body $body_class' style='height:190px; word-wrap: break-word; overflow: auto;'> <img src='data:ads;base64' '> <p class='adtext'>$row_ad->text</p> </div> this how can it. <div class='panel-body $body_class' style='height:190px; word-wrap: break-word; overflow: auto;'> <img src='data:image/jpeg;base64,<?php echo $row_ad->image;?>' /> <p class='adtext'><?php $row_ad->text ?></p> </div>

mysql - How to get top n records group by wildcards -

here table example: +--------+-------------+ | id | city_detail | +--------+-------------+ | 1 | 12_hyd_test | | 2 | 13_blr_test | | 3 | 15_blr_test | | 4 | 18_hyd_test | | 5 | 17_coi_test | | 6 | 22_coi_test | | 7 | 62_hyd_test | | 8 | 72_blr_test | | 9 | 92_blr_test | | 10 | 42_hyd_test | | 11 | 21_coi_test | | 12 | 82_coi_test | +--------+-------+-----+ from table, how use condition group select +--------+-------------+ | id | city_detail | +--------+-------------+ | 12 | 82_coi_test | | 11 | 21_coi_test | | 10 | 42_hyd_test | | 7 | 62_hyd_test | | 9 | 92_blr_test | | 8 | 72_blr_test | +--------+-------+-----+ in each city show 2 result ( %coi% or %hyd% or ' %blr%' ) order id desc probably simplest method use variables: select e.* (select e.*, (@rn := if(@c = substr(city_detail, 4), @rn + 1, if(@c := substr(city_detail, 4),

javascript - Event delegation in Angular2 -

i'm developing app in ng2 , i'm struggling something. i'm building calendar can pick date-range , need react on click & mouseenter/mouseleave events on day cells. have code (simplified) this: calendar.component.html <month> <day *ngfor="let day of days" (click)="handleclick()" (mouseenter)="handlemouseenter()" (mouseleave)="handlemouseleave()" [innerhtml]="day"></day> </month> but gives me hundreds of separate event listeners in browser's memory (each day's cell gets 3 event listeners, , can have 12 months displayed @ time on 1k of listeners). so wanted "the proper way", using method called "event delegation". mean, attach click event on parent component ( month ) , when receives click event, check whether occurred on day component - , react click. jquery in it's on() method when pass selector parameter. but doing

javascript - JS Library installation quits in the middle through MAC terminal -

Image
npm err! darwin 15.4.0 npm err! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" npm err! node v4.2.3 npm err! npm v2.14.7 npm err! code etimedout npm err! errno etimedout npm err! syscall read npm err! network read etimedout npm err! network not problem npm npm err! network , related network connectivity. npm err! network in cases behind proxy or have bad network settings. npm err! network npm err! network if behind proxy, please make sure npm err! network 'proxy' config set properly. see: 'npm config' i'm using personnel mac , doesn't undergo proxy setup

javascript - How to close firebase connection in node.js -

below simple example how using firebase: let firebase = require('firebase'); firebase.initializeapp({ serviceaccount: './config/firebase.json', databaseurl: 'https://thenameofhedatabase.firebaseio.com' }); let db = firebase.database(); ... ... the point after code execution db object holds node.js session. not want call process.exit(0) . so, right way close or dispose db object of firebase? this has been fixed in version 3.4.1 of javascript sdk . firebase.database().gooffline() releases database node.js process can exit.

Swift initialize Self in a static methods -

having problem getting work, inside user.provideinstance i'm unable initialize self , return. thoughts? extension nsmanagedobject { public convenience init(managedobjectcontext: nsmanagedobjectcontext) { let entity = nsentitydescription.entityforname(string(self.dynamictype), inmanagedobjectcontext: managedobjectcontext)! self.init(entity: entity, insertintomanagedobjectcontext: managedobjectcontext) } } public protocol deserializable { static func provideinstance(json: [nsobject: anyobject]) -> self } @objc(user) public class user: nsmanagedobject, deserializable { public static func provideinstance(json: [nsobject: anyobject]) -> self { let context = dicontainer.instance.resolve(coredatastack.self).managedobjectcontext let instance = self.init(managedobjectcontext: context) return instance } } error on let instance = self.init(managedobjectcontext: context) : constructing object of class type self meta

node.js - When trying to execute an JavaScript file gives me an: SyntaxError: unexpected token ) -

during path on creating chat application, trying create app.js file till came across easy/novice silly syntaxerror don't think wrong it, still causes issues me progress onwards, tried adding additional parentheses, brackets or semicolons. wouldn't resolve :/ this app.js file: var express = require('expres'), //now in express no longer create http server automatically //app variable function bundles in express //for socket.io need http server object so, need create manually app = express(), //create variable called "server". //requires http module, "createserver" (creates server) , pass data onto "app" variable. server = require('http').createserver(app), //then need create socket functionality. //create variable called "io". //the variable "io" requires "socket.io" , need make "listen". //so why need http server, parameter of "listen&q

sql server - How can I set the date of every row in a table to the current date? -

i have sql server table: create table [dbo].[synonym] ( [synonymid] [int] not null, [wordformid] [int] not null, [ascii] (ascii([text])) persisted, [text] [varchar](max) not null, [version] [timestamp] null, [createdby] [int] null, [createddate] [datetime] null, [modifiedby] [int] null, [modifieddate] [datetime] null, primary key clustered ([synonymid] asc) (pad_index = off, statistics_norecompute = off, ignore_dup_key = off, allow_row_locks = on, allow_page_locks = on) on [primary] ) on [primary] textimage_on [primary] how can set createddate current date of rows? if want save date when record created, add default constraint table: alter table [synonym] add constraint createddate default getdate() [createddate] then if insert record don't need specify createddate , current date value. if want set date existing records run update update [synonym] set [createddate] = getdate() or records

How do I pass a JSON object to inline javascript In EJS -

i want send ejs object javascript function. have tried below code didn't work. <% books.foreach(function(book){ %> <button onclick="getbookdetails(<%=book %>);" > <%=book.name %></button> <% }); %> my javascript code is function getbookdetails(book){ //using book object } i have tried following stuff also.but didn't help. getbookdetails(<%=json.stringify(book) %>); please me find mistake. you can't call getbookdetails(<%=book%>) because <%=book%> evaluated [object object] , not { name: "wind in willows, author: "kenneth grahame" } require. you're on right lines using json.stringify missed 1 crucial point: using <%= escape html entities. instead - use <%- so: <% books.foreach(function(book){ %> <button onclick="getbookdetails(<%-json.stringify(book)%>);"><%=book.name %></button> <% }); %> you&

c# - How can I set the RGB Color in font Using xssfworkbook npoi -

how can set rgb color in cell backgroudn using class xssfworkbook using npoi? byte[] rgb = new byte[3] { 192, 50, 90 }; xssfcellstyle headercellstyle1 = (xssfcellstyle)wb.createcellstyle(); headercellstyle1.setfillforegroundcolor(new xssfcolor(new color(255, 255, 255))); i don't want use pattern: titlestyle.bottombordercolor = indexedcolors.grey25percent.index; solution of problem here here define new xssfcolor , assign xssfcellstyle var color = new xssfcolor(new byte[] { 0,255, 0 }); var rowstyle =(xssfcellstyle)wb.createcellstyle(); rowstyle.setfillforegroundcolor(color)

python 3.x - How to handle min_itemsize exception in writing to pandas HDFStore -

i using pandas hdfstore store dfs have created data. store = pd.hdfstore(storename, ...) file in downloaded_files: try: gzip.open(file) f: data = json.loads(f.read()) df = json_normalize(data) store.append(storekey, df, format='table', append=true) except typeerror: pass #file error i have received error: valueerror: trying store string len [82] in [values_block_2] column column has limit of [72]! consider using min_itemsize preset sizes on these columns i found possible set min_itemsize column involved not viable solution not know max length encounter , columns encounter problem. is there solution automatically catch exception , handle each item occur? i think can way: store.append(storekey, df, format='table', append=true, min_itemsize={'long_string_column': 200}) basically it's similar following create table sql statement: create table df( id int,

javascript - Change the Key with CryptoJS -

this question has answer here: ciphertext not converting plain text , not being alerted 2 answers i using cryptojs encrypt , decrypt text. here, taking message , showing both encryption , decryption messages. i using des algorithm encrypting , decrypting. this html file <!doctype html> <html> <head> <script src="tripledes.js"></script> <script src="mode-ecb.js"></script> <style type="text/css"> .maindiv { /* center form on page */ margin: 0 auto; width: 400px; /* see outline of form */ padding: 1em; border: 1px solid #ccc; border-radius: 1em; } div + div { margin-top: 1em; } label { /* make sure labels have same size ,

python - Pip install does not fetch the latest version -

Image
i want install latest django-froala-editor version. but pip install keeps installing django-froala-editor version 2.0.1. steps reproduce problem. (using virtualenvwrapper ease test) mktmpenv pip search froala pip install django-froala-editor the version 2.0.1 gets installed, though 2.3.2 present on pypi website , pip search shows 2.1.0 version. os. os x yosemity 10.10.5, pip version 8.1.2, python 2.7 install directly git if can't latest version pypi: pip install git+https://github.com/froala/django-froala-editor this can included in requirements.txt git+https://github.com/froala/django-froala-editor generally, pip install git+{url repo}

plunker - How to view forks of my plunks? -

in plunker how view forks of plunks? have plunks forked, there way see these plunks forks? the ui not expose forks of plunks. information is, however, recorded , available via undocumented plunker api. to see forks of plunk <plunkid> , visit https://api.plnkr.co/plunks/<plunkid> . see forks property array of ids of forks.

c# - Local Database not working -

i have working mvc5. have created portal site working server db connection after have created local db connect local sql server not connect db. server db connection using appseetings.config <?xml version="1.0"?> <appsettings> <add key="webpages:version" value="2.0.0.0" /> <add key="webpages:enabled" value="false" /> <add key="preserveloginurl" value="true" /> <add key="clientvalidationenabled" value="true" /> <add key="unobtrusivejavascriptenabled" value="true" /> <add key="defaultmembershipname" value="username" /> <add key="smtpserver" value="relay-hosting.secureserver.net" /> <add key="smtpport" value="25" /> <add key="userid" value="thenna41@gmail.com" />

php - Laravel : How to store json format data in database? -

i want store json format data in database given array. how store using controller. suppose have json data : {"id":"bangladesh","divisions":[{"name":"barisal"},{"name":"chittagong"},{"name":"dhaka"},{"name":"khulna"},{"name":"rajshahi"},{"name":"rangpur"},{"name":"sylhet"}]} so far know in controller using json format i'm not aware of it. public function saveuser(request $request) { $div=new div(); $user->json = json_encode( array({"date 1": { {"id":"bangladesh","divisions":[{"name":"barisal"},{"name":"chittagong"},{"name":"dhaka"},{"name":"khulna"},{"name":"rajshahi"},{"name":"rangpur"

javascript - window.removeEventListener with a named function isn't working -

i using react , below code using implement infinite scroll feature. componentdidmount() { // flag check if content has loaded. let flag = true; function infinitescroll() { let enterprisewrap = $('.enterprise-blocks'); let contentheight = enterprisewrap.offsetheight; let yoffset = window.pageyoffset; let y = yoffset + window.innerheight; console.log('hey'); if(this.props.hasmore) { if(y >= contentheight && flag) { flag = false; this.props.loadmorevendors(function() { flag = true; }); } } else { window.removeeventlistener('scroll', infinitescroll.bind(this)); } } window.addeventlistener('scroll', infinitescroll.bind(this)); } i wanna unbind scroll event once items loaded removeeventlistener not working. doing wrong? every time bind function, new function back. removing different listener

c# - Specify Left, Top Coordinates in ItemsControl with Shape Items -

i'm having issues binding itemscontrol collection contains shapes. don't need datatemplate, want specify top/left location of items contained in collection. <itemscontrol x:name="regions" datacontext="{binding path=model}" itemssource="{binding path=items}"> <itemscontrol.itemspanel> <itemspaneltemplate> <canvas x:name="canvas" background="yellow" /> </itemspaneltemplate> </itemscontrol.itemspanel> </itemscontrol> public model model {get;} public class model : inotifypropertychanged { public observablecollection<element> items {get;} } public class element : shape { public override system.windows.media.geometry geometry {get;} } i tried using itemscontrol.itemcontainerstyle, got binding error: <itemscontrol.i

c++ - Generate random coordinates in a rectangle qt -

i have rectangle length 27.5 , width 3.5 , supposed generate coordinates within rectangle unique i.e., without duplicates. number of coordinates need generated based on size of list. here have done far using qt: struct coordinates_t{ int x; int y; }; qvector<coordinates_t> coordinateslist; qlist<qstring> listofdevices; //populate listofdevices for( int = 0; < listofdevices.count(); i++) { coordinateslist.pushback({rand() % 51 + (-25), rand() % 11 + (-5)}); } the problem though rand function generates random numbers within rectangle, not avoid duplicates. there someway in can avoid duplicates , produce unique coordinates within given rectangle. here example demonstrates check duplicates using qvector , qpoint . if want use qvector::contains own struct, must implement operator==() . #include <qcoreapplication> #include <qvector> #include <qpoint> #include <qdatetime> #include <qdebug> int main(int argc,

python - Django - forms vs model form, editing a model.textField, and getting the pk of an object? -

models.py from django.db import models django import forms class history(models.model): commenttypes = ( ('1', 'issues'), ('2', 'risks'), ('3', 'dependencies'), ('4', 'accomplishments'), ('6', 'ugm') ) historyid = models.integerfield() projectid = models.integerfield() userid = models.charfield(max_length=6) logcomments = models.textfield(max_length=1000) timestamp = models.datetimefield(auto_now_add=true, auto_now=false) commenttype = models.charfield(max_length=1,choices=commenttypes) forms.py class statustab(modelform): class meta: model = history fields = ['logcomments'] views.py def projecttabs(request): form = statustab(request.post or none) context = { "form":statustab, } if request.method == 'post' , form.is_valid(): instance = form.sa

singleton - Get instance of same Java application if it is already running -

is possible check if java application running , if is, instance of it? have jar first time it's clicked opens frame, , every time after (until it's closed), gets frame , adds object it. needs work without main application having close() method application work again when reopened if stops responding or has been closed task manager. java applications works on different process. so not easy interact between 2 different process (already running application , new one). what can find inter process communication mechanism , use it. typical inter process communications use files or common database. you can store id of current main thread executing java app. if new process starts check if there running application. if yes, can use same (or new one) inter process communication system send information main process should update. secondary process kill itself.

jquery - How can I pass variables to external javascript file that can be accessed by all the functions -

i have kendo grid events property hooked function(grid_onrowselect) in external javascript file. there other functions in external javascript file ( on button click * $("#btns").on('click', function () {....* ) , few others. grid_onrowselect function , other functions use common set of variables. how can pass variables external javascript file view (cshtml) can accessed functions. @(html.kendo().grid<mymodel>() .name("rgrid") .events(events => events.change("grid_onrowselect")) .columns(columns => { columns.command(command => ....... ....... ....... the external js file is var myfunc = myfunc || (function () { var _args = {}; // private return { init: function (args) { _args = args; // other initialising }, helloworld: function () { alert('hello world! -' + _args[0]); }, grid_onrowselect: function (e) { var data = this.dataitem(this.select()); de

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -

when responding supplicant_state_changed_action broadcast , attempting send udp packet, exception: java.net.socketexception: sendto failed: eperm (operation not permitted) @ libcore.io.iobridge.maybethrowaftersendto(iobridge.java:542) @ libcore.io.iobridge.sendto(iobridge.java:511) @ java.net.plaindatagramsocketimpl.send(plaindatagramsocketimpl.java:184) @ java.net.datagramsocket.send(datagramsocket.java:305) @ com.mycompany.app.serviceclass.discover(serviceclass.java:355)at com.mycompany.app.serviceclass.access$600(serviceclass.java:39) @ com.mycompany.app.serviceclass$statemachine.run(serviceclass.java:242) @ java.lang.thread.run(thread.java:818) caused by: android.system.errnoexception: sendto failed: eperm (operation not permitted) @ libcore.io.posix.sendtobytes(native method) @ libcore.io.posix.sendto(posix.java:211) @ libcore.io.blockguardos.sendto(blockguardos.java:278) @ libcore.io.iobridge.sendto(iobridge.java:509) @ java.net.plaindat

user interface - how to find view by its view class in android -

i inspired following code: @test public void ontype() throws exception { ... onview(isassignablefrom(edittext.class)).perform(typetext("a")); ... } how view view class in activity, think it's useful control 3rd custom view if have object reference class example class derived view.class view someview <- findviewbyid(int), getview(), getrootview() etc // method return view you can check if can assign other class cast - in way moving right left ( examples bellow ): edittext <- textview <- view framelayout <- viewgroup <- view numberpicker <- linearlayou <- viewgroup <- view example application: // view class reference call find view id view view = findviewbyid(r.id.someview); if(view!=null) { class viewclass = view.getclass() // check if can assign edit text class class ??? if(edittext.class.isassingablefrom(viewclass)) { // u can cast edit text , stuff edit text class did cas

dynamic programming - How does one solve this optimization? -

in videogame, there n levels, each 1 requires have amount of energy in order win level. start game @ level 0 0 energy, , every time win level, spend energy level requires (your energy can't go below 0). each level has 0, 1, or more shops sells energy amount e @ cost c. if find without enough energy pass level, lose because can't go previous levels buy other shops. whenever buy shop, new amount of energy e (the 1 shop sells), is, doesn't sum previous energy. the question: minimum money necessary in order win n levels? (assuming money infinite , can buy shops want,... want optimize buys necessary) i'm interested know how 1 finds solution this. problem solving technique solves kind of problems, if so, can explain?. there similar known problems should study first? i tried using recursive backtracking, hope of finding overlapping states , use dynamic programming, didn't find them. states where: shops, fork 2 branches... buys shop, or doesn't. this

java - Intellij tomee set tomee.serialization.class.whitelist -

how setup in intellij idea vm options. i need setup set java_opts="-dtomee.serialization.class.whitelist=" set catalina_opts="-dtomee.serialization.class.blacklist=-" in run/debug configuration local tomee server pass vm options -tomee.serialization.class.whitelist=* -tomee.serialization.class.blacklist=- also tried without *. still giving me "invalid arguments" error after run/debug server. how set properly? ps.if run server manually works correct. you need specify 2 properties java system properties (-d) in vm options of run configuration: -dtomee.serialization.class.whitelist=* -dtomee.serialization.class.blacklist=-

javascript - Why would multiple simultaneous AJAX calls to the same ASP.NET MVC action cause the browser to block? -

Image
a few days asked question: why $.getjson() block browser? i fire 6 jquery async ajax requests @ same controller action pretty @ once. each request takes 10 seconds return. through debugging , logging requests action method notice requests serialised , never run in parallel. i.e. see timeline in log4net logs this: 2010-12-13 13:25:06,633 [11164] info - got:1156 2010-12-13 13:25:16,634 [11164] info - returning:1156 2010-12-13 13:25:16,770 [7124] info - got:1426 2010-12-13 13:25:26,772 [7124] info - returning:1426 2010-12-13 13:25:26,925 [11164] info - got:1912 2010-12-13 13:25:36,926 [11164] info - returning:1912 2010-12-13 13:25:37,096 [9812] info - got:1913 2010-12-13 13:25:47,098 [9812] info - returning:1913 2010-12-13 13:25:47,283 [7124] info - got:2002 2010-12-13 13:25:57,285 [7124] info - returning:2002 2010-12-13 13:25:57,424 [11164] info - got:1308 2010-12-13 13:26:07,425 [11164] info - returning:1308 looking @ network timeline in firefo

dictionary - Rand Dict value not working in python -

is there way me specify value of 'ben stiller' or 'bill murray want? i know cant random.choice(ben_stiller.values()): i changed dict key name of movie , works perfect now. ^ import random last_man = { 'mark walberg': '1', 'ben stiller': '2', 'bill murray': '3', } markymark = { 'movie': 'the martian', 'movie': 'the departed', 'movie': 'xyz' } ben_stiller = { 'movie': 'meet parents', 'movie': 'something mary', 'movie': 'dunno' } bill_murray = { 'movie': 'life aquatic', 'movie': 'rushmore', 'movie': 'groundhogs day' } print "there 3 actors, 1 chosen randomly" print "you have name many movies have been in" print "if 1 wrong, lose, hae 3 chances, , must