PostId int64 13 11.8M | PostCreationDate stringlengths 19 19 | OwnerUserId int64 3 1.57M | OwnerCreationDate stringlengths 10 19 | ReputationAtPostCreation int64 -33 210k | OwnerUndeletedAnswerCountAtPostTime int64 0 5.77k | Title stringlengths 10 250 | BodyMarkdown stringlengths 12 30k | Tag1 stringlengths 1 25 ⌀ | Tag2 stringlengths 1 25 ⌀ | Tag3 stringlengths 1 25 ⌀ | Tag4 stringlengths 1 25 ⌀ | Tag5 stringlengths 1 25 ⌀ | PostClosedDate stringlengths 19 19 ⌀ | OpenStatus stringclasses 5 values | unified_texts stringlengths 47 30.1k | OpenStatus_id int64 0 4 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
9,875,353 | 03/26/2012 15:50:46 | 325,016 | 04/24/2010 17:25:09 | 635 | 10 | Whats a good convention for ordering items in classes? | I was thinking of something along these lines, should I be doing anything differently?
This is more for myself, I don't intend to force anyone to follow this.
class Class
{
public:
typedef a b;
enum TYPE {A, B, C, D, E};
~Class();
Class();
Class(Class && rhs);
Class(const Class & rhs);
Class & operator= (const Class & rhs);
void swap(const Class & rhs);
static void foo();
bool is() const;
virtual bool is() const;
typeName get() const;
virtual get() const;
void set();
virtual void set();
void do() const;
virtual void do() const;
void do();
virtual void do();
char char_;
unsigned char uChar_;
w_char wChar_;
short short_;
unsigned short uShort_;
int int_;
float float_;
double double_;
std::thing stdThing_;
my::thing myThing_;
private:
bool is() const;
virtual bool is() const;
typeName get() const;
virtual get() const;
void set();
virtual void set();
void do() const;
virtual void do() const;
void do();
virtual void do();
char char_;
unsigned char uChar_;
w_char wChar_;
short short_;
unsigned short uShort_;
int int_;
float float_;
double double_;
std::thing stdThing_;
my::thing myThing_;
} | c++ | null | null | null | null | 03/26/2012 16:00:59 | not constructive | Whats a good convention for ordering items in classes?
===
I was thinking of something along these lines, should I be doing anything differently?
This is more for myself, I don't intend to force anyone to follow this.
class Class
{
public:
typedef a b;
enum TYPE {A, B, C, D, E};
~Class();
Class();
Class(Class && rhs);
Class(const Class & rhs);
Class & operator= (const Class & rhs);
void swap(const Class & rhs);
static void foo();
bool is() const;
virtual bool is() const;
typeName get() const;
virtual get() const;
void set();
virtual void set();
void do() const;
virtual void do() const;
void do();
virtual void do();
char char_;
unsigned char uChar_;
w_char wChar_;
short short_;
unsigned short uShort_;
int int_;
float float_;
double double_;
std::thing stdThing_;
my::thing myThing_;
private:
bool is() const;
virtual bool is() const;
typeName get() const;
virtual get() const;
void set();
virtual void set();
void do() const;
virtual void do() const;
void do();
virtual void do();
char char_;
unsigned char uChar_;
w_char wChar_;
short short_;
unsigned short uShort_;
int int_;
float float_;
double double_;
std::thing stdThing_;
my::thing myThing_;
} | 4 |
10,704,658 | 05/22/2012 15:00:46 | 756,053 | 05/16/2011 17:17:33 | 41 | 6 | Why is my Word Press front-page.php is broken? | I have a front-page.php file in my active theme folder and it's broken. The site is located at http://ccrccmo.com. My front-page.php is a static file. It broke after I deleted some pages I didn't need in my backend.
Here is my code:
<!DOCTYPE html>
<html>
<head>
<title>CCRCC</title>
<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
<script type="text/javascript" src="http://malsup.github.com/jquery.cycle.all.js"></script>
<script src="wp-content/themes/ccrcc/js/slides.min.jquery.js"></script>
<script>
$(function() {
$('#slideshow').cycle({
fx: 'fade',
timeout: 4000,
before: function(){
$('.caption').animate({
top:0
},200);
},
after: function() {
$('.caption').animate({
top: -40
},200);
}
});
});
</script>
</head>
<body>
<header>
<h1>Christian County Republicans</h1>
<h2>Christian County Republicans Central Committee</h2>
</header>
<nav>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">Officials</a></li>
<li><a href="#">Events</a></li>
<li><a href="#">Candidates</a></li>
<li><a href="#">Information</a></li>
<li><a href="#">Contact Us</a></li>
</ul>
</nav>
<div id="content-bg">
<div id="main-content">
<div id="slideshow">
<div class="slide">
<img src="images/courthouse2.jpg">
<div class="caption">
<p>This is the latest post... <a href="#">Read Read More</a></p>
</div>
</div>
<div class="slide">
<img src="images/thumbsup.jpg">
<div class="caption">
<p>This is the later post... <a href="#">Read Read More</a></p>
</div>
</div>
<div class="slide">
<img src="images/working.jpg">
<div class="caption">
<p>This is an older post... <a href="#">Read Read More</a></p>
</div>
</div>
</div>
<h2>Welcome</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent vestibulum, magna in ultricies feugiat, diam neque gravida metus, eget hendrerit justo libero nec est. Fusce vitae augue sit amet lorem lobortis dictum eget ac magna. Nulla bibendum, lectus sed rhoncus vestibulum, purus risus semper mi, in bibendum magna arcu sed lectus. Suspendisse magna nisl.</p>
<p>Mollis ultrices luctus scelerisque, tincidunt a massa. Duis dapibus tincidunt diam, in adipiscing tellus lobortis pretium. Aenean porttitor condimentum felis vitae placerat. Etiam </p>
<div class="col50 team-preview">
<h2>Meet Our Team</h2>
<img src="images/alec-wade.jpg" alt="Image of Alec Wade">
<h3>Alec Wade</h3>
<h4>Board Director</h4>
<p class="block">Mollis ultrices luctus scelerisque, tincidunt a massa. Duis dapibus tincidunt diam. </p>
<a href="#" class="button">Read More →</a>
</div>
<div class="col50 lastcol">
<h2>Upcoming Events</h2>
<h3>Lorem ipsum dolor</h3>
<time>2012-5-20</time>
<p>Mollis ultrices luctus scelerisque, tincidunt a massa. Duis dapibus tincidunt diam, in adipiscing tellus lobortis pretium. Aenean porttitor condimentum felis vitae placerat. Etiam</p>
<a href="#" class="button">Read More →</a>
</div>
</div><!--End of Main-->
<aside><!--sidebar.php-->
<h2>Main Menu</h2>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">Get Involved</a></li>
<li><a href="#">Missouri Republican Platform</a></li>
<li><a href="#">National Republican Platform</a></li>
<li><a href="#">Christian County Republican By Laws</a></li>
</ul>
<h2>Resources</h2>
<ul>
<li><a href="#">Republican Organizations</a></li>
<li><a href="#">Voter Registration</a></li>
<li><a href="#">Legislative Watch</a></li>
</ul>
<h2>News</h2>
<img src="images/court-room.jpg">
<h3>Lorem ipsum dolor</h3>
<time>2012-5-20</time>
<p>Mollis ultrices luctus scelerisque, tincidunt a massa. Duis dapibus tincidunt diam, in adipiscing tellus lobortis pretium. Aenean porttitor condimentum felis vitae placerat. Etiam </p>
<a href="#" class="button">Read More →</a>
</aside>
</div><!--End of content-bg-->
<footer>
© CCRCC 2012 Design by <a href="http://zachdyerdesign.com">Zach Dyer Design</a>
</footer>
</body>
<html> | php | wordpress | content-management-system | themes | null | 05/22/2012 20:54:46 | too localized | Why is my Word Press front-page.php is broken?
===
I have a front-page.php file in my active theme folder and it's broken. The site is located at http://ccrccmo.com. My front-page.php is a static file. It broke after I deleted some pages I didn't need in my backend.
Here is my code:
<!DOCTYPE html>
<html>
<head>
<title>CCRCC</title>
<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
<script type="text/javascript" src="http://malsup.github.com/jquery.cycle.all.js"></script>
<script src="wp-content/themes/ccrcc/js/slides.min.jquery.js"></script>
<script>
$(function() {
$('#slideshow').cycle({
fx: 'fade',
timeout: 4000,
before: function(){
$('.caption').animate({
top:0
},200);
},
after: function() {
$('.caption').animate({
top: -40
},200);
}
});
});
</script>
</head>
<body>
<header>
<h1>Christian County Republicans</h1>
<h2>Christian County Republicans Central Committee</h2>
</header>
<nav>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">Officials</a></li>
<li><a href="#">Events</a></li>
<li><a href="#">Candidates</a></li>
<li><a href="#">Information</a></li>
<li><a href="#">Contact Us</a></li>
</ul>
</nav>
<div id="content-bg">
<div id="main-content">
<div id="slideshow">
<div class="slide">
<img src="images/courthouse2.jpg">
<div class="caption">
<p>This is the latest post... <a href="#">Read Read More</a></p>
</div>
</div>
<div class="slide">
<img src="images/thumbsup.jpg">
<div class="caption">
<p>This is the later post... <a href="#">Read Read More</a></p>
</div>
</div>
<div class="slide">
<img src="images/working.jpg">
<div class="caption">
<p>This is an older post... <a href="#">Read Read More</a></p>
</div>
</div>
</div>
<h2>Welcome</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent vestibulum, magna in ultricies feugiat, diam neque gravida metus, eget hendrerit justo libero nec est. Fusce vitae augue sit amet lorem lobortis dictum eget ac magna. Nulla bibendum, lectus sed rhoncus vestibulum, purus risus semper mi, in bibendum magna arcu sed lectus. Suspendisse magna nisl.</p>
<p>Mollis ultrices luctus scelerisque, tincidunt a massa. Duis dapibus tincidunt diam, in adipiscing tellus lobortis pretium. Aenean porttitor condimentum felis vitae placerat. Etiam </p>
<div class="col50 team-preview">
<h2>Meet Our Team</h2>
<img src="images/alec-wade.jpg" alt="Image of Alec Wade">
<h3>Alec Wade</h3>
<h4>Board Director</h4>
<p class="block">Mollis ultrices luctus scelerisque, tincidunt a massa. Duis dapibus tincidunt diam. </p>
<a href="#" class="button">Read More →</a>
</div>
<div class="col50 lastcol">
<h2>Upcoming Events</h2>
<h3>Lorem ipsum dolor</h3>
<time>2012-5-20</time>
<p>Mollis ultrices luctus scelerisque, tincidunt a massa. Duis dapibus tincidunt diam, in adipiscing tellus lobortis pretium. Aenean porttitor condimentum felis vitae placerat. Etiam</p>
<a href="#" class="button">Read More →</a>
</div>
</div><!--End of Main-->
<aside><!--sidebar.php-->
<h2>Main Menu</h2>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">Get Involved</a></li>
<li><a href="#">Missouri Republican Platform</a></li>
<li><a href="#">National Republican Platform</a></li>
<li><a href="#">Christian County Republican By Laws</a></li>
</ul>
<h2>Resources</h2>
<ul>
<li><a href="#">Republican Organizations</a></li>
<li><a href="#">Voter Registration</a></li>
<li><a href="#">Legislative Watch</a></li>
</ul>
<h2>News</h2>
<img src="images/court-room.jpg">
<h3>Lorem ipsum dolor</h3>
<time>2012-5-20</time>
<p>Mollis ultrices luctus scelerisque, tincidunt a massa. Duis dapibus tincidunt diam, in adipiscing tellus lobortis pretium. Aenean porttitor condimentum felis vitae placerat. Etiam </p>
<a href="#" class="button">Read More →</a>
</aside>
</div><!--End of content-bg-->
<footer>
© CCRCC 2012 Design by <a href="http://zachdyerdesign.com">Zach Dyer Design</a>
</footer>
</body>
<html> | 3 |
10,505,290 | 05/08/2012 19:37:13 | 1,382,956 | 05/08/2012 19:33:20 | 1 | 0 | How to make Adaptive OFDM system? | I am trying to make Adaptive OFDM system in which number of carrier should be chosen based on channel conditions like if channel conditions are good select all available sub carriers if channel condition is not good select few carriers which are based. I want to design such system in Matlb simulink enviroment.
| php | html | css3 | null | null | null | open | How to make Adaptive OFDM system?
===
I am trying to make Adaptive OFDM system in which number of carrier should be chosen based on channel conditions like if channel conditions are good select all available sub carriers if channel condition is not good select few carriers which are based. I want to design such system in Matlb simulink enviroment.
| 0 |
11,310,023 | 07/03/2012 11:32:38 | 1,403,398 | 05/18/2012 12:55:32 | 1 | 2 | If post published by admin in wordpress | Example :- 10 users and 2 admin in a site.
If the post is published by admins than
<?php ?????() { ?>
<!-- do this -->
<?php }
else { ?>
<!-- do this if posted by user -->
<?php } ?> | wordpress | null | null | null | null | 07/03/2012 13:46:20 | off topic | If post published by admin in wordpress
===
Example :- 10 users and 2 admin in a site.
If the post is published by admins than
<?php ?????() { ?>
<!-- do this -->
<?php }
else { ?>
<!-- do this if posted by user -->
<?php } ?> | 2 |
6,029,642 | 05/17/2011 10:41:45 | 445,126 | 09/11/2010 14:33:35 | 1,350 | 63 | Facebook like button works in Linter, but not on actual page | As far as I can tell, my meta tags are all correct
[Here are the linter results][1] which all appear normal, and when you press the like button on this page, it works
If you do the same thing from [here][2] (where the actual users will be) it doesn't work
Below are all my meta tags for open graph
<meta content="706887311" property="fb:admins">
<meta content="185050568185601" property="fb:app_id">
<meta content="WaggleB.com" property="og:site_name">
<meta content="article" property="og:type">
<meta content="CB!!!!!!! EDIT" property="og:title">
<meta content="http://waggleb.com/12454874521145474-2/?Id=631D9B88-D468-44F5-B76B-04B7CB849616&Type=6FB1E07C-4E14-4F7D-9F27-356CCD617FFE&Source=" property="og:url">
<meta content="CB" property="og:description">
<meta content="http://waggleb.com/wp-content/themes/waggleb/style/images/mini_logo.png" property="og:image">
[1]: http://developers.facebook.com/tools/lint/?url=http://waggleb.com/12454874521145474-2/?Id=631D9B88-D468-44F5-B76B-04B7CB849616&Type=6FB1E07C-4E14-4F7D-9F27-356CCD617FFE&Source=
[2]: http://waggleb.com/12454874521145474-2/?Id=631D9B88-D468-44F5-B76B-04B7CB849616&Type=6FB1E07C-4E14-4F7D-9F27-356CCD617FFE&Source= | facebook | facebook-like | opengraph | null | null | 05/17/2011 18:40:37 | too localized | Facebook like button works in Linter, but not on actual page
===
As far as I can tell, my meta tags are all correct
[Here are the linter results][1] which all appear normal, and when you press the like button on this page, it works
If you do the same thing from [here][2] (where the actual users will be) it doesn't work
Below are all my meta tags for open graph
<meta content="706887311" property="fb:admins">
<meta content="185050568185601" property="fb:app_id">
<meta content="WaggleB.com" property="og:site_name">
<meta content="article" property="og:type">
<meta content="CB!!!!!!! EDIT" property="og:title">
<meta content="http://waggleb.com/12454874521145474-2/?Id=631D9B88-D468-44F5-B76B-04B7CB849616&Type=6FB1E07C-4E14-4F7D-9F27-356CCD617FFE&Source=" property="og:url">
<meta content="CB" property="og:description">
<meta content="http://waggleb.com/wp-content/themes/waggleb/style/images/mini_logo.png" property="og:image">
[1]: http://developers.facebook.com/tools/lint/?url=http://waggleb.com/12454874521145474-2/?Id=631D9B88-D468-44F5-B76B-04B7CB849616&Type=6FB1E07C-4E14-4F7D-9F27-356CCD617FFE&Source=
[2]: http://waggleb.com/12454874521145474-2/?Id=631D9B88-D468-44F5-B76B-04B7CB849616&Type=6FB1E07C-4E14-4F7D-9F27-356CCD617FFE&Source= | 3 |
3,012,755 | 06/10/2010 08:22:03 | 162,767 | 08/25/2009 13:50:05 | 131 | 3 | what is the longest lenght of word sequence that google can show as a autocomplete? | I am more curious to know what is the longest length word-series that google shows as a auto suggest?. | google | null | null | null | null | 06/10/2010 10:42:30 | off topic | what is the longest lenght of word sequence that google can show as a autocomplete?
===
I am more curious to know what is the longest length word-series that google shows as a auto suggest?. | 2 |
7,836,041 | 10/20/2011 12:39:26 | 1,005,204 | 10/20/2011 12:36:23 | 1 | 0 | jQuery is printed on the page rather than executed | Please have a look at this page http://miladalami.com/?page_id=5
If you browse to the bottom of the page, you will see that it has printed part of a jQuery code on the page. The site is on Wordpress and the jQuery code is for the footer. What that is strange is that on other pages on the site, this code is working fine. Is there a mastermind out there that can solve this puzzle for me?
Please note that I am not experienced programmer so any details in guidance would be appreciated. | javascript | jquery | wordpress | footer | null | 11/14/2011 11:50:27 | not a real question | jQuery is printed on the page rather than executed
===
Please have a look at this page http://miladalami.com/?page_id=5
If you browse to the bottom of the page, you will see that it has printed part of a jQuery code on the page. The site is on Wordpress and the jQuery code is for the footer. What that is strange is that on other pages on the site, this code is working fine. Is there a mastermind out there that can solve this puzzle for me?
Please note that I am not experienced programmer so any details in guidance would be appreciated. | 1 |
10,251,970 | 04/20/2012 18:57:35 | 1,323,007 | 04/10/2012 01:37:51 | 8 | 0 | Lisp: my member function | I have to write function that checks if any item is in list. But lisp is very hard to me. Can u guys help me?
Example: myMember(list, item) -> (myMember '(1 (3 4 (2))) (2)) -> should give true
Example2: (myMember '(1 (3 4)) (2)) -> should give false
| list | lisp | item | member | check | 04/21/2012 19:12:48 | off topic | Lisp: my member function
===
I have to write function that checks if any item is in list. But lisp is very hard to me. Can u guys help me?
Example: myMember(list, item) -> (myMember '(1 (3 4 (2))) (2)) -> should give true
Example2: (myMember '(1 (3 4)) (2)) -> should give false
| 2 |
8,846,307 | 01/13/2012 05:23:05 | 1,050,967 | 11/17/2011 03:57:51 | 36 | 1 | str_replace all in mysql and php | I am trying to replace all values that I have in a field called age and a table called screens
the field has rows that contain numbers with a plus sign
> like age= 15+
I am trying to remove all the + signs
so do an update that will change all fields
for example if fields are
> 18+ 21+ 45+
change them to : 18 21 and 45
| php | mysql | sql | null | null | null | open | str_replace all in mysql and php
===
I am trying to replace all values that I have in a field called age and a table called screens
the field has rows that contain numbers with a plus sign
> like age= 15+
I am trying to remove all the + signs
so do an update that will change all fields
for example if fields are
> 18+ 21+ 45+
change them to : 18 21 and 45
| 0 |
4,313,239 | 11/30/2010 11:31:38 | 35,700 | 11/08/2008 04:58:05 | 470 | 14 | [VIM] How to delete current buffer and reopen the next buffer in current window? | I would like to know is there any shortcuts or commands to switch buffer(delete current and reopen next buffer) in current window because sometimes I feel I opened too many buffers? And currently I use bufexplorer and fuzzyfinder. | vim | vim-plugin | null | null | null | null | open | [VIM] How to delete current buffer and reopen the next buffer in current window?
===
I would like to know is there any shortcuts or commands to switch buffer(delete current and reopen next buffer) in current window because sometimes I feel I opened too many buffers? And currently I use bufexplorer and fuzzyfinder. | 0 |
8,969,948 | 01/23/2012 10:06:48 | 106,528 | 05/13/2009 18:13:53 | 531 | 6 | What below code do? |
What the below code do ?
'<dd class="ui_tpicker_time" id="ui_tpicker_time_' + dp_id + '"' + ((o.showTime)
? '' : noDisplay) + '></dd>' +
Where i can see the contents of the class="ui_tpicker_time"
I did a find on "ui_tpicker_time" but couldn't find where the class is located | javascript | jquery | html | mvc | null | 01/23/2012 10:23:21 | not a real question | What below code do?
===
What the below code do ?
'<dd class="ui_tpicker_time" id="ui_tpicker_time_' + dp_id + '"' + ((o.showTime)
? '' : noDisplay) + '></dd>' +
Where i can see the contents of the class="ui_tpicker_time"
I did a find on "ui_tpicker_time" but couldn't find where the class is located | 1 |
731,417 | 04/08/2009 19:11:29 | 52,209 | 01/06/2009 21:55:45 | 1 | 0 | Charting widget for GTK or QT | Is there a widget for GTK or QT that would allow me to draw stock charts like this?
http://smartquant.com/openquant/openquant_chart.jpg
Thanks, Joel | gtk | qt | charts | stocks | null | 07/21/2012 13:32:14 | not constructive | Charting widget for GTK or QT
===
Is there a widget for GTK or QT that would allow me to draw stock charts like this?
http://smartquant.com/openquant/openquant_chart.jpg
Thanks, Joel | 4 |
8,833,935 | 01/12/2012 10:58:54 | 449,132 | 09/16/2010 05:21:18 | 712 | 5 | How do I publish a Javascript Framework Project? | I have done one JS Framework I wonder how I can publish my work effectively?
Sorry if this question is not relevant for StackOverflow. I will remove it after I got some useful answer. | javascript | null | null | null | null | 01/13/2012 03:14:01 | not a real question | How do I publish a Javascript Framework Project?
===
I have done one JS Framework I wonder how I can publish my work effectively?
Sorry if this question is not relevant for StackOverflow. I will remove it after I got some useful answer. | 1 |
5,891,959 | 05/05/2011 02:17:37 | 721,828 | 04/23/2011 15:03:14 | 1 | 0 | Php special integers | HELP!
I need to Write a function findSpecialIntegers() that takes a integer as the starting point and returns an array that contains the first 10 integers (greater than or equals to the given integer) that are divisible by 3 or 7, BUT NOT BOTH.
| php | integer | special | null | null | 05/05/2011 02:26:23 | not a real question | Php special integers
===
HELP!
I need to Write a function findSpecialIntegers() that takes a integer as the starting point and returns an array that contains the first 10 integers (greater than or equals to the given integer) that are divisible by 3 or 7, BUT NOT BOTH.
| 1 |
3,904,034 | 10/11/2010 06:53:13 | 410,248 | 08/03/2010 23:57:01 | 50 | 1 | Android network stats | Is it possible to create a application that gets network activity / statistics while running as a background process?
Thanks
M | android | null | null | null | null | null | open | Android network stats
===
Is it possible to create a application that gets network activity / statistics while running as a background process?
Thanks
M | 0 |
7,356,752 | 09/09/2011 03:10:58 | 830,641 | 07/06/2011 00:04:06 | 545 | 24 | What does the scope_id parameter in g_scanner_scope_add_symbol represent? | When using the Lexical Scanner GScanner I want to add my own symbols to scan for. When looking for information I find only the API documentation and in other peoples source code like Gimp. The problem is the g_scanner_add_symbol is deprecated and the only one left to use is g_scanner_scope_add_symbol. I understand how to add symbols to my custom scanner using this function, but I still have no idea what the parameter scope_id is used for.
What does scope_id in GScanner represent and how can I take advantage of it?
| c | glib | null | null | null | null | open | What does the scope_id parameter in g_scanner_scope_add_symbol represent?
===
When using the Lexical Scanner GScanner I want to add my own symbols to scan for. When looking for information I find only the API documentation and in other peoples source code like Gimp. The problem is the g_scanner_add_symbol is deprecated and the only one left to use is g_scanner_scope_add_symbol. I understand how to add symbols to my custom scanner using this function, but I still have no idea what the parameter scope_id is used for.
What does scope_id in GScanner represent and how can I take advantage of it?
| 0 |
646,419 | 03/14/2009 18:24:38 | 72,546 | 03/01/2009 21:35:41 | 75 | 2 | Python 3.x Ebook? | I read http://diveintopython.org/toc/index.html for Python 2.x but is there any e-books for Python 3.x? | python | null | null | null | null | 09/24/2011 14:58:05 | not constructive | Python 3.x Ebook?
===
I read http://diveintopython.org/toc/index.html for Python 2.x but is there any e-books for Python 3.x? | 4 |
6,353,415 | 06/15/2011 05:28:04 | 742,781 | 05/07/2011 06:17:47 | 38 | 1 | ERROR/AndroidRuntime(328): Caused by: java.lang.IndexOutOfBoundsException: Invalid index 10, size is 10 | **How to solve this ERROR/AndroidRuntime(328):
Caused by: java.lang.IndexOutOfBoundsException: Invalid index 10, size is 10
this problem ...**
**Log cat:**
06-15 05:11:39.499: ERROR/AndroidRuntime(328): FATAL EXCEPTION: AsyncTask #2
06-15 05:11:39.499: ERROR/AndroidRuntime(328): java.lang.RuntimeException: An error
occured while executing doInBackground()
06-15 05:11:39.499: ERROR/AndroidRuntime(328): at android.os.AsyncTask$3.done(AsyncTask.java:200)
06-15 05:11:39.499: ERROR/AndroidRuntime(328): at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
06-15 05:11:39.499: ERROR/AndroidRuntime(328): at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
06-15 05:11:39.499: ERROR/AndroidRuntime(328): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
06-15 05:11:39.499: ERROR/AndroidRuntime(328): at java.util.concurrent.FutureTask.run(FutureTask.java:137)
06-15 05:11:39.499: ERROR/AndroidRuntime(328): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1068)
06-15 05:11:39.499: ERROR/AndroidRuntime(328): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:561)
06-15 05:11:39.499: ERROR/AndroidRuntime(328): at java.lang.Thread.run(Thread.java:1096)
**06-15 05:11:39.499: ERROR/AndroidRuntime(328): Caused by: java.lang.IndexOutOfBoundsException: Invalid index 10, size is 10**
06-15 05:11:39.499: ERROR/AndroidRuntime(328): at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:257)
06-15 05:11:39.499: ERROR/AndroidRuntime(328): at java.util.ArrayList.get(ArrayList.java:311)
06-15 05:11:39.499: ERROR/AndroidRuntime(328): at $MyGroupByCategorySync.doInBackground(GroupByCategoryProductSearchMainActivity.java:691)
06-15 05:11:39.499: ERROR/AndroidRuntime(328): at android.os.AsyncTask$2.call(AsyncTask.java:185)
06-15 05:11:39.499: ERROR/AndroidRuntime(328): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
06-15 05:11:39.499: ERROR/AndroidRuntime(328): ... 4 more
**Code :**
public class class_name extends Activity implements View.OnClickListener,OnKeyListener {
Spinner spinner_group_select_category;
TableLayout tl_group_product_list_by_category;
Button btn_back_group_by_category_search;
int color_blue = -16776961;
int color_black = -16777216;
int color_white = -1;
private ArrayList<String> list_productid;
private ArrayList<String> list_productname;
private ArrayList<String> list_thumbnail;
private ArrayList<String> list_offername;
private ArrayList<String> list_offerid;
// private ArrayList<String> list_cityname;
private ArrayList<String> list_location;
private ArrayList<String> list_price;
private ArrayList<String> list_prdescription;
private ArrayList<String> list_catname;
private ArrayList<String> list_categoryid;
private ArrayList<Drawable> list_drawable;
private List<ArrayList<?>> lists_of_product_data;
private int single_row_id = 0;
String category_selected;
ArrayList category_array_list;
// private EditText edit_search;
ArrayAdapter adapter_category;
private final int SEARCHED_PRODUCT = 1;
private final int INITIAL_PRODUCT = 2;
private boolean is_searched = false;//VARAIBLE FOR CHECKING PRODUCTS ARE SEARCHED OR NOT
private boolean pressed_once = false;//VARIABLE FOR CHECKING ENTER BUTTON PRESSED
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.group_by_category_product_list);
spinner_group_select_category=(Spinner) findViewById(R.id.spinner_group_select_category);
tl_group_product_list_by_category=(TableLayout) findViewById(R.id.tl_group_product_list_by_category);
initialiseDealSearchComponent(); // initialise components
initializeArrayLists(INITIAL_PRODUCT); // initialise
prepareList(); // call preparelist
/* edit_search = (EditText) findViewById(R.id.edt_search_products);
edit_search.setOnKeyListener(this);*/
btn_back_group_by_category_search.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
Intent intent=new Intent(GroupByCategoryProductSearchMainActivity.this,GroupPurchasingSelectProduct.class);
startActivity(intent);
overridePendingTransition(R.anim.zoom_enter, R.anim.zoom_exit);
}
});
Log.v("--: INITIALIZATION :--","GroupByCategoryProductSearchMainActivity onCreate() Rows Created");
new MyGroupByCategorySync().execute(); // for creating row one by one
Log.v("--: INITIALIZATION :--","GroupByCategoryProductSearchMainActivity onCreate() Rows Created");
Log.v("-->","GroupByCategoryProductSearchMainActivity ENDING onCreate()");
category_array_list = getCategoryList();
adapter_category = createAdapter(spinner_group_select_category,category_array_list);
spinner_group_select_category.setOnItemSelectedListener(new OnItemSelectedListener()
{
@Override
public void onItemSelected(AdapterView<?> parent, View view,int position, long id)
{
String catid="id" ;
String category_selected = spinner_group_select_category.getSelectedItem().toString();
Log.i("--: VALUE :--","category_selected = "+category_selected);
if(!(category_selected=="Select"))
{
XMLData.group_categroy_item_list_details.clear();
if(XMLData.group_caegory_id_map.get(category_selected)!=null)
catid = XMLData.group_caegory_id_map.get(category_selected).toString();
Log.i("--: VALUE :--","category_id = "+catid);
XMLDataParser.parseXML(XMLDataParser.GROUP_CATEGORY_ITEM_LIST_DETAIL_PARSER_CODE, catid);
clearAllList();
initializeArrayLists(SEARCHED_PRODUCT);
pressed_once = true;
is_searched = true;
Log.i("--: VALUE AFTER PARSING:--","pressed_once = "+pressed_once);
Log.i("--: VALUE AFTER PARSING:--","is_searched = "+is_searched);
new MyGroupByCategorySync().execute();
}
}
@Override
public void onNothingSelected(AdapterView<?> arg0)
{
}
});
}
private ArrayList<String> getCategoryList()
{
Log.e("------------", ".........................................................................................");
Log.v("-->"," STARTING getCategoryList()");
ArrayList<String> category_list = new ArrayList<String>();
category_list.add(0,"Select");
for(HashMap<String,String> map : XMLData.group_caegory_list)
{
String categoryid = "";
String categoryname = "";
if(map.get("categoryid")!=null)
{
categoryid = map.get("categoryid").toString();
}
if(map.get("categoryname")!=null)
{
categoryname = map.get("categoryname").toString();
}
category_list.add(categoryname);
XMLData.group_caegory_id_map.put(categoryname,categoryid);
}
Log.i("--: RETURNING :--", "category_list = "+category_list);
Log.v("-->"," ENDING getCategoryList()");
return category_list;
}
private void createRows(List<ByCategory> lists)
{
Log.e("------------", ".........................................................................................");
Log.v("-->","GroupByCategoryProductSearchMainActivity STARTING createRows()");
int row_id = 0;
for(ByCategory bycategory : lists)
{
String productid=bycategory.getProductid();
String productname=bycategory.getProductname();
String thumbnail=bycategory.getThumbnail();
String offername=bycategory.getOffername();
String offerid=bycategory.getOfferid();
String location=bycategory.getLocation();
String price=bycategory.getPrice();
String prdescription=bycategory.getPrdescription();
String catname=bycategory.getCatname();
Drawable product_image=bycategory.getDrawableImage();
Log.v("-->","create row for id"+row_id);
TableRow table_row = new TableRow(this);
TextView tv_blank = new TextView(this);
TextView tv_photo = new TextView(this);
TextView txt_pname = new TextView(this);
TextView txt_city = new TextView(this);
TextView txt_state = new TextView(this);
TextView img_line = new TextView(this);
LinearLayout line_layout = new LinearLayout(this);
LinearLayout row_layout = new LinearLayout(this);
table_row.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT ,LayoutParams.FILL_PARENT));
table_row.setPadding(0, 5, 0, 5);
tv_blank.setWidth(11);
tv_photo.setBackgroundDrawable(product_image);
Log.i("--: VALUE :--", "PRODUCT IMAGE SET TO ROW = "+single_row_id+" "+product_image);
tv_photo.setLayoutParams(new TableRow.LayoutParams(45 ,45));
tv_photo.setGravity(Gravity.CENTER_VERTICAL);
txt_pname.setBackgroundResource(R.drawable.empty);
txt_pname.setText(productname);
Log.i("--: VALUE :--", "PRODUCT NAME SET TO ROW = "+single_row_id+" "+productname);
txt_pname.setTextColor(color_black);
txt_pname.setTextSize(14);
txt_pname.setWidth(110);
txt_pname.setHeight(60);
txt_pname.setPadding(10,0,0,0);
txt_pname.setGravity(Gravity.LEFT);
txt_pname.setGravity(Gravity.CENTER_VERTICAL);
txt_city.setBackgroundResource(R.drawable.empty);
txt_city.setText(location);
Log.i("--: VALUE :--", "location NAME SET TO ROW = "+single_row_id+" "+location);
txt_city.setTextColor(color_black);
txt_city.setTextSize(13);
txt_city.setWidth(65);
txt_city.setHeight(60);
txt_city.setPadding(15,0,0,0);
txt_city.setGravity(Gravity.LEFT);
txt_city.setGravity(Gravity.CENTER_VERTICAL);
txt_state.setBackgroundResource(R.drawable.empty);
txt_state.setText(location);
Log.i("--: VALUE :--", "PRODUCT NAME SET TO ROW = "+single_row_id+" "+location);
txt_state.setTextColor(color_black);
txt_state.setTextSize(13);
txt_state.setWidth(65);
txt_state.setHeight(60);
txt_state.setPadding(15,0,0,0);
txt_state.setGravity(Gravity.LEFT);
txt_state.setGravity(Gravity.CENTER_VERTICAL);
img_line.setBackgroundResource(R.drawable.separater_line);
img_line.setLayoutParams(new TableRow.LayoutParams(LayoutParams.FILL_PARENT ,2));
line_layout.setGravity(Gravity.CENTER_HORIZONTAL);
//table_row.setBackgroundColor(color_white);
/* table_row.setGravity(Gravity.CENTER_VERTICAL);
table_row.addView(tv_blank);
table_row.addView(tv_photo);
table_row.addView(btn_name);*/
row_layout.setGravity(Gravity.CENTER_VERTICAL);
row_layout.addView(tv_blank);
row_layout.addView(tv_photo);
row_layout.addView(txt_pname);
row_layout.addView(txt_city);
row_layout.addView(txt_state);
table_row.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View v)
{
Log.e("--: PRESSED --:","GroupByCategoryProductSearchMainActivity createSingleRow() onClick() Add as Contact Button is Pressed");
Intent intent_show_detail = new Intent(GroupByCategoryProductSearchMainActivity.this,GropPurchasingItemDetail.class);
Toast.makeText(GroupByCategoryProductSearchMainActivity.this, "Row pressed", 1000);
startActivity(intent_show_detail);
finish();
}
});
table_row.addView(row_layout);
line_layout.addView(img_line);
tl_group_product_list_by_category.addView(table_row);
tl_group_product_list_by_category.addView(line_layout);
row_id++;
}
Log.v("-->","GroupByCategoryProductSearchMainActivity ENDING createRows()");
}
private void clearAllList()
{
list_productid.clear();
list_productname.clear();;
list_thumbnail.clear();;
list_offername.clear();;
list_offerid.clear();;
list_location.clear();;
list_price.clear();;
list_prdescription.clear();;
list_catname.clear();
list_categoryid.clear();
list_drawable.clear();
tl_group_product_list_by_category.removeAllViews();
// lists_of_product_data.clear();
}
private void initializeArrayLists(int code_list)
{
Log.e("------------", ".........................................................................................");
Log.v("-->","GroupByCategoryProductSearchMainActivity STARTING initializeArrayLists()");
list_productid=new ArrayList<String>();
list_productname = new ArrayList<String>();
list_thumbnail=new ArrayList<String>();
list_offername = new ArrayList<String>();
list_offerid=new ArrayList<String>();
//list_cityname = new ArrayList<String>();
list_location = new ArrayList<String>();
list_price = new ArrayList<String>();
list_prdescription = new ArrayList<String>();
list_catname = new ArrayList<String>();
list_categoryid= new ArrayList<String>();
list_drawable= new ArrayList<Drawable>();
String productid = "";
String productname = "";
String thumbnail = "";
String offername = "";
String offerid="";
String location = "";
String price="";
String prdescription="";
String catname="";
String categoryid="";
int no_of_map = 0;
if(code_list == INITIAL_PRODUCT)
{
no_of_map = XMLData.group_by_category_product_data_list.size();
Log.i("--: VALUE INITIAL_PRODUCT :-- ", "intitial no_of_map = "+no_of_map);
}
else if(code_list == SEARCHED_PRODUCT)
{
no_of_map = XMLData.group_categroy_item_list_details.size();
Log.i("--: VALUE SEARCHED_PRODUCT:-- ", " no_of_map = "+no_of_map);
}
HashMap<String,String> product_map = null;
for(int i=0;i<no_of_map;i++)
{
if(code_list == INITIAL_PRODUCT)
{
product_map = XMLData.group_by_category_product_data_list.get(i);
Log.v("-->"," in product_search_data_list ");
}
else if(code_list == SEARCHED_PRODUCT)
{
product_map = XMLData.group_categroy_item_list_details.get(i);
Log.v("-->","in group_categroy_item_list_details ");
}
if(product_map.get("productid")!=null)
{
productid = product_map.get("productid").toString();
Log.v("-->","productid ="+productid);
}
list_productid.add(productid);
if(product_map.get("productname")!=null)
{
productname = product_map.get("productname").toString();
Log.v("-->","productname ="+productname);
}
list_productname.add(productname);
if(product_map.get("thumbnail")!=null)
{
thumbnail = product_map.get("thumbnail").toString();
}
list_thumbnail.add(thumbnail);
Log.v("-->","thumbnail = "+thumbnail);
if(product_map.get("offername")!=null)
{
offername = product_map.get("offername").toString();
}
list_offername.add(offername);
Log.v("-->","offername = "+offername);
if(product_map.get("offerid")!=null)
{
offerid = product_map.get("offerid").toString();
}
list_offerid.add(offerid);
Log.v("-->","offerid = "+offerid);
if(product_map.get("location")!=null)
{
location = product_map.get("location").toString();
}
list_location.add(location);
Log.v("-->","location ="+location);
if(product_map.get("price")!=null)
{
price = product_map.get("price").toString();
}
list_price.add(price);
Log.v("-->","price = "+price);
if(product_map.get("prdescription")!=null)
{
prdescription = product_map.get("prdescription").toString();
}
list_prdescription.add(prdescription);
Log.v("-->","prdescription = "+prdescription);
if(product_map.get("catname")!=null)
{
catname = product_map.get("catname").toString();
}
list_catname.add(catname);
if(product_map.get("categoryid")!=null)
{
categoryid = product_map.get("categoryid").toString();
}
list_categoryid.add(categoryid);
Log.v("-->","---------------------------------------------------");
}
Log.v("-->","initializeArrayLists()");
Log.v("-->","GroupByCategoryProductSearchMainActivity ENDING initializeArrayLists() "+product_map);
}
private void createSingleRow(String bycategory_info[],Drawable product_image)
{
Log.e("------------", ".........................................................................................");
Log.v("-->","GroupByCategoryProductSearchMainActivity STARTING createSingleRow()");
String productname = bycategory_info[1];
String city = bycategory_info[4];
String state = bycategory_info[4];
final String strOfferid=bycategory_info[3];
// for(int row_id=0;row_id<no_of_rows;row_id++)
// {
TableRow table_row = new TableRow(this);
TextView tv_blank = new TextView(this);
TextView tv_photo = new TextView(this);
TextView txt_pname = new TextView(this);
TextView txt_city = new TextView(this);
TextView txt_state = new TextView(this);
TextView img_line = new TextView(this);
LinearLayout line_layout = new LinearLayout(this);
LinearLayout row_layout = new LinearLayout(this);
table_row.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT ,LayoutParams.FILL_PARENT));
table_row.setPadding(0, 5, 0, 5);
tv_blank.setWidth(11);
tv_photo.setBackgroundDrawable(product_image);
Log.i("--: VALUE :--", "PRODUCT IMAGE SET TO ROW = "+single_row_id+" "+product_image);
tv_photo.setLayoutParams(new TableRow.LayoutParams(45 ,45));
tv_photo.setGravity(Gravity.CENTER_VERTICAL);
txt_pname.setBackgroundResource(R.drawable.empty);
txt_pname.setText(productname);
Log.i("--: VALUE :--", "PRODUCT NAME SET TO ROW = "+single_row_id+" "+productname);
txt_pname.setTextColor(color_black);
txt_pname.setTextSize(14);
txt_pname.setWidth(110);
txt_pname.setHeight(60);
txt_pname.setPadding(10,0,0,0);
txt_pname.setGravity(Gravity.LEFT);
txt_pname.setGravity(Gravity.CENTER_VERTICAL);
txt_city.setBackgroundResource(R.drawable.empty);
txt_city.setText(city);
Log.i("--: VALUE :--", "location NAME SET TO ROW = "+single_row_id+" "+city);
txt_city.setTextColor(color_black);
txt_city.setTextSize(13);
txt_city.setWidth(65);
txt_city.setHeight(60);
txt_city.setPadding(15,0,0,0);
txt_city.setGravity(Gravity.LEFT);
txt_city.setGravity(Gravity.CENTER_VERTICAL);
txt_state.setBackgroundResource(R.drawable.empty);
txt_state.setText(state);
Log.i("--: VALUE :--", "PRODUCT NAME SET TO ROW = "+single_row_id+" "+state);
txt_state.setTextColor(color_black);
txt_state.setTextSize(13);
txt_state.setWidth(65);
txt_state.setHeight(60);
txt_state.setPadding(15,0,0,0);
txt_state.setGravity(Gravity.LEFT);
txt_state.setGravity(Gravity.CENTER_VERTICAL);
img_line.setBackgroundResource(R.drawable.separater_line);
img_line.setLayoutParams(new TableRow.LayoutParams(LayoutParams.FILL_PARENT ,2));
line_layout.setGravity(Gravity.CENTER_HORIZONTAL);
//table_row.setBackgroundColor(color_white);
/* table_row.setGravity(Gravity.CENTER_VERTICAL);
table_row.addView(tv_blank);
table_row.addView(tv_photo);
table_row.addView(btn_name);*/
row_layout.setGravity(Gravity.CENTER_VERTICAL);
row_layout.addView(tv_blank);
row_layout.addView(tv_photo);
row_layout.addView(txt_pname);
row_layout.addView(txt_city);
row_layout.addView(txt_state);
table_row.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View v)
{
XMLDataParser.parseXML(XMLDataParser.GROUP_PRODUCT_ITEM_DETAIL_PARSER_CODE,strOfferid);
Intent intent_show_detail = new Intent(GroupByCategoryProductSearchMainActivity.this,GroupByCategoryItemDetail.class);
Toast.makeText(GroupByCategoryProductSearchMainActivity.this, "Row pressed", 1000);
startActivity(intent_show_detail);
finish();
}
});
table_row.addView(row_layout);
line_layout.addView(img_line);
tl_group_product_list_by_category.addView(table_row);
tl_group_product_list_by_category.addView(line_layout);
// }
Log.v("-->","GroupByCategoryProductSearchMainActivity ENDING createSingleRow()");
single_row_id++;
}
/* private void clearAllList()
{
list_productname.clear();
list_offername.clear();
list_cityname.clear();
list_location.clear();
list_price.clear();
list_prdescription.clear();
list_catname.clear();
list_thumbnail.clear();
tl_group_product_list_by_category.removeAllViews();
lists_of_product_data.clear();
}*/
private void prepareList()
{
Log.v("--: prepareList :--","GroupByCategoryProductSearchMainActivity prepareList() start");
lists_of_product_data = new ArrayList<ArrayList<?>>();
lists_of_product_data.add(0,list_productname);
lists_of_product_data.add(1,list_location);
lists_of_product_data.add(2,list_thumbnail);
lists_of_product_data.add(3,list_drawable);
Log.v("--: prepareList :--","GroupByCategoryProductSearchMainActivity prepareList() end");
}
private Drawable loadImageFromWebOperations(String url)
{
Log.e("------------", ".........................................................................................");
Log.v("-->","GroupByCategoryProductSearchMainActivity STARTING loadImageFromWebOperations()");
try
{
InputStream is = (InputStream) new URL(url).getContent();
Drawable d = Drawable.createFromStream(is, "src name");
Log.i("--: RETURNING :-- d", "Drawable = "+d);
Log.v("-->","GroupByCategoryProductSearchMainActivity ENDING loadImageFromWebOperations()");
return d;
}
catch (Exception e)
{
Log.v("EXCEPTION AT ","GroupByCategoryProductSearchMainActivity loadImageFromWebOperations()");
System.out.println("EXCEPTION AT loadImageFromWebOperations ="+e);
Log.i("--: RETURNING :-- null", "Drawable");
Log.v("-->","GroupByCategoryProductSearchMainActivity ENDING loadImageFromWebOperations()");
return null;
}
}
private ArrayAdapter createAdapter(Spinner spinner,ArrayList array_list)
{
Log.v("Start ","RegistrationPage createAdapter()");
ArrayAdapter<String> adapter = new ArrayAdapter(this,R.layout.spinner_textview,array_list);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_item);
spinner.setAdapter(adapter);
// spinner.setOnItemSelectedListener(this);
Log.i("--: Category :--", "adapter = "+adapter);
Log.v("End ","Category createAdapter()");
return adapter;
}
public void initialiseDealSearchComponent()
{
Log.v("start","initialiseDealSearchComponent Start");
btn_back_group_by_category_search=(Button) findViewById(R.id.btn_back_group_by_category_search);
Log.v("End","initialiseDealSearchComponent End");
}
@Override
public void onClick(View arg1) {
// TODO Auto-generated method stub
}
@Override
public boolean onKey(View arg0, int arg1, KeyEvent arg2) {
// TODO Auto-generated method stub
return false;
}
**class MyGroupByCategorySync extends AsyncTask
{
String bycategory_info[] = new String[9];
Drawable product_image = null;
int no_of_rows = list_productname.size();
@Override
protected Object doInBackground(Object... params)
{
Log.e("------------", ".........................................................................................");
Log.v("-->"," STARTING doInBackground()");
Log.i("--: doInBackground :-- ", "no_of_rows = "+no_of_rows);
for(int i=0;i<no_of_rows;i++)
{
bycategory_info[0] = list_productid.get(i).toString();
bycategory_info[1] = list_productname.get(i).toString();
bycategory_info[2] = list_offername.get(i).toString();
bycategory_info[3] = list_offerid.get(i).toString();
bycategory_info[4] = list_location.get(i).toString();
bycategory_info[5] = list_price.get(i).toString();
bycategory_info[6] = list_prdescription.get(i).toString();
bycategory_info[7] = list_catname.get(i).toString();
bycategory_info[8] = list_categoryid.get(i).toString();
// PRODUCTs_info[4] = list_PRODUCT_thumbnail.get(i).toString();
product_image = loadImageFromWebOperations(list_thumbnail.get(i).toString());
XMLData.group_by_category_product_image_list.add(product_image);
if(!is_searched)
XMLData.initial_list_of_product_by_category.add(new ByCategory(bycategory_info[0],bycategory_info[1],list_thumbnail.get(i).toString(),bycategory_info[2],bycategory_info[3],bycategory_info[4],bycategory_info[5],bycategory_info[6],bycategory_info[7],bycategory_info[8], product_image));
else
XMLData.searched_list_of_product_by_category.add(new ByCategory(bycategory_info[0],bycategory_info[1],list_thumbnail.get(i).toString(),bycategory_info[2],bycategory_info[3],bycategory_info[4],bycategory_info[5],bycategory_info[6],bycategory_info[7],bycategory_info[8], product_image));
publishProgress();
SystemClock.sleep(15);
}
Log.v("-->","ENDING doInBackground()");
XMLData.is_by_category_product_data_parsed = true;
return null;
}
@Override
protected void onPostExecute(Object result)
{
super.onPostExecute(result);
pressed_once = false;
single_row_id = 0;
Log.i("--: VALUE AFTER onPostExecute:--","pressed_once = "+pressed_once);
}
@Override
protected void onProgressUpdate(Object... values)
{
// super.onProgressUpdate(values);
createSingleRow(bycategory_info, product_image);
}
}**
}
| android | android-xml | android-asynctask | null | null | 06/15/2011 06:11:12 | not a real question | ERROR/AndroidRuntime(328): Caused by: java.lang.IndexOutOfBoundsException: Invalid index 10, size is 10
===
**How to solve this ERROR/AndroidRuntime(328):
Caused by: java.lang.IndexOutOfBoundsException: Invalid index 10, size is 10
this problem ...**
**Log cat:**
06-15 05:11:39.499: ERROR/AndroidRuntime(328): FATAL EXCEPTION: AsyncTask #2
06-15 05:11:39.499: ERROR/AndroidRuntime(328): java.lang.RuntimeException: An error
occured while executing doInBackground()
06-15 05:11:39.499: ERROR/AndroidRuntime(328): at android.os.AsyncTask$3.done(AsyncTask.java:200)
06-15 05:11:39.499: ERROR/AndroidRuntime(328): at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
06-15 05:11:39.499: ERROR/AndroidRuntime(328): at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
06-15 05:11:39.499: ERROR/AndroidRuntime(328): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
06-15 05:11:39.499: ERROR/AndroidRuntime(328): at java.util.concurrent.FutureTask.run(FutureTask.java:137)
06-15 05:11:39.499: ERROR/AndroidRuntime(328): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1068)
06-15 05:11:39.499: ERROR/AndroidRuntime(328): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:561)
06-15 05:11:39.499: ERROR/AndroidRuntime(328): at java.lang.Thread.run(Thread.java:1096)
**06-15 05:11:39.499: ERROR/AndroidRuntime(328): Caused by: java.lang.IndexOutOfBoundsException: Invalid index 10, size is 10**
06-15 05:11:39.499: ERROR/AndroidRuntime(328): at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:257)
06-15 05:11:39.499: ERROR/AndroidRuntime(328): at java.util.ArrayList.get(ArrayList.java:311)
06-15 05:11:39.499: ERROR/AndroidRuntime(328): at $MyGroupByCategorySync.doInBackground(GroupByCategoryProductSearchMainActivity.java:691)
06-15 05:11:39.499: ERROR/AndroidRuntime(328): at android.os.AsyncTask$2.call(AsyncTask.java:185)
06-15 05:11:39.499: ERROR/AndroidRuntime(328): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
06-15 05:11:39.499: ERROR/AndroidRuntime(328): ... 4 more
**Code :**
public class class_name extends Activity implements View.OnClickListener,OnKeyListener {
Spinner spinner_group_select_category;
TableLayout tl_group_product_list_by_category;
Button btn_back_group_by_category_search;
int color_blue = -16776961;
int color_black = -16777216;
int color_white = -1;
private ArrayList<String> list_productid;
private ArrayList<String> list_productname;
private ArrayList<String> list_thumbnail;
private ArrayList<String> list_offername;
private ArrayList<String> list_offerid;
// private ArrayList<String> list_cityname;
private ArrayList<String> list_location;
private ArrayList<String> list_price;
private ArrayList<String> list_prdescription;
private ArrayList<String> list_catname;
private ArrayList<String> list_categoryid;
private ArrayList<Drawable> list_drawable;
private List<ArrayList<?>> lists_of_product_data;
private int single_row_id = 0;
String category_selected;
ArrayList category_array_list;
// private EditText edit_search;
ArrayAdapter adapter_category;
private final int SEARCHED_PRODUCT = 1;
private final int INITIAL_PRODUCT = 2;
private boolean is_searched = false;//VARAIBLE FOR CHECKING PRODUCTS ARE SEARCHED OR NOT
private boolean pressed_once = false;//VARIABLE FOR CHECKING ENTER BUTTON PRESSED
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.group_by_category_product_list);
spinner_group_select_category=(Spinner) findViewById(R.id.spinner_group_select_category);
tl_group_product_list_by_category=(TableLayout) findViewById(R.id.tl_group_product_list_by_category);
initialiseDealSearchComponent(); // initialise components
initializeArrayLists(INITIAL_PRODUCT); // initialise
prepareList(); // call preparelist
/* edit_search = (EditText) findViewById(R.id.edt_search_products);
edit_search.setOnKeyListener(this);*/
btn_back_group_by_category_search.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
Intent intent=new Intent(GroupByCategoryProductSearchMainActivity.this,GroupPurchasingSelectProduct.class);
startActivity(intent);
overridePendingTransition(R.anim.zoom_enter, R.anim.zoom_exit);
}
});
Log.v("--: INITIALIZATION :--","GroupByCategoryProductSearchMainActivity onCreate() Rows Created");
new MyGroupByCategorySync().execute(); // for creating row one by one
Log.v("--: INITIALIZATION :--","GroupByCategoryProductSearchMainActivity onCreate() Rows Created");
Log.v("-->","GroupByCategoryProductSearchMainActivity ENDING onCreate()");
category_array_list = getCategoryList();
adapter_category = createAdapter(spinner_group_select_category,category_array_list);
spinner_group_select_category.setOnItemSelectedListener(new OnItemSelectedListener()
{
@Override
public void onItemSelected(AdapterView<?> parent, View view,int position, long id)
{
String catid="id" ;
String category_selected = spinner_group_select_category.getSelectedItem().toString();
Log.i("--: VALUE :--","category_selected = "+category_selected);
if(!(category_selected=="Select"))
{
XMLData.group_categroy_item_list_details.clear();
if(XMLData.group_caegory_id_map.get(category_selected)!=null)
catid = XMLData.group_caegory_id_map.get(category_selected).toString();
Log.i("--: VALUE :--","category_id = "+catid);
XMLDataParser.parseXML(XMLDataParser.GROUP_CATEGORY_ITEM_LIST_DETAIL_PARSER_CODE, catid);
clearAllList();
initializeArrayLists(SEARCHED_PRODUCT);
pressed_once = true;
is_searched = true;
Log.i("--: VALUE AFTER PARSING:--","pressed_once = "+pressed_once);
Log.i("--: VALUE AFTER PARSING:--","is_searched = "+is_searched);
new MyGroupByCategorySync().execute();
}
}
@Override
public void onNothingSelected(AdapterView<?> arg0)
{
}
});
}
private ArrayList<String> getCategoryList()
{
Log.e("------------", ".........................................................................................");
Log.v("-->"," STARTING getCategoryList()");
ArrayList<String> category_list = new ArrayList<String>();
category_list.add(0,"Select");
for(HashMap<String,String> map : XMLData.group_caegory_list)
{
String categoryid = "";
String categoryname = "";
if(map.get("categoryid")!=null)
{
categoryid = map.get("categoryid").toString();
}
if(map.get("categoryname")!=null)
{
categoryname = map.get("categoryname").toString();
}
category_list.add(categoryname);
XMLData.group_caegory_id_map.put(categoryname,categoryid);
}
Log.i("--: RETURNING :--", "category_list = "+category_list);
Log.v("-->"," ENDING getCategoryList()");
return category_list;
}
private void createRows(List<ByCategory> lists)
{
Log.e("------------", ".........................................................................................");
Log.v("-->","GroupByCategoryProductSearchMainActivity STARTING createRows()");
int row_id = 0;
for(ByCategory bycategory : lists)
{
String productid=bycategory.getProductid();
String productname=bycategory.getProductname();
String thumbnail=bycategory.getThumbnail();
String offername=bycategory.getOffername();
String offerid=bycategory.getOfferid();
String location=bycategory.getLocation();
String price=bycategory.getPrice();
String prdescription=bycategory.getPrdescription();
String catname=bycategory.getCatname();
Drawable product_image=bycategory.getDrawableImage();
Log.v("-->","create row for id"+row_id);
TableRow table_row = new TableRow(this);
TextView tv_blank = new TextView(this);
TextView tv_photo = new TextView(this);
TextView txt_pname = new TextView(this);
TextView txt_city = new TextView(this);
TextView txt_state = new TextView(this);
TextView img_line = new TextView(this);
LinearLayout line_layout = new LinearLayout(this);
LinearLayout row_layout = new LinearLayout(this);
table_row.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT ,LayoutParams.FILL_PARENT));
table_row.setPadding(0, 5, 0, 5);
tv_blank.setWidth(11);
tv_photo.setBackgroundDrawable(product_image);
Log.i("--: VALUE :--", "PRODUCT IMAGE SET TO ROW = "+single_row_id+" "+product_image);
tv_photo.setLayoutParams(new TableRow.LayoutParams(45 ,45));
tv_photo.setGravity(Gravity.CENTER_VERTICAL);
txt_pname.setBackgroundResource(R.drawable.empty);
txt_pname.setText(productname);
Log.i("--: VALUE :--", "PRODUCT NAME SET TO ROW = "+single_row_id+" "+productname);
txt_pname.setTextColor(color_black);
txt_pname.setTextSize(14);
txt_pname.setWidth(110);
txt_pname.setHeight(60);
txt_pname.setPadding(10,0,0,0);
txt_pname.setGravity(Gravity.LEFT);
txt_pname.setGravity(Gravity.CENTER_VERTICAL);
txt_city.setBackgroundResource(R.drawable.empty);
txt_city.setText(location);
Log.i("--: VALUE :--", "location NAME SET TO ROW = "+single_row_id+" "+location);
txt_city.setTextColor(color_black);
txt_city.setTextSize(13);
txt_city.setWidth(65);
txt_city.setHeight(60);
txt_city.setPadding(15,0,0,0);
txt_city.setGravity(Gravity.LEFT);
txt_city.setGravity(Gravity.CENTER_VERTICAL);
txt_state.setBackgroundResource(R.drawable.empty);
txt_state.setText(location);
Log.i("--: VALUE :--", "PRODUCT NAME SET TO ROW = "+single_row_id+" "+location);
txt_state.setTextColor(color_black);
txt_state.setTextSize(13);
txt_state.setWidth(65);
txt_state.setHeight(60);
txt_state.setPadding(15,0,0,0);
txt_state.setGravity(Gravity.LEFT);
txt_state.setGravity(Gravity.CENTER_VERTICAL);
img_line.setBackgroundResource(R.drawable.separater_line);
img_line.setLayoutParams(new TableRow.LayoutParams(LayoutParams.FILL_PARENT ,2));
line_layout.setGravity(Gravity.CENTER_HORIZONTAL);
//table_row.setBackgroundColor(color_white);
/* table_row.setGravity(Gravity.CENTER_VERTICAL);
table_row.addView(tv_blank);
table_row.addView(tv_photo);
table_row.addView(btn_name);*/
row_layout.setGravity(Gravity.CENTER_VERTICAL);
row_layout.addView(tv_blank);
row_layout.addView(tv_photo);
row_layout.addView(txt_pname);
row_layout.addView(txt_city);
row_layout.addView(txt_state);
table_row.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View v)
{
Log.e("--: PRESSED --:","GroupByCategoryProductSearchMainActivity createSingleRow() onClick() Add as Contact Button is Pressed");
Intent intent_show_detail = new Intent(GroupByCategoryProductSearchMainActivity.this,GropPurchasingItemDetail.class);
Toast.makeText(GroupByCategoryProductSearchMainActivity.this, "Row pressed", 1000);
startActivity(intent_show_detail);
finish();
}
});
table_row.addView(row_layout);
line_layout.addView(img_line);
tl_group_product_list_by_category.addView(table_row);
tl_group_product_list_by_category.addView(line_layout);
row_id++;
}
Log.v("-->","GroupByCategoryProductSearchMainActivity ENDING createRows()");
}
private void clearAllList()
{
list_productid.clear();
list_productname.clear();;
list_thumbnail.clear();;
list_offername.clear();;
list_offerid.clear();;
list_location.clear();;
list_price.clear();;
list_prdescription.clear();;
list_catname.clear();
list_categoryid.clear();
list_drawable.clear();
tl_group_product_list_by_category.removeAllViews();
// lists_of_product_data.clear();
}
private void initializeArrayLists(int code_list)
{
Log.e("------------", ".........................................................................................");
Log.v("-->","GroupByCategoryProductSearchMainActivity STARTING initializeArrayLists()");
list_productid=new ArrayList<String>();
list_productname = new ArrayList<String>();
list_thumbnail=new ArrayList<String>();
list_offername = new ArrayList<String>();
list_offerid=new ArrayList<String>();
//list_cityname = new ArrayList<String>();
list_location = new ArrayList<String>();
list_price = new ArrayList<String>();
list_prdescription = new ArrayList<String>();
list_catname = new ArrayList<String>();
list_categoryid= new ArrayList<String>();
list_drawable= new ArrayList<Drawable>();
String productid = "";
String productname = "";
String thumbnail = "";
String offername = "";
String offerid="";
String location = "";
String price="";
String prdescription="";
String catname="";
String categoryid="";
int no_of_map = 0;
if(code_list == INITIAL_PRODUCT)
{
no_of_map = XMLData.group_by_category_product_data_list.size();
Log.i("--: VALUE INITIAL_PRODUCT :-- ", "intitial no_of_map = "+no_of_map);
}
else if(code_list == SEARCHED_PRODUCT)
{
no_of_map = XMLData.group_categroy_item_list_details.size();
Log.i("--: VALUE SEARCHED_PRODUCT:-- ", " no_of_map = "+no_of_map);
}
HashMap<String,String> product_map = null;
for(int i=0;i<no_of_map;i++)
{
if(code_list == INITIAL_PRODUCT)
{
product_map = XMLData.group_by_category_product_data_list.get(i);
Log.v("-->"," in product_search_data_list ");
}
else if(code_list == SEARCHED_PRODUCT)
{
product_map = XMLData.group_categroy_item_list_details.get(i);
Log.v("-->","in group_categroy_item_list_details ");
}
if(product_map.get("productid")!=null)
{
productid = product_map.get("productid").toString();
Log.v("-->","productid ="+productid);
}
list_productid.add(productid);
if(product_map.get("productname")!=null)
{
productname = product_map.get("productname").toString();
Log.v("-->","productname ="+productname);
}
list_productname.add(productname);
if(product_map.get("thumbnail")!=null)
{
thumbnail = product_map.get("thumbnail").toString();
}
list_thumbnail.add(thumbnail);
Log.v("-->","thumbnail = "+thumbnail);
if(product_map.get("offername")!=null)
{
offername = product_map.get("offername").toString();
}
list_offername.add(offername);
Log.v("-->","offername = "+offername);
if(product_map.get("offerid")!=null)
{
offerid = product_map.get("offerid").toString();
}
list_offerid.add(offerid);
Log.v("-->","offerid = "+offerid);
if(product_map.get("location")!=null)
{
location = product_map.get("location").toString();
}
list_location.add(location);
Log.v("-->","location ="+location);
if(product_map.get("price")!=null)
{
price = product_map.get("price").toString();
}
list_price.add(price);
Log.v("-->","price = "+price);
if(product_map.get("prdescription")!=null)
{
prdescription = product_map.get("prdescription").toString();
}
list_prdescription.add(prdescription);
Log.v("-->","prdescription = "+prdescription);
if(product_map.get("catname")!=null)
{
catname = product_map.get("catname").toString();
}
list_catname.add(catname);
if(product_map.get("categoryid")!=null)
{
categoryid = product_map.get("categoryid").toString();
}
list_categoryid.add(categoryid);
Log.v("-->","---------------------------------------------------");
}
Log.v("-->","initializeArrayLists()");
Log.v("-->","GroupByCategoryProductSearchMainActivity ENDING initializeArrayLists() "+product_map);
}
private void createSingleRow(String bycategory_info[],Drawable product_image)
{
Log.e("------------", ".........................................................................................");
Log.v("-->","GroupByCategoryProductSearchMainActivity STARTING createSingleRow()");
String productname = bycategory_info[1];
String city = bycategory_info[4];
String state = bycategory_info[4];
final String strOfferid=bycategory_info[3];
// for(int row_id=0;row_id<no_of_rows;row_id++)
// {
TableRow table_row = new TableRow(this);
TextView tv_blank = new TextView(this);
TextView tv_photo = new TextView(this);
TextView txt_pname = new TextView(this);
TextView txt_city = new TextView(this);
TextView txt_state = new TextView(this);
TextView img_line = new TextView(this);
LinearLayout line_layout = new LinearLayout(this);
LinearLayout row_layout = new LinearLayout(this);
table_row.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT ,LayoutParams.FILL_PARENT));
table_row.setPadding(0, 5, 0, 5);
tv_blank.setWidth(11);
tv_photo.setBackgroundDrawable(product_image);
Log.i("--: VALUE :--", "PRODUCT IMAGE SET TO ROW = "+single_row_id+" "+product_image);
tv_photo.setLayoutParams(new TableRow.LayoutParams(45 ,45));
tv_photo.setGravity(Gravity.CENTER_VERTICAL);
txt_pname.setBackgroundResource(R.drawable.empty);
txt_pname.setText(productname);
Log.i("--: VALUE :--", "PRODUCT NAME SET TO ROW = "+single_row_id+" "+productname);
txt_pname.setTextColor(color_black);
txt_pname.setTextSize(14);
txt_pname.setWidth(110);
txt_pname.setHeight(60);
txt_pname.setPadding(10,0,0,0);
txt_pname.setGravity(Gravity.LEFT);
txt_pname.setGravity(Gravity.CENTER_VERTICAL);
txt_city.setBackgroundResource(R.drawable.empty);
txt_city.setText(city);
Log.i("--: VALUE :--", "location NAME SET TO ROW = "+single_row_id+" "+city);
txt_city.setTextColor(color_black);
txt_city.setTextSize(13);
txt_city.setWidth(65);
txt_city.setHeight(60);
txt_city.setPadding(15,0,0,0);
txt_city.setGravity(Gravity.LEFT);
txt_city.setGravity(Gravity.CENTER_VERTICAL);
txt_state.setBackgroundResource(R.drawable.empty);
txt_state.setText(state);
Log.i("--: VALUE :--", "PRODUCT NAME SET TO ROW = "+single_row_id+" "+state);
txt_state.setTextColor(color_black);
txt_state.setTextSize(13);
txt_state.setWidth(65);
txt_state.setHeight(60);
txt_state.setPadding(15,0,0,0);
txt_state.setGravity(Gravity.LEFT);
txt_state.setGravity(Gravity.CENTER_VERTICAL);
img_line.setBackgroundResource(R.drawable.separater_line);
img_line.setLayoutParams(new TableRow.LayoutParams(LayoutParams.FILL_PARENT ,2));
line_layout.setGravity(Gravity.CENTER_HORIZONTAL);
//table_row.setBackgroundColor(color_white);
/* table_row.setGravity(Gravity.CENTER_VERTICAL);
table_row.addView(tv_blank);
table_row.addView(tv_photo);
table_row.addView(btn_name);*/
row_layout.setGravity(Gravity.CENTER_VERTICAL);
row_layout.addView(tv_blank);
row_layout.addView(tv_photo);
row_layout.addView(txt_pname);
row_layout.addView(txt_city);
row_layout.addView(txt_state);
table_row.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View v)
{
XMLDataParser.parseXML(XMLDataParser.GROUP_PRODUCT_ITEM_DETAIL_PARSER_CODE,strOfferid);
Intent intent_show_detail = new Intent(GroupByCategoryProductSearchMainActivity.this,GroupByCategoryItemDetail.class);
Toast.makeText(GroupByCategoryProductSearchMainActivity.this, "Row pressed", 1000);
startActivity(intent_show_detail);
finish();
}
});
table_row.addView(row_layout);
line_layout.addView(img_line);
tl_group_product_list_by_category.addView(table_row);
tl_group_product_list_by_category.addView(line_layout);
// }
Log.v("-->","GroupByCategoryProductSearchMainActivity ENDING createSingleRow()");
single_row_id++;
}
/* private void clearAllList()
{
list_productname.clear();
list_offername.clear();
list_cityname.clear();
list_location.clear();
list_price.clear();
list_prdescription.clear();
list_catname.clear();
list_thumbnail.clear();
tl_group_product_list_by_category.removeAllViews();
lists_of_product_data.clear();
}*/
private void prepareList()
{
Log.v("--: prepareList :--","GroupByCategoryProductSearchMainActivity prepareList() start");
lists_of_product_data = new ArrayList<ArrayList<?>>();
lists_of_product_data.add(0,list_productname);
lists_of_product_data.add(1,list_location);
lists_of_product_data.add(2,list_thumbnail);
lists_of_product_data.add(3,list_drawable);
Log.v("--: prepareList :--","GroupByCategoryProductSearchMainActivity prepareList() end");
}
private Drawable loadImageFromWebOperations(String url)
{
Log.e("------------", ".........................................................................................");
Log.v("-->","GroupByCategoryProductSearchMainActivity STARTING loadImageFromWebOperations()");
try
{
InputStream is = (InputStream) new URL(url).getContent();
Drawable d = Drawable.createFromStream(is, "src name");
Log.i("--: RETURNING :-- d", "Drawable = "+d);
Log.v("-->","GroupByCategoryProductSearchMainActivity ENDING loadImageFromWebOperations()");
return d;
}
catch (Exception e)
{
Log.v("EXCEPTION AT ","GroupByCategoryProductSearchMainActivity loadImageFromWebOperations()");
System.out.println("EXCEPTION AT loadImageFromWebOperations ="+e);
Log.i("--: RETURNING :-- null", "Drawable");
Log.v("-->","GroupByCategoryProductSearchMainActivity ENDING loadImageFromWebOperations()");
return null;
}
}
private ArrayAdapter createAdapter(Spinner spinner,ArrayList array_list)
{
Log.v("Start ","RegistrationPage createAdapter()");
ArrayAdapter<String> adapter = new ArrayAdapter(this,R.layout.spinner_textview,array_list);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_item);
spinner.setAdapter(adapter);
// spinner.setOnItemSelectedListener(this);
Log.i("--: Category :--", "adapter = "+adapter);
Log.v("End ","Category createAdapter()");
return adapter;
}
public void initialiseDealSearchComponent()
{
Log.v("start","initialiseDealSearchComponent Start");
btn_back_group_by_category_search=(Button) findViewById(R.id.btn_back_group_by_category_search);
Log.v("End","initialiseDealSearchComponent End");
}
@Override
public void onClick(View arg1) {
// TODO Auto-generated method stub
}
@Override
public boolean onKey(View arg0, int arg1, KeyEvent arg2) {
// TODO Auto-generated method stub
return false;
}
**class MyGroupByCategorySync extends AsyncTask
{
String bycategory_info[] = new String[9];
Drawable product_image = null;
int no_of_rows = list_productname.size();
@Override
protected Object doInBackground(Object... params)
{
Log.e("------------", ".........................................................................................");
Log.v("-->"," STARTING doInBackground()");
Log.i("--: doInBackground :-- ", "no_of_rows = "+no_of_rows);
for(int i=0;i<no_of_rows;i++)
{
bycategory_info[0] = list_productid.get(i).toString();
bycategory_info[1] = list_productname.get(i).toString();
bycategory_info[2] = list_offername.get(i).toString();
bycategory_info[3] = list_offerid.get(i).toString();
bycategory_info[4] = list_location.get(i).toString();
bycategory_info[5] = list_price.get(i).toString();
bycategory_info[6] = list_prdescription.get(i).toString();
bycategory_info[7] = list_catname.get(i).toString();
bycategory_info[8] = list_categoryid.get(i).toString();
// PRODUCTs_info[4] = list_PRODUCT_thumbnail.get(i).toString();
product_image = loadImageFromWebOperations(list_thumbnail.get(i).toString());
XMLData.group_by_category_product_image_list.add(product_image);
if(!is_searched)
XMLData.initial_list_of_product_by_category.add(new ByCategory(bycategory_info[0],bycategory_info[1],list_thumbnail.get(i).toString(),bycategory_info[2],bycategory_info[3],bycategory_info[4],bycategory_info[5],bycategory_info[6],bycategory_info[7],bycategory_info[8], product_image));
else
XMLData.searched_list_of_product_by_category.add(new ByCategory(bycategory_info[0],bycategory_info[1],list_thumbnail.get(i).toString(),bycategory_info[2],bycategory_info[3],bycategory_info[4],bycategory_info[5],bycategory_info[6],bycategory_info[7],bycategory_info[8], product_image));
publishProgress();
SystemClock.sleep(15);
}
Log.v("-->","ENDING doInBackground()");
XMLData.is_by_category_product_data_parsed = true;
return null;
}
@Override
protected void onPostExecute(Object result)
{
super.onPostExecute(result);
pressed_once = false;
single_row_id = 0;
Log.i("--: VALUE AFTER onPostExecute:--","pressed_once = "+pressed_once);
}
@Override
protected void onProgressUpdate(Object... values)
{
// super.onProgressUpdate(values);
createSingleRow(bycategory_info, product_image);
}
}**
}
| 1 |
9,906,685 | 03/28/2012 11:36:35 | 790,023 | 06/08/2011 23:09:39 | 23 | 0 | My code won't insert into db | I cant really think of a reason it wouldnt...it looks fine to me (if it was fine, i wouldnt be here asking)
This happened before (see my recent posts) where I used code from a previous project (that worked fine), but when I tried using it for this particular project, it wouldnt work. I have no idea why it wont work this particular time, since it worked before
Can anyone tell me whats wrong with the query?
<?php
$hostname = "localhost";
$db_user = "#"; // change to your database password
$db_password = "#"; // change to your database password
$database = "#"; // provide your database name
$db_table = "#"; // leave this as is
# STOP HERE
####################################################################
# THIS CODE IS USED TO CONNECT TO THE MYSQL DATABASE
$db = mysql_connect($hostname, $db_user, $db_password);
mysql_select_db($database,$db);
?>
<?php
$date = date("Y-m-d H:i:s");
$cfname = preg_replace('#[^A-Za-z0-9.,]#i', '', $_POST['cfname']);
$cfname = strip_tags($cfname);
$cfname = mysql_real_escape_string($cfname);
$cfname = stripslashes($cfname);
$clname = preg_replace('#[^A-Za-z0-9.,]#i', '', $_POST['clname']);
$clname = strip_tags($clname);
$clname = mysql_real_escape_string($clname);
$clname = stripslashes($clname);
$cname = $cfname+$clname;
$cemail = preg_replace('#[^A-Za-z0-9@.-_ ]#i', '', $_POST['cemail']);
$cemail = strip_tags($cemail);
$cemail = mysql_real_escape_string($cemail);
$cemail = stripslashes($cemail);
$cphone = preg_replace('#[^0-9]#i', '', $_POST['cphone']);
$cphone = strip_tags($cphone);
$cphone = mysql_real_escape_string($cphone);
$cphone = stripslashes($cphone);
$caddress = preg_replace('#[^A-Za-z0-9]#i', '', $_POST['caddress']);
$caddress = strip_tags($caddress);
$caddress = mysql_real_escape_string($caddress);
$caddress = stripslashes($caddress);
$caddress2 = preg_replace('#[^A-Za-z0-9]#i', '', $_POST['caddress2']);
$caddress2 = strip_tags($caddress2);
$caddress2 = mysql_real_escape_string($caddress2);
$caddress2 = stripslashes($caddress2);
$cage = preg_replace('#[^0-9]#i', '', $_POST['cage']);
$cage = strip_tags($cage);
$cage = mysql_real_escape_string($cage);
$cage = stripslashes($cage);
$cnationality = preg_replace('#[^A-Za-z,]#i', '', $_POST['cnationality']);
$cnationality = strip_tags($cnationality);
$cnationality = mysql_real_escape_string($cnationality);
$cnationality = stripslashes($cnationality);
$flightno = $_POST['flightno'];
$flightno = strip_tags($flightno);
$flightno = mysql_real_escape_string($flightno);
$resno = $flightno*2;
if (isset($_REQUEST['Submit'])) {
# THIS CODE TELL MYSQL TO INSERT THE DATA FROM THE FORM INTO YOUR MYSQL TABLE
$sql ="INSERT INTO $db_table(cust_name,cust_email,cust_phone,cust_add,cust_add2,cust_age,cust_nationality,flight_no,resno) VALUES ('$cname','$cemail','$cphone','$caddress', '$caddress', '$caddress2', '$cage', '$cnationality', '$flightno', '$resno')";
if($result = mysql_query($sql ,$db)) {
echo '<meta http-equiv="refresh" content="35,search.php" />Thank you for
reserving your e-ticket. Your reservation number is $resno. Please keep it to
confirm your reservation. You can confirm your ticket by calling this number 1-
800-NOTAREALNUMBER or you can visit our offices located in The South Pole next
to Willy Wonkas Chocolate Factory. Have a great day! <p><a
href="search.php"><small>Click here to go back</small></a></p>';
} else {
echo "ERROR: ".mysql_error();
}
} else { echo ""?>
<form onsubmit="return validateForm()" enctype="text/plain" method="post"
action="" name="cusBooking">
<table style="text-align: left; background-color: white; width: 425px; height:
143px;" border="0" cellpadding="1" cellspacing="3">
<tbody>
<tr>
<td>
<small>First name: </small><input type="text" name="cfname" />
</td>
<td>
<small>Last name: </small><input type="text" name="clname" />
</td>
</tr>
<tr>
<td>
<small>Email: </small><input type="text" name="cemail" />
</td>
<td>
<small>Phone number: </small><input type="text" name="cphone" />
</td>
</tr>
<tr>
<td>
<small>Address: </small><input type="text" name="caddress" />
</td>
<td>
<small>Address 2: </small><input type="text" name="caddress2" />
</td>
</tr>
<tr>
<td>
<small>Age: <input type="text" name="cage" />
</td>
<td>
<small>Nationality: </small><input type="text" name="cnationality" />
</td>
</tr>
<tr>
<td>
<input name="flightno" value='<?php echo "$flightno"?>' type="hidden">
</td>
<td>
<input name="Submit" type="image" tabindex="5" src="images/flight_button.png"
value="Submit Your Site" />
</td>
</tr>
</tbody>
</table>
</form>
<?php
}
?> | php | mysql | null | null | null | 03/28/2012 11:58:51 | too localized | My code won't insert into db
===
I cant really think of a reason it wouldnt...it looks fine to me (if it was fine, i wouldnt be here asking)
This happened before (see my recent posts) where I used code from a previous project (that worked fine), but when I tried using it for this particular project, it wouldnt work. I have no idea why it wont work this particular time, since it worked before
Can anyone tell me whats wrong with the query?
<?php
$hostname = "localhost";
$db_user = "#"; // change to your database password
$db_password = "#"; // change to your database password
$database = "#"; // provide your database name
$db_table = "#"; // leave this as is
# STOP HERE
####################################################################
# THIS CODE IS USED TO CONNECT TO THE MYSQL DATABASE
$db = mysql_connect($hostname, $db_user, $db_password);
mysql_select_db($database,$db);
?>
<?php
$date = date("Y-m-d H:i:s");
$cfname = preg_replace('#[^A-Za-z0-9.,]#i', '', $_POST['cfname']);
$cfname = strip_tags($cfname);
$cfname = mysql_real_escape_string($cfname);
$cfname = stripslashes($cfname);
$clname = preg_replace('#[^A-Za-z0-9.,]#i', '', $_POST['clname']);
$clname = strip_tags($clname);
$clname = mysql_real_escape_string($clname);
$clname = stripslashes($clname);
$cname = $cfname+$clname;
$cemail = preg_replace('#[^A-Za-z0-9@.-_ ]#i', '', $_POST['cemail']);
$cemail = strip_tags($cemail);
$cemail = mysql_real_escape_string($cemail);
$cemail = stripslashes($cemail);
$cphone = preg_replace('#[^0-9]#i', '', $_POST['cphone']);
$cphone = strip_tags($cphone);
$cphone = mysql_real_escape_string($cphone);
$cphone = stripslashes($cphone);
$caddress = preg_replace('#[^A-Za-z0-9]#i', '', $_POST['caddress']);
$caddress = strip_tags($caddress);
$caddress = mysql_real_escape_string($caddress);
$caddress = stripslashes($caddress);
$caddress2 = preg_replace('#[^A-Za-z0-9]#i', '', $_POST['caddress2']);
$caddress2 = strip_tags($caddress2);
$caddress2 = mysql_real_escape_string($caddress2);
$caddress2 = stripslashes($caddress2);
$cage = preg_replace('#[^0-9]#i', '', $_POST['cage']);
$cage = strip_tags($cage);
$cage = mysql_real_escape_string($cage);
$cage = stripslashes($cage);
$cnationality = preg_replace('#[^A-Za-z,]#i', '', $_POST['cnationality']);
$cnationality = strip_tags($cnationality);
$cnationality = mysql_real_escape_string($cnationality);
$cnationality = stripslashes($cnationality);
$flightno = $_POST['flightno'];
$flightno = strip_tags($flightno);
$flightno = mysql_real_escape_string($flightno);
$resno = $flightno*2;
if (isset($_REQUEST['Submit'])) {
# THIS CODE TELL MYSQL TO INSERT THE DATA FROM THE FORM INTO YOUR MYSQL TABLE
$sql ="INSERT INTO $db_table(cust_name,cust_email,cust_phone,cust_add,cust_add2,cust_age,cust_nationality,flight_no,resno) VALUES ('$cname','$cemail','$cphone','$caddress', '$caddress', '$caddress2', '$cage', '$cnationality', '$flightno', '$resno')";
if($result = mysql_query($sql ,$db)) {
echo '<meta http-equiv="refresh" content="35,search.php" />Thank you for
reserving your e-ticket. Your reservation number is $resno. Please keep it to
confirm your reservation. You can confirm your ticket by calling this number 1-
800-NOTAREALNUMBER or you can visit our offices located in The South Pole next
to Willy Wonkas Chocolate Factory. Have a great day! <p><a
href="search.php"><small>Click here to go back</small></a></p>';
} else {
echo "ERROR: ".mysql_error();
}
} else { echo ""?>
<form onsubmit="return validateForm()" enctype="text/plain" method="post"
action="" name="cusBooking">
<table style="text-align: left; background-color: white; width: 425px; height:
143px;" border="0" cellpadding="1" cellspacing="3">
<tbody>
<tr>
<td>
<small>First name: </small><input type="text" name="cfname" />
</td>
<td>
<small>Last name: </small><input type="text" name="clname" />
</td>
</tr>
<tr>
<td>
<small>Email: </small><input type="text" name="cemail" />
</td>
<td>
<small>Phone number: </small><input type="text" name="cphone" />
</td>
</tr>
<tr>
<td>
<small>Address: </small><input type="text" name="caddress" />
</td>
<td>
<small>Address 2: </small><input type="text" name="caddress2" />
</td>
</tr>
<tr>
<td>
<small>Age: <input type="text" name="cage" />
</td>
<td>
<small>Nationality: </small><input type="text" name="cnationality" />
</td>
</tr>
<tr>
<td>
<input name="flightno" value='<?php echo "$flightno"?>' type="hidden">
</td>
<td>
<input name="Submit" type="image" tabindex="5" src="images/flight_button.png"
value="Submit Your Site" />
</td>
</tr>
</tbody>
</table>
</form>
<?php
}
?> | 3 |
9,717,055 | 03/15/2012 09:33:31 | 1,056,922 | 11/20/2011 23:28:06 | 89 | 3 | Create custom AudioVideo Call Lync 2010 | I'm new at using Lync SDK. And i want to create an custom application i WPF where i have defined an screen where the video is placed, and just two buttons used to connect and disconnect. I have searched Google thin and the only thing i have found is the Microsoft Lync Client. | wpf | lync | null | null | null | null | open | Create custom AudioVideo Call Lync 2010
===
I'm new at using Lync SDK. And i want to create an custom application i WPF where i have defined an screen where the video is placed, and just two buttons used to connect and disconnect. I have searched Google thin and the only thing i have found is the Microsoft Lync Client. | 0 |
7,518,736 | 09/22/2011 17:10:25 | 247,560 | 01/10/2010 17:09:38 | 290 | 0 | Is PL SQL really required? | what all can be done in PL SQL which can also be done by embedding sql statements in an application langauage say PhP. Why do people still use PL SQL , Are there any major advantages.?
I want to avoid learning a new language and see if PHP can suffice. | php | oracle | plsql | null | null | 09/22/2011 18:36:46 | not constructive | Is PL SQL really required?
===
what all can be done in PL SQL which can also be done by embedding sql statements in an application langauage say PhP. Why do people still use PL SQL , Are there any major advantages.?
I want to avoid learning a new language and see if PHP can suffice. | 4 |
7,310,747 | 09/05/2011 16:40:22 | 923,155 | 09/01/2011 09:11:49 | 13 | 0 | How to create a button like "facebook like" | I am at a total loss with this, I need to create a "like button" like the facebook like button, I have tried to use jquery to do this but havent got anywhere. I need to basically add a row to a mysql db and then update the number of "likes" next to the button ont he page all without a refresh.
Can anyone help with this as I am totally stuck as i dont know javascript or jquery :(
Hope someone can as its been driving me nuts :)
| jquery | null | null | null | null | 09/06/2011 01:37:33 | not a real question | How to create a button like "facebook like"
===
I am at a total loss with this, I need to create a "like button" like the facebook like button, I have tried to use jquery to do this but havent got anywhere. I need to basically add a row to a mysql db and then update the number of "likes" next to the button ont he page all without a refresh.
Can anyone help with this as I am totally stuck as i dont know javascript or jquery :(
Hope someone can as its been driving me nuts :)
| 1 |
4,436,129 | 12/14/2010 05:19:20 | 541,497 | 12/14/2010 05:19:20 | 1 | 0 | in php decode to encode using md5 funcation | in php decode to encode using md5 funcation | php | null | null | null | null | 12/14/2010 05:48:56 | not a real question | in php decode to encode using md5 funcation
===
in php decode to encode using md5 funcation | 1 |
2,573,135 | 04/04/2010 00:28:33 | 253,197 | 01/18/2010 13:11:30 | 104 | 9 | Python progression path - From apprentice to guru | I've been learning, working, and playing with Python for a year and a half now. As a biologist slowly making the turn to bio-informatics, this language has been a the very core of all the major contributions I have made in the lab. (bash and R scripts have helped some too. My C++ capabilities are very not functional yet). I more or less fell in love with the way Python permits me to express beautiful solutions and also with the semantics of the language that allows such a natural flow from thoughts to workable code.
What I would like to know from you is your answer to a kind of question I have seldom seen in this or other forums. Let me sum up what I do NOT want to ask first ;)
- I don't want to know how to QUICKLY learn Python
- Nor do I want to find out the best way to get acquainted with the language
- Finally, I don't want to know a 'one trick that does it all' approach.
What I do want to know your opinion about, is:
**What are the steps YOU would recommend to a Python journeyman, from apprenticeship to guru status (feel free to stop wherever your expertise dictates it), in order that one IMPROVES CONSTANTLY, becoming a better and better Python coder, one step at a time.**
The kind of answers I would enjoy (but feel free to surprise the readership :P ), is formatted more or less like this:
- Read this (eg: python tutorial), pay attention to that kind of details
- Code for so manytime/problems/lines of code
- Then, read this (eg: this or that book), but this time, pay attention to this
- Tackle a few real-life problems
- Then, proceed to reading Y.
- Be sure to grasp these concepts
- Code for X time
- Come back to such and such basics or move further to...
- (you get the point :)
This process depicts an iterative Learn/Code cycle, and I really care about knowing your opinion on what exactly one should pay attention to, at various stages, in order to progress CONSTANTLY (with due efforts, of course). If you come from a specific field of expertise, discuss the path you see as appropriate in this field.
Thanks a lot for sharing your opinions and good Python coding! | python | progress | self-improvement | null | null | 03/02/2012 17:27:19 | not constructive | Python progression path - From apprentice to guru
===
I've been learning, working, and playing with Python for a year and a half now. As a biologist slowly making the turn to bio-informatics, this language has been a the very core of all the major contributions I have made in the lab. (bash and R scripts have helped some too. My C++ capabilities are very not functional yet). I more or less fell in love with the way Python permits me to express beautiful solutions and also with the semantics of the language that allows such a natural flow from thoughts to workable code.
What I would like to know from you is your answer to a kind of question I have seldom seen in this or other forums. Let me sum up what I do NOT want to ask first ;)
- I don't want to know how to QUICKLY learn Python
- Nor do I want to find out the best way to get acquainted with the language
- Finally, I don't want to know a 'one trick that does it all' approach.
What I do want to know your opinion about, is:
**What are the steps YOU would recommend to a Python journeyman, from apprenticeship to guru status (feel free to stop wherever your expertise dictates it), in order that one IMPROVES CONSTANTLY, becoming a better and better Python coder, one step at a time.**
The kind of answers I would enjoy (but feel free to surprise the readership :P ), is formatted more or less like this:
- Read this (eg: python tutorial), pay attention to that kind of details
- Code for so manytime/problems/lines of code
- Then, read this (eg: this or that book), but this time, pay attention to this
- Tackle a few real-life problems
- Then, proceed to reading Y.
- Be sure to grasp these concepts
- Code for X time
- Come back to such and such basics or move further to...
- (you get the point :)
This process depicts an iterative Learn/Code cycle, and I really care about knowing your opinion on what exactly one should pay attention to, at various stages, in order to progress CONSTANTLY (with due efforts, of course). If you come from a specific field of expertise, discuss the path you see as appropriate in this field.
Thanks a lot for sharing your opinions and good Python coding! | 4 |
7,656,058 | 10/05/2011 02:21:26 | 591,593 | 01/27/2011 02:49:53 | 646 | 61 | Android Basic Reading | I would like some reading recommendations to help building a strong basic understanding about Android framework. Beside Android's official developer documentation, is there any other good resource to start from? | android | tutorials | null | null | null | 10/05/2011 02:57:37 | not constructive | Android Basic Reading
===
I would like some reading recommendations to help building a strong basic understanding about Android framework. Beside Android's official developer documentation, is there any other good resource to start from? | 4 |
4,743,588 | 01/20/2011 04:58:44 | 579,911 | 01/18/2011 12:15:19 | 1 | 0 | search option for pdf file in iphone | In my ebook project am having a pdf file in iphone. It loads well. Now i want to add a search option in that. How to implement this with iphone? send me some sample codes and url's. thanks. | iphone | search | pdf | null | null | null | open | search option for pdf file in iphone
===
In my ebook project am having a pdf file in iphone. It loads well. Now i want to add a search option in that. How to implement this with iphone? send me some sample codes and url's. thanks. | 0 |
10,502,121 | 05/08/2012 15:58:13 | 1,003,189 | 10/19/2011 13:06:13 | 144 | 11 | node-postgres will not insert data, but doesn't throw errors either | I'm using the [node-postgres][1] module for node.js and I have a problem inserting data.
The function:
function addItems(listId, listItems, handle) {
if (!listItems) {
handle(listId);
return;
}
var client = dbConnector.getClient(),
important,
dateArray,
dateString,
i,
prepStatement;
client.connect();
for (i in listItems) {
console.log(listItems[i]);
dateArray = listItems[i].itemdate.split('-');
dateString = dateArray[1] + '-' + dateArray[0] + '-' + dateArray[2];
if (listItems[i].important) {
important = 'true';
} else {
important = 'false';
}
prepStatement = {
name: 'insert task',
text: 'INSERT INTO listitem (todolist_id, name, deadline, description, important, done, created) VALUES ($1, $2, $3, $4, $5, $6, now()) RETURNING listitem_id',
values: [ listId, listItems[i].itemname, dateString, listItems[i].itemdesc, important, listItems[i].done ]
};
var query = client.query(prepStatement);
console.log("Adding item " + i);
query.on('error', function(error) {
console.log(error);
});
query.on('end', function(result) {
console.log("Query ended");
if (result) {
console.log("Added listitem no " + result.rows[0].listitem_id);
}
});
}
client.end();
handle(listId);
}
No new data appears in the database. The `query.on('error')` and `query.on('end')` events are never fired. Come to think of it, I'm beginning to doubt if the query is even triggered (tho I can't see why it shouldn't).
The only log I get is:
{ itemname: 'Task 1',
itemdate: '08-05-2012',
important: 'on',
itemdesc: 'A task',
done: 'false' }
Adding item 0
{ itemname: 'Task 2',
itemdate: '22-05-2012',
important: 'on',
itemdesc: 'Another one',
done: 'false' }
Adding item 1
So how should I proceed in debugging this?
[1]: https://github.com/brianc/node-postgres | node.js | node-postgres | null | null | null | null | open | node-postgres will not insert data, but doesn't throw errors either
===
I'm using the [node-postgres][1] module for node.js and I have a problem inserting data.
The function:
function addItems(listId, listItems, handle) {
if (!listItems) {
handle(listId);
return;
}
var client = dbConnector.getClient(),
important,
dateArray,
dateString,
i,
prepStatement;
client.connect();
for (i in listItems) {
console.log(listItems[i]);
dateArray = listItems[i].itemdate.split('-');
dateString = dateArray[1] + '-' + dateArray[0] + '-' + dateArray[2];
if (listItems[i].important) {
important = 'true';
} else {
important = 'false';
}
prepStatement = {
name: 'insert task',
text: 'INSERT INTO listitem (todolist_id, name, deadline, description, important, done, created) VALUES ($1, $2, $3, $4, $5, $6, now()) RETURNING listitem_id',
values: [ listId, listItems[i].itemname, dateString, listItems[i].itemdesc, important, listItems[i].done ]
};
var query = client.query(prepStatement);
console.log("Adding item " + i);
query.on('error', function(error) {
console.log(error);
});
query.on('end', function(result) {
console.log("Query ended");
if (result) {
console.log("Added listitem no " + result.rows[0].listitem_id);
}
});
}
client.end();
handle(listId);
}
No new data appears in the database. The `query.on('error')` and `query.on('end')` events are never fired. Come to think of it, I'm beginning to doubt if the query is even triggered (tho I can't see why it shouldn't).
The only log I get is:
{ itemname: 'Task 1',
itemdate: '08-05-2012',
important: 'on',
itemdesc: 'A task',
done: 'false' }
Adding item 0
{ itemname: 'Task 2',
itemdate: '22-05-2012',
important: 'on',
itemdesc: 'Another one',
done: 'false' }
Adding item 1
So how should I proceed in debugging this?
[1]: https://github.com/brianc/node-postgres | 0 |
7,803,275 | 10/18/2011 06:29:26 | 965,064 | 09/26/2011 12:37:28 | 6 | 0 | breaking down code into smaller chuncks and reduce repetition (classes) | Hi I wonder if anyone can help me regarding designing classes and objects for this kind of project. I am creating a simple affiliate website which displays products on a page.
The data is passed to me though an XML document. Then the data is filtered and added to the database ready to populate the website.
There are 3 sets of data which is stored. Products, brands and categories.. These are my tables in the database. I also have 3 classes, products, brands and categories. These filter the data, store the data, delete.
There are also general classes that are shared between all 3 but these act more like static functions.. For example to extract a datatable I would pass values from product, brand etc. everything works all fine and dandy.
My problem is that the class structure seems very bloated with loads of methods in each product, brand and category class. What I want to do is break the classes down in to smaller chunks.
here is sample code from my product class
using System;
using System.Collections;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Web;
using System.Xml;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using NetCms.Core.Generics;
using NetCms.Core.XmlCore;
using NetCms.Core;
using NetCms.Core.ErrorHandling;
namespace ClassRespository
{
/// <summary>
/// Summary description for ProductClass
/// </summary>
public class Product
{
private static string _tableName = "ProductDetails";
private static List<string> txtToIgnore = new List<string>{"men"};
public static string queryStringId = "ProdId";
public string ProductIdentifier { get; set; }
public int ProductId { get; set; }
public string ProductName { get; set; }
public string ProductDescription { get; set; }
public string TrackLink { get; set; }
public string ProductImage { get; set; }
public string TrackPrice { get; set; }
public string MerchantId { get; set; }
public int CategoryId { get; set; }
public int BrandId { get; set; }
private List<Product> extractCategoryXmlData()
{
XmlCoreManager xmlDoc = new XmlCoreManager();
XmlDocument loadedXml = xmlDoc.LoadXml();
List<Product> ProductList = new List<Product>();
XmlNodeList productDetails = loadedXml.GetElementsByTagName("prod");
string id = "";
string pId = "";
string name = "";
string desc = "";
string trackLink = "";
string productImage = "";
string trackPrice = "";
string merchantId = "";
string categoryId = "";
for (int i = 0; i < productDetails.Count; i++)
{
id = productDetails[i].Attributes["id"].Value; // unique ID
pId = XmlCoreManager.IfNodeIsEmpty(productDetails[i].SelectSingleNode("pId")); // product ID
name = XmlCoreManager.IfNodeIsEmpty(productDetails[i].SelectSingleNode("text/name")); // product name
desc = XmlCoreManager.IfNodeIsEmpty(productDetails[i].SelectSingleNode("text/desc")); // product description
trackLink = XmlCoreManager.IfNodeIsEmpty(productDetails[i].SelectSingleNode("uri/awTrack")); // product track link
productImage = XmlCoreManager.IfNodeIsEmpty(productDetails[i].SelectSingleNode("uri/awImage")); // product image
trackPrice = XmlCoreManager.IfNodeIsEmpty(productDetails[i].SelectSingleNode("price/buynow")); // product price
merchantId = productDetails[i].ParentNode.Attributes["id"].Value;
categoryId = XmlCoreManager.IfNodeIsEmpty(productDetails[i].SelectSingleNode("cat/awCatId")); // product ID
Product categoryInstance = new Product();
categoryInstance.ProductIdentifier = id;
categoryInstance.ProductId = Convert.ToInt32(pId);
categoryInstance.ProductName = name;
categoryInstance.ProductDescription = desc;
categoryInstance.TrackLink = trackLink;
categoryInstance.ProductImage = productImage;
categoryInstance.TrackPrice = trackPrice;
categoryInstance.CategoryId= Convert.ToInt32(categoryId);
categoryInstance.MerchantId = merchantId;
categoryInstance.BrandId = Brand.UpdateProductBrand(name);
if(XmlCoreFilter.XmlValidationChecks(txtToIgnore, desc, name, categoryInstance.BrandId))
{
ProductList.Add(categoryInstance);
}
}
return ProductList;
}
private static ArrayList RemoveBlankProductImages(List<Product> _modifiedDataList)
{
string imageLink = "noimage.gif";
ArrayList modiedList = new ArrayList(_modifiedDataList);
foreach (Product removedImages in _modifiedDataList)
{
if (removedImages.ProductImage.Contains(imageLink))
{
modiedList.Remove(removedImages);
}
}
return modiedList;
}
private void insertProductDbData(IEnumerable<Product> productData)
{
netCmsConnection con = new netCmsConnection();
SqlCommand cmd = new SqlCommand {Connection = con.getDatabaseConnection()};
string strQuery = "INSERT INTO " + _tableName + " (m_id, m_productid, m_productname, m_productdescription, m_tracklink, " +
"m_productimage, m_trackprice,mm_merchantid,m_categoryid, m_brandid) VALUES (@m_id, @m_productid, @m_productname, @m_productdescription, " +
"@m_tracklink, @m_productimage, @m_trackprice, @m_productimagethumb, @m_merchantid, @m_categoryid, @m_brandid)";
cmd.CommandText = strQuery;
cmd.CommandType = CommandType.Text;
foreach (Product records in productData)
{
cmd.Parameters.Clear();
cmd.Parameters.AddWithValue("@m_id", records.ProductIdentifier);
cmd.Parameters.AddWithValue("@m_productid", records.ProductId);
cmd.Parameters.AddWithValue("@m_productname", records.ProductName);
cmd.Parameters.AddWithValue("@m_productdescription", records.ProductDescription);
cmd.Parameters.AddWithValue("@m_tracklink", records.TrackLink);
cmd.Parameters.AddWithValue("@m_productimage", records.ProductImage);
cmd.Parameters.AddWithValue("@m_trackprice", records.TrackPrice);
cmd.Parameters.AddWithValue("@m_merchantid", records.MerchantId);
cmd.Parameters.AddWithValue("@m_categoryid", records.CategoryId);
cmd.Parameters.AddWithValue("@m_brandid", Convert.ToInt32(records.BrandId));
cmd.ExecuteNonQuery();
}
con.DatabaseConnectionClose();
}
private void removeProductDbData()
{
XmlCoreManager.DbDataRemover(_tableName);
}
public static void ExecuteUpdate()
{
Product product = new Product();
// remove data from database
product.removeProductDbData();
// Extract Xml and insert in database
product.insertProductDbData(product.extractCategoryXmlData());
}
private static DataTable ExtractProductRecords()
{
int catNumber;
int brandNumber;
bool validateCat = int.TryParse(HttpContext.Current.Request.QueryString[Category.queryStringId],out catNumber);
bool validateBrand = int.TryParse(HttpContext.Current.Request.QueryString[Brand.queryStringId], out brandNumber);
if (!validateCat || !validateBrand)
{
catNumber = 0;
brandNumber = 0;
}
StringBuilder queryBuilder = new StringBuilder();
if (catNumber != 0)
{
queryBuilder.Append(String.Format(" WHERE m_categoryid = {0}", catNumber));
}
if (brandNumber != 0)
{
queryBuilder.Append(String.Format(" AND m_brandid = {0}", brandNumber));
}
string sql = String.Format("SELECT TOP 30 [m_id],[m_productname],[m_tracklink],[m_trackprice],[m_productimage] " +
" FROM [affiliateDatabase].[dbo].[ProductDetails]" + queryBuilder.ToString() +
" ORDER BY m_views");
DataTable dt = DataExtraction.DataSqlDataTable(sql);
return dt;
}
private static List<DataRow> RecordsToList()
{
DataTable dt = Product.ExtractProductRecords();
List<DataRow> list = dt.AsEnumerable().ToList();
return list;
}
public static string DisplayRecords()
{
string productFolder = ConfigurationManager.AppSettings["productFolder"];
StringBuilder sb = new StringBuilder();
List<DataRow> records = Product.RecordsToList() as List<DataRow>;
int counter = 1;
foreach (DataRow record in records)
{
string anchorLink = HttpUtility.HtmlEncode(record.ItemArray[1].ToString().Trim());
sb.Append("<div class=\"Product\">\n");
sb.Append("<div class=\"productImage\"><a href=\"/" + productFolder + "/Default.aspx?" + queryStringId + "=" + HttpUtility.HtmlEncode(record.ItemArray[0].ToString().Trim()) + "\"><img height=\"240\" width=\"240\" src=\"" + record.ItemArray[4].ToString().Trim() + "\" /></a></div>\n");
sb.Append("<div class=\"title\"><p>" + HttpUtility.HtmlEncode(record.ItemArray[1].ToString().Trim()) + "</p></div>\n");
sb.Append("<div class=\"cost\"><p>Discount price: <span>£" + HttpUtility.HtmlEncode(record.ItemArray[3].ToString().Trim()) + "</span></p></div>\n");
sb.Append("<div class=\"moreDetails\"><p><a href=\"/" + productFolder + "/Default.aspx?" + queryStringId + "=" + HttpUtility.HtmlEncode(record.ItemArray[0].ToString().Trim()) + "\">View Details</a></p></div>\n");
sb.Append("<div class=\"purchaseButton\"><p><a href=\"/" + record.ItemArray[2].ToString().Trim() + "\">Purchase</a></p></div>\n");
sb.Append("</div>\n");
if (counter == 4)
{
sb.Append("<div class=\"clearboth\"><!-- x --></div>\n");
counter = 0;
}
counter++;
}
return sb.ToString();
}
public static Product IndividualRecordResult(int id)
{
int productId = Convert.ToInt32(id);
StringBuilder query = new StringBuilder();
netCmsConnection con = new netCmsConnection();
Product productList = new Product();
query.Append("SELECT m_productname, m_productdescription, m_tracklink, m_trackprice, m_productimage, m_categoryid ");
query.Append("FROM ProductDetails WHERE m_id = @productId");
Product.updateViewData(productId);
try
{
netCmsConnection.openConnection();
SqlCommand comm = new SqlCommand(query.ToString(), con.ObjConnection);
comm.Parameters.AddWithValue("@productId", productId);
SqlDataReader reader = comm.ExecuteReader();
while (reader.Read())
{
productList.ProductName = reader["m_productname"].ToString();
productList.ProductDescription = reader["m_productdescription"].ToString();
productList.ProductId = Convert.ToInt32(reader["m_categoryid"]);
productList.TrackPrice = reader["m_trackprice"].ToString();
productList.TrackLink = reader["m_tracklink"].ToString();
productList.ProductImage = reader["m_productimage"].ToString();
}
reader.Close();
reader.Dispose();
}
catch (Exception ex)
{
ExceptionCatcher.ErrorHandler(ex);
}
finally
{
con.DatabaseConnectionClose();
}
return productList;
}
private static void updateViewData(int id)
{
int productId = Convert.ToInt32(id);
StringBuilder query = new StringBuilder();
List<Product> individualProduct = new List<Product>();
netCmsConnection con = new netCmsConnection();
query.Append("UPDATE ProductDetails SET m_views = m_views + 1 WHERE m_id = @productId");
try
{
netCmsConnection.openConnection();
SqlCommand comm = new SqlCommand(query.ToString(), con.ObjConnection);
comm.Parameters.AddWithValue("@productId", productId);
comm.ExecuteNonQuery();
comm.Dispose();
}
catch (Exception ex)
{
ExceptionCatcher.ErrorHandler(ex);
}
finally
{
con.DatabaseConnectionClose();
}
}
}
}
Can anyone recommend a better way of executing this?
| c# | asp.net | oop | class | null | 10/18/2011 11:02:41 | off topic | breaking down code into smaller chuncks and reduce repetition (classes)
===
Hi I wonder if anyone can help me regarding designing classes and objects for this kind of project. I am creating a simple affiliate website which displays products on a page.
The data is passed to me though an XML document. Then the data is filtered and added to the database ready to populate the website.
There are 3 sets of data which is stored. Products, brands and categories.. These are my tables in the database. I also have 3 classes, products, brands and categories. These filter the data, store the data, delete.
There are also general classes that are shared between all 3 but these act more like static functions.. For example to extract a datatable I would pass values from product, brand etc. everything works all fine and dandy.
My problem is that the class structure seems very bloated with loads of methods in each product, brand and category class. What I want to do is break the classes down in to smaller chunks.
here is sample code from my product class
using System;
using System.Collections;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Web;
using System.Xml;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using NetCms.Core.Generics;
using NetCms.Core.XmlCore;
using NetCms.Core;
using NetCms.Core.ErrorHandling;
namespace ClassRespository
{
/// <summary>
/// Summary description for ProductClass
/// </summary>
public class Product
{
private static string _tableName = "ProductDetails";
private static List<string> txtToIgnore = new List<string>{"men"};
public static string queryStringId = "ProdId";
public string ProductIdentifier { get; set; }
public int ProductId { get; set; }
public string ProductName { get; set; }
public string ProductDescription { get; set; }
public string TrackLink { get; set; }
public string ProductImage { get; set; }
public string TrackPrice { get; set; }
public string MerchantId { get; set; }
public int CategoryId { get; set; }
public int BrandId { get; set; }
private List<Product> extractCategoryXmlData()
{
XmlCoreManager xmlDoc = new XmlCoreManager();
XmlDocument loadedXml = xmlDoc.LoadXml();
List<Product> ProductList = new List<Product>();
XmlNodeList productDetails = loadedXml.GetElementsByTagName("prod");
string id = "";
string pId = "";
string name = "";
string desc = "";
string trackLink = "";
string productImage = "";
string trackPrice = "";
string merchantId = "";
string categoryId = "";
for (int i = 0; i < productDetails.Count; i++)
{
id = productDetails[i].Attributes["id"].Value; // unique ID
pId = XmlCoreManager.IfNodeIsEmpty(productDetails[i].SelectSingleNode("pId")); // product ID
name = XmlCoreManager.IfNodeIsEmpty(productDetails[i].SelectSingleNode("text/name")); // product name
desc = XmlCoreManager.IfNodeIsEmpty(productDetails[i].SelectSingleNode("text/desc")); // product description
trackLink = XmlCoreManager.IfNodeIsEmpty(productDetails[i].SelectSingleNode("uri/awTrack")); // product track link
productImage = XmlCoreManager.IfNodeIsEmpty(productDetails[i].SelectSingleNode("uri/awImage")); // product image
trackPrice = XmlCoreManager.IfNodeIsEmpty(productDetails[i].SelectSingleNode("price/buynow")); // product price
merchantId = productDetails[i].ParentNode.Attributes["id"].Value;
categoryId = XmlCoreManager.IfNodeIsEmpty(productDetails[i].SelectSingleNode("cat/awCatId")); // product ID
Product categoryInstance = new Product();
categoryInstance.ProductIdentifier = id;
categoryInstance.ProductId = Convert.ToInt32(pId);
categoryInstance.ProductName = name;
categoryInstance.ProductDescription = desc;
categoryInstance.TrackLink = trackLink;
categoryInstance.ProductImage = productImage;
categoryInstance.TrackPrice = trackPrice;
categoryInstance.CategoryId= Convert.ToInt32(categoryId);
categoryInstance.MerchantId = merchantId;
categoryInstance.BrandId = Brand.UpdateProductBrand(name);
if(XmlCoreFilter.XmlValidationChecks(txtToIgnore, desc, name, categoryInstance.BrandId))
{
ProductList.Add(categoryInstance);
}
}
return ProductList;
}
private static ArrayList RemoveBlankProductImages(List<Product> _modifiedDataList)
{
string imageLink = "noimage.gif";
ArrayList modiedList = new ArrayList(_modifiedDataList);
foreach (Product removedImages in _modifiedDataList)
{
if (removedImages.ProductImage.Contains(imageLink))
{
modiedList.Remove(removedImages);
}
}
return modiedList;
}
private void insertProductDbData(IEnumerable<Product> productData)
{
netCmsConnection con = new netCmsConnection();
SqlCommand cmd = new SqlCommand {Connection = con.getDatabaseConnection()};
string strQuery = "INSERT INTO " + _tableName + " (m_id, m_productid, m_productname, m_productdescription, m_tracklink, " +
"m_productimage, m_trackprice,mm_merchantid,m_categoryid, m_brandid) VALUES (@m_id, @m_productid, @m_productname, @m_productdescription, " +
"@m_tracklink, @m_productimage, @m_trackprice, @m_productimagethumb, @m_merchantid, @m_categoryid, @m_brandid)";
cmd.CommandText = strQuery;
cmd.CommandType = CommandType.Text;
foreach (Product records in productData)
{
cmd.Parameters.Clear();
cmd.Parameters.AddWithValue("@m_id", records.ProductIdentifier);
cmd.Parameters.AddWithValue("@m_productid", records.ProductId);
cmd.Parameters.AddWithValue("@m_productname", records.ProductName);
cmd.Parameters.AddWithValue("@m_productdescription", records.ProductDescription);
cmd.Parameters.AddWithValue("@m_tracklink", records.TrackLink);
cmd.Parameters.AddWithValue("@m_productimage", records.ProductImage);
cmd.Parameters.AddWithValue("@m_trackprice", records.TrackPrice);
cmd.Parameters.AddWithValue("@m_merchantid", records.MerchantId);
cmd.Parameters.AddWithValue("@m_categoryid", records.CategoryId);
cmd.Parameters.AddWithValue("@m_brandid", Convert.ToInt32(records.BrandId));
cmd.ExecuteNonQuery();
}
con.DatabaseConnectionClose();
}
private void removeProductDbData()
{
XmlCoreManager.DbDataRemover(_tableName);
}
public static void ExecuteUpdate()
{
Product product = new Product();
// remove data from database
product.removeProductDbData();
// Extract Xml and insert in database
product.insertProductDbData(product.extractCategoryXmlData());
}
private static DataTable ExtractProductRecords()
{
int catNumber;
int brandNumber;
bool validateCat = int.TryParse(HttpContext.Current.Request.QueryString[Category.queryStringId],out catNumber);
bool validateBrand = int.TryParse(HttpContext.Current.Request.QueryString[Brand.queryStringId], out brandNumber);
if (!validateCat || !validateBrand)
{
catNumber = 0;
brandNumber = 0;
}
StringBuilder queryBuilder = new StringBuilder();
if (catNumber != 0)
{
queryBuilder.Append(String.Format(" WHERE m_categoryid = {0}", catNumber));
}
if (brandNumber != 0)
{
queryBuilder.Append(String.Format(" AND m_brandid = {0}", brandNumber));
}
string sql = String.Format("SELECT TOP 30 [m_id],[m_productname],[m_tracklink],[m_trackprice],[m_productimage] " +
" FROM [affiliateDatabase].[dbo].[ProductDetails]" + queryBuilder.ToString() +
" ORDER BY m_views");
DataTable dt = DataExtraction.DataSqlDataTable(sql);
return dt;
}
private static List<DataRow> RecordsToList()
{
DataTable dt = Product.ExtractProductRecords();
List<DataRow> list = dt.AsEnumerable().ToList();
return list;
}
public static string DisplayRecords()
{
string productFolder = ConfigurationManager.AppSettings["productFolder"];
StringBuilder sb = new StringBuilder();
List<DataRow> records = Product.RecordsToList() as List<DataRow>;
int counter = 1;
foreach (DataRow record in records)
{
string anchorLink = HttpUtility.HtmlEncode(record.ItemArray[1].ToString().Trim());
sb.Append("<div class=\"Product\">\n");
sb.Append("<div class=\"productImage\"><a href=\"/" + productFolder + "/Default.aspx?" + queryStringId + "=" + HttpUtility.HtmlEncode(record.ItemArray[0].ToString().Trim()) + "\"><img height=\"240\" width=\"240\" src=\"" + record.ItemArray[4].ToString().Trim() + "\" /></a></div>\n");
sb.Append("<div class=\"title\"><p>" + HttpUtility.HtmlEncode(record.ItemArray[1].ToString().Trim()) + "</p></div>\n");
sb.Append("<div class=\"cost\"><p>Discount price: <span>£" + HttpUtility.HtmlEncode(record.ItemArray[3].ToString().Trim()) + "</span></p></div>\n");
sb.Append("<div class=\"moreDetails\"><p><a href=\"/" + productFolder + "/Default.aspx?" + queryStringId + "=" + HttpUtility.HtmlEncode(record.ItemArray[0].ToString().Trim()) + "\">View Details</a></p></div>\n");
sb.Append("<div class=\"purchaseButton\"><p><a href=\"/" + record.ItemArray[2].ToString().Trim() + "\">Purchase</a></p></div>\n");
sb.Append("</div>\n");
if (counter == 4)
{
sb.Append("<div class=\"clearboth\"><!-- x --></div>\n");
counter = 0;
}
counter++;
}
return sb.ToString();
}
public static Product IndividualRecordResult(int id)
{
int productId = Convert.ToInt32(id);
StringBuilder query = new StringBuilder();
netCmsConnection con = new netCmsConnection();
Product productList = new Product();
query.Append("SELECT m_productname, m_productdescription, m_tracklink, m_trackprice, m_productimage, m_categoryid ");
query.Append("FROM ProductDetails WHERE m_id = @productId");
Product.updateViewData(productId);
try
{
netCmsConnection.openConnection();
SqlCommand comm = new SqlCommand(query.ToString(), con.ObjConnection);
comm.Parameters.AddWithValue("@productId", productId);
SqlDataReader reader = comm.ExecuteReader();
while (reader.Read())
{
productList.ProductName = reader["m_productname"].ToString();
productList.ProductDescription = reader["m_productdescription"].ToString();
productList.ProductId = Convert.ToInt32(reader["m_categoryid"]);
productList.TrackPrice = reader["m_trackprice"].ToString();
productList.TrackLink = reader["m_tracklink"].ToString();
productList.ProductImage = reader["m_productimage"].ToString();
}
reader.Close();
reader.Dispose();
}
catch (Exception ex)
{
ExceptionCatcher.ErrorHandler(ex);
}
finally
{
con.DatabaseConnectionClose();
}
return productList;
}
private static void updateViewData(int id)
{
int productId = Convert.ToInt32(id);
StringBuilder query = new StringBuilder();
List<Product> individualProduct = new List<Product>();
netCmsConnection con = new netCmsConnection();
query.Append("UPDATE ProductDetails SET m_views = m_views + 1 WHERE m_id = @productId");
try
{
netCmsConnection.openConnection();
SqlCommand comm = new SqlCommand(query.ToString(), con.ObjConnection);
comm.Parameters.AddWithValue("@productId", productId);
comm.ExecuteNonQuery();
comm.Dispose();
}
catch (Exception ex)
{
ExceptionCatcher.ErrorHandler(ex);
}
finally
{
con.DatabaseConnectionClose();
}
}
}
}
Can anyone recommend a better way of executing this?
| 2 |
4,573,424 | 01/01/2011 07:06:13 | 480,322 | 10/19/2010 09:58:36 | 32 | 0 | nhibernate3 weaknesses | from the moment we've migrated to nhibernate3 ,around 30% percent of queries can not execute anymore,while there were not any problem with the previous version. does anybody have such problems? | nhibernate | null | null | null | null | 01/02/2011 01:37:45 | not a real question | nhibernate3 weaknesses
===
from the moment we've migrated to nhibernate3 ,around 30% percent of queries can not execute anymore,while there were not any problem with the previous version. does anybody have such problems? | 1 |
5,115,515 | 02/25/2011 09:21:35 | 629,860 | 02/23/2011 09:10:55 | 15 | 0 | Oracle certification | Hii,I want to do Oracle certification 1Z0-051 oracle 11g,can anybody help me how can i prepare and where can i get the dumps?,plzzzzzzzz if anybody having the dumpa plzz share to me,
Thanks a lot in advance | oracle | certification | null | null | null | 02/25/2011 10:11:24 | off topic | Oracle certification
===
Hii,I want to do Oracle certification 1Z0-051 oracle 11g,can anybody help me how can i prepare and where can i get the dumps?,plzzzzzzzz if anybody having the dumpa plzz share to me,
Thanks a lot in advance | 2 |
8,364,017 | 12/02/2011 23:32:34 | 225,850 | 12/06/2009 16:44:46 | 132 | 14 | How to handle rails 3 model relationships at view and controller level? | I have a project going on right now that is really big data model wise. I am trying to figure out the best way to handle inter-model relationships.
For the sake of brevity:
Car
has_many :passengers
has_many :items
or
Team
has_one :head_coach
has_many :coaches
has_many :players
belongs_to :owner
So from the show page I would see who is in the car and what items are in the car. I have some co-workers who think we should have a controller action called `manage` where they would click a link on the show page to manage the relationship between the other models
So the `Team` controller would have this
class TeamController < ApplicationController
# ... magic ...
def manage_players
@signed_players = Player.signed_players
@free_agents = Player.free_agents
end
end
The `manage_players` view would just have links to the actual RESTful actions on the appropriate controller to remove relationships etc...
Anyone have thoughts on how this should be accomplished? | ruby-on-rails | ruby-on-rails-3 | user-interface | null | null | null | open | How to handle rails 3 model relationships at view and controller level?
===
I have a project going on right now that is really big data model wise. I am trying to figure out the best way to handle inter-model relationships.
For the sake of brevity:
Car
has_many :passengers
has_many :items
or
Team
has_one :head_coach
has_many :coaches
has_many :players
belongs_to :owner
So from the show page I would see who is in the car and what items are in the car. I have some co-workers who think we should have a controller action called `manage` where they would click a link on the show page to manage the relationship between the other models
So the `Team` controller would have this
class TeamController < ApplicationController
# ... magic ...
def manage_players
@signed_players = Player.signed_players
@free_agents = Player.free_agents
end
end
The `manage_players` view would just have links to the actual RESTful actions on the appropriate controller to remove relationships etc...
Anyone have thoughts on how this should be accomplished? | 0 |
2,278,982 | 02/17/2010 07:29:25 | 244,470 | 01/06/2010 05:24:43 | 5 | 0 | Error in downloading and saving image using python | I written a code for downloading and saving images from a site .It worked nicely,but for some urls it is being showing an error.I have paste code below
import urllib2
import webbrowser
imageurl='http://www.example.com/'+image[s]
opener1 = urllib2.build_opener()
page1=opener1.open(imageurl)
my_picture=page1.read()
image1=image[s].replace("/","")
fout = open('images/tony/'+image1, "wb")
fout.write(my_picture)
fout.close()
Actually i get many values of image[s] and is working almost condition.But when the value of image[s]=images/PG013001 GROUP 2.jpg, the compiler gives an error
File "leather.py", line 37, in get_leather
page1=opener1.open(imageurl)
File "D:\Program Files\Python\lib\urllib2.py", line 395, in open
response = meth(req, response)
File "D:\Program Files\Python\lib\urllib2.py", line 508, in http_response
'http', request, response, code, msg, hdrs)
File "D:\Program Files\Python\lib\urllib2.py", line 433, in error
return self._call_chain(*args)
File "D:\Program Files\Python\lib\urllib2.py", line 367, in _call_chain
result = func(*args)
File "D:\Program Files\Python\lib\urllib2.py", line 516, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 404: Not Found
I thought the corresponding imageurl ie 'http://www.example.com/images/PG013001 GROUP 2.jpg' doesn,t exist but when it is checked it exist.Please suggest a fix
regards
| python | null | null | null | null | null | open | Error in downloading and saving image using python
===
I written a code for downloading and saving images from a site .It worked nicely,but for some urls it is being showing an error.I have paste code below
import urllib2
import webbrowser
imageurl='http://www.example.com/'+image[s]
opener1 = urllib2.build_opener()
page1=opener1.open(imageurl)
my_picture=page1.read()
image1=image[s].replace("/","")
fout = open('images/tony/'+image1, "wb")
fout.write(my_picture)
fout.close()
Actually i get many values of image[s] and is working almost condition.But when the value of image[s]=images/PG013001 GROUP 2.jpg, the compiler gives an error
File "leather.py", line 37, in get_leather
page1=opener1.open(imageurl)
File "D:\Program Files\Python\lib\urllib2.py", line 395, in open
response = meth(req, response)
File "D:\Program Files\Python\lib\urllib2.py", line 508, in http_response
'http', request, response, code, msg, hdrs)
File "D:\Program Files\Python\lib\urllib2.py", line 433, in error
return self._call_chain(*args)
File "D:\Program Files\Python\lib\urllib2.py", line 367, in _call_chain
result = func(*args)
File "D:\Program Files\Python\lib\urllib2.py", line 516, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 404: Not Found
I thought the corresponding imageurl ie 'http://www.example.com/images/PG013001 GROUP 2.jpg' doesn,t exist but when it is checked it exist.Please suggest a fix
regards
| 0 |
11,376,374 | 07/07/2012 15:44:00 | 1,048,226 | 11/15/2011 18:38:44 | 58 | 0 | iPhone .ipa and file extraction | I am writing an app for the iphone platform. My code is mostly C++ with some Objective-C code to interface with ios sdk apis. I am not very versed on iphone programming and this is my first app, so problem is that i need to read a binary file, using C++ code, containing some data but i don't kown how to do it. My concern is: can i use directly fopen/fread? Which path should i use? I come from Android development. The .apk is a simple .zip archive, so one just need to extract in memory the needed file and process it, or extract the file in a temporary directory and read it in the usual way, but i do not know how to to the same in the case of an iPhone application. Thanks. | iphone | ipa | null | null | null | null | open | iPhone .ipa and file extraction
===
I am writing an app for the iphone platform. My code is mostly C++ with some Objective-C code to interface with ios sdk apis. I am not very versed on iphone programming and this is my first app, so problem is that i need to read a binary file, using C++ code, containing some data but i don't kown how to do it. My concern is: can i use directly fopen/fread? Which path should i use? I come from Android development. The .apk is a simple .zip archive, so one just need to extract in memory the needed file and process it, or extract the file in a temporary directory and read it in the usual way, but i do not know how to to the same in the case of an iPhone application. Thanks. | 0 |
214,615 | 10/18/2008 05:14:45 | 16,340 | 09/17/2008 16:21:05 | 184 | 20 | Will Google Andriod ever support .NET? | Now that the G1 with Google's Android OS is now available (soon), will the android platform ever support .Net? | google-android | google | .net | mobile | android | 06/25/2012 15:40:01 | not constructive | Will Google Andriod ever support .NET?
===
Now that the G1 with Google's Android OS is now available (soon), will the android platform ever support .Net? | 4 |
9,852,228 | 03/24/2012 13:43:39 | 865,900 | 07/27/2011 16:38:25 | 1 | 0 | Which framework for a web portal accessing a couchDB? | I'll soon have to develop a web portal accessing a couchDB. Of course, I have done some research already, however I'm not sure if my ideas will work out.
I will have an existent couchDB. There will probably only be one user available which gets read-access via the GET-method. The web portal will have to filter and display data for different users from that couchDB, so I'll need some kind of extra user-management.
So far I have only basic knowledge about web frameworks and technologies, however I am quite experienced in Java. So from my research so far, I was seriously thinking about using Grails, ExtJS or both. However, will I be able to easily access the couchDB from within those frameworks? I've found some concerning info about necessary patches for ExtJS that are not in active development anymore.
I did have a very brief look at couchApps, however I'm not sure if those are sufficient enough (especially because of the user-management layer, I will only have this one couchDB user for accessing the DB). Also I found Django, however I'm not at all familiar with Python yet. :/
I'd be very thankful if someone could help me out a little in finding a suitable framework.
Thanks so far! | grails | extjs | couchdb | web-frameworks | couchapp | 03/27/2012 15:50:30 | not constructive | Which framework for a web portal accessing a couchDB?
===
I'll soon have to develop a web portal accessing a couchDB. Of course, I have done some research already, however I'm not sure if my ideas will work out.
I will have an existent couchDB. There will probably only be one user available which gets read-access via the GET-method. The web portal will have to filter and display data for different users from that couchDB, so I'll need some kind of extra user-management.
So far I have only basic knowledge about web frameworks and technologies, however I am quite experienced in Java. So from my research so far, I was seriously thinking about using Grails, ExtJS or both. However, will I be able to easily access the couchDB from within those frameworks? I've found some concerning info about necessary patches for ExtJS that are not in active development anymore.
I did have a very brief look at couchApps, however I'm not sure if those are sufficient enough (especially because of the user-management layer, I will only have this one couchDB user for accessing the DB). Also I found Django, however I'm not at all familiar with Python yet. :/
I'd be very thankful if someone could help me out a little in finding a suitable framework.
Thanks so far! | 4 |
10,854,419 | 06/01/2012 16:54:38 | 1,313,547 | 04/04/2012 18:18:48 | 180 | 11 | Using authlogic with iPhone client using ASIHTTPRequest | I am currently working on an iPhone front end for a rails service that uses vanilla authlogic for authentication. I am completely stuck on how to login to authlogic from the iPhone using ASIHTTPRequest or possibly NSURLConnection. How do I get the current user once I am already logged in? I have found many similar questions here on Stack Overflow but none of them provided good, in depth answers. Any help is greatly appreciated! | iphone | ruby-on-rails | ios | asihttprequest | authlogic | null | open | Using authlogic with iPhone client using ASIHTTPRequest
===
I am currently working on an iPhone front end for a rails service that uses vanilla authlogic for authentication. I am completely stuck on how to login to authlogic from the iPhone using ASIHTTPRequest or possibly NSURLConnection. How do I get the current user once I am already logged in? I have found many similar questions here on Stack Overflow but none of them provided good, in depth answers. Any help is greatly appreciated! | 0 |
7,102,986 | 08/18/2011 05:52:54 | 846,503 | 07/15/2011 13:13:15 | 35 | 7 | How can I parse HTML File Elements? | Please Suggest Me How Can i Parse HTML Elements with <b> Bold <i> Italic Text.
My Html file is like below.
{
<html><body> #FONTSTART#
<p><rob:Tagname1>
<b>Some Text Some Text</b><br />
<i>Some Text Some Text</i><br />
Some Text Some Text
</rob:familypagenames></p>
<p><rob:Tagname2> Some Text.
<b>Sexes
</b>
M >
F . <i>Some Text Some Text</i>
<b>M.
</b>
<i> MSome Text Some Text
</i>
</rob:fieldguide2></p>
<p></p>
#FONTEND# <hr> </body></html>
} | iphone-sdk-4.0 | null | null | null | null | 08/18/2011 10:37:16 | not a real question | How can I parse HTML File Elements?
===
Please Suggest Me How Can i Parse HTML Elements with <b> Bold <i> Italic Text.
My Html file is like below.
{
<html><body> #FONTSTART#
<p><rob:Tagname1>
<b>Some Text Some Text</b><br />
<i>Some Text Some Text</i><br />
Some Text Some Text
</rob:familypagenames></p>
<p><rob:Tagname2> Some Text.
<b>Sexes
</b>
M >
F . <i>Some Text Some Text</i>
<b>M.
</b>
<i> MSome Text Some Text
</i>
</rob:fieldguide2></p>
<p></p>
#FONTEND# <hr> </body></html>
} | 1 |
10,069,387 | 04/09/2012 05:41:29 | 1,321,238 | 04/09/2012 05:30:42 | 1 | 0 | How To display HTML Content in MVC 3 using Extenson Methods | **How To display HTML Content in MVC 3 using Extenson Methods**
**.cs(HTML Helper)**
public static IHtmlString GetContentDetails(this HtmlHelper html,Int32 Id)
{
dbGymEntities _reposotory = new dbGymEntities();
var details = _reposotory.tbl_StaticPages.SingleOrDefault(p=>p.StaticPageID == Id);
var output = new System.Text.StringBuilder();
output.Append(details.StaticPageContent);
return html.Raw(output.ToString());
}
**View(.csHtml Page)**
@Html.GetContentDetails(13)
****Tell me where I am wrong...Its simply display Html text.****
<div id="footer_wraper">
<ul>
<li><a href="/home/">Home</a></li>
<li><a href="#>View profile</a></li>
</ul>
<div class="clear">
</div>
</div>
| asp.net-mvc-3 | null | null | null | null | 04/16/2012 15:46:26 | not a real question | How To display HTML Content in MVC 3 using Extenson Methods
===
**How To display HTML Content in MVC 3 using Extenson Methods**
**.cs(HTML Helper)**
public static IHtmlString GetContentDetails(this HtmlHelper html,Int32 Id)
{
dbGymEntities _reposotory = new dbGymEntities();
var details = _reposotory.tbl_StaticPages.SingleOrDefault(p=>p.StaticPageID == Id);
var output = new System.Text.StringBuilder();
output.Append(details.StaticPageContent);
return html.Raw(output.ToString());
}
**View(.csHtml Page)**
@Html.GetContentDetails(13)
****Tell me where I am wrong...Its simply display Html text.****
<div id="footer_wraper">
<ul>
<li><a href="/home/">Home</a></li>
<li><a href="#>View profile</a></li>
</ul>
<div class="clear">
</div>
</div>
| 1 |
4,796,146 | 01/25/2011 16:30:52 | 312,390 | 04/08/2010 23:53:10 | 411 | 8 | Best Language to Scrape a Webpage? | I have excellent knowledge of PHP, excellent knowledge of Javascript, moderate knowledge of Java.
Basically, I was to go to a website, auto-enter a form input with a date range, click the search button, then return the information listed in the results.
What language above would give me the best/most features for manipulating and navigating pages -- and are there any classes you recommend me getting to assist in this? Thanks! | java | php | javascript | null | null | 01/27/2011 11:45:07 | not constructive | Best Language to Scrape a Webpage?
===
I have excellent knowledge of PHP, excellent knowledge of Javascript, moderate knowledge of Java.
Basically, I was to go to a website, auto-enter a form input with a date range, click the search button, then return the information listed in the results.
What language above would give me the best/most features for manipulating and navigating pages -- and are there any classes you recommend me getting to assist in this? Thanks! | 4 |
5,356,058 | 03/18/2011 18:05:26 | 148,814 | 08/01/2009 01:19:28 | 1,193 | 10 | Which Programming Language or tool should I Use for this project? | I have to work on a project which
* runs on a single system ie., single User
* User Will record entries and get reports based on date
* Deployment overhead should be less.
Since i am a web developer, it will be better if you suggest me a web based frameworks like PHP, Python with Django...that suits the above needs.
If the web based idea looks silly please forgive me. Awaiting your responses. | software-engineering | analysis | null | null | null | 03/18/2011 18:14:57 | not constructive | Which Programming Language or tool should I Use for this project?
===
I have to work on a project which
* runs on a single system ie., single User
* User Will record entries and get reports based on date
* Deployment overhead should be less.
Since i am a web developer, it will be better if you suggest me a web based frameworks like PHP, Python with Django...that suits the above needs.
If the web based idea looks silly please forgive me. Awaiting your responses. | 4 |
9,834,452 | 03/23/2012 05:13:11 | 215,847 | 11/20/2009 22:15:40 | 610 | 44 | how do I make a single legend for many subplots with matplotlib? | I am plotting the same type of information, but for different countries, with multiple subplots with matplotlib. That is, I have 9 plots on a 3x3 grid, all with the same for lines (of course, different values per line).
However, I have not figured out how to put a single legend (since all 9 subplots have the same lines) on the figure just once.
How do I do that? | python | matplotlib | null | null | null | null | open | how do I make a single legend for many subplots with matplotlib?
===
I am plotting the same type of information, but for different countries, with multiple subplots with matplotlib. That is, I have 9 plots on a 3x3 grid, all with the same for lines (of course, different values per line).
However, I have not figured out how to put a single legend (since all 9 subplots have the same lines) on the figure just once.
How do I do that? | 0 |
9,372,542 | 02/21/2012 05:15:47 | 1,020,664 | 10/30/2011 12:46:45 | 16 | 0 | Troubleshooting import of XBRL taxanomy in Microsoft Dynamics Ax 4.0 | I'm an computer science engineering student on internship at a firm that has implemented Microsoft Dynamics AX 4.0. They have appointed me a task to configure XBRL reporting in this ERP.I have tried to import the XBRL taxanomy through the import method but it keeps generating errors. If anyone has generated reports with XBRL tagging in Microsoft Dynamics AX 4.0 please help me out as i have tried all the methods on internet and couldn't find any solution.Thanks in advance to anyone who is kind enough to give their time and help me out. | dynamics | erp | ax | xbrl | null | 02/27/2012 16:57:05 | off topic | Troubleshooting import of XBRL taxanomy in Microsoft Dynamics Ax 4.0
===
I'm an computer science engineering student on internship at a firm that has implemented Microsoft Dynamics AX 4.0. They have appointed me a task to configure XBRL reporting in this ERP.I have tried to import the XBRL taxanomy through the import method but it keeps generating errors. If anyone has generated reports with XBRL tagging in Microsoft Dynamics AX 4.0 please help me out as i have tried all the methods on internet and couldn't find any solution.Thanks in advance to anyone who is kind enough to give their time and help me out. | 2 |
531,570 | 02/10/2009 09:07:29 | 20,400 | 09/22/2008 12:12:36 | 2,881 | 123 | Developer podcasts? | What Developer pod casts do you listen to?
I used to listen to Dot Net Rocks and remember looking for a good Java one a while ago, but as my workload intensified I didn't have the time to listen anymore and I never found a good Java one.
When do you listen to them? During work? While commuting? or in your own time?
(Obviously there is the SO podcast, I've only listened to one episode of it though) | podcast | null | null | null | null | 09/18/2011 02:55:41 | not constructive | Developer podcasts?
===
What Developer pod casts do you listen to?
I used to listen to Dot Net Rocks and remember looking for a good Java one a while ago, but as my workload intensified I didn't have the time to listen anymore and I never found a good Java one.
When do you listen to them? During work? While commuting? or in your own time?
(Obviously there is the SO podcast, I've only listened to one episode of it though) | 4 |
8,116,728 | 11/14/2011 02:43:33 | 303,477 | 03/28/2010 07:19:01 | 1,059 | 19 | Disabling tab space highlight in vim | I am setting up my new mac book for development. In vim (mac vim), with jellybeans color scheme, all the tab spaces are highlighted. This is annoying as left side of most of the instructions/line is in grey. I read about "TabLineFill", but not sure how to use it. Is there a better way?
Thanks,
bsr | vim | macvim | null | null | null | null | open | Disabling tab space highlight in vim
===
I am setting up my new mac book for development. In vim (mac vim), with jellybeans color scheme, all the tab spaces are highlighted. This is annoying as left side of most of the instructions/line is in grey. I read about "TabLineFill", but not sure how to use it. Is there a better way?
Thanks,
bsr | 0 |
5,702,941 | 04/18/2011 12:33:57 | 709,253 | 04/15/2011 06:17:36 | 1 | 0 | web application developed in 32bit machine | if a web application developed in 32bit machine then deployed in server machine which is 64 bit machine...will this make application slower in any chance. | asp.net | web-applications | null | null | null | 04/18/2011 12:47:09 | not a real question | web application developed in 32bit machine
===
if a web application developed in 32bit machine then deployed in server machine which is 64 bit machine...will this make application slower in any chance. | 1 |
11,607,518 | 07/23/2012 06:36:47 | 1,545,060 | 07/23/2012 06:10:58 | 1 | 0 | datepicker not working with autocomplete symfony | I am working with a form in symfony in which i need to use both the autocomplete and the datepicker functionalities. For autocomplete I am using sfExtraWidgetFormInputAutocomplete and for datepicker I am using sfWidgetFormDateJQueryUI in my form configure() method. In my form first widget using autocompelte is rendered and then the datepicker widget. I have read that there is some compatibility issue with these two.
Please tell me how to make them both work in single form. | symfony | autocomplete | datepicker | null | null | null | open | datepicker not working with autocomplete symfony
===
I am working with a form in symfony in which i need to use both the autocomplete and the datepicker functionalities. For autocomplete I am using sfExtraWidgetFormInputAutocomplete and for datepicker I am using sfWidgetFormDateJQueryUI in my form configure() method. In my form first widget using autocompelte is rendered and then the datepicker widget. I have read that there is some compatibility issue with these two.
Please tell me how to make them both work in single form. | 0 |
5,317,003 | 03/15/2011 19:36:49 | 564,979 | 01/06/2011 05:11:14 | 113 | 3 | php - compare two variables | i have this code
<?php
ob_start();
header("Content-Type: text/html; charset=ISO-8859-1");
$campo = $_GET['campo'];
$valor = $_GET['valor'];
$hello;
// Verificando o campo login
// Verificando o campo email
if ($campo == "myPassword") {
if (!preg_match("/^\S{4,12}$/", $valor)) {
echo "Tamanho entre 4 e 12 letras e sem espaços";
}
else
$hello = $valor; //problem here
echo $hello;
}
if ($campo == "passwordMatch") {
if ($hello != $valor ) {
echo "Passwords don't match";
}
}
?>
so, i need store a variable (where i put "problem here") and compare below, but this code didn't work and i don't know why
thanks | php | string | compare | null | null | null | open | php - compare two variables
===
i have this code
<?php
ob_start();
header("Content-Type: text/html; charset=ISO-8859-1");
$campo = $_GET['campo'];
$valor = $_GET['valor'];
$hello;
// Verificando o campo login
// Verificando o campo email
if ($campo == "myPassword") {
if (!preg_match("/^\S{4,12}$/", $valor)) {
echo "Tamanho entre 4 e 12 letras e sem espaços";
}
else
$hello = $valor; //problem here
echo $hello;
}
if ($campo == "passwordMatch") {
if ($hello != $valor ) {
echo "Passwords don't match";
}
}
?>
so, i need store a variable (where i put "problem here") and compare below, but this code didn't work and i don't know why
thanks | 0 |
10,160,224 | 04/15/2012 07:13:13 | 700,195 | 04/09/2011 18:28:05 | 171 | 7 | What do you code first to learn a new language, library, or framework? | Every language, framework, and library has its own syntax, quirks, and pitfalls.
----------
**What Program, Game, etc. do you code in order to learn these unique characteristics?
How do you decide on what previous programming experience is applicable?**
----------
I'd imagine that the task would have to be complicated enough to force you to use applicable programming techniques and idioms, but simple enough that it wouldn't take a ton of time. | language-agnostic | frameworks | programming-languages | self-improvement | null | 04/15/2012 08:19:49 | not constructive | What do you code first to learn a new language, library, or framework?
===
Every language, framework, and library has its own syntax, quirks, and pitfalls.
----------
**What Program, Game, etc. do you code in order to learn these unique characteristics?
How do you decide on what previous programming experience is applicable?**
----------
I'd imagine that the task would have to be complicated enough to force you to use applicable programming techniques and idioms, but simple enough that it wouldn't take a ton of time. | 4 |
5,208,811 | 03/06/2011 05:00:08 | 238,387 | 12/24/2009 21:25:54 | 115 | 7 | How to get port identifiers for an edge using Boost Graph Library? | Using the Boost Graph Library, is it possible to get the port identifiers for an edge?
Example: After calling `read_graphviz`, I can iterate through the edges of this graph and print their `node_id`s -- I get "A -> B, A -> B". How can I print something like "A:p0 -> B:p1, A:p0 -> B:p2"?
digraph G {
A [label="A|<p0>p0"];
B [label="B|<p1>p1|<p2>p2"];
A:p0 -> B:p1;
A:p0 -> B:p2;
}
![Rendering of digraph G][1]
[1]: http://i.stack.imgur.com/N6lmE.png | c++ | boost | graphviz | null | null | null | open | How to get port identifiers for an edge using Boost Graph Library?
===
Using the Boost Graph Library, is it possible to get the port identifiers for an edge?
Example: After calling `read_graphviz`, I can iterate through the edges of this graph and print their `node_id`s -- I get "A -> B, A -> B". How can I print something like "A:p0 -> B:p1, A:p0 -> B:p2"?
digraph G {
A [label="A|<p0>p0"];
B [label="B|<p1>p1|<p2>p2"];
A:p0 -> B:p1;
A:p0 -> B:p2;
}
![Rendering of digraph G][1]
[1]: http://i.stack.imgur.com/N6lmE.png | 0 |
5,230,070 | 03/08/2011 08:31:30 | 162,337 | 08/24/2009 21:50:11 | 675 | 20 | Scope constants to an rspec context | I often want to do
context "empty stack" do
SOME_CONSTANT = "value"
it "should be empty" do
# use SOME_CONSTANT
end
end
context "populated stack" do
SOME_CONSTANT = "a different value"
it "should have some items" do
# use SOME_CONSTANT
end
end
ruby doesn't scope constants to closures so they leak out. Does anyone have a trick for declaring constants that are scoped to a context?
| constants | rspec2 | rpsec | null | null | null | open | Scope constants to an rspec context
===
I often want to do
context "empty stack" do
SOME_CONSTANT = "value"
it "should be empty" do
# use SOME_CONSTANT
end
end
context "populated stack" do
SOME_CONSTANT = "a different value"
it "should have some items" do
# use SOME_CONSTANT
end
end
ruby doesn't scope constants to closures so they leak out. Does anyone have a trick for declaring constants that are scoped to a context?
| 0 |
11,121,819 | 06/20/2012 14:29:18 | 1,468,124 | 06/20/2012 04:45:56 | 1 | 0 | connection of mysql for python | I have installed the MySQLdb for python and I am able to import MySQLdb.I need to connect to the mysql database of my webpage. I have installed mysql community server in my local machine.... now i used
db=MySQLdb.connect(
host="localhost",
user="br_admin",
passwd="blabla",
db="br_brain"
)
` but i get the error as
**Traceback (most recent call last):
File "<pyshell#22>", line 5, in <module>
db="brainse_brain"
File "C:\Python27\lib\site-packages\MySQLdb\__init__.py", line 81, in Connect
return Connection(*args, **kwargs)
File "C:\Python27\lib\site-packages\MySQLdb\connections.py", line 187, in __init__
super(Connection, self).__init__(*args, **kwargs2)
OperationalError: (2003, "Can't connect to MySQL server on 'localhost' (10061)")**
can some one tell me what is the problem with my connection.? | mysql | python-2.7 | null | null | null | null | open | connection of mysql for python
===
I have installed the MySQLdb for python and I am able to import MySQLdb.I need to connect to the mysql database of my webpage. I have installed mysql community server in my local machine.... now i used
db=MySQLdb.connect(
host="localhost",
user="br_admin",
passwd="blabla",
db="br_brain"
)
` but i get the error as
**Traceback (most recent call last):
File "<pyshell#22>", line 5, in <module>
db="brainse_brain"
File "C:\Python27\lib\site-packages\MySQLdb\__init__.py", line 81, in Connect
return Connection(*args, **kwargs)
File "C:\Python27\lib\site-packages\MySQLdb\connections.py", line 187, in __init__
super(Connection, self).__init__(*args, **kwargs2)
OperationalError: (2003, "Can't connect to MySQL server on 'localhost' (10061)")**
can some one tell me what is the problem with my connection.? | 0 |
10,496,361 | 05/08/2012 09:54:58 | 349,026 | 05/24/2010 14:18:18 | 1,700 | 79 | List<byte[]> joining/concatenate using LINQ? | I have a list of byte arrays `List<byte[]> inputs`.
I want to join,concatenate the entries with comma, meaning all the values would be comma delimited and stored in a single byte[] array. How can I do this using LINQ?
List<byte[]> ==> Command/Delimited ==> byte[]
Thanks for the guidance.
Wajih | c# | arrays | linq | join | byte | 05/16/2012 12:33:03 | not a real question | List<byte[]> joining/concatenate using LINQ?
===
I have a list of byte arrays `List<byte[]> inputs`.
I want to join,concatenate the entries with comma, meaning all the values would be comma delimited and stored in a single byte[] array. How can I do this using LINQ?
List<byte[]> ==> Command/Delimited ==> byte[]
Thanks for the guidance.
Wajih | 1 |
3,942,510 | 10/15/2010 13:10:20 | 310,276 | 04/06/2010 18:00:39 | 85 | 6 | SQL Server Error "Could not open a connection to SQL Server" | I know this is a known issue. But I've tried everything I found out and I can't solve it yet.
I've a .Net winforms app. It needs to connect to a SQL Server in a remote server in the same network. It works perfectlly in my machine, but it doesn't in antoher machine from my work. Both machines have Windows 7 and installed the SQL server, only client tools (the exactly same installation, I think).
I've read this article: http://blog.sqlauthority.com/2009/05/21/sql-server-fix-error-provider-named-pipes-provider-error-40-could-not-open-a-connection-to-sql-server-microsoft-sql-server-error/ . I'll tell you the result of each Solution:
1) "check if SQL Server service status is “Running” ". I've installed only SQL server client, "Sql Server servicies" list is empty.
"In addition, ensure that your remote server is in the same network. Run “sqlcmd -L” in your command prompt to ascertain if your server is included in your network list." It is included in servers list.
2) It is enabled in both machines.
3) There is no active Firewall in both machines.
4) It is enabled. Also, if it weren't be enabled my app woudn't work in any pc.
5) Again, I've installed only SQL server cliente. "Sql Server servicies" list is empty.
6) There is no active Firewall.
7) We are not using alias at all (any machine).
Please help!!
Thanks,
DIego | .net | sql-server | winforms | sql-server-2008 | null | null | open | SQL Server Error "Could not open a connection to SQL Server"
===
I know this is a known issue. But I've tried everything I found out and I can't solve it yet.
I've a .Net winforms app. It needs to connect to a SQL Server in a remote server in the same network. It works perfectlly in my machine, but it doesn't in antoher machine from my work. Both machines have Windows 7 and installed the SQL server, only client tools (the exactly same installation, I think).
I've read this article: http://blog.sqlauthority.com/2009/05/21/sql-server-fix-error-provider-named-pipes-provider-error-40-could-not-open-a-connection-to-sql-server-microsoft-sql-server-error/ . I'll tell you the result of each Solution:
1) "check if SQL Server service status is “Running” ". I've installed only SQL server client, "Sql Server servicies" list is empty.
"In addition, ensure that your remote server is in the same network. Run “sqlcmd -L” in your command prompt to ascertain if your server is included in your network list." It is included in servers list.
2) It is enabled in both machines.
3) There is no active Firewall in both machines.
4) It is enabled. Also, if it weren't be enabled my app woudn't work in any pc.
5) Again, I've installed only SQL server cliente. "Sql Server servicies" list is empty.
6) There is no active Firewall.
7) We are not using alias at all (any machine).
Please help!!
Thanks,
DIego | 0 |
6,216,709 | 06/02/2011 15:30:53 | 219,406 | 11/26/2009 13:11:45 | 1,906 | 135 | jqrid 4 with jquery 1.6.1 | is there anyone who have experienced problems using the latests jQuery version with one of the last jqGrid releases?
I am in process to upgrade jQuery to 1.6.x and I was trying to find infos about jqGrid but it seems that they are not yet supporting it.
| jquery | jqgrid | null | null | null | 06/03/2011 10:47:52 | too localized | jqrid 4 with jquery 1.6.1
===
is there anyone who have experienced problems using the latests jQuery version with one of the last jqGrid releases?
I am in process to upgrade jQuery to 1.6.x and I was trying to find infos about jqGrid but it seems that they are not yet supporting it.
| 3 |
9,530,699 | 03/02/2012 09:17:47 | 1,244,685 | 03/02/2012 08:54:44 | 1 | 0 | Enhanced For Loop - Array of Objects | Ok so I have a class called Dog() which takes two parameters, a string and an integer.<br />
This class has a method called bark(), which prints a string depending on the integer passed into the Dog() constructor.
I also have a class called Kennel() which creates an array of 5 Dog()s... looks like this:
public class Kennel
{
Dog[] kennel = new Dog[5];
public Kennel()
{
kennel[0] = new Dog("Harold",1);
kennel[1] = new Dog("Arnold",2);
kennel[2] = new Dog("Fido",3);
kennel[3] = new Dog("Spot",4);
kennel[4] = new Dog("Rover",5);
}
}
For starters, this works, but seems wrong. Why do I have to start with Dog[] ... new Dog[5]? Maybe stupid question... I'm new to this.
Anyway... What I have been asked to do is use the "enhanced" for loop to iterate through the array calling bark().
So with a traditional for loop it would look like this:
for (i=0;i<kennel.length;i++)
{
kennel[i].bark();
}
Simple stuff, right? But how do I implement this using the for(type item : array) syntax? | java | arrays | foreach | enhanced-for-loop | null | null | open | Enhanced For Loop - Array of Objects
===
Ok so I have a class called Dog() which takes two parameters, a string and an integer.<br />
This class has a method called bark(), which prints a string depending on the integer passed into the Dog() constructor.
I also have a class called Kennel() which creates an array of 5 Dog()s... looks like this:
public class Kennel
{
Dog[] kennel = new Dog[5];
public Kennel()
{
kennel[0] = new Dog("Harold",1);
kennel[1] = new Dog("Arnold",2);
kennel[2] = new Dog("Fido",3);
kennel[3] = new Dog("Spot",4);
kennel[4] = new Dog("Rover",5);
}
}
For starters, this works, but seems wrong. Why do I have to start with Dog[] ... new Dog[5]? Maybe stupid question... I'm new to this.
Anyway... What I have been asked to do is use the "enhanced" for loop to iterate through the array calling bark().
So with a traditional for loop it would look like this:
for (i=0;i<kennel.length;i++)
{
kennel[i].bark();
}
Simple stuff, right? But how do I implement this using the for(type item : array) syntax? | 0 |
7,201,317 | 08/26/2011 07:23:04 | 733,287 | 05/01/2011 13:00:26 | 724 | 74 | jquery validation not working properly | hi am using jquery validation plugin to validate my form . i am using codeigniter .
there is input box .
<input type="text" value="" class="city" name="city" id="textarea_small" autocomplete="off">
i have validated it like this
var x=$("#contactinfo").validate({
rules: {
city: {
required: true,
minlength: 3,
maxlength: 50,
lettersonly: true
},
},
messages: {
city: {
required: "Enter City",
minlength: "min length 3"
},
}
});
the minimum length is 3 characters , if i typed less than 3 characters and select another input box the city input box displays `min length 3` it is working fine
but i have two problems
1. if i paste a word more than 3 character and select another input-box the folowing javascript error appear in firebug
$.validator.methods[method] is undefined
var result = $.validator.methods[...r/g, ""), element, rule.parameters );
and it says the linenumber is 471 in `jquery.validate.js`
2.i am using `Ajax AutoComplete for jQuery` library to give auto suggestions according to the word user type in city input-box. it works fine , but when i type less than 3 characters an click on my auto suggestion values drop-down it gives validation error `min length 3` even though my value is more than 3 characters . if i type more than 3 characters and select an auto-suggest value from drop-down it does not give validation error , but like the first example it gives
$.validator.methods[method] is undefined
var result = $.validator.methods[...r/g, ""), element, rule.parameters );
and it says the linenumber is 471 in `jquery.validate.js`
i only get it correct if i type more than 3 letters an click else where(change event).
is this a bug . or am i missing something
please help.................................................... :(
| javascript | jquery | ajax | jquery-validation-plugin | null | null | open | jquery validation not working properly
===
hi am using jquery validation plugin to validate my form . i am using codeigniter .
there is input box .
<input type="text" value="" class="city" name="city" id="textarea_small" autocomplete="off">
i have validated it like this
var x=$("#contactinfo").validate({
rules: {
city: {
required: true,
minlength: 3,
maxlength: 50,
lettersonly: true
},
},
messages: {
city: {
required: "Enter City",
minlength: "min length 3"
},
}
});
the minimum length is 3 characters , if i typed less than 3 characters and select another input box the city input box displays `min length 3` it is working fine
but i have two problems
1. if i paste a word more than 3 character and select another input-box the folowing javascript error appear in firebug
$.validator.methods[method] is undefined
var result = $.validator.methods[...r/g, ""), element, rule.parameters );
and it says the linenumber is 471 in `jquery.validate.js`
2.i am using `Ajax AutoComplete for jQuery` library to give auto suggestions according to the word user type in city input-box. it works fine , but when i type less than 3 characters an click on my auto suggestion values drop-down it gives validation error `min length 3` even though my value is more than 3 characters . if i type more than 3 characters and select an auto-suggest value from drop-down it does not give validation error , but like the first example it gives
$.validator.methods[method] is undefined
var result = $.validator.methods[...r/g, ""), element, rule.parameters );
and it says the linenumber is 471 in `jquery.validate.js`
i only get it correct if i type more than 3 letters an click else where(change event).
is this a bug . or am i missing something
please help.................................................... :(
| 0 |
8,907,543 | 01/18/2012 09:04:26 | 330,475 | 05/01/2010 17:16:53 | 1 | 0 | N-Tier Architecture | I’m in the situation that I have to design and implement a system from the scratch. I’m having some questions about the architecture that I would like your comments and thoughts on.
Quick Info about the project: Its a data centric web application.
The application will be built on Microsoft .NET Framework 4.0 with MS SQL SERVER 2008 database.
Requirement:<br/>
1. Rich UI and robust <br/>
2. Multi-device Support (every browser and on every device) <br/>
3. Loosely coupled
<br/>
Below is the architectural diagram link i have build : <br/>
https://plus.google.com/photos/104702944930754413137/albums/5698893164980998113?authkey=CMjh9ufOyPOpeA
<br/>
Briefing of the architecture <br/>
1.Presentation layer : HTML5/Asp.NET MVC + JQuery ( Web application for multidevice support in first version) <br/>
2. Distributed Services : WCF (XML/JSON/JSONP) <br/>
3. Domain Layer(Business Layer) : All business Logics <br/>
4. Data persistence (DAL Layer) : Entity Framework 4.0 with database first approach. POCO entities are generated and separated out using T4 template<br/>
5. Infrastructural Layer: Contains common libraries like POCO entities, Exception Handling, logging etc <br/>
<br/>
My Concern:<br/>
1. As application is to be build **loosely coupled** so in future if business requirement grows new modules can easily plugged without affecting the architecture.<br/>
So i have thought of using Repository pattern along with IoC and DI (can be Unity/Ninject/Sprint.NET or any other ) <br/>
2. WCF with both XML and JSON support <br/>
3. Distributed Service Layer to place IoC & DI <br/>
4. Exception Handling & Logging using Enterprise Library 5.0
<br/><br/>
Looking for valuable comments and suggestion.<br/>
If i am doing anything wrong please put me in right direction. <br/>
Thanks !!!
[1]: http://i.stack.imgur.com/JOnfd.png | wcf | entity-framework | inversion-of-control | n-tier | null | null | open | N-Tier Architecture
===
I’m in the situation that I have to design and implement a system from the scratch. I’m having some questions about the architecture that I would like your comments and thoughts on.
Quick Info about the project: Its a data centric web application.
The application will be built on Microsoft .NET Framework 4.0 with MS SQL SERVER 2008 database.
Requirement:<br/>
1. Rich UI and robust <br/>
2. Multi-device Support (every browser and on every device) <br/>
3. Loosely coupled
<br/>
Below is the architectural diagram link i have build : <br/>
https://plus.google.com/photos/104702944930754413137/albums/5698893164980998113?authkey=CMjh9ufOyPOpeA
<br/>
Briefing of the architecture <br/>
1.Presentation layer : HTML5/Asp.NET MVC + JQuery ( Web application for multidevice support in first version) <br/>
2. Distributed Services : WCF (XML/JSON/JSONP) <br/>
3. Domain Layer(Business Layer) : All business Logics <br/>
4. Data persistence (DAL Layer) : Entity Framework 4.0 with database first approach. POCO entities are generated and separated out using T4 template<br/>
5. Infrastructural Layer: Contains common libraries like POCO entities, Exception Handling, logging etc <br/>
<br/>
My Concern:<br/>
1. As application is to be build **loosely coupled** so in future if business requirement grows new modules can easily plugged without affecting the architecture.<br/>
So i have thought of using Repository pattern along with IoC and DI (can be Unity/Ninject/Sprint.NET or any other ) <br/>
2. WCF with both XML and JSON support <br/>
3. Distributed Service Layer to place IoC & DI <br/>
4. Exception Handling & Logging using Enterprise Library 5.0
<br/><br/>
Looking for valuable comments and suggestion.<br/>
If i am doing anything wrong please put me in right direction. <br/>
Thanks !!!
[1]: http://i.stack.imgur.com/JOnfd.png | 0 |
6,750,743 | 07/19/2011 16:39:49 | 385,064 | 07/07/2010 00:50:13 | 77 | 0 | Why isn't glibc installed by default? | According to wikipedia, glibc is a very widely used library in unix/linux, so since it's so popular, why isn't it installed to system by default? | linux | linux-kernel | glibc | null | null | 07/19/2011 22:08:14 | off topic | Why isn't glibc installed by default?
===
According to wikipedia, glibc is a very widely used library in unix/linux, so since it's so popular, why isn't it installed to system by default? | 2 |
1,240,468 | 08/06/2009 17:58:58 | 81,717 | 03/23/2009 23:19:43 | 277 | 20 | How to diplomatically give 'Code Complete' to another team in my office? | There is another team in my office which I think would greatly benefit from reading "Code Complete". I have an extra copy of the book, and would like to give it to them in the hope that they will read it and follow some of its sage advice. How do I do this diplomatically? | books | null | null | null | null | 08/07/2009 03:55:19 | off topic | How to diplomatically give 'Code Complete' to another team in my office?
===
There is another team in my office which I think would greatly benefit from reading "Code Complete". I have an extra copy of the book, and would like to give it to them in the hope that they will read it and follow some of its sage advice. How do I do this diplomatically? | 2 |
7,158,449 | 08/23/2011 08:54:52 | 680,410 | 03/28/2011 14:36:37 | 319 | 12 | Nested fusion vector -- how to access a sequence-of-sequences in a flattened way? | in the following example, Outer contains a nested fusion::vector:
struct A { fusion::vector<int, double> sub_elements_; };
struct B { fusion::vector<char *, char *> sub_elements_; };
class Outer { fusion::vector<A, A, B> elements_; };
Outer outer_;
How can I access Outer in a **flattened** way? For example, I would like these to be equivalent:
fusion::at_c<0>(fusion::at_c<2>(outer_.elements_).sub_elements_);
fusion::at_c<4>(outer_); // Same result; how to make such a flattened access work?
- One approach might be using the `fusion::joint_view`; however this seems to be non-optimal, because the view adds a superfluous layer of references to its sub-sequences.
- Or, I could implement my own fusion sequence type, e.g., starting with the example [triple.cpp][1]. To get this right is rather complex.
Accessing a nested vector is a pretty generic task -- does boost::fusion provide a good solution to this?
[1]: http://www.boost.org/doc/libs/1_47_0/libs/fusion/example/extension/triple.cpp | c++ | vector | metaprogramming | boost-mpl | boost-fusion | null | open | Nested fusion vector -- how to access a sequence-of-sequences in a flattened way?
===
in the following example, Outer contains a nested fusion::vector:
struct A { fusion::vector<int, double> sub_elements_; };
struct B { fusion::vector<char *, char *> sub_elements_; };
class Outer { fusion::vector<A, A, B> elements_; };
Outer outer_;
How can I access Outer in a **flattened** way? For example, I would like these to be equivalent:
fusion::at_c<0>(fusion::at_c<2>(outer_.elements_).sub_elements_);
fusion::at_c<4>(outer_); // Same result; how to make such a flattened access work?
- One approach might be using the `fusion::joint_view`; however this seems to be non-optimal, because the view adds a superfluous layer of references to its sub-sequences.
- Or, I could implement my own fusion sequence type, e.g., starting with the example [triple.cpp][1]. To get this right is rather complex.
Accessing a nested vector is a pretty generic task -- does boost::fusion provide a good solution to this?
[1]: http://www.boost.org/doc/libs/1_47_0/libs/fusion/example/extension/triple.cpp | 0 |
792,451 | 04/27/2009 06:45:26 | 95,880 | 04/25/2009 07:25:57 | 1 | 0 | Want to send parameters with custom dispatch event | I am creating a library. Here is an example
[Event (name="eventAction", type="something")]
public function create_new_customer(phone_number:String):void
{
-------------;
----;
------------;
rpc.addEventListener(Event.COMPLETE, onCreate_returns);
}
private function onCreate_returns(evt:Event):void
{
var ob:Object = evt.target.getResponse();
dispatchEvent(new something("eventAction"));
}
I have a listener to this event in app side. So when I manually dispatch event I want the
"ob" to be sent as a parameter. How to do it? | actionscript-3 | null | null | null | null | null | open | Want to send parameters with custom dispatch event
===
I am creating a library. Here is an example
[Event (name="eventAction", type="something")]
public function create_new_customer(phone_number:String):void
{
-------------;
----;
------------;
rpc.addEventListener(Event.COMPLETE, onCreate_returns);
}
private function onCreate_returns(evt:Event):void
{
var ob:Object = evt.target.getResponse();
dispatchEvent(new something("eventAction"));
}
I have a listener to this event in app side. So when I manually dispatch event I want the
"ob" to be sent as a parameter. How to do it? | 0 |
4,065,580 | 10/31/2010 22:52:15 | 39,677 | 11/03/2008 21:48:03 | 7,104 | 5 | should I be using 1.9.2 or 1.8.7 for rails 3.0 production apps? | I'm currently using 1.9.2 with rails 3, and I ran into a snag with ruby-debug.
Should I be using 1.8.7 to be more on the safe side with rails 3?
I'm new to rails, and I want to stay away from hackish workarounds or configuration nightmares.
(I'm using rvm) | ruby-on-rails | null | null | null | null | null | open | should I be using 1.9.2 or 1.8.7 for rails 3.0 production apps?
===
I'm currently using 1.9.2 with rails 3, and I ran into a snag with ruby-debug.
Should I be using 1.8.7 to be more on the safe side with rails 3?
I'm new to rails, and I want to stay away from hackish workarounds or configuration nightmares.
(I'm using rvm) | 0 |
700,563 | 03/31/2009 08:28:22 | 41,420 | 11/27/2008 16:42:26 | 521 | 37 | How to deal with unresponsive clients? | Running a business / being self-employed we all have to deal occassionally with clients who become unresponsive. E.g. you send them a UI mockup asking for feedback and all you get back is silence. You ask about some details about the feature in their application that you're working on and you don't hear from them for a month.
I try to nag them every few days by sending an email or an IM message, but it not always works. Some promise to get back to you, saying something along the lines of "sorry, I've been swamped with work recently, I will get the answers to you today" - and "today" was 5 days ago, a week ago, two weeks ago and so on. And it repeats like that.
Have you worked out some good methods of dealing with such clients? How do I 'force' them to finally move forward, so that I can resume my work on their project? | customer-relationship | null | null | null | null | 05/04/2012 13:29:19 | off topic | How to deal with unresponsive clients?
===
Running a business / being self-employed we all have to deal occassionally with clients who become unresponsive. E.g. you send them a UI mockup asking for feedback and all you get back is silence. You ask about some details about the feature in their application that you're working on and you don't hear from them for a month.
I try to nag them every few days by sending an email or an IM message, but it not always works. Some promise to get back to you, saying something along the lines of "sorry, I've been swamped with work recently, I will get the answers to you today" - and "today" was 5 days ago, a week ago, two weeks ago and so on. And it repeats like that.
Have you worked out some good methods of dealing with such clients? How do I 'force' them to finally move forward, so that I can resume my work on their project? | 2 |
3,115,680 | 06/25/2010 05:02:26 | 192,261 | 10/19/2009 07:03:39 | 65 | 5 | How come I can see nothing about the ecommerce from the Google Analytics admin site | Here's the script for tracking the ecommerce on my site, http://gist.github.com/452437 , I tried to do the purchase for several times, but I don't anything happened on https://www.google.com/analytics/reporting/ecommerce , I double checked the script for several times and I can't see anything wrong, could somebody help to point out what the problem is? Thanks a lot | google-analytics | null | null | null | null | null | open | How come I can see nothing about the ecommerce from the Google Analytics admin site
===
Here's the script for tracking the ecommerce on my site, http://gist.github.com/452437 , I tried to do the purchase for several times, but I don't anything happened on https://www.google.com/analytics/reporting/ecommerce , I double checked the script for several times and I can't see anything wrong, could somebody help to point out what the problem is? Thanks a lot | 0 |
11,542,214 | 07/18/2012 13:11:26 | 93,647 | 04/21/2009 08:11:02 | 1,287 | 15 | should I use Microsoft chart controls? | I've googled something called `Microsoft chart controls` that seems a little bit old project (~2008) but it seems still alive and pretty much supported.
I just want to draw regular graphs in my standalone application (WinForms, WPF or anything else - i don't care). More information in my previous, closed, question http://stackoverflow.com/questions/11539775/c-sharp-opensource-project-to-draw-graphs-or-should-i-write-that-myself
1. Could you recommend `Microsoft Chart Controls`? Or you probably can suggest something better?
2. Must I install this? http://www.microsoft.com/en-us/download/details.aspx?id=14422
3. Am I correct that this is http://msdn.microsoft.com/en-us/library/dd456632.aspx a good page to get started? (if this page about `Microsoft Chart Controls` or it about other `Chart Controls`)? | c# | null | null | null | null | 07/18/2012 14:03:34 | not constructive | should I use Microsoft chart controls?
===
I've googled something called `Microsoft chart controls` that seems a little bit old project (~2008) but it seems still alive and pretty much supported.
I just want to draw regular graphs in my standalone application (WinForms, WPF or anything else - i don't care). More information in my previous, closed, question http://stackoverflow.com/questions/11539775/c-sharp-opensource-project-to-draw-graphs-or-should-i-write-that-myself
1. Could you recommend `Microsoft Chart Controls`? Or you probably can suggest something better?
2. Must I install this? http://www.microsoft.com/en-us/download/details.aspx?id=14422
3. Am I correct that this is http://msdn.microsoft.com/en-us/library/dd456632.aspx a good page to get started? (if this page about `Microsoft Chart Controls` or it about other `Chart Controls`)? | 4 |
6,368,988 | 06/16/2011 08:21:06 | 751,902 | 05/13/2011 06:55:53 | 12 | 0 | How to: implement a basic php paging with mysql, ajax AND linq | Am trying to implement a simple mysql data paging using php, ajax and (the real kicker) linq. There is a linq implementation for php, called phplinq
I have been able to implement the paging without the linq part, and the relevant code is this: (split into several files)
1. pagination.php, where it all starts.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD
HTML 4.01 Transitional//EN"> <html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
<title>Pagination with Jquery, Ajax, PHP</title>
> <script type="text/javascript"
> src="js/jquery1_5_2_min.js"></script>
> <script type="text/javascript" src="js/paginator.js"></script>
> <link rel="stylesheet" type="text/css" href="css/table.css">
> </head>
> <body>
> <div id="loading"></div>
> <div id="container">
> <div class="data"></div>
> <div class="pagination"></div>
> </div>
> </body> </html>
2. load_data.php, the file where the data is all pulled
<?php
if($_POST['page']){
$page = $_POST['page'];
$cur_page = $page;
$page -= 1;
$per_page = 15;
$previous_btn = true;
$next_btn = true;
$first_btn = true;
$last_btn = true;
$start = $page * $per_page;
include"dbconnect.php";
$query_pag_data = "SELECT id as msg_id,name as message from student LIMIT $start, $per_page";
$result_pag_data = mysql_query($query_pag_data) or die('MySql Error' . mysql_error());
$msg = "";
while ($row = mysql_fetch_array($result_pag_data)) {
$htmlmsg=htmlentities($row['message']);
$msg .= "<li><b>" . $row['msg_id'] . "</b> " . $htmlmsg . "</li>";
}
$msg = "<div class='data'><ul>" . $msg . "</ul></div>"; // Content for Data
/* --------------------------------------------- */
$query_pag_num = "SELECT COUNT(*) AS count FROM student";
$result_pag_num = mysql_query($query_pag_num);
$row = mysql_fetch_array($result_pag_num);
$count = $row['count'];
$no_of_paginations = ceil($count / $per_page);
/* ---------------Calculating the starting and endign values for the loop----------------------------------- */
if ($cur_page >= 7) {
$start_loop = $cur_page - 3;
if ($no_of_paginations > $cur_page + 3)
$end_loop = $cur_page + 3;
else if ($cur_page <= $no_of_paginations && $cur_page > $no_of_paginations - 6) {
$start_loop = $no_of_paginations - 6;
$end_loop = $no_of_paginations;
} else {
$end_loop = $no_of_paginations;
}
} else {
$start_loop = 1;
if ($no_of_paginations > 7)
$end_loop = 7;
else
$end_loop = $no_of_paginations;
}
/* ----------------------------------------------------------------------------------------------------------- */
$msg .= "<div class='pagination'><ul>";
// FOR ENABLING THE FIRST BUTTON
if ($first_btn && $cur_page > 1) {
$msg .= "<li p='1' class='active'>First</li>";
} else if ($first_btn) {
$msg .= "<li p='1' class='inactive'>First</li>";
}
// FOR ENABLING THE PREVIOUS BUTTON
if ($previous_btn && $cur_page > 1) {
$pre = $cur_page - 1;
$msg .= "<li p='$pre' class='active'>Previous</li>";
} else if ($previous_btn) {
$msg .= "<li class='inactive'>Previous</li>";
}
for ($i = $start_loop; $i <= $end_loop; $i++) {
if ($cur_page == $i)
$msg .= "<li p='$i' style='color:#fff;background-color:#006699;' class='active'>{$i}</li>";
else
$msg .= "<li p='$i' class='active'>{$i}</li>";
}
// TO ENABLE THE NEXT BUTTON
if ($next_btn && $cur_page < $no_of_paginations) {
$nex = $cur_page + 1;
$msg .= "<li p='$nex' class='active'>Next</li>";
} else if ($next_btn) {
$msg .= "<li class='inactive'>Next</li>";
}
// TO ENABLE THE END BUTTON
if ($last_btn && $cur_page < $no_of_paginations) {
$msg .= "<li p='$no_of_paginations' class='active'>Last</li>";
} else if ($last_btn) {
$msg .= "<li p='$no_of_paginations' class='inactive'>Last</li>";
}
$goto = "<input type='text' class='goto' size='1' style='margin-top:-1px;margin-left:60px;'/><input type='button' id='go_btn' class='go_button' value='Go'/>";
$total_string = "<span class='total' a='$no_of_paginations'>Page <b>" . $cur_page . "</b> of <b>$no_of_paginations</b></span>";
$msg = $msg . "</ul>" . $goto . $total_string . "</div>"; // Content for pagination
echo $msg;
}
3. dbconnect.php, containing login stuff
<?php
$uname="root";
$server="localhost";
$password="root";
$database="testdb";
$bd = mysql_connect($server, $uname, $password) or die("Opps");
mysql_select_db($database, $bd) or die("Opps some thing went wrong");
?>
4. paginator.js, the file with javascript functions.
$(document).ready(function(){
function loading_show(){
$('#loading').html("<img src='/mages/loading.gif'/>").fadeIn('fast');
}
function loading_hide(){
$('#loading').fadeOut('fast');
}
function loadData(page){
loading_show();
$.ajax
({
type: "POST",
url: "load_data.php",
data: "page="+page,
success: function(msg)
{
$("#container").ajaxComplete(function(event, request, settings)
{
loading_hide();
$("#container").html(msg);
});
}
});
}
loadData(1); // For first time page load default results
$('#container .pagination li.active').live('click',function(){
var page = $(this).attr('p');
loadData(page);
});
$('#go_btn').live('click',function(){
var page = parseInt($('.goto').val());
var no_of_pages = parseInt($('.total').attr('a'));
if(page != 0 && page <= no_of_pages){
loadData(page);
}
else{
alert('Enter a PAGE between 1 and '+no_of_pages);
$('.goto').val("").focus();
return false;
}
});
});
And finally, table.css, the file with some basic styling.
body{
width: 800px;
margin: 0 auto;
padding: 0;
}
#loading{
width: 100%;
position: absolute;
top: 100px;
left: 100px;
margin-top:200px;
}
#container .pagination ul li.inactive,
#container .pagination ul li.inactive:hover{
background-color:#ededed;
color:#bababa;
border:1px solid #bababa;
cursor: default;
}
#container .data ul li{
list-style: none;
font-family: verdana;
margin: 5px 0 5px 0;
color: #000;
font-size: 13px;
}
#container .pagination{
width: 800px;
height: 25px;
}
#container .pagination ul li{
list-style: none;
float: left;
border: 1px solid #006699;
padding: 2px 6px 2px 6px;
margin: 0 3px 0 3px;
font-family: arial;
font-size: 14px;
color: #006699;
font-weight: bold;
background-color: #f2f2f2;
}
#container .pagination ul li:hover{
color: #fff;
background-color: #006699;
cursor: pointer;
}
.go_button
{
background-color:#f2f2f2;border:1px solid #006699;color:#cc0000;padding:2px 6px 2px 6px;cursor:pointer;position:absolute;margin-top:-1px;
}
.total
{
float:right;font-family:arial;color:#999;
}
if youre going to replicate this, there is a css folder and a js folder and i have downloaded the jquery 1.5.2 from google. you can replace the line
<script type="text/javascript" src="js/jquery1_5_2_min.js"></script>
in pagination.php with
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
Also, the table being used is
CREATE TABLE student (
id INT PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(150)
);
my
objective here is get rid of all direct mysql query calls inside the files with whatever i can put there using linq. I have used linq extensively with .NET 4.0, so basically what am trying to do here is abstracting the data access layer, as if i were using .NET objects to interface with data instead of pure mysql query calls.
Does this make sense? my end goal is being able to replace all mysql query calls with phplinq and completely isolate the data access code.(If linq is an overkill or somehow inadequate, ill drop it) I dont want to go with any ORM here because am going to heavily customize the grid (In this example there is just a list) and the future Data Access Layer
Am not that proficient with php, so please dont direct me to extensive reading. something i could pick up and play with would be much better
| php | mysql | linq | paging | null | null | open | How to: implement a basic php paging with mysql, ajax AND linq
===
Am trying to implement a simple mysql data paging using php, ajax and (the real kicker) linq. There is a linq implementation for php, called phplinq
I have been able to implement the paging without the linq part, and the relevant code is this: (split into several files)
1. pagination.php, where it all starts.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD
HTML 4.01 Transitional//EN"> <html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
<title>Pagination with Jquery, Ajax, PHP</title>
> <script type="text/javascript"
> src="js/jquery1_5_2_min.js"></script>
> <script type="text/javascript" src="js/paginator.js"></script>
> <link rel="stylesheet" type="text/css" href="css/table.css">
> </head>
> <body>
> <div id="loading"></div>
> <div id="container">
> <div class="data"></div>
> <div class="pagination"></div>
> </div>
> </body> </html>
2. load_data.php, the file where the data is all pulled
<?php
if($_POST['page']){
$page = $_POST['page'];
$cur_page = $page;
$page -= 1;
$per_page = 15;
$previous_btn = true;
$next_btn = true;
$first_btn = true;
$last_btn = true;
$start = $page * $per_page;
include"dbconnect.php";
$query_pag_data = "SELECT id as msg_id,name as message from student LIMIT $start, $per_page";
$result_pag_data = mysql_query($query_pag_data) or die('MySql Error' . mysql_error());
$msg = "";
while ($row = mysql_fetch_array($result_pag_data)) {
$htmlmsg=htmlentities($row['message']);
$msg .= "<li><b>" . $row['msg_id'] . "</b> " . $htmlmsg . "</li>";
}
$msg = "<div class='data'><ul>" . $msg . "</ul></div>"; // Content for Data
/* --------------------------------------------- */
$query_pag_num = "SELECT COUNT(*) AS count FROM student";
$result_pag_num = mysql_query($query_pag_num);
$row = mysql_fetch_array($result_pag_num);
$count = $row['count'];
$no_of_paginations = ceil($count / $per_page);
/* ---------------Calculating the starting and endign values for the loop----------------------------------- */
if ($cur_page >= 7) {
$start_loop = $cur_page - 3;
if ($no_of_paginations > $cur_page + 3)
$end_loop = $cur_page + 3;
else if ($cur_page <= $no_of_paginations && $cur_page > $no_of_paginations - 6) {
$start_loop = $no_of_paginations - 6;
$end_loop = $no_of_paginations;
} else {
$end_loop = $no_of_paginations;
}
} else {
$start_loop = 1;
if ($no_of_paginations > 7)
$end_loop = 7;
else
$end_loop = $no_of_paginations;
}
/* ----------------------------------------------------------------------------------------------------------- */
$msg .= "<div class='pagination'><ul>";
// FOR ENABLING THE FIRST BUTTON
if ($first_btn && $cur_page > 1) {
$msg .= "<li p='1' class='active'>First</li>";
} else if ($first_btn) {
$msg .= "<li p='1' class='inactive'>First</li>";
}
// FOR ENABLING THE PREVIOUS BUTTON
if ($previous_btn && $cur_page > 1) {
$pre = $cur_page - 1;
$msg .= "<li p='$pre' class='active'>Previous</li>";
} else if ($previous_btn) {
$msg .= "<li class='inactive'>Previous</li>";
}
for ($i = $start_loop; $i <= $end_loop; $i++) {
if ($cur_page == $i)
$msg .= "<li p='$i' style='color:#fff;background-color:#006699;' class='active'>{$i}</li>";
else
$msg .= "<li p='$i' class='active'>{$i}</li>";
}
// TO ENABLE THE NEXT BUTTON
if ($next_btn && $cur_page < $no_of_paginations) {
$nex = $cur_page + 1;
$msg .= "<li p='$nex' class='active'>Next</li>";
} else if ($next_btn) {
$msg .= "<li class='inactive'>Next</li>";
}
// TO ENABLE THE END BUTTON
if ($last_btn && $cur_page < $no_of_paginations) {
$msg .= "<li p='$no_of_paginations' class='active'>Last</li>";
} else if ($last_btn) {
$msg .= "<li p='$no_of_paginations' class='inactive'>Last</li>";
}
$goto = "<input type='text' class='goto' size='1' style='margin-top:-1px;margin-left:60px;'/><input type='button' id='go_btn' class='go_button' value='Go'/>";
$total_string = "<span class='total' a='$no_of_paginations'>Page <b>" . $cur_page . "</b> of <b>$no_of_paginations</b></span>";
$msg = $msg . "</ul>" . $goto . $total_string . "</div>"; // Content for pagination
echo $msg;
}
3. dbconnect.php, containing login stuff
<?php
$uname="root";
$server="localhost";
$password="root";
$database="testdb";
$bd = mysql_connect($server, $uname, $password) or die("Opps");
mysql_select_db($database, $bd) or die("Opps some thing went wrong");
?>
4. paginator.js, the file with javascript functions.
$(document).ready(function(){
function loading_show(){
$('#loading').html("<img src='/mages/loading.gif'/>").fadeIn('fast');
}
function loading_hide(){
$('#loading').fadeOut('fast');
}
function loadData(page){
loading_show();
$.ajax
({
type: "POST",
url: "load_data.php",
data: "page="+page,
success: function(msg)
{
$("#container").ajaxComplete(function(event, request, settings)
{
loading_hide();
$("#container").html(msg);
});
}
});
}
loadData(1); // For first time page load default results
$('#container .pagination li.active').live('click',function(){
var page = $(this).attr('p');
loadData(page);
});
$('#go_btn').live('click',function(){
var page = parseInt($('.goto').val());
var no_of_pages = parseInt($('.total').attr('a'));
if(page != 0 && page <= no_of_pages){
loadData(page);
}
else{
alert('Enter a PAGE between 1 and '+no_of_pages);
$('.goto').val("").focus();
return false;
}
});
});
And finally, table.css, the file with some basic styling.
body{
width: 800px;
margin: 0 auto;
padding: 0;
}
#loading{
width: 100%;
position: absolute;
top: 100px;
left: 100px;
margin-top:200px;
}
#container .pagination ul li.inactive,
#container .pagination ul li.inactive:hover{
background-color:#ededed;
color:#bababa;
border:1px solid #bababa;
cursor: default;
}
#container .data ul li{
list-style: none;
font-family: verdana;
margin: 5px 0 5px 0;
color: #000;
font-size: 13px;
}
#container .pagination{
width: 800px;
height: 25px;
}
#container .pagination ul li{
list-style: none;
float: left;
border: 1px solid #006699;
padding: 2px 6px 2px 6px;
margin: 0 3px 0 3px;
font-family: arial;
font-size: 14px;
color: #006699;
font-weight: bold;
background-color: #f2f2f2;
}
#container .pagination ul li:hover{
color: #fff;
background-color: #006699;
cursor: pointer;
}
.go_button
{
background-color:#f2f2f2;border:1px solid #006699;color:#cc0000;padding:2px 6px 2px 6px;cursor:pointer;position:absolute;margin-top:-1px;
}
.total
{
float:right;font-family:arial;color:#999;
}
if youre going to replicate this, there is a css folder and a js folder and i have downloaded the jquery 1.5.2 from google. you can replace the line
<script type="text/javascript" src="js/jquery1_5_2_min.js"></script>
in pagination.php with
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
Also, the table being used is
CREATE TABLE student (
id INT PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(150)
);
my
objective here is get rid of all direct mysql query calls inside the files with whatever i can put there using linq. I have used linq extensively with .NET 4.0, so basically what am trying to do here is abstracting the data access layer, as if i were using .NET objects to interface with data instead of pure mysql query calls.
Does this make sense? my end goal is being able to replace all mysql query calls with phplinq and completely isolate the data access code.(If linq is an overkill or somehow inadequate, ill drop it) I dont want to go with any ORM here because am going to heavily customize the grid (In this example there is just a list) and the future Data Access Layer
Am not that proficient with php, so please dont direct me to extensive reading. something i could pick up and play with would be much better
| 0 |
6,110,722 | 05/24/2011 12:53:02 | 650,492 | 03/08/2011 20:53:44 | 4,823 | 285 | In C what does this macro define? | #define NUM_SQ_0 (1 << 1*1) //<<----- ??
static struct square sq_0[NUM_SQ_0];
Note that square is a struct with 4 pointers to square, defined as follows:
typedef struct square {
struct square *nw, *ne,
*sw, *se;
} *square;
| c | define | null | null | null | null | open | In C what does this macro define?
===
#define NUM_SQ_0 (1 << 1*1) //<<----- ??
static struct square sq_0[NUM_SQ_0];
Note that square is a struct with 4 pointers to square, defined as follows:
typedef struct square {
struct square *nw, *ne,
*sw, *se;
} *square;
| 0 |
9,472,364 | 02/27/2012 21:14:00 | 1,236,507 | 02/27/2012 21:01:11 | 1 | 0 | VB.NET don't get a successfull answer of a HTTP-Server | tcpClient.Connect("www.***.com", 80)
Dim message As String = "GET /***.html HTTP/1.1" & Chr(10) & "Host: www.***.com" & Chr(10)
tcpClient.Client.Send(System.Text.Encoding.Default.GetBytes(message))
I tried it with a few websites but it doesn't worked anywhere, I just become a error, that thers an timeout or the request is false and the server couldn't handle it. Here the code for the TcpClient:
Dim tcpClient As New TcpClient
Does anyone know whats wrong? I tried some combinations of the 'message' without Host and so on. | http | get | request | tcpclient | vb.net-2010 | null | open | VB.NET don't get a successfull answer of a HTTP-Server
===
tcpClient.Connect("www.***.com", 80)
Dim message As String = "GET /***.html HTTP/1.1" & Chr(10) & "Host: www.***.com" & Chr(10)
tcpClient.Client.Send(System.Text.Encoding.Default.GetBytes(message))
I tried it with a few websites but it doesn't worked anywhere, I just become a error, that thers an timeout or the request is false and the server couldn't handle it. Here the code for the TcpClient:
Dim tcpClient As New TcpClient
Does anyone know whats wrong? I tried some combinations of the 'message' without Host and so on. | 0 |
6,554,336 | 07/02/2011 00:23:25 | 93,422 | 04/20/2009 20:39:20 | 2,233 | 53 | A term to represent a moment in time (date and time) | Title says it all. For example, I want to use a shorter word for `EventDateAndTime` property.
Is there such word in English language?
> naming is one of the hardest things
> in programming | naming | null | null | null | null | 07/04/2011 02:05:50 | off topic | A term to represent a moment in time (date and time)
===
Title says it all. For example, I want to use a shorter word for `EventDateAndTime` property.
Is there such word in English language?
> naming is one of the hardest things
> in programming | 2 |
9,579,564 | 03/06/2012 07:30:12 | 1,116,045 | 12/26/2011 08:08:55 | 33 | 1 | polish characters in debian command line only installation | I have debian lenny command line installation, I am trying to print polish characters to the command line and I have a Turkish QWERTY keyboard.
If I use `dpkg-reconfigure console-data`
and select pc/qwertz/polish/standard/standard as keyboard layout, instead of ć and ż, console displays diamond ascii code. So I went ahead and changed the default locale to pl_PL using
dpkg-reconfigure locales
then it started to display some weird characters like upside down question mark instead of ć and ż.
On another lenny machine which has graphical user interface, a similar keyboard displays these accented characters fine if I change keyboard preferences to Polish qwertz.
What else can I do to make polish characters work in command line only interface? | command-line | keyboard | debian | polish | null | 03/07/2012 17:58:55 | off topic | polish characters in debian command line only installation
===
I have debian lenny command line installation, I am trying to print polish characters to the command line and I have a Turkish QWERTY keyboard.
If I use `dpkg-reconfigure console-data`
and select pc/qwertz/polish/standard/standard as keyboard layout, instead of ć and ż, console displays diamond ascii code. So I went ahead and changed the default locale to pl_PL using
dpkg-reconfigure locales
then it started to display some weird characters like upside down question mark instead of ć and ż.
On another lenny machine which has graphical user interface, a similar keyboard displays these accented characters fine if I change keyboard preferences to Polish qwertz.
What else can I do to make polish characters work in command line only interface? | 2 |
10,070,360 | 04/09/2012 07:42:33 | 1,208,510 | 02/14/2012 07:09:54 | 409 | 11 | Android: SSO on Twitter | I am getting this error
04-09 13:06:59.463: W/DefaultRequestDirector(4381): Authentication error: Unable to respond to any of these challenges: {oauth=WWW-Authenticate: OAuth realm="http://twitter.com"}
04-09 13:06:59.463: W/System.err(4381): oauth.signpost.exception.OAuthNotAuthorizedException: Authorization failed (server replied with a 401). This can happen if the consumer key was not correct or the signatures did not match.
04-09 13:06:59.472: W/System.err(4381): at oauth.signpost.commonshttp.CommonsHttpOAuthProvider.retrieveToken(CommonsHttpOAuthProvider.java:80)
04-09 13:06:59.472: W/System.err(4381): at oauth.signpost.AbstractOAuthProvider.retrieveRequestToken(AbstractOAuthProvider.java:66)
04-09 13:06:59.472: W/System.err(4381): at com.example.bloa.OAUTH.onCreate(OAUTH.java:66)
I am using this link https://github.com/brione/Brion-Learns-OAuth example. Please can u say me where I am going wrong.. I am getting **USER_TOKEN** keys but not getting **REQUEST_TOKEN** keys can anybody say me how get REQUEST_TOKEN keys..
Thanks in Advacnce..
| android | twitter | single-sign-on | null | null | null | open | Android: SSO on Twitter
===
I am getting this error
04-09 13:06:59.463: W/DefaultRequestDirector(4381): Authentication error: Unable to respond to any of these challenges: {oauth=WWW-Authenticate: OAuth realm="http://twitter.com"}
04-09 13:06:59.463: W/System.err(4381): oauth.signpost.exception.OAuthNotAuthorizedException: Authorization failed (server replied with a 401). This can happen if the consumer key was not correct or the signatures did not match.
04-09 13:06:59.472: W/System.err(4381): at oauth.signpost.commonshttp.CommonsHttpOAuthProvider.retrieveToken(CommonsHttpOAuthProvider.java:80)
04-09 13:06:59.472: W/System.err(4381): at oauth.signpost.AbstractOAuthProvider.retrieveRequestToken(AbstractOAuthProvider.java:66)
04-09 13:06:59.472: W/System.err(4381): at com.example.bloa.OAUTH.onCreate(OAUTH.java:66)
I am using this link https://github.com/brione/Brion-Learns-OAuth example. Please can u say me where I am going wrong.. I am getting **USER_TOKEN** keys but not getting **REQUEST_TOKEN** keys can anybody say me how get REQUEST_TOKEN keys..
Thanks in Advacnce..
| 0 |
9,759,781 | 03/18/2012 16:02:28 | 891,494 | 08/12/2011 09:21:55 | 22 | 0 | how to catch domain url from request coming? | How do I get the IP address of the server a request is coming from. Here's a scenario;
I have two servers - client|server. How can I detect the IP of the client server in java | java | javascript | api | rest | null | null | open | how to catch domain url from request coming?
===
How do I get the IP address of the server a request is coming from. Here's a scenario;
I have two servers - client|server. How can I detect the IP of the client server in java | 0 |
7,764,633 | 10/14/2011 07:53:23 | 684,534 | 03/30/2011 18:53:05 | 567 | 0 | C++0x topics cover | There are many books about C++. But which of advanced books about C++ language covers the current version `C++0x` best? | c++ | books | null | null | null | 10/14/2011 08:37:59 | not constructive | C++0x topics cover
===
There are many books about C++. But which of advanced books about C++ language covers the current version `C++0x` best? | 4 |
4,488,071 | 12/20/2010 08:45:26 | 535,039 | 12/08/2010 13:33:26 | 1 | 0 | How can I store the image in websql(sqllite) ? | I want to store images in websql(sqllite).so please provide the procedure to store images in websql. | html5 | null | null | null | null | 12/21/2010 08:40:00 | not a real question | How can I store the image in websql(sqllite) ?
===
I want to store images in websql(sqllite).so please provide the procedure to store images in websql. | 1 |
9,345,057 | 02/18/2012 23:15:42 | 1,153,935 | 01/17/2012 12:50:53 | 14 | 0 | Load text from txt file | I need to be able to update a date on a site via a txt file (or xml or whatever is easiest).
This is what the html looks like right now, and I need the line "THIS SHOULD BE DYNAMIC" to be loaded from an external file which I easily can update.
<div class="container">
<div>
<h1>LOREM IPSUM:<br />
THIS SHOULD BE DYNAMIC
<div class="separator"></div>
LOREM IPSUM<br />
LOREM IPSUM<br />
LOREM IPSUM</h1>
</div>
</div>
| jquery | text | load | null | null | null | open | Load text from txt file
===
I need to be able to update a date on a site via a txt file (or xml or whatever is easiest).
This is what the html looks like right now, and I need the line "THIS SHOULD BE DYNAMIC" to be loaded from an external file which I easily can update.
<div class="container">
<div>
<h1>LOREM IPSUM:<br />
THIS SHOULD BE DYNAMIC
<div class="separator"></div>
LOREM IPSUM<br />
LOREM IPSUM<br />
LOREM IPSUM</h1>
</div>
</div>
| 0 |
7,919,150 | 10/27/2011 16:24:30 | 1,011,704 | 10/24/2011 21:23:31 | 8 | 2 | Commons vfs findFiles imaginary file | In my quartz job I want to read csv files from directory using commons-vfs.
try {
FileSystemManager fsManager = VFS.getManager();
final FileObject fileObject = fsManager.resolveFile(getJob().getDirectory());
if(fileObject.getType() != FileType.FOLDER) {
throw new FileTransferException("Invalid directory : " + getJob().getDirectory());
}
final FileFilter fileFilter = new FileFilter() {
@Override
public boolean accept(FileSelectInfo fileInfo) {
try {
boolean isCSV = fileInfo.getFile().getName().getBaseName().endsWith(".csv");
logger.debug("TEST : {} {} " + fileInfo.getFile().getName(), fileInfo.getFile().getType() , isCSV);
long fileTime = fileInfo.getFile().getContent().getLastModifiedTime();
return isCSV;
} catch (FileSystemException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return false;
}
}
};
FileSelector selector = new FileFilterSelector(fileFilter);
FileObject[] findFiles = fileObject.findFiles(selector);
for (int i = 0; i < findFiles.length; i++) {
logger.info("Found {} : {}", i, findFiles[i]);
}
} catch(Exception e) {
throw new JobExecutionException(e);
}
In folder have some files, but it throws exeception when I want to check file date and filter too old files.
It also shows strange 'imaginary' as file type - it is real file, itself just found it:
18:13:27.807 DEBUG [AE-Scheduler_Worker-2][CsvImportJob]
TEST : imaginary false file:///e:/some_directory /not_csv.txt
org.apache.commons.vfs2.FileSystemException: Could not determine the last modified timestamp of "file:///e:/some_directory /not_csv.txt" because it does not exist.
at org.apache.commons.vfs2.provider.DefaultFileContent.getLastModifiedTime(DefaultFileContent.java:165)
| java | commons-vfs | null | null | null | null | open | Commons vfs findFiles imaginary file
===
In my quartz job I want to read csv files from directory using commons-vfs.
try {
FileSystemManager fsManager = VFS.getManager();
final FileObject fileObject = fsManager.resolveFile(getJob().getDirectory());
if(fileObject.getType() != FileType.FOLDER) {
throw new FileTransferException("Invalid directory : " + getJob().getDirectory());
}
final FileFilter fileFilter = new FileFilter() {
@Override
public boolean accept(FileSelectInfo fileInfo) {
try {
boolean isCSV = fileInfo.getFile().getName().getBaseName().endsWith(".csv");
logger.debug("TEST : {} {} " + fileInfo.getFile().getName(), fileInfo.getFile().getType() , isCSV);
long fileTime = fileInfo.getFile().getContent().getLastModifiedTime();
return isCSV;
} catch (FileSystemException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return false;
}
}
};
FileSelector selector = new FileFilterSelector(fileFilter);
FileObject[] findFiles = fileObject.findFiles(selector);
for (int i = 0; i < findFiles.length; i++) {
logger.info("Found {} : {}", i, findFiles[i]);
}
} catch(Exception e) {
throw new JobExecutionException(e);
}
In folder have some files, but it throws exeception when I want to check file date and filter too old files.
It also shows strange 'imaginary' as file type - it is real file, itself just found it:
18:13:27.807 DEBUG [AE-Scheduler_Worker-2][CsvImportJob]
TEST : imaginary false file:///e:/some_directory /not_csv.txt
org.apache.commons.vfs2.FileSystemException: Could not determine the last modified timestamp of "file:///e:/some_directory /not_csv.txt" because it does not exist.
at org.apache.commons.vfs2.provider.DefaultFileContent.getLastModifiedTime(DefaultFileContent.java:165)
| 0 |
7,934,595 | 10/28/2011 20:33:45 | 299,128 | 03/22/2010 15:06:56 | 1 | 0 | I am getting this error when i run the home page. htaccess file is pointing to the public/index.php page | Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[08006] [7] FATAL: no pg_hba.conf entry for host "172.20.45.19", user "helios", database "sol_app", SSL off' in /home/aacharya/sol-devel/CVSROOT/SolApp/library/Zend/Db/Adapter/Pdo/Abstract.php:140 Stack trace: #0 /home/aacharya/sol-devel/CVSROOT/SolApp/library/Zend/Db/Adapter/Pdo/Abstract.php(140): PDO->__construct('pgsql:host=sunc...', 'helios', '', Array) #1 /home/aacharya/sol-devel/CVSROOT/SolApp/library/Zend/Db/Adapter/Pdo/Pgsql.php(87): Zend_Db_Adapter_Pdo_Abstract->_connect() #2 /home/aacharya/sol-devel/CVSROOT/SolApp/library/Zend/Db/Adapter/Abstract.php(459): Zend_Db_Adapter_Pdo_Pgsql->_connect() #3 /home/aacharya/sol-devel/CVSROOT/SolApp/library/Zend/Db/Adapter/Pdo/Abstract.php(251): Zend_Db_Adapter_Abstract->query('INSERT INTO "tr...', Array) #4 /home/aacharya/sol-devel/CVSROOT/SolApp/library/Zend/Db/Adapter/Abstract.php(578): Zend_Db_Adapter_Pdo_Abstract->query('INSERT INTO "tr...', Array) #5 /home/aacharya/sol-devel/CVSROOT/SolApp/library/Bus in /home/aacharya/sol-devel/CVSROOT/SolApp/library/Zend/Db/Adapter/Pdo/Abstract.php on line 157 | php | zend-framework | null | null | null | 10/29/2011 01:36:01 | not a real question | I am getting this error when i run the home page. htaccess file is pointing to the public/index.php page
===
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[08006] [7] FATAL: no pg_hba.conf entry for host "172.20.45.19", user "helios", database "sol_app", SSL off' in /home/aacharya/sol-devel/CVSROOT/SolApp/library/Zend/Db/Adapter/Pdo/Abstract.php:140 Stack trace: #0 /home/aacharya/sol-devel/CVSROOT/SolApp/library/Zend/Db/Adapter/Pdo/Abstract.php(140): PDO->__construct('pgsql:host=sunc...', 'helios', '', Array) #1 /home/aacharya/sol-devel/CVSROOT/SolApp/library/Zend/Db/Adapter/Pdo/Pgsql.php(87): Zend_Db_Adapter_Pdo_Abstract->_connect() #2 /home/aacharya/sol-devel/CVSROOT/SolApp/library/Zend/Db/Adapter/Abstract.php(459): Zend_Db_Adapter_Pdo_Pgsql->_connect() #3 /home/aacharya/sol-devel/CVSROOT/SolApp/library/Zend/Db/Adapter/Pdo/Abstract.php(251): Zend_Db_Adapter_Abstract->query('INSERT INTO "tr...', Array) #4 /home/aacharya/sol-devel/CVSROOT/SolApp/library/Zend/Db/Adapter/Abstract.php(578): Zend_Db_Adapter_Pdo_Abstract->query('INSERT INTO "tr...', Array) #5 /home/aacharya/sol-devel/CVSROOT/SolApp/library/Bus in /home/aacharya/sol-devel/CVSROOT/SolApp/library/Zend/Db/Adapter/Pdo/Abstract.php on line 157 | 1 |
11,463,079 | 07/13/2012 01:50:06 | 103,264 | 05/08/2009 01:16:16 | 2,951 | 6 | Titanium vs Sencha - learning curve? | Sencha has a steep learning curve, but how does this compare to titanium? is titanium easier to learn? | javascript | sencha-touch | titanium | sencha | titanium-mobile | 07/18/2012 02:33:40 | not constructive | Titanium vs Sencha - learning curve?
===
Sencha has a steep learning curve, but how does this compare to titanium? is titanium easier to learn? | 4 |
3,616,224 | 09/01/2010 08:30:05 | 345,847 | 05/20/2010 07:53:50 | 56 | 1 | JPQL ORDER BY clause with parameter | I'm trying to write a JPQL Query with an ORDER BY clause:
query = "SELECT c FROM item ORDER BY c.name ASC"
I would like to set an "order" parameter, whose value would be either "ASC" or "DESC":
query = "SELECT c FROM item ORDER BY c.name :order"
And then in my implementation:
query.setParameter("order", "ASC");
This is when I get an Hibernate error:
org.hibernate.HibernateException: Errors in named queries
Any idea on what I'm doing wrong? Thanks! | hibernate | ejb-3.0 | order-by | jpql | null | null | open | JPQL ORDER BY clause with parameter
===
I'm trying to write a JPQL Query with an ORDER BY clause:
query = "SELECT c FROM item ORDER BY c.name ASC"
I would like to set an "order" parameter, whose value would be either "ASC" or "DESC":
query = "SELECT c FROM item ORDER BY c.name :order"
And then in my implementation:
query.setParameter("order", "ASC");
This is when I get an Hibernate error:
org.hibernate.HibernateException: Errors in named queries
Any idea on what I'm doing wrong? Thanks! | 0 |
11,009,296 | 06/13/2012 06:24:58 | 1,435,226 | 06/04/2012 13:08:22 | 11 | 0 | XSS VULNERABILITY FOR XML -- response.getWriter().write(xml.toString()); | I need to fix a issue for xss vulnerability. the code segment is below.
StringBuffer xml = new StringBuffer();
xml.append("<?xml version=\"1.0\"?>");
xml.append("<parent>");
xml.append("<child>");
for(int cntr=0; cntr < dataList.size(); cntr++){
AAAAA obj = (AAAAA) dataList.get(cntr);
if(obj.getStatus().equals(Constants.ACTIVE)){
xml.append("<accountNumber>");
xml.append(obj.getAccountNumber());
xml.append("</accountNumber>");
xml.append("<partnerName>");
xml.append(obj.getPartnerName());
xml.append("</partnerName>");
xml.append("<accountType>");
xml.append(obj.getAccountType());
xml.append("</accountType>");
xml.append("<priority>");
xml.append(obj.getPriority());
xml.append("</priority>");
}
}
xml.append("</child>");
xml.append("</parent>");
response.getWriter().write(xml.toString());
response.setContentType("text/xml");
response.setHeader("Cache-Control", "no-cache");
The issue is at the line having the syntax response.getWriter().write(xml.toString()); It says that it is vulnerable for xss attack. I have done sufficient home work and also installed ESAPI 2.0. but I donot know how to implement the solutions.
Please suggest a solution. | java | xml | xss | null | null | null | open | XSS VULNERABILITY FOR XML -- response.getWriter().write(xml.toString());
===
I need to fix a issue for xss vulnerability. the code segment is below.
StringBuffer xml = new StringBuffer();
xml.append("<?xml version=\"1.0\"?>");
xml.append("<parent>");
xml.append("<child>");
for(int cntr=0; cntr < dataList.size(); cntr++){
AAAAA obj = (AAAAA) dataList.get(cntr);
if(obj.getStatus().equals(Constants.ACTIVE)){
xml.append("<accountNumber>");
xml.append(obj.getAccountNumber());
xml.append("</accountNumber>");
xml.append("<partnerName>");
xml.append(obj.getPartnerName());
xml.append("</partnerName>");
xml.append("<accountType>");
xml.append(obj.getAccountType());
xml.append("</accountType>");
xml.append("<priority>");
xml.append(obj.getPriority());
xml.append("</priority>");
}
}
xml.append("</child>");
xml.append("</parent>");
response.getWriter().write(xml.toString());
response.setContentType("text/xml");
response.setHeader("Cache-Control", "no-cache");
The issue is at the line having the syntax response.getWriter().write(xml.toString()); It says that it is vulnerable for xss attack. I have done sufficient home work and also installed ESAPI 2.0. but I donot know how to implement the solutions.
Please suggest a solution. | 0 |
9,818,407 | 03/22/2012 08:02:24 | 1,008,203 | 10/22/2011 05:41:36 | 39 | 5 | Custom Listview Out of Memory Error in android | I am getting out of memory error for custom listview case.
the logcat is like the following..
03-22 13:19:15.222: E/AndroidRuntime(21239): FATAL EXCEPTION: main
03-22 13:19:15.222: E/AndroidRuntime(21239): java.lang.OutOfMemoryError: (Heap Size=19911KB, Allocated=8715KB, Bitmap Size=185KB)
03-22 13:19:15.222: E/AndroidRuntime(21239): at java.util.ArrayList.addAll(ArrayList.java:203)
03-22 13:19:15.222: E/AndroidRuntime(21239): at com.live2support.BaseActivity$CustomAdapter.getView(BaseActivity.java:709)
03-22 13:19:15.222: E/AndroidRuntime(21239): at android.widget.AbsListView.obtainView(AbsListView.java:1428)
03-22 13:19:15.222: E/AndroidRuntime(21239): at android.widget.ListView.makeAndAddView(ListView.java:1801)
03-22 13:19:15.222: E/AndroidRuntime(21239): at android.widget.ListView.fillDown(ListView.java:671)
03-22 13:19:15.222: E/AndroidRuntime(21239): at android.widget.ListView.fillGap(ListView.java:642)
03-22 13:19:15.222: E/AndroidRuntime(21239): at android.widget.AbsListView.trackMotionScroll(AbsListView.java:3452)
03-22 13:19:15.222: E/AndroidRuntime(21239): at android.widget.AbsListView$FlingRunnable.run(AbsListView.java:2950)
03-22 13:19:15.222: E/AndroidRuntime(21239): at android.os.Handler.handleCallback(Handler.java:587)
03-22 13:19:15.222: E/AndroidRuntime(21239): at android.os.Handler.dispatchMessage(Handler.java:92)
03-22 13:19:15.222: E/AndroidRuntime(21239): at android.os.Looper.loop(Looper.java:150)
03-22 13:19:15.222: E/AndroidRuntime(21239): at android.app.ActivityThread.main(ActivityThread.java:4389)
03-22 13:19:15.222: E/AndroidRuntime(21239): at java.lang.reflect.Method.invokeNative(Native Method)
03-22 13:19:15.222: E/AndroidRuntime(21239): at java.lang.reflect.Method.invoke(Method.java:507)
03-22 13:19:15.222: E/AndroidRuntime(21239): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:849)
03-22 13:19:15.222: E/AndroidRuntime(21239): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:607)
03-22 13:19:15.222: E/AndroidRuntime(21239): at dalvik.system.NativeStart.main(Native Method)
| android | null | null | null | null | null | open | Custom Listview Out of Memory Error in android
===
I am getting out of memory error for custom listview case.
the logcat is like the following..
03-22 13:19:15.222: E/AndroidRuntime(21239): FATAL EXCEPTION: main
03-22 13:19:15.222: E/AndroidRuntime(21239): java.lang.OutOfMemoryError: (Heap Size=19911KB, Allocated=8715KB, Bitmap Size=185KB)
03-22 13:19:15.222: E/AndroidRuntime(21239): at java.util.ArrayList.addAll(ArrayList.java:203)
03-22 13:19:15.222: E/AndroidRuntime(21239): at com.live2support.BaseActivity$CustomAdapter.getView(BaseActivity.java:709)
03-22 13:19:15.222: E/AndroidRuntime(21239): at android.widget.AbsListView.obtainView(AbsListView.java:1428)
03-22 13:19:15.222: E/AndroidRuntime(21239): at android.widget.ListView.makeAndAddView(ListView.java:1801)
03-22 13:19:15.222: E/AndroidRuntime(21239): at android.widget.ListView.fillDown(ListView.java:671)
03-22 13:19:15.222: E/AndroidRuntime(21239): at android.widget.ListView.fillGap(ListView.java:642)
03-22 13:19:15.222: E/AndroidRuntime(21239): at android.widget.AbsListView.trackMotionScroll(AbsListView.java:3452)
03-22 13:19:15.222: E/AndroidRuntime(21239): at android.widget.AbsListView$FlingRunnable.run(AbsListView.java:2950)
03-22 13:19:15.222: E/AndroidRuntime(21239): at android.os.Handler.handleCallback(Handler.java:587)
03-22 13:19:15.222: E/AndroidRuntime(21239): at android.os.Handler.dispatchMessage(Handler.java:92)
03-22 13:19:15.222: E/AndroidRuntime(21239): at android.os.Looper.loop(Looper.java:150)
03-22 13:19:15.222: E/AndroidRuntime(21239): at android.app.ActivityThread.main(ActivityThread.java:4389)
03-22 13:19:15.222: E/AndroidRuntime(21239): at java.lang.reflect.Method.invokeNative(Native Method)
03-22 13:19:15.222: E/AndroidRuntime(21239): at java.lang.reflect.Method.invoke(Method.java:507)
03-22 13:19:15.222: E/AndroidRuntime(21239): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:849)
03-22 13:19:15.222: E/AndroidRuntime(21239): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:607)
03-22 13:19:15.222: E/AndroidRuntime(21239): at dalvik.system.NativeStart.main(Native Method)
| 0 |
11,287,812 | 07/02/2012 04:31:33 | 1,495,131 | 07/02/2012 04:25:51 | 1 | 0 | Adding powers. Completely stumped on this | Can anyone show me how I can do this? Thanks.
The program needs to define a function sumPower, which should accept a list of numbers. Function sumPower should then use each item in the list as an exponent on the number 2. This function should add these powers and return the sum. You should also make sure to write a main program with a statement like:
print( sumPower([2,4,6]) )
| python | null | null | null | null | 07/02/2012 14:20:11 | not a real question | Adding powers. Completely stumped on this
===
Can anyone show me how I can do this? Thanks.
The program needs to define a function sumPower, which should accept a list of numbers. Function sumPower should then use each item in the list as an exponent on the number 2. This function should add these powers and return the sum. You should also make sure to write a main program with a statement like:
print( sumPower([2,4,6]) )
| 1 |
2,789,306 | 05/07/2010 14:31:17 | 104,815 | 05/11/2009 14:10:21 | 1,044 | 89 | Javascript - Get callback info back to original calling function. | Let's say you have a Javascript function that calls a web service method. So that webservice completes and calls a callback function, which has the result.
How do I get that result back into the original function that called the web service method? Essentially, I'm trying to "synchronize" an asynchronous call.
| asp.net | javascript | jquery | web-services | null | null | open | Javascript - Get callback info back to original calling function.
===
Let's say you have a Javascript function that calls a web service method. So that webservice completes and calls a callback function, which has the result.
How do I get that result back into the original function that called the web service method? Essentially, I'm trying to "synchronize" an asynchronous call.
| 0 |
5,836,484 | 04/29/2011 19:26:08 | 634,619 | 02/25/2011 17:47:50 | 6 | 1 | problem minus in mysql in subtratcting group data | i have three table
member (**memberid**,m_name,statusid,address,DOB,phone)
booking (**bookingid**, memberid ,sessionid, cost)
session(**sessionid**, activity,location)
(fk memberid, fk sessionid )BOOKING IS link with ( member pk )and (session pk)
session activity is like football,swimming,badminton,tennis
i want to run the following query
find the name of all member who have booked any session for 'football', but not any session for 'swimming' during december 2009
-----------------------------------------------------------------------------------------
sql
select DISTINCT Event1.m_name ,Event1.activity
FROM
(
select mm.m_name,ss.activity,ss.sessionid,ss.s_date
from member mm
inner join booking bb on bb.memberid = mm.memberid
inner join session ss on ss.sessionid = bb.sessionid
where activity = 'football'
)as Event1
INNER JOIN
(
select mm.m_name ,ss.activity,ss.sessionid,ss.s_date
from member mm
inner join booking bb on bb.memberid = mm.memberid
inner join session ss on ss.sessionid = bb.sessionid
where mm.memberid not in
(
select mm.memberid
from member mm
inner join booking bb
on bb.bookingid = mm.memberid
inner join session ss
on bb.sessionid = ss.sessionid
where ss.activity in ( 'swimming')
)
) as Event2
on Event1.sessionid = Event2.sessionid
what im doing wrong it return me memeber who have book football and swmming. | mysql | database | query | null | null | null | open | problem minus in mysql in subtratcting group data
===
i have three table
member (**memberid**,m_name,statusid,address,DOB,phone)
booking (**bookingid**, memberid ,sessionid, cost)
session(**sessionid**, activity,location)
(fk memberid, fk sessionid )BOOKING IS link with ( member pk )and (session pk)
session activity is like football,swimming,badminton,tennis
i want to run the following query
find the name of all member who have booked any session for 'football', but not any session for 'swimming' during december 2009
-----------------------------------------------------------------------------------------
sql
select DISTINCT Event1.m_name ,Event1.activity
FROM
(
select mm.m_name,ss.activity,ss.sessionid,ss.s_date
from member mm
inner join booking bb on bb.memberid = mm.memberid
inner join session ss on ss.sessionid = bb.sessionid
where activity = 'football'
)as Event1
INNER JOIN
(
select mm.m_name ,ss.activity,ss.sessionid,ss.s_date
from member mm
inner join booking bb on bb.memberid = mm.memberid
inner join session ss on ss.sessionid = bb.sessionid
where mm.memberid not in
(
select mm.memberid
from member mm
inner join booking bb
on bb.bookingid = mm.memberid
inner join session ss
on bb.sessionid = ss.sessionid
where ss.activity in ( 'swimming')
)
) as Event2
on Event1.sessionid = Event2.sessionid
what im doing wrong it return me memeber who have book football and swmming. | 0 |
3,958,141 | 10/18/2010 10:11:18 | 366,053 | 06/14/2010 06:02:58 | 42 | 0 | Android: Issue working on background thread. | I am working on an application to sync contacts which are large in number.
The syncing takes place in a background thread with user being able to browse through the rest of the application. I am displaying the sync status in the notification bar suing the progress bar.
The problem I am facing is that there are instances when the activity is killed and hence the background thread used for syncing the contacts is purged.
Can this situation be avoided in any case?
| android | null | null | null | null | null | open | Android: Issue working on background thread.
===
I am working on an application to sync contacts which are large in number.
The syncing takes place in a background thread with user being able to browse through the rest of the application. I am displaying the sync status in the notification bar suing the progress bar.
The problem I am facing is that there are instances when the activity is killed and hence the background thread used for syncing the contacts is purged.
Can this situation be avoided in any case?
| 0 |
11,242,143 | 06/28/2012 09:55:11 | 795,651 | 06/13/2011 09:01:23 | 129 | 1 | Getting Facebook account details | I am using Sharekit for Facebook and Twitter and i would like to get the Facebook account details like User id,Profile Name etc.please give your suggestions and help.I had got the details before but now i am not able to retrieve it.
Please find the code below,
if ([[NSUserDefaults standardUserDefaults] objectForKey:@"kSHKFacebookUserInfo"]){
NSDictionary *facebookUserInfo = [[NSUserDefaults standardUserDefaults] objectForKey:@"kSHKFacebookUserInfo"];
fbUseremail = [facebookUserInfo objectForKey:@"email"];
NSLog(@"FBid-- %@",fbUseremail);
}
if ([[NSUserDefaults standardUserDefaults] objectForKey:@"kSHKFacebookUserInfo"]){
NSDictionary *facebookUserInfo = [[NSUserDefaults standardUserDefaults] objectForKey:@"kSHKFacebookUserInfo"];
fbUserName = [facebookUserInfo objectForKey:@"name"];
NSLog(@"FBName-- %@",fbUserName);
}
Now it gets crashed as the facebookUserInfo is NULL. | iphone | ios5 | sharekit | null | null | null | open | Getting Facebook account details
===
I am using Sharekit for Facebook and Twitter and i would like to get the Facebook account details like User id,Profile Name etc.please give your suggestions and help.I had got the details before but now i am not able to retrieve it.
Please find the code below,
if ([[NSUserDefaults standardUserDefaults] objectForKey:@"kSHKFacebookUserInfo"]){
NSDictionary *facebookUserInfo = [[NSUserDefaults standardUserDefaults] objectForKey:@"kSHKFacebookUserInfo"];
fbUseremail = [facebookUserInfo objectForKey:@"email"];
NSLog(@"FBid-- %@",fbUseremail);
}
if ([[NSUserDefaults standardUserDefaults] objectForKey:@"kSHKFacebookUserInfo"]){
NSDictionary *facebookUserInfo = [[NSUserDefaults standardUserDefaults] objectForKey:@"kSHKFacebookUserInfo"];
fbUserName = [facebookUserInfo objectForKey:@"name"];
NSLog(@"FBName-- %@",fbUserName);
}
Now it gets crashed as the facebookUserInfo is NULL. | 0 |
10,731,488 | 05/24/2012 05:10:59 | 1,411,658 | 05/23/2012 04:19:46 | 1 | 0 | how to create a queue in c#.net? | the kind of program that i actually want to write is:there are different data that comes in from a server and we have to send that data to another server,and among that data we have to filter data,make some internal calculation from our side and then we have to send,for that my idea is to create a queue ,where data can reside for a fixed time..we will do internal calculation and send and at that time other data that are coming will reside in another queue..and after the first queue is executed ,then we can do internal calculation for another queue but cant get idea ,about how to implement queue in c#.net? | c# | .net | null | null | null | 05/24/2012 11:22:42 | not a real question | how to create a queue in c#.net?
===
the kind of program that i actually want to write is:there are different data that comes in from a server and we have to send that data to another server,and among that data we have to filter data,make some internal calculation from our side and then we have to send,for that my idea is to create a queue ,where data can reside for a fixed time..we will do internal calculation and send and at that time other data that are coming will reside in another queue..and after the first queue is executed ,then we can do internal calculation for another queue but cant get idea ,about how to implement queue in c#.net? | 1 |
5,582,800 | 04/07/2011 14:35:01 | 121,143 | 06/11/2009 08:07:37 | 122 | 4 | I used Office Web Components (OWC), what now? | I have simple Windows application entirely based on these Microsoft technologies:
- **Office Web Components (OWC)** as front-end
- **OLEDB Provider for OLAP Services** as back-end
OLEDB Provider reads data from several ODBC sources, builds cube file and client simply shows OWC ActiveX connected to this generated cube file. User can use dimensions and measures from cube file and create graphs or pivot tables, filter data, drill-down, use some MDX syntax... everything that OWC supports.
My customer loves simplicity of GUI of OWC. There is terrible limitation within (64K rows in dimension) but worse is that **Microsoft completely abandoned OWC development**. It looks like there isn't any natural successor of OWC. I guess there is some solution with Excel as front-end and MS SQL server and back-end. My priorities are:
* same or similar GUI as OWC (Excel fits)
* "cube in a transportable file" concept (?)
What technologies should I use now?
Thanks
| microsoft | components | office | replacement | null | null | open | I used Office Web Components (OWC), what now?
===
I have simple Windows application entirely based on these Microsoft technologies:
- **Office Web Components (OWC)** as front-end
- **OLEDB Provider for OLAP Services** as back-end
OLEDB Provider reads data from several ODBC sources, builds cube file and client simply shows OWC ActiveX connected to this generated cube file. User can use dimensions and measures from cube file and create graphs or pivot tables, filter data, drill-down, use some MDX syntax... everything that OWC supports.
My customer loves simplicity of GUI of OWC. There is terrible limitation within (64K rows in dimension) but worse is that **Microsoft completely abandoned OWC development**. It looks like there isn't any natural successor of OWC. I guess there is some solution with Excel as front-end and MS SQL server and back-end. My priorities are:
* same or similar GUI as OWC (Excel fits)
* "cube in a transportable file" concept (?)
What technologies should I use now?
Thanks
| 0 |
10,576,468 | 05/14/2012 00:58:46 | 1,377,453 | 05/05/2012 23:55:24 | 6 | 0 | load new webpage after loading the present one | `Goal:
I have a text file which consists of list of URLs separated by '\n'.
My goal is to pass them into an array and load them sequentially after a page gets loaded.
My code:
`<html>
<head> </head>
<script type="text/javascript">
var allText =[];
var allTextLines = [];
var Lines = [];
var txtFile = new XMLHttpRequest();
txtFile.open("GET", "URL.txt", true);
var i=0;
txtFile.onreadystatechange = function URL()
{
if (txtFile.readyState == 4)
{
allText = txtFile.responseText;
allTextLines = allText.split(/\r\n|\n/);
document.write(allText);
window.location.href=allTextLines[i++];
window.onload=setTimeout(URL,1000);
}
}
txtFile.send(null);
</script>
</html>`
I tried for loop. But, the browser keeps stuck in processing.
Any insights on how to do it
Any help will be greatly appreciated.
Thanks. | javascript | null | null | null | null | null | open | load new webpage after loading the present one
===
`Goal:
I have a text file which consists of list of URLs separated by '\n'.
My goal is to pass them into an array and load them sequentially after a page gets loaded.
My code:
`<html>
<head> </head>
<script type="text/javascript">
var allText =[];
var allTextLines = [];
var Lines = [];
var txtFile = new XMLHttpRequest();
txtFile.open("GET", "URL.txt", true);
var i=0;
txtFile.onreadystatechange = function URL()
{
if (txtFile.readyState == 4)
{
allText = txtFile.responseText;
allTextLines = allText.split(/\r\n|\n/);
document.write(allText);
window.location.href=allTextLines[i++];
window.onload=setTimeout(URL,1000);
}
}
txtFile.send(null);
</script>
</html>`
I tried for loop. But, the browser keeps stuck in processing.
Any insights on how to do it
Any help will be greatly appreciated.
Thanks. | 0 |
8,499,998 | 12/14/2011 05:45:24 | 475,063 | 10/13/2010 21:27:42 | 1 | 1 | What is the best BIG scale application based on .NET | I really need's some sample of .Net based applications.
There are too many samples for applications based on PHP Like Facebook or Twitter, But I can't find any interesting application on .Net platform.
also except Stackoverflow ;) | .net | null | null | null | null | 12/14/2011 05:53:11 | not constructive | What is the best BIG scale application based on .NET
===
I really need's some sample of .Net based applications.
There are too many samples for applications based on PHP Like Facebook or Twitter, But I can't find any interesting application on .Net platform.
also except Stackoverflow ;) | 4 |
11,422,468 | 07/10/2012 21:41:49 | 1,516,068 | 07/10/2012 21:23:59 | 1 | 0 | Need to find Jquery solution to reset all input, or textarea decendants of a given class | <script type="text/javascript">
function toggle_visibility(classname) {
//Before toggle the decendants of the given DIV, I want to reset all input text, or textarea to blank
// ???
$("." + classname).find('DIV').toggle();
}
</script>
<div class="level1">level1: This is level1 heading
<div class="level2">Leve 2<input type="checkbox" onclick="toggle_visibility('level2');" />
<div class="level3">level3<input type="checkbox" onclick="toggle_visibility('level3');" />
<div class="level4a">level 4a<input type="text" value=""/></div>
<div class="level4b">level 4b<input type="text" value=""/></div>
</div>
</div>
<div>level3b</div>
</div>
| jquery | reset | children | null | null | 07/11/2012 23:57:42 | not a real question | Need to find Jquery solution to reset all input, or textarea decendants of a given class
===
<script type="text/javascript">
function toggle_visibility(classname) {
//Before toggle the decendants of the given DIV, I want to reset all input text, or textarea to blank
// ???
$("." + classname).find('DIV').toggle();
}
</script>
<div class="level1">level1: This is level1 heading
<div class="level2">Leve 2<input type="checkbox" onclick="toggle_visibility('level2');" />
<div class="level3">level3<input type="checkbox" onclick="toggle_visibility('level3');" />
<div class="level4a">level 4a<input type="text" value=""/></div>
<div class="level4b">level 4b<input type="text" value=""/></div>
</div>
</div>
<div>level3b</div>
</div>
| 1 |
11,569,073 | 07/19/2012 20:49:08 | 1,259,799 | 03/09/2012 17:01:04 | 22 | 1 | Track geocoin programmatically in xcode | I've done quite big research but didn't managed to find any information how could I track geocoin in my iPhone program. Any one has any ideas how to make it possible?
Thanks for any help or info. | iphone | ios | xcode | geolocation | gps | 07/20/2012 17:10:33 | not a real question | Track geocoin programmatically in xcode
===
I've done quite big research but didn't managed to find any information how could I track geocoin in my iPhone program. Any one has any ideas how to make it possible?
Thanks for any help or info. | 1 |
11,593,643 | 07/21/2012 15:55:39 | 1,319,802 | 04/08/2012 02:06:51 | 35 | 0 | How to choose my new career? to be a SW developer? to be a SW tester? | I did electronics design and embedded software (e.g. Linux driver) in the past several years. Now I have a chance to change the direction of my career. And I decided not to do HW design any more and applied some SW positions. In fact, to be a SW developer is my dream!
Recently I may get a high level tester position (architect level), and it allows me to study the whole system. I was told there is also programming work. But I really want to be a SW developer: I like the feeling to create something and grasp more and more programming skills.
I feel very contradictory! I don't know how to make the decision.
Hope to get your feedback!
BR | tester | null | null | null | null | 07/21/2012 18:13:08 | not constructive | How to choose my new career? to be a SW developer? to be a SW tester?
===
I did electronics design and embedded software (e.g. Linux driver) in the past several years. Now I have a chance to change the direction of my career. And I decided not to do HW design any more and applied some SW positions. In fact, to be a SW developer is my dream!
Recently I may get a high level tester position (architect level), and it allows me to study the whole system. I was told there is also programming work. But I really want to be a SW developer: I like the feeling to create something and grasp more and more programming skills.
I feel very contradictory! I don't know how to make the decision.
Hope to get your feedback!
BR | 4 |
4,812,956 | 01/27/2011 05:10:12 | 587,133 | 01/24/2011 06:58:42 | 11 | 0 | java error missing return statement | package com.cordys.report;
import java.io.FileInputStream;
import org.apache.commons.codec.binary.Base64;
public class Encode
{
public static String encodeFileStream(String filePath) //file path ex : C:\Program Files\Cordys\Web\reports\I0001180.pdf
{
try
{
FileInputStream fin = new FileInputStream("E:/CSS Document/Test.pdf");
StringBuffer sb=new StringBuffer();
int lineLength = 72;
byte[] buf = new byte[lineLength/4*3];
while (true)
{
int len = fin.read(buf);
if (len <= 0)
{
break;
}
//new Base64().encode(byte);
//sb.append(Base64.encode(buf));
//sb.append(Base64.encodeBase64(buf));
Base64 b = new Base64();
sb.append(b.encode(buf));
return sb.toString();
}
}
catch(Exception e)
{
return e.getMessage();
}
}
} | java | null | null | null | null | 02/21/2012 11:47:37 | not a real question | java error missing return statement
===
package com.cordys.report;
import java.io.FileInputStream;
import org.apache.commons.codec.binary.Base64;
public class Encode
{
public static String encodeFileStream(String filePath) //file path ex : C:\Program Files\Cordys\Web\reports\I0001180.pdf
{
try
{
FileInputStream fin = new FileInputStream("E:/CSS Document/Test.pdf");
StringBuffer sb=new StringBuffer();
int lineLength = 72;
byte[] buf = new byte[lineLength/4*3];
while (true)
{
int len = fin.read(buf);
if (len <= 0)
{
break;
}
//new Base64().encode(byte);
//sb.append(Base64.encode(buf));
//sb.append(Base64.encodeBase64(buf));
Base64 b = new Base64();
sb.append(b.encode(buf));
return sb.toString();
}
}
catch(Exception e)
{
return e.getMessage();
}
}
} | 1 |
4,613,536 | 01/06/2011 09:40:39 | 553,104 | 12/24/2010 07:38:03 | 11 | 0 | In Java's property name, which name is more correct ? | In Java's property name, which name is more correct ?
1.createDate
2.creationDate
3.createdDate
4.others
Please tell me a better expression, because, I'm Japanese. | java | jaxb | properties | expression | name | null | open | In Java's property name, which name is more correct ?
===
In Java's property name, which name is more correct ?
1.createDate
2.creationDate
3.createdDate
4.others
Please tell me a better expression, because, I'm Japanese. | 0 |
10,791,608 | 05/28/2012 23:55:52 | 1,290,030 | 03/24/2012 14:00:36 | 27 | 4 | Get bites from AVAudioRecorder | Hello I'm kind of new in iOS and I have a particular task, first I record a sound with AVAudioRecorder and I can record and play it without troubles, but I need to get the data in bites of the record here are my functions:
@interface recordViewController : UIViewController <AVAudioRecorderDelegate, AVAudioPlayerDelegate>
{
AVAudioRecorder *audioRecorder;
AVAudioPlayer *audioPlayer;
UIButton *playButton;
UIButton *recordButton;
UIButton *stopButton;
}
Record:
-(void) recordAudio {
if (!audioRecorder.recording)
{
playButton.enabled = NO;
stopButton.enabled = YES;
[audioRecorder record];
}
}
Play:
-(void) playAudio {
if (!audioRecorder.recording)
{
stopButton.enabled = YES;
recordButton.enabled = NO;
NSError *error;
audioPlayer = [[AVAudioPlayer alloc]
initWithContentsOfURL:audioRecorder.url
error:&error];
audioPlayer.delegate = self;
if (error)
NSLog(@"Error: %@", [error localizedDescription]);
else
[audioPlayer play];
}
}
How can I get the data in bites of the record? I searched in iOS Developer API and I cant find anything, Thanks in advanced.
| ios | ios5 | avaudiorecorder | null | null | null | open | Get bites from AVAudioRecorder
===
Hello I'm kind of new in iOS and I have a particular task, first I record a sound with AVAudioRecorder and I can record and play it without troubles, but I need to get the data in bites of the record here are my functions:
@interface recordViewController : UIViewController <AVAudioRecorderDelegate, AVAudioPlayerDelegate>
{
AVAudioRecorder *audioRecorder;
AVAudioPlayer *audioPlayer;
UIButton *playButton;
UIButton *recordButton;
UIButton *stopButton;
}
Record:
-(void) recordAudio {
if (!audioRecorder.recording)
{
playButton.enabled = NO;
stopButton.enabled = YES;
[audioRecorder record];
}
}
Play:
-(void) playAudio {
if (!audioRecorder.recording)
{
stopButton.enabled = YES;
recordButton.enabled = NO;
NSError *error;
audioPlayer = [[AVAudioPlayer alloc]
initWithContentsOfURL:audioRecorder.url
error:&error];
audioPlayer.delegate = self;
if (error)
NSLog(@"Error: %@", [error localizedDescription]);
else
[audioPlayer play];
}
}
How can I get the data in bites of the record? I searched in iOS Developer API and I cant find anything, Thanks in advanced.
| 0 |
7,228,175 | 08/29/2011 09:08:07 | 204,682 | 11/06/2009 10:11:00 | 989 | 36 | How can you know if a stream is closed? | I have a method with a Stream for input :
public void Export(Stream finalOutPutStream)
For test purposes, i call it with a memory stream, like this :
// When
_exporter.Export(new System.IO.MemoryStream());
But when, in the method, i want to write on this memory stream, i get a ObjectDisposedException.
This stream is not enclosed in a using statement, i do not call explicitely .Dispose().
What happened ?
Thanks :) | c# | stream | null | null | null | 04/30/2012 18:30:34 | too localized | How can you know if a stream is closed?
===
I have a method with a Stream for input :
public void Export(Stream finalOutPutStream)
For test purposes, i call it with a memory stream, like this :
// When
_exporter.Export(new System.IO.MemoryStream());
But when, in the method, i want to write on this memory stream, i get a ObjectDisposedException.
This stream is not enclosed in a using statement, i do not call explicitely .Dispose().
What happened ?
Thanks :) | 3 |
9,821,903 | 03/22/2012 12:04:28 | 461,581 | 09/29/2010 09:57:48 | 66 | 2 | c# why can't we override static property ? (how can high level classes call base class method with high level data) | My question is probably not well phrased and it's probably a dupe but here I go
class person {
protected static string request = "select * from person where gender in ('male','female')";
public string sharedmethod()
{
return "the request is" + request;
}
}
class man:person
{
override protected static string request = "select person.*,man.* from person,men where mytype in ('male') ";
DateTime dateOfFirstCar;
}
class woman:person
{
override protected static string request = "select person.*,woman.* from person,women where mytype in ('female') ";
DateTime dateOfFirstITBAG;
}
class Program
{
static void Main(string[] args)
{
if (new person().sharedmethod() == new man().sharedmethod())
Console.Write("result of ");
}
}
A man is a person
A woman is a person
Person,man,woman exist in my database but need different queries
I don't want to duplicate those queries so I thought it was a good idea to store them in a static property in each class.
I got some low level stuff (not figured there) that lie in the base class (coz I don't want to duplicate) and I wanted inherited classes to call base class method with the context of the herited classes
I want man.[inherited]somemethod() to execute person.somemethod() but with variables coming from man
thank you | c# | inherit | null | null | null | null | open | c# why can't we override static property ? (how can high level classes call base class method with high level data)
===
My question is probably not well phrased and it's probably a dupe but here I go
class person {
protected static string request = "select * from person where gender in ('male','female')";
public string sharedmethod()
{
return "the request is" + request;
}
}
class man:person
{
override protected static string request = "select person.*,man.* from person,men where mytype in ('male') ";
DateTime dateOfFirstCar;
}
class woman:person
{
override protected static string request = "select person.*,woman.* from person,women where mytype in ('female') ";
DateTime dateOfFirstITBAG;
}
class Program
{
static void Main(string[] args)
{
if (new person().sharedmethod() == new man().sharedmethod())
Console.Write("result of ");
}
}
A man is a person
A woman is a person
Person,man,woman exist in my database but need different queries
I don't want to duplicate those queries so I thought it was a good idea to store them in a static property in each class.
I got some low level stuff (not figured there) that lie in the base class (coz I don't want to duplicate) and I wanted inherited classes to call base class method with the context of the herited classes
I want man.[inherited]somemethod() to execute person.somemethod() but with variables coming from man
thank you | 0 |
9,950,255 | 03/30/2012 20:50:46 | 379,235 | 06/29/2010 16:45:28 | 1,535 | 27 | numpy: is there any driver to load data from mongodb? | - I have a large collection in mongo
- I want to load the data in numpy ndarray
- is there a way to load data from mongodb without iterating through pymongo. something like [R-Mongo][1]
[1]: https://github.com/tc/RMongo | python | mongodb | numpy | null | null | null | open | numpy: is there any driver to load data from mongodb?
===
- I have a large collection in mongo
- I want to load the data in numpy ndarray
- is there a way to load data from mongodb without iterating through pymongo. something like [R-Mongo][1]
[1]: https://github.com/tc/RMongo | 0 |
6,955,922 | 08/05/2011 12:02:24 | 663,905 | 03/17/2011 08:01:32 | 47 | 0 | How to upload JSON Object to PHP? | I have Activity, in my Activity has Button,When click button create one JSON object.
I want post that JSON object in PHP.I search for that,I got so many solution.But i dont
understand what is going there.pls explain and send sample code plz.
pls help thanks | android | null | null | null | null | 08/05/2011 13:27:54 | not a real question | How to upload JSON Object to PHP?
===
I have Activity, in my Activity has Button,When click button create one JSON object.
I want post that JSON object in PHP.I search for that,I got so many solution.But i dont
understand what is going there.pls explain and send sample code plz.
pls help thanks | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.