Posts

Showing posts from May, 2012

plot - Overlapping graphs in matlab -

i drawing several graphs in same plot in matlab using command, hold on. problem drawing points big markersize on top of of graphs, , theses points have specific color. happens of them take color , others take color, guess colors of points mixed colors of graphs on top of put them. there mean ask matlap overwrite whatever under points color assign them? example: x= 0:1:10; plot(x,x,'r',x,-x,'b','linewidth',2) hold on plot(5,-5,'.',10,10,'.','markercolor',[0,0.5,0],'markersize',24) hold on plot(5,5,'.',10,-10,'.','markerfacecolor',[0,0.75,0],'markersize', 24) imagine curves more complicated theses simple lines no way start having fun cutting them each time want represent point... problem points 5,-5 , 10,10 have same color. namely 0 0.5 0 dark green. color mixed depending on line lie. if specify color '.g' don't problem, problem got many points covered few number of colors lab...

c# - Client not receiving message in time (TcpClient) -

i have 2 applications "talk" each other tcp, problem when send something, application doesn't receives @ same time, when requests second time, 'he' receives duplicated. example: client request connection (income string: 00200001 0050 ); server accept connection(acknowledge) (output string: 00570002 ); the client doesn't receives acknowledge, when requests connection again, receives output string of: 00570002 00570002 (duplicated). this happens in application connects mine. private int listenerport = 4545; private tcplistener listener; private tcpclient socket; public communicator() { try { this.listener = new tcplistener(ipaddress.parse("127.0.0.1"), listenerport); listenerport++; listener.start(); this.connecttopendingrequest(); } ca...

pandas - Python apply a func to two lists of lists, store the result in a Dataframe -

to simplify problem, have 2 lists of lists , function shown below: op = [[1,2,3],[6,2,7,4],[4,1],[8,2,6,3,1],[6,2,3,1,5], [3,1],[3,2,5,4]] ap = [[2,4], [2,3,1]] def f(lista, listb): return len(lista+listb) # real f returns number i want f(op[i],ap[j]) each i, j , idea create pandas.dataframe looks this: ap[0] ap[1] op[0] f(ap[0],op[0]) f(ap[1],op[0]) op[1] f(ap[0],op[1]) f(ap[1],op[1]) op[2] f(ap[0],op[2]) f(ap[1],op[2]) op[3] f(ap[0],op[3]) f(ap[1],op[3]) op[4] f(ap[0],op[4]) f(ap[1],op[4]) op[5] f(ap[0],op[5]) f(ap[1],op[5]) op[6] f(ap[0],op[6]) f(ap[1],op[6]) my real data has around 80,000 lists in op , 20 lists in ap, , function f little bit time consuming, computational cost should worried. my idea achieve goal constructing pandas.series of length len(ap) for each op , , append series final dataframe . example, op[0] , first create series have information f(op[0],ap[i]) each i . i stuck constructing series . trie...

java - How to get the Hibernate SessionFactory from org.springframework.orm.hibernate4.LocalSessionFactoryBean? -

i migrating 1 old legacy application spring. in data access layer of current legacy code, there 1 basedataaccessor. data accessor provide reference of sessionfactory through 1 method. meet delivery date, have keep structure same, , need reference of hibernate sessionfactory in basedataaccessor. i able reference of org.springframework.orm.hibernate4.localsessionfactorybean implementing applicationcontextaware, unable convert sessionfactory. there way this? thanks the localsessionfactorybean creates sessionfactory : @bean public localsessionfactorybean sessionfactory() { localsessionfactorybean sessionfactory = new localsessionfactorybean(); sessionfactory.setdatasource(datasource()); sessionfactory.setpackagestoscan(new string[] { "my.packages" }); sessionfactory.sethibernateproperties(hibernateproperties()); return sessionfactory; } then can inject sessionfactory his: @autowired sessionfactory sessionfactory; check this article d...

java - Regex search taking increasingly long time -

my regex taking increasingly long match (about 30 seconds 5th time) needs applied around 500 rounds of matches. suspect catastrophic backtracking. please help! how can optimize regex: string regex = "<tr bgcolor=\"ffffff\">\\s*?<td width=\"20%\"><b>((?:.|\\s)+?): *?</b></td>\\s*?<td width=\"80%\">((?:.|\\s)*?)(?=(?:</td>\\s*?</tr>\\s*?<tr bgcolor=\"ffffff\">)|(?:</td>\\s*?</tr>\\s*?</table>\\s*?<b>tags</b>))"; edit: since not clear(my bad): trying take html formatted document , reformat extracting 2 search groups , adding formating afterwards. the alternation (?:.|\\s)+? inefficient, involves backtracking. if want match characters including whitespace regex, with [\\s\\s]*? or enable singleline mode (?s) (or pattern.dotall matcher option) , use . (e.g. (?s)start(.*?)end ). note : manipulate html, use dedicated parser, jsoup...

javascript - Display content on click of navigation menu in angularjs -

my html page contain 2 sections. left side have navigation(code below) , right side display contents respective navigation menu. on click of each navigation menu, particular section should rendered on content part. i have done using ng-show/ng-hide setting flag in js file. since setting flags each sections , show/hide , js code file looks odd. know not correct way it. i new angularjs. kindly me achieve efficiently. html code: (only navigation part) <div class="col-md-2"> <ul class="nav nav-pills nav-stacked"> <li class="active"><a href="#home" data-toggle="collapse" data-target="#login">home</a> </li> <div class="collapse" id="login"> <ul class="nav nav-pills nav-stacked"> <li><a class="glyphicon glyphicon-log-in" href="#" ng-click="loginscreen()">login</a></li> <li><a clas...

javascript - How to get the clean "non-highlighted" code with prism.js -

i'm using prism.js highlight css in <pre contenteditable="true"> tag in settup similar this one . on keyup copy code hidden <textarea> output highlighted text such as: <span class="token selector">#description </span><span class="token punctuation">{</span><br> <span class="token property">cursor</span><span class="token punctuation">:</span> ... etc. is there way un-highlighted text able save in clean original format?

c++ - How can we use both Hamming distance and distance between coordinates to match features? -

as known, tracking objects in opencv can use: featuredetector find features descriptormatcher match similarity between features of desired object , features of current frame in video and use findhomography find new position of object for matching features descriptormatcher uses hamming distance (value of difference between 2 sequences of same size, not distance between coordinates). i.e. find similar object in current frame, not nearest previous position (if know it). how can use match both hamming distance , distance between coordinates, example, given weight of both, not hamming distance? it solve following problems: if start track object position (x,y) on previous frame, , current frame contains 2 similar objects, find similar, not nearest. due inertia coordinates changes slower similarity (a sharp change in light or rotation of object). , must find similar object nearest coordinates. thus find features, not similar, give accurate homography, because exclud...

ios - Button with Image and a label on bottom -

Image
i want make button has icon , label on bottom of this: what best way this? possible drag image view object , label button? uibutton has 2 properties may find of interest. titleedgeinsets , imageedgeinsets . use property resize , reposition effective drawing rectangle button title. can specify different value each of 4 insets (top, left, bottom, right). positive value shrinks, or insets, edge—moving closer center of button. negative value expands, or outsets, edge you play around these desired layout.

javafx checklistree output: the term inter comma -

for (checkboxtreeitem<string> treeitem : treeitems) { if (treeitem.isselected()) { if (treeitem.getvalue() != null) { konular = konular + treeitem.getvalue(); } } } system.out.println(konular); hi, code checktreeviews ,treelist sample1 sample2... i have choice, output: nullsample3sample4 i want: sample3, sample4 the java 8 way: string konular = treeitems .stream() .map(treeitem::getvalue) .filter(value -> value != null) .collect(collectors.joining(", "));

javascript - Google Charts - how to add a fixed scale on an axis -

Image
i'm having trouble scaling chart correctly. chart represents data every hour of day in 24 hour format, meaning need numbers 0-24 on linechart. i've tried adding logscale , minvalue , maxvalue properties haxis , nothing working. as can see on chart, hour axis not spanning fixed axis 0-24 hours, instead 9-15 hours. i have 3 rows in data set, reside on hours 9 , 14 , 15 . despite this, lines spanning 9-14 if have values; there no data there, lines should running along bottom @ 0 between these 2 points. how can put fixed horizontal scale on chart, , have individual values on lines each hour? here's code: google.load('visualization', '1.1', {packages: ['line']}); google.setonloadcallback(drawchart); function drawchart() { var json = $.getjson('my json data link', function(data) { var chartstructure = new google.visualization.datatable(); var chartdata = []; chartstructure.addcolumn('n...

asp classic - Escape asp/vbscript script tags -

how escape asp directive output so need print page string asp tags <% response.write "<%=count%>" %> but error microsoft vbscript compilation error '800a0409' unterminated string constant so how print script tags? so need <%=count%> not count there way instead of ? <% response.write "<" & "%=count%" & ">" %> you need make sure html encode before attempting use response.write() this; here use html encoded value of % &#37 stop vbscript run-time spitting it's dummy (but can use &lt; < , &gt; > has been suggested) . <% response.write "<&#37=count&#37>" %> outputs: <%=count%>

iphone - Programmatically get own phone number in iOS -

is there way own phone number standard apis iphone sdk? at risk of getting negative marks, want suggest highest ranking solution (currently first response) violates latest sdk agreement of nov 5, 2009. our application rejected using it. here's response apple: "for security reasons, iphone os restricts application (including preferences , data) unique location in file system. restriction part of security feature known application's "sandbox." sandbox set of fine-grained controls limiting application's access files, preferences, network resources, hardware, , on." device's phone number not available within application's container. need revise application read within directory container , resubmit binary itunes connect in order application reconsidered app store. this real disappointment since wanted spare user having enter own phone number.

ios - SDWebImage resizing with UIGraphicsBeginImageContextWithOptions -

Image
i'm using sdwebimage download thumbnails. resize them before caching them using - (uiimage *)imagemanager:(sdwebimagemanager *)imagemanager transformdownloadedimage:(uiimage *)image withurl:(nsurl *)imageurl delegate method. the code use reisze images is: - (uiimage *)imagebyscalingandcroppingforsize:(cgsize)targetsize image:(uiimage *)image { uiimage *sourceimage = image; uiimage *newimage = nil; cgsize imagesize = sourceimage.size; cgfloat width = imagesize.width; cgfloat height = imagesize.height; cgfloat targetwidth = targetsize.width; cgfloat targetheight = targetsize.height; cgfloat scalefactor = 0.0; cgfloat scaledwidth = targetwidth; cgfloat scaledheight = targetheight; cgpoint thumbnailpoint = cgpointmake(0.0, 0.0); if (cgsizeequaltosize(imagesize, targetsize) == no) { cgfloat widthfactor = targetwidth / width; cgfloat heightfactor = targetheight / height; if (widthfactor > heightfactor) ...

ode - solve system of differential equation in matlab -

Image
i trying solve system of differential equations in matlab. dn/du=(-2*u*n-k*(n*u-(1+g)))/(1+u^2+k*u*(u-(1+g)/n)) dxi/du=(1-u^2)/(1+u^2+k*u*(u-(1+g)/n)) df/du=(2*u+k*u^2*(u-(1+g)/n))/(1+u^2+k*u*(u-(1+g)/n)) k , gamma constants. have initial conditions so: n(0)=1, xi(0)=0, f(0)=0 first tried use 'dsolve'. g=0.1; k=3; syms n(u) u n(u)=dsolve(diff(n,u)== (-2*u*n-k*(n*u-(1+g)))/(1+u^2+k*u*(u-(1+g)/n)),n(0)==1) syms x(u) u n x(u)= dsolve(diff(x,u)== (1-u^2)/(1+u^2+k*u*(u-(1+g)/n)),x(0)==0) syms f(u) u n f(u)=dsolve(diff(f,u)== (2*u+k*u^2*(u-(1+g)/n))/(1+u^2+k*u*(u-(1+g)/n)),f(0)==0) from there not explicit solution first equation , returned [empty sym] shown below. warning: explicit solution not found. in dsolve (line 201) in untitled (line 37) n(u) = [ empty sym ] x(u) = (1089*atan(33/(1600*n^2 - 1089)^(1/2) - (80*n*u)/(1600*n^2 - 1089)^(1/2)))/(160*n*(1600*n^2 - 1089)^(1/2)) - (35937*log(40*n*u^2 - 33*u + 10*n))/(2*(- 2560...

time - R - Split numeric vector into intervals -

i have question regarding "splitting" of vector, although different approaches might feasible. have data.frame(df) looks (simplified version): case time 1 1 5 2 2 3 3 3 4 the "time" variable counts units of time (days, weeks etc) until event occurs. expand data set increasing number of rows , "split" "time" intervals of length 1, beginning @ 2. result might this: case time begin end 1 1 5 2 3 2 1 5 3 4 3 1 5 4 5 4 2 3 2 3 5 3 4 2 3 6 3 4 3 4 obviously, data set bit larger example. feasible method achieve result? i had 1 idea of beginning with df.exp <- df[rep(row.names(df), df$time - 2), 1:2] in order expand number of rows per case, according number of time intervals. based on this, "begin" , "end" column might added in fashion of: df.exp$begin <- 2:(df.exp...

Creating a Custom Content Editor WebPart in SharePoint 2013 -

i have requirement , need suggestion guys. in below state requirement. i have sharepoint 2013 publishing site. has custom master pages build using html files , custom page layouts. client needs follow styles according clients style guide. master pages , page layouts styling not issue. content needed follow same styles guided clients style guide. have used 'script editor' web part insert content. has bad influence technically skilled users can insert content. if use content editor web part not need use html code insert content. issue default content editor web part not has styles relevant clients style guide. can create our own content editor web part reflect clients style guide using visual studio ? hope these information enough idea. thanks , regards, chiranthaka ok guys! many help. found several articles regarding creating custom sharepoint 'custom content editor' web part using visual studio 2013 , sharepoint 2013 enterprise. these artcles old can...

burn - Is it possible to pass a Wix variable to SuppressOptionsUI? -

i trying options button on wixstandardbootstrapperapplication hidden if application has been installed. i hoping able pass variable suppressoptionsui . seems value of suppressoptionsui must literal yes or no . this code using. <!-- don't show options button if have existing install --> <variable name="suppressoptions" type="string" value="no"/> <util:directorysearch after='previousinstallfoldersearch' condition='previousinstallfolder' path='[previousinstallfolder]' result="exists" variable="suppressoptions"/> <bootstrapperapplicationref id="wixstandardbootstrapperapplication.hyperlinksidebarlicense"> <bal:wixstandardbootstrapperapplication showversion="yes" licenseurl="http://static.my-site.com/eula.html" logofile="installer-banner.bmp...

neon - Meaning of ARM operand [r0]! -

i have encountered instruction: vld1.16 {d0}, [r1]! i confused ! means when appended pointer [r1]. how different instruction: vld1.16 {d0}, [r1] thanks taking @ question. the ! causes r1 updated after memory access next address after loaded memory. for example, vld1.16 {d0}, [r1]! same thing as: vld1.16 {d0}, [r1] add r1, r1, #8

list - Implement `[1,2].contains(2)` in JavaScript -

this question has answer here: how check if array includes object in javascript? 38 answers essentially require: if( [1,2].contains(2) ) {...} i surprised can't find simple solution this. is possible add contains method javascript's list type? underscore's similar functions: _.contains vs. _.some , _.map vs _.each offers: _.contains([1,2], 2); however, _ jquery, , still rather clumsy. the solution of tushar right, recomend way: object.defineproperty(array.prototype, 'contains', { writable: true, configurable: true, enumerable: false, value: function(val) { return this.indexof(val) !== -1; } }; the reason many libraries depend on construction for (var in array) ... if define function without setting enumerable property false, such cycles eterate through function well. enumerable = false pre...

match - VBA; Lookup multiple instances of a variable and copy range to another sheet -

i have spreadsheet tab containing amounts paid various clients. there more 1 row per client. need able select instances of client, copy columns of data each instance of client tab. @ moment know how select first instance of record. so example, want put instances of client id 1 tab; data tab id amt 1 £20 2 £10 3 £15 1 £10 2 £20 invoice tab id amt 1 £20 1 £10 i hope i've explained enough, please let me know if need more detail. i'm pretty new vba sorry if easy question. thanks in advance :) eta i tried adapt piece of code found, failed work @ all; 'what value want find (must in string form)? fnd = 1 set myrange = worksheets("data").range("i:ac") set lastcell = worksheets("data").cells(myrange.cells.count) set foundcell = myrange.find(what:=fnd, after:=lastcell) 'test see if found if not foundcell nothing firstfound = foundcell.address else goto nothingfound end if set rng = fo...

c++ - optimization issue with splitting an image into channels -

Image
here code, "algorithm" trying take bayer image, or rgb image, , separate channel g, luma (or grayscale) different channels of color, an example bayer pattern void utilities::separatechannels(int* channelr, int* channelg, int* channelb, double*& gr, double*& r, double*& b, double*& gb,int _width, int _height, int _colororder) { //swith case color order int counter_r = 0; int counter_gr = 0; int counter_gb = 0; int counter_b = 0; switch (_colororder) { //grbg case 0: (int j = 0; j < _width; j++) { (int = 0; < _height; i++) { if (i % 2 == 0 && j % 2 == 0) { gr[counter_gr] = channelg[i*_width+ j]; counter_gr++; } else if (i % 2 == 0 && j % 2 == 1) { r[counter_r] = channelg[i*_width...

drupal - My path breadcrumbs are in an overridden state -

yesterday installed path breadcrumbs module , created breadcrumbs rules. featured them , didn't work them. today opened breadcrumbs on local site , saw "overridden" near names of every breadcrumb rules. feature not in overridden state. re-saved breadcrumbs, nothing happened. can , why? how fix it? http://i.stack.imgur.com/tpddw.png

CSS transition making page too wide -

i trying make box slide in left of page while in viewport, it's making page wide , can't reverse once out of viewport once i've scrolled past it. have: .box { background: #2db34a; border-radius: 6px; cursor: pointer; height: 95px; line-height: 95px; text-align: center; transition-property: background; transition-duration: 1s; transition-timing-function: linear; width: 95px; margin-top: 500px; } #slide { position: absolute; right: -100px; width: 100px; height: 100px; background: blue; overflow: hidden; animation: slide 0.5s forwards; animation-delay: 1s -webkit-animation: movetoright .6s ease both; animation: movetoright .6s ease both; -webkit-animation: movefromright .6s ease both; animation: movefromright .6s ease both; } @-webkit-keyframes movetoright { { } { -webkit-transform: translatex(100%); } } @keyframes movetoright { { } { -webkit-transform: translatex(100%); transform: translatex(100%); } } @-webkit-keyframes movefromright { { -w...

javascript - New instance of function with object property -

function first class objects in javascript - how use in combination new ? i how make object acts both function , object fetch.proxy = '127.0.0.1' fetch(url) but trying figure out how can combine creating new intance can along lines of: a = new fetch(host, username) a(path1) // fetches username@host/path1 a(path2) // fetches username@host/path2 (not useful example 1 instance) the following approach not work applying new returns object (so typeerror: object not function ). var fetch = function(a, b){ if ( (this instanceof arguments.callee) ){ //called constructor this.host = this.username = b; this.host = 'localhost' } else { //called function console.log("fetching "+this.username+'@'+this.host+a); } }; = new fetch('host', 'username') a('/path1') // typeerror: object not function a('/path2') // typeerror: object not function i have been playi...

.net - What is a good model structure for a WPF and EF application? -

short question: there best practice setting single model handle both lazy loading features of ef , interface sync of background data changes wpf? longer explanation/question (and current solution): there plenty of articles explaining mvvm wpf, , plenty of articles working basic model classes , dbcontext’s ef, none (that i’ve found) tie 2 together, my application client-side wpf application uses ef persist data generated application local sqlite database; there background worker threads wpf application fire off returns data other locations require persisting, data saved database if threads complete , returns wpf application while running - otherwise results discarded , app try running thread again next time, now run problem…. ef requires virtual icollections lazy loading (which require) in order ensure background data syncs displaying on wpf applications, need use observablecollections , implement inotifypropertychange interface other fields - example - have customer class...

android - How to spawn multiple threads for upload without waiting -

i have following class responsible fetch non synced receipts receipts table , upload them server, following function of iterates through cursor result set: public class midnightupload { public static void checklocalandupload(final context ctx) { cursor cursor = databasehandler .getinstance(ctx) .getreadabledatabase() .query(receipt.table_name, receipt.fields, receipt.web_receipt_id + " ?", new string[]{"dummy"}, null, null, null, null); if (cursor != null && cursor.movetofirst()) { { log.d("_id", cursor.getstring(cursor.getcolumnindexorthrow("_id"))); log.d("receipt_id", cursor.getstring(cursor.getcolumnindexorthrow("receipt_id"))); log.d("web_receipt_id", cursor.getstring(cursor.getcolumnindexorthrow(...

android - Ellipsize text inside TextView instead of clipping -

Image
in listview row have title , subtitle. if title takes 2 lines i'd subtitle textview shrink , text inside ellipsized fit remaining space. title should have priority on subtitle. how prevent subtitle clipped? here s row: <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="90dp" android:background="#fff"> <view android:id="@+id/news_unread_indicator" android:layout_width="5dp" android:layout_height="match_parent" android:layout_alignparentleft="true" android:background="@color/unread_news" /> <relativelayout android:layout_width="match_parent" android:layout_height="90dp" android:orientation="vertical" android:paddingbottom="10dp" android:paddi...

c# - How to use SbyteToBoolConverter converter in wpf, for converting bool property to sbyte in the UI -

i have sbytetoboolconverter can use checkbox if had sbyte type of property. code goes this: class sbytetoboolconverter: ivalueconverter { public object convert(object value, type targettype, object parameter, system.globalization.cultureinfo culture) { if ((sbyte)value == 0) return false; else return true; } public object convertback(object value, type targettype, object parameter, system.globalization.cultureinfo culture) { if ((bool)value) return 1; else return 0; } } however looking opposite of this, have boolean property , want show 0 or 1 on ui, combobox control. have use opposite converter, booltosbyteconverter. my question is, can not use same sbytetoboolconverter achieving somehow, after have replace convert , convertback call. is there way work same converter or have create new 1 opposite of this. re-using converter opposite direction mean exchange conv...

angularjs - Angular app only loads on page refresh -

i building wordpress site page angular app. working until (and can't recall change broke it), app not load when arrive @ page via link (angular loaded , code snippet below processed, nothing logged), does work if refresh page. i've backed out real code leave: angular.module("af2015app", []) .controller("testctrl", function() { console.log("test test"); }); and commented out in html except <div ng-app="af2015app" class="app"> <p ng-controller="testctrl">use ...!</p> </div> i'm @ loss how debug these circumstances. i'm not loading pages via ajax. thanks ideas everyone. had go @ debugging , discovered that, after turning off script tag angular, angular still present. gave me idea @ batarang and, after deactivating that, working again. perhaps answer someday. needless don't know underlying problem was.

javamail - notification if no reply to a mail in Gmail (Java) -

i know if possible know if recipient has answered definit email . what te best way in java ? there message-id , in-reply-to , references headers in e-mail message (see http://cr.yp.to/immhf/thread.html or http://wesmorgan.blogspot.ch/2012/07/understanding-email-headers-part-ii.html ). have keep message-id of e-mail message interested in, , parse headers of incoming messages, if contain id. as way in java, read java mail api tutorial , study javax.mail javadoc (and sub-packages). warning: athough commonly used e-mail clients, these headers not mandatory, there no 100% secure way it.

PHP spits actual HTML instead of image -

having small issue here cannot figure out have gone wrong. have following code should show image depending on condition instead shows html in browser if ($this->id_status == 2) { $this->id_status = "<img src='../_lib/img/gray_dot.png' />"; } elseif ($this->id_status == 1) { $this->id_status = "<img src='../_lib/img/green_dot.png' />"; } elseif ($this->id_status == 3) { $this->id_status = "<img src='../_lib/img/orange_dot.png' />"; } can help? try this: <?php if ($this->id_status == 2) { ?> <img src='../_lib/img/gray_dot.png' /> <?php } elseif ($this->id_status == 1) { ?> <img src='../_lib/img/green_dot.png' /> <?php } elseif ($this->id_status == 3) { ?> <img src='../_lib/img/oran...

eclipse - C: Implicit declaration of function ‘vsyslog’ -

i trying implement sys logger pam module. code follows: #define __use_bsd #include <syslog.h> #include <stdarg.h> #include <string.h> static void _log(int level, const char *format, ...) { va_list args; va_start(args, format); openlog("my_app", log_cons|log_pid|log_perror, log_auth); vsyslog(level, format, args); va_end(args); closelog(); } pam_extern int pam_sm_authenticate( pam_handle_t *pamh, int flags,int argc, const char **argv ) { /* something... */ _log(log_info, "username check"); if (strcmp(username, "jdoe") != 0) { _log(log_err, "auth error"); return pam_ignore; } /* else... * } but, when compile, eclipse cdt returns me warning: ../src/mypam.c:33:5: warning: implicit declaration of function ‘vsyslog’ [-wimplicit-function-declaration] how fix it? note using centos 7 dev machine. fixed, defining both __use_bsd , _bsd_source foll...

keymapping - Insert mode mapping in Vim -

this may trivial couldn't find way make mapping work. i have following mapping in .vimrc compile file using clang , run afterwards: map <f5> :wa \| !clang++ -g -std=c++11 % -o test && ./test : <cr> i want add same mapping in insert mode doesn't seem work. 1 of many things i've tried (including wrapping mapping in separate function) was: imap <f5> <c-o> <f5> how can make mapping work in insert mode? remove space after <c-o> . work, needed use nnoremap instead of map . should work: nnoremap <f5> :wa \| !clang++ -g -std=c++11 % -o test && ./test : <cr> imap <f5> <c-o><f5>

web services - Gatling test fails when digest authentication on -

i developped soap web service. started implement without authentication. works fine : service, call soap ui , gatling tests. i added digest authentication , cannot make gatling test work (the test soap ui still successful). according gatling documentation ( here ), supposed call .digestauth(login, pass) on http request: val scn = scenario("scenario") .feed(feeder) .feed(feeder2) .forever{ exec( http("myrequest") .post(target) .digestauth("login","pass") .body(elfilebody("request.wsdl")) .headers(headers_2) ) } the answer server 500 error message : jul 07, 2015 4:27:31 pm com.sun.xml.wss.impl.securityrecipient processmessagepolicy schwerwiegend: wss0253: message not conform configured policy: no security header found in message update : i'm using latest version of gatling 2.1.6 i cannot share webservice here how configured. spring-servlet.xml <sws:interceptors> ...

osx - access forbidden xampp in mac php -

there error infomation: access forbidden! don't have permission access requested directory. there either no index document or directory read-protected. if think server error, please contact webmaster. error 403 localhost apache/2.4.12 (unix) openssl/1.0.1m php/5.6.8 mod_perl/2.0.8-dev perl/v5.16.3 i have setting httpd.conf file follw: alias /myspace "/volumes/myspace/workspace/phpworkspace" <directory "/volumes/myspace/workspace/phpworkspace"> options indexes followsymlinks multiviews allowoverride order deny,allow allow #require granted </directory> "/volumes/myspace/workspace/phpworkspace" place location of code. have tried many methods: xampp access forbidden php new xampp security concept: access forbidden error 403 - windows 7 - phpmyadmin the order directive should allow first, deny . set allow all , don't set deny . change directory directive , should work <directory...

javascript - getClusters() returning array of length 0 -

var markers = []; (var = 0; < 50; i++) { var latlng = new google.maps.latlng(30, 40); var marker = new google.maps.marker({ position: latlng }); markers.push(marker); } var markercluster = new markerclusterer(map, markers); var arr = markercluster.getclusters(); alert(arr.length); for(var i=0;i<arr.length;i++){ console.log(arr[i].getcenter()); } the above code returning array on length 0. why getclusters() not working? i got reason. need wait time before markercluster created completely.just changed part below. settimeout(function() { var arr = markercluster.getclusters(); alert(arr.length); for(var i=0;i<arr.length;i++){ console.log(arr[i].getcenter()); } },2000);

How to Migrate Drupal Database to Opencart? -

i have move products, categories, attributes drupal database opencart. ok if tables or rows available in both databases available. there automated way this? if can't write migration-script, way achieve looking through database-structure of both systems, exporting tables concerned drupal, editing them manually fit scheme of opencart , import oc-database.

amazon web services - Content type of S3 key is being set as 'application/octet-stream' even after explicitly setting it to "text/plain", in python boto -

i have save textfile s3 using boto. have fetched textfile using "requests" library. have written following code save file s3: filename = "some/textfile/fi_le.txt" k = bucket.new_key(filename) k.set_contents_from_string(r.raw.read()) k.content_type = 'text/plain' print k.content_type k = bucket.get_key(filename) print k.content_type the output is: text/plain application/octet-stream what should set file's content_type 'text/plain'? note: dealing lot of such files, setting manually in aws console not option. try setting content type before call set_contents_from_string : k = bucket.new_key(filename) k.content_type = 'text/plain' k.set_contents_from_string(r.raw.read()) the reason have set before, not after, because set_contents_from_string method results in file being written s3 - , once it's written, changes local object attributes won't reflected. instead, set local attributes first, before object writ...

c# - Block regex to recognize number while it's part of a URL -

i using regex: [(]?(((\d)([() .-]+)?)+){7,18}|\*\d{3,10}|\d{3,10}\*(?!/) how can change attached regex not recognize numbers part of url facebook phone number, recognize phone number not part of url? the url: https://www.facebook.com/pages/fashion-24/151055822249094?fr=ts the above regex detect "151055822249094" phone number. you can use negative lookbehind in regex: (?<!/)[(]?(((\d)([() .-]+)?)+){7,18}|*\d{3,10}|\d{3,10}*(?!/)

mysql - Off-site Database Server -

i'm intending on having group of dedicated servers hosted 29ms away database cluster [aws]. acceptable latency? or should attempt else databases? i'm not in position manage own database cluster, hence decision use aws host databases. it depends on application. i use development db server ~20 ms away , web app runs considerably slower (5-20 times) compared lan server. it might possible mitigate of that, cost lot of effort , might end ad-hoc local cache copy of db anyway.

javascript - What is the meaning of 'role','title','alt' in DOJO Mobile -

i dojo fresher, here mobile application developed dojo mobile. and found can't work when open ios voiceover. the data-dojo-type="dojox/mobile/scrollableview" component can't scroll more. i checked dojo website , found solution( https://dojotoolkit.org/reference-guide/1.10/dojox/mobile/faq.html ): how develop applications support ios voiceover? to set alt , title , role attributes. voiceover read widgets these attributes set. see tests/test_a11y.html examples. however, value of spinwheel can not read voiceover in 1.8.make sure follow guide visited page tests/test_a11y.html ( https://github.com/dojo/dojox/blob/master/mobile/tests/test_a11y.html ) , find code include alt,title,role attributes: here question: what's meaning of these 3 attributes,can add attributes every dojo components in code?and how decide value of these attributes? and found tests/test_a11y.html dojo components include role attribute others include three.it ma...

linux - Run a script from root and it calls another script that was in the sudo oracle. how to do that without asking the password of the oracle -

i'm logging linux machine root , after login have used su - oracle connect database. i've 2 shell scripts 1 @ root home , 1 @ home/oracle. in home/oracle i've wrote script taking backup of database. script available in root nohup ssh oracle@onprem-svcdb /home/oracle/test.sh while running script asking password of oracle, don't need while running scripts doesn't need ask password , needs run script in oracle. need that??? can this you try expect tool: you start expect script below, start main sql-script in return , send oracle password if prompted: content of /tmp/expect.exp script: #!/usr/bin/expect -f # set variables set password '***' set timeout -1 # execute spawn /usr/bin/su oracle -c "/tmp/main_script.sh" match_max 100000 # passwod prompt while {1 > 0 } { expect "*?assword:*" # send password aka $password send -- "$password\r" } # send blank line (\r) make sure gui send -- "\r" expect eof ...

node.js - Object is not a Function - SuperTest -

Image
i'm not sure why it's throwing error , it's saying not function. 'use strict'; var koa = require("koa"); var app = koa(); var chai = require('chai'); var expect = chai.expect; var request = require('supertest'); describe('feature: car rest endpoint', function () { context('scenario: car', function () { var url = 'http://localhost/search/cars'; describe('given: resource accessed @ resource url' + url, function () { describe('then: receive successful response', function(){ it('status code should 200', function (done){ request(app) .get(url) .expect(200,done); }); }); it says it's line .expect(200,done) might wrong. i tried no luck: request(app) ...

go - How can I tell if my interface{} is a pointer? -

if have interface being passed function, there way tell if item passed in struct or pointer struct? wrote silly test illustrate need figure out. type mystruct struct { value string } func testinterfaceisorisntpointer(t *testing.t) { var mystruct interface{} = mystruct{value: "hello1"} var mypointertostruct interface{} = &mystruct{value: "hello1"} // ispointer method doesn't exist on interface, need if mystruct.ispointer() || !mypointertostruct.ispointer() { t.fatal("expected mystruct not pointer , mypointertostruct pointer") } } func isstruct(i interface{}) { return reflect.valueof(i).type().kind == reflect.struct } you can test via changing type according needs such reflect.ptr . can pointed value reflect.indirect(reflect.valueof(i)) after ensured it's pointer. addition: it seems reflect.value has kind method reflect.valueof(i).kind() enough.

email - Spring XD - Mail as Sink or Source -

i have been trying ingest data mail file using spring xd. although creation of stream comes out successful, no output file created in process. the command used follows: xd:>stream create mailtest --definition "mail --username=myemail%40gmail.com --password=mypassword --host=imap.gmail.com --delete=false --port=993 --outputtype=text/plain | file" --deploy what can fix this? moreover, same problem occurring when use mail sink . in example did, used http source . the commands used follows: xd:>stream create tomail --definition "http | mail --host=imap.gmail.com --to='\"some.email.com@gmail.com\"' --username=myemail%40gmail.com --subject='testing mail' --password=mypassword --port=993 --contenttype=text/plain" --deploy xd:> http post --target http://localhost:9000 --data "hello world!" your feedback appreciated!

sql - When is using transaction necessary in a web app? -

i wondering, if web request handler needs perform multiple update queries needs atomic group, in django app: modela.fieldx = true modela.save() # produce update query on modela table modelb.fieldy = modelb.fieldy + 1 modelb.save() # produce update query on modelb table and there no logical branch taken or exceptions thrown between queries, still need wrap queries in transaction? and downside of wrapping them in transaction? how affect performance of other queries on relevant tables? edit: currently, use transactions money-related queries, safe. usually, transactions necessary data consistency. example, when transfer money account account b should update amounts in accounts , b in transaction avoid situations when decrease amount of account amount of account b not increased due exception or other reason. long transactions bad relational databases because increases locking of db resources , increases overhead costs it i suggest using short transactions possib...

Cordova App breaks on Android 5.0 -

cordova app breaks on android lollipop, during app installation see in logcat, though not sure if these actual cause of error. (app installs/works fine on versions < 5.0) using cordova v-5.1.1 & cordova-android@4.0.2 i/personamanagerservice( 3485): personaid don't exist i/activitymanager( 3485): not start freezing screen locked container getkeyguardshowstate = false e/parcel ( 3485): class not found when unmarshalling: com.android.packageinstaller.installflowanalytics e/parcel ( 3485): java.lang.classnotfoundexception: com.android.packageinstaller.installflowanalytics further downword in logs see this d/applicationpolicy( 3485): isstatusbarnotificationallowedasuser: packagename = com.android.providers.downloads,userid = 0 v/applicationpolicy( 3485): isapplicationstateblocked userid 0 pkgname com.android.providers.downloads w/notificationservice( 3485): pray mode not found android.content.pm.packagemanager$namenotfoundexception: application package com.sec.and...

python 2 subprocess check_output not returning error output -

i have method def do_sh_shell_command(string_command, env_variables=none): cmd = shlex.split(string_command) try: p = subprocess.check_output(string_command, shell=true, env=env_variables) # shell=true means sh shell used except subprocess.calledprocesserror e: print 'error running command: ' + '"' + e.cmd + '"' + ' see above shell error' print 'return code: ' + str(e.returncode) return e.returncode, e.cmd return 0, p which work reason doesn't return error output specfici command def hold_ajf_job(job_order_id): #print 'ctmpsm -updateajf ' + job_order_id + ' hold' return do_sh_shell_command('ctmpsm -updateajf ' + job_order_id + ' hold') hold_ajf_job('0e4ba') do_sh_shell_command('lsl') output: ctmpsm -updateajf 0e4ba hold error running command: "ctmpsm -updateajf 0e4ba hold...

javascript - DataStore in Single Page Apps -

regardless of framework or library in use, amount of data downloaded internet , stored in javascript array gets larger , larger. the question is: hard limit on how data such array/object can hold? happens when limit reached? facebook ever crash because of such problem?

android - Empty Listview Text shows for a few seconds before listview loads -

Image
let me state there question similar here listview shows empty message briefly before data loaded but uses listfragment , derives cursoradapter , while using "ordinary" fragment , adapter derives baseadapter. i have set empty textview display when there no data in database, textview shown briefly while data loads. in fragment, have code: public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); databasemanager = new databasemanager(getactivity()); progressdialog = new progressdialog(getactivity()); sethasoptionsmenu(true); mcontext = getactivity(); } public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view rootview = inflater.inflate(r.layout.item_list_layout, container, false); itemlistview = (listview) rootview.findviewbyid(r.id.itemlistview); emptytext = (textview) rootview.findviewbyid(r.id.empty); registerforcontextmenu(itemlistview);...

mysql - Incorrect key file for table '/tmp/#sql_18b4_0.MYI'; try to repair it -

i got query our developers not executing on server , giving below error- incorrect key file table '/tmp/#sql_18b4_0.myi'; try repair i have checked tables individually , index, seems file. have checked these tables in other query join fetching more data query , working fine. even these tables hardly keep less 1000 records per table. query is: select `psmastersubject`.`id`, `psmastersubject`.`name`, `psprogram`.`name`, `psstreamlevel`.`id` `misdb`.`ps_master_subjects` `psmastersubject` left join `misdb`.`ps_programs` `psprogram` on (`psmastersubject`.`ps_program_id` = `psprogram`.`id`) left join `misdb`.`ps_stream_levels` `psstreamlevel` on (`psstreamlevel`.`id` , `psprogram`.`ps_stream_level_id`) left join `misdb`.`ps_program_levels` `psprogramlevel` on (`psprogramlevel`.`id` , `psstreamlevel`.`ps_program_level_id`) 1 = 1 order `psmastersubject`.`id` desc limit 10; i getting issues same have checked table not currupt. any quick highly appreciated. ...

javascript - need help in adding objects to array -

i fetching data text file , need in making information object.. array: ['celestine,timmy,celestinetimmy93@gmail.com,repeat 124\narun,mohan,reach@gmail.com,repeat 124213\njobi,mec,mec@gmail.com,rave\njalal,muhammed,jallu@gmail.com,rave1231212321\nvineeth,mohan,get,rave1231212321\n' ] i need values till \n in 1 object expected result: [{'celestine,timmy,celestinetimmy93@gmail.com,repeat 124} {arun,mohan,reach@gmail.com,repeat 124213} {jalal,muhammed,jallu@gmail.com,rave1231212321} {vineeth,mohan,get,rave1231212321} ] you can in way. after applying splitting '\n' ['celestine,timmy,celestinetimmy93@gmail.com,repeat 124\narun,mohan,reach@gmail.com,repeat 124213\njobi,mec,mec@gmail.com,rave\njalal,muhammed,jallu@gmail.com,rave1231212321\nvineeth,mohan,get,rave1231212321\n' ] you single 1 dimensional array. ["celestine,timmy...