Sunday, 1 September 2013

Stretching background image to full size

Stretching background image to full size

I want to make this image as the background image of my webpage. However ,
the problem is that the image doesn't cover the whole of the page, as you
may see in this preview , and it gets repeated at the rightmost end . Is
there a way so that the image covers the whole page (be it any way ,
stretching , re-sizing , or something new).
My Code:
<!DOCTYPE HTML>
<html>
<head>
<title>Angry Birds Star Wars</title>
<script src =
"http://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<script src = "http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<style>
body {
background:
url('http://www.androidtapp.com/wp-content/uploads/2012/11/Angry-Birds-Star-Wars-Menu.png');
}
</style>
</head>
<body>
</body>
</html>
Thanks.

Saturday, 31 August 2013

gmail Sidebar gadget is not showing

gmail Sidebar gadget is not showing

i am following this tutorial
https://developers.google.com/gmail/sidebar_gadgets when i am trying to
add a Hello World sidebar gadget to my gmail. i first hosted it on
http://cloudfactor9.appspot.com/ after that i added it in gadgets as you
can see in screen shot after that when i signout and signin into my gmail
there is no Hello World widget.can any one please tell why i am not able
to see Hello World widget ?? screenshot of gmail is

How to avoid force close if there is no data to fetch in db

How to avoid force close if there is no data to fetch in db

I'm having some problem in avoiding force stop of my application. When I
click my load button it is supposed to load all data present in my
database. However, if there is no data present in my database, I want to
display a toast saying that there is no data to fetch in the db.
save.setOnClickListener(new OnClickListener(){
public void onClick(View v) {
db.addContact(new PlayerData(name,score));
Log.d("Insert: ", "Inserting ..");
}
});
load.setOnClickListener(new OnClickListener(){
public void onClick(View v) {
List<PlayerData> contacts = db.getAllContacts();
//check to ensure there are users
if(contacts.size()==0)
try {
throw new Exception();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
PlayerData player = contacts.get(0);
String showName = player.getName();
int showScore = player.getscore();
Log.d("Getting:", showName);
Log.d("Getting:", Integer.toString(showScore));
saved.setText("Player Name: "+showName+" Player Score:
"+showScore);
}
});

Carousel not scaling the same way as the background image

Carousel not scaling the same way as the background image

I have the following markup:
<section class="block">
<img class="img-background" src="assets/background_banner.png" alt="" >
<div id="myCarousel" class="carousel slide">
<div class="carousel-inner">
<div class="active item">
<img src="assets/banner_1.png" alt="" >
</div>
And the CSS like this:
.img-background{
position:absolute;
margin-left:50%;
left:-512px;
top:0px;
z-index:1;
}
.carousel{
position:absolute;
margin-left:50%;
left:-512px;
top:0px;
z-index:2;
}
.carousel .item {
width: 100%; /*slider width*/
height: auto; /*slider height*/
}
.carousel .item img {
margin-left: 0%;
width: 100%; /*img width*/
}
/*full width container*/
@media (max-width: 767px) {
.block {
margin-left: -20px;
margin-right: -20px;
}
}
It works when the browser is full screen. I have a background image and a
carousel slide on top of that. But when I make the browser smaller the
carousel stays big while the image scales. I want them both to scale the
same way. Is this possible?

MySQL really unexpected error. BIGINT out of range

MySQL really unexpected error. BIGINT out of range

I have this kinda complicated query that is well explained in this
question. I haven't changed anything in the query or anything relating to
this system , however I suddenly started getting this error
BIGINT UNSIGNED value is out of range in '(_db.ads.impressions_total -
(cast(((curdate()) - cast(_db.ads.start as date)) as unsigned) *
_db.ads.impressions_perday))'
I'm really confused, I guess something is not caching right but what can I
do? I really need help..

Loading a table into PostgreSQL with a foreign key produces an error

Loading a table into PostgreSQL with a foreign key produces an error

I am using SymmetricDS database replication software to replicate tables
across databases.
I have this XML defined table for PostgreSQL which I've created:
<table name="ServiceItem">
<column name="ServiceItemID" type="INTEGER" required="true"
primaryKey="true"/>
<column name="ParentItemID" type="INTEGER" />
<foreign-key name="FK_ServiceItem_ServiceItem" foreignTable="ServiceItem">
<reference local="ServiceItemID" foreign="ParentItemID" />
</foreign-key>
</table>
I expect that all parentItemID values MUST exist in the ServiceItemID
column, that's the point of a foreign key.
But I get this error from SymmetricDS when I load it:
[] - JdbcSqlTemplate - ERROR: there is no unique constraint matching given
keys
for referenced table "ServiceItem". Failed to execute: ALTER TABLE
"ServiceItem"
ADD CONSTRAINT "FK_ServiceItem_ServiceItem" FOREIGN KEY ("ServiceItemID")
REFERENCES "ServiceItem" ("ParentItemID")
If I remove the foreign key, everything works as expected. This error
message is confusing me and I'm not sure what I am doing wrong. What does
it mean?

regex is not working properly - preg_replace or preg_match

regex is not working properly - preg_replace or preg_match

I have the following regex code --
$search_query=preg_replace('#[a-z. .a-z]#i', ' ', $_POST['searchquery']);
My database is lower case. The interpretation that I am going for is:
$search_query should allow all letters on a case insensitive basis and any
white space but ignore symbols and numbers. It should not replace anything
since it is case sensitive. And it should process 'search_query'. Where am
I going wrong...? My hashtags are correct and is i=case insensitive...
Please help...