Posts

Showing posts from July, 2011

openerp - Can we generate odoo reports in excel format? -

currently i'm generating openerp reports pdf format rml code using "openerp report designer" in openoffice . but how can generate report in xls format instead of pdf using same rml code. if 1 have solution / answer please let me know . thanks. the best way generate simple xls report use xls_report module has xls report engine. but complex designer xls reports, use xlwt package of python.

how to maintain the Image Position and Size for all size of Devices in android? -

Image
i have layout below image , have designed using image view , image button images. while run other devices alignment , size varies: so layout want use size based on design or device based or any technique there responsive design **i'm using on landscape mode there few ways this. easiest way use androids grid layout , build way, takes bit of getting used works well. the 2nd way make alot of values folders , ajusting dimens in them: https://developer.android.com/guide/practices/screens_support.html

matlab - Prevent from doing decimals -

i summing numbers between 2 indices in matrix, this: ans = sum(my_matrix1x500(100:300)); the ans number like: 351267300.4473 , on. how prevent printing decimals? instead of 351267300.4473 print 3512673004473 or remove decimal, possible? use fprintf('%.0f',x) print x '0' significant digits, or round(x) remove decimal altogether.

php - Sort array and child arrays by value -

i have array like: $array = array( 4 => array( 'position' => 0 'children' => array( ) ), 2 => array( 'position' => 0 'children' => array( 3 => array( 'position' => 1 ) 5 => array( 'position' => 0 ) ) ) ) i need sort outer arrays (2 & 4) key 'position', ascending (0 upwards), , sort each inner array of ('children'), respective position. there might 6 main arrays, 6 'children' arrays sort. what best way this? if understand explanation of problem correctly, following code work you: //sort outer array usort($array, function($a, $b) { return $a['position'] - $b['position']; }); //sort childrens foreach ($array &$item) { usort($item['children'], function($a, $b) { return $a[

Git log filtering by folder case insensitive (Windows) -

i got following command: git log --oneline -- sql\ that return commits files of sql path. but if change case, this: git log --oneline -- sql\ it doesn't work. can't find option make command case insensitive. possible? according specific example can replace sql [ss]ql . path accepts simple regular expression. git log --oneline -- [ss]ql\ there no solution using git core function.

swift3 - Accessing code in Swift 3 Error -

new in xcode 8 beta 4, nserror bridged swift error protocol type. affects storekit when dealing failed skpaymenttransaction s. ought check sure error didn't occur because transaction cancelled know whether or not show error message user. examining error's code . error instead of nserror , there no code defined. haven't been able figure out how error code error . this worked in previous version of swift 3: func failedtransaction(_ transaction: skpaymenttransaction) { if let transactionerror = transaction.error { if transactionerror.code != skerrorcode.paymentcancelled.rawvalue { //show error user } } ... } now error error not nserror , code not member. casting skerror seems working me in xcode 8 , swift 3... guard let error = transaction.error as? skerror else {return} switch error.code { // https://developer.apple.com/reference/storekit/skerror.code case .unknown: break case .paymentcanc

java - Apache Spark: How can I use an RDD inside of my RDD loop? -

