Saturday 31 August 2013

function, JSON, and variable

function, JSON, and variable

I've a problem with creation a function. For example I have a parsed json
date, I want to get value of 'test' and return it.
function returnVal(name) {
parsedJSON = JSON.parse('{"test": "hello"}');
return parsedJSON.name;
}
Thanks for any advices, and excuse me for my bad English :)

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?

imagepolygon - Generate strange output

imagepolygon - Generate strange output

When try to run this code, a strange output happen.
<?php
// cria uma imagem em branco
$image = imagecreate(400, 300);
// prenche a cor do fundo
$bg = imagecolorallocate($image, 0, 0, 0);
// escolhe uma cor para o poligono
$col_poly = imagecolorallocate($image, 255, 255, 255);
// desenha o poligono
imagepolygon($image,
array (
0, 0,
100, 200,
300, 200
),
3,
$col_poly);
// envia a imagem
header("Content-type: image/png");
imagepng($image);
?>
The output is:
Warning: Cannot modify header information - headers already sent by
(output started at /var/www/drawimage/index.php:2) in
/var/www/drawimage/index.php on line 23
what should be the picture looks like this:
‰PNG
IHDR,×ywPLTEÿÿÿ¥ÙŸÝ1IDAThí•;ŽÜ0D5끡À€Ç™C±¡à#è(lt;åÌýùivWeX»+'Púa§8ÑYxä7üä'lt;ò-ÒÈKhdþÅ#3¦Ä#EÓwy²È?ñÈû‡ŒðÊÈôb'0}á'yMH#ïÏáò~V™yû¥òžV™ç:g\Ö+Nlt;8dmE*³¬2qšXeâñGDamp;ú¿ÌŠÊ„÷©ÌŠÊ¬¥He¶ï
ÙFŸSf¾p¶iá"ÙN™ý‚Ù;QÊì§L\œ21{‚'í¹ð¥LØž"2;B)³W¢"9¾Bä|F™¹xA9f…Qæ@eÎëMlt;pälD(sŒ2q1ÊÄê
DŽ÷Â#„2áxÊœ¡ÌYˆPæú'kìqeæfáæš\™Á•¹/7ñH@'»¬ÌàÊÄs+••¹VÀÊ„k+s#°2wX™ìD²¡G•™Õ¥™lNPe2Uamp;¿ÚÄ#Cò6
29‚*ï%ªL쬍H¶^xTamp;dkP™•ÉË€ÊýBŠ'Ç"™»›nŠ)Á")L™òb)»@Ê"¦LÌ7˜2ÑØuÅnáH™Pì
eJR¦¬)Sµ©Qf6·jªA"©D™úZ©›ÊÔ¢L,·ˆ2ÑÙ+'j¿ð L¨ö€25(S"iº&lsqauo;&lsqauo;4ãî+Ó
¾2Í„øÊ4ˆ¯L{©‰G‚‡´=\eZÄWamp;Ö¾2 â+#ÍÉÂ#®2¡9q•iW™¶†«ŒÒ\DvOñ"QæÃSFA
/code/pre
pwhat is happening?/p

How to figure out the right size background image for iPhone

How to figure out the right size background image for iPhone

I am working with media queries to create screen breaks, in order to have
a website optimized on both the desktop and mobile. Currently, when I
bring the site up with its current css the background pictures are
stretched out of proportion. (The current background sizes are: 640px x
960px.)
Here is the current css:
@media only screen and (-webkit-min-device-pixel-ratio : 2), only screen
and (min-device- pixel-ratio : 2) {
#home{width: 980px;
height: 1090px;
background-image: url(../images/landingPageRetina.jpg) 50% 0
no-repeat;
background-size: 100% 100%;}
#about{background-image: url(../images/aboutMobile.png) 50% 0 no-repeat;}
#music{background-image: url(../images/musicMobile.jpg) 50% 0
no-repeat;}
#videos{background-size: url(..images/videosMobile.jpg)50% 0 no-repeat;}
#connect{background-image: url(..images/connectMobile.jpg)50% 0
no-repeat ;}
#contact{background-image: url(../images/contactMobile.jpg)50% 0
no-repeat ;}
}
Does anyone have any suggestions on what the correct sizes are - so that
the images will render proportionally?

Encrypted password in database and browser digest auth

Encrypted password in database and browser digest auth

I wrote a small webserver which currently uses basic auth over ssl. So far
everything works great. Now I want (need) to switch to digest auth. But I
can't figure how out to make this work with passwords that are not stored
as cleartext in the database? I only have the password digest (generated
using bcrypt) of my users' passwords stored. Is http digest auth possible
at all?

Passing values of radio buttons to another page for manipulation

Passing values of radio buttons to another page for manipulation

I am totally new to HTML and javascript programming. I made a quiz in a on
a website and try to now transfer the values of the radiobuttons to
another website where I want to do data manipulation with the values.
My first page with the quiz looks like this:
<html>
<head>
<title>How ecoconscious are you ?</title>
<style type="text/css">body {margin: 10px;
ol {
padding-left: 50px;
}
</style>
</head>
<body>
<!-------- Quiz Starts Here -------->
<h3>How ecoconscious are you ?</h3>
Hello and thank you for participating in this quiz to determine how
ecoconscious you really are.<br/><br/>Please try to answer these questions
as objective as possible. Please be honest with your answers as this will
make the statistic better!
<form action="http://how-ecoconscious-are-you.webs.com/statistics"
method="post">
<input type="hidden" name="QuizTitle" value="How ecoconscious are you ?"/>
<ol>
<li>What kind of car are you driving ?<br/>
<input type="radio" name="ans1_1" value="1"/>I have a regular car<br/>
<input type="radio" name="ans1_2" value="1"/>I drive a SUV<br/>
<input type="radio" name="ans1_3" value="1"/>I have a hybrid car<br/>
<input type="radio" name="ans1_4" value="1"/>I have a pick-up truck<br/>
<input type="radio" name="ans1_5" value="1"/>I don't have a car<br/><br/>
<p><input type="submit" onclick="this.value='Please wait ...'"
value="Submit!"/></p>
</ol>
</form>
<!-------- Quiz Ends Here -------->
</body>
</html>
When the submit button is clicked one gets forwarded to this page:
<html>
<head>
<script type="text/javascript"
src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
var answer1_1, answer1_2, answer1_3, answer1_4, answer1_5;
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data1 = google.visualization.arrayToDataTable([
['Task', 'What kind of car are you driving ?'],
['I have a regular car',answer1_1],
['I drive a SUV',answer1_2],
['I have a hybrid car',answer1_3],
['I have a pick-up truck',answer1_4],
['I do not have a car',answer1_5]
]);
var options1 = {
title: 'What kind of car are you driving ?',
is3D: true,
};
var chart1 = new
google.visualization.PieChart(document.getElementById('1'));
chart1.draw(data1,options1);
}
</script>
</head>
<body>
<div id="1" style="width: 900px; height: 500px;"></div>
</body>
</html>
How can I now make the values of the radiobuttons on the first page be
available on the second page for data manipulation (they are supposed to
build a statistical pie chart depending on the answers of the
participants)? Once the data is transferred, where do I have to make the
manipulation ?
Thanks in advance. Any help is geatly appreciated.

Delphi: How can I print the contents of a DBGrid or ADOQeury?

Delphi: How can I print the contents of a DBGrid or ADOQeury?

On the program I am working on for a school project, there is a results
page which displays the contents of a database in a DBGrid using a
ADOQuery component. I have a button on the page which when I click it, it
should print whatever the contents of the DBGrid is with a printer.
The printer setup is already done with a PrintDialog component, I know how
to do that part, the problem is finding a way to print the contents of
DBGrid.
Is this possible? If it is, how? Thanks in advance for any help in this
matter.

c/Invoke for cl x64

c/Invoke for cl x64

Is it exist the "arch" port for library: c/Invoke , for cl x64 compiler?
Or anybody can suggest another cross platform library like c/Invoke? Thanks.

Friday 30 August 2013

How do I prevent OS X from modifying a text file?

How do I prevent OS X from modifying a text file?

I emailed a text file with \n line terminations to a friend who uses OS X.
In the process, the \n's turned into \r\n's. I presume that OS X did the
nasty deed. Is there anything I can put into the file to fool OS X into
not fiddling with my file?
(I need the file intact because the first line is an MD5 signature to
verify the rest of the file. The file is destined for an embedded system
via a flash stick)
I'll propose solution number 1: Create the file with \r\n to begin with.

Thursday 29 August 2013

How do I select specific cells in VBA?

How do I select specific cells in VBA?

Basically I need to select specific cells on an excel sheet in vba. For
example the code should be able to select a5, a10, a15. I do not want the
cells in between them, just the ones I listed. Is there a specific
function that will do this? It seems like .Range could only take start
cell and ending cell.

Raster overlay from a matrix

Raster overlay from a matrix

I have a matrix of 100 raster layers and I'd like to create one new layer
that is the average. I understand if there were two layers I could simply
use the overlay function or perhaps just use c <- mean (a, b). However,
I'm not sure how to proceed with the matrix.
Here is sample of the matrix:
[[1]]
class : RasterLayer
dimensions : 175, 179, 31325 (nrow, ncol, ncell)
resolution : 1, 1 (x, y)
extent : 0, 179, 0, 175 (xmin, xmax, ymin, ymax)
coord. ref. : NA
data source : in memory
names : layer
values : 0, 100 (min, max)
I have tried
a.avg <- mean (a.total[,])
and I receive the error argument is not numeric or logical: returning NA

Is it possible to preserve the default formula fields values in a crystal report?

Is it possible to preserve the default formula fields values in a crystal
report?

