Posts

Showing posts from April, 2015

c# - how to run a background thread properly for a MVC app on shared host? -

i need run background thread mvc 4 app, thread wakes every hour or delete old files in database, goes sleep. method below: //delete old files database public void cleandb() { while (true) { using (userzipdbcontext db = new userzipdbcontext()) { //delete old files datetime timepoint = datetime.now.addhours(-24); foreach (userzip file in db.userfiles.where(f => f.uploadtime < timepoint)) { db.userfiles.remove(file); } db.savechanges(); } //sleep 1 hour thread.sleep(new timespan(1, 0, 0)); } } but should start thread? answer in this question creates new thread , start in global.asax , post mentions "asp.net not designed long running tasks". app run on shared host don't have admin privilege, don't think can install seperate program task. in short, is okay start thread in global.asax given thread doesn't (sleep

crash - App crashes when switching applications -

when switch applications or pressing windows button application terminates. on first page of application not occur. in debug mode, happens. application consumes 28 megabytes of memory. system should not terminate it. using prism windows phone , unity 3.5 prerelease. the crash occurs cause getnavigationstate doesn't support serialization of parameter type passed frame.navigate.

SED command to replace strings with in file -

i trying use sed replace strings special characters in text file. sed command becoming complicated. if please me exact command. code - sed -i 's;ps1='${hostname} [$oracle_sid] $pwd> ';ps1="${col_yellow}'customer test:${hostname}:[$oracle_sid]:$pwd> '${col_end}";g' i tried escape special characters below not working. sed -i 's;ps1=\'\${hostname} [\$oracle_sid] \$pwd> \';ps1="\${col_yellow}\'customer test:\${hostname}:[\$oracle_sid]:\$pwd> \'\${col_end}";g' .bash_profile_backup this might work (gnu sed): sed -i 's|ps1='\''${hostname} \[$oracle_sid\] $pwd> '\''|ps1="${col_yellow}'\''customer test:${hostname}:[$oracle_sid]:$pwd> '\''${col_end}"|g' file n.b. ' need quoted in both pattern , replacement whereas [] needs escaped in pattern only.

html - Styling ActionLinks in _LoginPartial compared to _Layout -

