Posts

Showing posts from March, 2014

Swift UICollectionView at starting -

in swift trying view like that . when user tap on + button image add view , view height increase dynamically , if user tap on image delete view , other elements rearrange position. try uicollectionview. in initial position there plus button , tapping on image pick image gallery. can 1 please suggest me how can it?

java - String.replaceAll does not apply to any kind of characters -

this question has answer here: string.replaceall() not working 6 answers so i've got simple method should remove characters except upper , lowercase letters , numbers string. public static string tosimple(string arg) //redurziert einen string auf buchstaben und ganze zahlen { string string = arg; int = 0; while ( < string.length()) { if (((int)string.charat(i) >= 48 && (int)string.charat(i) <= 57)||((int)string.charat(i) >= 65 && (int)string.charat(i) <= 90)||((int)string.charat(i) >= 97 && (int)string.charat(i) <= 121)) i+=1; else { int = string.length(); string = string.replaceall(""+string.charat(i), ""); if (!(string.length() < a)) //just in case { i+=1; }

xcode - NSImages to PDFs and merge them in Swift -

i have array nsimages in it. want convert nsimage pdf. so, can show me how in swift. if possible, guys show me how merge pdfs 1 , output well? thank much. here rough steps create pdf document images, should started. use pdfkit (import quartz) framework. // create empty pdf document let pdfdocument = pdfdocument() // load or create nsimage let image = nsimage(....) // create pdf page instance image let pdfpage = pdfpage(image: image!) // insert pdf page document pdfdocument.insert(pdfpage!, at: 0) // raw data of pdf document let data = pdfdocument.datarepresentation() // url save data let url = url(fileurlwithpath: "/path/to/your/pdf") // save data url try! data!.write(to: url) you may need tinker page's bounds , image size's exact pdf page sizes need. you can use other pdfdocument / pdfpage api insert, remove , reorder pages.

issues about json format returned by spring restful? -

