Posts

Showing posts from July, 2015

sql server - T-SQL MERGE: Is this pattern possible?: INSERT (once) if flag true or DELETE if flag false -

i wish use single sql statement (i.e., "merge") manage table representing mathematical set: insert element if true, else remove. using ice cream example, want add flavor or remove flavor list based on @exist flag below. possible? i've played several hours , either syntatically correct , doesn't insert row or write query think needs done won't compile because syntax isn't valid. (msdn merge "man" page) here feable attempt: create table icecream( flavor varchar(50) not null, constraint ak_flavor unique(flavor) ) declare @flavor varchar(50) declare @exist bit set @flavor='vanilla' set @exist=1 merge icecream t using icecream s on s.flavor=t.flavor , s.flavor=@flavor , t.flavor=@flavor when not matched target , @exist=1 insert (flavor) values (@flavor) when not matched source , @exist=0 delete output $action, inserted.*, deleted.*; although there different ways of accomplishing goal, merge stateme

How to include clickable forms in famo.us surfaces -

if have surface hase conent includes input. input doesn't seem gain focus on click. here how include surface. var configureview = function() { this.initialize.apply(this, arguments); }; _.extend(configureview.prototype, { template: templates['config'], initialize: function( options ) { var position = new transitionable([0, 0]);] var sync = new genericsync({ "mouse" : {}, "touch" : {} }); this.surface = new surface({ size : [200, 200], properties : {background : 'red'}, content: this.template() }); // surface's events piped `mousesync`, `touchsync` , `scrollsync` this.surface.pipe(sync); sync.on('update', function(data){ var currentposition = position.get(); position.set([ currentposition[0] + data.delta[0], currentposition[1] +

jsp - JSTL Issue Closing tags must match opened tags? -

receiving title error following code, have no idea why though? <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> <c:if test="${fn:length(art.articles.gallery) > 0}"> <div id="slidewrapper"> <c:set var="additionaljs" scope="request"/>${additionaljs} <script language="javascript"> // global variables , arrays var slideshowimages = new array; var slideshowimagealts = new array; <c:set var="galleryarray" value="${art.articles.gallery}"/> <c:set var="gallerylength" value="${fn:length(art.articles.gallery)}"/> <c:foreach items="${galleryarray}" varstatus="status"> <%-- reverse order --%> <c:set var="article" v

java - Custom data structure (element + weight) -

which data structure should use keep elements ordered given weight? need add elements in collection each element generate specific weight, weight not contained (neither calculated) inside element itself; calculated else outside of element. moreover, weight not need stored (but if needed), insert parameter put element @ right position. my specific use case sort music tracks. have list of tracks , list of rules apply on each tracks. iterate through each track, list of rules generate "score" given current track. add track "collection" given generated score, can pick first track highest score. i can't see data structure use in java. have implement new 1 myself? best guess kind of heap data structure, can't figure out 1 specifically. edit: weight calculated once @ beginning. can't provide "comparator" since compare tracks, , can't calculate score on "compareto method". algorithm like: public track determinenext() { my

Is mapToDouble() really necessary for summing a List<Double> with Java 8 streams? -

as far can tell, way sum list<double> using java 8 streams this: list<double> vals = . . . ; double sum = vals.stream().maptodouble(double::doublevalue).sum(); to me, maptodouble(double::doublevalue) seems kind of crufty - sort of boilerplate "ceremony" lambdas , streams supposed dispense with. best practices tell prefer list instances on arrays, , yet sort of summing, arrays seem cleaner: double[] vals = . . . ; double sum = arrays.stream(vals).sum(); granted, 1 this: list<double> vals = . . . ; double sum = vals.stream().reduce(0.0, (i,j) -> i+j); but reduce(....) longer sum() . i has way streams need retrofitted around java's non-object primitives, still, missing here? there way squeeze autoboxing in make shorter? or current state of art? update - answers digest here digest of answers below. while have summary here, urge reader peruse answers in full. @dasblinkenlight explains kind of unboxing necessary, due decisi

view - The github android library, Viewbadge, How to set rightMargin position? -

i tried this, doesnot work: linearlayout.layoutparams params = new linearlayout.layoutparams( layoutparams.wrap_content, layoutparams.wrap_content ); params.setmargins(0, 0, 200, 0); badge.setlayoutparams(params); badge.show(); could give surely runnable code? lot! fortunately, i'v gotten reason why layoutparams doesnot work. after scanning library code , find set layoutparams in applylayoutparams method show method : private void applylayoutparams() { framelayout.layoutparams lp = new framelayout.layoutparams(layoutparams.wrap_content, layoutparams.wrap_content); switch (badgeposition) { case position_top_left: lp.gravity = gravity.left | gravity.top; lp.setmargins(badgemarginh, badgemarginv, 0, 0); break; case position_top_right: ....... so, our marigin setting overriden. and then, find cool solution. using setbadgemargin method ok before show method. because change

javascript - TinyMCE custom format with :before selector -

Image
i'm trying setup custom format in tinymce. i'm trying make when select text , choose format, puts border around text , uses :before css selector prepend image. it seems working in chrome, not in ie8 or ie9 (haven't been able test in other browser versions). in ie8 , 9, format applied (the border , changing text color red, image doesn't appear here init method tinymce.init({ , theme : 'modern' , selector : selector , entity_encoding : 'named' , plugins : ['table','contextmenu','paste','fullscreen','image','template','mention'] , content_css : contentcss , formats : { warning: { inline:'span', 'classes':'rte-warning' } } , style_formats : [ {

java - How to make After Effects quit after passing -r javascript from command line -

while passing javascript myscript.jsx after effects want after effects exit on completion: "c:\program files\adobe\adobe after effects cc\support files\afterfx" -r "c:\workspaces\myaescripts\myscript.jsx" so last line in passed javascript myscript.jsx script is: app.quit(); regardless of command after effects doesn't want quit. have tried include an app.exitafterlaunchandeval=true; but didn't help. if pass same javascript using aftereffects.exe -s "here same javascript ending with; app.quit();" it exits (quits) beautifully. i stay passing javascript (using -r ). there limit on how many characters can used on command line in windows. need able make after effects exit after finished running script passed -r c:/path/to/myjavascript.jsx . had same problem describing because project has changed , app waiting response on whether save or not. legendary dan ebberts suggests adding: app.project.close(closeoptions.do

android - Overwrite PNG with 9 Patch and vice versa -

i have library project several app projects utilizing it. of app projects need png files of drawables (i.e. background image) due fact image repeats (i.e. evenly spaced vertical bars) or not if edges stretch. other app projects have solid backgrounds fine have 9 patch images. sample project structure library --res ----drawable-xxxx ------background.png ------some_image.9.png otherproject --res ----drawable-xxxx ------background.9.png ------some_image.png however, if try add 9 patch images 1 of projects, compile time error have duplicate resources same name. there easy way around without having redefine background file in each product (which not maintainable)? as gabe sechan , scottt pointed out in comments question, name of files has unique identify them.

c++ - Why am i a getting little green dashes and a green box in my code in MVS 2010? -

this question has answer here: how change visual studio whitespace settings? 3 answers i new c++ , having problem microsoft visual studio (2010). know there supposed better c++ ide's 1 school has use. so, problem is: there little green box appearing in text of code file. pretty small, cannot erase it. there in top corner , moves right of code type. additionally, when try make space little green dash instead. why doing , how can fix it? before started laptop windows key in between ctrl , alt button got stuck , had turn off computer , brute force place. assuming possible before did may have inadvertently turned on don't want or understand! thank in advance help. edit - here link picture: http://imgur.com/cm2nqvy it sounds have visual studio configured show whitespace , non-printable characters. i don't have access vs check how enable/disab

database - What is an ideal way of storing dynamic data in Rails? -

i have dynamic form generator user can determine layout of form , use form collect data. first implementation comes mind simplistic one: i have 2 models, form model , formrecords model. form model stores name , layout of form , formrecords model stores form_id , user_id , key-value pairs layout specifies. one problem implementation formrecords model have many entries, implementation used formdata model stored entire set of data specific form , specific user combination in encoded format, ruby hash, might work. feel there speed issues doing during lookup , data manipulation (i.e. select/join) is there better way implement this?

php - How to return unknown value using known value from same column in SQL -

i have form submits email address, name , image plus few more fields. submissions stored in same column named sentvalue each form field's unique name in column formfield. first time submissions require fields returning users need enter email , form returns image upload because found email address in db. i want use known value of fieldname 'email' return it's matching 'name' value fieldname 'name' , print page image upload. this without correct logic , have attempted numerous other formats , sql syntax select sentvalue name tbl_submission formid='2' , formfield='name' , formfield='email' , sentvalue='smit@home.com' return $query; what correct sql query achieve goal? @matt structure tbl_submission formid - because multiple forms post table , each has id formsubsid - each field's data gets id on db entry formfield - stores unique name of each field sentvalue - stores value of each field entered user

Rust (+SFML) - How to avoid extra object construction when limited by lifetime parameters? -

i'm using rust-sfml ( rsfml::graphics ) to, @ moment, draw pixels screen. (i'm starting both rust , project.) i'm storing data in image , copying texture . this texture used create sprite<'s> ; herein lies problem. need able mutate texture , type of sprite<'s> seems guarantee can't want. since need able call window.draw(&sprite) every time window redrawn, i'm creating new sprite each time. the preferable alternative keep sprite<'s> in struct render along texture . since 'sprite' has lifetime parameter, becomes struct render<'s> : struct render<'s> { texture: texture, sprite: sprite<'s>, } i have method on render : fn blit(&'s mut self) -> () which mutates render (by editing texture ). now, try call blit more once, run problem: render.blit(); render.blit(); // error: cannot borrow `render` mutable more once @ time which, think, happens because life

python - How to include additional files and directory in egg while deploying Scrapy project -

i have scrapy project, want deploy using scrapyd-deploy or scrapy deploy command line tool. went well, notice doesn't include additional file in package. example have file sources/sourcelist.csv in spider directory. doesn't seems include package. how can force deploy script include that. in short can include additional files using scrapy deploy . in long, can. have create egg , upload egg. first, create egg. create or edit setup.py exists in project root. should below: from setuptools import setup, find_packages setup( name = 'project', version = '1.0', packages = find_packages(), entry_points = {'scrapy': ['settings = ozbot.settings']}, include_package_data = true ) notice include_package_data = true line. second, create distribution egg. $python setup.py bdist_egg third, deploy egg $scrapy deploy dist/your_egg_file.egg make sure replace your_egg_file.egg right file name

c# - want to change window color using XAML RESOURCE FILE -

i want change color of window applying style defined in xaml resource file. have created style target type set window no key (assuming applied automatically windows). style not applied windows in app. using below code works controls in window,but not changing color of window itself. please let me know wrong. if give target type grid changes color, if give window not changing color resource file <color x:key="mainbackgroundcolor"></color> <solidcolorbrush x:key="mainbackground" color="{binding path=datacontext.mainapplicationcolor, updatesourcetrigger=propertychanged, relativesource={relativesource ancestortype={x:type window}, mode=findancestor}, fallbackvalue={staticresource mainbackgroundcolor}}"/> <style targettype="window"> <setter property="background" value="{staticresource mainbackground}" /> </style> view <window x:c

python - Flattened out a mixed type of list -

i have mixed list looked this: [('1cfv',), 'nonrbp', [0.00325071141379, 0.278046326931, 0.291350892759]] it created command: in [12]: l1 = [0.00325071141379, 0.278046326931, 0.291350892759] in [13]: t1 = ('1cfv',) in [14]: s1 = "nonrbp" in [15]: mixl = [t1,s1,l1] in [16]: mixl is there way convert into: ['1cfv', 'nonrbp', 0.00325071141379, 0.278046326931, 0.291350892759] i tried this, flattened out string 'nonrbp' not want: [item sublist in mixl item in sublist] >>> final = [] >>> = [('1cfv',), 'nonrbp', [0.00325071141379, 0.278046326931, 0.291350892759]] >>> in a: ... if hasattr(i, '__iter__'): ... j in i: ... final.append(j) ... else: ... final.append(i) ... >>> print final ['1cfv', 'nonrbp', 0.00325071141379, 0.27804632693100001, 0.29135089

html - How to disable link using bootstrap -

is there way disable image link using bootstrap? below jade code , tried adding 'disabled' class , did not work... any ideas? a(href='/home/action2') i.fa.fa-share-alt.fa-lg.img.disabled try using this: a.btn.btn-lg.disabled(href='/home/action2') i.fa.fa-share-alt.fa-lg

ruby on rails - Rspec: before each on js:true specs only -

for js:true feature specs e.g. scenario "test something", js: true end i want run arbitrary code e.g visit signin_path i know within spec_helper.rb config.before(:each) visit signin_path end but want run specs js:true is there way this? yes, specify separate before(:each, js: true) block in spec_helper.rb rspec.configure |config| config.before(:each, js: true) visit signin_path end end

amazon web services - Chef Recipe to set hostname of an EC2 instance AWS -

i want write chef recipe set hostname of ec2 instance : awsregioninstancetyperandomno like awsedev001 how can in chef recipe? have recipe ? please help how in regular unix land? you first add full fqdn /etc/hostname persistence: file '/etc/hostname' content 'hostname.example.com' end then set hostname running os: execute 'hostname hostname.example.com' not_if 'hostname -eq "hostname.example.com"' end this simple chef recipe example, can made more complex suit needs. may want @ hostname cookbook on chef community site .

android - Show ProgressDialog while Using AsynTAsk to parse JSON and populate a list -

i have 2 asynctasks. in first 1 iam fetching data server in json form , converting string. in second 1 iam parsing string objects. all happens after user clicks on button in alertdialog. while happening want show progressdialog. alertdialog dismisses after button click fine. progress dialog not show. here code:- private void poststring(string postedstring) { // todo auto-generated method stub string posturl = endpoints.posturl; try { string response = new post().execute(posturl).get(); string getrequesturl= url string items = new fetchitems().execute(getrequesturl).get(); arraylist<hashmap<string, string>> updatedpostlist = new getlist().execute(items).get(); } private class post extends asynctask<string, string, string> { @override protected string doinbackground(string...

javascript - PHP and JQuery deleting the right thing -

i making little warning/alert boxes php , jquery, , having little problem. problem is, when click close, box doesnt stay closed, , doesnt close right box. if there more 1 alert, want boxes stack up, , on top of each other, when close top one, 1 before shows up. @ moment when close it, box behind 1 i'm trying close closes, , closes 3 seconds(then page gets refreshed jquery , opens again.) need way delete box, can't without getting id of box. here code i'm using. <script> function open_box() { $("#box").show(); } $(document).ready(function() { $(".close").click(function() { $("#box").fadeout("slow"); //$("body").load("update_box"); }); $("#box").dblclick(function() { $("#box").effect("highlight"); }); }); </script> <style> .alerttitle { font-size:2em; text-ali

geometry - How can i add values to trianagle drawcanvas in android? -

i have small problem put values in canvas triangle. please find images. wanted image: https://drive.google.com/file/d/0b0udilp3sesvbeg2cfvraza4ndq/edit?usp=sharing tried image: https://drive.google.com/file/d/0b0udilp3sesvtvvrutizotnjdtq/edit?usp=sharing i want put 10 90 values in triangle canvas , names also. please give me suggestions how achieve this. have tried can't solution. code: protected void ondraw(canvas canvas) { super.ondraw(canvas); paint paint = new paint(); /*paint.setcolor(android.graphics.color.black); canvas.drawpaint(paint);*/ paint.setstrokewidth(4); paint.setcolor(android.graphics.color.red); paint.setstyle(paint.style.fill_and_stroke); paint.setantialias(true); point = new point(350,300); point b = new point(50,700); point c = new point(700,700); path path = new path(); path.setfilltype(filltype.even_odd); path.moveto(350,300);

Efficient Simulation of Brownian Motion in R -

data=data.frame(matrix(rnorm(1000*300,0,1),1000,300)) weiner.matrix=data.frame(cumsum(data)) mu=0 sigma=.15 dt=1/1000 bmot=data.frame(matrix(na,1000,300) bmot[1,]=100 (j in 1:ncol(data)){ (i in 2:nrow(data)){ bmot[i,j]=bmot[i-1,j]*(1+mu*dt+sigma*sqrt(dt)*(weiner.matrix[i,j]-weiner.matrix[i-1,j])) } } i trying simulate matrix of 1000 rows , 300 columns, 300 variables of geometric brownian motion. initial value starts @ 100 , randomness kicks in periods after t=1/row=1. is there way run 300 brownian motion simulation without going cell-by-cell have in loop?? you can use cumsum on set of normal variables produce single variable of brownian motion. random <- rnorm(1000, 0, sqrt(0.15)) x <- 100 + cumsum(random) nsim <- 300 you can use apply, for loop fast: x <- matrix(rnorm(n = nsim * 1000, sd = sqrt(0.15)), nrow = 1000, ncol = 300) (i in 1:nsim) x[,i] <- cumsum(x[,i])

how to send an array over a socket in python -

i have array kind of ([1,2,3,4,5,6],[1,2,3,4,5,6]) this. have send on stream/tcp socket in python. have receive same array @ receiving end. you can serialize object before sending socket , @ receiving end deserialize it. check this

ios - Auto Layout iOS7 -> iOS6 with status bar -

i'm struggling issue using constraints under xcode 5. i building app ios7 while trying keep ios6 ui compatibility. i facing 1 ui issue using interface builder. i have table view adjusts according height of superview using constraints (set in interface builder). it works under ios7.1 portrait , landscape orientation. my issue running on ios 6.1, views shrinks/enlarges depending of superview height, goes 20pixels more on bottom. because of status bar. it doesn't make sense me , since autolayout should take care of , right ? i've tried solutions here obviously, find ways go ios6 ios7 while preventing view showing under status bar. doesn't quite apply issue. any on how could/should solve problem ? thx update uiview frame programmatically when ios version < 6 if ([[[uidevice currentdevice] systemversion] floatvalue] < 7) { // update frame } else { //update frame in ui } or check below link, maybe helpful ios 7 status b

c# - How to save IBuffer object into JPG file in IsolatedStorage -

so have ibuffer object , want save content phone isolated storage jpg. i've tried following gives me error nullreferenceexception . i suspect stream not created how make work ibuffer? using (isolatedstoragefile store = isolatedstoragefile.getuserstoreforapplication()) { using (isolatedstoragefilestream filestream = store.createfile(filepath)) { memorystream stream = new memorystream(); photo.imagebuffer.asstream().copyto(stream); bitmapimage bitmap = new bitmapimage(); writeablebitmap wb = new writeablebitmap(bitmap); //encode writeablebitmap object jpeg stream. extensions.savejpeg(wb, filestream, (int)photo.dimensions.width, (int)photo.dimensions.height, 0, 100); } } error message {system.nullreferenceexception: object reference not set instance

ios - Post multiple images into web server -

the code make me happy post image web server. working smart single image. code i've used post single image is nslog(@"%@",requeststring); nsstring *url=[nsstring stringwithformat:@"http://37.187.152.236/userimage.svc/insertfacialimage?%@",requeststring]; nsmutableurlrequest *request = [[nsmutableurlrequest alloc] init] ; [request seturl:[nsurl urlwithstring:url]]; [request sethttpmethod:@"post"]; // create 'post' mutablerequest data , other image attachment. nsstring *boundary = @"---------------------------14737809831466499882746641449"; nsstring *contenttype = [nsstring stringwithformat:@"multipart/form-data; boundary=%@", boundary]; [request setvalue:contenttype forhttpheaderfield:@"content-type"]; nsdata *data = uiimagejpegrepresentation(chosenimage, 0.2f); [request addvalue:@"image/jpeg" forhttpheaderfield:@"content-type"]; nsmutabledata *body = [nsmutabledata data]; [body appendda

Array First Index in Fortran -

i thought first index of array in fortran 1. why code work? (code modified segment of wavewatch, http://polar.ncep.noaa.gov/waves/wavewatch/ ) do kindex=0, total+1 num = num * scale sig (kindex) = num end as you've been told fortran array indexing is, default, 1-based programmer can choose integer within range of integer kind used index values. there is, though, wrinkle of should aware. fortran doesn't default, either @ compile-time (where impossible in many cases) or @ run-time (possible expensive), check array index expressions in bounds. there lot of fortran code in wild problem , i've come across cases program has worked, apparently correctly, many years without being spotted. use compiler's options create version of program checks array bounds expressions @ run-time, run , see happens. or, you've been told, sig may have been declared 0 lowest index.

android - In App Billing - Monthly Subscription Version 3 -

i want implement monthly subscriptions application enable ad-free version. have implemented demo that, , working fine. while implementing in real scenario in application, have few queries :- what if user changes his/her mobile device. how can managed @ other device also. (i had planned when subscription purchased on 1 device, save yes/no value in shared pref , enable or disable ads based on that. problem when change device, how value of shared pref can checked @ other device) what if user cancels subscriptions google wallet. have saved yes/no value in preferences, check active subscription using purchase status api. (is fine ?) i want know way how these subscriptions should handled enable no-ads version application. better suggestion requested. you need pass purchase data server store @ end. can fetch users subscription status time server. check if shared pref has subscription info show/hide ads. if shared pref doesn't have subscription related data (either d

python - Search and replace missing lines in the data structure by pandas -

my data files have many missing lines (these time series data). find the location of these missing lines (the missing of values @ time points) , replace them lines nan. for purpose, used pandas. however, took time. so, couldn't check whether code working or not. for input in filelist: data=pd.read_csv(input,sep='#',index_col=[1],parse_dates=[1]) print data start = data.head(1).index end = data.tail(1).index timestamp = pd.date_range('2013-07-01 00:00:00','2013-09-30 23:59:00',freq="t") n=timestamp.size cr =pd.dataframe(na,columns=data.columns,index=timestamp) in range(n): s="%04d%02d%02d%02d%02d"%(timestamp.year[i],timestamp.month[i],timestamp.hour[i], timestamp.minute[i]) try: cr.ix[timestamp[i]]=data.ix[s] except valueerror: print input,s,"valueerror" except keyerror: print input,s,"keyerror" output = filelist[i] + "result" if have i

I am getting layout inflater error while using android:textSize="?android:attr/textAppearanceLarge" in my xml -

my application crashing if using android:textsize="?android:attr/textappearancelarge" in xml . don't want give hard coded text size because have create create xml different screen sizes or have manage text size @ run time. <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <edittext android:id="@+id/title" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="@string/title" android:textsize="?android:attr/textappearancelarge" /> <linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation=&quo

nested lists - What is the most efficient way of storing complex, self-referencing tree structures in an SQL database? -

i'm aware of , have used 2 methods in past basic tree structures: adjacency lists , nested sets. understand several pros , cons these approaches - e.g., adjacency lists quick update slow query, nested sets opposite (slow update, quick query). however, require ability store more complex tree-like structures. best way describe using human family relationships. first thought each element have both "ancestors" tree , "descendants" tree. however, there significant redudancy in approach as, using example below, both cameron , kelly share of bob's ancestor tree (and updates more time consuming, insertion tree have insert multiple trees). second thought include tree references. e.g., alice has own ancestor tree. both (4,5) element coming cameron's ancestor tree, , (2,3) element coming kelly's ancestor tree reference alice's ancestor tree. second approach requires less data storage, experience faster updates (only update single tree vs. multiple tre

Something interesting about two overloaded constructors of FileInputStream in Java 7 API -

before talking fileinputstream, starting scenario there 2 valid, overloaded methods compiler confused , report compile-time error in response inputs. here methods. double calcaverage(double marks1, int marks2) { return (marks1 + marks2)/2.0; } double calcaverage(int marks1, double marks2) { return (marks1 + marks2)/2.0; } here complete code showing use of methods: class myclass { double calcaverage(double marks1, int marks2) { return (marks1 + marks2)/2.0; } double calcaverage(int marks1, double marks2) { return (marks1 + marks2)/2.0; } public static void main(string args[]) { myclass myclass = new myclass(); myclass.calcaverage(2, 3); } } because int literal value can passed variable of type double, both methods acceptable candidates literal values 2 , 3 , , therefore compiler fails decide method pick. this confused when take above concept me, dive further java 7 api filei

javascript - Disable Copy or Paste action for text box? -

i have 2 textboxes, , want prevent user copying value first (email) textbox , pasting in second (confirmemail) textbox. email: <input type="textbox" id="email"><br/> confirm email: <input type="textbox" id="confirmemail"> i have 2 solution in mind: prevent copy action email textbox, or prevent paste action confirmemail textbox. any idea how it? http://jsfiddle.net/s22ew/ check fiddle fiddle $('#email').bind("cut copy paste",function(e) { e.preventdefault(); }); you need bind should done on cut,copy paste.you prevent default behavior of action. can find detailed explanation here

jquery - Bootstrap 3 Embed Image size based on device resolution -

Image
i'm new bootstrap 3 , building personal website it. want include email on website, not in plain text, protect against spambots. thought embedding image reasonable, unfortunately looks blurry on iphone. here image i'm thinking few solutions: embed 2x version of image , scale half size based on device ppi (pixels per inch) decide load either 1x , 2x version of image based on device ppi hope spambots don't care , leave email in plain text what can gracefully size image high-resolution screens? use svg image format scales nicely on retina displays

android - ListView: hide Contextual Action Bar -

i'm following official guide using contextual action mode this: listview.setchoicemode(abslistview.choice_mode_multiple_modal); listview.setmultichoicemodelistener(new abslistview.multichoicemodelistener() { @override public void onitemcheckedstatechanged(actionmode mode, int position, long id, boolean checked) { } @override public boolean oncreateactionmode(actionmode mode, menu menu) { menuinflater inflater = mode.getmenuinflater(); inflater.inflate(r.menu.shelf_context, menu); return true; } @override public boolean onprepareactionmode(actionmode mode, menu menu) { return true; } @override public boolean onactionitemclicked(actionmode mode, menuitem item) { // processing... return true; } @override public void ondestroyactionmode(actionmode mode) { } }); my listvie

batch file - Problems with finding errors using errorlevel -

i'm having issues errors 1 af batchjobs. i'm running 50 batchjobs each day, log file, tells me if batchjob completed or not. last week i've noticed errors, , right now, don't have control shows or tells me if batchjob fails error. batchjobs starting af script via sqlplus. i've tried use errorlevel, id didn't work. my batchjob looking far. i've included errorlevel code tried use. @echo off @for /f "tokens=1,2,3,4 delims=-/ " %%a in ('date /t') @( set day=%%a set month=%%b set year=%%c set all=%%a-%%b-%%c ) @for /f "tokens=1,2,3 delims=:,. " %%a in ('echo %time%') @( set hour=%%a set min=%%b set sec=%%c set allm=%%a.%%b.%%c ) @for /f "tokens=3 delims=: " %%a in ('time /t ') @( set ampm=%%a @echo on ) echo start: %date% %time% >> ..\log\scriptname_%all%_%allm%.log sqlplus "script" >> ..\log\scriptname_%all%_%allm%.log if %errorlevel% neq 0 goto :error goto :success :error ec

perl - extracting UUID from response in jmeter -

i using jmeter simulate multiple users upload file server used badboy record script , export jmeter upload file need uuid responded server can use rest of http request have tried use regular expression extractor using expression ${uuid} = \s* but did not work used uuid function generate random uuid not configure in way make request repeated until match uuid have been returned server 1 can me? for extracting uuid you'll need configure regular expression extractor post processor follows: reference name: meaningful, i.e. uuid regular expression: version 4 uuid ([a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89aabb][a-f0-9]{3}-[a-f0-9]{12}) template: $1$ you can test regular expression against returned data using view results tree listener (select regexp tester dropdown) for more information refer using regex (regular expression extractor) jmeter guide.

About JavaScript and PHP assignment operators: Why the different results? -

javascript code: var = 1, b = 2; = b + (b = a) * 0; // result = 2, b = 1; php code 1: $a = 1; $b = 2; $a = $b + ($b = $a) * 0; // result $a = 1, $b = 1; php code 2: $a = 1; $b = 2; $a = (int)$b + ($b = $a) * 0; // result $a = 2, $b = 1; what causes difference between php , javascript assignment operators? is operator precedence related? i want know reasons are. thanks! no, operator precedence doesn't factor evaluation order, therefore using assignments in complex evaluations reusing result of evaluation undefined. from php manual : operator precedence , associativity determine how expressions grouped, not specify order of evaluation. php not (in general case) specify in order expression evaluated , code assumes specific order of evaluation should avoided , because behavior can change between versions of php or depending on surrounding code. in short, output of $b + ($b = $a) undefined, since grouping overrides precedence, , not in a

jquery - Update text file in remote computer by web access? -

i have linux machine running web server php. contain text file name 'autorun.conf' - configuration file, see below. the user can read file ('autorun.conf') local computer - using web browser (e.g. google chrome). what happen files parse , user can see current configuration, user can update configuration , send linux. i did parts of code : html file read file linux machine ,parse it,show , let user change it. for example following code read file 'result' string function button1_onclick() { console.log("button click"); $.get('/autorun.conf', function(result) { after change configuration last thing send update 'result' string server. i did not see how can it. found plenty of file upload plugins enable me send multiple file drag , drop , find simple example 'form' enable me it. the simplest version of ajax (jquery) upload 1 file but did not find simple code let me send update string make file