Posts

Showing posts from January, 2015

How to disable cache in tomcat 8.0.23? -

how can disable static-file cache in tomcat 8.0.23? my app.nocache.js file created gwt being cached tomcat. anytime recompile, tomcat serving old version of file. i happy disable tomcat's cache file containing "nocache" in it's name. disabling tomcat's cache well. i have tried: <resources cachingallowed="false" cachemaxsize="0" /> in web-inf/context.xml file, or: <context cachingallowed="false" cachemaxsize="0"> ...but neither of these attempts have succeeded in disabling cache. sorry answer late, may can other people. found in guide migrating tomcat 7 tomcat 8 should insert cachingallowed , cachemaxsize properties in resources tag has nested in context tag. missed nest it? link official guide: https://tomcat.apache.org/migration-8.html to me has worked. did dspace installation <context docbase="/my/path/to/xmlui" reloadable=...

session starts automatically in PHP 5.6.8? -

i'm running php 5.6.8. i'm trying build website. i've called session_status() on multiple pages , returns true. why happen? didn't ever call session_start(). i'm sorry if question asked or if can find answer on google. didn't. thank you. your check should this: if(session_status() === php_session_active) the session_status function not return true or false value. http://php.net/manual/en/function.session-status.php

mysql - SQL Conditional Logic to select the 'most appropriate' record -

i simplified entire system shows enough particular question. i'm storing in table information 1 photo has been scaled down several times (maintain aspect ratio). i'm trying devise 1 query table can appropriate photo. what mean appropriate is if request 705px width largest 1 returned in case 700x394 if request 50px width smallest 1 returned in case 150x84 sample data photo resized dimensions 700x394 400x200 300x169 150xx84 more information the images in database proportionally resized down using reference edge. the reference edge longest edge means if receive portrait photo gets resized down proportionally *x700, *x400, *x300, *x150. if image landscape gets resized down same way 700x*, 400x*, 300x*, 150x* this query partially works 0 maximum edge or lower. doesn't work if request dimension that's on maximum width. select * images width >= 750 order width asc limit 1 i have working trick change logic based on portrait or landscape ...

How to declare a global variable in Jenkins and use it in an MSBuild task within each individual project -

i converting our ci platform cruisecontrol jenkins, , can't seem figure out seems should relatively simple (disclaimer - i'm no ci or build automation expert, dumped lap , find interesting) in cruisecontrol, able declare variables this: <cb:define rootdir="j:\sources\" /> <cb:define logdir="j:\sources\buildlogs" /> <cb:define iisdir="j:\iis\" /> <cb:define artifacts="artifacts\" /> then use them part of msbuild task <msbuild> <executable>c:\windows\microsoft.net\framework\v4.0.30319\msbuild.exe</executable> <workingdirectory>$(rootdir)$(projectname)</workingdirectory> <projectfile>$(projectname).sln</projectfile> <buildargs>/p:builddate="1";outdir="$(iisdir)$(projectname)\bin\\";webprojectoutputdir="$(iisdir)$(projectname)\\"</buildargs> <targets>rebuild;$(projectname)</targets> ...

python - Pandas: transform a DataFrame by splitting each value into multiple values -

i'd extract point values , frequencies of scrabble letters. wikipedia gives following table (copied http://en.wikipedia.org/wiki/scrabble_letter_distributions#english ). # english scrabble points (rows) , frequencies (columns). scrabble_table = """ ×1 ×2 ×3 ×4 ×6 ×8 ×9 ×12 0 (blank) 1 l s u n r t o e 2 g d 3 b c m p 4 f h v w y 5 k 8 j x 10 q z """ which can import dataframe without problems. pd.read_table(io.stringio(scrabble_table), index_col=0).fillna("") image of resulting table . this table has values such "l s u" in 1-point row , 4-frequency column. i'd table has 1 row per letter , 3 columns: letter, frequency, , point value. can suggest how transform original table want? thanks. ...

ruby on rails - Creating filtering by 'Created_at' and/or presence of data in multiple columns -

big newbie here. started rails recently. i've been searching , i'm stuck on forward progress i've reached filtering. currently on index page, i'm showing orders created. customers (first_name, last_name) pay 'cash', 'credit', or 'check' (shown in decimal(8,2)). create filter manager can click on date , filter payment type (cash, credit or check), reconciliation purposes. i have searched many , confused method use. best guess have use sort of 'scoped' methodology? if can point me in right direction, i'd solve myself. in advance! scopes great in ruby. http://apidock.com/rails/activerecord/namedscope/classmethods/scope if want filter date. want supposed happen after today following. put scope definition in model want scope. lets call mimodel scope :post_dated, where("created_at > current_timestamp") that dumb example example nonetheless. if want filter after given date can use lambdas scope :post_d...

