Posts

Showing posts from April, 2011

excel - Concatenate certain cells from column based on two conditions -

i have excel worksheet of different football teams , squads, , information individual players. trying is, table, concatenate cells , place data cell on more simpler table other users see, instance, show players injured in teams. i'll explain: f_team | player | injured liverpool coutinho 0 liverpool benteke 1 liverpool sturridge 1 man u rooney 1 chelsea sterling 0 so in other table looks this f_team | players injured liverpool benteke, sturridge man u rooney so data can grouped individual teams, stuck trying concatenate properly. i have tried using vba, comes #name? , don't know why, , don't know if doing correct. function concatenateif(criteriarange range, criteriarange2 range, _ condition variant, condition2 variant, concatenaterange range, _ optional separator string = ",") variant 'update 20150414 dim xresult string on error resume next if criteriarange.count <> concat

Can Scala select a concrete implicit when mapping a list of concrete objects inheriting a common trait? -

expanding on bit further on previous similar question posted yesterday employee , manager both extend person . i've defined implicit "converter" objects both subclasses. i created list of type list[product serializable person] contains 1 of each concrete class. import scala.reflect.classtag object example { trait person { def age: int } case class employee(age: int) extends person case class manager(age: int) extends person class converter[t] { def convert(t: t) = (t,t) } def convert[t <: person:classtag](p: t)(implicit converter: converter[t]) = converter.convert(p) def main(args: array[string]): unit = { implicit val employeeconverter = new converter[employee]() implicit val managerconverter = new converter[manager]() convert(employee(1)) // works convert(manager(2)) // works list(employee(3),manager(4)) map(e => convert(e)) // compile error } } convert ing employee , manager separately works fine, whe

php - ACF Flexible content - basic text field -

i'm working on acf custom fields flexible content wordpress. i'd make flexible content appear, use code found on acf website. create fields on acf, nothing appear. • here made on acf : name of fexible content • , here sub fields this text area , normal texte title • here code <?php /* template name: ateliers */ ?> <?php get_header(); ?> <?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?> <?php // check if flexible content field has rows of data if( have_rows('ateliers') ): // loop through rows of data while ( have_rows('atelieratelier') ) : the_row(); if( get_row_layout() == 'content' ): the_sub_field('atelier_01'); elseif( get_row_layout() == 'content' ): the_sub_field('texte_atelier'); endif; endwhile; else : // no layouts found endif; ?> <?php endwhile; ?> <?php get_

c - How to use macro for calling function? -

i want call function according func_name string. code here below: #define make_funcname func_name##hello void call_func(void* (*func)(void)) { func(); } void *print_hello(void) { printf("print_hello called\n"); } int main(void) { char func_name[30] = "print_"; call_func(make_funcname); return 0; } but code doesn't work. want code work call_func(print_hello) . preprocessor treated code call_func("print_hello") . how use macro in c make exception? or not possible using c ? then problem code value of func_name known @ run-time. you can this: #define make_funcname(funcname) funcname##hello void call_func(void* (*func)(void)) { func(); } void *print_hello(void) { printf("print_hello called\n"); } int main(void) { call_func(make_funcname(print_)); return 0; } but not possible use string value within macro parameters in code snippet. if want call functions names using string valu

Android FilePicker dialog only working for some devices -

i'm using regular boiler-plate code showing file picker dialog on android. after file path, i'm uploading file server using aquery. however, code working on old samsung phone runs on android 4.1.2 not on other devices. tested using many devices works on samsung devices jellybean. intent intent = new intent(intent.action_get_content); intent.settype(minmetype); intent.addcategory(intent.category_openable); // special intent samsung file manager intent sintent = new intent("com.sec.android.app.myfiles.pick_data"); // if want file type, can skip next line sintent.putextra("content_type", minmetype); sintent.addcategory(intent.category_default); intent chooserintent; if (getpackagemanager().resolveactivity(sintent, 0) != null) { // device samsung file manager chooserintent = intent.createchooser(sintent, "open file"); chooserintent.putextra(intent.extra_initial_intents, new intent[

ios - How to fetch data and display using "GET"-with Authorization header using Rest API -

