Posts

Showing posts from September, 2015

ios - NSDateFormatter: error in converting date -

i have got following time stamp in milliseconds: nsdate * date = [nsdate datewithtimeintervalsince1970:1470524933.923123]; nsdate * date2 = [nsdate datewithtimeintervalsince1970:1470666561.000]; nsdateformatter *dateformatter = [[nsdateformatter alloc] init]; [dateformatter setdateformat:@"yyyy-mm-dd 'at' hh:mm:ss"]; nsstring * dateinstring = [dateformatter stringfromdate:date]; when run following: 2016-08-07 @ 00:08:53 , 2016-08-08 @ 15:29:21 however first date should following according epoch time converter website using : your time zone: 8/7/2016, 12:08:53 gmt+1:00 dst it says 00 rather 12. why that? try set timezone of nsdateformatter gmt [dateformatter settimezone:[nstimezone timezonewithabbreviation:@"gmt"]]; as larme , vadian suggested if want 12 hour use format [dateformatter setdateformat:@"yyyy-mm-dd 'at' hh:mm:ss a"];

android - How to read a column value in parse.com without accessing an object or a pointer -

by using code, not able 'name' unless use objectid = xj34weo . suggest way, if not, @ least using pointer. //parse query initialization final parsequery<parseobject> query = parsequery.getquery("myusers"); //to check row has "number"="1234" query.whereequalto("number", "1234"); query.findinbackground(new findcallback<parseobject>() { public void done(list<parseobject> employees, parseexception e) { if (e == null) { try { //xj34we0 objectid query.get("xj34weo").get("name") + ""); } catch (parseexception pe) {} } } }); are trying employee object number? you have list<parseobject> , use it. query.findinbackground(new findcallback<parseobject>() { public void done(list<parseobject> employees, parseexception e) { if (e == null && employ

serialization - Flink is not able to serialize scala classes / Task Not Serializable -

i have scala class having 2 fields vals flink saying doesn't have setters. task not serializable. i tried setters using var says duplicate setter. vals public why asking setters. flink version 1.1.0 class impression(val map: map[string, string],val keyset:set[string]) my code: val preaggregate = stream .filter(impression => { true }) .map(impression => { val xmap = impression.map val values = valfunction(xmap) new impressionrecord(impression, values._1, values._2, values._3) }) exceptions: **class impression not contain setter field map** 19:54:49.995 [main] info o.a.f.a.java.typeutils.typeextractor - class impression not valid pojo type 19:54:49.997 [main] debug o.a.flink.api.scala.closurecleaner$ - accessedfields: map(class -> set()) exception in thread "main" **org.apache.flink.api.common.invalidprogramexception: task not serializable at** org.apache.flink.api.scala.closurecleaner$.ensureserializable(closurecleaner.scala:172) @

java - I cannot get the program to repeat output in an ordered manner -

i want design program scales strings. if string d = "abc\ndef\nghi",horizontal scalling=2,vertical scalling=2, scaleobj.scale(d,2,2)/ defined below / should output "aabbcc\naabbcc\nddeeff\nddeeff\ngghhii\ngghhii". //output aabbcc aabbcc ddeeff ddeeff gghhii gghhii ive have problem ive defined below: //mainsix.java public class mainsix{ public static void main(string[] args){ scale scaleobj = new scale(); system.out.println(scaleobj.scale("abc\ndef",2,3)); } } class scale { public static string scale(string strng, int k, int v) { //horizontal scalling -k string s=strng.replaceall(".", repeat("$0",k)); //verical scalling string y = repeat(s,v); return y; } public static string repeat(string str, int times){ return new string(new char[times]).replace("\0", str); } } when compile output aabbcc ddeeffaabbcc ddeeffaabbcc dd

timer - Java TimerTask cancel -

i have following problem. every 2 seconds programm go inside if statement. inside if statement want have timer give me message after 15 seconds. timer should run delay of 1 second. while i'm "waiting" timer, if statement executed 7 times. problem is, have 7 same timertask @ same time running. how can solve problem? if (response == true) { final timer timer = new timer(); final int keepalivetimeout = 15000; //15 seconds timer.schedule(new timertask() { @override public void run() { if (response) { response = false; log.i(tag, "********response******"); timeoutcounter = 0; } else if (timeoutcounter > keepalivetimeout) { log.i(tag, "********timer timeout******"); } log.i(tag, "********timer******"); timeoutcounter = timeoutcounter + 1000; } }, 0, 1000); } from java api : public void schedule(timertask task, long delay,

