Posts

Showing posts from April, 2012

android - Toolbar color does not stays the same -

i wanted change toolbar color programmatically, using code: ((appcompatactivity) getactivity()).getsupportactionbar().setbackgrounddrawable(new colordrawable(getresources().getcolor(r.color.test))); i have 2 fragments, , b, suppose if switch a, color changes blue, if switch b, color changes test , again if switch , b, color stays blue! for color changes in both fragments using above code. above code trigger on oncreateview , problem think. how can make listener this, when fragment on screen each time , color changes? use getsupportactionbar().setbackgrounddrawable(new colordrawable(getresources().getcolor(r.color.test))); and getsupportactionbar().setbackgrounddrawable(new colordrawable(getresources().getcolor(r.color.blue))); in activity not in fragments

python - Securing scrapyd's APIs and Web Interface -

i have setup scrapyd manage scrapy spiders in better way , doing fine. doubtful how secure fear gets know scrapyd server can use apis manipulate working of scrapyd. i need 1 external ip able interact scrapyd api, no other system should able it. how secure server not can interact it? i not find on google. sorry if foolish question, failed figure out. thanks. that's not scrapyd problem, that's server management problem. need close scrapyd port on server outside ips except own.

android - How to detect the song on Spotify without enable device broadcast? -

we can detect current track info when device broadcast enabled in spotify.i know whether possible track info without enable device broadcast in android ? use notification access track details

What is the most efficient way to find amicable numbers in python? -

i've written code in python calculate sum of amicable numbers below 10000: def amicable(a, b): total = 0 result = 0 in range(1, a): if % == 0: total += j in range(1, b): if b % j == 0: result += j if total == b , result == a: return true return false sum_of_amicables = 0 m in range (1, 10001): n in range (1, 10001): if amicable(m, n) == true , m != n: sum_of_amicables = sum_of_amicables + m + n code running more 20 minutes in python 2.7.11. ok? how can improve it? optimized o(n) def sum_factors(n): result = [] in xrange(1, int(n**0.5) + 1): if n % == 0: result.extend([i, n//i]) return sum(set(result)-set([n])) def amicable_pair(number): result = [] x in xrange(1,number+1): y = sum_factors(x) if sum_factors(y) == x , x != y: result.append(tuple(sorted((x,y)))) return set(result) run it start = time.time(

jvm arguments - How to broken jvm parameter count limit? -

my project use thrift service can't allow generate more 254 apis. compile error: platform restriction: parameter list's length cannot exceed 254. it seems jvm not allow on 254 parameter. how broken limit ? thanks

java - Spring MVC how to handle Joda Data Types as JSON -

