Sunday, 15 April 2012

php - DeleteUser method in FOSuserBundle symfony 2 Userinterface error -


I have a problem deleting user with $ UserManager-> deleteUser ($ user). I am getting an error: Error: Class AppBundle \ Controller \ UsermanagerController has 35 abstract methods and therefore they must apply abstract methods to summarize or declare them.

My Controller:

  Namespace AppBundle \ Controller; Use Symfony \ Component \ HttpFoundation \ Request; Use Symfony \ Bundle \ FrameworkBundle \ Controller \ Controller; Use AppBundle \ Entity \ UserManager; Use FOS \ UserBundle \ Model \ UserInterface; Use Symfony \ Component \ HttpKernel \ Exception \ NotFoundHttpException; Class UsermanagerController Expands Controller User Interface {Public Function deleteAction ($ user) {$ UserManager = $ this- & gt; Container-> Obtain ('fos_user.user_manager'); If ($ user == faucet) {New Nottold HTTP Exception ('User not found for user'. $ User); } $ UserManager- & gt; Delete user ($ user); $ $ - this- & gt; Redirect ($ this - & amp; generUrl ('admin_index')); }  

My entity:

  Namespace AppBundle / Entity; Use the theory / ORM \ mapping as an ORM; Use FOS \ UserBundle \ Doctrine \ UserManager as BaseCustomer; Use FOS \ UserBundle \ Model \ UserInterface; / ** * @ ORM | Entryy * * / class UserManager BaseCustomer implements UserInterface {}  

My config.yml: orm:

  resolve_target_entities: FOS \ UserBundle \ Model \ UserInterface : AppBundle \ Entity \ UserManager  

and routing. Assam:

  fos_deleteuser_group: path: / app / usermanager / delete / {user} default: {_controller: AppBundle: Usermanager: delete}  

/ UserBundle / doctrine / UserManager, tried using any luck.

Thanks in advance for your help

In short:

Your first error was that implements the user interface in the admin you have removed it.

Then you have another problem inside your controller because you pass the string to the UserManager :: deleteUser method which is something UserInterface

I will provide some code for you, which should fix it.

  & lt ;? Php / ** * @ Ultimate $ username string * @ Return Response * / Public Function Deletion Action ($ user name) {$ userManager = $ this- & gt; Obtain ('fos_user.user_manager'); / * @ $$ User Manager User Manager * / $ user = $ userManager- & gt; FindUserByUsername ($ username); If (\ is_null ($ user)) {// user not found, $ notFoundResponse returns $ notFoundResponse; } \ Assert (! \ Is_null ($ user)); $ UserManager- & gt; DeleteUser ($ user); // OK, generate $ OK Response Returns $ OKHrsons; }  

c - Client not able to send message to server -


I am new to programming socket programming. I am trying to create a server that has the ability to connect to multiple clients. However,

  1. My message server is not printed at the end. This means that the code "Do you want to send?" Prompt does not stop at

  2. The second message switch on the wired client (like) does not respond to my server. Same looks like

Edit 1 I have edited the code that sends a message to the customer. However, the server side prevents "error on ACCEPT: bad file descriptor", which I am unable to resolve.

Edit 2 My client is also sending another message, but my server does not receive it and does not print it, even if the error on acceptance has ended Ho.

  ----- Listen (sockfd, 5); Clilen = sizeof (cli_add); Int pid; While (1) {nzockfood = acceptable (sockfid, (structure sokadar *) and cli_ed, and cleanen); If (newsfold <0) {error ("error in accepting"); Exit (1); } Pid = fork (); If (pid & lt; 0) {error ("Error creating new process"); Exit (1); } If (pid == 0) {close (sockfd); // Read buffer from socket bargeo (buffer, 256); N = reading (Newsoffor, buffer, 255); If (n & lt; 0) {error ("error in reading"); Exit (1); } Printf ("Message:% s", Buffer); ----- Barge (buffer, 256); N = write (newsockfd, tmparray, strlen (tmparray)); If (n & lt; 0) error ("oops! Can not write"); Exit (0); } And {closed (newsfoked); }}  

and client.c is

  Int likes; While (1) {printf ("What to do? \ N1. Send \ n2.Exit \ n"); Scanf ("% d", & amp; option); Switch (Preferred) {Case 1: {Berzero (buffer, 256); Printf ("What do you want to send?"); Fgets (buffer, 255, stdin); Getchar (); N = write (sockfd, buffer, 255); If (n & lt; 0) error ("oops! Can not write"); Bzero (buffer, 256); N = reading (scoff, buffer, 255); If (n & lt; 0) error ("Oops! Can not read"); Printf ("Received Message:% s \ n", Buffer); break; } Case 2: {Return 0; }}}  


sed - Increment all defines/enums in a source file -


मेरे पास बहुत से (100+) परिभाषित करता है / एन्यूमरेशन / वेरिएबल्स जैसे:

  FOO: 1 बार: 2 QUX: 3 // ... ZYX: 99 XYZ: 100  

मैं एक नई पंक्ति जोड़ना चाहता हूं: BAZ: 3 बार के बाद, और QUX के मान को '4' के साथ-साथ बाकी के मूल्यों को अपडेट करने के साथ-साथ अपडेट करें। BAZ के बाद के सभी मूल्यों को बढ़ाने के लिए सबसे आसान और आसान समाधान क्या है, अंतर्निहित / मूल यूनिक्स टेक्स्ट संपादन उपकरण (पाठ संपादक, सेड, आदि) का उपयोग करते हुए?

  $ cat file FOO: 1 बार: 2 QUX: 3 / / ... ZYX: 99 एक्सवाईजेड: 100  

यह बार्स के बाद बीएजी डालता है और उसके बाद हर नंबर को बढ़ाता है:

  $ awk 'NR == 1 , / ^ बार: / {प्रिंट; अगला}! एफ {प्रिंट "BAZ: 3"; f = 1} / ^ [[alnum:]] +: / {प्रिंट $ 1, ++ $ 2; अगला} 1 'फ़ाइल FOO: 1 बार: 2 BAZ: 3 QUX: 4 // ... ZYX: 100 एक्सवाईजेड: 101  

यह कैसे काम करता है

  • एनआर == 1, / ^ बार: / {प्रिंट; अगला}

    बार: से शुरू होने वाली पहली पंक्ति सहित सभी रेखाएं प्रिंट करें

  • ! F {प्रिंट "BAZ: 3"; f = 1}

    हम केवल इस कोड के बाद बार का सामना किया गया है। यहां, BAZ लाइन को जोड़ें और झंडा f को एक में सेट करें ताकि हम इसे फिर से जोड़ना न भूलें।

  • / ^ [[alnum:]] +: / {प्रिंट $ 1, ++ $ 2; अगला}

    बृहदान्त्र के बाद एक पहचानकर्ता के साथ शुरू होने वाली किसी लाइन लाइन के लिए, वृद्धि बृहदान्त्र के बाद की संख्या और अगली पंक्ति तक जायें।

  • 1

    अन्य सभी पंक्तियों के लिए, जैसे // ... , उन्हें प्रिंट करें जैसा है

( 1 के रूप में लाइन मुद्रित करने के लिए awk का गुप्त लबादा है)।

python - Receive a string with values and return a list -


Then, I get a str, with values ​​like:

  some = "8478579 " 

and get me

  some = [8,4,7,8,5,7,9]  
some.split () , but it gives me : something ["8478579"].

Using an understanding of the list

  Gt; & Gt; & Gt; [Iii] For some [ii] [8, 4, 7, 8, 5, 7, 9]  

or a map

< Previous> & gt; & Gt; & Gt; Something = "8478579"> gt; & Gt; & Gt; List (map (int, some)) [8, 4, 7, 8, 5, 7, 9]

c# - Process.Kill throwing Win32Exception (Access is denied) -


मेरे पास निम्न कोड है:

  foreach (var प्रक्रिया प्रक्रिया में.गेटप्रक्रियासबायनाम (नाम) )) {Try {process.Kill ()} यदि (! Process.WaitForExit (टाइमआउट)) {session.log ("कीलिंग प्रक्रिया {0} का समय समाप्त हो गया।", नाम); } और {session.log ("कीलिंग प्रक्रिया {0} सफलतापूर्वक समाप्त हो गई।", नाम); }} पकड़ (अपवाद अपवाद) {session.log ("प्रक्रिया को मारने की कोशिश करते समय अपवाद {0}: {1}", नाम, अपवाद। टॉस्ट्रिंग ()); }}  

निम्न अपवाद फेंक रहा है:

  प्रक्रिया को मारने का प्रयास करते समय अपवाद & lt; प्रक्रिया नाम & gt ;: System.ComponentModel.Win32Exception (0x80004005):  

कोड आम तौर पर काम करता है, लेकिन अजीब है। समय यह असफल हो जाता है मेरे द्वारा बनाए गए एक इंस्टॉलर पर कस्टम क्रिया का यह हिस्सा है, और जब यह चलाता है, तो यह स्थानीय सिस्टम खाते के अंतर्गत चलता है। मैंने देखा है कि यह अतीत में होता है। मैं इसे जानता हूं मैं इस प्रक्रिया में संहिता को संशोधित नहीं कर सकता, इसलिए मैं इसे समाप्त करने के लिए स्वयं हूं, हालांकि मैं फिट देखता हूं। किसी प्रक्रिया को निखारने का सबसे अच्छा तरीका क्या है जिससे मुझे कुछ मध्यवर्ती अवस्था में छोड़ने की परवाह नहीं है, क्योंकि मैं सिस्टम से उसकी फाइलों को अनइंस्टॉल कर रहा हूं? किसी भी आईओ को समाप्त करने या रद्द करने की अनुमति दी जानी चाहिए, अगर कोई भी सेटिंग ऐप के लिए वैश्विक स्तर पर सेट की जाने वाली प्रक्रिया में है और उपयोगकर्ता उन्नयन करता है क्या पी / इनकॉल्टिंग सबसे अच्छा समाधान हो सकता है?


Python error IOError: [Errno 2] No such file or directory: -


मेरी स्क्रिप्ट है

  bs4 आयात से BeautifulSoup आयात अनुरोधों आयात आयात करें ओएस givenURL = raw_input ("Entrer votre liens") हेडर = {'उपयोगकर्ता-एजेंट': 'मोज़िला / 5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebkit / 537.36 (KHTML, Gecko जैसे) क्रोम / 39.0.2171.95 सफ़ारी / 537.36'} # प्रारंभ सत्र सत्र = अनुरोध। सत्र () # प्लेलिस्ट प्रतिक्रिया = सत्र। प्राप्त हो रही है (दिए गए URL, शीर्षलेख = हेडर) सूप = खूबसूरत सूप (response.content) playlist = सूप.फ़ीन्ड ('a', {'data-playlist': true} ) ['डेटा-प्लेलिस्ट'] oname = soup.find ("title") oname.text प्रिंट oname.text # वीडियो की सूची यूआरएल = 'http://animedigitalnetwork.fr/index.php?option=com_vodvideo&view = प्लेलिस्ट & amp; प्रारूप = कच्चे 'प्रतिक्रिया = session.post (यूआरएल, डेटा = {' प्लेलिस्ट ': प्लेलिस्ट,' सीज़न ':' ',' ऑर्डर ':' डीईएससी '}, हेडर = हेडर) सूप = खूबसूरत सूप (प्रतिक्रिया। सामग्री) पथ = os.path.join ('प्लेलिस्ट', oname.text) के साथ खुले (मार्ग, 'w') के रूप में च: च या वीडियो सूप में। चयन ('div.adn-video'): s = 'http://www.animedigitalnetwork.fr' + video.a.get ('href') f.write (s + '\ n' ) # फ़ाइल पढ़ें, और पहली पंक्ति छपाई के बाद तोड़। च के रूप में खुले (पथ) के साथ: f: लाइन में लाइन के लिए: print line.rstrip () तोड़  

मुझे स्क्रिप्ट के साथ एक त्रुटि मिलती है

  ट्रेसबैक ( सबसे हालिया कॉल अंतिम): फ़ाइल "adnplay.py", पंक्ति 33, & lt; मॉड्यूल & gt; ओपन (पथ, 'डब्ल्यू') के रूप में एफ के रूप में: IOError: [त्रुटि 2] ऐसा कोई फ़ाइल या निर्देशिका नहीं है: यू 'प्लेलिस्ट / मारिया, सोरसी \ एक्सईयर डीआरजीआर \ एक्सई 9, प्यूकेले डे बल! - VOSTFR ' 

मैं साइट की प्लेलिस्ट को प्राप्त करने के लिए इस स्क्रिप्ट का उपयोग करता हूं और मुझे नहीं पता कि स्क्रिप्ट को कैसे ठीक करना है क्योंकि मेरे पास कोई समस्या नहीं है

और मैं

ty अग्रिम में


go - Daylight saving hours in Golang -


I am preparing a UI for a scheduling interface, where a user can set the timer several hours in the future . If possible, I want to be able to handle Daylight Savings, I thought it would be quite easy. While checking time, I went to the following inconsistency in the Golang package, if it is that which is.

  Package main import ("fmt" "time") func main () {Fairy timeformat = "January 2, 2006 3:04 pm (MST)" test, mistake : Time =. Purse (time format, "25th October, 1:59 am (bst)") fmt.println (test, test.itc), err) dur, _: = time.ParseDuration ("1m") test = test.Add ( Dur) fmt.println (test, test.UTC ()) fmt.Println ("--------- -----------") test, err = time.Parse (time format , "October 25, 2015 2:01 AM (BST)") fmt.println (test, test.UTC (), mistake) test = test.Add (dur) fmt.println (test, test.UTC ()) test = Test.Sub (dur) fmt.println (test, test.UTC ())}  

I know that on October 25, 2015, at 2 pm on BST at 1:00 GMT ( UTC) should go back. If I increase BST between 1 minute to 1:59 then actually the time is switched to GMT.

  2015-10-25 01:59:00 +0100 BST 2015-10-25 00:59: 00 0000 UTC & lt; Zero & gt; 2015-10-25 01:00:00 +0000 GMT 2015-10-25 01:00:00 +0000 UTC -------------------- 2015-10- 25 02:01:00 +0000 BST 2015-10-25 02:01:00 +0000 UTC & lt; Zero & gt; 2015-10-25 02:02:00 +0000 BST 2015-10-25 02:02:00 +0000 UTC  

However if I had a time of 2:00 in BST If I analyze, I hope it will be to switch to GMT, as the time of transition has to be increased. If the transitional code was called by Ad, then I add a minute again, but this time does not even return to GMT.

b) Always be GMT + 1

b) for BST

