download mediawiki source filetarball from https://www.mediawiki.org/wiki/Download/jaextend all files into /Library/WebServer/Documentsmake symbolic link between the directory created in step 2 to "wiki"(refered in 7.).check php version ( should be equal or more than 5.5.9)edit conf to enable php onapache sudo vi /private/etc/apache2/httpd . conf uncomment the line "LoadModule php5_module libexec/apache2/libphp5. so"sudo apachectl restartaccess http://localhost/wiki/mw-config/index.phpstart installation.
2016年7月6日水曜日
install mediawiki on mac os x
uninstall mysql from mac os x
$ sudo rm -rf /usr/local/mysql-5.1.37-osx10.5-x86_64/
$ sudo rm -rf /Library/StartupItems/MySQLCOM/
$ sudo rm -rf /Library/PreferencePanes/MySQL*
$ sudo rm -rf /Library/Receipts/mysql-5.1.37-osx10.5-x86_64.pkg/
2016年6月24日金曜日
Use list as associative array part 2
This one is better than the previous one.
> test2_list <- list( list( "Mon","Tue","Wed","Thu","Fri","Sat","Sun"), list( 1,2,3,4,5,6,7))
>for ( i in test2_list[ [2]]) {
+ # if( match( weekdays( as. Date( ISOdate( year( Sys. Date( )), 1,1)), abbreviate = TRUE), test_list[ [1]] [i ], nomatch = FALSE))
+ print( paste( ">>", test2_list[ [1]] [i ]))
+ }
[1] ">> Mon"
[1] ">> Tue"
[1] ">> Wed"
[1] ">> Thu"
[1] ">> Fri"
[1] ">> Sat"
[1] ">> Sun"
>
> test2_list <- list
>
+ # if
+ }
[1] ">> Mon"
[1] ">> Tue"
[1] ">> Wed"
[1] ">> Thu"
[1] ">> Fri"
[1] ">> Sat"
[1] ">> Sun"
>
Use list as associative array.
> test_list <- list(list("Mon",1),list("Tue",2),list("Wed",3),list("Thu",4),list("Fri",5),list("Sat",6),list("Sun",7))
>
{
}
[[1]]
[1] 5
2016年6月15日水曜日
Calculate day dependent data with less workload - 2 - test 2 strings are equal or not
Use match function to test 2 strings are same or not.
Below is a normal case and easy.
>weekdays ( as. Date( "2016-01-01"), abbreviate = TRUE)
[1] "Fri"
>match ( weekdays( as. Date( "2016-01-01"), abbreviate = TRUE),"Fri")
[1] 1
In other cases, match return NA not 0 by default and this causes a problem in if function. I see this is very strange, however, it is just one more option to go.
>match ( weekdays( as. Date( "2016-01-01"), abbreviate = TRUE),"Mon")
[1] NA
The parameternomatch will give an option to set a value for the case. with "nomatch=0" you can booleanize the return value
>match ( weekdays( as. Date( "2016-01-01"), abbreviate = TRUE),"Fri", nomatch=0)
[1] 1
>match ( weekdays( as. Date( "2016-01-01"), abbreviate = TRUE),"Thur", nomatch=0)
[1] 0
Then now it's possible to use if-then-else clause without problem.
>if ( match( weekdays( as. Date( "2016-01-01"), abbreviate = TRUE),"Mon", nomatch=0)) {print( "金曜日")} else{ print( "other days...")}
[1] "other days..."
>if ( match( weekdays( as. Date( "2016-01-01"), abbreviate = TRUE),"Fri", nomatch=0)) {print( "金曜日")} else{ print( "other days...")}
[1] "金曜日"
Below is a normal case and easy.
>
[1] "Fri"
>
[1] 1
In other cases, match return NA not 0 by default and this causes a problem in if function. I see this is very strange, however, it is just one more option to go.
>
[1] NA
The parameter
>
[1] 1
>
[1] 0
Then now it's possible to use if-then-else clause without problem.
>
[1] "
>
[1] "金曜日"
how to eliminate blank lines by atom regex.
use "^\s" instead of traditonal "^$". seems that atom's regex works only when at least one character is being consumed.
When given data are below,
[2016-06-01,167],[2016-06-02,155],[2016-06-03,140],[2016-06-04,138],[2016-06-05,144],[2016-06-06,176],[2016-06-07,157],[2016-06-08,146],[2016-06-09,134],[2016-06-10,130],[2016-06-11,119],[2016-06-12,107],[2016-06-13,141]]
regex below will remove all brackets and leave data and just one comma before them. DO NOT FORGET BRACES!
\[+[0-9-]+,([0-9]+)\][,\]] → $1,
when original data is as below
423 258 314 175 255 211 134 162 205 168 156 273 258 288 291 243 128
(\b[0-9]*\b) → $1,
wil add comma at the end of each numeric.
423, 258, 314, 175, 255, 211, 134, 162, 205, 168, 156, 273, 258, 288, 291, 243, 128,
77.9 73.5 74.5 72.2 73.1 73.4 72.9 72.7 76.9 73.1 71.8 79 79.9 78.4 77.4 79.6 74.6
(\s) → , # actually ", + space"
77.9, 73.5, 74.5, 72.2, 73.1, 73.4, 72.9, 72.7, 76.9, 73.1, 71.8, 79, 79.9, 78.4, 77.4, 79.6, 74.6
When given data are below,
[2016-06-01,167],[2016-06-02,155],[2016-06-03,140],[2016-06-04,138],[2016-06-05,144],[2016-06-06,176],[2016-06-07,157],[2016-06-08,146],[2016-06-09,134],[2016-06-10,130],[2016-06-11,119],[2016-06-12,107],[2016-06-13,141]]
\[+[0-9-]+,([0-9]+)\][,\]] → $1,
when original data is as below
423 258 314 175 255 211 134 162 205 168 156 273 258 288 291 243 128
(\b[0-9]*\b) → $1,
wil add comma at the end of each numeric.
423, 258, 314, 175, 255, 211, 134, 162, 205, 168, 156, 273, 258, 288, 291, 243, 128,
77.9 73.5 74.5 72.2 73.1 73.4 72.9 72.7 76.9 73.1 71.8 79 79.9 78.4 77.4 79.6 74.6
(\s) → , # actually ", + space"
77.9, 73.5, 74.5, 72.2, 73.1, 73.4, 72.9, 72.7, 76.9, 73.1, 71.8, 79, 79.9, 78.4, 77.4, 79.6, 74.6
2016年6月14日火曜日
Calculate # of months from the beginning of the year.
>
The fix is to use
>
> m
[1] 6
[1] "
>
2016年6月10日金曜日
Calculate day dependent data with less workload - 1 set languge locale
In order to calculate day dependent data with less workload, I like to automate processes. The first step is to judge the first day of each belongs to which day of the week.
Currently R's language setting is set to JA. This may be
>
[1] "金"
>
[1] "ja_JP.UTF-8"
Change LC_MESSAGES to US. But weekdays function still return the value in Japanese.
>
[1] "en_US"
>
[1] "金"
Investigate Sys
>
{
"LC_MONETARY", "LC_NUMERIC", "LC_TIME", "LC_MESSAGES",
"LC_PAPER", "LC_MEASUREMENT"))
}
<
<
Set LC_ALL locale, instead of LC_MESSAGES to US English.
>
[1] "en_US/en_US/en_US/C/en_US/en_US"
Then return is in US English.
>
[1] "Fri"
>
2016年6月9日木曜日
S&P 500 according to GDP forecast by GDPnow 2016-05-28
Now the target value at the end of 2016 is 2339.
> 0.603*
[1] 2249.308 2266.049 2280.233 2294.785 2306.989 2318.216 2328.660 2339.162 2349.197 2358.947
2016年6月8日水曜日
Set Operator - count working days in 2016
Combined previous two samples will bring the list which are weekday bu not holiday .
> seq(1,365,1)[is.element(seq(1,365,1)%%7,c(6,4,5,0,1))][!is.element(seq(1,365,1)[is.element(seq(1,365,1)%%7,c(6,4,5,0,1))],holiday2016)]
Then you now know how many days you have to go to the office.
> length(seq(1,365,1)[is.element(seq(1,365,1)%%7,c(6,4,5,0,1))][!is.element(seq(1,365,1)[is.element(seq(1,365,1)%%7,c(6,4,5,0,1))],holiday2016)])
[1] 245
>
> seq(1,365,1)[is.element(seq(1,365,1)%%7,c(6,4,5,0,1))][!is.element(seq(1,365,1)[is.element(seq(1,365,1)%%7,c(6,4,5,0,1))],holiday2016)]
Then you now know how many days you have to go to the office.
> length(seq(1,365,1)[is.element(seq(1,365,1)%%7,c(6,4,5,0,1))][!is.element(seq(1,365,1)[is.element(seq(1,365,1)%%7,c(6,4,5,0,1))],holiday2016)])
[1] 245
>
2016年6月7日火曜日
Set operator - how to create the list of Monday to Friday seq number for 2016.
Create the list of
>
[1] 1 4 5 6 7 8 11 12 13 14 15 18 19 20 21 22 25 26 27 28 29 32 33 34 35 36 39 40 41
[30] 42 43 46 47 48 49 50 53 54 55 56 57 60 61 62 63 64 67 68 69 70 71 74 75 76 77 78 81 82
[59] 83 84 85 88 89 90 91 92 95 96 97 98 99 102 103 104 105 106 109 110 111 112 113 116 117 118 119 120 123
[88] 124 125 126 127 130 131 132 133 134 137 138 139 140 141 144 145 146 147 148 151 152 153 154 155 158 159 160 161 162
[117] 165 166 167 168 169 172 173 174 175 176 179 180 181 182 183 186 187 188 189 190 193 194 195 196 197 200 201 202 203
[146] 204 207 208 209 210 211 214 215 216 217 218 221 222 223 224 225 228 229 230 231 232 235 236 237 238 239 242 243 244
[175] 245 246 249 250 251 252 253 256 257 258 259 260 263 264 265 266 267 270 271 272 273 274 277 278 279 280 281 284 285
[204] 286 287 288 291 292 293 294 295 298 299 300 301 302 305 306 307 308 309 312 313 314 315 316 319 320 321 322 323 326
[233] 327 328 329 330 333 334 335 336 337 340 341 342 343 344 347 348 349 350 351 354 355 356 357 358 361 362 363 364 365
>
2016年6月2日木曜日
Set Operator - how to extract only working day from all Friday of 2016.
When holiday2016 is the list of
> holiday2016
[1] 1 2 11 42 81 120 124 125 126 200 224 263 267 284 308 328 358
>
[1] 1 8 15 22 29 36 43 50 57 64 71 78 85 92 99 106 113 120 127 134 141 148 155 162 169 176 183 190 197
[30] 204 211 218 225 232 239 246 253 260 267 274 281 288 295 302 309 316 323 330 337 344 351 358 365
>
[1] 8 15 22 29 36 43 50 57 64 71 78 85 92 99 106 113 127 134 141 148 155 162 169 176 183 190 197 204 211
[30] 218 225 232 239 246 253 260 274 281 288 295 302 309 316 323 330 337 344 351 365
登録:
投稿 (Atom)