Monday, 30 September 2013

Ternary operator in C – stackoverflow.com

Ternary operator in C – stackoverflow.com

Why this program is giving unexpected numbers(ex: 2040866504, -786655336)?
#include <stdio.h> int main() { int test = 0; float fvalue = 3.111f;
printf("%d", test? fvalue : 0); …

A function on binary relations

A function on binary relations

Let $\rho$ is a function mapping every binary relation $f$ (on some set
$U$) into a function which maps binary relations into binary relations by
the formula
$$(\rho(f))(g) = f\circ g.$$
Is $\rho$:
upper adjoint in a Galois connection?
lower adjoint in a Galois connection?
meet-semilattice homomorphisms?
join-semilattice homomorphisms?
(The order assumed is the set-theoretic inclusion of binary relations.)
If it has adjoints, what these adjoints are?

Hadoop and Python: View Error

Hadoop and Python: View Error

I'm using Hadoop streaming to run some Python code. I have noticed that if
there is an error in my Python code (in mapper.py, for example), I won't
be notified about the error. Instead, the mapper program will fail to run,
and the job will be killed after a few seconds. Viewing the logs, the only
error I see is that mapper.py failed to run or was not found, which is
clearly not the case.
My question is, is there a specific log file I can check to see actual
errors that may exist in the mapper.py code? (For example, would tell me
if an import command failed)
Thank you!

adding new rows to table on clicking button in jquery

adding new rows to table on clicking button in jquery

I am pretty new to jquery..i have the following code. here i wants to get
new rows in the table on clicking add button.. but i cant get it.,
can someone tell me what mistake i ve done here?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title> Adding Next Rows </title>
<link rel="stylesheet" href="resources/css/jquery.ui.all.css">
<script src="resources/scripts/jquery.ui.effect.js"></script>
<script src="resources/scripts/jquery.ui.effect-explode.js"></script>
<style>
h3
{
color:#0000FF;
display:inline-block;
}
.pdzn_tbl1 th
{
background:#DFDFDF;
border:#D6D6D6 1px solid;
}
.pdzn_tbl1 td
{
border-right:#729111 1px solid;
border-bottom:#729111 1px solid;
padding-top: 5px;
}
</style>
</head>
<body>
<h3> Adding Next Rows </h3>
<script type="text/javascript">
function ajax()
{
if (window.XMLHttpRequest)
{
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else if (window.ActiveXObject)
{
// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
else
{
alert("Your browser does not support XMLHTTP!");
return;
}
}
var $ = jQuery.noConflict();
$("#addrows").click(function () {
if(document.getElementById("hiddenprice").value == "") {
imagecounter = 4;
} else {
imagecounter =
parseFloat(document.getElementById("hiddenprice").value) + 1;
}
//imagecounter=4;
var newImageDiv = $(document.createElement('div'))
.attr("id", 'add_div' + imagecounter);
/*onchange="return
fn_productname(this.value,\'prdname'+imagecounter+'\')"*/
newImageDiv.after().html('<table width="100%" cellpadding="0"
cellspacing="0" class="pdzn_tbl1" border="0">'+
'<tr>'+
'<td style="padding:5px;" >'+'<input type="text"
name="rollno<? $i ?>" />' + '</td>' + '<td
style="padding:5px;">'+ '<input type="text"
name="firstname<? $i ?>" />'+'</td>'+'<td
style="padding:5px;">'+'<input type="text"
name="lastname<? $i ?>"
/>'+'</td>'+'</tr>'+'</table>');
newImageDiv.appendTo("#addgroup");
$("tr:last").after(newImageDiv);
document.getElementById("hiddenprice").value = imagecounter;
imagecounter++;
});
</script>
<div class="common" style="width:1040px; -overflow-x:scroll; padding: 5px
5px 0 5px;">
<table id="maintable" width="50%" cellpadding="0" cellspacing="0"
class="pdzn_tbl1" border="#729111 1px solid" >
<tr> <th align="center"> Roll No </th>
<th align="center"> First Name </th>
<th align="center"> Last Name </th>
</tr>
<?php
$t_row=3;
for($i=1;$i<=$t_row;$i++)
{
?>
<tr id="rows">
<div style="padding-left: 5px">
<td style="padding:5px;" > <input type="text" name="rollno<? $i ?>" /> </td>
<td style="padding:5px;"> <input type="text" name="firstname<? $i ?>" />
</td>
<td style="padding:5px;"> <input type="text" name="lastname<? $i ?>" /> </td>
</tr>
</div>
<? } ?>
<div id="addgroup">
<div id="add_div1"> </div>
</div> <table>
&nbsp;
<br />
<input type="button" name="add" value="+Add" id="addrows"
style="color:#3300FF; font-size:16px; " />
<input type="hidden" id="hiddenprice" name="hiddenprice"
value="3"/> </table>
</div>
</body>
</html>
thanks in advance..!!!!

Sunday, 29 September 2013

How to get the actual vAxis max value of Google Chart API?

How to get the actual vAxis max value of Google Chart API?

I have two LineChart, each has a rangeFilter (like the one here
https://code.google.com/apis/ajax/playground/?type=visualization#chartrangefilter_control)
I want to synchronize the scale of the two chart. That is, when one chart
changed the range of view, it will change vAxis max value to suite the
maximum data in that range, and I want the other chart change scale to the
same value.
I've no idea how I can get the vAxis.viewWindow.max in realtime. Any help
would be appreciated.

Fastest way to implement a sprite

Fastest way to implement a sprite

I'm using PyOpenGL to implement a small 2D game engine. I'm hesitating on
the way I implement a Sprite class.
I'm already keeping all the scene (tiled map) in a VBO, and all textures
are kept in the same big texture. All the sprite's images are also in this
texture. So I suppose that, for performance, I should include the sprite
in the VBO, let say from position sprite_start_position.
The first question is : since a sprite can have several stances (images),
is it better to :
setting only one entry in the VBO for the sprite, and modifying the
texture coords in this entry accordingly to the stance, using
glBufferSubData
setting as many entries in the VBO as there are stances, but drawing only
the current one with glDrawArrays
other ?
The second is the similar with sprite position. Must I :
change the position of the right entry in the VBO with glBufferSubData
use some glTranslate before glDrawArrays(GL_QUADS, sprite_start_position, 1)
other ?
I'm relatively new to OpenGL and I still feel a little lost in this API...

Char pointer giving me some really strange characters

Char pointer giving me some really strange characters

When I run the example code, the wordLength is 7 (hence the output 7). But
my char array gets some really weird characters in the end of it.
wordLength = word.length();
cout << wordLength;
char * wordchar = new char[wordLength]; //new char[7]; ??
for (int i = 0; i < word.length(); i++) //0-6 = 7
{
wordchar[i] = 'a';
}
cout << wordchar;
The output: 7 aaaaaaa²²²²¦¦¦¦¦ÂD&#9577;2¦&#9792;
Desired output is: aaaaaaa... What is the garbage behind it?? And how did
it end up there?

Saturday, 28 September 2013

copy object pointer into dynamic object array

copy object pointer into dynamic object array

I am working with a class I created that has a function addClass which
allow the user to add A an Instance of Class to a dynamically allocated
array.
Here is the code of the class and a simple test:
Class.h Listing
#ifndef CLASS_H
#define CLASS_H
#include<iostream>
class Class {
public:
Class(std::string text);
Class(const Class& orig);
virtual ~Class();
Class(std::string text, Class * name, int size); //"The Other
constructor"
std::string toString();
void addClass(Class * name, int size = 1);
Class getClass(int index);
private:
Class * classArray;
std::string value;
int size;
};

I'm recieving an error when formatting a date in Python, why?

I'm recieving an error when formatting a date in Python, why?

This is my code for formatting a date:
def updateUserDBDates():
global userDB, currentDate, previousDate, changeInDate
index = 0
index2 = 0
userDB[1] = datetime.strptime("%d-%m-%Y", userDB[0])
userDB[0] = datetime.today().strftime("%d-%m-%Y")
saveData()
currentDate = userDB[0]
previousDate = userDB[1]
changeInDate = currentDate - previousDate
and I get this error:
File "/home/nathan/Documents/project001/programFiles/Project 001.py",
line 170, in updateUserDBDates
userDB[1] = datetime.strptime("%d-%m-%Y", userDB[0])
File "/usr/lib/python2.7/_strptime.py", line 325, in _strptime
(data_string, format))
ValueError: time data '%d-%m-%Y' does not match format '28-09-2013'
From what I can see everything should work fine, what is causing this
error and how can I fix it easily?
Sorry, I'm still rather new at this.
Thank you,
Nathan

Update icloud calendar via php curl

Update icloud calendar via php curl

I want to realize a script for managing events to a shared icloud
calendar. I've stored on my db several events and, on request, i need to
create an event to be seen on remote phones/ipad and so on.
Thanks to Andy and his post I had no problem for write an event to icloud,
but when I try to update or delete an event, icloud doesn't seem to record
any change. Below you can find part of the function I use to create the
event
$body = <<<__EOD
BEGIN:VCALENDAR
PRODID:-// blablabla
VERSION:2.0
BEGIN:VEVENT
METHOD:UPDATE
UID:$id
DTSTAMP:$tstamp
ORGANIZER;CN=$organizer:MAILTO:$email
DTSTART:$tstart
DTEND:$tend
SUMMARY:$name
LOCATION:$location
DESCRIPTION:$description
SEQUENCE:2
END:VEVENT
END:VCALENDAR
__EOD;
$headers = array(
'Content-Type: text/calendar; charset=utf-8',
'If-None-Match: *',
'Expect: ',
'Content-Length: '.strlen($body),
);
// CONNESSIONE E SCRITTURA
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, $userpwd);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
curl_exec($ch);
if(curl_errno($ch)) echo 'Curl error: '.curl_error($ch);
curl_close($ch);
If I exclude the connection to the icloud server and print $body the .ics
generated update without any problem my local calendar (and then replicate
the changes to icloud). Otherwise if I try to connect to icloud it won't
save the changes. I've tried to change the server request but still can't
get out of it

Friday, 27 September 2013

How to authenticate user with symfony and facebook

How to authenticate user with symfony and facebook

I was able to connect Symfony and Facebook API. I am getting all data that
I need including email.
I do not want to use ready to use solution (FOS or something like that) .
Once I got email from fb I am checking that email against db table with
doctrine and I am getting User object.
How can I authenticate that User object?
Give me some hints.

Django Views - Block Consecutive Quick Calls

Django Views - Block Consecutive Quick Calls

A button click in my app calls a view which does a few database changes
and then redirects to a new views which renders html. When the user
typically clicks on the link, he accidentally clicks on in twice to thrice
in a couple of seconds. I want to block the view call if the same call was
made less than 10 seconds ago. Of course I can do it by checking in the
database, but I was hoping to have a faster solution by using some
decorator in django.

Aggregate Self-Referencing Table

Aggregate Self-Referencing Table

I've seen several questions/answers on how to recursively query a
self-referencing table, but I am struggling to apply the answers I've
found to aggregate up to each parent, grandparent, etc. regardless of
where the item sits in the hierarchy.
MyTable
-----------
Id
Amount
ParentId
Data:
Id Amount Parent Id
1 100 NULL
2 50 1
3 50 1
4 25 2
5 10 4
If I were to run this query without filtering, and SUMming amount, the
result would be:
Id SumAmount
1 235
2 85
3 50
4 35
5 10
In other words, I want to see each item in MyTable and it's total Amount
with all children.

C++ Function declare in function

C++ Function declare in function

Why does is it compile?
int main() {
void f();
}
What is f? Is it function or variable... How can I use f?

what's the nature of property in ruby class?

what's the nature of property in ruby class?

In ruby, there is something very strange which I can't understand. Those
keywords in class like attr_reader or property in the following example.
class Voiture
attr_reader :name
attr_writer :name
property :id, Serial
property :name, String
property :completed_at, DateTime
end
How does it works ?How can I create my own ? What's that ? Function, method ?
class MyClass
mymagickstuff :hello
end

call matlab function without all its arguments

call matlab function without all its arguments

function y = myFunc(tR,mode)
if ~isfield(tR, 'isAvailable')
tR.isAvailable= false;
end
if tR.isAvailable
y = fullfile(workingFolder,'file.txt');
else
y = '';
switch(mode)
case '1'
.....
case '2'
.....
end
end
when I call myFunc(tR,'1') it'es OK but I would also to be able to call
myFunc sometimes without the mode just myFunc(tR)
how could I say in some cases within the function myFunc don't execute the
switch case when the mode varaible isn't provided in arguments ?

Stuck with :hover

Stuck with :hover

I need some help with pseudoclass :hover. I have an object which I first
want to move to the right of the page, then to the bottom, them left, then
top and continue as a Clock and never stop. I can get it to right corner
but from there it will not move to the bottom direction and forward.
Please help:
Oppgave 5-1
#animWrap {
margin: 0px; height: 667px; width: 1366px; top: 0px; left:
0px; right: 0px; bottom: 0px; background-color:
rgb(255,105,180); position: absolute;
}
#Boks{
height: 150px; width: 150px; border-radius: 0%;
background-color: rgb(255,20,147); position: absolute; top: 0px;
left: 0px; transition: left 3s linear 0s, bottom 5s linear 2s;
}
#animWrap:hover #Boks{
height: 150px; width: 150; left: 1216px;
}
<section id="animWrap">
<div id="Boks"> </div>
</section>

