Posts

Showing posts from March, 2011

javascript - How can i simulate a responsive website like desktop in mobile? -

i have responsive website, in need add button "view classic version (desktop)". problem site made in responsive format , can not redo in mobile version (both, mobile version , desktop version separated). there way simulate size of 1200px inside mobile device (js or jquery)? e.g. website using bootstrap 3 thanks!

Is it possible to track changes to Entity Metadata in Dynamics CRM? -

is there way track changes metadata, new fields, new entities , on? it difficult control large project in same environment, there customization should not deployed productions (mostly mistakes or test in development environment). and there way know did customization? i looking know every possible change, not in particular. you have use retrievemetadatachangesrequest , not possible know made change. this available microsoft dynamics crm 2011 update rollup 12 this request intended used cache information metadata , be able work offline , can use track changes metadata in complex projects , complex teams examples on internet not friendly how can use request: the request can completed filling 1 parameter retrievemetadatachangesrequest req = new retrievemetadatachangesrequest() { clientversionstamp = null }; var response = (retrievemetadatachangesresponse)service.execute(req); the first time executed request clientversionstamp needs null, because there no

Is there a way to specify an Object in a dynamicField in Apache Solr 4.6.1 -

i have started work on apache solr , might rookie question. i understand dynamicfield primitives can configured in schema.xml, there way specify user defined datatype (i.e. object), in schema.xml? unable find in documentation .

javascript - Best way to implement switchable pages for a bootstrap SPA -

