Monday 30 September 2013

Using the definition of the derivative to prove a constant function – math.stackexchange.com

Using the definition of the derivative to prove a constant function –
math.stackexchange.com

I am presented with the following task: "Let $f$ be a function defined on
the interval $I$. All we know about $f$ is that there is a constant $K$
such that $$|f(a) - f(b)| \leq K|a-b|^2$$ for all …

which statement best describes the linear correlation

which statement best describes the linear correlation

Over the course of a given week, 39 members of a reading club went to the
library
The table below shoes the ages of these 39 members and the number of time
they visited the library that week

Which one of the following statements best describes the linear
correlation between the ages of the members and the number of library
visits?
a) the correlation is positive and high
b) the correlation is positive and low
c) the correlation is negative and high
d) the correlation is negative and low
I don't understand how to solve this question just by looking at the
table. Do i draw a scatter plot? but we don't have ordered pairs (x,y)

Start with MySQL and change to MongoDB in the future?

Start with MySQL and change to MongoDB in the future?

I'm new to node.js I have plan to use database other than MySQL (lets say
MongoDB), but I'm only familiar with MySQL.
DO you think better to use MySQL first and change to MongoDB in the
future? or learn MongoDB quickly and use MongoDB from beginning?

EasyMock partial mock private methods

EasyMock partial mock private methods

I have the following scenario:
public class ClassA {
public void methodA(){
try {
int result=methodB();
} catch (IOException e) {
//Some code here
}
}
private int methodB() throws IOException{
//Some code here
return 1;
}
}
I want to cover the catch block of the public method methodA() in my test.
I don't want to change the visibility of the private method. Is there any
way to achieve partial mock of private method using EasyMock? Or is there
any way to change the behaviour of private method in my Junit class to
throw exception without using mocking?
Thanks in advance.

Sunday 29 September 2013

scatter-gather list in Linux kernel device driver

scatter-gather list in Linux kernel device driver

I am working on a device driver that has access to a scatter-gather list
(sg) element. I am able to extract the data out of it and store it in an
allocated buffer using sg_copy_to_buffer. Now, my idea is to create a new
scatterlist and copy from this buffer into the new scatterlist I create
(ofcourse this is done later) and return this new scatterlist back to the
kernel. (This is for performance metrics, etc.) I tried searching online
for documentation to use scatterlist, etc. but to no avail. What I
typically am doing:
char *buffer = kmalloc (***);
struct scatterlist *sglist = kmalloc (sizeof (struct scatterlist)...);
sg_init_one(sglist, buffer, BUFFER_SIZE);
sg_copy_to_buffer (inp_sglist, inp_sglist_len, buffer);
*** Later ***
sg_copy_from_buffer (sglist, 1, buffer);
Is there a good documentation to help me map my scatterlist to a virtual
buffer? I tried looking at http://lwn.net/Articles/256368/
http://www.linuxjournal.com/article/7104 etc.
Any help or pointers would be appreciated!

Where does gdb get function names from?

Where does gdb get function names from?

I'm looking at a live python process using GDB and see the following frames:
...
#5 call_function (oparg=<optimized out>, pp_stack=0x7fffb1b2ffa0) at
Python/ceval.c:4084
#6 PyEval_EvalFrameEx (f=f@entry=0x1a03850, throwflag=throwflag@entry=0)
at Python/ceval.c:2679
...
I'm confused about where does the call_function come from though. It
doesn't seem to be a symbol in either the python executable or the binary:
~ &#5125; objdump -x /usr/lib/libpython3.3m.so.1.0 | grep call_function
000000000005f0e0 l F .text 0000000000000094
call_function_tail
If it's not a known symbol, how does GDB know about it... and what is it
exactly (apart of course that it's a normal function)?

MySQL - Update field statement query/error

MySQL - Update field statement query/error

The below statement returns the results I want to change perfectly
"Showing rows 0 - 29 ( 2,018 total, Query took 0.0781 sec)" :
SELECT * FROM wp_posts WHERE ID IN
(SELECT post_id FROM wp_postmeta WHERE (meta_key = 'expires') AND
(meta_value <= NOW() - INTERVAL 1 DAY) AND (meta_value IS NOT NULL));
However the below returns an error "#1292 - Truncated incorrect datetime
value: ''", when I try and update that result sets 'post_status' field ...
Where is the error in my 2nd statements syntax please (below) ?
UPDATE wp_posts SET post_status='draft' WHERE ID IN
(SELECT post_id FROM wp_postmeta WHERE (meta_key = 'expires') AND
(meta_value <= NOW() - INTERVAL 1 DAY) AND (meta_value IS NOT NULL));
Thanks.

MVC Paging Display issue with page numbers

MVC Paging Display issue with page numbers

In my View i have implemented a paging and everything looks good. However
the format of page numbers is not what i expected. Its showing the pages
index like this :
««
«

3
4
5
6
7
8
9
10
11
12

»
»»
clicking this links works, but it should have displayed things in a
straight row
here is the code for my view
<table>
<tr>
<th>
Account Type
</th>
<th>
Account #1
</th>
<th>
Account #2
</th>
<th>
Amount
</th>
<th>
Comment
</th>
<th>
Date
</th>
</tr>
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.TransactionType)
</td>
<td>
@Html.DisplayFor(modelItem => item.AccountNumber)
</td>
<td>
@Html.DisplayFor(modelItem => item.DestAccount)
</td>
<td>
@Html.DisplayFor(modelItem => item.Amount)
</td>
<td>
@Html.DisplayFor(modelItem => item.Comment)
</td>
<td>
@Html.DisplayFor(modelItem => item.ModifiedDate)
</td>
</tr>
}
</table>
@Html.PagedListPager(Model, page => Url.Action("Index",new {page}))

Saturday 28 September 2013

Secondary keyboard is not functioning as it should [migrated]

Secondary keyboard is not functioning as it should [migrated]

I plugged USB keyboard and it doesn't function fully when I start working
in Visual Studio. I can type and mostly everything works except F12.Click
on top of Method or Class and press F12 it should take me to the
definition, but when I press from my laptops keyboard it works fine.
Anyone know why it is not working from secondary keyboard?
Thanks,

Hiding settings.py passwords for Heroku Django deployment

Hiding settings.py passwords for Heroku Django deployment

I have sensitive data (database passwords) in settings.py and I was
advised to upload my Django project to a github repository before pushing
it to Heroku on their "Getting Started with Django on Heroku". If I put
settings.py in .gitignore, then presumably it won't get deployed with my
project. How can I prevent settings.py from being exposed but still get it
deployed with my project ?

Increase Div height when checkmark is checked

Increase Div height when checkmark is checked

I currently have a fadein/out of a hidden div when a checkmark is checked.
I would like to also increase the appropriate div height as well and then
remove the same height after the check mark is unchecked. This some
snippets of my current code:
<script type="text/javascript">
$('.checkTax').change(function() {
if ($(this).attr("checked")) {
$('.prorateTax').fadeIn();
return;
}
$('.prorateTax').fadeOut();
});
</script>
The div whos height needs to be adjusted is: .article.prorate . I've tried
a few suggestions online and so far nothing is working. If other
information is needed to provide a adequate response please let me know.

Codeigniter validate_upload library can't upload file

Codeigniter validate_upload library can't upload file

