Posts

Showing posts from June, 2015

spring mvc - Tomcat 7 with SpringMVC, missing "Server startup" success message -

up until catalina.log used report following: mar 19, 2015 4:49:20 pm org.apache.catalina.core.applicationcontext log info: initializing spring frameworkservlet 'dispatcher1' mar 19, 2015 4:49:20 pm org.apache.coyote.abstractprotocol start info: starting protocolhandler ["http-bio-9080"] mar 19, 2015 4:49:20 pm org.apache.catalina.startup.catalina start info: server startup in 53209 ms which during automated deployment know whether servlet started ok. recently, no longer message in catalina.out. however: there no startup errors logging working the server seems working perfectly, afaict (responds requests) kill -3 doesn't show helpful can see so, what might have caused "server startup" message stop being printed (and yet server accept connections)? in (annotation based) spring mvc, there place can place hook , output custom "servlet startup success" message? the "standard out" may no longer going catalin...

recyclerview - Android back-button working but back via home button not working perfectly -

i have recycler view data. when item clicked, opens new detailsactivity . trouble when come detailsactivity mainactivity back-button (down on natel) working perfectly. when come via home button extends actionbaractivity , load data again scratch. want same return button in natel below. have idea? back code in onoptionsitemselected methord: if (id == android.r.id.home) { intent homeintent = new intent(this, activitymain.class); homeintent.addflags(intent.flag_activity_clear_top); startactivity(homeintent); // navutils.navigateupfromsametask(this); // tried } if understood correctly, instead of starting activity over, call finish() on current activity. basically when click item calling below correct (or along lines)? startactivity(new intent(this, detailsactivity.class); if so, once in detailsactivity , call: if (id == android.r.id.home) { finish(); } that finish detailsactivity shown on mainactivity , return exact same spot at.

python >= operator on classes -

i have question regarding python '>=' behaviour. i have old timestamp class, holds (hour, minute) tuple , offers methods such __eq__ , __gt__ , __lt__ . i refactoring account day , second, , store data total seconds. here implemented __eq__ , __gt__ , __lt__ well. however, further in code using >= operator class , while old class version working properly, new 1 getting typeerror: unorderable types: timestamp() >= timestamp() error. code below: class timestamp(tuple): # old, working version """timestamp, hh:mm tuple supporting comparison , addition""" __slots__ = () def __new__(cls, *args): if len(args) == 1: # tuple entrance hour, minute = args[0] elif len(args) == 2: # hour, minute entrance hour, minute = args[0], args[1] else: raise typeerror('wrong input timestamp') div, minute = divmod(minute, 60) hour += div _, hou...

application settings - Automatically change database connection when creating new queries in SQL Management Studio -

in sql management studio, can query database table right clicking in object explorer , selecting 'select xx rows'. window opens showing query , results. query includes database , scheme names. action not affect selected database connection in toolbar's dropdown list. i use starting point manually writing queries, , it's quicker query tables. regularly change current database connection database created query for. is there way make database connection in toolbar's dropdown list automatically change database start query in object explorer? this solved since release of ssms 2016.

In Ruby or Rails, what is the best way to convert Eastern Time to UTC? -

i'm not referring mydatetime = datetime.now mydatetime.new_offset(rational(0, 24)) or time.now.utc what have text date given in eastern time. i can convert text date datetime. let's call eastern_date_time . now, have variable containing datetime, nothing knows it's eastern besides us. converting ourselves quite onerous. if date in daylight savings time (dst) (march 8 november 1st year), we'd have add 4 hours our eastern_date_time var utc, , if date in standard time (st) we'd have add 5 hours our eastern_date_time variable. how can specify have eastern datetime, , convert utc... determine if date in dst/st, , apply 4 or 5 hours properly? i want convert sort of date utc, storage in database. edit: using `in_time_zone', i'm unable convert eastern text time utc. how can achieve objective? example... text_time = "nov 27, 2015 4:30 pm" #given eastern myeasterndatetime = datetime.parse text_time # => fri, 27 nov 2015 16:30:00 ...

java - Doubly-Wildcard Generic Type error -

Image
i trying define operator ++ custom map type this: @override public mutablemap<k, v> $plus$plus(map<? extends k, ? extends v> map) { hashmap<k, v> copy = this.copy(); map.$plus$plus$eq(map); return copy; } the ++= operator defined this: public void $plus$plus$eq(map<? extends k, ? extends v> map); however, compiler complains on map.$plus$plus$eq(map); line, following crazy error: the method $plus$plus$eq(map<? extends capture#10-of ? extends k, ? extends capture#11-of ? extends v>) in type map<capture#10-of ? extends k,capture#11-of ? extends v> not applicable arguments (map<capture#12-of ? extends k,capture#13-of ? extends v>) as can see in screenshot, none of solutions provided eclipse work, yet alone make sense: i have been working java generics quite while now, having developed own generic type system custom programming (whose library trying code), have never had error before. edit : interestingly, cas...

c# - Ozeki is not returning other records -

i'm doing ozeki messenger project using c#. want retrieve more 1 record table. returning me first record only... here's code. idea doing wrong guys? protected void page_load(object sender, eventargs e) { try { string x; string y; string z; string sendernumber, receivernumber, message; sendernumber = request.querystring.get("sender"); receivernumber = request.querystring.get("receiver"); message = request.querystring.get("msg"); sqlconnection connection = new sqlconnection(); sqlcommand command = new sqlcommand(); sqldatareader reader; connection.connectionstring = constring; command.connection = connection; command.commandtext = "select p_name, p_parking tblpharmacy code = '" + message + "'" ; connection.open(); reader = command.executereader(); string data = ...

java - Ebean enhancement ignores a model -

we using avaje-agentloader enhance our ebeans. ebeans in same package. including loader, agent & base ebean library in our project (via sbt): "org.avaje" % "avaje-agentloader" % "1.1.2", "org.avaje.ebeanorm" % "avaje-ebeanorm" % "4.5.5", "org.avaje.ebeanorm" % "avaje-ebeanorm-agent" % "4.5.2", however, when loader runs enhancement, skips 1 ebean. each ebean annotated @entity , extends com.avaje.ebean.model . there seem no differences between ones enhanced , 1 not. there no includes, or extends, etc. basically, i'm wondering if has run across issue in past, or has insights. things we've tried: specifying actual classes enhanced via serverconfig.setclasses(...) specifying pakages analyse/enhance via serverconfig.addpackage(...) or setpackages(...) not specifying @ , having loader analyse all. we've set break-point @ transformer.transform , bean in questio...

find the rank of an element in a vector in matlab -

i have task combine 2 vectors in following way. input 2 vectors first 1 indicating indices of dividors of groups , second 1 indicating elements trying classify. example, vector [1,3,5,9] means first group consists of 1, second group consists of 2 , 3, third group consists of 4 , 5, , forth 1 consists of 6, 7, 8 , 9, etc. in case, if second vector [2,4,6], output [2,3,4]. know how impliment in matlab loops. question is: there anyway without loops? many time , attentions. edit: scalevtr=[1,3,5,9]; >> eltvtr=[2,4,6]; >> j=1; output=[]; >> i=1:size(eltvtr,2) while(true) if eltvtr(i)<=scalevtr(j) output= [output,j]; break; else j=j+1; end end end >> output output = 2 3 4 qq = [1 3 5 9]; qq2 = [2 4 6]; ceil(interp1(qq,1:numel(qq),qq2))

c# shift the elements of array by 1 with for loop -

im making game in c# , have scoreboard top 5 players. made work, @ least thought did... script enter value of player's name , score in array, there problem. delete last one, if make best score become #1, old #1 deleted , #2 #2 unless make result place. question how move array 1 place (it depends on player's result) , delete last string of it? edit: can't use list, because im doing stuff array. this: string topscores = sbname[i].substring(4); int topscoreint = convert.toint32(topscores); if need use array instead of list (which has handy insert method), work way last value forward, replacing each it's predecessor's value, until 1 want update: int place = 2; // meaning 3rd place, since arrays zero-based // start @ end of array, , replace each value 1 before (int = array.length - 1; > place; i--) { array[i] = array[i - 1]; } // update current place new score array[place] = score;

php - Input::file() returns nothing -

i trying upload image using laravel frame work facing difficulty problem $file=input::file(); returns nothing , after when write $filename = $file->getclientoriginalname(); error call member function getclientoriginalname() on non-object please me here html code <form action="enter-input" method="get" enctype="multipart/form-data"> <input name='image' style="width:194px;"type='file' class='form-control'> <input type="submit" class="btn btn-primary" value="submit"> </form> here controller code $file= input::file('image'); $filename = $file->getclientoriginalname(); the first line returns nothing , second line shows error call member function getclientoriginalname() on non-object me guys stuck in problem , new laravel. change method="get" method="post" .

algorithm - Graph partitioning with constraints -

given graph g(v,e) , set of pairs p = {[vi,vj]...} i'm looking algorithm partition graph (into smallest possible number of path-connected patches) such 2 vertices make pair in p belong different partitions. any or correct-direction-pointing appreciated!

python - Spark MLlib - trainImplicit warning -

i keep seeing these warnings when using trainimplicit : warn tasksetmanager: stage 246 contains task of large size (208 kb). maximum recommended task size 100 kb. and task size starts increase. tried call repartition on input rdd warnings same. all these warnings come als iterations, flatmap , aggregate, instance origin of stage flatmap showing these warnings (w/ spark 1.3.0, shown in spark 1.3.1): org.apache.spark.rdd.rdd.flatmap(rdd.scala:296) org.apache.spark.ml.recommendation.als$.org$apache$spark$ml$recommendation$als$$computefactors(als.scala:1065) org.apache.spark.ml.recommendation.als$$anonfun$train$3.apply(als.scala:530) org.apache.spark.ml.recommendation.als$$anonfun$train$3.apply(als.scala:527) scala.collection.immutable.range.foreach(range.scala:141) org.apache.spark.ml.recommendation.als$.train(als.scala:527) org.apache.spark.mllib.recommendation.als.run(als.scala:203) and aggregate: org.apache.spark.rdd.rdd.aggregate(rdd.scala:968) org.apache.spark.ml.r...

c++ - Chessboard Class give me error -

this class chessboard . how can resolve error compiler give ? thanks the error " expected unqualified-id before '[' token|" #ifndef scacchiera_h_included #define scacchiera_h_included class chess { public: private: unsigned int rows = 0; unsigned int columns = 0; int[][]mat = new int[rows][columns]; }; #endif // scacchiera_h_included with of user changed code class chess { public: chess(unsigned int a):mat(mat[a][a]){}; private: int mat[0][0]; }; but compiler gives me error incompatible types in assignment of 'int' 'int [0][0]'| int[][]mat = new int[rows][columns]; should int mat[rows][columns]; if rows , columns constants. or class chess { public: chess(int r, int c) { rows = r; columns = c; mat = new int*[rows]; for(int = 0; < rows; ++i) mat[i] = new int[columns]; } private: unsigned int rows = 0; unsigned int columns = 0; i...

c# - sorting and searching of data in table not working -

i follow tutorials on sorting , searching from: http://www.asp.net/mvc/overview/getting-started/getting-started-with-ef-using-mvc/sorting-filtering-and-paging-with-the-entity-framework-in-an-asp-net-mvc-application when try , sorting not working. want sorting on 3 fields, username , user_role , date_of_register . displayed data not sorting in order (just displaying data) . please can me doing wrong. //controller code: public actionresult displayusers(string sortorder, string searchstring) { viewbag.namesortparm1 = string.isnullorempty(sortorder) ? "name_desc" : ""; viewbag.namesortparm2 = string.isnullorempty(sortorder) ? "role_desc" : ""; viewbag.datesortparm = sortorder == "date" ? "date_desc" : "date"; var users = in db.app_user select a; switch (sortorder) { case "name...

unlink() not working while I try to remove an image PHP -

i trying remove image directory using unlink() function. if (file_exists($oldpicture)) { unlink($oldpicture); echo 'deleted old image'; } else { echo 'image file not exist'; } the value of $oldpicture ../images/50/56/picture.jpg . the follow block of code runs without errors when check directory image still there. am doing wrong here? thanks "@fred-ii- yeah right, getting denied permission...any idea how can fix this? p.s. error reporting amazing, me that! – bigrabbit" use chmod on file before unlinking it: if (file_exists($oldpicture)) { // last resort setting // chmod($oldpicture, 0777); chmod($oldpicture, 0644); unlink($oldpicture); echo 'deleted old image'; } else { echo 'image file not exist'; } http://php.net/manual/en/function.chmod.php a last resort setting using 0777 in commented code. "how use var_dump() check folder/file permissions?" it's n...

replace - Replacing multiple while keeping a number that changes the same on each line -

i have list 1. md (1) 2. md (2) 3. .... 4. md (10) goes on line while want make md line (1) .... md line (10) , on. can use replace feature on notepad++ this? "find" md (put kind of placeholder here find numbers keep them same) , replace" md line (same place holder). i've tried using number sign place holder didn't work. thank in advance. replace ^([0-9]+. md) with md line pattern anchored beginning of line via ^ , 1 or more digits, followed period, space , md .

java - How to pack 2 long values in one single string and get them back -

please me ideas, how in java: input: long id1 = 123456 (any long value) long id2 = 4490390904 (any long value) output: a94dhjfh4990-d49044 (whatever, string) and then, based on output id1 , id2 . so, kind of enconding, hashing. not obvious (like 123456###4490390904) don't want encryption level... wonder if there can use provided java library (so no 3rd party libraries) or algorithms (code snippets). update similar : https://github.com/peet/hashids.java a shot in dark, since not precise on requirements. following provides 2 functions encode both value in string , decode string array of long . each long value formatted in hexadecimal. public class idencoder { static final string sep = "-"; public static string encode(long id1, long id2) { return long.tohexstring(id1)+sep+long.tohexstring(id2); } // assume paramater @ right format. // several exceptions can thrown. add exception handling necessary... public...

nullpointerexception - BlueJ call to public method null pointer exception (java.awt.container) -

Image
normally instantiate panels inside of makeframe method, instead i'm required use 2 separate methods of createbuttonpanel() , createtextpanel(). problem being cannot work out how let makeframe use these when not inside of it's own method, , when i'm used javascript i've done looks should work, doesn't. from screenshot, creating local variable in createbuttonpanel method making unavailable (null) add method of container. public void createbuttonpanel() { jpanel buttonpanel = new jpanel(); } instead, make assign new instance class level variable won't null when passing add method of container. public void createbuttonpanel() { this.buttonpanel = new jpanel(); // assigning class member } this should fix problem. also, advised move initializer method constructor calls , make private there no use of making public in case. hope helps.

ios - Facebook SDK 4.0: Asking publish_actions -

i using fbsdkloginbutton logging in through facebook in app. define readpermissions as; nsarray *permissions = [nsarray arraywithobjects:@"public_profile", @"email",nil]; self.loginfbbtn.readpermissions = permissions; the above goes well. if need ask permissions post timeline , want have access " publish_actions " permissions, there way ask these without provoking fbsdkloginmanager , because way given in facebook docs : if ([[fbsdkaccesstoken currentaccesstoken] hasgranted:@"publish_actions"]) { // todo: publish content. } else { fbsdkloginmanager *loginmanager = [[fbsdkloginmanager alloc] init]; [loginmanager loginwithpublishpermissions:@[@"publish_actions"] handler:^(fbsdkloginmanagerloginresult *result, nserror *error) { //todo: process error or result. }]; } apparently way can invoke " publish_actions " app. want use without fbsdkloginmanager . please help, need rolling. so update: by of wizk...

java - Add Javascript to jax-rs endpoint -

i need return html code jax-rs endpoint. followed tutorials , got know can return string. problem need add javascript function returning html. how can it? my code snippet. return "<html><body>hello world</html></body>" here can add javascript function inside returning string. can follow same steps following when declaring javascript inside html page. provide example: return "place script here hello world" make sure put script inside tags.

java - ListView items not changing text colour -

Image
i've used colouring adapter change text colour of list view items after debugging app crashes , error don't know how fix. know problem lies line 77 reason not clear me. ideas on how rectify this? package com.apptacularapps.exitsexpertlondonlite; import android.content.context; import android.os.bundle; import android.support.v7.app.actionbaractivity; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import android.widget.adapterview; import android.widget.arrayadapter; import android.widget.listview; import android.widget.textview; public class stationchooseractivity extends actionbaractivity { listview list_linechooser; string[] listcontent = { "bakerloo line", "central line", "circle line", "district line", "hammersmith & city line", "jubilee line", "metropolitan line", "northern line...

perl file test operators and "$_" -

i'm going through o'reilly's "intermediate perl". -s used so: print map { " $_\n" } grep { -s < 1000 } @argv; which gives warning: warning: use of "-s" without parentheses ambiguous unterminated <> operator though, when put parentheses around -s works charm. not sure if perl version related or mistype authors. perl version: v5.18.2 built darwin-thread-multi-2level what causing issue , can correct it? < can start of term readline / glob shortcut. print "[$_]\n" < b c >; < can start of infix operator numeric less-than operator. print "foo\n" if $x < 3; -s can legally followed both, perl has guess 1 wanted when sees < . using of following instead of -s solves issue since none of them can followed term: -s($_) -s() (-s)

html - PayPal Donation Button - How can I remove the 'recurring donation (monthly)' option? -

i've included paypal donate button on website. when visitors click through, sent paypal page can log in , input donation amount. however, given option make donation monthly recurrence. isn't suitable our site , wondered how remove tick box? image here: http://imgur.com/gywbhhl paypal suggested if wanted remove option button, 'would need edit html code option taken out , no longer available' visitors. the unprotected code reads follows: <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top"> <input type="hidden" name="cmd" value="_donations"> <input type="hidden" name="business" value="identification number"> <input type="hidden" name="lc" value="gb"> <input type="hidden" name="item_name" value="donation fund name"> <input type="hidden" ...

c++ - Instance object with a array -

i'm working in c++ class : class foo { int ; foo (){ = rand(); } foo(int b){ a=b } }; int main(){ foo * array = new foo[10]; //i want call constructor foo(int b) // foo * array = new foo(4)[10]; ???? } please , :d you should first correct syntax (put ; , make constructors public etc). then, can use uniform initialization in c++11, like #include <iostream> class foo { public: int a; foo () { } foo(int b) { = b; } }; int main() { foo * array = new foo[10] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; std::cout << array[2].a << std::endl; // ok, displays 2 delete[] array; } you should try avoiding altogether raw arrays, use std::vector (or std::array ), or other standard container instead. example: std::vector<foo> v{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; or std::vector v(10, 4); // 10 elements, initialized 4 no need remember delete memory etc.

svn - "Requests for a collection must have a trailing slash on the URI" error -

i have svn server (visualsvn server 3.2), works fine, in windows event viewer found many requests collection must have trailing slash on uri. [301, #175002] [client 127.0.0.1] could not fetch resource information. [301, #0] [client 127.0.0.1] what problem? the question should asked @ serverfault, not stackoverflow. the error-level event logged when user navigates url https://svn.example.com/svn/myrepo (without trialing slash). this not problem, fact visualsvn server writes error-level event might confusing. guess can improved in future visualsvn server updates, thank report!.

django - Virtualenv Python Windows -

i'm having problems featured in question: pip python 2.7 , 3.4 on windows machine but question have this. when use virtualenvwrapper , mkvirtualenv , lsvirtualenv , , rmvirtualenv work. work on 'venv name' doesn't anything. , when don't use wrapper, doing venvname\scripts\activate activates virtualenv prefix before name in shell white instead of green, not sure means. main problem this, , may related of other stuff. when begin install stuff using either requirements.txt or manually installing things via pip, of installed packages end in c:\python27\lib\site-packages rather c:\python34\lib\site-packages or whatever. assume has pip3 being located @ c:\python27\site-packages rather c:\python34 . also, when load virtualenv , begin install things uses packages in c:\python27\lib\site-packages instead of installed virtualenv's site-packages folder. causes lots of issues. example earlier installing django , specifying 1.8, kept sayi...

php - Determine if PDOStatement object originated from PDO::query() or PDO::prepare() -

both pdo::query() , pdo::prepare() return pdostatement object 2 used differently: a pdostatement pdo::query() ready immediate use fetch() or fetchall() a pdosatement pdo::prepare() needs populated bind() run execute() before can use fetch() is there way can differentiate between pdosatement came pdo::query() versus 1 came pdo::prepare() ? i'm not entirely sure can tell them apart. both pdo::prepare() pdo::query() return pdostatement object doesn't appear have methods determining origin. that being said, debugdumpparams() function include parameter count in output, you'd need manually capture , parse output text obtain it.

sql - Java HQL Issues with GroupBy/Having Query -

i have make hql using hibernate find out sum of frequencies of museum vigilants museums, museum vigilants occupy same shift per hour - want find mike jones frequency in shift. this have far: select v, m.freq/count(m.id) vigilant v inner join v.museums m group m.id having count(m.id) > 0 , v.forename = 'mike jones' this me list of objects in hibernate vigilant , number - numbers have gotten correct , wish sum them - i.e. want sum(m.freq/count(m.id)) , return hql hibernate. i've tried multiple ways, devised sql solution following path , subqueries hql doesn't allow subqueries in clause set me this. have no idea how because adding sum or removing v select statement doesn't work. any how can work? thanks. you can't group whole entities : neither group clause nor order clause can contain arithmetic expressions. hibernate not expand grouped entity, cannot write group cat if properties of cat non-aggregated. have list non-aggregated...

javascript - jquery Datatable: get order direction from moment-plugin -

i trying order direction of column moment-plugin (the column contains dates) sort '-'-entrys @ bottom of sorting (no matter if asc or desc) (see example below) i have following code: function($, moment) { $.fn.datatable.moment = function ( format, locale ) { var types = $.fn.datatable.ext.type; // add type detection ('-' allowed) types.detect.unshift( function ( d ) { if(d === '-') { return 'moment-'+format; } return moment( d, format, locale, true ).isvalid() ? 'moment-'+format : null; }); // add sorting method - use integer sorting types.order[ 'moment-'+format+'-pre' ] = function ( d ) { return d === '-' || d === null ? infinity : parseint( moment( d.replace ? d.replace(/<.*?>/g, '') : d, format, locale, true ).format( 'x' ), 10 ); }; }; } when following, sorting doesn't work column @ all ... // add sorting method -...

c++ - execlp hanging after execution -

i'm calling external binary ( webots simulator ) in cpp program, calling fork() , execlp() , takes on argument path of specific file. there no issues when path file valid , file exists, however, when point invalid file, expected could not open file: 'file.wbt' but child process not exit . though might due webot's internal code , how handles such errors, however, if call webots file.wbt on system's bash shell same error gets thrown but process ends should . a compilable section of program: #include <iostream> #include <fstream> #include <stdio.h> #include <sys/types.h> #include <signal.h> int start_webots(const char* world){ //starting webots child process known pid int pid = fork(); if (pid == 0){ printf("starting webots..."); execlp("/usr/bin/webots","webots",world,null); printf("finished executing webots"); exit(1); } else printf(...

c# - Combining generic methods and overloads -

i have following method: public void set<t>(ienumerable<t> records) { foreach (var record in records) { set(record); } } i either 1 of following set methods called, depending on t : public void set(recordtype1 record) { // recordtype1 logic } public void set(recordtype2 record) { // logic applicable recordtype2 } hopefully, can see i'm attempting allow set method called inferred @ runtime. "isn't working" (i.e. won't compile it's expecting recordtype1 ). question how can keep kind of structure without testing type before sending records off set method? why don't create interface ( irecordtype ), allow recordtype1 , recordtype2 inherit it, move main logic of each set method interface. public interface irecordtype { void set(...); } public void set(ienumerable<irecordtype> records) { foreach (var record in records) { record....

sql server - How do I retrieve a count of timestamps over the first hour of each shift? -

okay 1 might tricky explain.. what trying count number of loads within first hour of each shift. mean if loading starts @ 0630, want count number of times finished loading 0630 0700. if loading started @ 0705, count 0705 0800 etc. here's have work far: select est.shift_date ,case est.shift_ident when '1' 'd' when '2'then 'n' end shift_ident ,min(est.start_timestamp) start equip_status_trans est join equip_status_code esc on esc.status_code est.status_code est.shift_date >= (getdate() - 180) , esc.status_desc 'lu loading' , est.equip_ident in ( 's803' ,'s804' ) group est.shift_date ,est.shift_ident ,est.equip_ident ignoring filters, gets me date, shift identity, , start timestamp of loading each shift. i have select est.shift_date ,case est.shift_ident when '1' 'd' when '2' 'n' e...

javascript - How can I set daternagepicker to allow local datetime selection instead of utc -

i using dan grossman's daterangepicker display range of datetime users selection. unfortunately datetime selected , passed backend in utc , such being saved database. need set daterangepicker display local time based on time zone selected earlier. know how deal this? tried adding timezone option ("01:00") doesn't seem make difference. $('form .date_available').daterangepicker({ timezone: "01:00", timepicker: true, timepickerincrement: 30, mindate: currentdate, mintime: currenttime, format: 'mm/dd/yyyy h:mm a', formattime: 'h:mm a', formatdate: 'mm/dd/yyyy' }); you need set time zone server in config/application.rb config.time_zone = 'pacific time (us & canada)' or have timezone change users can add following application_controller.rb, , should save in settings user timezone: around_filter :user_time_zone def user_time_zone(&block) if user_signed_in? time.use_zone(curr...

MongoDB best practices for choosing _id field type -

i'm write webapp based on node.js , mongodb. webapp have users stored in table users. question quite simple: since username unique, idea change _id field type objectid string contain username? i think more convenient , somehow reduce number of requests needed perform several tasks. typically if use username _id, references user in other tables directly give me username , not objectid i'd need convert intelligible name before displaying it. moreover having 2 different fields (objectid _id + username) require 2 indexes speed lookups either on ids or on usernames , require more space in database. last, if understood correctly documentation , on sharded environment, mongodb able ensure uniqueness of _id field. but, may miss things i'd realize (and regret) later. can please shed light on this? thanks!

email - Linux: Crontab Job without Interfering with Sys Admin's Jobs? -

i need create new crontab job in redhat linux environment. have sudo access don't think can on system--some higher level sys admins, example, disable firewall changes make. so here crontab command: crontab e and brings screen like: 33 2 * * * /usr/bin/cu-firewall update > /dev/null 2>&1 30 1 * * * /root/update_atbi_website > /dev/null 0 4 * * * /home/prov356/scripts/opnforumbackup i want not send email , have done in local vm: mailto="" # execute 15 minute */15 * * * * perl /db_xenia/pl/get_usgs.pl question: if append above existing crontab info prevent sending of emails sys admin too? don't want trouble! perhaps, append /dev/null after perl commands? thanks. never mind: per @basile's comment, didn't need sudo. logged in non-sudo , ran crontab -e ; time there no sys admin entries. entered own configs, saved, , cronjob seems running fine. thanks.

css - Using Bootstrap Glyphicons -

i trying use glyphicons twitter bootstrap. want use pseudo-element :after instead of before. .glyphicon.glyphicon-search:before above works fine. .glyphicon.glyphicon-search:after above not work. what doing wrong? it's because glyphicon classes intended use :before , not :after. if check out source code in css you'll see. example be: .glyphicon-asterisk the css looks so: .glyphicon-asterisk:before {content: "\2a";} if this: .glyphicon-asterisk:before, .glyphicon-asterisk:after {content: "\2a";} you able thing. you'll need create new class , add content this: .glyphicon-asterisk:after {content: "\2a";}

javascript - How to bind style attribute top and left in rivet.js -

how bind object such i: var item = function() { this.x = 10; this.y = 10; } var = new item(); to div has style " position: relative; left: {x}; top: {y} " using http://rivetsjs.com/ you need create custom binder that: rivets.binders['style-*'] = function(el, value){ el.style.setproperty(this.args[0], value); }; ... ... <p rv-style-left="item.x" rv-style-top="item.top">

Excel If Or Statement not working -

Image
i have 2 columns of data , wanted identify swap candidate based on 2 criteria: if first column < 0.5 or if first column divided second column < 10. and here's formula =if(or(e2<0.5,(e2/f2)<=10),"swap candidate"," ") (the first , second column in column e , f in workbook). function doesn't work should. instead returns values true while it's not. example in highlighted cell. i ran formula evaluate highlighted cell. , shows false after evaluating or statement return value if true. the numbers stored in correct format. don't what's going on it. me out please? in example given value in yellow column f <=10 therefore return true correct - unless i'm missing something?

vb.net - Hexadecimal value 0x00, is an invalid character OpenXML SDK -

i have following function takes datatable , builds excel spreadsheet data using openxml sdk, , returns byte array. 9 out of ten times, works great, occasionally, error out following message: '.', hexadecimal value 0x00, invalid character. here function: private function buildexcelsheet(byref tbl datatable) byte() dim memstream new memorystream memstream.position = 0 dim spreadsheetdocument spreadsheetdocument = spreadsheetdocument.create(memstream, spreadsheetdocumenttype.workbook) ' add workbookpart document. dim workbookpart workbookpart = spreadsheetdocument.addworkbookpart try workbookpart.workbook = new workbook catch ex exception debug.writeline(ex.message) end try ' add worksheetpart workbookpart. dim worksheetpart worksheetpart = workbookpart.addnewpart(of worksheetpart)() try worksheetpart.worksheet = new worksheet(new sheetda...

android - How to display multiple info windows for multiple MapView markers at a time? -

i developed sample application show multiple markers on mapview . i'm able display 1 info window 1 marker @ time. possible display multiple info windows multiple markers @ time on mapview ? you can customize layout of info window looks there more more.

Freeing an array of mpc_t in C -

i'm new c programming , couldn't find solution problem. although code works (i've been able include in other program), when tries free memory assigned calloc(), returns following error: free(): invalid next size (normal): followd appears memory address. i'm using mpc libraries (for arbitrary precision complex numbers). smallest program repeats error: #include <stdio.h> #include <stdlib.h> #include <gmp.h> #include <mpfr.h> #include <mpc.h> int n = 10; int precision = 512; int main(void) { mpc_t *dets2; dets2 = (mpc_t*)calloc(n-2,sizeof(mpc_t)); (int = 0; i<=n-2; i++) { mpc_init2(dets2[i],512); //initialize complex numbers mpc_set_str(dets2[i],"1",0,mpfr_rndn); //set numbers 1 } free(dets2); //release memory occupied numbers return 0; } thanks help! your loop breaks after i == n-2 , should break before. condition in loop should i<n-2 instead of i<=n-2 . so...

git filter branch - Remove contents of a commit from a git repo after its already been git -rm'ed and pushed -

so had user add , remove large directory of files in workspace 2 distinct commits. pushed changes central repo , end user looks noop. problem our central repo has jumped 50x in size because of this. have tried several things filter branch , not working. so folder added @ root level. name of .core i have tried following filter-branch based on links: http://www.somethingorothersoft.com/2009/09/08/the-definitive-step-by-step-guide-on-how-to-delete-a-directory-permanently-from-git-on-widnows-for-dumbasses-like-myself/ http://dound.com/2009/04/git-forever-remove-files-or-folders-from-history/ remove directory permanently git the final commands have tried looks this: git filter-branch -f --index-filter "git rm -rf --cached --ignore-unmatch .core" --prune-empty --tag-name-filter cat -- --all rm -rf .git/refs/original rm -rf .git/refs/logs git reflog expire --expire=now --all && git gc --prune=now --aggressive the resulting output says ref unchanged. ...

python - Using generators to perform an inorder tree traversal on a BST -

so given following: def inorder(t): if t: inorder(t.left) yield t.key inorder(t.right) x = [ n n in inorder(r) ] x contains root node, why? here's full code; note bst implementation correct, it's inorder() implementation generators somehow wrong. class stree(object): def __init__(self, value): self.key = value self.left = none self.right = none def insert(r, node): if node.key < r.key: if r.left none: r.left = node else: insert(r.left, node) else: if r.right none: r.right = node else: insert(r.right, node) def inorder(t): if t: inorder(t.left) yield t.key inorder(t.right) r = stree(10) insert(r, stree(12)) insert(r, stree(5)) insert(r, stree(99)) insert(r, stree(1)) tree = [ n n in inorder(r) ] print tree inorder(t.left) creates generator object, doesn't run it. need itera...

typeahead.js - Color of the .tt-suggestion.tt-cursor can't be changed -

i have change color of font of .tt-suggestion.tt-cursor , remove it's background. the following css doesn't work: .tt-suggestion.tt-cursor { color: #009bc6; } cause this have been changed in typeahead version 0.11, moving mouse on .tt-suggestion element no longer triggers .tt-cursor class, see this issue #1195 . solution // workaround: add support tt-cursor style on mouseenter/mouseleave $('.twitter-typeahead') .on('mouseenter', '.tt-suggestion', function(e){ $('.tt-cursor', $(this).closest('.tt-menu')).removeclass('tt-cursor'); $(this).addclass('tt-cursor'); }) .on('mouseleave', '.tt-menu', function(e){ $('.tt-cursor', $(this).closest('.tt-menu')).removeclass('tt-cursor'); });

meta tags - I can't get Google Webmaster Tools to verify my site -

i want add domain lslib.com google webmaster tools need verify domain. i've tried meta tag option, google analytics option , html file option, nothing seems work. if open url above , @ source, first meta tag mirrors webmaster tools telling me: <meta name="google-site-verification" content="xwd_tw7b5saxputdgsblb3zaieyeltgmgou8wdzq870" /> only, why not work? if meta tag validation not working, can try html file verification: verify site uploading html file: on webmaster tools home page, click manage site button next site want, , click verify site. if html file upload not visible on recommended method tab, click alternate methods tab. select html file upload, , follow steps on screen. once html file has been uploaded root of website, click verify. check link form more information: https://support.google.com/webmasters/answer/35658?hl=en

javascript - Deploy Meteor app with CDN links for CSS/JS -

i have following packages added meteor project: twbs:bootsrap fortawesome:fontawesome when deploy application, there way use settings.json swap out package files use cdn links instead: //maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css //maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js //maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css i understand how include cdn links in project (like this question ), i'm more interested in having ability develop locally packages , take advantage of cdn when deployed.

python - Summary not working for OLS estimation -

i having issue statsmodels ols estimation. model runs without issues, when try call summary can see actual results typeerror of axis needing specified when shapes of , weights differ. my code looks this: from __future__ import print_function, division import xlrd xl import numpy np import scipy sp import pandas pd import statsmodels.formula.api smf import statsmodels.api sm file_loc = "/users/niklaslindeke/python/dataset_3.xlsx" workbook = xl.open_workbook(file_loc) sheet = workbook.sheet_by_index(0) tot = sheet.nrows data = [[sheet.cell_value(r, c) c in range(sheet.ncols)] r in range(sheet.nrows)] rv1 = [] rv5 = [] rv22 = [] rv1fcast = [] t = [] price = [] time = [] retnor = [] model = [] in range(1, tot): t = data[i][0] ret = data[i][1] ret5 = data[i][2] ret22 = data[i][3] ret1_1 = data[i][4] retn = data[i][5] t = xl.xldate_as_tuple(t, 0) rv1.append(ret) rv5.append(ret5) rv22.append(ret22) rv1fcast.append(ret...

Powershell install Java silently -

i need install new java update silently. have these arguments installation: install_silent=1 static=0 auto_update=0 web_java=1 web_java_security_level=h web_analytics=0 eula=0 reboot=0 nostartmenu=0 sponsors=0 and tried: start-process -wait '\\srv\netlogon\java\jre-8u45-windows-i586.exe' -argumentlist '/s install_silent=1 static=0 auto_update=0 web_java=1 web_java_security_level=h web_analytics=0 eula=0 reboot=0 nostartmenu=0 sponsors=0' and also: $arguments = @( '/s', "/v/qn `"install_silent=1 static=0 auto_update=0 web_java=1 web_java_security_level=h web_analytics=0 eula=0 reboot=0 nostartmenu=0 sponsors=0 /l \`"c:\temp\java_install.log\`"`"" ) $proc = start-process "\\srv\netlogon\java\jre-8u45-windows-i586.exe" -argumentlist $arguments -wait -passthru if($proc.exitcode -ne 0) { throw "error" } and both version has prompt dialog. how install silently? i found solution in ...