i'm starting new spring mvc project. i'm using jpa entities mapping. had entity name account datetime field annotated followed: @entity public class account implements serializable{ @id @generatedvalue private long id; @temporal(temporaltype.timestamp) private date openintime; .......... } and entity client date field followed @entity public class client { @id @generatedvalue private long id; private string firstname; private string lastname; @temporal(temporaltype.date) private date birthdate; } in spring-mvc controller, find account id , return followed @requestmapping(value = "/find", method = requestmethod.get, produces = "application/json") public responseentity<?> findaccountbyid(@requestparam("accountid") long accountid) { account accountfound = accountservice.findbyid(accountid); responseentity<account> responseentity = new responseentity<account>(

To access the list object of outer class in the inner class in python -

class policy(object): def __init__(self,name): global policies_list self.policy_1_list=[] self.id=name policies_list.append(self) class policy_1: def __init__(self): policy_1_list.append(self) how use policy_1_list list object of outer class policy in constructor of inner class policy_1? how refer outer class element?

Filter by user property doesn't work in Firebase Analytics -

Image
in order test how filter user property works , i've did bellow test : 1 . i've run bellow code, set user property favorite_food pizza . , send event called test_audience_event2 . should associate property event . right ? firanalytics.setuserpropertystring("pizza", forname: "favorite_food2") firanalytics.logeventwithname("test_audience_event2", parameters: nil) after 24 hours, succeed see test_audience_event2 can see in bellow picture: 2 . i've set filter = userproperty.favorite_food2.pizza , got nothing can see in bellow picture. why ? thanks. audiences have 10 users threshold before showing data, maybe filtering have 10 users threshold ? have try launching on 10 different device, or install-launch-uninstall-reinstall etc 10 times on 1 devices ?

sql - Oracle DB quote column names -

when using regular tables, fine use following oracle sql query: select max(some_primary_key) mytable however, when using database objects (i.e. table of object), yields following error: ora-00904: "some_primary_key": invalid identifier when quoting column name, this: select max("some_primary_key") mytable this works expected. why necessary escape column names when working objects, not tables? it doesn't have objects or tables, has how these objects/tables have been created. if create table "blabla" need address table "blabla", if create table blabla can address table via blabla or blabla or blabla. using " " makes name case sensitive , reason why developers don't use " " because don't want case sensitive names .

JavaScript parseInt on hover? -

i have simple multiplier function addfive() { document.getelementbyid("amount").value = parseint(document.getelementbyid("amount").value) +5; } <span id="5" onclick="addfive()">+5</span> i function when mouseover prints selected area, instead of clicking. i've tried replacing onclick mouseover without luck. is possible javascript, i'm looking for? rather including javascript event listener inline, might try deploying javascript unobtrusively instead. the unobtrusive javascript approach separates more cleanly structure of document , behaviour of document. <span id="span5">+5</span> <script> var span5 = document.getelementbyid('span5'); var amount = document.getelementbyid('amount'); function addfive() { amount.value += 5; } span5.addeventlistener('mouseover',addfive,false); </script>

Tint Android vector menu icons through XML -

i've read answers , blog posts explaining vectordrawables in android , how can used instead of png files of different pixel densities. i've seen there android:tint xml attribute can used on imagebutton s , similar view s, want able apply tint vector icons use menu items, unable use android:tint on menu items. one blog post explained tinted drawables can created so: <?xml version="1.0" encoding="utf-8"?> <bitmap xmlns:android="http://schemas.android.com/apk/res/android" android:src="@drawable/ic_action_something" android:tint="@color/color_action_icons_tint"/> where xml file above tinted drawable, referenced drawable through src original vector (black), , tint colour icon tinted to. however, above did not work me, giving me following error: android.content.res.resources$notfoundexception: file res/drawable/ic_chevron_left_white_24dp.xml drawable resource id #0x7f02007e @ android.co

android - socket(AF_INET, SOCK_DGRAM, 0) Fail return -1 -

in android m, compiled daemon , driver communication, program has use struct sockaddr_in addr; char buffer[1024]; mcsocket_t *mcs = (mcsocket_t *)data; /* initialize socket */ mcs->sock = socket(pf_inet, sock_dgram, 0); if(mcs->sock < 0) { //loge("%s: error on socket(): %d", __func__, mcs->sock); loge("%s: error on socket(): %d = %s", __func__, errno, strerror(errno)); goto exitcommandthread; } bzero(&addr, sizeof(addr)); addr.sin_family = af_inet; addr.sin_port = htons(mcs->port); addr.sin_addr.s_addr = inaddr_any; /* bind address , port */ if (0 != bind(mcs->sock, (struct sockaddr*)&addr, sizeof(addr))) { loge("%s: error on bind(): %d = %s", __func__, errno, strerror(errno)); running = 0; } but executed /system/bin/daemon ,socket(pf_inet, sock_dgram, 0); returns mcs->sock=-1,print:error on socket(): 13 = permission denied

swift3 - Are Doubles Comparable in Swift -

swift 3, xcode 8β2. i've implemented class sorts comparable data , attempted test using doubles. unfortunately, i'm getting error "cannot convert value of type '[double]' specified type '[t]'." . i've reproduced error in sample code below: class foo<t: comparable> { let data: [t] = [double]() } am right assuming doubles comparable and, if so, how eliminate error above? thx. your property has generic type, t : can't declared holding concrete type. use [t] in declaration, , use double when instantiating class. for example i've made property var modify it: class foo<t: comparable> { var data: [t] = [t]() } let f = foo<double>() f.data = [42.0, 33.0] f.data.sort() print(f.data) gives [33.0, 42.0] as expected.

http - Extract TCP payload from pcap file -

using tcpdump , capturing network traffic. interested in extracting actual tcp payload data, i.e. http traffic in particular case. i tried achieve using scapy , found function remove_payload() . there corresponding counterpart? or know of other tools provide such functionality? unfortunately, did not find satisfactory scapy documentation. you can read pcap scapy rdpcap , can use raw (right above tcp) layer of packets play http content: from scapy.all import * pcap = rdpcap("my_file.pcap") pkt in pcap: if raw in pkt: print pkt[raw]

python - Newlines removed in POST request body? (Google App Engine) -

i building rest api on google app engine (not using endpoints) allow users upload csv or tab-delimited file , search potential duplicates. since it's api, cannot use <form> s or blobstore's upload_url . cannot rely on having single web client call api. instead, ideally, users send file in body of request. my problem is, when try read content of tab-delimited file, find newline characters have been removed, there no way of splitting content rows. if check content of file directly on python interpreter, see tabs , newlines there (output truncated in example) >>> open('./data/occ_sample.txt') o: ... o.read() ... 'id\ttype\tmodified\tlanguage\trights\n123456\tphysicalobject\t2015-11-11 11:50:59.0\ten\thttp://creativecommons.org/licenses/by-nc/3.0\n...' the requesthandler logs content of request body: import logging class reportapi(webapp2.requesthandler): def post(self): logging.info(self.request.body) ... so

mysql - Change characters in sql file -

Image
i have questions mysql , characters on .sql files . i picked module accounting software (dolibarr if people know it) , problem .sql file . this file looks : i character instead of getting french accent character "é" "è" "ô" etc ... my question : i assume it's character set problem. it's unicode , need utf-8 ? if it's truth, how can change ? because in file, there's not define : default character set utf8 default collate utf8_general_ci; and don't know how .sql file called mysql database, it's maybe database problem ? :/ thank answers, , script if me :) just open file in editor capable of reading encoding have in file , save file in desired encoding.

javascript - gulp-ruby-sass Error: must provide pattern -

Image
this directory structure: i set workstation, , set gulp file work on folder format, not working properly. this gulp file: var gulp = require('gulp'), sass = require('gulp-ruby-sass'), imagemin = require('gulp-imagemin'), changed = require('gulp-changed'), browsersync = require('browser-sync'), livereload = require('gulp-livereload'), gp_concat = require('gulp-concat'), gp_rename = require('gulp-rename'), gp_uglify = require('gulp-uglify'), watch = require('gulp-watch'); gulp.task('sass', function () { gulp.src('./app/template/css/style_v1.scss') .pipe(sass()) .on('error', function (err) { console.log(err.message); }) .pipe(gulp.dest('./dist/css')) .pipe(livereload()); }); gulp.task('compress', function() { gulp.src('./app/*.js') .pipe(gp_concat('concat.js')

c++ - constructing enum with underlying "bool" type from a boolean? -

if define enum so: enum foo : bool { left = false, right = true }; then try construct 1 boolean so: int main (int ac, const char **av) { foo foo ( ac > 1 ); cout << boolalpha << bool(foo) << endl; return 0; } it fails, works constructor so: foo foo ( foo( ac > 1 ) ); why this? thought foo foo (...) was explicit constructor call? i don't think can this: foo foo ( ac > 1 ); suppose define foo enum as: enum foo : bool { left = false }; what happen if called: foo foo(true); you don't have appropriate enum value want initialize with.

scala - Hdfs Snappy corrupted data. Could not decompress data. Input is invalid. When does this occur and can it be prevented? -

i writing data hdfs following code: def createorappendhadoopsnappy(path: path, hdfs: filesystem): compressionoutputstream = { val compressioncodecfactory = new compressioncodecfactory(hdfs.getconf) val snappycodec = compressioncodecfactory.getcodecbyclassname(classof[org.apache.hadoop.io.compress.snappycodec].getname) snappycodec.createoutputstream(createorappend(path, hdfs)) } def createorappend(path: path, hdfs: filesystem): fsdataoutputstream = { if (hdfs.exists(path)) { hdfs.append(path) } else { hdfs.create(path) } } and code calling function roughly: ... val outputstream = new bufferedoutputstream(hdfsutils.createorappendhadoopsnappy(filepath, filesystem)) ... for(managedoutputstream <- managed(outputstream)) { ioutils.writelines(lines.asjavacollection, "\n", managedoutputstream, "utf-8") } ... now @ 1 point have had few files corrupted following message when read them 'hadoop fs -text': java.lang.internalerror: no

Pulling all data from SQLite table column using C# iteration -

i've written sql query using stringbuilder , send off database using sqltedatareader seen below: string criteria = string.format("select tile_id {0} zoom_level = 14", dbtable); sqlitecommand command = new sqlitecommand(criteria, dbconn); sqlitedatareader reader = command.executereader(); while (reader.read()) { console.writeline("starting reader: \n"); foreach (var in reader) { console.writeline(i); } } ismet = true; } catch (exception e ) { console.write(e.stacktrace); } dbtable == map . i've ran above sql query through sqlite browser , it's pulled correct information. the returned value system.data.common.datarecordinternal , after googling arou

r - ggplot2: Degree Celsius Symbol in labeller with dev="tikz" option in knitr -

Image
i want put degree celsius symbol in ggplot2 labeller .mwe given below output: library(ggplot2) ggplot(data=mtcars, mapping = aes(x=drat, y=mpg)) + geom_point() + facet_wrap(facets = ~cyl, labeller = as_labeller(c(`4` = "4 °c",`6` = "6 °c", `8` = "8 °c"))) however same strategy not work when dev="tikz" option used in knitr . figure out problem highly appreciated. thanks it looks 1 option when working tikz device write math in native latex. \circ degree symbol, 1 of labels "$4^\\circ{c}$" . the following knits pdf dev = "tikz" , shows degree symbol: ggplot(data=mtcars, mapping = aes(x=drat, y=mpg)) + geom_point() + facet_wrap(facets = ~cyl, labeller = as_labeller(function(string) paste0("$", string, "^\\circ{c}$"))) to add more spacing between number , degree symbol can include \\: or \\; in label. labeller = as_labeller(function(string) paste0("$", st

css - Achieve alternate row colours across multiple tbody elements -

is there way in css achieve alternate row shading rows across multiple tbody elements treated 1 group? so example: <tbody> <tr>...</tr> </tbody> <tbody> <tr>...</tr> </tbody> <tbody> <tr>...</tr> </tbody> i know of nth-child, not work here, since if each tbody has 1 row, coloured same. anyone know of ways achieve behaviour? not css...no. nth-of- doesn't work way. need javascript. jquery makes easy. $("#my-table tr:even").css("background-color", "#bbbbff"); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <table id="my-table"> <tbody> <tr> <td>row 1</td> </tr> </tbody> <tbody> <tr> <td>row 2</td> </tr> </tbody> <tbody> <tr>

parse.com - Logical issue of how to get if the user has liked an image swift 2 -

i'm trying make simple photograph app tables in parse.com table users id name email table follows id follower (pointer user) followed (pointer user) table images id image (file) uploader (pointer user) table likes id likedimage (pointer images) wholikedit (pointer user) so have logic. if user1 likes image of user2 there row inserted in table likes. till now. but if user1 closes app , opens again, show red heart (exactly in instagram) image cell if liked it. the problem if query inside cellforitematindexpath see if currentuser , id of images matches somewhere @ table likes not ux because if has 100 images slow, eventually. so question is, there smart way make query , change image of cell instantly ??? i've thought when app opens (and user logged in) can make general query @ table likes , search currentuser id @ column wholikedit , make array id's of images column likedimage . inside cellforitematindexpath i can check if

javascript - Pushing data to (nested) array, depending on existing object field -

i'm pushing data array within foreach-loop: let result = []; data.foreach(function(part){ let text = part.one + part.two; result.push({ text: text, element: [{ id: part._id, page: part.page }] }); }); but need check if text in object of array. if there such object, page part.page should added array of object identical text field. otherwise data should added result array. example result = [ { text: 'some text', element: [{ id: 1, page: '12-34'}] } ] if next part -elements this: { id: 2, one: 'some ', two: 'text', page: '45-67' } { id: 3, one: 'another ', two: 'text', page: '12-34' } result should get result = [ { text: 'some text', pages: [{ id: 1, page: '12-34'}, { id: 2, page: '45-67' }] // page added array, text identical }, { text: 'another text', pages: [{ id:

Retrieving data in php -

i've created page i've place updating attachment. while doing so, if file same name, size, extension attached, attachment table need not updated. scenario. how tried do: else if($mode == "attachment_update") { $id = intval(mysqli_real_escape_string($mysqli, $_request["_id"])); $upload_directory = "upload/attachment/"; $result = file_upload("attachment", "../".$upload_directory); $file_name = '".addslashes($result[file_name])."'; write_log($file_name); $file_extension = '".$result[file_extension]."'; write_log($file_extension); $file_size = '".$result[file_size]."'; write_log($file_size); $uploaded_file_name = '".$result[uploaded_file_name]."'; write_log($uploaded_file_name); $uploaded_file_path = '".$upload_directory.$result[uploaded_file_name].&

populating jtable with sql server database -

public inventoryjframe() throws classnotfoundexception { try { initcomponents(); class.forname("com.microsoft.sqlserver.jdbc.sqlserverdriver" ); stringstringcon="jdbc:sqlserver://aayanpc;databasename=qseal;user=sa;password=123"; connection con=drivermanager.getconnection(stringcon); statement state=con.createstatement(); resultset rs=state.executequery("select * qseal"); resultsetmetadata rsmetadata=rs.getmetadata(); int columns=rsmetadata.getcolumncount(); defaulttablemode1 dtm=new defaulttablemode1(); } catch (sqlexception ex) { logger.getlogger(inventoryjframe.class.getname()).log(level.severe, null, ex); } } i error in line defaulttablemode1 dtm=new defaulttablemode1(); . error "cannot find symbol" , in hint says create pachkage defaulttablename in source pack according what “cannot find symbol” compilation error mean? a &q

R network package - is there a faster way to add edges? -

i have adjacency matrix (m) of 7000 nodes. creating network using n <- 7000 m <- matrix(rbinom(3*n, 1, 0.2), n,n) diag(m) <- 0 g <- network(m, directed = f) is slow. there more efficient way of creating large random networks in r? alternative methods such using igraph appreciated. with igraph, can do: library('igraph') g <- graph.adjacency(m, mode='undirected') the edges can retrieved using e(g) , vertices using v(g) . check out igraph docs more information.

c# - Can I use an external file for system.web config similar to file attribute for appSettings -

i hoping separate identity config in system.web section of web.config , put in separate file don't have check in source control username/password being used. is possible? looks file attribute doesn't work system.web section , if configsource attribute work, wouldn't want have of system.web config section in different file. can help? thanks! a bit more research has revealed while can't use configsource or file attributes on <system.web> section, can use on tags within it. for example, wanted move our globalization settings out of web.config globalization.config , , changed our web config this: <system.web> <globalization requestencoding="utf-8" responseencoding="utf-8" culture="auto" uiculture="auto" /> <!-- other settings removed --> </system.web> to this <system.web> <globalization configsource="globalization.config" /> <!-- oth

java - Disabling textfields on button click and simultaniously enabling another button -

this question has answer here: how disable android button? 9 answers i have: my textfields textinput & textinput2 , btnclickme disabled & button2 enabled when click on button bevestig weddenschap . i cannot figure out how this. can me out? xml code: <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/details_frankrijk" android:textsize="17sp" android:id="@+id/tvdetails" android:layout_alignparentleft="true" android:layout_alignparentstart="true" /> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:textappearance="?android:attr/textappearancemedium" android:text="@string/positie" android:id=

c++ - Stack overflow when trying to implement lock-free queue -

implemented lock-free queue based on algorithm specified in maged m. michael , michael l. scott work simple, fast, , practical non-blocking , blocking concurrent queue algorithms (for algorithm, jump page 4) i used atomic operation on shared_ptr such std::atomic_load_explicit etc. when using queue in 1 thread only, fine, when using different thread, stack overflow exception. i not trace source of problem unfortunately. seems when 1 shared_ptr getting out of scope, decrements number of references on next concurrentqueuenode , causes infinite recursion, can't see why.. the code: the queue node: template<class t> struct concurrentqueuenode { t m_data; std::shared_ptr<concurrentqueuenode> m_next; template<class ... args> concurrentqueuenode(args&& ... args) : m_data(std::forward<args>(args)...) {} std::shared_ptr<concurrentqueuenode>& getnext() { return m_next; } t getvalue()

azure - Why can I not see my output dataset in PowerBI? -

Image
hi i've tried setup stream analytic in azure exports data powerbi. i've followed following tutorial feed power bi application insights . my input has been set , received notification passed connection test. same can said output. query shown below it's pretty simple. select category, count(*) [*outputname*] //the name here matches name of output [*inputname*] //the name here matches name of input group category, tumblingwindow(day, 1) when running job set job start @ '07/07/2016 01:00:00 pm' expecting run query against aggregate version of data below (as set tumble window day). seems run, , don't errors notification running. when check dataset in powerbi workspace, hasn't been created. can see no errors in audit logs either.

java - BottomSheet Library -

i trying implement bottomsheet library located here. have followed instruction application getting crashed when try open bottosheet menu. my java code implement bottomsheet below findviewbyid(r.id.butshare).setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { new bottomsheet.builder(quoteviewactivity.this).title("title").sheet(r.menu.menu).listener(new dialoginterface.onclicklistener() { @override public void onclick(dialoginterface dialog, int which) { switch (which) { case r.id.help: //q.toast("help me!"); break; } } }).show(); } }); and menu xml below <menu xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@+id/share" android:title="@string

javascript - Selected value of auto filled dorp down list is not going to JS page using Ajax / jQuery -

country drop down list displayed database table using php & mysql. based on selected country, state drop down list auto filled. on js page, tried alert country , state selected country displayed fine displays first state list no matter whatever state selected on form page. html form page <form name="frm_edit" id="frm_edit" novalidate> <div class="control-group form-group"> <div class="controls"> <label>country:</label> <select name="cbo_country" id="cbo_country" onchange="selectstate();"> # countries displayed here db <options> using php , mysql. </select> </div> </div> <div class="control-group form-group"> <div class="controls"> <label>state:</label> <s

elf - Get the address that caused segmentation fault from core dump using C -

i trying write c program can parse core dump files. question is, how can address caused core dump in c? know 1 can address using gdb answer: how can gdb tell me address caused segfault? but directly retrieve address in c. information highly appreciated. thanks! notice: know how parse core dump elf. don't know how address caused segfault. my question is, how can address caused core dump in c? short answer: there 2 ways interpret question. what address of faulting instruction? what address out of bounds? elf core dumps keep of meta information in notes, stored in note segment. notes of different types. to answer #1, need grab registers. @ elf header find program header table. walk program header table find note table (type pt_note). walk note table find note of type nt_prstatus. payload of note struct elf_prstatus , can found in linux/elfcore.h. 1 of fields of struct of general purpose registers. grab %rip , done. for #2, similar. time lo

vb.net - How to get column ("id") value from datagridview with visual basic .net -

i have datagridview displays data database. on every row have added button text value "approve". when user clicks on button, want approved column on database changed 0 1. question how know button on row clicked. like, "update request set approved=1 id=???" . , don't want show auto increment id column on datagridview user. this should give general idea. uses sqlite can sub db. used generic index column name dgv. can leave out confirmation dialog, too, of course. private sub mydgv_cellcontentclick(sender object, e datagridviewcelleventargs) handles mydgv.cellcontentclick if typeof directcast(sender, datagridview).columns(e.columnindex) datagridviewbuttoncolumn andalso e.rowindex >= 0 select case e.columnindex case mydgv.columns("approvebutton_col_name").index dim dr dialogresult = messagebox.show("are sure want approve this?", "confirm approval", messageboxbuttons.yesno, messa

php - Returning and Echoing multiple variables -

i've written following php script intended echo 3 variables captured in constructor book within class book . i'd php echo 3 variables. however, @ moment echoes 1 of three. here code: <?php class book { protected $title; protected $author; protected $yearpublished; function book($title, $author, $yearpublished) { $this->title=$title; $this->author=$author; $this->yearpublished=$yearpublished; } function summary() { return $this->title; return $this->author; return $this->yearpublished; sprintf($this->title, $this->author, $this->yearpublished); } } $test= new book("pride , prejudice","john doe","2016"); $test->summary(); echo $test->summary(); you have change function to function summary(){ return $this->t

spring mvc - HttpMediaTypeNotAcceptableException: Could not find acceptable representation. When with special url -

@requestmapping(value = "/servers/{domain}", method = requestmethod.get) public server getmailserver(@pathvariable("domain") string domain) server server = null; try { server = getserverbydomain(domain); } catch(exception e){ } return server; } when call " http://localhost:8080/server/hotmail.com " httpclient method,the value of variable domain "hotmail", not "hotmail.com".and got error: httpmediatypenotacceptableexception: not find acceptable representation. but if call " http://localhost:8080/server/hotmail ", works well. i hope can see causing issue. this might same issue had (and guy: https://stick2code.blogspot.co.at/2014/03/solved-orgspringframeworkwebhttpmediaty.html ) my service offers operations on files, i.e., /files/check/foo.txt i got httpmediatypenotacceptableexception , rest handler never called. the problem is, spring has feature tri

c# - Open the Outlook meeting window with a button -

Image
i got windows form button (c#). button should open outlook meeting window looks this: the button has open window user can create meeting. can me ? you can use winforms application button , execute code on button click: microsoft.office.interop.outlook.application outlookapplication = new microsoft.office.interop.outlook.application(); ; microsoft.office.interop.outlook.appointmentitem appointmentitem = (microsoft.office.interop.outlook.appointmentitem)outlookapplication.createitem(microsoft.office.interop.outlook.olitemtype.olappointmentitem); appointmentitem.subject = "meeting subject"; appointmentitem.body = "the body of meeting"; appointmentitem.location = "room #1"; appointmentitem.start = datetime.now; appointmentitem.recipients.add("test@test.com"); appointmentitem.end = datetime.now.addhours(1); appointmentitem.reminderset = true; appointmentitem.reminderminutesbeforestart = 15; appointmentitem.importance = microsoft.o

is there a more efficient way to filter regex match string? -

var s = '/home/src/_layouts/default.pug';// wanna '_layouts/default' var regex = /(src\/.*)/; var m = s.match(regex); var t = m[0].match(/([^(src\/)].*)(?=\..*$)/)[0]; console.log(t);// outputs "_layouts/default" it works no elegant enough, wanna more efficient, can me? thanks. the regex you're after /src\/([^.]*)\..+/ . it'll match src , capture before dot. [^.] negated character class ("match except these characters"), meaning it'll filename , not extension.

javascript - TinyMCE editor doesn't initialize -

i'm building simple cms in ruby on rails , decided use wysiwyg editor syntax highlighting, chose tinymce. though, while trying use it, stuck couple of issues: the first issue had error while trying run test blog cms. first included s.add_dependency "tinymce-rails" into mycms.gemspec , ran $ bundle install then added //= require tinymce line application.js in cms. when included cms plugin (which comes separate gem) test blog, couldn't reach admin panel because of error -- rails couldn't find tinymce , need include gem tinymce-rails in test app's gemfile work. (the same issue i've got gem bootstrap-sass -- after including app's gemfile worked, though present in mycms.gemspec the second issue editor doesn't initialize , not displayed in page. so, here comes form itself: <%= form_for (@entry, as: :entry, url: entries_path) |f| %> <p> <%= f.label :title %> <br/> <%= f.text_field :title %

javascript - I want to have a dropdown menu where you choose the number instead of the variable -

the "var aantal = 10" gives me 10 traingles user insert own amount of triangles. var aantal = 10; var triangle = []; (var = 0; < aantal; i++){ triangle[i] = new triangle; triangle[i].xleft = 20 + 30*i; triangle[i].yleft = 20 + 20*i; } a quick , easy way ask user input in browser via window.prompt method. this stops code until user presses "ok" or "cancel" in popup window. when user fills in value , presses "ok", value returned string . here's example: var userinput = prompt("how many triangles want?", 10); var count = parseint(userinput, 10); (var = 0; < count; += 1) { console.log("triangle " + i); } note need explicitly convert string number . additionally, might want check null or nan : when user presses "cancel" or fills in invalid data, you'll need have fallback. once works, might want try create &

SQL Server messes views code formatting on save -

every time save view on sql server such as: select column1 , column2 table1 column3 in ( select top(1) column4 table2 inner join table3 on table2.column1 = table3.column1 ) sql server removes indenting, line breaks , tabs , creates block such one: select column1 , column2 table1 column3 in (select top(1) column4 table2 inner join table3 on table2.column1 = table3.column1) this ok small queries, makes long ones totaly unreadable. know default behavior sql server haven't been able find setting change formatting or disable altogether. there way make sql not change code format upon saving? i use scripts instead of designer. either create view or alter view , formatting preserved. in ssms can right click view-> script view as-> alter -> new query window

ansible - Running playbooks automatically -

i learning ansible , hard time figuring out, how configure ansible run playbooks on own after interval. ? puppet does. ansible works in different way compared puppet. puppet pulls configuration changes central place , applies changes on remote host asked it. ansible design works different. push changes (from control machine has ssh access remote hosts - own computer) remote hosts. you can make ansible work in pull mode it's not how ansible designed used. you can see answer more information: can't run ansible in daemon-mode if host automatically run playbooks on (localhost) use ansible-pull script + crontab.

How to show the result of a subreport only when a column value in the master report changes -

Image
i want show result of subreport when column value in master report changes in picture above first 2 rows have same values (test) "name" column. in third row "name" column have fedex value name column value changing here want show subreport result. when "name" column value changes fedex ups again subreport result should shown. in report designer, can add group. group expression should $f{name} field. then, if needed, can add group header , / or group footer. everything should in place this. also, should check comment alexk on other question: did read data grouping ?

android - Remove just last instance of an activity from stack -

i have application 2 activities , b, main activity , b called can called b itself. so stack like a,b0,b1,b2,b3 in cases want able remove last instance of b, [android:nohistory="true"] won't work. a,b0,b1,b2,b3 => a,b0,b1,b2,b4 how can accomplish this? the below lines finish activity in working , start same activity: finish(); startactivity(getintent());

jquery - I have to change the background of div of previously checked radio buttons? But i am getting problems -

i getting problem in changing css of div of checked radio buttons. jquery code on load page: var check = jquery('input:radio').is(':checked'); if (check == true) { //jquery('input:radio').closest('.swatch').find('div.new').removeclass('new'); jquery('.swatch-element').addclass('new'); } else { jquery('.swatch-element').removeclass('new'); } my list structure: <div data-option-index="0" class="swatch clearfix swatch-0"> <div class="header">weight</div> <div class="swatch-element 1-pound available new" data-value="1 pound"> <input type="radio" checked="" value="1 pound" name="option-0" id="swatch-0-1-pound"> <label for="swatch-0-1-pound"> 1 pound <img src="//cdn.shopi