Thursday, 3 October 2013

Get the names of all the entities in the entity container

Get the names of all the entities in the entity container

How to retrieve the name of all the entity objects in the container. I
wish to bind the list of tables to a combox. So I want the name of all the
classes in the edmx.

Wednesday, 2 October 2013

spring java and customize configuration file

spring java and customize configuration file

i would like to include a xml file for my web app configuration. where
should i include this config file and how can i access it?
this is my proj tree directory:
web proj/
|
|---Java Resource/
|
|---build/
|
|---WebContent/
| |
| |---css/
| |---images/
| |---js/
| |---META-INF/
| |---themes/
| |---WEB-INF/
| | |
| | |---jsp/
| | |---lib/
| | |---web-servlet.xml
| | |---spring-security.xml
| | |---tiles.xml
| | |---web.xml
| |---index.jsp
|---build.properties
|---build.xml
many thanks.

Best way to iterate 1 to 10 times and add value and to numpy array in python

Best way to iterate 1 to 10 times and add value and to numpy array in python

I know this is a simple question for someone, but I'm lost here.
Say if I want my result to be 10 random numbers in an array value:
np.random.randint(0,2) # returns 0,1
I want to iterate 10 times:
for i=1 to 10 :
np.random.randint(0,2) addto myarray
I want a numpy array of0,1,1,0... 10 times
Thank you.

extract string after the first special character

extract string after the first special character

I have this string below:
foob/site?article=foo-title&id=12
how can I get the foo-title from the above string using regex? A short
solution would be appreciated.
Note: the foo-title could be any title.

Modal Diolog position using variable

Modal Diolog position using variable

i have modal dialog. I want to position it according to variable that i
get. I just concerned on Y-position and for X-position i just put 'middle'
and it's worked.
Is it possible for me to put variable in my modal window position just
like my last line?
My idea is where ever user click, the modal dialog will appear upper the
clicked position
here is how i get the y-position (onclcick)
var curr = e.pageY - $(window).scrollTop();
$('#spnCursor').val(curr);
This code to get the variable value
$(function() {
var cursor = $('#spnCursor').val();
var msgposition = cursor - 300;
$( "#dialog-form" ).dialog({
position: ['middle','msgposition'],
Thanks.

Tuesday, 1 October 2013

Write python object to multi-column csv file

Write python object to multi-column csv file

I am using Google Geocode API to append more detailed geographical
information to a list of addresses. That is to say, in a spreadsheet, I
want to append columns of sub-district (an administrative unit in India),
city and village specifically to each observation (address).
I've already imported the address into python in an ugly way and used
Google API together with some codes to convert this page
(http://maps.googleapis.com/maps/api/geocode/json?address=RAVI+NAGAR,+NAIDU+THOTA,+VISAKHAPATNAM+&sensor=true
) into the following printout:
Ravi Nagar [u'neighborhood', u'political']
Naidu Thota [u'sublocality', u'political']
Vizag [u'locality', u'political']
Vishakhapatnam [u'administrative_area_level_2', u'political']
Andhra Pradesh [u'administrative_area_level_1', u'political']
India [u'country', u'political']
530029 [u'postal_code']
as search result for address string:
"RAVI+NAGAR,+NAIDU+THOTA,+VISAKHAPATNAM+",Visakhapatnam,ANDHRA+PRADESH.
My question is, how to get these back to the previous csv file? I mean, I
don't want to miss the previous rows of the csv file and I want to append
new columns to the table. (Given the above result, I would like to have
columns for "postal_code", "administrative_area_level_1",
"administrative_area_level_2", "locality", "sublocality" and
"neighborhood" respectively. What I can think of is to construction a
function with identifier but I don't know that method according to my
shallow knowledge of Python.
One more minor point to ask: does it matter for u to show up in the
printouts? How to remove it? I mean remove the u in the "result"
dictionary (for this, you can click the link I've provided)?
Thank you for your help!
Linfeng

Struts2: Displaying text/huge file in textarea or frame

Struts2: Displaying text/huge file in textarea or frame

I have a huge content of data which is stored in a data-structure
(TreeMap) in the backend and I need to display that in my UI which should
be based on struts2.
Any idea on how to display the content of the Map in the struts2 front end
screen?
In backend I will be using a for loop to iterate through each record of
the map and need to display it line by line in the front end. I don't
think that I can use textarea for this. Whether there is any feature
available in struts2 to print it line by line in the front end by reading
it from backend. I am totally new to struts and It will be great if I
could get any suggestions. Please let me know in case if any clarification
is needed.

Is there a way to detect if a website uses a a known DDoS protection service (Prolexic for example)?

Is there a way to detect if a website uses a a known DDoS protection
service (Prolexic for example)?

Is there a way to check if a website uses a a known DDoS protection
service (Prolexic for example)?
My first guess was to look at the IP address the website resolves (and see
if it matches the protection service provider) to, but I am not sure that
proves anything.

SQL Azure Automated Backups doesn't work

SQL Azure Automated Backups doesn't work

I configured automated export of my SQL azure db, but backups are not
created. Also, I'am resieved this mail.
Automated SQL Export failed for pgmkixvn6d:aplicensingdb at 25.09.2013
23:06:45. The temporary database copy was made, but this copy could not be
exported to the .bacpac file in storage.
NOTES: We recommend checking that the storage account is available, and
that you can perform a manual export to that account. We will attempt to
export again at the next scheduled time
I tryed to export db manualy in this storage accaunt — it was created
without problems.