Saturday, 31 August 2013

freeing the popup twice crashes applcation

freeing the popup twice crashes applcation

In my execute block that gets called with a button click, I create a popup
menu to appear where the button was clicked. It current appears properly,
with a few items with one of them having a couple sub items. When this
that runs once then calls the destructor, it is fine. But if I execute it
twice (show the popup and click an item twice) then destruct, the
application crashes. I think it is because I'm not freeing the popup
correctly (which is declared as a private property).
procedure TPlugIn.Execute(AParameters : WideString);
var
i: Integer;
pnt: TPoint;
begin
GetCursorPos(pnt);
FPopup := TPopupMenu.Create(nil);
FPopup.OwnerDraw:=True;
FPopup.AutoHotkeys := maManual;
//SQL Upgrade
Item := TMenuItem.Create(FPopup);
Item.Caption := 'Database Install/Upgrade';
Item.OnClick := ShowItemCaption;
FPopup.Items.Add(Item);
//Language Folder
Item := TMenuItem.Create(FPopup);
Item.Caption := 'Language Folder';
Item.OnClick := ShowItemCaption;
FPopup.Items.Add(Item);
//Machines
Item := TMenuItem.Create(FPopup);
Item.Caption := 'Machines';
MachineItem := TMenuItem.Create(FPopup);
MachineItem.Caption := 'Sample Machine 1';
MachineItem.OnClick := ShowItemCaption;
Item.Add(MachineItem);
MachineItem := TMenuItem.Create(FPopup);
MachineItem.Caption := 'Sample Machine 2';
MachineItem.OnClick := ShowItemCaption;
Item.Add(MachineItem);
FPopup.Items.Add(Item);
Self.FPopup := FPopup;
FPopup.Popup(pnt.X, pnt.Y);
end;
In the ShowItemCaption procedure I just show the caption of that sender
object. I haven't coded specific events yet. If it free the popup in the
execute procedure, the popup doesn't appear anymore.
destructor TPlugIn.Destroy;
begin
inherited;
FPopup.Free;
//ShowMessage('freed');
end;

IList Property stays null even when member is instantiated

IList Property stays null even when member is instantiated

