Thursday, 3 October 2013

PHP POST Code Cleanup

PHP POST Code Cleanup

Is there a better way to using post data rather then defining the
variables manually?
My Current Method
<form method="POST" action="form.php">
<input type="text" name="name" id="name" />
<input type="submit" value="Submit">
</form>
<?php
$name = $_POST['name'];
function echoname ($name) {
echo $name;
};
echo "This is my new" . echoname ($name);
?>
Now I know you can just go like this for my example however it is only an
example:
<?php
$name = $_POST['name']
echo "This is my new" . $name;
?>
Is there a better way to use $_POST['value'] without having to define the
post data as a variable every time?
As a note, i have looked here: PHP Manual $_POST already
Thanks!

Wednesday, 2 October 2013

#2003 - The server is not responding

#2003 - The server is not responding

Can anyone help me?
I am using win 7 ultimate 64bit I bought a software that only use appserv
242. but appserv 242 cant start apache. So what i did is I installed the
software which has mysql in it. and then i installed appserv 249 so that i
can open phpmyadmin.
I can run the software. When I tried opening the databse using phpMyAdmin
it shows error message:
#2003 - The server is not responding.
What should I do so that I can access the database using phpMyAdmin?

SQL Join - multiple tables in same row

SQL Join - multiple tables in same row

We're developing a PHP page to create some reports. We're using data from
a database that is "populated" by a third-party application.
We need to execute a query to select "tickets" between a period and to
select other data from another table.
Example:
//Select tickets closed between dates
SELECT *
FROM ticsummary
WHERE resolution_date between #07/04/2013# AND #08/04/2013#;
//Result
Ticket Resolution_date
61968 07/04/2013This (above) is working great. However we need to add a
content that is in another table named "ticFieldVals". The content from
this table is:
ticId fieldId intVal numVal strVal
61968 1 4 Voz NULL NULL
61968 2 3 Closed NULL NULL
61968 3 2 NULL NULL
61968 100 2 NULL NULL
61968 103 NULL 300.000 NULL
61968 85253767 0 NULL NULL
61968 73913495 1 NULL NULL
61968 23260488 NULL NULL
61968 83015458 1 NULL NULL
61968 33742201 1 NULL NULL
61968 57589628 1 NULL NULL
61968 91660570 NULL NULLSo I need to execute a "join", to have
both of these tables in just one table. However the content of
ticFieldVals there is a lot of rows, and I need to put all together in
same row.
I'm sure if you can totally understand, but any help is greatly appreciated.

Delete substring from the end of string

Delete substring from the end of string

I would like to do the following in C. I have string like unsigned char
out[CHUNK]. And I would like to remove everything after a substring "LEN "
in out[CHUNK]. I do not know the position of LEN. It can appear anywhere.
Thank you

R - Forecasting Har model

R - Forecasting Har model

I'm currently completing my MSc dissertation, using R to build a realised
volatility model using HAR.
There is a great guide on using high frequency in R which has been
invaluable to me. I was wondering though if you could all help with one
issue?
I've successfully achieved page 16 example in this pdf:
http://cran.r-project.org/web/packages/highfrequency/highfrequency.pdf
However, I would like to forecast the model into the future for a few
periods. So far I have had no success and it doesn't seem to let me
forecast harmodel like an ar model.
Do you have any suggestions? I thought it would be relatively easy to
extend the forecast that takes place in the example you already provided.
My dissertation would be grateful for any help you can offer.
Thanks very much, Stephen Donnelly
P.S:
rm(list=ls(all=TRUE))
library("highfrequency")
log.ret <- function(x) { y <- diff(log(x)); return(y) }
x <- as.matrix(read.csv("C:/users/u590799/Desktop/DATA-TEST.csv"))
dates <- x[,1]
times <- x[,2]
values <- as.numeric(x[,3])
times[which(times=="")] <- "00:00:00"
date.n.time <- matrix(NA, NROW(x), 1)
for(i in seq(1, NROW(x), 1)){date.n.time[i,1] <- paste(dates[i],
times[i], sep=" ")}
date.n.time2 <- as.Date(as.character(date.n.time), "%Y-%m-%d %H:%M:%OS")
x <- as.matrix(values); rownames(x) <- date.n.time; colnames(x)
y <- log.ret(x) #5 min log returns
y <- as.xts(y)
setwd("C:/Users/u590799/Documents/QUB/RV/Output")
fname <- "The New Style-Settings-Normalised"
y.out <- harModel(data=y, periods = c(1,5,22),RVest = c("rCov"),
type="HARRV",h=1, transform=NULL)
capture.output(summary(y.out),file=paste(fname, "out-summary.txt",
sep="-"))
pdf(file=paste(fname, "out-plot.pdf", sep="-"), paper="a4r", width=12
, height=11.7); plot(y.out); dev.off()

