Posts

Showing posts from February, 2011

java - org.hibernate.HibernateException: /hibernate.cfg.xml not found from resources -

Image
i have new spring-boot project. use gradle build manager , eclpice ide. want use hibernate , try configurations hibernate.cfg.xml file, org.hibernate.hibernateexception: /hibernate.cfg.xml not found i store file in resources folder, tried put meta-inf folder. folders structure: hibernateutil.java: public class hibernateutil { private static sessionfactory sessionfactory = buildsessionfactory(); private static sessionfactory buildsessionfactory() { try { if (sessionfactory == null) { sessionfactory = new configuration().configure().buildsessionfactory(); } return sessionfactory; } catch (throwable ex) { system.err.println("initial sessionfactory creation failed." + ex); throw new exceptionininitializererror(ex); } } public static sessionfactory getsessionfactory() { return sessionfactory; } public static void shutdown() { // close caches , co

ios - UIFont.systemFontOfSize(16.0) = font size ... ?? px in HTML -

this question has answer here: font size in pixels 7 answers i have uifont.systemfontofsize(16.0) want know font size pixels on html as @cynicismrising answer :- point sizes defined 1/72 of inch. is, 72-point font approximately 1 inch lowest descent highest ascent. maximum height of glyph in 72pt font 1 inch.

Unable to send/receive messages in Multi Node Kafka cluster -

i have multi node kafka cluster, im able create topics successfully, clear in zookeeper logs. cant send/receive messages of topics though created. also dont see logs created topics of them in /tmp/kafka-logs directory in of kafka brokers part of 3 nodes. for example: if had created topic1...topic5. i'm able send , receive messages topic3,topic4. have producer & consumer running in node1. idea if i'm doing wrong here? on producer side: private properties producerconfig() { properties props = new properties(); props.put("bootstrap.servers", "host1:9092,host2:9092,host3:9092"); props.put("acks", "all"); props.put("retries", 0); props.put("key.serializer", "org.apache.kafka.common.serialization.stringserializer"); props.put("value.serializer", "org.apache.kafka.common.serialization.stringserializer"); return props; } on consumer side: private properties c

ios - In objective-c date picker issue -

i have send date server in "eee, dd mmm yyyy h:mm:ss a" format , date should save in json format "yyyy-mm-dd't'hh:mm:ss.sss'z'". please give me suggestions. exact solution here.i tried sample 1 you.here solution. nsdateformatter* formatter = [[nsdateformatter alloc] init]; [formatter setdateformat:@"eee, dd mmm yyyy h:mm:ss a"]; lbl.text = [formatter stringfromdate:[nsdate date]] nslog(@"the lbl text - %@",lbl.text); the printed output is the lbl text - thu, 28 jul 2016 2:44:56 pm then need convert string date in same date format [formatter setdateformat:@"eee, dd mmm yyyy h:mm:ss a"]; nsdate *date = [dateformatter datefromstring:lbl.text]; nslog(@"the date - %@",date); in above code if not set date format "eee, dd mmm yyyy h:mm:ss a" returns nil date.so when date format set format same string format. printed result is the date - 2016-07-28 09:14:56 +0000 then set dat

php - Can't type a "}" in PhpStorm -

i have azerty keyboard, , version of phpstorm : 2016.2 (last version). did not have issue previous version got of phpstorm. how discovered issue? i'm learning web development , trying edit templates when create new file seems can't type editor itself... just know, in azerty keyboard, default shortcut type } : altgr + = (2 keys after 0) , opening curly braces it's altgr + ' (4) anyone got idea ? go settings -> keymap, there find shortcut icon on top right. click , press same combination you're trying use } sign. remove found shortcuts , try again.

reactjs - React + Flux example | Step by Step Guide -

i have googled across various platforms , websites not find basic example of flux architecture react. there complex examples , mentioned simple difficult start with. how start learning flux docs not best way understand unless have sample working example step step guide most flux tutorials find online using react. have plenty of options available online. here few (free , paid): free options include: https://scotch.io/tutorials/getting-to-know-flux-the-react-js-architecture for more in depth discussion on topic can check out: https://discuss.reactjs.org/t/whats-the-best-flux-tutorial/51/2 paid options include (free trial available): with account on pluralsight there 4 courses available: "building applications react , flux", cory house "building data-driven react applications relay, graphql, , flux", samer buna "building real-time app react, flux, webpack, , firebase", hendrik swanepoel "react , flux angular developers",

ruby on rails - How do I use the parser gem to extract this code snippet I want? -

i stumbled across this parser gem . what want extract specific method long file. one example has_many method rails: def has_many(name, scope = nil, options = {}, &extension) reflection = builder::hasmany.build(self, name, scope, options, &extension) reflection.add_reflection self, name, reflection end the issue is, need able extract version of same method (from earlier time), more verbose , complex. version looks this: def has_many(association_id, options = {}) validate_options([ :foreign_key, :class_name, :exclusively_dependent, :dependent, :conditions, :order, :finder_sql ], options.keys) association_name, association_class_name, association_class_primary_key_name = associate_identification(association_id, options[:class_name], options[:foreign_key]) require_association_class(association_class_name) if options[:dependent] , options[:exclusively_dependent] raise argumenterror, ':dependent , :exclusively_dependent

winapi - Why SHCreateItemFromIDList faild? -

tchar temp[max_path] = { 0, }; hresult hr = null; pidlist_absolute pidl; //=lpitemidlist ishellitem2 *_psidrop=null; hresult hr = coinitializeex(null, coinit_apartmentthreaded | coinit_disable_ole1dde); //must add this! shparsedisplayname(l"c:\\", null, &pidl, 0, null); if (shgetpathfromidlist(pidl, temp)) { wprintf(l"%s\n", temp); } hr = shcreateitemfromidlist(pidl, iid_ppv_args(&_psidrop)); if (failed(hr)) { wprintf(l"shcreateitemfromidlist failed"); } how can initialize ishellitem2 use pidlist_absolute ? _psidrop has been null.

c# - "The network name cannot be found" error when accessing server path -

i error when try access server path remote client. address in web.config file <appsettings> <add key="rootdirectory" value="\\ipaddress/root\"/> </appsettings> its retrieved if (configurationmanager.appsettings["rootdirectory"] != null) { root = configurationmanager.appsettings["rootdirectory"]; } public static string requiredscvfileslocation { { return root + @"blabla\"; } } and called this string[] requiredfiles = directory.getfiles(globals.common.requiredscvfileslocation,"*.svc.zip").toarray(); error comes @ last code piece the problem solved when share filepath in server iis. didn't think needed long sufficient permissions given iis_iusrs .

tsql - Create new columns in a declared query variable in SQL Server -

i've created stored procedure in sql server 2008 r2. executes pivot table. so, need next steps 3 new columns, create in declared query variable. in these 3 columns have perform calculation. at first, stored procedures code: update stored procedure: begin set nocount on; declare @colno nvarchar(max) declare @colsum nvarchar(max) declare @query nvarchar(max) set nocount on; vals ( select distinct ds.no qrtestview ds ) select @colno = coalesce(@colno + ', ', '') + quotename(no) @colsum = coalesce(@colsum + '+ ', '') + quotename(no) vals order no set @query = 'select *, [bonus] + 125 [fee], ([bonus] + 125) * [all] [fee2] ( select *, case when 70-(100 - quote) * 10 > -80 70-(100 - quote) * 10 else -70 end [bonus] ( select *, '+@col

php - Laravel Eloquent - how to relate table to another by two fields -

having 2 tables user , mail mailtable : \mail \--|id \--|user_id \--|from_user_id \--|other_fields usertable : \user \--|id \--|name \--|other_fields the mail table related user 2 fields => user_id , from_user_id , how use eloquent fetch data related user inbox , outbox(sent) 1 user? not sure how models have been defined, should work. namespace app; use illuminate\database\eloquent\model; class mail extends model { public function user() { return $this->hasone('app\user'); } public function from_user() { return $this->hasone('app\user', 'id', 'from_user_id'); } } then fetch, use: $from_user = $mail->from_user adjust namespaces according how they've been defined in application.

html - How to use nested p tags in CSS and Bootstrap boxes? -

Image
this image have: not sure how make text lieu, suchy, prix, chf 2'250 align in image. , because i'm new bootstrap want know if did correct. .boxes-images img { width: 100%; } .boxes-images h4 { text-align: center; background-color: #8c1211; color: #ffffff; padding: 10px 0px 10px 0px; font-weight: bold; margin-top: 0px; margin-bottom: 0px; } .boxes-images .details { background-color: #d6d6d6; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; } <div class="text-page"> <div class="row"> <div class="col-sm-3 boxes-images"> <img src="images/automobile.jpg"> <h4>immobilier</h4> <div class="details"> <p>magnifique et spacieux 4,5 pieces: 1mios de loyer</p> <p>lieu<span>suchy</span> <p> <p>prix<span>chf 2'250

Rails route to specific action for resource -

i'm trying url given params: url_for({ :action => "show", :controller => "questions", :dashboard_id => "123", :dashboard_type => "mono", :question_id => "1234", :only_path => true }) but error: actioncontroller::routingerror: no route matches {:action=>"show", :controller=>"questions", :dashboard_id=>"123", :dashboard_type=>"mono", :question_id=>"1234"} in routes.rb file, have configuration: resources :dashboards, :only => [:index, :all, :create] resources :questions, :path => '/:dashboard_type/questions' end what seems problem? replace :question_id :id it should be url_for({ :action => "show", :controller => "questions", :dashboard_id => "123", :dashboard_type => "mono", :id => "1234", :only_path => true }) as t

sitemap - Whitespace between elements (closing tags and opening tags) in XML? -

i have xml sitemap. need white space between closing tag , opening tags? e.g. should this: />< actually : /> < or both okay? here's example of block of code without spaces: <?xml version="1.0" encoding="utf-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml"><url><loc>http: //www.ospreyeurope.com/che_de/hiking/tempest-series</loc><lastmod>2016-07-20</lastmod><changefreq>daily</changefreq><priority>0.5</priority><xhtml:link rel="alternate" href="http://www.ospreyeurope.com/eu_en/hiking/tempest-series" hreflang="en" /><xhtml:link rel="alternate" href="http://www.ospreyeurope.com/che_de/hiking/tempest-series" hreflang="de-ch" /><xhtml:link rel="alternate" href="http://www.ospreyeurope.com/che_fr/hiking/tempest

oracle - With clause execution -

i've thought with clause working one-time execute statement, behaves normal table - can sql operations on over regular table. but turned out in several databases(oracle, netezza, sybase, teradata) with clause executed each time used. test as( select random() --pseudo code ) select '1st select', * test union select '2nd select', * form test instead of 2 identical numbers, query above returns 2 different numbers, executed each of selects. if have complex query within with clause , use 5 times in rest of query, execute 5 times seems ineffective me. so can give me logical reason working way? at least in teradata it's working expected, random value calculated once: with test as( select random(1,1000000) x --pseudo code ) select '1st select', x test union select '2nd select', x test ; *** query completed. 2 rows found. 2 columns returned. *** total elapsed time 1 second. '1st select' x -----

ubuntu - [/lib/x86_64-linux-gnu/libc.so.6 - glibc not found] -

i using ubuntu 12.04 lts , when try execute premake5 tool ( http://premake.github.io/download.html ) following error , have not figured out how solve yet.. premake5: /lib/x86_64-linux-gnu/libc.so.6: version `glibc_2.16' not found (required premake5) i read on internet that`s caused version of ubuntu. ideas? the binary version of premake5 more contemporary os. old ubuntu 12.04 has (g)libc → libc6 version 2.15 , cannot used. premake5 available source code, premake-4.4-beta5-src.zip http://sourceforge.net/projects/premake/files/premake/4.4/premake-4.4-beta5-src.zip/download ... or https://github.com/premake/premake-core ... , can try if it's possible build ubuntu 12.04 . confirm : premake5 builds ok ubuntu 12.04.5 git clone https://github.com/premake/premake-core.git cd premake-core/ git submodule init git submodule update make -f bootstrap.mak linux provides premake-core/bin/release/premake5

visual studio - I'm trying to get my Nuget packages from Team Services but i get an error -

Image
unable load service index source -my source-. key not valid use in specified state. error package manager console: install-package : nuget packages missing solution. packages need restored in order build dependency graph. restore packages before performing operations. @ line:1 char:1 + install-package owasp.esapi -source source ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + categoryinfo : invalidoperation: (:) [install-package], invalidoperationexception + fullyqualifiederrorid : nugetmissingpackages,nuget.packagemanagement.powershellcmdlets.installpackagecommand another error: steps add vsts package feed , install package producing nuget packages the process quite simple. first need package feed send nuget package to. create clicking package link inside project , click "new feed", giving name "default" (we unlikely create more 1 in each project). leave options , choose create.

android - ListView collapse in CustomScrollView -

hello new in android development, , i've read various threads talked fact listview should not inside scrollview , need wrap in linear or relative layout. but have layout <com.itmind.spac.spacapp.custom_extends.customscrollview xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/scrollviewreceipt" > <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> <include android:id="@+id/include1" android:layout_width="fill_parent" android:layout_height="wrap_content" layout="@layout/toolbar" /> <spinner android:id="@+id/customers_spinner" android:layout_width="fill_paren

python - Sublime Text plugin - how to find all regions in selection -

how find regions in selection (regeon type too)? if calling method: def chk_links(self,vspace): url_regions = vspace.find_all("https?://[^\"'\s]+") i=0 region in url_regions: cl = vspace.substr(region) code = self.get_response(cl) vspace.add_regions('url'+str(i), [region], "mark", "packages/user/icons/"+str(code)+".png") = i+1 return in view context, e.g.: chk_links(self.view) all works fine, in way: chk_links(self.view.sel()[0]) i error: attributeerror: 'region' object has no attribute 'find_all' full code of plugin can find here sublime "view" method documentation the selection class (returned view.sel() ) list of region objects represent current selection. region can empty, list contains least 1 region length of 0. the methods available on selection class modify , query it's extents. similar methods available on r

Installshield 2014 - show form optional by errorcode of batch script -

how can display form in installshield sequence optional evaluating error code of batchscript? windows installer offers no direct way this. have create msi .dll custom action runs batch file, captures error code, , stores windows installer property (e.g. using msisetproperty). can edit events on relevant next button conditionally go selected optional panel. (don't forget edit button events accordingly wizard remains consistent.)

Can not load the json file of urls in python -

i tried make dict python , try retrieve data via url json error wrong ? use python 2.7.6 import json import urllib json_string = 'http://localhost/csv/taxo.json' parsed_json = json.loads(json_string) print(parsed_json['genus']) this error traceback (most recent call last): file "dic2.py", line 11, in parsed_json = json.loads(json_string) file "/usr/lib/python2.7/json/ init .py", line 338, in loads return _default_decoder.decode(s) file "/usr/lib/python2.7/json/decoder.py", line 366, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) file "/usr/lib/python2.7/json/decoder.py", line 384, in raw_decode raise valueerror("no json object decoded") valueerror: no json object decoded json_string not json string. url... you should content of url 1 of http modules available python. you should other way around. requests module gives option requ

sql - query to find primary index for a progress table (openegde V11.6) -

in previous versions of progress database (9.x, 10.x) below query works fine find primary index of table. select "_index-name" pub."_index" in, pub."_file" fi fi."_file-name"='tablename' , in."rowid" = (select"_file"."_prime-index" pub."_file" fs fs."_file-name"='tablename'); now rowid has been removed on progress v11.6 , there sql query fetch primary index of progress database table through ojdbc? this working in 11.6 well. see following query: select "_index-name" pub."_index" idx, pub."_file" fi fi."_file-name"='customer' , idx.rowid =(select"_file"."_prime-index" pub."_file" fs fs."_file-name"='customer'); _index-name -------------------------------- custnum

How to plot glm model coefficients with abline in R? -

Image
i'm struggling plot cofficients of glm model using abline . lets take simple 2d example: d <- iris[51:150, c(3:4,5)] d[,3] <- factor(d[,3]) plot(d[,1:2], col=d[,3]) the glm model yields 4 coefficients: m <- glm(formula = species~petal.length*petal.width, data = d, family = "binomial") m$coefficients # (intercept) petal.length petal.width petal.length:petal.width # -131.23813 22.93553 63.63527 -10.63606 how plot simple abline ? binomial models not set this. have single 0|1 response variable (i.e. predict whether sample in single species). maybe because have 2 species included in model, still seems work (this not case when 3 spp included). second trick predict type="response" , round these values discrete predictions: d$pred <- factor(levels(d[,3])[round(predict(m, type="response"))+1]) plot(d[,1:2], col=d[,3]) points(d[,1:2], col=d$pred, pch=

base64 - Java Encode and decode string without forward or backward slash -

i have code encode , decode string. when input "9" encrypt method return "9icoc73f/683bf5wrjdnkq==" the problem when encode string return encoded string (/ or \ ) , want remove (/ or \ ) string. so how can achieve encrypt , decrypt both method. import java.security.key; import javax.crypto.cipher; import javax.crypto.spec.secretkeyspec; import sun.misc.base64decoder; import sun.misc.base64encoder; public class encryptdecryptaesalgo { private static final string algo = "aes"; private static final byte[] keyvalue = new byte[] { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p' }; public string encrypt(string data) throws exception { string encryptedvalue = ""; try { key key = generatekey(); cipher c = cipher.getinst

java - PublishSubject to fire onNext when subscribed -

i'm trying create proxy models using rxjava, proxy lets other subscribe changes in model. here's simplified version of proxy: class mymodelproxy { private static mymodelproxy instance; private mymodel model; private publishsubject<mymodel> subject; private mymodelproxy() { this.model = // load cache this.subject = publishsubject.create(); } public static observable<mymodel> observe() { if (instance == null) { instance = new mymodelproxy(); } return instance.subject; } private void modelupdated() { this.subject.onnext(this.model); } } there's 1 instance of mymodel in system, might change on time, , want able register these updates. code works if register on observable returned observe method before calling onnext of subject. the behavior want when subscribe method called on observer current instance of mymodel sent subscriber subscribed. i tho

chromium embedded - How to open a file dialog using javascript with CEF -

i learning cef,and want open file dialog using owner javascript code.who can me solve it? i have solved problem. how open filedialog using javascript

print a paragraph that contains more than 2 patterns using awk or sed -

i want print paragraphs begin "select" , end ";", should contain "in cccc" example if have following code select aaaa bbbb in cccc ; select dddd eeeee in ffff ; select rrrr eeeee in cccc ; the result select aaaa bbbb in cccc ; select rrrr eeeee in cccc ; so here's awk used awk '/^select*/,/^;/{if ($0 ~ /^in cccc/) ; print}' inputfile result entire content of file you can try awk : awk 'begin{ors=rs=";"} /^[[:space:]]*select.*in cccc/' file here, ors - output record separator rs - input record separator

angular - How do I navigate to a sibling route? -

let's presume got router config export const employeeroutes = [ { path: 'sales', component: salescomponent }, { path: 'contacts', component: contactscomponent } ]; and have navigated salescomponent via url /department/7/employees/45/sales now i'd go contacts , don't have parameters absolute route (e.g. department id, 7 in above example) i'd prefer there using relative link, e.g. [routerlink]="['../contacts']" or this.router.navigate('../contacts') which unfortunately doesn't work. there may obvious solution i'm not seeing it. can out here please? if using new router (3.0.0-beta2), can use activatedroute navigate relative path follow: constructor(private router: router, private r:activatedroute) {} /// gotocontact() { this.router.navigate(["../contacts"], { relativeto: this.r }); }

c# - HTML Designer Interface -

i have searched couple of hours, did not found fitting solution. here problem: my software (c#, wpf) contains functionality send automatically mails customers. therefore, offer interface create html mail template (header/footer) give mails professional look. freeware/framework 'ask question' interface in stack overflow awesome. greetings leo have here , reuse build email template, , save it. you allow user set special tags in such {{name}} or {{orderdescription}} , parse fill html string output before sending.

ansible - One or more undefined variables: 'dict object' has no attribute 'ansible_ssh_host' -

i trying install openstack using ansible aio, ran bootstrap-ansible.sh , bootstrap-aio.sh scripts , updated openstack_user_config.yml, user_variables.yml files, started run-playbook.sh script, failed following error: task: [openstack_hosts | drop hosts file entries script] ********************* fatal: [ . . . ] => {'msg': "ansibleundefinedvariable: 1 or more undefined variables: 'dict object' has no attribute 'ansible_ssh_host'", 'failed': true} fatal: [ . . . ] => {'msg': "ansibleundefinedvariable: 1 or more undefined variables: 'dict object' has no attribute 'ansible_ssh_host'", 'failed': true} can please find issue occurs , how fix ? i fixed same problem on docker :) the 'dict object' referring dictionary object created user_variables.yml file (possibly because ansible compiler uses python, i'm not sure). basically, 'ansible_ssh_host'

javascript - jQuery Ajax object dot notation undefined from REST -

hey guys having big problem understanding why each unable parse restful end point within ajax success function: so have following code: $.ajax({ datatype: "json", url: '/showroom-event-gallery-api', success: function(data) { var rawdata = data.slice(0,10); console.log(rawdata); (var = 0, len = rawdata.length; < len; i++) { var imagename = rawdata.name; console.log(imagename); } } }); the console.log(rawdata); statement runs , shows objects rest api. issue having when try , use dot notation select parameter called name within of objects , store them variable. when console.log(imagename); undefined name parameter inside object unsure why happening? here example of data: [ { id:225, car_image_category_id:37, image_name:"dsc_9672", name:"77a3b8f84d63557d165f3b4ecf0d079e5cd1ae67.jpg", path:"img/imagedb/77a3b8f84d63557d165f3b4ecf0d079e5cd1ae67.jpg&qu

IntelliJ System.out.println() - Cannot resolve method println(java.lang.String) -

Image
i using intellij idea, learning java. went until yesterday, when mentioned error occurred. i didn't make changes. looking solution following ways: reboot pc restart intellij. delete project directory , use 1 (both on desktop) nothing helps. buy running simple hello world method. keeps showing error: is there able me? ok, solved. file -> invalidated caches / restart

AutoHotKey, set focus on a button webpage and send click -

i have 1 button on html page window title "page": <button onclick="alert('this button has been clicked')">submit</button> and using autohotkey, i'm trying set focus on him , send mouse click. this ahk code write: ^p:: controlfocus, submit, page mouseclick left return on pressing ctrl+p keys, should job. unfortunately, doesn't work. i've read documentation examples , can't work... you can learn lot more intergrating ahk html dom here: https://autohotkey.com/boards/viewtopic.php?f=7&t=4588 see following example on how can achieved. example #singleinstance, off onexit,onexit gui add, activex, x0 y0 w640 h480 vwb, shell.explorer ; final parameter name of activex component. wb.silent := true ;surpress js error boxes wb.navigate("http://example.com/") ;put web address here... comobjconnect(wb, wb_events) ; connect wb's events wb_events class object. gui show, w640 h480 return guiclose:

ruby - Rails + Nokogiri : controller create -

i creating simple_form allows users create new article in database providing link original article. if user provides url ("original_url"), use nokogiri fetch information. i following error message: "no implicit conversion of nil string", tells me simple_form input field "original_url" not available used in controller / nokogiri. is possible use variable simple_form before saving it? my controller - create code: def create if @original_url = nil @article = article.new(article_params) else @url = params[:original_url] #### think problem is. how pass "original_url" input controller? #### data = nokogiri::html(open(@url)) headline = data.at_css(".entry-title").text.strip @article = article.new(:headline => headline) end respond_to |format| if @article.save format.html { redirect_to @article, notice: 'article created.' } format.json { render :show, status: :created, location

Supporting Authentication for HTML files in ASP.Net MVC -

i have web application developed in asp.net mvc, hosted in iis . client has provided set of html files help. have provided link html files in our application. html files stored in folder within web-directory of hosted applications. expectation html pages should not accessed unauthorized users. static pages , if know url, can directly access providing address in address-bar. please suggest how overcome? i had problem pdfs ( not html) resolve did : public class myfilecontroller : controller { [accesscontrol] public fileresult pdf() { return file(@"filepath\file.pdf", "system.net.mime.mediatypenames.application.pdf"); } } try system.net.mime.mediatypenames.text.html

javascript - Checking exists JS function in JavaFX WebEngine -

i need execute script file myfunctions.js in javafx webengine , send info server resttemplate: public void ondevicestatuschanged(devicestatusevent devicestatusevent) { string uri = defaultpage + "my/" + "devices/status"; if (devicestatusevent.getdevstat().getdev() == 0) { webengine.executescript("billacceptorstatus(" + devicestatusevent.getdevstat().getstatus() + ")"); } if (devicestatusevent.getdevstat().getdev() == 1) { webengine.executescript("posprinterstatus(" + devicestatusevent.getdevstat().getstatus() + ")"); } if (devicestatusevent.getdevstat().getdev() == 2) { webengine.executescript("cardreaderstatus(" + devicestatusevent.getdevstat().getstatus() + ")"); } if (devicestatusevent.getdevstat().getdev() == 4) { webengine.executescript("pinpadstatus(" + devicestatusevent.ge

how to write results of CRF++ tool in a file -

i using crf++. following command used testing:- crf_test -m model_file test_files there no option write results on file. while need results on separate file. we can use crf_test -m model_file test_files>filename . hope helpful.

html - Vertically align text divs with responsive font-size within a div -

Image
i have div : and tried making font-size of text responsive using code : font-size:calc(xx + 1.5vw); if make screen smaller headers not vertically aligned : html : <div id="topsection"> <div id="header1">header 1</div> <div id="header2">header 2</div> </div> css : #header1 { margin-left:220px; font-size:calc(20px + 1.5vw); color:#fff; } #header2 { color: #fff; margin-left:220px; font-size:calc(9px + 1.5vw); } #topsection { background-color:#222939; width:100%; height:75px; z-index:1; position:absolute; top:10px; left:0; color:white; } i tried changing css headers : #header1 { display: inline-block; vertical-align: middle; margin-left:220px; font-size:calc(20px + 1.5vw); color:#fff; } #header2 { display: inline-block; vertical-align: middle; margin-left:220px; font-size:calc(9px + 1.3vw); color: #fff; } but looks : you need content div center in middle. see example below. have test

sql - Split by uppercase Oracle -

i loooking regex expression or : ------------------------ | id | prop_name | ------------------------ | 1 | isthisanexample | ------------------------ to : ----------------------------- | id | prop_name | ----------------------------- | 1 | example | ----------------------------- of course cool if first character uppercase , if other words start lowercase. spliting them okay. maybe regexp looking for "insert blank between each lower case character followed upper case character": select regexp_replace('isthisanexample', '([[:lower:]])([[:upper:]])', '\1 \2') dual first character can replaced upper case letter select upper(substr('isthisan example', 1,1))||substr('isthisan example', 2) dual; so, first replace first character , regexp_replace result: select regexp_replace(upper(substr('isthisan example', 1,1))||substr('isthisan example', 2), '([[:lower:]])([[:upper

linux - Search for columns ending with certain pattern, then delete that column -

i need search line of numbers columns end 999 , delete entire column while preserving leading number (i.e. 8599999.... --> 85) data line: 66 72 79 84 87 90 91 92 92 93 92 91 89 85999999999999999999999999999999999 desired output: 66 72 79 84 87 90 91 92 92 93 92 91 89 85 using sed $ echo '66 72 79 84 87 90 91 92 92 93 92 91 89 85999999999999999999999999999999999' | sed 's/999\+//g' 66 72 79 84 87 90 91 92 92 93 92 91 89 85 999\+ 999 followed number of consecutive 9s

amazon web services - Elastic search to have mapped column value as the ID using spark submit -

my spark submit pulls data kafka , puts elastic search, using below snippet run rdd. facts.foreachrdd(fact -> { javaesspark.savejsontoes(fact, esindex + "/" + estype); please me find way fact (elastic search mapping) column event_id "_id" of elastic search document. you can try following: facts.foreachrdd(fact -> { javaesspark.savejsontoes(fact, esindex + "/" + estype, immutablemap.of("es.mapping.id", "your_column_name"));});

wpf - Caliburn Micro Message.attach does not consider changes of datacontext -

this simplified example. have usercontrol contains "browse folder" functionality, using textbox , button. clicking button open browse-dialog, , fill in textbox. <usercontrol x:class="myusercontrol" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:cal="http://www.caliburnproject.org" mc:ignorable="d" d:designheight="300" d:designwidth="300"> <grid> <grid.columndefinitions> <columndefinition width="100"></columndefinition> <columndefinition width="*"></columndefinition> </grid.columndefinitions> <grid.rowdefinition

python - ValueError: too many values to unpack - Is it possible to ignore one value? -

the following line returns error: self.m, self.usercodetousernamelist, self.itemslist, self.usertokeyhash, self.filetokeyhash = readuserfilematrixfromfile(x,true) the function returns 6 values. in case, last 1 useless (its none). want store 5. is possible ignore last value? you can use *rest python 3. >>> x, y, z, *rest = 1, 2, 3, 4, 5, 6, 7 >>> x 1 >>> y 2 >>> rest [4, 5, 6, 7] this way can sure not encounter unpacking issues.

vba - Error Checking Option Boxes -

i'm trying build in error checking 2 option boxes have: projectoptionbox implementoptionbox this current code have right error checking couple of other things, unsure kind of code necessary option boxes: function checkinputs() boolean if not checkcontrol(me.nametextbox, "please enter name") exit function if not checkcontrol(me.projecttextbox, "please enter project name") exit function if not checkcontrol(me.initiativecombobox, "please select initiative") exit function if not checkcontrol(me.audiencecombobox, "please select audience") exit function if not checkcontrol(me.impactcombobox, "please select impact type") exit function if not checkcontrol(me.hourstextbox, "please enter amount of monthly hours") exit function if not checkcontrol(me.peopletextbox, "please enter amount of people on project") exit function if not checkcontrol(me.lengthlistbox, "") if not ch

objective c - UIImage orientation changed when drawing in UIGraphicsBeginImageContext -

Image
i want resize uiimage used below code. uigraphicsbeginimagecontext(size); [sourceimage drawinrect:cgrectmake(0, 0, size.width, size.height)]; uiimage *destimage = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext(); above code works fine orientation of destimage changed. don't know how. source.imageorientation = 3 destimage.imageorientation = 0 can 1 tell me how resize image same orientation sourceimage? edited: uiimage *scaleimage = [uiimage imagewithcgimage:destimage.cgimage scale:sourceimage.scale orientation:sourceimage.imageorientation]; edited: i getting result after resize image. i have tried above code also. still give me opposite orientation. resize imageview calayer *layer; layer=self.view.layer; uigraphicsbeginimagecontext(self.view.bounds.size); cgcontextcliptorect (uigraphicsgetcurrentcontext(),captureframe); //give frame of image here(x,y,width,height) [layer renderincontext:uigraph

ruby - How to add a disabled submit button in rails -

i have submit button in form in ruby f.submit btn_text, class: "btn btn-one mgt12 mgb12", id: "btn_id" i want make button disabled ruby without using javascript add disabled: true option. f.submit btn_text, class: "btn btn-one mgt12 mgb12", id: "btn_id", disabled: true

swift2 - My app cannot generate device token -

suddenly app cannot generate device token. created app receive remote push notification, thje app worked well, today app dont generate device token, run code on xcode , dont generate token. no delegates method called. dont change , dont work more. function didregisterforremotenotificationswithdevicetoken dont work. look: func application(application: uiapplication, didregisterforremotenotificationswithdevicetoken devicetoken: nsdata) { print(devicetoken) } dont print nothing this function nothing: func application(application: uiapplication, didfailtoregisterforremotenotificationswitherror error: nserror) { print(error) } func application(application: uiapplication, didfinishlaunchingwithoptions launchoptions: [nsobject: anyobject]?) -> bool { // override point customization after application launch. let types:uiusernotificationtype = [uiusernotificationtype.alert, uiusernotificationtype.badge, uiusernotificationtype.sound] application.registeruser

ios - Strange reaction when comparing dates with currentDate Swift -

i have title says strange reaction when compare dates currentdate. here happen: query server take dates print them sure took them right (and ok). print currentdate appearing 3 hours earlier. ok fix i'm saying. but! when i'm trying compare them take dates 20:59 , earlier. this code ( //dateevent dates recover server ) if dateevent.earlierdate(self.currentdate).isequaltodate(self.currentdate){ print("all dates \(dateevent)") if nscalendar.currentcalendar().isdate(dateevent, equaltodate: self.currentdate, tounitgranularity: .day){ print("here passed server \(dateevent)") print("here current date \(self.currentdate)") } } this output all dates 2016-07-28 19:00:00 +0000 here passed server 2016-07-28 19:00:00 +0000 here current date 2016-07-28 13:43:51 +0000 dates 2016-07-28 19:00:00 +0000 here passed server 2016-07-28 19:00:00 +0000 here current date 2016-07-28 13:43:51 +0000

c++ - call of overloaded *** <unresolved overloaded function type>)' is ambiguous -

please me how resolve error template <typename inputlterator, typename outputlterator, typename predicate> outputlterator copy_if( inputlterator begin, inputlterator end, outputlterator destbegin, predicate p) { return remove_copy_if(begin, end,destbegin, not1( ptr_fun( p ) ) ); } template <class t> bool is_not_3( t val ) { return val != 3; } void foo( ) { vector<int> v; v.push_back( 1 ); v.push_back( 2 ); v.push_back( 3 ); copy_if( v.begin( ), v.end( ), ostream_iterator<int>( cout, " " ), is_not_3<int> ); } and error saying : error: call of overloaded 'copy_if(std::vector::iterator, std::vector::iterator, std::ostream_iterator, )' ambiguous rewrite statement copy_if( v.begin( ), v.end( ), ostream_iterator<int>( cout, " " ), //...); like ::copy_if( v.begin( ), v.end( ), ostream_iterator<int>( cout, " " ), //...); ^^^ otherwise function conflicts standard

iOS Continuous Integration with Jenkins, Hockey, and increase version -

currently, using jenkins, fastlane , hockey uitesting , deliver application end users. have set in jenkins automatically upload ipa file hockey. i need upload hockey daily , can run script that. how can increase version every time when upload hockey? also, safe, don't want store version number in local file or something. instead, want retrieve version number hockey , increase based on number. there anyway implement one? you can use fastlane's increment_build_number action this.

python - Flask_Scss not compiling scss file in simple app -

i'm trying use flask-scss compile scss file in flask app. here app: from flask import flask, jsonify, render_template, request flask_scss import scss app = flask(__name__) app.debug = true scss(app, static_dir='static', asset_dir='assets/scss/') @app.route('/') def index(): return render_template('index.html') if __name__ == '__main__': app.run(debug=true) this file in directory contains static directory , assets directory. furthermore, assets contains scss directory, holds file test.scss . when run app, don't see css files getting created inside of static . can please tell me i'm doing wrong?

javascript - How do I import the D3 library into my project file structure? -

i trying not rely on basic code follows in file: <script src="//d3js.org/d3.v3.min.js"></script> i trying include d3 library in file structure. have created "libs" file in project. here link page download d3 library: https://github.com/d3/d3 question after downloading necessary files github, create d3 folder in libs folder , place files there? if so, reference specific file or folder? there few different ways of importing other people's code. could, suggested, download latest release , copy d3.js or d3.min.js lib/ directory, import so: <script src="lib/d3.min.js"></script> alternatively, if you're using package manager npm or bower , install using that, recommended in readme. there's resource showing how use bundler rollup package d3 of other libraries.

C++: Can function pointers be traced back to the original function before compilation without looking at the function name? -

i want set server on students can upload , run code course. however, don't want them access various functions, system(), allow bad access server. can search pre-processor output explicit function call, if user makes function pointer this: int (*syst)(const char*) = system; syst("rm *"); i'm still open threat. however, can't search string "system", example, since it's otherwise valid name - if student didn't include cstdlib, use name variable name. since beginning programming course, having blacklist of variable names ten miles long bad idea. is there way define functions other name , allow me search other designation before compiling code? by far easiest solution compile code - that's pretty harmless - , @ actual library imports. users may have defined own system , wouldn't cause system imported glibc . showing imported symbols the main reason can't @ raw source code because #define allows malicious users

Ruby on Rails:Remove some elements in Strong parameters -

Image
examples: have 4 check boxes boolean values correspond 4 texts : a,b,c,d. i need push texts checked ( = true ). but in default,strong parameters values our form save database, need push 1 of them , not all. need remove text isn't checked in strong parameters . how can ?? know after strong parameters permitted , can not change inside it. strong parameters in controller: params.require(:question).permit(:id, :job_id, :content,answers_attributes: [ :id, :content,:result ]) (answers nested atribute)

Service Fabric Azure test environment -

we have number of service fabric clusters provisioned in azure, dev , testing. find way 'pause' these on night save paying them when they're not being used. this seems azure dev labs for, far can see don't support service fabric clusters. i'm thinking of writing script tear these environments down @ night , rebuild them in morning, before doing i'm wondering if there better ways. service fabric clusters cannot safely "paused". if shut down vms, there chance cluster's state - applications , data - lost. if don't mind starting fresh set of clusters every morning, it's pretty straightforward automate. can define environments using arm templates , write short script provision, create script delete resource groups @ end of day, remove vms , associated resources.

matrix - How to resolve integer overflow in r? -

i have created matrix (mata) of 1000 rows , 1000 columns, , want calculate powers of matrix. works calculating 3rd power of matrix. when ask calculate 4th power, gives warning message saying, "in mata * mata * mata * mata : nas produced integer overflow" how can resolve problem? since didn't give example: set.seed(101) z <- matrix(rnorm(1e6),1e3) z2 <- round(z)*1000000 storage.mode(z2) <- "integer" if want matrix power (as in z2 %*% z2 %*% z2 %*% z2 ), it's best use matrix or expm package. library(expm) z4c <- z2 %^% 4 on other hand, if want elementwise product z4d <- z2*z2*z2*z2 ## warning message "nas produced" all need convert numeric. storage.mode(z2) <- "numeric" z4e <- z2*z2*z2*z2 ## fine