I have a crystal report in which I'm trying to dynamically insert an
image. I've managed to make it work on the report itself by adding the
path to the image in the graphic location property and when I preview the
report the picture displayed is the one I intended to display, not the one
I'm using as placeholder.
However, it doesn't seem to work in the application (I get the image I
used as placeholder instead of the one I set the graphic location to).
After exporting the report from the report viewer, I found out that when
the report is displayed, the formula fields used are wiped and the value
I've stored in the Graphic Location of the picture - which is the path to
the image I want to show dynamically - is blank.
In the code of my application, I'm setting the formula field I'm using as
the path of the image I want to display.
Here's the code:
Dim CrReport As New ReportDocument
CrReport = New myReport
CrReport.DataDefinition.FormulaFields.Item("picpath").Text =
"""C:\Picture.jpg"""
CrystalReportViewer1.RefreshReport()
CrReport.Refresh()
picpath is the formula field that holds the path to the picture.
I'm using Crystal Reports XI and Visual Studio 2008.
What I'd like to know is: is it possible to preserve the default values of
the formula fields so that they can be changed programmatically at
runtime?
For example: If the default value I set for a formula field is
"C:\Picture.jpg", when I run the report in the application without
changing this value, it will remain the same.

Wednesday 28 August 2013

Remote Desktop Gateway 401 rpcping response

Remote Desktop Gateway 401 rpcping response

A vanilla domain-less install of Windows Server 2008R1 and following many
of available guides:
http://technet.microsoft.com/en-us/library/dd983949(v=ws.10).aspx
Full Computer Name set to TSGSERVER.local, Workgroup WORKGROUP.
Add roles for Remote Desktop Services and the Remote Desktop Gateway.
Create self-signed certificate.
Complete install.
Export certificate via MMC from Local Computer/Personal/Certificates.
Import certificate via MMC to Local Computer/Trusted Root Certification
Authorities.
Test with rpcping on command line:
rpcping -v 3
-e 3388
-t ncacn_http
-s localhost
-o RpcProxy=TSGSERVER.local
-P "Administrator,WORKGROUP,Password1"
-H NTLM -u NTLM
-a connect
-F ssl
-B msstd:TSGSERVER.local
-E
-R None
And the RPC fails:
RPCPing v6.0. Copyright (C) Microsoft Corporation, 2002-2006
Since you have specified the RPC/HTTP proxy echo only option (-E), the
endpoint
/interface you have specified will be ignored as no calls will reach the
RPC/HTT
P server
RPCPing set Activity ID: {0c934a78-201c-40a3-82e8-9700bd928be6}
RPCPinging proxy server tsgserver.local with Echo Request Packet
Setting autologon policy to high
Sending ping to server
Response from server received: 401
Use Server Preffered Auth Scheme: 2
Setting autologon policy to high
Sending ping to server
Response from server received: 401
Client is not authorized to ping RPC proxy
Ping failed
With the IIS log files being similarly informative:
#Software: Microsoft Internet Information Services 7.5
#Version: 1.0
#Date: 2013-08-28 18:01:02
#Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port
cs-username c-ip cs(User-Agent) sc-status sc-substatus sc-win32-status
time-taken
2013-08-28 18:01:02 192.168.1.1 RPC_IN_DATA /Rpc/rpcproxy.dll - 443 -
192.168.1.1 MSRPC 401 2 5 514
2013-08-28 18:01:02 192.168.1.1 RPC_IN_DATA /Rpc/rpcproxy.dll - 443 -
192.168.1.1 MSRPC 401 2 5 0
What steps am I missing?

Python arguments cuts at < when reading from command line

Python arguments cuts at < when reading from command line

I got a script that is supposed to take the time it takes to execute a
python-script. For simplicity I just supply the actual command I want to
execute as arguments in the commandline.
Say I call:
python time.py python ratatosk.py < input.txt
Here everything after python time.py is the actual command I want to execute.
However, when reading the sys.argv with this:
print 'Number of arguments:', len(sys.argv), 'arguments.'
print 'Argument List:', str(sys.argv)
It only returns:
Number of arguments: 3 arguments.
Argument List: ['time.py', 'python', 'ratatosk.py']
Where did the rest of the arguments go? It looks like < somehow stripped
it away.
I am running Python Python 2.7.3 (v2.7.3:70274d53c1dd, Apr 9 2012,
20:52:43) on a MacBook Pro.

Convert multiple unicode in a string to character

Convert multiple unicode in a string to character

Problem -- I have a string say Buna$002C_TexasBuna$002C_Texas' and where $
is followed by unicode. I want to replace these unicode to its respective
unicode character representation.
In perl if any unicode is in the form of "\x{002C} then it will be
converted to it respective unicode character.Below is the sample code.
#!/usr/bin/perl
my $string = "Hello \x{263A}!\n";
@arr= split //,$string;
print "@arr";
I am processing a file which contain 10 million of records. So i have
these strings in a scalar variable. To do the same as above I am
substituting $4_digit_unicode to \x{4_digit_unicode} as below.
$str = 'Buna$002C_TexasBuna$002C_Texas';
$str =~s/\$(.{4})/\\x\{$1\}/g;
$str = "$str"
It gives me
Buna\x{002C}_TexasBuna\x{002C}_Texas
It is because at $str = "$str" line $str is being interpolated but not its
value. So \x{002C} is not being interpolated by perl.
Is there any way to force perl so that it will also interpolate the
contents of $str too.
OR
Is there any other method to achieve this? I do not want to take out each
of the unicode then pack it using pack "U4",0x002C and then substitute it
back. But something in one line (like below unsuccessful attempt) is OK.
$str =~s/\$(.{4})/pack("U4",$1)/g;
I know above if wrong; but can I do something like above.
For input string $str = 'Buna$002C_TexasBuna$002C_Texas' desired output is
Buna,_TexasBuna,_Texas.

How to print out a div its with inline css in ruby on rails?

How to print out a div its with inline css in ruby on rails?

I need to print a div content with its inline cascading style sheet. The
div is showing on the middle of page as a pop up.

Tuesday 27 August 2013

How to received sms in android?

How to received sms in android?

I am new to android and i am using android 2.1 for some sms_receive thing:
when an sms received,it won't work... Nothing happens when sms received
and I have force close, help! Code for androidmanifest.xml:
enter code here <uses-sdk android:minsdkversion="7" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<application android:label="@string/app_name">
<activity>
android:name=".SmsReceiver"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver android:name="com.example.smsreceiver.SmsReceiver"
android:enabled="true">
<intent-filter android:priority="2147483647">
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
</intent-filter>
</receiver>
</application>
public class RSMSActivity extends BroadcastReceiver {
private static final String SHORTCODE = "55443";
@Override
public void onReceive(Context context, Intent intent) {
Bundle bundle = intent.getExtras();
Object[] messages = (Object[]) bundle.get("pdus");
SmsMessage[] sms = new SmsMessage[messages.length];
//Create messages for each incoming PDU
for (int n = 0; n < messages.length; n++) {
sms[n] = SmsMessage.createFromPdu((byte[]) messages[n]);
}
for (SmsMessage msg: sms) {
//Verify if the message came from our known sender
if (TextUtils.equals(msg.getOriginatingAddress(), "09358921973")) {
Toast.makeText(context, "Received message from the mothership:
" + msg.getMessageBody(),
Toast.LENGTH_SHORT).show();
}
}
}
}

EWS 401 Unauthorized - But only when running under a service on the target server

EWS 401 Unauthorized - But only when running under a service on the target
server

I have written a windows service in C# to automatically poll an exchange
mailbox using EWS.
On my development machine, which is connected to the exchange server
network via VPN, it works perfectly.
On the target server the EWS is returning Request failed. The remote
server returned an error: (401) Unauthorized.(The remote server returned
an error: (401) Unauthorized.)
On the same server, I can connect to the EWS URL via a browser using the
same credentials as are being provided to the service.
The credentials are provided in the app.config file, and I have triple
checked that they are the same on the target server as my development
machine.
What could be causing this?

How to use GAMMA function _xlfn.GAMMA?

How to use GAMMA function _xlfn.GAMMA?

Microsoft website has an introduction on GAMMA function.
I could download it and have a look, the formula is shown as
=_xlfn.GAMMA(2.5).
However, when I create a new excel file, I can't use it, neither by write
formula as =_xlfn.GAMMA(2.5)" or "=GAMMA(2.5).
Did I missed something? Is there some library I shall register, like using
Solver function?
I'm using Excel 2007. The msdn page says "GAMMA" function applies to Excel
2003, so I guess the problem is not the version, but some usage trick.

How java ensures only one instance of an enum per JVM

How java ensures only one instance of an enum per JVM

How does Java ensure internally that only one instance of an ENUM would
exist per JVM? Is it created when application boots up and from that point
on when multiple threads access it, it will just return the object created
at startup?
Or does it implement some kind of double synchronization similar to the
singleton pattern so that even if multiple threads access it, only one
istance will be created?

Listview - Capture text from dynamically created textbox on Update

Listview - Capture text from dynamically created textbox on Update

I have a database and a bound Listview with dynamically created controls.
I have been attempting to find a way to capture the new value using markup
as
<asp:ListView ID="ListView1" runat="server" DataSourceID="SqlDataSource1"
DataKeyNames="ID" OnItemUpdating="ListView1_ItemUpdating">
and code behind as
Protected Sub ListView1_ItemUpdating(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.ListViewUpdateEventArgs) Handles
ListView1.ItemUpdating Dim capString As String = String.Empty capString =
e.NewValues End Sub
This fails with the error Unable to cast object of type
'System.Collections.Specialized.OrderedDictionary' to type 'System.String'
I'm hoping someone could help me identify either a better way to
accomplish capturing this data, or if it is possible to cast this data and
how to do it in code.

Has a command access to its own name=?iso-8859-1?Q?=3F_=96_tex.stackexchange.com?=

Has a command access to its own name? – tex.stackexchange.com