I am having trouble using an IList property which always seems to return
null, even though the member is is getting is instantiated:
private List<ModelRootEntity> _validTargets = new
List<ModelRootEntity>();
public IList<IModelRootEntity> ValidTargets
{
get
{
return _validTargets as IList<IModelRootEntity>;
}
protected internal set
{
if (value == null)
_validTargets.Clear();
else
_validTargets = value as List<ModelRootEntity>;
}
}
ModelRootEntity implements IModelRootEntity. I watched both values during
debugging, whilst the member shows a positive count, the property stays
null.
I also tried raising an exception within the property getter to throw if
the counts of _validTargets and _validTargets as List<ModelRootEntity> are
different, but it never threw.
Found question [Dictionary properties are always null despite dictionaries
being instantiated, which seems similar, however in my case this seems to
happen regardless of serialization.
Any ideas?

store php multidimensional array in localstorage

store php multidimensional array in localstorage

I'm building a site where a user can use the site and input data. However
to save their data, they need to log into my site (using facebook
connect). The data that they input is stored in a php multidimensional
array with the following structure:
$order = array();
$order[] = array('rank'=>'1', 'day'=>'Tues'); // This $order[] has input
inputted several times by the user
// I haven't included all the code because it's big, all that's really
needed is to see the structure of $order
My question is, how do I convert the php multidimensional array into
javascript and then how do I store it onto localStorage using
localStorage.setItem() so that once they've logged in with facebook
connect I can use that data? Is this the best way of going about it or
should I be doing something else?
<?php
require_once 'src/facebook.php';
$order = array();
$order[] = array('rank'=>$column, 'day'=>$day);
$loginUrl = $facebook->getLoginUrl(array('scope'=>'user_about_me,email'));
?>
<html>
<head>
<script type="text/javascript">
function fblogin() {
var fk = "<?php echo $loginUrl; ?>";
// What do I do here to convert $order into javascript?
// What do I do here to store converted $order onto localStorage()
window.location = "<?php echo $loginUrl; ?>";
}
</script>
</head>
<body>
<INPUT type="image" src="img/fb.png" onclick="fblogin()"/>
</body>
</html>

NumPy : array methods and functions not working

NumPy : array methods and functions not working

I have a problem regarding NumPy arrays.
I cannot get array methods like .T or functions like numpy.concatenate to
work with arrays I create:
>>> a=np.array([1,2,3])
>>> a
array([1, 2, 3])
>>> a.T
array([1, 2, 3])
>>> np.concatenate((a,a),axis=0)
array([1, 2, 3, 1, 2, 3])
>>> np.concatenate((a,a),axis=1)
array([1, 2, 3, 1, 2, 3])
>>>
However when I create an array using bult-in functions like rand
everything is fine
>>> a=np.random.rand(1,4)
>>> a.T
array([[ 0.75973189],
[ 0.23873578],
[ 0.6422108 ],
[ 0.47079987]])
>>> np.concatenate((a,a),axis=0)
array([[ 0.92191111, 0.50662157, 0.75663621, 0.65802565],
[ 0.92191111, 0.50662157, 0.75663621, 0.65802565]])
Do you think it has to do with element types (int32 vs float64) ?
I anm running python 2.7 on windows 7
Any help would be greatly appreciated.
Thanks !

Declaring array as static won't crash program

Declaring array as static won't crash program

When I initialise array of 1,000,000 integers, program crashes, but when I
put keyword static in front everything works perfectly, why?
int a[1000000] <- crash
static int a[1000000] <- runs correctly

org.springframework.web.util.NestedServletException: RequestFailed;

org.springframework.web.util.NestedServletException: RequestFailed;

DetachedCriteria d= DetachedCriteria(Details.class).
setProjection(Projections.projectionList().add&#8203;(Projections.property("subject"),"subject"));
d.add(Restrictions.eqProperty("question","child"));
d.add(Restrictions.eqProperty("answer","M"));
d.add(Restrictions.eqProperty("test","1")); Criteria
cr=sessionFactory.createCriteria(details.class).
setProjection(Projections.projec&#8203;tionList().add(Projections.property("answer"),"answer"));
cr.add(Restrictions.eqProperty("question","immunization"));
cr.add(Subqueries.propertyIn("subject", d)); List ls=cr.list();

java java.util.concurrent.Executors concrete class

java java.util.concurrent.Executors concrete class

What is the concrete class of following ?
java.util.concurrent.Executors
java.util.concurrent.ExecutorService
And how it initialize/instantiate ... since we are directly using to
create and execute the task.

What is the best cloud hosting solution for nodejs and mongodb application?

What is the best cloud hosting solution for nodejs and mongodb application?

I am working on a new application which uses nodejs and mongodb. I am new
to both of these. I have earlier worked on AWS and simple unix servers.
But I need a solution like heroku which can be scaled with least efforts.
Please give some feedback regarding that.
I have googled a bit and I liked https://modulus.io/ . Its scalable and
cheap.
Heroku + Mongolab seems costly.
Also I am not aware of what issues I am going to face.
Pardon me if you find this question unsuitable for stackoverflow.

Friday, 30 August 2013

draw bitmap images outside onDraw function Canvas Android

draw bitmap images outside onDraw function Canvas Android

I want to call a function to draw Bitmap images from the onDraw().
Actually I need to draw bitmap images outside the onDraw() . Help me.
Thanks.

Thursday, 29 August 2013

How can you secure a JavaScript application's API calls?

How can you secure a JavaScript application's API calls?

I have a JavaScript application.
It's built with jQuery.
It uses $.get() to pull JSON data from a server, and uses the data to load
a puzzle.
I want to distribute the JavaScript application to clients, and make it
easy for them to install.
I'd like it to simply give them a JavaScript block they can drop into
their page, and it will interact with my API.
I'm not passing sensitive data, any my API is protecting the database from
SQL injection, etc.
I just want to try to prevent unauthorized use of my API, and I can't
think of a way to do that with JavaScript, since anyone with a DOM
inspector can scrape any credentials from any variables or can monitor any
server traffic POST or GET data...
Would it be possible to authenticate the referrer on the other side?
I know that's not bulletproof, but it's not sensitive data. I just want to
reduce the unauthorized use as much as possible..
Any ideas?

Excel VBA: How to set range to variable?

Excel VBA: How to set range to variable?

I'm trying to save a range from another sheet to a variable and then
compare it to a cell. I have this code:
Function collectUtfall(A1 As String, Ax As String)
Dim rng As Variant
Dim sum as Integer
sum = 0
Set rng = Sheets("Utfall").Range("N2").Value <------- This line
If rng = Ax Then
sum = sum + 10
Else: sum = 33
End If
collectUtfall = sum
End Function
The problem is that it's not acting the way I hoped. I get #Value error,
and I have narrowed it down to the line marked in the code. If I remove
that line I don't get the error but of course the result is only 0.
I have tried to dim rng As Range also, doesn't work.
What can be the problem?

How to post dynamic fields in IE9

How to post dynamic fields in IE9

I have a form in which users can fill static fields. Below them a button
allows to add dynamically new fields :
<form action="url" method="POST">
<table class="table" id="mytable">
<thead>
<tr>
<th>Foo</th>
<th>Bar</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<button id="new-field">Add new fields</button>
</form>
Here is my JS code :
$('#new-field').click(function(e) {
e.preventDefault();
var i = $('#mytable tbody tr').length + 1;
$('<tr><td><input type="text" name="newfield['+ i
+']['foo']"></td><td><input type="text" name="newfield['+ i
+'][bar]]"></tr>').appendTo($('#mytable tbody'));
});
New fields are displayed correctly, but when I post the form (via a submit
button), new fields are not considered on IE9... It works on Firefox and
Chrome.
Apparently here is a solution : Dynamically added form elements are not
POSTED in IE 9 But I can't use the compatibility mode for my project.
Have you got any solution please ?

Wednesday, 28 August 2013

Which is better method to prevent XSS?

Which is better method to prevent XSS?

$a_idWhich is better method to prevent XSS attacks? Here is the code I am
trying to do.
Is this line of code enough to prevent XSS attacks? or Do I have to parse
each element with 'strip_tags'. Thank you for any suggestions.
$xss = array_map('strip_tags', $_POST);
OR
I have a lot of form elements to replace with 'strip_tags'.
$f_name = strip_tags($_POST["f-name"]);
$a_id = isset($_POST['a_id']) ? (int)strip_tags($secure_POST['a_id']) : 0;
$qry = $pdo_conn->prepare('INSERT INTO TABLE1(id, f_name) VALUES (?, ?)');
$qry->execute(array($a_id, $f_name));

C# While loop until button click

C# While loop until button click

Hey i am writing a program for school project and i need some help. (Yes i
have been on Google searching for help)
I am making a program in Winforms (C#) in MS visual studio 2012
i need the code to do this
code code code
Event for button click from user
//Start while loop..
Do
{
code code code
code code code
} (!button not click again)
I know that many talk about multithreading but i think that i am to low
lvl to work whit that for now, so if i can avoid it i will.
I am still pretty new in programming so please don't hate on my noob
question.
Tanks in advance.

MySQL: Unknown column 'XYZ' in 'field list'

MySQL: Unknown column 'XYZ' in 'field list'

I have very big problem. I dont know why, but on two days when I make this:
$mysql = @mysql_query("UPDATE aso_repairs SET
repairs_date_received = '$date_current',
repairs_sendnoticer_email_received = 'Sending',
repairs_sendnoticer_sms_received = 'Sending',
repairs_supply_received_method = 'Get',
repairs_supply_received_partners_id =
'$_SESSION[users_partners_id]',
repairs_supply_received_users_id =
'$_SESSION[users_id]',
repairs_supply_received_trackingnumber = '',
repairs_supply_received_payment_type =
'$ras_repairs_supply_received_payment_type',
repairs_supply_received_payment_status = 'End',
repairs_other_whereis = 'Odebrane'
WHERE repairs_id = '$ras_repairs_id'
");
if (!$mysql) {
die(mysql_error());
}
I get error: Unknown column 'repairs_sendnoticer_email_end' in 'field
list'. This column exist in table. Where is the problem guys... :(

Tuesday, 27 August 2013

Incompatible pointer types returning 'NSString *__strong' from a function with result type

Incompatible pointer types returning 'NSString *__strong' from a function
with result type

/Users/project/get_usr_pass.m:39:12: Incompatible pointer types returning
'NSString *__strong' from a function with result type 'get_usr_pass *'
+(get_usr_pass *)getInstance
{
@synchronized(self)
{
if(instance==nil)
{
instance= [get_usr_pass new];
NSArray *pathArray =
NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
NSUserDomainMask, YES);
NSString *myPath = [[pathArray objectAtIndex:0]
stringByAppendingPathComponent:@"saved.plist"];
BOOL fileExists = [[NSFileManager defaultManager]
fileExistsAtPath:myPath];
if (fileExists) {
NSArray *values = [[NSArray alloc]
initWithContentsOfFile:myPath];
instance = [values objectAtIndex:1];
}
}
}
NSString *str = [[NSString stringWithFormat:@"%@", instance ] MD5];
return str;
}
Need help to fix this issue. Thanks for the time.

How to detect hashed password length?

How to detect hashed password length?

I've started learning of password hashing. And I wonder how to detect
hashed password length? Right now I'm experimenting with sha512 and one of
the question is how to get user typed password length? Or is it impossible
and I should validate user typed password length (e.g. if it is more than
8 characters) with javascript before sending a password to server? Could
anybody explain me or suggest some learning material?

Cannot get mt process output

Cannot get mt process output

I try to get mt my Tshark process output, the executed command return one
by one the packets that has checksum error:
protected string[] invokeProcess(WiresharkProcesses process, string args)
{
try
{
switch (process)
{
case WiresharkProcesses.Capinfo:
processToInvoke = Path.Combine(getbBasePath, "capinfos.exe");
break;
case WiresharkProcesses.Editcap:
processToInvoke = Path.Combine(getbBasePath, "editcap.exe");
break;
case WiresharkProcesses.Tshark:
processToInvoke = Path.Combine(getbBasePath, "tshark.exe");
break;
case WiresharkProcesses.Wireshark:
processToInvoke = Path.Combine(getbBasePath,
"wireshark.exe");
break;
}
ProcessStartInfo capinfosProcess = new
ProcessStartInfo(processToInvoke);
capinfosProcess.Arguments = args;
capinfosProcess.WindowStyle = ProcessWindowStyle.Hidden;
capinfosProcess.RedirectStandardOutput = true;
capinfosProcess.RedirectStandardInput = true;
capinfosProcess.RedirectStandardError = true;
capinfosProcess.CreateNoWindow = true;
capinfosProcess.UseShellExecute = false;
capinfosProcess.ErrorDialog = false;
List<string> lineList = new List<string>();
using (Process pros = Process.Start(capinfosProcess))
{
pros.ErrorDataReceived += pros_ErrorDataReceived;
pros.OutputDataReceived += pros_OutputDataReceived;
pros.EnableRaisingEvents = true;
pros.BeginOutputReadLine();
pros.BeginErrorReadLine();
StreamReader reader = pros.StandardOutput;
while (!reader.EndOfStream)
{
lineList.Add(reader.ReadLine());
}
pros.WaitForExit();
}
return lineList.ToArray();
}
catch (Exception)
{
return null;
}
}
my problem is that my output is empty but when i am run the same command
using command line i can see my output for example this is the output for
1 packet with checksum error:
Frame 1: 74 bytes on wire (592 bits), 74 bytes captured (592 bits)
Encapsulation type: Ethernet (1)
Arrival Time: Aug 26, 2013 11:41:51.779691000 Jerusalem Daylight Time
[Time shift for this packet: 0.000000000 seconds]
Epoch Time: 1377506511.779691000 seconds
[Time delta from previous captured frame: 0.000000000 seconds]
[Time delta from previous displayed frame: 0.000000000 seconds]
[Time since reference or first frame: 0.000000000 seconds]
Frame Number: 1
Frame Length: 74 bytes (592 bits)
Capture Length: 74 bytes (592 bits)
[Frame is marked: False]
[Frame is ignored: False]
[Protocols in frame: eth:ip:udp:dns]
Ethernet II, Src: Vmware_96:2c:da (00:50:56:96:2c:da), Dst:
Vmware_b1:6b:03 (00:50:56:b1:6b:03)
Destination: Vmware_b1:6b:03 (00:50:56:b1:6b:03)
Address: Vmware_b1:6b:03 (00:50:56:b1:6b:03)
.... ..0. .... .... .... .... = LG bit: Globally unique address
(factory default)
.... ...0 .... .... .... .... = IG bit: Individual address (unicast)
Source: Vmware_96:2c:da (00:50:56:96:2c:da)
Address: Vmware_96:2c:da (00:50:56:96:2c:da)
.... ..0. .... .... .... .... = LG bit: Globally unique address
(factory default)
.... ...0 .... .... .... .... = IG bit: Individual address (unicast)
Type: IP (0x0800)
Internet Protocol Version 4, Src: 192.0.16.6 (192.0.16.6), Dst:
192.0.16.200 (192.0.16.200)
Version: 4
Header length: 20 bytes
Differentiated Services Field: 0x00 (DSCP 0x00: Default; ECN: 0x00:
Not-ECT (Not ECN-Capable Transport))
0000 00.. = Differentiated Services Codepoint: Default (0x00)
.... ..00 = Explicit Congestion Notification: Not-ECT (Not
ECN-Capable Transport) (0x00)
Total Length: 60
Identification: 0x0162 (354)
Flags: 0x00
0... .... = Reserved bit: Not set
.0.. .... = Don't fragment: Not set
..0. .... = More fragments: Not set
Fragment offset: 0
Time to live: 128
Protocol: UDP (17)
Header checksum: 0x0000 [incorrect, should be 0x9880 (may be caused by
"IP checksum offload"?)]
[Good: False]
[Bad: True]
[Expert Info (Error/Checksum): Bad checksum]
[Message: Bad checksum]
[Severity level: Error]
[Group: Checksum]
Source: 192.0.16.6 (192.0.16.6)
Destination: 192.0.16.200 (192.0.16.200)
[Source GeoIP: Unknown]
[Destination GeoIP: Unknown]
User Datagram Protocol, Src Port: 65512 (65512), Dst Port: domain (53)
Source port: 65512 (65512)
Destination port: domain (53)
Length: 40
Checksum: 0xa108 [validation disabled]
[Good Checksum: False]
[Bad Checksum: False]
Domain Name System (query)
Transaction ID: 0xe471
Flags: 0x0100 Standard query
0... .... .... .... = Response: Message is a query
.000 0... .... .... = Opcode: Standard query (0)
.... ..0. .... .... = Truncated: Message is not truncated
.... ...1 .... .... = Recursion desired: Do query recursively
.... .... .0.. .... = Z: reserved (0)
.... .... ...0 .... = Non-authenticated data: Unacceptable
Questions: 1
Answer RRs: 0
Authority RRs: 0
Additional RRs: 0
Queries
mail.yandex.ru: type A, class IN
Name: mail.yandex.ru
Type: A (Host address)
Class: IN (0x0001)

selecting two diffferent data from different table and display the value

selecting two diffferent data from different table and display the value

i have two tables tbl_product and tbl_sales. my problem is that how
can i get the data from two different table and display it
horizontally and sum the "total" and "discount" from tbl_rsales. for
example
the ff data in my tbl_products are
id|pcode|pdesc |
1 |1000 |wire |
2 |1443 |capactor |
and the ff data in my tbl_sales are
id|total|discount| pcode |
1 |1000 |10 | 1000 |
2 |2000 |20 | 1443 |
3 |1000 |10 | 1000 |
4 |1000 |20 | 1443 |
the expected output must be something like this. how can i select it from
two different table?
id | pcode | pdesc | total | discount |
1 | 1000 | wire | 2000 | 20 |
2 | 1443 | capacitor | 3000 | 40 |

How to print from MVC4 controller from server

How to print from MVC4 controller from server

Code below is used to print from ASP .NET MVC4 application to Samsung
ML-331x Series printer connected to IP address in LAN and shared in server
as Samsung ML-331x Series
Nothing is printed. Execution stops at doc.Print() line. Every controller
call adds new unfinished job:

Those jobs are never finished, only iisreset clears them.
Server is Windows 2003 + IIS It worked in MVC2 .NET 3.5 application.
ForteSSL VPN was installed in server and application was upgraded to MVC3
and .NET 4. (After that printing was not checked immediately, so I'm not
sure is this related to those changes).
User NETWORK SERVICE with all permissions is added to printer users but
problem persists. Running application in development computer by pressing
F5 in visual studio with Web Developer server and calling with controller
to print to PDF Creator works OK.
How to print from controller in server ?
public ActionResult PrintTest()
{
var doc = new PrintDocument();
doc.PrinterSettings.PrinterName = "Samsung ML-331x Series";
doc.PrintPage += new PrintPageEventHandler(TestProvideContent);
doc.Print();
return new ContentResult()
{
Content = "Printed"
};
}
public void TestProvideContent(object sender, PrintPageEventArgs e)
{
e.Graphics.DrawString("Test",
new Font("Arial", 12),
Brushes.Black,
e.MarginBounds.Left,
e.MarginBounds.Top);
}
Update
Application runs at full trust Level. Application log in event viewer does
not have any entries about this.
Using Programmatically "hello world" default SERVER-side printer in
ASP.NET MVC I tried to use printer name with server name as
\\SERVER\Samsung ML-331x Series but problem persists.

Courier-MTA not listening, how to increase debugging information?

Courier-MTA not listening, how to increase debugging information?

i Follow tutorial from https://wiki.archlinux.org/index.php/Courier_MTA
based on systemctl status command, the server is working fine
# systemctl status courier
courier.service - Courier Daemon
Loaded: loaded (/usr/lib/systemd/system/courier.service; disabled)
Active: active (running) since Tue 2013-08-27 15:40:16 WIT; 35s ago
Process: 509 ExecStop=/usr/sbin/courier stop (code=exited,
status=0/SUCCESS)
Process: 511 ExecStart=/usr/sbin/courier start (code=exited,
status=0/SUCCESS)
Main PID: 516 (courierd)
CGroup: name=systemd:/system/courier.service
„¥„Ÿ516 /usr/lib/courier/courierd
„¥„Ÿ517 /usr/lib/courier/courierd
„¥„Ÿ518 ./courieruucp
„¥„Ÿ519 ./courierlocal
„¥„Ÿ520 ./courierfax
„¥„Ÿ521 ./courieresmtp
„¤„Ÿ522 ./courierdsn
Aug 27 15:40:16 gravity courierd[517]: Started ./courieruucp, pid=518,
maxdels=4, maxhost=4, maxrcpt=16
Aug 27 15:40:16 gravity courierd[517]: Started ./courierlocal, pid=519,
maxdels=10, maxhost=4, maxrcpt=1
Aug 27 15:40:16 gravity courierd[517]: Started ./courierfax, pid=520,
maxdels=1, maxhost=1, maxrcpt=1
Aug 27 15:40:16 gravity courierd[517]: Started ./courieresmtp, pid=521,
maxdels=40, maxhost=4, maxrcpt=100
Aug 27 15:40:16 gravity courierd[517]: Started ./courierdsn, pid=522,
maxdels=4, maxhost=1, maxrcpt=1
Aug 27 15:40:16 gravity courierd[517]: queuelo=200, queuehi=400
Aug 27 15:40:16 gravity courierd[517]: Purging /var/spool/courier/msgq
Aug 27 15:40:16 gravity courierd[517]: Purging /var/spool/courier/msgs
Aug 27 15:40:16 gravity courierd[517]: Waiting. shutdown time=Tue Aug 27
16:40:16 2013, wakeup time=Tue Aug 27 15:50:44 2013,
queuedeliverin...rogress=0
Aug 27 15:40:16 gravity courieruucp[518]: ERROR: no uucp user found,
outbound UUCP is DISABLED!
but the server was not listening at all
$ sudo netstat -ant | grep :25
$ sudo netstat -ant | grep :143
the start configuration
# grep START= /etc/courier/*
/etc/courier/esmtpd:ESMTPDSTART=YES
/etc/courier/esmtpd-msa:ESMTPDSTART=YES
/etc/courier/esmtpd-ssl:ESMTPDSSLSTART=NO
/etc/courier/imapd:IMAPDSTART=YES
/etc/courier/imapd-ssl:IMAPDSSLSTART=NO
/etc/courier/pop3d:POP3DSTART=YES
/etc/courier/pop3d-ssl:POP3DSSLSTART=NO
the log:
Aug 27 15:40:16 gravity courierd: Loading STATIC transport module libraries.
Aug 27 15:40:16 gravity courierd: Courier 0.71 Copyright 1999-2012 Double
Precision, Inc.
Aug 27 15:40:16 gravity courierd: Installing [0/0]
Aug 27 15:40:16 gravity courierd: Installing uucp
Aug 27 15:40:16 gravity courierd: Installed: module.uucp - Courier 0.71
Copyright 1999-2012 Double Precision, Inc.
Aug 27 15:40:16 gravity courierd: Installing local
Aug 27 15:40:16 gravity courierd: Installed: module.local - Courier 0.71
Copyright 1999-2012 Double Precision, Inc.
Aug 27 15:40:16 gravity courierd: Installing fax
Aug 27 15:40:16 gravity courierd: Installed: module.fax - Courier 0.71
Copyright 1999-2012 Double Precision, Inc.
Aug 27 15:40:16 gravity courierd: Installing esmtp
Aug 27 15:40:16 gravity courierd: Installed: module.esmtp - Courier 0.71
Copyright 1999-2012 Double Precision, Inc.
Aug 27 15:40:16 gravity courierd: Installing dsn
Aug 27 15:40:16 gravity courierd: Installed: module.dsn - Courier 0.71
Copyright 1999-2012 Double Precision, Inc.
Aug 27 15:40:16 gravity courierd: Initializing uucp
Aug 27 15:40:16 gravity courierd: Initializing local
Aug 27 15:40:16 gravity courierd: Initializing fax
Aug 27 15:40:16 gravity courierd: Initializing esmtp
Aug 27 15:40:16 gravity courierd: Initializing dsn
Aug 27 15:40:16 gravity courierd: Started ./courieruucp, pid=518,
maxdels=4, maxhost=4, maxrcpt=16
Aug 27 15:40:16 gravity courierd: Started ./courierlocal, pid=519,
maxdels=10, maxhost=4, maxrcpt=1
Aug 27 15:40:16 gravity courierd: Started ./courierfax, pid=520,
maxdels=1, maxhost=1, maxrcpt=1
Aug 27 15:40:16 gravity courierd: Started ./courieresmtp, pid=521,
maxdels=40, maxhost=4, maxrcpt=100
Aug 27 15:40:16 gravity courierd: Started ./courierdsn, pid=522,
maxdels=4, maxhost=1, maxrcpt=1
Aug 27 15:40:16 gravity courierd: queuelo=200, queuehi=400
Aug 27 15:40:16 gravity courierd: Purging /var/spool/courier/msgq
Aug 27 15:40:16 gravity courierd: Purging /var/spool/courier/msgs
Aug 27 15:40:16 gravity courierd: Waiting. shutdown time=Tue Aug 27
16:40:16 2013, wakeup time=Tue Aug 27 15:50:44 2013, queuedelivering=1,
inprogress=0
Aug 27 15:40:16 gravity courieruucp: ERROR: no uucp user found, outbound
UUCP is DISABLED!
how to increase debugging information?

Monday, 26 August 2013

Wine Fatal Error - Invalid command line parameter: -changedir

Wine Fatal Error - Invalid command line parameter: -changedir

When ever I start Plants Vs. Zombies one 'Fatal Error' window appears with
message: Invalid command line parameter: -changedir. Previously I was able
to play such games in Wine but I don't know exactly what happened.
Here is the error when I execute this game from terminal:
$ wine PlantsVsZombies.exe
fixme:ole:CoInitializeSecurity ((nil),-1,(nil),(nil),0,3,(nil),0,(nil)) -
stub!
fixme:gameux:GameExplorerImpl_VerifyAccess (0x13da58,
L"\3a5a\685c\6d6f\5c65\6173\7275\7661\505c\616c\746e\2073\7376\5a20\6d6f\6962\7365\4720\6d61\2065\664f\5420\6568\5920\6165\2072\6445\7469\6f69\5c6e\6c50\6e61\7374\7356\6f5a\626d\6569\2e73\7865e",
0x32f8d8)
I tried re-installing wine many times, deleted all configuration files and
other files and directories:
$ sudo find / | grep wine | sudo xargs rm -r wine
But it never worked for me. I am using latest wine1.6 downloaded from wine
repository:
$ sudo add-apt-repository ppa:ubuntu-wine/ppa
If someone knows please help me. I don't want to switch to Windows in
order to play games.

PHP remove timestamp from string

PHP remove timestamp from string

In a PHP script I need to remove the 00:00:00 from "2003-01-28 00:00:00".
No matter what numbers are in the 00:00:00 it should be stripped if
exists. Is there some sort of formula (regex maybe?) that can detect and
remove it?
Additionally, the 00:00:00 may not always be in the string. That's why I
need to detect it first.
How would I go about this? Any ideas or functions?

Correct Focus Management: JavaFX and Swing Interop

Correct Focus Management: JavaFX and Swing Interop

I've been developing Swing applications for many years, and recently tried
getting my feet wet with JavaFX. Everything's been going well for the most
part, but I'm having problems with inter-operating Swing and JavaFX
components when it comes to focus.
Basically, is there a right way to manage focus between JavaFX and Swing?
In the application I'm making, each component requests for focus in the
window when the mouse enters it's bounds. Unfortunately, this makes JavaFX
components like Popup freeze in place, instead of auto-hiding as it is
defaulted to do when it loses focus.
Thank you in advance.
Edit: To be more clear, the Popup doesn't actually freeze, buttons and
other stuff work, but TextFields become ineditable. I'm sure other
controls suffer the same problem as well.

Fibre channel long distance woes

Fibre channel long distance woes

I need a fresh pair of eyes.
We're using a 15km fibre optic line across which fibrechannel and 10GbE is
multiplexed (passive optical CWDM). For FC we have long distance lasers
suitable up to 40km (Skylane SFCxx0404F0D). The multiplexer is limited by
the SFPs which can do max. 4Gb fibrechannel. The FC switch is a Brocade
5000 series. The respective wavelengths are 1550,1570,1590 and 1610nm for
FC and 1530nm for 10GbE.


Optics
Here is the power output of one port summarized (collected using sfpshow
on different switches)
SITE-A units=uW (microwatt) SITE-B
**********************************************
FAB1
SW1 TX 1234.3 RX 49.1 SW3 1550nm (ko)
RX 95.2 TX 1175.6
FAB2
SW2 TX 1422.0 RX 104.6 SW4 1610nm (ok)
RX 54.3 TX 1468.4
What I find curious at this point is the asymmetry in the power levels.
While SW2 transmits with 1422uW which SW4 receives with 104uW, SW2 only
receives the SW4 signal with similar original power only with 54uW.
Vice versa for SW1-3.
Anyway the SFPs have RX sensitivity down to -18dBm (ca. 20uW) so in any
case it should be fine... But nothing is.
Some SFPs have been diagnosed as malfunctioning by the manufacturer (the
1550nm ones shown above with "ko"). The 1610nm ones apparently are ok,
they have been tested using a traffic generator. The leased line has also
been tested more than once. All is within tolerances. I'm awaiting the
replacements but for some reason I don't believe it will make things
better as the apparently good ones don't produce ZERO errors either.
Earlier there was active equipment involved (some kind of 4GFC retimer)
before putting the signal on the line. No idea why. That equipment was
eliminated because of the problems so we now only have:
the long distance laser in the switch,
(new) 10m LC-SC monomode cable to the mux (for each fabric),
the leased line,
the same thing but reversed on the other side of the link.


FC switches
Here is a port config from the Brocade portcfgshow (it's like that on both
sides, obviously)
Area Number: 0
Speed Level: 4G
Fill Word(On Active) 0(Idle-Idle)
Fill Word(Current) 0(Idle-Idle)
AL_PA Offset 13: OFF
Trunk Port ON
Long Distance LS
VC Link Init OFF
Desired Distance 32 Km
Reserved Buffers 70
Locked L_Port OFF
Locked G_Port OFF
Disabled E_Port OFF
Locked E_Port OFF
ISL R_RDY Mode OFF
RSCN Suppressed OFF
Persistent Disable OFF
LOS TOV enable OFF
NPIV capability ON
QOS E_Port OFF
Port Auto Disable: OFF
Rate Limit OFF
EX Port OFF
Mirror Port OFF
Credit Recovery ON
F_Port Buffers OFF
Fault Delay: 0(R_A_TOV)
NPIV PP Limit: 126
CSCTL mode: OFF
The problem is the 4GbFC fabrics are almost never clean. Sometimes they
are for a while even with a lot of traffic on them. Then they may suddenly
start producing errors (RX CRC, RX encoding, RX disparity, ...) even with
only marginal traffic on them. I am attaching some error and traffic
graphs. Errors are currently in the order of 50-100 errors per 5 minutes
when with 1Gb/s traffic.
Forcing the links on 2GbFC produces no errors, but we bought 4GbFC and we
want 4GbFC.

I don't know where to look anymore. Any ideas what to try next or how to
proceed?
If we can't make 4GbFC work reliably I wonder what the people working with
8 or 16 do... I don't assume that "a few errors here and there" are
acceptable.
Oh and BTW we are in contact with everyone of the manufacturers (FC
switch, MUX, SFPs, ...) Except for the SFPs to be changed (some have been
changed before) nobody has a clue. Brocade SAN Health says the fabric is
ok. MUX, well, it's passive, it's only a prism, nature at it's best.
Any shots in the dark?

Ubuntu failed to upgrade

Ubuntu failed to upgrade

So i was trying to upgrade ubuntu.. and what i did was that i used the
update manager to upgrade it for me. i had the LTS version ans i was
trying to upgrade it to 12.10 so when i started the upgrade i closed all
the programs and started to upgrade and everything went well until the
installing process. it was like fail to install this package a couple of
times and then i displayed that an error occurred and that ubuntu needs to
fix and that it wil run a recovery but it didnt and when i turned off the
computer and turned it back on and tried to run ubuntu first i get the
normal purple/pink starting color with nothing going on and then the
screen flashes and goes dark then it just lights up but its black.. hope
someone can help me fix this and sorry for the weird long explanation

repeater not giving me new value during editing in asp.net

repeater not giving me new value during editing in asp.net

<asp:Repeater ID="RptrSearchedPhotographer" runat="server"
onitemcommand="RptrSearchedPhotographer_ItemCommand"
onitemdatabound="RptrSearchedPhotographer_ItemDataBound">
<ItemTemplate>
<tr>
<td>
<asp:Label ID="LblContactInfo" runat="server" Text='<%#
Eval("ContactInfo")%>'/>
<asp:TextBox ID="TxtContactInfo" runat="server"
Text='<%#Eval("ContactInfo") %>' Visible="false"
></asp:TextBox>
</td>
<td>
<asp:LinkButton ID="LnkDelete" runat="server"
CommandArgument='<%#Eval("Id") %>'
CommandName="delete">Delete</asp:LinkButton>
<asp:LinkButton ID="lnkEdit" runat="server"
CommandArgument='<%#Eval("Id") %>' CommandName="edit"
EnableViewState ="true">Edit</asp:LinkButton>
<asp:LinkButton ID="lnkUpdate" runat="server"
CommandArgument='<%#Eval("Id") %>' CommandName="update"
Visible="false"
EnableViewState="true">Update</asp:LinkButton>
<asp:LinkButton ID="LinkCancel" runat="server"
CommandName="cancel"
Visible="false">cancel</asp:LinkButton>
</td>
</tr>
</ItemTemplate>
</asp:Repeater>
my .cs code is...
if (e.CommandName.Equals("update")) {
TextBox DetailNote =
(TextBox)e.Item.FindControl("txtDetailNote");
string s = DetailNote.Text;
}
but here... its give me old value of in s from textbox. but i want new
value which is inserted during run time... I googled a lot... but its not
work... help...!

pivot on multiple column sql server

pivot on multiple column sql server

I have below table and want to use pivot on multiple column using sum
aggregate.
Category Station1 Station2 Station3
-------------------------------------------------------------
Category1 5.26 6.25 7.28
Category2 4.22 5.00 6.00
Category3 5.00 4.00 8.00
Category1 4.00 7.00 9.00
Category2 2.00 5.00 8.00
And Want Output like
My_Station Category1 Category2 Category3
------------------------------------------------------------------------
Station1 Sum_of_Cat1 Sum_of_Cat2 Sum_of_Cat3
Station2 Sum_of_Cat1 Sum_of_Cat2 Sum_of_Cat3
Station3 Sum_of_Cat1 Sum_of_Cat2 Sum_of_Cat3
With Single Query. Not using any loop
Thanks

Call controller function from Bootstrap-UI Typeahead template

Call controller function from Bootstrap-UI Typeahead template

I am unable to call a controller-function from inside a custom-template
with ui-typeahead:
<input typeahead="val for val in autoComplete($viewValue)"
typeahead-template-url="searchAutocompleteTpl.html"
ng-model="query"/>
<script type="text/ng-template" id="searchAutocompleteTpl.html">
<span ng-repeat="eqp in match.model.equipment"/>
<a href="" ng-click="showItem(eqp.model)">
found in: {{eqp.model}}
</a>
</script>
The problem is that the controller's scope seems to be absent in the
template:
showItem(eqp.model)
is never called. I have also tried with:
$parent.showItem(eqp.model)
to no avail
How can I call a function/value on the controller's scope then?

HeaderTitle not applying localized style from values-ar/styles.xml

HeaderTitle not applying localized style from values-ar/styles.xml

In my Android App I have added components for the arabic version like this:

In the styles.xml I defined:
<style name="HeaderImage">
<item name="android:background">#193660</item>
<item name="android:src">@drawable/logo_white_trans_96x96_300dpi</item>
<item name="android:scaleType">fitStart</item>
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
</style>
<style name="HeaderTitle">
<item name="android:background">#193660</item>
<item name="android:layout_width">fill_parent</item>
<item name="android:layout_height">match_parent</item>
<item name="android:textColor">#ffffff</item>
<item name="android:textSize">25sp</item>
<item name="android:gravity">right|center_vertical</item>
<item name="android:paddingLeft">15dip</item>
</style>
When I launch the emulator (with arabic locale) the text alignment is
correct but all the styles are set to default. No Image is displaying and
it's just the standard gray bar.
The only difference in the values/styles.xml is the gravity "left". The
other files have been copied. Can anyone tell me what I'm doing wrong?

Sunday, 25 August 2013

Where can I get cheap soccer jerseys?

Where can I get cheap soccer jerseys?

I don't need world soccer shop or the teams' sites. i'm talking about
jerseys that sell for under 30 or 40 dollars.

AJAX Script - Now need to update more than one

AJAX Script - Now need to update more than one

I have a results table that allows users to delete library books from
their list of selected books at the checkout stage. I've implemented a
simple AJAX technique so that when the user clicks the Delete button next
to a book in the list it removes it from the page without having to reload
the page - this is all working well.
I now also need to update another element on the page that handles the
pagination showing how many selected books they have. At the top of the
list there is this pagination summary:
<div class="recordlist_nav">Displaying records 1 - 10 of 10 records
selected</div>
As well as removing the book from the list I also need to update this, for
example if they deleted one book it should change to:
<div class="recordlist_nav">Displaying records 1 - 9 of 9 records
selected</div>
I can generate the updated string but not sure how I get my AJAX script to
update multiple elements at the same time. Here's my script:
<script type="text/javascript">
function deleteRecord(recid,articleID) {
// Allocate an XMLHttpRequest object
if (window.XMLHttpRequest) {
// IE7+, Firefox, Chrome, Opera, Safari
var xmlhttp=new XMLHttpRequest();
} else {
// IE6, IE5
var xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
// Set up the readyState change event handler
xmlhttp.onreadystatechange = function() {
if ((this.readyState == 4) && (this.status == 200)) {
document.getElementById("selectedRecord" +
recid).innerHTML=xmlhttp.responseText;
}
}
// Open an asynchronous POST connection and send request
xmlhttp.open("POST", "delete_record.php", true);
xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
xmlhttp.send("recid="+recid+"&articleID="+articleID);
return false; // Do not follow hyperlink
}
</script>
At present the delete_record.php simply echoes out an empty string when it
deletes the selected record:
$result = '';
echo $result ;
I'm storing the updated pagination header in a $navigation variable. I now
need to pass this back to the script and have that script replace the
contents of the with the contents of the $navigation variable.

[ Mathematics ] Open Question : Can fractions be multiplied on the calculator?

[ Mathematics ] Open Question : Can fractions be multiplied on the
calculator?

I am learning how to multiply fractions in the simplest form and ran
across a problem I don't know how to do. If I wanted to figure this out on
the calculator how would I go about doing it? 7/11 x 6/11= I have a
Scientific Calculator. Can I use this one, or would I need a different
type of calculator? Thank you.

Sortable images with jquery sortable in HTML

Sortable images with jquery sortable in HTML

I'm trying to make sortable images with jquery in HTML. What is wrong with
the source here? I've defined the jquery sortable function in a
functions.js file and tested it on this page with text, so I know it
works. But I can't get it to work with the divs of the images and their
respective titles. Do I have to set up the CSS for the image divs a
certain way?
Here is the source. See "sortable" for the sortable div, which surrounds
the image divs.
<html xmlns:exist="http://exist.sourceforge.net/NS/exist">
<head>
<title>William Blake Archive Comparison of The First Book of
Urizen (1794): electronic edition</title>
<script src="/blake/applets/lightbox/lb.js"></script>
<link rel="stylesheet" type="text/css" href="/blake/style.css" />
<link rel="stylesheet" type="text/css" href="/blake/slider.css" />
<link rel="stylesheet" type="text/css"
href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css"
/>
<script
src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"
type="text/javascript"></script>
<script
src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/jquery-ui.min.js"
type="text/javascript"></script>
<script src="/blake/jQueryRotate.2.1.js"
type="text/javascript"></script>
<script src="/blake/binaryajax.js" type="text/javascript"></script>
<script src="/blake/imageinfo.js" type="text/javascript"></script>
<script src="/blake/exif.js" type="text/javascript"></script>
<script src="/blake/accessibleUISlider.jQuery.js"
type="text/javascript"></script>
<script src="/blake/functions.js"></script>
<style type="text/css"></style>
<meta lang="en" />
<script type="text/javascript"></script>
<link rel="meta" type="application/rdf xml"
href="/exist/blake/archive/rdf.xq?req=&amp;mode=obj" />
</head>
<body onLoad="window.name=''">
<div>
<table cellpadding="25" style="width:auto;" id="comparison">
<tr>
<div id="sortable" class="ui-state-default">
<td valign="top" align="center"
style="font-size:smaller;">
<div style="min-width:350px;">
<p>The Book of Urizen, copy G,
c. 1818 (Library of Congress): electronic edition <br />
<a
href="/exist/blake/archive/object.xq?objectid=urizen.g.illbk.21&amp;java=no"
target="wbamain">object 21 (Bentley
21, Erdman 21, Keynes 21)</a>
</p>
<img
src="/blake/images/urizen.g.p21.100.jpg"
/>
<p>
<a
href="javascript:START('/exist/blake/archive/userestrict.xq?copyid=urizen.g')">
<span
style="font-size:smaller">©<date>1998</date>
</span>
</a>&#160;&#160;&#160;&#160;
</p>
</div>
</td>
<td valign="top" align="center"
style="font-size:smaller;">
<div style="min-width:350px;">
<p>The First Book of Urizen, copy B,
1795 (Morgan Library and Museum): electronic edition <br />
<a
href="/exist/blake/archive/object.xq?objectid=urizen.b.illbk.23&amp;java=no"
target="wbamain">object 23 (Bentley
21, Erdman 21, Keynes 21)</a>
</p>
<img
src="/blake/images/urizen.b.p23-21.100.jpg"
/>
<p>
<a
href="javascript:START('/exist/blake/archive/userestrict.xq?copyid=urizen.b')">
<span
style="font-size:smaller">©<date>2003</date>
</span>
</a>&#160;&#160;&#160;&#160;
</p>
</div>
</td>
<td valign="top" align="center"
style="font-size:smaller;">
<div style="min-width:350px;">
<p>A Large Book of Designs, copy A,
1796 (British Museum): electronic edition <br />
<a
href="/exist/blake/archive/object.xq?objectid=bb85.a.spb.02&amp;java=no"
target="wbamain">object 2 (Bentley
85.2, Butlin 262.3)</a>
</p>
<img
src="/blake/images/bb85.a.2.ps.100.jpg" />
<p>
<a
href="javascript:START('/exist/blake/archive/userestrict.xq?copyid=bb85.a')">
<span
style="font-size:smaller">©<date>2012</date>
</span>
</a>&#160;&#160;&#160;&#160;
</p>
</div>
</td>
</div>
</tr>
</table>
</div>
<p>
<script language="JavaScript">
datestamp( );
</script>
</p>
</body>
</html>

[ Friends ] Open Question : Should I try to lose some weight? What do you think of this figure?

[ Friends ] Open Question : Should I try to lose some weight? What do you
think of this figure?

5'9", 145 lbs I gained approx. 15 lbs in the last 13 years. I used to
weigh 130 lbs. Would I look better with less weight on? Here are a couple
pics:

Saturday, 24 August 2013

Git stash not applying all my changes

Git stash not applying all my changes

I am working on a group project. I made a bunch of changes to my files and
right before I pushed to gitHub I noticed there had been a new update so I
ran the commands
git add .
git commit -m "some message"
git stash
then I updated with github
git pull
I changed a gem file and two other places that called for the gem
'rmagick' because it causes me issues.
Then I ran the command
git stash pop
It asked me to commit the changed files and I did,
I ran the git stash pop again but not all of my updates came back. Please
help me so I do not lose 3 hours work.
When I run git stash show -p I can see all of my changes! I think ....

Adding JSON elements to two dimensional array

Adding JSON elements to two dimensional array

Good Day,
I have this JSON object that i want to push and change the two values in
to another array
var line4 = [
{"viewed":2, "sumDate":1377129600000, "redeemed" : 8},
{"viewed":12, "sumDate":1377129600000, "redeemed" : 3},
{"viewed":18, "sumDate":1377129600000, "redeemed" : 13}
];
i want the new line4 to be like this format
line4 = [["2008-06-30", 2], ["2008-7-14", 12, ["2008-7-28", 18]]
i cant seem to format it correctly to my array
$(line4).each(function (index, value) {
console.log("value: " + value);
$(value).map(function(){
d = new Date(parseInt(this.sumDate));
this.sumDate = (1 + d.getMonth()) + '/'+ d.getDate() + '/' +
d.getFullYear().toString().slice(-2);
console.log("sumdate : " +this.sumDate);
console.log("viewed : " +this.viewed);
line5.push([this.sumDate, this.viewed]);
});
});
but im getting
line4 : 8/21/13,2,8/21/13,12,8/21/13,18

Android popup window list view

Android popup window list view

I have a popup window in my project. I got a groups posts in a listview.
If i click a post in listview a popup window will open and it includes
post,post comments and likes; user can like and write comment for that
post in that window. But i couldn't bind my comment datas to popup
window's listview. Below is my codes and logcat data:
ListView lstcomment =
(ListView)popup.getContentView().findViewById(R.id.lstcomments);
CommentAdapter cmm = new CommentAdapter(this, commentarName,
commentarPicture, commentarComment);
System.out.println(cmm.getCount());
if(cmm.getCount()>0)
{
lstcomment.setAdapter(cmm);
}
else
{
lstcomment.setVisibility(View.GONE);
nocomment.setVisibility(View.VISIBLE);
}
Logcat
08-25 02:54:27.680: E/AndroidRuntime(21581): FATAL EXCEPTION: main
08-25 02:54:27.680: E/AndroidRuntime(21581): java.lang.NullPointerException
08-25 02:54:27.680: E/AndroidRuntime(21581): at
com.invemo.vodafonelivecoursetest.CommentAdapter.getCount(CommentAdapter.java:39)
08-25 02:54:27.680: E/AndroidRuntime(21581): at
com.invemo.vodafonelivecoursetest.MainActivity.showFbPopup(MainActivity.java:1342)
08-25 02:54:27.680: E/AndroidRuntime(21581): at
com.invemo.vodafonelivecoursetest.MainActivity.access$9(MainActivity.java:1297)
08-25 02:54:27.680: E/AndroidRuntime(21581): at
com.invemo.vodafonelivecoursetest.MainActivity$3.onItemClick(MainActivity.java:343)
08-25 02:54:27.680: E/AndroidRuntime(21581): at
android.widget.AdapterView.performItemClick(AdapterView.java:315)
08-25 02:54:27.680: E/AndroidRuntime(21581): at
android.widget.AbsListView.performItemClick(AbsListView.java:1058)
08-25 02:54:27.680: E/AndroidRuntime(21581): at
android.widget.AbsListView$PerformClick.run(AbsListView.java:2514)
08-25 02:54:27.680: E/AndroidRuntime(21581): at
android.widget.AbsListView$1.run(AbsListView.java:3168)
08-25 02:54:27.680: E/AndroidRuntime(21581): at
android.os.Handler.handleCallback(Handler.java:605)
08-25 02:54:27.680: E/AndroidRuntime(21581): at
android.os.Handler.dispatchMessage(Handler.java:92)
08-25 02:54:27.680: E/AndroidRuntime(21581): at
android.os.Looper.loop(Looper.java:137)
08-25 02:54:27.680: E/AndroidRuntime(21581): at
android.app.ActivityThread.main(ActivityThread.java:4425)
08-25 02:54:27.680: E/AndroidRuntime(21581): at
java.lang.reflect.Method.invokeNative(Native Method)
08-25 02:54:27.680: E/AndroidRuntime(21581): at
java.lang.reflect.Method.invoke(Method.java:511)
08-25 02:54:27.680: E/AndroidRuntime(21581): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
08-25 02:54:27.680: E/AndroidRuntime(21581): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:606)
08-25 02:54:27.680: E/AndroidRuntime(21581): at
dalvik.system.NativeStart.main(Native Method)
If i write my comment data to logcat via System.out.println i can get data
but i couldn't wrote them to listview.
My Adapter's code:
package com.invemo.vodafonelivecoursetest;
public class CommentAdapter extends BaseAdapter {
private Activity activity;
private String[] profilePicture;
private String[] contentMessage;
private String[] sender;
private static LayoutInflater inflater=null;
public ImageLoader imageLoader;
public CommentAdapter(Activity a, String[] senders, String[]
profilePictures, String[] announceContents) {
activity = a;
this.profilePicture=profilePictures;
this.contentMessage=announceContents;
this.sender=senders;
inflater =
(LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
imageLoader=new ImageLoader(activity.getApplicationContext());
}
@Override
public int getCount() {
return sender.length;
}
@Override
public Object getItem(int position) {
return position;
}
@Override
public long getItemId(int position) {
return position;
}
public static class ViewHolder {
public TextView textTitle;
public ImageView image;
public TextView contentArea;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View vi = convertView;
ViewHolder holder;
if (convertView == null) {
vi = inflater.inflate(R.layout.announce_item, null);
holder = new ViewHolder();
holder.textTitle = (TextView) vi.findViewById(R.id.textView1);
holder.image = (ImageView) vi.findViewById(R.id.imageView1);
holder.contentArea=(TextView)vi.findViewById(R.id.textView2);
vi.setTag(holder);
} else
holder = (ViewHolder) vi.getTag();
holder.textTitle.setText(sender[position]);
holder.contentArea.setText(contentMessage[position]);
holder.contentArea.setAutoLinkMask(Linkify.WEB_URLS);
holder.image.setTag(profilePicture[position]);
imageLoader.DisplayImage(profilePicture[position], activity,
holder.image);
return vi;
}
}

What's wrong with my join statement? It returns BOOLEAN in PHP

What's wrong with my join statement? It returns BOOLEAN in PHP

To make my question as clear as possible (I've been moaned at previously
for being too vague), here's the structure and data of two tables I'm
working with in a project. Table 1 contains a list of football games,
table 2 contains UK football teams that will be recorded in table 1.
I'm just learning about SQL from a book I took out from the library. I've
followed the instructions on joining table data. Here, I am simply trying
to echo the data onto the page, to make sure my query is right before
styling the page around this data.
<?php
//Set DB Variables
$dbc = mysql_connect(host, username, password);
$db = mysql_select_db(database);
$results= mysql_query("SELECT 'tbl_games.game_ID',
'tbl_games.game_date', 'tbl_teams.team_name' FROM tbl_teams,
tbl_games
WHERE 'tbl_games.team1_ID' = 'tbl_teams.team_ID' AND
'tbl_games.team2_ID' = 'tbl_teams.team_ID' AND
'tbl_games.team1_score' IS NULL AND 'tbl_games.team2_score' IS
NULL");
while ($row = mysql_fetch_array($results)) {
foreach ($row as $columnName => $results) {
echo 'Column name: '.$columnName.' Column data:
'.$columnData.'<br/>';
}
}
?>
There are no errors being printed on the page when I run the code, it just
doesn't print anything. But there are (or at least should be) some results
showing up. What did I get wrong here?
--
-- Table structure for table `tbl_games`
--
DROP TABLE IF EXISTS `tbl_games`;
CREATE TABLE IF NOT EXISTS `tbl_games` (
`game_ID` int(6) NOT NULL AUTO_INCREMENT,
`team1_ID` int(4) NOT NULL,
`team2_ID` int(4) NOT NULL,
`team1_score` int(2) DEFAULT NULL,
`team2_score` int(2) DEFAULT NULL,
`game_date` date NOT NULL,
PRIMARY KEY (`game_ID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci
AUTO_INCREMENT=121 ;
--
-- Dumping data for table `tbl_games`
--
INSERT INTO `tbl_games` (`game_ID`, `team1_ID`, `team2_ID`, `team1_score`,
`team2_score`, `game_date`) VALUES
(1, 42, 34, NULL, NULL, '2013-08-23'),
(2, 159, 45, NULL, NULL, '2013-08-23'),
(3, 5, 122, NULL, NULL, '2013-08-23'),
(4, 67, 12, NULL, NULL, '2013-08-24'),
(5, 60, 155, NULL, NULL, '2013-08-24'),
(6, 78, 105, NULL, NULL, '2013-08-24'),
(7, 101, 156, NULL, NULL, '2013-08-24'),
(8, 134, 144, NULL, NULL, '2013-08-24'),
(9, 142, 47, NULL, NULL, '2013-08-24'),
(10, 13, 88, NULL, NULL, '2013-08-24'),
(11, 21, 120, NULL, NULL, '2013-08-24'),
(12, 19, 16, NULL, NULL, '2013-08-24'),
(13, 20, 123, NULL, NULL, '2013-08-24'),
(14, 26, 29, NULL, NULL, '2013-08-24'),
(15, 36, 51, NULL, NULL, '2013-08-24'),
(16, 77, 21, NULL, NULL, '2013-08-24'),
(17, 81, 84, NULL, NULL, '2013-08-24'),
(18, 85, 18, NULL, NULL, '2013-08-24'),
(19, 132, 96, NULL, NULL, '2013-08-24'),
(20, 162, 50, NULL, NULL, '2013-08-24'),
(21, 22, 131, NULL, NULL, '2013-08-24'),
(22, 25, 152, NULL, NULL, '2013-08-24'),
(23, 86, 46, NULL, NULL, '2013-08-24'),
(24, 97, 27, NULL, NULL, '2013-08-24'),
(25, 107, 140, NULL, NULL, '2013-08-24'),
(26, 109, 115, NULL, NULL, '2013-08-24'),
(27, 127, 133, NULL, NULL, '2013-08-24'),
(28, 146, 69, NULL, NULL, '2013-08-24'),
(29, 150, 112, NULL, NULL, '2013-08-24'),
(30, 2, 38, NULL, NULL, '2013-08-24');
-- --------------------------------------------------------
--
-- Table structure for table `tbl_teams`
--
DROP TABLE IF EXISTS `tbl_teams`;
CREATE TABLE IF NOT EXISTS `tbl_teams` (
`team_ID` int(4) NOT NULL AUTO_INCREMENT,
`team_name` varchar(50) COLLATE latin1_general_ci NOT NULL,
PRIMARY KEY (`team_ID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci
AUTO_INCREMENT=164 ;
--
-- Dumping data for table `tbl_teams`
--
INSERT INTO `tbl_teams` (`team_ID`, `team_name`) VALUES
(1, 'Aberdeen'),
(2, 'Accrington Stanley'),
(3, 'AFC Bournemouth'),
(4, 'AFC Wimbledon'),
(5, 'Airdrieonians'),
(6, 'Albion Rovers'),
(7, 'Aldershot Town'),
(8, 'Alfreton Town'),
(9, 'Alloa Athletic'),
(10, 'Annan Athletic'),
(11, 'Arbroath'),
(12, 'Arsenal'),
(13, 'Aston Villa'),
(14, 'Ayr United'),
(15, 'Barnet'),
(16, 'Barnsley'),
(17, 'Berwick Rangers'),
(18, 'Birmingham City'),
(19, 'Blackburn Rovers'),
(20, 'Blackpool'),
(21, 'Bolton Wanderers'),
(22, 'Bradford City'),
(23, 'Braintree Town'),
(24, 'Brechin City'),
(25, 'Brentford'),
(26, 'Brighton & Hove Albion'),
(27, 'Bristol City'),
(28, 'Bristol Rovers'),
(29, 'Burnley'),
(30, 'Burton Albion'),
(31, 'Bury'),
(32, 'Cambridge United'),
(33, 'Cardiff City'),
(34, 'Carlisle United'),
(35, 'Celtic'),
(36, 'Charlton Athletic'),
(37, 'Chelsea'),
(38, 'Cheltenham Town'),
(39, 'Chester'),
(40, 'Chesterfield'),
(41, 'Clyde'),
(42, 'Colchester United'),
(43, 'Coventry City'),
(44, 'Cowdenbeath'),
(45, 'Crawley Town'),
(46, 'Crewe Alexandra'),
(47, 'Crystal Palace'),
(48, 'Dagenham & Redbridge'),
(49, 'Dartford'),
(50, 'Derby County'),
(51, 'Doncaster Rovers'),
(52, 'Dumbarton'),
(53, 'Dundee'),
(54, 'Dundee United'),
(55, 'Dunfermline'),
(56, 'East Fife'),
(57, 'East Stirlingshire'),
(58, 'Elgin City'),
(59, 'England'),
(60, 'Everton'),
(61, 'Exeter City'),
(62, 'Falkirk'),
(63, 'FC Halifax Town'),
(64, 'Fleetwood Town'),
(65, 'Forest Green Rovers'),
(66, 'Forfar Athletic'),
(67, 'Fulham'),
(68, 'Gateshead'),
(69, 'Gillingham'),
(70, 'Greenock Morton'),
(71, 'Grimsby Town'),
(72, 'Hamilton Academical'),
(73, 'Hartlepool United'),
(74, 'Heart of Midlothian'),
(75, 'Hereford United'),
(76, 'Hibernian'),
(77, 'Huddersfield Town'),
(78, 'Hull City'),
(79, 'Hyde'),
(80, 'Inverness Caledonian Thistle'),
(81, 'Ipswich Town'),
(82, 'Kidderminster Harriers'),
(83, 'Kilmarnock'),
(84, 'Leeds United'),
(85, 'Leicester City'),
(86, 'Leyton Orient'),
(87, 'Lincoln City'),
(88, 'Liverpool'),
(89, 'Livingston'),
(90, 'Luton Town'),
(91, 'Macclesfield Town'),
(92, 'Manchester City'),
(93, 'Manchester United'),
(94, 'Mansfield Town'),
(95, 'Middlesbrough'),
(96, 'Millwall'),
(97, 'Milton Keynes Dons'),
(98, 'Montrose'),
(99, 'Morecambe'),
(100, 'Motherwell'),
(101, 'Newcastle United'),
(102, 'Newport County'),
(103, 'Northampton Town'),
(104, 'Northern Ireland'),
(105, 'Norwich City'),
(106, 'Nottingham Forest'),
(107, 'Notts County'),
(108, 'Nuneaton Town'),
(109, 'Oldham Athletic'),
(110, 'Oxford United'),
(111, 'Partick Thistle'),
(112, 'Peterborough United'),
(113, 'Peterhead'),
(114, 'Plymouth Argyle'),
(115, 'Port Vale'),
(116, 'Portsmouth'),
(117, 'Preston North End'),
(118, 'Queen of the South'),
(119, 'Queen''s Park'),
(120, 'Queens Park Rangers'),
(121, 'Raith Rovers'),
(122, 'Rangers'),
(123, 'Reading'),
(124, 'Republic of Ireland'),
(125, 'Rochdale'),
(126, 'Ross County'),
(127, 'Rotherham United'),
(128, 'Salisbury City'),
(129, 'Scotland'),
(130, 'Scunthorpe United'),
(131, 'Sheffield United'),
(132, 'Sheffield Wednesday'),
(133, 'Shrewsbury Town'),
(134, 'Southampton'),
(135, 'Southend United'),
(136, 'Southport'),
(137, 'St Johnstone'),
(138, 'St Mirren'),
(139, 'Stenhousemuir'),
(140, 'Stevenage'),
(141, 'Stirling Albion'),
(142, 'Stoke City'),
(143, 'Stranraer'),
(144, 'Sunderland'),
(145, 'Swansea City'),
(146, 'Swindon Town'),
(147, 'Tamworth'),
(148, 'Torquay United'),
(149, 'Tottenham Hotspur'),
(150, 'Tranmere Rovers'),
(151, 'Wales'),
(152, 'Walsall'),
(153, 'Watford'),
(154, 'Welling United'),
(155, 'West Bromwich Albion'),
(156, 'West Ham United'),
(157, 'Wigan Athletic'),
(158, 'Woking'),
(159, 'Wolverhampton Wanderers'),
(160, 'Wrexham'),
(161, 'Wycombe Wanderers'),
(162, 'Yeovil Town'),
(163, 'York City');
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

Linking to sibling libtool library with recursive Automake

Linking to sibling libtool library with recursive Automake

I am building a shared library, and have a source tree structured like this:
Makefile.am
src/
Makefile.am
srcfile1.h
srcfile1.cpp
...
thirdpaty/
Makefile.am
lib1/
Makefile.am
lib1.h
lib1.cpp
...
lib2/
...
I use recursive Automake since some of the thirdpaty libraries are
distributed with their own Automake files. src/Makefile.am includes the
usual libtool macros:
lib_LTLIBRARIES = libmylib.la
libmylib_la_SOURCES = scrfile1.h srcfile1.cpp ...
How do I link the main library to the third party ones? The Autotools
manual leads me to believe that the third party libraries nees to be built
as libtool conveniece libraries, so I have the following in
thirdparty/lib1/Makefile.am:
noinst_LTLIBRARIES = libthirdpaty1.la
libthirdpaty1_la_SOURCES = lib1.cpp lib1.h
And add the following in src/Makefile.am:
libmylib_la_LIBADD = $(top_buildir)/thirdparty/lib1/libthirdpaty1.la
My root Makefile.am holds the INCLUDES macro:
INCLUDES = -I$(top_builddir)/thirdparty
But building with this configuration gives me undefined symbol errors.
What is the correct way to structure this srouce code and link all the
libraries together?

Best way to manage Listview items from Indy 10 thread

Best way to manage Listview items from Indy 10 thread

I'm making a multi user remote administration tool, a sort of VNC but
which support multi remote desktop viewer a bit like Teamviewer does.
I have a Delphi Form which only contains a TListview, this listview
contains users list which are currently connected to the server.
When a connection is dropped, the listview item is deleted.
For some reason I got some random problems while deleting more than a
single item, for example if I decide to flush the whole server
connections, if I have more than 1 listview item, it start going crazy.
Sometimes no error show up, just some items remain listed, sometimes it
shows "address violations errors".
As I was before using pure Winsock API to make Client / Server
application, I maybe use badly Indy components.
A short explanation about my way of managing the Server component.
My application is Multi Server, which means user could create one or many
servers at the same time. When a new Server is created by the user it run
a new thread which will create a new indy Server component and setup
needed events (OnConnect, OnExecute, OnDisconnect) etc...
Every commands that acts with some VCL form are of course Synchronize
using the Synchronize(); delphi method.
When a new connection show up, i create from the Server Execute method a
new listview item, then i set the new listview item to the AContext.data
property.
When a connection is dropped on the OnDisconnect event, I delete the
listview item then empty the AContext data to be sure, he wont do it again
when he will be automatically destroy.
Synchronize(procedure begin
TListItem(AContext.data).Delete;
end);
AContext.data := nil;
This way of doing works very badly when I have more than a single
connection. After debugging it seems even with the Synchronize commands
are executed at the same time which could result conflicts in the VCL
form.
I'm not an expert in Indy10, any advice would be surely appreciate.
Thank you in advance and sorry for my poor english.

Successfull authentication but status is always offline and rooster is empty (Android,XMPP,Facebook)

Successfull authentication but status is always offline and rooster is
empty (Android,XMPP,Facebook)

pI am developing XMPP client for chat.facebook.com on Android. I use
X-FACEBOOK-PLATFORM mechanism. According to the server response, I am
successfull with authentication. But my JID is strange it is:
-0@chat.facebook.com@chat.facebook.com:5222/Application_a573c90d_4E4AD1661EFE6.
And my status is always offline. And rooster is always empty. My LogCat is
here:/p p08-24 14:13:19.920: I/System.out(12326): PRE-CONNECTED 08-24
14:13:19.950: D/dalvikvm(12326): GC_CONCURRENT freed 372K, 5% free
9556K/10055K, paused 2ms+13ms 08-24 14:13:22.540: D/SMACK(12326): 02:13:22
PM SENT (736870032): 08-24 14:13:22.950: D/SMACK(12326): 02:13:22 PM RCV
(736870032): X-FACEBOOK-PLATFORMDIGEST-MD5 08-24 14:13:22.950:
D/SMACK(12326): 02:13:22 PM SENT (736870032): 08-24 14:13:23.260:
D/SMACK(12326): 02:13:23 PM RCV (736870032): 08-24 14:13:23.280:
W/System.err(12326): java.security.KeyStoreException:
java.security.NoSuchAlgorithmException: KeyStore jks implementation not
found 08-24 14:13:23.280: W/System.err(12326): at
java.security.KeyStore.getInstance(KeyStore.java:119) 08-24 14:13:23.280:
W/System.err(12326): at
org.jivesoftware.smack.ServerTrustManager.(ServerTrustManager.java:70)
08-24 14:13:23.280: W/System.err(12326): at
org.jivesoftware.smack.XMPPConnection.proceedTLSReceived(XMPPConnection.java:871)
08-24 14:13:23.280: W/System.err(12326): at
org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:221)
08-24 14:13:23.280: W/System.err(12326): at
org.jivesoftware.smack.PacketReader.access$000(PacketReader.java:44) 08-24
14:13:23.280: W/System.err(12326): at
org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:70) 08-24
14:13:23.280: W/System.err(12326): Caused by:
java.security.NoSuchAlgorithmException: KeyStore jks implementation not
found 08-24 14:13:23.300: W/System.err(12326): at
org.apache.harmony.security.fortress.Engine.notFound(Engine.java:177)
08-24 14:13:23.300: W/System.err(12326): at
org.apache.harmony.security.fortress.Engine.getInstance(Engine.java:151)
08-24 14:13:23.300: W/System.err(12326): at
java.security.KeyStore.getInstance(KeyStore.java:116) 08-24 14:13:23.300:
W/System.err(12326): ... 5 more 08-24 14:13:23.720: D/SMACK(12326):
02:13:23 PM SENT (736870032): 08-24 14:13:23.760: D/dalvikvm(12326):
GC_FOR_ALLOC freed 197K, 5% free 9677K/10183K, paused 19ms 08-24
14:13:24.383: D/SMACK(12326): 02:13:24 PM RCV (736870032): 08-24
14:13:24.390: D/SMACK(12326): 02:13:24 PM RCV (736870032):
X-FACEBOOK-PLATFORMDIGEST-MD5 08-24 14:13:24.390: I/System.out(12326):
CONNECTED:true 08-24 14:13:24.390: I/TOKEN(12326):
CAAJGIBU9x88BAGqzQnpM1vEInxaMuih6ZCKwAW5zCUK6SIFHfyT7LlS6DiXe8pvePLHHfZBujJ6BattMOjLft7HnsFKO94CYVDWpFPtyGWRivIvI4ZBIxJy1uT4s1yroKCSAyhLyXnZCf9hg8OsQT5TD0RcK3ISWDamyJBEEJmqj9o7YusmhAZCpK5ZCXHThdJHNzXZBfUAndd3tHfd32EW
08-24 14:13:24.430: D/SMACK(12326): 02:13:24 PM SENT (736870032): 08-24
14:13:24.798: D/SMACK(12326): 02:13:24 PM RCV (736870032):
dmVyc2lvbj0xJm1ldGhvZD1hdXRoLnhtcHBfbG9naW4mbm9uY2U9QjdFOTc2M0Q0Nzc2QTlDMTFBMjE0QTRCOTdFQzVEQjU=
08-24 14:13:24.800: D/SMACK(12326): 02:13:24 PM SENT (736870032):
bWV0aG9kPWF1dGgueG1wcF9sb2dpbiZub25jZT1CN0U5NzYzRDQ3NzZBOUMxMUEyMTRBNEI5N0VD
08-24 14:13:24.800: D/SMACK(12326):
NURCNSZhY2Nlc3NfdG9rZW49Q0FBSkdJQlU5eDg4QkFHcXpRbnBNMXZFSW54YU11aWg2WkNLd0FX
08-24 14:13:24.800: D/SMACK(12326):
NXpDVUs2U0lGSGZ5VDdMbFM2RGlYZThwdmVQTEhIZlpCdWpKNkJhdHRNT2pMZnQ3SG5zRktPOTRD
08-24 14:13:24.800: D/SMACK(12326):
WVZEV3BGUHR5R1dSaXZJdkk0WkJJeEp5MXVUNHMxeXJvS0NTQXloTHlYblpDZjloZzhPc1FUNVRE
08-24 14:13:24.800: D/SMACK(12326):
MFJjSzNJU1dEYW15SkJFRUptcWo5bzdZdXNtaEFaQ3BLNVpDWEhUaGRKSE56WFpCZlVBbmRkM3RI
08-24 14:13:24.800: D/SMACK(12326):
ZmQzMkVXJmFwaV9rZXk9NjQwMDUzNTYyNjg5NDg3JmNhbGxfaWQ9MCZ2PTEuMA== 08-24
14:13:25.208: D/SMACK(12326): 02:13:25 PM RCV (736870032): 08-24
14:13:25.210: D/SMACK(12326): 02:13:25 PM SENT (736870032): 08-24
14:13:25.510: D/SMACK(12326): 02:13:25 PM RCV (736870032): 08-24
14:13:25.510: D/SMACK(12326): 02:13:25 PM RCV (736870032): 08-24
14:13:25.530: D/SMACK(12326): 02:13:25 PM SENT (736870032): Application
08-24 14:13:25.925: D/SMACK(12326): 02:13:25 PM RCV (736870032):
-0@chat.facebook.com/Application_a573c90d_4E4AD1661EFE6 08-24
14:13:25.925: D/SMACK(12326): 02:13:25 PM SENT (736870032): 08-24
14:13:26.330: D/SMACK(12326): 02:13:26 PM RCV (736870032): 08-24
14:13:26.340: D/SMACK(12326): 02:13:26 PM SENT (736870032): 08-24
14:13:26.340: D/SMACK(12326): 02:13:26 PM SENT (736870032): 08-24
14:13:26.340: D/SMACK(12326): User logged (736870032):
-0@chat.facebook.com@chat.facebook.com:5222/Application_a573c90d_4E4AD1661EFE6
08-24
14:13:26.340: D/APP_ID(12326): 640053562689487 08-24 14:13:26.340:
I/System.out(12326): TLS:true 08-24 14:13:26.340: I/System.out(12326):
Logged in:true/p

Friday, 23 August 2013

Does every infinite set have a denumerable subset?

Does every infinite set have a denumerable subset?

This question is answered with a mere "Yes" in the textbook (Theory of
Sets by Joseph Breuer), but I'm not sure where the confidence comes from.
For instance, if we have a non-denumerable set, then it seems to me that
no matter what pattern we choose, we'll end up with a subset with the same
cardinal number. Or won't we?
I guess what makes matters worse is that the question right after proving
the theorem that "If a denumrable set is subtracted from a non-denumrable
set, the resulting set is no-denumerable." I understood the proof, and can
even reproduce it perfectly, but I have no idea I understand what it
means. An example would make things clearer, I guess.
I'm thoroughly confused; please help!

Selecting top values from columns

Selecting top values from columns

How can I find top 5 countries with highest population per continent. I
just want to use below 1 table:
URL: http://dev.mysql.com/doc/index-other.html
Database: world database (MyISAM version, used in MySQL certifications and
training)
Below is what I came up with:
select Continent,
substring_index(
GROUP_CONCAT(distinct cast(Name as char)), ',', 5)
From
country
group by
Continent,Name;
Thanks, Rio

Powershell Remoting: Transport Exception

Powershell Remoting: Transport Exception

Here's the code I'm using:
const string username = "domain\\user";
const string password = "password";
var credentials = new PSCredential(username, password.ToSecureString());
var connInfo = new WSManConnectionInfo(new
Uri("https://server.domain.com/powershell"),
"http://schemas.microsoft.com/powershell/Microsoft.Exchange", credentials)
{AuthenticationMechanism =
AuthenticationMechanism.Negotiate};
var rS = RunspaceFactory.CreateRunspace(connInfo);
rS.Open();
Here's the Exception:
Connecting to remote server server.domain.com failed with the following
error message: The WinRM client cannot process the request. The
authentication mechanism requested by the client is not supported by the
server or unencrypted traffic is disabled in the service configuration.
Verify the unencrypted traffic setting in the service configuration or
specify one of the authentication mechanisms supported by the server. To
use Kerberos, specify the computer name as the remote destination. Also
verify that the client computer and the destination computer are joined to
a domain. To use Basic, specify the computer name as the remote
destination, specify Basic authentication and provide user name and
password. Possible authentication mechanisms reported by server: For more
information, see the about_Remote_Troubleshooting Help topic.
So here's my confusion.
I checked the WSMan:\localhost\Client on the client computer, and made
sure AllowUnencrypted was $true.
I checked WSMan:\localhost\Service on the server and made sure
AllowUnencrypted was $true.
WSMan:\localhost\Service\Auth has Negotiate as well as Kerberos set to
$true as well.
What else can I check to get rid of the exception?

Can I define like a main in sikuri? a way to run a serie of sikuri file one by one automatically

Can I define like a main in sikuri? a way to run a serie of sikuri file
one by one automatically

I try to make automatic test on sikuli, I have to many TCs in sikuli
files, but I need all the file on sikuli run one by one without human
actions, a know I can do a batch or a sukili file who run all the files,
but isn't a way to do like a main in a scrip in sikuli?

How to deal with unwanted characters in date with strptime in R

How to deal with unwanted characters in date with strptime in R

I have been sent many datasets with the date in the following format:
10.18.12 klo 04.00.00 ap.
10.18.12 klo 04.00.00 ip.
The dates are in Finnish. 'klo' is for time, ap. is for 'am' and ip. is
for 'pm'. I am trying to read it with strptime but I can't see how to deal
with unwanted characters like "klo", nor how I can tell strptime that what
ap and ip stand for. I thought that something like this might work
time = strptime(paste(date),format='%m.%d.%y%n%n%n%n%n%I.%M%S%n%p%n')
because I thought that I could define unwanted characters as white space
but it doesn't work. Any advice?
Thanks.

how to implement the output of decision tree built using the ctree (party package)?

how to implement the output of decision tree built using the ctree (party
package)?

I have built a decision tree using the ctree function via party package.
it has 1700 nodes. Firstly, is there a way in ctree to give the 'maxdepth'
value.I tried control_ctree option but, it threw some error message saying
couldnt find ctree function.
Also, how can I consume the output of this tree?. How can it be
implemented for other platforms like SAS or SQL. I also have another doubt
as to what does the value "* weights = 4349 " at the end of the node
signify. How will I know, that which terminal node votes for which
predicted value.
P.S. i am a new R user.

Thursday, 22 August 2013

Hibernate + MSSQL Server: using both nvarchar and char strings (jtds driver)

Hibernate + MSSQL Server: using both nvarchar and char strings (jtds driver)

Is it ever possible to use both unicode and non-unicode strings in
Hibernate (version 4) and Microsoft SQL server (2008/2012)?
What we have now - customised SQL Server dialect that generate nvarchar
for strings:
public class SQLServerUnicodeDialect extends SQLServerDialect {
public SQLServerUnicodeDialect(){
super();
// Use Unicode Characters
registerColumnType( Types.VARCHAR, "nvarchar($l)" );
...
}
At jdbc level we're using JTDS driver that convert all strings as unicode
by default (see parameter sendStringParametersAsUnicode).
So I see 2 problems in the task:
How to say hibernate separate unicode and non-unicode strings?
Which jdbc driver support both string types (looks like JTDS has 1 option
- all strings as unicode or no)?
Any thoughts are welcome.

Trying to the hide the arrow on the select tag

Trying to the hide the arrow on the select tag

I have been having problems trying to hide the default arrow icon on the
select tag
http://i255.photobucket.com/albums/hh140/testament1234/select_zpse4931c27.jpg
CSS -
.toolbar .sort-by select {
background:url('/skin/frontend/baby/default/images/select_icon.jpg');
background-repeat:no-repeat;
background-position:center right;
border-radius:5px;
border:1px solid #9edef1;
font-family:'montserratregular', sans-serif;
margin-left: 10px;
}
Regarding the image i have attached if you look at it closely there is a
small background icon behind the default arrow icon. Not sure why it is
not putting the background image on top of the default icon

Streaming Replication Resource Management (PGSQL) on FreeBSD 8.x

Streaming Replication Resource Management (PGSQL) on FreeBSD 8.x

I am attempting to set up PGSQL-HA streaming replication on freeBSD 8.2
(willing to upgrade to 8.4 if need be).
The set up is simple: 2 nodes, one active one standby. I have successfully
set up streaming replication between the two nodes, but I am now trying to
set up a resource agent/manager to deal with automatic failover and
STONITH.
I have attempted to use Heartbeat/Corosync/Pacemaker for this, but am
running into difficulty building them from source (Pacemaker, in
particular).
Is there an easier way than using Pacemaker for a simple 2 node set up? I
have little experience with this and especially with freeBSD.
Thanks!
*Note: FreeBSD 8.x is required, the servers are running other services
that would make it too difficult to upgrade or change the OS

In Word 2010, how do you have copy at 45 degrees?

In Word 2010, how do you have copy at 45 degrees?

I'm transferring an Excel document with headers at 45 degrees to a Word
doc (2010). the paste transfers the line to horizontal which takes up too
much space. How do I keep the 45 degrees angle?

Run time Polymorphism

Run time Polymorphism

In polymorphsim we 2 types. 1)Compile time - Method Over Loading 2)Run
time - Method Over riding How can we say method over riding ** is **Run
time Polymorphism

Oracle: SELECT where date is less if not equals null

Oracle: SELECT where date is less if not equals null

I have a table of records, and one column holds the value when the records
turns in-active. Most of the records are still open, and there for do not
hold any value in the end_date column. I want to select all of those
records, wich are still active. One way to achieve this (from the top of
my head):
select *
from table t
where nvl(t.end_date, to_date('2099-DEC-31', 'MM-DD-yyyy')) > sysdate
But it doesn't feel right. Is there a better way to achieve what I want?

Script strange behavior

Script strange behavior

I have a table with users and i have a link to delete user from database.
Sometimes it works fine, but some times it freezes when i confirm deletion
and i have to press "Esc" button for confirm window to disappear. I use
"$(document).on('click', function()" because i add users via jquery, and
if i use "$(document).ready(function()" newly added users won't delete.
Could you please check this script for errors and tell me if it's script
issue or something else? May be there is a way to improve it?
Script
$(document).on('click', function() {
$("a:contains('Delete')").click(function(event) {
if(confirm("Are you sure ?")){
$.ajax({
url: $(event.target).attr("href"),
type: "DELETE",
beforeSend: function(xhr) {
xhr.setRequestHeader("Accept", "application/json");
xhr.setRequestHeader("Content-Type",
"application/json");
},
success: function() {
var tr = $(event.target).closest("tr");
tr.css("background-color","#000000");
tr.fadeIn(1000).fadeOut(200, function(){
tr.remove();})
}
});
} else {
event.preventDefault();
}
event.preventDefault();
});
});
Table cell with delete link
<a href="/delete/${user.login}.json">Delete</a>

Wednesday, 21 August 2013

Getting Error in BaseAdapter Android

Getting Error in BaseAdapter Android

I have created a class that extends BaseAdapter.I don't have any
custom.xml to inflate it . Simple i have written this code
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = getLayoutInflater();//Getting Error here
to create a method getLayoutInflater
View row;
row = inflater.inflate(android.R.layout.simple_list_item_1,
parent, false);
TextView title;
title = (TextView) row.findViewById(android.R.id.text1);
title.setText(Title[position]);
return (row);
}
On getLayoutInflater() it is showing me the error to create a method.If i
am creating this class in the main activity then it is working properly.So
what i have to do remove this error

How are concatenated strings allocated?

How are concatenated strings allocated?

I was wondering how strings and memory work together.
As far as I'm aware, I know that when a string is created, it puts some
array of characters + '\0' into memory. I also know that they're
immutable. So for things like concatenation, what happens in memory that
allows you to access the same string?
I don't imagine that the string or character you concatenated is put
directly after the addresses of the original strings because that might
overlap some needed memory.
In C# and other languages, you can say:
string s = "Hello" ... s = s + '!'
Would this be creating a new string? One that is pointing to a new
location that says "Hello!", leaving the original never to be referenced?
Or is there a default char buffer that strings use that allows for some
space in concatenation?

How to Increment a nvarchar value + number when more then one value is displayed for a given ID

How to Increment a nvarchar value + number when more then one value is
displayed for a given ID

I need to add a address type value to a column when more then one value is
returned from the query below. For example if a single result is returned
then I want the value in the address type column to be Business. But if
there is more then one value returned, I want it to increment a value
after the first result to be Alternate Business 1,Alternate Business 2,
Alternate Business 3 etc.
Can anyone help me out?
SELECT al.ADDRESS_ID, addr.LINE1 + ' (' + addr.LABEL + ')' AS
ModifiedLine1, addr2.ADDR_TYP_ID, addr2.LABEL, addr2.LINE2, addr2.LINE3,
addr2.CITY, addr2.STATE, addr2.COUNTRY, addr2.POSTAL_CD FROM
INT_AUX_LST_ADDR al LEFT JOIN INT_AUX_ADDRESS addr ON addr.ADDRESS_ID =
al.ADDRESS_ID LEFT JOIN INT_AUX_ADDRESS addr2 ON addr2.ADDRESS_ID =
al.ADDRESS_ID LEFT JOIN INT_RELATION_TYP rt ON rt.RLTN_TYP_ID =
al.RLTN_TYP_ID WHERE al.LISTING_ID = 1

how to hide a Check box in the pdfpcell while checking a condition using ItextSharp in a c#asp.net web application

how to hide a Check box in the pdfpcell while checking a condition using
ItextSharp in a c#asp.net web application

Context: created a checkox and tried to add the check box to the pdfpcell
using the cellEvent. added the table contains the check box to parent
table pdfpcell using addElement method. how do i make the
checkbox.checked=true using itextsharp on satisfying certain condition
like we can do in asp.net on checkbox control
PdfPTable fslchkbox = new PdfPTable(1);
chkbox = new PdfPCell();
chkbox.HorizontalAlignment = PdfPCell.ALIGN_LEFT;
iTextSharp.text.pdf.events.FieldPositioningEvents fslevents = new
iTextSharp.text.pdf.events.FieldPositioningEvents(writer, ck2);
chkbox.CellEvent = fslevents;
chkbox.Border = 0;
fslchkbox.AddCell(chkbox);
PdfPCell FSLChk = new PdfPCell();
FSLChk.Border = 0;
FSLChk.HorizontalAlignment = PdfPCell.ALIGN_LEFT;
FSLChk.AddElement(fslchkbox);
program.AddCell(FSLChk);
document.add(program);

Rails - Polymorphic Self-Join Model Associations

Rails - Polymorphic Self-Join Model Associations

I'm working on building an app to keep track of product designs, and I'm
having some trouble with my associations. Basically I have a model
(Assembly) which needs to have polymorphic association, but also needs to
be able to belong to itself.
To illustrate, I have three models: Product, Assembly, and Part.
A Product can have many Assemblies.
An Assembly can have many Parts AND Assemblies.
An Assembly belongs to a Product OR an Assembly.
A Part belongs to an Assembly.
My model definitions are currently like this:
product.rb
class Product < ActiveRecord::Base
belongs_to :product_family
has_many :assemblies, as: :assemblable
end
assembly.rb
class Assembly < ActiveRecord::Base
belongs_to :assemblable, polymorphic: true
has_many :parts
has_many :subassemblies, as: :assemblable
end
part.rb
class Part < ActiveRecord::Base
belongs_to :assembly
belongs_to :product_family
end
What I would like to be able to do is, given an assembly called "top_assy":
top_assy.subassemblies.create
However, when I try this, I get the following error:
NameError: uninitialized constant Assembly::Subassembly
I'm clearly doing something wrong here - what am I missing? I have already
tried adding 'class_name: "Assembly"' as an argument to the 'has_many
:subassemblies' command.
Thanks in advance!

Why can't I compare a count of a new array?

Why can't I compare a count of a new array?

Can someone explain this to me ?
if(0 <= -1)
NSLog(@"Thank god");
if([NSArray new].count <= -1)
NSLog(@"What the **** ? %i", [NSArray new].count);
if([[NSArray alloc] init].count <= -1)
NSLog(@"What the **** ? %i", [[NSArray alloc] init].count );
Output is twice What the **** ? 0 and I was expecting no output I expect
to have 0 as count.
If I put the count in a int or log it it ouputs 0 (zero), but the if
statement generates a true on this.

set all div in html without vertical scrollbar

set all div in html without vertical scrollbar

I am building Dashboard page which contains graphs(using HighCharts for
same). my html also contains jQuery Tabs.
In one tab there are 4 different charts.charts are getting loaded properly
but it comes with vertical scroll bar. being a dashboard page i want to
hide vertical scroll bar.
Here is My HTML
<div id="container" style="width:98%;">
<ul>
<li><a href="#divP1">Dashboard</a></li>
<li><a href="#divP2">Network</a></li>
<li><a href="#divP3">> 24 Hours</a></li>
</ul>
<div id="divP1" style="margin:0 auto;">
<div id="divDailyUptimeLineChart"
style="width:650px;height:250px;float:left;"></div>
<div style="width:500px;height:250px;margin-left:750px;"
id="divUptimeGauge"></div>
<br />
<div style="clear:both;width:700px;float:left;"
id="divFaultCount"></div>
<div style="margin-left:700px;" id="divTicketTypeCount"></div>
<br />
</div>
<div id="divP2" style="margin:0 auto;">
<div id="divFaultTicketType" style="width:49%;float:left;"
></div>
<div id="divCRATicketType"
style="margin-left:49%;width:49%"></div>
</div>
<div id="divP3" style="margin:0 auto;">
<div id="divTicketTypeTime"></div>
</div>
</div>
HighCharts are reneder to divDailyUptimeLineChart divUptimeGauge
divFaultCount divTicketTypeCount On first tab
JS :
$('#container').tabs();
I have tried this code in my HighCharts Defination Code : but it didnt worked
chart: {
renderTo: divID,
type: 'gauge',
height: $(document).height()/2,
width: $(document).width()/2,
},