Monday, 15 August 2011

symfony - Symfony2 - I can't get gmail mail transport get to work ... authentication fails -


I have a mailer configuration but when I am sending an email with a custom symphonic console command, I am getting this error: [2015-03-16 20:38:09] APIR: An exception occurred when flipping the email queue: Username "?????????" Failed to authenticate on SMTP server with. Using 1 possible authenticator

I tried two Gmail accounts for authenticity but no luck ... any idea what's wrong here?

Hull: The problem was ... I only enabled it ...

"post-text" itemprop = "text">

@ David Marco Credit:

P> You have to either upgrade to a more secure app that uses the most up-to-date security measures All Google products, such as Gmail, Use the latest security measures. ()

Or allow less secure apps and select "Allow" to allow at least secure apps to access their Google account. We do not recommend this option because it can make it easier for anyone to gain access to your account.

Source:


javascript - Cannot read property 'replace' of undefined - replacing text in JS generated HTML -


मेरी एक अनोर्ड सूची ( ul ) है जो बाहरी जावास्क्रिप्ट द्वारा उत्पन्न होती है। प्रत्येक सूची वस्तु में एक दोहराई गई पंक्ति है जो मैं हटाना चाहूंगा क्योंकि मैं बाहरी जावास्क्रिप्ट को संशोधित नहीं कर सकता, मैं प्रतिस्थापन पद्धति का उपयोग करने का प्रयास कर रहा हूं। सूची को प्रत्येक li तत्व को दिए गए वर्ग द्वारा पहचाना जाता है; आरएसएस-आइटम

निम्नलिखित मेरा कोड है:

  & lt; स्क्रिप्ट & gt; फ़ंक्शन myFunction () {var str = document.getElementsByClassName ('आरएसएस-आइटम')। InnerHTML; Var res = str.replace ('को बदलने के लिए पाठ', ''); Document.getElementsByClassName ('आरएसएस-आइटम')। InnerHTML = res; } & Lt; / script & gt; & Lt; बटन onclick = "myfunction ()" & gt; बदलें & lt; / बटन & gt;  

निम्न पंक्ति पर त्रुटि उत्पन्न हो रही है:

  var res = str.replace ('प्रतिस्थापित करने के लिए टेक्स्ट', '');  

त्रुटि बताती है:

  अनक्यूट टाइप एरर: अपरिवर्तित  

की संपत्ति को 'प्रतिस्थापित' नहीं पढ़ा सकता है I समझो, यह शायद इसका अर्थ है कि जावास्क्रिप्ट क्लास के नाम 'आरएसएस-मद' के साथ तत्व को नहीं खोज रहा है, या मैं पाठ बदलने की कोशिश कर रहा हूं। मैं पूरी तरह से निश्चित हूं कि यह सही वर्ग का नाम है, और यह पाठ वास्तव में वहां बदलने की कोशिश कर रहा है। क्या यह समस्या आ रही है क्योंकि जावास्क्रिप्ट द्वारा मार्कअप उत्पन्न किया जा रहा है? मैं एक मृत अंत में आया हूँ

document.getElementsByClassName ('आरएसएस-आइटम') एक सरणी- वस्तु (ए) की तरह यदि आप पहले तत्व चाहते हैं, तो आपको इसके लिए पूछना चाहिए:

  var str = document.getElementsByClassName ('rss-item') [0]। WinnerHTML;  

यदि आप थोड़ा और अधिक रक्षात्मक होना चाहते हैं, तो वास्तव में यह जाँच कर लायक हो सकता है कि किसी भी तत्व को इस तरह से उपयोग किया गया है:

  var तत्व = दस्तावेज़.getElementsByClassName ('आरएसएस-आइटम'); यदि (elements.length & gt; 0) {तत्वों [0]। WinnerHTML = तत्व [0]। WinnerHTML.replace ('को बदलने के लिए पाठ', ''); }  

जैसा कि आप टिप्पणियों में सुझाव दिया है, आप पाए गए सभी तत्वों पर प्रतिस्थापन कर सकते हैं। इस मामले में, आप इस तरह के तत्वों के माध्यम से लूप कर सकते हैं:

  var तत्व = document.getElementsByClassName ('rss-item'); के लिए (var i = 0; i & lt; elements.length; ++ i) {तत्व [i] .innerHTML = तत्व [i]। WinnerHTML.replace ('को बदलने के लिए पाठ', ''); }  

