Posts

Showing posts from 2015

html - How to open UIWebView from another UIWebView? -

Image
i have web view @ bottom of 1 of view controllers contains links. want when user clicks on 1 of links in web view opens web view takes screen with content of page user has clicked on. or maybe when user clicks on 1 of links in web view, user taken safari display content of link. know how this? cheers. above screen shot of web view links user can click on.. try this: -(bool)webview:(uiwebview *)webview shouldstartloadwithrequest:(nsurlrequest *)request navigationtype:(uiwebviewnavigationtype)navigationtype; { nsurl *requesturl =[ request url ]; if ( ( [ [ requesturl scheme ] isequaltostring: @"http" ] || [ [ requesturl scheme ] isequaltostring: @"https" ] || [ [ requesturl scheme ] isequaltostring: @"mailto" ]) && ( navigationtype == uiwebviewnavigationtypelinkclicked ) ) { return ![ [ uiapplication sharedapplication ] openurl: requesturl] ; } return yes; }

apache - Why should we keep index.php in the public folder instead of in the root? -

Image
i still don't quite understand why must keep index.php in public directory instead of in root directory. root/of/project public/ index.php .htacess (html, image, css, etc) then, write following in our virtual host file: documentroot /path/to/myapp/app/public <directory "/path/to/myapp/app/public"> # other setting here </directory> the .htaccess file redirects non-existing urls index.php: rewriteengine on rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^ index.php [qsa,l] i notice frameworks so, such symfony , zend, this tutorial. actual benefits having trouble of modifying virtual host file? why shouldn't have below instead without modifying virtual host file? security risk or something? root/of/project index.php .htacess public/ (html, image, css, etc) if keeping index.php , modifying virtual host file better, how can modify virtual host file i

java - Does Glassfish server consist of a webserver also? -

according defintions have read web server can serve http requests (e.g apache). a web container can serve servlets , jsps etc. since tomcat can both serve http requests , serve servlets , jsps considered both web server , web container. application servers jboss, glassfish fledged java ee servers include other containers apart web container. now in order application server glassfish work on own, needs web server(an http server) built it. therefore should contain webserver work on won, , if doesn't contain webserver built it, there should way plug existing web servers apache application server. what actual implementation? include webserver or should plug webservers these java ee application servers? yes, includes full web tier. java servlet spec covers of this.

java - My CSS stopped working -

i have problem css file haven't been able solve while. i'm relatively new in java web technologies , have no clue could've caused that. i'm trying write mvc based application servlets work controllers, jsp's views , database model. homecontroller supposed retrieve names of categories database , forward view (home.jsp). works fine, can display categories in view since i've implemented homecontroller css file have stopped working. ended working controller , awfull view. have no idea problem is. here's significant files: web.xml: <?xml version="1.0" encoding="utf-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="webapp_id" version="3.0"> <context-param> <param-name>databaseurl</param

JDBC SQL Server Exception: java.lang.NumberFormatException -

i using minecraft jdbc logging plugin (logblock), automatically parses inputs server name, login, password, , port valid jdbc command. have set server , user using microsoft sql server express 2014 , tested login using this method , told me succeded. can assume error in parsing of inputs. find way not have change source code of plugin, instead edit inputs trick plugin parsing correctly. here's code give plugin: mysql: host: bob\sqlexpress database: minecraft password: testest12/345 user: skrublord9000 port: 3306 bob computer name, sqlexpress server name. can't think it's backwards slash that's causing problem. here's output of jdbc plugin: [logblock] connecting skrublord9000@jdbc:mysql://bob\sqlexpr ess:3306/minecraft?useunicode=true&characterencoding=utf-8... [logblock] error while fetching connection: com.mysql.jdbc.exceptions.jdbc4.mysqlnontransientconnectionexception: cannot loa d connection cl

using HTML div and CSS -

