I am new to android
i want to develope Calendar application that shows events of current day.
it should fling to next or previous day
Thanks and Regards
Sasil
I have table 'products' and I need to update 'price' field by 20% if product 'type' field is "imported".
How do I read and update field at the same time in my UPDATE query?
How i can create pop-up window (with some text)when focus on TextInput (like in windows xp when i focus mouse cursor on file it shows short info).
ps: example of pop-up in windows xp
I'v followed a tutorial to use OGL tesselaton. In one of the callbacks there is a malloc and it creates a leak every time I render a new frame.
void CALLBACK combineCallback(GLdouble coords[3], GLdouble *vertex_data[4],
GLfloat weight[4], GLdouble **dataOut)
{
GLdouble *vertex;
vertex = (GLdouble *) malloc(6 * sizeof(GLdouble));
vertex[0] = coords[0];
vertex[1] = coords[1];
vertex[2] = coords[2];
for (int i = 3; i < 6; i++)
{
vertex[i] = weight[0] * vertex_data[0][i] +
weight[1] * vertex_data[0][i] +
weight[2] * vertex_data[0][i] +
weight[3] * vertex_data[0][i];
}
*dataOut = vertex;
}
I'v tried to free(vertex) but then the polygons did not render. I also tried allocating on the heap then doing delete(vertex) but then the polygon rendered awkwardly. I'm not sure what to do.
Thanks
Hi all
I have winxp with the latest service pack on my old laptop.
I have a situation where I can Ping and status says connected but cannot browse.
I have seen various post on the net proposing solutions that works for some and not for others
I have tried reseting winsock but nothing.
If I vpn to my work then I can browse.
I would like to avoid reformatting the computer and not take such a drastic action.
Any suggestions?
this is my code... i dont anderstend way the class dont work...
import java.awt.BorderLayout;
import java.awt.Button;
import java.awt.Color;
import java.awt.GridLayout;
import java.awt.Panel;
public class Caldesinger
{
public Panel p1=new Panel();
public Button[] arr=new Button[20];
public String[] name = {"9","8","7","6","5","4","3","2","1","0","+","-","*","/",".","cos","sin","=","pow"};
public Caldesinger()
{
for (int i = 0; i < arr.length; i++)
{
this.arr[i]=new Button(""+name[i]);
}
}
public Panel getP1() {
return p1;
}
public void setP1(Panel p1) {
this.p1 = p1;
}
public Button[] getArr() {
return arr;
}
public void setArr(Button[] arr) {
this.arr = arr;
}
public Object c()
{
this.p1.setLayout(new GridLayout(4,15));
for (int i = 0; i < arr.length; i++)
{
arr[i].setBackground(Color.LIGHT_GRAY);
arr[i].setForeground(Color.orange);
p1.add(arr[i]);
}
this.p1.setLayout(new GridLayout(4,15));
return this;
}
}
the class desinge the applet
this is the main:
import java.applet.Applet;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class Mainapp extends Applet implements ActionListener
{
Caldesinger desinge=new Caldesinger ();
public void init()
{
this.setLayout(new BorderLayout());
this.desinge.c();
}
public void ActionPerformed(ActionEvent arg0)
{
for (int i = 0; i <20; i++)
{
if(arg0.getSource()== this.desinge.arr[i]);
}
}
}
way the method c does not work?
the method desinge the applet
hi
i have 2 tables
table items has 144602 records
table A has 27721 records
code in items = BAR8 in A
i want to show all records that equal
i try this: SELECT Items.Code, A.BAR8
FROM Items INNER JOIN A ON Items.Code = A.BAR8;
and i get 28048 records !!! i need to get 27721 , how to do it ?
thank's in advance
I have a column within which are multiple 'records' (each a div).
Each record has a bunch of fields (each a span whose id is the fieldname).
I want to allow the user to sort all the records based on a field. I also want, the field that has been sorted to be moved to the beginning of the record. So I came up with this. But its really slow for a large sets. Not sure whats the best way to do this. Any ideas?
$(".col1 div").sort(
function (a,b)
{
if($(a).children("."+field).text() > $(b).children("."+field).text())
return -1;
else
return 1;
}).appendTo(".col1");
Hey guys I am trying to return the latest 10 results of a query from a php file, through json format, to a jquery getjson function that prints results. I am getting weird problems though. For example I am only getting 8 entries returned, and some are disordered, and sometimes nothing is returned. I am not really sure what I am doing wrong, so if anyone has any ideas I would really appreciate it.
This is my query ($res)
SELECT time, user, message FROM comments WHERE topic_id='$topic_id' ORDER BY time DESC LIMIT 10
This is the processing of the results
while($row = mysql_fetch_array($res)){
$message=$row['message'];
$user=$row['user'];
if($row['message'] AND $row['time'] > $_GET['time'])
$data[] = $row;
}
$out = json_encode($data);
print $out;
And this is the retrieval where prepare is just a function that returns information into a div
$.getJSON(files+"processing.php?action=load&time="+0+"&topic_id="+topic_id+"&t=" + (new Date()), function(json) {
if(json.length) {
for(i=0; i < 10; i++) {
$('#comment-list').prepend(prepare(json[i]));
$('#list-' + count).fadeIn(1500);
}
}
});
function prepare(response) {
count++;
var string = '<li class="comment-list" id="list-'+count+'">'
//organize info into a div
+'</li>';
return string;
}
Hey guys I have a query that currently finds the latest comment for each of a user's topics and then orders topics by that comment's timestamp. What I want to do is expand on this query's use and print the latest comment for each topic. The problem with this query is that while it orders the topics correctly, it prints seemingly random comments for each topic. I am trying to implement a sub query but I am not quite sure how to approach it. I was thinking that I just had to somehow use this query to get the comments. If anyone has any ideas I would really appreciate it.
Here is what I think I need to add
SELECT * FROM comments where topic_id='$topic_id' ORDER BY timestamp DESC LIMIT 1
Here is the query I need to modify
SELECT topic.topic_title, topic.content_type, topic.subject_id, topic.creator, topic.description, topic.topic_id,comments.message,comments.user
FROM comments
JOIN topic ON topic.topic_id = comments.topic_id
WHERE topic.creator = '$user' AND comments.timestamp > $week
GROUP BY topic_id ORDER BY MAX(comments.timestamp) DESC
I'm working for a website where i need to sum functionality related to sales
I'm very new to the website stuff and found many things on net but don't knew what to follow.
Can anybody suggest me some good tutorials which i can follow to create my website
The things which i am going to work on as:
saving customer information to data base
using saved customer information, placing order
generating bills and invoices and downloading it in pdf file format
sending mails to customer with those invoice as attachments
I have a following query. It uses only one table (Customers) from Northwind database.
I completely have no idea how does it work, and what its intention is. I hope there is a lot of DBAs here so I ask for explanation. particularly don't know what the OVER and PARTITION does here.
WITH NumberedWomen AS
(
SELECT CustomerId ,ROW_NUMBER() OVER
(
PARTITION BY c.Country
ORDER BY LEN(c.CompanyName) ASC
)
women
FROM Customers c
)
SELECT * FROM NumberedWomen WHERE women > 3
If you needed the db schema, it is here
I have an online form which collects member(s) information and stores it into a very long MySQL database. We allow up to 16 members to enroll at a single time and originally structured the DB to allow such.
For example:
If 1 Member enrolls, his personal information (first name, last name, address, phone, email) are stored on a single row.
If 15 Members enroll (all at once), their personal information are stored in the same single row.
The row has information housing columns for all 'possible' inputs. I am trying to consolidate this code and having every nth member that enrolls put onto a new record within the database.
I have seen sugestions before for inserting multiple records as such:
INSERT INTO tablename VALUES
(('$f1name', '$f1address', '$f1phone'), ('$f2name', '$f2address', '$f2phone')...
The issue with this is two fold:
I do not know how many records are
being enrolled from person to person
so the only way to make the
statement above is to use a loop
The information collected from the
forms is NOT a single array so I
can't loop through one array and
have it parse out. My information is
collected as individual input fields
like such: Member1FirstName,
Member1LastName, Member1Phone,
Member2Firstname, Member2LastName,
Member2Phone... and so on
Is it possible to store information in separate rows WITHOUT using a loop (and therefore having to go back and completely restructure my form field names and such (which can't happen due to the way the validation rules are built.)
Hi all,
is there any tool that will give me a view for XML fields like so.
I want something that will show me the a view like so, if i select element1
Service/Body/element1
Is there any tool for eclipse for doing the above.
Thanks.
Hello,
I am trying to use this query to return every instance where the variable $d['userID'] is equal to the User ID in a separate table, and then echo the username tied to that user ID.
Here's what I have so far:
$uid = $d['userID'];
$result = mysql_query("SELECT u.username
FROM users u
LEFT JOIN comments c
ON c.userID = u.id
WHERE u.id = $uid;")$row = mysql_fetch_assoc($result);
echo $row['username'];
I need a special regular expression, have no experience in them whatsoever so I am turning to you guys on this one:
I need to validate a classifieds title field so it doesn't have any special characters in it, almost.
Only letters and numbers should be allowed, and also the swedish three letters å, ä, ö, and also not case sensitive.
Besides the above, these should also be allowed:
The "&" sign.
Parenthesis sign "()"
Mathematical signs "-", "+", "%", "/", "*"
Dollar and Euro signs
Accent sign or whatever it's called, for example in "coupé" the apostrophe above the "e".
Double quote and singel quote signs.
The comma "," and point "." signs
Thanks
Hi folks,
I have a nested map:
Map<Integer, Map<Integer, Double>> areaPrices = new HashMap<Integer, Map<Integer, Double>>();
and this map is populated using the code:
while(oResult.next())
{
Integer areaCode = new Integer(oResult.getString("AREA_CODE"));
Map<Integer, Double> zonePrices = areaPrices.get(areaCode);
if(zonePrices==null)
{
zonePrices = new HashMap<Integer, Double>();
areaPrices.put(areaCode, zonePrices);
}
Integer zoneCode = new Integer(oResult.getString("ZONE_CODE"));
Double value = new Double(oResult.getString("ZONE_VALUE"));
zonePrices.put(zoneCode, value);
myBean.setZoneValues(areaPrices);
}
I want to use the value of this Map in another method of the same class. For that I have a bean.
How do I populate it on the bean, so that I can get the ZONE_VALUE in this other method
In my bean I added one new field as:
private Map<Integer, Map<Integer, Double>> zoneValues;
with getter and setter as:
public Map<Integer, Map<Integer, Double>> getZoneValues() {
return zoneValues;
}
public void setZoneValues(Map<Integer, Map<Integer, Double>> areaPrices) {
this.zoneValues = areaPrices;
}
What I am looking for to do in the other method is something like this:
Double value = myBean.get(areaCode).get(zoneCode);
How do I make it happen :(
Hello All,
I have scoured the internet looking for a good tutorial or posting about having a UITableView populated with a UITextField in each cell for data entry.
I want to keep track of each UITextField and the text written within it while scrolling. The tableView will be sectioned. I have been using a custom UITableViewCell but I'm open to any method.
Also, is it possible to use the textFields as ivars?
If any of you could point me in the right direction, it would be greatly appreciated.
Thank you in advance!
I keep getting a value of 0 for $years and $months when there should be a value other then 0 can someone tell me what I'm doing wrong with my code? And what I need to fix?
I'm trying to subtract two dates.
Here is my PHP code.
$delete_date = "2000-01-12 08:02:39";
$current_date = date('Y-m-d H:i:s'); //current date
$diff = abs(strtotime($current_date) - strtotime($delete_date));
$years = floor($diff / (365*60*60*24));
$months = floor(($diff - $years * 365*60*60*24) / (30*60*60*24));
echo $current_date . '<br />';
echo $delete_date. '<br />';
echo $diff. '<br />';
echo $years. '<br />';
echo $months. '<br />';
I have the following pages:
*page1.php
<?php
if (isset($_GET['link'])) {
session_start();
$_session['myvariable'] = 'Hello World';
header('Location: http://' . $_SERVER['SERVER_NAME'] . dirname($_SERVER['REQUEST_URI']) . '/page2.php');
exit;
}
?>
<a href="<?php print $_SERVER['REQUEST_URI'] . '?link=yes';?>">Click Here</a>
*page2.php
<?php
print 'Here is page two, and my session variable: ';
session_start();
print $_session['myvariable']; //This line could not output.
exit;
?>
When I try output $_session['myvariable'] I did not get the result hello world message.
I could not find out the solution to fix it .?
How can I call the button1_Click event in the form closing event so I don't have to copy and paste the code from button1_Click?
public void button1_Click(object sender, EventArgs e)
{
//Yes or no message box to exit the application
DialogResult Response;
Response = MessageBox.Show("Are you sure you want to Exit?", "Exit", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
if (Response == DialogResult.Yes)
// Exits the application
Application.Exit();
}
public void xGameThemeComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
string folder = Application.StartupPath;
string theme = (string)xGameThemeComboBox.Items[xGameThemeComboBox.SelectedIndex];
string path = System.IO.Path.Combine(folder, theme + ".jpg");
Image newImage = new Bitmap(path);
if (this.BackgroundImage != null) this.BackgroundImage.Dispose();
{
this.BackgroundImage = newImage;
}
}
private void xGameForm_FormClosing(object sender, FormClosingEventArgs e)
{
// call button1_Click here
}
I'm trying to write a function that will change the size of a dynamic array to a new size. In my header file, I have:
Image **images; //pointer to a dynamic array of image pointers
int maximum; //size
I want to do this by allocating a new array and copying the values over without changing their indices. If there are non-null pointers outside the range newmax, then we cant do this. So heres what I have:
There are no compilation or runtime errors. However, I find that the new array isnt getting sized right. When I run the following test case:
I should get an index out of bounds error, but instead the system lets it slide. Can anyone see the mistake? I've looked for hours but cant find anything.
Hi folks!
Actually I'm new to C++. I tried something out (actually the map container) but it doesn't work the way I assumed it will... Before posting my code, I will explain it shortly.
I created 3 classes:
ClassA
ClassDerivedA
ClassAnotherDerivedA
The two last ones are derived from "ClassA".
Further I created a map:
map<string,ClassA> test_map;
I put some objects (from Type ClassDerivedA and ClassAnotherDerivedA) into the map. Keep in mind: the mapped value is from type "ClassA". This will only work because of Polymorphism. Finally I created an iterator which runs over my map and compares the user input with my keys in the map. If they match, it will call a specific method called "printOutput".
And there is the Problem:
Although i declared "printOutput" as "virtual" the only method called is the one from my base class, but why?
and here is the code:
#include <iostream>
#include <map>
using namespace std;
class ClassA
{
public:
virtual void printOutput() { cout << "ClassA" << endl; }
};
class ClassDerivedA : public ClassA
{
public:
void printOutput() { cout << "ClassDerivedA" << endl; }
};
class ClassAnotherDerivedA: public ClassA
{
public:
void printOutput() { cout << "ClassAnotherDerivedA" << endl; }
};
int main()
{
ClassDerivedA class_derived_a;
ClassAnotherDerivedA class_another_a;
map<string,ClassA> test_map;
test_map.insert(pair<string,ClassA>("deriveda", class_derived_a));
test_map.insert(pair<string,ClassA>("anothera", class_another_a));
string s;
while( cin >> s )
{
if( s != "quit" )
{
map<string,ClassA>::iterator it = test_map.find(s);
if(it != test_map.end())
it->second.printOutput();
}
else
break;
}
}
Blockquote