testing - How do I create an Arbitrary for a System.Type? -


I am trying to start my model organizations using FsCheck. Models live in C # and typically begin through the unit framework through their own personal setters. For example (contrived):

  public class model {public string one {get; Private set; } Public int two {get; Private set; }}  

I want to create an FsCheck Generator which automatically uses the generator registered for each property's model. Something like this:

  model model maker = gene (event) = new model () type & lt; Model & gt; .GetProperties () | & Gt; Array.filter (funny p - & gt; p.CanWrite). & Gt; Array.iter (funny p -> NewVal = Arb.generateType p.PropertyType // I believe I can drink it. Set value (event, newwall)) event of return}  

Two things are wrong with it:

  1. Come on! can not be used outside the gene computing expression.
  2. Arb.generateType is not present, and I can not find any way to equal it

Is it possible to make this generator automatic Will you set a private field on your model?

With the power of reflection, everything is possible (or throws at runtime).

  module array = open system. Reflection // This is just a helpful type on which there is reflection. Type Internal GenerateInvoker = Fixed Member Invitation & lt; 'Typ & gt; () = Generate billion & lt; 'Typ & gt; | & Gt; Gen.map box // invokes a common method using a runtime type as the normal sequence. Type typed type (type: type) = typhus & lt; GenerateInvoker & gt; .GetMethod ("Invoke", Binding Flex. Static ||| Binding Falges Nonpolic). Mascogenic Meth ([| type |]). Invoke (empty, [||]):? & Gt; General's & lt; Obj & gt; Model Generator = Gin (Give Event = Enter New Model) (Prop = Type ; GetProperties () | & gt; Array.filter (Fun p - & gt; p.CanWrite) // GEN Builder Implementation, so you can do something to support in Sahara! NewVal = Arb.generateType prop.PropertyType prop.SetValue (event, newVal) event of return} Gen.Sample 1 3 modelGenerator  < / Pre> 

video - FFMPEG Concat Dropping Frames -


I am using FFMPEG to do the following two things:

  • An MP 4 Create a set of images
  • Compile MP3 to make long video (MP3)

To create mp4s from images, I use the following command I do:

  ffmpeg -r 5 -i 'img% 03d.jpg' output.mp4  

As far as I know, this 5fps Creates a video with the framerate of

But when I try to compile MP4s, it seems that the frames are being dropped within each MP4.

To create compiled footage, I create a text file that points to all MP3s that should be included in the compilation, such as

  file 'set1 / Output.mp4 'file' set2 / output.mp4 'file' set3 / output.mp4 'file' set4 / output.mp4 'file' set5 / output.mp4 'file' set6 / output.mp4 'file' set7 / output. Mp4 '/ code>  

Then I run the following command:

  ffmpeg -f concat -i input.txt -codec copy compilation.mp4  

The resultant video leaves 2-3 frames with each output video

How do I ensure that the compiled video does not leave any frame?

(For reference, I have used the following tutorial :)

I was able to find work-charts using the following tutorial:

Instead of compiling MP3, I can point out all the image properties that are last The video file should be compiled in

I created a text file that looks like this:

  file 'set1 / img% 03d.jpg' file 'set2 / img% 03d.jpg' file ' Set3 / img% 03d.jpg 'file' set4 / img% 03d.jpg 'file' set5 /img%03d.jpg 'file' set6 / img% 03d.jpg 'file' set7 / img% 03d.jpg ' 

where naming conventions in each set folder are images with img001 jpg, img002.jpg, etc.

Then I can compile all the images in the final video using the following images:

  ffmpeg -f concat -r 5 -i Input.txt compilation.mp4  

java - How to catch null pointer exception by the right way -


I have implemented that method, which should be redirected to the personal page if the data and users with data in the database ID is successfully received, but if it is empty it must be redirected to the login page. How can handle empty exceptions in this method? The logged in for the logged in filter requires attention and thanks for your help!

  get public strings (user) (UserDao ud = new UserDao); SessionBean.setCurrentUser (ud.getSessionUserFromDb (Input Login, InputPassword)); Try {currentUserId = sessionBean.getCurrentUser () GetUserId (); } Hold (NullPointerException e) {System.out.print ("NullPointerException caught"); } If (currentUserId! = 0) {loggedIn = true; If (login = true) {System.out.println ("successfully logged in");} Return session bn.directPoseral (); } Else {FacesMessage msg = New FacesMessage ("Login Error!", "Error MSG"); Msg.setSeverity (FacesMessage.SEVERITY_ERROR); FacesContext.getCurrentInstance (). AddMessage (null, msg); Return session Bean.redirectToLogin (); }}  

