Posts

Showing posts from February, 2014

mysql - Its possible to generate a SQL Database from a JSON file? -

well have database in json format, generated exel file, want modernize database , export mysql database. json structure: [ { "nombre": "test", "especialidad": "test", "especialidad2": "test pediatrica", "especialidad3": "", "cel": "2222009374947478474777", etc..... }, { "nombre": "test", etc..... } ] if not possible or difficult, better option directly export exel file mysql? thanks. with mysql: have convert csv, use excel write sql, or write import procedure. mariadb skip entirely , use json column format: https://mariadb.com/kb/en/mariadb/column_json/ upgrading mysql mariadb easy , quick. gets little bit of performance increase + nice json column format (and few more).

c# - What could cause a 401 error in a git pull (via libgit2sharp)? -

this pull wrapper works on local network: internal mergestatus pull() { using (var repo = new repository(repositoryroot)) { var merger = new signature(username,emailaddress,datetimeoffset.utcnow); var options =new pulloptions { fetchoptions = new fetchoptions() { credentialsprovider = credentialshandler } }; mergeresult result = repo.network.pull(merger, options); return result.status; } } the following shows credentialshandler using along commented-out attempt use usernamepasswordcredentials gave me same result. public libgit2sharp.handlers.credentialshandler credentialshandler { { if (credentialshandler_ == null) { credentialshandler_ = (_url, _user, _cred) => new defaultcredentials(); //this not fix 401 error on jupiter box //credentialshandler_ = (_url, _user, _cred) => new usernamep

vb.net - Opening a second-form more than once error -

Image
i have button in form1 opens form2. using frm2.show() . works totally fine first time open frm2, when close frm2 , click on button in frm1 open frm2 again, error: can tell me how solve it? edit: have module have database connection , declaration forms: public frmgame new game public frmplay new play public frmfinish new gamefinish public frmlogin new login public frmmanage new manage public frminsert new toevoegen where open form when click on button in form1. sounds me close()ing frm2. closing form should dispose , release resources, can't show() again. instead, need create new instance of object, this: frm2=new form2() frm2.show() if doesn't work (perhaps because don't want re-initialize form's data members), use hide(), rather close() temporarily hide form during program's execution. if need prevent form being closed x button, can few different methods: the best way go may hide or disable close button. read on this post better ide

jquery - Manage tiny fonts visualization with CSS/Javascript in Firefox -

Image
i trying create website in navigation based on zoomable contents. for instance, here screenshot of can see after opening webpage: then, using zoom.js "zooming" page , able read text. however, after magnification got this: the font-size set 9.4%, , can see causes characters overlapped , not correctly positioned. i tried use jquery plugin fittext.js or jquery textfill , see if changed font-size in "magic" way solve issue; unfortunately had effect in solving visualization issue. so question is: how can make font looking "normal"? there jquery plugin or other js library manage problem? i using firefox, , prefer focus on using browser moment. as suggested nico o , ed plunkett in comments, solution problem start big page, in 20 times bigger desired page size. added following css scale 20 times smaller: body { transform: scale(0.05); transform-origin: 0 0; } when need zoom on point, add new transformation parameters in

MySQL Fabric failover and Connection Pooling with Hibernate -

i'm attempting implement automatic failover via mysql fabric server group using jndi resource, hibernate, , connection pooling. our db farm setup mysql fabric , i'm attempting implement client/connector. i have jndi resource declared in server.xml file has mysql fabric-based url , driver, , uses connection pooling hibernate. <resource name="jdbc/myapp" type="javax.sql.datasource" driverclassname="com.mysql.fabric.jdbc.fabricmysqldriver" maxwait="1000" url="proper.fabric.url/fabricservergroup=myfabricgroup" maxactive="45" validationquery="select 1 dual" /> the problem i'm having connection pooling , fabric not play together. after taking down master db, fabric automatically promotes slave expected. however, when attempt make new connection db i'm getting old now-defunct connections back, notably i'm getting read-only connection when i'm requesting readwrite. additional info i

ruby - task in Capistrano 3 cannot find RVM -

i have been using capistrano 3 deploy php app several months , works great. recently, decided start using sass stylesheets , trying deploy these changes. i trying write task runs after rest of deploy stuff finished converts scss file css using sass gem. namespace :deploy after :finished, :assets on roles(:app), in: :sequence, wait: 5 within release_path # process sass files css execute "sass #{release_path}/styles/test.scss #{release_path}/styles/test.css" end end end end i using rvm on server , have sass gem installed in specific gemset. there .rvmrc file in project root loads correct gemset when cd 'current' directory capistrano creates. when deploy, fails on new task saying cannot find sass. stderr: bash: sass: command not found i can log server same user used deploy capistrano , cd 'current' directory , run same command in task (substituting #{release_path} actual path) , works fine. things have t

apiary.io - Apiary Proxy Request Timed Out -

i'm trying use apiary document api , test requests keep getting response 504 proxy request timed out. api running on machine under http://localhost:3000/ , specified under host metadata. when click compare under call, shows apiary added header "host" specifies user specific proxy. there missing or apiary not localhosts? because proxy remotely calls specified host, cannot directly call localhost. could use https://ngrok.com , set tunnel , use tunnel url host.

project - read and write from a txt file (assembly) -

i writing project in assembly language , have problem read file , print on screen written in it. i took part of code (which read , print part) , tried fix , re write , still have problem. if can me i'll more happy this code : org 100h mov ah,0ah mov dx,offset place int 21h ; getting place(directory) of file mov si,offset place inc si mov dx,[si] inc dx mov si,dx mov [si],0 mov ah,02 mov dl,13 int 21h mov ah,02 mov dl,10 int 21h mov ah,0ah mov dx,offset filename int 21h ;getting file name mov si,offset filename inc si mov dx,[si] inc dx mov si,dx mov [si],0 mov ah,02 mov dl,13 int 21h mov ah,02 mov dl,10 int 21h call gotoplace ;go place of file ;------------------ call openfile ;open file ;------------------ mov ah,3fh mov si,offset filehandle mov bx,[si] ;move file adress bx mov cx,40000 ;numbers of bytes read mov dx,offset buff ;pointer read buffer int 21h mov si,offset filesize ;move si

Log4j.xml, same package, different level goes to different appender -

assume have 2 appenders console , file. package "my.package", want warn+ level logs go file , info+ level logs go console. the following code send info+ level logs console, nothing goes file: <category name="my.package"> <priority value="warn" /> <appender-ref ref="file" /> </category> <category name="my.package" additivity="false"> <priority value="info" /> <appender-ref ref="console" /> </category> the following code cause error this: log4j:error attempted append closed appender named [file]. <category name="my.package"> <priority value="warn" /> <appender-ref ref="file" /> </category> <category name="my.package"> <priority value="info" /> <appender-ref ref="console" /> </category> how send warn+ level lo

Get access google spreadsheet (saved into google drive account) from a java google app engine (servlet) -

i stuck here. want access google spreadsheet google app engine (with java, using servlet because idea read information spreadsheet, saved in google drive account, , shows via "jsp" limited users number, here in company). of course i've create project in "google cloud developer console" got "project id" fourth-case-xxxx, etc . until step understood , went well. i´ve been looking thousands of example here , on google, etc.for read understand that: must create "oauth2 credential" (reason why created oauth2 credential in "api , authentication" in developer console of course (i got json auth_uri, client_secret, client_id, etc, etc). from i've read need client_secret , client_id. following tutorial ( link ) got error "oauth_token not exist.". in other tutorial i´v read not necessary use "oauth2" in app engine. dizzy. the want simple java servlet (nothing complex, following practices, not care) read data

debian - Bash script to check if running -

i have following in crontab sync folders on servers run on round robin dns settings syncs every minute. * * * * * rsync -ar --delete -e ssh user@skynet.rizzler.se:/home/user/folder1/ /home/user/folder1/ >/dev/null 2>&1 * * * * * rsync -ar --delete -e ssh user@skynet.rizzler.se:/home/user/folder2/ /home/user/folder2/ >/dev/null 2>&1 this rsync works small files, it's getting bigger wondering how can script, put script crontab , each time script run, check if it's running. if script running, nothing; if it's not running, should go ahead , start rsync. anyone know how can this? as swornabsent noted in comments, can use file-based locks , though link identifies reasons not use it. see this question quick-and-dirty locking in shell scripts , has great answer advantages directory-based locks instead. to identify whether process running, may choose use pgrep , though may not idea in general case due time after check , before process start

asp.net mvc - How to enable Common.Logging.Log4Net -

i trying enable common.logging.log4net write types of logs log file. tutorials make simple don't know doing wrong. these steps taking: create new asp.net mvc empty project install "common logging log4net 1211" nuget package add following lines default web.config: <common> <logging> <factoryadapter type="common.logging.log4net.log4netloggerfactoryadapter, common.logging.log4net"> <arg key="configtype" value="inline" /> </factoryadapter> </logging> </common> <log4net> <root> <level value="all" /> <appender-ref ref="fileappender" /> </root> <appender name="fileappender" type="log4net.appender.fileappender" > <param name="file" value="c:\users\myname\downloads\log.txt" />

powershell v2.0 - Excessive whitespace around filepath -

ps c:\> $pst_path = $outlook.session.stores | { ($_.filepath -like '*.pst') } | select filepath | format-table -hide ps c:\> $pst_path c:\users\abelej\documents\outlook files\my outlook data file(1).pst ps c:\> _ i've tried using $pst_path.trim() method trim leading , trailing spaces no luck. can see above white space variable contains. problem comes when i'm using copy-item complains file name exceeds 260 character limit. the format-* cmdlets displaying formatted data user. not use them if need further process data. expand filepath property instead: $outlook.session.stores | { $_.filepath -like '*.pst' } | select -expand filepath

c - va_start va_end with fatfs f_printf -

i'm trying implement function, write sdcard. should called printf additional optional arguments: void writedatatofiles(int anything, const tchar* fmt, ...){ .... va_list args; va_start(args, fmt); f_printf(file, fmt, args); //this doesnt work vprintf(fmt, args); //this works va_end(args); f_sync(file); ... } i try call this int m=5 writedatatofiles(0,"my int value %i\n", m); vprintf work, f_printf saving string "i" instead of replacing actual value this f_printf implementation /*-----------------------------------------------------------------------*/ /* put formatted string file */ /*-----------------------------------------------------------------------*/ int f_printf(fil* fil, /* pointer file object */ const tchar* str, /* pointer format string */ ... /* optional arguments... */ ) { va_list arp; byte f

database - magento table that stores relation between cms_block and categories -

Image
in magento, need run query find out categories have static block assigned. know static blocks stored in cms_block , , categories stored. however, table joins these 2 in database? or foreign key field in category table? categories eav model, so, should indeed @ table join. here request looking : select cat.*, cms.* `catalog_category_entity` cat join `catalog_category_entity_int` ci on cat.entity_id = ci.`entity_id` join `eav_attribute` att on att.`attribute_id` = ci.`attribute_id` join `cms_block` cms on cms.`block_id` = ci.`value` att.`attribute_code` = 'landing_page' alan storm, has great article (as usual) on blog if want dig deeper magento eav structure : http://alanstorm.com/magento_advanced_orm_entity_attribute_value_part_1

javascript - How to use a 'plotWidth' calculation to position a highcharts pie -

i'm using combination of pie charts , stand alone svg images in chart have encountered positioning problem pies. pies linked each other , chart resized, want them remain exact distance away each other. if @ example in fiddles , resize window bigger , smaller see travel apart window grows , clash when window size reduced. to position pies relative each other, wanted +/- 50px 75% width of plot area: (this.plotwidth * 0.75) - 50 //for first pie (this.plotwidth * 0.75) + 50 //for second pie that way, no matter size window, pair of pies sit together. http://jsfiddle.net/so7k6w7v/1/ i tried use logic in center , however, x position appears set 0 demonstrated in fiddle . series: [ { type: 'pie', //center: [(this.plotwidth * 0.75) - 50, 71], //for first pie center: ['50%', 71], name: 'bbb', data: [ ['', 40.5], [''

Django Form Wizard With Fieldsets -

i'm using django form wizard (from 1.8 located in formtools ) split form multiple steps. this works fine , all. i'm interested in making fieldsets in form , splitting form multiple different groups on each page. a example this . i found module called django-form-utils replaces forms.form betterform class, can specify fieldsets. problem in template, wizard wants me use {{wizard.form}} , betterform i'm forced use {{form.fieldsets}} . maybe know way use them , make them compatible? or perhaps know way of using fieldsets form wizard. i'm interested in answer can tell me how use fieldsets form wizard. oh feel stupid. way easier expected. reason misunderstood {{wizard.form}} functionality. to use fieldsets django-form-utils . use {{wizard.form.fieldsets}} .

jquery - How to collapse accordion tabs? -

at moment have set accordion page when click on each accordion tab collapses 1 above or below. what achieve can click accordion tab opens , can close down. my html follow: <dl class="accordion"> <dt class="title"> <p>accordion 1</p> </dt> <dd> <p>some text accordion here...</p> </dd> <dt class="title"> <p>accordion 2</p> </dt> <dd> <p>some text accordion here...</p> </dd> <dt class="title"> <p>accordion 3</p> </dt> <dd> <p>some text accordion here...</p> </dd> <dt class="title"> <p>accordion 4</p> </dt

html - Proper way to space floating left characters -

i have following html/css: .wrapper { border: 1px solid blue; height: auto; width: 830px; } .feature_wrapper { float: left; width: 395px; margin: 10px; height: auto; } .feature_wrapper img { float: left; margin-right: 10px; } .feature_wrapper h3 { } .feature_wrapper p { overflow: hidden; text-align: justify; } <div class="wrapper"> <div class='feature_wrapper'> <img src="http://placehold.it/134x134"> <h3>sample header</h3> <p>lorem ipsum dolor sit amet, consectetur adipiscing elit. nunc dictum porttitor mi, non tincidunt lorem iaculis nec. vestibulum vel facilisis ante. sed rutrum vulputate lectus, @ fermentum nisi consectetur sit amet. vivamus ultricies et dolor ut viverra. nulla in nisi blandit, egestas neque in, rhoncus erat. sed vitae euismod enim. pellentesque varius sodales elementum. nulla ut ligula consectetur massa porttitor pharetra. morbi et ult

bash - How to automate file transformation with simultanous execution? -

i working on transforming lot of image files (png) text files. have basic code 1 one, time consuming. process involves converting image files black , white format , using tesseract transform text file. process works great take days me acomplisyh task if done file file. here code: for f in $1 echo "processing $f file..." convert $f -resample 200 -colorspace gray ${f%.*}bw.png echo "ocr'ing $f" tesseract ${f.*}bw.png ${f%.*} -l tla -psm 6 echo "removing black , white $f" rn ${f%.*}bw.png done echo "done!" is there way perform process each file @ same time, is, how able run process simultaneously instead of 1 one? goal reduce amount of time take me transform these images text files. thanks in advance. you make content loop function call function multiple times send each background execute another. function my_process{ echo "processing $1 file..." convert $1 -resample 200 -colorspace gray ${1%.*}bw.png

ios - Dropbox Core API, notification if a file has been added to a folder -

i have app creates tickets putting file in dropbox folder. based on ticket file added (dropbox) folder. use dropbox core api. now, have refresh folder manually see if new file has been added. searching method notified when folder changed (a file has been added) haven't found it. guess longpoll_delta can job isn't available in ios api. is there method in objective-c? i retrieve data following way: - (void) refreshtable { [self.restclient loadmetadata:@"path"]; } - (void)restclient:(dbrestclient *)client loadedmetadata:(dbmetadata *)metadata { (dbmetadata * child in metadata.contents) { if (!child.isdirectory && !child.isdeleted) { nslog(@"filename: %@", child.filename); } } } any ideas? the new dropbox api v2 has function this: [[[dropboxclient.filesroutes listfolderlongpoll:cursor] setresponseblock:...]; cursor parameter returned listfolder or listfoldercontinue .

delphi - VirtualTreeView and VCL Styles -

i'm using virtualtreeview (as grid - in delphi xe7) in app , chose use carbon vcl style. problem arise because need color rows according status on each line, , font color keep staying white when use light color on line. impossible read data. when use iceberg classico style, issue not occurs. so basically, can change set of rows color according style selected, 1 solution. i'm looking way modify font color according row color background? i'm doing colorization code inside event: beforecellpaint , tried modify font color without success. any idea? i found library helps lot on subject: // unit vcl styles utils // github.com/rruz/vcl-styles-utils targetcanvas.brush.color := acolor; if tstylemanager.activestyle.name = 'carbon' tcustomstyleext(tstylemanager.activestyle).setstylefontcolor(sftreeitemtextnorma‌​l, clblack) else tcustomstyleext(tstylemanager.activestyle).setstylefontcolor(sftreeitemtextnorma‌​l, afontcolor); targetcanvas.fillre

javascript - On Windows Phone's IE Touchstart Event Ends Automatically After Few Seconds -

i have specific problem. i'm writing web-page mobile phones has button on it. i'm detecting touchevent on every browser including ie, on ie it's quite specific. after few seconds automatically ends. can somehow me? here code (modified one, still not working properly): if (window.navigator.pointerenabled) { tapbutton.addeventlistener("pointerup", function(e) { e.preventdefault(); addclass(this, 'clicked'); buttontouched = true; }, false); tapbutton.addeventlistener("pointerdown", function(e) { e.preventdefault(); removeclass(this, 'clicked'); buttontouched = false; }, false); alert("pointerenabled"); } else if (window.navigator.mspointerenabled) { tapbutton.addeventlistener("mspointerdown", function(e) { e.preventdefault(); addclass(this, 'clicked'); buttontouched = true; }, false); tapbutton.addeventli

javascript - TextBox with DropDown using bootstrap -

Image
i using bootstrap develop project. have requirement of dropdown text filter.if user know list item he/she can directly input text , search list or he/she can scroll item. after selection item should display in text box. i have been searching in internet haven't found solution. however below link helpful not fully. https://code.google.com/p/ufd/ please if knows please let me know. for countries, cities , address, should use google maps functionality. here how done function initialize() { var mapoptions = { center: new google.maps.latlng(-33.8688, 151.2195), zoom: 13 }; var map = new google.maps.map(document.getelementbyid('map-canvas'), mapoptions); var input = /** @type {htmlinputelement} */( document.getelementbyid('pac-input')); var types = document.getelementbyid('type-selector'); map.controls[google.maps.controlposition.top_left].push(input); map.controls[google.maps.controlpos

c# - Text fields & gridview didn't update while CRUD performing operations winforms devexpress -

Image
in simple form, have gridview & few text fields ( edittext ) available, data filled ms access database while form loads . have few buttons crud operation . after performing new record or modify record or delete record (in separate / new form) have code update / refresh gridview & edittext . code doesn't works here. if use breakpoint & check means working fine, automatically data didn't updates ms access datadase. after repoening same form updates or keep 1 refresh button after pressing updates. wrong code ?? please me solve this.. in advance. billdetails frm = new billdetails(edittext1.text, code1, mode); frm.showdialog(); string qry = "select billid, billno, billdate, billdescription, billamount, deductionamount, amountpaid tblcoverletterdetail chq_id=" + edittext2.text; appset.fillgrid(gridcontrol1, qry); gridview1.columns["billid"].visible = false; this above code filling gridview after curd (create operation).

javascript - HTML5 form required attribute. Set custom validation message? -

i've got following html5 form: http://jsfiddle.net/nfgfp/ <form id="form" onsubmit="return(login())"> <input name="username" placeholder="username" required /> <input name="pass" type="password" placeholder="password" required/> <br/>remember me: <input type="checkbox" name="remember" value="true" /><br/> <input type="submit" name="submit" value="log in"/> currently when hit enter when they're both blank, popup box appears saying "please fill out field". how change default message "this field cannot left blank"? edit: note type password field's error message ***** . recreate give username value , hit submit. edit : i'm using chrome 10 testing. please same use setcustomvalidity : document.addeventlistener("domcontentloaded", function(

osx - Why does mDNSResponder make Ansible run slowly? -

i upgraded os os x 10.10.4, swaps discoveryd mdnsresponder . ansible playbooks, ran normally, run incredibly - tasks took seconds take several minutes. turning off mdnsresponder appears solve issue. why might be? notably, regular ssh connections work when mdnsresponder running, it's ansible runs slowly.

Differences between arrays, pointers and strings in C -

just have question in mind troubles me. i know pointers , arrays different in c because pointers store address while arrays store 'real' values . but i'm getting confused when comes string . char *string = "string"; i read line several things : an array of chars created compiler , has value string . then, array considered pointer , program assigns pointer string pointer points first element of array created compiler. this means, arrays considered pointers . so, conclusion true or false , why ? if false, differences between pointers , arrays ? thanks. a pointer contains address of object (or null pointer doesn't point object). pointer has specific type indicates type of object can point to. an array contiguous ordered sequence of elements; each element object, , elements of array of same type. a string defined "a contiguous sequence of characters terminated , including first null character". c has no st

Kafka multiple consumers for a partition -

i have producer writes messages topic/partition. maintain ordering, go single partition , want 12 consumers read messages single partition(no consumer group, messages should go consumers). achievable? read forums 1 consumer can read per partition. you may use simpleconsumer achieve asking - no consumer groups, consumers can read single partition. approach means have handle offset storing , broker failure handling yourself. another option use high level consumer different consumer groups (you assign random uuid each consumer). way you'll able consume 1 topic/partition consumers , able commit offsets , handle broker outage. the rule "only single consumer can consume topic/partition" applies consumer groups, e.g. 1 consumer in group can consume 1 topic/partition simultaneously.

kernel - Are Berkeley Packet Filter opcode values implementation defined? -

are berkeley packet filter opcode values implementation defined? i thought of tcpdump/libpcap authoritative in bpf arena. noticed linux kernel , tcpdump read bpf filters differently. bpf mnemonics , behavior same, actual opcode values seem different. went looking on internets "the standard", i've found has mnemonics. no, other instructions bpf interpreters/jits support others don't, have same binary values. compare, example, current libpcap pcap/bpf.h with, @ least, linux linux/bpf_common.h , linux/filter.h in 3.19 kernel, , note comment in linux/filter.h reads: /* * try , keep these values , structures similar bsd, * bpf code definitions need match can share filters */ and code in libpcap uses same compiler generate bpf code linux kernel, *bsd/os x/solaris 11/etc. kernels, , userland bpf interpreter, small code changes deal fetching packet metadata (rather packet data).

javascript - How to remove onload event from body tag -

this question has answer here: can't remove inline event handler in chrome 3 answers i've this government site page , using developer console want remove onload event attached body tag entering code in console: var script = document.createelement("script"); script.src = "//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"; document.head.appendchild(script); //wait jquery library load settimeout(function(){ $("body").unbind("onload"); $("body").get(0).onload = null; }, 3000); but not work. what way remove handler attached javascript code? since i'll need remove using attache js code in google chrome extension. i've not yet tried code in google chrome extension. first want make work using developer console. the following jquery remove onload function body tag: $('body&#

php - How to create a div tag for every record selected in my database -

i'm working on results page website's search engine , trying figure out how create div tag every record selected database. using php. loop through result of $query , echo each row in div this: $query = mysqli_query($connect, "select * mytable"); if(mysqli_num_rows($query) > 0) { while($row = mysqli_fetch_array($query)) { echo "<div>".$row['column']."</div>"; } } else { echo "<div>no results found</div>"; }

apache spark - java.lang.ClassCastException: scala.Tuple2 cannot be cast to java.lang.Iterable -

working java in spark, want parse text document called artist_data.txt; first created javardd; javardd rawartistdata = sc.textfile("src/main/resources/artist_data.txt"); parse document, has tab sperator has bad lines number of lines appear corrupted. don't contain tab, or inadvertently include newline character. need use flatmap method; now running code below, got error; java.lang.classcastexception: scala.tuple2 cannot cast java.lang.iterable javardd<tuple2<integer, string>> artistbyid0 = rawartistdata .flatmap(new flatmapfunction<string, tuple2<integer, string>>() { private static final long serialversionuid = 1l; @suppresswarnings("unchecked") public iterable<tuple2<integer, string>> call(string s) { string[] sarray = s.split("\t"); return (iterable<tuple2<integer, string>>) new tuple2<integer, string> (integer.parseint(sarray[0])

jquery - How to increase input box size from right to left -

how increase input box size right left $('#search').live('focus', function () { $(this).animate({ width: ($(this).width() + 60) + 'px' }, 300); }).live('blur', function () { if ($(this).val() == '') { $(this).animate({ width: ($(this).width() - 60) + 'px' }, 300); } try this <div style="position:absolute; float:right; right:160px; top:-14px;"> <input class="boxhomefilterbutton" id="searchininstitudesbutton" style="width:100px; padding-left:15px;" placeholder="hizli ara" onfocus="focussearch(this);" onblur="bluursearch(this);"/> and this function focussearch(e) { $('#searchininstitudesbutton').animate({ 'margin-left': '-=60px', width : 160, "opacity": "9

c# - Distinct items in List -

i have excel spreadsheet trying populate list unique values. have found linqtoexcel prefer not use. @ there 2000 rows isn't much. my thought was: list<string> lst = new list<string>(); string item; (i=2; i<2001; i++) { item = ws.cells[i,3]; if(lst.**notinlist**(item)) { lst.add(item); } } i know there isn't notinlist() , hoping similar or idea. use contains instead list<string> lst = new list<string>(); string item; (i=2; i<2001; i++) { item = ws.cells[i,3]; if(!lst.contains(item)) { lst.add(item); } }

javascript - loading a html page into modal using html5 -

i had requirement load topology diagram taking few html form fields input. using window.open() method show topology diagram in new window. old fashioned, , want use modal instead. had used below code pass data new window window.opener.document.getelementbyid("sample-xml").value; but if using modal, can tell me how fit in other html page modal , @ same time pass few values parent html page child html page.. i tried using < dialog > tag it's supported on chrome.

jquery - Sharepoint 2013: How to make Promoted links responsive? -

Image
i'm having (as expected) big times truble trying implement twitter bootstrap in sharepoint, anyway, of things works exept when i'm trying make promoted links reponsive. i'm trying achieve task assign them class name "col-md-4", i'm doing changing via jquery class name in way: $(document).ready(function() { $('#promotedlinksbody_wpq2').removeclass('ms-promlink-body'); $('#promotedlinksbody_wpq2').addclass('row container-fluid'); $('#promotedlinksbody_wpq2').children().removeclass('ms-tileview-tile-root'); $('#promotedlinksbody_wpq2').children().addclass('col-md-4'); }); i'm removing class named 'ms-promlink-body'and 'ms-promlink-body' because otherwise nothing working (apparently maybe sharepoint overriding it). by way system half working , half not, here screenshots: full screen visualization medium device

javascript - Validating form input fields while typing using jQuery? -

i have script : <script> jquery(document).ready(function($) { var firstname = "/^[a-za-z]+$/"; var email = /^[ ]*([^@@\s]+)@@((?:[-a-z0-9]+\.)+[a-z]{2,})[ ]*$/i; jquery('input#firstname').bind('input propertychange', function() { if (firstname.test(jquery(this).val())) { jquery(this).css({ 'background': '#c2d699' }); } else { jquery(this).css({ 'background': '#ffc2c2' }); } }); jquery('input#email').bind('input propertychange', function() { if (email.test(jquery(this).val())) { jquery(this).css({ 'background': '#c2d699' }); } else { jquery(this).css({ 'background': '#ffc2c2' }); } }); }); </script> and in view have 2 textboxes in v

jax rs - how to see actual body sent from restassured -

i have created jax-rs rest api , tested rest-assured. tests green. trying create html/js front end it. my problem not know how json objects should accepted rest api. restassured/jax-rs never handled request strings. fill in objects , objects, (un)marshaling (json) invisible. is there way can see (debug) strings created rest-assured/java , sent on "wire"? i'm not restassured used, can't answer question directly, here ideas may out. i don't know serializer restassured uses under hood, resteasy on wildfly uses jackson default. familiar library. less trivial application, may need dig apis directly desired results. here it's documentation . particular case can simple as objectmapper mapper = new objectmapper(); string jsonstring = mapper.writevalueasstring(yourobject); system.out.println(jsonstring); this print out pojo in json format, based on getters in class. @ basic level. if don't have jackson dependency, can add <dependency>

oracle - if statement in sql -

sql script i use "if" statement output greater 365 days specific row should updated "yes" else "no" if ( to_date('04/06/2015','dd/mm/rrrr')- lodg_date ) > 365 "yes" else "no" end if ; please advise oracle doesn't support if statement (outside of pl/sql blocks) your question lists tags 3 different rdbms (mysql, postgresql , microsoft sql server), , each 1 things little bit differently. in oracle, can subtract 2 date expressions , difference value in days (whole , fractional.) you can use case expression conditional test, , return value depending on result of test. for developing , testing expressions, in select statement, e.g. select case when to_date('04/06/2015','dd/mm/yyyy')-t.lodg_date > 365 'yes' else 'no' end over_a_year , t.lodg_date mytable t if want perform update operation, update rows in table, s

c++ - Movement of sprite using fixed time step -

i have loop: sf::clock clock; sf::time timesincelastupdate = sf::time::zero; while (mwindow.isopen()) { processevents(); timesincelastupdate += clock.restart(); while (timesincelastupdate > timeperframe) { timesincelastupdate -= timeperframe; processevents(); update(timeperframe); } render(); } and in update function this: object.speed = object.speed * timeperframe.asseconds(); and run method in do: sprite.move(cos(sprite.getrotation()*pi / 180) * speed, sin(sprite.getrotation()*pi / 180) * speed); but problem sprite doesn't move. when don't multiply speed timeperframe.asseconds(), move. how should fix correct? , how use timeperframe variable? object.speed = object.speed * timeperframe.asseconds(); this line reducing speed every frame until 0. you need scale movement distance delta time whenever move object. try this: float distance = speed * timeperframe.asseconds(); sprite.move(cos(sprite.getr

asp.net mvc - Try Catch, ModelState.IsValid, or Both? -

i wondering, best way test validity , errors in basic crud actions? when first used generate scaffolded mvc controllers, had this: if (modelstate.isvalid) { // stuff return view("successfulview") } // if got far went wrong, redisplay return view() but this: try { // stuff return redirecttoaction("successfulview"); } catch { return view(); } testing modelstate not same testing exception, i'm tempted put them both in. but wonder why ms didn't put both in when updated scaffolding code (which no doubt did reason). plus, every basic action starts become quite convoluted: if (modelstate.isvalid) { try { // stuff return redirecttoaction("successfulview"); } catch { return view(); } } // if got far went wrong, redisplay return view() modelstate - validates viewmodel data annotations would've applied. trycatch - catch exceptions may occur in code. i bo

javascript - Uncaught TypeError: Cannot read property 'toUpperCase' of undefined react state item -

i'm new react , javascript , i'm trying render following react component: 'use strict'; var react = require('react'); import toreadlist './toreadlist.js'; var toread = react.createclass({ getinitialstate: function() { return { booktitles: [] }; }, handlesubmit: function(e) { e.preventdefault(); this.state.booktitles.push(react.finddomnode(this.refs.booktitleinput).value.trim()); this.setstate({items: this.state.booktitles}); }, render: function() { return (<div> <form onsubmit={this.handlesubmit}><input type="text" ref="booktitleinput"></input> <input type="submit"></input></form> <toreadlist booktitles={this.state.booktitles} /> </div> ); } }); module.exports = toread; but having following error on console: " uncaught typeerror: cannot read property 'touppercase' of undefined "

c - How do I write a makefile for my module -

here question:i want write kernel module , have writen files: a.c,b.c,b.h , d.h. a.c includes b.h , d.h , b.h includes d.h too. wrote makefile this: ifneq ($(kernelrelease),) mymodule-objs :=a.c b.c obj-m += a.o b.o else pwd := $(shell pwd) kver := $(shell uname -r) kdir := /lib/modules/$(kver)/build all: rm -rf *.o *.mod.c *.symvers *order *.markers *.cmd *- $(make) -c $(kdir) m=$(pwd) clean: rm -rf *.o *.mod.c *.symvers *order *.markers *.cmd *- endif but doesn't work,how should write correct makefile? want file name x.ko in end and. after use 'make' command,and use 'insmod' give me message: insmod: error: not insert module a.ko: unknown symbol in module by way use unbuntu 14.10. kernel 3.16.0-37-generic obj-m += a.o b.o will create 2 modules, a.ko , b.ko if want create single module out of both (which suppose because of line mymodule-objs ), replace line with obj-m += mymodule.o mymodule.o built according mymodule-objs

python - replace exact word while ignoring punctuation -

i know how replace exact word exception of ignoring punctuation i've see answer nice fails on edges me. here example replace: "hi name john, , 30 yrs old." to "to hi name ted, , 30 yrs old." thanks >>> s = "hi name john, , 30 yrs old." >>> new_s = s.replace("john", "ted") >>> new_s 'hi name ted, , 30 yrs old.'

javascript - uploadify.js get id of clicked item -

i need retreive id of button clicked launch file upload uploadify(). have parse id extract number , pass on upload.php script. format of id : upload_1 upload_2 ..... upload_xx the button (divs) being created in php with: while (....) { echo "<div class='upload' id='upload_" . $row['did'] . "' data-role='none' title='upload documents'>"; } i need retreive xx ( $row['did'] ) part. this script have: <?php $timestamp = time();?> $(function() { $('div[id*="upload_"]').uploadify({ 'buttontext' : '&#x21e7;', 'method' : 'post', 'uploadlimit' : 2, 'width' : 24, 'height' : 24, 'title' : 'upload docs', 'buttonclass' : 'uploadbutton', 'swf' : 'inc/uploadify/u