Posts

Showing posts from July, 2012

go - With Golang Templates how can I set a variable in each template? -

how can set variable in each template can use in other templates e.g. {{ set title "title" }} in 1 template in layout <title> {{ title }} </title> then when it's rendered tmpl, _ := template.parsefiles("layout.html", "home.html") it set title according whatever set in home.html instead of having make struct each view page when isn't necessary. hope made sense, thanks. just clarification: layout.html: <!doctype html> <html> <head> <title>{{ title }} </title> </head> <body> </body> </html> home.html: {{ set title "home" . }} <h1> {{ title }} page </h1> if want use value in template can pipeline dot: {{with $title := "sometitle"}} {{$title}} <--prints value on page {{template "body" .}} {{end}} body template: {{define "body"}} <h1>{{.}}</h1> <--prints "sometitle...

c# - ConfigurationManager.AppSettings vs Constants Class -

if have hard coded strings in app, when should store in app.config file , when should use const string in public static class? i guess benefit of using appsettings don't need recompile if used static class, there other pros/cons?

javascript - wrapping pulled text in <p> tags -

i have wordpress site have pulled out images , text separately use in different parts on single.php. html - (bootstrap 3 framework) <div class="row"> <div class="col-md-12"> <?php preg_match_all('/(<img [^>]*>)/', get_the_content(), $matches); for( $i=0; isset($matches[1]) && $i < count($matches[1]); $i++ ) { echo $matches[1][$i]; } ?> </div> </div><!-- /row --> <div class="row"> <div class="col-md-12"> <?php echo preg_replace('/(<img [^>]*>)/', '', get_the_content()); ?> </div> </div><!-- /row --> this puts images in first row, , text in second row. however, not wrap text when it's pulled out in tags. want wrap text in < p > tag can apply css it. also, in browser's inspector, pulls hr...

java - Should I care about the difference between main thread and UI thread in Lollipop and beyond? -

before lollipop, life easy. had main thread - called ui thread - in gui stuff done (and avoided under circumstances long-running operations avoid kind of hiccup), , had background threads did long-running stuff. now in lollipop , later versions of android, iirc term ui thread seems point user new renderthread , thread example used animate ripples, hero elements between activities or other kind of animation needs happen while main thread processes input events or busy creating new stuff in background. with android studio 1.3 3 thread types got own annotation, denote particular piece of code should run on particular thread. me question is: should app developer care run anything on uithread , i.e. renderthread , , such ever use @uithread in application? i remember on chet haase's presentation of renderthread last year's google io. statement was, in first place have continue mainthread before. renderthread used animations only. instance, if have method ond...

mysql - Get average time per a visit -

what i'm trying average page_visit_duration of rows have same session_id row duplicate session id means visitor visited multiple pages rows same session_id need add total page_visit_duration of pages visited before getting average time spent on site how can searched , couldn't find anything. here's queries tried: select avg(page_visit_duration) avgtime page_views select avg(page_visit_duration) avgtime page_views group `session_id` please note second query returns many results need give 1 average what i'm trying average time spent on our site per visitor. you need first group results, , take average of those. select avg(total_duration) avgtime (select sum(page_visit_duration) total_duration, session_id page_views group session_id) sq

algorithm - Why is only one of the given statements about complexity classes correct? -

apparently correct answer following question (c), why other options not correct until know value of n? if n=1, of these seem correct except (b)! going wrong? which of following not o(n 2 )? (a) 15 10 * n + 12099 (b) n 1.98 (c) n 3 / √n (d) 2 20 * n wikipedia says :- big o notation describes limiting behavior of function when argument tends towards particular value or infinity, in terms of simpler functions. description of function in terms of big o notation provides upper bound on growth rate of function. an upper bound means f(n) = n can expressed o(n), o(n 2 ), o(n 3 ), , others not in other functions o(1), o(log n). so, going in same direction, can eliminate options shown below :- 15 10 * n + 12099 < c * n 2 , n > √12100 i.e. n > 110 --- hence o(n 2 ). n 1.98 < n 2 , n > 1 --- , o(n 2 ). n 3 / √n = n 5/2 > n 2 n > 1 --- hence, isn't o(n 2 ). 2 20 * n = 1024*1024*n < c* n 2 n ...

