Thursday, 15 August 2013

python - Sending a dict from a list as a Gmail -


I want to email the script to any object in the new properties list. Each object list like so:

  newProperties [0] = { "marketing_package_url": "http://www.capitalpacific.com/inquiry/TrailsEndMarketplaceExecSummary.pdf", "Location": "Goa city, or", "title": "trails end Market", "Contact": "mailto: mhorwitz@capitalpacific.com"} \ newProperties [1] = { "marketing_package_url": "http: // cp. capitalpacific .com / properties / yukon-village-yukonOK.pdf "," location ":" yukon, okay "," title ":" yukon village "," contact ":" mailto: rsanner@capitalpacific.com "} .. Selenium import webdriver import import import import import import cs import json driver = web driver. Firefox () # Capitol Pacific website # Commerexle  

/ full script

 Real Estate #open text file containing the property title, which we already know about #list q, unique marketing URLs that we know about old properties = [] P = Rie Compel (R 'https ?: \ / \ [^ "] +' with Re.IGNORECASE | re.MULTILINE) (open (" properties F: in the line f: q = re.findall (p, line) oldProperties.extend (q) #search driver.get for new listing ("http: // cp .capitalpacific.com / properties ") # Current List page to enter the list newProperties = [] property driver.find_elements_by_css_selector ( 'table.property div.property'): title = property.find_element_by_css_selector ( 'div.title h2') position = property.find_element_by_css_selector ( ' div.title h4 ') marketing_package = property Kfind_element_by_partial_link_text (' marketing package ') contact_email = property.find_element_by_partial_link_text newProperties.append ({' title '(' com. '): title.text,' location ': location.text,' marketing_package_url ': marketing_package.get_attribute ( "href"),' Contact ': contact_email.get_attribute ( "href")}) driver.close () # that #marketing URLS X old properties refers to cross Th Search for: For items in new properties: if (item ['Marketing Ng_package_url'] == x: newProperties.remove (item) #properties now only have new properties - open them in the file ('properties.txt' , 'W'): For items in new properties: Jason .dump (item, outfile) # If no new properties are found, then skip #else, end email properties # New If the property is not found, then delete script #else, email properties if len (newProperties) == 0: sys.exit () else: fromaddr = 'osxxxxxt @ gm ail.com 'toaddrs = [' osfsfsar@onid.oregonstate.edu '] username =' xxxx@gmail.com 'password =' ​​0fdrfdf 'server = smtplib.SMTP (' smtp.gmail.com: 587 ') server. Server.login (user name, password) for starttls () newProperties items: msg = str (items) #PROBLEM server here. Sendmail (fromaddr, toaddrs, msg) server.quit ()  

The problem is currently the email sent is empty, I used to add new entries on the page, but it appears that the problem of creating a word in a string and sending it Is happening Does anyone know how I can fix this?


php - Twitter APIs not working on hosting [Works fine on localhost] -


I am working on an app so that the Tweets made in 1 mile radius of given geolocation (latitude and longitude) To be shown. This is my PHP code,

   

I am using the Vip server (PHP V5.5.12) and my code is working fine on this. But when I host my application on some free hosting sites (I have tried hostinger.in and 000webhost.com), then this script fails and prints 'blank' only.

Please help me solve this problem. / P>

Thank you in advance.

I tried both in the hosting and 000webhost and many others did not work because of Twitter There is a library to connect, PHP uses curls, and many free hosting has disabled the curl, or denies the curling connection to outgoing connections or twitter when it comes from the IP from the free host server. Maybe it's possible for the internet I've read, because many hackers are messing with Twitter and hosting with free hosting accounts. So, looking for a free hosting with CPNL, which works with Twitter API, it is a challenge, I have tried more than 20 and they do not work, some of them will be automatically recorded to the account or file Deleted or FTP access blocks if you try to curl Twitter


The DataMember attributes in WCF are not honored when I copy from List to another -