i creating relatively simple web ui embedded platform. layout styling bootstrap 4 seems nice way go. idea single page application without using additional framework. number of pages limited, fixed navbar or tabs 4 pages. of pages contain number of "cards" show information. navigation controlled embedded part via websocket. now more concrete, way create "switchable pages" bootstrap. hiding showing div hiding showing container ( possible ? ) dynamically create page within javascript function any other option ? i not have experience javascript , web programming, pointers or suggestions helpful. the easiest way add same class (lets assume it'll _view ) , different ids "views". $('._view').hide(); $('#' +id).show(); every time need open "page". p. s. underscore in class name points maintainers class not used styling, needed script

neural network - LSTM tensorflow tutorial - batch size and time steps -

Image
i going through tensorflow tutorial . cannot understand why num_batches = 4 , time_steps = 5 . why there no words_in_dataset[?] = [brown, red] [ ]

node.js - How to use Node in a Swift iOS app that uses Firebase as a backend? -

i building swift ios application using firebase backend service. far, i've been ok using cocoapods implement dependencies. i've reached point need start integrating other services (like elastic search) requires node in application, particularly when comes using them firebase. i'm bit lost on how use node in swift ios app, if i'm using firebase primary backend. i'm curious whether has elegant solution this? edit: should setting websocket firebase , node can communicate? if so, i'm still left question on how setup node work swift app.

Which version of JSON Schema is Visual Studio Code using -

the documentation ( https://code.visualstudio.com/docs/languages/json ) not specific version. know vscode supports draft-04 sure using it, wonder if supports draft-06 too.

Get the ASCII value of a character in Redshift -

i trying find ascii value of character string. looking opposit of chr, chr(65)= a. fn(a) should return 65. not find function in redshift sql manual. closest find is: ascii deprecated leader node–only function. you write python user-defined function returns character given ascii value.

Rails Asset Pipeline: Getting raw data in production -

this works in development: raw rails.application.assets['path'].to_s but in production throws following error: undefined method `[]' nil:nilclass all assets have been precompiled.

java - Cannot login to website using jsoup -

i trying login this website . here have tried far, doesn't seem work: try{ connection.response login = jsoup.connect("login_url").method(connection.method.get).execute( connection.response doc = jsoup.connect("https://ecampus.psgtech.ac.in/studzone/") .data("txtstudid","id") .data("txtpasswd","password") .data("btnlogin","login") .useragent("mozilla/5.0 (windows nt 6.1; wow64; rv:50.0) gecko/20100101 firefox/50.0") .method(connection.method.post).execute(); //doesn't seem work. document docs=jsoup.connect("https://ecampus.psgtech.ac.in/studzone/attwfpercview.aspx/") //after login .cookies(doc.cookies()) .useragent("mozilla/5.0 (windows nt 6.1; wow64; rv:50.0) gecko/20100101 firefox/50.0").get(); test=doc

python - How can I better handle this Flask-SQLAlchemy commit/rollback? -

i'm reviewing old code wrote , looking @ shared commit function had written handle responses user on failures when attempting commit changes database (such deletes): def _commit_to_database(): """a shared function make commit database , handle exceptions if encountered. """ flask.current_app.logger.info('committing changes database...') try: db.session.commit() except assertionerror err: flask.abort(409, err) except (exc.integrityerror, sqlite3.integrityerror) err: flask.abort(409, err.orig) except exception err: flask.abort(500, err) finally: db.session.rollback() i think understand thought process: attempt commit , upon failures trigger flask.abort send response back, believe found database left open session requiring rollback when did , adding rollback finally statement resolved allowing me still use flask.abort . the questions have around me code are:

asp.net mvc - wcf excel: An error occurred while processing your request -

i develop application using asp.net mvc c# , wcf. tried import excel file , save in database. worked on local system. then, later deploy iis. initially, worked, later displays error error. error occurred while processing request also, other menu displays this. works on local system questions how resolve issue how debug on iis

kubernetes - Horizontal auto scaler doesn't report CPU usage -

Image
i trying test kubernetes hpa in example here kubectl run php-apache --image=gcr.io/google_containers/hpa-example --requests=cpu=200m --expose --port=80 kubectl autoscale deployment php-apache --cpu-percent=20 --min=1 --max=10 kubectl hpa output name reference targets minpods maxpods replicas age php-apache deployment/php-apache <unknown> / 20% 1 3 0 1h why isn't controller-manager able current usage? environment details : k8s version 1.7.3 heapster running service on port 80, in kube-system. influxdb set sink , can see usage/limit etc. correctly in grafana on heapster api i can see cpu requests (200m) on deployed pod's yaml. no errors in controller manager logs. see etcd watch , pod creation messages. there no "horizontal-pod-autoscaler-sync-period" specified in controller manifest, default should 30 seconds. "hpa describe" doesn't list events ("<n

swift - How to create stack views with constraints to the parent view's margins in Interface Builder? -

i want have horizontal stack view, or other view, constrain width of view's margins. i first add interface elements. (image 1) when put them in stack, resize (what understand) intrinsic content sizes? okay. (image 2) at point, items turn red if selected. when click "update frames" button in interface builder bigger , bigger. until extend right off screen. going on? why updating frames make them grow beyond confines of screen? (image 3) okay... maybe can ctrl-drag between stack , view , pick constraints based on view's margins, right? maybe fix it... let's constrain our stack resize way want. weird thing is, doesn't matter if click , drag view stack or stack view... either way end constraints seem describe reverse of want. not meant! i want use view's margins define stack view's width, not other way around! also, added 67.5 reason. thankfully there's place reverse these , remove 67.5, right? click on constraint , make cha

java - "AppName still not working" message box android -

ok, here problem, updated application i'm developing, first time did this, application worked fine, when second update, application shows me message. [enter image description here][1] in english means like, "parkinghelper11 still not working" the device i'm using ta 1039 nokia 6 android 7.0 build.grandle apply plugin: 'com.android.application' android { compilesdkversion 25 buildtoolsversion "25.0.3" defaultconfig { applicationid "app.parkinghelper.com.parkinghelper11" minsdkversion 19 targetsdkversion 25 versioncode 1 versionname "1.0" testinstrumentationrunner "android.support.test.runner.androidjunitrunner" vectordrawables.usesupportlibrary = true } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro'

sql - Rake task firing off mailer not returning correct results -

when apartment's unit number more 10 characters long , apartment's status available should trigger mailer. mailer fires off fine, returns listings instead of ones need. appreciated. too_long.rake namespace :listings desc 'notifies agent when unit long' task notify_agent_unit: :environment listing.all.each |listing| if listing.where("length(apartment) > 10") && listing.where(status: 'available') toolongmailer.unit_too_long(listing, listing.listing_agent).deliver_now end end end end i couldn't work added scope in model works perfectly. scope :unit_length_available, -> { where("length(apartment) > 10 , (status ilike '%available%')") }

mail attachment SendGrid using ruby -

i trying send email attachment in ruby , have following line: from = email.new(email: 'mail@mail.com') = email.new(email: 'mail@mail.com') subject = 'file week' content = content.new(type: 'text/plain', value: 'please find file week.') mail = mail.new(from, subject, to, content) mail.attachments['test.txt'] = file.read("#{rails.root}/public/test.txt") sg = sendgrid::api.new(api_key:'myapikey') sg.client.mail._('send').post(request_body: mail.to_json) the issue code following line (when remove it, receive email): mail.attachments['test.txt'] = file.read("#{rails.root}/public/test.txt") but when try run it, following error: undefined method '[]=' nil:nilclass has faced error before? per docs , create new mail object using hash values being strings. it's hard tell, because don't know email or content classes doing, suspect going wrong when create mail . l

ruby - fog-azure-rm: creating Disks fails with uninitialized constant Azure::Core -

i'm unable create disks in azure. below steps did create failing. versions: fog-azure-rm (0.3.2) ruby version 2.4.0 azure_storage_service = fog::storage::azurerm.new( :tenant_id => '<tenantid>', :client_id => '<clientid>', :client_secret => '<clientsecret>', :subscription_id => '<subscriptionid>' ) azure_storage_service.create_disk('disk_name',1023) /usr/local/lib/ruby/gems/2.4.0/gems/fog-azure-rm-0.3.2/lib/fog/azurerm/requests/storage/create_page_blob.rb:13:in `rescue in create_page_blob': uninitialized constant azure::core (nameerror) /usr/local/lib/ruby/gems/2.4.0/gems/fog-azure-rm-0.3.2/lib/fog/azurerm/requests/storage/create_page_blob.rb:11:in `create_page_blob' /usr/local/lib/ruby/gems/2.4.0/gems/fog-azure-r

MongoDB - many-many relationship select row that match a set of values -

i working on solution company , i've problem related mongodb solve. building mapping between products , suppliers. simplified structure of documents following: product { "id" : "1", "name" : "any-product", }, supplier { "id" : "99", "name" : "acme", "products" : [1,....] //list of products suppliers can supply } when need place order place least number of suppliers....the best 1 supplier can supply entire order. that's problem: need select suppliers can supply product in given list. i'm new mongodb , did various tests not find solution....anyway think solution not simple. consider can change structure of db meet these need. feel free propose different approach. in advance

python - PANDAS vlookup against series with common index using map -

import pandas pd import numpy np pb = {"mark_up_id":{"0":"123","1":"456","2":"789","3":"111","4":"222"},"mark_up":{"0":1.2987,"1":1.5625,"2":1.3698,"3":1.3333,"4":1.4589}} data = {"id":{"0":"k69","1":"k70","2":"k71","3":"k72","4":"k73","5":"k74","6":"k75","7":"k79","8":"k86","9":"k100"},"cost":{"0":29.74,"1":9.42,"2":9.42,"3":9.42,"4":9.48,"5":9.48,"6":24.36,"7":5.16,"8":9.8,"9":3.28},"mark_up_id":{"0":"123","1":"456","2":"789",&q

Vagrant Puppet, unable to install @angular/cli -

i have these resources on default.pp file: class { 'nodejs': repo_url_suffix => '8.x', } -> package { 'gulp': ensure => 'present', provider => 'npm'; 'webpack': ensure => 'present', provider => 'npm'; 'pm2': ensure => 'present', require => class['nodejs'], provider => 'npm'; '@angular/cli': ensure => 'present', provider => 'npm'; } and while trying setup vagrant instance, gets stuck , no more activity on screen: ==> default: notice: /stage[main]/nodejs::install/package[nodejs]/ensure: created ==> default: notice: /stage[main]/main/package[gulp]/ensure: created ==> default: notice: /stage[main]/main/package[webpack]/ensure: created ==> default: notice: /stage[main]/main/package[pm2]/ensure: created i've tried too: 'pm2': ensure => &#

Using accepts_nested_attributes_for to create a double nested record with rails -

i'm using rails 5 , i'm having trouble creating doubly nested record using accepts_nested_attributes_for. have models looks this: class quote < applicationrecord has_many :terms, inverse_of: :quote has_many :mileages, inverse_of: :quote end class term < applicationrecord belongs_to :quote, optional: true end class mileage < applicationrecord belongs_to :quote, optional: true end class residual < applicationrecord belongs_to :term, optional: true belongs_to :mileage, optional: true end and trying use accepts_nested_attributes_for create residual record when creating new quote. working fine term , mileage, , rebate , moneyfactor nested under term (i leaving out because working fine), having difficulty when trying create residual because belongs 2 different models belongs quote. i've read many posts nested_attributes_for none seem deal specific situation. my quotescontroller create action: def create @quote = quote.new(quote_params)

html - Centre bootstrap divs in the middle of an image -

hi guys have background image 5 small divs in it. wondering best way center 5 divs in middle of image. reason cant find way put in middle without using margin-left: 300px or this. tried use div align in row doesn't work well html: <div class="parallax2"> <div class="info1"> <span class="border"></span> <div class="row"> <div class="col-xs-6 col-sm-4 col-md-2" > <!-- work_process --> <div class="work_process"> <div class="work_process-box"> <i class="fa fa-lightbulb-o"></i> <h4>idea</h4> </div> </div> <!-- work_process --> </div> <div class="col-xs-6 col-sm-4 col-md-2"> <!-- work_p

C++ struct in separate header file -

this question has answer here: headers including each other in c++ 7 answers i've tried organize project thought include of global variables, #includes , struct definition in global.h header. can't understand concept , errors during build seem prove that. when try access global.h in logic.h happens. global.h: #ifndef global_h #define global_h #include "logic.h" #include <sdl.h> #include <iostream> #include <string> #include "graphics.h" //global variables , structs enum directions { d_up, d_left, d_down, d_right, d_total }; struct character { float health; float x; float y; float velocity; bool collision[d_total]; directions direction; sdl_rect animation; sdl_rect sprite; }; const int windowwidth = 800; const int windowheight = 600; const int framewidth = 64; cons

encoding - Escape Email Address - Best Practices -

what best practices user registration via web page, in regards escaping characters? if registers , email address test+1@gmail.com should escaped? should use encodeuricomponent on whole address, escaping + , @ %2b1 , %40? ran problem + not escaped , saved space, resulted in user not being found in db. suggestions?

Facebook AppInvite Android Studio Cannot resolve method show( -

i'm developping app react native, need incorporate native module use facebook appinvite let user invite friends on app. however, i've followed in react native's documentation add native module in react native (the link between react native , native code works), native module written in java doesn't work. https://facebook.github.io/react-native/docs/native-modules-android.html package com.app.app; import android.app.activity; import android.content.context; import android.graphics.bitmap; import com.facebook.react.bridge.nativemodule; import com.facebook.react.bridge.reactapplicationcontext; import com.facebook.react.bridge.reactcontext; import com.facebook.react.bridge.reactcontextbasejavamodule; import com.facebook.react.bridge.reactmethod; import com.facebook.facebooksdk; import com.facebook.callbackmanager; import com.facebook.facebookexception; import com.facebook.share.model.appinvitecontent; import com.facebook.share.widget.appinvitedialog; import androi

swift - observeSingleEvent is not triggering -

my observesingleevent not being triggered. set breakpoint @ let annotationref.. , goes through that, annotationref.observesingle.. , skips right on block of code under end of method. issue? let annotationref = database.database().reference(withpath: "annotationitems") annotationref.observesingleevent(of: .value, with: { snapshot in // not print print("it works") }) i have checked related questions. other things i've tried (and still didn't work): 1) turn off disk persistence 2) let newref = database.database().child("annotationitems) newref.observesingleevent(of: .value, { snapshot in 3) observe vs. observesingleevent 4) added listener this database structure "annotationitems" : { "apple infinite loop" : { "city" : "cupertino", } }

Elasticsearch | Query over array of objects -

lets have object in es such as: { name: "calendar"; events: [ { birthday: "1992-10-09", graduation: "2018-06-15", wedding: "2016-12-12" } ] } is there way can query on events array find element in events array passed current date. so far have: get /index/type/_search { "query": { "range" : { "events" : { "gte" : "now" } } } } but not iterate on each object in array , return name of event. scenario should return object graduation: "2018-06-15". help! you can use nested datatypes store nested documents inside parent document. , query nested types can use nested query .

Google Scripts - Copy existing spreadsheet and rename it -

i using google scripts. attempting to, upon form submission, copy , existing spreadsheet (not spreadsheet form submits to) , rename based upon cell in submission. i assumed way identify spreadsheet copied id. here bit of code. both variables (newuserss , uuid) define properly. var newuserss = "1-bow_eikc-dt8px9ylwpjzttwjedyopxcassxq9ndvm"; var uuid = sheet.getsheetvalues(newline,2,1,1); newuserss.copy(uuid); you can copy spreadsheet using retrieved spreadsheet using spreadsheet id. the detail information of copy() here . modified script : var id = "1-bow_eikc-dt8px9ylwpjzttwjedyopxcassxq9ndvm"; var newuserss = spreadsheetapp.openbyid(id); var uuid = sheet.getsheetvalues(newline,2,1,1); newuserss.copy(uuid); if misunderstand question, i'm sorry.

Running python on Command prompt:Access is Denied -

i installed python long , worked fine these months, install libraries command prompt..run python programs using shell vba until 1 day..it started failing, able run python scripts idle not command prompt or vba. have tried checking permission no success. if type python on command prompt, says app can't run on pc , later "access denied" displays on prompt.

css - Amcharts: how to apply transform in valueAxis svg element -

i trying apply margin in amcharts .amcharts-category-axis svg element, not works in css <g class="amcharts-category-axis" transform="translate(0,20)" visibility="visible">...</g> if apply transform="translate(50,20)" fix problem, in css .amcharts-category-axis{ transform: translate(0, 20); } doesn't works you need specify unit when using css. try transform: translate(50px, 20px) . note this doesn't work on ie 11 , edge . you'll have stick attributes ie/edge or, preferably, setting own margins using chart's margin properties . demo using translate(59px, 0px)

c# - WinForms Control for PDF Viewer with Layers/OCG functionality -

i looking c# winforms pdf viewer control has ability toggle visibility of layers(i.e. ocgs). suggestions? have taken quick @ spire.pdfviewer , dynamicpdf viewer libraries, either mention layers/ocg in documentation. am correct layer visibility should controllable pdf viewer?

java ee - Loop inside @Schedule with new transactions -

this question exact duplicate of: what's clean, standard way multiple transactions in ejb? 2 answers i'm using ejb @scheduled annotation loop on context entities every 10 secs. contexts entities unrelated each other , therefore should create new transactions update method: @stateless public class updateservice { @ejb contextdao contextdao; @schedule(second = "*/10", minute = "*", hour = "*") public void update() { for(contextentity context : contextdao.findallcontexts()) { updatecontext(context); } } public void updatecontext(contextentity context) { // load data db // update stuff // save db } } now wanna have single transactions updatecontext method. if error in 1 contextentity, transaction should rolled , not whole loop. what correct t

In python is "key not in container" allowed, or must we write "not (key in container)?" -

in python, know permissible write: happy_bag = list() if not (key in happy_bag): print(key, " ain't in da bag.") but okay write: happy_bag = list() if key not in happy_bag: print(key, " ain't in da bag.") also, following legal: if key in happy_bag: print("congratulations! have ", key, " in bag!") but alright if add word "is"? if key in happy_bag: print("congratulations! have ", key, " in bag!") it correct write: container = [] key = 1 if key not in container: print("not found") and advised. pep 8: programming conventions use is not operator rather not ... is . while both expressions functionally identical, former more readable , preferred. regarding second question is in not correct operator in python. operator is used test reference identity: a = [] b = [] c = assert(a == b) # good, 2 lists compare equal per list.__eq__ assert(a b) #

osx - python(twisted) gives error in openssl installation in MAC? -

i have installed openssl in mac(v 10.11.3) # brew upgrade #brew install openssl warning: openssl 1.0.2l installed i ran following commands too; easy_install pyopenssl easy_install pycrypto all these commands installed without issue. and tried link openssl brew #brew link openssl and getting warning: refusing link: openssl linking keg-only openssl means may end linking against insecure, deprecated system openssl while using headers homebrew's openssl. instead, pass full include/library paths compiler e.g.: -i/usr/local/opt/openssl/include -l/usr/local/opt/openssl/lib but if try; brew link /usr/local/opt/openssl/bin --force (or, **lib**, **include** folders) i same locations error: no available formula name "/usr/local/opt/openssl/bin" now when try in python command prompt; >>> twisted.internet import reactor, endpoints i following error attributeerror: 'module' object has no attribute 'op_no_tls

swift - Proper way to stop an infinitely rotating image? and how does one implement removeAllAnimations? -

i'd use button toggle – click once & image rotates indefinitely. click again, image stops, click again, restarts. i found answer helpful in getting animation continue: rotate view 360 degrees indefinitely in swift? however, i'm unclear on how stop things. i've implemented code below & seems work, curious if proper way stop animation, or if there another, preferred method. - rotation continues until finishing, i'm wondering if can freeze rotation @ location when button pressed (i've tried .removeallanimations() in second attempt below, doesn't seem work @ all. @iboutlet weak var imageview: uiimageview!     var stoprotation = true     func rotateview(targetview: uiview, duration: double = 1.0) {         if !stoprotation {             uiview.animate(withduration: duration, delay: 0.0, options: .curvelinear, animations: {                 targetview.transform = targetview.transform.rotated(by: cgfloat(double.pi))             }) { finished in  

date - Create season variable in R -

my season time oct 1st march 31st of following year. how create dummy variable season see person exposed in , out df <- data.frame(id= c(1:6), drug = c("a","c","a","a","b","a"), start = c("01/01/2009","07/10/2010","10/10/2009","03/01/2011","03/01/2012","04/12/2010"), end=c("09/10/2009","04/20/2011","07/20/1010","01/01/2012","04/01/2013","09/30/2011")) my output: id drug start end season 1 1 01/01/2009 09/10/2009 1 2 1 01/01/2009 09/10/2009 0 3 2 c 07/10/2010 04/20/2011 0 4 2 c 07/10/2010 04/20/2011 1 5 2 c 07/10/2010 04/20/2011 0 6 3 10/10/2009 07/20/1010 1 7 3 10/10/2009 07/20/1010 0 8 3 10/10/2009 07/20/1010 1 9 4 b 03/01/2011 01/01/2012 1 10 4 b

Power Function Without the use of In Built Power function In Python -

i'm trying make power function in python (2.7) without use of n**n or importing math.pow this had tried. screenshot of vi is there should put under loop math checks out? think w = x*i causing issue. thanks everyone!

What does the output mean when I print a tensor in tensorflow -

sorry if obvious. title says, mean when print tensor in console. print(tf.constant([1,2])) # tensor("const_7:0", shape=(2,), dtype=int32) i understand shape , dtype , how const_7:0 ? const looks me operation creates tensor. :0 then? const_7 means name of operation , name of operation should unique in single graph. port 0 means first output tensor of op. operation has many output tensors tf.split , these tensors named port after name of operation.

php - WordPress: Related Tags by Tag? -

a short question, maybe has idea. i found a little snippet times ago, displays list of tags, used in specific category. does knows snippet or modification show related tags based on tag (show tags, combined specific tag)? sincerely!

c++ - qtcreator this value on local and variable window? -

Image
hi there, as can see in attached picture this value on local variables window different printed. give me explain? btw, give explain of other fields this such as: qobject, [d]...etc update this happened on qtcreator 4.2.1 (based on qt 5.8.0) i've upgraded qtcreator 4.3.1 (based on qt 5.9.1) , show this value printed on terminal. maybe there way configure local , expression window somehow.

nginx - What is gnginx.exe? How to delete it from processes? -

Image
i have strange picture in windows 10 task manager. have terminated nginx.exe process still have these. gnginx.exe ? can't terminate in task manager, process doesn't disappear. also nginx directory. program lives in it:

swift - PhysicsEditor Polygon Path to CGPath -

is there way can export physicsbody polygon path physicseditor (from code , web) cgpath? feel there may easier way me manually convert (72, 429) , (77, 423) , (77, 425) , (-64, 437) ... [cgpoint(x: 72, y: 429), cgpoint(x: 77, y: 423) ... etc. can't find info online. thanks edit: have figured out way in xcode playground using string.replacingoccurrences(of:... you can make own extractor template , extract plist of strings read nsarray. now not going go on process, can check out resources on @ code , web see how make that. the string must in {x,y} format once have in plist format, can load nsarray , , iterate through array so: let polygon = cgmutablepath() polygon.move(to:cgpoint.zero) let array = nsarray(filenamed:"polygon") strpoint in array { let point = cgpointfromstring(strpoint) polygon.addline(to:point) } polygon.closesubpath() 'note if need example of how plist should nsarray, can create 1 via new file method, , open in xm

mysql - Java - how to query by Enum values -

i need data database enum values , enum following: public enum inspecttype{ often, regular, special, } and entity , public class techbridgeinspect{ private inspecttype insepcttype; get... set... } if want select total count database inspecttype = , how write it? i try following cannot worked. select count(*) techbridgeinspect inspecttype = 'often'; update: try following jpql , worked , string jpql1= "select count(inspect) techbridgeinspect inspect inspect.insepcttype in (:inspecttype)"; entitymanager.createquery(jpql1,long.class).setparameter("inspecttype", enumset.of(techbridgeinspect.inspecttype.often)).getsingleresult(); try this, if using jpa, select count(t) techbridgeinspect t t t.inspecttype = inspecttype.often

How to find out the categorical variables in R -

this question has answer here: how classes of columns in data frame? 1 answer i have dataset, named diamonds. has ten variables: carat, cut, color, clarity... so, how can write code find out variables categorical variables. using class() function find out type of each variable, how can let program print automatically? classvariables = sapply(diamonds, function(x) class(x)) > str(diamonds) classes ‘tbl_df’, ‘tbl’ , 'data.frame': 53940 obs. of 10 variables: $ carat : num 0.23 0.21 0.23 0.29 0.31 0.24 0.24 0.26 0.22 0.23 ... $ cut : ord.factor w/ 5 levels "fair"<"good"<..: 5 4 2 4 2 3 3 3 1 3 ... $ color : ord.factor w/ 7 levels "d"<"e"<"f"<"g"<..: 2 2 2 6 7 7 6 5 2 5 ... $ clarity: ord.factor w/ 8 levels "i1"<"si2"<"si1"&l

html - Can we validate .0 using regex -

i'm doing field accept whole numbers. did regex validation /^\d{1,3}$/ validating whole number entry , not allow decimal .1 e.g make 1.1 invalid when tried input 1.0 accepted it. there regex check .0? ^\d{1,3}(\.0)?$ accepts one, 2 or 3 digit whole numbers if end .0 .

How to use Apache to serve Django server and React client? -

i'm trying configure apache2 serve django backend apis ( /api/ ), , react app client side js ( / ). i want root path load react app (e.g. www.example.com/ ). i'm having hard time. if alias/documentroot / react's /build directory, apache stops serving django. , conversely when remove alias/documentroot, django serves fine react doesn't. how this? here's httpd.conf file: ``` documentroot /home/ubuntu/project/webapp/build/ alias / /home/ubuntu/project/webapp/build/ <directory /home/ubuntu/project/webapp/build> require granted </directory> alias /static /home/ubuntu/project/webapp/build/static <directory /home/ubuntu/project/webapp/build/static> require granted </directory> wsgidaemonprocess server python-home=/home/ubuntu/python3.5/ python-path=/home/ubuntu/project/server wsgiprocessgroup server wsgiscriptalias /admin /home/ubuntu/project/server/server/wsgi.py <directory /home/ubuntu/project/server/server> <fi

How to get "substring" from a char array in C -

i have char array of form: [17 chars, tab char, 17 chars, tab char, 17 chars, tab char, char representing number between 1 , 4 digits long, null-byte] i want store chars sit between tab char , null-byte in new variable. example 1: char array: [1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,\t,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,\t,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,\t,3,4,\0] and want save int 34 in variable called x. example 2: char array: [1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,\t,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,\t,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,\t,5,9,9,\0] and want save int 599 in variable called x. i can if know number of digits of number, not sure how solve problem of having number of unknown length. any appreciated much. let's string (aka char array) pointed str , since seem need number in int can use atoi(str + 3 * (17 + 1)) want. if want in string can use strcpy(str2, str + 3 * (17 + 1)) assuming buffer pointed str2 . btw, need include stdlib.h at

PHP Switch Case with Include Breaks Following Code -

Image
my code working before included in external file. in main file: switch($data){ case 'test': include_once(dirname(__file__) . '/test.php'); break; } in test.php: <?php echo 'bark bark'; ?> what when try load main file : parse error: syntax error, unexpected 'break' (t_break) in /(......directory info removed)/mainfile.php on line 3 i have tried many different ways reference directory path, including full path (public_html, etc), , nothing seems load it. using wordpress; not sure if makes difference. any ideas? there character &#65279 - 'zero width no-break space' after ; in include_once . should have copy pasted somewhere. remove last character or try typing manually. fixes! read here

android application using java -

morning dear freinds, i'm new in android , have problem button,when click on program closed message 09-14 12:39:30.197 10756-10756/com.mugenziisrael.bus_booking e/androidruntime: fatal exception: main java.lang.runtimeexception: unable start activity componentinfo{com.mugenziisrael.bus_booking/com.delaroystudios.bus_seat_booking_system.sign_in}: android.view.inflateexception: binary xml file line #71: error inflating class button please know may me solve issue, main class. package com.delaroystudios.bus_seat_booking_system; import android.content.intent; import android.graphics.color; import android.support.v7.app.appcompatactivity; import android.os.bundle; import android.view.view; import android.widget.adapterview; import android.widget.arrayadapter; import android.widget.button; import android.widget.spinner; import android.widget.spinneradapter; import android.widget.textview; import android.widget.toast; public class main_activity_login extends appcompatactivity {

quickbooks - Trying to add a Payment on QBO Credit Memo -

i'm trying add payment credit memo type throws error this. {"fault":{"error":[{"message":"a business validation error has occurred while processing request","detail":"business validation error: amount received (plus credits) can't less selected charges. also, selected charges can't less selected credits.","code":"6000","element":""}],"type":"validationfault"},"time":"2017-09-13t21:33:58.047-07:00"} here sample post body request { "customerref": { "value": "73", "name": "john doe" }, "totalamt": 1100.0, "line": [ { "amount": 1100.0, "linkedtxn": [ { "txnid": "250", "txntype": "creditmemo" }]

javascript - jQuery function not working for dynamically added field -

i added group of fields dynamically. , assign class jquery function it. first row working fine when insert send row jquery function not working. insert dynamic field same class. $(".catg").change(function(){ var classes = $(this).parents('.col-sm-3').parents('.input-group').attr('id'); alert(classes); }); you should use .on() create delegated events: $(document).on('change', '.catg', function(){ var classes = $(this).parents('.col-sm-3').parents('.input-group').attr('id'); alert(classes); });

machine learning - Use neural network to learn a square wave function -

Image
out of curiosity, trying build simple connected nn using tensorflow learn square wave function such following one: therefore input 1d array of x value (as horizontal axis), , output binary scalar value. used tf.nn.sparse_softmax_cross_entropy_with_logits loss function, , tf.nn.relu activation. there 3 hidden layers (100*100*100) , single input node , output node. input data generated match above wave shape , therefore data size not problem. however, trained model seems fail completed, predicting negative class always. so trying figure out why happened. whether nn configuration suboptimal, or due mathematical flaw in nn beneath surface (though think nn should able imitate function). thanks. as per suggestions in comment section, here full code. 1 thing noticed saying wrong earlier is, there 2 output nodes (due 2 output classes): """ see if neural net can find piecewise linear correlation in data """ import time import os import tens