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:


ASP.NET WIF Retrieve LDAP attributes as claims from AD FS server -


Claims completely new, WIF, in ADFS. I followed the code in this question: I was able to use the log user authenticated against AD FS. However, how do I get lost in the form of TP query AD FS to reclaim my LDAP characteristics for this user because I have them in the Reillying Party Claim Rast is configured by the rules as I did configure ADFS server. any idea? It was hoping to use code as I have mentioned above to get the claims back instead of proving it.

The problem is that the mentioned code does not rely on ADFS at all. Instead, it produces locally identifiable

I believe that you should use an idle flow with ADFS, that is, you want to redirect your browser to ADFS and then You want the user to return the claim. One of the easiest ways is described here, in one of my tutorials:


security - kernel - Executing in Ring0 -> risks? -


यह प्रश्न बहुत है (और केवल) सैद्धांतिक।

कृपया ध्यान दें इस परिस्थिति:

  • ring0 में चल रहा है & lt; -> अधिकतम विशेषाधिकार।
  • अगर किसी के पास एक कर्नेल है, तो कहें, 20 विश्वसनीय चलने वाली प्रक्रियाएं।
  • प्रत्येक प्रक्रिया अपने स्वयं के पेज से पढ़ती है / लिखती है, और अन्यथा नहीं कर सकती है; & lt; -> सीगफॉल्ट
  • उन प्रक्रियाओं में एक दूसरे के अलावा एक आभासी पते बहुत दूर हैं, जो पर्याप्त प्रक्रिया अलगाव प्रदान कर सकते हैं। / Li>
  • वे एक प्रबंधक (रूट) द्वारा सेट किए गए हैं और खुद को कम से कम विशेषाधिकार (एलडीटी बिट्स को उचित रूप से सेट किया गया) के साथ चलाते हैं
  • केवल भरोसेमंद कोडक ध्यानपूर्वक समीक्षा किए गए कोड -> विश्वास।

क्या सगेफाफ्ट्स के बारे में पूरे सिस्टम को उड़ा देने के कुछ जोखिम हैं?

क्या उपयोगकर्ताओं को भरोसेमंद तरीके से पर्याप्त अलगाव रणनीति है?


अपडेट (निंजाल का उत्तर देने के लिए) :

1) प्रक्रियाओं को एक दूसरे के साथ संवाद करने की आवश्यकता नहीं है। यदि उन्हें भविष्य की आवश्यकता होती है, तो वे पहले से निर्धारित ऑफसेट और परमाणु ताले और पूर्ण आरसीयू समर्थन (पहले से ही पूर्वानुमान में किया गया) के साथ एक बड़ी रिंग बफ़र के लिए धन्यवाद करेंगे।

यदि कभी बफर पूरा हो जाता है (ऐसा नहीं होना चाहिए क्योंकि उचित मूल्यों पर मान सेट करने के लिए बहुत से चरम परीक्षण किए गए हैं), वे कुछ भी जोड़ने से पहले इंतजार करेंगे (रिसीक करने के लिए, लेकिन यह बहुत ही सबसे बुरी स्थिति है)।

2) कोई इंटरप्रोसेस नहीं सत्यापन की आवश्यकता है वे सभी कार्य करते हैं जैसे कि वे मशीन पर अकेले थे।

3) हमारे पास पूर्ण आरसीयू समर्थन है (भले ही अभी तक प्रक्रियाओं की आवश्यकता नहीं हो, लेकिन जल्द ही हो)। जहां व्यावहारिक नहीं है, बुनियादी परमाणु तालों।

4) डीएमए एक भौतिक ऑफसेट पर रखा गया है जो कभी भी रीलाइटेबल (बड़े ऑफसेट) नहीं होना चाहिए। यह वर्तमान में कम भौतिक मेमोरी में डाल दिया गया है गार्ड पृष्ठों को इस क्षेत्र की रक्षा करें।


.net - How to run Giles? -


I'm trying to use but there is no benefit. I have both V.S. 2013 and V.S. Tried the solution to 2010, tried using it with power shaft and newgate etc. I can not get only the ps1 (an xi) It seems that logic is the problem. I am implementing this in the following way:

  giles.ps1 -s TestGiles.sln  

Try using full path etc. How do I Can I run the equipment?

