hey guys
i have a column in the database(postgresql)
i want to insert the current time in GMT in this column
when getting the current time and inserting it into the DB
it's inserted in the server timezone GMT-5 although that time was in GMT+0
any ideas how to insert this time in the database in GMT timezone ?
i am starting with this table:
SELECT [Lab Occurrence Form].[Practice Code], [Lab Occurrence Form].[1 0 Preanalytical (Before Testing)], Count([Lab Occurrence Form].[1 0 Preanalytical (Before Testing)]) AS [CountOf1 0 Preanalytical (Before Testing)]
FROM [Lab Occurrence Form]
WHERE ((([Lab Occurrence Form].[Occurrence Date]) Between [Forms]![By Number]![Text4] And [Forms]![By Number]![Text2]))
GROUP BY [Lab Occurrence Form].[Practice Code], [Lab Occurrence Form].[1 0 Preanalytical (Before Testing)]
HAVING ((([Lab Occurrence Form].[Practice Code])<>"") AND ((Count([Lab Occurrence Form].[1 0 Preanalytical (Before Testing)]))<>0));
it selects 3 columns but i need to aggregate the comments and put it in the fourth column where the first two values are the same
I would like to invoke heavy duty method dowork on a separate thread and kill it if its taking longer than 3 seconds. Is there any problem with the following code?
class Class1
{
/// <summary>
/// The main entry point for the application.
/// </summary>
///
[STAThread]
static void Main(string[] args)
{
Console.WriteLine("starting new thread");
Thread t = new Thread(new ThreadStart(dowork));
t.Start();
DateTime start = DateTime.Now;
TimeSpan span = DateTime.Now.Subtract(start);
bool wait = true;
while (wait == true)
{
if (span.Seconds>3)
{
t.Abort();
wait = false;
}
span = DateTime.Now.Subtract(start);
}
Console.WriteLine("ending new thread after seconds = {0}", span.Seconds);
Console.WriteLine("all done");
Console.ReadLine();
}
static void dowork()
{
Console.WriteLine("doing heavy work inside hello");
Thread.Sleep(7000);
Console.WriteLine("*** finished**** doing heavy work inside hello");
}
}
I would like to invoke heavy duty method dowork on a separate thread and kill it if its taking longer than 3 seconds. Is there any problem with the following code?
class Class1
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
Console.WriteLine("starting new thread");
Thread t = new Thread(new ThreadStart(dowork));
t.Start();
DateTime start = DateTime.Now;
TimeSpan span = DateTime.Now.Subtract(start);
bool wait = true;
while (wait == true)
{
if (span.Seconds > 3)
{
t.Abort();
wait = false;
}
span = DateTime.Now.Subtract(start);
}
Console.WriteLine("ending new thread after seconds = {0}", span.Seconds);
Console.WriteLine("all done");
Console.ReadLine();
}
static void dowork()
{
Console.WriteLine("doing heavy work inside hello");
Thread.Sleep(7000);
Console.WriteLine("*** finished**** doing heavy work inside hello");
}
}
Hi people:
I came across with some code like this that i am not sure with:
unsigned long byte_count : 32
unsigned long byte_count2 : 28
What does the ':' play here?
Thanks, peace!
lukmac
here is task
How many ways are there to choose from the set {1, 2, . . . , 100} three distinct
numbers so that their sum is even?
first of all sum of three numbers is even if only if
1.all number is even
2.two of them is odd and one is even
i know that
(n) = n!/(k!*(n-k)!
(k)
and can anybody help me to solve this problem
I am attempting to put all my database connections in 1 php file, rather than in each of my individual php pages. I have the following:
//conn.php:
<?php
class conn {
var $username = "name";
var $password = "password";
var $server = "localhost";
var $port = "3306";
var $databasename = "db";
var $tablename = "tablename";
var $connection;
public function getConnected() {
$this->connection = mysqli_connect(
$this->server,
$this->username,
$this->password,
$this->databasename,
$this->port
);
}
}
?>
// file.php:
<?php
require_once("conn.php");
class myClass{
public function con() {
$conn = new conn();
$conn->getConnected();
}
public function myF() {
$stmt = mysqli_prepare($conn->connection, "SELECT * FROM $conn->tablename");
mysqli_stmt_execute($stmt);
}
}
?>
I then call this as follows:
$myNew = new myClass();
$myNew-con();
$myNew-myF();
When I call this, I get the following error:
Undefined property: myClass::$connection
What am I doing wrong?
Suppose I have variables
$x1 = 'XX a b XX c d XX';
$x2 = 'XX a b XX c d XX e f XX';
I want a regular expression that will find each instance of letters between XX. I'm looking for a general solution, because I don't know how many XX's there are.
I tried using /XX(.*?)XX/g but this only matches "a b" for x1 and "a b", "e f" for x2 because once the first match is found, the engine has already read the second "XX".
Thanks for any help.
I have an application which reads the data from the database, creates an object out of the data, marshalls it into an xml and enqueue the xml to a queue which is producer. The xml is dequeued from the queue by a consumer.
I need to use xsds at two different places.
For database access while reading the data from the database and
For interaction between producer and consumer
Can the same xsd be used in both the cases? Or do I need to use different xsds?
we know algorithm how reverse array of n integers
for (int i=0;i<n/2;i++){
swap(a[i],a[n-1-i]):
}
is this method better according the speed of algorithm or not because swap using xor is more fast then in other method
here is code
public class swap{
public static void main(String[]args){
int a[]=new int[]{2,4,5,7,8,11,13,12,14,24};
System.out.println(" array at the begining:");
for (int i=0;i<a.length;i++){
System.out.println(a[i]);
}
for (int j=0;j<a.length/2;j++){
a[j]^=a[a.length-1-j];
a[a.length-1-j]^=a[j];
a[j]^=a[a.length-1-j];
}
System.out.println("reversed array:");
for (int j=0;j<a.length;j++){
System.out.println(a[j]);
}
}
}
//result
array at the begining:
2
4
5
7
8
11
13
12
14
24
reversed array:
24
14
12
13
11
8
7
5
4
2
hello
does Display:none or jquery Hide function speed up my website, i mean i'm developing a website where i have a DIV but it's not always needed so if a give him CSS property Display:none or using jquery .Hide will that speed up my website ? if not how to do that?
Thanks
I have the following rewrite rule
rewrite ^/ab(.*)/(.*)$ /repo/ab$1/rtest/$2 break;
When the request file is /abname/index.php it gets rewritten to /abname/rtest/index.php
But if the request is of the form /abname/dir1/index.php it gets rewritten as /abname/dir1/rtest/index.php but I would want it to be rewritten as /abname/rtest/dir1/index.php
How do I write the rule ?
I copied the following code from http://www.codeproject.com/KB/cs/CSLLKeyboardHook.aspx,
public int hookProc(int code, int wParam, ref keyboardHookStruct lParam)
{
if (code >= 0)
{
Keys key = (Keys)lParam.vkCode;
if (HookedKeys.Contains(key))
{
KeyEventArgs kea = new KeyEventArgs(key);
if((wParam == WM_KEYDOWN || wParam == WM_SYSKEYDOWN) && (KeyDown != null))
{KeyDown(this, kea) ;}
else if ((wParam == WM_KEYUP || wParam == WM_SYSKEYUP) && (KeyUp != null))
{KeyUp(this, kea); }
if (kea.Handled)
{return 1;}
}
}
lParam.vkCode ++;
lParam.scanCode ++;
return CallNextHookEx(hhook, code, wParam, ref lParam);
}
It works fine but when I make a little change:
lParam.vkCode ++;
or
lParam.scanCode ++;
right before the return CallNextHookEx(...), the original keys still appears in Notepad.
Ex. If I press "a", I expect the letter in Notepad will be "b" but it still "a".
It seems like "lParam" doesn't change. Couldn't understand why?
we know algorithm how reverse array of n integers
for (int i=0;i<n/2;i++){
swap(a[i],a[n-1-i]):
}
is this method better according the speed of algorithm or not because swap using xor is more fast then in other method
here is code
public class swap {
public static void main(String[]args){
int a[]=new int[]{2,4,5,7,8,11,13,12,14,24};
System.out.println(" array at the begining:");
for (int i=0;i<a.length;i++){
System.out.println(a[i]);
}
for (int j=0;j<a.length/2;j++){
a[j]^=a[a.length-1-j];
a[a.length-1-j]^=a[j];
a[j]^=a[a.length-1-j];
}
System.out.println("reversed array:");
for (int j=0;j<a.length;j++){
System.out.println(a[j]);
}
}
}
Result:
array at the begining:
2
4
5
7
8
11
13
12
14
24
reversed array:
24
14
12
13
11
8
7
5
4
2
I know that by default ASP.NET ships with LocalSqlServer... I just uploaded my website and I did the following:
<remove name="LocalSqlServer"/>
<add name="LocalSqlServer" connectionString="Data Source=winsqlus03.lxa.perfora.net,1433; Initial Catalog=db323219488; User ID= dboxxxxxxxxx; Password=xxxxx;"/>
And inside my App_Data I still have the ASPNETDB.MDF, when I tried to run it... What I got is:
Could not find stored procedure 'dbo.aspnet_CheckSchemaVersion'.
why is this?
I have data composed of a list of employers and a list of workers. Each has a many-to-many relationship with the other (so an employer can have many workers, and a worker can have many employers).
The way the data is retrieved (and given to me) is as follows: each employer has an array of workers. In other words:
employer n has:
worker x, worker y etc.
So I have a bunch of employer objects each containing an array of workers.
I need to transform this data (and basically invert the relationship). I need to have a bunch of worker objects, each containing and array of employers. In other words:
worker x has:
employer n1, employer n2 etc.
The context is hypothetical so please don't comment on why I need this or why I am doing it this way. I would really just like help on the algorithm to perform this transformation (there isn't that much data so I would prefer readability over complex optimizations which reduce complexity). (Oh and I am using Java, but pseudocode would be fine). Thanks!
Hello,
I am binding a collection of MyItem class instances to a DataGrid. The MyItem class has a property called "IsSelected". This property can get changed programmatically. How do I propogate that change back to the UI such that if this value is true, the row associated with MyItem is highlighted (selected) and if it is false, the row associated with MyItem is not highlighted?
Thank you,
my_window.document.write('
<script type="text/javascript">
function redirect(linkid) {
opener.location.href=linkid;
window.close();
}
</script>
<h1>Hello</h1>
<p>Thank you.If you accidentally closed our website click
<a href="javascript:redirect('http://google.com')">here</font></a>
to go back to our website</p>
');
This is my piece of code to close a already opened pop up window by redirecting it to google.com. I think there is some problem with matching the apostrophes ' and "... how to code with (' (" (' ') ") ')... is this correct? please help me with this.
Please help me with the necessary changes wherever required.
How do I show the dates number format next to its name in the array using PHP? So that the number format is saved in the database and the month name is displayed?
Here is the php code.
$month_options = array("Month", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");