Posts

Showing posts from May, 2013

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

javascript - Why is my function being returned correctly when prototyped outside of my constructor, but not when it's being used as a method within my constructor? -

i have function constructor needs have method being used 1 of properties within constructor. normally, i'd create function property so: var currentdate = new formatdate(new date()); console.log(currentdate.year, currentdate.month, currentdate.dayofmonth, currentdate.dayofweek, currentdate.second); function formatdate(dateholder){ this.monthsarray = ["jan", "feb", "mar", "apr", "may", "june", "july", "aug", "sep", "oct", "nov", "dec"]; this.daysofweekarray = ["sun", "mon", "tue", "wed", "thu", "fri", "sat"]; this.date = new date(dateholder); this.year = this.date.getfullyear(); this.month = this.monthsarray[this.date.getmonth()]; this.dayofmonth = this.addzero(this.date.getdate()); this.dayofweek = this.daysofweekarray[this.date.getday()]; this.minute = th

windows - Problems Making Text Based RPG game/template in C++ -

i making text based rpg in c++ class, using multi file tree structure story sections, when 2 of sections merge 1 other story section getting error saying variable section being redefined, have heard of using headers has not been working because don't know how it! here link files: hey on here! you might forgetting add include guards tops of files. these keep files being compiled more once. have defined variable twice in same scope or function. example (from wikipedia) #ifndef grandfather_h #define grandfather_h // code compiled once // preprocessor directive #ifndef struct foo { int member; }; #endif /* grandfather_h */

Jquery Clone and Increase attri Id -

