Posts

Showing posts from April, 2010

javascript - Repeated regular expression match -

i have string consists exclusively of numbers. want match groups of 3 of every digit excluding first digit. for example: "1000123" should return "000" , "123" matches. i tried using /\d(\d{3})+/ but matches first group being "000" , global flag didn’t either. how solve this? use negative lookahead. 3 digits. (?!^\d)\d{3} demo or from 1 upto 3 digits. (?!^\d)\d{1,3}

Qt connecting to postgreSQL database without configuring ODBC -

i'm trying connect postgresql database without configuring system dsn odbc, i've googled lot , i've tried lot of connection strings didn't work, maybe i'm doing wrong. here 1 of connection strings i've tried: dbconnectionstring = qstring("driver=postgresqlunicode(x64)}| server="+dbhost+"|port=%1|database="+dbname+"|uid="+username+"|pwd="+password+"|byteaaslongvarbinary=1").arg(port) db.setdatabasename(dbconnectionstring); any suggestion?

Sometimes android.content.res.Resources$NotFoundException: String resource ID on API 21 -

i have strange problem. in app on crash sended log exception. strange error: android.content.res.resources$notfoundexception: string resource id #0x7f050095 @ android.content.res.resources.gettext(resources.java:1334) other parts of stack trace may different. string id maybe different too. it occurs on api 21 android 5.0 or 5.0.1. , then, not always. in other api , android versions - problem don't occurs. i have /res/values/strings.xml needed data. what problem? possible problem specific firmware? or maybe, apk damaged after installation? because, understand it, whether problem code, time. as found problem due fact resources used activity have destroyed.

javascript - video duration inside a for loop not working -

the code taken following link : https://s3.amazonaws.com/demo.jwplayer.com/text-tracks/chapters.html in code there following: function update() { var p = v.currenttime/v.duration*100; b.style.background = "linear-gradient(to right, #500 "+p+"%, #000 "+p+"%)"; } function render() { var c = v.texttracks[0].cues; (var i=0; i<c.length; i++) { var s = document.createelement("span"); s.innerhtml = c[i].text; s.setattribute('data-start',c[i].starttime); s.style.width = ((c[i].endtime-c[i].starttime)/888*480-7)+'px'; s.addeventlistener("click",seek); b.appendchild(s); } } in render() function. number 888 represent full duration of video. there anyway can retrieve full duration automatically? in update() function there variable v.duration. tried use instead of 888 code still did not work. reason v.duration did not work in render() function? there eas

javascript - Tranfer data between canvas with pubnub and webrtc successfully -

i trying implement small app (example in order make main app work) when user 1 canvas clicks button, other user's channels numbers changes in order become same user clicked button on first canvas (this implemented shown below webrtc , pubnub! ). the problem data never exchanged between peers channel never changed. please help!! index.html <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge,chrome=1"> <title>codoodler</title> <meta name="description" content="draw"> <meta name="author" content="tomomi imura @girlie_mac"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" href="css/style.css"> <script src="http://cdn.pubnub.com/pubnub.min.js&qu

php - Change values on a multidimensional array key based with the value in the same key on another array -