python - How to add colorbar to a histogram? -

Image
i have histogram (just normal histogram): in situation, there 20 bars (spanning x axis 0 1) , color of bar defined based on value on x axis. what want add color spectrum 1 of in http://wiki.scipy.org/cookbook/matplotlib/show_colormaps @ bottom of histogram don't know how add it. any appreciated! you need specify color of faces form of colormap, example if want 20 bins , spectral colormap, nbins = 20 colors = plt.cm.spectral(np.linspace(nbins)) you can use specify color of bars, easiest getting histogram data first (using numpy ) , plotting bar chart. can add colorbar seperate axis @ bottom. as minimal example, import numpy np import matplotlib.pyplot plt import matplotlib mpl nbins = 20 minbin = 0. maxbin = 1. data = np.random.normal(size=10000) bins = np.linspace(minbin,maxbin,20) cmap = plt.cm.spectral norm = mpl.colors.normalize(vmin=data.min(), vmax=data.max()) colors = cmap(bins) hist, bin_edges = np.histogram(data, bins) fig = plt.figure() ax...

salesforce - How to Detect Errors in Apex Data Loader Batch Execution -

we have dos batch job runs multi-step process to: delete records salesforce specific object (download ids , delete them using data loader) deletes records database table mirrors salesforce data. extracts data database , uploads data salesforce objects using data loader. downloads salesforce data database table. recently, first step has been failing query-timeout error. if rerun process, works ok without other changes. being investigated, not question. my question is: how can detect when step 1 (which uses data loader) in batch file fails? if fails, not want proceed rest of process, deletes database data used elsewhere reporting. does apex loader set errorlevel if fails? how else can determine there failure? thanks. ron ventura please view more detail refer link below. check log file data loader generates when there error, if no errors found log files empty, if pass 100% successful, error log have header line , no rows. http://www.nimbleuser.com/blog/pos...

c++ - Upgrade Compatibility of Boost Serialization with binary archives armv7 to arm64 -