Can two commands where the one is a copy of the other so that \ifx gives
true have different behaviour depending on the actual name used for a
call? \documentclass{article} \newcommand\red{some code …

Slow Find on Mongo DB

Slow Find on Mongo DB

Hi guys i have a problem with mongo, i have install mongodb following
documentation and, i use mongo with spring. I have insert on mongo 400000
row of a little of file:
List<LinkedHashmap<String,Object> listelem = contains all row of a file.
MongoTemplate mongo = new MongoTemplate(new MongoClient(), "mydb");
mongo.insert(list, "mycollection");
for(int i=0; i< list.size();i++){
mongo.insert(list.get(i), "mycollection");
}
I have use this solution because if i use:
mongo.insert(list, "mycollection");
and the content of file is >16MB is very slow to insert. (there is a
solution?)
If the i want find all row of a file i make this:
MongoTemplate mongo = null;
try {
mongo = new MongoTemplate(new MongoClient(), "mydb");
} catch (UnknownHostException e) {
e.printStackTrace();
}
Query search = new Query(Criteria.where("idfile").is(idfile));
List<BasicDBObject> listElem =
mongo.find(search,BasicDBObject.class,"mycollection");
But this find is very slow and i have insert index on db:
db.mycollection.ensureIndex( { "idfile": 1 } )
Where am I doing wrong? Thanks.

Monday 26 August 2013

Unusual error in Clients website

Unusual error in Clients website

I just created an account on my client's website (which I build for him).
I have tested this website extensively and could not find any problems - 2
years ago. I've since tested it to make sure it's all running smoothly
every month since the website was released.
I just created a new account on his website just now, and I get this error:
Server Error in '/' Application.
Mailbox unavailable. The server response was: <me@myemail.com> No such
user here
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.
Exception Details: System.Net.Mail.SmtpFailedRecipientException: Mailbox
unavailable. The server response was: <me@myemail.com> No such user here
Source Error:
Line 62: HttpUtility.UrlEncode(token));
Line 63:
Line 64: WebMail.Send(
Line 65: email,
Line 66: "Please confirm your Account.",
Source File:
d:\HostingSpaces\website\website.com.au\wwwroot\Protected\Account\Register.cshtml
Line: 64
Stack Trace:
[SmtpFailedRecipientException: Mailbox unavailable. The server response
was: <me@myemail.com> No such user here]
System.Net.Mail.SmtpTransport.SendMail(MailAddress sender,
MailAddressCollection recipients, String deliveryNotify,
SmtpFailedRecipientException& exception) +1229659
System.Net.Mail.SmtpClient.Send(MailMessage message) +1772
System.Web.Helpers.WebMail.Send(String to, String subject, String body,
String from, String cc, IEnumerable`1 filesToAttach, Boolean
isBodyHtml, IEnumerable`1 additionalHeaders, String bcc, String
contentEncoding, String headerEncoding, String priority, String
replyTo) +686
ASP._Page_Protected_Account_Register_cshtml.Execute() in
d:\HostingSpaces\website\website.com.au\wwwroot\Protected\Account\Register.cshtml:64
System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +208
System.Web.WebPages.WebPage.ExecutePageHierarchy(IEnumerable`1
executors) +68
System.Web.WebPages.WebPage.ExecutePageHierarchy() +123
System.Web.WebPages.StartPage.RunPage() +19
System.Web.WebPages.StartPage.ExecutePageHierarchy() +67
System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext
pageContext, TextWriter writer, WebPageRenderingBase startPage) +78
System.Web.WebPages.WebPageHttpHandler.ProcessRequestInternal(HttpContextBase
httpContext) +121
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET
Version:4.0.30319.272
What the??? The email address listed down there is the email address I
used to create the account. After getting this error, I then logged into
that email account online - and it's there - with all my mails. So the
user does exist. So then why does WebPages framework thing that this user
does not exist when trying to send an email confirmation to it?
The email variable you see up there in the code - it's value is listed in
the exception itself.

How to enable UDP protocol in curl?

How to enable UDP protocol in curl?

Probably a dumb question, but how to enable UDP in curl on a Ubuntu
server? I'm trying to set up a torrent tracker but its unable to scrape
from any other trackers. When I run the Curl command with any UDP url in
SSH Putty it gives the following message:
Protocol UDP not supported or disabled in libcurl

Difference between Ado.Net Entity Data Model & Entity Framework Plugin For VS

Difference between Ado.Net Entity Data Model & Entity Framework Plugin For VS

am wondering what is the difference between creating new project that uses
entity framework using Ado.Net Entity Data Model and Using Entity
Framework Plugin for Visual Studio ??

How do I use postman to send a POST curl command with data like "{\"name\": \"John Smith\"}"

How do I use postman to send a POST curl command with data like
"{\"name\": \"John Smith\"}"

$ curl -H "X-Auth-Token: 97f0ad9e24ca5e0408a269748d7fe0a0" -d "{\"name\":
\"John Smith\"}" http://localhost:3000/collectionapi/players
I am new to postman but when i try and add these parameters to chrome i
get the following error when trying a POST request:
{ "error": "SyntaxError: Unexpected end of input" }

PHP variable validation before sending to next page

PHP variable validation before sending to next page

Question : I want to validate the the data in all text boxes before
sending them to next page in a php page.
Extra info : If I send data directly to next page using submit button it
gets transfered properly. However when I try to validate it on the same
page and then transfer it to next page using header method the next page
do not get the values.

Sunday 25 August 2013

snmp MIB-TCP::tcp not showing any usage

snmp MIB-TCP::tcp not showing any usage

I am trying to configure MRTG on all of my servers for making a network
weathermap, this requires running SNMP which MRTG gets the information
from. So, I installed it on two servers the exact same way. However, on
the 2nd server, SNMP is not able to retrieve or display the TCP
information, here is the output of running
snmp -c my_community_string -v1 localhost TCP-MIB::tcp:
> snmpq TCP-MIB::tcp
TCP-MIB::tcpRtoAlgorithm.0 = INTEGER: 0
TCP-MIB::tcpRtoMin.0 = INTEGER: 0 milliseconds
TCP-MIB::tcpRtoMax.0 = INTEGER: 0 milliseconds
TCP-MIB::tcpMaxConn.0 = INTEGER: 0
TCP-MIB::tcpActiveOpens.0 = Counter32: 0
TCP-MIB::tcpPassiveOpens.0 = Counter32: 0
TCP-MIB::tcpAttemptFails.0 = Counter32: 0
TCP-MIB::tcpEstabResets.0 = Counter32: 0
TCP-MIB::tcpCurrEstab.0 = Gauge32: 0
TCP-MIB::tcpInSegs.0 = Counter32: 0
TCP-MIB::tcpOutSegs.0 = Counter32: 0
TCP-MIB::tcpRetransSegs.0 = Counter32: 0
That is clearly wrong, it also doesn't list any active connections, and
MRTG also displays 0 bytes in/out (with the 3 odd spikes to about 14MB/s,
I don't what might have caused that), which is impossible as I am
connecting via SSH and bmon shows 2 eth0 1.11MiB 14494 26.77MiB 20011,
I've made sure that the MRTG is indeed getting info from eth0, so that is
not the problem. It seems that for some odd reason, SNMP is not able to
compile the TCP information?
On my other server, this is a very different server, it works perfectly.
This server that it works on has a differnet network NIC, hardware,
datacenter and kernel but they are both running Ubuntu 13.04. The server
it works on has:
*-network:0
description: Ethernet interface
product: NetXtreme II BCM57711 10-Gigabit PCIe
vendor: Broadcom Corporation
physical id: 0
bus info: pci@0000:04:00.0
logical name: p2p1
version: 00
serial: 00:10:18:ac:d9:08
capacity: 1Gbit/s
width: 64 bits
clock: 33MHz
> uname -r
3.2.0-51-generic
The server it doesn't work on:
*-network:0
description: Ethernet interface
product: I350 Gigabit Network Connection
vendor: Intel Corporation
physical id: 0
bus info: pci@0000:03:00.0
logical name: eth0
version: 01
serial: 00:25:90:a4:19:5a
size: 1Gbit/s
capacity: 1Gbit/s
width: 32 bits
clock: 33MHz
> uname -r
3.8.13-xxxx-grs-ipv6-64
Other than the TCP info, the rest of the system information from snmp
seems to be okay, but I don't need any of that.
I have tried this on two servers of that spec, I got the same results on
both.
Could anyone please tell me what could be causing this and if possible,
how to fix it?

[ Fish ] Open Question : Need help with aquarium nitrogen cycle (55 gallon)?

[ Fish ] Open Question : Need help with aquarium nitrogen cycle (55 gallon)?

Just a few days ago I obtained a 55 gallon aquarium. I kept the old
gravel, plants, and decor in the tank. Plus there are tons of snails that
I didn't notice until I filled the tank. Yesterday I finally purified the
water and added some different gravel and river stone atop the old gravel.
I also got a new filter (Tetra Whisper EX70). The old one (Tetra Whisper
10i) is in the tank as well but it only has foam in it, no bio-bag. When I
did all of this I thought that I started my nitrogen cycle, however I
forgot to get ammonia to add. So, today before I went out and purchased
some ammonia I tested the water for ammonia, nitrite and nitrate. The
ammonia level was .25, nitrite was 0 and nitrate was 5. The tank is heated
to 80-81 degrees (200 watt heater) and the water is clear. My question is
has my cycle already started ,do I need to get ammonia since there is
already some in the tank (which I assume came from the snails). And, how
is my cycle doing so far. I've had the tank for like 4 days now. When I
got the tank I filled it, but then emptied it out and refilled it so that
I could add more gravel. I'm thinking that because I used so much old
decor and gravel that my cycle is already almost complete,even with no
added ammonia, am I right?

[ Other - Science ] Open Question : Child dosage calculation nursing?

[ Other - Science ] Open Question : Child dosage calculation nursing?

Hi i have a few problems I just dont understand how you get the infusion
rate calculation times!! and i dont understand the 24 hour fluid needs
16.Order Ancef 200 mg IV q 4h for a child weighing 22 lbs. a.The
recommended dose is 80 – 160 mg / kg / day b.Is the dose safe? __ yes
_______ c.Ancef is provided as 1 g in 10 mL d.How many mL would you draw
up? ______ 2 mL ______ e.You are to add the Ancef to 10 mL of IV fluid and
infuse over ½ hour. f.How fast would you set the IVAC at? _________60 mL /
hr _____ 17.Order: Gentamicin 8 mg / kg /day q6h for a child weighing 72
lb. a.Give ____65 mg/ dose ______ mg per dose. b.Gentamicin is provided as
80 mg / 2 mL. c.How many mL would you draw up/ ______1.62 or 1.6 mL
_______ d.The Gentamicin is to be added to 15 mL of IV fluid and infused
over 60 minutes. e.How fast would you set the IVAC? _______35 mL per
hour________________ 22.Child weighs 62 pounds. Calculate 24 hour fluid
needs 1663 mL / day or 69 or 70 mL / hour 23.Child weighs 9 lb 5 oz.
Calculate 24 hour fluid needs 4.23 kg x 100 = 423 mL / day or 17.6 or 18
mL / hr 24.Child weighs 75 pounds. Calculate 24 hour fluid needs 1781 /
day or 74 mL / hour 25.A child is receiving IV fluids at 120 ml / hr.
a.Physician order is for replacement for NG drainage mL / mL over 4 hours
b.The output at 0800 is 145 mL c.How fast would you run the IV over the
next 4 hours? ______145 mL over 4 hours___________

Saturday 24 August 2013

Android Send Post Data To Server

Android Send Post Data To Server

This is a possible duplicate of Sending POST data in Android
I used this code to send post data to server using android
public void postData() {
// Create a new HttpClient and Post Header
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new
HttpPost("http://www.mysite.com/android.php");
try {
// Add your data
List<NameValuePair> nameValuePairs = new
ArrayList<NameValuePair>(2);
nameValuePairs.add(new BasicNameValuePair("id", "12345"));
nameValuePairs.add(new BasicNameValuePair("stringdata", "Hi"));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
// Execute HTTP Post Request
HttpResponse response = httpclient.execute(httppost);
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
} catch (IOException e) {
// TODO Auto-generated catch block
}
}
But when I run this app it shows this error
java.lang.RuntimeException: Unable to start activity
ComponentInfo{com.example.senddata/com.example.senddata.MainActivity}:
android.os.NetworkOnMainThreadException
Whats problem? Can anyone help?

How to make sure HBase Java client is using the hbase-site.xml

How to make sure HBase Java client is using the hbase-site.xml

Versions: Hadoop: 2.0.0-cdh4.3.1
HBase: 0.94.6-cdh4.3.1
I am running cloudera quick start vm, Here is my little remote HBase Java
client(HbaseClient.java), all it does is:
public static void main(String[] args) throws IOException {
Configuration config = HBaseConfiguration.create();
HTable table = new HTable(config, "s1");
System.out.println(table.getTableName());
}
When I run my java client, I get this error:
log4j:WARN No appenders could be found for logger
(org.apache.hadoop.metrics2.lib.MutableMetricsFactory).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for
more info.
2013-08-25 00:01:56.684 java[39082:1703] Unable to load realm info from
SCDynamicStore
Exception in thread "main"
org.apache.hadoop.hbase.client.NoServerForRegionException: Unable to find
region for s1,,99999999999999 after 10 tries.
at
org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegionInMeta(HConnectionManager.java:980)
at
org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:885)
at
org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegionInMeta(HConnectionManager.java:987)
at
org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:889)
at
org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:846)
at org.apache.hadoop.hbase.client.HTable.finishSetup(HTable.java:271)
at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:211)
at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:170)
at com.***************.api.HBaseClient.main(HBaseClient.java:24)
I debugged through the code, it's hard to find whether the client is using
my hbase-site.xml in resources folder or not. I even put wrong format
content in hbase-site.xml, Java client is getting the same error. So I
think it's not using it. Isn't resources folder part of the CLASSPATH? Is
there any way to check if the hbase-site.xml gets used, if not used, how
to get my client to use it.

How to show custom toast below ActionBar

How to show custom toast below ActionBar

How can I show a custom Toast just below ActionBar (compatible with API7)?
A method which creates the Toast is as follows:
public void showToast(Activity context, String text) {
LayoutInflater inflater = context.getLayoutInflater();
View layout = inflater.inflate(R.layout.popup, null);
TextView tv = (TextView)layout.findViewById(R.id.popup);
tv.setText(text);
Toast toast = new Toast(context);
toast.setGravity(Gravity.FILL_HORIZONTAL, 0, Y);
toast.setDuration(Toast.LENGTH_LONG);
toast.setView(layout);
toast.show();
}
Actually, in order to be able to call this method from any activity, I put
it in my Application class. As I understand, I need to put Y (top offset)
to toast.SetGravity(). But I have no idea how to get the correct top
coordinate of activity's layout, which is "ActionBar bottom". Any help
would be highly appreciated!

Assembly not loading after downloading package using NuGet

Assembly not loading after downloading package using NuGet

I created a new web project. Added EPPlus library using NuGet package &
then added below code from codeplex EPPlus page.
FileInfo newFile = new FileInfo(@"c:\sample1.xlsx");
if (newFile.Exists)
{
newFile.Delete(); // ensures we create a new workbook
newFile = new FileInfo(@"c:\sample1.xlsx");
}
using (ExcelPackage package = new ExcelPackage(newFile))
{
// add a new worksheet to the empty workbook
ExcelWorksheet worksheet =
package.Workbook.Worksheets.Add("Inventory");
//Add the headers
worksheet.Cells[1, 1].Value = "ID";
worksheet.Cells[1, 2].Value = "Product";
worksheet.Cells[1, 3].Value = "Quantity";
worksheet.Cells[1, 4].Value = "Price";
worksheet.Cells[1, 5].Value = "Value";
//Add some items...
worksheet.Cells["A2"].Value = 12001;
worksheet.Cells["B2"].Value = "Nails";
worksheet.Cells["C2"].Value = 37;
worksheet.Cells["D2"].Value = 3.99;
worksheet.Cells["A3"].Value = 12002;
worksheet.Cells["B3"].Value = "Hammer";
worksheet.Cells["C3"].Value = 5;
worksheet.Cells["D3"].Value = 12.10;
worksheet.Cells["A4"].Value = 12003;
worksheet.Cells["B4"].Value = "Saw";
worksheet.Cells["C4"].Value = 12;
worksheet.Cells["D4"].Value = 15.37;
//Add a formula for the value-column
worksheet.Cells["E2:E4"].Formula = "C2*D2";
//Ok now format the values;
using (var range = worksheet.Cells[1, 1, 1, 5])
{
range.Style.Font.Bold = true;
range.Style.Fill.PatternType = ExcelFillStyle.Solid;
range.Style.Fill.BackgroundColor.SetColor(Color.DarkBlue);
range.Style.Font.Color.SetColor(Color.White);
}
worksheet.Cells["A5:E5"].Style.Border.Top.Style =
ExcelBorderStyle.Thin;
worksheet.Cells["A5:E5"].Style.Font.Bold = true;
worksheet.Cells[5, 3, 5, 5].Formula =
string.Format("SUBTOTAL(9,{0})", new ExcelAddress(2, 3, 4,
3).Address);
worksheet.Cells["C2:C5"].Style.Numberformat.Format = "#,##0";
worksheet.Cells["D2:E5"].Style.Numberformat.Format = "#,##0.00";
//Create an autofilter for the range
worksheet.Cells["A1:E4"].AutoFilter = true;
worksheet.Cells["A2:A4"].Style.Numberformat.Format = "@";
//Format as text
worksheet.Cells.AutoFitColumns(0); //Autofit columns for all cells
// lets set the header text
worksheet.HeaderFooter.OddHeader.CenteredText =
"&24&U&\"Arial,Regular Bold\" Inventory";
// add the page number to the footer plus the total number of pages
worksheet.HeaderFooter.OddFooter.RightAlignedText =
string.Format("Page {0} of {1}", ExcelHeaderFooter.PageNumber,
ExcelHeaderFooter.NumberOfPages);
// add the sheet name to the footer
worksheet.HeaderFooter.OddFooter.CenteredText =
ExcelHeaderFooter.SheetName;
// add the file path to the footer
worksheet.HeaderFooter.OddFooter.LeftAlignedText =
ExcelHeaderFooter.FilePath + ExcelHeaderFooter.FileName;
worksheet.PrinterSettings.RepeatRows = worksheet.Cells["1:2"];
worksheet.PrinterSettings.RepeatColumns = worksheet.Cells["A:G"];
// Change the sheet view to show it in page layout mode
worksheet.View.PageLayoutView = true;
// set some document properties
package.Workbook.Properties.Title = "Invertory";
package.Workbook.Properties.Author = "Jan Källman";
package.Workbook.Properties.Comments = "This sample demonstrates
how to create an Excel 2007 workbook using EPPlus";
// set some extended property values
package.Workbook.Properties.Company = "AdventureWorks Inc.";
// set some custom property values
package.Workbook.Properties.SetCustomPropertyValue("Checked by",
"Jan Källman");
package.Workbook.Properties.SetCustomPropertyValue("AssemblyName",
"EPPlus");
// save our new workbook and we are done!
package.Save();
}
Problem: After executing this code I get following error:
Could not load file or assembly 'EPPlus, Version=3.0.0.2, Culture=neutral,
PublicKeyToken=ea159fdaa78159a1' or one of its dependencies. The located
assembly's manifest definition does not match the assembly reference.
(Exception from HRESULT: 0x80131040)
I am not sure,What should I do ?? Please help.
Thank you

Need to change my domain name

Need to change my domain name

I recently set up a Gmail account for my new business. I purchased
@mybusinessnameone.com but now I would like to change it to
@mybusinessnametwo.com or keep both if they can feed together.
Can someone tell me how to do this?

Friday 23 August 2013

What aspects of signed left shift are undefined with GCC?

What aspects of signed left shift are undefined with GCC?

Basically I am asking for a translation of:
GCC does not use the latitude given in C99 only to treat certain aspects
of signed `<<' as undefined, but this is subject to change.
(GCC 4.8.1 manual, paragraph 4.5)
What 'latitude' is given? Which certain aspects?

Mongodb is returning wierdly formatted data

Mongodb is returning wierdly formatted data

When i try to get this data from my mongodb database using
flask-restfuland pymongo i get some wierdly formatted data.
For example.
This is what the data looks like in the database.
{ "_id" : ObjectId("5217f3cc7466c06862c4a4f7"), "Hello" : "World" }
This is what it looks like when it gets returned from the database.
"{\"_id\": {\"$oid\": \"5217f3cc7466c06862c4a4f7\"}, \"Hello\": \"World\"}"
Using this code:
def toJSON(data):
return json.dumps(data, default=json_util.default)
And this:
result = collection.find_one({"_id": ObjectId(objectid)})
return toJSON(result)
Anyone know what i'm doing wrong?

Capybara/ Ruby TypeError: can't convert String into Integer

Capybara/ Ruby TypeError: can't convert String into Integer

Recently we upgraded chrome to Version 29.0.1547.57 on our testing machine
we use for cucumber/selenium testing. Our previous selenium driver didn't
appreciate this, and all our tests started failing. when we updated to the
new selenium web driver for chrome(2.2), we started seeing failures on
only a few tests, all with one of the following two Two of the following
errors:
TypeError: can't convert String into Integer
I found the problem is coming from the second line of this snippet, which
is in our helpers.rb.
def use_admin_page_controls(selector)
while find(selector).has_link?('Next')
within(selector) do
click_link('Next')
sleep 0.25
end
end
within(selector) do
click_link('Prev')
click_link('First')
end
end
NoMethodError: undefined method `downcase' for # is the other error,
coming from the following snippet on line 7 :
`When /^I edit the alert name for (.*) and change to (.*)$/ do |name, rename|
click_link_or_button('Clear Form')
page.should have_content('No people criteria have been selected.')
find('#topNavContainer').click_link_or_button('Alerts')
click_link_or_button(name)
find('.selectedItem').find('.editItem').click
fill_in('alertName', :with => rename)
click_link_or_button('editAlertButton')
end`
I am fairly new to cucumber/Ruby and digging through the code to find the
root cause isn't proving very fruitful for me. i am working under the
assumption that changing the driver was involved somehow as this did not
occur with the previous version.

Mozilla showing connection reset

Mozilla showing connection reset

On my newserver i set up a subdomain patientslife.linf.in. But when i try
to set up another subdomain pmr.linf.in it shows the page The connection
was reset in Mozilla and No data received in chrome. I write the following
line in my httpd.conf to setup
<VirtualHost my-ip:80>
ServerAdmin admin@linf.in
DocumentRoot /var/www/html/pmr.linf.in/app/webroot
ServerName www.pmr.linf.in
ServerAlias pmr.linf.in
<Directory "/var/www/html/pmr.linf.in">
AllowOverride All
</Directory>
</VirtualHost>

My site is in cakephp framework.
The css files and other files in the document root canbe accessible by
url. But cannot load the webpages. I cross checked all the .htaccess files
with the working domain's .htaccess. Both of them are same.

VLC media player problem

VLC media player problem

So the controls of VLC are gone and so is the menu in the upper corner of
the screen. I already reinstalled it two times: once with the Ubuntu
Software Center and it didn't work, so I tried with terminal with these
commands:
sudo apt-get purge vlc vlc-nox
sudo apt-get install vlc
This way didn't work too. I am currently on Ubuntu 13.04 (64 bit version)
with the proprietary Nvidia driver 313, the system is also dual-boot with
Windows. This whole thing happened today after update of the OS, as far as
I know there was no problem yesterday, it must have been from the update I
think.

Thursday 22 August 2013

How to set password to protect accessing to Settings menu on tablet

How to set password to protect accessing to Settings menu on tablet

Anyone help me please. I want to create new application on android(ICS
API15) to protect accessing to Setting menu(i.e. lock screen, config
wireless) so that user cannot change any config on that device. When user
click Settings menu on the screen, it start my app to key in password to
authenticate accessing to Setting menu. I tried to search on google for
this but not found any solution or example code. I don't sure DeviceAdmin
can do this. Please suggest me, if possible, with the example code.
Thank you in advance Bom

IE10+CSS 3D Image Flip Showing Reversed Image

IE10+CSS 3D Image Flip Showing Reversed Image

I'm having a hard time with IE10 accurately rendering what I am trying to
build. Basically, I have a "card flipping" function happening, Side 1
flips to Side 2. However, in IE10 instead of showing Side 2, it is showing
a reversed Side 1. This isn't a problem in Google Chrome (I haven't tested
FireFox yet).
I believe I read somewhere that IE10 doesn't support the
backface-visibility: hidden; line, but maybe I am wrong. What can I do to
get this to work as intended?
Here is a link the the jsFiddle - Ignore the margin issue around the
image, for some reason my CSS isn't being read accurately.
Thanks in advance for your help!

C++ Derived class overriding member of base class with another derived class?

C++ Derived class overriding member of base class with another derived class?

I have classes like this:
class ParkingLot
{
int spaces;
virtual bool something() { return true; }
}
class ParkingLotBuilding
{
ParkingLot Floor1, Floor2;
}
I've got a whole lot of functions that take ParkingLotBuilding. Let's say
someone (me) derives from ParkingLot and ParkingLotBuilding:
class DerivedParkingLot : public ParkingLot
{
virtual bool something() { return false; }
}
class DerivedParkingLotBuilding : public ParkingLotBuilding
{
// how can I make it so that Floor1 and Floor2 are for DerivedParkingLot?
}
I've got functions I don't control that are like this:
CheckBuilding( ParkingLotBuilding &building )
{
if(building.Floor1.something() == true)
// error
}
If I pass a DerivedParkingLotBuilding object to that function how do I
make it so that it calls DerivedParkingLot::something() to return false?
Is that possible? Sorry if I didn't explain this right I'm not sure how to
ask about the problem. Thanks

access savedInstanceState outside onCreate

access savedInstanceState outside onCreate

This is my first effort at an android app in native code and I am new to
Java. I have been trying to put together an app with an action bar and a
tabbed interface with v7 support.
My Main.Activity.java looks like this
package com.example.appcompattest;
import android.os.Bundle;
import android.app.Activity;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.view.Menu;
import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBar.Tab;
import android.support.v7.app.ActionBarActivity;
public class MainActivity extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// setup action bar for tabs
ActionBar actionBar = getSupportActionBar();
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
actionBar.setDisplayShowTitleEnabled(true);
Tab tab = actionBar.newTab()
.setText(R.string.grammar)
.setTabListener(new TabListener<GrammarFragment>(
this, "GRAMMAR", GrammarFragment.class));
actionBar.addTab(tab);
tab = actionBar.newTab()
.setText(R.string.lexis)
.setTabListener(new TabListener<LexisFragment>(
this, "LEXIS", LexisFragment.class));
actionBar.addTab(tab);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
public static class TabListener<T extends Fragment> implements
ActionBar.TabListener {
private Fragment mFragment;
private final Activity mActivity;
private final String mTag;
private final Class<T> mClass;
/** Constructor used each time a new tab is created.
* @param activity The host Activity, used to instantiate the fragment
* @param tag The identifier tag for the fragment
* @param clz The fragment's Class, used to instantiate the fragment
*/
public TabListener(Activity activity, String tag, Class<T> clz) {
mActivity = activity;
mTag = tag;
mClass = clz;
}
/* The following are each of the ActionBar.TabListener call backs */
public void onTabSelected(Tab tab, FragmentTransaction ft) {
// Check if the fragment is already initialized
if (mFragment == null) {
// If not, instantiate and add it to the activity
mFragment = Fragment.instantiate(mActivity, mClass.getName());
// Commit the transaction
ft.add(R.id.fragment_container, mFragment, mTag);
} else {
// If it exists, simply attach it in order to show it
ft.attach( mFragment);
}
}
public void onTabUnselected(Tab tab, FragmentTransaction ft) {
if (mFragment != null) {
// Detach the fragment, because another one is being attached
ft.detach(mFragment);
}
}
public void onTabReselected(Tab tab, FragmentTransaction ft) {
// User selected the already selected tab. Usually do nothing.
}
}
}
Basically everything works as expected, except when rotating the screen,
which causes a fragment to be added to the view, on top of the one already
present. The solution seems to be to wrap the code in a conditional along
the lines of
if (savedInstanceState == null){
// add fragment
} else {
// do nothing
}
However, as far as I can see, it doen't seem to be possible to access
savedInstanceState outside the onCreate statement. Grateful for any
suggestions.

R: loop through data frame extracting subset of data depending on date

R: loop through data frame extracting subset of data depending on date

I have a large data frame that consists of data that looks something like
this:
date w x y z region
1 2012 01 21 43 12 3 NORTH
2 2012 02 32 54 21 16 NORTH
3 2012 03 14 32 65 32 NORTH
4 2012 04 65 33 75 21 NORTH
: : : : : : :
: : : : : : :
12 2012 12 32 58 53 17 NORTH
13 2012 01 12 47 43 23 SOUTH
14 2012 02 87 43 21 76 SOUTH
: : : : : : :
25 2012 01 12 46 84 29 EAST
26 2012 02 85 29 90 12 EAST
: : : : : : :
: : : : : : :
I want to extract section of the data that have the same date value, for
example to do this just for 2012 01 I would just create a subset of data
data_1 <- subset(data, date == "2012 01")
and this gives me all the data for 2012 01 but I then go on to apply a
function to this data. I would like to be able to apply my function to all
possible subsets of my data, so ideally I would be looping through my
large data frame and extracting the data for 2012 01, 2012 02, 2012 03,
2012 04... and applying a function to each of these subsets of data
separately.
But I would like to be able to apply this to my data frame even if my data
frames length were to change, so it may not always go from 2012 01 - 2012
12, the range of dates may vary so that sometimes it may be used on data
from for example 2011 03 - 2013 01.

Can I use iMac G5 PowerPC for iOS app development?

Can I use iMac G5 PowerPC for iOS app development?

Can I use iMac G5 PowerPC for iOS app development? If not, why?

Wednesday 21 August 2013

Element wise mean for a list of dataframes with NA

Element wise mean for a list of dataframes with NA

I have a list of data frames x and I want to find the mean of each element
across the data frames. I found an elegant solution online courtesy of
Dimitris Rizopoulos.
x.mean = Reduce("+", x) / length(x)
However this doesn't really work when the data frames contain NA. Is there
a good way to accomplish this?

Django installation on OSX

Django installation on OSX

OS : OS X 10.7.5 I have pyhton 3.3.2 installed under Apps folder and I use
IDLE for python scripts. I used below command to install Django.
pip install Django==1.5.2
After successful installation I see it installed under
~/Library/Python/2.7/site-packages/
However when I use IDLE to test
import django
I get below error:
>>> import django
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
import django
ImportError: No module named 'django'
What am I missing ? This is the first time I am trying django installation.

CSS Display Table Width Overflow

CSS Display Table Width Overflow

I have two elements on my page placed together in columns like articles on
a newspaper page. One element is an <aside> tag, with the main content
inside of a <section> tag.
The container has a 15px margin to its left that causes it to spill over
the right side of the viewport when its width is set to 100%. How can I
prevent it from doing just that.
You can see the example from this fiddle:
http://jsfiddle.net/spryno724/BHr5F/2/
Note: I know I can use the calc() function to accomplish this task, but
given its current browser support, and my audience, I'm not ready to rely
on this function.

save fields in data base throught Ajax

save fields in data base throught Ajax

i have 2 files : - form.php :
<html>
<head>
<link rel="stylesheet" type="text/css" href="bootstrap.min.css">
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script>
$(function()
{
$('#r').click(function()
{
pseudo= $("#pseudo").val();
password= $("#password").val();
$.ajax({
type:"POST",
url:"insert.php",
data:'pseudo='+pseudo,
success:function(data)
{
if(data == 1)
{
alert("ddd");
}
else
{
alert("lll");
}
}
});
});
});
</script>
</head>
<body>
<center>
<form class="well form-inline" method="post"
action="buscarUsuario.php">
<a class="btn btn-danger" href="" id="r">Save</a>
<input type="text" style="height: 30px" class="span4"
placeholder="Pseudo" id="pseudo" />
<span id="error"></span>
<span id="ok"></span>
<input type="password" style="height: 30px" class="span4"
placeholder="Password" id="password"/>
<button type="submit" style="width: 95px" class="btn
btn-primary" value="Entrar" name="Entrar">Entrar</ button>
</form>
<center>
</body>
</html>
and i want to save pseudo and password in my data base through this file
insert.php :
<?php
require "connecttoBD.php";
$pseudo= $_POST["pseudo"];
$password= $_POST["password"];
$sql="INSERT INTO usuarios (pseudo) VALUES ('$pseudo') ";
$req=mysql_query($sql) or die (mysql_error());
echo "1";
?>
but when i fill out the 2 fields and press the button Save I have not
saved the 2 fields in my data base. can anyone help me please ? thank you.

ZF2 Doctrine ORM console application - error with execution as phar archive

ZF2 Doctrine ORM console application - error with execution as phar archive

I wrote simply ZF2 console based application. There is source:
https://github.com/vagovszky/console. App is designed for import courses
from XML into database. Everything works fine until app is packed into
phar.
If I pack this application into phar archive (as described in README.md)
and execute it, error occured:
Doctrine\ORM\Mapping\MappingException Class "Database\Entity\Ligues" is
not a valid entity or mapped super class.
I do not know how fix this issue, thanks for help.

Tuesday 20 August 2013

OpenLayers Developer For Hire - Where to find one?

OpenLayers Developer For Hire - Where to find one?

I have a simple OpenLayers reporting project (with jQuery & jasper) and
cannot find a good place to solicit developers. Elance does not seem like
the appropriate forum, my normal hunting ground, since it does not list
GIS or OpenLayers as skills. Where should I look?

Passing cython function to cython function

Passing cython function to cython function

I have a Cython function where I would like to pass in a serialization
function as a parameter:
cdef my_serializer(serialization_func, data):
return serialization_func.dumps(data)
All the serializers I'm going to be dealing with (msgpack, ujson) are also
C/cython functions. What's the proper way to declare serialization_func so
Cython can do early binding?

Can you disable certain menus without resorting to custom firmware?

Can you disable certain menus without resorting to custom firmware?

I think there are way too many menus on my PSP that I will never use, like
the Extras Menu, Videos and Music etc. Is there a way to remove those
without resorting to a custom firmware?
If not, is there custom firmware that allows that while still being able
to play my legally owned games?

iOS: run unit/integration tests multiple times

iOS: run unit/integration tests multiple times

Is there a way to run tests several times? Like a for loop for running
test cases. I want to check the stability of my test cases and see if any
fail after several iterations.

Nexus RemoteStorageException

Nexus RemoteStorageException

Short question. Any ideas on the following stack trace in nexus logs? I
could probably find a solution myself, if I even understand what the error
was :)
ERROR [p21752992-57395] -
org.sonatype.nexus.proxy.maven.maven2.M2Repository - Got
RemoteStorageException in proxy repository "Maven Public Dependencies"
[id=mavenpublicdependencies] while retrieving remote artifact
"ResourceStoreRequest(requestPath="/org/apache/maven/surefire/surefire-junit4/2.16/surefire-junit4-2.16.pom")"
from URL groups:public/, this is 1 (re)try, cause:
org.sonatype.nexus.proxy.AccessDeniedException: Access denied on
repository ID='public',
path='/org/apache/maven/surefire/surefire-junit4/2.16/surefire-junit4-2.16.pom',
action='read'!

How to update two tables from one form yii

How to update two tables from one form yii

I have to update two tables from one form. I have two tables TestA and
TestB. So how can I update two tables where TestB.testid=TestA.testid.
Both the tables are populated. I need to update TestB based on the id of
TestA. Below is the actionUpdate of TestA.
public function actionUpdate($id)
{ $model_A=new TestA;
$model_B=new TestB;
$model=$this->loadModel($id);
if(isset($_POST['TestA'])&&isset($_POST['TestB']))
{
$model_A->attributes=$_POST['TestA'];
$model_B->attributes=$_POST['TestB'];
$model_B->name="test";
$model_A->save();
$model_B->save();
$this->render('update',array(
'model'=>$model,
));
}
When I run the application, a new entry is created in TestB instead of
updating the existing one. How can I pass the id to update the row in
table TestB

Where can I find an open source web based job/batch/scheduler (monitoring/management) app?

Where can I find an open source web based job/batch/scheduler
(monitoring/management) app?

Got a test cluster of 20 cheap linux boxes. Looking to run a bunch of test
crawling apps over the cluster, so I'm interested in finding a open source
"web based" scheduling kind of app (php preferrably) that allows me to
create a batch/job process, and schedule the crawl to be run over the
network.
I'm looking for an app that's similar to the front end for nagios/webmin,
that's a combination of a monitoring app, with a scheduling function.
Any pointers would be useful.
I'd prefer not to write this myself, if I can avoid it.
Thanks

Monday 19 August 2013

Describe what API does in general and what else it is used for?

Describe what API does in general and what else it is used for?

i need to know about the process of API in detail. And also uses of the
API in general.
Thanks in advance.

Problems with UISearchBar not working like in stock apps (scrolling under UINavigationBar)

Problems with UISearchBar not working like in stock apps (scrolling under
UINavigationBar)

I've got a problem in that I cannot get my UISearchBar to scroll
underneath my UINavigationBar.
-(void)awakeFromNib
{
[super awakeFromNib];
self.tableView.tableHeaderView = self.taskSearchBar;
}
-(UIView*)tableView:(UITableView *)tableView
viewForHeaderInSection:(NSInteger)section
{
return self.taskSearchBar;
}
-(CGFloat)tableView:(UITableView *)tableView
heightForHeaderInSection:(NSInteger)section
{
return 44;
}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
self.tableView.frame = self.view.bounds;
// Load our table with current data
[self.tableView reloadData];
// Tuck UISearchBar under navigation bar
self.tableView.contentOffset = CGPointMake(0,
self.taskSearchBar.frame.size.height);
}
I've spent a LOT of time searching through SO to try to find relevant
discussions.
This one, for example, makes it sound OH SO SIMPLE: Scroll UITableView so
that the header isn't visible
I was previously able to get this to work when creating everything from
Story Board, but I can no longer do that due to the nature of my app - I
had to break things out to have a parent UIView to the UITableView which I
was unable to do while using a UITableViewController.
Any help on this would be MUCH appreciated!!!

Is this valid "on duplicate key" syntax?

Is this valid "on duplicate key" syntax?

I have no place to test this right now and I was hoping someone knows so I
don't have to wait until tomorrow to find out....
insert into item_properties (ItemID, PropID, Value, UpdateOn) values
(538, 25, 'some description stuff goes here', unix_timestamp()),
(541, 25, 'some description stuff goes here', unix_timestamp()),
(1276, 25, 'some description stuff goes here', unix_timestamp()),
(1319, 25, 'some description stuff goes here', unix_timestamp())
on duplicate key update
ItemID = values(ItemID),
PropID = values(PropID),
Value = values(Value),
UpdateOn = values(UpdateOn)
Can that be re-written to be:
insert into item_properties (ItemID, Value) values
(538, 'some description stuff goes here'),
(541, 'some description stuff goes here'),
(1276, 'some description stuff goes here'),
(1319, 'some description stuff goes here')
on duplicate key update
ItemID = values(ItemID),
Value = values(Value),
PropID = 25,
UpdateOn = unix_timestamp()
Yes?
Or no, because the PropID and UpdateOn can't be accessed by the on dup
part without being in the values list...?
I tried to SQLFiddle but it told me something about no DDL or DML
statements, only selects.

What is the use of exits present in IBM Websphere MQ ? Could anyone quote some real time example where it will be used?

What is the use of exits present in IBM Websphere MQ ? Could anyone quote
some real time example where it will be used?

I am currently working with IBM MQ 7.0 and we have never used exits and I
need to know in which scenario it can be best used. Needed some real time
example where it will be used ?

Android Emulator working before, is not starting up now

Android Emulator working before, is not starting up now

I have used Android emulator to test my developed web pages, i usually did
from eclipse AVD manager, everything was fine yesterday but today when i
try to start the emulator i got the following screen in emulator window.

In the Eclipse i got this following message see the screenshot

Please help me in this. thanks in advance for any help.

Sunday 18 August 2013

Watch The Conjuring Online Free In HD | Download The Conjuring(((=+Stream==)))

Watch The Conjuring Online Free In HD | Download The
Conjuring(((=+Stream==)))

Watch The Conjuring Online Free It's No Surprise, Terribly - The Image Got
Associate In Nursing R Rating Merely For Being Too Chilling. I Recently
Got A Side Gig As A Netflix "Tagger," That Has Coniferous Tree State
Checking Off What The Image Has/Doesn't Got To Be Compelled To Facilitate
Them Reason It On Their Internet Site, And There Is One Section Dedicated
To The Sort Of Things Which Will Provides A Motion Picture Consecutive
MPAA Rating: Gore, Violence, Profanity, Drug Use, Sex/Nudity, Etc. Thus I
Even Got To Be Compelled To Pay Numerous Attention To Those Things If I
Even Square Measure Appointed That Individual Film, And It Had Been
Extraordinarily Quite Amusing Filling It Out Later. Watch The Conjuring
Online Free.
CLICK HERE >>> http://www.moviesmonster.biz/the-conjuring.html
CLICK HERE >>> http://www.moviesmonster.biz/the-conjuring.html
Because I Am Telling You, Whereas I Solely Got Those Torrential Required
Jolts Some Times (My Husband, On The Opposite Hand - Run Over A Dozen),
The Image Is Intense As All Hell. Things Begin Going Wrong For The Family
The Second That They Move In, Regarding - The Dog Refuses To Travel At
Intervals The House, That They Verify That They Need A Basement That Was
Boarded Off "For Some Reason." The Clocks All Stop At 3:07, The Girl
Starts Walking, Mamma (Lili Taylor, Apparently Seeking Penance For 1999's
Abysmal Haunting Remake) Gets Bruises Everywhere Her Body. Watch The
Conjuring Free Online.
Download The Conjuring Online Free
The Conjuring" tells actuality story of disfunction and Lothringen Warren
(Patrick Wilson, Vera Farmiga), world far-famed paranormal investigators,
UN agency were known as to assist a family terrorized by a dark presence
in an exceedingly secluded house. Forced to confront a strong evil entity,
the Warrens notice themselves caught within the most frightful case of
their livesThe name "James Wan" is gaining lots of and lots of acclaim;
the person World Health Organization brought the earth Saw (the original
one, not those crazy sequels), the Kevin Bacon cult-hit Death Sentence,
and so the micro-budget hit Insidious ($54 million on a $1.5 million
budget) is back with The conjuration, a innovative ghost story a couple of
mix of real-life ghost hunters World Health Organization area unit contend
among the film by Insidious star Saint Patrick Wilson and so the Departed
star Vera Farmiga. Wan premiered footage of The conjuration for the first
time at manhattan Comic-Con, and it arguably became the surprise hit of
the convention – that's speech one issue, considering that NYCC 2012
jointly featured high-profile horror flicks similar to the Carrie and Evil
Dead reamakes. browse on for our breakdown of The conjuration footage and
panel – and a breakdown of why this will be the scariest film of 2013.
Rome what I've seen The conjuration is even lots of nominal and smart in
its execution than Insidious was. altogether of the delineated footage,
the scares were created through smart sequencing and camerawork, with clip
2 notably evidencing Wan's maturing ability as a horror director – a genre
that the director himself confessed he can alone play certain word of
farewell, before moving on to completely different pastures (like sci-fi
or superhero films)

Difference between function and polynomials

Difference between function and polynomials

I would like to know if there is an important difference between functions
and polynomials? Because in essence they seem very similar, because of the
evaluation homomorphism.
Thanks in advance.

Display different parts of JQuery Ajax response in separate DIVs

Display different parts of JQuery Ajax response in separate DIVs

I have a script that allows the user to grade an image and then
dynamically adds another form to the page to grade the next. When the
image grade is entered it is entered into a database and displayed on the
page above the newly created form in a list with the ID responds.
All of this works great but I would also be able to show a running count
of how many images have been audited at the top of the page in a DIV with
the ID results.
The JQuery
$("#FormSubmit").click(function (e) {
e.preventDefault();
if($("#grade").val()!='1')
{
if($("#positioning_reason").val() == '' &&
$("#exposure_reason").val() == '' &&
$("#equipment_reason").val() == '' &&
$("#patient_reason").val() == '')
{
alert("Please select why the image was not perfect");
return false;
}
}
jQuery.ajax({
type: "POST",
url: "response.php",
dataType:"text",
data: $('#test_form').serialize(),
success:function(response){
$("#responds").append(response);
$('#test_form')[0].reset();
$("#test_form").get(0).scrollIntoView();
$("#results").display $numRows in this div
},
error:function (xhr, ajaxOptions, thrownError){
alert(thrownError);
}
});
});
response.php
if(isset($_POST['grade']))
{
$grade = $_POST['grade'];
$positioning = $_POST['positioning_reason'];
$exposure = $_POST['exposure_reason'];
$patient = $_POST['patient_reason'];
$equipment = $_POST['equipment_reason'];
$user_id = $_POST['user_id'];
$audit_id = $_POST['audit_id'];
$sql= "INSERT INTO image(auditID,
imageGrade,positioning_reasonID,exposure_reasonID,patient_reasonID,equipment_reasonID,auditDate,userID)
VALUES('$audit_id',
$grade,'$positioning','$exposure','$patient','$equipment',NOW(),$user_id)";
$result = mysqli_query($mysqli,$sql) or die(mysqli_error($mysqli));
if($result)
{
$sql = "SELECT * FROM image WHERE auditID = '$audit_id'";
$result = mysqli_query($mysqli,$sql) or die(mysqli_error($mysqli));
$numRows = mysqli_num_rows($result);
$my_id = mysqli_insert_id($mysqli);
echo '<li id="item_'.$my_id.'" class="audit_item">';
echo '<div class="del_wrapper"><a href="#" class="del_button"
id="del-'.$my_id.'">';
echo '<img src="images/icon_del.gif" border="0" />';
echo '</a></div>';
echo 'Grade - '.$grade.' - '.$my_id.' - '.$numRows.'</li>';
}else{
header('HTTP/1.1 500 Looks like mysql error, could not insert
record!');
exit();
}
}
I would like to display the value $numRows in a div called 'results' (at
present it i being displayed with all of the other results for testing
purposes). I have tried getting the $numRow value from a different php
page using a separate page load function further down the page but it was
very slow and the result were not always correct because of timings

Create array of outer products in numpy

Create array of outer products in numpy

I have an array of n vectors of length m. For example, with n = 3, m = 2:
x = array([[1, 2], [3, 4], [5,6]])
I want to take the outer product of each vector with itself, then
concatenate them into an array of square matrices of shape (n, m, m). So
for the x above I would get
array([[[ 1, 2],
[ 2, 4]],
[[ 9, 12],
[12, 16]],
[[25, 30],
[30, 36]]])
I can do this with a for loop like so
np.concatenate([np.outer(v, v) for v in x]).reshape(3, 2, 2)
Is there a numpy expression that does this without the Python for loop?
Bonus question: since the outer products are symmetric, I don't need to m
x m multiplication operations to calculate them. Can I get this symmetry
optimization from numpy?

Watch Chelsea vs Hull Live Streaming

Watch Chelsea vs Hull Live Streaming

Watch Chelsea vs Hull Live Streaming Link
Chelsea met first great success in 1955 with a victory in the English
League Cup. Following that, the club won several competitions in 1960,
1970, 1990 and 2000. Since 1996, Chelsea knows the most successful period
in its history. In all, the club has won four championships, seven FA
Cups, four League Cups and four FA Community Shields. Moreover, in
addition to national success, the club has also won competitions at
continental level, with two European Cup Winners' Cup, one UEFA Super Cup
and the Champions League. In 2009-2010, the club won its first Double5,
and in 2012, Chelsea became the first London club to win the Champions
League.
Watch Chelsea vs Hull Live Streaming Link

Intel INF Chipset installation stuck on Windows 7 64-Bit

Intel INF Chipset installation stuck on Windows 7 64-Bit

I am about to re-setup my system, running on a GigaByte GA-X58A-UD3R /
Core i7
I installed Windows 7 64-Bit and now downloaded the INF update utility
from the GigaByte website.
When running it, it installs a few things, then it says:
Installing Intel(R) 7500/5520/5500/X58 I/O Hub System Management Registers
- 342E
And then it just keeps installing and installing, but never comes to an
end. Waited for 10 minutes already. Rebooted. Safe mode. Tried it all.
What's wrong here?

Making a request to an API in php

Making a request to an API in php

So I want a way to start up and shutdown my droplet with Digital ocean,
they have their own API but im not quite sure how to do it
basically I want to be able to click a button on my website, The server
starts up and the JSON response is displayed. The API url is this
https://api.digitalocean.com/droplets/?client_id=[your_client_id]&api_key=[your_api_key]
and the example output is this:
{ "status": "OK", "droplets": [ { "id": 100823, "name": "test222",
"image_id": 420, "size_id":33, "region_id": 1, "backups_active": false,
"ip_address": "127.0.0.1", "locked": false, "status": "active"
"created_at": "2013-01-01T09:30:00Z" } ] }
Any help is apreciated

Saturday 17 August 2013

Youtube embed code not loading until page refresh?

Youtube embed code not loading until page refresh?

Basically, I have a website that allows users to embed a Youtube video,
Vimeo, Prezi, Scribd and a few other things.
Once they upload them, their embed code is saved to a database and the
page is reloaded just like what happens when anything is sent to a SQL
database through PHP. Although, the embedded movie/presentation will not
show until the page is refreshed again.
Why is this happening? Must I somehow use a load priority make these
embedded elements a priority to load straight away? This is my first time
working with embed code, and I have searched online for solutions,
although I could not find anything.
PS. Very new to PHP, MySQL and embed code.

Regex expression returns nothing. Why?

Regex expression returns nothing. Why?

This returns nothing?
# Enter your code for "Image Extractor" here.
import re
with open('site.html') as html:
content = html.read()
content = str(content)
print(re.findall(r'<ima?ge?\s+[^>]*?src=["|\']([^["|\']]+)', content))
I think it has something to do with me escaping the backslash from the
expression...

Localize popover twitter bootstrap

Localize popover twitter bootstrap

I'm trying to localize information which is displayed in a popover from
Twitter Bootstrap.
Ideally would be showing/hiding divs depending on browser language, and of
course if a certain input field got hovered over with the corresponding
div id.
This is what I got so far:
$(function () {
$("#popOver").popover(
{
trigger: 'hover focus',
placement: 'right',
content: function () {
return $('#sInfo').show();
}
});
});
And some where on the page (mvc view) i got these divs:
<div lang="en" id="sInfo">
Here is some English content.
</div>
<div lang="pt" id="sInfo">
Here is some portugese content.
</div>
Can someone help me out with this?

Efficient manipulation of a list of cartesian coordinates in Python

Efficient manipulation of a list of cartesian coordinates in Python

Background:
I'm writing a program which handles large quantities of data related to
the networks of vertices of various regular shapes. I have a working
generator which produces a list of cartesian coordinates corresponding to
the vertices of said shapes based on a range of user input parameters. The
data is then passed to filters which clear up duplicate entries, sort the
data and various other functions, from where the cleaned data is fed to a
canvas module which loops through and draws the vertices.
Question:
I need to implement a new filter that efficiently loops through the
coordinates, comparing each pair against every other pair, i.e.
(x1,y1)->(x2,y2) to (x1,y1)->(xn,yn), (x2,y2)->(x3,y3) to (x2,y2)->(xn,yn)
etc. for all entries and, for example, if the relationship between (x1,y1)
and (x5,y5) fits [(x5-x1)^2+(y5-y1)^2]=vertex_spacing^2, then the two sets
of coordinates are then paired with their respective list entry numbers
and appended to a new list where one entry would be of the form: [(x1,y1),
(x5,y5), 0, 4] for example. What is the most efficient method for
achieving this?
My Attempts:
I've looked at quite a few methods for handling lists on here and on
various guides. I've attempted nested 'for' and 'if' loops, but find while
this method can work it leads to excessively long run times, as well as
attempting to breaking the problem down into numerous smaller for loops.
Further Notes:
The ultimate aim of this is to use the resulting coordinates for front-end
interface elements, and to be saved and imported as necessary. The
function of the list positions 0 and 4 in [(x1,y1), (x5,y5), 0, 4] is to
enable the interface to group coordinates for later use in canvas objects.
The method should be able to process potentially thousands of coordinates.
Thank you in advance for any help, I am of course willing to improve the
phrasing/information I've supplied and/or add example code if it is
unclear what I am asking in any way- I'm still quite new to this! :)

calculating 2^1000 without any module/library

calculating 2^1000 without any module/library

i am practicing on projecteuler and am working on a problem to calculate
2**1000(2^1000) in python. my code is
z=2**1000
sum=0
while z>0:
x=int(z%10)
sum+=x
z=z/10
print(sum)
gives result
10715086071862673209484250490600018105614048117055336074437503883703510511249361224931983788156958581275946729175531468251871452856923140435984577574698574803934567774824230985421074605062371141877954182153046474983581941267398767559165543946077062914571196477686542167660429831652624386837205668069376
1189
while python is able to calculate right value for z but why is the sum not
correct? (PS.don't need one line solutions)

Web development, web site making

Web development, web site making

The question i am asking may be pretty easy for some but i don't have any
idea about this. Can anybody tell me how to change the content of a web
site without touching other elements? i want the content (mid) of my web
site to change when i click on any of the links on my navigation bar and
the rest of the things like navi bar bottom description left list etc.
remain unchanged. I know it's possible but don't know how to do this. I
have not tried any thing because i don't know :p can any body help? Please
be specific as you would already would have noticed that i am pretty dumb
at it

How to return 404 page in ASP .NET MVC when query string parameters is incorrect

How to return 404 page in ASP .NET MVC when query string parameters is
incorrect

Let's imagine I have the following action
public ViewResult Products(string color)
{...}
and route which maps url "products" to this action.
According to SEO tips link /products?color=red should return
200 OK
But link /products?someOtherParametr=someValue
404 Not found
So the question is - how to handle unexisting query parameters and return
404 in this case

Friday 16 August 2013

Watch Essendon vs North Melbourne Live Stream Australian Football (AFL-Round 21) Game Online TV

Watch Essendon vs North Melbourne Live Stream Australian Football
(AFL-Round 21) Game Online TV

Welcome to the Australian Football (AFL-Round 21) games between Essendon
vs North Melbourne live Streaming On your PC. Watch Essendon vs North
Melbourne live Australian Football (AFL-Round 21) online. Here you can
watch all Australian Football (AFL-Round 21) games this season Essendon vs
North Melbourne in high-definition (HD) stream.You can Access this
Australian Football (AFL-Round 21) games Essendon vs North Melbourne live
coverage on your computer/PC/Laptop, Linux, Android, Apple, iOS, Mac,
tablet and mobile devices.
Click Here To: Watch Essendon vs North Melbourne Live
http://live-sports-online-tv35.blogspot.com
Watch Australian Football (AFL-Round 21) Game MATCH DETAILS Tournament:
Australian Football (AFL-Round 21) 2013 Team: Essendon vs North Melbourne
Date: Saturday, August 17, 2013 Time: 04:40 pm Local, 04:40 pm AEST Venue:
Etihad Stadium TV: FOXTEL Click Here To: Watch Essendon vs North Melbourne
Live
http://live-sports-online-tv35.blogspot.com
Also you can find cheap tv processing program. Watch Essendon vs North
Melbourne live Australian Football (AFL-Round 21) . Enjoy watching live
stream Essendon vs North Melbourne online free. Stream coverage Essendon
vs North Melbourne online betfair tv, internet tv, broadcast, sop cast,
telecast, coverage, live streaming online free today. All kinds of
International Events Essendon vs North Melbourne live match. Essendon vs
North Melbourne online HD video and TV link in here. Where can i watch
Essendon vs North Melbourne free live Stream tv. watch Essendon vs North
Melbourne live video feed. Online Australian Football (AFL-Round 21)
Streaming of Essendon vs North Melbourne live scores and highlights.
Essendon vs North Melbourne Live stream@Australian Football (AFL-Round 21)
online TV.

Saturday 10 August 2013

Execution of ruby OR condition on an array

Execution of ruby OR condition on an array

In irb
[[]] | [3]
produces
[[], 3]
I am having some difficulty understanding it. How is the OR operator
working here ?

a doubt in finding distance in graph theory

a doubt in finding distance in graph theory

I was studying about a product graph which is defined as :
..
I am taking $G_1$ and $G_2$ as connected graphs.
I found that for any 2 vertices $(g,h),(g',g')$,
$(d(g,h),(g',h')$ = 1 if $g \sim g'$ or $h\sim h'$
$(d(g,h),(g',h')$ = 2 if $ g=g' ~or ~h=h'$
$(d(g,h),(g',h')$ = min{d(g,g'),d(h,h')}, otherwise.
Here d denotes the distance between vertices and ~ means adjacency. Am I
right in finding the above result? Is there any flaw. Please rectify if I
am wrong.
Heartily thanks.
NOTE: 1st clause in the the formula directly follows from definition. In
2nd clause i took g=g'. the the vertices are like (g,h) and (g,h'). There
must exist a vertex b such that g is adjacent to b. thus we get a path of
length 2: (g,h)(b,c)(g,h'), where c is any vertex in $G_2$. thus distance
is 2 in this case. I am doubtful about 3rd clause.

Friday 9 August 2013

other way how to toggle 2 function in jQuery

other way how to toggle 2 function in jQuery

I want to toggle this tweenmax when click TweenMax.to(con, 1, {height:
'200px', ease:Bounce.easeOut}); here exactly what I want:
function One() {
TweenMax.to(con, 1, {height: '200px', ease:Bounce.easeOut});
}
function Two() {
TweenMax.from(con, 1, {height: '200px', ease:Bounce.easeOut});
}
$('.click').toggle(One, Two);
con is a div that will animation the height when click is this posible ?
please help

nesting another field in a json column

nesting another field in a json column

I'm trying to use the Json type available in the Postgres 9.2 release as a
means to . I created a column called data on the corrections table, and
when I present the corrections form I'm also passing the text_field
content so that when I create an entry it will be saved like this
data: {"content from @content"=>"value entered in form field", "content
from @content" => "value entered in form field }
with the multiple entries with (dynamic key names) in data resulting from
however many form fields are created by <% @content.each do |content| %>
in the form below.
<% @content.each do |content| %>
<div class="row">
<p class='span3'>
<%= label_tag(content, "#{content}") %>
</p>
<p class='span3'>
<%= d.text_area content, :class => 'content', :value => "", :cols
=> "40", :rows => "2", :id =>
'correction_data_'"#{content.parameterize}"%>
I have two questions
1 How would I change the Rails form to nest another key value pair inside
(or associate with) each
"content from @content"=>"value entered in form field"
2 Is this proper JSON format? It seems to me like it's just saving a bunch
of key value pairs with the key always changing depending on the content
from @content. If it isn't, is that a problem? Am I missing out on
something by doing it this way?
data: {"content from @content"=>"value entered in form field", "content
from @content" => "value entered in form field }

How to do free hand drawing on map view in iphone sdk

How to do free hand drawing on map view in iphone sdk

Can anyone tell me that How to do free hand drawing on map view in iphone
sdk .
Thanks
Rohit Sharma

PHP/javascript confirm() -- can't figure out what's wrong with this code

PHP/javascript confirm() -- can't figure out what's wrong with this code

If someone could troubleshoot I would be very grateful. I have copied and
pasted a javascript "confirm()" code block from w3c schools. I have
repeatedly double-checked the punctuation and braces, and still it won't
work. With the comment in place, the first alert box fires; but when I
remove the comments, then nothing happens, indicating that there is a
problem in the commented code. But for the life of me I can't find the
problem.
if (TRUE) {
echo "<script>
alert('test confirm box'); /*
var r = confirm('Title, Author, or Keyword not found.\nSearch again
ALL publishers, categories, and types?');
if (r==true)
{
alert('OK');
}
else
{
alert('cancel');
} */
</script>";
}