so, html code <head lang="en"> <meta charset="utf-8"> <title>test</title> <link rel="stylesheet" href="style.css" type="text/css"> </head> <body> <div> <div class="header"> <input name="1" value="1" disabled /> </div> </div> and css-file: .header { background-color: yellow; color: green } the problem have, css code isn't changing html, made quick test , put css code in html file , worked. i know that, if use "id" insead of "class" works, task not change html file my problem don't want css code in html file, possible? edit: tried online worked, seems problem of webstorm since set in html file: <link rel="stylesheet" href="style.css" type="text/css"> your style.css file must in same folder html file. also, ;

android - BluetoothAdapter variable not being found? -

Image
hello working on android ble project , running problem can't check if bluetoothadapter variable null? why that. should straight forward? did forget import something?

java - How can i add classes to classpath with gradle? -

i had spring mvc project xml configurations base, , change java code ones. problem is, have applicationcontexttest there specifics configurations test. when run gradle test fail error: /home/karim/workspace/spring-project/src/test/java/org/my-com/my-project/services/phoneservicetest.java:13: error: package config not exist import config.applicationcontexttest; ^ /home/karim/workspace/spring-project/src/test/java/org/my-com/my-project/services/phoneservicetest.java: error: cannot find symbol @contextconfiguration(classes=applicationcontexttest.class) ^ i think understand error means, there no config package in classpath right? the applicationcontexttest class @ src/test/resources/config . how can fix this? the resources folder for... resources (images, properties files, etc.). source files go in src/test/java .

c# - Width of control based on width of window -

i'm trying figure out, how write responsive ui in xaml. i have 2 controls on window. minwidth of each control id 400. if width of windows >800, width of each control should 50%, if change widht of window <800, each control should have 100% of window. it's pretty simple set html/css, , right i'm trying in wpf without progress. can me that? i tried handle wrappanel, not work. wraps properly, not change width of control. i have 2 ideas doing this: using binding converter, , bind width/height of each item container width/height. creating custom panel, de desired layout. only few ideas, hope helps.

ios - Cannot invoke 'init' with argument of type 'NSNumber' (Swift) -

i trying use 'weights' array fill graph below fetch request. getting error "cannot invoke 'init' argument of type 'nsnumber' , have no idea why. 'weights' array should array of uint16. var weights : [int16] = [] func weightfetchrequest() -> nsfetchrequest { let appdelegate = uiapplication.sharedapplication().delegate appdelegate let managedcontext = appdelegate.managedobjectcontext! let fetchrequest = nsfetchrequest(entityname: "assessment") fetchrequest.sortdescriptors = [nssortdescriptor(key: "nsdateofassessment", ascending: true)] var error: nserror? let fetchedresults = managedcontext.executefetchrequest(fetchrequest, error: &error) [assessment]? if let assessments = fetchedresults { let weightss = assessments.map { assessment in assessment.weight } weights = weightss println(w

php - Symfony is changing where it's looking for assets depending on url -

Image
symfony looks looking assets in relative location based on url path navigate to. assets load , applied correctly when navigate "first-level" path such example.com/mpre , example.com/test , example.com/foo , of assets 404 when navigate "second-level" url such example.com/mpre/test , example.com/test/foo , example.com/foo/bar . why this? there way framework in 1 spot assets regardless of url? i have 2 urls example.com/mpre example.com/mpre/test my assets (css, js) load fine on first url, example.com/mpre , of them 404 when navigate second url, example.com/mpre/test when go inspector on each page see path assets, see following: example.com/bundles/app/css/023f7f6_style.css_4.css //example.com/mpre 200 ok response example.com/mpre/bundles/app/css/c8b625f_style.css_3.css //example.com/mpre/test 404 not found response in config.yml have following line assetic: assetic: write_to: %kernel.root_dir%/../web/bundles/app/ additional inf

What should a C# object initializer for a Dictionary<string, string[]> look like? -