Tuesday, 1 October 2013

How to serve cached images in django sorl-thumbnails ? It's raising 404s

How to serve cached images in django sorl-thumbnails ? It's raising 404s

I'm new to sorl-thumbnail and I am generating thumbnails that behave like
they should work fine but they don't. Here's an example of what I'm doing
{% thumbnail
"http://www.tlswebsolutions.com/wp-content/uploads/2012/03/django-logo-negative.png"
"200x200" as im %}
<img src="{{ im.url }}">
{% empty %}
<p>No image</p>
{% endthumbnail %}
I'm using memcached with the default configuration and the stats look like
my thumbnails are actually stored in the cache. The thumbnail appears in
the my folder /proj/myapp/cache/x/xx/xx.jpg
But the site raises a 404. Which I think is normal, as there is no URL
pointing to that /cache directory.
I checked the doc, they don't seem to say that there is anything
particular to do about this. Did I miss an obvious step somewhere ?
Thanks a bunch!

AJAX not working after rewrite using htaccess

AJAX not working after rewrite using htaccess

my ajax script is not working after applying rewrite rule. The ajax script
is in page http://raymondmiranda.com/image-gallery
my htaccess code is:
RewriteEngine On
# Unless directory, remove trailing slash
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/$ /$1 [R=301,L]
# Redirect external .php requests to extensionless url
RewriteCond %{THE_REQUEST} ^(.+)\.php([#?][^\ ]*)?\ HTTP/
RewriteRule ^(.+)\.php$ /$1 [R=301,L]
# Resolve .php file for extensionless php urls
RewriteRule ^([^/.]+)$ $1.php [L]
#Default Page
DirectoryIndex home.php

What is an intuitive definition of the zero vector=?iso-8859-1?Q?=3F_=96_math.stackexchange.com?=

What is an intuitive definition of the zero vector? – math.stackexchange.com

I'm learning now about vector spaces and subspaces, and one of three rules
that determine if something is a subspace of a larger vector space is that
it must contain the zero vector... but ...

Question regarding Ito Process

Question regarding Ito Process

I am new to Ito Process, so I have a following question. Consider a
standard Ito Process, $$X_t=X_0+\int_0^t\mu_sds+\int_0^t\sigma_sdW_s$$
where W is the m-dimentional Brownian motion and X is a n-dimentional
process. $\mu$ and $\sigma$ are adaptive to {$\Sigma_t$} generated by the
Brownian motion. In somewhere in my textbook, it says the drift and the
variance can be derived as following, $$\frac{d}{ds}
E(X_s|\Sigma_t)|_{s=t}= \mu_t $$ and $$\frac{d}{ds}
Var(X_s|\Sigma_t)|_{s=t}= \sigma_t\sigma_t^T$$ I thought this is trivial
and attempted to prove it myself, however it took me nearly an hour, and
can't even show the first one..
I tried the following way, $$\frac{d}{ds} E(X_s|\Sigma_t)|_{s=t}=
\frac{d}{ds}
E(X_0+\int_0^s\mu_sds+\int_0^s\sigma_sdW_s|\Sigma_t)|_{s=t}$$$$=\frac{d}{ds}
E(X_0|\Sigma_t)+\frac{d}{ds}E(\int_0^s\mu_sds)+\frac{d}{ds}E(\int_0^s\sigma_sdW_s|\Sigma_t))$$
Then I feel that the last term should be zero by the independent increment
property, but not 100% sure I can use here, inside the integral there is
$\sigma_s$, then I don't know how to proceed from here and get the above
two equation.
Any help will be extremely appreciated!!

Monday, 30 September 2013

Problem in the Installation

Problem in the Installation

I am a one of the new User to Ubuntu and downloaded the Ubuntu 12.04 ,I
installed to My Laptop 7 or 8 times but I could not see anything in the
screen which means screen is coming black color ,and i asked from my
friend they said that problem is in the Drivers of the Laptop,My Laptop
Requirements as Follows Hp Pavilion g series , Ram-2Gb, VGA-Radeon tm HD
6470 Please friend give the best answers ,i am waiting for your answers
pleaseeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee

Distinction between linear and nonlinear model – stats.stackexchange.com

Distinction between linear and nonlinear model – stats.stackexchange.com

I have read some explanations about the properties of linear vs nonlinear
models, but still I am sometimes not sure if a model on hand is a linear
or a nonlinear one. For example, is the following ...

can I base my asp membership provider 'applications' by a guid

can I base my asp membership provider 'applications' by a guid

I created an asp portal for my customers. They all access the same website
and pass in a tokenid, which is a guid. This guid tells me what company
they belong to and what they have access to.
I have the membership provider set up to not allow duplicate email
addresses and everyone under the same application. So, with this in mind,
I figured I could do the following to allow them to register with more
than one company with the same email account.
Create an membership provider application for each tokens (for each company).
Write a script that finds all of the accounts that are based on this guid
and place them under appropriate application
Will this work? Will it allow my customers to create a login for each
token/company using the same email address?
Thanks for the help!

Calling a webservice via application

Calling a webservice via application

I have a question for you. I hope you will answer it.
Criteria:
I have a third party webservice..
IS it good to call that webservice by creating my own service and then
implement in application
or
Directly implement that third party webservice in my application.
I googled a lot and couldn't identify the pros and cons.Hope you will help
me.

Sunday, 29 September 2013

subclass's sharedClient Method

subclass's sharedClient Method

In the superClass,i defined a method called "sharedClient"
+ (id)sharedClient
{
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
instance = [[self alloc]init];
});
return instance;
}
at this method i want to dispatch the object once .then i defined two
subclasses of the superClassBclass A,and class B.
i hope that after i've called the method sharedClient of A, there's a
sharedClient of A, and I"ve called the sharedClient of B, there's an
object of B.but it seems that if A and B called the method both, there
always be one object of the previously called classB

