hi i want to find how to find no of weeks and each mondays date between 2 dates. for ex 10-07-2009 to today .
Note :consider leap year and other date related constrains also.
Hi there, im trying to do a comparison in MYSQL but wish for it to be case sensitive
ex:
$userID="test"
$q = db_query("select * from users where user_id = '" . $userID . "'");
In DB:
userid = "TEST"
Ho do i go about making sure the mysql query does not return TRUE for this query as the userid varialbe doesnt match the case of the userid in the database
thanks
Hello,
I want to loop the update statement, but it only loops once.
Here is the code I am using:
do {
mysql_select_db($database_ll, $ll);
$query_query= "update table set ex='$71[1]' where field='val'";
$query = mysql_query($query_query, $ll) or die(mysql_error());
$row_domain_all = mysql_fetch_assoc($query);
} while ($row_query = mysql_fetch_assoc($query));
Thanks
Jean
I have a database of nouns (ex "house", "exclamation point", "apple") that I need to output and describe in my application. It's hard to put together a natural-sounding sentence to describe an item without using "a" or "an" - "a house is BIG", "an exclamation point is SMALL", etc.
Is there any function, library, or hack i can use in PHP to determine whether it is more appropriate to describe any given noun with A or AN?
I'm try to use drupal open id module. When i used to login using any provider id(yahoo,google..) the step it goes to registration page of my site. My question is how to populate details of the user to my form without additional burden to the user ?. For ex name,email-id etc. Is there any module associated with it ?
Can JDBC component be used for inserting Java objects into a Mysql database ? I want to store Java objects that i am routing through message exchanges into a database using spring xml .
i have never used hibernate before , so cannot use the hibernate or JPA components
Ex Code :
<from uri="bean:MessageProducer?method=send" /> /* bean sending the objects */
/* what code do i need to write for insertion of these Objects into testdb */
<to uri="jdbc:testdb"/>
In my asp.net I am using Datalist in that I want to limit row count and want the sort to be in vertical. Let me know how to do this.
Ex: I want my list to be like this
Hi,
I have an address control which display the contact info of the person.
so it displays something like
1234, street
City, CA 12345
Now i want to give user flexibility to create format out of it.
For ex someone might want to display address as,
street, City, Country
OR
Just display their emails:
[email protected][email protected]
Any good ideas on how to it or similar examples?
thanks
I wonder that, why are we using ({ }) ?
Is it delegate ?
What does it mean to use this syntax ?
What are we wrapping with it ?
For ex:
$.ajaxSetup ({ // <-- THIS
error: fError,
compelete: fComp,
success: fSucc
}); // <-- AND THIS
Hi,
Please tell me how can I find the last word from any particular cell in excel sheet if cell contains multiple words or instructions.
For ex- The below string is in particular cell:
C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Blue hills.jpg
My requirement is to search only last word in that cell i.e. Blue hills.jpg
Your early response is highly appreciated!!!
I cannot see this behavior in JBoss 4.2.3. If I try to call addCookie() on HttpServletResponse and my cookie value has accented characters in it (ex. ç) I get this exception:
java.lang.IllegalArgumentException: Control character in cookie value, consider BASE64 encoding your value
Does anyone know what change in JBoss 5.1.0 could be causing these problems?
I have following code :
try {
MapSqlParameterSource parameters = new MapSqlParameterSource();
parameters.addValue("ids", year);
return this.template.getJdbcOperations().query(
"SELECT * FROM INCOME WHERE PROVNUM=? AND FISCALDATE IN ( :ids )", this.rowMapper, parameters);
}catch (EmptyResultDataAccessException ex) {
return null;
}
But i am not able to send the value for PROVNUM. how to do that?
need help,
thanks.
For many programming languages, there are centralized sites (ex. CPAN, PEAR, PyPi, RubyGems, etc.) which list recently updated (existing plus newly added) modules, but I haven't seen any site which allows you to list only recently added/created modules. Can anybody point me to such a site/service?
For many programming languages, there are centralized sites (ex. CPAN, PEAR, PyPi, RubyGems, etc.) which list recently updated (existing plus newly added) modules, but I haven't seen any site which allows you to list only recently added/created modules. Can anybody point me to such a site/service?
Hi I have made this function that takes a table and prepare the label for a barplot
prepare_labels <- function(ft){
labs <- ft
labs <- paste(labs, "\n", sep="")
labs <- paste(labs, round(prop.table(ft)*100,2), sep="")
labs <- paste(labs, "%", sep="")
return(labs)
}
It actually works fine, but is there any better way to write that function, the above code looks ugly and I want to write beautiful code :-)
ex:
ft <- table(mydata$phone_partner_products)
prepare_labels(ft)
[1] "3752\n34.09%" "226\n2.05%" "2907\n26.41%" "1404\n12.76%" "1653\n15.02%"
[6] "1065\n9.68%"
Hi i have to select the 2 lastest element for every topic
ex:
table: msg
id | topic_id
-----------
1 | 1
2 | 1
3 | 1
4 | 1
5 | 2
6 | 2
7 | 2
8 | 3
i want obtain these rows:
3 1
4 1
6 2
7 2
8 3
How can i do?
thanks
Hey guys I have a connection class I found for pdo. I am calling the connection method on the page that the file is included on. The problem is that within functions the $conn variable is not defined even though I stated the method was public (bare with me I am very new to OOP), and I was wondering if anyone had an elegant solution other then using global in every function. Any suggestions are greatly appreciated.
CONNECTION
class PDOConnectionFactory{
// receives the connection
public $con = null;
// swich database?
public $dbType = "mysql";
// connection parameters
// when it will not be necessary leaves blank only with the double quotations marks ""
public $host = "localhost";
public $user = "user";
public $senha = "password";
public $db = "database";
// arrow the persistence of the connection
public $persistent = false;
// new PDOConnectionFactory( true ) <--- persistent connection
// new PDOConnectionFactory() <--- no persistent connection
public function PDOConnectionFactory( $persistent=false ){
// it verifies the persistence of the connection
if( $persistent != false){ $this->persistent = true; }
}
public function getConnection(){
try{
// it carries through the connection
$this->con = new PDO($this->dbType.":host=".$this->host.";dbname=".$this->db, $this->user, $this->senha,
array( PDO::ATTR_PERSISTENT => $this->persistent ) );
// carried through successfully, it returns connected
return $this->con;
// in case that an error occurs, it returns the error;
}catch ( PDOException $ex ){ echo "We are currently experiencing technical difficulties. We have a bunch of monkies working really hard to fix the problem. Check back soon: ".$ex->getMessage(); }
}
// close connection
public function Close(){
if( $this->con != null )
$this->con = null;
}
}
PAGE USED ON
include("includes/connection.php");
$db = new PDOConnectionFactory();
$conn = $db->getConnection();
function test(){
try{
$sql = 'SELECT * FROM topic';
$stmt = $conn->prepare($sql);
$result=$stmt->execute();
}
catch(PDOException $e){ echo $e->getMessage(); }
}
test();
hi
why in Windows 7 i see the Data & Time in DataTimePicker inverse
and in Windows XP it fine ? (the region and language are same)
ex.
Win7: 2010/12/31 - 51:09
XP : 31/12/2010 - 09:51
thank's in advance
array_key_exists is not working for large multidimensional array. For ex
$arr=array( '1'=>10,
'2'=>array('21'=>21,
'22'=>22,
'23'=>array('test'=>100,
'231'=>231),
),
'3'=>30,
'4'=>40
);
array_key_exists('test',$arr) returns 'false' but it works with some simple arrays.
I have a Problem with Closing the Thread. I will Closing the Thread with onStop,onPause and onDestroy. This is my Source in the Activity Class:
@Override
protected void onStop(){
super.onStop();
finish();
}
@Override
protected void onPause() {
super.onPause();
finish();
}
@Override
public void onDestroy() {
this.mWakeLock.release();
super.onDestroy();
}
And the Thread Class:
public class GameThread extends Thread {
private SurfaceHolder mSurfaceHolder;
private Handler mHandler;
private Context mContext;
private Paint mLinePaint;
private Paint blackPaint;
//for consistent rendering
private long sleepTime;
//amount of time to sleep for (in milliseconds)
private long delay=1000/30;
//state of game (Running or Paused).
int state = 1;
public final static int RUNNING = 1;
public final static int PAUSED = 2;
public final static int STOPED = 3;
GameSurface gEngine;
public GameThread(SurfaceHolder surfaceHolder, Context context, Handler handler,GameSurface gEngineS){
//data about the screen
mSurfaceHolder = surfaceHolder;
mHandler = handler;
mContext = context;
gEngine=gEngineS;
}
//This is the most important part of the code. It is invoked when the call to start() is
//made from the SurfaceView class. It loops continuously until the game is finished or
//the application is suspended.
private long beforeTime;
@Override
public void run() {
//UPDATE
while (state==RUNNING) {
Log.d("State","Thread is runnig");
//time before update
beforeTime = System.nanoTime();
//This is where we update the game engine
gEngine.Update();
//DRAW
Canvas c = null;
try {
//lock canvas so nothing else can use it
c = mSurfaceHolder.lockCanvas(null);
synchronized (mSurfaceHolder) {
//clear the screen with the black painter.
//reset the canvas
c.drawColor(Color.BLACK);
//This is where we draw the game engine.
gEngine.doDraw(c);
}
} finally {
// do this in a finally so that if an exception is thrown
// during the above, we don't leave the Surface in an
// inconsistent state
if (c != null) {
mSurfaceHolder.unlockCanvasAndPost(c);
}
}
this.sleepTime = delay-((System.nanoTime()-beforeTime)/1000000L);
try {
//actual sleep code
if(sleepTime>0){
this.sleep(sleepTime);
}
} catch (InterruptedException ex) {
Logger.getLogger(GameThread.class.getName()).log(Level.SEVERE, null, ex);
}
while (state==PAUSED){
Log.d("State","Thread is pausing");
try {
this.sleep(1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}}
How i can close the Thread from Activity Class??
This is a statement referring to problem caused by page fault:(from Silberschatz 7th ed P-310 last para)
'We cant simply restart instructions when instruction modifies several different location
Ex:when a instruction moves 256 bytes from source to dest and either src or dest straddles on page boundary , then,after a partial move, if a page fault occurs, 'we can't simply restart the instructions'
My question is Why not?
Simply restart the instruction again do the same copy after page is in.
Is there any problem in it?
I wrote a html scraper to scrape my various social identites, so I can make a real time 'biography' website.
However after using php curl_exec, I find that texts that I have quoted, end up being formatted in a weird character set.
ex: "I love dogs" gets formatted to ’I love dogs ’
"I hate cheese" gets formatted to “I hate cheese�
How do I either scrub these characters, or set curl not to format quotes like this.
Also, I have turned off magic_quotes.