Posts

php - setISODate work that way? -

i testing these cases: $date = new \datetime(); echo($date->format('y.m.d')) . php_eol; $date->setisodate(2018, 1, 1); echo($date->format('y.m.d')) . php_eol; $date->setisodate(2019, 1, 1); echo($date->format('y.m.d')) . php_eol; $date->setisodate(2020, 1, 1); echo($date->format('y.m.d')) . php_eol; ouput: 2017.08.17 2018.01.01 2018.12.31 2019.12.30 i understood show this: 2017.08.17 2018.01.01 2019.01.01 2020.01.01 why happen? surely there did not quite understand. the arguments year , week , dayofweek . php's week starts on monday, , week 1 of year first week has @ least 4 days in january. in 2018, year starts on monday, week 1 starts on january 1, , that's day 1 of week. in 2019, year starts on tuesday, week 1 starts on monday, december 31, 2018, , that's day 1 of week. in 2020, year starts on wednesday, week 1 starts on monday, december 30, 2019, that's day 1 of week.

python - How can i update pandas dataframe columns based on index -

in pandas have dataframe: df1 = pd.dataframe({'type':['application','application','hardware'], 'category': ['none','none','hardware']}) i have following index retrieve rows type contains "application" , category contains 'none'. df1[df1['type'].str.contains('application') & df1['category'].str.contains('none')] category type 0 none application 1 none application i update column category such value 'some new value' each row. i have tried same following loc index no success df1[df1.loc[:,'type'].str.contains('application') \ & df1.loc[:,'category'].str.contains('none')] thanks. are looking this? df1.loc[(df1['type'] == 'application') & (df1['category'] == 'none'), 'category'] = 'new category' category ...

html - How to make 3 absolute-positioned elements stick together even they are scaled resonsively? -

Image
i trying achieve this: the 3 drinks stuck in mobile version. know, scale browser width, elements should scaled well. it's hard use percentage width , height's measurement. i have following code: <div class="s-drinks"> <div class="drink-wrap-col1"> <div class="drink"> <img src="https://placehold.it/300x500" alt="popular drink"> </div> </div> <div class="drink-wrap-col2"> <div class="drink--secondary"> <img src="https://placehold.it/300x500" alt="popular drink"> </div> </div> <div class="drink-wrap-col3"> <div class="drink...

regex - `Nothing` in macro crashes Excel 2013 -

Image
i'm trying use regex in excel 2015 macro. don't know if i'm doing wrong, every time run it, excel crashes. here's macro: sub makeexplicit() dim whitespace regexp set whitespace = new regexp whitespace.pattern = "\s+" whitespace.multiline = true whitespace.global = true dim implicit regexp set implicit = new regexp implicit.pattern = "^\d+-\d+$" dim row range each row in activesheet.usedrange.rows dim first range set first = row.cells(1, 1) dim str string str = first.text str = whitespace.replace(str, nothing) if implicit.test(str) 'fixme here crashes dim fromto variant fromto = split(str, "-") dim sfrom, sto integer sfrom = fromto(1) sto = fromto(2) ' doplň chybějící číslice ' např [2345, 78] doplní ' na [2345, 2378] ...

c++ - For-Loop on Pointer: Does it move the whole address range? -

i have bit of code: int count_x(char* p, char x) { if (p == nullptr) return 0; int count = 0; (; *p != 0; p++) { if (*p == x) count++; } return count; } the input in case char-array: char v[] = { "ich habe einen beispielsatz erstellt!"}; since looking cpp book "c++ programming language - 4th edition" got code there , trying figure out. when stepping through it, noticed loop moves memory address in increments of one. not surprising me, following question arose , couldn't find answer yet: loop reduce overall memory range or whole range being moved? since knowlege use "block" in whole storing such char-array (or type of array), guess later since don't see reducing boundries. "knowledge" have ask: doesn't cause major issues theoretically possible read parts of memory programm shouldn't have access to? will have keep in mind when dealing (very) long arrays? in c , c++, "strings thi...

python - Trouble Transforming IEEE 754 data to be displayed in PyQt4 -

i have large image stored in nparry each pixel ieee 754 formatted. trying view image in pyqt4. have tried using qimage , qpixmap available formats have been unable view image properly. hoping there module transforms ieee 754 data format pyqt4 able display.

python 3.x - Difference between python3 and python3m executables -

what difference between /usr/bin/python3 , /usr/bin/python3m executibles? i observing them on ubuntu 13.04, google suggests exist on other distributions too. the 2 files have same md5sum, not seem symbolic links or hard links; 2 files have different inode numbers returned ls -li , testing find -xdev -samefile /usr/bin/python3.3 not return other files. someone asked similar question on askubuntu , wanted find out more difference between 2 files. credit goes chepner pointing out had link solution. python implementations may include additional flags in file name tag appropriate. example, on posix systems these flags contribute file name: --with-pydebug (flag: d) --with-pymalloc (flag: m) --with-wide-unicode (flag: u) via pep 3149 . regarding m flag specifically, pymalloc is: pymalloc, specialized object allocator written vladimir marangozov, feature added python 2.1. pymalloc intended faster system malloc() , have less memo...