Posts

Showing posts from June, 2012

symfony - How to concatenate a Twig variable in Javascript -

i have twig template contains javascript code. in control pass array template. i'm using javascript display map using google maps api javascript . created variable incremented @ each loop round when creating markers. variable want use variable access each element of table according given index. since array in twig, index in javascript. concatenation seems complicated. here's line concerned question : infowindow.setcontent('<div><strong>{{ services['+j+']["name"] }}</strong><br>'); and here' full example: var j = 0; var markers = locations.map(function(location, i) { var marker = new google.maps.marker({ position: location }); service.getdetails( { placeid: 'chijn1t_tdeuemsrusoyg83fry4' }, function(place, status) { google.maps.event.addlistener(marker, 'click', function() { infowindow.setcontent('<div><strong>{{ servic

how to convert array in php -

this question has answer here: convert multidimensional array single array 10 answers hi got array database. array (size=4) 0 => array (size=1) 0 => array (size=1) 'email_1' => string 'denise@aaa.com' (length=18) 1 => array (size=1) 0 => array (size=1) 'email_1' => string 'denise@aaa.com' (length=18) and need this array (size=4) 0 => array (size=1) email_1' => string 'denise@aaa.com' (length=18) 1 => array (size=1) 'email_1' => string 'denise@aaa.com' (length=18) i tried array_merge , all. no idea how archive this? do below:- $final_array = array(); foreach($original_array $key=>$val){ $final_array[$key][] = $val[0][

php - Doctrine Entity Relationship -

am having bit of challenge creating entity relationship between product category , associated color(s) following entities (i omitted getters , setters though): #product /** * product * * @orm\table(name="product") * @orm\entity(repositoryclass="appbundle\repository\productrepository") */ class product { /** * @var int * * @orm\column(name="id", type="integer") * @orm\id * @orm\generatedvalue(strategy="auto") */ private $id; /** * @var string * * @orm\column(name="name", type="string", length=255) */ private $name; /** * @var float * * @orm\column(name="price", type="float") */ private $price; /** * @var int * * @orm\column(name="category", type="integer") * * many products have 1 category * * @orm\manytoone

python - Fast way to sample geometric points from SVG paths -

i'm using excellent svgpathtools library in python 3 work paths in svg file, created in vector drawing application. i'd create detailed point arrays each of paths contained within svg, points equidistant along path. following that, becomes unbearably slow if more few thousand samples taken. samples_per_px = 1 fname = "/path/to/file.svg" paths, attributes = svg2paths(fname) mypaths = {} path,attr in zip(paths, attributes): mypathlist = [] pathlength = path.length() pathcolour = attr['stroke'] numsamples = int(pathlength * samples_per_px) in range(numsamples): #parametric length = ilength(geometric length) mypathlist.append(path.point(path.ilength(pathlength * / (numsamples-1)))) mypaths[pathcolour] = np.array(mypathlist) i've felt python ain't real pythonic. there way can take advantage of pythoness speed up? wiki

html - font-weight on vector icons breaks elements alignment -

Image
i have div containing vector icon (in example, fontawesome icon). the icon horizontally aligned right , expect on edge of container (the div ). works expected can see here (you'll have zoom lot) https://jsfiddle.net/k0h56myn/ where icon , bottom border start @ same x coordinate (the red line show perfect pixel alignment): adding font-weight: 700; style icon breaks alignment, see below: i assume font-weight "expand" icon n pixels, not caring @ of object repositioning , alignment.. right? do have trick prevent in order have perfect , ocd-approved alignment? there no position (alignement) changed here. act normal fonts. while adding font weight, font become bold. text fonts only. not issue. wiki

java - Incompatible types: Required: T Found: Object - IntelliJ -

there method (abbreviated) in project i'm working on: public <t> t query( final extractor<t> extractor, final list result) { //... return extractor.extract(result) //... } with extractor defined as: public interface extractor<t> { t extract(list<map<string, object>> result); } in eclipse there isn't error intellij refuses compile class incompatible types: required: t found: object , way if cast return value t or return object instead , can't figure out why failing. you need add type argument parameter: query(final extractor<t> extractor, final list<map<string, object>> result){ the error message because of type mismatch( raw type ). here docs raw type: raw types show in legacy code because lots of api classes (such collections classes) not generic prior jdk 5.0. when using raw types, pre-generics behavior — box(in case list) g

sql - Performance of Inner Join vs Cartesian product -

possible duplicate: explicit vs implicit sql joins i want know difference in performance of select * a,b,c a.x = b.y , b.y = c.z and select * inner join b on a.x = b.y inner join c on b.y = c.z basically want know if inner join performs better cartesian product? also, in inner join cartesian product carried out internally? first of these 2 operations 2 different purposes , while cartesian product provides result made joining each row 1 table each row in table. while inner join (sometimes called simple join ) join of 2 or more tables returns rows satisfy join condition. now coming have written here : in case of cartesian product first table comprising of a,b,c created , after on basis of ever condition given,we result. see it's heavy process. on other hand inner join chooses result fulfilling given condition .hence it's better solution achieving end results. first 1 abuse of sql language. wiki

string - R: get dataframe row with specific characters -

i need detect rows of df/tibble containing specific sequence of characters. seq <- "rt @aventussystems" sequence df <- structure(list(text = c("@aventussystems wow, upgrade of investor", "rt @aventussystems: recent article our investors shown in forbes! t.co/n8ogwiedpu #aventus #globaladvisors #4thefans #ti…", "@aventussystems nice have project", "rt @aventussystems: join #ticketrevolution #aventus today! #aventus #ticketrevolution #aventcoin #4thefans t.co/oplycfmw4a" ), tweet_id = c("898359464444559360", "898359342952439809", "898359326552633345", "898359268226736128"), created_at = structure(c(17396, 17396, 17396, 17396), class = "date")), .names = c("text", "tweet_id", "created_at"), row.names = c(na, -4l), class = c("tbl_df", "tbl", "data.frame")) select(df, contains(seq)) # tibble: 4 x 0 sapply(df$t

vba - Public variable goes out of scope -

my public variables losing scope when execution moves sub in different module. can't fathom why happening. module a: option compare database public db dao.database public xlapp excel.application sub main() dim db dao.database set db = currentdb processfiles ' upload data report files appendtopentana ' transfer data main tables pentana export table producefinalexport ' export final data excel end sub module b: sub processfiles() dim recset recordset ' open recordset containing keywords in file names identify area set recset = db.openrecordset("tblfiles") ' rest of code end sub in module b variable db has been set nothing , object ref error. i've tried using older 'global' declaration rather public same result. public variables commonly used, don't what's going wrong here. sub main() dim db dao.database set db = currentdb you have additional local variable db in main , , 1 set. local variables

angularjs dom manipulation based on button click -

basically want change attribute value based on button clicked, these 2 buttons <button ng-click="fn(a)"></button> <button ng-click="fn(b)"></button> and have prebuilt directive takes value input, <div directive-name="" id="abc"></div> if click on first button,i want value of directive based on button clicked. what did earlier; $scope.go = function(data){ if(data==a){ var b = document.queryselector( 'div' ); b.setattribute("directive-name","value"); } else{} } here problem is selecting first div of document , setting attribute value that. tried pass id like var b = angular.element(document.queryselector('#abc')); i saw custom directives so, not working angularjs dom manipulation through directives if possible provide me demo in plunkr or fiddle and if want change css property of div based on button clicked thanks in advance you can this.

mysql - Database design for a tutorial web application -

we have requirement of creating tutorial kind of application, there list of topics , each topics have sub topics. user can enroll topic, , go through sub topics , mark sub topics "completed". opting use mysql relational db. so. there typically 3 master tables, users topics sub_topics we planning continue approach making mapping tables ' users , topics ' i.e ' user_topics ' contains column user_id , topic_id , is_enrolled , mapping table track completion status of sub topics, may ' user_sub_topics ' contains user_id , sub_topic_id , topic_id , is_completed is best way design db? or other work around can done? here few queries need data topic list display list of topics completed label if user has completed sub topics (join query help) topic detail page display list of completed sub topics too please suggest first have design such relational database finding relations between entities , study bit er or extended er dia

javascript - incorrect run php by button click -

i have php function update records in data table , need run click button in html. my php function this: <?php try { $sql = 'select id_data, date_record, value1, value2, value3 data '; $s = $pdo->prepare($sql); $s->execute(); } catch (pdoexception $e) { $error = 'error select data' . $e->getmessage(); include 'error.html.php'; exit(); } while ($row = $s->fetch()) { $dane[] = array( 'id_data' => $row['id_data'], 'date_record' => $row['date_record'], 'value1' => $row['value1'], 'value2' => $row['value2'], 'value3' => $row['value3'] ); } if (isset($_get['edytion'])) { foreach ($data $data2) { try { $sql = 'update data set date_record = :date_record, value1 = :value1, value2 = :value2, value3 = :value3 id_data= :id_data'; $s = $pdo->prepare($sql); $s->bindvalue(':

javascript - Form fields / Placeholder and value -

i have form field want change if condition true. <input type="email" name="useremail" id="useremail" class="form-control" ng-class="{'invalid-signup': signupform.useremail.$invalid && signupform.useremail.$dirty, 'valid-signup': signupform.useremail.$valid && signupform.useremail.$dirty}" placeholder="primary contact email." ng-required="true" ng-maxlength="30" ng-minlength="5" ng-model="signupmodel.useremail"/> <div ng-show="signupform.useremail.$dirty && signupform.useremail.$invalid"> <p ng-show="signupform.useremail.$error.required">email required.</p> <p ng-show="signupform.useremail.$error.pattern">email not valid.</p> <p ng-show="signupform.useremail.$error.minlength">email short, min 5 characters.</p> <p ng-show="

c# - Get Regedit values from Published Web Site -

i have web site , want values regedit. tried , working on localhost; registrykey = registry.currentuser.opensubkey("software\\neyya", true); if (mykey == null) mykey = registry.currentuser.createsubkey("software\\neyya"); _filesystemstorelocation = mykey.getvalue("filestorepath", "").tostring(); when publish website on local machine, code not me. , tried this; registrykey mykey; mykey = registrykey.openremotebasekey(registryhive.localmachine, "desktop-a1jj95k"); mykey = registry.currentuser.opensubkey("software\\neyya", true); if (mykey == null) mykey = registry.currentuser.createsubkey("software\\neyya"); _filesystemstorelocation = mykey.getvalue("filestorepath", "").tostring(); but not working neither. thanks help. wiki

c# - How to set recovery action for windows service -

Image
i looking solution how set recovery action when service fails programmaticaly in c#. there 4 options under service | properties | recovery. default 1 "take no action". set "restart service" external program written in c#. can start/stop service program don't find anyway set recovery action ("restart service"). to run external program, select "run program" option , fill in details: your c# program can restart service if happen. wiki

excel vba - How to minimize userform when workbook is maximized -

i have problem, please me! story: have userform in excel 2016 (64bit), userform activity in multi workbook. steps: open userform open more 2 workbooks minimize userform, minimize workbook we're opening maximize workbook minimized @ 3. how show userform minimize mode? used showwindow lhwnd, sw_show (sw_show = 2), showwindow doesn't work. can me @ step 5? thank much!!! source: private declare ptrsafe function showwindow lib "user32" (byval hwnd long, byval ncmdshow long) long <br> private declare ptrsafe function findwindow lib "user32" alias "findwindowa" (byval lpclassname string, byval lpwindowname string) long public function showwin(strclassname string, strwindowname string, lngstate long) 'get window handle. dim lngwnd long dim intret integer lngwnd = findwindow(strclassname, strwindowname) showwind = showwindow(lngwnd, lngstate) end function note: userform have minimine button, maximixe button

.htaccess - Redirecting a | (pipe) or %7C in htaccess -

how correctly redirect url permanently, https://example.com/%7chttps://example.com/ to, https://example.com in htaccess? thank you! redirect 301 <src_url> <dst_url> so, in case: redirect 301 /|example.com example.com wiki

javascript - How to prevent input values of hour and minute in specific format (hh:mm) -

i have 1 input field time entry , needs enter hour , minute in hh:mm format. numbers can allowed , additional unnecessary data restricted. have solution issue using javascript or jquery or ok. thank you. <form> <input pattern="\d{1,2}:\d{1,2}" id="date" required="required" maxlength="5"> <input type="submit"> </form> scrpit $(document).ready(function(){ $('#date').keypress(validatenumber); }); function validatenumber(event) { var key = window.event ? event.keycode : event.which; if (key < 48 || key > 58) { return false; } else { return true; } }; see wiki

ios - Getting Phonegap app to scale correctly between iPad and iPhone -

i facing issue phonegap build in app building locked landscape orientation , built ipad dimensions (2048x1536px). when open ipa on ipad, fine. when open ipa on iphone scales down width of device, app locked landscape orientation, need scale height of device. (sounds easy, right?) have run through number of available config , index settings trying solution, gets worse, not better. i'm wondering if can suggest means this. config has 2 relevant settings name="fullscreen" name="enableviewportscale" and index html, app calls on load, offers generic viewport setting. set in version scales device width (leaving portion of app hanging off bottom of screen when held in required landscape position). anyone know solution? how can html go "this in landscape, should scale device height." which web framework using? in jquery mobile scale full screen , has been full screen whatever size of device. http://demos.jquerymobile.com/1.2.1/docs/t

python - Fetching values preceding a given index value in json field -

i have jsonfield [{"0":"z","1":"y","2":"x","3":"w","4":"v"}]. i want fetch values preceding y i.e. x,w,v ... i = 0 name = none obj= model.objects.get(name=request['name']) key in obj: currentposition = key[str(i)] = +1 if currentposition == request['position']: continue else: senddata.append({"position": currentposition}) when adding y in request fetching details z also. you can values preceding "y" using simple comparison in list comprehension: >>> lst = [{"0":"z","1":"y","2":"x","3":"w","4":"v"}] >>> [v v in lst[0].values() if v < "y"] ['x', 'w', 'v'] to values keys preceding key of "y" , use this: >>> idx = next(in

3d heatmap in R, outline the hot spots -

i'm making 3d heatmap using rgl package in r , thinking outlining hot spot areas. want make map following 1 (you can note there solid boundary around hot spots.): image 1 with data, can make looks one. image 2 . don't know how draw outline in 3d environment. datasets 2 images different. want visualization way similar previous one. need draw outlines. thanks suggestions. wiki

javascript - Continue adding new items from the end of the created rows -

i'm trying restart adding data end of dynamically created list of drop downs. scenario use add multiple lines errors using drop downs created using jquery function. these errors stored using error id in 1 column in table string looks 1,2,3,4 ... etc. the functions add data working flawlessly. issue when try edit data. to edit data use javascript fire post request pull data table below code i'm using data data tables. html: create list <div id="jtype-container" <?php if ($gettimedatarow["jtype"] == "qc"){?> style="display: block;" <?php } ?>> <div id="error-add-container"> <div id="error-column-headings"> error number<span>error name</span> </div> <div class="error-column" id="errorarea"> <!-- code inserted using javascript retrieves data --> <!-- database--> </div>

windows - Eclipse Error: "Java started but returned exit code = 13" -

on 64 bit windows 10 operating system, have installed 64 bit jdk1.7. i have set user variable path value c:\program files\java\jdk1.7.0_67\bin. after setting environment variables, have executed javac through command prompt. when try run 64 bit eclipse, returns error "java started returned exit code = 13". please me figure out problem. i think 64 bit java 8 should pre-installed under c:\program files\java . java 8 may 32 bit. if can uninstall java 8, uninstall it. if not, check java configuration , in tab "java", tick version 7 , untick 8. wiki

c# - Cannot update Microsoft.Extensions.Logging to (2.0) Mono Develop 6.1.4 -

my packages in project indicated there version update 2.0 for: microsoft.extensions.logging netstandard.library microsoft.netcore.platforms the 1 cannot update microsoft.extensions.logging the error this: package 'microsoft.extensions.logging 2.0.0' not exist in folder '/home/myuser/updatedpon/pon/sbmanager/packages' not install package 'microsoft.extensions.logging 2.0.0'. trying install package project targets '.netframework,version=v4.5', package not contain assembly references or content files compatible framework. more information, contact package author. i have been searching internet past few days looking solution, have not found 1 of yet. has 1 ran issue, running monodevelop 6.1.4 , mono version 5.2.0.215. lastly webforms application. the microsoft.extensions.logging 2.0.0 nuget packages has assemblies .net standard 2.0. a more recent version of nuget required .net standard 2.0 recognised target framework.

java - Windows JVM process priority -

i started 2 jvm processes (jars) programmatically 2 different threads in java application using runtime.getruntime.exec(..) method. executing sequential under windows os, windows gave cpu first process , second waiting without cpu percentage given. how start processes more concurrent? //thread 1 string fullcommand = "java -djava.security.policy=\"c:\java.policy\" -cp testlinda.jar;../../lib/globallinda.jar; rs.ac.bg.etf.kdp.integral "; string [] envp = {"jobid=1"}; string filepath = "./job1"; process proc = runtime.getruntime().exec(fullcommand, envp, new file(filepath)); int returnvalue = proc.waitfor(); //thread 2 string fullcommand = "java -djava.security.policy=\"c:\java.policy\" -cp testlinda.jar;../../lib/globallinda.jar; rs.ac.bg.etf.kdp.integral "; string [] envp = {"jobid=2"}; string filepath = "./job2"; process proc = runtime.getruntime().exec(fullcommand, envp, new file(filepath)

How can I call a specific object based off cin c++ -

so trying eliminate how reiterate same code in switch statement difference being object getting getanswer() method. appreciated #include "main.hpp" #include "toolbox.hpp" #include <iostream> #include <chrono> problem1 problem1; problem2 problem2; problem3 problem3; problem4 problem4; problem5 problem5; problem6 problem6; problem7 problem7; problem8 problem8; problem9 problem9; problem10 problem10; problem11 problem11; problem12 problem12; problem13 problem13; problem14 problem14; problem15 problem15; problem16 problem16; void execute::print() { int choice; { std::cout << "please enter # of problem solve: "; std::cin >> choice; std::cout << std::endl; switch (choice) { case 1: { auto timepoint1 = std::chrono::high_resolution_clock::now(); std::cout << problem1.getanswer() << std::endl; auto timepoint2 = std::chrono::high_resolution_clock::now();

ruby on rails - Use external file storage for heroku app? -

i have rails application running on heroku, heroku file system read-only cannot store files or images on heroku. a lot of people has suggested use amazon s3, can use external storage save user files , images , retrieve them there paperclip or carrier-wave or similar. currently using dropbox images , files storage. slow. have shared hosting account, there have lot of disk space , want use store files. idea on how that? wiki

webpack - Set local and remote directories to be synced in remote-ftp (Atom package) -

i'm using atom editor , remote-ftp sync local files shared host. i'm creating project vue-webpack-boilerplate has ./dist folder production files. i want sync ./dist folder server remote-ftp upload project files. search in remote-ftp documentation didn't find solution. is there way specify folder sync server? other packages? possible solutions: using .ftpignore : no can't because still folder upload, need it's files not itself. change server root ./dist : it's possible don't want upload project has larger size. sorry writing problems. in case remote-sync package seems better choice, can configure both local source , remote target directory: { // … source: './dist', target: '/path/on/server' } wiki

mysql - In Hive metastore db, How can I get the update_time of alter table -

i had change table in hive using "alter table " this. alter table tbl_name add columns (...); alter table tbl_name change col1 col2 string comment 'test'; in table tbls of hive metastore database, record create_time of table. how can update time of alter table . use below command desc formatted tbl_name and last_modified_time it give when last updated. in unixtimestamp. wiki

php - user_photos facebook permission doesn't work -

i working on web project , integrating facebook login users. , going add permissions, allow web access user information when login facebook. added $permissions = array( 'scope' => 'user_friends, user_photos, email, user_status, user_website, user_videos' ); $loginurl = $helper->getloginurl(new_fb_login_url(), $permissions); then try login facebook account , works user_friends, email , asks user allow access to. didn't user_photos other, didn't ask photos access. been trying searching hours on this. can me on problem? thanks. wiki

rest - Buzz - disabling SSL verification in POST request -

how disable ssl verification in post request using buzz php library? founded here: buzz - scripted http browser i want achieve using curl "-k" flag. wiki

beautifulsoup - Python scraping href iinks -

my goal scrape href links on base_url site. my code: from bs4 import beautifulsoup selenium import webdriver import requests, csv, re game_links = [] link_pages = [] base_url = "http://www.basket.fi/sarjat/ohjelma_tulokset/?season_id=93783&league_id=4#mbt:2-303$f&stage=177155:$p&0=" browser = webdriver.phantomjs() browser.get(base_url) table = beautifulsoup(browser.page_source, 'lxml') game in table.find_all("a", {'game_id': re.compile('\d+')}): href=game.get("href") print(href) result: http://www.basket.fi/sarjat/ottelu/?game_id=3502579&season_id=93783&league_id=4 http://www.basket.fi/sarjat/ottelu/?game_id=3502579&season_id=93783&league_id=4 http://www.basket.fi/sarjat/ottelu/?game_id=3502523&season_id=93783&league_id=4 http://www.basket.fi/sarjat/ottelu/?game_id=3502523&season_id=93783&league_id=4 ...... the problem can't understand why in result href links

Firebase deactivate non-realtime mode -

i getting warning message @ firebase console: read-only & non-realtime mode activated improve browser performance select key fewer records edit or view in realtime how can activate real-time mode? getting out of hand not delete node right now. thanks! update by right last 3 attributes auto expanded in real time mode. collapsed default. also, not delete entire 'accounts' node in case. if in real time mode, so. wiki

javascript - Pass drop down select value from react bootstrap -

i'm unable pass value react bootstrap dropdown function defined. also, i'm populating value category props. below code: handledropdownchange = (evtkey) => { console.log(evtkey) } <dropdownbutton onselect={(event) => this.handledropdownchange(event)} title="" id="category-dropdown" > {category.map((category, i) => <menuitem key={i}>{category.path}</menuitem>)} </dropdownbutton> the menuitem's key should eventkey . <dropdownbutton onselect={this.handledropdownchange} title="" id="category-dropdown"> {category.map((category, i) => <menuitem eventkey={i}>{category.path}</menuitem>) } </dropdownbutton> wiki

jquery - How do I change the action on a form with javascript? -

i use laravel 5.3 my form : {!! form::open(['route' => 'shop.process','id'=>'my-form']) !!} ... {!! form::close() !!} if meets conditions, want change action my condition in javascript : if (true) { $('#my-form').attr('action', '/shop/detail') return true; } if condition met, success convert url this: http://myshop.dev/shop/detail but, content not display content page appear when click url , enter how can solve problem? if want change content of form youll need load form ajax form area. assuming /shop/detail form. should this. either using .load(), or .ajax() if (true) { $('#my-form').attr('action', '/shop/detail'); $('#my-form').load('/shop/detail'); return true; } or.. if (true) { $('#my-form').attr('action', '/shop/detail') $.ajax({ url:'/shop/detail', success:functio

python - Why is pyDatalog not terminating? -

i'm taking @ pydatalog , created quick conversion program loosely based on blog entry : convert_length.py: from pydatalog import pydatalog pydatalog.create_terms(','.join(( 'scale', 'convert', 'from', 'to', 'intermediate', 'value', 'x', 'y'))) scale['meter', 'aln'] = 1.684132 scale['meter', 'angstrom'] = 1e+10 scale['meter', 'centimeter'] = 100 scale['meter', 'millimeter'] = 1000 scale['meter', 'inch'] = 39.370079 scale['light year', 'meter'] = 9.461e+15 scale['astronomical unit', 'meter'] = 1.496e+11 scale['foot', 'inch'] = 12 scale['yard', 'foot'] = 3 scale['mile', 'yard'] = 1760 scale['meter', 'm'] = 1 scale['centimeter', 'cm'] = 1 scale['millimeter', 'mm'] =

ruby on rails - undefined method 'url' for "filename.png":String` -

again in trouble. everythings works fine, reebot , got error undefined method 'url' "1503393906_pointer.png":string . error occurs when enter in property (view & edit). part of _form.html.erb <% if !@property.slider1.url.nil? %> <%= content_tag :p, file.basename(@property.slider1.path)%> <label><%= form.check_box :remove_slider1 %> remove slier #1 </label> <% end %> part of property.rb (model) class property < applicationrecord mount_uploader :slider1, slideruploader end part of slider_uploader.rb class slideruploader < carrierwave::uploader::base storage :file def store_dir "cdn" end def extension_whitelist %w(jpg jpeg gif png avi mp4) end def content_type_whitelist ['image/jpeg', 'image/gif', 'image/png', 'image/svg+xml', 'image/bmp', 'video/x-msvideo']

javascript - Regex for a number which can starts with 0 -

i use regex field: /^([1-9]([0-9]){0,3}?)((\.|\,)\d{1,2})?$/; what want allow user enter 0 beginning of number, in cas, must enter @ least second digit diffrent 0 , same rule applied third , fourth digits. example: 01 -> valid 00 -> not valid 0 -> not valid 1 -> valid in short, 0 value must not allowed. how can using regex? or better if javascript script? if want match numbers have 1 4 digits in part before decimal separator, , 2 digits after decimal separator (i deduce regex used) and not start 00 (that requirement comes verbal explanation), use /^(?!00)(?!0+(?:[.,]0+)?$)\d{1,~4}(?:[.,]\d{1,2})?$/ see regex demo . details ^ - start of string (?!00) - no 2 0 s @ start of string (?!0+(?:[.,]0+)?$) - negative lookahead fails match if there 1 or more 0 s, followed optional sequence of . or , followed 1 or more zeros string end \d{1,4} - 1 4 digits (?:[.,]\d{1,2})? - 1 or 0 occurrences of [.,] - . or , \d{1,2} - 1 or 2 digi

oracle - OBIEE 12.2.1.2 Visual Analyzer - Data Format and Map(VA) -

Image
is possible change data format in va? i.e. not want "billions" displayed. moreover, want deactive map visualization. somehow possible? ideas , suggestions appreciated! funny - i'm fighting oracle similar topics. short version: dvt charting engine extremely black-boxed , has no config parameter exposed or documented. yet. edit: regarding maps @ moment it's or nothing. have va or don't. wiki

ios - Fill the View Controller with elements/objects from web/cloud swift -

i have tableviewcontroller connected empty-"template" viewcontroller . make each cell responsible own interface/design. in other words: viewcontroller has elements placed (like uiimage , uilabel , uitext , etc.) , each time when specific cell selected viewcontroller starts fill specific images/resources. moreover, great if resources taken web or cloud (in order not save in application itself). so, imagine somehow this: flow sketch the problem deal first time, , tried find different ways solve problem (in terms of implementation), therefore ask: idea can implemented in way or there more reliable way, , techniques or technology can used realization? thank you! you can in multiple approaches. totally depends on architecture have been following. you can use react/ key-value observing , set keys when response. alternatively, small app or poc, use alamofire network manager , response, set labels. use image extension in alamofire set images takes more ti

jquery - Want to run only one if Condition -

what if screen width < 1200 alert('1200') alert shown , when screen width < 640 alert('640') alert shown. need without use of else block. fiddle if ($(window).width() < 1200) { alert('1200'); } if ($(window).width() < 640) { alert('640'); } <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> use if/else if . way first matching branch followed. note logic work in case you'd need reverse order of conditions. try this: if ($(window).width() < 640) { alert('640'); } else if ($(window).width() < 1200) { alert('1200'); } <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> as side note, detecting browser width sign you're amending ui different resolutions. if that's case can achieve same thing in much better way using css media queri

html - CSS - Only select the first descendant -

i'm trying style main tags based on theme. if section's class red, of of it's inner tags should use red style regardless of if section inside section uses yellow style. so question how restrict inner tags of section/div/nav etc, use style of first descendant encounters. note : not want rely on order of declare tags. .red input { background-color: red; } .red article { background-color: red; } .red p { background-color: red; } /*.. other tags.. */ .yellow input { background-color: yellow; } .yellow article { background-color: yellow; } .yellow p { background-color: yellow; } /*.. other tags.. */ .blue input { background-color: blue; } .blue article { background-color: blue; } .blue p { background-color: blue; } /*.. other tags.. */ <section class="yellow"> <section class="blue"> <form> <input type="button" value=&quo

image deformation in an android projrct -

Image
in android app, need deform image 1 point other point. should seems that the origin point , b new position of a the result may i have try use "drawbitmapmesh" function make possible, did not reach, here wrap code: public void warp(float startx, float starty, float endx, float endy) { float ddpull = (endx - startx) * (endx - startx) + (endy - starty) * (endy - starty); float dpull = (float) math.sqrt(ddpull); (int = 0; < (counts * 2); += 2) { float dx = orig[i] - startx; float dy = orig[i + 1] - starty; float dd = dx * dx + dy * dy; float d = (float) math.sqrt(dd); // deformation when point in circle if (d < cirr) { double e =(cirr * cirr - dd) * (cirr * cirr - dd) / ((cirr * cirr - dd + dpull * dpull) * (cirr * cirr - dd + dpull * dpull)); double pullx = e * (endx - startx); double pully = e * (endy - starty);

c# - use HttpClient for form submittion -

in c# code need post form other website payment gateway, can adding html tags webform , submitpage on body load. i wants in more proper way using httpclient. when post http call client url data values. page dont redirect me payment website.is there code work in same way when post form manualy. here code snippet form submisttion manualy:(its working) <form action="https://somewebsite.com/someurl" method="post" target="_blank"> <input name="token" value="mytokenparameter" hidden = "true"/> <input name="postbackurl" value="http://mywebsite.com/status.aspx" hidden = "true"/> <input value="confirm" type = "submit" name= "pay"/> </form> here c# code submit same data httpclient:(its not redirecting user payment website) private async task processasyncrequest() { using (var client = new httpclient()) { var values = ne

ios - Swift 3: prepare(for:sender:) -

Image
this question has answer here: unexpectedly found nil iboutlet in prepareforsegue 1 answer i have simple entity: extension team { @nonobjc public class func fetchrequest() -> nsfetchrequest<team> { return nsfetchrequest<team>(entityname: "team") } @nsmanaged public var name: string? @nsmanaged public var phone: string? @nsmanaged public var department: string? @nsmanaged public var position: string? } picture easy understanding: i load current entity core data app successfully. furthermore, have uitableviewcontroller property members (it's storage of fetch result team entity). var members: [team] = [] after app launching ( viewdidload(_:) ) members.count equal 7 , right. also, these elements of members using uitableview in uitableviewcontroller: my task open detailed view controller retrieve data tapped cell.

javascript can't pass string to my function -

i calling function parameter date string "24/08/2017" , function function openedit(dateid){ alert(dateid); } and it's return 0.00013882002974714924. function call like <button onclick="openedit(datestring)"></button> use if using server side technology <button onclick="openedit(\''+datestring+'\')"></button> or <button onclick="openedit('<yourdate>')"></button> you need add quotes around datestring wiki

MYSQL cumulative sum by player -

im having table players , scores. managed create query cumulative sum. want query group cumulative sum player, cumulative sum of previous players not included start cumulative sum of new player. example of result current query: +--------+--------+-------+ | player | total | cumul | +--------+--------+-------+ | arne | 16 | 16 | | arne | -48 | -32 | | arne | 13 | -19 | | arne | -17 | -36 | | arne | 7 | -29 | | arne | 41 | 12 | | arne | -30 | -18 | | arne | -6 | -24 | | arne | 18 | -6 | | bjorg | -5 | -11 | | bjorg | 9 | -2 | | bjorg | -38 | -40 | | bjorg | -12 | -52 | | bjorg | 11 | -41 | | bjorg | 3 | -38 | +--------+--------+-------+ how should like: +--------+--------+-------+ | speler | total | cumul | +--------+--------+-------+ | arne | 16 | 16 | | arne | -48 | -32 | | arne | 13 | -19 | | arne | -17 | -36 | | arne

c++ - How to store template type in structure -

#include<iostream> #include<typeinfo> using namespace std; template <class key, class value> struct st { typedef key keytype; typedef value valuetype; }; int main() { st<int, int> st1; if(typeid(st1.keytype) == typeid(int)) cout<<"yes"; return 0; } is there way of storing type key , value within structure? st1 structure stores key of type int , value of type int or template type within structure. want later use type comparison. following error. invalid use of ‘st<int, int>::keytype’ if(typeid(st1.keytype) == typeid(int)) i want store type initialized to stored within structure. if can use c++11 or newer, can use decltype if ( typeid(decltype(st1)::keytype) == typeid(int) ) cout<<"yes"; or, better imho, std::is_same (evaluated compile-time) if ( std::is_same<decltype(st1)::keytype, int>::value ) cout&