How should I display download links to only certain users in ActiveAdmin rails?

How should I display download links to only certain users in ActiveAdmin
rails?

I want to hide download links according to user role of logged in user in
Active Admin

Division of two binary numbers

Division of two binary numbers

So here I am facing a problem.I have only 25 instructions in my
instruction set.(no multiply,divide,subtract, increment instruction). now,
I am trying to preform a binary division.My problem is, how can I know if
the divisor is smaller then the dividend in order to subtract them both
(in 2's compliment form)?
INSTRUCTION SET:

C++ code compiles without include

C++ code compiles without include

Why I don't need to include cstdlib and how do I disable this? I'm using
Code::Blocks with GCC compiler on Windows 7.
#include <iostream>
using std::cout;
using std::endl;
int main()
{
cout << "Hello" << endl;
system("pause");
return 0;
}

Saturday, 28 September 2013

Bootstrap datepicker not working after build in Durandal 2.0

Bootstrap datepicker not working after build in Durandal 2.0

After building main-built.js with 'weyland build' my durandal application
fails with 'object doesn't support property or method 'datepicker''. If I
run the app with <script src="lib/require/require.js"
data-main="app/main"> everything is just fine, but if I run from
main-built.js the application stops working after navigating to a page
with bootstrap datepicker.
Can someone help me on this one?

Scrolling down on a Mobile Phone

Scrolling down on a Mobile Phone

http://54.200.76.33:8080/
I've got this working on desktop browsers.If you scroll down, you'll see a
search bar shows up at the bottom of the screen and becomes fixed to the
bottom.
If you look at this on a mobile phone, when you scroll down, the bar
doesn't immediately stick to the bottom. It'll wait until the user stops
scrolling, and then it becomes fixed to the bottom.
Is there any way to fix this? Thanks.

filepath comparsion through if condition

filepath comparsion through if condition

I am getting the two different path that are basically file path ,
injected through xml by spring ioc..
private String FilePath1; //it consists path c:\abc folder
private String FilePath2; //it consists of c:\abc\def
now I need to check that if they two are equal then they should go inside
the condition otherwise not
please advise how to achieve this..
what I have tried is ..
if (FilePath1 =! FilePath2)
{
filemove(mcrpFilePath, zipfileName); //i want if two file paths are not
wqula then it // should go inside
filemove
}