regex for html anchors in titles
After a lot of messing around and the help of you guys I got a nice system
that makes a little list of all the titles in my html text. This is done
with a regex which works fine until I try to add the URL's
Original:
$txt = preg_replace("#\[h2\](.+?)\[/h2\](.+?(?=\[h1\]|\[h2\])|.+$)#is",
"<h2 style='display:inline;'>\\1</h2>", $txt);
$txt = preg_replace("#\[h1\](.+?)\[/h1\](.+?(?=\[h1\]|<h2)|.+$)#is", "<h1
style='display:inline;'>\\1</h1>", $txt);
What I'm trying to make it
$txt = preg_replace("#\[h2\](.+?)\[/h2\](.+?(?=\[h1\]|\[h2\])|.+$)#is",
"<li><a href=\"#\\1>\\1</a></li>", $txt);
$txt = preg_replace("#\[h1\](.+?)\[/h1\](.+?(?=\[h1\]|<li)|.+$)#is",
"</ul><a href=\"#\\1>\\1</a><ul>", $txt);
Thursday, 3 October 2013
Wednesday, 2 October 2013
Table Style in Joomshopping
Table Style in Joomshopping
Hi I want to put my products in a table with some columns which contains
the product features, is there any idea about that or some plugins?
Hi I want to put my products in a table with some columns which contains
the product features, is there any idea about that or some plugins?
creating a sequence of columns in a dataframe based upon an index for loop or using plyr in r
creating a sequence of columns in a dataframe based upon an index for loop
or using plyr in r
I am new to R and this website: I have a complex problem in which I have
to create 24 hourly data frames in which each dataframe contains hourly
demand for a product as 1 column and the next 8 columns contain hourly
temperatures. If I am referring to the 8 am hour demand, the dataframe for
8am will contain a column for Demand then eight columns for temperature
ranging from the most current hour to the 7 past hours. The additional
complication is that for earlier hours i.e. "4AM", I have to get yestrdays
temperatures for some columns. I am hitting my head against the wall
trying to figureout how to do this in a vectorize langauge or use apply or
plyr to solve. demand8AM Temp8AM Temp7AM Temp6AM...Temp1AM
Demand4AM Temp4AM Temp3AM Temp2AM Temp1AM Temp12AM Temp11pm(Lag)
Temp10pm(Lag) In my code Hours are numbers 1 is 12AM etc...
Here is some simple code I created to create the dataset I am dealing
with. #Creating some Fake Data
require(plyr)
# setting up some fake data
set.seed(31)
foo <- function(myHour, myDate){
rlnorm(1, meanlog=0,sdlog=1)*(myHour) + (150*myDate)
}
Hour <- 1:24
Day <-1:90
dates <-seq(as.Date("2012-01-01"), as.Date("2012-3-30"), by = "day")
myData <- expand.grid( Day, Hour)
names(myData) <- c("Date","Hour")
myData$Temperature <- apply(myData, 1, function(x) foo(x[2], x[1]))
myData$Date <-dates
myData$Demand <-(rnorm(1,mean = 0, sd=1)+.75*myData$Temperature )
## ok, done with the fake data generation.
Thank you for any help
or using plyr in r
I am new to R and this website: I have a complex problem in which I have
to create 24 hourly data frames in which each dataframe contains hourly
demand for a product as 1 column and the next 8 columns contain hourly
temperatures. If I am referring to the 8 am hour demand, the dataframe for
8am will contain a column for Demand then eight columns for temperature
ranging from the most current hour to the 7 past hours. The additional
complication is that for earlier hours i.e. "4AM", I have to get yestrdays
temperatures for some columns. I am hitting my head against the wall
trying to figureout how to do this in a vectorize langauge or use apply or
plyr to solve. demand8AM Temp8AM Temp7AM Temp6AM...Temp1AM
Demand4AM Temp4AM Temp3AM Temp2AM Temp1AM Temp12AM Temp11pm(Lag)
Temp10pm(Lag) In my code Hours are numbers 1 is 12AM etc...
Here is some simple code I created to create the dataset I am dealing
with. #Creating some Fake Data
require(plyr)
# setting up some fake data
set.seed(31)
foo <- function(myHour, myDate){
rlnorm(1, meanlog=0,sdlog=1)*(myHour) + (150*myDate)
}
Hour <- 1:24
Day <-1:90
dates <-seq(as.Date("2012-01-01"), as.Date("2012-3-30"), by = "day")
myData <- expand.grid( Day, Hour)
names(myData) <- c("Date","Hour")
myData$Temperature <- apply(myData, 1, function(x) foo(x[2], x[1]))
myData$Date <-dates
myData$Demand <-(rnorm(1,mean = 0, sd=1)+.75*myData$Temperature )
## ok, done with the fake data generation.
Thank you for any help
My site keeps crashing on my Chrome
My site keeps crashing on my Chrome
For some reason my site won't operate in Google Chrome. It works
flawlessly in Firefox without special errors, but is a no-no in Chrome.
What gives?
http://www.lemaineofficial.com/
(It says an error has occured, and that I can try to reload. However it
gives same error always)
The moment my javascript wants to get executed (it loads the site
briefly), Chrome just aborts the page. I've never seen an error like this
and have no idea how to troubleshoot except removing functions till it
works, which I will try to do.
I just need to know what can cause this behavior on Chrome with
javascript, or know how to easily troubleshoot it.
Note: This site works as intended with Firefox without crashes.
For some reason my site won't operate in Google Chrome. It works
flawlessly in Firefox without special errors, but is a no-no in Chrome.
What gives?
http://www.lemaineofficial.com/
(It says an error has occured, and that I can try to reload. However it
gives same error always)
The moment my javascript wants to get executed (it loads the site
briefly), Chrome just aborts the page. I've never seen an error like this
and have no idea how to troubleshoot except removing functions till it
works, which I will try to do.
I just need to know what can cause this behavior on Chrome with
javascript, or know how to easily troubleshoot it.
Note: This site works as intended with Firefox without crashes.
Tuesday, 1 October 2013
JUnit testing to get the bigger number of 2 values?
JUnit testing to get the bigger number of 2 values?
I need some help figuring out how to get a JUnit test of the bigger number
of 2 values.
I know how to do Junit testing of simple functions like adding,
subtracting and etc but not finding a bigger value of the two.
This is what I have:
public static int getMax(int x, int y){
if(x >= y) {
return x;
}
else {
return y;
}
}
Im stuck on proving what I wrote.
I need some help figuring out how to get a JUnit test of the bigger number
of 2 values.
I know how to do Junit testing of simple functions like adding,
subtracting and etc but not finding a bigger value of the two.
This is what I have:
public static int getMax(int x, int y){
if(x >= y) {
return x;
}
else {
return y;
}
}
Im stuck on proving what I wrote.
Cgo linker errors on C constants
Cgo linker errors on C constants
I'm using cgo to wrap a C library and have run into a strange set of
linker errors. I've boiled the problem down to the following:
A file header.h contains
#ifndef HEADER_H
#define HEADER_H
#define CONSTANT1 ("")
#define CONSTANT2 ""
#define CONSTANT3 ((char*)0)
#define CONSTANT4 (char*)0
I'm using cgo to wrap a C library and have run into a strange set of
linker errors. I've boiled the problem down to the following:
A file header.h contains
#ifndef HEADER_H
#define HEADER_H
#define CONSTANT1 ("")
#define CONSTANT2 ""
#define CONSTANT3 ((char*)0)
#define CONSTANT4 (char*)0
Audit of who ran what command via ssh with shared account
Audit of who ran what command via ssh with shared account
We use shared accounts on our servers. Each uses a different ssh key. Is
there a way to create an audit trail of who ran what commands? We can
distinguish real "users" by the ssh key used.
We use shared accounts on our servers. Each uses a different ssh key. Is
there a way to create an audit trail of who ran what commands? We can
distinguish real "users" by the ssh key used.
My desktop shows no video signal on boot?
My desktop shows no video signal on boot?
Computer: Dell Optiplex GX620
Monitor: HP w1907
OS: Dual-Boot Ubuntu 13.04/Windows 7
Problem: When I turn my computer on it shows no video signal. The power
light is on and the VGA cord is completely in. After about 5 minutes I'll
unplug and restart my computer. Sometimes when I do this I can hear the
fan blowing at full power. After about 15-20 trial-and-error runs I'll
finally get the computer on and boot up normally. How can I fix this?
*Note: I am reluctant to open up my computer, but I will as a last resort.
Computer: Dell Optiplex GX620
Monitor: HP w1907
OS: Dual-Boot Ubuntu 13.04/Windows 7
Problem: When I turn my computer on it shows no video signal. The power
light is on and the VGA cord is completely in. After about 5 minutes I'll
unplug and restart my computer. Sometimes when I do this I can hear the
fan blowing at full power. After about 15-20 trial-and-error runs I'll
finally get the computer on and boot up normally. How can I fix this?
*Note: I am reluctant to open up my computer, but I will as a last resort.
Subscribe to:
Comments (Atom)