Posts

Showing posts from September, 2013

ruby - Rails: Get the DateTime format returned using Jbuilder -

i noticed when returning field type datetime in jbuilder : "2016-11-25t13:25:06.024z" but when in .html.erb page display field "2016-12-21 09:35:05 utc" my question how format of jbuilder in html.erb. what you're seeing in json standard iso-8601 formatted timestamp time in utc (hence z ). can format in rails conveniently named iso8601 method: > time.now.utc.iso8601 => "2016-12-22t04:59:25z" the utc call there ensure time in utc, don't need doesn't hurt , can prevent problems. if want match precision you're getting jbuilder, include precision in iso8601 call: > time.now.utc.iso8601(3) => "2016-12-22t05:01:21.512z"

android - On Back press of second activity, 1st activity gets blank -

i have 2 activities, when go 2nd activity (2nd activity invoked 1st activity) 1st activity , 1st activity gets blank. tried call finish() after startactivity() . directly going home activity. 2nd activity contains fragment. @override protected void onresume() { super.onresume(); mapview.onresume(); } } if right understand question, solution can found in documentation setup parent activity in androidmanifest.xml : <application ... > ... <!-- main/home activity (it has no parent activity) --> <activity android:name="com.example.myfirstapp.mainactivity" ...> ... </activity> <!-- child of main activity --> <activity android:name="com.example.myfirstapp.displaymessageactivity" android:label="@string/title_activity_display_message" android:parentactivityname="com.example.myfirstapp.mainactivity" > <!-- parent activity meta-data support

Redirect private IP server: Apache proxyPass -

i have 2 servers apache; first 1 redirects requests second one. the first server has both public ip , private ip, , second has private ip. this first server's configuration: proxypass /app/ http://192.168.1.50/app/ proxypassreverse /app http://192.168.1.50/app/ proxypassreverse /app/ http://192.168.1.50/app/ proxypass /app http://192.168.1.50/app/ when calls navigator http://www.domain.com/app , css can't load because navigator tries load 192.168.1.50 , know private ip. <link rel="stylesheet" type="text/css" href="http://192.168.1.50:80/app/appdata/htmlsite/static20100831/css/style.css"> how can solved?

python - simple scraper kodi addon syntax failure regex "list exceeds" -