Thursday, 26 September 2013

compare two classes c#

compare two classes c#

I need to determine if two classes have the same value.
Class A is the model of a record in a database. The value of Class A is
set as values of textboxes in a form.
If save is triggered, I need to know if values on the textboxes are still
the same as Class A.
I created Class B and equals it to class A. Then replace Class B attribute
values to what the textboxes has.
Then I compare if Class A == Class B.
My Problem is that after I update an attribute of Class B, the same
attribute from Class A updates.
what can you suggest.

Thursday, 19 September 2013

How can I filter out certain items in an array using php?

How can I filter out certain items in an array using php?

I would like to filter out a php array based on some search criteria, but
it's not quite working.
I've been trying this code I found on google, but it giving an error?
$shortWords = '/'.$_GET['sSearch'].'/i';
$rResult = array_filter($rResult,
function($x) use ($shortWords) {
return preg_match($shortWords,$x);
});
Here is the error:
preg_match() expects parameter 2 to be string, array given
I don't quite know what the "function($x) use...." is doing...my
limitations to php.
Here is what the array looks like before the "array_filter()":
array(
[0] =>
array(
['unit_nbr'] =>'BBC 2'
['p_unit_group_id'] =>NULL
['name'] =>1
['unit_id'] =>22640
['properties_id'] =>1450
)
[1] =>
array(
['unit_nbr'] =>'BBC 3'
['p_unit_group_id'] =>NULL
['name'] =>1
['unit_id'] =>22641
['properties_id'] =>1450
)
I would like to have the unit_nbr "BBC 2" remain in the array when I pass
that search string over to the function. I don't know what I'm doing
wrong.
Any help is appreciated.
Thanks in advance.

how to redirect to two diffrerent page when base action done with js/jquery

how to redirect to two diffrerent page when base action done with js/jquery

im trying redirect to two different page the my base page . But , when
base action comleted . Sample blabla.jsp;
... ...
in js code; ... if(..){ $("#x").attr("action","b.jsp");
$("#x").attr("method","post"); } else{ $("#x").attr("action","c.jsp");`
$("#x").attr("method","post"); } ...
But ,pressing the submit button , first direct a.jsp , after redirect
b.jsp or c.jsp i cant redirect to b.jsp or c.jsp from a.jsp . This is
impossible. Dont ask me why :( .
tHANK YOU EVERYBODY

MiniMax for dots and dashes game?

MiniMax for dots and dashes game?

I need help coming up with an algorithm that develops all the states in a
4x4 game. There are 16777216 combinations and I am completely lost. I've
tried to come up with an algorithm, but I just don't know how to go about
it. thanks.

How to install rmagick on Mac OS X Mountain Lion?

How to install rmagick on Mac OS X Mountain Lion?

I'm trying to install rmagick on Mountain Lion.
I've installed ImageMagick successfully by Homebrew, but I can't install
rmagick gem. My ruby environment is managed by rvm and installed ruby
1.8.6.

I've got an error below when tried to install rmagick.
gem install rmagick -v 2.7.2
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
/Users/Macmini/.rvm/rubies/ruby-1.8.6-p420/bin/ruby extconf.rb
checking for Ruby version >= 1.8.2... yes
checking for /usr/bin/gcc... yes
checking for Magick-config... yes
checking for ImageMagick version >= 6.3.0... yes
checking for HDRI disabled version of ImageMagick... yes
checking for stdint.h... no
checking for sys/types.h... no
checking for magick/MagickCore.h... no
Can't install RMagick 2.7.2. Can't find MagickCore.h.
The erros shows that counldn't find MagickCore.h, but I found in
/usr/local/Cellar/imagemagick/6.8.6-3/include/ImageMagick-6/magick/MagickCore.h
I guess if I can manage to tell installer this path, it will go well but
I've no idea to do it.
I've googled and found similar questions below.
Can't install rmagick in Mountain Lion
"rmagick" gem installation issue
And tried to pass PKG_CONFIG_PATH and C_INCLUDE_PATH before 'gem install'
command, and wrote them to ~/.bash_profie, and build ImageMagick from
source, but nothing changed.

Does anyone know how to fix it?

jQuery rotator does not work after redesign

jQuery rotator does not work after redesign

im redesign my website and as u can see here the site where it works i
have at the app section a div rotator. I copyed the complete html tag from
class="appsblock whiteblock block with everything inside it and also the
css and script. So the same html code which is right now on my site and
works.
the problem is that it just shows me the left and right button and ( which
is the grey circle ) not the content and the rotator is also not working
anymore after the redesign. even if i copyed the complete html tag from
the site where it works http://jsfiddle.net/mK8LL/
would be nice if someone could help me . im sitting over three hours on
that now.

how to assign different task to different thread

how to assign different task to different thread

Please go through this code and help me to achieve the desired output
import java.util.Date;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import cyclicbarrier.Hashmap;
public class ThreadpoolDemo {
private static final int nthreads=10;
public static void main(String[] args) throws InterruptedException {
ExecutorService exe=Executors.newFixedThreadPool(nthreads);
for(int i=1;i<7;i++)
{
Runnable worker=new Myrunnable(i);
exe.execute(worker);
}
exe.shutdown();
}
}
class Myrunnable implements Runnable
{
private int ii;
Myrunnable(int i)
{
ii=i;
}
public void run()
{
Hashmap hsamap=new Hashmap();
System.out.println(hsamap.getcity(ii));
System.out.println(Thread.currentThread().getName()+" Executed
this");
Thread.currentThread().stop();
System.out.println(new Date());
}
}
import java.util.HashMap;
public class Hashmap {
public String getcity(int i)
{
HashMap<Integer,String> hm=new HashMap<Integer,String>();
hm.put(1, "AAAA");
hm.put(2, "BBBB");
hm.put(3, "CCCC");
hm.put(4, "DDDD");
hm.put(5, "EEEE");
hm.put(6, "FFFF");
String value=hm.get(i);
return value;
}
}
Output:
BBBB
pool-1-thread-2 Executed this
DDDD
pool-1-thread-4 Executed this
FFFF
pool-1-thread-6 Executed this
AAAA
pool-1-thread-1 Executed this
CCCC
pool-1-thread-3 Executed this
EEEE
pool-1-thread-5 Executed this
now if I change the values to for(int i=3;i<7;i++),I should get
the output as
DDDD
pool-1-thread-4 Executed this
EEEE
pool-1-thread-5 Executed this
FFFF
pool-1-thread-6 Executed this
means Thread 1 should always display "AAAA" if i request,Thread 2 should
always display "BBBB" and so on Please tell me how can i achieve this. or
else if I assign i=3; then thread 3 only should display corresponding
Hashmap values,if I assign i=5;then thread 5 only should display
corresponding Hashmap values. Thanks in advance

centOS6 desktop got auto-formatted

centOS6 desktop got auto-formatted

My system was shut-down for around 15 days. Now, when I logged-in to my
system, I was shocked..everything in my system got deleted or formatted or
invisible. There were many files and data, all, everything got
disappeared. I am not able to find the reason behind this cause. Can
anybody help me PLEASE.

Wednesday, 18 September 2013

2D arrays, Strings, doubles and addition

2D arrays, Strings, doubles and addition

My assignment is to create a program that will scan in a text file that
contains the students details and grades for 4 assignments which will then
be broken down into both Strings (the details) and doubles (the students
grades) and to finally calculate the average for each students grade and
then an average for each Assignment. The Final output should look like
this(got it from my assignment sheet):
Student Name FAN Part 1 Part 2 Part 3 Part 4 Mark Grade
Adam Adamson adam0001 85.4 79.8 82.4 86.1 82.77% HD
Bethany Bright brig0001 89.7 85.6 84.2 82.9 84.92% DN
Cameron Carlson carl0001 55.45 49.82 60.4 42.27 50.23% P
David Dawson daws0001 72.6 78.49 80.2 65.88 74.46% CR
Evelyn Ellis elli0001 50.2 35.88 48.41 58.37 46.57% FA
Frances Fitz fitz0001 78.9 75.67 82.48 79.1 78.38% DN
Greg Gregson greg0001 24.3 32.88 29.72 28.4 30.05% F
Harriett Hope hope0001 52.2 58.93 61.5 63.44 60.12% P
Ivan Indigo indi0001 88.4 91.23 90.05 92.46 91.08% HD
Jessica Jones jone0001 82.33 89.74 81.3 84.85 85.84% HD
Average 67.948 67.804 70.066 68.377 68.44% CR
StdDev 19.4441
In the text file there are 10 lines, first line is:
Adam Adamson,adam0001,85.4,79.8,82.4,86.1
and so on for 10 randomly created students. I have 3 classes, a main class
called Topic Management, a StudentMarks class (for the students grades)
and a Student class (for the name and the FAN (the adam0001 part)). I have
created an array that stores all the scores called marks. I am able to
print out the name and the FAN and am also able to assign the grades into
doubles using double score1 = double.parseDouble(); etc. each score has
it's own method which I am then calling in the main class.
The trouble I am having is getting each column of results to print out
next to the name and the fan. At the moment they just print out in single
column below. Then I need to calculate the averages, i'm not sure how to
go about it. Any help would be greatly appreciated. This is my program so
far:
This is my Main Class - Topic Management:
public class TopicManagement
{
public static void main(String[] args) throws IOException
{
System.out.println("Hello, Welcome to the Student Assesment Calculator");
System.out.println("Student Name \t FAN \t\tScore 1\tScore2\tScore
3\tScore 4\tTotal");
Student student = new Student();
StudentMarks studentMarks = new StudentMarks();
student.student();
studentMarks.score1();
studentMarks.score2();
studentMarks.score3();
studentMarks.score4();
}//end of method
}//end of class
The Student Class:
public class Student
{ //ROW, COL
String[][] nameFan = new String[10][6];
//this method outputs the name and fan
public void student() throws IOException
{
Scanner scan = new Scanner (new File ("TestResults.txt"));
for (int row = 0, col; row < nameFan.length; row++)
{
Scanner lineRead = new Scanner(scan.nextLine());
lineRead.useDelimiter(",");
col = 0; // Starting at column 0 for each row
while (lineRead.hasNext()) //Check for next
{
nameFan[row][col]=lineRead.next();
col++; // Move on to the next column
}
}
for (int row = 0; row < nameFan.length; row++)
{
System.out.print(nameFan[row][0] + "\t " + nameFan[row][1] + "\t ");
System.out.print("\n");
}
}//end of nameFan method
public String [][] nameFan()
{
return nameFan;
}
}//end of class
Then finally the StudentsMarks class:
public class StudentMarks
{
//ROW, COL
String[][] marks = new String[10][6];
//was going to call the method 'student' but would have been
confusing with the student class
public String[][] studentMarks() throws IOException
{
Scanner scan = new Scanner (new File ("TestResults.txt"));
for (int row = 0, col; row < marks.length; row++)
{
Scanner lineRead = new Scanner(scan.nextLine());
lineRead.useDelimiter(",");
col = 0; //Starting at column 0 for each row
while (lineRead.hasNext()) //Check for next
{
marks[row][col]=lineRead.next();
col++; // Move on to the next column
}
}
return marks;
}
public void score1() //method for score1
{
for (int row = 0; row < marks.length; row++)
{
double score1 = Double.parseDouble(marks[row][2]); //col
remains 2 because all of column 2 is assignment 1, it doesn't
change
System.out.print(score1);
System.out.println("\t1"); //Had a 1 print out so i knew which
was part of the first group of scores
}
}
public void score2() //method for score2
{
for (int row = 0; row < marks.length; row++)
{
double score2 = Double.parseDouble(marks[row][3]);
System.out.print(score2);
System.out.println("\t2"); //same as in score 1
}
}
public void score3()
{
for (int row = 0; row < marks.length; row++)
{
double score3 = Double.parseDouble(marks[row][4]);
System.out.print(score3);
System.out.println("\t3");
}
}
public void score4()
{
for (int row = 0; row < marks.length; row++)
{
double score4 = Double.parseDouble(marks[row][5]);
System.out.print(score4);
System.out.println("\t4");
}
}
}

telerik MVC Grid with check all checkbox not functioning

telerik MVC Grid with check all checkbox not functioning

I know my code is right but am I missing a scripts? i'm using
jquery-1.7.1.min.js
@(Html.Telerik().Grid<RenanNewTask.Models.RenanListViewModel>()
.Name("RenanGrid")
.DataKeys(dataKeys => dataKeys.Add(c => c.Org_UID))
.Columns(columns =>
{
//columns.Bound(c => c.eff_date).Title("Effective
Date").Format("{0:MM/dd /yyyy}").Width(20);
columns.Bound(c => c.eff_date).Title("Effective
Date").ReadOnly(true).Format("{0:MM/dd/yyyy}").Width(20).Encoded(true)
.ClientTemplate("<input type='checkbox' name='checkedRecords'
value='<#= eff_date #>' />")
.HeaderTemplate(
@<text>
<input type="checkbox" title="check all records"
id="checkAllRecords" />
</text>
)
.Title("")
.Width(10)
.HeaderHtmlAttributes(new { style = "text-align:center" })
.HtmlAttributes(new { style = "text-align:center" });
columns.Bound(o => o.eff_date).Width(20);
columns.Bound(c => c.name_long).Title("Name Long").Width(20);
})
.DataBinding(dataBinding => dataBinding.Ajax()
.Select("GetOrgUID", "Renan"))
.Pageable(paging => paging.Style((GridPagerStyles.PageInput |
GridPagerStyles.Numeric | GridPagerStyles.PageSizeDropDown |
GridPagerStyles.NextPrevious)).Position(GridPagerPosition.Bottom).PageTo(1).PageSize(20))
.Scrollable(scrolling => scrolling.Height(250))
.Resizable(resizing => resizing.Columns(true))
)
$('#checkAllRecords').click(function checkAll() { $("#RenanGrid tbody
input:checkbox").attr("checked", this.checked); });

mDNS discover iOS device name

mDNS discover iOS device name

I notice that some of the better network discovery apps like Fing for iOS
and iNet for Mac are able to discover the device name of iOS devices and
Mac devices even when they are not advertising Bonjour services such as
iTunes Wi-Fi Sync. How is this done? I am aware of how to do a reverse
mDNS query
http://serverfault.com/questions/143184/how-do-i-get-the-machine-name-from-an-ip-via-multicast-dns.
But that doesn't work unless Wi-Fi Sync is running or some other Bonjour
service on the iOS device. I am not sure how to get the name otherwise but
these app reliably get it. I used Wireshark while iNet was discovering and
I only see ICMP and NetBios queries all which return 0 answers.

Media queries on Kindle Fire landscape mode vs. iPad query in landscape mode

Media queries on Kindle Fire landscape mode vs. iPad query in landscape mode

I'm new to web development and responsive design, so this might be an
idiotic question. Unfortunately, I have searched and searched and cannot
find an answer.
When I write a media query for Kindle Fire landscape, it effects the iPad
landscape and vice versa. I cannot separate them. I have tried many things
and nothing works.I don't have a problem in portrait mode or with other
devices. I assume this is a problem here because the resolutions overlap,
but I thought the code below would make them mutually exclusive. It
doesn't.
Kindle landscape
@media screen and (min-width: 600px) and (max-width: 1024px){ #help{color:
red;}}
iPad landscape
@media screen and (min-width: 768px) and (max-width: 1024px){/default
color is white for desktop version so I don't specify the color in this
query/ }}
The code above will make iPad #help red. If I reverse the order and put
iPad first and Kindle second, then #help is white in Kindle.
And this code below makes the iPad landscape look fine, but Kindle is all
broken.
@media screen and (max-width: 1024px){ /code/;}}
What am I doing wrong??? How do I write code so that I can make my website
look right on Kindle without messing up the iPad? Do I need something
else, like javascript?

Group values with common domain and page values

Group values with common domain and page values

Based on a follow-up from a previous question Parsing URI parameter and
keyword value pairs, I would like to group URLs that have the same domain
and page name. The URLs may have the same or different parameters and/or
respective values. The URL/page value is printed, followed by all of it
parameter and keyword values. Looking for an answer using Python to parse,
group and print the values. I have not been able to find an answer via
Google or SO.
Example source of URLs with various parameters and values:
www.domain.com/page?id_eve=479989&adm=no
www.domain.com/page?id_eve=47&adm=yes
www.domain.com/page?id_eve=479
domain.com/cal?view=month
domain.com/cal?view=day
ww2.domain.com/cal?date=2007-04-14
ww2.domain.com/cal?date=2007-08-19
www.domain.edu/some/folder/image.php?l=adm&y=5&id=2&page=http%3A//support.domain.com/downloads/index.asp&unique=12345
blog.news.org/news/calendar.php?view=day&date=2011-12-10
www.domain.edu/some/folder/image.php?l=adm&y=5&id=2&page=http%3A//.domain.com/downloads/index.asp&unique=12345
blog.news.org/news/calendar.php?view=month&date=2011-12-10
Example output I am looking for. The URL and a list of the parameter/value
combinations from all of the URLs that are the same is the original.
www.domain.com/page
id_eve=479989
id_eve=47
id_eve=479
adm=no
adm=yes

domain.com/cal
view=month
view=day

w2.domain.com/cal
date=2007-04-14
date=2007-08-19

www.domain.edu/some/folder/image.php
l=adm
l-adm
id=2
id=2
page=http%3A//.domain.com/downloads/index.asp
page=http%3A//support.domain.com/downloads/index.asp

How do I sum thses two variables?

How do I sum thses two variables?

puts "first number please"
first = gets.chomp
puts "Second number please"
second = gets.chomp
answer = first + second
puts "The calculation is #{first} + #{second} = " + answer.to_s
I summed two variables first and second if first ==1 and second ==2 then
answer should be 3 but ruby shows 12 What is problem. What I tried is
answer = first.+(second)

SocketException Connection failed

SocketException Connection failed

I use the sample code on MSDN but it cannot work.
Below is code:
IPHostEntry ipHost = Dns.GetHostEntry(Dns.GetHostName());
IPAddress ipAddr = ipHost.AddressList[2];
IPEndPoint ipEndPoint = new IPEndPoint(ipAddr, 11000);
Socket client = new Socket(AddressFamily.InterNetwork, SocketType.Stream,
ProtocolType.Tcp);
client.Connect(ipEndPoint);

Writing unit test to check that event was triggered

Writing unit test to check that event was triggered

I am wondering what is the correct approach. First here is the test code.
describe 'Something', ->
it 'should be triggering even', (done) ->
spy = sinon.spy()
instance = new Something()
instance.on("itsdone", spy)
instance.methodCall()
spy.should.have.been.calledOnce
done()
Looks pretty straightforward, but since events are usually asynchronous,
this cannot work.
class Something
constructor: ->
@events = {}
on: (event, cb) ->
@events[event] = new signals.Signal() unless @events[event]?
@events[event].add cb
methodCall: ->
# Fire up `itsdone` event when everything else is done
setTimeout (-> @events['itsdone']?.dispatch()), 0
I have figured out one way to do it...
describe 'Something', ->
it 'should be triggering even', (done) ->
instance = new Something()
instance.on("itsdone", done)
instance.methodCall()
This works correctly and when event is not triggered, test will fail after
2 seconds. However there is no verification, that it was triggered only
one. Maybe I need another test for that ? Since I already know it's
triggered at least once, I can use test with spy after this one probably.
Another "dirty" approach could be this:
This way test will fail obviously. Then I thought about something like
this...
describe 'Something', ->
it 'should be triggering even', (done) ->
spy = sinon.spy()
instance = new Something()
instance.on("itsdone", spy)
instance.methodCall()
setTimeout ->
spy.should.have.been.calledOnce
done()
, 0
This works too, but probably not really bulletproof. It would need bigger
timeout probably to be sure. However that means tests will take longer to
process, which is not good idea.
Do you have any other ideas how this should be solved ?

Tuesday, 17 September 2013

How xx will be initialized from web.xml springs

How xx will be initialized from web.xml springs

Listener org.springframework.web.context.ContextLoaderListener calls
contextConfigLocation
through contextloader class as it extends it
{....
String configLocation =
servletContext.getInitParameter("contextConfigLocation");
...`enter code here`
}
enter code here
Listener org.springframework.web.util.Log4jConfigListener callsenter code
here log4jConfigLocation through some extended class { ... String location
= servletContext.getInitParameter("log4jConfigLocation"); .. }
Those are understandable as from servlet technology, context-params get
loaded whenever server starts up and we call it using
servletContext.getInitParameter() method.
Can somebody explain how Listeners will be initialized in Springs.

Why is random text appearing when I'm trying to type?

Why is random text appearing when I'm trying to type?

the problem I am having, is that when I am trying to type something, text
will suddenly appear where I am typingall of the sudden,all of the
suddenall of the suddenall of the suddenall of the sudden(<-like that) (I
didn't plan that)
I have noticed that the text that appears is usually something I had
selected previously. It's as if I copy and pasted it, but I never copied
the original text, and never asked it to paste. It is very unpredictable,
often happening four or five times in a row, with less than a second
between each 'paste'. I am running in Linux Xubuntu, and I have a split
partition with Windows 7. The same problem happened when I was running
CentOS next to Windows. I completely removed it and later installed
Xubuntu in the same partition. The problem has never appeared in Windows.
I've looked all over google, and no one seems to have the same problem.
I've found a rare few that had rogue characters appearing, but they were
always specific characters happening at specific times. On my system, they
seem to pop up anywhere there's a box to type in. I guess an answer I'm
expecting is that I'll need to wipe clean my hard-drive and reinstall it
all again or just put up with the annoyance, but I'm rather interested as
to what would even cause something like this, and what sort of root issue
would be at play.

Extract a substring from a string based on the position of character - Python

Extract a substring from a string based on the position of character - Python

Im trying to extract the substrings from the below string
package: name='com.example.tracker' versionCode='1' versionName='1.0'
as string 1 : versionCode='1' and as string 2: versionName='1.0'
I used str.find('versionCode) which returns me the index of 'v' in the
versioncode and i used string length to access '1'. However there are time
the versioncode might be a double digit number so I can't fix the location
of the digit. Is there a way to achieve this?
If the string is
package: name='com.example.tracker' versionCode='12' versionName='12.0'
I need to extract 12 and 12.0. My implementation can support single digits
but the digits will vary.
if line.find('versionCode') != -1:
x = line.find('versionCode')
versionCode = line[x+13:x+15]

Ldap based authentication throws NPE

Ldap based authentication throws NPE

I've configured my webapp to use ldap/AD as the
authentication/authorisation provider.
My configuration worked fine for a while but it recently out of the blue
started throwing the follwing exception:
java.lang.NullPointerException
at
org.springframework.security.ldap.userdetails.LdapUserDetailsImpl$Essence.hasAuthority(LdapUserDetailsImpl.java:195)
at
org.springframework.security.ldap.userdetails.LdapUserDetailsImpl$Essence.addAuthority(LdapUserDetailsImpl.java:188)
at
org.springframework.security.ldap.userdetails.LdapUserDetailsMapper.mapUserFromContext(LdapUserDetailsMapper.java:85)
at
org.mule.galaxy.security.ldap.LdapAuthenticationProvider.authenticate(LdapAuthenticationProvider.java:265)
at
org.springframework.security.authentication.ProviderManager.authenticate(ProviderManager.java:156)
at
org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter.attemptAuthentication(UsernamePasswordAuthenticationFilter.java:94)
at
org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:195)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at
org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at
org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at
org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)
at
org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)
at
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
at
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
and here is my spring configuration:
<bean id="propertiesLDAP"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="systemPropertiesModeName"
value="SYSTEM_PROPERTIES_MODE_OVERRIDE" /> <!-- Existing system
properties override local ones -->
<property name="location" value="classpath:META-INF/ldap.properties" />
<property name="ignoreResourceNotFound" value="false" />
<property name="ignoreUnresolvablePlaceholders" value="true" />
<property name="properties">
<props>
<prop key="providerURL">ldap:/localhost:389</prop>
<prop key="userDn">uid=admin,ou=system</prop>
<prop key="password">secret</prop>
<prop key="userSearchBaseContext">ou=system</prop>
<prop key="userSearchFilterExpression">(uid={0})</prop>
<prop key="userSearchBase">ou=system</prop>
<prop key="userSearchAttributeKey">objectclass</prop>
<prop key="userSearchAttributeValue">person</prop>
<prop key="roleDn">ou=groups,ou=system</prop>
<prop key="groupSearchFilter">uniqueMember={0}</prop>
<prop key="usernameAttribute">uid</prop>
</props>
</property>
</bean>
<bean id="contextSource"
class="org.springframework.security.ldap.DefaultSpringSecurityContextSource">
<constructor-arg value="${providerURL}" />
<property name="userDn">
<value>${userDn}</value>
</property>
<property name="password">
<value>${password}</value>
</property>
</bean>
<bean id="userSearch"
class="org.springframework.security.ldap.search.FilterBasedLdapUserSearch"
depends-on="propertiesLDAP">
<constructor-arg value="${userSearchBaseContext}" />
<constructor-arg value="${userSearchFilterExpression}" />
<constructor-arg ref="contextSource" />
<property name="searchSubtree" value="true" />
</bean>

How can I put text into css3

How can I put text into css3

I'm wondering if it's possible to have certain pieces of 'static' text in
the css3 instead of in the HTML, just like one can also have
'background-image' in css3 ?
I have searched on google but cannot seem to find any reference to this.
reards, Jurjen.

Formatting lists in erlang

Formatting lists in erlang

I am very new to erlang. I am trying to print a list to the console.
This is what I am able to do currently and stuck up.
I'm trying this out in the erl.
>List = [{"a",20},{"b", 30}].
[{"a",20},{"b",30}]
>lists:foreach( fun(H) -> io:format("~p~n", [H]) end, List).
{"a",20}
{"b",30}
I am interested in formatting each list there. I want the output to be of
the form
"a" - 20
"b" - 30
I am not knowing how would I be able to access the lists in a list and
format them as I want them to be. Any kind help would be greatly
appreciated.

Sunday, 15 September 2013

SDL file creation for a Cpp Program.

SDL file creation for a Cpp Program.

How to create a simple SDL file with .sdl extension? My task is to create
sdl file with circuit and supply it to a Cpp Program. I was given a cpp
program in which I must initialize SDL file.
circuit.Load("SDL File");
Thank you in advance for responses

How do I change the compiler in Xcode

How do I change the compiler in Xcode

I'm compiling a C code in Xcode 4.6.3, however I don't know which compiler
I'm using. I need to use gcc 4.2.
Thanks in advance.

Excel file uses accumulating memory

Excel file uses accumulating memory

I have an excel file that is only 1MB but grows memory usage indefinitely
(above 6GB) as it runs until it crashes.
The sheet is composed of 100 independent rows with about 300 columns each
where it pulls in data from an Add-in and does excel calculations. The
excel has VBA that connects to a local Access DB to pull 10,000 ID's,
which then goes through them in groups of 100 at a time, pulls in data
from the add-in (using UDF's) and then goes to the next 100.
It does the following steps: 1) Pull in a list of 10,000 unique
8-character IDs from an Access DB, inserts them into Sheet2 (unused for
anything else) - this part doesn't use much memory 2) In VBA - starting at
the top, it loops through in blocks of 100 ID's at a time, copies them
into A1:A100 positions in Sheet1 with the 300 columns of referencing UDF's
and calculations to the ID in columb A for each row 3) Calculates the
sheet to pull in new data from the UDF's for each column
This seems to only add to memory usage each time it is run even though the
previous block of 100 ID's is gone (I did it this way since it seemed to
crash if I did 10,000 all at once). The workbook is on MANUAL calculation
(hence step 3); and all objects are being set to = Nothing once done for
the DB information copying.
How do I stop the memory usage from accumulating? It seems related to the
UDF's not clearing out of memory once they have been run. Is there a way
to clear any cache in Excel or reset it with VBA after each block of 100
IDs? Thanks

background task interval period in IOS 7

background task interval period in IOS 7

I Have the following code in the appdidEnterBackground() and I see that in
IOS 6 I see that the background time period is approx 10 mins and the same
code in IOS 7 is printing 2 mins.
Here's the code:
-(void)applicationDidEnterBackground:(UIApplication *)application
{
backgroundTaskIdentifier = [[UIApplication sharedApplication]
beginBackgroundTaskWithExpirationHandler:^{
[[UIApplication sharedApplication]
endBackgroundTask:backgroundTaskIdentifier];
backgroundTaskIdentifier = UIBackgroundTaskInvalid;
}];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT,
0), ^{
NSTimeInterval timeInterval = [[UIApplication
sharedApplication] backgroundTimeRemaining];
NSLog(@" time remaining in background = %f",remainingTime);
});
}
Question is: How can I increase my background time period from 2 mins to
approx 10 mins in IOS 7? Is there anything I am missing?

how to get html class values using regular expression in ruby

how to get html class values using regular expression in ruby

I have this below string from which I want to extract class values "ruby",
"html", "java"
<div class="ruby" name="ruby_doc">
<div class="html" name="html_doc">
<div class="java" name="java_doc">
This is what I have so far
str = <<END
<div class="ruby" name="ruby_doc">
<div class="html" name="html_doc">
<div class="java" name="java_doc">
END
str.scan(/"[^"]+/) #=> returns
["\"ruby", "\" name=", "\"ruby_doc", "\">\n<div class=", "\"html",...]
str.scan(/class="[^"]+/) #=> ["class=\"ruby", "class=\"html", "class=\"java"]

PHP to get the cloumn names which are not null

PHP to get the cloumn names which are not null

Hi I am trying to write a php code . where I want get the cloumn names
which are not null.
My db looks like
person username p1 p2 p3 p4
raj raju_01 30 40
raj ravi_02 70 80
raj king_03 90 70
king raju_01 60 90
king ravi_02 80 80
king king_03 90 70
So when I query for non empty coloums for person-raj-- I need to get only
coloumn name p1,p2 when I querey for person king I need to get p3,p4. But
at same time I need to check raj should repeated for 3 times and king must
be repeated for 5 times.
Can anyone suggestme how to this.

How can i get the position of a slanted rectangle and also to copy the intensities as a matrix?

How can i get the position of a slanted rectangle and also to copy the
intensities as a matrix?

I would like to draw a rectangle on a figure and to be able to take the
positions of my rectangle so i would be able to "copy" the intensities in
the rectangle to another matrix.The rectangle needs to be able to be
slanted if i want to,so i understand the command "imrect" will not work
here.Another problem i have is once that I've drawn a slanted rectangle i
don't know how can i "copy" the intensities as a matrix,cause the matrix
is also slanted now. I'm adding part of my code so you can see what i'm
trying to do:
for k = 1 : nFrames
this_frame = read(obj, k);
thisax = axes('Parent', thisfig);
image(this_frame, 'Parent', thisax);
if k==nFrames
title(thisax, sprintf('Frame #%d', k));
end
if k==1
result=input('How many rectangles would you like to draw? ');
pos=zeros(result,4);
for i=1:result
handle=imrect;
pos(i,:)=handle.getPosition;
end
end
end

Saturday, 14 September 2013

Why does it raise an Server Error (500) when I try to enter the Application Settings Page on appengine console?

Why does it raise an Server Error (500) when I try to enter the
Application Settings Page on appengine console?

A little bit long title here, since I'm actually not a local English
speaker... Let's circle back to the question. I set up an app on Google
App Engine and as many beginners does, I used up the free quota provided.
Then I began searching reasons why that happened.Finally I adjusted my
code so that there is fewer Database Queries that traverse all the
entities. And I limited the "max_idle_clones" to 10 and raised
"min_pending_latency" to 3.00s in the "Application Settings" page, as you
can see in the screenshot (Oh, obviously you can't see any pictures since
I can't upload pictures based on my current level) But when I clicked
"Save Settings" on that page it just raised an Server Error page. But I
can see my adjustment in Admin Log page. I don't know why does it raise an
Server Error (500) when I'm trying to enter the "Application Settings"
page. Are there a few possible reasons for that?

Facebook Login Doesn't Work

Facebook Login Doesn't Work

I am trying to add Facebook login to my web site.
What I have done?
Created APP on Facebook as Website with Facebook Login
Sandbox mode is off
APP is set to work on localhost.
What is the problem?
I keep getting $user variable's value as 0
example.php in Facebook PHP SDK works just fine!
I can see my APP when I visit Facebook -> Privacy Settings -> Apps. No
matter if I login with my login.php or example.php of Facebook PHP SDK,
the app seems to be added just the same. However while example.php can
retrieve data from facebook, login.php can't.
I copy and paste the codes from example.php to my login.php page (please
check the code below).
Here is my code;
require_once('system/api/facebook/facebook.php');
$facebook = new Facebook(array(
'appId' => '123456',
'secret' => 'abcde12345',
));
$user = $facebook->getUser();
if ($user) {
try {
$user_profile = $facebook->api('/me');
} catch (FacebookApiException $e) {
error_log($e);
$user = null;
}
}
// Login or logout url will be needed depending on current user state.
if ($user) {
$logoutUrl = $facebook->getLogoutUrl();
} else {
$loginUrl = $facebook->getLoginUrl();
}
if (!$user) echo '<a href="'.$loginUrl.'">Login</a>';
echo '<pre>';
var_dump($user);
echo '</pre>';
Can someone please tell me what is the difference between my login.php and
example.php as I wasted more than 5 hours without no result?
I also Googled and searched SOF without any info which was helpful.
I hope I was able to clearly ask my question and state my problem.
Thank you all for your help and concern.

Generate video from data

Generate video from data

I have made a website in PHP and JavaScript.
Users have uploaded photos and posted about themselves.
I want the website to: Generate a video for each user, from the content
that they have uploaded.
Could you please guide me, as to which language can be used? Which
tutorials can I refer to?

HTML base element doesn't append context to head links from JSP tag file

HTML base element doesn't append context to head links from JSP tag file

I am having issues with the HTML base element not appending the context to
any link or script URL's. I am dynamically creating the base url within
the jsp, and the correct context is set in the source. However, all of the
references in the head give 404's in the browser dev console, and the page
obviously has no css. I am setting the HTML head with a jsp .tag file.
Here is my index.jsp file
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="tag" tagdir="/WEB-INF/tags"%>
<c:set var="req" value="${pageContext.request}" />
<c:set var="uri" value="${req.requestURI}" />
<!DOCTYPE html>
<html>
<head>
<base href="${req.contextPath}" >
<tag:head page="home" />
</head>
<body>
</body>
</html>
So I am setting the base as the first thing in the head, and then setting
whatever the head.tag file has. I have also tried setting the base in the
head.tag file and that doesn't work either. Here is the head.tag file
<%@ tag language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ attribute name="page" required="true" %>
<link rel="shortcut icon" type="image/x-icon" href="images/favicon.ico"/>
<title> <c:out value="${page}" /> </title>
<meta charset="UTF-8">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="css/layout.css" type="text/css" />
<link rel="stylesheet" href="stylesheet.css" type="text/css" />
<link rel="stylesheet" href="css/slide.css" type="text/css" media="screen" />
<link rel="stylesheet" href="css/jquery-ui/jquery-ui-1.10.3.custom.css"
type="text/css" media="screen" />
<script type="text/javascript" src="js/jquery-1.10.1.min.js"></script>
<script type="text/javascript"
src="js/jquery-ui-1.10.3.custom.min.js"></script>
<script type="text/javascript" src="js/ajax.js"></script>
<script type="text/javascript" src="js/onLoad.js"></script>
<script type="text/javascript" src="js/cookies.js"></script>
<script type="text/javascript" src="js/spin.js"></script>
<script type="text/javascript" src="js/slide.js"></script>
So for example, the browser is looking in
http://localhost:8080/css/layout.css for the layout stylesheet, when it
should be looking in http://localhost:8080/WebApp/css/layout.css The base
element in the html source when the page renders is '' which is valid
because it is an absolute url and defines the root. I even tried setting
the whole url inclidung http://localhost:8080 Any ideas as to whats going
on here? thanks for your help!

List files that is changed/modified today by single user

List files that is changed/modified today by single user

I need to list all files that is changed(modified) today from single users.
I tried this: find -mtime -1 but output is wrong. Can you guys/girls
please tell me is there a way to list all files that is chanfed today from
single user?

android how to subtract string from given string

android how to subtract string from given string

i m getting string in button.text i want to display only specific
charecter only but when click show full value in toast how i will do that?
Button e01;
e01.setText(days[1]); // 2013/09/11
i want to display only 11
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
switch (v.getId()) {
case R.id.e01:
value = e01.getText().toString();
Toast.makeText(this, value, Toast.LENGTH_SHORT) .show();
//value=// 2013/09/11

Friday, 13 September 2013

How to create c# class for below json object?

How to create c# class for below json object?

I am new to json. This is my json object.Anyone please help me to create
C# class for the below json object
{ "JBS" : { "name" : "Jobsite" }, "LNK" : { "name" : "Linked IN" }, "MUK"
: { "name" : "Monster UK" } }
In that I need information of (JBS,jobsite ) like that for n elements.
Thanks.

JTabbedPane Forced Size

JTabbedPane Forced Size

I have a JFrame that has 3 components on it.
The design is like this:
http://i.imgur.com/2EJxFcb.png
My problem happens in the JTabbedPane.
The pane begins off with a settings panel, which is added to it when the
whole JFrame loads up. Then, when the user connects, a new tab is added to
the pane (the actual chat panel).
When that tab is added to the pane, it overlaps the bottom of the java
applet loaded from the local file, which is NOT what I want to do. Here is
how it looks:
http://i.imgur.com/RhidGdN.png
As you can tell, the bottom of the highscores and java applet has been cut
off. How do I resize the JTabbedPane to make it resize towards the bottom,
instead of upwards?

How much of Google Maps is stored in memory on my mobile device?

How much of Google Maps is stored in memory on my mobile device?

It obviously has to be the case that the map is stored in memory.
However, when I calculate my route then turn off my wifi/3g, Google Maps
still navigates me successfully. It is also the case that, when I
pre-calculate the route, lose connection and then make a wrong turn, I am
still successfully redirected given that I don't stray TOO far from the
given path.
So how does Google Maps determine HOW MUCH of the route to store in
memory? And how is the data structured, some sort of weighted graph?

jqBootstrapValidation on input type number

jqBootstrapValidation on input type number

As far as I understand, jqBootstrapValidation should automatically
validate html5 elements, like this:
<input type="number" class="form-control" name="ordPrice"
placeholder="Price" data-validation-number-message="Not a number">
But, it doesn't. Here is my js bind:
$('#create_form').find('input,select,textarea').not('[†ype="submit"],
[type="file"]').jqBootstrapValidation({
preventSubmit: true,
submitError: function($form, event, errors) {
console.log('error!');
},
submitSuccess: function($form, event) {
console.log('success!');
event.preventDefault();
},
filter: function() {
return $(this).is(':visible');
}
});
Am I missing something very elementary here?

dust template for nested math condition

dust template for nested math condition

I want to output html table with 4 entries for each row using dust templates.
here is the template :
var compiledtlist = dust.compile(
"<table class='table'>" +
"{#data}" +
"{@math key=\"{tagid}\" method=\"mod\" operand=\"4\"}" +
"{@eq value=0}" +
"<tr><td><button class='btn btn-mini btn-info
tag'>{tname}</button>&nbsp;x&nbsp; <span class='badge
badge-info'>10</span> <br /><p>{tdesc}</p></td>" +
"{/eq}" +
"{@eq value=3}" +
"<td><button class='btn btn-mini btn-info
tag'>{tname}</button>&nbsp;x&nbsp; <span class='badge
badge-info'>10</span> <br /><p>{tdesc}</p></td></tr>" +
"{/eq}" +
"{@default}" +
"<td><button class='btn btn-mini btn-info
tag'>{tname}</button>&nbsp;x&nbsp; <span class='badge
badge-info'>10</span> <br /><p>{tdesc}</p></td>" +
"{/default}" +
"{/math}" +
"{/data}" +
"</table>"
, "taglist");
console.log(compiledtlist);
dust.loadSource(compiledtlist);
dust.render("taglist", { data: data }, function (err, out) {
console.log(err);
console.log(out);
$('#tagstable').html(out);
});
and the data is :
[
{
"tagid":10,
"tname":"sql server",
"tdesc":"As a database, it is a software product whose primary
function is to store and retrieve data as requested by other
software applications, be it those on the same computer or those
running on another computer across a network (including the
Internet)."
},
{
"tagid":9,
"tname":"entity framework",
"tdesc":"ADO.NET Entity Framework (EF) is an open source[1]
object-relational mapping (ORM) framework for the NET Framework"
},
{
"tagid":8,
"tname":"spring",
"tdesc":"he Spring Framework is an open source application framework
and inversion of control container for the Java platform"
},
{
"tagid":7,
"tname":"struts",
"tdesc":"Apache Struts is an open-source web application framework
for developing Java EE web applications. It uses and extends the
Java Servlet API to encourage developers to adopt a
model–view–controller (MVC) architecture."
},
{
"tagid":6,
"tname":"asp.net mvc",
"tdesc":"The ASP.NET MVC Framework is an open source web application
framework that implements the model–view–controller (MVC) pattern."
},
{
"tagid":5,
"tname":"asp.net",
"tdesc":"ASP.NET is a server-side Web application framework designed
for Web development to produce dynamic Web pages. It was developed
by Microsoft to allow programmers to build dynamic web sites, web
applications and web services."
},
{
"tagid":4,
"tname":"xml",
"tdesc":"Extensible Markup Language (XML) is a markup language that
defines a set of rules for encoding documents in a format that is
both human-readable and machine-readable"
},
{
"tagid":3,
"tname":"javascript",
"tdesc":"JavaScript (JS) is an interpreted computer programming
language.[5] As part of web browsers, implementations allow
client-side scripts to interact with the user, control the browser,
communicate asynchronously, and alter the document content that is
displayed"
},
{
"tagid":2,
"tname":"java",
"tdesc":"Java is a general-purpose, concurrent, class-based,
object-oriented computer programming language that is specifically
designed to have as few implementation dependencies as possible."
},
{
"tagid":1,
"tname":"c#",
"tdesc":"C#[note 1] (pronounced see sharp) is a multi-paradigm
programming language encompassing strong typing, imperative,
declarative, functional, procedural, generic, object-oriented
(class-based), and component-oriented programming disciplines"
}
]
Unfortunately nothing is returned by the template except table tags.
what am i missing here ?
Is the math tag wrong ?

Datagridview row validation

Datagridview row validation

I have a Datagridview, Validation must check complete row that all fields
are inserted values or not If particular datagridview cell is not filled
then we want to show error that particular cell in that column show fill

What is OpenCMIS Bridge?

What is OpenCMIS Bridge?

I just noticed this project at Apache OpenCMIS:
https://svn.apache.org/repos/asf/chemistry/opencmis/trunk/chemistry-opencmis-bridge
There is no description, no documentation, and reading the code does not
give much hints at what it is supposed to do.
Apache OpenCMIS sometimes releases great software silently, with little
communication, so we might be missing another great software here.
A Google Search for "OpenCMIS Bridge" returns only source code and the
bare download page.

Thursday, 12 September 2013

How does CreateProcess() come to know that new process undergo which subsystem?

How does CreateProcess() come to know that new process undergo which
subsystem?

When you build a project, we can define that under which subsystem we want
to run our program in windows. But how it would affect the output exe
file. Or in other words when we call a CreateProcess() API we just pass it
an exe file, So which header inside the exe file, it checks to determine
that which subsystem going to handle this process? Or it uses some other
method in order to accomplish it?

Can't get the Mongo portion of my heroku app to work

Can't get the Mongo portion of my heroku app to work

I've looked through several stackoverflow articles and tried different
ways of connection but none of them work. So far I've tried:
var mongodb = require('mongodb');
var uri = 'mongodb://Userxxx:Passxxx@ds0URI:PORT/heroku_appXXX';
mongodb.MongoClient.connect(uri, { server: { auto_reconnect: true } },
function (err, db) {
});
That crashed with the following error:
TypeError: Cannot call method 'connect' of undefined
Then I tried this:
mongo = require('mongodb')
Server = mongo.Server
Db = mongo.Db
BSON = mongo.BSONPure;
con = null;
server = new Server('xxxxx.mongolab.com', 'PORT', {auto_reconnect: true});
DBCon = new Db('xxxxx', server, {safe: false});
DBCon.open(function(err, db) {
if(!err) {
db.authenticate('xxxxx', 'xxxxx', function(err){
if(!err) con = db;
})
}
});
And that gave me an error:
/app/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:10
number') throw "host and port must be specified [" + host + ":" + port +
"]"; host and port must be specified
Does anyone know the right way to do this?

Highcharts: Stacking a column inside of another column

Highcharts: Stacking a column inside of another column

I don't know if highchart has support for this, I can't seem to find
anything in my searched. But I would like to stack a column inside a
column.
I have 2 series of data: Daily Active Users (DAU), and New Users (NU). New
Users is a part of Daily Active Users therefore I would like to stack New
Users inside of Daily Active Users, not on top of it.
Example: For one entry New Users is 3, and Daily Active Users 10. On the Y
axis, I would like to have Daily Active Users reach to value 10, but I
would want to start plotting New Users at value 7.
Here is what I have so far. This is incorrect because New Users is just
plotted on top of Daily Active Users.
http://jsfiddle.net/6JACr/
If you look at the first entry of August 6th, 2013: Daily Active Users is
6,310 and New Users is 1,325. New Users is being plotted starting at 6,310
when I want it to be starting at 4,985 (6,310-1,325).
Here is the code where I stack the columns
nu_series = {
name: "NU",
type: "column",
data: nu_data,
stack: 0
};
all_series[1] = nu_series;
dau_series = {
name: "DAU",
type: "column",
data: dau_data,
stack: 0
};
all_series[2] = dau_series;

Is This Contact Form Email Script Secure

Is This Contact Form Email Script Secure

I found the following contact form script online and I want to find out if
it is secure, and if it is not how I might make it more secure. I just
went back to the page where I think I got the code a long time ago and I
see one commentor said :
"client side validation is only for user conveneicne, it doens't prevent
spam, hackers, or annoying web devs. All a hacker has to do is create
their own HTML file without javascript. Spam bots wouldn't even use the
form they'll just parse it for the id's and send raw packets. Always check
input on the server, never trust the user. "
I'm not exactly sure what that means, but hoping if someone sees a
vulnerability in the code below it the comment may make more sense :
<?php
$EmailFrom = Trim(stripslashes($_POST['Email']));
$EmailTo = "info@mysite.com";
$Subject = "Customer Inquiry from MySite.com";
$Name = Trim(stripslashes($_POST['Name']));
$Tel = Trim(stripslashes($_POST['Tel']));
$Email = Trim(stripslashes($_POST['Email']));
$Message = Trim(stripslashes($_POST['Message']));
// validation
$validationOK=true;
if (!$validationOK) {
print "<meta http-equiv=\"refresh\"
content=\"0;URL=http://www.mysite.com/contact-us-error.php\">";
exit;
}
// prepare email body text
$Body = "";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "Tel: ";
$Body .= $Tel;
$Body .= "\n";
$Body .= "Email: ";
$Body .= $Email;
$Body .= "\n";
$Body .= "Message: ";
$Body .= $Message;
$Body .= "\n";
// send email
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");
// redirect to success page
if ($success){
print "<meta http-equiv=\"refresh\"
content=\"0;URL=http://www.mysite.com/contact-us-success.php\">";
}
else{
print "<meta http-equiv=\"refresh\"
content=\"0;URL=http://www.mysite.com/contact-us-error.php\">";
}
?>
Thanks for taking a look

Checking any divs in some position or not by using jquery

Checking any divs in some position or not by using jquery

I Want to check whether a div present in a particular position or not.
so here is my code
html
<div class="container">
<div class="icon icon-1"></div>
<div class="icon icon-2"></div>
<div class="icon icon"-3></div>
.
.
.
.
.
</div>
css
.container {
position:relative;
}
.icon {
position:absolute
}
I will dynamically add left position to the icon divs. so am facing some
issue now. some time two or more icon div will be in same position. so i
just want to check whether any other div already present in there or not.
so let me know if have any jquery solution thanks

PHP login requires refresh

PHP login requires refresh

I have a webpage that shows a login form depending on whether a cookie is
set. If the user logs in, the data is sent to a login script which sets
the cookie and returns the user back to the original page. The problem is,
for some reason, despite the cookie being set correctly (or deleted, in
the case of logout), the page continues showing the old content. A refresh
is required for the page to actually show the correct info. What's going
on?
My login script effectively does this:
setcookie("my_cookie",$userID, time()+3600*24*356, "/");
and my page checks this:
if (!isset($_COOKIE["my_cookie"]))
at the very top of the page.
Thanks for the help.

Using services to run code in the background

Using services to run code in the background

I know this is asked in a lot of questions, and there's a lot of
information about it. However I have yet to find an example or complete
explanation, on how to just set up a service and run some code in it
whilst your Apps running.
Specifically I want to run this code:
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.Scanner;
public class SearchingFilesMain {
public static void main(String[] arg) {
String[] array = new String[1000];
int checker4 = 0;
String checker3 = "";
String checker2 = "";
String checker1 = "";
String checker = "";
int num = 0;
try {
Scanner scan = new Scanner(new BufferedReader(new FileReader(
"C:\\Users\\User\\Desktop\\asciiTracks.txt")));
while (checker != null) {
String pattern = "Array Start";
checker = scan.findWithinHorizon(pattern, 0);
if(checker.equals("Array Start")){
String pattern2 = "Array Size";
checker3 = scan.findWithinHorizon(pattern2, 300);
if(checker3 != null && checker3.equals("Array Size")){
checker4 =
Integer.parseInt(scan.findInLine("(10000|\\d{1,4})"));
System.out.println(checker4);
checker1 = scan.findWithinHorizon("DATA ASCII", 500);
if(checker1 != null && checker1.equals("DATA ASCII")){
scan.nextLine();
for(int counter = 0; counter<checker4; counter++){
array[num] = scan.nextLine();
num++;
if(num >999){
num = 0;
}else{}
}
for(int counter1 = 0 ; counter1 < 1000 ; counter1++){
if(array[counter1] != null){
System.out.println(array[counter1]);
String values = (array[counter1]).toString();
System.out.println(values);
String[] valueArray = values.split("\\s+");
//no value stored in valueArray[0] index for
some reason.
System.out.println(valueArray[1]);
System.out.println(valueArray[2]);
System.out.println(valueArray[3]);
System.out.println(valueArray[4]);
}else{
break;
}
}
}else{
System.out.println("DATA ASCII not found");
}
}else{System.out.println("no array size");
//similar code to that above must go in here at a later
point.
//added similar code so far works perfectly at searching
through file!
checker1 = scan.findWithinHorizon("DATA ASCII", 500);
if(checker1 != null && checker1.equals("DATA ASCII")){
scan.nextLine();
for(int counter = 0; counter<checker4; counter++){
array[num] = scan.nextLine();
num++;
if(num >999){
num = 0;
}else{}
}
for(int counter1 = 0 ; counter1 < 1000 ; counter1++){
if(array[counter1] != null){
System.out.println(array[counter1]);
String values = (array[counter1]).toString();
System.out.println(values);
String[] valueArray = values.split("\\s+");
//no value stored in valueArray[0] for some reason.
System.out.println(valueArray[1]);
System.out.println(valueArray[2]);
System.out.println(valueArray[3]);
System.out.println(valueArray[4]);
}else{
break;
}
}
}else{
System.out.println("DATA ASCII not found");
}
}
}else{System.out.println("no array start");}}}catch
(FileNotFoundException e) {}}}
This code searches through a file looking for keywords and numbers,
finding the data related to them and storing it in Arrays. I simply want
to run this code in a service in the background alongside my App. I want
it to send data back to my App, and update the UI (therefore i believe i
need to use a bindservice() ) and start and stop when my App starts and
stops.
I want it to be left running the entire time, as at some point it will be
reading in data from a network socket.
Any example code you think might work and a small explanation on why it
works, or an url to a very simplistic tutorial with example code would be
great. Services are completely new to me so if there's a better way of
doing what Ive described please feel free to tell me.

Wednesday, 11 September 2013

MVC log in is not working

MVC log in is not working

I have a MVC3 application, n my log in module works fine when I run the
solution from VS. But when I added it as a site in my IIS(ver 6) The log
in is not working. I wrote to a txt file to see whether log in fails, but
log in is successful. But it does not let me to go to the home page it
directs me back to log in page itself. please help.
[HttpPost]
public ActionResult Login(LoginModel model, string returnUrl) {
string lines = "UserName:" + model.Username + " Pwd:" +
model.Password + " IsValid:" + ModelState.IsValid + "\n";
System.IO.File.WriteAllText(@"E:\Nirushan.txt", lines);
if (!ModelState.IsValid) {
ModelState.AddModelError("",
GetLocalResource("Message.InvalidLogin"));
return View();
}
var authenticationResult =
_authenticationService.TryAuthenticateDirectLogin(model.Username,
model.Password);
using (System.IO.StreamWriter file = new
System.IO.StreamWriter(@"E:\Nirushan.txt", true))
{
file.WriteLine();
//Status is success
file.WriteLine("Status:" +
authenticationResult.AuthenticationStatus);
bool st =
AuthenticationTicketService.SetAuthenticationTicket(authenticationResult.AuthenticatedUser.Id);
// st is true
file.WriteLine("TicketService:" + st);
}
if (authenticationResult.AuthenticationStatus ==
AuthenticationStatus.RegeneratedForgottenPasswordExpired)
{
ModelState.AddModelError("",
GetLocalResource("Message.RegeneratedForgottenPasswordExpired"));
return View();
}
if (authenticationResult.AuthenticationStatus ==
AuthenticationStatus.UserIsLockedOut) {
ModelState.AddModelError("",
GetLocalResource("Message.UserIsLockedOut"));
return View();
}
if (authenticationResult.AuthenticationStatus ==
AuthenticationStatus.DirectLoginNotAllowed) {
ModelState.AddModelError("",
GetLocalResource("Message.DirectLoginNotAllowed"));
return View();
}
if (authenticationResult.AuthenticationStatus !=
AuthenticationStatus.Success) {
ModelState.AddModelError("",
GetLocalResource("Message.LoginFailed"));
return View();
}
if (authenticationResult.AuthenticatedUser.PasswordChange)
return RedirectToAction("ChangePassword", new {
returnUrl,
model.Username
});
if
(AuthenticationTicketService.SetAuthenticationTicket(authenticationResult.AuthenticatedUser.Id)
== false) {
ModelState.AddModelError("",
GetLocalResource("Message.MissingSessionInfo"));
return View();
}
return Redirect(returnUrl ?? Url.Action("Index", "Home"));
}

C++ constructor arguments

C++ constructor arguments

Bozo(const char * fname, const char * lname); // constructor prototype
In this case, you would use it to initialize new objects as follows:
Bozo bozetta = bozo("Bozetta", "Biggens"); // primary form
Bozo fufu("Fufu", "O'Dweeb"); // short form
Bozo *pc = new Bozo("Popo", "Le Peu"); // dynamic object
I just have a few questions regarding this. First is that, why is const
needed before char? or why is it there?. Also, why is it declaring as a
pointer?
Second, is there any difference between the "primary form" and the "short
form?"
Third question is that in Java, I used string variables for the formal
parameters, but in C++ it's in char? I thought char can only contain a
single alphabet, and it's not a char array. Could I do this with string
instead?

How to test standard output string in other java file in Java?

How to test standard output string in other java file in Java?

So, in brief:
I have a method that is void, and prints stuff to standard output.
I have a second file that tests the output of functions against what it
should be and returns true if they all pass.
I have a makefile that checks the output of the test file to make sure
that all the tests passed.
My problem is that I don't know how to compare the void method's printed
output against what it should be in the test file. I was told to modify
the make file, but I don't know how. My other tests for methods with
return types look something like this:
private static boolean testNumFunc() {
if (MainFile.numFunc(300) == /*proper int output*/) {
return true;
}
return false;
}
How would I test a void function this way by modifying the makefile?

How is string#size implementated?

How is string#size implementated?

I did:
cout << sizeof(string) << endl;
is 8 on my 64bit machine which is the same as sizeof(char*) so I am
assuming the string class stores only the char*. Then how is the size
function implemented? Is it using strlen (since it is not store the actual
size or the pointer to the ending byte)?
But on this page: http://en.cppreference.com/w/cpp/string/basic_string/size
It shows the size function have a complexity of constant, so I am
confused. This page: Why is sizeof(string) == 32? tells me his string size
is larger...
I am using GCC 4.7.1 on Fedora 64 bit.

Pack a PrimeFace Dialog

Pack a PrimeFace Dialog

In Swing, you can call pack() which will make the frame that is displaying
contents shrink to the size of its contents.
Here is the JavaDoc for it: pack()
Causes this Window to be sized to fit the preferred size and layouts of
its subcomponents. If the window and/or its owner are not yet displayable,
both are made displayable before calculating the preferred size. The
Window will be validated after the preferredSize is calculated.
Is there a corresponding way to do this in a PrimeFaces dialog. Namely,
can I make a dialog shrink to fit its contents?

symfony2 slow performance due to the firewall

symfony2 slow performance due to the firewall

I have a problem with symfony2 (2.3.4), especially with the firewall. It
takes ages to complete the request and here is the debug screenshot.
I have also googled for solutions, but neither the change of the mysql
hostname to "127.0.0.1", nor the other hints have helped.
My settings: symfony2 (2.3.4), PHP 5.4.19, MySQL 5.1.66, Debian 6.0.7.

google api custom Infobox not maintain the same position of the marker in street view

google api custom Infobox not maintain the same position of the marker in
street view

We are using the custom infobox provided by the google api and when we go
to the street view then infobox position not changed according to marker
position in street view as they display in the actual map marker position.
Can anyone tell me how to set the customize infobox position according to
the marker position in the street view.
Regards, Vipul Singhal

Android:state_hovered not working

Android:state_hovered not working

I have a simple button, and I am trying to make it change color when you
hover over it. I am using an android simulator on eclipse but the
android:state_hovered="true" is not working.
Any help would be appreciated, thank you.

Building a "This Week" & "Next Week" Link Quiery

Building a "This Week" & "Next Week" Link Quiery

I'm building a script for an events website and I have shortcut links for
"Today, 7 Days, 14 Days, 30 Days & 60 Days, using PHP to get each day
count from today which works fine but I'd prefer to have it as "Today,
This Week, Next Week" and then let the users do a custom search for
anything further in the future. Problem is I have no idea how to get the
weeks for this type of calculation. For example I could do this week as
"From today to +7" and then do next week as "Today +7 to Today +14" but
this would be a bit confusing, so what I want to do is:
Today = Today //I have the script for this
This Week = Today (Whichever day we are on) to Sunday
Next Week = Next Monday to Next Sunday
Any Ideas how this is done?

Tuesday, 10 September 2013

GpsStatus.getTimeToFirstFix () always returns zero in S4 device

GpsStatus.getTimeToFirstFix () always returns zero in S4 device

getTimeToFirstFix () and getSatellites ()method in GpsStatusclass always
returning zero in samsung s4 device. getting proper values in s3 device.I
m not understanding whether it is device related issue or not

What is use of values-v11 and values-v14 folders?

What is use of values-v11 and values-v14 folders?

I am new to android application.
Pls explain the following folders and its uses
values-sw600dp
values-sw720dp-land
values-v11
values-v14

How to use two Hubs in signalR one of wich is Cross Domain?

How to use two Hubs in signalR one of wich is Cross Domain?

I have 2 applications, in one of them I have a control panel. From this
control panel I want to know the status of the other application. The
application A have a hub to monitor its status in its control panel. The
application B also have its own hub to provide users in it about its
status. What I'm trying to do is to listen to status on hub B from hub A.
Is it possible? I'm able to listen form hub A alone or from B alone
loading B's hub via AJAX
$.ajax({
url: "http://localhost:62835/signalr/hubs",
crossDomain: true,
dataType: "script",
cache: true,
success: function () {
doStuffWithB_hub();
}});
The problem is that when I load both hubs, I can only listen to hub A. I
can invoke from B but don't get data back when there's a update.
Thanks for the responses.