Monday, 19 August 2013

Primary Key error when trying to create Foreign Key

Primary Key error when trying to create Foreign Key

Running into a problem creating a Foreign Key after creating a
Parent/Child table scheme with partitioning setup.
CREATE TABLE [dbo].[MessageHeader](
[MessageReceivedHeaderID] [int] IDENTITY(1,1) NOT NULL,
[MessageReceivedHeaderGlobalId] [uniqueidentifier] NULL,
[CreatedDateTime] [datetime] NOT NULL
)
GO
ALTER TABLE [dbo].[MessageHeader]
ADD CONSTRAINT [PC_MessageHeader_CreatedDateTime_1]
PRIMARY KEY CLUSTERED ([MessageHeaderID], [CreatedDateTime] ASC)
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF,
IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS
= OFF)
ON [PS_Monthly] ([CreatedDatetime])
CREATE TABLE [dbo].[MessageDataInfo](
[MessageDataInfoID] [int] IDENTITY(1,1) NOT NULL,
[MessageHeaderID] [int] NOT NULL,
[CreatedDateTime] [datetime] NOT NULL)
GO
ALTER TABLE [dbo].[MessageDataInfo]
ADD CONSTRAINT [PC__CreatedDateTime_1]
PRIMARY KEY CLUSTERED ([MessageDataInfoID], [CreatedDateTime])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY
= OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = OFF)
ON [PS_Monthly] ([CreatedDatetime])
GO
ALTER TABLE [dbo].[MessageDataInfo] WITH CHECK
ADD CONSTRAINT [FK_HeaderID]
FOREIGN KEY([MessageHeaderID])
REFERENCES [dbo].[MessageHeader] ([MessageHeaderID])
What happens is I get the error:
Msg 1776, Level 16, State 0, Line 1 There are no primary or candidate keys
in the referenced table 'dbo.MessageHeader' that match the referencing
column list in the foreign key 'FK_HeaderID'.
I am not sure why this is happening because that column is obviously the
Primary Key! Any help is appreciated.

Total average curvature of an immersed torus.

Total average curvature of an immersed torus.

How to prove that the total average curvature of an immersed torus of
$R^3$ such that has nontrivial self-intersection must $> 8 \pi$? I don't
have any idea about it.

Sunday, 18 August 2013

IMG won't show on remote site

IMG won't show on remote site

I have a webpage where the images are not being found (running chrome). I
synced the remote directory with my local one, so all files should be
identical, however I can see the images locally but not on the remote
site. Can anyone explain why?
I have the following directory where my index.html is:
icons/circle/*.png, where * is some generic social media i.e. (facebook,
twitter, etc.)
using this code to show it on html
<img class="social-media" src="icons/circle/facebook.png">
But it only shows when I view my webpage locally, not when everything is
uploaded to the server.
See webpage footer at dmacmill.com
Full directory listing:

Parsing a text file into a list in python

Parsing a text file into a list in python

I'm completely new to Python, and I'm trying to read in a txt file that
contains a combination of words and numbers. I can read in the txt file
just fine, but I'm struggling to get the string into a format I can work
with.
import matplotlib.pyplot as plt
import numpy as np
from numpy import loadtxt
f= open("/Users/Jennifer/Desktop/test.txt", "r")
lines=f.readlines()
Data = []
list=lines[3]
i=4
while i<12:
list=list.append(line[i])
i=i+1
print list
f.close()
I want a list that contains all the elements in lines 3-12 (starting from
0), which is all numbers. When I do print lines[1], I get the data from
that line. When I do print lines, or print lines[3:12], I get each
character preceded by \x00. For example, the word "Plate" becomes:
['\x00P\x00l\x00a\x00t\x00e. Using lines = [line.strip() for line in f]
gets the same result. When I try to put individual lines together in the
while loop above, I get the error "AttributeError: 'str' object has no
attribute 'append'."
How can I get a selection of lines from a txt file into a list? Thank you
so much!!!

Android build error in vendor_module_check.mk

Android build error in vendor_module_check.mk

I am trying to build android 4.2.2 for maguro, but I keep getting the
following build error:
vendor_module_check.mk:53 vendor/broadcom/maguro/proprietary/bcm4330.hcd
has unknown owner
Does anyone know how to solve this ?
Thanks.

How to create dynamic tabs in JSF

How to create dynamic tabs in JSF

I am querying database and fetching some value in bean.Depending on the
value returned from bean i have to create tabs dynamically.If the value is
3 there should be 3 tabs

How can I show text touching div borders?

How can I show text touching div borders?

I have a DIV. Inside that DIV I put some some text. The div is positioned
absolutely. It has style="border:1 px solid black" so it shows as a nice
rectangle. Now within this rectangle I want to show text which touched
either top or bottom border (whichever is easier):
The thing is: 1) I don't want to underline the text- this is not the issue
2) I don't want to manually position the text within the DIV
3) The point is: I set the position of the DIV and the text automatically
touches the border (top or bottom border)- no matter what font-family or
font-size I set.