the company work releases on ios , android, , apple requiring update of our apps run on arm64 architecture (previously released armv7). unfortunately have been using boost::archive::binary_iarchive 's (and binary_oarchive 's) store lot of user data (saved games, preferences, etc). while testing, loading of these archives saved armv7 binary, fails spectacularly on arm64 devices running "universal binary" version of our games. template<typename t> static t deserialize(std::vector<char> buffer) { boost::iostreams::basic_array_source<char> source(&buffer[0], buffer.size()); boost::iostreams::stream<boost::iostreams::basic_array_source<char>> input_stream(source); boost::archive::binary_iarchive ia(input_stream); // crashes here t value; ia >> boost_serialization_nvp(value); return value; } the buffer pass in reasonable size. based on fact crashing during constructor of boost::archive::binary_iarchiv...

javascript - change colour of header when scroll -

i'm going cut chase straight away, want header go transparent (no background attribute in css) having background-color of white on scroll. i using javascript , not getting anywhere. $(window).scroll(function() { var changenav = 'rgba(0, 0, 0, 0.36)' if ($(window).scrolltop() > 200) { changenav = '#ffffff'; } $(.header).css('background-color', changenav); }); also, there way can make go on itself? @ bottom of page , header has background-color of white, when scoll top, javascript takes attribute out? have been playing , searching couldn't find anything. note: had gotten piece of javascript place on stack overflow, here thank much jsbin demo $(.header) should $(".header") also script can "simplified" to: $(window).scroll(function() { var scrolled = $(this).scrolltop() > 200; $(".header").css('background-color', scrolled ? '#fff' : "rgba...

iis 7 - Configure application pools with the default settings using AppCmd.exe -

i working on build script , need reconfigure application pool default settings using appcmd.exe. point me right direction? thank you. you can list of settings using this... appcmd list apppool "test" /text:* you can check https://technet.microsoft.com/en-us/library/cc732992%28v=ws.10%29.aspx more information.

install - Canopy installation problems, a solution for TIF? -

i've been starting python in canopy enthought little more month now. i'm struggling installation @ many levels drives me crazy. want install modules deal tif files, in order create multiimage tof, etc. tifffile 0.4 pylibtiff i cannot them through easy_install. tried pip install tifffile i keep getting these errors: error: visual studio 2008 express edition found in path, visual studio 2008 required build extension modules on 64-bit platform. visual studio installed, installed 2013 express version, downloaded , installed 2008 too, nothing seems work. this driving crazy, , i'm not sure handle basics of how python handle different modules. through different .zip packages, ended tifffile code, don't know put it. there .exe installer pylibtiff can't work either. if can help, save life of computer, feel it's gonna learn fly soon. thanks lot !! dam. you need visual studio 2008. not visual studio express 2008.

css - How do I center a button in an angular-ui-grid cell? -

i define column follows: { name: 'button', displayname: '', cellclass: 'ui-grid-vcenter', enablecolumnmenu: false, enablefiltering: false, enablesorting: false, celltemplate: '<div><button ng-click="grid.appscope.rowbuttonhandler(row.entity.id)">clicky</button></div>' } resulting in: <div class="ui-grid-cell ng-scope ui-grid-coluigrid-010 ui-grid-vcenter" ui-grid-cell="" ng-class="{ 'ui-grid-row-header-cell': col.isrowheader }" ng-repeat="(colrenderindex, col) in colcontainer.renderedcolumns track col.coldef.name"> <div class="ng-scope"> <button ng-click="grid.appscope.rowbuttonhandler(row.entity.id)"></button> </div> </div> i want center button vertically , horizontally. horizontally, works, vertically, can't seem css right. here's generic shot @ it: .ui-grid-vcent...

vb.net - FTP Client uploads only 0KB files -

i having small problem ftp client. choosing file works, renaming file 4 variables works. it's upload causing me trouble. whenever file uploaded ftp server says 0kb. i thinking of 2 possible problems: visual studio tells me variable file used before has been assigned value, make sure isn't null did following. dim file byte() if (not file nothing) strz.write(file, 0, file.length) strz.close() strz.dispose() filesystem.rename(filename, originalfile) end if this takes care of possible errors. the second 1 fname, same warning file, , took care of same way. another possibility code takes 4 variables , makes file , uploads it, hence 0kb size.... here's code: dim filename string dim originalfile string private function enumeratecheckboxes(byval path string) originalfile = path dim fname string each control in me.controls if (typeof control combobox andalso ...

debian - Set up TightVNC programmatically with BASH -

i'm writing script set vnc (amongst other things) on many debian based devices. want include vnc in setup (specifically, tightvnc if possible) , have set given password (randomly generated script). problem is, every guide find seems assume human doing this, , ready sit , type in password , press enter. can't seem bash echo password vnc (it says 'password short') nor can 'expect' work properly. an example guide found looks this: http://www.penguintutor.com/linux/tightvnc i'm looking similar this: #!/bin/bash echo "going configure vnc" #turn on vnc server tightvncserver #spit out password vnc server first run echo $password #confirm pw echo $password but, on every virginal run of tightvncserver asks password inputted hand: going configure vnc require password access desktops. password: password short how can #1 around this, or #2 use bash / expect give password make happy? # configure vnc password umask 0077 ...

c# - Inject dictionary using dependency injection -

i created function(dictionary) project: private static dictionary<string, func<imessageprocessor>> strategyfactories = new dictionary<string, func<imessageprocessor>>() { { "t.2.12.0", new func<imessageprocessor>(() => new hvpvtparser()) }, { "t.3.03.0", new func<imessageprocessor>(() => new pvtparser()) }, { "unknown", new func<imessageprocessor>(() => new unknownparser()) } }; as per requirement, want rid of new operator classes (hvpvtparser, pvtparser , unknownparser). can improve function through dependency injection? during research, found option inject dictionary. unable understand word 'inject'. can provide code sample achieve goal or guidelines solve problem. typically "inject" sort of service implements interface. in case like: public interface istrategyfactoryservice { public dictionary<string, func<imessageprocessor...

Setting page titles as attribute values with Rails -

i'm wondering if knows how set page's title attribute. was thinking along lines of: <% content_for :title, "museum | '@gallery.name'" %> but cant figure out wrap @gallery.name in, if right approach. it's simple question, seem stumped! maybe? <% content_for :title %> (@gallery && @gallery.name) || 'museum' <% end %> of course yield :title somwewhere required credits @clark if text should museum | foobar if @gallery name exists instead of (@gallery && @gallery.name) || 'museum' should "museum | #{@gallery && @gallery.name} (in case @gallery guaranteed defined simplier "museum | #{@gallery.name}" (remember use double " not ' ).

Ruby post match returning Nil.. like its supposed too -

my while loop busted somehow.. error: `block in scrape': undefined method `post_match' nil :nilclass (nomethoderror) its returning nil supposed after going through string, , populates array supposed too, last time hits .post_match fails because nil.. supposed nil.. not sure do?? want populate array , exit loop once parent_pic_first nil. parent_pic_first = /\"hires\":\"/.match(pic).post_match while parent_pic_first != nil parent_pic = uri.extract(parent_pic_first, ['http']) pic_list = [] pic_list.push(parent_pic[0]) parent_pic_first = /\"hires\":\"/.match(parent_pic_first).post_match end the error isn't fact parent_pic_first nil , problem /\"hires\":\"/.match(parent_pic_first) nil . you're attempting call method post_match on nil value. nil.post_match quite not going work. you need add in checks prevent calling post_match on nil , this: par...

java - Added methods to the Button (any view Class) in Android -

this question has answer here: custom surfaceview causing nosuchmethodexception 1 answer i have set android class programmaticly set text of series button created in xml. in class create identifier(numberid) each instance of button later used in onclick method able tell apart each button , have differences both. i have used below code , have set buttons in xml use class instead of official button class public final class numpadbutton extends button { public int buttonnumber; public numpadbutton(context context) { super(context); } public void setbuttonnumber(int buttonnumber) { this.buttonnumber = buttonnumber; } public int getbuttonnumber() { return buttonnumber; } } however extending button class , adding required methods ends causing error : android.view.inflateexception: binary xml file line #13: error inflating class... i know the...

mysql - Running a SELECT Query with an Ansible Task -

in this list of mysql db modules ansbile, there's 1 creating db, or creating user, etc. i run query against pre-existing table , use results of query populate ansible variable (list of ip addresses, , node type) upon run different tasks, depending on node type. how can done in ansible? this approximately how (but untested): - name: retrieve stuff mysql command: > mysql --user=alice --password=topsecret dbname --host=147.102.160.1 --batch --skip-column-names --execute="select stuff stuff_table" register: stuff always_run: true changed_when: false - name: stuff debug: "{{ item }}" with_items: stuff.stdout_lines documented here .

Laravel AJAX validation: Return HTML instead of JSON -

as it's stated in docs, if ajax validation fails json response: if validation fails, redirect response generated send user previous location. errors flashed session available display. if request ajax request, http response 422 status code returned user including json representation of validation errors. but i'd prefer partial view flashed error default non ajax. is possible emulate non ajax or turn off ajax without rebuilding source or other awkwardness? btw, culprit function buildfailedvalidationresponse. i got similar problem these days , ended overwriting method well. under laravel 5.1.20, had copy method response class illuminate\foundation\http\formrequest class app\http\requests\request, , answer, changed if ($this->ajax() || $this->wantsjson()) { with if ($this->wantsjson())) { this complete method in app\http\requests\request class public function response(array $errors) { if (!$this->pjax() && ...

python - Referencing numpy array locations within if statements -

i have following section of python: for j in range(0,t): x in xrange(len(index)): y in xrange(x+1,len(index)): if index(y) == index(x): continue for have been attempting translate matlab equivalent. in matlab, operation simple follows: iter = 1:t = 1:length(index) j = i+1:length(index) if index(j) == index(i) continue; end however, when attempt execute code receive "numpy.ndarray object not callable" error. why arise, , how go writing in proper python manner execute? looks index array of sort, when index(y) , index(x) , python thinks you're trying call function index() using x , y parameters, respectively. if you're trying access elements, use index[x] , index[y] .

c - Populating an array from a large array, two elements at a time -

i have array of 10 random elements, generated this: ( j = 0;j<10;j++) { file[j] = rand(); printf("element[%d] = %d\n", j, file[j] ); } then generate new array 2 elements. value of array taken array above, , placed array 2 elements. in code sample below: for(i = packet_count, j = 0; j < 2; ++j, ++i) { packet[j] = file[i] ; ++packet_count ; printf("\npacket: %d", packet[j]); } printf("\ntransmit packet: %d bytes", sizeof(packet)); the output shown below: telosb mote timer start. element[0] = 36 element[1] = 141 element[2] = 66 element[3] = 83 element[4] = 144 element[5] = 137 element[6] = 142 element[7] = 175 element[8] = 188 element[9] = 69 packet: 36 packet: 141 transmit packet: 2 bytes i want run through array , take ...

java - JSP on Tomcat is displaying as source, not processed as JSP -

note: not duplicate of this question . question pointed using @restcontroller, , problem solved switching @controller. using @controller , org.springframework.web.servlet.view.internalresourceviewresolver porting web app websphere tomcat. following in mvc-config.xml file: <mvc:view-controller path="/" view-name="redirect:/dashboard"/> <mvc:view-controller path="/login" view-name="login"/> <mvc:view-controller path="/**.html" view-name="login"/> <!-- resolves view names protected .jsp resources within /web-inf/views directory --> <bean class="org.springframework.web.servlet.view.internalresourceviewresolver"> <property name="prefix" value="/web-inf/views/"/> <property name="suffix" value=".jsp"/> </bean> when launch app tomcat, following test displayed (which text of /web-inf/views/login.jsp, part working): ...

Pull out information from last line from a if else statement within a for loop Python -

i don't think possible figured ask in case. trying write memory efficient python program parsing files typically 100+ gigs in size. trying use loop read in line, split on various characters multiple times , write within same loop. the trick file has lines start "#" not important except last line starts "#" header of file. want able pull information last line because contains sample names. for line in seqfile: line = line.rstrip() if line.startswith("#"): continue (unless last line starts #) samplenames = lastline[8:-1] newheader.write(new header sample names) else: columns = line.split("\t") more splitting write if not possible other alternative can think of store lines # (which can still 5 gigs in size) go , write beginning of file believe can't done directly if there way memory efficiently nice. any appreciated. thank you if want index of last line starting # , read once using takewhile , ...

javascript - ng-class $window.innerWidth -

i trying find solution add class item if screen width greater x (ie. 1200). ng-class="{ large: islarge() }" $scope.islarge = function () { return ($window.innerwidth >= 1200); } this doesn't work, , wont add class. needs update on browser resize. thinking directive might better option. edit: don't want hear if should done, if can done. you could this. have crafted directive example accomplishes this. chose width of 500 in example easier jsfiddle demo. check out following... <div class="item" resizer></div> .item { background-color: tomato; height: 100px; width: 100px; } .large { background-color: dodgerblue; } app.directive('resizer', ['$window', function ($window) { return { restrict: 'a', link: function (scope, elem, attrs) { angular.element($window).on('resize', function () { $window.innerwidth > 5...

ios - Need to fix autolayout issues with only UIButton's and UILabels -

currently trying use autolayout on ios app in xcode 6. storyboard using consists of uibutton , uilabel elements, resize , fit based on device. works on iphone 6 plus , 6 when 5s or 5 things weird. can't use size classes due both 5s , 6/6p using compact width regular height. there way fix this? all images can found here yes! autolayout there's way. from pictures looks may have vertical constraint on "play" button attached top of view. try putting constraint on "how long" label. way button position relative title instead of whole screen.

matlab - How to operate with binary numbers as if they were a string -

what have is: assume x1= 0 0 1 , x2 = 0 1 0, given number l length give switch positions, let's l=2 (it changes randomly), i'd have switch de numbers this: x1= 0 0 1; x1'= 0 0 0 x2 = 0 1 0; x2'= 0 1 1 what i've done far. each binary number code has value. said, ok, can make vector, position of vector code, , inside value, of course. now, when need access string or bits or code, not sure how call it, i've been looking , i've found 2 functions(that didn't know of before): dec2bin , de2bi . believe second 1 useful creates vector. , guess have vector position 1 l , l+1 n of both x1 , x2, , somehow switch both of (right i'm thinking of using 3rd vector it'd go: x1 xcopy, x2 x1, x1 x2 (the proper halfs, not of vector of course). i'm sure there better ways of doing particular switching, , whole thing. could tell me of better or more useful way of approaching problem? in other languages feel it'd more natural, using map or struct g...

jquery - How to run a javascript function onload? -

http://8animetv.co.vu/ problem when open post link on own loads ugly site. site loads video posts right in list , when click on video title loads post iframe left (where picture is). <iframe name="ifrm" id="ifrm" src="somepicture.png"></iframe> <ul> <li><a href="postlink" target="ifrm">video 1</a></li> </ul> the post site , main site on same html file. need function whenever window.location.href = homepage/post/something instead go http://8animetv.co.vu/ load homepage/post/something iframe. possible? just bind function onload event. window.onload=function(){}; load site iframe want use src property of iframe object. ref: http://www.w3schools.com/jsref/dom_obj_frame.asp

javascript - Getting a string on an update request in KendoUI datasource -

i have pretty simple grid data source retrieves data correctly cause have schema.parse function defined the problem when try update/create new row schema.parse() called again , parameter passed string contains html of page. cannot hell going on there. thanks var _datasource = new kendo.data.datasource({ transport: { read: { datatype: "json", url: layerdefprovider.getlayerurlbyid("surveys") + "/query", data: { f: "json", //token: token, outfields: "*", //outsr: 3857, where: "1=1" }, type: "post" }, create: function (options) { console.debug("called");//never gets called }, update: function (options) { console.debug("ca...

Android 2 Image view with half display in left side and half display in right side -

Image
i drawing linear layout in android display 2 images half image in left side , half image. i draw : but want draw below, can please me draw image below. my layout file here: <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > <linearlayout android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_alignparenttop="true" android:layout_centerhorizontal="true" android:layout_margintop="10dp" android:orientation="vertical" > <linearlayout android:layout_width="fill_parent" android:layout_height="0dp" android:layout_weight="1.5" > <imageview android:id="@+id/sideleft...

sql - MySql Query fetches twice the rows -

i have following query. select a.nume_echipament, a.producator, a.seria, b.uc, b.port, (select starea echipamente order data desc, ora desc limit 1) starea, a.durata_aprovizionare, a.durata_viata, ( select data_aprov aprovizionari nume_echipament='automat_imbuteliere' order date(data_aprov) desc, time(ora_aprov) desc limit 1) data_aprov, ( select ora_aprov aprovizionari nume_echipament='automat_imbuteliere' order date(data_aprov) desc, time(ora_aprov) desc limit 1) ora_aprov, sec_to_time(count(starea)*5) durata_totala date_tehnice inner join echipamente b on a.nume_echipament=b.nume_echipament inner join aprovizionari c on c.nume_echipament=a.nume_echipament a.nume_echipament='automat_imbuteliere' , b.starea='1' , b.data > c.data_aprov , b.ora >c.ora_aprov ; the problem fetches rows twice...

Preventing a spring boot service from failing on startup with Redis not present -

we have number of services use spring boot (v1.2.3) , spring data redis using spring-boot-starter-redis dependency. also using spring session , corresponding redis dependency <dependency> <groupid>org.springframework.session</groupid> <artifactid>spring-session</artifactid> <version>1.0.0.release</version> </dependency> <dependency> <groupid>org.springframework.session</groupid> <artifactid>spring-session-data-redis</artifactid> <version>1.0.0.release</version> <type>pom</type> </dependency> if redis server not started or cannot reached service issues fail , aborts startup. is possible allow service not fail on startup? need setup in order so? note : tracked critical failure down , in redis support spring session. failure thrown here ripples cause s...

c# - Windows Console Application Global IErrorHandler -

i trying find way make exceptions in console application pass trough ierrorhandler (i use denomination because in wcf kind of operation possible ierrorhandler). i searched on google results seem return wcf solutions. what i'm looking solution little bit this console application, in wcf looks easy because can configure behavior each endpoint in windows application think kind of solution can reachable. all exceptions cached, legacy code , calling method handle exception in every catch not solution problem. thanks in advance. you can either bubble exceptions root of console application , wrap in big try/catch handles exceptions, or @ start of console application can add event handler app domain "unhandled exception" event , exceptions go unhandled routed there. using system; using system.security.permissions; public class example { [securitypermission(securityaction.demand, flags=securitypermissionflag.controlappdomain)] public static void mai...

regex - Regular Expression to find CVE Matches -

i pretty new concept of regex , hoping expert user can me craft right expression find matches in string. have string represents lot of support information in vulnerabilities data. in string series of cve references in format: cve-2015-4000. can provide me sample regex on finding occurrences of ? obviously, numeric part of changes throughout string... generally should include previous efforts in question, expect match, etc. since aware of format , easy one... cve-\d{4}-\d{4,7} this matches first cve- 4-digit number year identifier , 4 7 digit number identify vulnerability per new standard. see in action here .

ruby on rails - Configuring the memcached log level -

i'm trying setup memcached logging, can keep track of reads/writtes in cache of rails app. using mac osx development installed memcached homebrew, , starting launchy. my startup file looks ( homebrew.mxcl.memcached.plist ) : <?xml version="1.0" encoding="utf-8"?> <!doctype plist public "-//apple//dtd plist 1.0//en" "http://www.apple.com/dtds/propertylist-1.0.dtd"> <plist version="1.0"> <dict> <key>label</key> <string>homebrew.mxcl.memcached</string> <key>keepalive</key> <true/> <key>programarguments</key> <array> <string>/usr/local/opt/memcached/bin/memcached</string> <string>-vv</string> <string>localhost</string> </array> <key>runatload</key> <true/> <key>workingdirectory</key> <string>/usr/local</string> <key>sta...

How to run specific tasks parallel in Gradle -

i have issues plugins not working when running gradle --parallel switch. still, love run @ least compilation , unit tests in parallel. there way accomplish this? there no way specify specific tasks can executed in parallel. in gradle build hit issues uploadarchives tasks not working --parallel . @ https://github.com/gradle/gradle/blob/master/gradle/fix-gradle-2492.gradle can see how fixed using locks.

ios - How to prevent SwiftSupport libraries to be included twice -

Image
when export our application, firefox ios , .ipa file, swiftsupport directory included twice: ./payload/client.app/frameworks/libswiftcore.dylib ./payload/client.app/frameworks/libswiftcoreaudio.dylib ./payload/client.app/frameworks/libswiftcoregraphics.dylib ./payload/client.app/frameworks/libswiftcoreimage.dylib ./payload/client.app/frameworks/libswiftdarwin.dylib ./payload/client.app/frameworks/libswiftdispatch.dylib ./payload/client.app/frameworks/libswiftfoundation.dylib ./payload/client.app/frameworks/libswiftobjectivec.dylib ./payload/client.app/frameworks/libswiftsecurity.dylib ./payload/client.app/frameworks/libswiftuikit.dylib ./swiftsupport/libswiftcore.dylib ./swiftsupport/libswiftcoreaudio.dylib ./swiftsupport/libswiftcoregraphics.dylib ./swiftsupport/libswiftcoreimage.dylib ./swiftsupport/libswiftdarwin.dylib ./swiftsupport/libswiftdispatch.dylib ./swiftsupport/libswiftfoundation.dylib ./swiftsupport/libswiftobjectivec.dylib ./swiftsupport/libswiftsecurity.dylib ./...

javascript - What are the possible levels of nested quotes in C#? -

i trying directly write javascript variable assignment code on asp.net web page. response.write("<script>ithtml = '"); response.write("<div id=\"pop_ctrl\">select</div><ul id=\"demo_ul\">"); foreach (article in arts) { response.write("<li class=\"demo_li\"><a onclick=\"showarticlecard(" + a.id + ",\'" + a.user + "\',\'" + a.datestring + "\'); return false\"><div>" + it.user + "</div>&nbsp;&nbsp;<div>" + it.title + "</div></a></li>"); } response.write("</ul>"); response.write("';</script>"); anchor tag in markup executes function showarticlecard() on click. function accepts 1 int , 2 string parameters. when trying add c# string variable in place of string parameters, replaces them javascript keyword. tried using ' ,...