windows - Add custom "Install or run program from your media" to drive -

most dvd's/iso's have 'autorun' option (which technically no autorun anymore) allow users intended task using 'what-to-do-with-this'-dialogue of windows or using right-click menu. because hdd messy , need open 1 .bat inside time wherever go (foreign computers) add function drive make access quicker , easier other people. so far have added custom label , icon autorun.inf inside root of drive , works when copy autorun.inf working iso file won't show me action on drive (after re-plug ofc). does windows not allow these 'hot-actions' hdd's? or there fix this? tried far (my autorun.inf): [autorun] label=custom name yeah icon=custom_logo_whoo.ico open=run.bat shell\readme\command=run.bat shell\readme=run awesome software shell=readme

android - How to use different file format for apk? -

i want store local android applications on local android repository (e.g. using fdroid) using different format (for example compressed in bzip2 -- myapp.bz). can change fdroid server send bzip2 files fdroid android "play store" app , decompress it, tar (or keep in uncompressed format) , rename apk before handling android package manager able this? still being able install app android package manager? from understand not apk files compressed zip, package manager should understand tared file renamed extension? that´s not possible permitted format android application package ( .apk ) compressed .zip

javascript - add attribute to input from array; however, using value pair from jsaon -

i'm getting error: setattribute' on 'element': 2 arguments required, 1 present. i want add attributes input i'm avoiding repeats: //putholder.setattribute("placeholder", "product name (required)"); //putholder.setattribute("ng-model", "vm.product.productname"); //putholder.setattribute("ng-minlength", "4"); //putholder.setattribute("ng-maxlength", "12"); //putholder.removeattribute("size"); i have used following code can't right: var putholder = document.getelementbyid('customerid'); //var result = '{"placeholder":"product name (required)","ng-model":"vm.product.productname","ng-minlength":"4", "ng-maxlength":"12"}'; //$.each($.parsejson(result), function (k, v) { // putholder.setattribute(k + ' = ' + v); // }); //or js please prefer javascript js...

javascript - Adding additional text to a textbox using jquery -

i have page when user clicks on button add value textbox. got text add on textbox, inserts value newline. seems include < p > element each time well. there anyway value insert on same line? i don't know if makes difference using tinymce textbox. javascript $(document).ready(function () { $('#btnaddemailamount').click(function() { var text = $( "#<%= tbxemailmsg.clientid %>" ).val() + " amount"; $( "#<%= tbxemailmsg.clientid %>" ).val( text ); }); }); .aspx <div class="dialog" id="pnlemailmsg"> <div class="content" style="width: 685px; margin: 10px auto 10px auto; background-color: #d3d3d3; padding: 15px 30px 30px 30px;"> <h1>edit email message</h1> <button type="button" id="btnaddemailamount">amount</button><b...

javascript - calling a SOAP service from Node.js -

i started using node.js, , trying consume soap service using node soap extension. using sample service call right now, can't seem , running. var soap = require('soap'); var fs = require('fs'); requrl = fs.readfile('www.webservicex.net/stockquote.asmx?wsdl', 'utf-8', function(err, data){ if(err) console.log(err) soap.createclient(data, function(err, client){ client.stockquote.stockquotesoap.getquote({symbol:'nke'}, function(err, response){ if(err) console.log(err); console.log(response); }); console.log('here soap sent ' + data + client.lastrequest); }); }); here error getting: { [error: enoent, open 'c:\dev\workspace\webdevclass\node\www.webservicex.net\st ockquote.asmx?wsdl'] errno: -4058, code: 'enoent', path: 'c:\\dev\\workspace\\webdevclass\\node\\www.webservicex.net\\stockquote. asmx?wsdl' } fs.js:...

Writing arabic letters in java desn't work with runnable jar file -

i using code write string text file. string combination of english , arabic letters. when run code in eclipse works fine when extract code runnable jar file , run arabic letters replaced question mark. writer writer = new outputstreamwriter(new fileoutputstream(filename), "utf-8"); bw = new bufferedwriter(writer); bw.write("<meta http-equiv='content-type' content='text/html;charset=utf-8'>");

multi tenant - manage containers from another container, docker -

i need able deploy new container or manage docker containers running in coreos running docker container. docker version 1.5.0 coreos version 647.2.0 right process deploying new instance of application using shell script. it does: duplicate source code of node.js application new folder cd it deploy new docker container in detached mode setting 'pwd' -v work directory application runs i thinking, if possible execute shell script inside container deploys new container in coreos or there alternatives method. another objective able stop running container. any comments or suggestions appreciated. run controlling container docker client & socket mounted , able control docker daemon within containers (run docker client within docker container ) edit: note root access required docker socket, means container able control docker daemon , launch containter root on host, use containers trust , need access. $ docker run \ -v /var/run/docker.sock:/...

