Posts

Showing posts from May, 2011

javascript - Adding additional files to C# script and css bundles -

ok have been using c# bundling minify , combine scripts , css. but i'm not sure how append script bundle has been created. i'm trying append bundle because not scripts found in same file, i'm working nopcommerce solution in visual studio. scripts added on solution. here bundle code: bundles.add(new scriptbundle("~/content/themes/base/js/scripts/footeroptimized").include( "~/themes/mytheme/content/js/bootstrap.min.js", "~/scripts/jquery.validate.min.js", "~/scripts/jquery.validate.unobtrusive.min.js", "~/scripts/public.common.min.js", "~/themes/mytheme/content/js/readmore.min.js")); i thought maybe use bundles .add() function error: bundles.add("~/themes/mytheme/content/js/global.min.js")); the error is: "cannot convert string system.web.optimization.bundle" i couldn't find explaining why im getting error. also have added using statement optimizatio

C++ multithreading: QSocketNotifier:Socket notifiers cannot be enabled or disabled from another thread -

i have 3 threads. main thread (for gui) -> worker thread -> worker thread b in worker thread b (in code called recognitionthread) trying start process , write data process. process supposed start python virtual environment (this part works) , execute commands in environment (that doesn t work). when try write data process get: socket notifiers cannot enabled or disabled thread i think kind of understand problem is, not totally , have no clue how solve issue. those relevant parts of code: recognitionclass.cpp: qprocess recognitionclass::p; recognitionclass::recognitionclass(qobject *parent) : qobject(parent) { startpythonvirtualenv(); } void recognitionclass::startpythonvirtualenv() { qregistermetatype<qprocess::processerror>("qprocess::processerror"); params<<"-f"<<"-c"<<"python2"<< "/home/john/desktop/python.log"; qdebug()<<"parameters: "<<par

tensorflow - How can I create a Tensor from an Example object in Java? -

my use case: trying serve models trained python within our existing jvm service libtensorflow_jni. now able load model using savedmodelbundle.load() . find hard feed request model. user request not scalar matrix, map of features, like: {'gender':1, 'age': 20, 'country': 100, other features ...} by searching around tensor flow tutorials, see example protocol buffers may fit here holds list of features. not sure how convert java tensor object. if create tensor directly serialized example object, tensorflow runtime seems not happy datatype. example, following, tensor inputtensor = tensor.create(example.tobytearray()); s.runner().feed(inputtensorname, inputtensor).fetch(outputtensorname).run().get(0); i illegalargumentexception: java.lang.illegalargumentexception: expected serialized vector, got shape: [] could guys shed light how can move forward here in case happens know or have same use cases? thanks! looking @ error message, appea

api - Robot Framework Requests Library: set session cookie -

i trying create session using requestslibrary in robot framework. first api call "authentication step". step requires store cookie remainder of api calls. normally, use curl -c cookie.txt -d "j_username=foo%40inq.com&j_password=pass123&submit=login" https://api.company.com/j_spring_security_check but understand it, requestslibrary doesn't support curl commands? below example of code i'm trying execute *** settings *** documentation api library requestslibrary library collections *** variables *** ${headers} create dictionary content-type application/json accept application/json *** test cases *** tester create session tc https://api.company.com/j_spring_security_check?j_username=regression1@att&j_password=tcpass1234&submit=login ${headers} cookies.txt it works if leave cookie param none, unable run remainder of test: ${result}= post request tc https://api.company.com/engagement

ios - Regex function to find @ mentions does not work anymore -

xcode 8.3.3 i wrote regex method mentions of string. func getmentions() -> [string] { let pattern = "\\b@[a-za-z0-9]+" { let regex = try nsregularexpression(pattern: pattern, options: nsregularexpression.options(rawvalue: 0)) let nsstr = self nsstring let = nsrange(location: 0, length: nsstr.length) var matches : [string] = [string]() regex.enumeratematches(in: self, options: nsregularexpression.matchingoptions(rawvalue: 0), range: all) { (result : nstextcheckingresult?, _, _) in if let r = result { let result = nsstr.substring(with: r.range) string matches.append(result) } } log.info(matches) return matches } catch { return [] } } this used work fine. however, when run this, empty matches. did updated now? i've tried this: let pattern = "\\b@[a-za-z0-9]+\\b"

java - How to do a screen capture without getting an OOM (out of memory) exception? -

i want screencapture , save view. i think can create bitmap big view , draw view on bitmap. in situation, view's width same screen's width, , height may more screen. so easy oom problem. there way avoid problem? if don't need transparency, can use bitmap.config.rgb_565 instead of bitmap.config.argb_8888 : bitmap.createbitmap(width, height, bitmap.config.rgb_565); this reduces memory usage half.

arrays - How do I update unlockable characters in SpriteKit game with Swift 3? -

i have made game featuring 1 player. made character screen user can choose character he/she wants play with. how make high score unlocks character, , allows user equip character use in game? right player has own swift file defines properties of him: import spritekit class player: skspritenode, gamesprite { var initialsize = cgsize(width:150, height: 90) var textureatlas: sktextureatlas = sktextureatlas(named: "rupert") let maxflyingforce: cgfloat = 80000 let maxheight: cgfloat = 900 var health:int = 1 var invulnerable = false var damaged = false var damageanimation = skaction() var dieanimation = skaction() var forwardvelocity: cgfloat = 190 var poweranimation = skaction() init() { super.init(texture:nil, color: .clear, size: initialsize) createanimations() self.run(soaranimation, withkey: "soaranimation") let bodytexture = textureatlas.texturenamed("pug3") self.physicsbody = skphysicsbody(texture: bodytexture, size: self.size) self.physicsbody

javascript - how to make organize file in angularjs? -

Image
i trying in view but come this: i want 10 file , make new line put 10 file heres view md-content.md-whiteframe-1dp .glyph layout="row" div layout="column" layout-align="center center" ng-repeat="doc in ctrl.documents" style="text-align: center;" div md-icon.material-icons.md-48 insert_drive_file span.step style="padding-left:48;" | test using ng-repeat-start , ng-repeat-end can achieve, how works in angular angular.module('notesapp', []) .controller('mainctrl', ['$scope', function ($scope) { $scope.docs = [1, 2, 3,4, 5,6,7,8,9,10,11,12,13,14,15, 16,17,18,19,20]; }]); <html lang = "en"> <head> <link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet"> <link rel = "stylesheet" href = "https://ajax.googleapi

soap - Coldfusion cfc webservice returns error when string parameter is longer than 64k -

im building webservice in coldfusion. simple function receives 2 parameters, both of them string. runs fine when 1 of strings longer 64k chars throws error cfinvoke side. "doctype not allowed" any ideas? here sample code: <cfcomponent> <cffunction name="syncdata" returntype="string" access="remote"> <cfargument name="table" type="string" required="yes"/> <cfargument name="data" type="string" required="yes"/> .... .... </cffunction> </cfcomponent> on client remote side <cfinvoke webservice="myurl" refreshwsdl="yes" method="syncdata" returnvariable="result" username="myuser" password="mypassword"> <cfinvokeargument name="table" value="mytablename"> <cfinvokeargument name="data" value="#data#"> </cfinvoke&

c# - Searching for a string in many small text files on Windows Server 2012 R2 get slower and slower -

we need grep 500k of files around 736 bytes. using findstr proved unworkable , cache memory drained away, creating many hard faults. wrote c# program see progress. first time through read around 200k reasonably fast ~1-2 mins slowed down 3-7 second/10000. clearing cache using rammap , running again got 40k , started slowing similar speed before. looking memory when running c# version fast fine, 3gb left of 6gb, disk high not excessive. no hard faults occurring. is there limitation hitting here causing this. have ran on different platform , os (window 7) , findstr completed within 55 seconds thanks,

python - Printing my Class attributes -

these 2 parts of misbehaving text based adventure code i'm trying learn how youtube tutorial. believe of problems arise because tutorial i'm pretty sure using python2.something , i'm using 3. problem i'm trying list "player" class attributes on start screen, have done playername, i'm having trouble getting numbers listed self.attack , self.health etc print. downloaded python first time 5 days ago, bear noob if can, please. let me know can change, , thank in advance! class player: def _init_(self, name): self.name = name self.maxhealth = 100 self.health = self.health self.attack = 10 self.gold = 0 self.bandages = 0 def start1(): os.system("cls") print("name: %s" % (playerig)) print("attack: {}".format (playerig.attack)) print('health: {}/{}'.format(playerig.health, playerig.maxhealth)) print("gold: %i") % playerig.gold print("bandages: %i&qu

git branch doesn't show all my branches created in my newly created repo in local -

why doesn't not show current branches after created local repository?. used git branch , git branch -a command. in git current version 2.14 windows so initial branch master ,then created "test" branch but after use command git branch doesn't show branches master , test for reference since didn't not see question solved. step 1 : after creation of repo on my/your local step 2 : commit first include master branch step 3 : create first branch , commit step 4 : try git branch or git branch -a cheers !!

css - what does scale3d() function really do? -

scale3d(sx, sy, sz) i can't understand scale3d() when change (sz) value in below code can see value of (sz) = 1 body{perspective:600px} div{ width: 300px; height: 300px; background-color: burlywood; margin: auto; border-radius:40px; transition: 5s ease-in-out; transform: scale3d(1,1,1) } <div></div> in below code can see value of (sz) = 0.5 but nothing changed same result body{perspective:600px} div{ width: 300px; height: 300px; background-color: burlywood; margin: auto; border-radius:40px; transition: 5s ease-in-out; transform: scale3d(1,1,0.5) } <div></div> note : tried solutions & values nothing happened the third number in scale3d z-axis, applicable three-dimensional shapes. your examples have perspective, they're still use two-dimensional shapes, nothing happens. you can see effect true cube: scale3d(1,1,1) #

xaml - How Can I Disable Pointer Mode For Xbox One (C#, UWP) -

i wondering how disable pointer mode on uwp application. have xyfocuskeyboardnavigation set , works when plug xbox 1 controller pc. whenever debug console have pointer instead of typical xbox controls. have tried disable adding following commands nothing worked, please help: requirespointer="never" //at page level this.requirespointer = requirespointer.never; //on load requirespointermode = "whenrequested" //in app.xaml this.requirespointermode = windows.ui.xaml.applicationrequirespointermode.whenrequested; //tried on load requirespointermode not exist application.current.requirespointermode = applicationrequirespointermode.whenrequested; //tried on load got error: system.notsupportedexception: 'specified method not supported.' whenever debug console have pointer instead of typical xbox controls. have tried disable adding following commands nothing worked, please help: this.requirespointermode = windows.ui.xaml.applicationrequirespoin

javascript - Shopify + Parallax Theme, How to target schema elements on home page -

okay, i'm using shopify build website client. bought theme , want me use it, want still supply client website looks unique , not store same theme. the main page allows customization side bar on left can pick elements , put them on page. home page html looks like: <div class="index-sections"> {{ content_for_index }} </div> so there isn't anywhere me put custom html/css in between elements. honest, i'd love figure out how split sections haven't yet. shopify uses schema pull whatever options choose lets headers, or menu font, , applies them across entire site. i've chosen white font "headline" class, means picture text on gets white font regardless of whether or not can see it. in particular case, want change font color because majority of 1 of photos using white. found div id of specific block of code need style, link image i not sure how target headline class within specifically. tried : .shopify-s

jquery - Apply Grid-Overlay to Image and Video -

i have following issue: i want add overlay videos , images. the overlay based on png-pixel. i want cover whole width , height of images , cideos repeating png-pixel [1]: https://i.stack.imgur.com/ljbrb.png <- pixel here example result: https://theuprisingcreative.com/video/ * { box-sizing: border-box; margin: 0; padding: 0; } .row { clear: both; } .spalten-6 { width: 49.99992%; } .spalten-12 { width: 100%; } .spalten-6, .spalten-12 { float:left;} .img-box img { width: 100%; } .img-box { border-left: 2px solid white; border-top: 2px solid white; } #video-container { position: relative; height:300px } #video-container { top:0%; left:0%; height:100%; width:100%; overfl

linux - PID of processes in docker container when run commands via && -

i wrote dockerfile , use cmd ["/bin/bash", "-c", "script1.sh && script2.sh" start container. after running container, found process pid 1 process cmd column bash, , script2.sh child process. f s uid pid ppid c pri ni addr sz wchan tty time cmd 4 s 0 1 0 0 80 0 - 4491 wait ? 00:00:00 bash 0 s 0 8 1 0 80 0 - 4494 wait ? 00:00:00 script2 0 s 0 10 8 99 80 0 - 1632452 futex_ ? 00:01:05 java 4 s 0 64 0 0 80 0 - 4545 wait ? 00:00:00 bash 0 r 0 79 64 0 80 0 - 1785 - ? 00:00:00 ps if use cmd [ "/bin/bash", "-c", "script2.sh" ] , process pid 1 script2.sh. could explain happen in first case? in both cases, bash starts out pid 1. for first example, bash going run command "script1.sh && script2.sh" , first

From the list of data frame select particular columns in R -

i have multiple csv files 2, , want extract specific column each file. filenames <- list.files("path") for(iter in 1:length(filenames)){ print(filenames[iter]) my_csv=read.csv(filenames[iter]) where, csv1 , csv2 contains columns a1,a2,a3,a4 , b1,b2,b3,b4 respectively. want fetch column a1 csv1 , b2 csv2 csv number (csv 1 (1 in case) matches coulmn name (a1 in case)). likewise b2 csv2(csv 2 matches colummn name b2. for reading in csv files recommend using fread data.table package (more on here ). library(data.table) filecsv <- list.files(pattern = "csv$") # function extracts column csv file # doesn't colnames getcsvcolumn <- function(file) { <- gsub("csv|\\.", "", file) foo <- fread(file) foo[, paste0("v", i), = false] } res <- sapply(filecsv, getcsvcolumn) res <- do.call("cbind", res) colnames(res) <- gsub("\\..*","", colnames(res))

Display near by places in Location based Augmented reality Android -

i wanted try , code location based ar shows places.i tried android code in following link augmented reality android example , ended following error in redmi note 3(api 24) nougat. did changes in main.xml <?xml version="1.0" encoding="utf-8"?> <framelayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/surface_overlay"> <surfaceview android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/surface_camera" /> </framelayout> error 08-18 09:15:15.588 32701-32701/? e/androidruntime: fatal exception: main process: advisory.arplaces, pid: 32701 java.lang.nullpointerexception: attempt write field '

spring - Decrypt password in pom.xml -

i have util class picks properties application.properties (jdbc password in encrypted format in it) file , encrypts/decrypts it. there way decrypt password while using placeholders in pom.xml for, decrypt password in pom.xml need create create master password below commands : mvn --encrypt-master-password once run command then, create file called ~/.m2/settings-security.xml , write below content file : <settingssecurity> <master><!-- result of above command --></master> </settingssecurity> after encrypt password rum below commands : mvn --encrypt-password after running command output, need create file /.m2/settings.xml , write output in maven settings ~/.m2/settings.xml . can use below sample code write /.m2/settings.xml . <settings> ... <servers> ... <server> <id>test.server</id> <username><!-- database username --></username> <password><

jquery - 'active' navigation item depends on certain section -

i'm using plugin scrollify landing, great, can't solve 1 problem. have 8 sections, of them has different "data-section-name" attribute. have navigation, looks circles 'active' class. wrote function, when click on circle, becomes 'active' , scroll section. when use scroll mouse, circles' 'active' doesnt' change. should do? how can identify section , 'active' cirlcle? you can active section's data using $.scrollify.current() method on before() or after() scrollify() property. matching data, can add active class navigation. find below fiddler reference. here used fixed-nav on left scroll navigation indication(not captures click event). hope helps.

android - Adding Scrolling to Fragments Screen in a TabLayout -

Image
i have collapsingtoolbarlayout , inside have tablayout. , display in same activity viewpager fragments of tablayout. can not make scroll work when slide on fragment. scrolling on tablayout , collapsingtoolbar, working. when sliding through fragment screen not roll. , when sliding tablayout scrolling works normally. how solve this? code: <android.support.design.widget.coordinatorlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:fitssystemwindows="true" > <!--<include layout="@layout/content_perfil_empresa" />--> <android.support.design.widget.appbarlayout android:id="@+id/app_bar" android:layout_width="match_parent" an

Solr Client makes a connection only to the first zookeeper node in the ensemble -

i using solr 6.4.0 , zookeeper 3.4.9 2 solr nodes , 3 znodes. solr client connections made see first node mentioned in list of zkhosts provided serves requests. other 2 znodes not serve solr, due see first znode max out connections. checked seeing connections made against each of 3 znodes. when kill first znode mentioned in zkhost list, solr connections start failing , not served other 2 live nodes. solr client - new cloudsolrclient.builder().withzkhost("10.250.60.45:2181,10.250.60.46:2181,10.250.60.47:2181/solr").build(); zoo.cfg (with myid) - server.1=abc-01.xyz.local:2181:5181 server.2=abc-02.xyz.local:2181:5181 server.3=abc-03.xyz.local:2181:5181 any appreciated.

hive - How to properly use parentheses in a complex SQL query -

i have confusion regarding how use parentheses in sql query. the query below throws error error while compiling statement: failed: parseexception cannot recognize input near '(' '(' 'select' in source query: select customer_id, order_id, city, ((query_1 ) join (query_2 ) b on a.customer_id = b.customer_id) c but on other hand query below works select customer_id, order_id, city, (query_1) join (query_2) b on a.customer_id = b.customer_id update: i'm running on hive the first query throws error because nested query has no output fields. fix adding 'select * from' or 'select [list_the_fields] from': select c.customer_id, c.order_id, c.city, (select * (query_1 ) join (query_2 ) b on a.customer_id = b.customer_id) c but second query better

python - tensorflow: multiply certain rows of a matrix with certain columns in another -

suppose have matrix a , matrix b . know tf.matmul(a,b) can calculate multiplication of 2 matrices. have task requires multiplying rows of a columns of b . for example, have list of row ids of a , ls_a=[0,1,2] , , list of column ids of b , ls_b=[4,2,6] . want result list, denoted ls , such that: ls[0] = a[0,:] * b[:,4] ls[1] = a[1,:] * b[:,2] ls[2] = a[2,:] * b[:,6] how can achieve this? thank helping me! you can tf.gather follows: import tensorflow tf a=tf.constant([[1,2,3],[4,5,6],[7,8,9]]) b=tf.constant([[1,0,1],[1,0,2],[3,3,-1]]) #taking rows 0,1 a, , columns 0,2 b ind_a=tf.constant([0,1]) ind_b=tf.constant([0,2]) r_a=tf.gather(a,ind_a) #tf.gather access rows, use tf.transpose access columns r_b=tf.transpose(tf.gather(tf.transpose(b),ind_b)) # diagonal elements of multiplication res=tf.diag_part(tf.matmul(r_a,r_b)) sess=tf.interactivesession() print(r_a.eval()) print(r_b.eval()) print(res.eval()) this prints #r_a [[1 2 3] [4 5 6]] #r_b [[ 1 1]

itext - How to create dynamic pdf cells in C# mvc -

i have view containing table has more 30 columns changing month want print pdf.but need create pdf cell dynamically.ie if select month august pdf have 30 columns if select february pdf have 28 columns how can please me.below code. [![table print pdf][1]][1] document pdfdoc = new document(pagesize.a4, 40f, 40f, 30f, 30f); // document pdf = new document(pagesize.a4,) pdfwriter.getinstance(pdfdoc, response.outputstream); pdfdoc.open(); pdfptable tablebody = new pdfptable(pdfcell); tablebody.totalwidth = 500f; pdfpcell cell0 = new pdfpcell(new phrase(" georoof \n\n monthly field visit report", new font(font.fontfamily.helvetica, 12f, font.bold))); cell0.colspan = 7; cell0.horizontalalignment = 1; //0=left, 1=centre, 2=right cell0.paddingbottom = 6f; cell0.paddingtop = 6f; tablebody.addcell(cell0); pdfpcell cell1 = new pdfpcell(new phrase("dealer", new font(font.fontfamily.helvetica, 10f, font.bold))); cell1.colspan = 1; cell1.horizontalalignment = 1; //0=le

android - How to update the location data in a single row in the server(without getting the data duplicated)? -

whenever new location data getting saved in new row instead of existing row getting updated new data. how can achieve it? below code: parseobject customerrequest = new parseobject("customerrequest"); parsegeopoint parsegeopoint = new parsegeopoint(mcurrentlocation.getlatitude(), mcurrentlocation.getlongitude()); parsequery<parseobject> query = parsequery.getquery("parsegeopoint"); customerrequest.put("location", parsegeopoint); customerrequest.saveinbackground(new savecallback() { @override public void done(parseexception e) { if (e == null) { log.i("parse result", "successful!"); } } ); in above code, directly put data using .put without removing existing data using .remove w.r.t. below line: customerrequest.put("location", parsegeopoint); so, should add line customerrequest.remove("location"); before line customerrequest.put("location", par

r - Cumprod ignoring NA -

this question has answer here: calculate cumsum() while ignoring na values 3 answers i'd produce dataframe applied comprod function ignoring na x = data.frame(a=c(na,1,2,3),b=c(na,5,6,7)) > cumprod(x) b 1 na na 2 na na 3 na na 4 na na the result want is, > cumprod(x) b 1 na na 2 1 5 3 2 30 4 6 210 any simple , efficient idea? anything multiplied 1 again, so: x[] <- lapply(x, function(i) cumprod(replace(i,is.na(i),1)) * ifelse(is.na(i),na,1) ) x # b #1 na na #2 1 5 #3 2 30 #4 6 210

typescript - (): meaning in javascript function -

i looking @ piece of code in react application: export const clickoptoutmessage = (): clickoptoutmessage => ({ type: click_opt_out_message, }); what (): do? having trouble googling due fact it's bunch of characters. i'll try explain step step (sorry if know except ending, people may learn new) () => { /** function body goes here **/ } is arrow function () => {} //basically equals: (function () {}).bind(this) it have context written. in typescript can write function return type, this: function(): number { return 2; } so, know since arrow function function different syntax - (): type return type! export const clickoptoutmessage = (): clickoptoutmessage => ({ type: click_opt_out_message, }); somewhere in code looked at, there piece: const click_opt_out_message = "click_opt_out_message"; // value can differ in code observed type clickoptoutmessage = { type: "click_opt_out_message" } as can see, ():

python - Extract youtube meta-info with regex -

i want extract youtube video meta-info using python regular expression, here have found extract video url , video title import re import urllib2 #https://www.youtube.com/user/<channel_name>/videos #here channel name schooloflifechannel site = "https://www.youtube.com/user/schooloflifechannel/videos" videos = [] #re_filter defines filter find anchor tags using regular expressions m_filter = r'<ul.*?/ul>' read_url = urllib2.urlopen(site) re_filter = r'<a.*?/a>' all_links_temp = re.findall(re_filter,read_url.read(),re.multiline) #this varialbe denotes class of each video link of channel video_link_class = 'class="yt-uix-sessionlink yt-uix-tile-link' video_titles = [] video_links = [] #this loop finds titles , links videos , stores them in 2 seperate lists. #you use dictionary here might make things easier parsing further temp in all_links_temp: if video_link_class in temp: title_filter = r'title=".*?&qu

javascript - What does it mean by chrome v8 engine embeded nodejs? -

i new mean, when learning node.js nodejs embeded chrome v8 engine, nodejs work on specific browser. can brief nodejs embeded on chrome v8 engine not on other browser engines node.js javascript execution environment stands itself. has nothing browser. can run javascript programs node.js. to parse , execute javascript, node.js has v8 javascript engine (the same engine used chrome) embedded in it. allows run , execute javascript. not make browser in way. in addition v8 javascript execution engine, node.js comes large set of built-in libraries doing sorts of things socket communication file i/o, allowing 1 write sorts of applications in node.js, including server processes. does nodejs work on specific browser if build server process in node.js, can use browser talk server, either via regular http page requests, form posts, ajax calls or websocket connections. what nodejs embeded on chrome v8 engine not on other browser engines nodejs needs 1 javascript

css3 - CSS:Fix image outside the body of container -

Image
i have fix blue colored 'lock' image outside of container below: so far have achieved below: i setting image background-image of container , css container wrote is: .container{ margin: 0 auto; max-width: 620px; background-color: $white; box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.2); object-fit: contain; margin-top: 30px; padding: 40px; min-height: 100px; object-fit: contain; overflow: hidden; border-radius: 5px; background-repeat: no-repeat; background-image: url("../lock.svg"); } <body> <div class="container"> </div> </body> </html> if give background-position, image hiding behind container, please advice how achieve this? approach correct? if want set lock button depending on container, have set relative position container , absolute position button. then set top , right property button depending on container. .container { position: relative; } .button { position: absolute; top: px

Swift3 Array convert in String like "{\"type\": \"0\"}" -

i have created 1 array in swift. have 1 node.js api, in api passing string type data let dic = "{\"type\": \"0\",\"message\": \"\(message)\", \"sender_id\":\"\(username)\", \"reciever_id\": \"61\", \"\(username)\": \"2017-05-09 03:02:55 pm\"}" i cant able pass dic in api. problem is, have 1 array how can convert array string . have add 1 more parameter in dic , pass array here code how generating array ( { desc = "this suger m23 type "; price = 50; product = "suger temp"; }, { desc = "this suger m23 type "; price = 50; product = "suger temp"; } ) code let ary_allproduct :nsmutablearray = [] in 0..<count { var dict = dictionary<string, any>() dict["product"]="suger temp"

how to Automatically calculate expiry date in backpack laravel? -

i have field name month want when user set month automatic calculate created at month , upload database. ps - sorry new @ laravel please see edit: my store method looks like <?php namespace app\http\controllers\admin; use backpack\crud\app\http\controllers\crudcontroller; // validation: change requests match own file names if need form validation use app\http\requests\clientsrequest storerequest; use app\http\requests\clientsrequest updaterequest; use carbon\carbon; class clientscrudcontroller extends crudcontroller { public function setup() { $this->crud->setmodel('app\models\clients'); $this->crud->setroute(config('backpack.base.route_prefix') . '/clients'); $this->crud->setentitynamestrings('clients', 'clients'); $this->crud->setfromdb(); } public function store(storerequest $request) { // additional operations before save here $start_day = carbon::parse($request-

How can we overlay the icon with rectangular shape in android -

Image
i want design ui shown @ image below. we're unable that. here code <linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <edittext android:id="@+id/editshop" android:drawableleft="@drawable/user_icon" android:background="@drawable/rectangle" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginleft="20dp" android:layout_marginright="20dp" android:layout_margintop="20dp" android:hint="shopname" android:inputtype="text" android:padding="7dp" android:singleline="true" /> </linearlayout> i want output like: try this. <relativelayout xmlns:android="http://schemas.android.com/apk/

How to call a function in my_helper from routes in Codeigniter -

i have function named enable_disable(param1,param2) in my_helper.php . how can call enable_disable(param1,param2) routes.php in codeigniter? please share great ideas if have key. write code ( enable_disable($p1, $p2) function) in pre_system hook . being loaded before router. if want quick , dirty way, can put apppath.'config/config.php' file @ end.

javascript - Where are the CommonJS modules? -

from time time hear commonjs http://www.commonjs.org/ effort create set of modular javascript components frankly have never understood of it. where these modular components can use? don't see on homepage. commonjs standard specifies way modularize javascript, commonjs not provide javascript libraries. commonjs specifies require() function lets 1 import modules , use them, modules have special global variable named exports object holds things exported. // foo.js ---------------- example foo module function foo() { this.bla = function() { console.log('hello world'); } } exports.foo = foo; // myawesomeprogram.js ---------------------- var foo = require('./foo'); // './' require module relative // in case foo.js in same directory .js file var test = new foo.foo(); test.bla(); // logs 'hello world' the node.js standard library , 3rd party libraries use commonjs modularize code. one mo

cmake - Can parameter DESTINATION for INSTALL be empty? -

in general, relative parameters of type path , "lib" or "source/include" resolved in cmake absolute path using current value of variables, instance: ${cmake_install_prefix} in case of command install . this, however, not work if use empty relative path (or not set @ all), resulting absolute path equal ${cmake_install_prefix} - cmake generator complain non existing destination , although there no reason why couldn't resolved. i know 2 workarounds issue, both have flaws prevent me achieving goal: use ${cmake_install_prefix} destination value. correctly resolved path, in case of install(export) , paths in generated target.cmake absolute, makes package not relocatable. use . destination . @ least generates relative paths inside target.cmake , paths incorrect. . apparently considered regular folder, , in process of target.cmake generation, when _import_prefix determined, cmake strips 1 folder component much: # compute installation prefix relative

python - Understand fast prime numbers generator -

def sieve_for_primes_to(n): size = n//2 sieve = [1]*size limit = int(n**0.5) in range(1,limit): if sieve[i]: val = 2*i+1 tmp = ((size-1) - i)//val sieve[i+val::val] = [0]*tmp return sieve print [2] + [i*2+1 i, v in enumerate(sieve_for_primes_to(10000000)) if v , i>0] can please describe how code works? this called sieve of eratosthenes , wiki page job of describing it. the gist of goes this: you select numbers starting 2 , going up, you: mark number selected prime. remove multiples of number set prevent them being selected in future. see 1)

reactjs - How to link 'from outside' into Navigator (for example from a global footer) -

with react navigation , there way link from outside specific path/screen inside navigator? for example implement global footer, this: <provider store={store}> <view> <appnavigator /> <myfooter /> // link here path/screen inside appnavigator </view> </provider> i think refs might work here. if want use navigator same level declare can use react's refs , pass props myfooter . @ example in official documentation. const appnavigator = stacknavigator(someapprouteconfigs); class app extends react.component { somefunction = () => { // call navigate appnavigator here: this.navigator && this.navigator.dispatch({ type: 'navigate', routename, params }); } render() { return ( <view> <appnavigator ref={nav => { this.navigator = nav; }} /> <myfooter somefunction={this.somefunction} /> </view> ); } }

php - MySQL error on registration form -

i'm creating website using joomla (with template mega deals ii), , whenever test registration, either 1 of 2 errors. one : warning registration failed: have error in sql syntax; check manual corresponds mysql server version right syntax use near ' 2)' @ line 3 this happens when id column in users table not primary key, creates db entry 0 id. registration form go through , can see account had been added in table; however, id 0 no matter how many accounts add. two : warning error getting user database: duplicate entry '0' key 'primary' this happens when set id primary key , let auto increment. did lot of testing, , playing around values in table, seems me reason, registration form sends info database id set 0 (since default id none) first, error comes in, auto increments inside table. because i'm able add 1 user before specific error keeps reoccuring, seems first user takes default id , current auto increment id @ same time? possible? bot

sql server - SQL UPDATE SELECT with WHERE -

i want update column in table, in each row there must go value dependend on where of row. this how table looks like. businessunitguid | classname | defaultguid 5 | pricelist | 349fdafd34m 5 | footer1 | 987ioxg376l 5 | header1 | 12wqx954mio 7 | pricelist | null 7 | footer1 | null 7 | header1 | null results should this. businessunitguid | classname | defaultguid 5 | pricelist | 349fdafd34m 5 | footer1 | 987ioxg376l 5 | header1 | 12wqx954mio 7 | pricelist | 349fdafd34m 7 | footer1 | 987ioxg376l 7 | header1 | 12wqx954mio but shown query doesn't work, because returns many rows , it's not precise. update csc_businessunit set defaultguid = ( select defaultguid csc_businessunit businessunitguid = 5 ) businessunitguid = 7 you need check on classname well: update b1 set b1.defaultguid =

installation - Can I create installer that copies files from a UNC path on the network? -

is possible create inno setup script copy files unc path on network rather statically adding them setup file? if so, can still done if need authenticate path first? there mechanism provide authentication info in inno setup script? essentially, wanting setup copy files various sources on intranet unc path put setup destination directory. yes, specify unc path in source parameter of [files] section entry , use external flag . [files] source: \\unc\path\file.txt; destdir: {app}; flags: external to authenticate, have call wnetuseconnection or similar winapi. see how execute "net use" command inno setup installer on windows 7?