parent question: asp.net mvc navbar-brand header text color i have successfuly changed styling of actionlinks in _layout file. successfuly inherit style style.css file way: <li>@html.actionlink("about", "about", "home", new { area = "" }, new { @class = "navbar-brand" })</li> when try same actionlinks in _loginpartial file: <li>@html.actionlink("register", "register", "account", routevalues: null, htmlattributes: new { id = "registerlink" }, new { area = "" }, new { @class = "navbar-brand" })</li> the references added _loginpartial actionlink these: new { area = "" }, new { @class = "navbar-brand" } this not @ work, breaks application. these links stardard mvc , not changed. how apply styling _loginpartial actionlinks? you should write: @html.actionlink("register", "register", &qu

android - My R is gone and can not be recreated -

what did: i downloaded: xyplot , added jar libs folder i added example: quickstart project i startet app: worked i closed eclipse i opened eclipse my r gone what tried fix problem: i restarted eclipse i cleaned project i deleted project eclipse , reimported it i used android-tools fix properties i checked if there uppercase letters in layout-files or drawables, etc. i checked other invalid characters. i made sure there no other r imported of files nothing solved problem my min , target sdk: <uses-sdk android:minsdkversion="13" android:targetsdkversion="19" /> does had same issue? r located , how can recreate it? ok figured out when create new project r of new project cant found. going on there? you have typo (unclosed tag, missing hyphen, comma, dot or other error wrong package name in manifest) somewhere in 1 of xml files, either in manifest.xml or in strings, or layout. check them.

html - Proper bootstrap grid? -

Image
what proper way make bootstrap grid? here example have <div class="row"> <div class="col-md-12"> <div class="page-header"> hello </div> </div> </div> do need make row before col , or dont need use col if creating new row or proper make this 1. <section class="content row"> <div class="col-md-12"> <div class="page-header"> hello </div> </div> <div class="col-md-12"> <div class="what"> hello 2 </div> </div> </section> or proper way make this 2. <div class="row"> <div class="col-md-12"> <div class="page-header"> hello </div> </div> </div> <div class="row&quo

vNext: Console app that uses razor views without hosting -

i creating console application file conversions. these conversions done creating model input file , executing razor models output. to have working in ide used visual studio 2015 preview , created vnext console application uses mvc. (you razor support out of box then). working need host mvc app though, , cheapest way hosting through weblistener. host mvc app , call through "http://localhost:5003/etc/etc" rendered views construct output. but console app not supposed listen to/use port. command line tool file conversions. if multiple instances run @ same time fight host pages on same port. (this of coarse prevented choosing port dynamically, not looking for) so question how working without using port, using of vnext frameworks possible. in short: how can use cshtml files pass models in console app not use port using vnext razor engine. here code use: program.cs using microsoft.aspnet.hosting; using microsoft.aspnet.http; using microsoft.aspnet.mvc; using micro

PHPBB Parse error: syntax error, unexpected '}' overall_header.html.php -

hi problem getting error here on ym phpbb3 website parse error: syntax error, unexpected '}' in /public_html/cache/tpl_anami_overall_header.html.php on line 309 it happened when installed mod onto phpbb3 , became this. notes: (things didn't work me) i have tried deleting files off cache i have tried restoring backups of previous dates also forum data such posts, forums , topics deleted if reinstall new version of phpbb3 directory same sql database? if possible, reinstall phpbb instead thanks actually simple error talking about. should solved yourself. use php syntax checker or other tools this.

java - how to use crosswalk project in eclipse plugin -

i facing difficulty using crosswalk project eclipse , there plugin eclipse . gone through documentation seems complicated: https://crosswalk-project.org/documentation/getting_started/windows_host_setup.html#install-ant has idea how integrate , use eclipse anyway found 1 plugin eclipse @ : https://github.com/crosswalk-project/crosswalk-developer-tools-eclipse-plugin i followed below link: https://github.com/crosswalk-project/crosswalk-developer-tools-eclipse-plugin to create cross walk hello world project fro android . now creates blank project facedetection --index.html --manifest.json there no java file , other . how can run project ??. if have eclipse , android sdk already, can install crosswalk-eclipse-plugin eclipse. supports create empty crosswalk application , package it. more details refer link.

eclipse - If condition stopped working in my Java page connecting database -

public string function(string person, string area){ system.out.println("area"+area); //verified "null" obtained here if(area==null){ system.out.println("case1:"+area); } return area; } i not getting print specified inside if condition why happening? database connecting page consists of 2100 lines of codes. can 1 tell me possible reason this? fed this. working fine before. :( could area "null" , not null? if case , area database value of type varchar try this: if(area==null || area.tolowercase().equals("null")){ btw. not sure if tolowercase needed. and way :-) better. if(area==null || "null".equals(area.tolowercase())){ anyway. null safetyness not necessary because of area==null. if area null whole if condition true.

graphics - Implement Undo&Redo Java Blackboard Paint -

i've got blackboard, can draw dragging mouse. i'm trying implement undo & redo delete/restore last coordinates drawn. undo & redo works, blackboard doesn't refresh automatically, , have drag mouse again. here code (too long): public class clientblackboard extends jpanel implements keylistener { [...] class mmotionlistener implements mousemotionlistener { public void mousedragged(mouseevent e) { x = e.getx(); y = e.gety(); points.add(new pointerdraw(x, y)); _changed = true; try { drawcurrentshape(_bufimage.creategraphics()); } catch (exception e1) { // todo auto-generated catch block e1.printstacktrace(); } repaint(); } public void mousemoved(mouseevent e) { } } // subscribe mouse events class mlistener implements mouselistener { // required interface, not used public void mouseclicked(mouseevent e) {} public void m

mysql - Unexpected token limit in JPA -

whenever i'm using limit in jpa query exceptionn thrown.can 1 suggest me alternative way filter record on basis of rownum or roncount. select employeebo a.batchid=:'127'and limit :startponit,:endpoint, you can't use limit in jpa named query, can restrict records row count using setmaxresult();

jpa - How to count all rows returned from a JPASubQuery query via QueryDSL? -

my subquery returns list of servicetypeids , respective counts in table called 'billingdata'. i perform count(*) operation on subqueryresult jpasubquery subquery = new jpasubquery(); subquery.from(billingdata); subquery.where( billingdata.servicetypeid.in(servicetype.type_one.getid(), servicetype.type_one_two.getid()) .and(billingdata.accountid.isnull()) .and(billingdata.price.isnotnull()) .and(billingdata.numberid.eq(numbers.id)));//join condition subquery.groupby(billingdata.servicetypeid); subquery.having(billingdata.count().goe(1)); my count attempt subquery .list(billingdata.servicetypeid, billingdata.servicetypeid.count()) .count().eq(2l); fails error java.lang.illegalargumentexception: org.hibernate.hql.internal.ast.querysyntaxexception: expecting close, found ',' the error occurs when don't specify count. i perform simple count(*), failing find way

javascript - Single click on dynamically added element -

most people know how bind "click' event dynamically added element with $('#main').on('click','.link',function(){ //some code here }); where .link dynamically added element. how code above should when want fire function on first click? yes, know .one() , question merge .one() .on() . jquery docs show .one() , .on() same of 1.7: .one( events [, selector ] [, data ], handler ) .on( events [, selector ] [, data ], handler )

r - How to extract specific values from a DEM (digital elevation model)? -

i'm trying calculate elevation data hiking routes, using open data (avoiding licensing constraints google). i able read public dem of country (with 10-metres resolution) using readgdal (from package rgdal), , proj4string(mygrid) gives me: "+proj=utm +zone=32 +datum=wgs84 +units=m +no_defs +ellps=wgs84 +towgs84=0,0,0" the beginning of .asc file is: ncols 9000 nrows 8884 xllcorner 323256,181155 yllcorner 4879269,74709 cellsize 10 nodata_value -9999 978 998 1005 1008 1012 1016 1020 1025 ..... ..... ..... 400 megabytes of elevation values .... ..... all need pick grid elevation data specific nodes of route, able calculate elevation gain, negative slope, min/max altitude... i bring routes data openstreetmap, using nice package osmar, data table of route this: routeid nodeid lat lon 1 -13828 -8754 45.36743 7.753664 2 -13828 -8756 45.36762 7.753878 3 -13828 -8758 45.36782 7.754344 4

c# - how to invoke an internal void method? -

how invoke refreshmethod of base(aclass) aclass not instantiable. public class aclass { private aclass(); internal void refreshmethod(); } public class bclass:aclass { //i want invoke refreshmethod... how ? thanks,if have idea? } since refreshmethod not static mehtod, have instantiate object of type aclass , invoke usual. however, don't think problem. think public bclass:bclass typo error. might wanted write following: public bclass: aclass { } then since bclass inherits aclass can invoke refreshmethod in bclass .

Unable to consume OpenShift REST API in C#.net -

i want know how can consume openshift rest api c#.net based application. have gone through url https://access.redhat.com/documentation/en-us/openshift_online/2.0/pdf/rest_api_guide/openshift_online-2.0-rest_api_guide-en-us.pdf , in there mentioned example ruby, python , crul. not mentioned .net. have created sample application consuming api. below code - string url = "https://openshift.redhat.com/broker/rest/api"; httpwebrequest request = (httpwebrequest)webrequest.create(url); request.method = "get"; request.contenttype = "application/xml;"; try { webresponse webresponse = request.getresponse(); stream webstream = webresponse.getresponsestream(); streamreader responsereader = new streamreader(webstream); string response = responsereader.readtoend(); console.out.writeline(response); responsereader.close(); } catch (exception e) { con

javascript - How to get selected combobox value and load its corresponding data in html form -

i have combobox loads value data base. want when user select value combobox form should load corresponding values database html form. here code trying: <div class="col-lg-6" style="display:none" id="c" > <form id="aa" action="" method="post" > <br><br><br> <select name="id" id="id" class="span2" style=" width:150px;" onchange="this.form.submit();"> <?php $servername = "localhost"; $username = "root"; $password = ""; $dbname = "valet"; // create connection $conn = mysqli_connect($servername, $username, $password, $dbname); // check connection if (!$conn) { die("connection failed: " . mysqli_connect_er

xsd - How to define mapping in castor for type="java.lang.Objects"? -

public class emp { private java.lang.objects anyvalue; public void getanyvalue(){} // getter public void setanyvalue(){} // setter } <class name="emp"> <map-to xml="emp"/> <field name="value1" type="java.lang.string"> <bind-xml name=""value1" node="element"/> </field> <field name="value2" type="pkg.value2"> <bind-xml name=""value2" node="element"/> </field> </class> xsd empinfo-> 1 ( 1 can used among these either value1 or value 2). how define 1 mapping in mapping.xml file structure emp can have value1 or can have value2 can used castor1.2 , can see in pojo class having object type how make work mapping file ?

vba - Access 2010 Afterupdate - set date on field -

i've got db need on please. i've got tasks database - want set date completed when status combo box marked completed. so combobox called "txtstatus" i'd when set completed updates field in tasks table (called completeddate) populated current date. i've tried doing afterupdate , if statement i'm getting nowhere. thoughts? i sure have sorted this, in case else struggling: private sub txtstatus_afterupdate() if me.txtstatus = true me.completeddate = date else me.completeddate = null end if end sub

jquery - This JavaScript doesn't work in Opera -

i use function in website. http://jsfiddle.net/alkasih/kn2695r7/ it works fine in mozila, in opera, doesn't seem work. can me how make works in browser. because may big deal website. var currentdiv = 0; $(document).ready(function(){ $("#pilihwarna option").click(function(){ $(".bigandsmall").eq($(this).index()).css( "display", "block" ); if($(this).index()!=currentdiv){ $(".bigandsmall").eq(currentdiv).css("display","none");} currentdiv=$(this).index(); }) }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <select id="pilihwarna" name="fgdfd" style="background:none;"> <option>satu</option> <option>dua</option> <option>tiga</option> <option>empat</option> </select> <div class="something

python - Python3 - how to login to web form with hidden values? -

i trying write python script login following site in order automatically keep on eye on of our merchant account details: https://secure.worldpay.com/sso/public/auth/login.html?serviceidentifier=merchantadmin the credentials using read-only, cannot used nefarious, isn't quite working correctly. my code far: import urllib requests import session login_url = "https://secure.worldpay.com/sso/public/auth/login.html?serviceidentifier=merchantadmin" _page = urllib.urlopen(login_url) _contents = _page.read() _jlbz_index = _contents.find("jlbz") _jlbz_start_index = _jlbz_index + 5 _jlbz_end_index = _jlbz_start_index + 41 jlbz = _contents[_jlbz_start_index:_jlbz_end_index] fdt = _contents.find("formdisplaytime") fdt_start_index = fdt + 23 fdt_end_index = fdt_start_index + 13 form_display_time = _contents[fdt_start_index:fdt_end_index] fsh = _contents.find("formsubmithash") fsh_start_index = fsh + 22 fsh_end_index = fsh_start_index + 4

python - How can I import submodules of pandas without importing matplotlib? -

i using pandas 0.14.1 on webserver process reports sql database. i not need plotting facilities, matplotlib always imported. how can import modules need following? df = pd.io.sql.frame_query(query, con=conn) df['colname'].apply(somefunc) df.set_index('colname') print df.to_html() i having add following hack of report generating scripts: import os os.environ['mplconfigdir'] = '/tmp/' before import pandas. can avoid this? here's webserver error log when omit hack: file "/var/www/scripts/myscript.py", line 46, in index\n pandas.io import sql file "/usr/lib/python2.7/dist-packages/pandas/__init__.py", line 41, in <module>\n pandas.core.api import * file "/usr/lib/python2.7/dist-packages/pandas/core/api.py", line 9, in <module>\n pandas.core.groupby import grouper file "/usr/lib/python2.7/dist-packages/pandas/core/groupby.py", line 15, in <module>\n pandas.core.fra

java - Howto properly make dbunit reference a dtd file in the xml dataset? -

how can setup dbunit add me line in xml dataset tag references dtd file? in xml file dataset represetned as <dataset> <table column="value ..." ... but want add reference dtd (or way) <!doctype dataset system "../my.dtd"> <table column="value" ... ... the xml genereated by: flatxmldataset.write(dataset, out); when add line hand, parsing error java.lang.nullpointerexception @ org.dbunit.dataset.xml.flatxmlproducer.isnewtable(flatxmlproducer.java:255) @ org.dbunit.dataset.xml.flatxmlproducer.startelement(flatxmlproducer.java:429) @ com.sun.org.apache.xerces.internal.parsers.abstractsaxparser.startelement(abstractsaxparser.java:509) @ com.sun.org.apache.xerces.internal.parsers.abstractxmldocumentparser.emptyelement(abstractxmldocumentparser.java:182) @ com.sun.org.apache.xerces.internal.impl.dtd.xmldtdvalidator.emptyelement(xmldtdvalidator.java:766) @ com.sun.org.apache.xerces.internal.impl.xmldocument

sql - SqlCommand: Incorrect syntax near the keyword 'OVER' -

i'm trying data database show in asp.net datagrid . it's showing above mentioned error. this select command: public masterjoblist getlistforgrid(int reccount, int pageno, string orderby) { strsql = "with temptable as(select jobdetails.jobcode,jobdetails.currentstatus,mastermodel.name modelnumber,mastermodel.code modelcode,masterbrand.code brandcode,masterbrand.name brandname,masterdevicetype.code devicecode,masterdevicetype.name dtype,row_number() on (order " + orderby + ") rownumber jobdetails jobdetails inner join masterdevicetype on jobdetails.dtype = masterdevicetype.code inner join masterbrand on jobdetails.bcode = masterbrand.code inner join mastermodel on jobdetails.modelnumber = mastermodel.code 1 = 1) select * temptable rownumber between {2} , {3}"; masterjoblist objlist = new masterjoblist(); datatable dt = new datatable(); dt = objdb.getdatatablefromsql(strsql); if

vba - Excel column range highlighting, and insertion of calculation data -

Image
i have following problem: i need highlight period of production order start , finish week, through columns - see in header, there lot of production orders. is possible vba? second problem: each production line has time capacity, production minutes should divided chosen production line weekly capacity end of highlighted period. this need done on button click e.g. vba, or formulas, have no idea place formulas, because whole table , header supposed dynamic - production plan updates weekly. update: here's code, inserts formula in order manufacturing period start finish week, need loop through columns , insert formula according following orders start , finish week. , have no idea how that, appreciated :) sub test() dim rng, rng2, rng3 range dim v1, v2 string x = range("e8") w = range("e11") 'search column or range sheets("forecast").range("d:d") set rng = .find(what:=x, _

mysql - Error: Incorrect syntax near the keyword 'RETURN'.SQLState: S0001ErrorCode: 156 when working with Squirrel client -

iam trying write pl/sql function in squirrel client. when iam tryin excute script in squirrel getting error. please me im new squirrel client. script: create function totalholiday return int total int:= 0; begin select count(*) total dbo.holiday; return total; end; / error: incorrect syntax near keyword 'return'. sqlstate: s0001 errorcode: 156 error occured in: create function totalholiday return int total int:= 0 i tried giving instead of did'nt work.. in sql tab in session properties dialog change statement separator ; / .

asp.net mvc - Need WURFL to work only for mobiles -

at present using below code detecting mobiles, tablets. need restrict code mobile. suggestions can appreciated if provided solution. displaymodeprovider.instance.modes.insert(0, new defaultdisplaymode("mobile") { contextcondition = (context => { var manager = (context.cache[wurflmanagercachekey] iwurflmanager); var cabablities = manager.getdeviceforrequest(context.request.useragent); return cabablities.getcapability("is_wireless_device") == "true"; //return cabablities.getcapability("mobile_browser").contains("opera"); //return cabablities.useragent.contains("opera"); }) }); i use is_wireless_device , is_tablet capabilities isolate mobile phones: if (is_tablet == false && is_wireless_device == true) { //must mobile phone }

php - JSON Export Function -

i have little situation. created function should let me export arrays in json format. this code far: function export( $option_values ) { $json = json_encode( $option_values ); $filename= '_' . date('y-m-d_h.i.s', time()); $filename= '_wp-' . get_bloginfo('version'); $filename= '.json'; header( "content-disposition: attachment; filename='$filename'" ); header( 'content-type: text/json'); header( 'content-length: ' . mb_strlen( $json ) ); header( 'connection: close'); i error message: warning: cannot modify header information - headers sent. how can complete task? somewhere in code outputting something. can intentional (with statements echo , print , etc.), or unintentional loading php-script linefeed after closing php-tag ( ?> ). remove output , go.

spring - TomcatLoadTimeWeaver breaks Log4j 2 -

i have serious problem tomcatloadtimerweaver , log4j , don't know how solve it. i'm using following: tomcat 8 spring framework 4.1.2 log4j 2.1 slf4j 1.7.7 eclipselink 2.5.2 all logging routed slf4j, , i'm using log4j 2.1 logging backend. log4j configured take configuration file non-standard location, specified in web.xml through log4jconfiguration context-param. log4jservletcontainerinitializer configures log4j on webapp start. works fine spring configures tomcatloadtimeweaver . i want use load time weaving eclipselink , added application context: <context:load-time-weaver/> the problem this: once spring registers tomcatloadtimeweaver adding transformer tomcat's webappclassloader , first subsequent attempt log through slf4j causes log4j implicitly re-initialized: since configuration file not in standard location (= root of classpath) error: no log4j2 configuration file found from moment on, log calls not handled (= in way specif

javascript - ExtJS 4.0.7 ItemSelector change "titles" dynamically -

i use itemselector element of extjs 4.0.7. default "titles" of itemselector are: "available" , "selected". can change dynamically? looking @ source code here: http://docs.sencha.com/extjs/4.2.2/source/itemselector.html#ext-ux-form-itemselector-method-setupitems seems there 2 configs can used tell item selector titles use lists: fromtitle , totitle. so imagine if set itemselector custom fromtitle (the title of 'available' list on left) , totitle (the title of 'selected' list on right) properties achieve want. haven't tried myself though... update sorry, above work on ext 4.2.2. had @ ext 4.0.7 , appears need use different configs. config need use called 'multiselects', can set titles. see example below: { xtype: 'itemselector', name: 'itemselector', id: 'itemselector-field', anchor: '100%', fieldlabel: 'itemselector', imagepath: '../ux/images/', s

angularjs - Trim string to a certain word count -

i have description in template <p>{{data.description}}</p> i want trim description word number, first 20 words. have seen many filters trim characters. causes last word break in cases. you need split description string words, using spaces, count it: app.filter('words', function () { return function (input, words) { if (isnan(words)) { return input; } if (words <= 0) { return ''; } if (input) { var inputwords = input.split(/\s+/); if (inputwords.length > words) { input = inputwords.slice(0, words).join(' ') + '\u2026'; } } return input; }; }); first check if parameter number, i'm checking if description longer what trim at, , trim rest. , in view: {{data.description | words:250}}

php - Joins in codeigniter -

i have sql-table products (dranken) , table orders (bestellingen). now want select products , sum of orders product. works fine code: $this->db->select('dranken.id,dranken.naam,dranken.minimum_prijs,dranken.gewicht, sum(bestellingen.aantal) totaalverkocht'); $this->db->from('dranken'); $this->db->group_by('dranken.id'); $this->db->join('bestellingen', 'bestellingen.drank_id = dranken.id',"left"); but want sum of orders before date. $this->db->where('bestellingen.date <=',$wheredate); this works almost. doesn't give me products doesn't have order. added clause. $this->db->or_where('bestellingen.date',null); but have problem. when there order product has date after clause, disappears results. more or less logical, because doesn't match statement. but don't want them disappear. if there no order matches this, want null. i thought left join gives r

ios - How to reliablly detect that a UIViewController has been dismissed -

i need things when viewcontroller dismissed, ie: when “back” pressed when poptorootviewcontroller called parent if in uinavigationcontroller when dismissviewcontroller called parent if presented eg need unsubscribe events, or dimiss presented alert etc. viewwilldisappear not called when poptorootviewcontroller called it’s parent doesnt work. willmovetoparentviewcontroller view controller containment dealloc no when garbage collected. i’m using c# xamarin anyway , doesnt work there. viewdidunload no longer used , never anyway a viewcontroller should not care how presented how find out when dismissed? this seems important, basic requirement. how unsubsribe events model without this, example? this similar question, no answer: can detect when uiviewcontroller has been dismissed or popped? ? this question bit old here conclusion came to: -dealloc - no guarantees on when going called. boilerplate code not reliable. -viewdiddisappear & -viewwilldi

javascript - Live validation instead of on button click validation -

i able use live page validation instead of valid or invalid message showing after pressing submit, code validates email address , when submit clicked input displays below followed valid or invalid, if valid in green , if invalid in red. here code: <!doctype html> <html> <head> <script class="jsbin" src="http:ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"> </script> <meta charset=utf-8 /> <title>email validation</title> </head> <body> <form onsubmit='validate(); return false;'> <p>enter email address:</p> <input id='email' placeholder="example@example.com" size="21"> <button type='submit' id='validate'>submit</button> </form> <br/> <h2 id='result'></h2> <script> function validateemail(email) { var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\&qu

Merge dataframe based on column in R -

hi have following data frame: css_week_end_date bv bvg bvh bvg1 bvg2 bvg3 bvg4 bvh1 bvh2 bvh3 bvh4 bvh5 bvg11 bvg12 bvg13 bvg14 bvg15 bvg16 bvg21 bvg22 bvg23 bvg24 bvg25 bvg31 bvg32 bvg34 1 2012-01-13 28.0 28.3 27.7 28.6 28.7 27.3 28.7 29.5 27.2 26.5 27.8 27.5 34.3 30.7 29.8 25.9 25.7 28.0 29.9 33.9 26.2 32.0 24.4 29.3 24.0 26.9 2 2012-01-20 28.8 29.5 28.4 31.8 29.2 28.2 28.9 30.0 27.8 27.4 28.0 28.7 37.9 34.3 33.3 30.7 27.1 31.6 28.6 32.6 29.3 32.8 24.5 31.5 24.0 27.8 3 2012-01-27 28.2 28.6 27.9 30.7 28.4 27.4 28.0 29.7 27.5 26.9 27.4 28.0 34.8 29.3 32.8 29.5 28.3 31.3 26.9 33.2 27.0 31.3 25.4 30.8 23.4 25.9 4 2012-02-03 28.1 28.2 28.1 30.6 27.6 27.0 27.8 30.5 27.5 25.9 27.5 28.9 37.9 29.1 31.7 30.0 26.8 31.9 26.4 32.3 26.6 31.3 23.5 30.5 21.7 26.3 5 2012-02-10 27.9 28.1 27.7 30.5 27.9 27.0 27.5 30.4 26.8 26.2 26.4 28.5 35.9 30.0 30.8 30.5 25.8 32.9 26.1 32.1 26.2 31.4 25.2

wampserver - WAMP Cannot start in Windows 8 -

i installed laravel on system , using localhost:8000 as server location. had wamp installed on system , using mysql laravel. everything working well. when restarted machine, no longer run wamp. still showing orange icon. when tried connect phpmyadmin, got error: #2002 - no connection made because target machine actively refused it. server not responding (or local server's socket not correctly configured). i checked apache test port 80, , shows server: apache/2.4.9/ (win64) php/5.5.12 can me? might problem? checked mysql error log , found error. fixed error specified in error log , it's working fine.

html - Floating Divs, adjust height to the bigger one -

my problem: i want make floated divs adapt height bigger one. tried many things setting height of .item 100% didn't work. do have set .row display table or there other solution such simple problem? help. .item { background-color: lightblue; padding-bottom: 25px; } .left { float: left; } .right { float: right; margin-left: 50px; } <div class="row"> <div class="item left"> <img src="http://lorempixel.com/400/400"" /> </div> <div class="item right"> <img src="http://lorempixel.com/400/200"" /> </div> <div style="clear: both;"></div> </div> please ignore lorempixel images, included them demonstrating problem i don't think can achieve using css on floated elements. achievable jquery. here's fiddle basically, uses paul irish'

php - Mysql Query to get booking availability for reservation system -

Image
i have 2 database tables 1). table structure 2). booking table i want availability of booking table current date , time. table structure booking table when request table availability date 2014-11-05 , booking time @ 11:00:00 should compare booking table table structure , display available tables. need mysql query perform operation.. select `bookingtable.restaurant_table`, `bookingtable.no_people`, `bookingtable.booking_date`, `bookingtable.bookingend_time`, `bookingtable.bookingstart_time` `bookingtable` left outer join `bookingtable` on `bookingtable.restaurant_table` = `tablestructure.table_no` `bookingtable.booking_date` = "2014-11-05" , `bookingtable.booking_time` = "11:00:00" this do, store dates , times unix timestamps personally

.net - Making a string property ObjectId in MongoDB with C# -

i started mongodb. using c# drivers. c# class looks this: [bsonrepresentation(bsontype.objectid)] public string id { get; set; } public string userid { get; set; } public list<string> filters { get; set; } with class able save , fetch records in mongodb. what want :- instead of creating separate property hold id (in case id property), want make userid property objectid. please note , supplying userid unique string value . possible achieve mongodb? sure possible. just put [bsonid] on userid prop , delete id property

php - PHPMailer Could not instantiate mail function -

i'm using simple code: $mailer = new phpmailer(); $mailer->ismail(); $mailer->ishtml(true); $mailer->charset = 'utf-8'; $mailer->from = 'from@domain.com'; $mailer->sender = $this->title; $mailer->fromname = site_title; $mailer->subject = $this->theme; $mailer->body = $this->text; $mailer->addaddress($this->mail); $result = $mailer->send(); subject, body, fromname, sender same. , works email's, doesn't work other emails same domain names. example, works email: some@mydomain.com, doesn't work someanother@mydomain.com phpmailer send me errorinfo: not instantiate mail function. with cmd can send email on address next command: echo "bla bla" | /usr/sbin/sendmail -f from@domain.com -v someanother@mydomain.com -t -i php ini: sendmail_path = /usr/sbin/sendmail -t -i php ver: 5.5 phpmailer ver: 5.2.7 i'll greatful assistance! the -f in sendmail command should not have space betwe

javascript - transmit data to an angularjs controller -

in view in want include java script file witch contains angular module , angular controller angular.module("company", []).filter('newlines', function(text){ return text.replace(/&/g, '<br />&');}) .controller("democontroller", function ($scope, $http) { $scope.company.title = title // title comme view } ); the data source controller comes view, how can transmit data view controller. in advance updated answer if data in model on server, you'll want load via $http, ngresource, or restangular. $http example (in controller): $http.get('/server/route/12345').success(function(data){ $scope.company.title = data } ) this assumes "/server/route/12345" route on server returns json object want set directly title. also, must inject $http controller (which you're doing in example code). . previous answer in html <input ng-model="v

Android and Nginx Rtmp Module solution -

folks i have android app streams videos wowza server. right now, using libstreaming ( https://github.com/fyhertz/libstreaming ) in android app livestream audio , video wowza. it works fine, building open source solution , stop using wowza (since payed product) , start using nginx-rtmp-module ( https://github.com/arut/nginx-rtmp-module ). problem libstreaming not work rtmp protocol, and, as researched, still couldn't find solution on android side livestream nginx. does know solution that? did implemented it? in advance! you can use ffmpeg convert rtp rtmp on server side. e.g. pipe udp input ffmpeg

sql server - sql aggregating the selection results -

i aggregate of selection results: i have select user result1 from....) returning 2 columns: user results1 **** ******** user1 5 user2 8 i have query select user result2 from....) returning 2 columns: user results2 **** ******** user1 9 user2 5 user3 15 how join results 3 columns make like: user results1 results2 **** ******** ******** user1 5 9 user2 8 5 user3 15 if aren't sure user value exists in both tables, should use full join query tables. full join or full outer join ( outer optional) return rows both tables, if user doesn't exist in 1 of them, still results: select [user] = coalesce(r1.[user], r2.[user]), r1.results1, r2.results2 result1 r1 full join result2 r2 on r1.[user] = r2.[user]; see sql fiddle demo . the problem using inner join require user in both tables. if try use right join or left join - may still not return users , results. if have multiple queries t

ios - How to get back to the app manually after sending sms message -

after sending sms text message receive sms feedback. copied , want paste applications. can not return application - cancel button turns gray - inactive. - (void)messagecomposeviewcontroller:(mfmessagecomposeviewcontroller *)controller didfinishwithresult:(messagecomposeresult)result { switch (result) { case messagecomposeresultcancelled: nslog(@"result: canceled"); [self dismissviewcontrolleranimated:yes completion:nil]; break; case messagecomposeresultsent: nslog(@"result: sent"); break; case messagecomposeresultfailed: nslog(@"result: failed"); break; default: nslog(@"result: not sent"); break; } // [self dismissviewcontrolleranimated:yes completion:nil]; } -(void)sms{ mfmessagecomposeviewcontroller *controller = [[mfmessagecomposeviewcontroller alloc] init] ; if([mfmessagec

graphviz - Render DOT script with multiple graphs to PDF one graph per page -

i have large dot script multiple graphs defined in it: digraph tree0 { ... } digraph tree1 { ... { ... i can render postscript file each graph on separate page calling dot -tps forest.dot -o forest.ps . however, performance reasons prefer pdf on postscript (scrolling , zooming smoother). if use same command pdf instead of ps, resulting file contains 1 of graphs , looks rest written stdout. converting ps pdf ps2pdf did not work, graphs , pages of ps file have varying size resulting pdf file have fixed page size, cutting away parts of graphs. is there easy way multi-graph pdf dot, works ps file? if not, how can convert ps pdf , keep varying page size? what this: dot -tps2 forest.gv -o forest.ps | ps2pdf forest.ps the main difference uses -tps2 . according documentation: ps2 produces postscript output pdf notations. assumed output directly converted pdf format. notations include pdf bounding box information, resulting pdf file can correctly used pdf tool

javascript - incorrect password and receive an alert from program django -

please im new django , want add source code project, when user try connect, if password equal "test" want template showed again user alert javascript says the password incorrect here code: views.py #authentification def home(request): if request.method=='post': admin1=administrateurform(request.post) if admin1.is_valid(): nom=admin1.cleaned_data['login'] pwd=admin1.cleaned_data['passe'] admin1 in administrateur.objects.all(): if admin1.login==nom , admin1.passe==pwd: return redirect(menuprincipal) else: return redirect(home) else: admin1=administrateurform() return render(request,'gpi/index.html',locals()) template: index.html: above of code put 1 : <body id="page-top" class="index"> {% if pwd == "test" %} <script type="text/javascript">a

How to deploy app in this meteor docker image? -

i tring use https://github.com/cycoresystems/docker-meteor run meteor app. i built docker image dockerfile in github repository. one issue have not sure commands run docker image. there not many instructions how use image. if run docker run -i -t ulexus/meteor /bin/bash , there error complaining '/var/www/main.js' not found. but how can copy meteor app source container without running container? maybe need use example in instruction: docker run --rm -e root_url=http://testsite.com -e repo=https://github.com/yourname/testsite -e branch=testing -e mongo_url=mongodb://mymongoserver.com:27017 ulexus/meteor but app repo private 1 rather public in github. not sure how specify username/password in command. ========== the dockerfile used create image this: # docker-version 1.2.0 # meteor-version 1.0.0 stackbrew/ubuntu:trusty run apt-get update ### latest node run apt-get install -y software-properties-common run add-apt-repository -y ppa:chris-lea/node.js run

java - Overriding Function in Polymorphism with different return type -

take following code , me understanding why return type of "mf.display" object type. though "mf" of "myfather" type still return type of "mf.display()" must integer type class myfather { object display() { system.out.println(1000); return 1000; } } class myson extends myfather { @override integer display() { system.out.println(500); return 500; } } public class testinheritance { public static void main(string[] args) { myfather mf = new myson(); integer myint = mf.display(); // error.type mismatch cannot convert object // integer } } the type myfather declares method object display() , when write mf.display() the type of expression object . doesn't matter type of object assigned mf . makes sense because mf have been method parameter: static void usefather(myfather mf) { mf.display(); }

php - pic random images from array -

so have code randomly pics image out of array provided: $bg = array('1.jpg', '2.jpg', '2.jpg',); // array of filenames $i = rand(0, count($bg)-1); // generate random number size of array $selectedbg = "$bg[$i]"; // set variable equal random filename chosen but images folder no matter name , how many there are. i've tried : $dir = "bg_photos/less_saturation/"; $exclude = array( ".",".."); if (is_dir($dir)) { $files = scandir($dir); foreach($files $file){ if(!in_array($file,$exclude)){ echo $file; $bg = array($file); // array of filenames $i = rand(0, count($bg)-1); // generate random number size of array $selectedbg = "$bg[$i]"; // set variable equal random filename chosen } } } but ever gives me last image in array ... can ? cheers chris you can use code. collect files, exept . , .. , array, , ra

oracle - SQL- Finding the users with the Maximun average score -

here schema: create table sample ( userid int, score int ); insert sample values (1,10); insert sample values (1,15); insert sample values (1,20); insert sample values (2,100); insert sample values (2,200); insert sample values (2,500); insert sample values (4,100); insert sample values (4,200); insert sample values (4,500); insert sample values (3,5); insert sample values (3,5); insert sample values (3,10); insert sample values (3,7); insert sample values (3,2); i want find user id's of have maximum highest average score. note there more one! above sample data, answer be: 2 , 4, becuase both have average score of 266.666... . i have working sql problem: select s.userid sample s group userid having avg(s.score) in ( -- gets maximum average score (returns 1 result) select max(average_score) max_average_score ( -- gets average score select avg(s2.score) average_score sample s2 group userid ) ); but think bit inefficient because