Thursday, 3 October 2013

Grid View items become invisible when scroll down

Grid View items become invisible when scroll down

1.i have a grid view in which i have to get image path from database and
images are in drawable my issue is when i scroll down grid view images
becomes invisible i have the following adapater 2.any help????
import android.app.Activity;
import android.graphics.drawable.Drawable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
public class GridViewAdapter extends BaseAdapter {
private Activity context;
List<Fotota> list_popupBarBackGround;
static final int ON_STICKER_LAYOUT=4;
private static ViewHolder holder;
private LayoutInflater l_Inflater;
public GridViewAdapter(Activity context, List<Fotota>
list_popupBarBackGround) {
this.context = context;
this.list_popupBarBackGround = list_popupBarBackGround;
l_Inflater = LayoutInflater.from(context);
}
@Override
public int getCount() {
return list_popupBarBackGround.size();
}
@Override
public Object getItem(int position) {
return null;
}
@Override
public long getItemId(int position) {
return 0;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
holder = new ViewHolder();
convertView = l_Inflater.inflate(R.layout.listview_griditem, null);
holder = new ViewHolder();
holder.imageView = (ImageView) convertView.findViewById(R.id.icon);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
holder.imageView.setImageResource(context.getResources()
.getIdentifier(list_popupBarBackGround.get(position).getThumbnail(),
"drawable",context.getPackageName()));
return convertView;
}
private static class ViewHolder {
ImageView imageView;
}

Wednesday, 2 October 2013

How to use if else and exist to drop table in MySQL when create view

How to use if else and exist to drop table in MySQL when create view

using both methods got error in workbench
method 1 got error
CREATE VIEW `db2`.`view2` AS
DROP PROCEDURE IF EXISTS `temp_table` $$
method 2 got error Error Code: 1351. View's SELECT contains a variable or
parameter method 2
CREATE VIEW `db2`.`view2` AS
SELECT IF(EXISTS(SELECT * FROM information_schema.tables WHERE
table_schema = 'db2' AND table_name = 'temp_table' LIMIT 1),1,0) into
@testresult;
IF (@testresult > 0) THEN
drop table temp_table;
END IF;
CREATE TEMPORARY TABLE temp_table (count int);
insert into temp_table select 1;

find and delete files with non-ascii names

find and delete files with non-ascii names

I have some old migrated files that contain non-printable characters. I
would like to find all files with such names and delete them completely
from the system.
Example:
ls -l
-rwxrwxr-x 1 cws cws 0 Dec 28 2011 ??"??
ls -lb
-rwxrwxr-x 1 cws cws 0 Dec 28 2011 \a\211"\206\351
I would like to find all such files. Please help

In jquery How to find the radio button Value which is in the inner div while chicking on radio button

In jquery How to find the radio button Value which is in the inner div
while chicking on radio button

How to find the radio button Value in inner div while clicking on radio
button
Hi i have a radio button i want to
find out the value of the radio button when clicking on that radio button
in Jqery
Please see [Click here to see My problem]
(http://jsfiddle.net/c857P/232/)

How do I disable notifications/reminder and set events to free time with Perl's ICal::Entry?

How do I disable notifications/reminder and set events to free time with
Perl's ICal::Entry?

Unforunately my university was too lazy to make a google calendar or .ics
for our public events. Instead they choose to wirte us an email with a
formatted text file containing a list of the dates. I have a Perl script
to convert said list, into an iCalendar (.ics) file. I want to import that
.ics into my google calendar later.
So far the script works very well but now I want to disable the standard
notifications (E-Mail and PopUp) and set the events to be free time
(instead of default busy). The problem is, that I don't get anything
usefull out of the documentation for Data::ICal::Entry::FreeBusy and
Data::ICal::Entry::Alarm::Display. Be so kind an provide me with the right
properties to add to the $event->add_properties(...) line in the script
below:
#!/usr/bin/perl -w
# Converts a specially formated text file (list of events) into an .ics
# (iCalendar) file for import into Google-Calendar or other calendar
# applications.
use Date::ICal;
use Data::ICal;
use Data::ICal::Entry::Event;
# Read file into one long string
open FILE, $ARGV[0] or die "Couldn't open file: $!";
my $fstring = join("", <FILE>);
close FILE;
# Prepare calendar
my $calendar = Data::ICal->new();
$calendar->add_properties( method=>"PUBLISH",);
# Add events depending on what was found in file
@events = split("\n\n", $fstring);
foreach $eventstring (@events) {
$eventstring =~ s/(\d+\.\d+\.\d+)//; # remove date from the string
$datestring = $1; #+but save it for processing:
($day, $month, $year) = split(/\./, $datestring);
$title = ( split /\n/, $eventstring )[1];
my $event = Data::ICal::Entry::Event->new();
$event->add_properties(
summary => "Kolloquium: $title",
description => $eventstring,
dtstart => Date::ICal->new( year=>"20$year", month=>$month,
day=>$day, hour=>17, min=>15 )->ical,
dtend => Date::ICal->new( year=>"20$year", month=>$month,
day=>$day, hour=>18, min=>15 )->ical,
dtstamp => Date::ICal->new( epoch => time )->ical,
# MISSING HERE: Right FREEBUSY and ALARM properties. PLEASE HELP!
);
$calendar->add_entry($event);
}
print $calendar->as_string;
Thank you kindly!

Tuesday, 1 October 2013

python - first alphabetic character, last, and pull the string in between

python - first alphabetic character, last, and pull the string in between

Strip string and return lowercase version of result
Return a lowercase version of the word with all non-alphabetic symbols
stripped away from the boundaries, but with such symbols remaining in the
interior of a word.
Precondition: wd is a string Postcondition: returns 'stripped' string in
lowercase
Typical examples of this behavior include:
>>> word_strip("don't")
"don't"
>>> word_strip('end.')
'end'
>>> word_strip('jack-o-lantern')
'jack-o-lantern'
>>> word_strip('"Stop!"')
'stop'
>>> word_strip('&%^$*%*%"')
''
>>> word_strip('hello there!!')
'hello there'
Code:
import string
def word_strip(wd):
alpha = 'abcdefghijklmnopqrstuvwxyz'
for i in range(0,len(wd)):
if wd[i] == alpha:
a = wd.find(alpha)
# locate last desirable character
b = wd.endswith(alpha)
# return an intentionally lowercase stripped word
wd = wd[a:b]
wd = wd.lower()
return wd

How can I select and display the maximum (and minimum) values from among several fields in a single record in mysql using php

How can I select and display the maximum (and minimum) values from among
several fields in a single record in mysql using php

I have a table which lists several tours and for each tour there are
several categories of accommodation types with different prices, along
with a lot of other fields such as dates, deadlines etc. It was easy to
set things up to display the array showing the tour, dates, deadlines but
I also want to select and display the maximum (and minimum when not 0)
accommodation rates for each tour. I may not be understanding some of the
answers I'm seeing but most seem to be looking for max values within a
field rather than across fields. I'm assuming once I know how to find the
max value, finding the min value would be the same basic procedure.
the abbreviated table structure with example data is:
id tourID RmA RmB RmC RmD ...other fields...
1 mb 600 450 550 300
2 kr 900 0 600 450
3 ww 500 650 550 600
4 wf 750 300 400 500
What I'd like to add to my current display is:
Tour Rates
mb 300 - 600
kr 450 - 900
WW 500 - 650
wf 300 - 750
I apologise if I'm repeating a frequently asked question, but it may be
that I haven't googled my question in a manner to find the appropriate
answer.

How prove this $ \sqrt{\frac{a}{a+3b+5bc}}+\sqrt{\frac{b}{b+3c+5ca}}+\sqrt{\frac{c}{c+3a+5ab}}\geq 1.$

How prove this $
\sqrt{\frac{a}{a+3b+5bc}}+\sqrt{\frac{b}{b+3c+5ca}}+\sqrt{\frac{c}{c+3a+5ab}}\geq
1.$

Let $a,b,c$ be nonnegative real numbers such that $a+b+c=3$, Prove that
$$
\sqrt{\frac{a}{a+3b+5bc}}+\sqrt{\frac{b}{b+3c+5ca}}+\sqrt{\frac{c}{c+3a+5ab}}\geq
1.$$
This problem is from
http://www.artofproblemsolving.com/Forum/viewtopic.php?f=52&t=555716
@Calvin Lin Thank you

Does Ubuntu Terminal Run In the background?

Does Ubuntu Terminal Run In the background?

I have a question?
If I am in the middle of using the terminal, say to apt-get something;
If I click the x / close button, does the Terminal continue to run in the
background?

To afraid to try it, cause I don't want to have to start the process all
over again...
Has anyone accidentally done it?