how can increase number of id after clone. ex: first row id 1 , last row id 2. when click button one, id first same 1 , second 2 , last clone 3. solution this? in advance guys. <table> <tr id="1"> <td><label>contact name</label></td> <td> <select> <option>1</option> <option>2</option> <option>3</option> <option>4</option> </select> </td> </tr> <tr id="2"> <td><label>contact name</label></td> <td> <select> <option>1</option> <option>2</option> <option>3</option> <option>4</option> </select> </td> </tr> $('.submit').click(function(e){ e.preventdefault() var s = $('table tr:last

java - get parse object from userList android -

i little bit confused resolve error. want search email id parse , check either email id exists there or not, if exists there give toast message user otherwise create account , it's data save on parse. but, getting error data not searching parse , not showing desire result. parsequery<parseobject> query = parsequery.getquery("appuser"); query.whereequalto("email", emailstr); query.findinbackground(new findcallback<parseobject>() { @override public void done(list<parseobject> userlist, com.parse.parseexception e) { if (e == null) { if (userlist.size() == 0) { saveuseronparse(user); }else{ toast temp = toast.maketext(sign

javascript - Create an if condition dynamically -

i have following array , created function return items array based on passed filter. var students = [ //name grade room gender ["name1", 80, "farabi", "k"], ["name2", 73, "b1", "k"], ["name3", 73, "b1", "k"], ["name4", 60, "farabi", "k"], ["name5", 80, "b1", "e"], ["name6", 43, "farabi", "e"], ]; function getgrades() { var grades = []; (var = 0; < students.length; i++) { if (students[i][arguments[0][1]] == arguments[0][0]) { grades.push(students[i][1]); } } return grades; } getgrades(["e", 3]); // [gender, column index] this works long pass single filter. if want pass 2 filters, e.g., getgrades(["e", 3], ["b1", 2]) won'

jquery - Dropzone on Rails causing double form submission to DB -

when "save" button clicked, there 2 entries created. 1 :map information stored, , 1 missing it, both same :name. how complete entry save? new.html.erb <%=form_for [@location, @floor], html: {class: "dropzone", multipart: true, id: "map-upload"} |f|%> <div> <%=f.label :name%> <%=f.text_field :name%> </div> <div class="fallback"> <%=f.label :map%> <%=f.file_field :map%> </div> <%=f.submit "save", id: "floor-submit"%> <%end%> drag-drop.js $(document).ready(function() { // disable auto discover dropzone.autodiscover = false; var mapupload = new dropzone("#map-upload", { paramname: "floor[map]", autoprocessqueue: false, maxfiles: 1, addremovelinks: false, dictdefaultmessage: 'drag & drop map image file here, or click here select file upload', }); $('#map-upload

pip - pyodbc install does not support python 3.5.1 -

i trying install pyodbc specific project, unfortunately when try install, no matter command end following error: command "/usr/local/bin/python3.5 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-vw5rz5_t/pyodbc/setup.py'; exec(compile(getattr(tokenize, 'open', open)(__file__).read() .replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-p5vfq2hq-record/install-record.txt --single-version- externally-managed --compile" failed error code 1 in /tmp/pip-build-vw5rz5_t/pyodbc/ obviously, error has been reported here , , aware python version dependency error. have attempted many different approaches deal issue, including attempts in stack overflow question, , following: original attempt: sudo pip3 install pyodbc installing in virtualenv (see here , , here ) could point me correct way install python package has dependency on python version default python package? have project runs on pyth

Change datetime to simple %m/%d/%Y in database with rails -

i have field called :date :datetime. trying save huge datetime string simple mm/dd/yyyy in database, not having luck. have tried 'american_date' gem, , have tried separate call in model here: after_save :change_date def change_date self.date.strftime("%m/%d/%y") end none of these have worked though. help? stack! try this: add file config/initializers following code: date::date_formats[:default]="%m/%d/%y" time::date_formats[:default]="%m/%d/%y %h:%m" time::date_formats[:db]="%m/%d/%y" and see railcast .

c# - Implement zoom functionality like touchpad -

i'm working on app in i'm going map mouse functions onto keyboard keys. example, if user presses 'l', app simulate left mouse click. have mapped clicks , scroll using: [dllimport("user32.dll", charset = charset.auto, callingconvention = callingconvention.stdcall)] public static extern void mouse_event(uint dwflags, uint dx, uint dy, uint cbuttons, uint dwextrainfo); now want implement zoom in , out functionality. in laptops, using pinch on touchpad, can zoom in , out. how can achieve that? there nice function in windows 8+ - injecttouchinput . allows inject touch events or mouse events parameters want. packed .net wrapper . this question contains working c++ sample code pinch, can adapt needs. simulate zoom touchscreen. this 1 way. other way may sending wm_mousewheel ctrl key modifier target hwnd, simulating mouse wheel zoom.

registry - C#: Is there a clean pattern for finding the right object combined with using? -

i clean/compact pattern exception safe , dispose ruleskey , if has thrown. not appear possible using (unless maybe 4 using s seems verbose , opening resources might not need opened). gets me direct/easy in c++. there solution? { registrykey ruleskey = null; ruleskey = ruleskey ?? registry.localmachine.opensubkey("software\\wow6432node\\company\\internal\\product"); ruleskey = ruleskey ?? registry.localmachine.opensubkey("software\\company\\company\\internal\\product"); ruleskey = ruleskey ?? registry.localmachine.opensubkey("software\\wow6432node\\company\\product"); ruleskey = ruleskey ?? registry.localmachine.opensubkey("software\\company\\product"); // code using ruleskey, might throw ruleskey.close(); } you use using (registrykey ruleskey = registry.localmachine.opensubkey("software\\wow6432node\\company\\internal\\product") ?? registry.localmachine.ope

python - Testing django methods -

developing simple chat system via django - i've implemented methods sending/receiving messages. for example ( isn't implementation example 1 chat application ) : def post(request): time.sleep(2) if not request.is_ajax(): httpresponse (" not ajax request ") if request.method == 'post': if request.post['message']: message = request.post['message'] to_user = request.post['to_user'] chatmessage.objects.create(sender = request.user, receiver = user.objects.get(username = to_user), message = message, session = session.objects.get(session_key = request.session.session_key)) return httpresponse (" not post request ") now have method written - need test see if message added. @ point have not written javascript i.e. intervals refresh , wait messages ect. should go straight writing js or test method first , see if works correctly write js it? sounds idiotic question i'm finding hard

java - Gson deserialize JSON array with multiple object types -

i have odd json like: [ { "type":"0", "value":"my string" }, { "type":"1", "value":42 }, { "type":"2", "value": { } } ] based on field, object in array type. using gson, thought have typeadapterfactory sends delegate adapters types typeadapter, i'm hung on understanding way of reading "type" field know type create. in typeadapter, object read(jsonreader in) throws ioexception { string type = in.nextstring(); switch (type) { // delegate creating types. } } would assume "type" field comes first in json. there decent way remove assumption? here code wrote handle array of newsfeedarticle , newsfeedad items in json. both items implement marker interface newsfeeditem allow me check if typeadater should used particular field. public class newsfeeditemtypeadapterfactory implements typeadapterfactory

html - Sorting top three using mysql/php -

i want 3 entities highest value database, sort them , place them in each div's scoreboard top three. able separate fields (id, name, description etc.) , retrieve using example: <?php echo $sql['id']; ?> i know code retrieve info , sort it: $sql = ("select * table order tablefield desc limit 3"); but don't know how place 3 entities each div's , separate entity's fields name, description etc. if using mysql (pdo), highly recommend, it's done follows: $sql = "select * table order tablefield desc limit 3"; $stmt = $conn->prepare($sql); $stmt->execute(); /*here multidimentional array information wanted*/ $rows = $stmt->fetchall(pdo::fetch_assoc); //this 1 method of extracting information //if want place them in specific divs //question suggests, use array //inside divs instead echoing them out in //this foreach loop foreach ($rows $row) { foreach ($row $key => $value) { echo $key.": &q

python - Arduino Serial programming issue -

i'm sending integer python using pyserial. import serial ser = serial.serial('/dev/cu.usbmodem1421', 9600); ser.write(b'5'); when compile,the receiver led on arduino blinks.however want cross check if integer received arduino. cannot use serial.println() because port busy. cannot run serial monitor first on arduino , run python script because port busy. how can achieve this? you listen arduino's reply additional code. import serial ser = serial.serial('/dev/cu.usbmodem1421', 9600); # timeout after second while ser.isopen(): try: ser.write(b'5'); while not ser.inwaiting(): # wait till something's received pass print(str(ser.read(), encoding='ascii')) #decode , print except keyboardinterrupt: # close port ctrl+c ser.close() use serial.print() print arduino receives serial port, python code listening.

How do you include a + sign in a filename in paket? It ends up url-encoded -

if have paket file files section this: files ../bin/profile259/foo.dll ==> lib/pq+ then paket pack insert url-encoded filename lib/pq%2b in nupkg file builds. what's right way specify filename encoding/decoding works correctly? paket version 2.62.6.0 resolution: use paket 2.63; bug, not user error. fixed in this patch . if want see shortcoming addressed, might want post issue on github repository contributing detailed reproduce steps or pr failing test: https://github.com/fsprojects/paket

php - Not sure if .htaccess file is correct. Also some fetch problems from mySQL -

This summary is not available. Please click here to view the post.

cypher - Query performance when adding a new node in Neo4j -

Image
i wondering why cypher query taking exorbitant amount of time. basically, have small family tree (two families), , i'm trying add each 1 new node carries small bit of metadata families easier keep isolated each other when queried. (thanks @tim kuehn advice ). once run query populate 2 families, have this, built no problems: next, want create aforementioned new nodes. first node created quickly, applied smaller family (i call them family b): // 'add :family node each relational group, so:' create (famb:family) famb match (a:person {name:"gramps johnson"})-[:related_to*]->(b:person) merge (famb:family)<-[:family]-(a) merge (famb:family)<-[:family]-(b) ...which gives me this. far good! moving forward, however, larger family's node never created reason. code same, query runs , runs... // 'add :family node each relational group, so:' create (fama:family) fama match (a:person {name:"gramps doe"})-[:

smtp - Email is bouncing off from few mail providers -

when im trying send email domain polish email providers onet.pl , gazeta.pl im getting bounce message: message sent not delivered 1 or more of recipients. permanent error. following address(es) failed: xxx@gazeta.pl smtp error remote mail server after helo mydomain.com: host mx.poczta.gazeta.pl [1.1.1.1]: 503 5.7.0 error: access denied unknown[2.2.2.2] i have configured ptr , mx record. please help. there many possibilities mail denied. please check : 1) mail server ip address should not blacklisted anywhere. can check http://multirbl.valli.org/lookup/ 2) make sure recipient mail server listen on port using i.e. port 25. please check if port 587 works. can try port 465 tls. 3) check if antivirus application installed on side causes issue.

node.js - What is the difference between .create() and .createCB() in Sails.js (Waterline ORM)? -

in the sails documentation on create , documentation talks function named ".create()" , use following example "createcb()": // create new record name 'walter jr' user.create({name:'walter jr'}).exec(function createcb(err, created){ console.log('created user name ' + created.name); }); // created user name walter jr // don't forget handle errors , abide rules defined in model what use of createcb , cb stands ? (edited)

html - Haveing trouble getting rid of the extra space to the right of my content -

i using bootstrap 3 grid on website , having trouble getting rid of space thats right of content. allowing bottom scrollbar visible , move. dont want hide scrollbar know how that. want fit content page there isnt reason bottom scrollbar display. want make content fit page. can continue redesigning..... www.trillumonopoly.com/index2.html actually should it .container-fluid { padding-left: 0; padding-right: 0; } and delete .row .navbar-default are. :)

javascript - Local HTML5 video playback with MP4/WebM Blob chunks -

i'm looking way play relatively large (up 500mb) mp4/webm means of html5 video. complication video isn't available url or file sequence of blob s. the app oriented @ desktop (chrome) , mobile (android/ios webview) offline usage. there's no ability stream video locally, i'm counting entirely on client-side js (no native platform extensions). the video stored in resource container (storage implementation out of scope of question) , can't loaded @ once because of size, can retrieved , buffered several blob chunks. it more convenient read chunks unparted mp4/webm instead of splitting it, guess approach requires local streaming server. it possible split video smaller clips (~10mb) beforehand if necessary, should played seamlessly. an approach i've tried looks that var player = document.queryselector('video'); getblob('webm-chunk1') .then(function (chunk1) { var url = url.createobjecturl(chunk1); player.src = url; player.play()

android - Retrieving drag location on moving GridView -

my question relatively simple. backstory i utilize ondraglistener detect current touch location of user. ondraglistener registered gridview scrolls automatically while user touching. issue the ultimate problem if user stops moving finger (and holds stationary) there no location events monitored, triggered, etc. any input on possible solutions wonderful. you can use setontouchlistener method , set ontouchlistener ontouch method in it, , make sure ontouch method return false.then record dragevent in ondraglistener when location change. , use recorded dragevent in ontouch method whatever want.ontouch method continuously trigger long finger down, since location of drag not changing, using latest recorded dragevent serve well.

flask - Can't define two var in javascript -

this question has answer here: rendering js jinja produces invalid number rather string 1 answer i want define 2 or more var in javascript code,but when define second one, first 1 becomes invalid.i have searched problem, don't why. can tell me how deal this? here javascript code(it's used convert json html table): <script type="text/javascript"> var v_first = {{ pass_kegg|safe }} var v_seconde = {{ pass_tmp|safe }} function buildhtmltable(mylist) { //builds html table out of mylist json data ivy restful service. } function addallcolumnheaders(mylist) { //adds header row table , returns set of columns.need union of keys records records may not containall records } </script> when define 1 variable,all things works fine. when fine second variab

(java.lang.IllegalArgumentException) Error with gui -

i making simple gui program in java. when click run gives me error looks this: exception in thread "awt-eventqueue-0" java.lang.illegalargumentexception: adding window container @ java.awt.container.checknotawindow(unknown source) @ java.awt.container.addimpl(unknown source) @ javax.swing.jlayeredpane.addimpl(unknown source) @ java.awt.container.add(unknown source) @ javax.swing.jrootpane.setcontentpane(unknown source) @ javax.swing.jframe.setcontentpane(unknown source) @ main.cool(main.java:31) @ main$1.run(main.java:43) @ java.awt.event.invocationevent.dispatch(unknown source) @ java.awt.eventqueue.dispatcheventimpl(unknown source) @ java.awt.eventqueue.access$500(unknown source) @ java.awt.eventqueue$3.run(unknown source) @ java.awt.eventqueue$3.run(unknown source) @ java.security.accesscontroller.doprivileged(native method) @ java.security.protectiondomain$javasecurityaccessimpl.dointersectionprivilege(unknown source) @ java.awt.eventqueue.dispatchevent(unknown sour

sql - Group by in HIVE not working like i want -

hi trying output city playerid ab(runs). output birth city of player had @ bats (ab) in career. now want cinncinati, sander01, 14432, correct. shows in 3's this. every city , player , runs, 2nd most. need 1 entry, other 2 redundant. think there did wrong group by, help? plz cinncinati, sander01, 14432 cinncinati, sander01, 14432 cinncinati, sander01, 14432 chicago, dere90, 12324 chicago, dere90, 12324 chicago, dere90, 12324 select a.bcity,a.id, b.ab master join (select id, sum(ab) ab batting group id) b on a.id = b.id order b.ab desc limit 30; refer distinct getting distinct result set.now coming question,join master table top row result set b. select a.bcity,b.id,b.ab master join (select id,sum(ab) ab batting group id order ab desc limit 1 ) b on a.id = b.id you can change limit 30 limit 1 , same result. select a.bcity,a.id, b.ab master join (select id, sum(ab) ab batting group id ) b on a.id = b.id order b.ab desc limit

javascript - How can I add a callback function to chrome extension api? -

actually, want use webrequest modify cookie before request sending. own cookie data stored in extension's storage, getting data storage asynchronous. how can modify request's cookie? i want this: var beforesendheadershandler = { func: function(details, addcookie){ addcookie(details) return {requestheaders: details.requestheaders} }, filter: { urls: ["<all_urls>"] }, extra: ["blocking", "requestheaders"] }; chrome.webrequest.onbeforesendheaders.addlistener(beforesendheadershandler.func, beforesendheadershandler.filter, beforesendheadershandler.extra); how can add callback argument chrome.webrequest.onbeforesendheaders.addlistener callback function, or other solution? if want that, use promise var beforesendheadershandler = { func: function(details, addcookie){ var promise = new promise(function(resolve) { chrome.storage.local.get("your key&quo

c - Duplicating strchr() -

i pretty new c, taking introductory course, , having issues homework problem. goal of program pass array name of type string , dynamically chosen character loop function. function must check string chosen character , if found return pointer character in string. if character not found null pointer supposed returned. code gets stuck in infinite loop on first character of string... #include<stdio.h> char occur(char array[],char c); int main(void){ char array[]="hello world!"; int = 33; char c; char occurence; for(i=33;i<=126;i++){ c = i; occurence=occur(array,c); printf("%c\n",occurence); } return 0; } char occur(char array[], char c){ int = 0; char *temp=array; for(temp=array+i;*temp!='\0';i++){ if(c==array[i]){ return *temp; } else{} } return 0; } use for(temp=array; *temp!='\0'; temp++){ if(c==*temp) { ...

Laravel validation site belongs to user -

my user.php class user extends authenticatable { public function sites() { return $this->hasmany(site::class); } } my site.php class site extends model { public function user() { return $this->belongsto(user::class); } } my routes.php route::resource('site', 'sitecontroller'); my sitecontroller.php class sitecontroller extends controller { public function edit(int $id) { $site = auth::user()->sites()->find($id); return view('site.edit', compact('site')); } } how can validate site belongs user? understand in case if site doesn't belong user, $site variable null. want more declarative way, laravel requests, because need same check in show , update , , destroy methods. cannot use laravel request, because checking this $siteid = route::current()->param('site'); $ids = auth::user()->sites()->pluck('id')->toarray(); $result =

How to make jquery scroll effect like tumblr? -

as can see in link: https://www.tumblr.com/explore/text when click , drag hashtags left , right much, automatically move original position. now can make links, means <a> elements, moved left , right can't taken original position if drag much. work here: https://codepen.io/victorcruzte/pen/oxmyjw html: <div class="parent"> <div class="children"> <a href="#">abcdefg</a> <a href="#">abcdefg</a> <a href="#">abcdefg</a> <a href="#">abcdefg</a> <a href="#">abcdefg</a> <a href="#">abcdefg</a> <a href="#">abcdefg</a> <a href="#">abcdefg</a> </div> </div> css: .parent { margin: 200px auto; width: 200px; height: 100px; overflow: hidden; border: 1px solid #000; } .children { float: left

c++ - bit operation AND -

Image
it leetcode problem. given array of numbers nums, in 2 elements appear once , other elements appear twice. find 2 elements appear once. for example: given nums = [1, 2, 1, 3, 2, 5], return [3, 5]. code is: class solution { public: vector<int> singlenumber(vector<int>& nums) { int axorb=0; for(auto i:nums) axorb=axorb^i; int differbit=(axorb&(axorb-1))^axorb; int group3=0, group5=0; for(auto i:nums) if(differbit&i!=0) group5=group5^i; else group3=group3^i; return vector<int>{group3,group5}; } }; submission result wrong answer. input:[0,0,1,2] output:[3,0] expected:[1,2] but if change highlighted part if(differbit&i) group5=group5^i; it accepted. spent lot of time thinking still have no idea. maybe type conversion happened? thanks this has operator precedence. because in c && , || operators added late given low priority wouldn't break legacy programs. this stack overflow

dns - current domain linked to email hosting, wish to add different web hosting -

i have setup web-hosting domain name, 'www.domainname.com' (forexample) , had working fine, when removed existing nameservers , placed in web-hosting nameservers, broke 3rd party email hosting, unbeknown me actively being used. rectify this, nameservers removed, , mail-hosting namerservers added back: ab1_mailnameserver_etc ab2_mailnameserver_etc nothing else changed 'err_name_not_resolved' error when venture 'www.domainname.com' through browser. i looked domain a-records using mxtoolbox , tells me no name servers can found, although have a-record for, domainname.com & www.domainname.com point correct ip. have correct a-records in hosting, , know because worked before hosting nameservers removed. my question is, can add in web-hosting nameservers under existing email nameservers without breaking email-hosting link? i lil frightened so, cannot risk breaking email twice in 1 week. thanks in advance peeps! ;) after changing mail-hosti

asynchronous - Python asyncio with Slack bot -

i'm trying make simple slack bot using asyncio, largely using example here asyncio part , here slack bot part. both examples work on own, when put them seems loop doesn't loop: goes through once , dies. if info list of length equal 1, happens when message typed in chat room bot in it, coroutine supposed triggered, never is. (all coroutine trying right print message, , if message contains "/time", gets bot print time in chat room asked in). keyboard interrupt doesn't work, have close command prompt every time. here code: import asyncio slackclient import slackclient import time, datetime dt token = "my token" sc = slackclient(token) @asyncio.coroutine def read_text(info): if 'text' in info[0]: print(info[0]['text']) if r'/time' in info[0]['text']: print(info) resp = 'the time ' + dt.datetime.strftime(dt.datetime.now(),'%h:%m:%s') print(re

regex - SQL Regular expression to split a column (string) to multiple rows based on delimiter '/n' -

i have split column multiple rows. column stores string, , have split delimiter based on '/n' have written below query. not able specify ^[/n] . other 'n' in string getting removed. please parse string with sample ( select 101 id, 'name' test, '3243243242342342/n12131212312/n123131232/n' attribute_1, 'test value/nneenu not/nhoney' attribute_2 dual ) -- end of sample data select id, test, regexp_substr(attribute_1,'[^/n]+', 1, column_value), regexp_substr(attribute_2,'[^/]+', 1, column_value) sample, table( cast( multiset(select level dual connect level <= length(attribute_1) - length(replace(attribute_1, '/n')) + 1 ) sys.odcinumberlist ) ) regexp_substr(attribute_1,'[^/n]+', 1, column_value) not null / you need use class [[:cntrl:]

html - Gmail Overriding font-family styles in tables -

for example if have: <div style="font-family:'trebuchet ms';"> <table cellspacing="0" cellpadding="0"> <tr> <td>text 1</td> <td>text 2</td> </tr> </table> </div> gmail's styles override font-family set in div, if use !important. if try set font right in td elements this: <div style="font-family:'trebuchet ms';"> <table cellspacing="0" cellpadding="0"> <tr> <td style="font-family:'trebuchet ms';">text 1</td> <td style="font-family:'trebuchet ms';">text 2</td> </tr> </table> </div> gmail strips contents of style attribute completely! same thing happens if try add table element, or span within td element. though it's not standards-complia

node.js - Why do I get syntax error when i am running parse-server app on my local server? -

Image
i have parse server application cloned on local server. have installed nodejs, mongodb , other packages required parse server. used application https://github.com/parseplatform/parse-server/ . whenever run parse server on local server getting syntax error. below screen shot of error: parse server downloaded server framework. if start cannot use because it not linked http web server. preferred web server parse express . if beginner better if start parse-server-example . provides minimal working parse server can use. can find more details here: https://github.com/parseplatform/parse-server-example

android - How can I get long value of event Id from Event object? -

i using google calendar api events. after got events,the event object doesn't contain long value of event id. want use event id view event details via google calendar app. can tell me how that? compile('com.google.apis:google-api-services-calendar:v3-rev125-1.20.0') { exclude group: 'org.apache.httpcomponents' } i using method, think not practice. private static final string[] instance_projection = new string[]{ calendarcontract.instances.event_id, // 0 calendarcontract.instances.begin, // 1 calendarcontract.instances.end, // 1 calendarcontract.instances.title // 2 }; private static final int projection_id_index = 0; private static final int projection_begin_index = 1; private static final int projection_end_index = 2; private static final int projection_title_index = 3; public long geteventid(string title) { cursor cursor = contentresolver.query(builder.build(), ins

C - Passing by value in Visual Studio -

i seem having strange issue in running program visual studio c++ 2010. here (very simplified) code: #include <stdio.h> #include <stdlib.h> #include <math.h> void recieve(double, double); void simple_pass(); void recieve(double x, double y) { printf("%d %d\n", x, y); } void main(int argc , char **argv) { simple_pass(); } void simple_pass() { recieve (0.25, 0.25); recieve (0.25, 0.75); recieve (0.75, 0.5); } when printing values, x 0 , y greater billion. thanks! %d ints, %lf doubles. most compilers give warning these days...

sql - Postgresql current_time stamp in Asia/kolkata changes when I change system date time -

i have postgresql installed on system in india timezone comes in asia/kolkata . what need current_timestamp tried following queries: select now() select current_timestamp @ time zone 'asia/kolkata' which gives me time-stamp correctly. but if change system date or time , use query giving me result changed date time. wrong. how can query or change neccessary conf make such way time stamp should comes correctly asia/kolkata , should in-depended of system date time. postgresql version : 9.3 you can't using postgresql alone, now() and current_timestamp depend on system date. basically, running on server based on system date. you have make sure system date accurate (with ntp sync) or use external service. here way request external time using sql only, it's far being effective or extremely accurate: create or replace function external_now() returns timestamp time zone $$ declare last_external_now timestamp time zone := null; begin