Is it possible to access to the workbooks published on tableau server from another computer? -

currently working on graduation project. trying set connection (ad_hoc connection) of 2 computer allow second computer access tableau server , vizualise workbooks published on server. while trying access not, tried google issue there nothing. can please. to access tableau server computer other 1 running tableau server or tableau mobile app, use tableau server computer name or ip address in url. on computer running tableau server, click start, right-click computer, , select properties. note computer name listed under computer name. if tableau server configured use port other default (port 80), must include port number in url. find port number: 2.1. on computer running tableau server, click start > programs > tableau server > configure tableau server. 2.2. port number shown in gateway section under general. on computer or device want access tableau server, type following url browser: ​if using default port: http://. if using custom port: http://:. so...

python - "ImportError: no module named 'requests'" after installing with pip -

i getting importerror : no module named 'requests' . but have installed requests package using command pip install requests . on running command pip freeze in command prompt, result is requests==2.7.0 so why sort of error happening while running python file? run in command prompt. pip list check version have installed on system if have old version. try uninstall package... pip uninstall requests try after install it: pip install requests you can test if pip not job. easy_install requests

transition - javafx using translatetransition and keyevent to move image around screen -

i trying make simple tile based movement system when direction pressed translate transition played smoothly move character 1 tile over. problem running when play animation image transition fine after transition completes, image jumps spot further intended. if take out portion of code onfinished animation plays pressing directions after cause image move previous place not current location. here code import javafx.animation.translatetransition; import javafx.application.application; import javafx.scene.group; import javafx.scene.scene; import javafx.scene.image.image; import javafx.scene.image.imageview; import javafx.scene.paint.color; import javafx.stage.stage; import javafx.util.duration; public class controltranslateimage extends application { final int step_size = 64; final duration duration = duration.millis(500); group player; public static void main(string[] args) { launch(args); } @override public void start(stage stage) ...

ios - dismiss a modally presented view controller to a different underlying view controller -

i have uiviewcontroller that's embedded in navigation view controller. modally present view controller shows countdown. once countdown ends, modal view controller should dismissed , show different underlying view controller original presenting uiviewcontroller. does know how in ios8 swift? there different ways approach this. 1 way replace initial presenting view controller desired underlying 1 when present modal view controller. nsarray * viewcontrollers = [self.navigationcontroller viewcontrollers]; [viewcontrollers replaceobjectatindex:viewcontrollers.count - 1 withobject:replacementcontroller]; dismissing modal show different underlying view controller swapped.

excel - Code to Select the first cell in a row after a loop finishes -

i working loop macro copies data until cell blank. once cell blank, want macro select cell in column a, in same row loop criteria satisfied. this have, loop macro works fine when tried code macro select cell error. range("c8:v8").select selection.copy activecell.offset(1, 0).range("a1").select activesheet.paste loop until activecell.offset(-1, 15) = "" activecell.offset(1, -6).range("a1").select end sub i'm having trouble understanding you're trying copy/paste, line select cell in column a, last row in spreadsheet: range(cells(activesheet.usedrange.rows.count + 1, 1), cells(activesheet.usedrange.rows.count + 1, 1)).select if doesn't achieve looking for, showing data copying/looping through helpful. it seems loop should never end in code, however, since end condition activecell.offset(-1, 15) looks finished copying contents cells "c8:v8". at end, error selecting activecell.offset(1, -6).range(...

swift - Adding undo function to drawing app -

i followed raywenderlich tutorial on using uikit make drawing app. i'm trying add in functionality undo last stroke. ideally undo 10ish strokes. i'm trying figure out best way go doing this. thinking of creating imageview has last stroke , making imageview.image = nil when user presses back. in code tutorial there's similar this. when touches end, newest stroke merged onto imageview of old ones @ right opacity. i'm not sure how add third (and potentially more) imageivews code make work. ideas / better way go this? code touchesended below. code override func touchesended(touches: set<nsobject>, withevent event: uievent) { if !swiped { // draw single point drawlinefrom(lastpoint, topoint: lastpoint) } // merge tempimageview mainimageview uigraphicsbeginimagecontext(mainimageview.frame.size) mainimageview.image?.drawinrect(cgrect(x: 0, y: 0, width: view.frame.size.width, height: view.frame.si...

c++ - Does std::unordered_map<std::string,std::function<void(std::string&) can hold only static functions? -

this continuation of question c++ function ptr in unorderer_map, compile time error i trying use std::function instead function pointer, , can insert function if functions static. otherwise following error main.cpp:15:11: error: no matching member function call 'insert' map.insert(std::make_pair("one",&example::processtring)); #include<string> #include <unordered_map> #include<functional> namespace test { namespace test { class example { public: example() { map.insert(std::make_pair("one",&example::processtring)); } static void processtring(std::string & astring) //void processtring(std::string & astring) -> compiler error { } static void processstringtwo(std::string & astring) { } std::unordered_map<std::string,std::function<void(std::string&)>> map; }; } } int main() { return 0; } in context, std::func...

recover file saved by hitting Ctrl + S on Visual studio -

i've complied code today using visual studio. kept hitting ctrl + s meanwhile coding have never "saved as...". visual studio crashed , code lost ='( possible recover it? check under c:\users\[username]\documents\visual studio 2010\projects

context free grammar - Does Chomsky Normal Form have left recursion? -

one of famous form of cfg cnf , know have 2 non terminal rhs or 1 terminal rhs , empty rhs,if exists, appear in rhs of root described in wiki , i'm not sure cnf allow have left recursion? yes, cnf allows form of recursion.

ios - CITransform vs CATransforms which and when to use? -

i need draw overlay on camera, on every frame draws arrow different direction. now understand, because of processing every frame, should using core graphics drawing, besides drawing arrow need give perspective effect depending on camera orientation. i managed overlay png on every frame transformed using cifilter ciperspectivetransform. but going next level "drawing" arrow , not sure better apply. should draw arrow , convert ciimage , follow known path of applying ciperspectivetransform or should dive core animation , if so... equivalent of ciperspectivetransform in core animations world. core animation doesn't perspective default. best suited 2d animation. however, possible. transformation matrix core animation catransform3d type. in order perspective work have manually set .m34 field of catransform3d small negative value. if google search on "catransform3d m34" should find info on how 3d perspective core animation layers. i haven't us...

javascript - How prevent angular auto trim for fields? -

is there way prevent angular auto trim fields in whole application? know can prevent specified field using ngtrim directive, doesn't add directive text fields in application, there way fields in angular module? here code, if add add spaces in begin of input not appear in label: <div ng-app> <div ng-controller="todoctrl"> {{field}} <input type="text" ng-model="field"> </div> </div> you can extend input[text] directive, code below automatically change value of attribute ngtrim false : .directive('input', function($compile){ // runs during compile return { link(scope, ielement, iattrs) { if (ielement.attr('type') === 'text') { iattrs.$set('ngtrim', "false"); } } }; }); reference: https://docs.angularjs.org/api/ng/type/ $compile.directive.attributes <!doctype html> <html lang="en...

javascript - Angular Service Promises -

so, i've got angular app makes restful calls server. there service wraps calls server. have method on service returns promise $http service. i'd add additional processing on method call, i'm not sure how because of asynchronous nature of promise. currently in typescript: class boardservice { private $http; constructor($rootscope: irootscope, $http: ng.ihttpservice) { this.$http = $http; } fetchboard(id: number) { return this.$http.get("/api/board/" + id); } } i'd this: fetchboard2(id: number) { this.$http.get("/api/board/" + id).success(function(data) { // manipulate data }); // return manipulated data; } how this? tricky sentence warning! because promises asynchronous, returning data based on data promise must return promise. want fetchboard2 return promise gets resolved once $http promise has come , you've manipulated data. angular's $q service. ...

java - aplying onPostExecute to onClickListener -

i have made program works asynctask prints list of json data when program executed, problem want execute when press button. how results of asynctask onclickbuttonlistener ? how call asynctask onclick? code: public class instillinger extends mainactivity { databasehelper mydb; string navn; string adresse; string bilmere; textview visnavn; textview visadresse; textview visbil; edittext navnfelt; edittext adrfelt; edittext bilfelt; button lagrebutton; button tilbakebutton; button visdatabutton; list<bruker> brukere; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.instillinger); mydb = new databasehelper(this); // visnavn = (textview) findviewbyid(r.id.visnavn); visadresse = (textview) findviewbyid(r.id.visadresse); //visbil = (textview) findviewbyid(r.id.visbil); navnfelt = (edit...

c# - Cannot deserialize the current JSON array into List<> 'because the type requires a JSON object " -

i getting "cannot deserialize current json array (e.g. [1,2,3]) type 'mercury.tgc.service.dto.contactresponsedto' because type requires json object (e.g. {"name":"value"}) deserialize correctly." what doing wrong? json returned api { "status": "success", "body": { "companyname": "keep org merge test", "taxid": "tax id2", "addresses": [ { "id": 100, "addressname": "location 1", "address1": "1234 create ave", "address2": "suite 1234", "city": "west des moines", "state": "ia", "postalcode": "50266", "country": "usa", "latitude": 41.575011, "longitude": 93.709212, "isprimary": true, "imageshortkey": "5a0lc9ge5n", "types": [], "phones": []...

get line number with bash in R -

using system(paste("wc -l file_1.txt")) in r obtain line number of file output 1601 file_1.txt my problem if type system(paste("wc -l file_1.txt"))->kt , kt [1] 0 i need able whether system(paste("wc -l file_1.txt"))->kt kt[1]==1600 or not..but cant access elements system commadn or printout...how can somehow check whether file has 1600 lines without reading r first... system returns return value of command default, need use intern argument: system(paste("wc -l banner.p"), intern=t)->kt kt string like <lines> <filename> and parse string.

excel - Run and execute a python script from VBA -

i'm trying run python script vba module. i've tried pretty every example i've seen on internet , have had no luck. in vba module run .bat file, , works perfectly: batchname = "u:\backup bat file.bat" shell batchname, vbnormalfocus next need run python script, located in same folder excel file. right i'm trying out this: dim ret_val dim args args=activeworkbook.path & "\beps_output.py" ret_val = shell("c:\python34\python.exe" & args, vbnormalfocus) it doesn't error out, nothing happens. i'm little confused @ "ret_val" (return value?) here, , why isn't running. try adding space between exe program , file: ret_val = shell("c:\python34\python.exe " & args, vbnormalfocus) also, because shell function returns value (variant type - double) specified arguments, returned value can contained in variable, here specify ret_val. can add conditional logic , error handling using va...

Parse the json objects inside json Array in Android? -

i trying parse json values android application , put result in lisview. there json result: [ {"dateticket": "12/02/2015", "description": "kkkkkk", "etat": "suivi", "idticket": 32, "nomfichier": "contrat", "objet": "contrat", "priorite": "first"}, {"dateticket": null, "description": null, "etat": "en cours", "idticket": 98, "nomfichier": "lotfi", "objet": "contrat", "priorite": "normale"}, { "dateticket": null, "description": null, "etat": "en cours", "idticket": 99, "nomfichier": "lotfi", "objet": "contrat", "priorite": "normale"}, ] thanks in advance maybe this make necessary changes. private void openparsejson(string st...

c++ - Getting the ListView index of a QList object -

i've exposed qlist<myitem*> model listview . how can listview index of myitem* object? context: i'm making findobject() function in c++ , when i've found object (a myitem* ), want scroll corresponding item in listview . some code (full source code , qt creator project can found @ https://github.com/joncol/qml_test ). the item class: class myitem : public qobject { q_object q_property(qint32 data read data notify datachanged) public: myitem() : m_data(s_counter++) {} quint32 data() const { return m_data; } signals: void datachanged(); private: static int s_counter; int m_data; }; the model: class mycppmodel : public qobject { q_object q_property(qqmllistproperty<myitem> itemlist read itemlist notify itemlistchanged) public: mycppmodel() { m_specialitem = new myitem; m_model.append(new myitem); m_model.append(new myitem); m_model.append(new myitem); m_mode...

c# - ConcurrentBag vs Custom Thread Safe List -

i have .net 4.5 single instance wcf service maintains collection of items in list have simultaneous concurrent readers , writers, far more readers writers. i deciding on whether use bcl concurrentbag<t> or use own custom generic threadsafelist class (which extends ilist<t> , encapsulates bcl readerwriterlockslim more suited multiple concurrent readers). i have found numerous performance differences when testing these implementations simulating concurrent scenario of 1m readers (simply running sum linq query) , 100 writers (adding items list). for performance test have list of tasks: list<task> tasks = new list<task>(); test 1: if create 1m reader tasks followed 100 writer tasks using following code: tasks.addrange(enumerable.range(0, 1000000).select(n => new task(() => { temp.where(t => t < 1000).sum(); })).toarray()); tasks.addrange(enumerable.range(0, 100).select(n => new task(() => { temp.add(n); })).toarray()); i follo...

coordinates - MATLAB - Correlation with Vectors -

i have 2 vectors xyz different sizes. can call data1 , data2, where: data1 = [1000 3:55 2000; ... 950 2200 4.5; ... 1050 2350 5.5; ... 1025 2500 6; ... 1075 2600 7; ... 1000 2700 8]; data2 = [1000 2650 7.95; ... 1000 2750 8.16; ... 1000 2700 9; ... 1025 3000 10]; the minimum acceptable difference between points 100 meters position (x, y) , 0.2 depth (z). in case, points between vectors p_data1 = [1000 2700 8] , p_data2 = [1000 2650 7.95], because distance acceptable , depth nearest. does know function can correlation me? think in matalab there function problem , high performance, calculation thousands of points. i'm using nested loop, performance bad, because calculate distances, differences between depths every point , filter matrix. in short, want find points lower , lower depths between 2 vectors of different sizes defined ranges. i thank help! data1 = [950 2200 4.5; ... ...

angularjs - Dependency injection in Controller's prototype -

is there way access dependencies in controller's method without attaching scope ? var mycontroller = function($http, $window) { this.window = $window //this slow digest cicle } mycontroller.prototype.method = function() { // how access $http here ? } angular.module('app').controller('mycontroller', mycontroller)

multithreading - Java Multiple threads for just 2 computers, how to do it in main -

i'm trying @ least 2 computers connect server, how start second thread? public static void main(string[] args) throws interruptedexception { // create server waits client request connection. while(true){ filesharedserver server = new filesharedserver(); thread thread = new thread(server); thread.start(); } } this refuses connection you need wait on serversocket.accept() method on incoming connections in server, , after receiving 1 start thread serve it, server socket stay same, waiting next connection in loop. while (true) { socket connection = serversocket.accept(); new therad() { public void run() { serveconnection(connection); } }.start(); }

r - Counting numbers of DBpedia wikilink and external link using SPARQL -

i querying dbpedia list of person names using sparql package in r. , working on counting of different categories 1 person, such number of wikilink or external_link . know count items per person, such as: query= "select count (*){ <http://dbpedia.org/resource/philipp_melanchthon> ?p ?o }" this print out count of items 1 person, there way print out count of different categories 1 person respectively? many thx. as pointed out following query gives relations , objects related it: select distinct *{ dbpedia:philipp_melanchthon ?p ?o. } if want find out external links, need replace ?p appropriate property in case dbpedia-owl:wikipageexternallink : select distinct *{ dbpedia:philipp_melanchthon dbpedia-owl:wikipageexternallink ?o. } thus count give external links: select (count(?o)){ dbpedia:philipp_melanchthon dbpedia-owl:wikipageexternallink ?o. }

wpf - Default windows theme specific BorderBrush for the Menu control -

Image
how default windows theme specific borderbrush menu control? example, can background colour menu using background="{x:static systemcolors.menubrush}" . what activeborderbrush or systemcolors.windowframebrush ? taken from: msdn wpf team blog - systemcolors reference

Python: cycle through elements in list reversing when the end is reached -

i have list looks like: a = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10'] i need cycle through list 1 element @ time when end of list reached, cycle needs reversed . for example, using itertools.cycle : from itertools import cycle a_cycle = cycle(a) _ in range(30): print a_cycle.next() i get: 01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 01, 02, 03, 04, 05, 06, 07, 08, 09, 10 but need is: 01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 10, 09, 08, 07, 06, 05, 04, 03, 02, 01, 01, 02, 03, 04, 05, 06, 07, 08, 09, 10 i need cycle through a fixed number of times, 200. you can cycle chain of a , reversed a , eg: from itertools import cycle, islice, chain = range(1, 11) b = reversed(a) c = cycle(chain(a, b)) d = list(islice(c, 100)) # `c` infinite - hence `islice` stop @ point... which gives you: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10,...

selection second row to current row excel vba -

i trying find, how can make selection of rows. i need make selection second row active cell row. can me? thx rows("2:activecell.row").select i try one, it´s not working. you need concatenate active cell. try, rows("2:" & activecell.row).select

Add values to a class in Python -

this question has answer here: how programmatically set attribute? 3 answers let's have following in python: class test(): self.value1 = 1 self.value2 = 2 def setvalue1(self, value): self.value1 = value so 1 can set value1 doing: test.setvalue1('hola') or test.value1 = 'hola' so far good. problem set values reading them somewhere else instance have following: a = [['value1','hola'],['value2','adios']] i able run (in pseudo code): for each in a: test.each[0] = a[1] is possible? much! you that: class test: def __init__(self): self.val1 = 1 t = test() setattr(t, 'val2', 2) print t.val2 or that: class test: def __init__(self): self.val1 = 1 def setself(self, name, val): self.__dict__[name] = val t = test() t.setself(...

android - get city name in andorid using ip address without GPS -

i can able city name in android using gps or network provider i tried locationmanager , if gps off location manager , location getting null. why without gps ? reason battery getting low soon. improve battery performance dont want turn on gps . is there way without turning on gps able city name in android? or if gps off why location manager getting null? how solve this easy way current location json. john get current location

mysql - php not selecting after truncating the some part of the database -

after truncate table in database cannot select specific column in table not affected truncate code. think database has been corrupted. final defense 2 days , completed system after running code system went crazy! because select function functioning here code think literally destroy database, use reset evaluation system of particular university. mysql_query("truncate table records"); mysql_query("truncate table chairassign"); mysql_query("truncate table studentstotal"); mysql_query("truncate table tempfiles"); mysql_query("truncate table tempfiles2"); mysql_query("update evaluationstatus set allowviewing ='no'"); mysql_query("update faculty set evaluateid1 = 'null', evaluateid2 = 'null', evaluateid3 = 'null' , evaluatedbyself = 'no' ,canevaluate = 'no'"); mysql_query("update users set deanevaluator = 'no' ,evaluatedbyself = 'no' ,eval...

sapui5 - UI5 Image Gallery with Indices (Carousel or Paginator) -

Image
i build image gallery (in lightbox (overlay)) indices displaying index of current shown image. like: i have more 5 pictures, need "swipe" gestures display next/prev ones , arrows. first thought sap.ui.commons.carousel perfect, did not find events (like e.g. "transitionend") not know how access current index then. paginator has no swipe event (?).. i appreciate advice approach follow! first steps, i'd happy post code here. right need little start best fitting solution of controls. thanks lot. why not use sap.m.carousel? has pagechanged event oldactivepageid , newactivepageid params. here sample: var appcarousel = new sap.m.app("myapp", {initialpage:"carouselpage"}); var carouselpage = new sap.m.page("carouselpage", {title: "carousel", enablescrolling: false } ); var page1 = new sap.m.page("page1", ...

scala - Some.asInstanceOf[T] or Some.get.asInstanceOf[T] for json -

i have rdd json rows: val jsons = sc.textfile("hdfs://" + directory + "articles_json/*/*").flatmap(_.split("\n")). map(x => json.parsefull(x)) each json has field "dc:title" , want create rdd these titles , indexes. val titles_rdd = jsons.filter(x => x.isdefined). map(x => x.get.asinstanceof[map[string, any]]. get("dc:title").get.asinstanceof[string]).zipwithindex() but, don't understand, should use .get in x => x.get.asinstanceof in map, or x => x.asinstanceof ? , same question .get after get("dc:title") ? did try sqlcontext? parsing simpler this. https://spark.apache.org/docs/1.1.0/sql-programming-guide.html#json-datasets it great, if can give sample json of yours edited: i assume question, you have list, scala> val = list(some(1),some(2),some(3),none,some(4)) a: list[option[int]] = list(some(1), some(2), some(3), none, some(4)) ...

java - Maping a String to XWPFDocument same as console -

i using xwpfdocument generating .docx invoice. have designed string below on console xxxx restaurant & cafe phone no# 12131546 invoice no. 120 type: c-6 customer name: 29 05 2015 --------------------------------------- product qty price total --------------------------------------- fr. egg+toast but. jam 1 110.0 110.0 --------------------------------------- discount: 0% sub total: 110.0 cash: 200 my code generating .docx is: fileoutputstream output = new fileoutputstream(file); xwpfdocument doc = new xwpfdocument(); xwpfparagraph para = doc.createparagraph(); para.setalignment(paragraphalignment.center); xwpfrun run = para.createrun(); run.setbold(true); run.setfontsize(11); doc.write(output); output.close(); but generated .docx having text looks...

Getting data from sql table inside a GridView (C#) -

i've got gridview made in asp.net. want fill method. doesn't work. return() doesn't work , getdata inside page_load underlined red(compiler error cs1501). public partial class pages_gridview1 : system.web.ui.page { protected void page_load(object sender, eventargs e) { getdata(); } public string getdata(chart chart) { string connstr = configurationmanager.connectionstrings["crm_sql"].connectionstring; sqlconnection conn = new sqlconnection(connstr); conn.open(); sqlcommand query = new sqlcommand(chart.sql, conn); sqldatareader rst = query.executereader(); gridview1.datasource = rst; gridview1.databind(); return gridview1(); } } you calling getdata() method without parameters , in method definition using getdata(chart chart) . plus returning string in method definition!! method call : getdata() method definition : public string getdata(char...

javascript - Collapse row on mouse click -

i found 1 example of collapsible content on internet it's unfinished. <div class="container faq_wrapper"> <div class="row"> <div class="span10 offset1"> <p> &nbsp;</p> <div class="faq-all-actions"> <a class="faq-expand" onclick="jquery('.answer-wrapper').css('display','block');">expand all</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a class="faq-collapse" onclick="jquery('.answer-wrapper').css('display','none');">collapse all</a></div> </div> </div> <div class="row"> <div class="span10 offset1"> <div class="question-wrapper"> <div class="arrow"> &nbsp;</div> ...

Open text file via batch? -

i trying access text file using batch when user enters command. have tried doing start e:\programming\important\folder\textfile cls and closes cmd window wont open file. mind telling me did wrong? (sorry code not being in gray box im using web browser on phone) i guess problem textfile has no file extension, windows not know how open it. instead of using start use notepad command, notepad.exe in search path of system, can write: notepad 'e:\programming\important\folder\textfile' this open file.

sql - Creating a SAP master vendor table -

i need create master vendor table containing following tables: lfa1, lfb1, lfbk, lfm1, lfm2 , wyt3 ...in sql. can please assist me on columns link which? e.g. lfa1.lifnr = lfb1.lifnr creating lfa1_lfb1 lfa1_lfb1.lifnr = lfbk.lifnr creating lfa1_lfb1_lfbk ...etc. relationships between these tables are: lifnr between lfa1, lfb1, lfbk , lfm1 lifnr , ekorg between lfm1 , lfm2 between lfm2 , wyt3, lifnr, ekorg , werks i'm not sure.

c++ - How to increase the number of cells in an array with Dynamic Allocation? -

so trying use dynamic allocation increase number of cells in array. the array type location created includes x , y coordination the process goes way: i create new heap location array of same size + 1 i use for-loop copy previous locations new array deleting previous pointer pointing previous 1 new one what doing wrong? this code : void extendlocarray(location** ilocprevarray, int innumberofmovements) { // variable definition location* locnewpatharray = new location[innumberofmovements]; int nindex; // code section // copies previous locations (nindex = innumberofmovements - 2; nindex >= 0; nindex--) { locnewpatharray[nindex] = (*ilocprevarray)[nindex]; } delete[](*ilocprevarray); (*ilocprevarray) = locnewpatharray; } a correct function can following way (provided want copy elements of arrays in reverse order) void extendlocarray( location** ilocprevarray, size_t innumberofmovements ) { // v...

sparql - Is it possible to Filter Graphs in a way that they at most contain requested Data? -

let me start example query explain problem: select ?g ?s ?p ?o { {graph ?g { ?s ?p ?o. optional{ ?s ab:temperature ?temperature.} filter (?temperature = 20) filter not exists {?s ab:person ?person} } } } this query gives me graphs (in case representing context data) have temperature of 20 don't have person associated. problem want query graphs optional properties shouldn't have other properties. @ time of query know optional part don't know additional property might there. there easy way sparql or easier check after received graph , converted object can handle programm? if understand question correctly, searching graphs have subjects properties not others. in case i'd run this: select ?g ?s ?p ?o { graph ?g { ?s ?p ?o. filter not exists { ?s ?bad [] . filter (?bad not in ( ab:temperature, ... ) ) } } }

python - Annotate with latest related object in Django -

i have model conversation , model message . the model message has foreign key conversation, text field, , date field. how can list conversations , each conversation recent message , date of recent message? i guess it's like conversation.objects.annotate(last_message=max('messages__date')) but give me latest date. want last_message contain both text of last message , date created. maybe need use prefetch_related? you can prefetch_related , queryset . like: conversation.objects.prefetch_related(prefetch('messages'), queryset=message.objects.order_by('date')[0])

liferay - Data too long for column mysql -

i using liferay framework mysql database , keep getting error : error [http-bio-80-exec-5][render_portlet_jsp:157] com.mysql.jdbc.mysqldatatruncation: data truncation: data long column 'odlukakomentar' @ row 1 @ com.mysql.jdbc.mysqlio.checkerrorpacket(mysqlio.java:4118) @ com.mysql.jdbc.mysqlio.checkerrorpacket(mysqlio.java:4052) @ com.mysql.jdbc.mysqlio.sendcommand(mysqlio.java:2503) @ com.mysql.jdbc.mysqlio.sqlquerydirect(mysqlio.java:2664) @ com.mysql.jdbc.connectionimpl.execsql(connectionimpl.java:2794) @ com.mysql.jdbc.preparedstatement.executeinternal(preparedstatement.java:2155) @ com.mysql.jdbc.preparedstatement.executeupdate(preparedstatement.java:2458) @ com.mysql.jdbc.preparedstatement.executebatchserially(preparedstatement.java:2006) @ com.mysql.jdbc.preparedstatement.executebatch(preparedstatement.java:1467) @ com.mchange.v2.c3p0.impl.newproxypreparedstatement.executebatch(newproxypreparedstatement.java:1723) @ org....

oracle - Solr date variable resolver is not working with MySql -

i have used solr 3.3 version data import handler(dih) oracle . working fine me. now trying same mysql . change in database, have changed query used in data-config.xml mysql . the query has variables passed url in http. same thing works fine in oracle variable resolver not in mysql . the query : select distinct doc.document_id , doc.first_version_id, doc.acl_id, fol.folder_id ds_document_c doc, ds_folder fol doc.cabinet_id = ${dataimporter.request.cabinetid} , fol.folder_id = doc.document_folder_id , doc.index_state_modification_date >= to_date('${dataimporter.request.lastindexdate}', 'dd/mm/yyyy hh24:mi:ss') and url : localhost:8983/solr/dataimport?command=full-import&clean=true&commit=true&cabinetid=17083360&lastindexdate='24/05/2015 00:00:00' solr building query below : select distinct doc.document_id , doc.first_version_id, doc.acl_id, fol.fo...