There is an error that I am getting:

  Giles -S "C: \ Users \ donations \ Documents \ \ Projects Visual Studio 2010 \ TestGiles \ TestGiles.sln "Grr, argh ... v0.1.1.6 Critical Error: System.IO.IOException: Handle is invalid on System.Console.Clear () on Giles.Program.ConsoleSetup () on Giles.Program; System.IO.__ Error.WinIOError (Int32 errorCode, string maybeFullPath) in System.Console.GetBufferInfo (Successful Boolean throwOnNoConsole, Boolean & amp; Main (String [arg]) Finish: True Giles.exe: On C: \ Users \ Donation \ Documents \ Visual Studio `Projects \ TestGiles \ Package Code Enter `2010 \ Giles.0.1.6.1 \ Tools \ giles .ps1: 8 characters: 2+ & amp; & Lt; & Lt; & Lt; & Lt; $ Giles -s $ solutionFile + CategoryInfo: NotSpecified: (: string) [], RemoteException + FullyQualifiedErrorId: Exception without verb: NativeCommandError: System.IO.IOException: handle is invalid. On the system. Io .__ System Systems on Console System on Console.client () Error in Console.GetBufinInfo (Boolean Throwone Now Console, Boolean and Successful) Vinoyear (enter 32 error code, string hole fullpath) Program on Giles. ConsoleSet () on gills. Program Main (String [] args)  

I just installed it, and through Was running from "denied entry" problems After some attempts to solve it, I decided to make a project on C

Then this work (the tool runs). Try to do this - although you do not have to face permission problems, let's start with the most basic scenario Create a simple console app on the root directory and try to run Gail on it My job looks like a command line statement

  giles.exe -s "c: \ x \ x.sln"  

(I've created a solution on C: \ and named it "x" Visual Studio X will create directory and file solution Will keep inside.) If this works ... then try copying your solution to this project.


Submit form thru javascript -


How do I submit a form when choosing a date? Trying to call it on the field change but not working, maybe I have to do this in the javascript section.

I have it

  & lt; Script type = "text / javascript" & gt; Calendar. Setup ({inputField: "element_4_3", basefield: "element_4", displayArea: "calendar_4", button: "cal_img_4", ifFormat: "% e% B,% Y", select: selectDate}); & Lt; / Script & gt;  
  & lt; Span id = "calendar_4" & gt; Data Aspirati: & lt; Img id = "cal_img_4" class = "datepicker" src = "images / calendar.gif" alt = "Select a date." OnChange = "this.form.submit ();" & Gt; & Lt; / Span & gt;  

How can I do this? Thanks


php - DirectoryIterator fails on Network Attached Storage -


सभी iterators का सबसे सरल:

  & lt;! DOCTYPE html & gt; & LT; html & gt; & Lt; शीर्ष & gt; & Lt;? Php $ it = नया डायरेक्टरी इटरेटर ("c:"); विदेशी मुद्रा (इसे $ फ़ाइल के रूप में $) {यदि (! $ It- & gt; हैदोट ()) {echo $ file "\ N"; }}? & Gt; & Lt; / head & gt; & LT; बॉडी & gt; डायरेक्टरी इटरेटर का परीक्षण & lt; / html & gt;  

यह मेरे स्थानीय C: ड्राइव पर ठीक काम करता है, लेकिन अगर मैं इसे अपने नेटवर्क अटैचमेंट स्टोरेज ड्राइव (जेडड) (Z :) में बदलता है) इसे विफल रहता है:

घातक त्रुटि: अनदेखा अपवाद 'अनपेक्षित वैल्यू एक्सपेशेशन' संदेश के साथ 'DirectoryIterator :: __ कंसल्ट (z:, z :): सिस्टम निर्दिष्ट पथ का पता नहीं लगा सकता। (कोड: 3) 'बी में:' public_html \ test \ test.php लाइन 8 (!) अनपेक्षित वैल्यू एक्सपेशेशन: डायरेक्टरीइटरेटर :: __ कंसल्ट (z:, z :): सिस्टम निर्दिष्ट पथ का पता नहीं लगा सकता। (कोड: 3) बी में: \ public_html \ test \ test.php पंक्ति 8 पर

अन्य सभी मामलों में NAS ठीक काम करता है।

LocalHost एक अपाचे है PHP 5 के साथ WAMP

आपको प्राप्त होने वाले त्रुटि संदेश को देखें:

घातक त्रुटि: अनदेखा अपवाद 'अनपेक्षित वैल्यू एक्सपेशेशन' संदेश 'DirectoryIterator :: __ construct (z:, z :) के साथ: सिस्टम निर्दिष्ट पथ नहीं ढूँढ सकता। (कोड: 3) 'में बी: \ public_html \ test \ test.php लाइन 8 (!) अनपेक्षित वैल्यू एक्सपेशन: डायरेक्टरीइटरेटर :: __ कंसल्ट (z:, z :): सिस्टम को पथ नहीं मिल सकता है निर्दिष्ट। (कोड: 3) में बी: \ public_html \ test \ test.php पंक्ति 8 पर

तो आपको अपना सी बदलना होगा: से बी:


sql server - SSIS Package Execution from SQL Agent & DTExec: Parameters or Variables? -


I have an SSIS package, for which I am giving some input value to the runtime, this is the SQL agent, or the file system DTExec is likely to either execute it. I have found, if I run DTExec from a file (actually an .ispac compiled project), then I can only set the variable with the / SET option, not the package parameter if I get it from the agent, or from normal If you want to run from the server, its better and the parameters are easy to use. At the moment I have created blank parameters and variables as placeholders, and to use the parameters to use additional variables, variables with expressions in the form of switches. Although all this is unnecessary, so I have to know what is the method to use only the parameters, and when it runs with the file system, it has to be set with DTEXX? Or does anyone have any better ideas in general?

When using an SSIS package, using DTXAC is the best, easiest, and to set parameters The most portable approach is to use "XML Configuration File". Creating and using such files gives you a set value (such as SQL Server instance name and password) and helps in executing a package in Dev to use another set in production.

To create an XML configuration file, click the SSIS tab in your package, select the package configuration and you can choose what settings will contain in the XML file and their initial value.


java - Why to double check the singleton intantiation -


लिंक में मैं नीचे singleton intantiation पाया:

  सार्वजनिक स्थिर सिंगलटन getInstanceDC () {If (_instance == null) {// एकल चेक किया गया (1) सिंक्रनाइज़ (सिंगलटन.क्लैस) {if (_instance == null) {// डबल चेक किया गया _instance = new सिंगलटन (); }}} वापसी _instance; }  

मुझे एकल चेक यानी (1) बिंदु नहीं मिल रहा है। इसका उपयोग यहां किसी भी तरह से एक धागा सिंक्रनाइज़ किए गए ब्लॉक के अंतर्गत उदाहरण की जांच करेगा, तो पहले जांच का उपयोग करने का क्या मतलब है?

सादर

जयेंद्र

विचार करें कि एक multithreaded वातावरण में दो धागे आपके सिंगलटन तक पहुंच सकते हैं। यहां डबल चेक के बिना क्या हो सकता है।

पहले धागा प्रवेश getInstanceDC () ; _instance है शून्य ताकि यह अगर ब्लॉक में प्रवेश करे दूसरा धागा प्रवेश getInstanceDC () ; _instance है शून्य ताकि यह अगर ब्लॉक में प्रवेश करे पहले धागा एक नया उदाहरण बनाता है दूसरा धागा एक नया उदाहरण बनाता है।

सिंक्रनाइज़ ब्लॉक में डबल चेक इस समस्या का समाधान करता है।

तो पूरी प्रक्रिया को सिंक्रनाइज़ क्यों नहीं करें? उत्तर प्रदर्शन कारणों के लिए है।


javacc - RegEx: words with no subword -


I am looking for a regex to create a DFA that contains all the words except one.

All possible terms except words containing the alphabet = {X, y, z} word = xyz Example:

Valid: xyyzx yyxzyxz yyzzx

invalid: x xyz z yxz xyz xyz Yxz

thanks

You can take advantage of abandonment techniques by using a regex like this:

  [xyz] * xyz [xyz] * | ([Xyz] +)  

The idea behind this regex matches invalid data , But to capture important data.

Enter image details here

Match information is:

  Matches 1 1. [7 -12] `xyyzx` match 2 1. [13-20]` Yuxxx` match 3 1. [21-26] `Xxxx`  

As you can see, you have to capture the contents of the capturing group to get valid data.

In discard techniques, except for all patterns, the pipes (regex "or") are made to the left of the reagents separated, but using the capturing group in the correct pattern Therefore, for this regex:

  [xyz] * xyz [xyz] * | ([Xyz] +) Leaving the lease - ^ ^ --- Keeping this pattern  

Excel nested if too many arguments fix without lookup -


I know that this question has been asked before. I want to know that it is possible to fix it without using a lookup with the index function. I looked at the question and tried to add to me and there was no success.

This is my formula:

= IF (C49 = "", "", IF (R49 = "2 months / month", DATE (YEAR (C49) (C49) + 2, Day (C49), if (R49 = "3 Month / Month", Date (Year (C49), Month (C49) + 3, Day (C49) ), If (R 49 = 4 months / month ", DATE (YEAR (C49), MONTH (C49) + 4, day (C49)) if (R49 =" 5 months / month ", DATE ( YEAR (C49), MONTH (C49) +5, day (C49), if (R49 = "6 months / month", date (year (c49), month (c49) + 6, Day (C49), if (R49 = "7 months / month", DATE (C49), MNST (C49), MONTH (C49) +7, Day (C49)) , If (R = 49 = "8 months / Hena ", DATE (year (C49), MONHT (C49) +8, Day (C49) IF (R49 =" 9 months / month ", DATE (year (c49), month (c) 49) + 9, Day (C49), if (R49 = "10 month / month", date (year (c49), month (c49) + 10, day (c49)) , If (R49 = "11 months / month", date (year (C49), month (C49) + 11, day (C49)), if (R49 = "12 months / mois" DATE (YEAR (C49), MONTH (C49) +12, DAY (C49)), "0")))))))))))))))))

I How can I modify this formula that does not get too much logic error?

You can avoid many IF statements using:

  = DATE (YEAR (C49), MONTH (C49) + LEFT (R49,2), DAY (C49))  

This will automatically connect months with two first characters Edit:

Edit:

If you want to check that C49 and R49 are empty, you can use it:

< Previous> = IF (C49 = "", IFERROR (DATE (YEAR (C49), MONTH (C49) + LEFT (R49,2), DAY (C49), "0")

If C49 is December 31 and you add 2 months So what do you expect?

If you want it to be February 28th, then you should use the approach of @ Bardi Houdini to my formula (based on your Nested) on March 3 I will return


Gmail API PHP Client Library - How do you send large attachments using the PHP client library? -


I am using Google's PHP Client Library to send calls to Gmail's API. Using those resources, I can send messages with attachments using code like this:

  public_smessage (Google_Service_Gmail $ gmail, $ raw_message) {log: info ('Gmail API request 'users_messages- & gt; send' '); $ PostBody = new Google_Service_Gmail_Message (); $ PostBody- & gt; SetRaw (Str :: base64_encode_url ($ raw_message)); Return $ gmail-> User_message-> Send ('me', $ postBody, ['uploadType' = & gt; 'multicast']); }  

But I can not understand how I can send attachments attached to some MB for my life I have found that it is necessary to use Multipurpose upload type, but I will tell about it How can it be implemented based on its current version, as I get the following error in the code given above:

  POST https: //www.googleapis. Com / gmail / v1 / users / me / messages / send? UploadType = multipart Error 413 Error in calling: The request unit is too large  

Really good Broad Stroke info, but I'm looking forward to a bit more guidance specific to Google's PHP Client Library.

Edit: Accordingly, the maximum upload size is actually 35 MB. The size specified in my php.ini is sufficient for this, and the request fails as an internal server error from Google 413.

Not familiar with the GMail API, but you were selected to reduce the size of each individual request Must be able to use uploads. Take a look at the file upload sample in the client:

  $ media = new Google_Http_MediaFileUpload ($ client, $ request, 'text / plain', empty, true, $ squared sbabytes); $ Media & gt; SetFileSize (file size (testfile)); $ Position = false; $ Handle = FOPN (testfell, "rb"); While (! $ Position & amp;; feof ($ handle)) {$ chunk = fread ($ handles, $ Chalkyzbytes); $ Position = $ media-> Next Chain ($ Chuck); }  

exception - debugging errors in python multiprocessing -


I am using pool in the multiprocessing module, Order to run the same code on different data.

It turns out that on some data my code raises an exception, but the exact line that does this is not given:

  traceback (most recent Only call in the final): File "my_wrapper_script.py", Line 366, & lt; Module & gt; Main () file "my_wrapper_script.py", line 343, main result = pool.map (process_function, folders) file "/usr/lib64/python2.6/multiprocessing/pool.py", line 148, map returns in self. Map_async (func, iterable, chunksize) .get () file "/usr/lib64/python2.6/multiprocessing/pool.py", line 422, in self-raising._ value keyError: 'some_key'  

I know about multiprocessing.log_to_stderr () , but it seems that it is useful when issues of concurrency arise, which is not my case.

Any thoughts?

If you are using a new enough version of Python, you will actually see the real exception Print it before one example, for example, this is a sample that fails:

  Import Multi Processing Def Indoor (): Increase exception ("FAIL") def f (): Print ("HI") Internal () p = multiprocessing Pool () p.apply (f) p.close () p.join ()  

Exception in running it with Python 3.4 Is:

  multiprocessing. Pool.RemoteTraceback: "" "Trace Back (most recent call final): The file "/usr/local/lib/python3.4/multiprocessing/pool.py", line 119, worker result = (true, exception in func ("FAIL"): In the "above" * failure, the file "test.py" was the direct reason for the exception of the following exception: "test.py", line 4, "test.py" in line 4, File: Traceback (last updated call last): file "test.py ", Line 13, & lt; module & gt; P.apply (f) file" /usr/local/lib/python3.4/multiprocessing/pool.py ", line 253, in return self. Apply_async (func, args, kwds) .get () file "/ usr /local/lib/python3.4/multiprocessing/pool.py", line 599, self-raising ._value exception: unsuccessful  

If there is no alternative to using a new version, the easiest thing to do is to wrap your worker task apart from an attempt / block, which will print an exception before raising it again:

  import multiuser import traceback def (" Except: print ("Exception in worker:") traceback.print_exc () raise p = multiprocessing.Pool () p.apply (f) p. Output:  
  Hi exception in the worker: traceback (most recent call final): file "(" FAIL ") exception: FAIL traceback (as state)" test.py ", line 5, last call last): file" test.py ", line 18, & lt; module & gt; P.apply F) File "/usr/local/lib/python2.7/multiprocessing/pool.py", line 244, in return self. Apply_async (func, args, kwds) .get () file "/ usr / local / lib / Python2.7 / multiprocessing / pool.py ", line 558, self-lifting ._value exception: unsuccessful  

xcode - Parse.com Query for future date -


I want to query Parse.com and see the events in the future. Currently, I am getting every item while applying the date of Parse.com with the date of the app in the app and only the future events are being displayed. This means that it is moving slowly, I was wondering how I should compare the query dates.

Any suggestions? Thank you

Provides all inequality operators (mostly, low warp, mostly on average, low tone horoscope two) Hence the future looks like:

  [query is where: @ "midnight calls" maximum: [NSDT date]];  

Multiple Laravel Applications -


I have some questions about Larval 5.

I have established a server with Apache, I would like to create subfolders for every website in the Www folder which I would like to run with Laravel. So it would be like this:

www | _ DomainA.com | _ DomainB.com

I already know, that if I should save the laval folders from appearing to the public then only the public folder contents of the larval app should be in this subfolder of www, and all others Folders should be kept at the same level, as the security increases from the www folder.

But I know what to do: does every subfolder (website) need to setup his Larval? Or is it common for just 1 installation and points to various public subfolders in www?

I think that you should be levervelous for every app. This is the best way because your app is direct Are not related to the form.

If you have only one ... it is also not sure how this will work, changes made in an app will also affect the other, especially about scaling and other perfomance issues. Think.


excel vba - VBA MsgBox keeps coming back -


I'm new to VBA I'm having a problem with a message box and I can not seem to find the answer . So the explanation hears if the value of a particular cell is & lt; 0 then the user is trying to issue a payment on the maximum amount acceptable (which should be on a very rare occasion). I have created a pop up to ask yes / no to continue with the payment, if they do not press anything then it cancels the final entry and they can re-enter the payment.

But if they click Yes the pop-up gets out, which I want, but it keeps popping up at any time while trying on a spreadsheet and doing anything because the value Continued & lt; 0

  Personal sub worksheet (sub target in the form of range) if category ("C39") & lt; 0 If the MSBbox ("total cash flow / payment can not exceed the maximum contract amount" and VBCRF and "Do you want to continue?", VbYesNo + vbCritical, "WARNING") = vbNo then application Code code   

There are several ways to work according to this code, but on behalf of the business, my suggestion That's when they choose yes that you capture your selection and make this comment for their own record.

This will also allow you to use that last selection in your top level if the statement is set, for example, if you have set the range ("40") for "acceptable" when yes selected If so, you could say that

  is the range ("C39") & lt; 0 more range ("C40") & lt; & Gt; "Acceptable" then if the MSBbox ("total cash flow / payment can not exceed the maximum contract amount" & amp; vbCrLf & quot; do you want to continue? ', VbYesNo + vbCritical, "WARNING" ) = VbNo Then Application.Undo Else Range "C40"). Value = "acceptable" end if end if  

java - How to perform drag drop in selenium grid -


I successfully installed the Selenium grid but was not able to do drag drop operations in the Selenium grid. If I run the code in testng it is working as expected, it is failing for the grid. I am learning the Selenium grid unable to fix this issue,

Jar: Selenium -Sarver- standalone-2.45.0.jar

Code:

East> Public Sector DragdropElements {WebDriver Driver; String Noduckal; @BeforeTest throws public Zero DrawDrop () MalformedElexception {// driver = New FirefoxDriver (); System.setProperty ("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.Jdk14Logger"); NodeURL = "http: // localhost: 4444 / wd / hub"; Desired capabilities cap = new desired capabilities (); Cap.setBrowserName ("Firefox"); /// cap.setVersion ("31.0"); //cap.setPlatform (Platform.VISTA); Driver = new remote web device (new url (node), cap); Driver.get ("http://only-testing-blog.blogspot.in/2014/09/drag-and-drop.html"); } @Test Public Zero DragdropElements1 () throws interrupted expressions {WebElement DragFrom = driver.findElement (By.xpath ("// * [@ id = 'dragdiv']"))); WebElement DragTo = driver.findElement (By.xpath ("// * [@ id = 'dropdiv']")); Action Builder = New Action (Driver); Action Drag Andrad 3 = Builder. Drag Endrope (Dragfram, Dragato) .build (); DragAndDrop3.perform (); String Textcomputer = Driver.Fund Element (Byexpath ("// * [@ id = 'blog1'] / div [1] / div / div / div / div [1] / h3")). Getteext (); Println ("" + TextTocompare); Assert.assertEquals (textcomputer, "drag and drop"); Exception}:

java.lang.ClassCastException: org.openqa.selenium .remote.RemoteWebDriver can not be inserted on org.openqa.selenium.interactions.HasInputDevices on Org .openqa.selenium.interactions.Actions (Action.Java 41). On the Qa.DragdropElements.DragdropElements1 (DragdropElements.java 45) on the sun. Sun.reflect.NativeMethodAccessorImpl.invoke (unknown source) on Reflect.NativeMethodAccessorImpl.invoke0 (Basic method)

Try it and it can work

  Actions actionsBuilder = new action (driver); Builder.keyDown (key control). Click (elementName) .keyUp (Keys.CONTROL); Action Action = actionsBuilder.build (); Action.perform ();  

Not sure why drag and drop for you is not working If you are running multi thread in your nodes, then just try to walk with the tone thread. Along with this, it is worth mentioning your node OS information.


html - Div not showing correctly in FF or IE -


I am working on a website in which I have created divs to be clickable on a home page and An image background is

The homepage displays the Opacity Debit correctly behind the text in Chrome, but in Firefox and Internet Explorer you can not see the ambiguity divisor and the text is at the top of the div.

> & lt; Div id = "main" class = "site"

This is because your background container is using the vendor-specific prefix style -WebKit-Gradient will ignore FF and IE this question () will give you all the vendor prefixes needed to properly implement the gradient.


ios - How is the Satellite view implemented in the detail view controller, displayed upon touch of a MKPinAnnotation Callout -


If you tap on the Mk pin annotation callout, in the Apple Map app, the following view is displayed. I'm trying to try something similar again, but I'm not sure how to apply the satellite image (I think it's an MKMapview on the coordinates of annotations) and the segment of satellite view To animate when the bottom scene is dragged? Apart from this, the satellite view constantly revolves and behind is a standard animation?

In summary:

  • How has the map image applied at the top?
  • How it is enhanced / zoomed when user goes down (see table)
  • Image is animated so that it can be rotated, is this built in feature ?

screen shot

How is the map image at the top?

This is not an image. It's a MKMapView.

When the user runs down (table) view below, then incrementally / zoomed

update mapview.frame.size. Scroll vif with scroll ContentAffost. why.

How is the image animated so that it rotates, is it built in a feature?

Animate Mkmapview or MKMapView.camera

I have created a sample that you can download.


actionscript 3 - How do AGAL registers get added or subtracted when they 'contain' 3D vectors? -


I am developing a space game, which is working on adding shadows to the planetary ring. For this I need to calculate that a cylinder (the shadow of the planet) pierces each other with an aircraft (the trap of the rings).

I am not able to see how 'sub' and 'jog' opodode deal with each component of a register. There is a graphic on this page that shows what each epode does; It describes extra and subtraction (among other calculations) in the form of 'component-wise'

Does this mean, if I am adding or subtracting 3D vectors, then X, Y , Z (and W?) Components will be affected independently of each other? And, if yes, then the registers know that not to do this, if adding or subtracting, say, number 2? Do I need to deal differently with each component for 3D vectors or just using 'Junk' or 'Sub', 2 vectors can be correctly added or reduced?

  1. component-wise means connecting each vector component to each other / Deductible / etc. will be isolation. For example, adding two vectors together:

    (x1, y1, z1, w1) + (x2, y2, z2, w2) = (x1 + x2, y1 + y2, z1 + z2 , W1 + w2)

  2. If you need to add only a few components in arbitrary order, use vector swearing:

    v1.xzy + V2.wwx = (v1 x + v2.w, v1.z + v2.w, v1.y + v2.x)


To pull out records from an access database multiple time according to the time frame -


I have access databases that have some ticket related data, they have all 2 columns- initial date and closing date, primary key As with the ticket number! How many records will I open until the end of January, how many were open till the end of the fabric, etc. So, if ticket id TKT1, "date of opening" = 12th January and "closing date" = 5th March, if I remove the count of tickets, then this TK1 is counted for the end of January and the end-February tickets should go. Is there a question with which we can apply it?


javascript - Would linked php file using scrolling plugin make html page refresh -


Using this plugin for infinite scroll

The first row of the page is such a line Which is linked to a .php file, which every time users want to load more content

  echo ('& lt; a href = "loadmore.php" & gt; & lt; / a & gt;');  

The php code for selecting and receiving further content in the linked file. Will that PHP code refresh the page - should I use AJAX?


java - How to parse textfield to bigdecimal -


Is it possible to parse the buggy from textfield? I have seen some code where they parse BigDecamal from strings. But is it possible to use it on the textfield? I have prepared some code for this work but I do not know that I should do it like this.

  Float value = float.parseflat (textFieldInvoiceServicePrice.getText ()); String servicetext = textFieldInvoiceService.getText (); BigDicall PricexL = Value Value of Value (value);  

No, this is not how you should do it - you currently have one Parsing the string to float, then change that float to BigDecimal . You obviously know how to get a string from a text field, because you are already doing it in the first line - you can do this with BigDecimal instead:

  BigDCom Price = New BigDecimal (TextField invoice usage (Gettext));  

However, you should be careful that it will not be culture-sensitive - it will always use . as a decimal separator, for example. If you want culture-sensitive parsing, you should use the NumberFormat .


windows - icacls function not overwriting the previous directory permissions -


मैं निम्नलिखित कोड का उपयोग कर रहा हूं:

  icacls C: \ testcott \ / अनुदान: R "TestGroup": (एनपी) एफ  

हालांकि, सी: \ testcott \ निर्देशिका में मौजूदा अनुमतियां अभी भी वहां हैं। मुझे लगता है कि / अनुदान: r विकल्प का अर्थ है कि वह मौजूदा अनुमतियों को अधिलेखित करेगा?

सभी अनुमतियों को बदलने के लिए नई नियुक्त वाले एक निर्देशिका पर:

  icacls c: \ test / reset icacls c: \ test / inheritance: r / grant प्रशासक: (ओआई) (सीआई) (एफ)  

com.android.support:appcompat searches in wrong place -


I'm trying to connect espresso with the project

Here's the error I get < / P>

  _MyProject: unspecified & gt; Com.android.support.test.espresso: espresso-core: 2.0_ _ & gt; Searched in the following places:  

C: / user / usernames / AppData / org.hamcrest: hamcrest-library: 1.1._

local / Android / SDK / Extra / Android / M2 Spaspotry / ORG / Hamcaster / HammerCast-Library / 1.1 / Hamsters-Library-1.1.jpg _

and find another library that is compiled Espresso is essential for

The real espresso library is here, but Gradeley is here Can not see

c: \ user \ user name \ apeda \ local \ android \ sdk \ extras \ android \ m2repository \ com \ android \ support \ test \ espresso

The build.gradle file consists of:

  buildscript {repositories {jcenter () // This is the default repo meinstantal ()} dependency {classpath 'com.android.tools.build : Gradle: 1.0.0 '}} Apply the plugin:' com.android.application 'dependency {compile' com.android.support:appcompat- v7: 22.0.0 'compiled fileTree (includes:' * .jar ' , Dir: 'libs') File Tree provided (included) Are: '* .jar', dir: 'ext_libs') compile project (': third_party: facebook ') androidTestCompile' com.android.support.test.espresso: espresso-core: 2.0 'androidTestCompile' com.android.support. What am i doing wrong   

"text">

add:

  repository {mavenCentral (); }  

At the top level, your build.gradle (i.e., your android and dependencies off) .

For example, in it JUnit4 (although not espresso), I have:

  buildscript {repositories {mavenCentral ()} dependency {classpath 'com.android. Tools .build: gradle: 1.0.0 '}} Apply the plugin:' com.android.application 'repositories {mavenCentral () // required for testing-support- lib dependency} dependency {androidTestCompile' com.android.support .test: testing -support-lib: 0.1 '} Android {compileSdkVersion 19 buildToolsVersion "21.1.2" Default Config {testApplicationId "com.commonsware.android.gradle.hello.test" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner "} Packaging Options {exclude 'LICENSE.txt' // Any Uch Is not currently required to make ...}}  

sql server - Connecting MSSQL Database Using PHP PDO Objects -


I am trying to connect to the MSSQL database server using the PSDO object:

 < Code> $ dsn = 'mssql: host = *** *** *** ***; Dbname = *** ... '; $ User name = '***'; $ Password = '***'; Try {$ Backlength = New PDO ($ DSN, $ username, $ passwd); $ Baglanti- & gt; SetAttribute (PDO :: ATTR_ERRMODE, PDO :: ERRMODE_EXCEPTION); $ Bugatti-> Edge ("SET NAMES UTF8"); Ini_set ('max_execution_time', 2000000); } Hold (PDOException $ e) {echo $ e-> GetMessage (); }  

I get this error after this coding:

  SQLSTATE [HY000]: General error: 10007 'NAMES' is a recognized SET option is not. [10007] (Severity 5)  

How can I do this issue?

Thank you

mssql STT name UTF8 < / P>

:

  $ pdo = new PDO ('dblib: host = localhost; dbname = databasename; charset = UTF-8', 'user Name ',' password ');  

or

  $ pdo = new PDO ('mysql: host = hostname; dbname = defaultDbName', 'username', 'password', array (PDO :: MYSQL_ATTR_INIT_COMMAND = & gt; "SET NAMES utf8"));  

Django tastypie use external resource only for filtering and exclude from API response -


Using the following resource class, I am creating an API to list all the favorite merchants for a given user.

  Category Favorites MerchantResource (ModelResource): 'Get all the merchants associated with the given user' 'user = fields.ForeignKey (UserResource,' user ', null = true, full = True) merchant = fields.ForeignKey (MerchantResource, 'Merchant', null = True, full = True) Square Meta: queryset = FavoriteMerchant.objects.all () resource_name = 'fm' include_resource_uri = Invalid permission Ed_methods = ['get '] Filtering = {' User ': ALL_WITH_RELATIONS}  

Now I want to exclude user details from the API response, but user name Wants to use) field would result to filter.

FYI I tried to add the field after exiting, but still in response is the result of user details:

  excludes = ['user']  

You can override the dehydration function and remove the user from the bundle Def dehydrates (self, Bundle): Dell Bundle data ['user'] return bundle

div>

angularjs - angular directive data binding -


I am trying to write a simple angular command which displays an object property, but I do not understand That's how binding works.

  & lt; Div ng-repeat = "c in cars" & gt; & Lt; Div car carElement = {{c}} & gt; & Lt; / Div & gt; & Lt; Div & gt; . Directive ('car', function () {return} template: function (amm, attri) {var car = greater seat element; return car. Brand + '' + car model;}};});  

I can not force the hole object, just for the simple properties, for example, it works:

  & lt; Div ng-repeat = "c in cars" & gt; & Lt; Div car brand = {{c.brand}} & gt; & Lt; / Div & gt; & Lt; Div & gt; . Directive ('car', function () {return} {template: function (amm, atri) {var brand = atri.brand; return '' + brand;}};});  

How can I send the whole car to the instructional template?

You have to pass an object, but not inside the expression:

  & Lt; Div ng-repeat = "c in cars" & gt; & Lt; Div car carElement = "c" & gt; & Lt; / Div & gt; & Lt; Div & gt; Directive:  
 . Directive ('car', function () {returns: {car: "= cement"}, template: function (Elem, attr) {// now you have 'car' scope.car}};});  

python - How to test django model method __str__() -


I am trying to test the __str__ method, and when it tries to enter my test, it My model gives the example (I think this is)

  def test_str_is_equal_to_title (self): "" "method` __str__` field should be equal to` title` "=" = = work. Work.objects.get (pk = 1) self.assertEqual (work .__ str__, work.title)  

And I'm getting the test from:

 < Code> conditional error: '& lt; binding method work .__ & lt;: test How to compare these 2 values ​​to pass the test!?   

You call str () string model example:

  self.assertEqual (str (work), work.title)  

vb.net - Best practice for accessing global Silverlight application data -


Text after "

I found Silverlight 5 a website that has got a group of applications hosted in some application-specific data sets. One of these figures is the current user object.

When the app starts (each one), it talks to the web service to pull current user information. However, in this SL application need to be accessed by all types of places.

I thought it made sense to put the built-in application on the object, but I was not sure if it was a good practice.

I put a simple property that puts the user in an interface and has applied it to the main app class.

Then, the rest of the application code accessed by it through a stable class:

  Public Module ApplicationUtils Public Property CurrentUser () as ConnectEntities.WebUser Receive ICommonAppData = Retrieve App TryCast (Application.Current, ICommonAppData) if the application isnot nothing (after nothing) then the return app.CurrentUser end then return nothing set (as the value ConnectEntities.WebUser) ICommonAppData = TryCast (Application.Current, ICommonAppData) are slow applications (application isnot If there is nothing, then the app.CurrentUser = value ends then the new NotImplementedException ("the current application does not apply the required interface") End the end end of the end end of the end terminal module  

I am not very familiar with, so I am trying to figure out whether it is an acceptable practice to reach global data, or if there is any complexity which I am not feeling here (thread safety issues, etc.) .).

After the text "itemprop =" text ">

I think it was also unable to find anywhere mentioning any details of using the application Need high privileges for Current property Also, in all my tests, it seems that I am able to use this property without the prerogative (with both local tests as well as the app posted on other machines).

I have moved forward with my original design and everything works fine.

Whether this is a best practice or not, I do not know. However, it is a reasonable solution to access such data.


forms - php prevent csrf attacks in mutiple submit -



forms - php prevent csrf attacks in mutiple submit -

i work php class prevent csrf attack.

code:

$token = nocsrf::generate( 'csrf_token' ); <form name="csrf_form" action="#" method="post"> <input type="hidden" name="csrf_token" value="<?php echo $token; ?>"> ...other form inputs... <input type="submit" value="send form"> </form>

for check csrf:

try { // run csrf check, on post data, in exception mode, validity of 10 minutes, in one-time mode. nocsrf::check( 'csrf_token', $_post, true, 60*10, false ); // form parsing, db inserts, etc. } grab ( exception $e ) { // csrf attack detected }

this worked me when have 1 in page when have 2 form in page work 1 form , in other form submit show csrf attack detected.

php check form 1:

if($_post['submit'] == "from") && !empty($_post['username'])){ seek { // run csrf check, on post data, in exception mode, validity of 10 minutes, in one-time mode. nocsrf::check( 'csrf_token', $_post, true, 60*10, false ); // form parsing, db inserts, etc. } grab ( exception $e ) { // csrf attack detected } }

php check form 2:

if($_post['submit'] == "from2") && !empty($_post['username'])){ seek { // run csrf check, on post data, in exception mode, validity of 10 minutes, in one-time mode. nocsrf::check( 'csrf_token', $_post, true, 60*10, false ); // form parsing, db inserts, etc. } grab ( exception $e ) { // csrf attack detected } }

html form:

<form name="csrf_form" action="#" method="post"> <?php $token = nocsrf::generate( 'csrf_token' );?> <input type="hidden" name="csrf_token" value="<?php echo $token; ?>"> <input type="text" name="username"> <input type="submit" value="form"> </form> <form name="csrf_form" action="#" method="post"> <?php $token = nocsrf::generate( 'csrf_token' );?> <input type="hidden" name="csrf_token" value="<?php echo $token; ?>"> <input type="text" name="badname"> <input type="submit" value="form2"> </form>

how prepare or how work class multiple form?!

class source here

make sure calling nocsrf::generate() once. if it's called more once, info old token overwritten, making invalid.

alternatively, utilize different key 2 tokens (instead of using "csrf_token" both).

php forms

java - is rollback possible in hibernate if one transaction fails among multiple transaction to different tables? -



java - is rollback possible in hibernate if one transaction fails among multiple transaction to different tables? -

i have 1 method :

// methods private void transform(transformlist transformlist) { tablea ta = transformlist.gettablea(); tableb tb = transformlist.gettableb(); tablec tc = transformlist.gettablec(); daoobj.savea(ta); daoobj.saveb(tb); daoobj.savec(tc); }

now,

//savea mehtod public void savea(tablea ta) { session session = context.gethibernatesession(); seek { if(session != null) { transaction tx = session.begintransaction(); tx.begin(); session.merge(ta); tx.commit(); } }catch (exception e) { tx.rollback(); throw new someexception(e.getmessage()); } finally{ if (session != null) { session.clear(); } } }

similarly,

//saveb mehtod public void saveb(tableb tb) { session session = context.gethibernatesession(); seek { if(session != null) { transaction tx = session.begintransaction(); tx.begin(); session.merge(tb); tx.commit(); } }catch (exception e) { tx.rollback(); throw new someexception(e.getmessage()); } finally{ if (session != null) { session.clear(); } } }

and,

//savec mehtod public void savec(tablec tc) { session session = context.gethibernatesession(); seek { if(session != null) { transaction tx = session.begintransaction(); tx.begin(); session.merge(tc); tx.commit(); } }catch (exception e) { tx.rollback(); throw new someexception(e.getmessage()); } finally{ if (session != null) { session.clear(); } } }

now while calling 'transform' method, if savea , saveb method success , exception occurs in savec method, possible rollback tablea , tableb records (which committed already) along tablec records?

no. you'll have move transaction handling @ to the lowest degree 1 level higher: create transaction, , phone call savea(), saveb() , savec() within transaction. don't handle transactions within save methods.

of course, 1 possibility. there frameworks, spring, help manage transactions.

java hibernate

excel - Create a Weeknumber -



excel - Create a Weeknumber -

i have column weenumber containing weeknumber based on input info column a2

the problem when utilize weeknumber (in swedish) not retrieve weeknumber in column weeknumber.

today, i'm using excel 2010

try changing format of b col general

edit:

here screenshot in gnumeric (sorry it's not excell utilize @ work).

the problem same, , solution works fine.

excel excel-2010

iphone - Send the image on API using post method from imagepicker -



iphone - Send the image on API using post method from imagepicker -

i want create registration form, here have taken uitextfield info in string , send on api using post method don't know how send image on api data?

try next code snippet

afhttprequestoperationmanager *manager = [[afhttprequestoperationmanager alloc] initwithbaseurl: [nsurl urlwithstring:@"your url"]]; nsdictionary *parameters = [nsdictionary dictionarywithobjectsandkeys:@"yourvalue",@"valuename",@"yourvalue",@"valuename", nil]; nsdata *imagedata = uiimagepngrepresentation(img_picture); [manager post:@"your url" parameters:parameters constructingbodywithblock:^(id<afmultipartformdata> formdata) { [formdata appendpartwithfiledata:imagedata name:@"logo" filename:@"image.png" mimetype:@"image/png"]; } success:^(afhttprequestoperation *operation, id responseobject) { nslog(@"success %@", responseobject); } failure:^(afhttprequestoperation *operation, nserror *error) { nslog(@"failure %@, %@", error, operation.responsestring); }];

where parameters contains textfield's data.

and logo image parameter name used in api coding.

iphone

java - Writing multiple objects to csv 1 per line -



java - Writing multiple objects to csv 1 per line -

im trying write serialize object multiline csv file. instead of 1 per line writes in 1 line.

here code.

purchaseorder po = new purchaseorder(entry); arraylist<object> l = lists.newarraylist(); l.add(po); l.add(new purchaseorder(entry)); csvmapper mapper = new csvmapper(); csvschema schema = mapper.schemafor(purchaseorder.class); schema = schema.withcolumnseparator(','); objectwriter author = mapper.writer(schema); file tempfile = new file("test.csv"); fileoutputstream tempfileoutputstream = new fileoutputstream(tempfile); bufferedoutputstream bufferedoutputstream = new bufferedoutputstream(tempfileoutputstream, 1024); outputstreamwriter outputstreamwriter = new outputstreamwriter(bufferedoutputstream, "utf-8"); for(object o : l) { writer.writevalue(outputstreamwriter, o); }

the reason arraylist end result needs generic arraylist need able contain ant type of object.

this solution worked in end. passing in list way it

purchaseorder po = new purchaseorder(entry); arraylist<object> l = lists.newarraylist(); l.add(po); l.add(new purchaseorder(entry)); csvmapper mapper = new csvmapper(); csvschema schema = mapper.schemafor(purchaseorder.class); schema = schema.withcolumnseparator(','); objectwriter author = mapper.writer(schema); file tempfile = new file("test.csv"); fileoutputstream tempfileoutputstream = new fileoutputstream(tempfile); bufferedoutputstream bufferedoutputstream = new bufferedoutputstream(tempfileoutputstream, 1024); outputstreamwriter outputstreamwriter = new outputstreamwriter(bufferedoutputstream, "utf-8"); writer.writevalue(outputstreamwriter, l);

-------new problem------- above sollution works if same object. 2 different object each needing own line schema has alter proving more troublesome thought be.

here im trying @ moment without success.

arraylist<object> l = lists.newarraylist(); l.add(new purchaseordere(entry)); l.add(new purchaseorderl(entry)); csvmapper mapper = new csvmapper(); //csvschema schema = mapper.schemafor(purchaseordere.class); //schema = schema.withcolumnseparator(','); //schema = schema.withlineseparator(""); //objectwriter author = mapper.writer(schema); file tempfile = new file("test.csv"); //fileoutputstream tempfileoutputstream = new fileoutputstream(tempfile); //bufferedoutputstream bufferedoutputstream = new bufferedoutputstream(tempfileoutputstream, 1024); //outputstreamwriter outputstreamwriter = new outputstreamwriter(bufferedoutputstream, "utf-8"); //for(object o : l) { //csvschema schema = mapper.schemafor(o.getclass()); //schema = schema.withcolumnseparator(','); //schema = schema.withlineseparator(""); objectwriter author = mapper.writer(); fileoutputstream tempfileoutputstream = new fileoutputstream(tempfile); bufferedoutputstream bufferedoutputstream = new bufferedoutputstream(tempfileoutputstream, 1024); outputstreamwriter outputstreamwriter = new outputstreamwriter(bufferedoutputstream, "utf-8"); writer.writevalue(outputstreamwriter, l); //}

the pieces commited out have tried sofar without success. there has im missing cnt think great lib wnt provide way serialize different objects same file.

java csv serialization jackson

jquery - Handling third-party javascripts quickly, so pages don't appear slow -



jquery - Handling third-party javascripts quickly, so pages don't appear slow -

i've been doing testing http://www.webpagetest.org/ today see scripts slowing downwards page loads. long story short, i've discovered third-party scripts causing noticeable slowdown in loading. i'm loading them @ bottom of page, using async , defer ( see https://www.igvita.com/2014/05/20/script-injected-async-scripts-considered-harmful/ ).

i believe main reason slowdown not in grabbing files third-party, in running various scripts, side-by-side mine.

i'd maintain scripts, want them loaded behind scenes, after scripts have loaded, , no noticeable performance decrease in browser. illustration don't want browser "stutter" or jump around if start scrolling downwards while third-party scripts loading, or various other minor annoyances.

has tackled before , come solution? far i'm thinking best alternative might load third-party scripts using jquery.getscript(), after scripts have finished (literally @ bottom of 1 of .js includes). still, may load them concurrently create browser sluggish sec or two.

some more details on how did testing, interested:

grabbed source code of product page, threw test php page modify @ will surrounded each script on/off flag such if ( isset( $_request["allowgoogleanalytics"] ) ) { ran test scripts turned off in new tabs, ran more tests, turning scripts on 1 @ time by time own scripts turned on, pages taking 1.9 seconds load (first view) , less sec on repeat view. fine me. after turning on third-party scripts, pages taking @ to the lowest degree 3.1 seconds load (first load) much 3.9

the 3rd party scripts in question are:

facebook "like" button google +1 button pinterest google trusted stores

none of these particularly bad on own, @ 1 time combine , take long, , create browser sluggish.

you can queue scripts, if problem in simultaneous load. load should started on document ready (i see using jquery, utilize in example). illustration code (tested locally, works).

<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script> var scripts2load = [ "http://apis.google.com/js/plusone.js", "http://connect.facebook.net/en_us/all.js#xfbml=1" ]; function loadnext() { var url = scripts2load.pop(); if (url) { $.ajax({ url: url, cache: true, crossdomain: true, datatype: "script", success: loadnext }); } } $(loadnext) </script>

javascript jquery facebook pinterest google-plus-one

primefaces - Referencing dataTable footer -



primefaces - Referencing dataTable footer -

i trying utilize ajax updates triggered component within p:datatable update footer of table. no matter how write id references in p:ajax tag don't seem able them right.

this example:

class="lang-html prettyprint-override"><h:form id="formid"> <p:datatable id="tableid" var="row" value="#{testbean.datarows}" rowindexvar="rowix"> <p:column> <h:outputtext value="#{row}"/> <p:inputtext id="innerinputid" value="#{testbean.str}"> <p:ajax event="keyup" update="tableid:footerid"/> <p:ajax event="keyup" update=":formid:tableid:footerid"/> <p:ajax event="keyup" update="@form:tableid:footerid"/> </p:inputtext> <f:facet name="footer"> <h:outputtext id="footerid" value="#{testbean.str}"/> </f:facet> </p:column> </p:datatable> <p:inputtext id="outerinputid" value="#{testbean.str}"> <p:ajax event="keyup" update="tableid:footerid"/> </p:inputtext> </h:form>

in generated html can see outputtext in footer gets id formid:tableid:footerid.

the reference outerinputid works fine.

all of references innerinputid expect work, don't. in generated html can see translated form formid:tableid:0:footerid. create sense if footer located within naming container of current row, isn't can see id.

i smell bug here. right? how can work around it?

or expected behaviour, , in case why?

i want display sum of cells in column in footer.

relevant software: primefaces 5.1, mojarra 2.2.7, glassfish 4.1

primefaces facelets jsf-2.2

ruby on rails - devise gem confirmation email sent 302 error -



ruby on rails - devise gem confirmation email sent 302 error -

i using devise gem user registration. confirm email not sent. 302 error.

user.rb add together :confirmable

migration successful.

# config/environments/development.rb config.action_mailer.default_url_options = { :host => 'localhost:3000' } config.action_mailer.raise_delivery_errors = false config.action_mailer.delivery_method = :smtp config.action_mailer.perform_deliveries = true config.action_mailer.default :charset => "utf-8" config.action_mailer.smtp_settings = { :address => 'smtp.gmail.com', :port => 587, :domain => "domain.com", :authentication => :plain, :user_name => "gmail@gmail.com", :password => "password" }

ruby-on-rails ruby-on-rails-3 ruby-on-rails-4 devise devise-confirmable

email - Importing a winmail.dat file into my calendar using Thunderbird Lightning -



email - Importing a winmail.dat file into my calendar using Thunderbird Lightning -

i using thunderbird lightning extension organize calendars. mutual send around winmail.dat files import new event calendar, faced issue utilize winmail.dat file so.

has found way in comfortable way? don't want download winmail.dat file first, convert (online) tool , able import it. has direct , quick way otherwise prefer create event entry manually. thanks!

the lookout add-on handle decoding of winmail.dat files.

email calendar thunderbird lightning winmail.dat

java - Binary Search Tree In Order Predecessor not removing node -



java - Binary Search Tree In Order Predecessor not removing node -

i've been trying bst work, issue persists node succeeding removed node never removed.

[ <p, 1>, <c, 26>, <u, 3>, <b, 293>, <h, 1>, <r, 12>, <v, 42>, null, null, null, <k, 465>, <q, 465>, <s, 42>, null, null, null, null, null, null, null, null, null, <l, 465>, null, null, null, <t, 465>, ] [ <p, 1>, <c, 26>, **<t, 465>**, <b, 293>, <h, 1>, <r, 12>, <v, 42>, null, null, null, <k, 465>, <q, 465>, <s, 42>, null, null, null, null, null, null, null, null, null, <l, 465>, null, null, null, **<t, 465>**, ] bst : inorder successor , predecessor binarysearchtree predecessor algorithm http://codereview.stackexchange.com/questions/35219/in-order-predecessor-bst-review

and looking @ these other implementations , adapting proper properties of tree:

http://algs4.cs.princeton.edu/32bst/bst.java.html http://cslibrary.stanford.edu/110/binarytrees.html https://www.cs.cmu.edu/~adamchik/15-121/lectures/trees/code/bst.java

public class binarysearchtree<key extends comparable<key>, value extends comparable<value>>{ class node extends keyvaluepair<key, value> { private int position = -1; private node leftchild = null; private node rightchild = null; private keyvaluepair<key, value> pair = new keyvaluepair<key, value>(); // getters , setters public node findmax() { node newcur = this; while (newcur.getrightchild() != null) { newcur = newcur.getrightchild(); } homecoming newcur; } } private int pos = -1; // helps maintain track of node in tree private int bstsize = 0; private int largestpos = -1; protected node root = null; private node findkey(key keytomatch, node current) { if (current == null || current.getkey() == keytomatch) { homecoming current; } else if (keytomatch.compareto(current.getkey()) < 0) { homecoming findkey(keytomatch, current.getleftchild()); } else { homecoming findkey(keytomatch, current.getrightchild()); } } private node put(node node, node temp) { if (node == null) { node = temp; } else if (temp.getkey().compareto(node.getkey()) < 0) { node.setleftchild(put(node.getleftchild(), temp)); } else if (temp.getkey().compareto(node.getkey()) > 0) { node.setrightchild(put(node.getrightchild(), temp)); } homecoming node; } @override public value put(key key, value value) { if (key == null || value == null) { homecoming null; } node temp = new node(); temp.setkey(key); temp.setvalue(value); node oldnode = null; value oldval = null; if (root == null) { root = temp; } else { oldnode = findkey(key, root); if (oldnode != null) { // means there key match oldval = oldnode.getvalue(); oldnode.setvalue(value); } else { put(root, temp); } } homecoming oldval; } private node remove(node current, key key) { node temp = new node(); if(current == null) { homecoming null; } else if(key.compareto(current.getkey()) < 0) { remove(current.getleftchild(), key); } else if(key.compareto(current.getkey()) > 0) { remove(current.getrightchild(), key); } else { if (current.getrightchild() == null) homecoming current.getleftchild(); else if(current.getleftchild() == null) homecoming current.getrightchild(); current.setkey(current.getleftchild().findmax().getkey()); current.setvalue(current.getleftchild().findmax().getvalue()); current.setleftchild(remove(current.getleftchild(), current.getkey())); } homecoming current; } @override public value remove(key key) { if (key == null || root == null) { homecoming null; } node current = findkey(key, root); value val = null; if(current == null) { homecoming val; } else { val = current.getvalue(); remove(root, key); } homecoming val; } public keyvaluepair<key, value>[] breadthfirsttraversal() { @suppresswarnings("unchecked") keyvaluepair<key, value>[] bftarray = new keyvaluepair[largestpos]; keyvaluepair<key, value> nodeval = null; if (!isempty()) { (int = 1; < bftarray.length + 1; i++) { keypos.reset(); if (positionfound(i)) { nodeval = findposkey(root, i); bftarray[i - 1] = nodeval; } else { bftarray[i - 1] = null; } } } homecoming bftarray; } }

java binary-search-tree

windows store apps - How to authenticate the user in offline mode in Azure Active Directory? -



windows store apps - How to authenticate the user in offline mode in Azure Active Directory? -

am developing windows store 8.1 app using c# , xaml.

in app, user log in app using azure active directory single sign on log in(with net connection)

but how authenticate user in azure active directory when user not connected internet?

i want app work in offline mode too..

how can accomplish this?

when 'log in', there should artifact produced. in case of openidconnect there id_token, oauth produces accesstoken. if captured , stored securely, there evidence user did authenticate aad @ 1 time. artifacts of 'log in' have expiration times.

backing up, when user logs in, how identity used? managed protected resources or reach out them?

windows-store-apps azure-mobile-services azure-active-directory

xml - Could not resolve archetype org.apache.maven.archetypes:maven-archetype-webapp -



xml - Could not resolve archetype org.apache.maven.archetypes:maven-archetype-webapp -

i getting above error message when seek , create simple maven project. have exhausted previous suggestions, e.g. window > preferences > maven > archetypes > add together remote catalog... , adding catalog file: http://repo1.maven.org/maven2/archetype-catalog.xml

when click verify says empty.

i have tried deleting maven repository in .m2 directory no reward.

my finish error this:

could not resolve archetype org.apache.maven.archetypes:maven-archetype-webapp:release of configured repositories. not resolve artifact org.apache.maven.archetypes:maven-archetype-webapp:pom:release failed resolve version org.apache.maven.archetypes:maven-archetype-webapp:pom:release: not find metadata org.apache.maven.archetypes:maven-archetype-webapp/maven-metadata.xml in local (c:\users\user_id\.m2\repository) failed resolve version org.apache.maven.archetypes:maven-archetype-webapp:pom:release: not find metadata org.apache.maven.archetypes:maven-archetype-webapp/maven-metadata.xml in local (c:\users\user_id\.m2\repository)

the maven-metadata.xml file in right place (i think) i'm not exclusively sure if right file contents, should go in file?

i have tried deleting , changing settings.xml file in terms of both content , location, 1 time again repeated, infuriating message.

after research on same issue have found 1 of solutions found follow these steps:

open window > preferences open maven > archetypes

click 'add remote catalog' , add together following:

catalog file: http://repo1.maven.org/maven2/archetype-catalog.xml description: maven catalog

hope of utilize you.

xml eclipse maven repository setup-project

javascript - Bootstrap Popover Dismissable is not working -



javascript - Bootstrap Popover Dismissable is not working -

<a href="#" class="btn btn-warning" id="no_mls_entry" tabindex="2" data-toggle="popover" data-trigger="focus" data-placement="left auto" title="early bird gets worm" data-content="sometimes takes time mls&reg; rets pool update new listing. loading manually early, sharing on social media give improve exposure on google.">enter without mls #</a>

the above popover html syntax, set data-trigger="focus" according instructions create dismiss on click.

and on document ready, run this:

$('#no_mls_entry').popover('show');

the popover shows alright, on clicking it, not go away.

it appears issue way focus beingness managed.

you seek next forcefulness focus:

$('#no_mls_entry').popover('show').focus();

here illustration of code in bootply:

http://www.bootply.com/j1itfk9m1y

alternatively, if willing not show popover on page load, can load popover next code , triggered on pressing button:

$('#no_mls_entry').popover();

javascript html twitter-bootstrap popover

ios - CGRectOffset animation not working on ios8 but works on ios7 -



ios - CGRectOffset animation not working on ios8 but works on ios7 -

i have uiview moved via cgrectoffset in animatewithduration block when swipe detected. same view moves downwards same way when downwards swipe detected. when downwards swipe occurs , move downwards animation completes, phone call method animates uilabel shake left right. works on iphone 5 ios7, doesnt work on ios8. know why? i've heard cgrectoffset not working autolayout, doesn't explain why can work on ios7 , not ios8.

-(void) animateplaylabel { [uiview animatewithduration:1 delay:0 usingspringwithdamping:0.1 initialspringvelocity:0.2 options:uiviewanimationoptioncurveeaseinout animations:^{ self.playlabel.frame = cgrectoffset(self.playlabel.frame, -10, 0); self.playlabel.frame = cgrectoffset(self.playlabel.frame, +20, 0); self.playlabel.frame = cgrectoffset(self.playlabel.frame, -20, 0); self.playlabel.frame = cgrectoffset(self.playlabel.frame, +20, 0); self.playlabel.frame = cgrectoffset(self.playlabel.frame, -20, 0); self.playlabel.frame = cgrectoffset(self.playlabel.frame, +20, 0); self.playlabel.frame = cgrectoffset(self.playlabel.frame, -10, 0); } completion:^(bool finished) { }];

you should set final value of frame within uiview animation block. fact result want in ios 7 fluke - you're using api incorrectly.

it looks want label bounce around in place without moving. utilize uidynamics accomplish effect. (there's plenty of sample code out there.)

if want finer-grain command on effect, check out core animation's keyframe animations.

ios ios7 ios8 autolayout uiviewanimation

python - batch file to enter commands in the prompt -



python - batch file to enter commands in the prompt -

i wanted write bat file in next commands

python print "hello"

i wanted work open python command utility , execute

print "hello"

if above 2 commands written in bat file python command utility getting opened , waiting after terminate manually,the next command getting executed there way can redirect above print "hello" command python command utility

i know can write separate python file print "hello" , phone call straight by python filename.py requirement redirection have mentioned above

any help in regard appreciated in advance!!!

i believe need utilize python -c command, followed code wish execute. code need enclosed in quotes or double quotes (i believe depends on whether wish utilize multi-line commands).

python windows batch-file

linux - multple ethernet over USB devices -



linux - multple ethernet over USB devices -

we have embedded linux device uses ethernet communicate. allow access via usb port, back upwards our device has g_ether linux gadget driver creates virtual ethernet port both our device , clients host. dhcp server assigns client ip address saving them having configure them selves, while device has prepare ip address. believe much same how android tethering

this works fine until client wants utilize 2 or more devices @ once. both devices come distinct network interfaces on clients machine, both devices have same ip address meaning cannot target host specifically! smaller problem there slight possibility both devices might assign clients "distinct" interface same ip address , cause conflict there too, less concerned ip address random since dhcp server assigns address based on mac address , g_ether randomly generates this, retry should prepare issue (not ideal, do)

i know if else has faced similar problem, , if how solved ?

linux usb ethernet

[CSS]: Priority of two styles on a selector -



[CSS]: Priority of two styles on a selector -

i have two css styles table :

<style> tr:nth-child(even){color:blue; background-color:gray;} .selectedrow {background-color:#f8ffbc;} </style>

on tr click add together selectedrow class clicked tr. on odd tr work , alter back-ground, in ones doesn't work

$("tbody td[name='select']").click(function () { $("tbody tr").removeclass("selectedrow"); $(this).closest("tr").addclass("selectedrow"); });

http://jsfiddle.net/qburkd3e/

is there specific priority or other things should know this?

it's because of css selector priority. classes , pseudo classes worth 10, elements 1. see http://css-tricks.com/specifics-on-css-specificity/

in first selector, utilize element , pseudoclass. that's weight of 11. sec selector class, has weight of 10. hence, first selector outweighs second.

you can increment second's weight adding element it, give identical weight. then, 1 later in stylesheet takes precendence.

tr:nth-child(even){color:blue; background-color:gray;} tr.selectedrow {background-color:#f8ffbc;}

css

.net - web API2 Http get request status pending -



.net - web API2 Http get request status pending -

i created web api 2 rest service (i utilize attribute routing) , it's working fine in local machine. when hosted it, http request pending. (i have installed .net framework 4.5.1 in host server) thought why? thanks

.net c#-4.0 asp.net-web-api restful-url

android - Drawer Indicator does not show -



android - Drawer Indicator does not show -

i can't have drawer indicator display. have either nil or "<" @ top left corner of screen depending of actionbar settings. want drawer indicator of nagivation drawer instead.

i utilize :

v4.widget.drawerlayout v7.app.actionbardrawertoggle but android.app.actionbar (not back upwards 7 one).

here snippet of code :

@override protected void oncreate(bundle savedinstancestate) { actionbar.setdisplayhomeasupenabled(true); actionbar.sethomebuttonenabled(true); actionbar.setdisplayshowhomeenabled(true); //i tried combinations unsuccessfully .... drawer = (drawerlayout) findviewbyid(r.id.drawer_layout); drawerlv = (listview) findviewbyid(r.id.left_drawer); drawer_linearlayout = (linearlayout) findviewbyid(r.id.drawer_linearlayout); drawerlv.setadapter(new arrayadapter<string>( this, r.layout.layout_main_drawer_list_item, mdraweritems)); drawerlv.setonitemclicklistener(new listview.onitemclicklistener() { @override public void onitemclick(adapterview<?> parent, view view, int position, long id) { selectitem(position); } }); drawertoggle = new actionbardrawertoggle(this, drawer, r.string.drawer_open,r.string.drawer_close) { @override public void ondrawerclosed(view view) { actionbar.settitle(mtitle); } @override public void ondraweropened(view drawerview) { actionbar.settitle(mdrawertitle); } }; drawertoggle.setdrawerindicatorenabled(true); drawer.setdrawerlistener(drawertoggle); }

i fixed problem. forgot add together next callback in acticity :

protected void onpostcreate(bundle savedinstancestate) { super.onpostcreate(savedinstancestate); // sync toggle state after onrestoreinstancestate has occurred. drawertoggle.syncstate(); }

by way, lollipop upgrade of v7.app.actionbardrawertoggle adds nice effect when navigation drawer opening or closing. recommend it.

android drawerlayout indicator

PHP - Combine arrays with same key value -



PHP - Combine arrays with same key value -

i have json array of multiple objects, here's example:

$people = [{"name":"john", "color":"green"}, {"name":"mary", "color":"green"}, {"name":"bob", "color":"red"}]

i utilize json_decode($people, true) convert them array...

now let's want combine have same color. i'd have array_merge_recursive($people[0], $people[1]) because both have green color. note have specify ones want merge recursively.

how can loop through $people after it's been decoded array format , automatically merge recursively have same key value?

something this:

foreach($people $person) { // if person has same color of previous // person merge them recursively. }

so after looping:

[{"name":"john, mary", "color":"green, green"}, {"name":"bob", "color":"red"}]

make result array associative array keyed color.

$people_by_color = array(); foreach ($people $person) { if (isset($people_by_color[$person['color']])) { $people_by_color[$person['color']]['name'] .= ', ' . $person['name']; $people_by_color[$person['color']]['color'] .= ', ' . $person['color']; } else { $people_by_color[$person['color']] = $person; } } $people_by_color = array_values($people_by_color); // turn indexed array

php arrays json object merge

Hex To binary - Using CharAt() with digits and appending numbers in a loop -



Hex To binary - Using CharAt() with digits and appending numbers in a loop -

i tasked manually turning hex codes binary pretty much have working except errors whenever tries turn integer binary illustration turning hex number 1, makes stop if have abcdefabc, everythings runs if have abcdef123, stops @ f , gives me 88 reason

any insight appreciated

this code:

string hex2="abcdef123"; system.out.println("newlooptest"); stringbuilder hexstring = new stringbuilder(); (int x = 0; x <= 8; x++) { if (hex2.charat(x) == 'a') { hexstring.append(1010); } else if (hex2.charat(x) == 'b') { hexstring.append(1011); } else if (hex2.charat(x) == 'c') { hexstring.append(1100); } else if (hex2.charat(x) == 'd') { hexstring.append(1101); } else if (hex2.charat(x) == 'e') { hexstring.append(1110); } else if (hex2.charat(x) == 'f') { hexstring.append(1111); } //works here else if (hex2.charat(x) == '0') { hexstring.append(0000); } else if (hex2.charat(x) == '1') { hexstring.append(0001); } else if (hex2.charat(x) == '2') { hexstring.append(0010); } else if (hex2.charat(x) == '3') { hexstring.append(0011); } else if (hex2.charat(x) == '4') { hexstring.append(0100); } else if (hex2.charat(x) == '5') { hexstring.append(0101); } else if (hex2.charat(x) == '6') { hexstring.append(0110); } else if (hex2.charat(x) == '7') { hexstring.append(0111); } else if (hex2.charat(x) == '8') { hexstring.append(1000); } else if (hex2.charat(x) == '9') { hexstring.append(1001); } else { system.out.println("error @ char" + x ); } } system.out.println("hex decimal " + hexstring.tostring());

3994433

it because appending numeric values instead of strings stringbuilder. quote binary value.

string hex2="abcdef123"; system.out.println("newlooptest"); stringbuilder hexstring = new stringbuilder(); (int x = 0; x <= 8; x++) { if (hex2.charat(x) == 'a') { hexstring.append("1010"); } else if (hex2.charat(x) == 'b') { hexstring.append("1011"); } else if (hex2.charat(x) == 'c') { hexstring.append("1100"); } else if (hex2.charat(x) == 'd') { hexstring.append("1101"); } else if (hex2.charat(x) == 'e') { hexstring.append("1110"); } else if (hex2.charat(x) == 'f') { hexstring.append("1111"); } else if (hex2.charat(x) == '0') { hexstring.append("0000"); } else if (hex2.charat(x) == '1') { hexstring.append("0001"); } else if (hex2.charat(x) == '2') { hexstring.append("0010"); } else if (hex2.charat(x) == '3') { hexstring.append("0011"); } else if (hex2.charat(x) == '4') { hexstring.append("0100"); } else if (hex2.charat(x) == '5') { hexstring.append("0101"); } else if (hex2.charat(x) == '6') { hexstring.append("0110"); } else if (hex2.charat(x) == '7') { hexstring.append("0111"); } else if (hex2.charat(x) == '8') { hexstring.append("1000"); } else if (hex2.charat(x) == '9') { hexstring.append("1001"); } else { system.out.println("error @ char" + x ); } } system.out.println("hex decimal " + hexstring.tostring());

loops binary append charat

ios - select/deselect random multiple dates -



ios - select/deselect random multiple dates -

on click want select/deselect random multiple dates. user should able select multiple dates (ex: should able select 2 dec 2014, 8 dec 2014 , 18 dec 2014. these 3 dates should selected.). current m using dlscalendar. dlscalendar supports single date selection , range selection. others lib supports above mention functionality welcome

thanks.

please more precise in want accomplish.

if trying create random dates in objective-c can following:

// objective-c random date picker //set day integers int lowerday = 1; int upperday = 31; //set month integers int lowermonth = 1; int uppermonth = 12; //set year integers int loweryear = 1; int upperyear = 2025; //or random year, higher loweryear! //generate random date int monthvalue = lowermonth + arc4random() % (uppermonth - lowermonth); //month int yearvalue = loweryear + arc4random() % (upperyear - loweryear ); //year //days differ each month should business relationship nsarray *highmonth =@[@"1",@"3",@"5",@"7",@"8",@"10",@"12"]; //months 31 days nsarray *lowmonth =@[@"4",@"6",@"9",@"11"]; //months 30 days nsstring *secondmonth =@"2"; nsstring *random_month =[nsstring stringwithformat:@"%d",monthvalue]; int dayvalue; if ([highmonth containsobject:random_month]) { //do nil upperday correctly set }else if([lowmonth containsobject:random_month]){ upperday=30; }else if([random_month isequaltostring:secondmonth]){ //to options 28 or 29 days if (fmod(monthvalue, 1.0) == 0.0) { //29 days upperday=29; }else{ //28 days upperday=28; } } dayvalue = lowerday + arc4random() % (upperday - lowerday ); //day //create nsdate , give our random numbers nsstring *datestring = [nsstring stringwithformat:@"%d-%d-%d",dayvalue,monthvalue,yearvalue]; nsdateformatter *dateformatter = [[nsdateformatter alloc] init]; [dateformatter setdateformat:@"dd-mm-yyyy"]; nsdate *datefromstring=[dateformatter datefromstring:datestring]; //check random date if (datefromstring==nil) { nslog(@"could not create random date"); }else{ nslog(@"succes! date was: %@",datefromstring); }

ios objective-c iphone ipad