Thursday, 15 May 2014

c# - How to use Ajax Get method to connect WCF service? DO I need to start cros? -



c# - How to use Ajax Get method to connect WCF service? DO I need to start cros? -

i met issue on ajax connect wcf service. using , post method json results. used stand coding website , seek lot solutions how resolve issue, but, unlucky, nil helps. error on cros issue.

so new solution issue? break 2 days already.

any suggestions good. taking time looking post!

rocky

may below blog help in access wcf service in cross domain

http://www.dotnet-tricks.com/tutorial/wcf/x8qn260412-calling-cross-domain-wcf-service-using-jquery.html

c# ajax json wcf

pdf - Align AcroFields in java -



pdf - Align AcroFields in java -

i'm using itextsharp populate info pdf templates, created in openoffice. populating fine, i'm getting proper pdf. in pdf summary come, place want align text against template.

i'm doing below code not work.

fields.setfieldproperty(fieldname, "fflags", pdfformfield.q_left, null);

please help. thanks.

assuming have pure acroform , not hybrid form indicated in comment, how alter quadding of field:

acrofields form = stamper.getacrofields(); acrofields.item item; item = form.getfielditem("fieldleft"); item.getmerged(0).put(pdfname.q, new pdfnumber(pdfformfield.q_left)); item = form.getfielditem("fieldcenter"); item.getmerged(0).put(pdfname.q, new pdfnumber(pdfformfield.q_center)); item = form.getfielditem("fieldright"); item.getmerged(0).put(pdfname.q, new pdfnumber(pdfformfield.q_right));

the quadding isn't part of field flags wrongly assumed. it's , entry of widget annotation dictionary.

java pdf itextsharp itext

d3.js - Can we change the padding property of pack layout with a transition? -



d3.js - Can we change the padding property of pack layout with a transition? -

at first set padding value of pack layout -15. want alter 0 transition. not find info on issue. know if can done or not? if yes, how?

the layouts in d3 compute positions of elements of visualisation. if alter parameters of layout (such padding), positions different. have run layout twice this. steps follows.

run layout original padding. draw elements. here, should you're doing already. now run layout again, new padding. pass new layout info .data() selector, you've done before initial data. now update positions of elements according new data. 1 time again similar you've done before, except you're operating on update , not on come in selection. can add together transition update using .transition().

layout d3.js

linux device driver - v4l2 kernel space debugging -



linux device driver - v4l2 kernel space debugging -

is there default mechanism enable debugging v4l2 drivers. want check dynamic debugging setting in /d. compile time flags in create file fine.

currently, had set below, not getting much information.

echo -n 0xffff>/sys/module/videobuf2_core/parameters/debug

can help me verbose v4l2 logs?

have in code: illustration file drivers/media/v4l2-core/v4l2-ioctl.c might 1 of more interesting ones, cause shows of user/kernel-space interactions.

in file see lot of pr_cont, pr_info , others. while printk printed, others something, if enabled. details on can found on http://lwn.net/articles/487437/ .

the nasty way replace of pr_cont or pr_info printk. can utilize #define this. if want enable 3 or 4 of them , add together own special ones, might fastest way.

the nice way have on how scheme thought used. can seek if can enable dynamic debugging, nicely described here https://lwn.net/articles/434833/ .

finally easiest way might have in kernel config. perhaps know command make menuconfig in source directory. can edit different settings, , in vi, can search using /. next specific modules, can enable or disable debugging options. if that's not enough, can alter global debugging level of kernel in .config file.

one specific flag might interested in is

config_video_adv_debug y here enable advanced debugging functionality on v4l devices. in doubt, n. symbol: video_adv_debug [=y] prompt: enable advanced debug functionality on v4l2 drivers location: -> device drivers -> multimedia back upwards (media_support [=y]) defined @ drivers/media/v4l2-core/kconfig:11 depends on: media_support [=y]

good luck

linux-kernel linux-device-driver v4l2

r - extract a single column -



r - extract a single column -

i have list of 701 given csv files. each 1 has same number of columns (7) different number of rows (between 25000 , 28000).

here extract of first file:

date,week,week day,hour,price,volume,sale/purchase 18/03/2011,11,5,1,-3000.00,17416,sell 18/03/2011,11,5,1,-1001.10,17427,sell 18/03/2011,11,5,1,-1000.00,18055,sell 18/03/2011,11,5,1,-500.10,18057,sell 18/03/2011,11,5,1,-500.00,18064,sell 18/03/2011,11,5,1,-400.10,18066,sell 18/03/2011,11,5,1,-400.00,18066,sell 18/03/2011,11,5,1,-300.10,18068,sell 18/03/2011,11,5,1,-300.00,18118,sell

i made nonlinear regression of supply curve of 9th hr year 2012. datas 2012 in 290. 654. csv files.

allenamen <- dir(pattern="*.csv") alledat <- lapply(allenamen, read.csv, header = true, sep = ",", stringsasfactors = false) h <- list() for(i in 290:654) { g <- function(a, b, c, d, p) {a*atan(b*p+c)+d} f <- nlslm(volume ~ g(a,b,c,d,price), data=subset(alledat[[i-289]], (hour==9) & (sale.purchase == "sell") & (!price %in% as.character(-50:150))), start = list(a=4000, b=0.1, c=-5, d=32000)) h[[i-289]] <- coef(f) }

this works , coefficients a, b, c , d every day in 2012.

this head(h):

[[1]] b c d 2.513378e+03 4.668218e-02 -3.181322e+00 2.637142e+04 [[2]] b c d 2.803172e+03 6.696201e-02 -4.576432e+00 2.574454e+04 [[3]] b c d 3.298991e+03 5.817949e-02 -3.425728e+00 2.393888e+04 [[4]] b c d 2.150487e+03 3.810406e-02 -2.658772e+00 2.675609e+04 [[5]] b c d 2.326199e+03 3.044967e-02 -1.780965e+00 2.604374e+04 [[6]] b c d 2934.0193270 0.0302937 -1.9912913 26283.0300823

and dput(head(h)):

list(structure(c(2513.37818972349, 0.0466821822063123, -3.18132213466142, 26371.4241646124), .names = c("a", "b", "c", "d")), structure(c(2803.17230054557, 0.0669620116294894, -4.57643230249848, 25744.5376725213), .names = c("a", "b", "c", "d")), structure(c(3298.99066895304, 0.0581794881246528, -3.42572804902504, 23938.8754575156), .names = c("a", "b", "c", "d")), structure(c(2150.48734655237, 0.0381040636898022, -2.65877160023262, 26756.0907073567), .names = c("a", "b", "c", "d")), structure(c(2326.19873555633, 0.0304496684589379, -1.7809654498454, 26043.735374657), .names = c("a", "b", "c", "d")), structure(c(2934.01932702805, 0.0302937043170001, -1.99129130343521, 26283.0300823458), .names = c("a", "b", "c", "d")))

now trying column h$a null. how can column?

in add-on want plot single coefficients , date. tried code:

koeffreihe <- function(x) { files <- list.files(pattern="*.csv") df <- data.frame() for(i in 1:length(files)){ xx <- read.csv(as.character(files[i])) xx <- subset(xx, sale.purchase == "sell" & hr == 3) df <- rbind(df, xx) g <- function(a, b, c, d, p) {a*atan(b*p+c)+d} f <- nlslm(volume ~ g(a,b,c,d,price), data=subset(alledat[[i]], (hour==9) & (sale.purchase == "sell") & (!price %in% as.character(-50:150))), start = list(a=4000, b=0.1, c=-5, d=32000)) h[[i]] <- coef(f) } df$date <- as.date(as.character(df$date), format="%d/%m/%y") plot(h$x ~ date, df, xlim = as.date(c("2012-01-01", "2012-12-31"))) } koeffreihe(a)

but error:

invalid type (null) variable 'h$x'

so problem h$a null. if can prepare problem guess code work too.

thank help!

first transform list data.frame:

h.df <- setnames(do.call(rbind.data.frame, h), names(h[[1]])) # b c d #1 2513.378 0.04668218 -3.181322 26371.42 #2 2803.172 0.06696201 -4.576432 25744.54 #3 3298.991 0.05817949 -3.425728 23938.88 #4 2150.487 0.03810406 -2.658772 26756.09 #5 2326.199 0.03044967 -1.780965 26043.74 #6 2934.019 0.03029370 -1.991291 26283.03

then can extract variables easily:

h.df$a #[1] 2513.378 2803.172 3298.991 2150.487 2326.199 2934.019

alternatively can iterate on list extract variable:

sapply(h, "[", "a") # #2513.378 2803.172 3298.991 2150.487 2326.199 2934.019

r list

c++ - Change OpenGL coordinates to window coordinates using gluProject method -



c++ - Change OpenGL coordinates to window coordinates using gluProject method -

i want alter opengl coordinates window coordinates using gluproject method. here part of code:

{ float test = m_nusha.getextremeleftpicturepoint(); float test1 = m_nusha.getextremerightpicturepoint(); float test2 = m_nusha.getextremetoppicturepoint(); float test3 = m_nusha.getextremebottompicturepoint(); gluproject(test, holey, holez, mvm, projm, viewport, &leftpictureside, &holey1, &holez1); gluproject(test1, holey, holez, mvm, projm, viewport, &rightpictureside, &holey1, &holez1); gluproject(holex, test2, holez, mvm, projm, viewport, &holex1, &toppictureside, &holez1); gluproject(holex, test3, holez, mvm, projm, viewport, &holex1, &bottompictureside, &holez1); }

but why leftpictureside , rightpictureside equal(543) if test , test1 have differends signs? because gluproject-method accepts first argument gldouble type(is gldouble unsigned type?).and why toppictureside , bottompictureside equal(142) if test2 , test3 variables quite different? how prepare it?

c++ opengl glut

c# - Converting [][] to [] by extracting 1 element from the inner array -



c# - Converting <T>[][] to <T>[] by extracting 1 element from the inner array -

is there potential 1 liner allows me create new 1 dimensional array index of inner array of 2d?

example take first element of each inner array:

double[][] array2d = new double[10][] // inner arrays double[5] double[] array1d = new double[10]; (int i=0; i<array2d.length; i++) { array1d[i] = array2d[i][0]; }

i'd utilize linq. won't "avoid loops" in terms of execution, it'll avoid loop in your source code:

// 1darray isn't valid identifier... var singlearray = jaggedarray.select(x => x[0]).toarray();

note relies on beingness jagged array (an array of arrays). not expect true multi-dimensional (rectangular) arrays.

or more efficiently:

var singlearray = array.convertall(jaggedarray, x => x[0]);

that's more efficient because knows output size start with, , builds array straight - it's bit less idiomatic using linq these days (which more applicable all sequences, not arrays).

c# arrays multidimensional-array jagged-arrays

mongodb - Javascript variable name coercion to string -



mongodb - Javascript variable name coercion to string -

i'm trying update database in mongo using string variable passed in. however, javascript automatically coerces variable type, , makes "type" key in database instead of string type points (let's "notify" instance)

"update_notifications": function (id ,type ,callback) { db.collection("backend_users", function(err, collection) { collection.update( {"_id": new mongodb.objectid(id)}, { $bit: { type : { xor: 1 } } }, function (err) { if (err) { console.log(color.red(err)); } callback(err); } ); }); },

is there anyway forcefulness mongo utilize "notify" instead of creating new "type" key? thanks!

you want build "update" object outside of statement this