i having 1 url data , display. here need follow steps authauthorization header: base64,sha256 0r sha512 so here coded data authorization header.but in console got error: str: { "error_code": "invalid_auth_header", "message": "invalid authorization. use auth header or access hash" } i new http/get, authorization header , all. doing wrong , need change there work out? here code (this update code based on below answer): #import "viewcontroller.h" #import <commoncrypto/commondigest.h> @interface viewcontroller () @end @implementation viewcontroller - (void)viewdidload { [super viewdidload]; nsstring *username = @"testingyouonit@gmail.com"; nsstring *password = @"testingyouonit2"; nsdata *plaindata = [password datausingencoding:nsutf8stringencoding]; nsstring *base64string = [plaindata base64encodedstringwithoptions:0]; base64string=[self sha256hashfo

shell - Why does `rm -i kk kk*` complain about a missing kk? -

well want understand how rm command works, what tried: touch kk kk.999 (so creates 2 blank files kk , kk.999) rm -i kk kk* (then tried command deletes kk , try delete files starting kk before deletes kk.999 error occurs) my thoughts: it deletes 'kk' , think linux try delete kk* ('kk' , 'kk.999') kk file left kk.999 (because 'kk' deleted) why says 'kk' didnt found? whoever has linux please try above commands , explain me happening... cant understand. anyway! the shell expands command line wildcards before command executed. rm -i kk kk* equivalent writing, rm -i kk kk kk.999 . second kk causes rm yell file not existing since removed when saw first instance on command line. can write rm -i kk* ensure file names aren't repeated.

How to write Swift Protocol methods in Objective C -

i have file slider.swift , there protocol defined class parameter. want write methods in objective c in header file. how pass class parameter in protocols. please help public protocol sliderdelegate: class { func slider(slider: slider, textwithvalue value: double) -> string func sliderdidtap(slider: slider) func slider(slider: slider, didchangevalue value: double) func slider(slider: slider, didupdatefocusincontext context: uifocusupdatecontext, withanimationcoordinator coordinator: uifocusanimationcoordinator) } public extension sliderdelegate { func slider(slider: slider, textwithvalue value: double) -> string { return "\(int(value))" } func sliderdidtap(slider: slider) {} func slider(slider: slider, didchangevalue value: double) {} func slider(slider: slider, didupdatefocusincontext context: uifocusupdatecontext, withanimationcoordinator coordinator: uifocusanimationcoordinator) {} } @ibdesignable public class slider: uivi

android - git add image is not pushed to server -

i changed drawable png file after edited gimp , added android studio in res folder. on emulator can see changed. , can see on bitbucket not changed although send these commands git add -a #i tried git add -u , git add . git commit -m "new button" git push -u origin master my git status says updated. understand way git works not detect changed file. remember did in few months ago without using rm cannot remember command used try --refresh , --force flags. from git manual: --refresh don’t add file(s), refresh stat() information in index. -f, --force allow adding otherwise ignored files.

angularjs - How to take the result.text from barcodescanner and use as an array -