should do this:

  If (sessionBean.getCurrentUser ()! = Null) {currentUserId = sessionBean.getCurrentUser (). GetUserId ()} and {System.out.println ("The current user is empty!"); }  

Improving bulk insert performance in Entity framework -


I want to insert 20000 records from an entity structure into an entity and it takes about 2 minutes. Is there any way other than using SP to improve its performance? This is my code:

  foreach (employee items in order) {t = new employee (); T. Text = item Text; DataContext.Employees.AddObject (t); } Datacontext Save Changes (); There is an opportunity for many improvements (if you are using  DbContext  then  

code>):

set Do:

  yourContext.configuration.AutoDetectChangesEnabled = false; YourContext.configuration.ValidateOnSaveEnabled = false; In the package of 100 codes, do  SaveChanges ()  do ... or you can try with 1000 items and see changes in performance. 

Because during all this insertion, the context is the same and it is getting bigger, you can rebuild your reference object in every 1,000 inserts. var yourContext = new YourContext (); I think this is a big advantage.

By making this improvement in my imported data process, it took it from 7 minutes to 6 seconds

Actual number ... your case can not be 100 or 1000. ..Try it and tweak it.


sass - SCSS change variable out of scope from inside @if -


इस सवाल का पहले से ही एक उत्तर है: < / P>

  • 1 उत्तर

क्या इसके लिए कोई वैकल्पिक हल है स्थिति, जब आप अपने फ़ंक्शन के दायरे के बाहर एक चर को संशोधित करना चाहते हैं? :

  $ ui- थीम: 'गुलाबी'; @if $ ui- थीम == "गुलाबी" {$ ui-main: # eb82b0; $ Ui-secondary: # fff5f9; $ Ui-third: # f6c2d9; } @else {$ ui-main: # ff8067; $ Ui-secondary: # fff6e5; $ Ui-third: # ffb1a2; } एक {रंग: $ ui-main; पृष्ठभूमि: $ ui-secondary};  

मैं ui-theme नामक वैश्विक वैरिएबल बनाना चाहता हूं जो $ ui-main, $ ui-secondary ... परिभाषा के नीचे लिखे गए सभी अन्य कोड में ऐसा लगता है कि @if जैसे निर्देशों का उपयोग करते समय परिवर्तनीय गुंजाइश भी लागू होती है।

क्या कोई जानता है कि यह कैसे प्राप्त किया जा सकता है?

आपको नियंत्रण ब्लॉक के बाहर अपने चर को प्रारंभ करना है:

  $ ui- थीम: 'गुलाबी'; $ Ui- मुख्य: नल; $ Ui- माध्यमिक: नल; $ Ui-third: नल; @if $ ui- थीम == "गुलाबी" {$ ui-main: # eb82b0; $ Ui-secondary: # fff5f9; $ Ui-third: # f6c2d9; } @else {$ ui-main: # ff8067; $ Ui-secondary: # fff6e5; $ Ui-third: # ffb1a2; } एक {रंग: $ ui-main; पृष्ठभूमि: $ ui-secondary};  

आउटपुट:

  a {color: # eb82b0; पृष्ठभूमि: # fff5f9; }  

कूट कोडिंग वैरिएबल के बजाय @ शामिल करें के माध्यम से ही करना संभव है।

_pink.scss: < / P>

  $ ui-main: # eb82b0; $ Ui-secondary: # fff5f9; $ Ui-third: # f6c2d9;  

शैलियां.scss:

<पूर्व> @ "गुलाबी" शामिल करें; // या यदि आप डिफ़ॉल्ट रंग $ ui-main: # ff8067 डिफ़ॉल्ट चाहते हैं, तो कुछ भी शामिल न करें; $ Ui-secondary: # fff6e5! डिफ़ॉल्ट; $ Ui-third: # ffb1a2! डिफ़ॉल्ट; एक {रंग: $ ui-main; पृष्ठभूमि: $ ui-secondary};