"update_notifications": function (id ,type ,callback) { var update = { "$bit": { } }; update["$bit"][type] = { xor: 1 }; db.collection("backend_users", function(err, collection) { collection.update( {"_id": new mongodb.objectid(id)}, update, function (err) { if (err) { console.log(color.red(err)); } callback(err); } ); }); },

the "left" side considered string literal in object notation, can assign in manner shown

javascript mongodb coercion

C/C++ XML Library that presents read files as a simple data structure? -



C/C++ XML Library that presents read files as a simple data structure? -

is there library focuses on reading xml info , presenting programmer navigated structure, tree? simpler structure, better. features validation, speed, etc not needed.

i want extract info .dae file (a 3d object format using xml) produced blender, such can cherry pick out info need, (vertices, normals, armatures, etc) , write out more specific format that's easier parse final, separate opengl programme later.

c++ xml parsing

videoview - How to play 3 videos from raw folder in same Activity on different Button clicks in Android? -



videoview - How to play 3 videos from raw folder in same Activity on different Button clicks in Android? -

i have play 3 videos on 3 different buttons in same activity.

my first video gets played , if play video lastly screenshot image comes in foreground , current video playing behind screenshot image of previous video.

please help me have asked question before , given http://blog.lemberg.co.uk/surface-view-playing-video solution not helpful me..

i have tried of playing video on different activity , after completion of video comes previous activity. not suitable me according current code structure..

you can utilize 1 video view in activity , switch content play while buttons clicking. before starting video playback,just check whether video playing or not videoview can check by

videoview.isplaying()

if playing stop , start new video content loaded raw. thought while clicking button, check videoview playing stop , start, else start.

create function this

playvideo(string path) { uri uri = uri.parse(uripath); mvideoview.setvideouri(uri); mvideoview.requestfocus(); if(mvideoview.isplaying()) { mvideoview.stopplayback(); } mvideoview.start(); }

call function in 3 button clicks 3 different paths.

android videoview mediacontroller surfaceholder textureview

Remove orphaned key/value from rails store hash -



Remove orphaned key/value from rails store hash -

i'm using text column , rails' store record user preferences so:

class user store :prefs, accessors: [:dismiss_setup, :initiate_setup] after_initialize :set_defaults private def set_defaults self.dismiss_setup ||= false self.initiate_setup || = false end end

this, of course, looks this:

#<user id: 13, prefs: {"dismiss_setup"=>false, "initiate_setup"=>"false"} ...

during development have changed these accessors several times workflows improve. can't figure out how automatically purge them prefs hash. i'm ending lot of key/values deprecated this:

#<user id: 13, prefs: {"dismiss_setup"=>false, "initiate_setup"=>"false", "something_old"=>"true", "no_longer_used"=>"true"} ...

i want create changes in future without cluttering users table. there way compare prefs hash current store accessors , delete don't exist? or perhaps way @ problem?

here's came with:

class user store :prefs, accessors: [:dismiss_setup, :initiate_setup] after_initialize :clean_up, :set_defaults def array_of_prefs self.class.name.constantize.stored_attributes[:prefs] end private def clean_up = self.array_of_prefs.map &:to_s self.prefs.keep_if { |k,v| a.include? k } end def set_defaults self.dismiss_setup ||= false self.initiate_setup ||= false end end

as bonus, @user.array_of_prefs can merged in other strong parameters in users controller. keeps dynamic.

ruby-on-rails ruby-on-rails-4

java - A inherits from B, B inherits from C. Will initializing A invoke constructor of C? -



java - A inherits from B, B inherits from C. Will initializing A invoke constructor of C? -

as preparing interview oop, came across question.

a inherits form b. b inherits c. initializing invoke constructor of c?

what know constructed not inherited. have utilize super keyword refer parent's constructor. right?

the constructor of subclass first invoke constructor of super class. if class has several ancestors, these calls stacked until constructor of top ancestor called. then, go on executing constructor of next ancestors until constructor of ancestors executed. can infer here every time create object, constructor of object class invoked, always.

note if don't add together phone call super() in subclass constructor, compiler add together automatically. if there's no default constructor super class , don't specify phone call specific constructor of super class in constructor of subclass, compiler error.

all these rules stated in jls.

java oop constructor

android - Google Cloud Messaging Server response slow (1 minute) -



android - Google Cloud Messaging Server response slow (1 minute) -

i have webserver sends via php notifications gcm developed android app users. there 3000 users, users receive 20 notifications per day.

it worked more 1 year, since 5 days see response time of phone call "https://android.googleapis.com/gcm/send" 1 min instead of less 1 sec before. , still notifications arrive @ users.

it developed in next way: http://www.androidhive.info/2012/10/android-push-notifications-using-google-cloud-messaging-gcm-php-and-mysql/

i disabled sending of notifications more 1 day. started again, , minutes googleapis responded usual, 1 time again response time of 60 seconds.

it looks google doing on purpose, not know why?

try running :

curl https://apis.google.com/

and

curl https://apis.google.com/ --ipv4

if 2nd 1 ran faster , disable ipv6 on server, maybe isp of server doesn't back upwards ipv6 yet leads 1-2 min delay before times out , switches ipv4 again.

another issue ran lately throttling gcm: how avoid throttling

basically google throttle force messages if send many messages same user in short period of time. "save battery" , "bandwidth" (probably ones) ... remember if want send info device more 10 times min , while user using app, improve open direct tcp connection between user , server :)

android google-app-engine google-cloud-messaging

Is it safe to run two concurrent makes? -



Is it safe to run two concurrent makes? -

lets open 2 shells in same directory , run create in both @ same time. of course of study there no reason this, safe? can cause corrupt build files?

for more realistic example, might run 2 separate makes in different directories, without knowing both recursive makes in same directory.