Cannot perform a calling between two emulator in android studio 2.0 -

Image
i turned on 2 emulators port 5556 , 5554 different windows. pressed number 5556 , called. nothing happens. cannot call between 2 emulators in android studio 2.0. how can fix thank in addition, can use block function block virtual call? i don't know if calling between 2 emulators should work or not. can simulate phone call in way: select … in emulator panel. select "phone" in left panel of extended controls dialog. select or type phone number in field. click call device.

ios - Realm swift change primaryKey -

so have realm object class registrationplatedb: rlmobject { dynamic var registrationplate : string = "" dynamic var user : string = "" override static func primarykey() -> string? { return "registrationplate" } ... and change class registrationplatedb: object { dynamic var plateid : int = -1 dynamic var registrationplate : string = "" dynamic var name : string = "" dynamic var user : string = "" override static func primarykey() -> string? { return "plateid" } .... so i've written migration migration.enumerate(registrationplatedb.classname()) { oldobject, newobject in newobject!["name"] = "" newobject!["user"] = "" newobject!["registrationplate"] = "" newobject!["plateid"] = -1 newobject!["primarykeyproperty"] = &

error when looping with macros in the indexing -

i trying create dummy variable identify next 5 observations after selection of cutoffs. first method in code below works, looks bit messy , i'd able adjust number of observations i'm creating dummies without typing out same expression 30 times (usually sign i'm doing hard way). every time put macro indexing, i.e. [_n-`i'] i following error: _= invalid name r(198); i'd grateful advice. sysuse auto.dta, replace global cutoffs 3299 4424 5104 5788 10371 this works sort price gen a=0 foreach x in $cutoffs { replace a=1 if price==`x' replace a=1 if price[_n-1]==`x' replace a=1 if price[_n-2]==`x' replace a=1 if price[_n-3]==`x' replace a=1 if price[_n-4]==`x' replace a=1 if price[_n-5]==`x' } this doesn't. foreach x in $cutoffs { forval `i' = 0/25 { replace a=1 if price[_n-`i']==`x' } } any advice why? in stata terms no loops needed here @ all, except ta

objective c - How to install root certificate inside iOS app, so it will be trusted when open URL from UIWebView? -

i have ios app in need use uiwebview open web page uses ssl certificate not issued trusted authority. got error. i can manually install ssl certificate, need on every client device, not option, need install root certificate code. but don't know how that. google in cases importing provisioning certificates. any guidance? need direction search. i read there ssl pinning, understand authentication purposes. should stick or not? p.s. url accessed not on our web server, can not manage certificates. reason need trust in general in app. i think cannot install certificate inside app. can show guide tell user how open , install certificate in safari. , open certificate url in safari via codes.

android - extract String between last slash and question mark -

i want extract string between last slash , question mark using regex string path="http://keting.amazonaws.com/media123/mediaattachments/000/000/004/original/shoes_tvc_2013.mp4?1470248308" i need "shoes_tvc_2013.mp4" string. pattern pattern = pattern.compile("need here"); matcher matcher = pattern.matcher(url); if (matcher.find()) { system.out.println(matcher.group(1)); //prints region/country } else { system.out.println("match not found"); } .*\/(.*)\? should trick. see here more.

python - Extract subarray from collection of 2D coordinates? -

in python, have large 2d array containing data, , mx2 2d array containing collection of m 2d coordinates of interest, e.g. coords=[[150, 123], [151, 123], [152, 124], [153, 125]] i extract mx1 array containing values of data array @ these coordinates (indices) locations. obviously, data[coords] not work. i suspect there easy way that, stackoverflow failed me now. in advance help. edit: example be data=[[0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 1, 2, 1, 0, 0], [0, 0, 0, 1, 23, 40, 0, 0], [0, 0, 0, 1, 1, 2, 0, 0], [0, 0, 3, 2, 0, 0, 0, 0], [0, 0, 4, 5, 6, 2, 1, 0], [0, 0, 0, 0, 1, 20, 0, 0], [0, 0, 0, 3, 1, 2, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0]] coords=[[1,4],[2,4],[2,5],[5,3],[6,5]] and desired output be out=[2,23,40,5,20] you use list comprehension : in [73]: [data[i][j] i,j in coords] out[73]: [2, 23, 40, 5, 20] the result returned list comprehension equivalent to result = [] i,j in coords: result.append(dat

php - How scalable is this file-based DB approach? -

i have simple php script calculates things given string input. caches results database , delete entries older number of days. our programmers implemented database as: function cachedcalculatething($input) { $cachefile = 'cache/' . sha1($input) . '.dat'; if (file_exists($cachefile) { return json_decode(file_get_contents($cachefile)); } $retval = ... file_put_contents(json_encode($retval)); } function cleancache() { $stale = time() - 7*24*3600; foreach (new directoryiterator('cache/') $fileinfo) { if ($fileinfo->isfile() && $fileinfo->getctime() < $stale) { unlink($fileinfo->getrealpath()); } } we use ubuntu lamp , ext3. @ number of entries cache lookup become non-constant or violate hard limit? while particular code not "scalable"* @ all, there number of things can improve it: sha1 takes string. non-string $input variable have serialized or json_encoded first, before calculating

powerbi - Power Bi does not connect with MySQL Database -

Image
i trying connect powerbi desktop form mysql database on localhost. when enter credential , try connect following popup box. i don't know should error log in powerbi seems encountered same problem did. first result in google: http://community.powerbi.com/t5/service/power-bi-desktop-error-when-connecting-to-local-mysql/td-p/2724

html - boostrap menu active page dont show style -

so want active page use same settings hover settings. no matter how change css cant work... long time since i've worked on page tho might missing easy shit... style.css before changes .navbar-default .navbar-brand { color: #fff; border-left:solid; border-right:solid; border-top:none; border-bottom:none; border-color:#202020; border-width:0.1pt; } .navbar-default .navbar-brand:hover, .navbar-default .navbar-brand:focus { color: #fff; border-left:solid; border-right:solid; border-top:none; border-bottom:none; border-color:#707070; border-width:0.1pt; background: -webkit-linear-gradient(top, rgba(112, 112, 112, 1) 0%, rgba(0, 0, 0, 1) 100%); background: linear-gradient(to bottom, rgba(112, 112, 112, 1) 0%, #404040 20%); } .navbar-default { font-size: 14px; background-color: rgba(0, 0, 0, 1); background: -webkit-linear-gradient(top, rgba(112, 112, 112, 1) 0%, rgba(0, 0, 0, 1) 100%); backgr

swift - Xcode 7 - Launch Screen localization doesn't work -

Image
i've created splash screen in swift using xcode 7 . i've generated localizations in photo different languages, doesn't work: can help? ok fix after create infoplist.strings , create splash screen each language , add below in each file "uilaunchstoryboardname" = "launchscreen"; "uilaunchstoryboardname" = "launchscreensp";

visual studio 2015 - Error with TFS Build -

Image
i'm new tfs , i'm trying setup automated build run each time there check in. added nuget installer , visual studio build steps looks neither step being executed. tried disabling steps attempt run build nothing still same error bin.rar file. simple mvc project should work default settings. i've looked everywhere , have not found similar error. i have tried removing build steps , queued new build got same error. there no reference bin.rar in sln, csproj, or config files. error on tfs build error in log the problem clear bro, authentication problem . make sure have required permissions before making build. going to build definition -> right hand click-> security-> build administrators -> administer build permissions inherited allow.

c++ - Cast for upcasting only -

we know c-style casts considered evil in c++. why replaced const_cast<> , static_cast<> , , dynamic_cast<> provide more bespoke casting, allowing programmer allow intended classes of conversions. far, good. however, there seems no builtin syntax perform explicit upcast: means perform otherwise implicit conversion in base& baseref = derived explicitly without allowing reverse . while know quite small corner case (most of time implicit conversions work fine), wondering techniques available implement such cast in user code. thinking along lines of template<class t> class upcast { public: template<class u, typename = typename std::enable_if<std::is_convertible<u, t>::value>::type> upcast(u value) : value(value) {} operator t() { return value; } private: t value; }; however, seems complicated good, , since i'm not expert in template-metaprogramming, ask whether there different/better/simp

jquery - javascript ajax request in rails not able to pass values -

i have rails application in have following controller action. def index .... .... @currency = params["currency"].present? ? params["currency"] : "inr" @check_in_date = params["arrival_date"].present? ? params["arrival_date"] : date.today.to_s @check_out_date = params["departure_date"].present? ? params["departure_date"] : (date.today + 1).to_s .... .... end i have javascript trying make ajax request this. filename.html.haml else{ hotel_id = id.slice(6) $.ajax({ url: "/single_hotel/"+hotel_id, data: {check_in_date: #{@check_in_date}, check_out_date: #{@check_out_date}, longitude: #{@longitude}, latitude: #{@latitude}, rooms: #{@rooms}, adults: #{@adults}, children: #{@children}, currency: #{@currency} }, type: 'get' }); } when check sources tab in chrome console see this. $.ajax({

angularjs - Mocking Components with Angular 2 -

i trying mock heroes-component of 'tour of heroes' angular 2 tutorial . don't know how mock router, needed instantiating heroescomponent. tried create spy jasmine, doesn't work, because missing property 'rootcomponenttype'. how can make work? import {heroescomponent} "./heroes.component"; import {router} "@angular/router-deprecated"; import {heroservice} "./hero.service"; describe('heroescomponent', () => { let heroes:heroescomponent; let router:router; let service:heroservice; beforeeach(() => { router = jasmine.createspyobj('router', ['navigate']); service = new heroservice(/* care later */); heroes = new heroescomponent(router, service); }); it('should defined', () => { expect(heroes).tobedefined(); }); }); it working now: describe('heroescomponent', () => { let router:any; let heroescomponent:hero

vb.net - concatenate Combobox items from Oracle DB -

i want display 2 table values oracle db in combobox (name , surname). far can display one, , 1 doesn't work criteria. using conn oracleconnection = new oracleconnection("data source=mydb;user id=lucky;password=mypassword;") try conn.open() dim sql string niz = "select name,surname mytable id=1 " dim cmd new oraclecommand(sql, conn) cmd.commandtype = commandtype.text dim dr oracledatareader = cmd.executereader() while (dr.read()) cmbcustomers.items.add(dr.getstring(0)) end while conn.close() catch ex exception messagebox.show(ex.message) conn.dispose() end try anybody knows how display name , surname in combobox, clause ? try using string concatenation way select name ||' ' || surname m

c# - ASP.NET MVC 5, SignalR 2.2.1 and Sessions. Using them to create a web chat -

i new asp.net mvc , signalr. have followed tutorials mvc , signalr catch foundations. searched, read , tested, nothing specific problem. try explain first time. trying create web chat program mvc , signalr. seems can not understood using of signalr , mvc , session handling. i need follow user session , determine whether user logged in or not. there function creating chat room (only logged users). option (1) not logged in user: the not logged in user must enter name have access of chat rooms. not able create new chat room. option (2) logged in user: the logged in user able create chat room. , join in other chat room. questions: how creation of new chat room should accomplished? create view new chat room dynamically in run time? create 1 static view , use showing data (i mean following: users , rooms programmatically determine user in room is, filter other users, conversation , show content specific users in specific room in static view...)? or else? how check

python - The truth value of a Series is ambiguous -

df['class'] = np.where(((df['heart rate'] > 50) & (df['heart rate'] < 101 )) & ((df['systolic blood pressure'] > 140 & df['systolic blood pressure'] < 160)) & ((df['dyastolic blood pressure'] > 90 & ['dyastolic blood pressure'] < 100 )) & ((df['temperature'] > 35 & df['temperature'] < 39 )) & ((df['respiratory rate'] >11 & df ['respiratory rate'] <19)) & ((df['pulse oximetry' > 95] & df['pulse oximetry' < 100] )), "excellent", "critical") for code, getting: valueerror: truth value of series ambiguous. use a.empty, a.bool(), a.item(), a.any() or a.all(). maybe solve (our) problem. import random import pandas pd import numpy np heart_rate = [random.randrange(45, 125) _ in range(500)] blood_pressure_systolic = [random.randrange(140, 230) _ in range(500)] blo

c# - Does SqlDataAdapter::Fill fetch the whole result set or is it on-demand? -

i trying connect datagridview sql server, , solution outlined in https://stackoverflow.com/a/18113368/492336 uses sqldataadapter , datatable: var adapter = new sqldataadapter("select * foo", "server=myhost-pc\\sqlexpress;trusted_connection=yes;database=test1"); var table = new datatable(); adapter.fill(table); view.datasource = table; i'm trying figure out if method fetches entire dataset server, or if connects datagridview server can fetch new rows on demand. for example if table has 1 million rows, of them fetched , written datatable object before sqldataadapter::fill has returned? limiting number of rows loaded via sql limits them either qualitatively (where...) or via rather blunt limit clause. can use dataadapter load rows in "pages" or groups - bit @ time. uses mysql works many of other (all?) of dbproviders: int pagesize = 10000; int page = 0; ... the initial loading: string sql = "select * sample"; using

angularjs - Difference between $httpParamSerializerJQLike and $httpParamSerializer -

i dont understand main difference between $httpparamserializerjqlike , $httpparamserializer , when can use 1 of them.. 1 me.. ? old question, looking today , found answer somewhere else: link : in general, seems $httpparamserializer uses less "traditional" url-encoding format $httpparamserializerjqlike when comes complex data structures. for example (ignoring percent encoding of brackets): with array property of data object such {sites:['google', 'facebook']} : $httpparamserializer return sites=google&sites=facebook $httpparamserializerjqlike return sites[]=google&sites[]=facebook with object property of data object such {address: {city: 'la', country: 'usa'}} : $httpparamserializer return address={"city": "la", country: "usa"} $httpparamserializerjqlike return address[city]=la&address[country]=usa

MS build and SonarQube analysis from jenkins, unable to execute Sonar, E170001 -

Image
i'm trying build .net project , start sonarqube code analysis jenkins. did following steps: download sonarqube start sonarqube server: c:...\sonarqube\bin\windows-x86-64\startsonar.bat install sonarqube 2.4.4 plugin on jenkins go http://localhost:8080/configure , configure sonarqube server shown here: go http://localhost:8080/configuretools/ , configure sonarqube scanner msbuild this: added job in jenkins, configured project build ms build, wrapped build step sonarqube scanner msbuild - begin analysis , sonarqube scanner msbuild - end analysis : my problem: jenkings checking out project files , building project analysis fails. here relevant console output: 10:53:36.189 info - 113 files analyzed 10:53:36.805 info - 0/113 files analyzed info: ------------------------------------------------------------------------ info: execution failure info: ------------------------------------------------------------------------ total time: 17.443s final memory: 18m

PHP CURL - HTTP Error 500 (The FastCGI process exceeded configured activity timeout) -

i have enabled curl on php , wanted check activated simple script below. <?php $curl = curl_init(); curl_setopt ($curl, curlopt_url, "http://www.php.net"); curl_exec ($curl); curl_close ($curl); ?> after testing on local machine, receive internal server error: http error 500.0 - internal server error c:\php\php-cgi.exe - fastcgi process exceeded configured activity timeout what causes of error? response shouldn't take long not see how can problem timeouts etc?

database - Derby Network Server not started automatically -

i application, file 'apache.jndi.properties' contains ds.jdbcdriver=org.apache.derby.jdbc.embeddeddriver ds.jdbcurl=jdbc:derby:memory:derbydb;create=true;derby.drda.startnetworkserver=true the network server not started automatically regarding above configs, started programmatically when try below code new networkservercontrol(inetaddress.getbyname("localhost"),1527).start(null) what's wrong apache.jndi.properties , why not started automatically?

java - cannot parse the String to Date object -

i have string in format : 2016-08-08t10:27:06.282858+00:00 . i want parse string date object. tried simpledateformat df = new simpledateformat("yyyy-mm-dd't'hh:mm:ss.ssssss'z'"); but i'm getting error: unparseable date: "2016-08-08t11:06:22+00:00" (at offset 19) i tried every other format in place of 'z' 'x', 'xxx' nothing seems work. correct format "yyyy-mm-dd't'hh:mm:ss.ssssssxxx". ' ' used escape simbols , avoid parsing them.

css - HTML5 video not working in safari 5 -

i'm using video in page , i'm having problem of not playing video in safari 5. have seen many answer not working in case. below code- <video autoplay muted width="320" height="240"> <source src="video/video.mp4" type="video/mov"> <source src="video/video.ogv" type="video/ogv"> <source src="video/video.webm" type="video/webm"> browser not support video tag. </video> this code works fine in mozilla , chrome not in safari.

spring statemachine - Can we use UmlStateMachineModelFactory inside a StateMachineBuilder -

i using statemachinebuilder create state machine , coz needed use programatically configure states , transitions. but due requirement change configuration constant , wanted use eclipse uml modelling since no longer need build state machine dynamically or programatically. avoid big code rework thought of using umlstatemachinemodelfactory inside builder below. builder<string, string> builder = statemachinebuilder .<string, string> builder(); builder.configureconfiguration() .withconfiguration() .autostartup(false) .listener(listener()) .beanfactory( this.applicationcontext.getautowirecapablebeanfactory()); builder.configuremodel().withmodel().factory(new umlstatemachinemodelfactory("classpath:model2.uml")); 1) legal in state machine, if how can attach entry actions each state? currently using builder using below code attaching entry actions each state stateconfigurer.state(&quo

sql server - SSIS - add upload date column after SSIS upload -

i'm uploading daily csv file via ssis package sql server table , each time insert date column states when upload complete. i'm thinking of putting in execute sql task after data flow task uses alter table query getdate() . each time run ssis package before csv data uploaded previous data moved archive table there won't worry of overwriting data each time insert column. thanks comments. what have done put in execute sql task , used code update [dbo].[cm25_current] set [upload date] = (getdate());

syslog-ng issue in tagging to server -

i installed syslog-ng using "yum install syslog-ng" in both local machine , server end. using open source version of syslog-ng. my need pass log file name client server end . explicitly set .sdata.file @ 18372.4.name field on client side, name of file available in $file_name macro. ".sdata.file @ 18372.4.name" empty in server side. when using static file name log beings work. below code dont know going wrong if need more information can provide can me. my client end syslog-ng code: source s_application_logs { file( "/var/log/test.log" flags(no-parse) ); }; destination d_access_system { syslog( "52.38.34.160" transport("tcp") port(6514) ); }; rewrite r_set_filename { set( "$file_name", value(".sdata.file @ 18372.4.name") ); }; rewrite r_rename_filename { subst( "/var/log/", "",

amazon s3 - AWS S3 object life cycle -

i want delete object in s3 bucket in bulk after period over. example object starting 2016-08-01* in name or *.xlsx files in bucket. can set life cycle individual object not in * mode. how it? according s3 api can list objects start prefix , can multiple delete .

xslt - XML - PIPE Character -

i have html mail created via xml , reason can't use special characters invalid characters in xml . so, how can print | ?

Android OpenGL ES 2.0 - Texture black -

i using opengl|es 2.0 create simple rectangle. not able textures working.my renderer & other class files below. texturerenderer.java public class texturerenderer implements renderer { private final context context; private final float[] projectionmatrix = new float[16]; private final float[] modelmatrix = new float[16]; private table table; private mallet mallet; private textureshaderprogram textureprogram; private colorshaderprogram colorprogram; private int texture; public texturerenderer(context context) { this.context = context; } @override public void ondrawframe(gl10 gl) { // todo auto-generated method stub // clear rendering surface. glclear(gl_color_buffer_bit); // draw table. textureprogram.useprogram(); textureprogram.setuniforms(projectionmatrix, texture); table.binddata(textureprogram); table.draw(); // draw mallets. colorprogram.useprogram(); colorprogram.setuniforms(projectionmatrix); mallet.bind

javascript - Change label on form label via JQuery -

i searched jquery change labels although there lot of answers didn't pertain question. want change label else includes links. can't seem work!! i've put js in head position of code had no luck , used jsfiddle please see below. doing wrong? jsfiddle https://jsfiddle.net/14tx86j5/ html <input name="input_147.1" value="i agree veryappt’s terms of service" id="choice_3_147_1" type="checkbox"> <label for="choice_3_147_1" id="label_3_147_1">i agree companies terms of service</label> jquery <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script> <script type="text/javascript"> jquery.noconflict(); jquery(document).ready(function($) { $("#label_3_147_1 label").html('you agree our <a href="http://www.google.com/accounts/tos" name="terms" target="_blank"

file upload - PHP image validation not working -

i working on cms site. i've created created " new-post.php " page & added conditions image type & size validation. works perfectly. i've same page updating post. condition not working on page. shows " invalid image " alert upload image valid extension. what's wrong code? any appreciated! if(!$stmt) { echo "<div class='alert alert-danger' style='margin-top: 20px;'><span class='glyphicon glyphicon-exclamation-sign'></span> <strong>post has not been updated.</strong></div><a href='dashboard?new' class='btn btn-danger btn-sm' style'margin-top: 50px;'>take me there again.i'll try again.</a>"; } else { if($image_type=="pimage/jpeg" or $image_type=="pimage/jpg" or $image_type=="pimage/png" or $image_type=="pimage/bmp"

javascript - File to upload and show on div multiple -

i have function created select image input type="file" , show uploaded file on div problem there multiple input file 3 input file tied alot issue facing 1 image showing , other 2 not showing. function head(input) { if (input.files && input.files[0]) { var reader = new filereader(); reader.onload = function(e) { $('#head_shot').attr('src', e.target.result); } reader.readasdataurl(input.files[0]); } } $("#head").change(function() { head(this); }); function side_profile(input) { if (input.files && input.files[0]) { var reader = new filereader(); reader.onload = function(e) { $('#side_profile').attr('src', e.target.result); } reader.readasdataurl(input.files[0]); } } $("#side_profile").change(function() { side_profile(this); }); function full(input) { if (input.files && input.files[0]) { var

r - list - rename specific data.frames column with lapply -

i have got list 10 data.frames , need rename 1 column of each data.frame. column rename no. 7 , think can trick lapply. here tried without success: lst <- lapply(lst, function(x) colnames(x)[7] <- 'new_name') i think close solution missing something. thanks you need use {} , return x : lst <- lapply(lst, function(x) {colnames(x)[7] <- 'new_name'; x}) or lst <- lapply(lst, function(x) { colnames(x)[7] <- 'new_name' x }) as reproducible example, use lapply(list(iris, iris), function(x) {colnames(x)[3] <- "test"; x})

Markers on google maps uploaded from excel(xlsx) file using Javascript -

i looking solution app. need upload excel file data , show data file on google maps multiple markers. found solution second part (show multiple markers on google map): <script> function initialize() { var mapdiv = document.getelementbyid('mymap'); var mapoptions = { center: new google.maps.latlng (-33.865143, 151.209900), zoom: 12, maptypeid: google.maps.maptypeid.roadmap }; var map = new google.maps.map(mapdiv, mapoptions); var locations = []; locations.push ({name:"bondi beach", latlng: new google.maps.latlng(-33.890542, 151.274856)}); locations.push ({name:"coogee beach", latlng: new google.maps.latlng(-33.923036, 151.259052)}); locations.push ({name:"cronulla beach", latlng: new google.maps.latlng(-34.028249, 151.157507)}); locations.push ({name:"manly beach", latlng: new google.maps.latlng(-33.80010128657071, 151.28747820854187)}); (var = 0; <

abap - SAP GUI incomplete error message -

Image
when programming abap sap gui gives hints error in code. unfortunately error messages displayed incompletely. in screenshot below: is there way view complete error message? the suggestion double click message did not work. disappears then. placing cursor on error message , pressing f1 results in message "no documenation available" in screenshot: you can double click on error message show full message. way set cursor on message , pressing f1. if not case, message not generic sap message.

c# - Extracting lambda expression from LINQ -

i have next chunk of code var query = wordcollection.select((word) => { return word.toupper(); }) .where((word) => { return string.isnullorempty(word); }) .tolist(); suppose want refactor code , extract lambda expression clause. in visual studio select lambda , refactor -> extract method. doing have linq modified to var query = wordcollection.select((word) => { return word.toupper(); }) .where(newmethod1()) .tolist(); and newmethod1() declared as private static func<string, bool> newmethod1() { return (word) => { return string.isnullorempty(word); }; } the question why new method not have input parameters, delegate func states newmethod1() should have string input parameter? to expected result, mark

dataframe - How to split columns in data frame by semicolon in R -

my question feels me obvious, however, not find solution. a have data frame this: <ticker>;<per>;<date>;<time>;<open>;<high>;<low>;<close> usd index;d;20150801;000000;97.199;97.336;97.191;97.192 usd index;d;20150802;000000;97.226;97.294;97.207;97.257 usd index;d;20150803;000000;97.255;97.582;97.155;97.499 i need them split in different columns ; this: <ticker> <per> <date> <time> <open> <high> <low> <close> usd index d 20150801 0 97.199 97.336 97.191 97.192 usd index d 20150802 0 97.226 97.294 97.207 97.257 usd index d 20150803 0 97.255 97.582 97.155 97.499 this basic question needs @ top of search results. thank in advance helping me resolve issue! we can use read.table setnames(read.table(text=dat[,1], sep=";", stringsasfactors=false), scan(text=names(dat), sep=";", = "", quiet