i trying simple kodi addon running limited code knowledge have. i took plugin chefkoch ( github.com/kodinerds/repo/blob…deo.chefkoch_de-2.0.7.zip ) example , rebuilt it, scrapes " http://www.multimedia.ethz.ch/speakers/d_arch " , gives me list of semester child pages "class = "sub-lev3" ". when click links want to list of videos in semester. can until point of choosing semester in "def listvideos" appears have problem. i think first 3 lines 1 make problems, tells list exceed failures in kodi log. content = geturl(url) tbody = re.search('<tbody>(.*?)</tbody>', content, re.dotall).group(1) spl = tbody.split('<tr>') in range(1, len(spl), 1): entry = spl[i] match = re.compile('<li class=\'video\'><a href=\'(.+?)\'', re.dotall).findall(entry) url = match[0] match = re.compile('<span>(.+?)<',

Module - JavaScript: Good Parts. How is this callback getting its arguments? -

i engaging famous "javascript: parts" douglas crockford. awesome book of course. while, may not have been ready yet, thought of giving shot. need understand following example. second argument in replace() takes 2 arguments a , b . defined? how take value? in advance. did refer stack , don't think helped. string.method('deentityify', function ( ) { // entity table. maps entity names // characters. var entity = { quot: '"', lt: '<', gt: '>' }; // return deentityify method. return function ( ) { // deentityify method. calls string // replace method, looking substrings start // '&' , end ';'. if characters in // between in entity table, replace // entity character table. return this.replace(/&([^&;]+);/g, function (a, b) { var r = entity[b]; return typeof r === 'string' ? r : a; } ); }; }( )); functions can written accept other functions arguments. such functions cal

multithreading - Java : Running shell script in background -

im trying run shell script in background not terminate when function/process end. seems despite nohup, when java thread ends. script. below sample code. /// /// tries run script in background /// try { runtime rt = runtime.getruntime(); process pr = rt.exec("nohup sh ./runner.sh > output.txt &", new string[] {}, wrkdir); // pr.waitfor(); // intentionally not using } catch(exception e) { throw new runtimeexception(e); } nohup applies invocations shell, not calling program. there lot of ways solve this, 1 springs mind try modifying java code invoke launcher shell script invokes nohup runner.sh... code (without needing launch sh ). something (untested) code: revised java: /// /// tries run script in background /// try { runtime rt = runtime.getruntime(); process pr = rt.exec("sh ./launcher.sh", new string[] {}, wrkdir); // pr.waitfor(); // intentionally not using } catch(exception e) { throw new runtimee

Address validation regex. What does this Rails validation mean? -

i have rails validation reads: validates :address_line_1, format: { if: :changed?, without: /^[0-9]+$/, multiline: true, message: i18n.t( :missing_street_info, scope: 'activerecord.errors.models.address' ) } what without section mean? regex? multiline key mean?

java - Android pre lolipop toolbar dont work -

i have drawer menu in devises post lolipop work fine in change colors on title , icon navigation in devises pre lolipop dont work , display white bar dont show icon my toolbar <framelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".users.menudrawer"> <android.support.design.widget.coordinatorlayout android:layout_width="match_parent" android:layout_height="match_parent" android:fitssystemwindows="true" > <android.support.design.widget.appbarlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/apptheme.

special character to csv in php -

Image
here current way i'm doing generate csv file in php, $path = $url . 'temp/' .$filename.'.csv'; fputcsv($fp, $heders, ","); foreach ($new_data $line) { fputcsv($fp, $line, ","); } fclose($fp); here problem have, this data have in data set, brüel & kjæ, type 4226, s/n: 2433646 when generate csv file it's change this, brüel & kjæ, type 4226, s/n: 2433646 i need same character csv. please me solve issue :( try this, set utf-8 before getting result both mysqli query , header 1. $mysqli->set_charset("utf8"); and 2. header('content-type: application/csv'); header('content-disposition: attachment; filename=' . $filename); header("content-transfer-encoding: utf-8"); header('pragma: no-cache');

javascript - Break up into smaller functions MVC -

i have following function function registeruser(event) { event.preventdefault(); let userdata = { username: $('#formregister input[name=username]').val(), password: $('#formregister input[name=passwd]').val() }; $.ajax({ method: "post", url: kinveybaseurl + "user/" + kinveyappkey + "/", headers: kinveyappauthheaders, data: json.stringify(userdata), success: registersuccess, error: handleajaxerror }); function registersuccess(userinfo) { saveauthinsession(userinfo); showhidemenulinks(); listbooks(); showinfo('user registration successful.'); } } i'm trying in following way: direction controllers contains registerusercontroller.js file 1 function: function registeruser(event) { event.preventdefault(); let userdata = { username: $('#formregister input[name=username]').val(), passwor

android - How to convert Game Rotation Vector sensor result to axis angles -

refer code below, got 4 numbers game_rotation_vector sensor event , want achieve axis angle rotation of phone. eg. if rotate phone screen counter clock wise 90 degress, want actual value 90deg sensor data. can provide code convert 4 game rotation vector values 3 axis angle values? the values placed unit quaternion like so : sensors_event_t.data[0] = rot_axis.x*sin(theta/2); sensors_event_t.data[1] = rot_axis.y*sin(theta/2); sensors_event_t.data[2] = rot_axis.z*sin(theta/2); sensors_event_t.data[3] = cos(theta/2) so reverse of just: double theta = math.acos(vals[3])*2; double sinv = math.sin(theta/2); double xa = vals[0]/sinv; double ya = vals[1]/sinv; double za = vals[2]/sinv; but xa, xy, , xz aren't angles, they're coordinates of axis described in documentation. i'm not sure want these, better off trying achieve unstated goal unit quaternion directly. the reason unit quaternion used avoid gimble lock , cannot describe every possible rotation i

java - Servlet external config file requires full path -

i've looked @ number of related cases here on stackoverflow related this, deal situation of deciding put external files , access them, quite clear. in situation, have java ee application needs use third party library reads external config file determine location of file. using eclipse , tomcat. the external config file has line reads like: filename=[path] , path expected full path name file. i have no way of knowing how access file, save specifying /web-inf/classes/file or file not work, library can't find it. when put full name /users/.../file on local machine, can find it. as intended deployed on production server in cloud, solution put needed file in cloud storage, set config file point absolute location ?

database - Way to implement Data Model ( activities feature ) -

Image
i have generic architectural question of data model. have social network. network has standard functionality such add friends; add photos; change profile; e.t.c; each of them actions begets different notifications (or activities) cab views in special screen user's friends. example can see similar functionality in instagram. looks like: in fact feature popular feature in screen. result personality , can't cached effectively. so, according or vision can propose 2 variants how can storage data: we can prepare list of notifications each user in moment when events occurred. allows reduce difficulty of query during getting activities. have load after each event. imagine user has 500 000 friends, each of them should see activities, need make 500 000 inserts in feeds of each user. therefore have additional overhead disk space , cpu. second approach saving notification in single instance in table, , composing feed each user during extracting notifications. have

IPN Paypal with javascript -

i want use paypal ipn website, using javascript, not know value of "e" on function dopost(e). how script in place in .html or .js listen. and please if can way other references? function dopost(e) { var isproduction = false; var strsimulator = "https://www.sandbox.paypal.com/cgi-bin/webscr"; var strlive = "https://www.paypal.com/cgi-bin/webscr"; var paypalurl = strsimulator; if (isproduction) paypalurl = strlive; var payload = "cmd=_notify-validate&" + e.postdata.contents; payload = payload.replace("+", "%2b"); var options = { "method" : "post", "payload" : payload, }; var resp = urlfetchapp.fetch(paypalurl, options); //handshake paypal - send acknowledgement , verified or invalid response if (resp == 'verified') { if (e.parameter.payment_status == 'completed') { if (e.parameter.receiver_email == 'receiver@

wsdl - Is there a possibility of using Custom Properties to set binding value in SoapUI -

Image
i running test soapui, there fail due not find custom properties of project in binding value. nullpointerexception when run tests command-line, though test run successfully. in soapui cannot define binding value while can other properties definition url. know possiblity of using project properties in binding value? edit i need define variable binding value depending on custom properties because need run test in different environments. able same definition url, ${#project#hostnameandport}/${#project#servicebatchpath}/wsdlname

Git: Zombie submodule -

so i've somehow managed create zombie git submodule. $ cat .gitmodules [submodule "source/crashprobe"] path = source/crashprobe url = https://github.com/bitstadium/crashprobe.git git thinks submodule untracked: $ git status on branch master branch up-to-date 'origin/master'. untracked files: (use "git add <file>..." include in committed) source/crashprobe/ deinit doesn't work: $ git submodule deinit source/crashprobe error: pathspec 'source/crashprobe' did not match file(s) known git. nor this: $ git rm --cached source/crashprobe fatal: pathspec 'source/crashprobe' did not match files ... despite fact that: $ ls .git/modules/source/crashprobe/ fetch_head gitdir objects head hooks packed-refs branches index refs config info sourcetreeconfig description logs nor this: $ git config -f .git/config --remove-section so

How to delete a remote branch in Mercurial? -

apparently strip works on local branch want delete remote branch. anything equivalent these git command mercurial? git push origin —delete [branch_name] git branch -d [branch_name] you cannot delete remote branch ever. stripping , hist-editing strictly local operation. need access server , strip there (maybe that's possible via web-interface, e.g. on bitbucket). the exception - degree - if changesets of phase draft , remote server configured non-publishing server. can obsolete changesets on remote server (but not delete them either).

sql server - How to get child data from a self referencing table in sql -

Image
i using sql 2012 , have self referencing table have 3 levels. table structure below: table structure i have table referencing table, have id foreign key, if foreign key table 6, need show 6 "aaa" , child node of "aa" child node of "a". need drill down lower level , lower level should able go upper level. can go second level. below structure of table references other table. so report on both these table , final output should : if question not clear please ask try , clarify it. assuming depth of category tree not more 3 levels, should work: declare @catergory table ( id int not null, name nvarchar(10) not null, parentid int null ) declare @customer table ( id int not null, name nvarchar(10) not null, surname nvarchar(10) not null, address nvarchar(30) not null, categoryid int not null ) insert @catergory (id, name, parentid) values (1, 'a', null), (2, 'b', null), (3, 'c',

sql - How do I write stored procedures to update one table of one schema from another table of a different schema? -

i made mistake of updating table, data should of not of. tried flashback, table seem large, flashback statement. think might able take data dev server production server. created user schema on production server , imported data need sort of fix update mistake. there thousands of rows, affected. can me on how update table data 1 schema table in different schema, on same database. want write stored procedure , loop on through , update. sort of have idea, , been googling it. don't know how call or differentiate table names in different schemas inside stored procedure. thank if understanding question correctly, asking how write query different schemas. all need prefix table name schema name. example schema: cat , schema dog select * cat.food cf join dog.food df on cf.sustinanceid = df.sustinanceid the same concept applies insert or update . prefix schema name.

java - JavaFX rectangle mouseonclick grid return -

i writing board game has 20x20 grid. this in board class: private final position[][] grid = new position[grid_size][grid_size]; each position has : public class position { private final coordinates pos; private player player; private final static double rectangle_size = 40.0; private final rectangle rect = new rectangle(rectangle_size, rectangle_size); } so have 20x20 positions , each positions has rectangle this display grid for (int cols = 0; cols < grid_size; ++cols) { (int rows = 0; rows < grid_size; ++rows) { grid.add(gameengine.getboard().getgrid()[cols][rows].getrect(), cols, rows); } } anyway, grid initialized , works properly. want make rectangle objects clickable , able return coordinates when clicked. this how handle mouse click private void setuprectangle() { rect.setonmouseclicked(new eventhandler<mouseevent>() { @override public void handle(mouseevent event) { rect.setfi

xpath - GoLang - XmlPath Selectors with HTML -

i looking @ documented example here , iterating purely on xml tree, , not html. therefore, still partly confused. for example, if wanted find specific meta tag within head tag name, seems cannot? instead, need find order in head tag. in case, want 8th meta tag, assume is: headtag, err := getbyid(xmlroot, "/head/meta[8]/") but of course, using getbyid function tag name - don't believe work. what full list of "getby..." commands? then, problem is, how access meta tag's contents? documentation provides examples inner tag node content. however, example work?: resp.query = extractvalue(headtag, @content ) the @ selector confuses me, appropriate case? in other words: is there proper html example available? is there list of correct selectors ids, tags, etc? can tags found name, , content extracted inner content tag? thank much! xpath not seem suitable here; should using goquery , designed html. here example: package

telerik - Kendo ComboBox is showing four loading gears while fetching data from server -

kendo combobox showing 4 loading gears when fetching data server instead of one. design or bug? how can fix it? steps reproduce: visit http://demos.telerik.com/kendo-ui/combobox/serverfiltering in chrome open developer tools -> network -> check offline now type 3 characters. this bug, background-repeat , background-position styles seem missing in latest kendo ui version. can add them manually until fix applied out-of-the-box: .k-i-loading, .k-loading, .k-loading-image { background-repeat: no-repeat; background-position: center center; }

mysql - Creating a yes or no questionnaire in PHP -

i have scenario in users complete quiz. rubricks follows: a series of questions radio button next them either yes or no each question either +1 or -1 given answer of yes or no each question falls own category (so user score per category) this data collected , presented user the questions category can in random order my thought process is, have users table in database questions table , answers table. the question table include id, question itself, category falls into. the answer table have question id , correct answer (in case either yes or no). when page loaded x amount of questions grabbed database , put form. the user completing quiz have score each section associated them, perhaps in score table. this updated when user submits form. programmatically, work, or on inflating issue? possible. possible , can implemented. you can ensuring have user table store unique primary id user number of categories can have different table or can in single table g

c++ - How does std::setw work with string output? -

i trying use set width setw string output output file, however, not able make work. have me following example. // setw example #include <iostream> #include <iomanip> #include <fstream> int main () { std::ofstream output_file; output_file.open("file.txt"); output_file << "first" <<std::setw(5)<< "second"<< std::endl; output_file.close(); return 0; } edit: above lines expected have many spaces between first , second , first second i hardly see spaces, output comes firstsecond think missed working of setw() note: integers, works fine just: output_file << 1 <<std::setw(5)<< 2 << std::endl; what doing wrong??. i suspect understanding of std::setw not correct. think need more along lines of combination of: std::setw setting field width std::setfill setting fill character std::left , std::right , std::internal s

html - CSS Foundation making left div go below right div on small screens -

i have layout header have title bar , , 2 divs. div on left takes 4 columns on big screens , 1 on right takes 8 columns . 1 on right has image takes whole div's width. on small screens left div go below right div, problems on small screens left div disappears under right div. html: <div class="header row row-wrapper"> <div class="frontpage-header-content"> <?php while ( have_posts() ) : the_post(); ?> <div class="large-4 medium-12 columns lcol"> <h3><?php the_title(); ?></h3> <div class="border"></div> </div> <div class="large-8 medium-12 columns rcol"> <div class="hero-image-wrapper"> <?php the_post_thumbnail(); ?> <div class="overlay"></div> </div> </div> </div> <div class="header-title-bar"&

javascript - Golden-layout + Angular is generating memory leak -

i'm having problem big memory leaks using angular , golden-layout in project. now, noticed examples angular leaking... to prove leak added small function topratedcontrollertag() userdetails controller holds information "selected user" panel. after closing panel, there lot of detached dom tree items , can still see function, not supposed happen. here minimal code demonstrating this: http://codepen.io/jpmp/pen/xpqzrw i'm using google developer tools. edit: link issue on golden-layout github.

Is it possible to add customized key, value to MySQL config file my.cnf and use it with sql statements? -

our company has set of offices, each 1 have it's own local mysql database. of tables has field called office_name has default value current office name. office_name="ny" is possible define office name in my.cnf , , value , use sql statements execute create tables default value office_name ? also each office has own rations calculate things, possible define values in my.cnf file , them in side defined predicate or function

vb.net - Encrypting the Connection String values in App.Config file -

so have code in app.config <appsettings> <add key="dtsrc" value="fmdbms01"/> <add key="initcat" value="training"/> <add key="userid" value="mysa"/> <add key="password" value="mypassword"/> <add key="clientsettingsprovider.serviceuri" value=""/> </appsettings> when found interesting article here encrypts sa username , password, tried using it. however, works same format illustrated in link, wish encrypt data is, tried using decrypt appsettings %windir%\microsoft.net\framework\v2.0.50727\aspnet_regiis -pef "appsettings" "c:\users\mypcname\documents\visual studio 2010\projects\project\project\" where "c:\users\mypcname\documents\visual studio 2010\projects\project\project\" is file location of web.config, error states there illegal characters in path then used this %windir%\mi

c++ - How to get reference to clicked sf::CircleShape? -

in sfml program storing drawn circleshapes in vector. how reference 1 on clicking mouse button? there's no shape.makeclickable() function in sfml, have is: sf::circleshape* onclick(float mousex, float mousey) {//called each time players clicks (sf::circleshape& circle : vec) { float distance = hypot((mousex - circle.getposition().x), (mousey - circle.getposition().y)); //checks distance between mouse , each circle's center if (distance <= circle.getradius()) return &circle; } return nullptr; } with vector in class: std::vector<sf::circleshape> vec; edit circles have clicked-on, , not first 1 finds : std::vector<sf::circleshape*> onclick(float mousex, float mousey) {//called each time players clicks std::vector<sf::circleshape*> clicked; (sf::circleshape& circle : vec) { float distance = hypot((mousex - circle.getposition().x), (mousey - circle.getposition().y)); /

ios - why the xcode build app for the i386 architecture when the build active architecture only is set to no in debug? -

i got third party library not support i386 , in debug mode when build active architecture set no, xcode build fail i386. in release configuration , set build active architecture no , seems not build i386.so app build success.what's reason in it? how xcode judge whether build i386 or not?

Horizontal Scroll to display PDF in Swift -

i have collection view users can download , view pdf file in web view. app landscape vertical scroll feels weird, want make scroll horizontal. possible in web view? or must use scrollview instead? in swift. i'm using alamofire download , destination: let documentsurl = nsfilemanager.defaultmanager().urlsfordirectory(.documentdirectory, indomains: .userdomainmask)[0] let fileurl = documentsurl.urlbyappendingpathcomponent("\(magazineobject.title).pdf") return fileurl } here's code view pdf class redirectmagazineviewcontroller: uiviewcontroller { @iboutlet weak var webview: uiwebview! @iboutlet weak var activityindicator: uiactivityindicatorview! var receivedata: nsurl! var receivetitle: string = "" override func viewdidload() { super.viewdidload() print("receivedata 2ndvc =>\(receivedata)") self.navigationcontroller?.navigationbarhidden = false self.title = re

html - jQuery Regex not picking up -

ok, have checked 4 different questions , none have given me answer. :( a website working on had few hundred pages unfortunately structure of tags in url has changed. , guess what, pages hard coded text , links (fml) anyway quick fix query change these links. i decided try using this: $(document).ready(function() { $('a').each(function() { var str2 = "tag="; var link = $(this).attr('href'); if(link.indexof(str2) != -1){ var link = link.replace("/tag=.*/","tag/$1"); $(this).attr('href', link); } }); }) what need value of 'href' scan 'tag=ecommerce' or 'tag=b2b' etc , change structure 'tag/eccommerce' or 'tag/b2b' however not working. what missing? you need use regex syntax /yourregex/ instead of "/yourregex/" . , use capturing group so: $(document).ready(function() { $('a').each(function() { var str2 = &

cakephp - VueJS - 2 controllers in 1 file -

how make 2 controllers work in 1 view? for example, view simplified (using cakephp 3's element page rendering): <div id="main"> <div id="sub"> <?= $this->element('main/sub'); ?> </div> </div> and controllers (i use requirejs): require(['jquery', 'vue'], function ($, vue) { return new vue({ el: '#main', data: { }, }); }); require(['jquery', 'vue'], function ($, vue) { return new vue({ el: '#sub', data: { }, }); }); i keep getting error , data in #sub won't render in dom. vue.js:1141 [vue warn]: avoid using reserved keywords in expression: return false; i'm new vuejs i'm unsure if correct setup or not. requirejs.config({ baseurl: 'js', // app base url paths: { vue: 'lib/vue', // /js/lib/vue.js library component1:

css - Simple Label in material-ui AppBar -

i wanted have simple label displayed in right part of appbar. i'm using iconelementright prop , pass disabled flat button: <appbar iconelementright={<flatbutton label="my label" disabled={true}/>} /> this feels terrible couldn't find different way without having own styling. i tried simple div styles terribly: <appbar iconelementright={<div><span>mylabel<span></div>} /> <div style="border-radius: 0px; transition:450ms cubic-bezier(0.23, 1, 0.32, 1); width: 100%; color: rgba(0, 0, 0, 0.87); padding-right: 24px; padding-left: 24px; font-family: roboto, sans-serif; display: flex; position: relative; z-index: 1100; box-sizing: border-box; box-shadow: 0px 1px 6px rgba(0,0,0,0.12), 0px 1px 4px rgba(0,0,0,0.12); background-color: rgb(250, 250, 250);"> <button tabindex="0" style="background: none; margin: 1px 8px 0px -16px; padding: 12px; border: 10px currentcolor; transi

c# - Mouse hook getting disconnected -

i'm trying implement color picker takes color pixel everywhere in screen. i'm planning use global mouse hook listen wm_mousemove in order update color mouse moved around , listen mouse clicks confirm (wm_lbuttondown) or cancel(wm_rbuttondown) operation. i have followed 1 of many tutorials around , came (in console application, test out if process works): static intptr hook; static bool click; static nativemethods.lowlevelhookstruct llhs; static void main(string[] args) { hook = nativemethods.setwindowshookex(nativemethods.wh_mouse_ll, mousehookcallback, (intptr)null, 0); if (hook != intptr.zero) { console.writeline("hook set"); while (!console.keyavailable) { console.writeline("{0} {1} {2}", hook, llhs.pt.x, llhs.pt.y); if(click) console.writeline("click!"); click = false; system.threading.thread.sleep(250); } } } and public static intptr mousehookcallback(int ncode, intptr wparam, intptr

java - How to add text in between a sentence using regex? -

my input <option value="" disabled selected hidden> the output should this: <option value="" disabled="disabled" selected="selected" hidden=""> then tried code; final string regex_disabled = "(?<=option value=\"\" disabled)(?=.*)"; final string replace_disabled = "=\"disabled\""; pattern disp = pattern.compile(regex_disabled); matcher dism = disp.matcher(text); text = dism.replaceall(replace_disabled); final string regex_selected = "(?<==\"disabled\" selected)(?=.*)"; final string replace_selected = "=\"selected\""; pattern selp = pattern.compile(regex_selected); matcher selm = selp.matcher(text); text = selm.replaceall(replace_selected); final string regex_hidden = "(?<==\"selected\" hidden)(?=.*)"; final string replace_hidden = "=“”"; pat

javascript - Vue.js - How to make a numbered input list -

using vue.js version 2.0 i have code, produces list array. inserts each array item inside input field: <div class="form-horizontal" id="portedittab2"> <div v-for="list in namelist"> <div> <label class="col-sm-1 control-label" for="namelist">1</label> <div class="col-sm-10"> <input v-bind:value=list.namelist type="text" id="namelist"> </div> </div> </div> </div> here vue instance: var portedittab = new vue({ el: '#portedittab2', data: { namelist: [] } }); as code stand right now, if, example, 'list.namelist' has 3 items in array, put each of 3 items in own input fields. what want able put label next each input field, , want numbers going 1 many input fields are. currently, <label> field

multithreading - Building BLAS, ATLAS and LAPACK without OpenMP support -

i have been using prebuilt linear algebra libraries use openmp parallelize execution. right working in project openmp parallelize tasks. set environment variable omp_num_threads. some threads make use of blas , lapack linear algebra routines. these libraries parallel , take @ environment variable omp_num_threads see number of threads have use. for requirements of project. need avoid nested parallelization making use of non parallel blas , lapack implementation. what best library , how can built? thank in advance. you can use openblas. library includes 1 version of lapack routines , quite flexible respect threading. the number of threads can defined either @ compile time : $shell> make use_thread=0 or using explicit environment variable : export openblas_num_threads=4 or using library api @ runtime: void openblas_set_num_threads(int num_threads);

javascript - Dynamically add jQuery multidatepicker "addDisabledDates" property -

i using jquery multi datepicker in html. need change datepicker setting property dynamically i.e, when choose "normal" option in select box disabled "saturday" , "sunday" in calendar , when choose "custom" option in select box disabled custom days. dont know how specify in code. code $('#datepick').multidatespicker({ beforeshowday: disablespecificweekdays, // disabling "sundays" dateformat: "d/m/yy", maxdate: "+3m", mindate: "-1m", multidate: true, adddisableddates: my_array }); function disablespecificweekdays(date) { var theday = date.getdate() + '/' +(date.getmonth() + 1) + '/' + date.getfullyear(); var day = date.getday(); return [day != 0 && day != 6]; } please 1 me place it? assuming have dropdown this: <select id="my-dropdown"> <option value="normal">normal</option>

docker - pod is not starting on gcloud container registry -

how can start pod (container) on gcloud using kubectl? push container registry, not start. describe pod. error are: back-off restarting failed docker container error syncing pod, skipping: failed "startcontainer" "target" crashloopbackoff: "back-off 2m40s restarting failed container=target pod=target-qehzu_default(e951a0c1-9b60-11e6-aded-42010af0019f)"

java - Database error recovering from misfires Qualtz -

i configured quartz use scheduled jobs database. when start scheduler with: try { // grab scheduler instance factory scheduler scheduler = stdschedulerfactory.getdefaultscheduler(); // , start off scheduler.start(); scheduler.shutdown(); } catch (exception se) { log.log(loglevel.error, se.getmessage()); } the config file of project looks like: org.quartz.scheduler.instancename = databasescheduler org.quartz.scheduler.skipupdatecheck = true org.quartz.threadpool.threadcount = 3 org.quartz.jobstore.class = org.quartz.impl.jdbcjobstore.jobstoretx org.quartz.jobstore.driverdelegateclass = org.quartz.impl.jdbcjobstore.mssqldelegate org.quartz.datasource.mydb.driver = com.microsoft.sqlserver.jdbc.sqlserverdriver org.quartz.datasource.mydb.url = jdbc:sqlserver://server:1433;databasename=schedules org.quartz.datasource.mydb.user = sa org.quartz.datasource.mydb.password = password

java - “IllegalStateException: Incompatible execution data for class in…” exception from Jacoco when run for an existing ear -

i’m trying test legacy big fat ear (app.ear) application using arquillian , testng. run test have added testable war file (test.war) in existing app.ear , deployed on wildfly 10 server remotely. @deployment public static enterprisearchive createdeployment(){ return shrinkwrap.createfromzipfile(enterprisearchive.class, new file("../earapp/target/earapp-0.0.1-snapshot.ear")) .addasmodule(testable.archivetotest(shrinkwrap.create(webarchive.class, "test.war") .addclass(currencyconvertertest.class) .addaswebinfresource(emptyasset.instance, "beans.xml"))); } the next part of requirement code coverage report after tests run. i’m using jacoco , running jacoco maven plugin. <plugin> <groupid>org.jacoco</groupid> <artifactid>jacoco-maven-plugin</artifactid> <version>0.7.7.201606060606</version> <executions> <execution>

testing - End to End test with ionic 2 -

i trying perform tests in ionic 2 application based on question , relevant links. have gone through referenced project , have read instructions. unfortuantely, not run test protractor . have in package.json file: "protractor": "^4.0.9", "protractor-jasmine2-screenshot-reporter": "^0.3.2", i need in .spec.ts file import: import { elementfinder, element, } 'protractor'; otherwise element , by not found. i not use gulp file or typings since obsolete ionic 2 . instructions refer tests order conf.js file, not exist in sample project (anymore?). when run test karma start diverse errors on selenium-webdriver or websocketserver . what need in order tests run protractor ?

java - Is it possible to allow Gson to just skip fields with wrong types? -

i have class sdk don't have access change, serialize json-valid string into. however, external api puts in wrong type date field. long story short: can ignore errors in gson, or tell gson ignore errors on fields, , partial object? for example, field should double, date(number) instead. i'm not using anyway, don't care, , don't need whole process fail. want parcable fields out, faulty fields left null. note: writing deserializer creates object want have created gson defeats purpose propose. this line of code fails, because single field wrong: customer customer = gson.fromjson(settings.getcustomerobjectjsonstring(), customer.class); i skip field cannot parse, because don't have access customer class, generated sdk/library. i'm aware of 2 options. you can use a json deserializer implementation parse json elements on own. following example affect double , double fields whatever dtos passed single gson instance, , such behavior can de

javascript - JQuery select dropdowns by id using AND and OR operators combination -

$(document).ready(function(){ if( $("#disaster_1,#genre_id_1,#area_id_1").change("background-color", "yellow")) { alert("threee changed"); } else{ $("#disaster_1,#genre_id_1").css("background-color", "red"); } }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> <h1>welcome web page</h1> <h2>nice meet you</h2> <div>very nice indeed.</div> <p>how you?</p> <p>i'm fine, <span>thanks.</span></p> <select name="area_id[1]" id="area_id_1" class="adminclass"> <option value="0" disabled selected>select area...</option> <option value="1" >tallu

ios - How to delete rows from UITableView based on date -

i have uitableview displaying entries, , underlying array entries. want delete entries older specific number of days. my question is, performant way that? go through array, compare dates , delete old entries , delete corresponding rows in tableview or go through tableview's rows, compare dates , delete rows , corresponding entries in array does know best way this? there "best" way?

recursion - Generating a list of all possible combinations of true or false for n given variables in LISP -

i want define function takes input "n" (the number of variables) , return possible truth values. here, represent truth values variable (1 <= <= n) +i representing true, , -i representing false. for example: (generate-values 2) should return: ((2 1)(2 -1)(-2 1)(-2 -1)) (generate-values 3) should return: ((3 2 1)(3 2 -1)(3 -2 1)(3 -2 -1)(-3 2 1)(-3 2 -1)(-3 -2 1)(-3 -2 -1)) here incorrect attempt: (defun generate-values (n) (cond ((equal n 0) nil) (t (list (cons n (generate-values (- n 1))) (cons (- 0 n) (generate-values (- n 1))))))) i know why incorrect, not able find way generate (3 2 1) , move on (3 2 -1) . program outputs: ((3 (2 (1) (-1)) (-2 (1) (-1))) (-3 (2 (1) (-1)) (-2 (1) (-1)))) any question qould thoroughly appreciated! thanks! it might easiest approach in easiest way possible, , figure out how make bit simpler or more efficient afterward. if you're doing recursively, it's important consider