a) BST "invalid" at the right time GMT time (right) Invalid BST is between 2:00 on October 2 after the last Sunday in October and the last Sunday of the following Sunday in March)

c) An error if a date was created with those dates with BST (And possibly other daylight saving hours in other countries).

Otherwise, I would have to check whether a user enters a date in BST or not that the date is outside of BST and adjust or emphasize users at UTC time, which is built in the library. Deals the object with the daylight saving function.

During the research I saw it and I have decided that it is definitely not as easy as I previously believed ...

To handle daylight saving time There will be no insight or better way for

Edited Version: Version 1.3.3 was retried and this output was received

  2015- 10-25 01:59 : 00 + 10100 BST 2015-10-25 00:59:00 +0000 UTC < Zero & gt; 2015-10-25 01:00:00 +0000 GMT 2015-10-25 01:00:00 +0000 UTC -------------------- 2015-10- 25 01:00:00 +0000 GMT 2015-10-25 01:00:00 +0000 UTC & lt; Zero & gt; 2015-10-25 01:01:00 +0000 GMT 2015-10-25 01:01:00 +0000 UTC  

It looks as if I used to expect later versions. .. If this question has also been received then it will be fully read.

Thank you.

Go, like everyone else but Microsoft, regularly updates that are included in the current go release uses it.

You used .1.0.3 which was released in March 2012. British time zone data for 2015 added later

Always use a current version of Go for Time Zone Count