i suspect reply here is complicated , depend, in part, on makefiles in question do. general create method of operation should create safe (in if newer sources won't rebuilt) create file cache , order of operations (especially combined possible utilize of -j) makes seem me might work might bad things.

that beingness said if makefiles constructed in "provably" right fashion (which notably might mean not using recursive make) might work ok.

as correctly pointed out madscientist in comment real underlying problem here when commands run create collide or overlap. create what, in case, causing happen because internal tests race 1 of variety of reasons.

make gnu-make

surfaceview - Stop OnDrawFrame of Android GLSurfaceView -



surfaceview - Stop OnDrawFrame of Android GLSurfaceView -

i writing application in using glsurfaceview draw shapes on display.the issue want pause drawing or stop drawing , resume again.glsurfaceview setrenderer called oncein lifetime of application.ondrawframe overriden function of glsurfaceview class os cannot disable it.so should go stopping/pausing drawing , resume again.i trying draw follows:

mglsurfaceview = new glsurfaceview(mcontext); mrelativelayout.addview(mglsurfaceview,mrelativelayout.getlayoutparams()); mglsurfaceview.seteglcontextclientversion(2); mglsurfaceview.setrenderer(new lessonfiverenderer(mcontext));

and trying pause/stop follows:

mglsurfaceview.onpause(); mglsurfaceview.getholder().getsurface().release(); mglsurfaceview.setvisibility(view.invisible); mglsurfaceview.destroydrawingcache(); //mrelativelayout.destroydrawingcache(); mglsurfaceview.invalidate(); mglsurfaceview.clearanimation(); mglsurfaceview.postinvalidate(); mrelativelayout.removeview(mglsurfaceview); mrelativelayout.destroydrawingcache(); //mrelativelayout.removeallviewsinlayout(); mrelativelayout.invalidate();

but issue drawing keeps happening in background.how should go stop drawing.

glsurfaceview can draw continuously or on demand. alter mode setrendermode() method.

if pass rendermode_continuously, draw method called scheme can so. (this "queue stuffing" approach settles match device refresh rate; see this article.) if pass rendermode_when_dirty, render if phone call requestrender().

you can see illustration of in android breakout. when game won or lost, glsurfaceview switched render-when-dirty mode.

android surfaceview

c# - add elements to int hashset from int array -



c# - add elements to int hashset from int array -

it possible iterate on array , add together elements hashset 1 one. there way add together integers int array int hashset without iterating on array elements??

int[] pagesid;//int array var deletepages = new hashset<int>();//hashset pagesid= array.convertall(text.split(','), s=>int.parse(s)); //values pagesid should added hashset.

update:

int[] pagesid;//int array var deletepages = new hashset<int>();//hashset foreach (xmlnode rule in pgmgmtrules) { ruleresult=doc.parsetext(rule.innertext, false);//parse rule if (ruleresult != "") { //if parsed rule result has value if (rule.attributes["action"].value == "delete") { var text=rule.attributes["pageids"].value; pagesid= array.convertall(text.split(','), s=>int.parse(s)); //add elements pagesid array hashset } } }

you can utilize overloaded constructor hashset constructor (ienumerable) takes ienumerable<t> parameter instead of using default constructor hashset<t>().

hashset<int> evennumbers = new hashset<int>(text.split(',').select(int.parse));

hashset constructor (ienumerable)

initializes new instance of hashset class uses default equality comparer set type, contains elements copied specified collection, , has sufficient capacity accommodate number of elements copied.

edit 1 if want filter number array can utilize where

var intarr = text.split(',').select(int.parse); hashset<int> evennumbers = new hashset<int>(intarr.where(i=>i%2==0));

edit 2 based on comments. can utilize list<int> instead of int array. keeping adding int pagesids in list in loop , when loop finished add together list in hashset through constructor hashset constructor (ienumerable) .

list<int> pagesid = new list<int>();//int array hashset<int> deletepages = null; foreach (xmlnode rule in pgmgmtrules) { ruleresult=doc.parsetext(rule.innertext, false);//parse rule if (ruleresult != "") { //if parsed rule result has value if (rule.attributes["action"].value == "delete") { var text=rule.attributes["pageids"].value; pagesid.addrange(text.split(',').select(int.parse)); } } } //add elements pagesid array hashset deletepages = new hashset<int>(pagesid);

c# asp.net arrays hashset

excel vba - Connect to FTP Server via VBA, "Put" function for *.XLSB local file -



excel vba - Connect to FTP Server via VBA, "Put" function for *.XLSB local file -

ive tried several different things ive found on here , nil has worked me 1 below:

option explicit const ftp_address = "ftp.yourdestination.com" const ftp_userid = "anon" const ftp_password = "anon" sub macro1() if not sendftpfile_f() msgbox "could not ftp file" else msgbox "sent" end if end sub function sendftpfile_f() boolean dim rc integer dim ifreefile integer dim sftpuserid string dim sftppassword string dim sworkingdirectory string dim sfiletosend string const ftp_batch_file_name = "myftpfile.ftp" const increased_buffer_size = 20480 sendftpfile_f = false sworkingdirectory = "c:\yourworkingdirectory\" sfiletosend = "nameoffile.txt" on error goto ftpnecafile_eh 'kill ftp process file if exists if dir(sworkingdirectory & ftp_batch_file_name) <> "" kill sworkingdirectory & ftp_batch_file_name end if 'create ftp process file ifreefile = freefile open sworkingdirectory & ftp_batch_file_name output #ifreefile print #ifreefile, "open " & ftp_address print #ifreefile, ftp_userid print #ifreefile, ftp_password print #ifreefile, "mput " & sworkingdirectory & sfiletosend print #ifreefile, "quit" close #ifreefile 'shell command ftp file server shell "ftp -i -w:20480 -s:" & sworkingdirectory & ftp_batch_file_name sendftpfile_f = true goto ftpnecafile_ex ftpnecafile_eh: msgbox "err", err.name ftpnecafile_ex: exit function end function

can please assist. need connect "ftp server" , upload same excel file (closeout.xlsb) vba code wrote in it. nil has worked me.

file location = c:\goodman input files file name = closeout.xlsb

connecting = "ftp.myserver.com"

need assistance,

lock

excel-vba

extracting data from text file in matlab -



extracting data from text file in matlab -

i'm doing project , need extract info text file. text file looks this:

class="lang-none prettyprint-override"> xfoil version 6.96 calculated polar for: nasa/ames 63a108 mod c airfoil 1 1 reynolds number fixed mach number fixed xtrf = 1.000 (top) 1.000 (bottom) mach = 0.000 re = 0.100 e 6 ncrit = 9.000 alpha cl cd cdp cm top_xtr bot_xtr ------ -------- --------- --------- -------- -------- -------- -8.000 -0.6796 0.09554 0.09079 0.0206 1.0000 0.1151 -7.750 -0.7040 0.08853 0.08376 0.0066 1.0000 0.1196 -7.500 -0.6948 0.08383 0.07912 0.0076 1.0000 0.1227 -7.250 -0.6828 0.08062 0.07590 0.0083 1.0000 0.1279 -7.000 -0.6902 0.07401 0.06912 0.0003 1.0000 0.1357 -6.750 -0.6730 0.07107 0.06625 0.0023 1.0000 0.1410 -6.500 -0.6686 0.06592 0.06093 -0.0017 1.0000 0.1516 -6.250 -0.6594 0.06196 0.05674 -0.0043 1.0000 0.1656 -6.000 -0.6402 0.05873 0.05365 -0.0027 1.0000 0.1722

and info continues.

i need extract numbers , of text.

i looked on similar question , couldent implement on this. help.

thank much!

matlab

javascript - Not able to get value using: this.$("#{INPUT_ELEMENT_ID}").val() in JS Framework -



javascript - Not able to get value using: this.$("#{INPUT_ELEMENT_ID}").val() in JS Framework -

generally, can utilize input_element_id value using jquery as:

$("#{input_element_id}").val();

which differ code: this.$("#{input_element_id}").val(); or same above line of code.

reason post question:

i wrote unit testing backbone application using jamine.js framework code coverage.

if backbone application's view has code: $("#{input_element_id}").val();, check input_element_id value.

but if application's view code has code: this.$("#{input_element_id}").val();, can not check value of input_element_id jasmine.js spec file.

(i used fixtures input_element_id value jasmine view spec.js file)

kindly help me, understand problem , resolve it.

thanks in advance.

$("#{input_element_id}").val();

used value id .

follwoing line wrong

this.$("#{input_element_id}").val();

we can write

$(this).val();

here same id or class utilize in above function . e.g: $(".word_span ").on("click", function (){ alert($(this).attr('title')); });

javascript jquery unit-testing backbone.js jasmine

In Java, why does System.out.println("\" \\"); gives " \ as output -



In Java, why does System.out.println("\" \\"); gives " \ as output -

in java when run system.out.println("\" \\"); output :

" \

can please explain in detail, why happening?

because escape double quotes ("") backslash (\) , backslash backslash.

java

apache wont treat html file as php even though i've already added an AddHandler -



apache wont treat html file as php even though i've already added an AddHandler -

i have configured apache's main config file , added

addhandler application/x-httpd-php5 .html .htm

but apache still won't treat .html files php files.

php html apache

I've created web application with cloud service, windows azure,right now i am deploying my web role on more then 2 environment -



I've created web application with cloud service, windows azure,right now i am deploying my web role on more then 2 environment -

i've implemented authentication in web application, problem @ time of deployment i've manual settings in web.config file like; every time if want deploy on test i've uncomment local testing settings , comment production setting , vice versa, there way can alter these settings runtime or dynamically @ time of deployment? because i've lots of environment publish every time manually comment , uncomment of setting not worthy

<!--local testing--> <add key="idafederationmetadatalocation" value="https://login.windows.net/test.onmicrosoft.com/testmetadata/2007-06/testmetadata.xml" /> <add key="idarealm" value="https://test.onmicrosoft.com/aadtest" /> <add key="idaaudienceuri" value="https://test.onmicrosoft.com/admtest" /> <add key="idaclientid" value="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" /> <add key="idapassword" value="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=" /> <!-- production --> <!-- <add key="idafederationmetadatalocation" value="https://login.windows.net/test.onmicrosoft.com/testmetadata/2007-06/testmetadata.xml" /> <add key="idarealm" value="https://test.onmicrosoft.com/aadtest" /> <add key="idaaudienceuri" value="https://test.onmicrosoft.com/admtest" /> <add key="idaclientid" value="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" /> <add key="idapassword" value="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=" />-->

so need comment 1 line in release version of web.config? can utilize web.config transformation. add together next line web.release.config file:

<add key="idafederationmetadatalocation" xdt:transform="remove" xdt:locator="match(key)"/>

windows cloud web-deployment azure-web-roles publishing

javascript - CasperJS times out on a page that Chrome can load in much less time. Is this expected? -



javascript - CasperJS times out on a page that Chrome can load in much less time. Is this expected? -

i'm using casperjs 1.1.0-beta3 measure page load times of cpu , info intensive web page. in scenarios, i'm seeing casperjs taking long time observe test-hook have set in place indicate page has finished loading , processing big amount of data.

the test hook uses casper.waitfor function variable gets set in global scope on page. indicates script finish , rendered.

details of page not not relevant, other gets big amount of json info server , processing done on main thread -- no worker threads involved , no cors requests either.

the issue is, casperjs seems take lot more time (10x +) compared identical scenario running on regular chrome.

what might going on? ways debug?

i have setup casperjs scripts take screenshot of page when times out, , shows page still in 'processing' state. indeed looks webkit engine used casper much slower normal chrome.

javascript phantomjs performance-testing casperjs

c++ - Couldn't deduce template parameter from function parameter's default argument -



c++ - Couldn't deduce template parameter from function parameter's default argument -

i'm trying create function finds minimum element in range satisfies given condition:

#include <functional> #include <iostream> #include <vector> template <typename it, typename pred, typename comp> minelementwhere( begin, end, pred pred = pred(), // utilize less-than default comparator. comp comp = std::less<decltype(*std::declval<it>())>() ) { minelement = end; (it = begin; != end; ++it) { if (!pred(*it)) { continue; } if (comp(*it, *minelement)) { minelement = it; } } homecoming minelement; } int main() { std::vector<double> foo; foo.push_back(6); foo.push_back(10); foo.push_back(-3); foo.push_back(7); std::cout << *minelementwhere( foo.begin(), foo.end(), [](double val) { homecoming val >= 0; } ) << std::endl; }

but error:

main.cpp: in function 'int main()': main.cpp:40:5: error: no matching function phone call 'minelementwhere(std::vector<double>::iterator, std::vector<double>::iterator, main()::__lambda0)' ) << std::endl; ^ main.cpp:40:5: note: candidate is: main.cpp:6:4: note: template<class it, class pred, class comp> minelementwhere(it, it, pred, comp) minelementwhere( ^ main.cpp:6:4: note: template argument deduction/substitution failed: main.cpp:40:5: note: couldn't deduce template parameter 'comp' ) << std::endl;

comp isn't homecoming type, it's not trying deduce homecoming type, , doesn't seem me there ambiguous overloads of comp (since there can 1 homecoming type of dereferencing it). why getting error, , how can prepare it?

you're expecting template parameter comp deduced default argument provided corresponding function parameter. however, explicitly listed non-deduced context, meaning template argument deduction fail template parameter (unless can deduced elsewhere).

from §14.8.2.5/5 [temp.deduct.type]

the non-deduced contexts are: — ... — template parameter used in parameter type of function parameter has default argument beingness used in phone call argument deduction beingness done.

to have template argument deduction succeed, provide default argument template parameter, instead of function parameter.

template <typename it, typename pred, typename comp = std::less<decltype(*std::declval<it>())>> minelementwhere( begin, end, pred pred = pred(), comp comp = comp() ) { ... }

live demo

c++ templates c++11

node.js - Grunt Watch forever using Grunt Forever -



node.js - Grunt Watch forever using Grunt Forever -

according grunt-forever documentation, grunt-forever must point application file. want perform grunt-watch task can continuously watch file, forever, , perform tasks if file ever changes.

is possible grunt forever?

if so, config file like?

node.js gruntjs

php - Gravity Forms add_filter -



php - Gravity Forms add_filter -

i'm looking assistance @ applying add_filter gravity forms. i've done research , found link http://www.gravityhelp.com/documentation/page/gform_pre_render rough illustration of how apply custom filter. unfortunately i've had no luck getting work. i'm not receiving errors. pretty much want display echo'd text @ top or bottom of radio button when user select one.

<ul class="gfield_radio" id="input_7_16"> <li class="gchoice_16_0"> <input name="input_16" type="radio" value="plan 180" id="choice_16_0" tabindex="1"> <label for="choice_16_0" id="label_16_0">op1</label> </li> <li class="gchoice_16_1"> <input name="input_16" type="radio" value="plan 420" id="choice_16_1" tabindex="2"> <label for="choice_16_1" id="label_16_1">op2</label> </li> <li class="gchoice_16_2"> <input name="input_16" type="radio" value="plan 560" id="choice_16_2" tabindex="3"> <label for="choice_16_2" id="label_16_2">op3</label>< /li> </ul>

gravity form add together filter

add_filter('gform_pre_render_6', 'populate_text'); function populate_text($form){ if ($field["id"] == choice_16_0) { echo '<br/>your start date saturday ' , getstartsat(); } else if ($field["id"] == choice_16_1 ) { echo '<br/>your start date mon ' , getstartmon(); } else if ($field["id"] == choice_16_2 ) { echo '<br/>your start date saturday ' , getstartsat(), 'or <br/> mon ' , getstartmon(); } homecoming $form; }

are submitting forms? pre render info getting pre render before form getting loaded , loading 'pre render' info. works multiple forms and/or custom db queries.

a mix of conditional logic & text fields take care of if not submitting anything. there dozens of methods echo text in gravity forms.

php wordpress-plugin gravity-forms-plugin

Modular C++ Project Build with CMake -



Modular C++ Project Build with CMake -

i'm trying find way build big modular c++ project cmake.

the construction of project following:

--project_root --src --folder_1 --source_1.h --source_1.cc --test_source_1.cc // file containing main unit tests --folder_2 --source_2.h --source_2.cc --test_source_2.cc // file containing main unit tests --folder_3 ...

and on.

each folder represent project module , each module might depend on other modules, illustration source_1.h may include source_2.h. every module folder may contains test file whole project have multiple executables.

how can build whole project cmake? how should write cmakelists.txt file?

thank lot.

there many, many examples out there of how construction cmake projects c++, many of referenced tutorial @user2485710 suggested in comment, i'm not going go super in-depth here, i'll @ to the lowest degree give starting point based on way want lay out folder structure.

the nice thing cmake can tree-decent using add_subdirectory command. lets split our cmake code required @ specific directory level. in otherwords, each cmakelists.txt file should minimal amount of work needed set things @ current depth in directory tree. in example, cmake tree might this:

--project_root --src --cmakelists.txt --folder_1 --cmakelists.txt --source_1.h --source_1.cc --test_source_1.cc // file containing main unit tests --folder_2 --cmakelists.txt --source_2.h --source_2.cc --test_source_2.cc // file containing main unit tests ...

in src/cmakelists.txt of project-level initialization, i.e. find_package, setting include-path, etc. add together next @ end:

add_subdirectory(folder_1) add_subdirectory(folder_2) ...

this tells cmake should in folders additional stuff do. in src/folder_1/cmakelists.txt, actual work of whatever combination of add_executable , add_library need build source_1.cc , test_source_1.cc, , likewise in src/folder_2/cmakelists.txt source_2.cc, etc.

the other nice thing cmake variables set higher tree propagated downwards through add_subdirectory. so, example, in src/cmakelists.txt can check sort of 'build unit-test' flag , set cmake variable there, , have in other cmakelists.txt files check variable. can super useful if have project cmake dynamically generating header files based on checking environment variables path-names , like.

c++ cmake

c# - Transforming into another object using LINQ Grouping -



c# - Transforming into another object using LINQ Grouping -

i have list of exams has happened on particular time, , mark obtained pupil exam contained in object below:

class exam { public datetime? datetime { get; set; } public double? mark { get; set; } public string pupil { get; set; } public int age { get; set; } }

i need transform format display purposes using next structure:

class examviewmodel { public datetime? datetime { get; set; } public double? mark { get; set; } list<studentviewmodel> students { get; set; } } class studentviewmodel { public string pupil { get; set; } public int age { get; set; } } class resultviewmodel { list<examviewmodel> exams { get; set; } }

basically want ot display exam has taken place @ particuar date, , total marks achieved in pupil (s1 = 10, s2 = 20, total = 30 @ 19/06/2014). students should transformed pupil viewmodel can see students have attended exam. how can using linq?

thanks, -mike

note: using .net4

tried:

exams.orderby(x=>x.datetime) .groupby(x => x.datetime, x=> x, (d, students) => new{date= x, students = students.tolist()} );

but cant total of marks..:(

it's cleaner imho utilize groupby subsequent select instead of using overload of groupby includes projection:

var query = exams.groupby(x => x.datetime) .select(g => new { date = g.key, totalmarks = g.sum(s => s.mark) } );

c# linq

CGAL Using Locate() to Find Cell on Triangulation Surface -



CGAL Using Locate() to Find Cell on Triangulation Surface -

using cgal, have 3d delaunay triangulation of set of random points on unit sphere, obtained via:

delaunay t(points.begin(), points.end());

now, able query t (using locate() or that) find 3 vertices of surface facet arbitrary point (also on unit sphere) contained inside.

when utilize locate(), interior cells results sometimes, include infinite vertex. don't want of these. want surface facets , able arbitrary point seek find on unit sphere. trying figure out has taken lot longer thought would.

any help much obliged. thanks.

so utilize find_conflit(), cgal::emptyset_iterator cit because don't need these. in bfit, facets of boundary of "hole", , hole tetrahedra in conflict point (whose circumscribing sphere contains point, natural extension infinite vertex). so, bfit, set them in standard container using std::back_inserter example. then, iterate on these, tests if finite facets. finite facets separate point rest of triangulation, so, can orientation() tests center of sphere 1 interested in.

triangulation cgal delaunay

java - Geotools coordinate transform -



java - Geotools coordinate transform -

how translate coordinates epsg: 54003 in epsg:4326? utilize next code

`coordinatereferencesystem worldcrs = defaultgeographiccrs.wgs84; string wkt = "projcs[\"world_miller_cylindrical\",geogcs[\"gcs_wgs_1984\",datum[\"wgs_1984\",spheroid[\"wgs_1984\",6378137,298.257223563]],primem[\"greenwich\",0],unit[\"degree\",0.017453292519943295]],projection[\"miller_cylindrical\"],parameter[\"false_easting\",0],parameter[\"false_northing\",0],parameter[\"central_meridian\",0],unit[\"meter\",1],authority[\"epsg\",\"54003\"]]"; coordinatereferencesystem crs; mathtransform transform; seek { crs = crsfactory.createfromwkt(wkt); transform = crs.findmathtransform(crs, worldcrs, true); system.out.println(transform.towkt()); system.out.println(transform.getclass().getcanonicalname()); } grab (exception e) { e.printstacktrace(); } seek { transform = crs.findmathtransform(crs.decode("epsg:54003"), worldcrs, true); system.out.println(transform.towkt()); system.out.println(transform.getclass().getcanonicalname()); } grab (exception e) { e.printstacktrace(); } seek { transform = crs.findmathtransform(crs.decode("esri:54003"), worldcrs, true); system.out.println(transform.towkt()); system.out.println(transform.getclass().getcanonicalname()); } grab (exception e) { e.printstacktrace(); }`

in pom, set dependency

<dependency> <groupid>org.geotools</groupid> <artifactid>gt-epsg-extension</artifactid> <version>11.1</version> <scope>compile</scope> </dependency>

in response receiving

org.opengis.referencing.nosuchidentifierexception: no transform classification "miller_cylindrical". @ org.geotools.referencing.operation.defaultmathtransformfactory.getprovider(defaultmathtransformfactory.java:290) @ org.geotools.referencing.operation.defaultmathtransformfactory.getdefaultparameters(defaultmathtransformfactory.java:316) @ org.geotools.referencing.wkt.parser.parseprojection(parser.java:603) @ org.geotools.referencing.wkt.parser.parseprojcs(parser.java:917) @ org.geotools.referencing.wkt.parser.parsecoordinatereferencesystem(parser.java:225) @ org.geotools.referencing.wkt.parser.parsecoordinatereferencesystem(parser.java:204) @ org.geotools.referencing.factory.referencingobjectfactory.createfromwkt(referencingobjectfactory.java:1090) @ ru.oogis.bank.sxf.testcrs.main(testcrs.java:25) org.opengis.referencing.factoryexception: error in "projection": no transform classification "miller_cylindrical". @ org.geotools.referencing.factory.propertyauthorityfactory.createcoordinatereferencesystem(propertyauthorityfactory.java:399) @ org.geotools.referencing.factory.bufferedauthorityfactory.createcoordinatereferencesystem(bufferedauthorityfactory.java:783) @ org.geotools.referencing.factory.fallbackauthorityfactory.createcoordinatereferencesystem(fallbackauthorityfactory.java:644) @ org.geotools.referencing.factory.fallbackauthorityfactory.createcoordinatereferencesystem(fallbackauthorityfactory.java:644) @ org.geotools.referencing.factory.fallbackauthorityfactory.createcoordinatereferencesystem(fallbackauthorityfactory.java:644) @ org.geotools.referencing.factory.authorityfactoryadapter.createcoordinatereferencesystem(authorityfactoryadapter.java:801) @ org.geotools.referencing.factory.threadedauthorityfactory.createcoordinatereferencesystem(threadedauthorityfactory.java:731) @ org.geotools.referencing.defaultauthorityfactory.createcoordinatereferencesystem(defaultauthorityfactory.java:179) @ org.geotools.referencing.crs.decode(crs.java:519) @ org.geotools.referencing.crs.decode(crs.java:447) @ ru.oogis.bank.sxf.testcrs.main(testcrs.java:36) caused by: java.text.parseexception: error in "projection": no transform classification "miller_cylindrical". @ org.geotools.referencing.wkt.parser.parseprojection(parser.java:605) @ org.geotools.referencing.wkt.parser.parseprojcs(parser.java:917) @ org.geotools.referencing.wkt.parser.parsecoordinatereferencesystem(parser.java:225) @ org.geotools.referencing.wkt.parser.parsecoordinatereferencesystem(parser.java:204) @ org.geotools.referencing.factory.propertyauthorityfactory.createcoordinatereferencesystem(propertyauthorityfactory.java:396) ... 10 more caused by: org.opengis.referencing.nosuchidentifierexception: no transform classification "miller_cylindrical". @ org.geotools.referencing.operation.defaultmathtransformfactory.getprovider(defaultmathtransformfactory.java:290) @ org.geotools.referencing.operation.defaultmathtransformfactory.getdefaultparameters(defaultmathtransformfactory.java:316) @ org.geotools.referencing.wkt.parser.parseprojection(parser.java:603) ... 14 more org.opengis.referencing.nosuchauthoritycodeexception: authorization "esri" unknown or doesn't match supplied hints. maybe defined in unreachable jar file? @ org.geotools.referencing.factory.manyauthoritiesfactory.nosuchauthority(manyauthoritiesfactory.java:489) @ org.geotools.referencing.factory.manyauthoritiesfactory.getauthorityfactory(manyauthoritiesfactory.java:467) @ org.geotools.referencing.factory.manyauthoritiesfactory.getcrsauthorityfactory(manyauthoritiesfactory.java:548) @ org.geotools.referencing.factory.authorityfactoryadapter.createcoordinatereferencesystem(authorityfactoryadapter.java:801) @ org.geotools.referencing.factory.threadedauthorityfactory.createcoordinatereferencesystem(threadedauthorityfactory.java:731) @ org.geotools.referencing.defaultauthorityfactory.createcoordinatereferencesystem(defaultauthorityfactory.java:179) @ org.geotools.referencing.crs.decode(crs.java:519) @ org.geotools.referencing.crs.decode(crs.java:447) @ ru.oogis.bank.sxf.testcrs.main(testcrs.java:46)

is there esri:54003 crs code?

your geotools not know esri:54003 crs. need utilize epsg:54003 or other crs instead.

java maven geotools

php casting variable to array -



php casting variable to array -

i dealing unusual issue of dealing garbage in iterating through variable has been cast array

$arr = (array)$var; // problem $arr = array($var); // ok

the first method seems work fine on values integers, not strings. there documented difference , php have real casting ?

the problem lavarel 4, database sources, function on line 704

if $var scalar, it's documented both lines same:

for of types: integer, float, string, boolean , resource, converting value array results in array single element index 0 , value of scalar converted. in other words, (array)$scalarvalue same array($scalarvalue).

http://www.php.net/manual/en/language.types.array.php#language.types.array.casting

php arrays casting

css3 - How to target only Ipad device not a browser view -



css3 - How to target only Ipad device not a browser view -

i have requirement want target ipad device not browser view (ctrl + shift + m : for mozilla)

i using @media screen , (min-device-width : 768px) , (-webkit-device-pixel-ratio : 1) , (orientation : portrait) not working .

try changing "1" "2" when specifying device pixel ratio.

(-webkit-device-pixel-ratio : 2)

css3

java - Leadbolt ad integration in libgdx -



java - Leadbolt ad integration in libgdx -

i'm new in libgdx , i'm trying show leadbolt ads in app. i've found forum thread http://www.badlogicgames.com/forum/viewtopic.php?f=11&t=9072&p=41323#p41323 communicating android , libgdx. i've build related interfaces , etc. interface works well, i've tried give message on showad() , works well. when i'm trying add together given code leadbolt, shows error on "this". code attached below. guess has simple solution java knowledge not plenty solution :)

public class androidbrowseropener implements actionresolver{ private adcontroller ad; @override public void showad() { // todo auto-generated method stub advertisement = new adcontroller(this, "my advertisement id"); ad.loadad(); } }

my main activity

public class mainactivity extends androidapplication { @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); initialize(new fatninja(new androidbrowseropener())); super.oncreate(savedinstancestate); } }

core interface

public interface actionresolver { public void showad(); }

i'm calling showad() main within create().

thanks replies.

edit:

thanks answer, i've found context illustration badlogic forums below, not showing ads. gives error: e/lbadcontroller(5088): loadad() failed - valid activity not passed code below:

public class androidbrowseropener implements actionresolver {

private adcontroller ad;

public androidbrowseropener(context context){ advertisement = new adcontroller(context, "my id"); } @override public void showad() { // todo auto-generated method stub ad.loadad(); system.out.println("it works"); } }

use adlistner instead of . think work

if posted code finish code have understand utilize of interface used. have send context phone call method. plz understand calling of method

java android libgdx leadbolt

Adding a new partition Kafka 0.8.1.1 -



Adding a new partition Kafka 0.8.1.1 -

for particular topic want have 1 partition per broker. thought scale maintain on adding brokers. however, when test out how new partitions added not work in way expect. example, have 3 brokers: 2064029428, 2064029280, 2064028458. create new topic:

/opt/kafka/bin/kafka-topics.sh --create --zookeeper zk.net:2181/stream --topic test --partitions 2 --replication-factor 1 /opt/kafka/bin/kafka-topics.sh --describe --zookeeper zk.net:2181/stream --topic test topic:test partitioncount:2 replicationfactor:1 configs: topic: test partition: 0 leader: 2064029428 replicas: 2064029428 isr: 2064029428 topic: test partition: 1 leader: 2064028458 replicas: 2064028458 isr: 2064028458

i alter topic add together partition.

/opt/kafka/bin/kafka-topics.sh --alter --zookeeper zk.net:2181/stream --topic test --partitions 3 /opt/kafka/bin/kafka-topics.sh --describe --zookeeper zk.net:2181/stream --topic test topic:test partitioncount:3 replicationfactor:1 configs: topic: test partition: 0 leader: 2064029428 replicas: 2064029428 isr: 2064029428 topic: test partition: 1 leader: 2064028458 replicas: 2064028458 isr: 2064028458 topic: test partition: 2 leader: 2064029428 replicas: 2064029428 isr: 2064029428

i have expected new partition have been created on broker 2064029280 since not have partition. instead 2 partitions on same broker 2064029428. expected? there way command new partition added? tried --replica-assignment option, works when creating topic, doesn't not work when altering topic.

as noted in kafka doc, have manually trigger reassignment.

in 0.8.1, partition reassignment tool not have capability automatically study info distribution in kafka cluster , move partitions around attain load distribution. such, admin has figure out topics or partitions should moved around.

in short have utilize bin/kafka-reassign-partitions.sh tool manually crafted migration plan.

see guide on manual reassignment more.

apache-kafka

Do I need to restart my system after setting JAVA in system environment's path variable? -



Do I need to restart my system after setting JAVA in system environment's path variable? -

i did next steps java not seem working me, need restart scheme if yes why?

1. right click computer->advence option->environment varibles->system variables 2. variable : path->edit 3. re-create jdk bin directory i.e.c:\program files\java\jdk1.7.0_51\bin 4. paste after putting semi-colon(;) in value section

i getting below error while running java in cmd

c:\users\user>java -version error: opening registry key 'software\javasoft\java runtime environment' error: not find java.dll error: not find java se runtime environment.

no, need close , recreate cmd windows, running java programs, or like.

to check it's correct, open new cmd window , type set -> review info path , java_home.

java java-home

Easiest way to grab and stream depth data from Asus Xtion with OpenNI to web browser -



Easiest way to grab and stream depth data from Asus Xtion with OpenNI to web browser -

i using debian , computer acts server, static ip address.

i connected asus xtion pro live it. works , can both depth , rgb values using sample application provided openni.

my question is: easiest , yet efficient way stream info web browser of computer connected same network (e.g. grayscale image or point cloud)?

any suggestion or illustration appreciated. thanks.

browser openni asus-xtion

jquery - How to add dynamic generated HTML at a certain place -



jquery - How to add dynamic generated HTML at a certain place -

i trying generate html .

<div class="order-listdetails-wrap"> <div class="ordertitle">popcorn - 250g</div> <div class="ordercont"> <div class="img"><img src="images/img_popcorn.jpg"/></div> <div class="orderprice"> <p>rs: <span>145</span></p> <p>qty: <span>1</span></p> <ul> <li>butter extra</li> <li>butter extra</li> </ul> </div> </div> </div>

the values of <li> tags under <ul> tags dynamic

i trying accomplish above using below procedure

// code generating ul , li tags .

var uitaghtml = $('<ul>'); (var k = 0; k < toppgs.length; i++) { uitaghtml.append('<li>' + toppgs[k] + '</li>') } uitaghtml.append('</ul>'); // code of above html without ul li tags var itemcart = '<div class="order-listdetails-wrap"> \ <div class="ordertitle">' + name + '</div> \ <div class="ordercont"> \ <div class="img"><img src="' + image + '"/></div> \ <div class="orderprice"> \ <p>rs: <span>' + cost + '</span></p> \ <p>qty: <span>' + quantity + '</span></p> \ </div> \ </div> \ </div>'; divhtml.append(itemcart);

could please help how add together dynamic generated html other dynamic generated css @ place .

i believe understand. quite close. check out modification here:

var uitaghtml = '<ul>'; (var k = 0; k < toppgs.length; i++) { uitaghtml += '<li>' + toppgs[k] + '</li>'; } var itemcart = '<div class="order-listdetails-wrap"> \ <div class="ordertitle">' + name + '</div> \ <div class="ordercont"> \ <div class="img"><img src="' + image + '"/></div> \ <div class="orderprice"> \ ' + uitaghtml + '</ul> \ </div> \ </div> \ </div>'; divhtml.append(itemcart);

since itemcart variable string, changed uitaghtml string , inserted wanted items listed. closing ul tweaked in string 1 less concatenation.

jquery html

c++ - Unknown Typename when declared in header -



c++ - Unknown Typename when declared in header -

for odd reason recieve unknown type name typedef void variable located in header file. naturally searched around net , while can noted found similar issues should noted not using ide vim , clang , don't have precompiled headers. in separate test ctrie_int header, compiles when extend implementation adding header implementation file of header weird error seen below. i'm sure simple issue i'm not sure is, suggestions?

clang++ -wall -wextra -g -std=c++11 lzwtest.cpp -o lzwtest dict; project compilation . . . . . compiling cpp file lzwtest.cpp ... in file included lzwtest.cpp:2: in file included ./lzw.h:23: in file included ./ctrie_int.h:36: ./ctrie_int.ii:7:1: error: unknown type name 'trie_int' trie_int * newtrie_int(int defval){return new trie<int>(defval);} ^ ./ctrie_int.ii:7:43: error: cannot initialize homecoming object of type 'int *' rvalue of type 'trie<int> *' trie_int * newtrie_int(int defval){return new trie<int>(defval);} ^~~~~~~~~~~~~~~~~~~~~ ./ctrie_int.ii:9:21: error: unknown type name 'trie_int' void deletetrie_int(trie_int * trie){delete ((trie<int> *)trie);} ^ ./ctrie_int.ii:11:19: error: unknown type name 'trie_int' int trie_int_size(trie_int * t){return ((trie<int> *)t)->size();} ^ ./ctrie_int.ii:13:30: error: unknown type name 'trie_int' int trie_int_getdefaultvalue(trie_int * t){return ((trie<int> *)t)->getdefaultvalue();} ^ ./ctrie_int.ii:15:23: error: unknown type name 'trie_int' int trie_int_contains(trie_int * t,const char * key){return ((trie<int> *)t)->contains(key); } ^ ./ctrie_int.ii:17:18: error: unknown type name 'trie_int' int trie_int_get(trie_int * t,char * key){return ((trie<int> *)t)->get(key); } ^ ./ctrie_int.ii:19:19: error: unknown type name 'trie_int' void trie_int_put(trie_int * t,char * s,int val){ ((trie<int> *)t)->put(s,val);} ^ ./ctrie_int.ii:21:37: error: unknown type name 'trie_int' const char * trie_int_longestprefix(trie_int * t,char * s){return ((trie<int> *)t)->longestprefix(s).c_str();} ^ ./ctrie_int.ii:23:23: error: unknown type name 'trie_int' int trie_int_compress(trie_int * t){return ((trie<int> *)t)->compress();} ^ 10 errors generated.

below header file beingness included

ctrie_int.h

#ifndef com_wordgame_utility_ctrie_h #define com_wordgame_utility_ctrie_h #ifdef __cplusplus extern "c"{ //this used identify next code c specific code enforce c style name mangling #endif //declare new void type emulate c class typedef void trie_int; ...removed in effort shorten question #ifdef __cplusplus } #endif #endif

this file uses previous simple code or inclusion of header file of lastly causes error described in beginning

#ifndef com_wordgame_utility_ctrie_h #define com_wordgame_utility_ctrie_h #ifdef __cplusplus extern "c"{ //this used identify next code c specific code enforce c style name mangling #endif void compress(char src[],char dst[]); void decompress(char src[],char dst[]); #ifdef __cplusplus } #endif #endif //below code added in file #include <stdio.h> #include <stdlib.h> #include "ctrie_int.h" // causes issue cannot find trie_int functions homecoming odd message describing trie_int defered actual pointer integer

for clarity first few lines of ctrie.ii looks this

//#include "ctrie_int.h" //should not included create cycle since ctrie_int.h declares @ final line #include "trie.hpp" //c++ code //this has compiled c++ compiler compiled anyway gaurds uneeded extern "c"{ //create new trie_int object trie_int * newtrie_int(int defval){return new trie<int>(defval);} ....removed in effort shorten question }

the clue in first stages of error message:

compiling cpp file lzwtest.cpp ... in file included lzwtest.cpp:2: in file included ./lzw.h:23: in file included ./ctrie_int.h:36: <<< here ./ctrie_int.ii:7:1: error: unknown type name 'trie_int'

it appears file ctrie_int.ii beingness included header before trie_int has been defined.

c++ c typename

dynamic - In SQL, how to find all rows where ANY column meets a condition? -



dynamic - In SQL, how to find all rows where ANY column meets a condition? -

i want find rows in table column meets condition.

for example, if have table robtest:

-- illustration table create table #robtest (a varchar(10), b varchar(10), c varchar(10)) insert #robtest select 'blue', 'green', 'green' union select 'green', 'blue', 'green' union select 'green', 'green', 'green'

if wanted find rows column has field value 'blue', write:

select * #robtest = 'blue' or b = 'blue' or c = 'blue'

and obtain rows 1 , 2. solution unweildy if table had dozens of column names or if can't sure column names might alter , running query audit, instance. how dynamically?

we can utilize information_schema.columns find column names, utilize cursor iterate on columns, using dynamic sql populate temporary table rows satisfying condition.

following code above, assuming #robtest definition given in question:

-- find columns of #robtest select column_name #columnnames tempdb.information_schema.columns table_name '%robtest%' -- create place hold our results select * #robtemp #robtest truncate table #robtemp -- set varaibles our iteration process declare @sql nvarchar(1000) declare @columncursor cursor declare @currentcolumn nvarchar(100) set @columncursor = cursor select column_name #columnnames -- go through columns 1 @ time , run query on column. open @columncursor fetch next @columncursor @currentcolumn while @@fetch_status = 0 begin set @sql = 'select * #robtest ' + @currentcolumn + ' = ''blue''' insert #robtemp exec sp_executesql @sql fetch next @columncursor @currentcolumn end -- show results select * #robtemp

sql dynamic

javascript - Meteor.js: Execute method after list has been populated -



javascript - Meteor.js: Execute method after list has been populated -

i started working on meteorite bundle adds groups/headlines lists. see demo here. source code demo here.

basically, want wait list exclusively populated , phone call method sets headlines/groups etc. way calling handlebars helper after {{#each}} loop, this:

<ul> {{#each listitems }} {{> listitem }} {{/each}} </ul> {{ grouplist }}

where grouplist helper executes code want run efter loop gets run (the code sets headlines).

this feels kind of ugly, , think prefer kind of callback {{#each}} loop gets called after it's finished iterating (and importantly if items in loop change). sort of rendered() method templates guess. (and i've of course of study tried rendered() method already, get's executed before loop run.)

is there such callback? or other technique less ugly 1 utilize handlebars helper?

rather letting blaze render list , using jquery add together headers, grouping , headers in template itself, this:

class="lang-html prettyprint-override"><template name="grouped"> {{#each groups}} <h2>{{heading}}</h2> {{#each items}} {{> item}} {{/each}} {{/each}} </template> class="lang-js prettyprint-override">template.grouped.groups = function () { homecoming _.chain(listitems.find().fetch()) .groupby("wins") .pairs() .map(function (pair) {return {heading: pair[0], items: pair[1]};}) .value(); };

this seems more 'meteoric' me - imperative dom manipulation wrong approach in meteor. i'm not sure how performance compares.

javascript meteor

c++ - Member function pointer wrapper using variadic template -



c++ - Member function pointer wrapper using variadic template -

i'm trying compile code using visual c++ 2013 , want take advantage of variadic templates. have several classes wrap function pointer - several versions different number of arguments.

the wrapper fellow member function 1 argument following:

template <typename t, t> struct proxy; template <typename t, typename r, typename arg0, r(t::*mf)(arg0)> struct proxy<r(t::*)(arg0), mf> { proxy(t& host) : m_host(host) {} template <typename arg0> r call(arg0&& arg0) { homecoming (m_host.*mf)(std::forward<arg0>(arg0)); } private: proxy& operator=(const proxy&); t& m_host; };

let's have test class:

class somehost { public: int somegetter() { homecoming 42; } void somesetter(int var) { m_var = var;} private: int m_var; };

and test case:

void test() { somehost obj; proxy<void(somehost::*)(int), &somehost::somesetter> g(obj); g.call(5); }

everything works fine far. rewrote proxy class using variadic template:

template <typename t, typename r, typename... args, r(t::*mf)(args...)> struct proxy<r(t::*)(args...), mf> { proxy(t& host) : m_host(host) {} template <typename... args> r call(args&&... args) { homecoming (m_host.*mf)(std::forward<args>(args)...); } private: proxy& operator=(const proxy&); t& m_host; };

using variadic template, visual c++ 2013 shows me several compiler errors coming test function:

file.cpp(79): error c2440: 'specialization' : cannot convert 'overloaded-function' 'void (__thiscall somehost::* )(void)' 1> none of functions name in scope match target type: see reference class template instantiation 'proxy<void (__thiscall somehost::* )(int),somehost::somesetter>' beingness compiled 1>file.cpp(79): error c2973: 'proxy<r(__thiscall t::* )(args...),mf>' : invalid template argument 'overloaded-function' 1>file.cpp(40) : see declaration of 'proxy<r(__thiscall t::* )(args...),mf>'

i tested template somehost::somegetter() , worked without problems.

any help highly appreciated.

thanks lot...

c++ templates c++11 variadic-templates member-function-pointers

c# - Android Socket/ServerSocket vs URLConnection -



c# - Android Socket/ServerSocket vs URLConnection -

i have android <-> server (c#) scheme passes strings between eachother via sockets/serversockets.it works nice when both on same lan, if android not on lan then, can't receive info (nats, port forwardings , so) on android client, because of blocked ports mobile net providers.

can replace sockets urlconnection?i passing strings.

c# android sockets

How to get xml tag value using attribute value in java -



How to get xml tag value using attribute value in java -

how xml tag value using attribute value in java?

the format of xml is:

<str name="total requests made datasource">0</str> <str name="total rows fetched">0</str>

say eg: need tag value 0 using total requests made datasource value.

find element using xpath:

//str[@name='total requests made datasource']

once found element(s), extract text content.

java xml

css - Why - cursor: pointer style being overridden for input in chrome and firefox -



css - Why - cursor: pointer style being overridden for input in chrome and firefox -

i'm trying set cursor: pointer on dom element, input isn't taking it. in chrome, see "user agent stylesheet" overriding css. wtf?

<!doctype html> <body> <div class='a'> <input type='checkbox'> </div> <style> .a { cursor: pointer; } </style> </body>

i have seen question: why user agent stylesheet override styles? problem not seem doctype, the recommended doctype.

using !important isn't acceptable here, shouldn't have worry weird browser useragent styles. what's going on?

update: clarify, question why user agent stylesheet overriding css , how create that stop. question not how can hack around behavior. right behavior of css cursor style should inherited kid nodes.

you need add together cursor:pointer input tag instead of surrounding div.

input { cursor: inherit; }

the user agent stylesheet overriding input, not parent.

css google-chrome firefox

Java ternary operator influence on generics type inference -



Java ternary operator influence on generics type inference -

public list<string> foo1() { list<string> retval = bar(); if (retval == null) homecoming collections.emptylist(); else homecoming retval; } public list<string> foo2() { list<string> retval = bar(); homecoming retval == null ? collections.emptylist() : retval; }

why foo1() compiles fine whereas foo2() has error? (to more precise "type mismatch: cannot convert list<capture#1-of ? extends object> list<string>")

i have thought both functions compile same bytecode, clever compiler should infer right type emptylist()...

compiles me fine in java 8.

earlier versions of java might need more help

return retval == null ? collections.<string>emptylist() : retval;

should work.

edit due improvements in java 8 type inference explained here

http://openjdk.java.net/jeps/101

and here's blog highlights: http://blog.jooq.org/2013/11/25/a-lesser-known-java-8-feature-generalized-target-type-inference/

java generics compiler-errors java-7

javascript - openERP 7: How to get the Model name and Action of the Current page? -



javascript - openERP 7: How to get the Model name and Action of the Current page? -

i don't how inquire this, assuming user goes "accounting" > "suppliers" > "purchase receipts", need @ page. how know @ page? solution variable instance i'm not getting luck or looking @ wrong way?

my code:

instance.web.viewmanageraction = instance.web.viewmanageraction.extend({ switch_mode: function(view_type, no_store, view_options){ // testing, output console results similar console.log( "account.voucher" + "action='action_purchase_receipt'" ); // other code homecoming this._super(view_type, no_store, view_options); } });

code /addons/account_voucher:

<menuitem id="menu_action_purchase_receipt" icon="stock_justify_fill" action="action_purchase_receipt" parent="account.menu_finance_payables" sequence="10" />

in method phone call self._name model name.

javascript openerp web-frameworks openerp-7

c++ - Generate a keyPressEvent/Input -



c++ - Generate a keyPressEvent/Input -

i need generate input of keyboard because have event attached input. seek phone call :

keypressevent(qt::key_delete);

without sucess, there way generate keypressevent ?

you might utilize qkeyevent.

are using qt4 or qt5?

have @ this:

http://stackoverflow.com/a/2035547/3751213

it might help.

or, if using linux xte great. included in xautomation.

xte 'key delete'

look here: http://linux.die.net/man/1/xte

c++ qt input keyevent

javascript - How does the "this" keyword work? -



javascript - How does the "this" keyword work? -

i have noticed there doesn't appear clear explanation of this keyword , how correctly (and incorrectly) used in javascript on stack overflow site.

i have witnessed unusual behaviour , have failed understand why has occurred.

how this work , when should used?

i recommend reading mike west's article scope in javascript (mirror) first. excellent, friendly introduction concepts of this , scope chains in javascript.

once start getting used this, rules pretty simple. ecmascript standard defines this keyword "evaluates value of thisbinding of current execution context" (§11.1.1). thisbinding javascript interpreter maintains evaluates javascript code, special cpu register holds reference object. interpreter updates thisbinding whenever establishing execution context in 1 of 3 different cases:

initial global execution context

this case javascript code evaluated when <script> element encountered:

<script type="text/javascript">//<![cdata[ alert("i'm evaluated in initial global execution context!"); settimeout(function () { alert("i'm not evaluated in initial global execution context."); }, 1); //]]></script>

when evaluating code in initial global execution context, thisbinding set global object, window (§10.4.1.1).

entering eval code

... direct phone call eval()

thisbinding left unchanged; same value thisbinding of calling execution context (§10.4.2(2)(a)).

... if not direct phone call eval()

thisbinding set global object as if executing in initial global execution context (§10.4.2(1)).

§15.1.2.1.1 defines direct phone call eval() is. basically, eval(...) direct phone call whereas (0, eval)(...) or var indirecteval = eval; indirecteval(...); indirect phone call eval(). see chuckj's answer (1,eval)('this') vs eval('this') in javascript? , this blog post dmitry soshnikov when might utilize indirect eval() call.

entering function code

this occurs when calling function. if function called on object, such in obj.mymethod() or equivalent obj["mymethod"](), thisbinding set object (obj in example; §13.2.1). in other cases, thisbinding set global object (§10.4.3).

the reason writing "in other cases" because there 8 ecmascript 5 built-in functions allow thisbinding specified in arguments list. these special functions take so-called thisarg becomes thisbinding when calling function (§10.4.3).

these special built-in functions are:

function.prototype.apply( thisarg, argarray ) function.prototype.call( thisarg [ , arg1 [ , arg2, ... ] ] ) function.prototype.bind( thisarg [ , arg1 [ , arg2, ... ] ] ) array.prototype.every( callbackfn [ , thisarg ] ) array.prototype.some( callbackfn [ , thisarg ] ) array.prototype.foreach( callbackfn [ , thisarg ] ) array.prototype.map( callbackfn [ , thisarg ] ) array.prototype.filter( callbackfn [ , thisarg ] )

in case of function.prototype functions, called on function object, rather setting thisbinding function object, thisbinding set thisarg.

in case of array.prototype functions, given callbackfn called in execution context thisbinding set thisarg if supplied; otherwise, global object.

those rules plain javascript. when begin using javascript libraries (e.g. jquery), may find library functions manipulate value of this. developers of javascript libraries because tends back upwards mutual utilize cases, , users of library typically find behavior more convenient. when passing callback functions referencing this library functions, should refer documentation guarantees value of this when function called.

if wondering how javascript library manipulates value of this, library using 1 of built-in javascript functions accepting thisarg. you, too, can write own function taking callback function , thisarg:

function dowork(callbackfn, thisarg) { //... if (callbackfn != null) callbackfn.call(thisarg); }

edit:

i forgot special case. when constructing new object via new operator, javascript interpreter creates new, empty object, sets internal properties, , calls constructor function on new object. thus, when function called in constructor context, value of this new object interpreter created:

function mytype() { this.somedata = "a string"; } var instance = new mytype(); // kind of following, there more steps involved: // var instance = {}; // mytype.call(instance);

quiz: fun, test understanding next examples.

to reveal answers, mouse on lite yellowish boxes.

what value of this @ line a? why?

<script type="text/javascript"> if (true) { // line } </script>

window

line evaluated in initial global execution context.

what value of this @ line b when obj.staticfunction() executed? why?

<script type="text/javascript"> var obj = { somedata: "a string" }; function myfun() { // line b } obj.staticfunction = myfun; obj.staticfunction(); </script>

obj

when calling function on object, thisbinding set object.

what value of this @ line c? why?

<script type="text/javascript"> var obj = { mymethod : function () { // line c } }; var myfun = obj.mymethod; myfun(); </script>

window

in example, javascript interpreter enters function code, because myfun/obj.mymethod not called on object, thisbinding set window.

this different python, in accessing method (obj.mymethod) creates bound method object.

what value of this @ line d? why?

<script type="text/javascript"> function myfun() { // line d } var obj = { mymethod : function () { eval("myfun()"); } }; obj.mymethod(); </script>

window

this 1 tricky. when evaluating eval code, this obj. however, in eval code, myfun not called on object, thisbinding set window call.

what value of this @ line e?

<script type="text/javascript"> function myfun() { // line e } var obj = { somedata: "a string" }; myfun.call(obj); </script>

obj

the line myfun.call(obj); invoking special built-in function function.prototype.call(), accepts thisarg first argument.

javascript this

javascript - Using php variables for image location, use onclick to run through image gallery -



javascript - Using php variables for image location, use onclick to run through image gallery -

i'm making simple database query returns several images. these images stored in php variable, javascript gallery showing 1 image @ time , using onclick function run though images. not working, please help!

my database query returns images, each set variable. variables set array (because thought should easier run through array)

$img1 = $row['img1']; $img2 = $row['img2']; $img3 = $row['img3']; $images = array($img1,$img2,$img3);

on page gallery section shows first image fine

<div id="showimage"> <img src= " <?php echo "$images[0]" ?>" id="gallery"> <div id="rightholder"><img onclick="gallery(1)" src="images/arrow-right.png"></div> <div id="leftholder"><img onclick="gallery(-1)" src="images/arrow-left.png"></div> </div>

but javascript wont date array key $images onclick, sec image not loaded.

var imagecount = 1; var totalimage = 3; function gallery(x) { var image = document.getelementbyid('gallery'); imagecount = imagecount + x; if(imagecount > totalimage){imagecount = 1;} if(imagecount < 1){imagecount = totalimage;} image.src = "<?php echo $images["+ imagecount +"]?>"; }

you cant this: image.src = "<?php echo $images["+ imagecount +"]?>";

js runs in browser. js not have php data.

you seek in js file:

var images = "<?php echo implode(",", $images); ?>"; images = images.split(",");

with piece of js can phone call image doing:

image.src = images[imagecount];

what takes php array, makes string seperated commas. string gets split on comma in js array.

javascript php image

c# - Stored Procedure does not call Update Command -



c# - Stored Procedure does not call Update Command -

i have stored procedure re-create info various tables of security db tenant db. in procedure performing insert operation followed update query. both of commands should execute each time procedure when execute procedure not execute update query. here construction of procedure:

complete sp:

alter procedure [ams].[usp_copymasterservicedatatoclient] @serviceids [varchar] (max) execute caller begin declare @processid uniqueidentifier declare @steps int set @processid = newid() set @steps = 1 exec usp_insertserverprocesslog 'usp_copymasterservicedatatoclient' ,@steps ,'starting procedure usp_copymasterservicedatatoclient' ,@processid ,'info' begin seek select * #serviceids ams.splitdelimiterstring(@serviceids, ',') select bs.* #tmpbkgservices [ams].[syn_backgroundservice] bs inner bring together #serviceids si on bs.[bse_id] = si.item bs.bse_isdeleted = 0 select * #tmpbkgserviceswithchilds #tmpbkgservices union select mbs.* #tmpbkgservices bs inner bring together [ams].[syn_backgroundservice] mbs on bs.[bse_id] = mbs.bse_parentserviceid bs.bse_isdeleted = 0 select #tmpbkgserviceswithchilds.bse_id item #serviceid #tmpbkgserviceswithchilds --for storing mappings bkgattributegroupmapping , bkgsvcattributegroupmapping based on service ids select * #tmpbkgattrgrpandbkgsvcattrgrpmapping [ams].[syn_backgroundservice] bs inner bring together [ams].[syn_bkgsvcattributegroupmapping] bpagp on bs.bse_id = bpagp.bsagm_serviceid , bpagp.bsagm_isdeleted = 0 inner bring together [ams].[syn_bkgattributegroupmapping] bsagm on bsagm.bagm_id = bpagp.bsagm_attributegroupmappingid , bsagm.bagm_isdeleted = 0 inner bring together #serviceid si on bs.[bse_id] = si.item bs.bse_isdeleted = 0 --for bkgsvcattributes select distinct [bsa_id] ,[bsa_name] ,[bsa_description] ,[bsa_label] ,[bsa_datatypeid] ,[bsa_isrequired] ,[bsa_reqvalidationmessage] ,[bsa_maxintvalue] ,[bsa_minintvalue] ,[bsa_maxdatevalue] ,[bsa_mindatevalue] ,[bsa_maxlength] ,[bsa_minlength] ,[bsa_iseditable] ,[bsa_issystempreconfiguredq] ,[bsa_code] ,[bsa_copiedfromcode] ,[bsa_isdeleted] ,[bsa_createdbyid] ,[bsa_createddate] ,[bsa_modifiedby] ,[bsa_modifieddate] ,[bsa_active] #tmpbkgsvcattributes #tmpbkgattrgrpandbkgsvcattrgrpmapping bs inner bring together [ams].[syn_bkgsvcattribute] bsa on bs.bagm_bkgsvcatributeid = bsa.bsa_id --and bsa.bsa_active = 1 , bsa.bsa_isdeleted = 0 --for bkgsvcattributeoption select [ebsao_id] ,[ebsao_bkgsvcattributeid] ,[ebsao_optiontext] ,[ebsao_optionvalue] ,[ebsao_isdeleted] ,[ebsao_isactive] ,[ebsao_createdbyid] ,[ebsao_createdon] ,[ebsao_modifiedbyid] ,[ebsao_modifiedon] #tmpbkgsvcattributeoption #tmpbkgsvcattributes tmpbsa inner bring together [ams].[syn_bkgsvcattributeoption] bsao on tmpbsa.bsa_id = bsao.ebsao_bkgsvcattributeid --and bsao.ebsao_isactive = 1 , bsao.ebsao_isdeleted = 0 --for bkgsvgattributesgroup select distinct [bsad_id] ,[bsad_name] ,[bsad_description] ,[bsad_iseditable] ,[bsad_issystempreconfigured] ,[bsad_code] ,[bsad_copiedfromcode] ,[bsad_isdeleted] ,[bsad_createdbyid] ,[bsad_createddate] ,[bsad_modifiedby] ,[bsad_modifieddate] --,[bsad_isrequired] #tmpbkgsvcattributesgroup #tmpbkgattrgrpandbkgsvcattrgrpmapping bs inner bring together [ams].[syn_bkgsvcattributegroup] bsag on bsag.bsad_id = bs.bagm_bkgsvcattributegroupid , bsag.bsad_isdeleted = 0 --for backgroundservices select distinct [bse_id] ,[bse_name] ,[bse_description] ,[bse_svctypeid] ,[bse_iseditable] ,[bse_issystempreconfigured] ,[bse_isdeleted] ,[bse_createdbyid] ,[bse_createddate] ,[bse_modifiedby] ,[bse_modifieddate] ,[bse_clientcount] ,[bse_parentserviceid] #tmpbackgroundservices #tmpbkgserviceswithchilds tmpbs tmpbs.bse_id not in ( select cbs.bse_id ams.backgroundservice cbs ) --for bkgattributegroupmapping select distinct [bagm_id] ,[bagm_bkgsvcattributegroupid] ,[bagm_bkgsvcatributeid] ,[bagm_iseditable] ,[bagm_issystempreconfigured] ,[bagm_code] ,[bagm_copiedfromcode] ,[bagm_isdeleted] ,[bagm_createdby] ,[bagm_createdon] ,[bagm_modifiedby] ,[bagm_modifiedon] ,[bagm_isdisplay] ,[bagm_displaysequence] ,[bagm_isrequired] #tmpbkgattributegroupmapping #tmpbkgattrgrpandbkgsvcattrgrpmapping tmpbagbsg tmpbagbsg.bagm_id not null , tmpbagbsg.bagm_id not in ( select cbagm.bagm_id ams.bkgattributegroupmapping cbagm ) --for bkgattributegroupmapping - entries select distinct [bagm_id] ,[bagm_bkgsvcattributegroupid] ,[bagm_bkgsvcatributeid] ,[bagm_iseditable] ,[bagm_issystempreconfigured] ,[bagm_code] ,[bagm_copiedfromcode] ,[bagm_isdeleted] ,[bagm_createdby] ,[bagm_createdon] ,[bagm_modifiedby] ,[bagm_modifiedon] ,[bagm_isdisplay] ,[bagm_displaysequence] ,[bagm_isrequired] #tmpbkgattributegroupmapping_allentries #tmpbkgattrgrpandbkgsvcattrgrpmapping tmpbagbsg tmpbagbsg.bagm_id not null --for bkgsvcattributegroupmapping select distinct [bsagm_id] ,[bsagm_serviceid] ,[bsagm_attributegroupmappingid] ,[bsagm_iseditable] ,[bsagm_issystempreconfigured] ,[bsagm_isdeleted] ,[bsagm_createdby] ,[bsagm_createdon] ,[bsagm_modifiedby] ,[bsagm_modifiedon] ,[bsagm_code] ,[bsagm_copiedfromcode] #tmpbkgsvcattributegroupmapping #tmpbkgattrgrpandbkgsvcattrgrpmapping tmpbagbsg tmpbagbsg.bsagm_id not null , tmpbagbsg.bsagm_id not in ( select cbsagm.bsagm_id ams.bkgsvcattributegroupmapping cbsagm ) --for bkgsvcattributegroupmapping-allentries select distinct [bsagm_id] ,[bsagm_serviceid] ,[bsagm_attributegroupmappingid] ,[bsagm_iseditable] ,[bsagm_issystempreconfigured] ,[bsagm_isdeleted] ,[bsagm_createdby] ,[bsagm_createdon] ,[bsagm_modifiedby] ,[bsagm_modifiedon] ,[bsagm_code] ,[bsagm_copiedfromcode] #tmpbkgsvcattributegroupmapping_allentries #tmpbkgattrgrpandbkgsvcattrgrpmapping tmpbagbsg tmpbagbsg.bsagm_id not null begin transaction -- inserting info -- 1. insert info tenant attribute security attribute if exists ( select 1 #tmpbkgsvcattributes ) begin insert [ams].[bkgsvcattribute] ( [bsa_id] ,[bsa_name] ,[bsa_description] ,[bsa_label] ,[bsa_datatypeid] ,[bsa_isrequired] ,[bsa_reqvalidationmessage] ,[bsa_maxintvalue] ,[bsa_minintvalue] ,[bsa_maxdatevalue] ,[bsa_mindatevalue] ,[bsa_maxlength] ,[bsa_minlength] ,[bsa_iseditable] ,[bsa_issystempreconfiguredq] ,[bsa_code] ,[bsa_copiedfromcode] ,[bsa_isdeleted] ,[bsa_createdbyid] ,[bsa_createddate] ,[bsa_modifiedby] ,[bsa_modifieddate] ,[bsa_active] ) select [bsa_id] ,[bsa_name] ,[bsa_description] ,[bsa_label] ,[bsa_datatypeid] ,[bsa_isrequired] ,[bsa_reqvalidationmessage] ,[bsa_maxintvalue] ,[bsa_minintvalue] ,[bsa_maxdatevalue] ,[bsa_mindatevalue] ,[bsa_maxlength] ,[bsa_minlength] ,[bsa_iseditable] ,[bsa_issystempreconfiguredq] ,[bsa_code] ,[bsa_copiedfromcode] ,[bsa_isdeleted] ,[bsa_createdbyid] ,getutcdate() --[bsa_createddate] ,[bsa_modifiedby] ,[bsa_modifieddate] ,[bsa_active] #tmpbkgsvcattributes #tmpbkgsvcattributes.bsa_id not in ( select cbsa.bsa_id ams.bkgsvcattribute cbsa ) end -- 2. insert info tenant attributegroup security attribute grouping if exists ( select 1 #tmpbkgsvcattributesgroup ) begin insert [ams].[bkgsvcattributegroup] ( [bsad_id] ,[bsad_name] ,[bsad_description] ,[bsad_iseditable] ,[bsad_issystempreconfigured] ,[bsad_code] ,[bsad_copiedfromcode] ,[bsad_isdeleted] ,[bsad_createdbyid] ,[bsad_createddate] ,[bsad_modifiedby] ,[bsad_modifieddate] ) --,[bsad_isrequired] select [bsad_id] ,[bsad_name] ,[bsad_description] ,[bsad_iseditable] ,[bsad_issystempreconfigured] ,[bsad_code] ,[bsad_copiedfromcode] ,[bsad_isdeleted] ,[bsad_createdbyid] ,getutcdate() --[bsad_createddate] ,[bsad_modifiedby] ,[bsad_modifieddate] --,[bsad_isrequired] #tmpbkgsvcattributesgroup #tmpbkgsvcattributesgroup.bsad_id not in ( select cbsad.bsad_id ams.bkgsvcattributegroup cbsad ) end -- 3. insert info tenant backgroundservice security backgroundservices if exists ( select 1 #tmpbackgroundservices ) begin insert [ams].[backgroundservice] ( [bse_id] ,[bse_name] ,[bse_description] ,[bse_svctypeid] ,[bse_iseditable] ,[bse_issystempreconfigured] ,[bse_isdeleted] ,[bse_createdbyid] ,[bse_createddate] ,[bse_modifiedby] ,[bse_modifieddate] ,[bse_clientcount] ,[bse_parentserviceid] ) select [bse_id] ,[bse_name] ,[bse_description] ,[bse_svctypeid] ,[bse_iseditable] ,[bse_issystempreconfigured] ,[bse_isdeleted] ,[bse_createdbyid] ,getutcdate() --[bse_createddate] ,[bse_modifiedby] ,[bse_modifieddate] ,null ,[bse_parentserviceid] #tmpbackgroundservices end -- 4. insert info tenant [bkgattributegroupmapping] security [bkgattributegroupmapping] if exists ( select 1 #tmpbkgattributegroupmapping ) begin insert [ams].[bkgattributegroupmapping] ( [bagm_id] ,[bagm_bkgsvcattributegroupid] ,[bagm_bkgsvcatributeid] ,[bagm_iseditable] ,[bagm_issystempreconfigured] ,[bagm_code] ,[bagm_copiedfromcode] ,[bagm_isdeleted] ,[bagm_createdby] ,[bagm_createdon] ,[bagm_modifiedby] ,[bagm_modifiedon] ,[bagm_isdisplay] ,[bagm_displaysequence] ,[bagm_isrequired] ) select [bagm_id] ,[bagm_bkgsvcattributegroupid] ,[bagm_bkgsvcatributeid] ,[bagm_iseditable] ,[bagm_issystempreconfigured] ,[bagm_code] ,[bagm_copiedfromcode] ,[bagm_isdeleted] ,[bagm_createdby] ,getutcdate() --[bagm_createdon] ,[bagm_modifiedby] ,[bagm_modifiedon] ,[bagm_isdisplay] ,[bagm_displaysequence] ,[bagm_isrequired] #tmpbkgattributegroupmapping end -- 5. insert info tenant [bkgsvcattributegroupmapping] security bkgsvcattributegroupmapping if exists ( select 1 #tmpbkgsvcattributegroupmapping ) begin insert [ams].[bkgsvcattributegroupmapping] ( [bsagm_id] ,[bsagm_serviceid] ,[bsagm_attributegroupmappingid] ,[bsagm_iseditable] ,[bsagm_issystempreconfigured] ,[bsagm_isdeleted] ,[bsagm_createdby] ,[bsagm_createdon] ,[bsagm_modifiedby] ,[bsagm_modifiedon] ,[bsagm_code] ,[bsagm_copiedfromcode] ) select [bsagm_id] ,[bsagm_serviceid] ,[bsagm_attributegroupmappingid] ,[bsagm_iseditable] ,[bsagm_issystempreconfigured] ,[bsagm_isdeleted] ,[bsagm_createdby] ,getutcdate() --[bsagm_createdon] ,[bsagm_modifiedby] ,[bsagm_modifiedon] ,[bsagm_code] ,[bsagm_copiedfromcode] #tmpbkgsvcattributegroupmapping end -- 6. insert info tenant [bkgsvcattributeoption] security bkgsvcattributeoption if exists ( select 1 #tmpbkgsvcattributeoption ) begin insert [ams].[bkgsvcattributeoption] ( [ebsao_id] ,[ebsao_bkgsvcattributeid] ,[ebsao_optiontext] ,[ebsao_optionvalue] ,[ebsao_isdeleted] ,[ebsao_isactive] ,[ebsao_createdbyid] ,[ebsao_createdon] ,[ebsao_modifiedbyid] ,[ebsao_modifiedon] ) select [ebsao_id] ,[ebsao_bkgsvcattributeid] ,[ebsao_optiontext] ,[ebsao_optionvalue] ,[ebsao_isdeleted] ,[ebsao_isactive] ,[ebsao_createdbyid] ,getutcdate() --[ebsao_createdon] ,[ebsao_modifiedbyid] ,[ebsao_modifiedon] #tmpbkgsvcattributeoption #tmpbkgsvcattributeoption.ebsao_id not in ( select cbsao.ebsao_id ams.bkgsvcattributeoption cbsao ) end --for storing mappings bkgattributegroupmapping , bkgsvcattributegroupmapping based on service id select * #tmpclientattrgrpandsvcattrgrpmapping [ams].[backgroundservice] bs inner bring together [ams].[bkgsvcattributegroupmapping] bpagp on bs.bse_id = bpagp.bsagm_serviceid , bpagp.bsagm_isdeleted = 0 inner bring together [ams].[bkgattributegroupmapping] bsagm on bsagm.bagm_id = bpagp.bsagm_attributegroupmappingid , bsagm.bagm_isdeleted = 0 inner bring together #serviceid si on bs.[bse_id] = si.item bs.bse_isdeleted = 0 -- bkgattributegroupmapping select distinct [bagm_id] ,[bagm_bkgsvcattributegroupid] ,[bagm_bkgsvcatributeid] ,[bagm_iseditable] ,[bagm_issystempreconfigured] ,[bagm_code] ,[bagm_copiedfromcode] ,[bagm_isdeleted] ,[bagm_createdby] ,[bagm_createdon] ,[bagm_modifiedby] ,[bagm_modifiedon] ,[bagm_isdisplay] ,[bagm_displaysequence] ,[bagm_isrequired] #tmpclientbkgattributegroupmap #tmpclientattrgrpandsvcattrgrpmapping select * #tempunmatchedbkgattributegroupmap #tmpclientbkgattributegroupmap t2 not exists ( select * #tmpbkgattributegroupmapping_allentries t1 t1.bagm_id = t2.bagm_id ) -- bkgsvcattributegroupmapping select distinct [bsagm_id] ,[bsagm_serviceid] ,[bsagm_attributegroupmappingid] ,[bsagm_iseditable] ,[bsagm_issystempreconfigured] ,[bsagm_isdeleted] ,[bsagm_createdby] ,[bsagm_createdon] ,[bsagm_modifiedby] ,[bsagm_modifiedon] ,[bsagm_code] ,[bsagm_copiedfromcode] #tmpclientbkgsvcattributegroupmap #tmpclientattrgrpandsvcattrgrpmapping select * #tempunmatchedbkgsvcattributegroupmap #tmpclientbkgsvcattributegroupmap t2 not exists ( select * #tmpbkgsvcattributegroupmapping_allentries t1 t1.bsagm_id = t2.bsagm_id ) --do not delete --update [ams].[bkgattributegroupmapping] --set bagm_isdeleted = 1 -- ,bagm_modifiedon = getdate() --where bagm_id in ( -- select bagm_id -- #tempunmatchedbkgattributegroupmap -- ); update bsagm set bsagm.bsagm_isdeleted=1,bsagm.bsagm_modifiedon=getutcdate() [ams].[bkgsvcattributegroupmapping] bsagm bring together #tempunmatchedbkgsvcattributegroupmap temp on bsagm.bsagm_id=temp.bsagm_id commit transaction -- drop temp tables drop table #serviceids drop table #serviceid drop table #tmpbkgserviceswithchilds drop table #tmpbkgsvcattributeoption drop table #tmpbkgattrgrpandbkgsvcattrgrpmapping drop table #tmpbkgsvcattributesgroup drop table #tmpbkgsvcattributes drop table #tmpbackgroundservices drop table #tmpbkgattributegroupmapping drop table #tmpbkgsvcattributegroupmapping drop table #tmpbkgservices drop table #tmpclientattrgrpandsvcattrgrpmapping drop table #tmpclientbkgattributegroupmap drop table #tempunmatchedbkgattributegroupmap drop table #tmpclientbkgsvcattributegroupmap drop table #tempunmatchedbkgsvcattributegroupmap drop table #tmpbkgattributegroupmapping_allentries drop table #tmpbkgsvcattributegroupmapping_allentries end seek begin grab rollback transaction set @steps = @steps + 1 exec usp_insertserverprocesslog '[usp_copymasterservicedatatoclient]' ,@steps ,'starting usp_copymasterservicedatatoclient catch' ,@processid ,'error' declare @errormessage varchar(max) declare @errorseverity int; declare @errorstate int; select @errorseverity = error_severity(); select @errormessage = error_message(); select @errorstate = error_state(); exec usp_insertserverprocesslog usp_copymasterservicedatatoclient ,0 ,@errormessage raiserror ( @errormessage ,@errorseverity ,@errorstate ); end grab set @steps = @steps + 1 exec usp_insertserverprocesslog '[usp_copymasterservicedatatoclient]' ,@steps ,'ending procedure usp_copymasterservicedatatoclient' ,@processid ,'info' end

in code using ado .net phone call procedure.

using (sqlconnection con = new sqlconnection(connection.storeconnection.connectionstring)) { sqlcommand _command = new sqlcommand("ams.usp_copydata", con); _command.commandtype = commandtype.storedprocedure; _command.parameters.addwithvalue("@serviceids", selectedservices.tostring()); con.open(); int32 rowsaffected = _command.executenonquery(); if (rowsaffected > 0) { //some operation perform homecoming true; } con.close(); }

c# sql sql-server stored-procedures ado.net