i trying declare dictionary values string arrays. how can this? i tried following code (which not work): dictionary<string, string[]> newdic = new dictionary<string,string[]> { {"key_0", {"value_0.0", "value_0.1"}}, {"key_1", {"value_1.0", "value_1.1", "value_1.2"}}, } you need specify values arrays like: using implicitly typed array {"key_0", new[] {"value_0.0", "value_0.1"}}, or explicitly specifying type {"key_0", new string[] {"value_0.0", "value_0.1"}}, so class like: public static class newclass { private static dictionary<string, string[]> newdic = new dictionary<string, string[]> { {"key_0", new[] {"value_0.0", "value_0.1"}}, {"key_1", new string[] {"value_1.0", "value_1.1", "value_1.2"}}, };

r - Can I lag daily data by months with lag ( )? -

i have daily data on several years several currencies. lag variables in data set 1 month (i.e. june 15 july 15, not 30 days). na's fine not possible. i have gotten far writing this: ddply(data, .(currency), function(x){ #first column date, 2nd currency, rest data. y=x[,-(3)] #this data want lagged y$date=as.date(y$date) %m+% months(1) #this increases dates 1 month x$date=as.date(x$date) #what data dont want lagged x[, (1:3)] below z=merge(x[,(1:3)], y, by=c("date", "currency")) #merge date, #lagged stuff merges non-lagged stuff 1 month later original obs date return(z) }) i can include data if necessary, given have works dont want spend time on it. i want check cant use lubridate %m+% months(1) syntax within lag function. have tried lag function package "statar" uses along_by syntax haven't been able figure out. thanks!

c# - WCF Service - Message / Object size related -

Image
i have wcf service (s1) client , wcf service(s2) server. s1 consume s2 on net.tcp. s2 has 1 operation, return complex object of it's contents string. average size of object between 7-8 mb. recently had add more string contents actual object graph. cause s2 return following error the socket connection aborted. caused error processing message or receive timeout being exceeded remote host, or underlying network resource issue. local socket timeout '00:05:00'. system.net.sockets.socketexception (0x80004005): existing connection forcibly closed remote host @ system.net.sockets.socket.receive(byte[] buffer, int32 offset, int32 size, socketflags socketflags) @ system.servicemodel.channels.socketconnection.readcore(byte[] buffer, int32 offset, int32 size, timespan timeout, boolean closing) however, works expected when remove of string contents object graph. after doing bit of homework,i managed land on conclusion that, has size of returned obje

Best C++ macro for creating a new scope -

i have macro #define scope_guard(guard, name, ...) \ for(bool __once = true; __once; /* nothing */) \ for(guard name (__va_args__); __once; __once = false) using this: scope_guard(std::unique_lock, lock, (some_mutex)) do_some(); or scope_guard(std::unique_ptr<char>, buff, (new char[buffer_size])) { *buff.get() = 0; getsomedescription(buff.get(), buffer_size); log(buff.get); } are there similar(better) implementation of macro, optimized multiple compilers correctly. p.s. macro should one, without macro boost_scope_exit_end (can redefine if (...) ) . edit simple scoupe in using codestyle huge. { std::unique_lock lock (some_mutex); do_some(); } but want using this scope_guard(std::unique_lock, lock, (some_mutex)) do_some(); you can awful lot c++ templates , lambda expressions. might worthwhile explore using them. example, instead of using scope_guard macro, this: template <typename g, typename f, typename... a> inl

What is the equivalent of Python's list[:x] in C++? -

in python, if have list l , want first x elements of it, call l[:x]. in c++, use vectors instead, don't know of easy way invoke first x elements of vector. there several ways: 1) create vector v consisting of first x elements as: std::vector<t> v { begin(l), begin(l) + x }; 2) pass first x elements function, pair of iterators: f(begin(l), begin(l) + x); where f accepts 2 iterators arguments — explore standard algorithms <algorithm> , of them work on pair of iterators. depending on use case, use of them.

How to consume a Chunked HTTP Stream with Apache Camel? -

i have issue consuming chunked http rsvp stream using camel. the stream here , can find more information @ end of this page i have created simple route such: from("http4://stream.meetup.com/2/rsvps").log(org.apache.camel.logginglevel.info, "meetupelasticsearch.log", "json rsvp ${body}") but nothing happens no message consumed. tried adding camel timer before because not sure can use http4 component directly in from result same. can me please? you cannot use http4 component in from() directive. however, there several ways call url , retrieve result: one create timer , call http4 component to() this: from("quartz2://httppoll/mytimer?trigger.repeatcount=0") .to("http4://stream.meetup.com/2/rsvps") .log("body is: ${body}") .to(mockdestination); another way use content enricher pattern if want example aggegates results 1 stucture. note well, if url dynamic must use recipientlist()

java - Handling exception in Service layer -

could please advice how overcome problem described below: there application (it involves using hibernate , spring frameworks) 3 layers: dao, service , controller. want avoid saving duplicate entities in db. made using constraints @ db-level , in annotation in bean ( @table(name = "artist", uniqueconstraints = {@uniqueconstraint(columnnames = "artist_name")}) ). logic supposes if try add duplicate entity exception thrown. try process exception in service layer fails succeed. mean when explicitly notice exception thrown application can't proceed work because of exceptions. more clear cite code below: dao-layer @override public void saveentity(client client) { session session = sessionfactory.getcurrentsession(); session.save(client); } service-layer @transactional @override public boolean saveentity(artist entity) { boolean completedstate = false; try { //method dao-layer artistdao.saveentity(entity); } catch (cons

java - Library function to do bean comparison using Functions? -

since java 8 has made easier ever refer method directly (function/lambda), traditional reflection-based bean comparators (e.g. common-lang's equalsbuilder ) can implemented cleanly without reflection. wondering available in well-known library already? just clear, after function similar signature: static <t> boolean equals(t a, t b, function<t, ?>... proprefs); alternatively, non-confusion way of implementing using streams? given example class like class person { long id; string name, surname; int age; public long getid() { return id; } public string getname() { return name; } public string getsurname() { return surname; } public int getage() { return age; } } of course, can in compact form like @override public boolean equals(object obj) { if(obj==this) return true; if(!(obj instanceof person)) return false; person p=(person)obj; return stream.<functi

ios - Making a single copy of a singleton -

a design question: i have singleton (in objective-c doesn't matter) the singleton class (object) data structure many classes access, , single (hence - singleton) now want add ability undo - saving snapshot of state of object - can go it. what need break singleton-ness of object (need 1 copy of it). not allow me share conveniently between classes. ideas? "the singleton class (object) data structure many classes access, , single" i think easier make singleton object have collection of data structure. create copies of data structure instead of copies of singleton.

java - Difference between LinkedList of Object and a LinkedList of a HashMap? -

i coding java code , saw couldn't : linkedlist<hashmap<string,object>> errormanagement = new linkedlist<hashmap<string, object>>(); hashmap<string,object> = new hashmap<string,object>(); errormanagement.add(i.clone()); <-- impossible add hash map here where getting errors if wanted add hash map linked list ... and figured out doing in way: hashmap<string,object> tokeninfo = new hashmap<string,object>(); linkedlist<object> errormanagement = new linkedlist<object>(); errormanagement.add(tokeninfo.clone()); <-- working charm ! i hadn't more errors. may explain me why ? , what's difference ? p.s. : should ,before asks me, error thrown when adding linked list (for first example)! the problem return type of clone() : it's object , not hashmap<string,object> . that's why second snippet works, first 1 not. you can fix first code snippet constructing copy of hash map through co

java - Increase the height of the toolbar in an E4 application -

Image
i've e4 application toolbar needed custom colored button. i'm using toolcontrol , creating obutton . problem button gets chopped off, there way can increase height of toolbar?

io - fortran read repeated pattern -

i have file looking this: ( 1) 0.9988472 ( 5)-0.0455316 ( 9)-0.0152022 ( ( 2) 0.0000060 ( 3) 0.0000060 ( 6)-0.0000036 ( ( 4)-0.0000036 ( i need read integer numbers in brackets , floats vectors. know in advance how many instances read. if had file looking this 1 5 9 2 3 6 4 i following: read(unitin, fmt='(3(i3))') (dummyint(i), i=1,n) but cannot figure out how read in 3 instances of 2 arrays per line. help appreciated. ok, straight forward... read(10, iostat=st, fmt='(7(a, a, i5, a, f10.7))')& ((dummyc, dummyc, dummyi, dummyc, determinantprefactors(i)), i=1,numdets)

Stalk bar chart in controlled order in SAS -

i want create stlak bar charts, column workscope having hsb,ohs,res. want reorder workscope in order of ohs,hsb,res in stalk bar. default taking in alphabetical order. how can achieve it. goptions reset=all; goptions colors=(red blue green); legend1 label=none order=('ohs' 'hsb' 'res'); proc gchart data=finalrepv3; vbar year / discrete type=sum sumvar=value subgroup=workscope legend=legend1 ; run; you can create sorting variable beforehand, use sort input data , plot using proc sgplot xaxis discreteorder = data . /* create dummy sorting variable */ data want; set finalrepv3; if workscope = "ohs" _sort = 1; if workscope = "hbs" _sort = 2; if workscope = "res" _sort = 3; run; /* put data in required order */ proc sort data = want; _sort; run; /* create plot */ proc sgplot data = want; vbar year / group = workscope response = value stat = sum; /* request x axis respe

asp.net - How to Insert whole DataTable into Sql table At once in C# -

i have excel sheet (named $sheet1) , sql table(named users ) same formate given below id | username | firstname | lastname | dateofbirth | 1 | robert | robert | poinan | 1984 | 2 | joy | joy | rob | 1990 | i have read whole excel sheet data in dataset (named ' ds ') want insert whole dataset (which ' ds ') in sql table (which ' users ') i using loop (can use foreach loop) insert ' ds ' (dataset) rows 1 one users (sql table) table sqlconn.open(); (int = 0; < ds.tables[0].rows.count; i++) { sqlcommand cmd = new sqlcommand("insert [users] ([id],[username],[firstname],[lastname],[dateofbirth]) values(@id,@username,@firstname,@lastname,@dateofbirth))", sqlconn); cmd.parameters.addwithvalue("@id", ds.tables[0].rows[i][0].tostring()); cmd.parameters.addwithvalue("@username", ds.tables[0].rows[i][1].tostring()); cmd.parameters.addwithvalue("@f

postgresql - st_intersect count result for each row -

i have 2 polygon tables freeform, , grid in postgres. count grid polygons intersect freeform polygons each freeform polygons. can 1 freeform: select count (*) (select a.* durs_area b, grid b.job_reference = '1571754' , st_intersects(a.geom, b.the_geom)) zulu; is there way create query add number of intersecting grid polygons each freeform polygons? use join (rather unnecessary sub-query), , aggregate. select ff.job_reference, count (g.*) durs_area ff join grid g on st_intersects(g.geom, ff.the_geom) group ff.job_reference, ff.the_geom;

bash - Shell Script - telnet multiple hosts:ports -

i'm not expert in shell script means. got structure idea post ( bash script telnet test multiple addresses , ports ) need verify lan connections between specific hosts , ports via telnet. the reason using telnet fact both lan , machines heavily secure , don't have access netcat, nmap or /dev/tcp. i'm no near comfortable python or pearl try route... ( know silly me, i'll there though :p ). the following code works, reasons beyond understanding while loop iterates once , no more... :( . note: important me know if connection failed due timeout or refused (port closed @ endpoint). can me in 1) fixing , 2) understanding why? fyi: else might have similar need here's operational updated code script. in case connection refused being handled success (testing firewall rules) can changed failed depending on necessities. #!/bin/bash path=`pwd`; touch $path/test_telnet.out || exit; touch $path/success.log || exit; touch $path/failed.log |

Unable to use Objective-C library in Swift project -

i've tried import objective-c library named ddhotkey in swift project , doesn't work in cases. here steps i've done: download "ddhotkey" repository right-click on project -> "add files %project_name%" -> select "ddhotkey-master" folder "copy items if needed" checkbox , "create folder references" radiobutton enabled according apple documentation, prompt bridging header should appear then, didn'tt-- files copied project's directory i've tried add bridging header project manually (file -> new -> source -> header file) name "bridge.h", set in project's settings (build settings -> swift compiler - code generation -> objective-c bridging header -> "bridge.h") , place following code file: . #ifndef project_name_bridge_h #define project_name_bridge_h #import "ddhotkey-master/ddhotkeycenter.h" #endif now compiles following code: var hotkeyce

c# - How to format asp.net web services (ASMX) to look like the mentioned example? -

i'm trying format web service result (json) mentioned example. current format fullcalendar not able display events. if @ output see date format different example though tried not use (tounixtimespan) , have double quotes on every item such as, title,start,end , id. how can rid of double quotes , format date , time? i appreciate efforts in reaching solution problem. example events: [ { title: 'all day event', start: '2014-11-01' }, { title: 'long event', start: '2014-11-07', end: '2014-11-10' }, { id: 999, title: 'repeating event', start: '2014-11-09t16:00:00' }, { id: 999, title: 'repeating event', start: '2014-11-16t16:00:00' }, { title: 'conference',

node.js - nclosure is not compatible with nodejs 0.12 -

the nclosure ,nodejs server-side google closure lib, not compatible nodejs 0.12 compatible nodejs 0.12 /node_modules/nclosure/lib/settingsloader.js:102 if (!path || !require('path').existssync(path)) return null; ^ typeerror: undefined not function @ nclosure.settingsloader.readargsfromjsonfile (/home/wj/work/transport/node_modules/nclosure/lib/settingsloader.js:102:33) @ nclosure.settingsloader.readsettingsobject (/node_modules/nclosure/lib/settingsloader.js:133:12) @ nclosure.base.loadbasescript_ (/node_modules/nclosure/lib/nclosurebase.js:199:53) @ new nclosure.base (/node_modules/nclosure/lib/nclosurebase.js:69:10) @ object.<anonymous> (/node_modules/nclosure/lib/nclosurebase.js:350:24) @ module._compile (module.js:460:26) @ object.module._extensions..js (module.js:478:10) @ module.load (module.js:355:32) @ function.module._load (module.js:310:12) @ module.require (module.js:365:17) t

android - An always expanded MvxExpandableListView -

i'm trying develop version of mvxexpandablelistview expanded. the code wrote seems work, i'm pretty sure don't things right way. tried find info android widgets lifecycle, found info activity lifecycle. more specifically, should expandall() method called ? i've tried several places , ended putting ondraw() handler. to prevent collapsing, called expandgroup() method in groupcollapse handler. hmm not sure it's right way either. so, here code : public class mvxexpandedlistview : mvxexpandablelistview { private bool _allexpanded = false; private void expandall() { var nbgroups = thisadapter.groupcount; (int = 0; < nbgroups; i++) { expandgroup(i); } } private void init() { groupcollapse += mvxexpandablelistview_groupcollapse; setselector(android.resource.color.transparent); cachecolorhint = color.transparent; setgroupindicator(null); } public mv

node.js - Test form data using Mocha for NodeJS -

i trying write mocha test nodejs sends form data , checks if response ok (200), , res.body has properties, the test fails , dont know reason. increasing timout didnt help, when use advancedrestclient chrome extension form data in payload section works perfectly! .type('form') supposed superagent syntax var should = require('should'), assert = require('assert'), request = require('supertest'), superagent = require('superagent'); describe('data', function () { it('should return status ok (200)', function(done) { this.timeout(20000); request.post('http://xxx:3000/xxx/xxx') .type('form') .send({startdate:"2015-03-08",enddate:"2015-03-24",timelapse:"day"}) .end(function(err, res) { if (err) { throw err;

c# - How to remove a constraint on table using entity framework db migrations -

i'm trying alter type of table column int long . altercolumn("dbo.files", "size", c => c.long(nullable: false)); it's throwing error on migration: the object 'df__files__size__1fcdbceb' dependent on column 'size'. alter table alter column size failed because 1 or more objects access column. how remove constraint in entity framework... migration, put in?

sql server - MS Access - Pass Through query best practice solution -

so have particular situation here crm i'm tasked developing, , i'd see if can insight on more of sanctioned, best-practice approach specific scenario. basically, have form called accounts displays information specific account subform needs display quotes , orders associated account give user snapshot of work done. due complexity of query , number of possible records, scrolling through subform can slow if using sql view or more obviously, local access query. best solution here pass through query can shoot processing straight sql. i've done quite bit of research , best approach i've seen either 1) use vba change definition of pass through query or 2) use insert statement populate local table can used recordsource subform. @ point want confirm either or both of these approaches qualify best practice situation , possibly example of code make happen. right i'm struggling processing belongs. don't want call code subform launches main accounts form since form

url rewriting - API and "normal" URLs in one Yii2 application -

i have (use) in yii2 application: a standard, seo-like urls, .html @ end (thus 'suffix' => '.html' ) , api request (basing on very simple code ) without suffix. so, make application being able serve both http://127.0.0.1/app/site/index.html -like urls , http://127.0.0.1/uslabs/web/user/2 -like api calls. it possible? if so, how should configure urlmanager component this? i went through " quick start " chapter in " restful web service " section, bring no help. don't use suffixes in examples given there. i'm stuck choice of either 1 or other scheme. yii has rest url router can use associate controllers, this; 'urlmanager' => [ 'enableprettyurl' => true, 'enablestrictparsing' => true, 'showscriptname' => false, 'suffix' => 'html', 'rules' => [ ['class' => 'yii\rest\urlrule', 'con

json - if else in javascript leading to missing values -

i have data in json format . follows json string: var datastring4 = {"details":[{"observationsource":"outpatient clinic","observationvalue":98.69999694824219,"readingname":"body temperature", "observationdatetime":"2014,08,01","readingtype":"vitals"},{"observationsource":"outpatient clinic", "observationvalue":66,"readingname":"heart rate","observationdatetime":"2014,08,01", "readingtype":"vitals"},{"observationsource":"patient self reported","observationvalue":98.5,"readingname":"body temperature","observationdatetime":"2014,08,02", "readingtype":"vitals"},{"observationsource":"patient self reported","observationvalue":62,"readingname":"heart rate","

CSV parsing through PHP -

i working in csv parsing in php have 1 column in csv i.e 'amount' have value ($45.34). so, when see these value in excel sheet show same value if see these value in formula bar in excel show me -45.34 (i.e negative value).so have not parse these value negative value need??

c# - Disable image paste in RichTextBox in Winforms -

we have usercontrols herits richtextbox . forbid user enter image(with copy paste) in user control. i found several places speaking of this: this doesn't work winforms this not work when doing right-click -> paste currently i've solution: protected override bool processcmdkey(ref message msg, keys keydata) { if (keydata == (keys)shortcut.ctrlv || keydata == (keys)shortcut.shiftins) { if (clipboard.containsimage()) { return false; } } return base.processcmdkey(ref msg, keydata); } which works copy paste ctrl+c-ctrl+v, not contextual menu. edit i tried given proposition: public class customrichbox : richtextbox { private const int wm_paste = 0x0302; protected override void wndproc(ref message m) { if (m.msg == wm_paste ) { if (clipboard.containsimage()) { return; } } base.wndproc(ref m); } } but when ct

java - Uploading file using selenium javascript error -

i have browse button browse file. after browsing there import button import file. i'm able browse path using following code: public static void uploadfiles(string object, string data) { try { string filemode=""; capabilities cap = ((remotewebdriver) driver).getcapabilities(); string browsername = cap.getbrowsername(); //system.out.println(browsername); if (browsername.contains("chrome")){ filemode= "open"; } else if (browsername.contains("firefox")){ filemode= "file upload"; } else if (browsername.contains("explorer")){ filemode = "choose file upload"; } string exe_file=driverscript.exe_filename; string[] command={exe_file,filemode,data};

c# - Why won't my JavaScript work in a ASP.net web form? -

i have no problems running code html page. now, in web form, converter nothing. trying migrate on web form page html use master page , theme. <asp:content id="content1" contentplaceholderid="head" runat="server"> <script lang="javascript" type="text/javascript"> //convert logic function celsiusconvert() { document.converter.fahrenheit.value = (document.converter.celsius.value * 9 / 5) + 32 document.converter.kelvin.value = document.converter.celsius.value * 1 + 273.15 } function fahrenheitconvert() { document.converter.celsius.value = (document.converter.fahrenheit.value - 32) * 5 / 9 document.converter.kelvin.value = ((document.converter.fahrenheit.value - 32) * 5 / 9) + 273.15 } function kelvinconvert() { document.converter.celsius.value = document.converter.kelvin.value - 273.15 document.converter.fahrenheit.value = ((document.converter.kelvi

javascript - Angular JS, I get how it works, but where should I use it? -

i skimmed angular js documentation, , it's rather interesting have say, maybe because have lack of immagination (perhaps of intelligence), cannot figure out many practical uses that. in situation say: "oh, thank god there's angular js , can task that."?

delphi - Convert extended value to Time -

i want convert extended value time. before decimalseparator hours after decimalseparator minutes digital 8,62944444444444 --> 8:37 1,41666666666667 --> 1:25 i've made funtion 1,41666666666667 --> 1:24 must 25 minutes function myconvertion(avalue: extended): tdatetime; var hour, min, sec, msec: word; begin hour:= trunc(avalue); min:= trunc(frac(avalue)*60); result:= encodetime(hour, min, 0, 0); end; when use exact 1,41666666666667 i'm 1:25 value must convert comes out soap enterface double (opostcalculationday.directassignedworktime). the value in debug mode = 1,41666666666667 myconvertion(1,41666666666667) --> 1:25 myconvertion(opostcalculationday.directassignedworktime) --> 1:24 myconvertion(roundto(opostcalculationday.directassignedworktime, -15)) --> 1:25 myconvertion(roundto(opostcalculationday.directassignedworktime, -16)) --> 1:24 myconvertion(strtofloat(floattostr(opostcalculationday.directassignedworktime)))--> 1:25

testing - Selenium, JAVA - how to find such element? -

do know how find , click @ element this: <div class="offer ctrlopenofferinfo"> <a class="linkoffer" href="offer_view.html?id=1007"/> <p class="photo"> <p class="name">new offer</p> <p class="price">123</p> <div class="rate ctrlviewrateoffer" data-value="0.0000"> <p class="date"/> <div class="hide info"> <div class="bginfo"/> using selenium webdriver , using name of element there few similiar elements on page? here's i've tired far: webdriverwait wait = new webdriverwait(driver, 30); wait.until(expectedconditions.invisibilityofelementlocated(by.xpath("//*[text()='new offer']"))); wait.until(expectedconditions.elementtobeclickable(by.xpath(".//*[@id='formdevelopmentelementadd'][text()='new offer']"))); driver.findelement(by.xpath(".//*[@id='fo