is possible run loop in apache spark parallelized , work rdds in loop? i want use correlation function cartesian product of values. cartesian product large, thinking parallelizing loop. but if parallelize loop, can still work rdds in loop? collecting , iterating not option. example: lets have products, date , price product in dataframe data. the rdd materials list of products have. dataframe data; javardd<string> materials; javapairrdd<string, string> cartesian = materials.cartesian(materials); in next step want loop through combinations of cartesian rdd , filter dataframe tuple values. what thinking of this: cartesian.foreach(new voidfunction<tuple2<string, string>() { public void call (tuple2<string, string> arg0) throws exception { javardd<double> rdd1 = data.where(data.col("product").equalto(arg0._1)) .tojavardd().map(new function<row, double>() { public double call(row arg1) throws

PHP directory and file information in an array -

so there user directory space. each user gets own space , can upload .gif, jpg, png, , mp4 files them. the user can create , manage own files in many directories or sub-directories wish. i have no idea how need end result have no example code. need end result follows: foreach ($file $file) { $data[] = array('type' => 'image', 'path' => $file["path"], 'name' => $file[name], 'time' => $file["update_time"]); } how details directories keeping in mind have no idea structure after base directory. also, need exclude directories , files begin . (such .htaccess, there others) here go. usa recursive function iterate on each directory. if directory recursion, otherwise , store data: $directorytoscan = './'; $results = []; $tree = getdirenties($directorytoscan, $results); var_dump($tree); function getdirenties($directory, &$results) { $entries = scandir($directory);

java - JDK installation prompts to install JRE again. What's the difference between jre outside and inside JDK folder? -

when install jdk, after installation of jdk prompts let choose location install jre of save version. but, when jdk installation done, can see jre folder inside jdk folder. example, if install jdk in: c:\program files\java\jdk8 we can see: c:\program files\java\jdk8\jre and if choose save jre at: c:\program files\java\jre8 we can find folder contains (nearly) same content jre inside jdk folder. difference between these two? as oracle installation manual suggests in section " private versus public jre ": private versus public jre installing jdk installs private jre , optionally public copy. private jre required run tools included jdk. has no registry settings , contained entirely in jre directory (typically @ c:\program files\jdk1.8.0\jre ) location known jdk. on other hand, public jre can used other java applications, contained outside jdk (typically @ c:\program files\java\jre1.8.0 ), registered windows registry (at hkey_local_machine\sof

reactjs - simulate for onClick not working in enzyme -

this cancel button <div classname="cancelfilebtn" onclick={this.props.cancelfilesending}> i need simulate click,i tried following test wrapper.find('.cancelfilebtn').simulate('click'); but click function still undefined...did miss else? , helpful if can mention changes if exist in simulating <sendmessagebutton onclick={this.props.handleclicksendmessage} loadingfile={this.props.loadingfile}/>

c# - Ajax method not executes -

Image
this question has answer here: ajax function not working 2 answers ajax method not calling webmethod , not update data database. try without , json.strigify not work properly. using gridview in o have take textboxes , performing update task on it. my javascript code - $("body").on("click", "[id*=gridview1] .update", function () { var row = $(this).closest("tr"); $("td", row).each(function () { if ($(this).find("input").length > 0) { var span = $(this).find("span"); var input = $(this).find("input"); span.html(input.val()); span.show(); input.hide(); }

How to access immediate character of string in python -

i'm working on small program removes unit production in given grammar. i've developed 1 logic correct me. problem i'm facing cannot access next immediate index of string stored in list in python. gram=[line.rstrip('\n') line in open("grammar.txt","r+")] non_terminals=[] productions=[] item in range(len(gram)): non_terminals.append(gram[item][0]) print(non_terminals) temp=[] item in range(len(gram)): str in non_terminals: if gram[item][0] str: productions.append(gram[item].lstrip(str).lstrip('-'+'>')) temp='' item in range(len(productions)): str in range(len(productions[item])): nt in non_terminals: if productions[item][str] nt: if productions[item][str-1] '|' , (productions[item] [str+1] '|'): i=nt.index(nt) temp=productions[item].rstrip(nt) temp=temp+productions[i] print(productio

ios - AVPlayer stops loading tracks in lock screen -

i developing app in i'm receiving audio files airdrop in inbox folder of app , playing them avplayer . have turned on background mode audio playback. when lock iphone , current music file ends, next file doesn't load inbox folder. have audio in main document folder, there working fine. in this?

php - Display json array -

i trying read api have implemented wordpress using wp-api v2, have used several plugins return information need. the source json can found here . i need return pure_taxonomies->property-status->name . i have tried following blank page: foreach($select_api $p) { echo ' status:'.$p->pure_taxonomies->property-status->name.' '; } any great! first of all, if have json_encoded string, should decode json_decode() decoded json , array 2 elements. error because of hyphen property-status in name of property. should use curly braces: status:'.$p->pure_taxonomies->{"property-status"}[0]->name.' important. use curly braces property names hyphen don't forget in structure property-status array. that's why used index 0 first element

ios - Swift 3.0: Value of type 'IndexSet' has no member 'enumerateIndexesUsingBlock' -

receiving value of type 'indexset' has no member 'enumerateindexesusingblock' error @ enumerateindexesusingblock. /** extension creating index paths index set */ extension indexset { /** - parameter section: section created nsindexpaths - return: array nsindexpaths */ func bs_indexpathsforsection(_ section: int) -> [indexpath] { var indexpaths: [indexpath] = [] self.enumerateindexesusingblock { (index:int, _) in indexpaths.append(indexpath(item: index, section: section)); } return indexpaths } } the foundation type nsindexset has enumerateindexesusingblock method. corresponding overlay type indexset swift 3 collection, therefore can map each index indexpath : extension indexset { func bs_indexpathsforsection(_ section: int) -> [indexpath] { return self.map { indexpath(item: $0, section: section) } } }

How to query autocomplete for restaurants in Google Places API -

i looking example query returns list of restaurants use autocomplete given piece of partial text or without coordinates position. i see example geocode, returns physical places. i tried using type=establishment number of results not restaurants. try code. can check documentation of google places api such questions. supported types listed here <label for="restaurant"> <input id="restaurant" name="restaurant"> </label> <script> var input = document.getelementbyid('restaurant'); var options = { types: ['(restaurant)'] }; var searchbox = new google.maps.places.searchbox(input,options); </script>

java - Invalid maximum heap size: -Xmx512m -

i have tried possible heap sizes jvm, keep getting below exception. admin pc@admin-pc mingw64 /c/controller/opendaylight (master) $ /c/apache-maven-3.3.9/bin/mvn clean install error: not create java virtual machine. error: fatal exception has occurred. program exit. invalid maximum heap size: -xmx512m note - don't mark duplicate, because have tried solutions here unable find final fix this. edit notes- adding debug information $ bash -x /c/apache-maven-3.3.9/bin/mvn clean install + '[' -z '' ']' + '[' -f /etc/mavenrc ']' + '[' -f '/c/users/admin pc/.mavenrc' ']' + cygwin=false + darwin=false + mingw=false + case "`uname`" in ++ uname + mingw=true + '[' -z 'c:\program files\java\jdk1.7.0_80' ']' + '[' -z 'c:\apache-maven-3.3.9' ']' + false + true + '[' -n 'c:\apache-maven-3.3.9' ']' ++ cd 'c:\apache-maven-3.3.9' ++ pwd

java - Siddhi I don't get any response from aggregate query -

i have simple query this: define stream myeventstream (userid string, price int); define stream outputstream (avgprice double, userid string); @info(name = 'aquery') myeventstream#window.time(5000) select avg(price) avgprice, userid group userid insert outputstream; when add query callback don't response it. runtime.addcallback("aquery", new querycallback() { @override public void receive(long timestamp, event[] inevents, event[] removeevents) { eventprinter.print(timestamp, inevents, removeevents); } }); i'm producing messages in thread: final atomicinteger counter = new atomicinteger(0); final random rnd = new random(system.currenttimemillis()); executorservice executor = executors.newsinglethreadexecutor(); executor.submit(() -> { while (counter.getandincrement() < 100) { try { handler.send(new object[]{"user1", rnd.nextint(

windows - Dealing with corporate firewall adding self-signed certificates -

i work in small group inside of large company. all network traffic goes through company's firewall, think acts man-in-the-middle when traffic comes in. one example see when using curl c:\>curl https://www.google.com curl: (60) ssl certificate problem: self signed certificate in certificate chain so check certificate chain with: c:\>openssl s_client -connect google.com:443 and (with details removed) certificate chain 0 s:/c=us/st=california/l=mountain view/o=google inc/cn=*.google.com i:/c=us/my company's intermediate ca 1 s:/c=us/my company's intermediate ca i:/c=us/my company's root ca 2 s:/c=us/my company's root ca i:/c=us/my company's root ca this provides challenge using package managers npm or composer because https fails due self-signed certificate error, or not being able verify certificate i can npm work setting config values ca="" , strict-ssl=false , that's insecure practice. i'd our deve

bots - ValidationResult throws : "Object reference not set to an instance of an object". when passing back choices -

please find below exception. stack trace: exception: exception caught: 'microsoft.bot.builder.formflow.formcanceledexception1' in mscorlib.dll ("object reference not set instance of object."). exception caught: 'microsoft.bot.builder.formflow.formcanceledexception1' in mscorlib.dll ("object reference not set instance of object.") hi, trying generate form flow , during validation, if user enters wrong text passing choices select bot throws above exception , emulator hangs. below example .field(nameof(registrationform.modelnumber), validate: async (state, value) => { var modelssuggestion = pimsserviceclient.getmodelsuggestion(); validateresult validateresult = new validateresult() { isvalid = modelssuggestion.any(m => m.tolower().equals(value?.tostring().tolower())), value = value, choices = new list(modelssuggestion.select(s => new choice { value = s } })) }; /* database stuff */ return validateresult; })

apk - Android How to have two different version of my application -

i'd know if there way have 2 version of our application on same device. the purpose have 1 using our production api use while having 1 deploy inside our team using our test api without having uninstall production one? we deploying production through playstore , moment using crashlytics deploy in intern. if keep using tools great. if have idea? regards, you can use build variant in android studio. go project architecture , add flavor , set diifrent value according need http://tools.android.com/tech-docs/new-build-system/user-guide https://developer.android.com/studio/build/build-variants.html

sublimetext3 - Sublime Text 3 in 4K resolution, text too small, snippet suggestions too large -

i learning how code right now, , use both desktop (1080p res) , laptop (4k res). love sublime text 3, think it's wonderful, , use on desktop time...but when try using on 4k laptop, text way small, , snippet suggestions way big. mean when type <ti , suggests <title> little suggestion window wonky , big , out of focus (i don't know how explain it). things i've tried... 1) changing font-size in settings. able increase size of font slightly, made snippet suggestion problem worse. ran problem... @ font-size: 19, font size stops increasing. font-size: 19, font-size: 22 same size, font-size: 23, of sudden huge. 2) changing computer's screen resolution 1080p. makes things little better, text blurry, it's not crisp anymore. after couple hours makes eyes hurt/tired at. plus sucks having switch computer 4k 1080p every time want code. i've searched whole bunch (on google , here) , doesn't seem else having issue :(. any appreciated. thank

sql - Mysql insert into duplicate key on a non-duplicate key -

i use php , mysql. this sql works: insert products (id, title, description) values (10, 'value1', 'value2') on duplicate key update id=10, title='value25', description='value2' my id primary key , therefor works. other fields varchars. my real case bit different. @ this: type introduced , together sku it's unique. id sku title description type 1 abc 1 2 abc 2 3 def 1 so "real" key sku want use , it's not unique own. can not in case. type unique. look below , might more clear: abc-one // unique combination abc-two // unique combination def-one // unique combination is possible use multi insert/update sql query in case? if define columns sku , type unique columns, on duplicate key update expression work e.g. 1 primarykey in products

Unexpected output using System.err.println() in java -

this question has answer here: java: system.out.println , system.err.println out of order 5 answers i tried executing following print statements in java, output got unexpected. output jumbled. public class asynctestclass { public static void main(string[] args) { system.out.println("1"); system.out.println("2"); system.out.println("3"); system.out.println("4"); system.out.println("5"); system.err.println("error"); system.out.println("6"); system.out.println("7"); system.out.println("8"); system.out.println("9"); system.out.println("10"); } } first run output: 1 error 2 3 4 5 6 7 8 9 10 second run output: 1 2 3 4 5 error 6 7 8 9 10 third run output: 1 error 2 3 4 5 6 7 8 9 10 why

cumulocity - Display icon depending upon managed object fragment -

we update status fragment in our managed objects reflect current operating state of device. i'd display icon on cockpit dashboard changes colour managed object state changes. i considered using cumulocity scada widget, best way? can create own widget , use in standard dashboard? perhaps new widget type can choose icon based on object property added? in scada-lts (open source) add datasource reads data device example using modbus tcp/ip. add data point in datasource showing device status. create view "multistate graphics" component displaying info on device status our data point. you can customize "multistate graphics" component uploading pictures of choice. please contact me if need more details.

azure - Turning off ServiceFabric clusters overnight -

we working on application processes excel files , spits off output. availability not big requirement. can turn vm sets off during night , turn them on again in morning? kind of setup work service fabric? if so, there way schedule it? thank replying. i've got chance talk microsoft azure rep , documented conversation in here community sake. response initial question a service fabric cluster must maintain minimum number of primary node types in order system services maintain quorum , ensure health of cluster. can see more reliability level , instance count @ https://azure.microsoft.com/en-gb/documentation/articles/service-fabric-cluster-capacity/ . such, stopping of vms cause service fabric cluster go quorum loss. possible bring nodes , service fabric automatically recover quorum loss, not guaranteed , cluster may never able recover. however, if not need save state in cluster may easier delete , recreate entire cluster (the entire azure resource group) every da

c# - Get the latest html after ajax call in webbrowser control? -

there lot of kind of questions , not able find solution problem. i have webpage , after webpage loads ajax called , load table data may takes 2 seconds. i want data inside table. when try access table using document text not have table html. still have initial html has loaded before ajax call. webbrowser1.update(); //didn't work then tried didn't work private void timer_tick(object sender, eventargs e) //interval of 5000 { if (webbrowser1.readystate == webbrowserreadystate.complete) { htmlelement element = webbrowser1.document.getelementbyid("tabletype3"); if (element != null) { string webbrowsercontent = element.innerhtml; timer.stop(); } } } then tried didn't work private void waittillpageloadscompletly(webbrowser webbrcontrol) { webbrowserreadystate loadstatus; int waittime = 20000; int counter = 0; while (true) { loadstatu

java - Re-deploy spring boot service without restart? -

i have developed micro service (spring boot rest service, deployed executable jar) track activities third party projects requirement , working now. currently it's working apart of projects, , have updated service additional features. but can't move live server without restarting existing service deployed jar. i'm afraid restart service, restart may leads lose data of integrated projects. what improvements can make in architecture solve problem? what jrebel plugin. worked me, but, unfortunately, it's not free app. alternative (i used approach spring mvc, spring boot otherwise), set soft link in work directory on compiled path in jboss (in case dir name target , *.class , *.jar files). me, first solution jrebel appropriate you.

C# serializer/deserializer with same functionality as XStream in java -

i need accomplish simple task: serialize , deserialize object hierarchy. i've tried xmlserializer , datacontractserializer , netdatacontractserializer nothing seems work, there problem. xmlserializer bad because requires properties public. (net)datacontractserializer(s) bad because it's missing metadata - there no metadata when user creates xml. so how solve task? consider classes: class { private b instanceb; private int integervalue; ... getters/setters } class b { private list<c> cinstancelist; private string stringvalue; ... getters/setters } class c { ... other properties ... getters/setters } and user input: <a> <b> <cinstancelist> <c> <someproperties>val</someproperties> </c> <c> <someproperties>differentval</someproperties> </c> </cinstancelist> <strigvalue>lalala<stirngvalue&g

javascript - jest trying to parse .css -

i have problem jest in no matters keeps trying parse css files javascript. the files build webpack. i have following configuration jest "jest": { "rootdir": "./src", "modulenamemapper": { "^.*[.](css|css)$": "../jest/stylemock.js" } }, i tried script preprocessor strip css imports: "jest": { "rootdir": "./src", "scriptpreprocessor": "../node_modules/jest-css-modules" }, it keeps throwing error. ({"object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){.button { ^ syntaxerror: unexpected token . the best solution use modulenamemapper line in jest config, described in jest docs . a minimal "ignore css" jest config, in package.json , might this "jest": {

mysql - Multiple aggregations in a single SQL statement -

i have sql table following structure: id | datetime | value --------------------- what results following structure: id | value_avg_overall | value_avg_last_month | value_avg_last_week ------------------------------------------------------------------- currently using join , constructing query similar one: select * ( select_overall inner join select_last_month on select_overall.id = select_last_month.id ) inner join select_last_week on select_last_week.id = select_last_month.id; i have simplified query make more readable, select_* statements simple select statements using group by avg() respective time ranges. is effective way perform multiple aggregations , return of them in single result set in mysql? this called conditional aggregation: select id, avg(value) value_avg_overall, avg(case when datetime > date_sub(curdate(), interval 1 month) value end) value_avg_last_month, avg(case when datetime > date_sub(curdate(), interval

java - How to debug SSL traffic android -

i want debug input/output ssl traffic(like proxy) on android application. read can done vpnservice . not fiddler or charles, android application. maybe have source create functional?

PHP Count words in array -

this question has answer here: how count occurrence of duplicate items in array 6 answers ok, in case have array kinda (but larger) $array = [ 0 => "tod", 1 => "tod", 2 => "max", 3 => "jeff", 4 => "tod", 5 => "max", 6 => "jeff", 7 => "max", 8 => "max" ]; now question is, there way count how many occurences of tod , jeff & max there in array $array , store them seperate variables, example desired outcome there 3 seperate variables these there values (based off of sample code shown above) $todamount = 3; $jeffamount = 2; $maxamount = 4; i've done quite bit of research , havn't found out way :/ thanks reading! array_count_values() need. <?php $array = [ 0 => "tod",

javascript - Ajax append to a variable with condition -

this code: $.ajax('http://mydb.php', { datatype: "json", jsonp: "jsoncallback", method: 'get', contenttype: 'application/json', success: function (data, status) { var _ul = $('<ul />').attr('data-role', 'listview'); $.each(data, function (i, item) { $('<li />').append($('<a href="#p'+item.id+'" >'+item.nome+'</a>')) .appendto(_ul); var makepage = $('<div id="header">'); //append </div> makepage var makepage.appendto($.mobile.pagecontainer); }); $('#output').empty().append(_ul).enhancewithin();//.listview(); }, error: function (xhr, d, s) { $('#output').empty().html(s); } }); i want append content var makepage . need this: if ( item.something != &qu

android - Samsung S4 history.back not working for first time -

when user clicks cancel action in hybrid (angular js) application, first time history.back not working in application. if once press device button , try again works well. i tried below possibilities $window.history.back(); // normal window window.history.back(); , window.histroy.go(-1); return false; // html onclick function <div ng-click="javascript:history.back()">back</div> <div ng-click="javascript:history.go(-1)">back</div> non of above solutions worked.

r - Grouping posixct-data non-linear -

i have got series of video uploads , want show how many videos has been uploaded in last month, half year, year, 2, year, 3, year ... published_at of type posixct , should transformed factor levels above. is there nice way so? seems not first person thinking this. the dates like: date<- as.posixct(c("2015-12-11 00:00:01", "2016-01-11 00:00:01", "2014-01-11 00:00:01", "2015-12-11 00:00:01", "2016-04-04 08:22:01", "2013-12-11 00:00:01") , format= "%y-%m-%d %h:%m:%s") df<- data.frame(date, number=ceiling(abs(rnorm(1:6)))) i thought using cut -function don't know how specify breaks my approach this: published_at <- as.posixct(c("2015-12-11 00:00:01") , format= "%y-%m-%d %h:%m:%s") library(lubridate) half_year <- interval(start = ymd(sys.date() - months(6)), end = ymd(sys.date()), tzone = "e

javascript - WebSocket connection closes when server sends message only on port 80 -

i have simple, local nodejs server running express. i'm using express-ws set websocket endpoint. client sends messages fine, , server receives them, when server tries send message back, connection closes , client never receives message. this happens on port 80. connection stays open on port 3000, 8080, 443, , client receives messages server sends back. app.js const express = require('express'); const path = require('path'); const app = express(); const expressws = require('express-ws')(app); app.use(express.static(path.join(__dirname, 'public'))); app.get('/', function(req, res, next){ res.send(`<script src="js/client.js"></script>`); }); app.ws('/', function(ws, req) { ws.on('message', function(msg) { console.log(msg); ws.send(msg); //the connection doesn't close commented out }); }); app.listen(80); client.js const ws = new websocket(`ws://${window.location.host}`);

javascript - Issues passing props to page via routing -

i novice in reactjs. have created small application populates grid users , upon clicking of button associated user, application redirect page containing info user (passed props). have used router handling page request: <router> <route path="/" header="main page" component={() => (<mainpage content={users}/>)}> </route> <route path="/username" header="user page" component={userpage}/> </router> the grid page, works correctly , gets data prop parent component following: var react = require('react'); var reactrouter = require('react-router'); var link = reactrouter.link; var prompt = require('../components/prompt'); var userslist = react.createclass({ accessuserinfo: function (user) { this.context.router.push('/username', query={user}); }, render: function(){ return( <form> <table> <tbody> <tr>

javascript - TypeError: path.replace is not a function -

/node_modules/webpack/lib/templatedpathplugin.js:72 .replace(regexp_hash, withhashlength(getreplacer(data.hash), data.hashwithlength)) ^ i'm getting error when running webpack - seems path object rather string, , replace method therefore not found. can shed light on error? here's webpack.config.js : var webpack = require('webpack'); var path = require('path'); var basepath = 'app'; var outputfile = 'output.js'; var config = { entry: basepath + '/index.js', output: { path: basepath, filename: outputfile }, resolve: { extensions: ['', '.js'] }, module: { loaders: [{ test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader', query: { presets: ['es2015'] } }] } }; module.exports = config; check plugin configuration. webpac

javascript - Datamaps are showing small size map of India -

hi trying create map datamap , d3 js. showing map in reverse , small in size. how can resolve this. sharing js fiddle same. <script src="//cdnjs.cloudflare.com/ajax/libs/d3/3.5.3/d3.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/topojson/1.6.9/topojson.min.js"></script> <script src="https://raw.githubusercontent.com/markmarkoh/datamaps/master/dist/datamaps.ind.js"></script> <div id="container" style="position: relative; width: 500px; height: 300px;"></div> var map = new datamap({ element: document.getelementbyid('container'), scope: 'ind' }); https://jsfiddle.net/bxp9e9j1/ you need tell center , projection. add code: setprojection: function(element) { var projection = d3.geo.equirectangular() .center([80, 25]) .scale(600) .translate([element.offsetwidth / 2, element.offsetheight / 2]); var

c# - Generate Guid on database but only when not set in entity -

i have case need add guid property not primary key, , shared several objects in table. what i'd is: generate guid on database when don't give value set guid (instead of generating it) when have value both of done on insert only, updates won't touch these values. what have tried: add [databasegenerated(databasegeneratedoption.identity)] attribute: works when don't need set guid manually add [databasegenerated(databasegeneratedoption.computed)] attribute: doesn't work when don't set guid manually i've seen quite lot topic, , closest thing article: http://www.davepaquette.com/archive/2012/09/23/calculated-columns-in-entity-framework-code-first-migrations.aspx but don't (and won't) use migration in our project, doesn't seem fit. or question, mean generating guids in .net (which doesn't seem clean, @ least in opinion): ef, code first - how set custom guid identity value on insert is there way generate guid database side

statistics - Keep completeness of record when subsetting time series datasets in R -

i'll explain problem better. have downloaded databasee 300,000 observations time span of 16 years. want subset database taking in account completeness. i want keep observations complete in terms of year. example: assuming 3 different items (a,b , c) , time frame of 5 years. for item have observation years 1 5; item b have observations years 1,2,4,5; item c have year 3. i want subset dataset new dataset contain item a. how can translate in code? in simple way, having not seen data, name <- c('a', 'a', 'a', 'a', 'a', 'b', 'b', 'b', 'b', 'c') year <- c(1, 2, 3, 4, 5, 1, 2, 4, 5, 3) data <- data.frame(name, year) tmp <- aggregate(year ~ name, data, length) tmp1 <- subset(tmp, year >=5)

jquery - Change the color of the nav tag when scroll -

i want change color of <a> element of nav when scroll down. here repo https://github.com/sebalaini/twelfth_project_treehouse.com , here example of take original jquery code https://codyhouse.co/gem/vertical-fixed-navigation/ i change code project doesn't work, what's wrong ? var contentsections = $('.section'); var navigationitems = $('.nav a'); updatenavigation(); $(window).on('scroll', function(){ updatenavigation(); }); function updatenavigation() { contentsections.each(function(){ $this = $(this); var activesection = $('.nav a[href="#'+$this.attr("class")+'"]'); if ( ( $this.offset().top - $(window).height()/2 < $(window).scrolltop() ) && ( $this.offset().top + $this.height() - $(window).height()/2 > $(window).scrolltop() ) ) { navigationitems.eq(activesection).addclass('selected'); }else { navigationitems.eq(a

javascript - Highcharts change tooltip / label value -

Image
is possible change tooltip in label representing x value 1 based on it? in case, have dates values i'm showing number of month in x axis. when moving mouse on dots see full date.

javascript - Count number of slides and inner to another div -

Image
i try display number on orbit slider foundation 6. i've change previous , next navigation buttons. hot show slider number instead orbit bullets. need total , current slides. like on example (function () { function slidenumber() { var $slides = $('.orbit-slide'); var $activeslide = $slides.filter('.is-active'); var activenum = $slides.index($activeslide) + 1; $('.slider-number').innerhtml = activenum; console.log(activenum); } $('[data-orbit]').on('slidechange.zf.orbit', slidenumber); })(); <div class="orbit" role="region" aria-label="favorite space pictures" data-orbit> <ul class="orbit-container"> <button class="orbit-previous"><span class="show- for-sr">previous slide</span><li></li></button> <button class="orbit-next"><span class="sh

java - Android: How to Use Handlers With Thread Class and UI Thread (MainActivity) -

i viewed answer here: updating android ui using threads but not able understand how instantiate handler in background thread match uithread. i want clear , im using 2 entirely separate classes. uithread handler code: final handler handler = new handler(){ @override public void handlemessage(message msg) { if(msg.what==update_image){ images.get(msg.arg1).setimagebitmap((bitmap) msg.obj); } super.handlemessage(msg); } }; background thread handler code: if(dataarrives){ message msg = handler.obtainmessage(); msg.what = update_image; msg.obj = bitmap; msg.arg1 = index; handler.sendmessage(msg); } in background class, im getting "handler" undefined. please show entire thread classes in answer if can.

python - Hidden references to function arguments causing big memory usage? -

edit: never mind, being stupid. i came across code recursion on smaller , smaller substrings, here's essence plus testing stuff: def f(s): if len(s) == 2**20: input('check memory usage again') else: f(s[1:]) input('check memory usage, press enter') f('a' * (2**20 + 500)) before call, python process takes 9 mb (as checked windows task manager). after 500 levels ~1mb strings, it's @ 513 mb. no surprise, each call level still holding on string in s variable. but tried fix replacing reference string reference new string , still goes 513 mb: def f(s): if len(s) == 2**20: input('check memory usage again') else: s = s[1:] f(s) input('check memory usage, press enter') f('a' * (2**20 + 500)) why doesn't let go off memory? strings smaller, later strings fit space of earlier strings. there hidden additional references strings somewhere or going on? i had expecte

javascript - How can i convert jquery to java script? -

i want use jquery function js function how can convert it? function is:-- $(document).ready(function() { $('#carousel').carousel({ interval: 5000 }) }); write same code in js on window.onload event using document.getelementbyid

algorithm - Interview Prep Words in a Grid -

i've been doing interview prep questions , question i've had trouble i'm unsure how implement solution. here's setup. you're given 8x8 grid of letters , list of words, , must return longest word in list can formed starting @ letter on grid , moving grid in way knight in chess. example, if had list ["word", "string", "test"] , following grid: y w e z t n u w o p a c q g f t e l z x c v b n m m w f r t o u o n s d f b e j o l z v c t b n m q w e r t s g x z r s then return "test", because can formed starting @ bottom left corner of grid 't', jumping 2 , right 1 'e', jumping down 2 , right 1 's', , left 2 , 1 't', , none of other words can formed on grid. i think you'd use branch , bound algorithm i'm totally lost on how set up. help? i'm trying implement in python. note: letters can repeated in grid, i.e. can jump on same letter many times want. my solution is: eve

java - Angular 2 in spring tools suite -

as know week ago google released official version of angular 2. want setup sts create angular2/typescript projects. read article i'm not pretty sure best way it. can give me advices should install able write angular 2 / typescript in sts? best regards. since sts eclipse-based package, can install regular eclipse plugins it. angularjs recommend use https://github.com/angelozerr/angularjs-eclipse . hope helps!!!

Escaping and eliminating spaces from PowerShell scripts to enable roaming of file type associations on Windows 10 -

solved: solution below after ************'s i trying output similar preferably using out-file . <?xml version="1.0" encoding="utf-8"?> <defaultassociations> <association identifier=".html" progid="firefoxhtml" applicationname="chromehtml" /> </defaultassociations> the problem having write-host , spaces being introduced along variable values. use out-file instead, when try concatenate each line this: $out = $out + '<association identifier="'$($item.psparentpath | split-path -leaf)'"' out-file -filepath c:\temp\test.xml $out i error unexpected token '$(' in expression or statement. i'm close getting desired output. if permissions changed on %windir%\system32\oemdefaultassociations.xml allow standard users write, login script can put copy of script outputs file per user file type associations can roam between windows 10 computers. $u

javascript - ES6 class methods not returning anything inside forEach loop -

for reason method gettwo() inside pollclass won't return 2 undefined . if put return statement outside .foreach() loop value returned however. class poll { constructor(name) { this.name = name; this.nums = [1, 2, 3]; } gettwo() { this.nums.foreach(num => { if (num === 2) return num; }) } } const newpoll = new poll('random name'); console.log(newpoll.gettwo()); // returns undefined, not 2 is issue closure, es 6, or whole other issue? an arrow function still function, , you're returning foreach callback function, not gettwo, have return gettwo function well. it's not quite clear why use loop check in way, concept like gettwo() { var n = 0; this.nums.foreach(num => { if (num === 2) n = num; }) return n; // returns gettwo() }

algorithm - How to create a hack proof unique code -

i creating bunch of unique codes in order run promotional campaign. campaign run total of 20 million unique items. validity of code 1 year. looking best possible option. can use 0-9 , a-z in code. limits me using 36 unique characters in code. end user need key in unique cd in system , offers. unique code not tied against user or transaction begin with. one way generate unique code create incremental numbers , convert them base36 unique cd. problem hackable. users can start inserting unqiue cd in incremental fashion , redeem offers not meant them. thinking of introducing kind of randomisation. need suggestions regarding same. note - limit of max characters in code 8. use cryptographically strong random number generator generate 40-bit numbers (i.e. sequences of 5-byte random arrays). converting each array base-36 yield sequence of random eight-character codes. run additional check on each code make sure there no duplicates. using hash set on converted strings let perfo

android - RecyclerView - Remove Items and Leave Items Out -

i have two-part question hoping can assist with. reading data api. 1 of results of api ( in custom library made app) whether result has image or not. i trying add functionality user can remove cards , not show them if not have image. able on load (they store selection) or on fly. question one is possible leave out items when populating recyclerview cardviews? can make image stay out doesn't issue of leaving card out. question two is possible remove multiple items recyclerview on fly? have tried for-loop cycle through of list items , if not have image remove them. issue works half time , when takes 4 clicks checkbox so. note: below code inside of oncheckedchangedlistener if(imageonly.ischecked()){ image = true; for(int = 0; < strains.size(); i++){ if(strains.get(i) != null) { if (strains.get(i).getimage().equalsignorecase(getcontext().getresources().getstring(r.string.no_image))) { strains.remove(i); a