जब मैं DataColumns वर्ग को दरोंऑफ़ पे क्लास में प्रतिलिपि करता हूं, तब डब्लूसीएफ में डेटामेम्बर विशेषताओं का सम्मान नहीं किया जाता है जब मैं निम्नलिखित कोड का उपयोग करता हूं प्रतिलिपि बनाना। मैं चरण 8, चरण 9, चरण 10 में परिणाम देखना चाहता हूं, लेकिन मुझे चरण 10 मिलता है, चरण 8, चरण 9 के रूप में ऑर्डर के अंशदान की अनदेखी की जा रही है और स्तंभों को वर्णानुक्रम में वर्णित रूप से क्रमबद्ध किया जा रहा है । इसके अलावा EmitDefaultValue = false विशेषता को नजरअंदाज किया जा रहा है और मैं शून्य मानों के साथ कदम देखता हूं।

<पूर्व> सूची & lt; DataColumns & gt; स्रोत = नई सूची & lt; DataColumns & gt; (); सूची के & lt; RatesOfPay & gt; गंतव्य = नई सूची & lt; दरेंऑफ़ पे & gt; (); गंतव्य = स्रोत। चयन करें (डी = & gt; नए दरेंऑफ़ पे (step8 = d.column8, step9 = d.column9, step10 = d.column10})। ToList (); सार्वजनिक वर्ग DataColumns {[डेटामेम्बर (ऑर्डर = 0, नाम = "कॉलम 8", एमिट डीफॉल्ट वैल्यू = गलत)] सार्वजनिक स्ट्रिंग column8 {get; सेट; } [डेटामेम्बर (ऑर्डर = 1, नेम = "स्तंभ 9", एमिट डीफॉल्ट वैल्यू = गलत)] सार्वजनिक स्ट्रिंग कॉलम 9 {प्राप्त; सेट; } [डेटामेम्बर (ऑर्डर = 2, नेम = "स्तंभ 10", एमिट डीफॉल्ट वैल्यू = गलत)] सार्वजनिक स्ट्रिंग कॉलम 10 {प्राप्त करें; सेट; }} पब्लिक क्लास रेटऑफ़ पे {[डेटामेम्बर (ऑर्डर = 0, नाम = "चरण 8", एमिट डीफॉल्ट वैल्यू = झूठे)] सार्वजनिक स्ट्रिंग चरण 8 {प्राप्त; सेट; } [डेटामेम्बर (ऑर्डर = 1, नेम = "चरण 9", एमिट डीफॉल्ट वैल्यू = गलत)] सार्वजनिक स्ट्रिंग चरण 9 {प्राप्त; सेट; } [डेटामेम्बर (ऑर्डर = 2, नेम = "स्टेप 10", एमिट डीफॉल्ट वैल्यू = फॉल्स)] सार्वजनिक स्ट्रिंग चरण 10 {प्राप्त; सेट; }}

मेरी टिप्पणियों पर विस्तार करने के लिए, DataMember है DataContractSerializer किसी विशेष सदस्य को क्रमबद्ध करने के लिए कैसे निर्देशित किया जाता है।

आदेश बताता है DataContractSerializer किस क्रम को क्रमबद्ध / deserialize सदस्य सं।

EmitDefaultValue बताता है कि DataContractSerialzier डिफ़ॉल्ट मानों का उत्सर्जन करना है या नहीं (संदर्भ प्रकारों के लिए शून्य, मान प्रकारों के लिए दिया गया मान) जब सीरियलिज़िंग हो यदि यह गलत पर सेट है, तो रिक्त परिणाम नहीं होगा - सदस्य को छोड़ दिया जाएगा। यह डिफ़ॉल्ट रूप से सच है।

कुछ उदाहरण यह स्पष्ट करने में मदद कर सकते हैं:

सबसे पहले, वर्ग। यदि आप डीबगर में क्लास को देखते हैं, तो संपत्तियों को एएससीआईआई वर्णमाला क्रम में सूचीबद्ध किया जा रहा है, जिसका मतलब है कि चरण 10 पहले सूचीबद्ध होगा यदि आप सीरियल किए गए एक्सएमएल को देखते हैं, तो आप ऐसा कुछ देख सकते हैं:

  & lt; column8 & gt; एबीसीडी & lt; / column8 & gt; & LT; column9 & gt; defg & lt; / column9 & gt; & LT; column10 & gt; hijk & lt; / column10 & gt;  

कॉलम में से एक, कॉलम 9 कहें, तो एक रिक्त स्ट्रिंग थी, आप इसे (जैसा कि EmitDefaultValue से सेट किया गया था) जब इसे सीरियल किया गया था: < / P>

  & lt; कॉलम 8 & gt; एबीसीडी & lt; / column8 & gt; & LT; column10 & gt; ZZZZ & lt; / column10 & gt;  

EmitDefaultValue एक नामकरण परिप्रेक्ष्य से थोड़ा भ्रमित हो सकता है और इसमें IsRequired के साथ कुछ बहुत ही मजेदार बातचीत है


Spaces in Associative Array Keys while looping through multiple arrays in Bash -


I am facing many problems, while many collaborative arrays are being paused.

