Posts

awk: how to delete first and last value on entire column -

I have a data that contains many columns. On a column, I would like to delete two commas which, at the beginning and in the whole Are located at the end of the column. My data looks something like this: a, 3,4,3,2, b, 3,4,5,1, c, 1,5,2,4,5, d , 3,6,24,62,3,54, How can someone remove the first and last comma on this data? I appreciate it. awk '{sub (/, /, "", $ 0); Print substrag ($ 0,0, length ($ 0) -1)} 'input.txt Output: a 3,4,3 , 2, b3,4,5,1, c 1,5,2,4,5, d3,6,24,62,3,54,

python - Pandas 0.13.1 use of groupby( ) with drop_duplicates( ) or dropna ( ) -

I just updated the pandas to 0.13.1 from the previous version - happily, this opened some options for me unfortunately From, it seems that some of my data tilt codes have caused problems. I did not make any changes other than updating the panda version from 0.11.0. The code that used to work first, and now works, is as follows: g_pres dropdown (0) And / or g_pres = (= 'follow', 'focal', 'std_epoch']) drop-duplicates (0) Error using any of the results: (Previous) --------------------------- -------------------- ---------------------------- Attribute error Tracebacks (most recent call final) & lt; Ipython-input-169-5d3c7458da40 & gt; In & lt; Module & gt; () ---- & gt; 1 g_pres = g_pres.groupby (['follow', 'focal', 'std_epoch']). Dropna (0) //anaconda/lib/python2.7/site-packages/pandas/core/groupby.py __getattr __ (self, atr) 293 294 if heetter (self, boss, ether) and atr! = '_cache': - &...

python - twisted SMTP server limit incoming email message size -

This is a very basic code that I am using to make SMTP server in twisted: by email. Import headers, twisted.internet, import from imported, twisted.mail import from reactor zope.interface import class ConsoleMessage delivery (object) from device: smtp istmp;% s "% (myHostname, clientIP, Smtp.rfc822date ()) "Received:% s from% s with"% s "% header (headerValue) def validateFrom (auto, hello, original): # All addresses are accepted return original def ValidateTo (self, user): # The message sent to the user only "console @ domain" is accepted. User.dest.local == "console": return lambda: increase console message (smtp.SMTPBadRcpt (user) class ConsoleMessage: tool (smtp.imessage) def __init __ (self): self.lines = [] Def line (self, line): self.lines.append (line) def eomReceived (self): print "New message received:" print "\ n" .join (self.lines) self.lines = any Also defer.Sciceed Returns (None) Def ConnectionList (Self):...

c++ - Wrong std::vector constructor -

I am getting a strange error from Consumable when compiling the code should be the straight line of code. This code generates an error: size_t s = 5; Std :: vector & lt; Double & gt; Best Scords {0}, I'm just trying to use to fill a new vector with values ​​of five -1.0. The error I get is Non-continuous expression can not be compressed with type 'size_type' (aka 'unsigned long') to 'double' in the initial list. What's going on? It's compiled exactly: std :: vector & lt; Double & gt; Best Scores {5, -1.0}; Is she trying to use the initial list creator? I thought you should have two curl braces for it: std :: vector & lt; Double & gt; Best Scores {{5, -1.0}}; The issue is that you create a vector using a brace-attached initial list are doing. This applies to std :: initializer_list & lt; T & gt; Producer supports this condition, size_t , -1.0 list std :: initializer_list & lt; Do...

vb.net - How to get the full path of a file through the file's name -

I'm trying to get the path of a file named after it. I have created an executable file on my desktop, command.xa , I am trying to get this full path through the console application. I want to find my entire computer for the file, (this is on my desktop for simplicity) and will return the path, it should be kept in mind that the file can be anywhere. The path I want to return is the program: "C: \ user \ jimbob \ Desktop \ Commands.exe" My code: Import system. IO module module 1 slow file location string as filename string = "command.xa" sub head () fileLocation = path. GetFullPath (filename) console.light line (file location) console.readline () end sub-end module but instead prints it " C: \ Users \ Jimbob \ Documents \ Visual Studio 2012 \ Projects \ Get Path Test \ Path Test \ Bin \ Debug \ Commands.exe " This is the path to the project of all my code In this way, the debug folder does not even have command.xa . Hel...

android - Custom Listview with checkbox not clickable -

I created a custom list view with checkbox, items on the list view are not clickable I want to enable the checkboxes not just to click the items in the list. store.getText () toString (); list.add (data); ArrayAdapter & LT; String & gt; Adapter = New ArrayAdapter & lt; String & gt; (MainActivity.this, R.layout.list_view, R.id.textView1, list); LSet adapter (Adapter);}}); ls.setOnItemClickListener (New OnItemClickListener () {@Override public void onItemClick (AdapterView & LT ;? & gt; arg0, see ARG1, ARG2 integer, long arg3) {string click = list.get (ARG2) .toString (); Toast .makeText (GetBaseContext (), "you clicked" + click, toast .LENGTH_SHORT) .show ();}}); list_view.xml & lt; Checkbox android: id = "@ + id / checkbox1 my Android code for": Layout_width = "Wrap_content" Android: Layout_height = "Wrap_content" Android: Leaut_algpriwartk = "true" Android: Leaut_alginpecrtop = "true" ...

php - Session array issue -

foreach ($ _SESSION ['कार्ट'] $ prodid = & gt; $ qty = & gt; $ आकार के रूप में) { कोड की यह पंक्ति त्रुटि को ऊपर लाता है। पार्स त्रुटि: सिंटैक्स त्रुटि, अप्रत्याशित ',', उम्मीद '' 'में सी: \ xampp \ htdocs \ ShoeShop \ cartPage.php पंक्ति 29 पर क्या किसी को भी इसे ठीक करने का तरीका पता है? मुझे सरणियों का बहुत कम ज्ञान है। मुझे लगता है कि आप ऐसा कुछ चाहते हैं: foreach ($ _ सशन ['कार्ट'] $ prodid के रूप में) {foreach ($ prodid $ qty = & gt; $ size) {}} या तो $ Code के रूप में foreach (array () ($ value) के रूप में) {} या foreach (array () $ key = & gt; $ value) {} का प्रारूप, वर्तमान में आपके पास foreach (सरणी () $ कुंजी = & gt; $ value = & gt; ???) {} के रूप में। यह मानता होगा कि $ _ सत्र ['कार्ट'] इस प्रारूप में है: अर्रे (अर्रे (qty = & gt; आकार, मात्रा = & gt; आकार , मात्रा = & gt; आकार,), अर्रे (qty = & gt; आकार, qty = & gt; आकार, मात्रा = & gt; आकार,))); ...