jeudi 27 juillet 2017

How to background avoid background colour from spreading all over the page in HTML5?

This is the my html code

<div class = 'paragraph1'>
<p>
    This is the paragraph. 
</p>

And below is my css

.paragraph1{
background: black ;
opacity: 0.5;
font-family: Verdana;
color:#9069CA;
text-align: left;
font-size: 18px;
padding-right: 420px;
padding-left: 135px;
}

How do I stop the paragraph background color from spreading all over the page.




Downloading file before is ready

I have a button to download a file from a db and writing info on it, but the button download the file before write the info so when I open it it's empty...

I have something like this:

/*taking blob from database and saved on a folder*/

File f = new File("file name");
for (int i = 0; i < datos.size(); i++) {
    /*write on the file*/
}


response.setContentType("application/octet-stream");
response.setHeader("Content-Disposition", String.format("attachment; filename=\"%s\"", f.getName()));

any ideas?




Which tool should I use for Responsive web development Chrome web developer tool or Simply resize the Window

I have been trying to make a responsive Website for mobile devices . I have found to test responsive design by 2 way. 1.By resizing window or 2. Using Google Chrome developer's tools in both of them i get a different view . Which one gives me right view, as I use font-size and padding in 'em'.




Couldn't Iterate The List More in Python 3

After several searching and modifies, I still couldn't figure it out. It stops at the 19th in the list.

This is the error:

line 22 in <module> parent_td=[td for td in possible_tds if 'Product' in td.text][0]
Index Error: List index out of range


    from urllib.request import urlopen as uReq
    from urllib.request import Request
    from bs4 import BeautifulSoup as soup
    import re

    ListName = "list"
    OpenList = open(ListName,"r")
    n=int(OpenList.readline())

    for num in range(1,n+1):
         print(num)
         theList=OpenList.readline()

         AccessCME=Request(theList,headers={"User-Agent":"Mozilla/5.0"})
         CMEPage=uReq(AccessCME).read()

         page_soup=soup(CMEPage,"html.parser")
         cme=page_soup.find("div",{"class":"cmeProduct section"})
         FuturesContracts=cme.span.text.strip()

         possible_tds=page_soup.find_all('td',attrs={'class':"prodSpecAtribute"})
         parent_td=[td for td in possible_tds if 'Product' in td.text][0]
         target = parent_td.fetchNextSiblings('td')[0].text.strip()
         first_take=re.sub('CME Globex:\s', '', target)
         BaseSymbol=re.sub(r'CME ClearPort:.*', '', first_take)

         print(FuturesContracts, BaseSymbol)

The link is the list file:

http://ift.tt/2tFWPkD

Let me know if I need to clarify anything else. Improvements/suggestions are welcome.




VBA - internet explorer - Click on IE popup

I am not able to click on Ie Pop up. code get stuck when the popup get open.

please advise.

regards, jayesh




PHP how to check if array is a collection of specific object

In my class I have a method which expects as array, and this array should be used differently depending on the collection type. The array items should be objects, and I need to know which class instance these objects are.

For example: in the array($obj1, $obj2), I need to check the instance of these objects, which class they were created from.

I know I could iterate the array and check instanceof of each item... but is there any better way to do so?




Speech to Text in Native Language

I want to develop an app which can convert speech to text in my langauge(Tamil). What are the possible api's such as Google Voice API, Alexa (I am not sure about these! I am confused! :-( ), that can convert voice to text in that particular language.

I am ready to merge the vocabulary of the language to work in that api. The platforms can be any like android or web. Anyone suggest please!

Also give a starting point to work with that api.

Note: I want the service free for atleast in development stage. Is there any?