Posts

c# - String Needs to Contain 2 words -

i have textbox on 1 of views, , textbox should not accept has more 2 words or less 2 words. textbox needs 2 words. basically textbox accepts person's first , last name. don't want people enter 1 or other. is there way check space character between 2 words , space character along letter , number , etc after 2nd word if exists? think if user accidently 'fat-fingers' space after 2nd word, should fine bc there still 2 words. for example: /* _ character means space */ john /* not accepted */ john_ /* not accepted */ john_smith_a /* not accepted */ john smith_ /* accepted */ any appreciated. there multiple approaches use solve this, i'll review on few. using string.split() method you use string.split() method break string it's individual components based on delimiter. in case, use space delimiter individual words : // words, removing empty entries along way var words = yourtextbox.split(n...

javascript - How to use gmap with fullpage.js? -

i want use gmap fullpage.js. using bootstrap 3 , section divided in half colums of 6 grids. want cover 1 half full map , other half form. problem coming height. functionality of fullpage.js provide vertical center feature. whole content start center. want overwrite heigth. there way without getting messed fullpage.js. attaching screenshot of problem. <div class="contact section active"> <div class="contact-wrapper"> <div class="row"> <div class="col-md-6"> <div class="map-overlay"> <div id="map" class="gmap"></div> </div> </div> <div class="col-md-6"> <div class="title"> ...

javascript - Populating ul list with index -

i having trouble populating ul li index value. my html below. <ul> <li></li> <li></li> <li></li> <li></li> </ul> my js below. $('document').ready(function(){ var indexus = $('li').index(); $('li').each(function(){ $('li').html(indexus); }); }); js fiddle: http://jsfiddle.net/kujwc/407/ i want populate li appropriate li index value, can end getting index value of latest (in case 3). how go looping in each index value each li shows value of own index number? you should this: $('li').each(function(){ $(this).html($(this).index()); }); you adding index li .. istead of $(this) inside of each, using $('li'). adds last value li index of them.

python 3.x - Pandas to Oracle via SQL Alchemy: UnicodeEncodeError: 'ascii' codec can't encode character -

using pandas 18.1... i'm trying iterate through folder of csvs read each csv , send oracle database table. there non-ascii character lurking in 1 of many csvs (more reveling in anguish). keep getting error: unicodeencodeerror: 'ascii' codec can't encode character '\xab' in position 8: ordinal not in range(128) here's code: import pandas pd import pandas.io.sql psql sqlalchemy import create_engine import cx_oracle cx engine = create_engine('oracle+cx_oracle://schema:'+pwd+'@server:port/service_name' ,encoding='latin1') name='table' path=r'path_to_folder' filelist = os.listdir(path) file in filelist: df = pd.read_csv(pathc+'\\'+file,encoding='latin1',index_col=0) df=df.astype('unicode') df['date'] = pd.to_datetime(df['date']) df['date'] = pd.to_datetime(df['contract_effdt'],format='%yyyy-%mm-%dd') df.to_sql(name, engine, ...

javascript - importing TypeScript vs ES2015 -

i trying figure out why typescript not picking "default export" of react . e.g. in javscript files using: import react 'react'; import reactdom 'react-dom'; but in typescript have use (after googling): import * react "react" import * reactdom "react-dom" i starting out fresh project after being unable import existing project , g et vs2k15 compile it. what difference, if any? there way specify "module 'react' has no default export" . i can see in react file there declare module "react" { export = __react; } is not considered default export i tried import __react "react" but same error. a default export giving 1 of exports alias "default". can using following syntax: export default function __react { //do work } you can use following syntax: function __react { //do work } export {__react default};

android - How to fetch fragment manager without extending the Activity -

i using libraries build cards, java extends library class have requirement use fragmentmanager in java class tried using inner class getting null pointer exception if have activity reference: activity.getfragmentmanager() if have fragment reference: fragment.getfragmentmanager() they both public methods, you'll need reference either activity or fragment. also, , though don't recommend it, if have view reference, view.getcontext() method likely activity , might able cast , fragmentmanager way. potentially dangerous, , stop working @ moment if android's implementations change, should know you're doing. passing activity/fragment reference way go.

matlab - Implementing a fingerprint quality measure? -

Image
i trying implement spatial domain fingerprint quality analysis. quality measure shown in below: i able implement till equation 9. next step calculate weight shown in equation 11. when tried implementing weights zero. of great if me fix issue. have attached code below: clc;clear all;close all; img = imread('c:\users\shrey\google drive\quality\testdatabase\fvc2004\db1_b\101_2.tif'); b = 2; br=1; img=finger_segment(img); img(img==0.5)=0; [gx,gy]=gradient(img); = 1 :b: size(img,1) j = 1 :b: size(img,2) % gradients blockwise gx1 = gx(i:min(i+b-1,size(gx,1)),j:min(j+b-1,size(gx,2))); gy1 = gy(i:min(i+b-1,size(gy,1)),j:min(j+b-1,size(gy,2))); temp = img(i:min(i+b-1,size(img,1)),j:min(j+b-1,size(img,2))); if (any(any(temp)) == 1) k(br) = coherence_grad_3(gx1,gy1,b); temp2=temp/sum(temp(:)); % centroid calculation [r1,c1]=size(temp); [i,j]=ndgrid(1:r1,1:c1); li(br,:)=[dot(i(:),te...