i trying take result.text returned cordova barcode scanner , parse data string used array, can populate input fields with-in form. here example code: document.addeventlistener("deviceready", function() { $scope.scanmaterial = function() { $cordovabarcodescanner .scan() .then(function(result) { var myresult = result.text; alert(myresult); }, function(error) { console.log("an error has happened " + error); }); }; }, false); the barcode data getting: w:966227, i:0253-0050-22, mfg:01/15, b:034, qty:56, n:00034 i end result take string of data , can populate following variables: var dataobj = { sessionid: sessionid, jobid: $stateparams.jobid, manufacturedate: $scope.manufacturedate, batchcode: $scope.batchcode, sku: $scope.sku, manufactureorigin: 'unknown',

magento - Do not show string if value is equal or greater than another -

it necessary hide oldprice string if value of string equal or greater price string. what correct syntax string oldprice ? // save product data result array $result['products'][] = array( 'id' => $_product->getid(), 'in_stock' => (bool)mage::getmodel('cataloginventory/stock_item')->loadbyproduct($_product)->getisinstock(), 'url' => str_replace('/index.php', null, $result['shop_data']['url']) . $_product->geturlkey() . $helper->getproducturlsuffix(), 'price' => $_product->getfinalprice(), 'oldprice' => $_product->getprice(), 'currencyid' => $currencycode, 'categoryid' => $_category->getid(), 'picture' => $picurl, 'name' => $_product->getname(), 'vendor' => trim($_product->getattributetext('manufacturer')), 'model' => $_pro

gmail - How I can I make my articles show the "View article" preview on Google Inbox? -

Image
i've setup my site show previews on facebook, twitter cards , other services using opengraph, i'm wondering necessary make articles show "go action" on inbox when they're shared? you'll need add gmail > markup > view action markup content. <script type="application/ld+json"> { "@context": "http://schema.org", "@type": "emailmessage", "potentialaction": { "@type": "viewaction", "target": "https://watch-movies.com/watch?movieid=abc123", "name": "watch movie" }, "description": "watch 'avengers' movie online" } </script>

Trying to check size of some cin statement -

i have simple user input function reads user types, ignoring enter's , taking first character comes across. using cin.ignore statement because part of menu, , want replay menu if enter none of given options, once. want have if-statement true iff user entered 1 character (he may enter multiple enter's before character), wanted use sizeof or length, couldn't quite work. can this? appreciated. also, if should changed phrasing of question, please let me know. in advance. char interface::leesin ( ) { char invoer; { invoer = cin.get(); } while (invoer == '\n'); cin.ignore(max,'\n'); return invoer; } the following code snippet whereby user presented console menu , needs input character. cin read in 1 char , program can processing char. loop terminate, when user inputs char '9'. #include <iostream> using namespace std; int main() { char ch; { //print menu here cin >> ch; // take in 1 char //perform

Fade in not working but fade out Animation works on Android -

i use method show view need fade in or fade out animation . it works when pass false execute fade out animation when pass true , fade in doesn't execute, instead, appears after 500ms without animation; private void setviewtransition(final boolean isvisible, final view view) { animation fadeanim; if (isvisible) { fadeanim = new alphaanimation(0.0f, 1.0f); if (view.getalpha() == 1.0f) { return; } } else { fadeanim = new alphaanimation(1.0f, 0.0f); if (view.getalpha() == 0.0f) { return; } } fadeanim.setduration(500); fadeanim.setanimationlistener(new animation.animationlistener() { @override public void onanimationstart(animation animation) { } @override public void onanimationend(animation animation) { if (isvisible) { view.setalpha(1.0f); } else { view.setalpha(0.0f);

javascript - Dependency injection error in angular -