I was referred to @raheel shan's thread on this page and use this
My_Upload extended library to have
if(!$this->upload->validate_upload('photo')) validation of input file, the
validation is work fine if user try to upload invalid file type and the
message is just shown in the right place.
Somehow, I can't upload image file to its folder and the filename is
unable to save into table, there was works pretty to upload the image file
and saved to table before I use this library.
Can someone please help with figure what's wrong in my code?
Controller:
public function index()
{
if(!$this->tank_auth->is_logged_in()) {
redirect('/auth/login');
}else{
$user_id = $this->session->userdata('user_id');
$profile = $this->users->get_profile_by_id($user_id);
$checked = $this->input->post('remove');
//$data['errors'] = array();
$this->form_validation->set_rules('name', 'Name',
'trim|required|xss_clean|min_length[5]|max_length[30]');
$this->form_validation->set_rules('country', 'Country',
'trim|required|xss_clean');
$this->form_validation->set_rules('website', 'Website',
'trim|xss_clean|max_length[30]');
//http://www.jeswin.com/professional/programming/codeigniter-uploading-an-image
if(isset($_FILES['photo']) AND !empty($_FILES['photo']['name'])) {
$this->form_validation->set_rules('photo', 'Photo',
'trim|callback_valid_upload');
if($this->upload->do_upload('photo')){
// image resizing
$config['source_image'] =
$this->upload->upload_path.$this->upload->file_name;
$config['maintain_ratio'] = TRUE;
$config['width'] = 100;
$config['height'] = 100;
$this->load->library('image_lib', $config); //codeigniter
default function
if(!$this->image_lib->resize()){
$this->session->set_flashdata('upload_msg',
$this->image_lib->display_errors());
}else{
$image_data = $this->upload->data();
$photo_to_table = $image_data['file_name'];
}
}
}else{
if((int) $checked == 1){
unlink('./uploads/'.$profile->photo);
$photo_to_table = '';
}else{
$photo_to_table = $profile->photo;
}
//$photo_to_table = ((int) $checked == 1) ? '' : $profile->photo;
}
if($this->form_validation->run()) { // validation ok
if(!is_null($data = $this->tank_auth->update_user(
$this->form_validation->set_value('name'),
$this->form_validation->set_value('country'),
$this->form_validation->set_value('website'),
$photo_to_table
))) { // success
$this->session->set_flashdata('msg', 'Profile has been
updated');
redirect(current_url());
}
}else{
$errors = $this->tank_auth->get_error_message();
foreach($errors as $k => $v) $data['errors'][$k] =
$this->lang->line($v);
}
//blah blah..//load view
}
public function valid_upload()
{
$user_id = $this->session->userdata('user_id');
$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'gif|jpg|jpeg|png';
$config['max_size'] = '500';
$config['file_name'] = $user_id.'_'.strtotime('now');
$config['overwrite'] = TRUE;
$config['remove_spaces'] = TRUE;
//$this->load->library('upload', $config);
$this->upload->initialize($config);
if(!$this->upload->validate_upload('photo'))
{
$this->form_validation->set_message('valid_upload',
$this->upload->display_errors());
return FALSE;
}else{
return TRUE;
}
}
}
Thanks.

Friday 27 September 2013

Laravel 4 Queue - [InvalidArgumentException] There are no commands defined in the "queue" namespace

Laravel 4 Queue - [InvalidArgumentException] There are no commands defined
in the "queue" namespace

I'm using Laravel 4 + Beanstalk + Supervisor on a CentOS 6 VPS.
It was already a pain to install both beanstalk and supervisor on the VPS,
but I got through it (I have done this same installation on my local
server, a Macbook Pro, and it's working fine there).
I want to take advantage of Laravel 4's Queues and Beanstalk to send email
asynchronously. I have made a "program" for supervisor that basically runs
the command
php artisan queue:listen --env=production
but the process associated to that won't start succesfully. The log I
defined for this process outputs the following:
[InvalidArgumentException]
There are no commands defined in the "queue" namespace.
So apparently artisan is finding something that it doesn't like at all.
Please, please, PLEASE, would you help me? Only results I've found on
Google are an unanswered git issue post, and an equally useless thread
with no answers on Laravel's forums.

General Anchor css is overriding class...but only on one page

General Anchor css is overriding class...but only on one page

I have the following after my reset at around line 69
a, a:visited {
text-decoration: none;
font-size: 1.3em;
color: #333;
font-family: "museo";
border-bottom: #444 solid 1px;
}
Then down at line 303 I have:
.leaderboard_ad {
background: #fff;
margin: 10px 36px;
position: relative;
width: 728px;
height: 70px;
padding: 5px;
border-radius: 3px;
border-bottom: #e4e4e4 solid 3px;
text-align: center;
}
.ad_title {
display: block;
border: 0;
color: blue;
font-size: 1.4em;
}
.ad_subhead {
color: green;
border: 0;
text-decoration: underline;
}
This is a development file, which is why I have the ad, it's a placeholder
for adsense.
Now, on most pages it gives me the style I want. However on one page the
leaderboard ad placeholder is being overwritten by the general anchor
style, I cannot figure out why. The HTML was copied and pasted so it's
100% the same. It appears the correct way everywhere but one page...I've
cleared my cache and it just keeps going. This seems to defy all logic.
Any ideas?
The code for the HTML:
<div class="leaderboard_ad">
<a href="#" class="ad_title">Ad Title</a>
<a href="#" class="ad_subhead">www.google.com/adsense</a>
<p>This is an example of a leaderboard AdSense text ad.</p>
</div>

How do I get all rows of a dataframe NOT designated in a vector in R?

How do I get all rows of a dataframe NOT designated in a vector in R?

I'm looking for an elegant, R-like way to capture rows in a dataframe that
don't have their indices listed in a vector:
table.combos <- matrix(data = 1:12, nrow = 10, ncol = 6, byrow=T)
table.combos
not.these<-c(2,4,5,9)
x<-table.combos[c(not.these),]
#y<- everything not in x

condensing the code or a one liner possible for this code in python

condensing the code or a one liner possible for this code in python

I have the following code and wondering if there is a simpler way to do
this. I am creating a list of tuples that holds letters from a string and
the corresponding number from a list. here it is
s="hello"
lst=[1,2,3,4,5]
res = []
for i in range(len(lst)):
res.append((s[i],lst[i]))
print res
The output is here which is correct. I am looking for condensed version if
possible
[('h', 1), ('e', 2), ('l', 3), ('l', 4), ('o', 5)]

Numpy Load OverflowError: length too large

Numpy Load OverflowError: length too large

I have an algorithm that runs through a dataset and creates a scipy sparse
matrix which in turn is saved using:
numpy.savez
and the file is open such as:
open(file, 'wb').
The matrix can get a considerable amount of disk space (it took about 20
GB running for 30 days)
After that, those matrices are loaded into other applications such as:
file = open(path_to_file, 'rb')
matrix = load(file)
data = matrix['arr_0']
ind = matrix['arr_1']
indptr = matrix['arr_2']
For 10 days it worked fine.
When running for a dataset of 30 days the matrix was also successfully
created and saved.
But when trying to load it I got the error:
Traceback (most recent call last):
File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/home/ubuntu/recsys/Scripts/Neighborhood/s3_CRM_neighborhood.py",
line 76, in <module>
data = matrix['arr_0']
File "/usr/lib/python2.7/dist-packages/numpy/lib/npyio.py", line 241, in
__getitem__
return format.read_array(value)
File "/usr/lib/python2.7/dist-packages/numpy/lib/format.py", line 458,
in read_array
data = fp.read(int(count * dtype.itemsize))
OverflowError: length too large
If I could successfully create and save the matrices shouldn't it be able
to also load the result? Is there some overhead that is killing the
loading? Is is possible to work around this issue?
Thanks in advance,

Flot Pie chart with legend & Pie labels

Flot Pie chart with legend & Pie labels

I am using flot library to draw pie chart. I want to draw pie chart having
combination of legend & pie labels. Wherein pie labels will only display
slice percentage & corresponding label information from data series will
be displayed in legend. Is this combination possible using flot charts?

How to deal with the "one unnamed variable" error in SPSS Amos?

How to deal with the "one unnamed variable" error in SPSS Amos?

I received the following question via email:
I am trying to run a five factor model with uncorrelated factors. Amos
keeps saying when I go to run the analysis that one variable is unnamed. I
cannot find it for the life of me and am 100% certain that I have labelled
all the variables.
After running Amos tutorials in universities, it seems like every second
student encounters this error. However, experienced users rarely if ever
experience the error.
Questions
What causes the "one variable unnamed error" in Amos?
How can it be presented?
How can a model be recovered?

Thursday 26 September 2013

Converting image url to complete html image tag

Converting image url to complete html image tag

I am working on comments thing and i want my user to be able to post image
url which i will change into image url with tag
my function
function ImageTag($text) {
// The Regular Expression filter
$reg_exUrl =
"/(http|https)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)?/";
// The Text you want to filter for urls
if(preg_match_all($reg_exUrl, $text, $url)) {
// make the urls hyper links
$matches = array_unique($url[0]);
foreach($matches as $match) {
$check = substr($match, -4);
if ($check == ".jpg" || $check == ".png" || $check ==
".gif" || $check == "jpeg" || $check == ".JPG" || $check
== ".PNG" || $check == ".GIF" || $check == "JPEG"){
$replacement = "<br/><img src=$match>";
$text = str_replace($match, $replacement, $text);
}
}
return nl2br($text);
} else {
// if no urls in the text just return the text
return nl2br($text);
}
}
$text = "The text you want to filter goes here. <img
src='http://static.php.net/www.php.net/images/php.gif'>
http://www.facebook.com http://static.php.net/www.php.net/images/php.gif";
$content = ImageTag($text);
echo $content;
I am half done with my function but i am not sure how to solve image which
are already have html tags
This is what i am getting

source code:
The text you want to filter goes here. <img src='<br/><img
src=http://static.php.net/www.php.net/images/php.gif>'>
http://www.facebook.com <br/><img
src=http://static.php.net/www.php.net/images/php.gif>

Wednesday 25 September 2013

Where to locate certain functionality - in the object class methods or in the application code? (Object oriented design)

Where to locate certain functionality - in the object class methods or in
the application code? (Object oriented design)

It's been a very long time since I touched object oriented programming, so
I'm a bit rusty and would appreciate your insight.
Given a class, for example CDPlayer, that includes the field
numberOfTracks and currentTrack and the methods getCurrentTrack and
setCurrentTrack, where should I put the functionality to set the current
track to a random track? In a method such as setRandomTrack inside this
class, or in the application code outside this class (e.g.
player1.setCurrentTrack(randomnumbergeneratingcode))?
What are the pros and cons of each of these approaches? Which is easier to
use, change and maintain?
Many thanks!

Thursday 19 September 2013

Updating a single record in a database in ASP

Updating a single record in a database in ASP

Guys whats the prper syntax for this I need ASAP tnx! Its for updating a
certain record in the database
Dim palit As New OleDb.OleDbCommand("update sample SET(fname)Values('" &
"Anthon" & "') where fullname='" & uniqueuser & "'", conn2)

How to numerically compute nonlinear polynomials efficiently and accurately?

How to numerically compute nonlinear polynomials efficiently and accurately?

(I'm not sure whether I should post this problem on this site or on the
math site. Please feel free to migrate this post if necessary.)
My problem at hand is that given a value of k I'd like to numerically
compute a rational function of nonlinear polynomials in k which looks like
the following: (sorry I don't know how to typeset equations here...) where
{a_0, ..., a_N; b_0, ..., b_N; u_0, ..., u_N, v_0, ..., v_N} are real
constant numbers and i is the imaginary number. I learned from Numerical
Recipes that there are whole bunch of ways to compute polynomials quickly,
in the meanwhile keeping the rounding error small enough if all
coefficients were constant. But I do not think those ideas are useful in
my case.
Currently I calculate it in a brute force way in C with complex.h (this is
just a pseudo code):
double complex function(double k)
{
return
(a_0+a_1*cexp(I*u_1*k)*k+a_2*cexp(I*u_2*k)*k*k+...)/(b_0+b_1*cexp(I*v_1*k)*k+v_2*cexp(I*v_2*k)*k*k+...);
}
However when the number of calls of function increases (because this is
just a part of my real calculation), it is very slow and inaccurate (only
6 valid digits). I appreciate any comments and/or suggestions.

A generic procedure that can execute any procedure/function

A generic procedure that can execute any procedure/function

input
Package name (IN)
procedure name (or function name) (IN)
A table indexed by integer, it will contain values that will be used to
execute the procedure (IN/OUT).
E.g
let's assume that we want to execute the procedure below
utils.get_emp_num(emp_name IN VARCHAR
emp_last_name IN VARCHAR
emp_num OUT NUMBER
result OUT VARCHAR);
The procedure that we will create will have as inputs:
package_name = utils
procedure_name = get_emp_num
table = T[1] -> name
T[2] -> lastname
T[3] -> 0 (any value)
T[4] -> N (any value)
run_procedure(package_name,
procedure_name,
table)
The main procedure should return the same table that has been set in the
input, but with the execution result of the procedure

table = T[1] -> name
T[2] -> lastname
T[3] -> 78734 (new value)
T[4] -> F (new value)
any thought ?

PHPBB Custom Search Box?

PHPBB Custom Search Box?

I am working on my website and would like to incorporate a search bar on
the homepage to search the forums. Has anyone done this before? I did a
fair amount of research and can't seem to find much. Thanks in advanced,
Josh

excel data mining connect to server with custom username and password

excel data mining connect to server with custom username and password

I can't connect in excel to remote server in data mining add-in. ain
problem is that field with custom username/password is greyed and only
windows authentification is available. As we dont havee a domain, i cant
use that authentification type.

Best Books to learn SSRS and SSAS

Best Books to learn SSRS and SSAS

I am beginner in SSAS and SSRS, Where do i get best books or online stuff
for SSAS(2008) and SSRS(2008), from basic level to advanced level.
Also please let me know what is the difference between 2008 and 2008R2

Wednesday 18 September 2013

how can i hide and show collaps

how can i hide and show collaps

i have two collaps in my page .i have Btn_First in collapsOne. when page
is loaded , i wanna collapsOne will be appear and collapsTwo no . and when
Btn_First clicked , collapsTwo will be appear. i did like below . all
things are correct , i get Alert in MyFunc . but collapsTwo will not
appear .
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse"
data- parent="#checkout" href="#collapseOne"> First
Step</a>
</div>
<div id="collapseOne" class="accordion-body collapse">
<div class="accordion-inner">
<form class="register-form">
<input class="input-block-level" type="text" placeholder=" Name "
id="inputname">
<input class="input-block-level" type="text" placeholder="Lname
" id="inputlname">
<button class="btn btn- medium btn-general input-block-level"
data-toggle="collapse" href="#collapseOne" type="submit"
id="Btn_First" ">Run </button>
</form>
</div>
</div>
</div>
/////////////////
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse"
data-parent="#checkout" href="#collapseTwo"> First
Step</a>
</div>
<div id="collapseOne" class="accordion-body collapse">
<div class="accordion-inner">
<form class="register-form">
<input class="input-block-level" type="text" placeholder=" Email
" id="inputEmai;">
<input class="input-block-level" type="text" placeholder="Phone "
id="inputPhone">
<button class="btn btn- medium btn-general input-block-level"
data-toggle="collapse" href="#collapseTwo" type="submit"
id="Btn_Second" ">Run </button>
</form>
</div>
</div>
</div>
///////////////////
<script type="text/javascript">
$(document).ready(function () {
$("#collapseTwo").remove();
$('#Btn_First).click(function () {
myfunc(2);
});
)};
function myfunc(flag) {
alert('hi');
if (flag == 2)
{
document.getElementById('collapseTwo').style.display = "visible";
}
}
</script>

How to do soring base on field of document?

How to do soring base on field of document?

Let's say i have a lot of data with this pattern in mongoDB:
db.customer.find()
{'_id':ObjectId('someId'),'customer':'brendon','address':'singapore','activity':[{'id':someId,'detail':'approaching'},{'id':someId,'detail':'explaining'},{'id':someId,'detail':'deal'}]}
this data means i have customer collection and each customer has array of
activity,
now, for all customer i want to do paging/sorting about 10 document per page.
and
how to do this in mongoDB.
in relational sql this is represented with:
customer (custId, name, address)
activity (actId, detail, custId)
select * from activity
left join customer
limit 10,0

batch file (windows cmd.exe) test if a directory is a link (symlink)

batch file (windows cmd.exe) test if a directory is a link (symlink)

I learned just now that this is a way to test in a batch file if a file is
a link:
dir %filename% | find "<SYMLINK>" && (
do stuff
)
How can I do a similar trick for testing if a directory is a symlink. It
doesn't work to just replace with , because dir %directoryname% lists the
contents of the directory, not the directory itself.
It seems like I need some way to ask dir to tell me about the directory in
the way that it would if I asked in the parent directory. (Like ls -d does
in unix).
Or any other way of testing if a directory is a symlink?
Thanks!

g++: error: unrecognized option ‘--as-needed’

g++: error: unrecognized option '--as-needed'

I am using Ubuntu 12.10 with a gcc version 4.6.3. I am trying to build my
code and getting an error when using 'make' command
g++: error: unrecognized option '--as-needed'
My Makefile looks as follows:
LFLAGS = -Wl,-rpath,. -Wl,-rpath-link,../bin --as-needed
LDFLAGS = $(RPATH) $(RPATHLINK) -L$(USRLIB) --as-needed
Previously this code was successfully building on RedHat Linux. But now I
need to run this code on Ubuntu.
If anyone knows about this. Please help
Regards Gaurav

R Shiny + select2 tag inputs

R Shiny + select2 tag inputs

I have gotten R shiny working with select2 by using the code available here:
https://github.com/mostly-harmless/select2shiny/tree/master/inst/select2shiny
How can I use select2's tag inputs?
I'm OK editing the 'tools.js' file directly if I need to, but I would
prefer a setup that I could set the type of input in UI or Server.
Thanks!

Gif not running when loading an external page

Gif not running when loading an external page

I Have a huge php table and i want Load it via AJAX to insert a loading
gif to the user. So i'm very noob with this kind of operation and i make a
very simple code to do this task. Here is my code:
$(document).ready(function() {
$("#tableDiv").html('<center><img src="images/loader.gif"
/></center>');
$("#tableDiv").load("regulatoryData.php");
});
This is loading the gif but it is not running, it remains static. How can
i correct it? Any suggestions?
EDIT: When i drag my image to the browser it animates normally.
Sorry about my english :/

Windows Azure store procedure not executing

Windows Azure store procedure not executing

my problem is as follows,
I have a site that uses a handful of store procedures and all of these
work fine in my local development environment.
However one of these store procedures is either not being fired or is
failed once it has been published to windows azure,
My connection to the database is good as other parts of the site function
correctly, I have used fiddler to check that the post event is passing
through the correct data - which it is.
I have gone onto the Azure database and looked at the store procedure and
it all looks good, I have even tested it with the azure tools - I can pass
in data and it executes without an issue.
So I an stumped as to what else I can do to find what cause of this problem.
Last thing I did was double check my local copy and then republish this to
azure.
Store procedure
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
INSERT INTO [dbo].[Events] ([Type] ,[StartDate]) VALUES (@Type, @StartDate)
END

ssh Paramiko error missing libdb_cxx4.7.so

ssh Paramiko error missing libdb_cxx4.7.so

I am using python 2.7 and running Paramiko library to run an SSH command
between two servers. i want to automatically execute commands on the
remote server using Client.exec_command('command'). After the command is
being executed the remote server is not able to locate the libdb_cxx4.7
even though after confirming tens of times its on the same location as in
'command' in order to the start up the processname ->
self.__cmdClient.exec_command('cmd.exe //usr/local/apps/bin/processname')
it has to access the library which is on the location -->
self.__cmdClient.exec_command('/usr/local/lib') #this is the location of
the library on the remote device.

Tuesday 17 September 2013

Android: How to use cursor loader with load manager to update custom list when user receives new sms

Android: How to use cursor loader with load manager to update custom list
when user receives new sms

I want to use the cursorLoader with LoadManger to update a list via SMS
inbox content provider . I tried to get the message from the content
provider, but the broadcast receiver is firing my activity class before
the message reaches the inbox(content provided).
Previously posted my code at Android: CustomListView is not updated on
receiving new sms when cursorloader with flag is used , but there is no
reply yet. Someone please help me to post the newly received message in
list view
Thanks in adavance

Why "import" is implemented this way?

Why "import" is implemented this way?

>>> import math
>>> math.pi
3.141592653589793
>>> math.pi = 3
>>> math.pi
3
>>> import math
>>> math.pi
3
Initial Question: Why can't I get math.pi back?
I thought import would import all the defined variables and functions to
the current scope. And if a variable name already exists in current scope,
then it would replace it.
Yes it does replace it:
>>> pi = 3
>>> from math import *
>>> pi
3.141592653589793
Then I thought maybe the math.pi = 3 assignment actually changed the
property in the math class(or is it math module?), which the import math
imported.
I was right:
>>> import math
>>> math.pi
3.141592653589793
>>> math.pi = 3
>>> from math import *
>>> pi
3
So, it seems that:
If you do import x, then it imports x as a class-like thing. And if you
make changes to x.property, the change would persist in the module so that
every time you import it again, it's a modified version.
Real Question:
1. Why import is implemented this way? Why not let every import math
import a fresh, unmodified copy of math? Why leave the imported math open
to change?
2. Is there any workaround to get math.pi back after doing math.pi =
3(Except math.pi = 3.141592653589793,of course)?
3. Originally I thought import math is preferred over from math import *.
But this behaviour leaves me worrying someone else might be modifying my
imported module if I do it this way...How should I do the import?

Native phone dialer ghost appears in recent apps after calling setResultData(null);

Native phone dialer ghost appears in recent apps after calling
setResultData(null);

Whenever I try to use my own app to handle an Outgoing call, I see a
zombie/ghost/second native phone dialer appear in the recent apps. This
seems tied to calling setResultData(null) in my receiver.
Nexus 4 (Android 4.3)
I've add the correct permissions
<uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS" />
And registered my receiver as follows
and create:
public class OutGoingCallReceiver extends BroadcastReceiver{
@Override
public void onReceive(Context context, Intent intent) {
// Cancel the broadcast and prevent other receivers from picking
it up
setResultData(null);
// Do awesome call handling here
//...
}
}
Any ideas what is wrong?

Website not doesn't scale to fit mobile or tablet devices

Website not doesn't scale to fit mobile or tablet devices

Well, I can't release the URL for the site (not live yet), I was running
into issues where the website won't scale to the device screen. For
instance, I want the entire website to fit on a mobile, and tablet device
without user having to manually scale it down. However, when you view the
site, it's zoomed in. Below is the viewport tag I'm using. Any ideas?
<meta name="viewport" content="width=max-device-width, initial-scale=1">

Detect Stage3D in php

Detect Stage3D in php

Is there a way in php to detect flash version needed for a submitted swf
(in my case a game) and set it automatically to be setup for Stage3D
(Flash Player 11+)?

CURLE_COULDNT_CONNECT - while Internet is ok and server is available

CURLE_COULDNT_CONNECT - while Internet is ok and server is available

I get this error from Curl, yet, the site is available, and I see nothing
going out on wireshark. What might cause this error ?
I've try to run it against www.google.com and got the same error. this
very code was working a few hours ago. I have no idea what might cause
this.
here is the code:
CURL *curl;
CURLcode res = CURLE_OK;
struct curl_slist *headers=NULL;
headers = curl_slist_append(headers, "Content-Type: text/xml");
curl_global_init(CURL_GLOBAL_ALL);
curl = curl_easy_init();
if(curl) {
struct rcvdstring s;
init_string(&s);
string FullAddress = URL+Method;
curl_easy_setopt(curl, CURLOPT_URL, FullAddress.c_str());
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
res = curl_easy_setopt(curl, CURLOPT_POSTFIELDS, DATA.c_str());
res = curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
char buf[1024];
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, writefunc);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &s);
res = curl_easy_perform(curl);
Respons.assign(s.ptr);
return res;
}

Sunday 15 September 2013

ajax file upload not showing response on same jsp page

ajax file upload not showing response on same jsp page

<!doctype html>
<head>
<script src="js/jquery.js"></script>
<script src="js/jquery.form.js"></script>
<style>
form { display: block; margin: 20px auto; background: #eee; border-radius:
10px; padding: 15px }
#progress { position:relative; width:400px; border: 1px solid #ddd;
padding: 1px; border-radius: 3px; }
#bar { background-color: #B4F5B4; width:0%; height:20px; border-radius:
3px; }
#percent { position:absolute; display:inline-block; top:3px; left:48%; }
</style>
</head>
<body>
<h1>File Upload Demo</h1>
<form id="myForm" action="../upload" method="post"
enctype="multipart/form-data">
<input type="file" size="60" name="myfile" accept=".sql">
<input type="submit" value="Ajax File Upload">
</form>
<div id="progress">
<div id="bar"></div>
<div id="percent">0%</div >
</div>
<br/>
<div id="message"></div>
<script>
$(document).ready(function()
{
var options = {
beforeSend: function()
{
$("#progress").show();
//clear everything
$("#bar").width('0%');
$("#message").html("");
$("#percent").html("0%");
},
uploadProgress: function(event, position, total, percentComplete)
{
$("#bar").width(percentComplete+'%');
$("#percent").html(percentComplete+'%');
},
success: function()
{
$("#bar").width('100%');
$("#percent").html('100%');
},
complete: function(response)
{
$("#message").html("<font
color='green'>"+response.responseText+"</font>");
},
error: function()
{
$("#message").html("<font color='red'> ERROR: unable to upload
files</font>");
}
};
$("#myForm").ajaxForm(options);
});
</script>
</body>
</html>
To upload file using ajax, this code works fine in html. Upload response
showing at same html page. But, when I'm putting same code into jsp, then
response it showing at the next page, where I'm uploading my file i.e.
upload servlet. But, I want to show my response on my jsp page itself.
How to solve this problem.!!

cake_session 1213: Deadlock found when trying to get lock; try restarting transaction

cake_session 1213: Deadlock found when trying to get lock; try restarting
transaction

I moved to a SQL cluster environment with Percona (3 master-master
synchronous nodes, using galera load balancer), and converted all dbs to
InnoDB. we now keep getting this in our CakePHP 1.3 application
2013-09-11 09:16:52 Sql_errors: Session error: (1213: Deadlock found when
trying to get lock; try restarting transaction) -
File:/cake/libs/cake_session.php - Line:759 2013-09-11 09:16:52
Sql_errors: Session error: (1213: Deadlock found when trying to get lock;
try restarting transaction) - File:/cake/libs/cake_session.php - Line:759
2013-09-11 10:54:49 Sql_errors: Session error: (1213: Deadlock found when
trying to get lock; try restarting transaction) -
File:/cake/libs/cake_session.php - Line:759 2013-09-11 11:36:36
Sql_errors: Session error: (1213: Deadlock found when trying to get lock;
try restarting transaction) -
since it's part of the core of CakePHP I am a bit weary of making any
modifications. I wonder if anyone has ever had this problem with CakePHP
and what suggestions might be useful to avoid it?

premature end of script of django app on justhost

premature end of script of django app on justhost

I am following this tutorial on creating a django app on justhost:
http://flailingmonkey.com/install-django-justhost
During the last step, I did python mysite.fcgi and status said "200 OK"
and page content was printed. But when I visit
http://summitsense.com/test_django/ I got following errors:
[Sun Sep 15 16:21:40 2013] [warn] [client 67.194.35.87] (104)Connection
reset by peer: mod_fcgid: error reading data from FastCGI server
[Sun Sep 15 16:21:40 2013] [error] [client 67.194.35.87] Premature end of
script headers: test_django.fcgi
[Sun Sep 15 16:21:40 2013] [error] [client 67.194.35.87] SoftException in
Application.cpp:256: File "/home5/summitse/public_html/500.php" is
writeable by group
[Sun Sep 15 16:21:40 2013] [error] [client 67.194.35.87] Premature end of
script headers: 500.php
Other info:
cat .htaccess
AddHandler fcgid-script .fcgi
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ test_django.fcgi/$1 [QSA,L]
cat test_django.fcgi
import sys, os
# Where /home/your_username is the path to your home directory
sys.path.insert(0, "/home/summitse/python")
sys.path.insert(13, "/home/summitse/django-projects/test_django")
os.environ['DJANGO_SETTINGS_MODULE'] = 'test_django.settings'
from django.core.servers.fastcgi import runfastcgi
runfastcgi(method="threaded", daemonize="false")
cat 500.php
<!-- PHP Wrapper - 500 Server Error -->
<html><head><title>500 Server Error</title></head>
<body bgcolor=white>
<h1>500 Server Error</h1>
A misconfiguration on the server caused a hiccup.
Check the server logs, fix the problem, then try again.
<hr>
<?
echo "URL: http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']."<br>\n";
$fixer = "checksuexec
".escapeshellarg($_SERVER['DOCUMENT_ROOT'].$_SERVER['REQUEST_URI']);
echo `$fixer`;
?>
</body></html>
Is there something obvious that I missed?

Refreshing Label content every second WPF

Refreshing Label content every second WPF

I'm trying to refresh a label content every second. So I define two
methods as below. I use startStatusBarTimer() in my constructor of Window.
codes:
private void startStatusBarTimer()
{
System.Timers.Timer statusTime = new System.Timers.Timer();
statusTime.Interval = 1000;
statusTime.Elapsed += new
System.Timers.ElapsedEventHandler(statusTimeElapsed);
statusTime.Enabled = true;
}
private void statusTimeElapsed(object sender, ElapsedEventArgs e)
{
lblNow.Content = DateTime.Now.ToString("yyyy/MM/dd");
}
But I get this error:
The calling thread cannot access this object because a different thread
owns it.
What is wrong? Or What can I do?

Creating a decently working version of array_diff in PHP

Creating a decently working version of array_diff in PHP

I have found that the array_diff function has several issues.
For example, array_diff(array(false), array(null)) returns an empty array,
I guess due to string conversion of the provided array's items. However,
null is a totally different value from false, so I conclude array_diff is
broken. Another problem array_diff suffers from appears when it is
presented with multidimensional arrays as arguments: the function will
start throwing notices all over the place.
Now what I desire is the exact same function, although working 100%. It
should do what array_diff is supposed to do, plus accepting
multidimensional arrays and strict comparing.
I have tried some things with array_udiff, but I don't really know what I
am doing, since hardly any explanation can be found on the documentation
page.
I thought it should be rather trivial to have a function that throws out
any items that don't occur in the first array passed to that function
(which is what array_diff supposedly does), but I can't seem to find an
efficient solution.

Use generated client key and secret for http basic authentication

Use generated client key and secret for http basic authentication

I am building an API for a local online food order delivery service based
in Accra, Ghana. I have been thinking on the lines of HTTP Basic
Authentication over SSL. Yet I want to take it a step further and upon
requesting the user's credentials the first time I will provide a
temporary client access key and secret that will expire in a short period
of time, typically 24 hours. The temporary credentials will be used to
make requests to the resource server to avoid storing the user's "true"
credentials on the client.
Upon expiry of the temporary access key and secret the user will be
prompted to login again, thereby generating another access key and secret
pair.
I want the API to be secure enough yet as simple as possible. Initially I
wanted to use sessions, but I understand using sessions to authenticate an
API is not the recommended practice, but my API will be consumed by only
in-house clients.
Is this a good pattern to use? Any recommendations?
Honestly, I have been trying to avoid the complexity that comes with
implementing something like OAuth 2.0 and keep things as simple as
possible so that I can concentrate on the application logic.

Serve different images to different user agents using htaccess

Serve different images to different user agents using htaccess

I am planning to build a responsive website. Though I want the images to
look good on all devices without having to change the content.
Is there a way to serve different images to different user agents or
screen resolutions, using only htaccess?
For example have two folders "/images" and "/imagesiphone" and if user
agent is ihpone it sends images from imagesiphone istead of images (of
course I would have to duplicate all the images in the folder
"imagesiphone").
Would there be any spam reactions if you send different content for the
same requested image?
Note: I dont want to use any javsacript.

Saturday 14 September 2013

Make HTML5 draggable items scroll the page?

Make HTML5 draggable items scroll the page?

I'm using the HTML5 attribute draggable = "true" on some of my divs on my
webpage. I want it so that when you drag one of these items to the bottom
of the page, it scrolls the page down and when you drag it to the top, it
scrolls the page up.
I will eventually make a playlist on my sidebar, and since it will not
always be on view depending on where you're looking on the page, the page
needs to scroll when you're dragging.
My page is here and you can try dragging the pictures of the posts around.
On Chrome, it automatically lets me scroll down when I drag to the bottom,
but not up. On Firefox, it doesn't automatically let me scroll either
direction. Any help?
Here's a simple jsfiddle to get you started. On Chrome you should be able
to drag the Google icon down and have it scroll the page down, but not
going up.

How to write inside a DIV box with javascript

How to write inside a DIV box with javascript

I'm making a mini-game where a player attacks a npc and in the center is a
white box (div) that I call (log), because when the player damages/attacks
the npc, I want to be able for that open white space to log what happened.
I'm using the getElementById(log) and then adding something along the
lines of "document.write("You attacked X npc"), but its not working.
Any idea on how I can get text INSIDE the box and not outside it? Thanks

Best way to make a bi-directional array?

Best way to make a bi-directional array?

I'm not sure if "bidirectional" is the best name for it, but I want a data
structure where both the key and the data are unique pairs. For example:
a=1,b=2,c=3... and I want to be able to call the variables in either
direction (what is the number for "a"? what is the letter for 3?). I feel
like this should be a pretty easy task, but I'm drawing a blank. The best
I can come up with is something like
array("a"=>1,1=>"a","b"=>2,2=>"b"...). There's a better way of doing this
other than storing each pair twice, right?

Any way to set a default value in a kendo grid custom popup template?

Any way to set a default value in a kendo grid custom popup template?

I'm using a custom edit popup template for my Kendo grid, the Add New Row
and edit use the same template, when the custom popup template is opened
on Add New Row, is there any way to set a default value for one of the
fields?

Need more body on my page

Need more body on my page

Thanks for the last answer, everyone. Now I've got a new one.
I have a page located here:
http://www.cityplaceselfstorage.com
I somehow need to "strech" the blue part body down further. I have more
text that needs to go in, but it "bleeds" into the white section
underneath.
Don't know which setting in the css file to manipulate. Been trying them
all but haven't had any luck.
Ideas?
Thanks, Jason

Borrar los elementos de un cojunto de listas

Borrar los elementos de un cojunto de listas

Se os ocurre como puedo hacer esto: Estoy saturado y no me doy cuenta de
como hacerlo, por el tema de que es una colección de listas.
Collection<List> coleccionDeListas = mapaPrueba.values();
for( List lista_A :coleccionDeListas){
for(a elementA:lista_A){
//borramos de la lista
lista_A.remove(elementA); //Esto no se puede hacer, ya que se
esta recorriendo la lista.
}
}

XCode 4 ignores file encoding

XCode 4 ignores file encoding

I got a perl project with lots of files in Western ISO 1 format.
I'd love to use XCode for that project but XCode refuse to recognize their
encoding and stubbornly opens all source files as Western (MAC OS Roman),
thereby screwing up some characters. I have to reinterpret the encodings
using the file inspector for every file, each time I open the project.
Also, the text settings of the file inspector insists that the Western
(MAC OS Roman) is the default encoding, which it is not. I set it in the
XCode preferences to Western ISO 1.
All other editors (textWrangler,even textEdit) open these files fine as
Western ISO 1. What am I missing here?
XCode 4.2 MacOSX 10.7.5
Any advise on this would be much appreciated. This is driving me nuts
since a while.
Best, Thomas

Run asp.net page method in background

Run asp.net page method in background

I have one page method in asp.net. I want to run this in background.
In the javascript the code is as below:
function UpdatePowerValues()
{
PageMethods.GetUpdatedPowerValues(onSuccess, onError);
}
function onSuccess(result) {
for (var deviceIP in result) {
var deviceValues = result[deviceIP].DeviceValues;
if (deviceValues != null) {
var $deviceInfoTable = $("table[key='" + deviceIP + "']
span");
$.each($deviceInfoTable, function () {
if ($(this).attr("propName") !== undefined) {
$(this).text(deviceValues[$(this).attr("propName")]);
}
});
}
}
}
In the code behind file the Web method is of following:
[ScriptMethod, WebMethod]
public static IDictionary<string, string> GetUpdatedPowerValues()
{
IDictionary<string, string> dataDictionary = null;
SOME FUNCTIONALITY WILL BE DONE & dataDictionary is returned
return dataDictionary ;
}
I want this pagemethod to run in background. Please help me out.

Friday 13 September 2013

Running Total Issue

Running Total Issue

I am very new to C++ and am trying to accomplish a program that will
display the following: 1. A Total of all customer bills 2. Total tax
collected 3. A customer count 4. An average customer bill.
The average bill, total tax, & customer count all seem to be working just
fine. It's the totalBill variable that is throwing it off I believe. I'll
attach the code below, I can't figure it out!
#include <iostream>
#include <iomanip>
using namespace std;
int main () {
double mealPrice;
double mealTotal;
double totalBills;
double totalTax;
double mealTax;
double averageBill;
int customerCount = 0;
mealTotal = 0.0;
bool anotherMeal = true;
char response;
while (anotherMeal == true)
{
cout << "Enter price of your meal: ";
cin >> mealPrice;
cout << endl;
customerCount++;
cout << "Another cusotmer? y/n : ";
cin >> response;
cout << endl << endl;
if (response == 'n') anotherMeal = false;
} //End While Loop
mealTax = (mealPrice * 0.0575);
mealTotal = (mealPrice + mealTax);
totalBills = (mealTotal += mealTotal);
totalTax = (mealTax + mealTax);
averageBill = (totalBills / customerCount);
cout << fixed << setprecision(2) << right;
cout << "Total Customer Bills : $ " << setw(8) << right << totalBills <<
endl;
cout << "Total Tax Collected : $ " << setw(8) << right << totalTax << endl;
cout << "Customer Count : " << setw(16) << right << customerCount << endl;
cout << "Average Customer Bill : $ " << setw(8) << right << averageBill <<
endl;
cout << endl;
cout << endl;
return 0;
} //End Main
When complied it gives the right numbers only is there is one customer, if
more the total will be thrown off. Thanks in advance!

Notice: Unknown: Skipping numeric key 1 in Unknown on line 0

Notice: Unknown: Skipping numeric key 1 in Unknown on line 0

I have the following code:
include 'includes/connect.php';
$sp= "clot";
$selectall = mysqli_prepare($connection, "SELECT Count FROM prices WHERE
Category = ? ORDER BY ppu LIMIT 11");
mysqli_stmt_bind_param($selectall, 's', $sp);
mysqli_stmt_execute($selectall);
$resulttotal = mysqli_stmt_get_result($selectall);
$x=1;
while($row = mysqli_fetch_array($resulttotal, MYSQLI_ASSOC)){
$_SESSION[$x] = $row['Count'];
$x++;
}
$y=1;
while(isset($_SESSION[$y])){
if($y==11){
$_SESSION['nextstart'] = $_SESSION[$y];
unset($_SESSION[11]);
}
else{
echo($y);
echo("<br>");
echo($_SESSION[$y]);
echo("<br>");
$y++;
}
}
Which outputs the expected string of numbers (1, 17, 2, 18...) this error
message(ten times, with key 1, key 2, key 3, and so on):
Notice: Unknown: Skipping numeric key 1 in Unknown on line 0
Looking this error up, the only answer I could find was that putting an
array into a superglobal would cause this. I don't believe I've put an
array in, $row['Count'] is a string, isn't it? I couldn't find any entries
on stackoverflow about this error.
What causes this error, and what should I do to fix it? (The shown code is
just me experimenting and planning a design for endless pagination using
my database.)

How to have the nav and footer more than 1000px?

How to have the nav and footer more than 1000px?

My wrapper is 1000px. How can I have my nav bar and footer to be the whole
page? If try taking nav and footer out of the wrapper nothing is being
centered.

file upload using hidden iframe

file upload using hidden iframe

below is the code of file upload using hidden i frame which i copied from
a website, but i don't know where did the ifame called "comment.php"
<script language="Javascript">
function fileUpload(form, action_url, div_id) {
// Create the iframe...
var iframe = document.createElement("iframe");
iframe.setAttribute("id", "upload_iframe");
iframe.setAttribute("name", "upload_iframe");
iframe.setAttribute("width", "0");
iframe.setAttribute("height", "0");
iframe.setAttribute("border", "0");
iframe.setAttribute("style", "width: 0; height: 0; border: none;");
// Add to document...
form.parentNode.appendChild(iframe);
window.frames['upload_iframe'].name = "upload_iframe";
var iframeId = document.getElementById("upload_iframe");
// Add event...
var eventHandler = function () {
if (iframeId.detachEvent) iframeId.detachEvent("onload",
eventHandler);
else iframeId.removeEventListener("load", eventHandler, false);
// Message from server...
if (iframeId.contentDocument) {
content = iframeId.contentDocument.body.innerHTML;
} else if (iframeId.contentWindow) {
content = iframeId.contentWindow.document.body.innerHTML;
} else if (iframeId.document) {
content = iframeId.document.body.innerHTML;
}
document.getElementById(div_id).innerHTML = content;
// Del the iframe...
setTimeout('iframeId.parentNode.removeChild(iframeId)', 500);
}
if (iframeId.addEventListener) iframeId.addEventListener("load",
eventHandler, true);
if (iframeId.attachEvent) iframeId.attachEvent("onload", eventHandler);
// Set properties of form...
form.setAttribute("target", "upload_iframe");
form.setAttribute("action", action_url);
form.setAttribute("method", "post");
form.setAttribute("enctype", "multipart/form-data");
form.setAttribute("encoding", "multipart/form-data");
// Submit the form...
form.submit();
document.getElementById(div_id).innerHTML = "Uploading...";
}
</script>
<!-- index.php could be any script server-side for receive uploads. -->
<form>
enter style-:
<input type="text" name="styles" />
enter pic:-
<input type="file" name="datafile" /></br>
<input type="button" value="upload"
onClick="fileUpload(this.form,'comment.php','upload'); return false;" >
<div id="upload"></div>
</form>

Java on JCreator (creating a LEAP YEAR program using while loop)

Java on JCreator (creating a LEAP YEAR program using while loop)

public class LeapYear_2 {
public static void main(String[] args) {
int year = 1900;
while (year <= 2100 && (year % 4 == 0)){
System.out.println(year + " Is a Leap Year");
year++;
System.out.println(year + " Is not a leap year");
year++;
}
}
} // i just want to know if whats wrong with my Codes?... i want to create
a program that year 1900 to 2100 will show the leap year and which is NOT
i just dont know how to use while with many conditions... it seem that i
have to have many condition in while loop in order for this program to
work as i want to... THanks!

Thursday 12 September 2013

Logcat error description : Button launch crashes app

Logcat error description : Button launch crashes app

There was some permission constraint in manifest file .... I removed it
but the application still crashes on button click....Rest of the buttons
are working great..... It started happening when i used the Notepad sample
code in the SDK to impement a similar "save Notes" for my application
These are the logcat details



09-13 01:52:24.175: D/dalvikvm(786): GC_FOR_ALLOC freed 64K, 7% free
2543K/2724K, paused 215ms, total 216ms
09-13 01:52:24.195: I/dalvikvm-heap(786): Grow heap (frag case) to
4.939MB for 2457616-byte allocation
09-13 01:52:24.235: D/dalvikvm(786): GC_FOR_ALLOC freed <1K, 4% free
4943K/5128K, paused 36ms, total 36ms
09-13 01:52:24.736: W/SoundPool(786): sample 1 not READY
09-13 01:52:25.085: D/gralloc_goldfish(786): Emulator without GPU
emulation detected.
09-13 01:52:25.485: I/Choreographer(786): Skipped 31 frames! The
application may be doing too much work on its main thread.
09-13 01:52:26.905: E/AudioTrack(786): Could not get audio output for
stream type 3
09-13 01:52:26.905: E/SoundPool(786): Error creating AudioTrack
09-13 01:52:27.025: D/dalvikvm(786): GC_FOR_ALLOC freed 28K, 3% free
5674K/5828K, paused 26ms, total 27ms
09-13 01:52:27.135: D/dalvikvm(786): GC_FOR_ALLOC freed 22K, 3% free
6090K/6236K, paused 33ms, total 38ms
09-13 01:52:27.245: I/Choreographer(786): Skipped 86 frames! The
application may be doing too much work on its main thread.
09-13 01:52:27.585: I/Choreographer(786): Skipped 39 frames! The
application may be doing too much work on its main thread.
09-13 01:52:27.985: I/Choreographer(786): Skipped 65 frames! The
application may be doing too much work on its main thread.
09-13 01:52:38.305: I/Choreographer(786): Skipped 49 frames! The
application may be doing too much work on its main thread.
09-13 01:52:38.545: I/Choreographer(786): Skipped 56 frames! The
application may be doing too much work on its main thread.
09-13 01:52:38.875: D/dalvikvm(786): GC_FOR_ALLOC freed 122K, 4% free
6816K/7056K, paused 136ms, total 141ms
09-13 01:52:38.975: I/dalvikvm-heap(786): Grow heap (frag case) to
9.112MB for 2457616-byte allocation
09-13 01:52:39.065: D/dalvikvm(786): GC_FOR_ALLOC freed 2K, 3% free
9214K/9460K, paused 96ms, total 96ms
09-13 01:52:39.645: W/SoundPool(786): sample 1 not READY
09-13 01:52:40.215: I/Choreographer(786): Skipped 33 frames! The
application may be doing too much work on its main thread.
09-13 01:52:48.765: E/AudioTrack(786): Could not get audio output for
stream type 3
09-13 01:52:48.765: E/SoundPool(786): Error creating AudioTrack
09-13 01:52:49.205: D/dalvikvm(786): GC_FOR_ALLOC freed 70K, 2% free
9546K/9736K, paused 51ms, total 81ms
09-13 01:52:49.265: I/dalvikvm-heap(786): Grow heap (frag case) to
11.779MB for 2457616-byte allocation
09-13 01:52:49.425: D/dalvikvm(786): GC_FOR_ALLOC freed 3542K, 31%
free 8404K/12140K, paused 158ms, total 160ms
09-13 01:52:49.685: I/Choreographer(786): Skipped 186 frames! The
application may be doing too much work on its main thread.
09-13 01:52:49.845: I/Choreographer(786): Skipped 37 frames! The
application may be doing too much work on its main thread.
09-13 01:52:50.205: I/Choreographer(786): Skipped 79 frames! The
application may be doing too much work on its main thread.
09-13 01:52:54.234: E/AudioTrack(786): Could not get audio output for
stream type 3
09-13 01:52:54.234: E/SoundPool(786): Error creating AudioTrack
09-13 01:52:54.564: D/dalvikvm(786): GC_FOR_ALLOC freed 32K, 31% free
8440K/12140K, paused 62ms, total 73ms
09-13 01:52:54.604: I/dalvikvm-heap(786): Grow heap (frag case) to
11.305MB for 3094560-byte allocation
09-13 01:52:54.774: D/dalvikvm(786): GC_FOR_ALLOC freed 3K, 25% free
11459K/15164K, paused 170ms, total 170ms
09-13 01:52:55.095: I/Choreographer(786): Skipped 194 frames! The
application may be doing too much work on its main thread.
09-13 01:52:55.244: I/Choreographer(786): Skipped 34 frames! The
application may be doing too much work on its main thread.
09-13 01:52:55.495: I/Choreographer(786): Skipped 54 frames! The
application may be doing too much work on its main thread.
09-13 01:52:58.245: I/Choreographer(786): Skipped 47 frames! The
application may be doing too much work on its main thread.
09-13 01:52:59.015: E/AudioTrack(786): Could not get audio output for
stream type 3
09-13 01:52:59.015: E/SoundPool(786): Error creating AudioTrack
09-13 01:52:59.045: D/AndroidRuntime(786): Shutting down VM
09-13 01:52:59.045: W/dalvikvm(786): threadid=1: thread exiting with
uncaught exception (group=0x41465700)
09-13 01:52:59.065: E/AndroidRuntime(786): FATAL EXCEPTION: main
09-13 01:52:59.065: E/AndroidRuntime(786):
android.content.ActivityNotFoundException: Unable to find explicit
activity class
{hellog.diwesh.NugaBest/helog.diwesh.NugaBest.NotesList}; have you
declared this activity in your AndroidManifest.xml?
09-13 01:52:59.065: E/AndroidRuntime(786): at
android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1628)
09-13 01:52:59.065: E/AndroidRuntime(786): at
android.app.Instrumentation.execStartActivity(Instrumentation.java:1424)
09-13 01:52:59.065: E/AndroidRuntime(786): at
android.app.Activity.startActivityForResult(Activity.java:3390)
09-13 01:52:59.065: E/AndroidRuntime(786): at
android.app.Activity.startActivityForResult(Activity.java:3351)
09-13 01:52:59.065: E/AndroidRuntime(786): at
android.app.Activity.startActivity(Activity.java:3587)
09-13 01:52:59.065: E/AndroidRuntime(786): at
android.app.Activity.startActivity(Activity.java:3555)
09-13 01:52:59.065: E/AndroidRuntime(786): at
helog.diwesh.NugaBest.NUGA_MainMenuActivity$1.onClick(NUGA_MainMenuActivity.java:150)
09-13 01:52:59.065: E/AndroidRuntime(786): at
android.view.View.performClick(View.java:4240)
09-13 01:52:59.065: E/AndroidRuntime(786): at
android.view.View$PerformClick.run(View.java:17721)
09-13 01:52:59.065: E/AndroidRuntime(786): at
android.os.Handler.handleCallback(Handler.java:730)
09-13 01:52:59.065: E/AndroidRuntime(786): at
android.os.Handler.dispatchMessage(Handler.java:92)
09-13 01:52:59.065: E/AndroidRuntime(786): at
android.os.Looper.loop(Looper.java:137)
09-13 01:52:59.065: E/AndroidRuntime(786): at
android.app.ActivityThread.main(ActivityThread.java:5103)
09-13 01:52:59.065: E/AndroidRuntime(786): at
java.lang.reflect.Method.invokeNative(Native Method)
09-13 01:52:59.065: E/AndroidRuntime(786): at
java.lang.reflect.Method.invoke(Method.java:525)
09-13 01:52:59.065: E/AndroidRuntime(786): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
09-13 01:52:59.065: E/AndroidRuntime(786): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
09-13 01:52:59.065: E/AndroidRuntime(786): at
dalvik.system.NativeStart.main(Native Method)



Androidmanifst
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="hellog.diwesh.NugaBest"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="11" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:name="helog.diwesh.NugaBest.MyApplication"
android:debuggable="true"
android:icon="@drawable/nuga"
android:label="@string/app_name" >
<activity
android:name="helog.diwesh.NugaBest.NUGA_HealthCareActivity_Intro"
android:configChanges="orientation|keyboardHidden"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
// 4. Layout Management
<activity
android:name="helog.diwesh.NugaBest.FileSiganlDisplay"
android:label="FileSiganlDisplay" />
<activity
android:name="helog.diwesh.NugaBest.NUGA_WebJoinActivity"
android:label="NUGA_WebJoinActivity"
android:windowSoftInputMode="stateHidden" />
<activity
android:name="helog.diwesh.NugaBest.NUGA_MainMenuActivity"
android:label="NUGA_MainMenuActivity" />
<activity
android:name="helog.diwesh.NugaBest.BTSmartSlavemodule"
android:configChanges="orientation|keyboardHidden"
android:label="SmartSlavemodule" />
<activity
android:name="helog.diwesh.NugaBest.BTDeviceListActivity"
android:configChanges="orientation|keyboardHidden"
android:label="@string/select_device"
android:theme="@android:style/Theme.Dialog" />
<activity
android:name="helog.diwesh.NugaBest.SnapActivity"
android:label="@string/title_activity_snap" >
</activity>
<activity
android:name="helog.diwesh.NugaBest.ImagesActivity"
android:label="@string/title_activity_images" >
</activity>
<activity
android:name="helog.diwesh.NugaBest.HelpActivity"
android:label="@string/Help" >
</activity>
<activity
android:name="helog.diwesh.NugaBest.AboutDevice"
android:label="@string/aboutus" >
</activity>
// Notepad Application
<activity android:name="NotesList"
android:label="@string/title_notes_list">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.EDIT" />
<action android:name="android.intent.action.PICK" />
<data
android:mimeType="vnd.android.cursor.dir/vnd.google.note"
/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.GET_CONTENT" />
<category android:name="android.intent.category.DEFAULT" />
<data
android:mimeType="vnd.android.cursor.item/vnd.google.note"
/>
</intent-filter>
</activity>
<activity android:name="NoteEditor"
android:theme="@android:style/Theme.Holo.Light"
android:screenOrientation="sensor"
android:configChanges="keyboardHidden|orientation"
>
<!-- This filter says that we can view or edit the data of
a single note -->
<intent-filter android:label="@string/resolve_edit">
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.EDIT" />
<action
android:name="helog.diwesh.NugaBest.action.EDIT_NOTE" />
<category android:name="android.intent.category.DEFAULT" />
<data
android:mimeType="vnd.android.cursor.item/vnd.google.note"
/>
</intent-filter>
<!-- This filter says that we can create a new note inside
of a directory of notes. The INSERT action creates an
empty note; the PASTE action initializes a new note from
the current contents of the clipboard. -->
<intent-filter>
<action android:name="android.intent.action.INSERT" />
<action android:name="android.intent.action.PASTE" />
<category android:name="android.intent.category.DEFAULT" />
<data
android:mimeType="vnd.android.cursor.dir/vnd.google.note"
/>
</intent-filter>
</activity>
<activity android:name="TitleEditor"
android:label="@string/title_edit_title"
android:icon="@drawable/ic_menu_edit"
android:theme="@android:style/Theme.Holo.Dialog"
android:windowSoftInputMode="stateVisible">
<!-- This activity implements an alternative action that can be
performed on notes: editing their title. It can be used as
a default operation if the user invokes this action, and is
available as an alternative action for any note data. -->
<intent-filter android:label="@string/resolve_title">
<!-- This is the action we perform. It is a custom action we
define for our application, not a generic VIEW or EDIT
action since we are not a general note viewer/editor.
-->
<action
android:name="helog.diwesh.NugaBest.action.EDIT_TITLE" />
<!-- DEFAULT: execute if being directly invoked. -->
<category android:name="android.intent.category.DEFAULT" />
<!-- ALTERNATIVE: show as an alternative action when the
user is
working with this type of data. -->
<category
android:name="android.intent.category.ALTERNATIVE" />
<!-- SELECTED_ALTERNATIVE: show as an alternative action
the user
can perform when selecting this type of data. -->
<category
android:name="android.intent.category.SELECTED_ALTERNATIVE"
/>
<!-- This is the data type we operate on. -->
<data
android:mimeType="vnd.android.cursor.item/vnd.google.note"
/>
</intent-filter>
</activity>
<activity android:name="NotesLiveFolder"
android:label="@string/live_folder_name"
android:icon="@drawable/live_folder_notes">
<intent-filter>
<action
android:name="android.intent.action.CREATE_LIVE_FOLDER" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>

Mobile back end starter google cloud

Mobile back end starter google cloud

Can't find the sample app Mobile backend starter on the google cloud
console - saw a posting on stackoverflow that said google is redoing some
of the UI on the google cloud console. any idea when the Mobile backend
starter sample kit will be visible on the google cloud console. I am
itching to try it asap.

The server unable to resolve the link MVC application

The server unable to resolve the link MVC application

I am currently working on a kendo ui tab. It contains tab1,tab2,tab3.
The first tab has the kendo ui grid which worked fine. What I am trying to
do is when a user selects a record on tab 1, tab 2 , or tab 3 it will be
enabled with data populated from controller.
here is the code:
function onChange() {
var grid = $("#product").data("kendoGrid"); ;
var selected = grid.select();
if (selected.length) {
var data = grid.dataItem(selected);
var trn= data.TRN;
$($('#tabstrip').find('a.k-link')[3]).data('contentUrl',
'TestPlan?TRN=' + hrn);
$($('#tabstrip').find('a.k-link')[2]).data('contentUrl',
'Summary?TRN=' + hrn);
var ts = $('#tabstrip').data("kendoTabStrip");
ts.reload(ts.tabGroup.children("li")[3]);
ts.reload(ts.tabGroup.children("li")[2]);
ts.enable(ts.tabGroup.children("li")[3]);
ts.enable(ts.tabGroup.children("li")[2]);
}
}
Testing: If I use Chrome to inspect the error that they could not find the
link of tab 2 and tab 3
So I suspect that my url content not format properly because it works in
the local environment but not in the server
So how I could modify the following link using URL.content?
$($('#tabstrip').find('a.k-link')[3]).data('contentUrl', 'TestPlan?TRN=' +
trn);
$($('#tabstrip').find('a.k-link')[2]).data('contentUrl',
'Summary?TRN=' + trn);

Including a small app into a Django template

Including a small app into a Django template

I am starting out in Django and haven't been able to find an answer to
this question in tutorials or elsewhere. It seems like a simple feature,
so I wonder if I am not understanding - so anyone that can explain it
clearly would be greatly appreciated.
Say I have a site with 5 different pages via Django templates. If I write
a small app that renders a poll (like the django tutorial), but I don't
want that app to have its own url, just to feature, for example, in a
sidebar of 2 of the 5 pages. The poll app has nothing to do with the other
pages/apps.
My first thought was to go to those 2 pages' templates and include the
template for the poll app - {% include "poll.html" %} ... I then found out
this renders only the html as is, but I need to reference the database
models to render a list of polls.
Inheritance doesn't quite make sense to me in this instance...
So, what would be the best practice way of doing this? For me, this is the
whole idea of plug and play apps that Django is good for, but can't figure
out how to just plug it in to other templates! I really just want to know
the simple theory behind doing this, because it seems like a key feature.
Thanks!

Query to remove all redundant entries from a table

Query to remove all redundant entries from a table

pI have a Postgres table that describes relationships between entities,
this table is populated by a process which I cannot modify. This is an
example of that table:/p precode+-----+-----+ | e1 | e2 | |-----+-----| |
A | B | | C | D | | D | C | | ... | ... | +-----+-----+ /code/pre pI want
to write a SQL query that will remove all unecessary relationships from
the table, for example the relationship code[D, C]/code is redundant as
it's already defined by code[C, D]/code. /p pI have a query that deletes
using a self join but this removes everything to do with the relationship,
e.g.:/p precodeDELETE FROM foo USING foo b WHERE foo.e2 = b.e1 AND foo.e1
= b.e2; /code/pre pResults in:/p precode+-----+-----+ | e1 | e2 |
|-----+-----| | A | B | | ... | ... | +-----+-----+ /code/pre pHowever, I
need a query that will leave me with one of the relationships, it doesn't
matter which relationship remains, either code[C, D]/code or code[D,
C]/code but not both./p pI feel like there is a simple solution here but
it's escaping me./p

Rails ActionMailer : filter emails to a specific list in development

Rails ActionMailer : filter emails to a specific list in development

Without editing any of my /app files, I'd like to edit either
development.rb or an initializer where I set a whitelist of testers.
Then the emails are sent only to those people in the whitelist (not to
spam other users mailbox).
I though of overriding deliver!, or the user.get_mail method but :
it's not in /config where it should be
it doesn't filter gem generated emailing (ie devise, mailboxer etc.)

OnSelect of Spinner show a Dialog with listview Android

OnSelect of Spinner show a Dialog with listview Android

I have a Spinner in which i am showing a list .Now i want to show that
list in a custom dialog that has listview on selection of list view item
.Spinner value will be the value that is selected from the listview item .
This is my Spinner
<Spinner
android:id="@+id/Tittle"
android:layout_width="290dp"
android:layout_marginLeft="5dp"
android:layout_marginTop="5dp"
android:visibility="gone"
android:layout_height="wrap_content"/>
This is how i am setting the value in the spinner
public void setTittle() {
String[] tittlearray = { "Mr.", "Mrs.", "Ms" };
ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(this,
android.R.layout.simple_spinner_item, tittlearray);
dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_item);
tittleSpinner.setAdapter(dataAdapter);
}
This is my ListView
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ListView
android:id="@+id/listview"
android:layout_height="wrap_content"
android:layout_width="match_parent">
</ListView>
</RelativeLayout>
Now i want this list in the Custom Dialog.Please help me to get this .

Wednesday 11 September 2013

UTC_TIMESTAMP() to user defined timezone?

UTC_TIMESTAMP() to user defined timezone?

I am storing timestamps in my db using UTC_TIMESTAMP().
I want to output them based on user selected timezone. I tried writing a
small function to do this, however, it does not output correctly.
// Date/time converter
function convertTZ($date, $tz, $tzFormat)
{
$date = new DateTime($date);
$date->setTimezone(new DateTimeZone($tz));
return $date->format($tzFormat);
}
echo $_SESSION['dtCurrLogin'].'<br />';
echo convertTZ($_SESSION['dtCurrLogin'], 'UTC', 'F j, Y @ g:i:s a e');
dtCurrLogin from db = 2013-09-12 01:23:45
the above outputs :
2013-09-12 01:23:45 September 12, 2013 @ 5:23:45 am UTC
Obviously this is not correct as I went from UTC to UTC so they should be
equal. If I change to output EST then it shows 1:23:45 am, but of course
that would not be right either.

Objectify 3 on GAE cloud

Objectify 3 on GAE cloud

For some reason I cannot upgrade the version of Objectify which my app use:
<dependency>
<groupId>com.googlecode.objectify</groupId>
<artifactId>objectify</artifactId>
<version>3.0</version>
</dependency>
It works fine locally with my GAE version
<version.gae>1.8.0</version.gae>. However, will there be any issues
pertaining to making it work when uploaded online to GAE cloud, there was
a notice of changes in the Datastore from GAE.

Missing sqlite3 after Python3 compile

Missing sqlite3 after Python3 compile

My question is much like several others. Having manually compiled Python,
sqlite3 is missing:

The main difference is that I'm using a Debian Linux system (unlike in
this question: OS X 10.8.2 python 3 import sqlite error), and Python3
(unlike in this and a bunch of other questions: Cannot import SQLite with
Python 2.6).
I was hoping for some guidance on which direction to troubleshoot in.
According to some of the Linux-but-older-Python questions, an error like
the one I'm getting could be caused by a missing resource during linking
or something (_sqlite3.so). I have two such files on my system, both of
them in older Python installations, ... but nothing related to Python3. Or
is one of these good enough? Or they say to install the libsqlite3-dev
package, then to re-compile Python. I did this, but I don't see how just
having this package on my system will affect the compilation process. And
indeed, it didn't. A second compile gave me a second Python without
sqlite3.
I wish I could just do apt-get install python3, but Debian, in its
stability, only has Python 3.2, where I need the latest version. Thoughts?

How to determine is HTML is an article?

How to determine is HTML is an article?

I have made a web crawler to index a bunch of websites (we'll use CNN for
example). Now just the site URL alone isn't enough to reliably determine
if the URL is actually article content and not a blog, video, or anything
else.
I have read on here and some users and suggested using boilerpipe for this
issue, but that does not do this functionality (it just scrapes content
from HTML code).
What is a good way, or algorithm for determining if a URL, and/or the
corresponding HTML code, is an article? Is there any APIs for this? I
realize this could different slightly from site to site.
Thank you, Rich

Lightview by Nick Stakenburg Rotate Image

Lightview by Nick Stakenburg Rotate Image

I'm using Lightview by Nick Stakenburg and I really need urgent help on it.
Here's the process.
Page loads with link to the image
User clicks the link to the image
Lightview/Lightbox shows up with the image and a rotate button
User clicks the rotate button. In Firefox and IE8, the image rotates just
fine but in IE10, the image is not updating. It seems to be rotating but
the image just moves a bit and doesn't change orientation.
Caching is not the problem as I have already disabled the cache on the page.
Big thanks to the person who can help.

Tuesday 10 September 2013

Bootrap datetimepicker not triggering asp textbox's onTextChanged event

Bootrap datetimepicker not triggering asp textbox's onTextChanged event

I can't seem to get my textbox to automatically postback after selecting a
date from the bootstrap datetimepicker (Downloaded from here). I stil have
to press enter for the event to trigger.
<div class="span3">Date<br />
<div id="datepicker" class="input-append date">
<asp:TextBox ID="txtDate" runat="server"
OnTextChanged="txtDate_TextChanged" AutoPostBack="true" />
<span class="add-on">
<i data-time-icon="icon-time"
data-date-icon="icon-calendar"></i>
</span>
</div>
</div>

Your Facebook Page Notifications RSS

Your Facebook Page Notifications RSS

I have read posts about how Facebook is deprecating the RSS feeds for
Facebook Pages. I'm not sure if this includes the RSS feeds for your Page
notifications on a page you manage or not? I have my RSS feeds from the
Page notifications and tried adding it to two different RSS readers
(Feedly and Mozilla Thunderbird). Initially it imported all of the
notifications, and worked fine. However, it wouldn't update the RSS Reader
when I got a new notification on my page, even though it was showing if
you went to the full RSS feed url in a browser. After 3 hours it added a
few of the new notifications.. but missed all from the entire 3 hour
period before. Is there a limit in how many notifications or connections
it can make to your RSS Feed to grab this info? Any help or links to
information about this would be greatly appreciated.
Thanks, Jon

Delete fields less than a specific value VBA

Delete fields less than a specific value VBA

I have the following column in excel
Sales Record Number 5100 5275 5310 5355 5357 5359 15 Seller ID: 233
I need VBA code to only show the rows greater than the value of 5000 so
'sales record number, '15' & "Seller ID" should be deleted.
I have tried the following:
Sub DeleteRows()
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Dim i As Long
For i = Range("A" & Rows.Count).End(xlUp).Row To 1 Step -1
If Not (Range("C" & i).Value < 5000) Then
Range("C" & i).EntireRow.Delete
End If
Next i
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub

wordpress functions to fit a frontend style site

wordpress functions to fit a frontend style site

I am looking to make a blog site that allows the following
-User can Create / Edit their own Posts (Frontend!) -User can Add events
to a calendar or Edit their events (frontend!)
those are the basic functions that I am looking for What is the best way
to do this from plugins?

Saving data in edittext when hitting Back button

Saving data in edittext when hitting Back button

So on activity 1 I click a button that takes me to activity 2. In activity
2 I enter some data into an EditText. When I hit the back button on the
phone it takes me to activity 1 which is correct but if I hit the activity
1 button again any text that I entered into the EditText is gone. I am
sure this is because I am starting a new Intent every time I hit my button
and I think I need to be using Flags but I am not certain. Below is my
basic MainActivity1 and MainActivity2 without the code I tried that didn't
work.
MainActivity1
public class MainActivity extends Activity {
Button b1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
b1 = (Button)findViewById(R.id.button2);
b1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
Intent i = new Intent(MainActivity.this,MainActivity2.class);
startActivity(i);
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
MainActivity2
public class MainActivity2 extends Activity {
EditText et1;
@Override
protected void onCreate(Bundle outState) {
super.onCreate(outState);
setContentView(R.layout.activity_main_2);
et1 = (EditText)findViewById(R.id.editText1);
}
}
}
Thank you in advance.

can't get text highlighted when multiple tags are present

can't get text highlighted when multiple tags are present

So I am trying to highlight some text once the selection around the text
is made and a button is clicked.
This is the implementation of it,
http://jsbin.com/uzILUro/1
Now there is a part of html that has multiple tags and is not getting
selected , I can't figure out the exact issue present.
Just try to select this whole paragraph and try selecting the other parts
too...
"The remainder is r when p is divided by k" means p = kq + r; the integer
q is called the quotient. For instance, "The remainder is 1 when 7 is
divided by 3" means 7 = 3·2 + 1. Dividing both sides of p = kq + r by k
gives the following alternative form p/k = q + r/k.
All the other works except the paragraph above.

EF5 Migrations throwing error on simplemembership seed

EF5 Migrations throwing error on simplemembership seed

Error:
No mapping exists from object type eTrail.Models.Global.Address to a known
managed provider native type.
The code that is throwing the error:
if (!WebSecurity.UserExists("me"))
{
WebSecurity.CreateUserAndAccount(
"me",
"password", new
{
FirstName = "Firstname",
LastName = "Lastname",
Email = "me@me.com",
Address = new Address
{
Street = "123 Stree",
Street2 = "",
City = "CityVille",
State = "UT",
Zip = "99999",
Country = "USA",
PhoneCell = "111.111.1111"
},
CreatedDate = DateTime.Now,
ModifiedDate = DateTime.Now,
ImageName = ""
});
}
My User.cs Model:
public class User : IAuditInfo
{
[Key]
[DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
public int UserId { get; set; }
public string UserName { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
[DataType(DataType.EmailAddress)]
public string Email { get; set; }
public Address UserAddress { get; set; }
public DateTime CreatedDate { get; set; }
public DateTime ModifiedDate { get; set; }
public ICollection<Role> Roles { get; set; }
public string ImageName { get; set; }
public User()
{
UserAddress = new Address();
Roles = new List<Role>();
}
}
The Address Model:
public class Address
{
[Key]
[DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public string Street { get; set; }
public string Street2 { get; set; }
public string City { get; set; }
public string State { get; set; }
public string Zip { get; set; }
public string Country { get; set; }
public string PhoneHome { get; set; }
public string PhoneCell { get; set; }
public string PhoneOther { get; set; }
public string FaxNumber { get; set; }
}
Any idea why I am getting this error? Both Model classes are in my
DbContext class as DbSet and DbSet.