class entitydataset { public list<entityrow> getdata() { return rowlist; } class entityrow { private map<string, object> rowdata; public map<string, object> getrowdata() { return rowdata; } } i wrote method in restful controller below. @requestmapping(value = "/entitydata", method = requestmethod.post, headers = "accept=application/json") public entitydataset getentitydata(@requestbody queryobject query) throws exception{ return entitymanager.generateentitydatabyname(query); } the returned json looked below. { "data": [ { "rowdata": { "fiscal_year_end": null, "home_country": null } }, { "rowdata": { "fiscal_year_end": null, "home_country": "10" } }, .......

angularjs - How can I set data to field with CKEditor in Protractor test? -

my issue got message, "element not visible" in protractor when tried set data field ckeditor. application working angularjs. element(by.model("question.translations[lang.locale].answer")).sendkeys("test answer e2e!!!"); how can set (or get) data field ckeditor in protractor test? html code: <div ng-repeat="lang in languages"> <div class="col-md-4"> <div class="input-icon right"> <div ckeditor="ckoptions" ng-model="question.translations[lang.locale].answer"></div> </div> </div> </div> when try this var value = 'hello'; browser.executescript(function (arguments) { window.ckeditor.instances.html_editor.setdata(arguments[0]); }, value); i error: failed: unknown error: cannot read property 'setdata' of undefined i found solution browser.switchto().frame(element(by.c

sql server - How do i assign 2 values from different tables into 1 variable name as foreign key using Entity Framework-Code First -

i'm confused foreign key concept. i'm trying arrange key relationships in each database class according code first concept in entity framework. i have 3 tables: a, b , c. table has aid primary key(pk), table b has bid pk, table c has cid primary key. relationship between table is: a-b : many-to-one, a-c : one-to-one, b-c : one-to-many table has variable refid can hold both bid or cid values. <foreignkey("bid")> public property refid b <foreignkey("cid")> public property refid c refid highlighted red saying the properties cannot overload each other because differ return types. what doing wrong? edited public class public property aid string // primary key public property refid string <foreignkey("refid")> public property b b <foreignkey("refid")> public property c c end class public class b public property bid string // primary key //

centos - Tomcat 8.5.6 is giving "403 Access Denied" Error in cent OS 7 -

i getting problem given $subject when trying access through external browser. have changed context.html in ../manager/meta-info/context.html. content looks follows. <context antiresourcelocking="false" privileged="true" > <valve classname="org.apache.catalina.valves.remoteaddrvalve" allow="^.*s" /> </context> in addition, have allowed port 8080 tcp in firewall. possible solution? thanks in adavance

php - is_dir () function is case sensitive -

below code <?php $folder_type=$_post['folder_type']; $folder_name=$_post['folder_name']; $images="images"; $path="../../".$folder_type."/".$folder_name; if (!is_dir("../../".$folder_type."/".$folder_name)) { mkdir("../../".$folder_type."/".$folder_name); mkdir("../../".$folder_type."/".$folder_name."/".$images); $content = file_get_contents('../../default_code.php'); $fp = fopen($path . "/$folder_name.php","wb"); fwrite($fp,$content); fclose($fp); } else { echo "0"; } chmod("../../".$folder_type."/".$folder_name, 0777); ?> if directory having foldername name alto , if tried new folder name alto won't accept right bt is_dir() function not checking casesensitive. if tried alto won't accept. there other way checking whether new foldername present in directory or n

angular2 routing - Angular 2: Uncaught TypeError: Cannot read property 'id' of undefined -

i have read this topic , reviewed lot of others can't find solution. i'm trying bundle angular 2 application , getting error, suppose problem appears here @component({ selector: 'affiliate', moduleid: module.id, styleurls: ['affiliate.css'], templateurl: './affiliate-index.html' }) here tsconfig.json { "compileroptions": { "target": "es5", "module": "commonjs", "moduleresolution": "node", "sourcemap": true, "emitdecoratormetadata": true, "experimentaldecorators": false, "removecomments": false, "noimplicitany": false } } gulpfile var gulp = require('gulp'); var sourcemaps = require('gulp-sourcemaps'); var concat = require('gulp-concat'); var typescript = require('gulp-typescript'); var systemjsbuilder = require('systemjs-builder');

c# - Telerik RadListView and drag&drop(for Windows Phone 8.1) -

i use telerik windows universal(windows phone 8.1). need drag&drop radlistview radlistview. read official documentation , have not found answer.there itemdragstartingcontext, dragaction, there no complete example drag&drop, reorder example. possible? if yes - need example drag&drop between radlistview. i received answer on official forums: radlistview not supported drag&drop, reorder. use standard listview - work drag&drop , reorder.

perl - Finding longest match between 2 files from pattern -

i having trouble implementing 2 files within program. trying to access contents of file $q , $s . print "input k value \n"; $k = <>; chomp $k; print "input t\n"; $t = <>; chomp $t; %qkmer = (); $i = 1; $query=' '; while ($line=<in>) { chomp($line); if ($line=~ m/^>/ ) { next; } $query=$query.$line; $line=~ s/(^|\n)[\n\s]*/$1/g; while (length($line) >= $k) { $line =~ m/(.{$k})/; if (! defined $qkmer{$1}) {#every key not deined first match $qkmer{$1} = $i; } $i++; $line = substr($line, 1, length($line) -1); } } open(mydata, '<', "data.txt"); while ($line=<mydata>) { \ chomp($line); %skmer = (); # initializes hash called skmer. $j = 1; if ($line=~ m/^>/ ) { #if line starts > next; #start on next line #separated characters } $line=~ s/^\s+|\s+$//g ; #remove spaces file while (length($line) >= $k) { $line =~ m/(.{

reactjs - HTML markup does not change when the UI changes in isomorphic react web app -

i using react creating sample page has server side rendering using rendertostring() seo friendly pages. this server.js code app.get('*', (req, res) => { match( { routes, location: req.url }, (err, redirectlocation, renderprops) => { // in case of error display error message if (err) { return res.status(500).send(err.message); } // generate react markup current route let markup; if (renderprops) { markup = rendertostring(<routercontext{...renderprops}/>); } else { res.status(404); } // render index template embedded react markup return res.render('index', { markup }); } ); }); my page search page static , when user enters input fetches data backend , renders list of components in same page. when see view page source in browser, can see initial static content, not html of list renders after backend response. what righ

vba - submit data from excel userform to password protected access database -

i trying submit userform data excel (2013) access database. without password, code works fine. private sub addoer_click() dim cnn adodb.connection dim rst adodb.recordset dim dbpath dbpath = sheet16.range("k18").value set cnn = new adodb.connection cnn.open "provider=microsoft.ace.oledb.12.0;data source=" & dbpath now trying use same method send data excel password protected database (each user has different password). in excel file, user id @ sheet16.range("k17") , password @ sheet16.range("k19") userid = sheet16.range("k17").value pw = sheet16.range("k19").value i changed cnn.open line following cnn.open "provider=microsoft.ace.oledb.12.0;" & _ "data source=" & dbpath, userid, pw, -1 and getting error: error -2147217843 (cannot start application.the workgroup information file missing or open exclusively user.) i changed cnn.open line this cnn.open "provider=micro

customErrors redirct page conflict with return url after session end in mvc5 -

in webconfig file have added this` <sessionstate mode="inproc" timeout="2" />` when session end have own authorizeattribute class , redirect login page while no session exist. when 404 redirect ~/invalid page working fine in development. after publish when session end redirect login page , url " http://localhost:8080/mss/invalid?aspxerrorpath=/mss/masterpanel/home " not right. here correct return url not invalid page url. need help

visual studio 2010 - python script to build multiple .msbuild files -

i new in python apologise rookie mistakes :) i need write python script sets environment visual studio, creates temporary workspace, checks out latest version tfs , runs multiple .msbuild files under single directory , saves output log file. i came script not working: import subprocess command = "cmd.exe /c dir c:\\" all_logs = [] def run_cmd(command): """run command , print output""" print 'running: "%s"' % command print 'working dir: %s' % os.getcwd() print 'env params: %s' % os.environ p = subprocess.popen(command, shell=true, stdin=subprocess.pipe, stdout=subprocess.pipe, stderr=subprocess.stdout) out, err = p.communicate() print 'output: %s' % out print 'error: %s' % err all_logs.append(out) def set_env_params(): os.environ['path'] = os.environ['path'] + r';c:\program files (x86)\microsoft visual studio 10.0\vc' def

javascript - SAPUI5: Compiling Declarative HTML is not working -

i saw code sinppet in sap documantion: https://help.sap.com/saphelp_nw74/helpdata/en/91/f1454b6f4d1014b6dd926db0e91070/content.htm i tried use in simple example below. what error message in console: uncaught typeerror: sap.ui.core.plugin.declarativesupport.compile not function how solve it? <!doctype html> <html> <title>declarative programming sapui5 - sample01</title> <script id='sap-ui-bootstrap' type='text/javascript' src='https://sapui5.hana.ondemand.com/resources/sap-ui-core.js' data-sap-ui-libs="sap.ui.commons" data-sap-ui-modules='sap.ui.core.plugin.declarativesupport' > </script> <script> function addbutton(){ console.log('addbutton'); $("body").append('<div id="button"><div data-sap-ui-type="sap.ui.commons.button" data-text="this button added dynamically"></div></div>&

Counting element symbols in Python -

i'm biologist , i'm quite new in programming, nowadays i'm trying improve; background not informatics. i`m quite stuck in problem. we've information molecules; each line begins atom represents 1 atom of entire molecule. example, first 2 lines: atom 1 n arg 1 0.609 18.920 11.647 1.00 18.79 n atom 2 ca arg 1 0.149 17.722 10.984 1.00 13.68 c we supposed count number of distinct atoms; better said, last item of every line ( c or n in e.g.) we have function drives , extract last item, i'm quite stuck @ point, because should write code if don't know atoms find (though know, because have entire list, , have n , c , o , s ) code have: def count_atom(molecule): number_atoms = dict() lines = molecule.split(os.linesep) line in lines: if line.startswith('atom'): atom = line[77].strip() print atom return number_atoms results= count_atoms(mole

linux - C++ dlsym Pointer Function Problems -

i calling function shared object (a.so) inside shared object jni interface (b.so). loaded a.so using dlopen , mapped function using dlsym . here part of code: int (*ptestcall)(char* szmsgout); //open shared object , create handler handle = dlopen (filename, rtld_lazy | rtld_global); //map adrress of function inside shared object function pointer *(void **) (&ptestcall) = dlsym(handle, "_zn7ipslink9testcallelllpc"); int ret = ptestcall(szmsgout); in log of a.so can see testcall called , finished it's job when tries write output szmsgout buffer crashes. if remove output writing buffer go ok without problem. can explain problem or why crashes? here example: jniexport jint jnicall java_linux_wrapperlinux_payment(jnienv *env, jobject obj, jchararray jmsgout){ int retval = false; char clog[1024] = ""; //get len of passed buffer int len = env->getarraylength(jmsgout); char *szmsgout; szmsgout = (char*) malloc (len); memset(szmsgout, 0

express - Angular2, ExpressJS, PassportJS Not able to maintain sessions -

Image
i using angular2, express , passport application. i've created api in express , i'm able login through postman chrom extension. i'm able login angular2 application well. in postman express maintaining sessions. in angular2 express not maintaining sessions. below 1 respons in angular2 app: and response in postman application: i'm attaching code here well: this code in angular2 service private _options = new requestoptions({ headers: new headers({ 'content-type': 'application/json' })}); constructor(private _http: http){ } login(credentials: object){ return this._http.post('http://localhost:1234/api/login', json.stringify(credentials), this._options); } i've configured express cors requests well. though i'm unable maintain sessions in expressjs. app.use(bodyparser.json()); //cors in express app.use(function(req, res, next) { res.header('access-control-allow-credentials', true); r

How to enable or disable any button in angular 2 based on mandatory and optional field -

i want save button enabled when placeholder value 'optional'.when value 'mandatory' save button should disabled , enabled if enter value field. my template- <md-input name="" [placeholder]="isoptional()"></md-input> <input type="button" disabled="placeholder==='mandatory'" value="save"> in typescript file- isoptional(){ if (cond1|| cond2){ return 'mandatory'; } else if (cond3||cond4){ return 'optional'; } i trying above in template not getting proper output.any idea going wrong? try following: <md-input name="" #input [placeholder]="isoptional()"></md-input> <input type="button" disabled="input.placeholder === 'mandatory'" value="save">

android - How can I convert .vp file into .xml or .apk file? -

i'm using justinmind , .vp file.i able convert in .html file how can convert in .xml or .apk?i have tried convert .html .xml using .tidy doesn't give me proper layout in androidstudio. i don't know sdk, quick search, found post on there forum : https://www.justinmind.com/community/topic/can-justmind-export-the-prototype-directly-to-the-android-studio-project for long term save, here 2 post : question : can use software simple designing , prototyping. reduce app build time if there way export files android studio project. possible? answer hi there, unfortunately not possible. however, can utilize generated css , javascript, may reduce app build time. best, danielle so need use generetad html/javascript/css files webview. no, can't create project, html files.

c# - How to exclude multiple properties in FluentAssertions ShouldBeEquivalentTo() -

using fluentassertions: i'm able exclude single property using shouldbeequivalentto. x.shouldbeequivalentto(y, opts => opts.excluding(si => !si.propertyinfo.canwrite)); but, how exclude more 1 property when using shouldbeequivalentto() ? you 'll have use function instead of expression. x.shouldbeequivalentto(y, excludeproperties); private equivalencyassertionoptions<xx> excludeproperties(equivalencyassertionoptions<xx> options) { options.excluding(t => t.ceoperator); options.excluding(t => t.ceoperatorname); options.excluding(t => t.status); options.excluding(t => t.isoperational); return options; }

Performing DNS "ANY" Lookup using Java JNDI -

i using java jndi perform dns lookups using following basic syntax per sscce below, trying query records using "any" attribute: import java.util.*; import javax.naming.*; import javax.naming.directory.*; public class sscce { public static void main(string[] args) { try { properties p = new properties(); p.put(context.initial_context_factory, "com.sun.jndi.dns.dnscontextfactory"); initialdircontext idc = new initialdircontext(p); attributes attrs = idc.getattributes("netnix.org", new string[] { "* *" }); attribute attr = attrs.get("* *"); if (attr != null) { (int = 0; < attr.size(); i++) { system.out.println("found " + (string)attr.get(i)); } } else { system.out.println("found nothing"); } } catch (exception e) { e.printstacktrace(); } } } my question around being able query resource type of

jersey 2.0 - How to get the actual values from OutboundJaxrsResponse in java? -

in restclient returns below response jersey service. outboundjaxrsresponse{status=200, reason=ok, hasentity=true, closed=false, buffered=false} the above 1 returns list. how can list , how validate each record id? if id not available in database need store missing id. how handle this? below code; public response list() throws exception { response response = null; restclient client = service.getclient(); try { response = client.invokeservicegetforarray(servicetype, "/test/name", null, null); jsonarray responselst = (jsonarray) response.readentity(jsonarraybuilder.class); system.out.println("response array list :: " + responselst); } catch (exception e) { return response.status(status.internal_server_error).entity(e.getlocalizedmessage()).build(); } return response; } above code snippet returns below response : outboundjaxrsresponse{status=200, reason=ok, hasentity=true, closed=false, buffered=false} try

c# - Passing a string gives a different ourcome to passing a string variable -

i tried finding answer . i have function supposed create formatted paragraph. when pass html string "<b>test</b>" bold text in pdf expected. however when pass string variable same value don't formatted text instead original string in pdf. private paragraph createsimplehtmlparagraph(string text) { //our return object paragraph p = new paragraph(); //parsetolist requires streamreader instead of text using (stringreader sr = new stringreader(text)) { //parse , collection of elements list<ielement> elements = itextsharp.text.html.simpleparser.htmlworker.parsetolist(sr, null); foreach (ielement e in elements) { //add elements paragraph p.add(e); } } //return paragraph return p; } thanks guys. checked variable @ runtime , in html format (eg: &lt instead of < ). had use h

javascript - CSS Page breaking content with top margin -

i need print invoice unknown number of items, , @ end of invoice there terms , conditions - unknown number of lines. so have similar this: <body> <div class="page"> <div class="margintop"></div> <div class="invoicecontent"></div> </div> <div class="page"> <div class="margintop"></div> <div class="invoicecontent"></div> </div> <div class="page"> <div class="margintop"></div> <div class="invoicecontent"></div> <div class="termsandconditions"></div> </div> </body> so page has background image, contains identity of company, , @ top there logo. in div of margintop skipping number of lines there nothing printed their. so in invoice content have in right place. now terms , conditions comes variable holds text

fortran - Passing a subarray of allocatable array to a subroutine, with right bounds -

in parallel program i'm writing, defined lot of multidimensional allocatable arrays (actually 1d, 2d or 3d) allocated negative lower bounds during execution. reason why did each process handles, in 2d example, 14 14 a matrix , shares overlap of 2 layers four neighboring processes, matrix allocated bounds (-1:12,-1:12) , "internal" part of matrix corresponds indices 1 10 . (italic represent choice/input dependency). the problem in doing didn't realize have been impossible rely on this fortran2003 feature , making impossible call mysub(a(:,i),...) in caller unit , refer dummy counterpart of a in subroutine using actual bounds ( -1 , 12 ), since a(:,i) expression, , not variable. the problem solved if pass whole array a subroutine, explained in previous linked answer , force me write "bigger" , less universal subroutine, which, on contrary, meant act on one-dimensional subarrays. is possible pass subarray of allocatable array (e.g. a(:,1)

linux - How we can change OS for Google App Engine flexible? Or can we do this at all? -

the 1 ends is: linux gae-default-1-c9cf 3.16.0-4-amd64 #1 smp debian 3.16.36-1+deb8u2 (2016-10-19) x86_64 but need version glibc 2.14. the current's 1 glibc 2.13: ldd (debian eglibc 2.13-38+deb7u11) 2.13 and can't upgrade glibc on os, because after apt-get update , apt-get install libc6 getting this: reading package lists... done building dependency tree reading state information... done libc6 newest version. 0 upgraded, 0 newly installed, 0 remove , 5 not upgraded. and can't modify sources.list because of: -bash: /etc/apt/sources.list: permission denied so need os gae flexible app. possible? yes, can build custom dockerfile either referring 1 fits requirements or specifying scratch: building custom runtimes

SPARK - How to force error on sc.parallelize -

question: this statement gives right result, no matter how paralleziation provided. why give correct result? reading big file or mappartitions approach result in minor loss of accuracy, why not here? must simple, cannot see it. val rdd = sc.parallelize(array("a", "b", "c", "d", "e", "f"),5) rdd.sliding(2).collect() reading big file or mappartitions approach result in minor loss of accuracy, it won't. result exact independent of source.

xpath - Accommodating to changes in target of transfer properties file in soapUI -

i have script evaluation scenario namespaces of request wsdl different in namespace 1 another, due testing(by importing test suite) request using property transfer in soapui becoming difficult because have change property transfer's target namespace each time because of change in namespace.my requirement create test suite can work scenarios.please suggest method. soapui version-5.2.1 soapui accept * wildcard namespaces. if you've like: declare namespace ns='http://www.openuri.org/'; //ns:root/ns:somenode you can safety simplify xpath like: //*:root/*:somenode or event shorter (if there same node names in different hierarchy): //*:somenode since there no sample of user case give general approach problem.

lotus notes - LS2J: get session from LS agent into java class -

i have java class should transfer data current database server. access current database, seems java needs working session object: public class edgeserverconnection { public edgeserverconnection(session session) { try { // how session here? database db = session.getcurrentdatabase(); ... } catch(exception e) { } } } the class should called lotusscript agent, somehow this: set session = new notessession set jsession = new javasession set connectionclass = jsession.getclass("edgeserverconnection") set connectionobject = connectionclass.createobject("(l/lotus/notes/session;v)", session) but throws error ls2j: java constructor failed execute if remove session parameter both constructor , createobject call, error goes away. how can agent session java class? you can't work domino objects in java class called ls2j nor can pass domino objects parameter. do work notes dom

Can I use php/mysql database to send remote notifications as opposed to Firebase? (iOS) -

here situation... i have table of deals in database businesses. if user subscribed see deals business, want remote notification sent them when business lists new deal. in simplest form, want user new notification (push notification @ top of phone) "new deal available business subscribed to!". i have of app connected database through php/mysql. unfortunate have migrate firebase seeing how not know @ integrate notifications. i not best end programmer in mind wondering if there way maybe have php script running 24/7 monitor changes in database (for example, every 10 minutes check see if there new deals user has not seen yet). , if there send request apn server... i not sure how approach this. advice?

android - Netty websocket close gracefully -

i need make websocket close gracefully. firstly send messages waiting in buffer close. channel.flush(); channel.close(); seems not right, because dont have completion handler flush method close after done. is there way this. netty used: 4.1.0.beta3 the trick can use writeandflush empty buffer, attach listener call. unpooled.empty_buffer can make pretty easy. channel.writeandflush(unpooled.empty_buffer).addlistener(... channel.close(); )}; if want close channel after flush can use channelfuturelistener.close simplify code. channel.writeandflush(unpooled.empty_buffer).addlistener(channelfuturelistener.close); if enough, may want write static helper method like netty examples do .

macros - checking if a file already exist using VBA powerpoint -

i want check if filename exist. wrote works when test in local desktop. filenames saved in sharepoint. when tested there, doesn't work! error message: bad file name or number. wrote: private sub commandbutton21_click() dim newfilename string dim ownpathname string oldweekday = weekday(now) select case oldweekday case 1 newfilename = "pt pm weekly " & format(date + 4, "yyyymmdd") case 2 newfilename = "pt pm weekly " & format(date + 3, "yyyymmdd") case 3 newfilename = "pt pm weekly " & format(date + 2, "yyyymmdd") case 4 newfilename = "pt pm weekly " & format(date + 1, "yyyymmdd") case 5 newfilename = "pt pm weekly " & format(date, "yyyymmdd") case 6 newfilename = "pt pm weekly " & format(date + 6, "yyyymmdd") case 7 newfilename = "pt pm weekly " & format(date + 5, &

javascript - Display specific DIV on html page while page is still displaying the content -

i have 4 div sections. 1. first div section has 5000 tables.each table has quick link 1 of below mentioned tables in 2nd or 3rd or 4th div. 2. 2d,3rd , 4th div section contains single table info. my question is: have 1 button called expand all, when click on this, have expand div sections. since fist div taking more time load due huge data. wrote time display it. var time_block=100; timercount = 0; $( ".displaynone" ).each(function( ) { var show_me=this; var show_me_time=time_block; timervar = settimeout(function({ display_parts(show_me,show_me_time); },time_block); time_block=time_block+200; timercount++; console.log('timeout='+timervar); }); function display_parts(x,y){ $(x).css('display','block'); } now, problem is, when first div section starts loading, user can click on quick link jump 2nd div timer still loading contents. but, scroll bar moves first div section , viewport

Is php's 'include' a function or a statement? -

there plenty of examples of both on web. php manual says "the include() statement [...]", seems contradictory - if it's statement shouldn't not have parenthesis? both of these work: include('somefile.php'); include 'somefile.php; so should or else care? quoting manual (my emphasis) because include() special language construct , parentheses not needed around argument. these called "special forms", , include such things echo , return statements. note while none of these functions, can still speak of expressions , statements, difference being former have value while latter don't. since include , include_once , require , require_once return value ( true if include successful), can used in expressions. reasoning, "include statement" incorrect, though include s used statements.

xml - java.lang.NoClassDefFoundError: org/apache/tiles/el/ELAttributeEvaluator -

error occur @ time of start server severe: exception sending context initialized event listener instance of class org.apache.struts2.tiles.strutstileslistener java.lang.noclassdeffounderror: org/apache/tiles/el/elattributeevaluator @ org.apache.struts2.tiles.strutstilescontainerfactory.createelevaluator(strutstilescontainerfactory.java:247) @ org.apache.struts2.tiles.strutstilescontainerfactory.createattributeevaluatorfactory(strutstilescontainerfactory.java:198) @ org.apache.tiles.factory.basictilescontainerfactory.createcontainer(basictilescontainerfactory.java:106) @ org.apache.tiles.startup.abstracttilesinitializer.createcontainer(abstracttilesinitializer.java:124) @ org.apache.tiles.startup.abstracttilesinitializer.initialize(abstracttilesinitializer.java:70) @ org.apache.tiles.web.startup.abstracttileslistener.contextinitialized(abstracttileslistener.java:62) @ org.apache.catalina.core.standardcontext.listeners

reactjs - Add SASS to ejected create-react-app config -

i want add .scss support in app, created using create-react-app. i did eject npm run eject , installed necessary dependencies: npm install sass-loader node-sass --save-dev inside config/webpack.config.dev.js added loaders snippet: { test: /\.scss$/, include: paths.appsrc, loaders: ["style", "css", "scss"] }, so beginning of loaders array so: loaders: [ // process js babel. { test: /\.(js|jsx)$/, include: paths.appsrc, loader: 'babel', query: require('./babel.dev') }, // "postcss" loader applies autoprefixer our css. // "css" loader resolves paths in css , adds assets dependencies. // "style" loader turns css js modules inject <style> tags. // in production, use plugin extract css file, // in development "style" loader enables hot editing of css. { test: /\.css$/, loader

fxml - I want to align my lables to the right side -

those labels nees aligned right side scene builder not "snap" right side:( javafx scene builder 2.0 build information version: 2.0-b20, changeset: 5cac093e5c1f date: 2014-03-21 09:29

c# google maps api - javascript errors on the html part -

i newly want use googlemap api display markers on map in simple c# windows form visual studio. i use "web browser" component display generated html file basic html code google plus customized coordinate. const string htmlpath = "d:/map.html"; streamwriter sw = new streamwriter(htmlpath, false, system.text.encoding.getencoding(437)); string centerlongitude = centerlongitudetextbox.text; string centerlatitude = centerlatitudetextbox.text; sw.writeline("<!doctype html>"); sw.writeline("<html>"); sw.writeline("<head>"); sw.writeline("<meta charset=\"utf-8\">"); sw.writeline("<style>"); sw.writeline("html, body, #map{"); sw.writeline("margin :0;"); sw.writeline("padding: 0;"); sw.writeline("height: 100%"); sw.writeline

jvm - Please explain Hotspot optimization refactor from Preconditions.java in guava code base? -

i going through guava code base , in preconditions source there explanation quoted below: all recent hotspots (as of 2009) really have natural code if (guardexpression) { throw new badexception(messageexpression); } refactored messageexpression moved separate string-returning method. if (guardexpression) { throw new badexception(badmsg(...)); } the alternative natural refactorings void or exception-returning methods slower. big deal - we're talking factors of 2-8 in microbenchmarks, not 10-20%. (this hotspot optimizer bug, should fixed, that's separate, big project). the coding pattern above heavily used in java.util, e.g. in arraylist. there rangecheckmicrobenchmark in jdk used test this. but methods in class want throw different exceptions, depending on args, appears pattern not directly applicable. can use ridiculous, devio

c++ - Class members memory allocation -

my question theoretical. suppose have class class a{ private: int * a; int b; private: a(){ = new int[100]; b = 100; } ~a(){ delete [] a; } } as far know if create object of type dynamically ( a * = new a() ) memory object allocate in heap , if use ( a a ) created on stack (a a) . in case when object created on stack memory variable a allocated on heap , in case when allocated object on heap memory object b allocated on stack. first question me sure: right? and second question more efficient store members of class in heap memory or stack memory eg? class a{ private: int * a; int * b; private: a(){ = new int[100]; b = new int(100); } ~a(){ delete [] a; delete b; } } when said efficient mean data class member storing near each other in memory in heap or stack (actually i'm not sure correct storing near each other). first

Mysql (InnoDB) config settings for better performance? -

recently updated vps 1gb 4gb memory. i'd hoped queries (mysql/innodb) running faster more memory, unfortunately that's not case. mysql automatically takes more memory when server has more memory or have change settings in my.cnf? , if so, changes should make? mysql not automatically take benefit of more memory installed. in case (given using innodb ) can @ least these improve performance of mysql: increase innodb_buffer_pool_size (default value option 128mb ). defines how memory dedicated mysql innodb cache data tables , idexes. means if can allocate more memory mysql cache more of data resulting in faster queries (because mysql in memory instead of doing i/o operations data lookup). of course should allocate reasonable amount of memory (not whole 4g :)) may not more 2g . should try , test on server more accurate result. (read more info, before change option https://dev.mysql.com/doc/refman/5.7/en/innodb-buffer-pool-resize.html ) increase innodb_buffer_pool

jquery - How to render patial through replaceWith() -

i have looked @ similar question , answers didn't work , may dated. think there used thing called rjs but, trying remove 1 partial , replace another. $("#me") .replacewith( '<%= escape_javascript render(partial: "photospread") %>') what happens sent browser text , displays <%= escape_javascript render(partial: "photospread") %> replace <% <%= $("#me").replacewith('<%= escape_javascript render("photospread") %>') <% evaluate ruby code inside it whereas <%= evaluate , print code inside <%= %>

java - jooq cannot convert from class a to class b -

i have problem, think can easly solved, can't it. i have class , b , class stored in postgres db: public class a() { private b b; ... } public class b() { private string firstname; private string lastname; private string personid; private string username; } in database, object of class b stored string username in entity. have object of class db in app, have read record , create object of class b. want create query jooq, jooq not know how convert string username instance of class b. how tell jooq how should map database object object of class a. a class equivalent person , b class equivalent executor. my query return jooq.select() .from(person) .where(person.id.eq(id)) .fetchoneinto(person.class); this exception thrown query caused by: org.jooq.exception.datatypeexception: cannot convert superadmin (class java.lang.string) class fi.ssm.oksa.domain.person.executor @ org.jooq.tools.convert$convertall.fail(convert.java:1118) ~[jo

logging - Limitations of GO lang log package -

i implementing logger in go. thinking of using logrus this. wanted understand limitations of built in log package. i know if want write logs file or implement rolling file logs etc need add feature manually. there other limitations have choose external log package? logging file using builtin log package not issue, can use log.setoutput() or logger.setoutput() set destination io.writer other default os.stderr , example file *os.file . what's missing , whished leveled logging (e.g. info , warn , debug , error etc.). reasoning, read blog post dave cheney: let's talk logging . you can't enforce specific log.logger used designated packages unless packages "willing" cooperate (e.g. provide setlogger() function). rolling log files missing feature. on other hand, it's easy "extend" standard logger log mongodb example, details see go: create io.writer inteface logging mongodb database . using mongodb can use capped collection im

Sed Remove 3 last digits from string -

27211;18:05:03479;20161025;0;0;0;0;10991;0;10991;000;0;0;000;1000000;0;0;000;0;0;0;82 second string after ; time. gg:mm:sssss: . want gg:mm:ss: like so: 27211;18:05:03;20161025;0;0;0;0;10991;0;10991;000;0;0;000;1000000;0;0;000;0;0;0;82 i tried cut deletes after n'th occurance of character, , stuck, please help. give 1 liner try: awk -f';' -v ofs=";" 'sub(/...$/,"",$2)+1' file it removes last 3 chars column 2. update sed 1 liner if fan of sed: sed -r 's/(;[^;]*)...;/\1;/' file

vba - Why is Rows(i).EntireRow.Delete deleting the cell instead of the row? -

instead of entire row being deleted, cell(i,8) gets deleted. code is, each cell until last row, if cell starts im, highlight it, , if corresponding cell less 4, delete row. thanks for = 1 lastrow if left(cells(i, 1), 2) = "im" cells(i, 1).interior.color = rgb(140, 220, 100) if cells(i, 8).value <= 4 rows(i).entirerow.delete end if end if next open immediate window. write these two: rows(5).entirerow.delete rows(5).delete see row 5 gets deleted. code wrong, running else.