Programming :: Popping Off More Than One Item At A Time In A List?
Jul 14, 2010
I was reading some code the other day and thought that I saw they were using the list.pop method to pop of more than one item at a time. Something like this.
Code:
l = [ 'a', 'b', 'c', 'd', 'e' ]
l.pop(0:3)
['a','b','c']
l
['d','e']
But of course when I looked at invoking the method, it only works for one item at a time. I'm working on a data structure where I'm parcing weather data that is 15 items long that are return in as data in a list that has 3,000 + items. I was wanting to pop off a lists of the 1st 15 items breaking them into chuncks (still trying to figure out how I'm going to store the associations as each day has 2-4 readings an hour for the past 72 hours, so I was wanting to group the days together but have each data point for each time).
I know I can just write a function (with some additional tweaking needed for neg starts to work on the right end):
But with increasing data sizes, I was wondering if there was a faster built-in way of doing this (perhaps implemented under the hood written originally in C as an extention, for example).
I have my own declared types and I have to operate with lists of items. I wish to write a one macro, instead of using a function for each type. It's intended to be like this: Code: #define ____append_to_list(head,
Recently I have installed DockbarX and Cardapio. After installation they are supposed to be found in the Add to Panel items, but both of them are not there.I can run them directly without any problem. Is there anything else I should do manually? I have tried pkill gnome-panel to restart the panel as well.
I am using the package Quantum espresso to get electron phonon coefficients for monolayer graphene. While applying one of the executables, I got the error: "At line 356 of file q2r.f90 (Unit 51 "a2Fq2r.51") Traceback not availabel: compile with -ftrace=frame or -ftrace=full. Fortran Runtime error: bad real number in item 1 of list input
I need to make a quick gui to interface with another application. I'm using Java swing to produce it, however have no experience with JAVA. I have used net bean to produce the gui. At one part I have a jList private javax.swing.JList jSymbolList1;
I want on a button press to add or change members of the list from a text field. I thought I could so this simply by using the addelement eg jSymbolList1.addElement("hello world"); However this produces an error. Can anyone tell me how to add a string or how to change a string at a set position?
How would I list 4 users ID numbered 10, 11, 12 and 13 from my users list and output them to a file busers where their names are numbered by ascending order? How would I accomplish that on a one line command?
I am trying to get this script to work. The purpose is to download a list of modules from the slax.org the list consist of a list of module numbers. What I am trying to do is Download the file or the file name corresponding to the number in the list.the list is comma delimited. this is what I have done so far and I am a stand still.
#!/bin/sh # Wget script to retrieve modules from slax.org modules # # ----Begin of user defined values ----- # Path to wget
I am using Debian linux. I have 100 timers running. If a timer expired which will generate a signal and it was mapped to a same function handler. All the timers are mapped to one function handler. The problem is if the timer expires one at a time, the function handler called at a time. But if the 2 timers expires at a time, the function handler is called one time only instead 2 times. Is it possible to invoke the function handler as many times based on timer expirary happens simultaneoulsy?
I am trying to set time using settimeofday in linux. But it sets local time. i.e works like SetLocalTime in windows. But I want to set system time(like SetSystemTime in windows). I could'nt find no other api in linux. What should i do? I had tried with mktime/gmtime apis
Is it possible to list all jobs and their pids from a certain time frame? For instance if I needed to see all completed jobs from yesterday how would I do this? I've tried jobs -n but that was messed up because I had typed jobs right before that.
How can I generate a list of files in a directory [e.g.: "/mnt/hdd/PUB/"] ordered by the files modification time? [in descending order, the oldest modified file is at the lists end] ls -A -lRt would be great:[URL] But if a file is changed in a directory it lists the full directory...so the pastebined link isn't good [i don't want a list ordered by "directories", I need a "per file" ordered list] OS: openwrt..[no perl -> not enough space for it :( + no "stat", or "file" command]
Just i want to ask doubts in c programming. I dont know whether this is the right place to ask doubts in c. If this is not a correct place, may i know where can i get help for c programming?is there any active forum or mailing list for c programming?
I have a Creative Labs SB X-Fi sound card and I am getting a lot of crackling & popping with it. Plus I have to kill and restart pulseaudio a lot. Does anyone know of anything that can be done to help this out? I have the latest F12 kernel and rpms installed.
I'm starting to use SuperUbuntu, and am trying to set up Evolution email prog. This is on a USB stick. Anyone know how to get rid of the keyring nonsense that keeps popping up? Google searches reveal that others are highly annoyed too, but can't cure it easily. Is it easy to put Thunderbird on and remove Evolution? And before anyone starts to preach security to me - I don't want to hear it. No offence meant. All I'm looking for is a correction.
i m using ubuntu 10.04 Lucidi m reposting this thread.few days back when i setup evolution client i m facing this problem since then.when i open my system i always find three applications opening automatically.1. Evolution2. A open office Word Processor (untitled3. Documents folder window.
This is an annoying problem I've been having with Unity. I'll be moving the mouse around and sometimes hit the right or left mouse clicker and the launcher bar pops out and stays stuck out. I can't get it to auto hide unless the browser is closed. Then I have to reopen the browser and start all over again. What makes this very annoying is there may be several tabs open in the browser that have to be all reloaded again.How do you get the launcher bar to auto hide again after it is stuck popped out?
Since I installed Natty recently, I had this "popping" sound from the speakers when the laptop was running on battery. Turns out this popping has to do with a power-saving feature for "hda-intel" sound-chips.
Open terminal and do: Code: gksudo gedit /usr/lib/pm-utils/power.d/intel-audio-powersave Find this line: INTEL_AUDIO_POWERSAVE=${INTEL_AUDIO_POWERSAVE:-true}
And comment it out by putting a "#" in front of it like this: # INTEL_AUDIO_POWERSAVE=${INTEL_AUDIO_POWERSAVE:-true}
Just below this line you make a new line, like this: INTEL_AUDIO_POWERSAVE=false
So now you will have: # INTEL_AUDIO_POWERSAVE=${INTEL_AUDIO_POWERSAVE:-true} INTEL_AUDIO_POWERSAVE=false Save the file (File > Save) and exit. Reboot the computer. The popping sound will be gone.
If you for some reason need to undo the setting, just open the file again and remove the "#" from: INTEL_AUDIO_POWERSAVE=${INTEL_AUDIO_POWERSAVE:-true}
And delete this line: INTEL_AUDIO_POWERSAVE=false Save the file. Reboot.
I just got Ubuntu a few days ago and recently updated it. I now have a screen popping up whenever I start Ubuntu that says I have less than a gig of space left on my hard drive. I dont want windows xp on my computer anymore but have no idea how to get rid of it.
I loaded CentOS from a USB net install as I am trying to get an eeeBox to run CentOS 5.3 as a low power usage firewall. As you might know this box doesn't have an optical drive so everything has to be loaded from something USB. After the net install I ran a yum update and then went to some websites that I use and Firefox would pop a small window which looked like a vertical blue bar with a white dot at the bottom. I could grab it with the mouse and expand it and it would open as a normal window but inside there would be nothing. Usually in other CentOS installations Firefox would put the new window in another tab. When I go to the Edit/Preferences area and click on the tab icon nothing appears on the page...only the mail and security icons work. I unloaded Firefox using yum remove and reloaded it using yum install and now when I start Firefox it pops three windows and every site I go to pops another window with nothing in it. Am I losing my mind, or is there something wrong with my hardware, or is this a bug?
I close Nautilus and it pops open again and always to the folder "media". The only thing I had in the media was a CDROM, which I unmounted and that made no difference. I then removed the CD from the CDROM drive and that made no difference. Any ideas why opensuse 11.2 would insist on keeping a Nautilus window open all the time -- defaulting the "/media" folder on initial opening?
I am using Debian testing with KDE 4.6.5. However, when I insert my ubs stick, on top of the expected kde response I get a Nautilus window popping up (which is the Gnome file manager). How can I disable this?
I have an external hard drive that i keep my media on for use with XBMC. The problem is that when media centre is on and i attach the hard drive, Ubuntu's file browser pops up with the contents of my drive and this is over XBMC. When using a remote i am left stuck as i can't alt+tab out of the file browser. How do i disable this?
I installed the Lucid Release Candidate today, and for some reason Broadcast Accounts keeps opening itself, even after I've added all the accounts I'm going to. Is this happening with anyone else, and how can I make it stop?
I did a clean install to 10.04. Not too many issues except any sound I play sounds like it's underwater and pops while playing. I have tried to do the Pulse Audio install, but every time I loaded pauvcontrol (I think was the title), it would pop up "Connection Failure: Connection Refused." I tried to follow other guides, but they'd all fail because I'd be missing half of the files it changed. I have a Creative Labs X-Fi Fatality card that has given me troubles in the past, but usually, it works. I tried to install Creative's open driver, but again, I had an error when I attempted to Make the directory.
I seem to be having a problem with Banshee. When I boot up, it automatically starts up, which seems innocent enough. However, I opened up Exaile (because Banshee had this problem of not recognizing spaces in some of my songs' filenames, replacing them with '%20'), and closed Banshee from its notifications icon. It closed, but about 3-5 seconds later its window pops up again. I used Ctrl+Q to quit, but it still came back after a few seconds. I've tried opening up a terminal and typing "killall banshee-1", but still, Banshee keeps coming back. Even though I restart and not open Exaile, Banshee still keeps coming back when I try to kill it.