i getting uncaught error: [$injector:modulerr] in strange manner. if inject dependency in manner throws above error. 'use strict'; var app = angular.module('myroutes', ['ngroute']); app.config(['$routeprovider'], function ($routeprovider) { }); but if flip above snippet in below way, error gone. 'use strict'; var app = angular.module('myroutes', ['ngroute']); app.config(function ($routeprovider) { //no error }); i using angular v 1.3.1 scripts including order. angular.js angular-routes.js myroutes.js myctrl.js considering minification in production environment, can't go second way. you have not closed config inline array annotation function correctly app.config(['$routeprovider'], function ($routeprovider) { should be // vvvvvvvvvv removed `]` app.config(['$routeprovider', function ($routeprovider) { }]); //<-- close here

java - Correct URL conditions -

in app have got edittext, user can put link show photo. in activity have got button, when user clicks it, can see website (url put in edittext). but there 1 problem: application can open link when has got " http://www .".. else app crashed i think can 4 situations: user puts www. vebsite.com without http:// user puts corrective url this: http://www . website.com user puts site domain this: website.com without http://www . user puts space in url (it may mistake) now have conditions this: if (string.valueof(text_of_url).contains("www")) { string full_url = string.valueof(text_of_url).replace("www.", http://www."); } else if (string.valueof(text_of_url).contains(".")) { string full_url = string.valueof(text_of_url).replace(" ", ""); } but works not correctly (i'm new in java). how can correctly conditions? you can use this: patterns.web_url.matcher(yoururl).match

ios - Correct TabBar and NavBar relationship/setup -

i need tab bar controller , nav bar controller (for tabs). correct setup? i have tab bar controller each tab leads separate nav bar controller leads vc. correct setup? or there preferred method have tab bar leads single nav bar controls vc's (for each tab)? possible, or lead lot of complications? you can 1 navigation controller: see image http://imgur.com/qxxjezi detail description: navigation , tab bar navigationcontroller -> check mark is initial view controller tabbarcontroller -> relationship segue root view controller both tabs fisrttabviewcontroller -> relationship segue view controllers secondtabviewcontroller -> relationship segue view controllers both tabs details fisrttabdetailviewcontroller -> action segue show secondtabdetailviewcontroller -> action segue show

python - Find duplicates, add to variable and remove -

i have script writes sales values separate lines in file , ultimate goal save data database. problem i'm running there duplicate entries same sales person, date, product, price , quantity. my code written file: john 07-15-2016 tool belt $100 2 sara 07-15-2016 hammer $100 3 john 07-15-2016 tool belt $100 2 john 07-15-2016 tool belt $100 2 sara 07-15-2016 hammer $100 3 how remove duplicates , add them together? i.e. output be: john 07-15-2016 tool belt $100 6 sara 07-15-2016 hammer $100 6 i've used counter doesn't catch multiple instances, nor can find way add 2 together. any appreciated. script: for line in s: var = re.compile(r'(\$)',re.m) line = re.sub(var, "", line) var = re.compile(r'(\,)',re.m) line = re.sub(var, "", line) line = line.rstrip('\n') line = line.split("|") if line[0] != '': salesperson = str(salesperson)

ruby - Deploying to Heroku, Rails app -

i trying deploy rails app heroku. app uploaded not run reason. when type heroku run rake db:migrate i error saying activerecord::connectiontimeouterror: not obtain database connection within 5.000 seconds (waited 5.000 seconds) i using puma server , post of files might cause problem... please ask might cause error! config/database.ymi production: adapter: postgresql host: localhost encoding: unicode database: fastorder_production pool: 5 username: <%= env['fastorder_database_user'] %> password: <%= env['fastorder_database_password'] %> template: template0 url: <%= env["database_url"] %> pool: env['rails_max_threads'] config/puma.rb workers integer(env['web_concurrency'] || 2) threads_count = integer(env['rails_max_threads'] || 5) threads threads_count, threads_count preload_app! rackup defaultrackup port env['port'] || 3000 environmen

IOS/Objective-C: Get Number from JSON -

i have json dictionary contains call integer (in mathematics) i.e. 1. i save number core data attribute nsinteger . following code issuing warning: incompatible pointer integer conversion initializing nsinteger expression of type 'id' nsinteger insertid = jsonresults[@"insert_id"]; i have tried various combinations of int , nsnumber , etc. no avail. can suggest right way this? nsdictionary can't store nsinteger . storing nsnumber . need unwrap nsnumber : nsinteger insertid = [jsonresults[@"insert_id"] integervalue];

ios - Not using unwrapping in guard statements -

i understand use of optionals enough know when necessary unwrap optional using exclamation point. why exclamation point isn't needed in guard statement? this code works , compiles doesn't use exclamation points: struct blog{ var author:string? var name: string? } func bloginfo2(blog:blog?){ guard let blog = blog else { print("blog nil") return } guard let author = blog.author, name = blog.name else { print("author or name nil") return } print("blog:") print(" author: \(author)") print(" name: \(name)") } this code works if put exclamation points: struct blog{ var author:string? var name: string? } func bloginfo2(blog:blog?){ guard let blog = blog! else { print("blog nil") return } guard let author = blog.author!, name = blog.name! else { print("author or name nil") return } print("blog:") print(" author: \(auth

java - Run-time error. Integer convert to string -

i creating program returns ordinal form of number (1st, 2nd etc.). when run program runtime error. i suspecting has converting int string, can't seem find source of problem. public void run() { ordinalform(5); } private string ordinalform(int num) { string number = integer.tostring(num); string correctword =""; if((number.charat(number.length()-2)=='1' && number.charat(number.length()-1)=='1')){ correctword=number+"th"; } else if (number.charat(number.length()-2)=='1' && number.charat(number.length()-1)=='2') { correctword=number+"th"; } else if ((number.charat(number.length()-1)=='1' && number.charat(number.length()-1)=='3')) { correctword=number+"th"; } else if(number.charat(number.length()-1)=='1') {

django - How to uninstall mod_wsgi when installed with make? -

i have installed mod_wsgi on ubuntu 14.04 described in documentation . while don't errors apache or django setup not work (no idea why exactly) start on , use libapache2-mod-wsgi. however, don't know how uninstall mod_wsgi. this answer more general question on subject advises trying make uninstall not work in case. make -n install gives me following output: /usr/bin/apxs2 -c -i/usr/include/python2.7 -dndebug -d_fortify_source=2 -wc,-g -wc,-o2 src/server/mod_wsgi.c src/server/wsgi_*.c -l/usr/lib -l/usr/lib/python2.7/config -lpython2.7 -lpthread -ldl -lutil -lm /usr/bin/apxs2 -i -s libexecdir=/usr/lib/apache2/modules -n 'mod_wsgi' src/server/mod_wsgi.la what have uninstall this? thanks! edit: i'm using mod_wsgi-4.5.3. remove configuration added apache configuration files , run: sudo rm /usr/lib/apache2/modules/mod_wsgi.so i recommend against using system provided mod_wsgi package out of date many many versions , not supported. bette

javascript - Called stop() outside of a test context -

i created new qunit qunit.module("integration"); qunit.modulestart(withpromise(function(details){ ....some logic promise in q }) qunit.moduledone(withpromise(function(details){ ....some logic })); qunit.test("1. push (new file)", function() { ..some logic }) and got error message called stop() outside of test context what wrong ?

linux - Blank desktop when using GNOME over VNC in RHEL 6.6 -

i can vnc rhel server, blank desktop kind of wallpaper applied, mouse pointer doesn't respond either left or right mouse click. my xstartup file in .vnc looks below: #!/bin/sh [ -r /etc/sysconfig/i18n ] && . /etc/sysconfig/i18n export lang export sysfont vncconfig -iconic & unset session_manager unset dbus_session_bus_address os=`uname -s` if [ $os = 'linux' ]; case "$windowmanager" in *gnome*) if [ -e /etc/suse-release ]; path=$path:/opt/gnome/bin export path fi ;; esac fi if [ -x /etc/x11/xinit/xinitrc ]; exec /etc/x11/xinit/xinitrc fi if [ -f /etc/x11/xinit/xinitrc ]; exec sh /etc/x11/xinit/xinitrc fi [ -r $home/.xresources ] && xrdb $home/.xresources xsetroot -solid grey xterm -geometry 80x24+10+10 -ls -title "$vncdesktop desktop" & gnome-session & i don't have xinitrc executable in /etc/x11/xinit, have directory xinitrc.d, has 1 file in it: 00-start-message-bus

C# Create zip, add file but can't open -

Image
i'm not c# developer knowledge limited. however, i'm trying write program in c# exports windows security log date , export evtx file. but have add evtx file zip file. code below creates zip file (i can see it) , adds evtx file zip (i think because in windows explore size changes 0kb more). #region "compress evtx file zip file: " // first create new zip archive in "achives" folder. string zipfilename = "zip-" + getdatetimestamp(1) + ".zip"; string zipfilepath = system.io.path.combine(zipevtxdirectorypath, zipfilename); ziparchive zipfile = zipfile.open(zipfilepath, ziparchivemode.create); // add evtx file created in program directory zip archive. console.writeline(evtxfilepath); console.writeline(evtxfilename); zipfile.createentryfromfile(evtxfilepath, evtxfilename); //evtxfilepath = "d:\test\vs\filesandfolders\testdirectory\archives\security-log

vba - VB: create comma separated string from array -

i trying convert list of array values comma separated string, single quotes. my array name is: info.arr_fonts( (0)times (1)verdana (2)arial (3)tahoma (4)helvetica ) - values dynamic, can +/-. enter code here i write them string variable like: "times, verdana, arial, tahoma, helvetica" can show me how can done? tried simple like: dim strfonts string strfonts = join(info.fontarray, ",") but not add single quotes around each word. update dim arrfontnames variant dim strfonts string dim lctr long arrfontnames = array("doremi", "times-roman", "helvetica", "jivetalk", "jive") strfonts = join(arrfontnames, ",") content of strfonts: "doremi,times-roman,helvetica,jivetalk,jive" i need pass strfonts parameter stored procedure. stored procedure needs receive lie this: 'doremi,times-rom

javascript - Hiding then showing the dropdown arrow in jquery from a select element -

i can hide dropdown arrow in select element css! want hide , more importantly show in jquery? select { -webkit-appearance: none; -moz-appearance: none; text-indent: 1px; text-overflow: ''; } <select style="border: 0px;"> <option value="0">test1</option> <option value="1">test2</option> </select> you create custom css class hides drop down arrow , use jquery toggle class on select element. for needs may need use jquery methods addclass , removeclass instead of toggleclass. $('#toggle').on('click', function() { $('#select').toggleclass('hide'); }); .hide { -webkit-appearance: none; -moz-appearance: none; text-indent: 1px; text-overflow: ''; } <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script&

java - What is a NullPointerException, and how do I fix it? -

what null pointer exceptions ( java.lang.nullpointerexception ) , causes them? what methods/tools can used determine cause stop exception causing program terminate prematurely? when declare reference variable (i.e. object) creating pointer object. consider following code declare variable of primitive type int : int x; x = 10; in example variable x int , java initialize 0 you. when assign 10 in second line value 10 written memory location pointed x. but, when try declare reference type different happens. take following code: integer num; num = new integer(10); the first line declares variable named num , but, not contain primitive value. instead contains pointer (because type integer reference type). since did not yet point java sets null, meaning "i pointing @ nothing". in second line, new keyword used instantiate (or create) object of type integer , pointer variable num assigned object. can reference object using dereferencing operator . (a dot

Unhelpful HTTP api response from rails -

i have ios app , passing image couple strings rails api. have started getting error rails. couldn't find info on causing error. assuming has passing larger average data package (an image) . { status code: 500, headers { connection = close; date = "fri, 15 jul 2016 20:30:01 gmt"; server = "nginx/1.4.6 (ubuntu)"; "transfer-encoding" = identity; } should trying solve problem client (ios) or server (rails/nginx) perspective? potentially helpful info: the rails controller api starts def image_build begin puts "begin" but "begin" never printed. edit 1 some more info: in ios these lines have output below: print(response) print(response.description) print(response.data) print(response.request) print(response.response) output: success: success: optional(<>) optional(<nsmutableurlrequest: 0x7fa9539506a0> { url: http://www.example.com/api/image_build }) optional(<nshttpurlr

jquery - Kendo Grid is not displaying json data webforms -

i'm new comer kendo grid, i'm using webmethod trigger it. of lots of forums, i'm able trigger request webmethod. problem method returning number of records in json format. simplicity, consider 1 hardcoded json record here response: {"d":"{\"pk_picture\":22,\"p_displayorder\":1,\"altattribute\":\"smith\",\"titleattribute\":\"smith\"}"} <script> $(document).ready(function () { $("#productpictures-grid").kendogrid({ height: 200, columns: [ { field: "pk_picture", title: "picture", width: "150px" }, { field: "p_displayorder", width: "150px" }, { field: "altattribute", width: "100px" }, { field: "titleattribute

html - Center ul submenus under parent li -

i've been looking around fix wasn't able find one. i'm helping out wordpress based site , introduced bootstrap , added custom css menu too. issue i'm not able center sub-menus under parent li , thing left on site. html <nav id="main_navbar_container"class="navbar navbar-default "> <div class="container"> <div class="row"> <!-- brand , toggle grouped better mobile display --> <div id="main_logo_container" class="navbar-header"> <!--main logo container--> <div="container"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false"> <span class="sr-only">toggle navigation</span> <spa

python - Removing white spaces and punctuation from list -

def wordlist (l: list) -> list: '''returns wordlist without white spaces , punctuation''' result = [] table = str.maketrans('!()-[]:;"?.,', ' ') x in l: n = x.translate(table) n = x.strip() n = x.split() if n != []: result.extend(n) return result the function supposed work this: print(wordlist([' testing', '????', 'function!!'])) should yield: ['testing', 'function'] but code have above yields: ['testing', '??', 'function!!'] so assume i'm doing incorrectly code in regards removing punctuation--where should fix it? other suggestions simplify code appreciated (since figured it's bit long-winded). did mean chain translate(table) , strip() , split() calls? then n = x.translate(table) n = x.strip() n = x.split() should be n = x.translate(table) n = n.strip() #

Store Date to UTC one-liner by PHP -

i understand best practice store dates utc databases quite confused in scenario in. let's have form end-user inserts date "07-15-2016" in eastern timezone. necessary store utc date or as-is since it's not datetime? i'm using one-liner in php sanitize date format before insert database. // user input 07-15-2016 , formatted 2016-07-15 00:00:00 $userdate = datetime::createfromformat('m-d-y', '07-15-2016')->format('y-m-d h:i:s')); is there make sure nothing messes since user-input est; meanwhile, time 00:00:00?

java - Getting Not Logged In Error! for 200 Response -

i trying simple scenario stated below: initiating webdriver instance , logging in facebook page trying response browser_all/nullstate.php?**sometext same i getting following error. error ! not logged in though getting 200 response, , mentioned hitting url after logging fb account can me , let me know why getting error response , suggestion how overcome it? i have written httpclient using httpurlconnection api in java.

Optimizing queries over date ranges in MongoDb (with other fields) -

i'm building scheduling/booking system bunch of providers serve customers @ bunch of locations on times. my appointment object looks this: { "providername" : {"type": "string"}, "location" : {"type": "string"}, "starttime" : {"type": "tba"}, "endtime" : {"type": "tba"}, } the appointments stored in mongodb , i'll need run lot of searches 4 fields set (there 10-20 searches each insertion, i'm optimizing reads here). i'm thinking store start , end times in milliseconds, , set compound index on these two, set 2 separate indices on provider name , location. but i'm wondering whether can improve performance (end reduce load on server) using optimizations: what's more efficient range queries - storing start/end time milliseconds/long or java.util.date or maybe string? if i'm interested in searches date only, perh

java - Menu Icon and Title Icon display not working -

i want set menu icon(about app) rhs of title , icon(like button) lhs of title. android:icon doesn't seem work on manifest activity xml. button: 1)without using toolbar getsupportactionbar().setdisplayhomeasupenabled(true); 2)with toolbar toolbar toolbar= (toolbar) findviewbyid(r.id.toolbar_gas_station); setsupportactionbar(toolbar); getsupportactionbar().setdisplayhomeasupenabled(true); icon: 1)without using toolbar have make menu file , override onoptionsitemselected , oncreateoptionsmenu write code accordingly 2)with toolbar: <android.support.design.widget.appbarlayout android:id="@+id/app_bar_layout" android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/themeoverlay.appcompat.dark.actionbar" android:fitssystemwindows="true"&g

error:: java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver -

i wrote java program when run it, showing: java.lang.classnotfoundexception: oracle.jdbc.oracledriver @ java.net.urlclassloader$1.run(urlclassloader.java:199) @ java.security.accesscontroller.doprivileged(native method) @ java.net.urlclassloader.findclass(urlclassloader.java:187) @ java.lang.classloader.loadclass(classloader.java:289) @ sun.misc.launcher$appclassloader.loadclass(launcher.java:274) @ java.lang.classloader.loadclass(classloader.java:235) @ java.lang.classloader.loadclassinternal(classloader.java:302) @ java.lang.class.forname0(native method) @ java.lang.class.forname(class.java:141) @ lib.dp_connect.connect(dp_connect.java:47) @ main.agent.main(agent.java:164). i see other questions same error , try solutions program doesn't work. my tests (java version 1.4): use oracle's classpath (export classpath=..../ojdbc14.jar) compile program path of library (java -classpa

php - How to get Specific Value from Session Array in CI? -

i session : echo '<pre>'; print_r($this->session->all_userdata()); exit; and result : array ( [session_id] => 47fa796fbc6c5146a5ba0b1e596f4354 [ip_address] => ::1 [user_agent] => mozilla/5.0 (windows nt 6.1; rv:47.0) gecko/20100101 firefox/47.0 [last_activity] => 1468617532 [user_data] => [session_data] => array ( [default] => english [register] => register [login] => login [logout] => logout [home] => home [latest_event] => latest event [events] => events [contact_us] => contact [submit_event] => submit event [register_now] => register [find_best_event_for_you] => find best event [select_date] => select date [find_event] => find event [create_event_home] => create own new event [create_event_home_txt] => bring people together, or turn passion bus

ruby on rails - How to give an f.file_field a value -

i have form in rails. it's in show.html.erb, in controller offer form controller push however. in last field want have file field, so: <%= f.hidden_field :image, value: @offer.image %> i can't apparently. error: paperclip::adapterregistry::nohandlererror in pushescontroller#create i'm not sure fix is. i've looked on how add value file_field can't find it. help, always, appreciated.

segmentation fault - Assembly - Segfault with subprogram -

i'm trying debug why i'm getting segfault in subprogram. it happens on ret line @ end of subprogram - in once 0x00 byte reach @ end of sentence. main : .data string: .string "aaaaaaaaaaa" endofstring: .space 8 msg: .string "%c occurs %d times \n" .text .global main main: mov $string,%rsi #rsi = string storage mov $0x61, %ah #storage of mov $0x65, %al #storage of e mov $0x69, %bh #storage of mov $0x6f, %bl #storage of o mov $0x75, %ch #storage of u #case mov %ah,%cl #1 byte register cmp later on. mov $0, %rax #initialize count 0 call freq #generate %rax value mov %rax, %rdx #count printf (2nd argument) mov $msg, %rdi #format printf(1st

asp.net - Cannot create a stored procedure using MySQL -

so may little vague i'm running layer after layer of problems here. each "fix" find on google presents me problem. laying things out anyway, i've bought windows hosting package in order produce asp.net application backed mysql server. i'm used mssql should workable , nicer open source. the first problem noticed (recently installed) copy of mysql workbench mysql server 5.7 not let me connect db whatsoever. tables refuse load , greeted with: #1548 - cannot load mysql.proc. table corrupted from there, thought "ok that's fine, i'll use web admin tool" in case phpmyadmin . have 0 experience phpmyadmin in past looks ok , preinstalled in control panel. started off creating first 5 tables. went smoothly , have 5 tables in database, 1 of them has data may view running "select * account_type". all seems good, go create procedure i'm want use in order test application. procedure return string based on tinyint user enters. procedure

javascript - What are differences between redux, react-redux, redux-thunk? -

i using react + flux. our team planning move flux redux. redux confusing me coming flux world. in flux control flow is simple components -> actions -> store , store updates components . simple , clear. but in redux confusing. there no store here, yes there examples without using store. went through several tutorials, seems has own style of implementation. using containers , not. (i don't know containers concept , not able understand mapstatetoprops, mapdispatchtoprops does). can explain how control flow happens in redux ? what roles of components/containers/actions/action creators/store in redux ? difference between redux/react-redux/redux-thunk/any others ?? it helpful if can post links simple , precise redux tutorials. can explain how control flow happens in redux ? redux has (always) single store. whenever want replace state in store, dispatch action. the action caught 1 or more reducers. the reducer/s create new state combines old

java - How to bind data from velocity template to spring controller? -

i have velocity template tag form. <div class="row"> <div class="container"> <div class="col-lg-12"> <table class=" table table-striped"> <thead> <th>#</th> <th>username</th> <th>role</th> <th>password</th> </thead> <tbody> #foreach( $user in $users ) <tr> <td>$user.id</td> <td>$user.username</td> <td>$user.role</td> <td>$user.password</td> <td><a href="/user/delete/$user.id">delete</a></td> <td><a href="/user/edit/$user.id">edit</a></td></tr> #end </tb