i have 2 arrays: $s_array: array ( [0] => array ( [field_1] => s. miguel [field_2] => continente [valor] => 0 ) [1] => array ( [field_1] => s. miguel [field_2] => guarita [valor] => 0 ) [2] => array ( [field_1] => s. miguel [field_2] => manteiga [valor] => 0 ) [3] => array ( [field_1] => s. miguel [field_2] => solmar [valor] => 0 ) [4] => array ( [field_1] => terceira [field_2] => continente [valor] => 0 ) [5] => array ( [field_1] => terceira [field_2] => guarita [valor] => 0 ) [6] => array ( [field_1] => terceira [field_2] => manteiga [valor] => 0 ) [7] => array ( [field_1] => terceira [field_2] => solmar [val

javascript - D3 selection based on text, but needing sibling element -

i'm struggling specific need, think. i'm drawing tree structure, using node config: <g class="node" transform="translate(160.65,400)"> <circle r="10" style="fill: rgb(255,255,255);"></circle> <text y="18" dy=".35em" text-anchor="middle" style="fill-opacity: 1;">data</text> </g> what want select circle based on data text tag. i've been reading subselectors , filters in d3, i'm new , don't quite it. appreciated! thanks you have 2 option select text tag. select parent node class: var texttag = d3.select(".node text").text(); if (texttag == "data") { var circletag = d3.select(".node circle"); console.log(circletag); } else { console.log("not find"); } select tag: var texttag = d3.select("text").text(); if (texttag == "data") { var circletag = d3

mysql - How to make a python package public if it relies on a SQL database I used? -

so data stored in mysql database (on local server). im wondering steps need complete in order make package available other users? github? since package relies on database content, assume public users wouldn't able use package. or they? sorry i'm new this, unsure of procedures. your best best ship package following: fixtures contain data application needs script insert "fixtures" in user of package fixtures there many ways this. how django fixtures simple json files. alternatively can supply "fixtures" sql scripts, model instances, etc. script the purpose of script install fixtures packaged within project in database. read fixture data in whatever format decide store it, loop on , insert in configured database. package you need include additional configurations in setup.py in order package include both fixture files insert script: data files : setup(..., package_data={'mypkg': ['data/*.json']},

cpython - gperftools failing to identify files -

is there way avoid google performance tools listing files "??:?", is, failing locate file contains function reporting on? how can work out library contains function being called? $ env ld_preload="/usr/lib/libprofiler.so.0" \ cpuprofile=output.prof python script.py $ google-pprof --text --files /usr/bin/python output.prof using local file /usr/bin/python. using local file output.prof. removing _l_unlock_13 stack traces. total: 433 samples 362 83.6% 83.6% 362 83.6% dtrsm_ ??:? 58 13.4% 97.0% 58 13.4% dgemm_ ??:? 1 0.2% 97.2% 1 0.2% pydict_getitem /.../objects/dictobject.c 1 0.2% 97.5% 1 0.2% pyparser_addtoken /.../parser/parser.c ... i aiming able profile c code in python package has many compiled c extension modules. in toy example above, track down "dtrsm_" defined? if there multiple loaded libraries contain functions same name, there way tell version being called? c/c++ won't comp

jquery - Use Webstorm to preview the project, always show the following tips, how to fix it? -

use webstorm preview project, show following tips, , jquery not works, open website directly, jquery works, problem? how fix webstorm? thanks tips: uncaught referenceerror: jquery not defined jquery-1.8.2.js:95 image link : http://np.cdnway.com/images/2015/07/13/55a318edb0062.jpg you have add jquery list of libraries project uses, webstorm knows you're using , can use reference. i don't solely link external site, there's on there post in here, i'll point jetbrains blog on topic.

matlab - How to use reshape on a 4D matrix after using fread on a RGB RAW file? -

Image
the following code correctly loads mp4 file , stores in 3d matrix. r = 1; filename = testdummymp4; readerobj = videoreader(filename, 'tag', 'myreader1'); f = get(readerobj, 'numberofframes'); tampon = single(read(readerobj,1)); tampon = imresize(tampon(:,:,1),r); = zeros(size(tampon,1),size(tampon,2),f,'uint8'); k = 1:f disp(['open: ' num2str(round(100*k/f)) '%']) vidframes = single(read(readerobj,k)); i(:,:,k) = imresize(vidframes(:,:,2),r); end; imagesc((i(:,:,1))); this output i'm trying reverse engineer code produces same sort of result .raw 8bit rbg file. following answers this question tried following: you can download 'm1302000245_1436389857.982603.raw' rbg file here or google drive version here ix = 256; iy = 256; sf = 30; % sample frequency recordingtime = 30; iz = sf*recordingtime testdummy = 'm1302000245_1436389857.982603.raw' fin = fopen(testdummy, 'r'); = fread(fi

ios - Thread issue where updating a label make a UIImageview invisible -

i have situation confusing me lots. have class has 2 separate things: animated uiimage , uilabel. have different outlets, not connected. when app runs, this: dispatch_async(dispatch_get_main_queue(), ^{ [self.monstermachine sethidden:no]; //monstermachine uiimageview [self.monstermachine startanimating]; }); but when this: [self.futtext settext:@"blah"]; // uilabel it causes monstermachine uiimageview not animate anymore. things have found: right after settext:@blah" can use nslog watch , see self.monstermachine.isanimated goes 1 0, ie yes no. if self.futtext saying "blah", can run settext:@"blah" on many times want , nothing happens, when change value other blah uiimageview stops animating , disappears if don't use main_queue show , animate monstermachine, won't display @ all, how diagnose or fix this? that's weird works me perfect. did call [self.futtext settext:@"blah"]; in main queue a

.net - Google API Service Account Initialisation -

i working on service should able insert calendar events user calendars various google apps domains using service account. works fine, came across small issue while initialising service using google api. initialisation described in google apis looks this: string[] scopes = new string[] { calendarservice.scope.calendar }; var certificate = new x509certificate2(service_account_pkcs12_file_path, "notasecret", x509keystorageflags.exportable); try { serviceaccountcredential credential = new serviceaccountcredential( new serviceaccountcredential.initializer(service_account_email) { user = user, scopes = scopes }.fromcertificate(certificate)); calendarservice service = new calendarservice(new baseclientservice.initializer() { httpclientinitializer = credential, }); return service;

c# - find an element from a drop down list using webdriver -

i writing simple automated test application, have reach point have write n unit test application. my question want assert value select user default value system, can give me hand please this code : iwebelement dropdownlistbox = _driver.findelement(by.id("ddlworkflow")); dropdownlistbox.click(); assert.areequal(-1, string.compare("cd-a", dropdownlistbox.text, true)); dropdown referred select element in selenium. in order select item list, need use selectelement class of selenium , part of webdriver.support.dll . try below code. selectelement selectelement = new selectelement(_driver.findelement(by.id("ddlworkflow"))); selectelement.selectbytext(dropdown item text); // or can use index selectelement.selectbyindex(dropdown item index); for getting drop down item selected text, need use below. selectelement.selectedoption.text; so final code this. assert.areequal("cd-a", selectelement.selectedoption.text, "dropdow

Ruby on Rails `method_missing': undefined method `active_record' -

i keep having following error message when run rails server on newly created rails project. created running command rails new toy_app . please guide me how can solve problem. have rails project , run rails server . not possible in new project. error message /library/ruby/gems/2.0.0/gems/railties-4.2.2/lib/rails/railtie/configuration.rb:95:in `method_missing': undefined method `active_record' #<rails::application::configuration:0x007f9413116e40> (nomethoderror) /users/judobear/toy_app/config/application.rb:24:in `<class:application>' /users/judobear/toy_app/config/application.rb:10:in `<module:toyapp>' /users/judobear/toy_app/config/application.rb:9:in `<top (required)>' /library/ruby/gems/2.0.0/gems/railties-4.2.2/lib/rails/commands/commands_tasks.rb:78:in `require' /library/ruby/gems/2.0.0/gems/railties-4.2.2/lib/rails/commands/commands_tasks.rb:78:in `block in server' /library/ruby/gems/2.0.0/gems/railties-4.2

Bash Script Help "if (user input) = then (var) =" -

i writing script cherry pick open changes gerrit. found 1 works sort of, though need able change inputs not have script each repo hardcoded specific repo's information. #! /bin/sh remote="${1-review}" ssh -p 29418 user@gerrit.remote.com gerrit query --format=text --patch-sets status:open branch:xxx project:xxx | grep revision: | awk '{print $2;}' | while read id git fetch "${remote}" && git cherry-pick "${id}" done now have been able pick open changes trying make can pass input change username, branch, project , remote. current method need enter username, project, branch, , remote manually script. specific repo. i have been having trouble if / then statements. know looks none of things asking coded, wanted provide working model though. i did change username , particular details, easy enough use script cherry-pick inserting requisite information. if this: project="$1" if [ "$1" = "xx&q

c# - My override of Async signature of GetWebResponse throws a runtime exception when setting property on response -

Image
this related question asked couple weeks ago never got answer on. need override asynchronous signature of system.net.webclient.getwebresponse, set contenttype utf-8. ( https://msdn.microsoft.com/en-us/library/c2xze5ez(v=vs.110).aspx ) i'm able fine synchronous call, asynchronous implementation throws runtime exception if try set same property - though can see property if examine response in debugger. i'm hoping it's dumb i've overlooked. in example below, i've created web reference (yes, old kind - no, can't change service reference right now) tempconvert service found here, , called oldschoolreference.tempconvert: http://www.w3schools.com/webservices/tempconvert.asmx then inherited reference, follows: using system; using system.collections.generic; using system.linq; using system.net; using system.text; using system.threading.tasks; namespace windowsformsapplication1.oldschoolreference { public partial class serviceproxy : tempconvert {

rest - How to tell the client that the data type is unsupported -

writing restful api, i've stumbled on problem. if client post/put data in format not supported api, how should server alert client? e.g.: client posted data in querystring format fielda=foo&fieldb=bar but server accepts json, data should posted this: {"fielda": "foo", "fieldb": "bar"} currently, i'm sending 415 status code (php code): header("http/1.1 415 unsupported media type", true, 415); but doesn't tell client media type api accepts/consumes. besides, enough or the right way fail request? the question is, in restful api, best way tell client data sent server in unsupported media type, , how server tells client supported/expected? ps: i'm writing application in php i'm interested in behavior, not actual implementation. because logic same everywhere, responses in language welcome. first of need distinguish between these 2 types of errors: 400 bad request - not same as

Android studio hangs with no reason -

i have worked on project weeks on android studio few hours ago android studio hangs no abvious reason. restart it, restart pc, did "invalidate caches / restart". search solutions on google no luck specially don't know what's reason. when open android studio open project after few seconds hangs if don't @ all. @user4847410 this idea.log 2015-06-29 17:48:54,801 [ 0] info - #com.intellij.idea.main - ------------------------------------------------------ ide started ------------------------------------------------------ 2015-06-29 17:48:54,856 [ 55] info - #com.intellij.idea.main - ide: android studio (build #ai-141.1980579, 03 jun 2015 00:00) 2015-06-29 17:48:54,856 [ 55] info - #com.intellij.idea.main - os: windows 7 (6.1, amd64) 2015-06-29 17:48:54,856 [ 55] info - #com.intellij.idea.main - jre: 1.8.0_45-b15 (oracle corporation) 2015-06-29 17:48:54,856 [ 55] info - #com.intelli

ios - objective c block that waits for another delegate -

i have watchkit app calls viewcontroller on iphone app. have delegate network connection. i'm trying use block don't tightly couple appdelegate , view controller closely. how can notify block when delegate finished? viewcontroller.m -(void)getwatchdatawithcompletion:(void(^)(bool gotdata))completion{ [self setupappforwatch]; completion(yes); } -(void)finishedmessageparse:(nsmutabledata *)messagedata{ //the delegate finish tell block completion done. } -(void)setupappforwatch{ [network call]; } appdelegate.m -(void)application:(uiapplication *)application handlewatchkitextensionrequest:(nsdictionary *)userinfo reply:(void (^) (nsdictionary *))reply{ [vc getwatchdatawithcompletion:^(bool gotdata){ if (gotdata){ //i'm done reply dictionary reply(@{@"data":serlizeddata}) }]; add new property in viewcontroller: @property (nonatomic, strong) void(^completion)(bool gotdata); -(void)getwatchdatawithcompletion:(

PHP List Directory structure and exclude some directories -

i have php code: $rootpath = '../admin/'; $inner = new recursivedirectoryiterator($rootpath); $fileinfos = new recursiveiteratoriterator($inner); foreach ($fileinfos $pathname => $fileinfo) { $pathname2 = substr($pathname,2); $sql = "select * admin_permissions page_name = '$pathname2'"; $rs = mysql_query($sql,$conn); if (mysql_num_rows($rs) == 0) { if (!$fileinfo->isfile()) continue; $sql2 = "insert admin_permissions (page_name) values ('$pathname2')"; $rs2 = mysql_query($sql2,$conn); echo "$pathname<br>"; } } that displaying directory structure , inserting directories , file names database (removing first 2 characters .. ). since recursivedirectoryiterator iterates through files in directories, how can exclude whole directories, including files within them? in essence, answer not different thomas ' answer. however, not few things correct:

Call C# class from Java class -

i have java class , c# class. want run c# class java class. however don't want pass java code c# , don't want in return c# code, want run c# code. i want shown in below classes java class: public void static main(string[] args){ system.out.println("running java code "); // here need call c# class } } i want code executed above java program using system; class program { console.writeline("running c# code "); } } you can run c# program exe file java code. first compile c#.net program program.exe file run same program.exe java code below: public static void main(string[] args) throws ioexception { // todo code application logic here process process; process = new processbuilder("c:\\projectspath\\program.exe").start(); } edit: you can send parameters exe file invoked passing arguments processbuilder constructor below: note : here im passing 2 argumenbts program.exe file na

matlab - i have 40401 by 57 matrix I need find max value from each row and the corresponding column index of that max value? -

i have 40401 57 matrix need find max value each row , corresponding column index of max value? some 1 please me find answer.. just looking in documentation can find syntax of max find maximum of a on given dimension dim . there example here . m = max(a,[],dim) note second argument empty matrix [] because don't want calculate maximum of entries in a , second argument. feature of max has no relevance here. now need indexes. looking again in documentation find syntax maximum values m , indexes i @ same time. there example here well. [m,i] = max(___) note here ___ means syntax not depend on input values. now can combine following line of code: [m,i] = max(a,[],2) this result when used random data: a = 2 20 6 8 5 13 16 11 10 2 10 20 9 11 14 6 19 5 15 2 17 19 1 11 m = 20 20 19 19 = 2 6 5 4

php - RegEx troubles with converting text to links -

i'm trying make shoutbox automatically convert posted data links if matches criteria. works, except not if there more 1 link in single shoutbox post. here code meant convert it: <? $text = "edit:4961310112967 - edit:021331612649 these correct?"; echo $text."<br><br>"; $view = "/(view|edit)\:[0-9]+(\s)?/"; if(preg_match_all($view, $text, $url, preg_set_order)) { foreach ($url $val) { echo "(matched: " . $val[0] . ")\n"; $checkcode = explode(":", $val[0]); if(strcmp($checkcode[0], 'view') == 0) { $text = preg_replace($view, '<a target="_blank" style="text-decoration: underline;color:purple;font-weight:bold;" href="../index.php?upc='.$checkcode[1].'">(view product)</a>', $

Javascript change input field name in php -

i've got table inside form. table displaying first row form fields. in next field javascripts executes inserts row table. field named qty1 first row, javascripts executes , row added field name should become qty2, etc. in form results page not pulling through qty2 input field value, qty1. doing wrong. not javescript expert. first row: $x = 1; echo '<tr>'; echo '<td><input type="text" name="qty' . $x . ' id="qty" size="6"/></td>'; echo '<td><input onfocus="grndtot()" type="text" name="grandtot1" id="grandtot1" size="10" readonly/></td>'; echo '</tr>'; then function insert row function grndtot() { var table = document.getelementbyid("mytable"); var row = table.insertrow(2); var cell1 = row.insertcell(0); var cell2 = row.insertcell(1); cell1.innerhtml = cell1.innerhtml = <?php

angularjs - Chaining methods with delays in javascript -

i'm attempting make piece of code more efficient. (function() { sc = angular.element('tbody').scope(); sc.draft.resetroster(); sc.$apply(); settimeout(function() { sc.draft.rosteradd({id: "12921", salary: 10600, position: "p"});sc.draft.rosteradd({id: "12123", salary: 2900, position: "c"});sc.draft.rosteradd({id: "5435", salary: 3800, position: "1b"});sc.draft.rosteradd({id: "12562", salary: 2400, position: "2b"});sc.draft.rosteradd({id: "38321", salary: 3100, position: "3b"});sc.draft.rosteradd({id: "6319", salary: 2400, position: "ss"});sc.draft.rosteradd({id: "5204", salary: 3200, position: "of"});sc.draft.rosteradd({id: "5222", salary: 2500, position: "of"});sc.draft.rosteradd({id: "12462", salary: 2600, position: "of"}); }, 3000); settimeout(function() {

python - Selenium: How to Inject/execute a Javascript in to a Page before loading/executing any other scripts of the page? -

i'm using selenium python webdriver in order browse pages. want inject javascript code in pages before other javascript codes loaded , executed. on other hand, need js code executed first js code of page. there way selenium? i googled couple of hours, couldn't find proper answer! if cannot modify page content, may use proxy, or use content script in extension installed in browser. doing within selenium write code injects script 1 of children of existing element, won't able have run before page loaded (when driver's get() call returns.) string name = (string) ((javascriptexecutor) driver).executescript( "(function () { ... })();" ... the documentation leaves unspecified moment @ code start executing. want before dom starts loading guarantee might satisfiable proxy or extension content script route. if can instrument page minimal harness, may detect presence of special url query parameter , load additional content, need using inline sc

Bootstrap 3 - Responsive mp3 audio -

i trying add audio player website should work on both mobile devices , desktops ( responsive ). found link wherein able add mp4 files bootstrap project. bootstrap 3 - responsive mp4-video there similar code in bootstrap add responsive audio files ? not in bootstrap itself, you'll have use external library such these: audiojs or bootstrap3_player

java - Return only if no Exception is thrown -

i'm implementing fixed sized queue in java uses constant size arraylist underlying container, front() method supposed return front element of queue . public t front(){ try{ if(isempty()) throw new exception("queue empty- can't return front element."); return arraylist.get(frontindex); }catch (exception e){ system.out.println(e); } } by coding in above way , want front() return value if no exception thrown ,however expected compiler show me " missing return statement ." , there way can make function return if no exception thrown. since catching exception in code compiler shows missing return statement error. you can implement function : public t front() throws exception { if(isempty()) { throw new exception("queue empty- can't return front element."); } return arraylist.get(frontindex); } and handle exception @ ca

How to detect save as dialog box in IE using Vbscript -

i writing simple vbscript shown below click "save" on save dialog box opens whenever click on download in ie far it's not working set wshshell = wscript.createobject("wscript.shell") wscript.appactivate ("internet explorer") wscript.sleep 10000 wshshell.sendkeys "%s"

jquery interate array and match to values in html table and fill in column -

i want read through array. match employee number table, , fill in bonus value in table on match. <script type="text/javascript" src="jquery.js"></script> <script> $( document ).ready(function() { // note employee may 0,1, or more bonuses myarray = {"employees": [ {"employee": "1231", "bonus":100}, {"employee": "1232", "bonus":200}, {"employee": "1233", "bonus":300} {"employee": "1233", "bonus":33} ] } $.each(myarray.employees, function(index) { console.log(this.employee); // having problem here... $("#mytable:has(td:contains(this.employee)").each(function () { console.log("found"); // write 2nd cell in table next employee# // assume employ

angularjs - UnknownError: unknown error: Element is not clickable at point (713, 6). Other element would receive the click: <div class="container">...</div> -

i getting weird error. in test, first navigate angularjs.org. sendkeys() input field called "javascript projects" has filters in it. after click checkbox , mark todo item done. however, on doing this, error, unknownerror: unknown error: element not clickable @ point (713, 6). other element receive click: ... (session info: chrome=43.0.2357.81) if reverse order of execution above, no error occurs. here code var util = require ('util'); describe ("page object text", function() { var homepage = require('../pages/angularjs_page.js'); ("should mark item done", function() { homepage.get(); browser.sleep(2000); homepage.searchtext('jquery'); homepage.markdonetodo(0); }); }); here page object code: var angularjs_page = function() { this.get = function() { browser.get('http://www.angularjs.org'); }; this.markdonetodo = function(index) { element.all(by.repeater('

Data will not parse and extract into excel file? -

import pandas pd import os import time datetime import datetime path = "c:\\users\s\downloads\h\intraquarter" def key_stats(gather = "total debt/equits (mrq) "): statspath = path + '/_keystats' stock_list = [x[0] x in os.walk(statspath)] df = pd.dataframe(columns = ['date','unix','ticker','de ratio']) each_dir in stock_list[1:25]: each_file = os.listdir(each_dir) ticker = each_dir.split("\\")[-1] if len(each_file) > 0: file in each_file: date_stamp = datetime.strptime(file, '%y%m%d%h%m%s.html') unix_time = time.mktime(date_stamp.timetuple()) full_file_path = each_dir+'/'+file source = open(full_file_path,'r').read() try: value = float(source.split(gather+':</td><td class="yfnc_tabledata1">')[1].split('</td>')[0]) df - df.ap

android - Proguard breaks parameterized constructor injection -

i set test project see how can use roboguice , proguard injected parameterized constructor. this proguard-rules.pro file: -keep class roboguice.** { *; } -keep interface roboguice.** { *; } -dontwarn roboguice.** -keep class org.roboguice.** { *; } -keep interface org.roboguice.** { *; } -dontwarn org.roboguice.** -keepattributes ** -keep class com.example.vladfatu.roboguicetest.application.testmodule -keep class com.google.inject.binder -keep class com.google.inject.module -keep public class com.google.inject.** { *; } # keeps fields , constructors @inject -keepclassmembers,allowobfuscation class * { @com.google.inject.inject <fields>; @com.google.inject.inject <init>(...); } this testmodule: public class testmodule implements module { public testmodule() { super(); } @override public void configure(binder binder) { binder.bind(stateprovider.class).to(roboteststateprovider.class); } } this stateprovider : public interface stateprovider { st

android - Retrofit and Multipart Image Uploading with HTTP 400 -

im start crying, because ive tried many solutions , topics, doesn`t work. the issue: have upload string (it bitmap, have base64 coded) our lovely server, have created background thread in android it, , calling backend. http 400 error message, following message: org.springframework.web.bind.missingservletrequestparameterexception","message":"required multipartfile parameter 'file' not present","path":"/backend/newimage"}. my headers: content-disposition: form-data; name="file" content-type: text/plain; charset=utf-8 content-length: 24069 content-transfer-encoding: binary /9j/4aaqskzjrgabaqaaaqabaad/2wbdaa0jcgsk.......etc.....binary i don`t see in headers following part: enctype: "multipart/form-data”). , don`t understand why, retforit interce looks this: @post("/newimage") @multipart string uploadimagetoidea(@query("id") string id, @part("file") string file ); i d

Where and how to download MySQL source code? -

i want download mysql source code. want install , compile within computer on linux environment. how can that? please me. there few reasons other applying patches or learning's sake. if installing on other personal machine consider using distribution's package manager. the docs these supported platforms : before proceed installation source, check whether oracle produces precompiled binary distribution platform , whether works you. put great deal of effort ensuring our binaries built best possible options optimal performance. verify system satisfies tool requirements listed @ section 2.8, “installing mysql source” . obtain distribution file using instructions in section 2.1.2, “how mysql” . configure, build, , install distribution: exact steps required after installing correct tools , downloading source: . # preconfiguration setup shell> groupadd mysql shell> useradd -r -g mysql mysql # beginning of source-build specific instructions shell>

nservicebus - IWantToRunWhenBusStartsAndStops not for production? -

new nservicebus (4.7.5) , implemented nsb host.exe hosted service (implementing iwanttorunwhenbusstartsandstops) detects changes database tables , notifies subscribing web apps publishing events, e.g. "customerdatawasupdatedevent". in future perform actual update through messagehandlers receiving commands obviously, @ moment publishing service polls database etc. it works well, however, approaching production, noticed david boike, in latest edition of "learning nservicebus", states classes implementing iwanttorunwhenbusstartsandstops development , used in production. set database change detection in start method , works nicely, know why discouraged? here comment in actual book: https://books.google.se/books?id=rvpzbgaaqbaj&pg=pa110&lpg=pa110&dq=nservicebus+iwanttorunwhenbusstartsandstops+in+production+david+boike&source=bl&ots=u6snii0nm3&sig=qixffovfhcy-_3qdnsexrpwrld4&hl=sv&sa=x&ei=lhwrvc2_bkrwywpb65fibw&ved=0cbsq6

asp.net web api - something wrong with wep api route -

my registered routes mapping looks this: config.routes.maphttproute( name: "withactionapi", routetemplate: "api/{controller}/{action}/{id}", defaults: new { id = system.web.http.routeparameter.optional } ); config.routes.maphttproute( name: "defaultapi", routetemplate: "api/{controller}/{id}", defaults: new { id = routeparameter.optional } ); and, controller looks this: // [route("???????????")] [httpget] public httpresponsemessage getpatientproviderdata([fromuri] patientproviderincomingdto ppdto) { var response = request.createresponse(httpstatuscode.ok, _claimdetailservice.getpatientproviderdata(ppdto.patientid, ppdto.facilitygroupid, ppdto.claimid)); return response; } i'm making call this: http://localhost:xxxx/api/claims/getpatientproviderdata?patientid=180&facilitygroupid=9&claimid=21 but, it's not hitting url. expecting hit url , supplied parameters converte

c++ - Using Clang 3.6 with MinGW w64 4.8 -

i've got clang-based project uses mingw (w64). i'm in process of updating clang 3.6. apparently mingw changed abi in 4.7 , clang uses new abi, i'm updating mingw @ same time. however, i'm having slight problem. using clang load libstdc++ headers results in great many compilation errors- particularly stuff constant expressions never being constant. have enabled c++14 , c++1y support. furthermore, i'm unable clang recognize target mingw. seems triple support mingw removed in 3.6 , don't know how communicate clang should emit code compatible mingw abi. how can make clang compatible mingw w64? you can make clang target mingw-w64 via -target , i.e.: $ clang -v 2>&1|grep target target: i386-pc-windows-cygnus $ clang -target i686-w64-mingw32 -v 2>&1|grep target target: i686-w64-windows-gnu simply renaming clang executable i686-w64-mingw32-clang++.exe may want.

java - how to convert arraylist data to string array in android -

here i'm trying latitude , longitude values json url stored in array can view logcat need values arraylist string array can load google map. if 1 know answer let me know pls.... try { **arraylist1.clear();** jsonarray = json.getjsonarray("latlogvalu"); log.d("haaaaaaaaaaaa", ""+json); (int = 0; < jsonarray.length(); i++) { log.d("h11111111111111111111111111", ""+jsonarray.length()); **hashmap<string, string> map = new hashmap<string, string>(); json = jsonarray.getjsonobject(i); map.put("pubname", json.getstring("pubname")); map.put("pubid", json.getstring("pubid")); map.put("lat", json.getstring("lat")); map.put("long", js

C# WPF Xaml: Globally set all text in a view to one color, and all backgrounds to another -

is there way (using data binding or xaml) set background of elements in view 1 color, , text another? i know can edit each element in view 1 one, i'd see if possible settings @ global level. kind of how default set black on white. i guess i'm asking if there feature/setting of wpf application offers i'm looking for, and/or should search find answer online. my project isn't using visual studio offers when create wpf project, can't use prism or mvvm light approach. thanks in advance answer! globally...or xaml... if there feature/setting of wpf application offers i'm looking for in application resource add style this: <style targettype="control"> <setter property="background" value ="blue"/> <setter property="foreground" value ="red"/> </style> <style targettype="textblock"> <setter property="background" value ="blue"

javascript - Understanding Dart 1.11's new appendHTML sanitizing -

i upgraded dart 1.11 , don't quite unterstand what's happening .appendhtml() . have large project using dart , .appendhtml() used quite often. have been working on app on year , nothing works anymore. :/ my console looks this: removing disallowed attribute <div style="width: 100%; text-align: right;"> removing disallowed attribute <div style="height: 2em;"> removing disallowed attribute <div style="height: 0.6em;"> removing disallowed attribute <div style="height: 2em;"> removing disallowed attribute <div style="height: 1em;"> removing disallowed attribute <div style="text-align: justify;"> removing disallowed attribute <div style="height: 1em;"> removing disallowed attribute <div style="height: 0.6em;"> removing disallowed attribute <span style="color: #0d4b63; font-size: 1.6em;"> most of time create elements using new eleme

javascript - In jQuery, show alerts when user try to change tab or change windows -

i want make exam page, , not let user visiting other pages until submits it. it seems onunload , onbeforeunload cases user explicitly close page. wondering if there trigger event when page lose focus. you can use $(window).blur() event that. $(window).blur(function() { console.log("page left"); }); or better page visibility check can find here: https://developer.mozilla.org/en-us/docs/web/guide/user_experience/using_the_page_visibility_api however, when show alert, won't able keep on page. can checkbox alert not show again. notify them test auto submit if leave tab won't want. $(window).blur(function() { if(!confirm("notice leaving page")) { if(!document.hasfocus()) { console.log("user left page"); } } });

R - transform output format of dplyr summarise -

i appreciate using summarise dyplr produce summary statistics. however, not totally convinced "format" of ouput. for example : mt = mtcars %>% group_by(gear, vs) %>% summarise(mean (disp) ) will produce gear vs mean(disp) 1 3 0 357.6167 2 3 1 201.0333 3 4 0 160.0000 4 4 1 115.6200 5 5 0 229.3250 6 5 1 95.1000 for scientific reports, rather prefer display output (whatever statistical meaning of mtcars example) : gear mean vs = 1 mean vs = 0 3 201.0333 357.6167 4 115.6200 160.0000 5 95.1000 229.3250 do know if possible "control" output format of dplyr summarise ? you use spread tidyr extend pipeline. note, assigned name mean referenced within spread call. library(dplyr) library(tidyr) mtcars %>% group_by(gear, vs) %>% summarise(mean_disp = mean (disp) ) %>% spread(vs, mean_disp) source: local data frame [3 x 3] gear

android - a LayoutParams constructor overload with size in dip. Why not? -

in android sdk there isn't overload of constructor of viewgroup (and subclasses) possibilities specify width , height in dp (or dip) instead of in pixel. why? have: viewgroup.layoutparams(int width, int height) could idea have: viewgroup.layoutparams(int dpwidth, int dpheight, int complexunittype.dip) where complexunittype enum units of measurement (for e.g) you can use method complextodimensionpixelsize used in typedvalue class , method accepts value convert pixel , current device metrics, possible implementation : int width = 300; // value converted displaymetrics metrics = getresources().getdisplaymetrics(); int widthinpx = typedvalue.complextodimensionpixelsize(width, metrics);