I am running the code (stripped of the real information)

  declare arrays = ("arrayone" "arraytwo") - A array = (["a"] = 1 ["two"] = 2) For the array in $ {array [*]} for $ $ in the array (eval resonance $$) [*] = 2) declared - A array = = (["blank" More text with the text "] = value [" empty space with "] = {'!' $ Array [@] \} is seen entirely" $ " 

It works perfectly well until I have run into the key value that keeps the space in it No matter what I do, I can not get items with empty space for proper treatment.

I appreciate your thoughts to get this work done. If that's the case, So there is a better way of doing this, I would be happy to hear it, I do not feel like scratched and started. It is best that I am able to come up with so far.

< P> Thank you!

Bash 4.3 This allows you to create a reference specifically to the other, in your case, you will declare

  - A assoc_one = (["one"] = 1 ["Two "] = 2) Announce - An ashoka_tobu = ([" Text with spaces "] = Value [" More text with spaces "] = separate value) Announce the -n array # to" $ {! Assoc_ @} "for the array in the $ {array {@}}"; for the key in the "$ {array} [@]}"; get 'one' 'two' 'text with more text with spaces " < / Pre> 

and it has happened. '

The names were changed to protect the idioms I mean, I have changed the names of the arrays so that I "$ {! Assoc _ @}" I can do the array without any particular code.


java - Application properties as static variables or instance variables with singleton -


I need to read application properties in a class from a .properties file that forms a point for application properties Should work in What is the recommended method for such a class: define those properties as a fixed variable or in the example variable with singleton patterns?

I have a myapp.properties file in the format key = value . Let's say that there are two application properties defined in this file:

company = ABC batchism = 1000

At the application startup I will read this file whenever I use application properties in a class ApplicationProperties I will use this class if I need it

I have 2 options:

Option 1: Application properties Defined as static variables:

  public class ApplicationProperties {private static string company; Private static id BATCH_SIZE; Static {// read myapp.properties file and static variable computing & amp; BATCH_SIZE} Private ApplicationsApplications () {} Public Stabilized String Millcompany () {Return Company; } Public stable difference getBatchSize () {Return BATCH_SIZE; }}  

Option 2: Define the application properties as an example variable:

  public class ApplicationProperties {Personal Static ApplicationProperties INSTANCE = New ApplicationApplications (); Private string company; Private int batch size; Private ApplicationsApplications () {// read myapp.properties file and frequency variable computing & amp; Batch system) public static applicationProperties getInstance () {return INSTANCE; } Public string getCompany () {return.company; } Public int getBatchSize () {return.batchSize; }}  

For option 1 I will arrive this way:

  ApplicationProperties.getCompany (); ApplicationProperties.getBatchSize ();  

For option 2, I would like to reach out to:

  ApplicationProperties.getInstance (). GetCompany (); . ApplicationProperties.getInstance () getBatchSize ();  

Which is better? And why?

If the answer to this question has been answered first, please answer.

Option 2 is a bit more complex and verbose without offering any benefit So, option 1 is better design.

IMHO is not "opinion-based".


ios - How do I resolve a to-many saving conflict in Core Data? -


यहाँ मेरा संबंध सेटअप है:

अनुभाग & lt; ----- & gt; & gt; अनुच्छेद

मैं थ्रेड कारावास रणनीति (सकल, मैं जानता हूँ, लेकिन विरासत; रणनीति को बदलना अभी एक विकल्प नहीं है) का उपयोग करते हुए कई सूत्रों पर पार्सिंग कर रहा हूं।

जब मैं NSMergeConflict ऑब्जेक्ट की जांच करता हूं, तो मुझे विवाद का सामना मिलता है, हालांकि मैं कई रिश्ते को नहीं देख रहा हूँ NSManagedObjectID जो वादा करता है, इसलिए मैं उलझन में हूँ और सोच रहा हूँ कि कैसे

मैं इस तरह से अपना NSMergePolicy उपवर्ग बना रहा हूं:

  वर्ग ModelMergePolicy: NSMergePolicy {init () {super। Init (mergeType: .MergeByPropertyObjectTrumpMergePolicyType)}}  

मैंने MergeByPropertyObjectTrumpMergePolicyType को चुना क्योंकि अन्य गुणों को मर्ज करना (जो साधारण विशेषताएं हैं) आसान और स्वचालित रूप से संभाला जाना चाहिए।

क्या मुझे कुछ और करने के लिए संघर्ष करने की सूची में अपने resolveConflicts (सूची: त्रुटि:) ओवरराइड

में कई संबंध वस्तु आईडी देखने की आवश्यकता है? > टी अग्रिम में hanks।


संपादित करें:

हताशा में, मैं दस्तावेज़ीकरण को अधिक बारीकी से पढ़ता हूं, और ऐसा लगता है कि कई रिश्तों को प्राप्त करना आवश्यक है और वहां जीता किसी भी NSManagedObjectID के साथ फ़ेचिंग करने के लिए नहीं, जो मुझे समझ में आता है।

अब मैं क्या कर रहा हूँ यह है कि एक से कई के विशिष्ट संस्करण कैसे प्राप्त करें रिश्ते (या NSManagedObject से रिश्ते प्राप्त करने के लिए) है, इसलिए मैं मर्ज को संभालने के लिए क्या कर सकता हूं।


html - Can't make link inside td vertically centered -


As a homework I am creating a website, I created this menu using a "table" and put "a href". "The problem inside each" TD "is that I can not understand how the text written in" A "inside" TD "is standing.
" <">
>
  & Lt; Table class = "male"> gt; & lt; tr & gt; & lt; td & gt; & lt; a href = "http://i.imgur.com/zxl58Pv.jpg?1" Style = "display: block; Width: 100%; Height: 100%; Text-decoration: none; "> Musei    Com / zxl58Pv.jpg? 1 "style =" display: block; Width: 100%; Height: 100%; Text-decoration: none; "> COMPITI   gt; & lt; td & gt; & lt; a href =" http: //i.imgur. Com / zxl58Pv.jpg? 1 "style =" display: block; Width: 100%; Height: 100%; Text-decoration: None; "Gt; Pageinley  & lt; td & gt; & lt; a href =" http: //i.imgur. Com / zxl58Pv.jpg? 1 "style =" display: block; Width: 100%; Height: 100%; Text-decoration: none; "> CONTATTI  gt; & lt; / TD & gt; & lt; / tr & gt; & lt; / table & gt;   

Inline style display: block; / Code>, because vertical-aligned works only on inline or table-cell . Code> box.

Alternatively, you can use

Code> TD A {display: block; padding: 1vw 0; No L-decoration: none;}

and remove all inline styles.

DEMO: