Daily Archives

Articles indexed Saturday October 20 2012

Page 9/14 | < Previous Page | 5 6 7 8 9 10 11 12 13 14  | Next Page >

  • New mainboard with 890GX chipset disables lightdm, even when using old graphics card instead of onboard graphics, startx works (Xubuntu 12.04)

    - by user99250
    I am trying to migrate an installed Xubuntu 12.04 to a new mainbaord with 890GX chipset. The Chipset has a built-in Radeon HD 4290 graphics. The system boots, but X won't start. The most suspicious message in Xorg.0.log is "ddxSigGiveUp: Closing log". When searching for this message, I found some answers like "remove your xorg.conf" (but there is none on my system). Or bug reports for fglrx (but that's not installed on my system). Or NVidia-related questions ... Interestingly, "startx" succeeds in opening a basic XFCE session. Then, I tried to disable the onboard graphics in the BIOS setup and use the old PCIe graphics card (Radeon HD 5450). No change. I don't think I can just blacklist a module, because the graphics card and the onboard graphics are covered by the same module. At the moment, use the free radeon drivers, not the restricted fglrx driver. If possible, I would like to stay on the free driver for two reasons: The fglrx driver from the ubuntu packages fails to build the kernel module. In past, I had bad experiences with the fglrx driver and changing screen config with RandR. When I connect the harddisk and the graphics card to my old mainboard, everything works again. This means, I have not screwed up my system configuration wile installing and removing the fglrx drivers. When I ordered this mainboard, I thought the 890GX is old enough to be supported and if not, I could still use my graphics card as backup solution. But without even the backup soluton, I'm screwed ... Any ideas ? Thanks and Regards, Kubuntu-Man (now switched to Xubuntu)

    Read the article

  • Totem crashes immediately after startup in 12.10

    - by Sakib Hasan
    I did a fresh install of Ubuntu 12.10 and did sudo apt-get update && sudo apt-get update. Then I installed ubuntu-restricted-extras, audacious and vlc from Software Center. After that I tried launch Totem Movie player but in terminal following error comes up: (totem:9295): Gdk-ERROR **: The program 'totem' received an X Window System error. This probably reflects a bug in the program. The error was 'BadDrawable (invalid Pixmap or Window parameter)'. (Details: serial 1808 error_code 9 request_code 152 minor_code 9) (Note to programmers: normally, X errors are reported asynchronously; that is, you will receive the error a while after causing it. To debug your program, run it with the GDK_SYNCHRONIZE environment variable to change this behavior. You can then get a meaningful backtrace from your debugger if you break on the gdk_x_error() function.) Trace/breakpoint trap (core dumped) I tried purge and again install. But the error remains. What should I do?

    Read the article

  • How to make my own web app

    - by pgrytdal
    After switchign to Ubuntu 12.10, I have discovered I like the Web App's feature. I do not, however, like the Gwibber application, or Twitter.com (and it's web app) because of lack of features. I do, however, like the Twitter client Hotot, but for some reason, is not working for me right now. I was wondering if there was a way I could make web.tweetdeck.com a Web App, until I can get Hotot working for me? Thank you!

    Read the article

  • Can't access external USB storage after updating to 12.10

    - by user99252
    I installed Ubuntu 12.04 after Windows failed me and Samsung got a bit pissy about providing any help. I then upgraded to 12.10 after a week or two and suddenly my external USB devices no longer work. The same devices I plugged in are no longer recognised. As I say, I'm only a user of Ubuntu for a fortnight, so any advice and directions to very simple instructions, would be appreciated greatly. I've seen this asked elsewhere, but the advice was to ask again if you needed clarification.

    Read the article

  • Linux Kernel not upgraded (from Ubuntu 12.04 to 12.10) - can't remove old kernels and can't install new apps

    - by Tony Breyal
    Question: How do I remove old kernel images which refuse to be removed? Context: Yesterday I upgraded Ubuntu from 12.04 to 12.10. However, the linux kernel has not upgraded from 3.2 to 3.5 as I would have expected. $ uname -r 3.2.0-32-generic $ uname -a Linux tony-b 3.2.0-32-generic #51-Ubuntu SMP Wed Sep 26 21:33:09 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux $ cat /proc/version Linux version 3.2.0-32-generic (buildd@batsu) (gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) ) #51-Ubuntu SMP Wed Sep 26 21:33:09 UTC 2012 Not sure why that happened there. I wanted to install Audacity (v2.0.1-1_amd64) to edit a lecture audio file. When trying this operation through Ubuntu Software Center, it says that to install audacity, four items will need to be removed: linux-image-3.2.0-27-generic linux-image-3.2.0-29-generic linux-image-3.2.0-30-generic linux-image-3.2.0-31-generic So I click "Install Anyway" but it fails with the following output: installArchives() failed: (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 259675 files and directories currently installed.) Removing linux-image-3.2.0-27-generic ... Examining /etc/kernel/postrm.d . run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.2.0-27-generic /boot/vmlinuz-3.2.0-27-generic update-initramfs: Deleting /boot/initrd.img-3.2.0-27-generic run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.2.0-27-generic /boot/vmlinuz-3.2.0-27-generic Generating grub.cfg ... run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 1 Failed to process /etc/kernel/postrm.d at /var/lib/dpkg/info/linux-image-3.2.0-27-generic.postrm line 328. dpkg: error processing linux-image-3.2.0-27-generic (--remove): subprocess installed post-removal script returned error exit status 1 No apport report written because MaxReports is reached already Removing linux-image-3.2.0-29-generic ... Examining /etc/kernel/postrm.d . run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.2.0-29-generic /boot/vmlinuz-3.2.0-29-generic update-initramfs: Deleting /boot/initrd.img-3.2.0-29-generic run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.2.0-29-generic /boot/vmlinuz-3.2.0-29-generic Generating grub.cfg ... run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 1 Failed to process /etc/kernel/postrm.d at /var/lib/dpkg/info/linux-image-3.2.0-29-generic.postrm line 328. dpkg: error processing linux-image-3.2.0-29-generic (--remove): subprocess installed post-removal script returned error exit status 1 No apport report written because MaxReports is reached already Removing linux-image-3.2.0-30-generic ... Examining /etc/kernel/postrm.d . run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.2.0-30-generic /boot/vmlinuz-3.2.0-30-generic update-initramfs: Deleting /boot/initrd.img-3.2.0-30-generic run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.2.0-30-generic /boot/vmlinuz-3.2.0-30-generic Generating grub.cfg ... run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 1 Failed to process /etc/kernel/postrm.d at /var/lib/dpkg/info/linux-image-3.2.0-30-generic.postrm line 328. dpkg: error processing linux-image-3.2.0-30-generic (--remove): subprocess installed post-removal script returned error exit status 1 No apport report written because MaxReports is reached already Removing linux-image-3.2.0-31-generic ... Examining /etc/kernel/postrm.d . run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.2.0-31-generic /boot/vmlinuz-3.2.0-31-generic update-initramfs: Deleting /boot/initrd.img-3.2.0-31-generic run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.2.0-31-generic /boot/vmlinuz-3.2.0-31-generic Generating grub.cfg ... run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 1 Failed to process /etc/kernel/postrm.d at /var/lib/dpkg/info/linux-image-3.2.0-31-generic.postrm line 328. dpkg: error processing linux-image-3.2.0-31-generic (--remove): subprocess installed post-removal script returned error exit status 1 No apport report written because MaxReports is reached already Errors were encountered while processing: linux-image-3.2.0-27-generic linux-image-3.2.0-29-generic linux-image-3.2.0-30-generic linux-image-3.2.0-31-generic Error in function: Setting up grub-pc (2.00-7ubuntu11) ... /usr/sbin/grub-bios-setup: warning: Sector 32 is already in use by the program `FlexNet'; avoiding it. This software may cause boot or other problems in future. Please ask its authors not to store data in the boot track. Installation finished. No error reported. Generating grub.cfg ... dpkg: error processing grub-pc (--configure): subprocess installed post-installation script returned error exit status 1 It seems I need to remove the old linux images somehow. I have tried this through (1) Synaptic, (2) Ubuntu Tweak, and (3) Computer Janitor. The first two fail, whilst Computer Janitor won't even open. The output from Synaptic is: E: linux-image-3.2.0-27-generic: subprocess installed post-removal script returned error exit status 1 E: linux-image-3.2.0-29-generic: subprocess installed post-removal script returned error exit status 1 E: linux-image-3.2.0-30-generic: subprocess installed post-removal script returned error exit status 1 E: linux-image-3.2.0-31-generic: subprocess installed post-removal script returned error exit status 1 How do I remove these old images? Thank you kindly in advance for any help on this matter. P.S. Further information: $ dpkg --list | grep linux-image rH linux-image-3.2.0-27-generic 3.2.0-27.43 amd64 Linux kernel image for version 3.2.0 on 64 bit x86 SMP rH linux-image-3.2.0-29-generic 3.2.0-29.46 amd64 Linux kernel image for version 3.2.0 on 64 bit x86 SMP rH linux-image-3.2.0-30-generic 3.2.0-30.48 amd64 Linux kernel image for version 3.2.0 on 64 bit x86 SMP rH linux-image-3.2.0-31-generic 3.2.0-31.50 amd64 Linux kernel image for version 3.2.0 on 64 bit x86 SMP ii linux-image-3.2.0-32-generic 3.2.0-32.51 amd64 Linux kernel image for version 3.2.0 on 64 bit x86 SMP ii linux-image-3.5.0-17-generic 3.5.0-17.28 amd64 Linux kernel image for version 3.5.0 on 64 bit x86 SMP ii linux-image-extra-3.5.0-17-generic 3.5.0-17.28 amd64 Linux kernel image for version 3.5.0 on 64 bit x86 SMP ii linux-image-generic 3.5.0.17.19 amd64 Generic Linux kernel image But trying to remove using the command line fails too e.g.: $ sudo apt-get purge linux-image-3.2.0-27-generic Reading package lists... Done Building dependency tree Reading state information... Done The following packages will be REMOVED linux-image-3.2.0-27-generic linux-image-3.2.0-29-generic linux-image-3.2.0-30-generic linux-image-3.2.0-31-generic 0 upgraded, 0 newly installed, 4 to remove and 1 not upgraded. 5 not fully installed or removed. After this operation, 597 MB disk space will be freed. Do you want to continue [Y/n]? Y (Reading database ... 259675 files and directories currently installed.) Removing linux-image-3.2.0-27-generic ... Examining /etc/kernel/postrm.d . run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.2.0-27-generic /boot/vmlinuz-3.2.0-27-generic update-initramfs: Deleting /boot/initrd.img-3.2.0-27-generic run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.2.0-27-generic /boot/vmlinuz-3.2.0-27-generic Generating grub.cfg ... run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 1 Failed to process /etc/kernel/postrm.d at /var/lib/dpkg/info/linux-image-3.2.0-27-generic.postrm line 328. dpkg: error processing linux-image-3.2.0-27-generic (--remove): subprocess installed post-removal script returned error exit status 1 No apport report written because MaxReports has already been reached Removing linux-image-3.2.0-29-generic ... Examining /etc/kernel/postrm.d . run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.2.0-29-generic /boot/vmlinuz-3.2.0-29-generic update-initramfs: Deleting /boot/initrd.img-3.2.0-29-generic run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.2.0-29-generic /boot/vmlinuz-3.2.0-29-generic Generating grub.cfg ... run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 1 Failed to process /etc/kernel/postrm.d at /var/lib/dpkg/info/linux-image-3.2.0-29-generic.postrm line 328. dpkg: error processing linux-image-3.2.0-29-generic (--remove): subprocess installed post-removal script returned error exit status 1 No apport report written because MaxReports has already been reached Removing linux-image-3.2.0-30-generic ... Examining /etc/kernel/postrm.d . run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.2.0-30-generic /boot/vmlinuz-3.2.0-30-generic update-initramfs: Deleting /boot/initrd.img-3.2.0-30-generic run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.2.0-30-generic /boot/vmlinuz-3.2.0-30-generic Generating grub.cfg ... run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 1 Failed to process /etc/kernel/postrm.d at /var/lib/dpkg/info/linux-image-3.2.0-30-generic.postrm line 328. dpkg: error processing linux-image-3.2.0-30-generic (--remove): subprocess installed post-removal script returned error exit status 1 No apport report written because MaxReports has already been reached Removing linux-image-3.2.0-31-generic ... Examining /etc/kernel/postrm.d . run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.2.0-31-generic /boot/vmlinuz-3.2.0-31-generic update-initramfs: Deleting /boot/initrd.img-3.2.0-31-generic run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.2.0-31-generic /boot/vmlinuz-3.2.0-31-generic Generating grub.cfg ... run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 1 Failed to process /etc/kernel/postrm.d at /var/lib/dpkg/info/linux-image-3.2.0-31-generic.postrm line 328. dpkg: error processing linux-image-3.2.0-31-generic (--remove): subprocess installed post-removal script returned error exit status 1 No apport report written because MaxReports has already been reached Errors were encountered while processing: linux-image-3.2.0-27-generic linux-image-3.2.0-29-generic linux-image-3.2.0-30-generic linux-image-3.2.0-31-generic E: Sub-process /usr/bin/dpkg returned an error code (1)

    Read the article

  • Upgrading kubuntu to version 12.10 stops

    - by simendsjo
    It's on the step "Installing the upgrades", says it's "Configuring virtuoso-opensource-6.1", and the last line in the log is "Unpacking linux-headers-3.5.0-17 (from .../linux-headers-3.5.0-17_3.5.0-17.28_all.deb) ..." .. And the application just sits there doing nothing. Trying to abort now says "The system could be in an unstable state if you cancel the upgrade", so I'd rather not do that :/ Any idea how I can kick the upgrade into gear again? EDIT: I closed the program, ran dpkg -configure (which failed). Booted ran configure again, some configuration, and things are up and running again. I'm leaving this open as I have no idea what the root cause was.

    Read the article

  • Upgrade with backports installed

    - by deshmukh
    I am running Ubuntu 12.04 with backports for TexLive. Ubuntu 12.10 is to contain the same version of TexLive that backport provides currently to 12.04. I, of course, want to move from backport to the normal version of TexLive available in Ubuntu 12.10 repositories. How do I handle the situation? Do I upgrade the normal way and everything will be taken care of i.e. my TexLive installation will now be from repositories instead of backports?

    Read the article

  • Should ATI catalyst be installed for sake of openCL?

    - by G Sree Teja Simha
    I have a HP Envy 4 1025tx with Hybrid graphics. Although this is a 64bit system, I've installed 32bit Ubuntu on it for some reasons.(Hybrid graphics don't do well with 64bit Ubuntu.-"Some one on some forum") I had heating problems with the GPU but I've fixed them all with vgaswitcheroo. But now I wanted to use my Blender on my Ubuntu. To my surprise Blender didn't detect the dedicated 7670m card in my machine. I've confirmed with cat /sys/kernel/debug/vgaswitcheroo/switch Both IGD and DIS were up and running. I dont seem to have libopencl on my /usr/lib even though my synaptic manager says that I have installed it. I'm not quite sure what I've installed. It says that I've installed "ocl-icd-libopencl1". So my question is... Do I have opencl on my system? If not do I have to get propreitary ATI drivers for sake of opencl(fglrx wrecks up my unity totally on my system I need directions to fix it if this is the choice)? Should I get a 64bit Ubuntu installed on this system?

    Read the article

  • Login screen won't accept my password

    - by Raven H
    I recently upgraded to 12.04 from 11.10 and since upgrading have been unable to login to my user profile. The upgrade went okay and I can login to a guest session fine but whenever I try to login to my profile, after entering my password, I just return to the login screen. I've changed my password in Root (passwd 'username')and can log in to tty1 with no issues, it's just in GUI I'm having problems. I'm using a HP dv7 laptop, 32 bit Ubuntu install, Intel® Core™2 Duo CPU P7350 @ 2.00GHz × 2, Nvidia graphics. Any help would be appreciated.

    Read the article

  • External Full HD monitor and Virtual Desktop Size

    - by Stefan
    I have two FullHD monitors attached to my ATI graphics card [2]. The resolution of both of them is detected properly without any modifications to /etc/X11/xorg.conf. I can run both of them in clone mode. However, when I try to run them next to each other, I got the following error: The selected configuration for displays could not be applied. If tried to fix this according to [1]. My xorg.conf now looks like this: Section "Module" Load "glx" EndSection Section "Screen" Identifier "Default Screen" DefaultDepth 24 SubSection "Display" # The 1088 is the smallest multiple of 32 >= 1088 # see manpages Virtual 1920 1088 EndSubSection EndSection This does not seem to be parsed properly. After restarting X, I cannot set resolutions beyond 1600 or so any more. /var/log/Xorg.0.log gives: [ 15.676] (II) fglrx(0): Not using mode "1920x1080" (width too large for virtual size) [ 15.676] (II) fglrx(0): Not using mode "1680x1050" (width too large for virtual size) Are my modifications syntactically incorrect? According to the man page, it should be fine. Any ideas? OS: Ubuntu 11.10 64bit [1] http://askubuntu.com/a/75546/5023 [2] 01:00.0 VGA compatible controller: ATI Technologies Inc Juniper [Radeon HD 5700 Series]

    Read the article

  • What is this style of navigation sidebar called and is there an open source Javascript library for it? [migrated]

    - by Lucas Meijer
    I'd like to build a sidebar navigation for an online book much like apple did here: http://developer.apple.com/library/ios/navigation/ (note it has collapsable entries) and to my surprise I'm having a hard time finding a good off the shelve javascript startingpoint to build from. What is this style of navigation sidebar called? Are there any open source Javascript libraries that provide this style of navigation?

    Read the article

  • Trying to detect collision between two polygons using Separating Axis Theorem

    - by Holly
    The only collision experience i've had was with simple rectangles, i wanted to find something that would allow me to define polygonal areas for collision and have been trying to make sense of SAT using these two links Though i'm a bit iffy with the math for the most part i feel like i understand the theory! Except my implementation somewhere down the line must be off as: (excuse the hideous font) As mentioned above i have defined a CollisionPolygon class where most of my theory is implemented and then have a helper class called Vect which was meant to be for Vectors but has also been used to contain a vertex given that both just have two float values. I've tried stepping through the function and inspecting the values to solve things but given so many axes and vectors and new math to work out as i go i'm struggling to find the erroneous calculation(s) and would really appreciate any help. Apologies if this is not suitable as a question! CollisionPolygon.java: package biz.hireholly.gameplay; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import biz.hireholly.gameplay.Types.Vect; public class CollisionPolygon { Paint paint; private Vect[] vertices; private Vect[] separationAxes; CollisionPolygon(Vect[] vertices){ this.vertices = vertices; //compute edges and separations axes separationAxes = new Vect[vertices.length]; for (int i = 0; i < vertices.length; i++) { // get the current vertex Vect p1 = vertices[i]; // get the next vertex Vect p2 = vertices[i + 1 == vertices.length ? 0 : i + 1]; // subtract the two to get the edge vector Vect edge = p1.subtract(p2); // get either perpendicular vector Vect normal = edge.perp(); // the perp method is just (x, y) => (-y, x) or (y, -x) separationAxes[i] = normal; } paint = new Paint(); paint.setColor(Color.RED); } public void draw(Canvas c, int xPos, int yPos){ for (int i = 0; i < vertices.length; i++) { Vect v1 = vertices[i]; Vect v2 = vertices[i + 1 == vertices.length ? 0 : i + 1]; c.drawLine( xPos + v1.x, yPos + v1.y, xPos + v2.x, yPos + v2.y, paint); } } /* consider changing to a static function */ public boolean intersects(CollisionPolygon p){ // loop over this polygons separation exes for (Vect axis : separationAxes) { // project both shapes onto the axis Vect p1 = this.minMaxProjection(axis); Vect p2 = p.minMaxProjection(axis); // do the projections overlap? if (!p1.overlap(p2)) { // then we can guarantee that the shapes do not overlap return false; } } // loop over the other polygons separation axes Vect[] sepAxesOther = p.getSeparationAxes(); for (Vect axis : sepAxesOther) { // project both shapes onto the axis Vect p1 = this.minMaxProjection(axis); Vect p2 = p.minMaxProjection(axis); // do the projections overlap? if (!p1.overlap(p2)) { // then we can guarantee that the shapes do not overlap return false; } } // if we get here then we know that every axis had overlap on it // so we can guarantee an intersection return true; } /* Note projections wont actually be acurate if the axes aren't normalised * but that's not necessary since we just need a boolean return from our * intersects not a Minimum Translation Vector. */ private Vect minMaxProjection(Vect axis) { float min = axis.dot(vertices[0]); float max = min; for (int i = 1; i < vertices.length; i++) { float p = axis.dot(vertices[i]); if (p < min) { min = p; } else if (p > max) { max = p; } } Vect minMaxProj = new Vect(min, max); return minMaxProj; } public Vect[] getSeparationAxes() { return separationAxes; } public Vect[] getVertices() { return vertices; } } Vect.java: package biz.hireholly.gameplay.Types; /* NOTE: Can also be used to hold vertices! Projections, coordinates ect */ public class Vect{ public float x; public float y; public Vect(float x, float y){ this.x = x; this.y = y; } public Vect perp() { return new Vect(-y, x); } public Vect subtract(Vect other) { return new Vect(x - other.x, y - other.y); } public boolean overlap(Vect other) { if( other.x <= y || other.y >= x){ return true; } return false; } /* used specifically for my SAT implementation which i'm figuring out as i go, * references for later.. * http://www.gamedev.net/page/resources/_/technical/game-programming/2d-rotated-rectangle-collision-r2604 * http://www.codezealot.org/archives/55 */ public float scalarDotProjection(Vect other) { //multiplier = dot product / length^2 float multiplier = dot(other) / (x*x + y*y); //to get the x/y of the projection vector multiply by x/y of axis float projX = multiplier * x; float projY = multiplier * y; //we want to return the dot product of the projection, it's meaningless but useful in our SAT case return dot(new Vect(projX,projY)); } public float dot(Vect other){ return (other.x*x + other.y*y); } }

    Read the article

  • How do I know if I've gone too far with processing things in a game?

    - by ThePlan
    A common programming quote I see every day is: Premature optimization is the root of all evil! I admit I'm one of those guys that like to do premature optimization in a pretty obssessive manner but that's probably because I'm not aware how powerful modern processors are. I can think of lots of sollutions for a problem, but all of them are tough on the memory side, and I keep thinking "This will hurt me more in the future when I'll have to re-do it because it's bad performance-wise." How do you know when the code you are thinking of is going too far and is not a case of premature optimization? How much can your game handle at a time before performance becomes a problem?

    Read the article

  • Choosing a mobile advertising mediator over going it alone

    - by Notbad
    We have finished our first game for IOS/Android. We would like to give it away adding ads to it. I have been reading a lot about the subject but it is a bit overwhelming for starters. From what I read, it seems there are some important points to have into consideration: 1) Do as much localization as you can (target your audience with ads they could be interested for the zone they live in). 2) Do not over advertise in your application. At this moment we have decided to go with AdMob. It seems an easy option to setup for beginners and have a good set of ad networks. My question is, will we earn less for example for iAds using adMob than implementing iAds without a mediator? Are adMob paying less than others (this is what I remember for some artilces I read)?. It would be nice to hear from people with experience on this to let us light our way a bit.

    Read the article

  • importing modules in app engine

    - by tanky
    Ive asked this before, but it seems i wasnt clear/detailed enough and after a week of trying im still struggling so i will try again. i am trying to use, oauth2 and ply on app engine. i have tried copying their directories into my app engine project directory (in the form ply-3.4 or brosner-python-oauth2-82a05f9) and i have tried copying the specific sub directory contained within the aforemention one. (ply or oauth2) i have tried saying import oauth2, from brosner-oauth2_python-82a05f9 import oauth and other variations on the theme, but i still cant get it to work nothing has worked. i have tried including them in app.yaml, but that seemed to create an even bigger error as my entire project wouldnt even run when i tried that. and now i have run out of things to try. the error log i am getting is as follows. INFO 2012-10-20 22:33:29,358 dev_appserver.py:2884] "GET / HTTP/1.1" 500 - WARNING 2012-10-20 22:33:58,453 py_zipimport.py:139] Can't open zipfile C:\Python27\lib\site-packages\oauth2-1.0.2-py2.7.egg: IOError: [Errno 13] file not accessible: 'C:\Python27\lib\site-packages\oauth2-1.0.2-py2.7.egg' WARNING 2012-10-20 22:33:58,453 py_zipimport.py:139] Can't open zipfile C:\Python27\lib\site-packages\ply-3.4-py2.7.egg: IOError: [Errno 13] file not accessible: 'C:\Python27\lib\site-packages\ply-3.4-py2.7.egg' WARNING 2012-10-20 22:33:58,453 py_zipimport.py:139] Can't open zipfile C:\Python27\lib\site-packages\tweepy-1.11-py2.7.egg: IOError: [Errno 13] file not accessible: 'C:\Python27\lib\site-packages\tweepy-1.11-py2.7.egg' ERROR 2012-10-20 22:34:00,015 wsgi.py:189] Traceback (most recent call last): File "C:\Program Files\Google\google_appengine\google\appengine\runtime\wsgi.py", line 187, in Handle handler = _config_handle.add_wsgi_middleware(self._LoadHandler()) File "C:\Program Files\Google\google_appengine\google\appengine\runtime\wsgi.py", line 225, in _LoadHandler handler = import(path[0]) File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 676, in Decorate return func(self, *args, **kwargs) File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 1850, in load_module return self.FindAndLoadModule(submodule, fullname, search_path) File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 676, in Decorate return func(self, *args, **kwargs) File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 1722, in FindAndLoadModule description) File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 676, in Decorate return func(self, *args, **kwargs) File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 1665, in LoadModuleRestricted description) File "C:\Documents and Settings\ladds\My Documents\udacity\sigh\main.py", line 3, in import ply ImportError: No module named ply INFO 2012-10-20 22:34:00,030 dev_appserver.py:2884] "GET / HTTP/1.1" 500 - thanks for any help.

    Read the article

  • How to change a sub layout dynamically

    - by user1762121
    I am newbie in android, but I want to change the contents of a layout, that is inside another layout, due to clicks on buttons. ----------------------------- | Button | Button | Button | ----------------------------- | | | Layout that changes | | dynamically | | | | | ------------------------------ Thanks

    Read the article

  • Why does iOS 5 fail to connect to a server running JDK 1.6, but not JDK 1.5

    - by KC Baltz
    We have a Java Socket Server listening on an SSLSocket (port 443) and an iOS application that connects with it. When running on iOS 5.1, the application stopped working when we upgraded the Java version of the server from JDK 1.5 to 1.6 (or 1.7). The app connects just fine to JDK 5 and 6 when running on iOS 6. The iOS app is reporting an error: -9809 = errSSLCrypto. On the Java side, we get javax.net.ssl.SSLException: Received fatal alert: close_notify. On the Java server side, we have enabled all the available cipher suites. On the client side we have tested enabling several different suites, although we have yet to complete a test involving each one individually enabled. Right now, it is failing when we use TLS_DH_anon_WITH_AES_128_CBC_SHA although it has failed with others and we are starting to think it's not the suite. Here is the debug output. It makes it all the way to ServerHelloDone and then fails shortly thereafter: Is secure renegotiation: false [Raw read]: length = 5 0000: 16 03 03 00 41 ....A [Raw read]: length = 65 0000: 01 00 00 3D 03 03 50 83 1E 0B 56 19 25 65 C8 F2 ...=..P...V.%e.. 0010: AF 02 AD 48 FE E2 92 CF B8 D7 A6 A3 EA C5 FF 5D ...H...........] 0020: 74 0F 1B C1 99 18 00 00 08 00 FF 00 34 00 1B 00 t...........4... 0030: 18 01 00 00 0C 00 0D 00 08 00 06 05 01 04 01 02 ................ 0040: 01 . URT-, READ: Unknown-3.3 Handshake, length = 65 *** ClientHello, Unknown-3.3 RandomCookie: GMT: 1333992971 bytes = { 86, 25, 37, 101, 200, 242, 175, 2, 173, 72, 254, 226, 146, 207, 184, 215, 166, 163, 234, 197, 255, 93, 116, 15, 27, 193, 153, 24 } Session ID: {} Cipher Suites: [TLS_EMPTY_RENEGOTIATION_INFO_SCSV, TLS_DH_anon_WITH_AES_128_CBC_SHA, SSL_DH_anon_WITH_3DES_EDE_CBC_SHA, SSL_DH_anon_WITH_RC4_128_MD5] Compression Methods: { 0 } Unsupported extension signature_algorithms, data: 00:06:05:01:04:01:02:01 *** [read] MD5 and SHA1 hashes: len = 65 0000: 01 00 00 3D 03 03 50 83 1E 0B 56 19 25 65 C8 F2 ...=..P...V.%e.. 0010: AF 02 AD 48 FE E2 92 CF B8 D7 A6 A3 EA C5 FF 5D ...H...........] 0020: 74 0F 1B C1 99 18 00 00 08 00 FF 00 34 00 1B 00 t...........4... 0030: 18 01 00 00 0C 00 0D 00 08 00 06 05 01 04 01 02 ................ 0040: 01 . %% Created: [Session-1, TLS_DH_anon_WITH_AES_128_CBC_SHA] *** ServerHello, TLSv1 RandomCookie: GMT: 1333992972 bytes = { 100, 3, 56, 153, 7, 2, 251, 64, 41, 32, 66, 240, 227, 181, 55, 190, 2, 237, 146, 0, 73, 119, 70, 0, 160, 9, 28, 207 } Session ID: {80, 131, 30, 12, 241, 73, 52, 38, 46, 41, 237, 226, 199, 246, 156, 45, 3, 247, 182, 43, 223, 8, 49, 169, 188, 63, 160, 41, 102, 199, 50, 190} Cipher Suite: TLS_DH_anon_WITH_AES_128_CBC_SHA Compression Method: 0 Extension renegotiation_info, renegotiated_connection: <empty> *** Cipher suite: TLS_DH_anon_WITH_AES_128_CBC_SHA *** Diffie-Hellman ServerKeyExchange DH Modulus: { 233, 230, 66, 89, 157, 53, 95, 55, 201, 127, 253, 53, 103, 18, 11, 142, 37, 201, 205, 67, 233, 39, 179, 169, 103, 15, 190, 197, 216, 144, 20, 25, 34, 210, 195, 179, 173, 36, 128, 9, 55, 153, 134, 157, 30, 132, 106, 171, 73, 250, 176, 173, 38, 210, 206, 106, 34, 33, 157, 71, 11, 206, 125, 119, 125, 74, 33, 251, 233, 194, 112, 181, 127, 96, 112, 2, 243, 206, 248, 57, 54, 148, 207, 69, 238, 54, 136, 193, 26, 140, 86, 171, 18, 122, 61, 175 } DH Base: { 48, 71, 10, 213, 160, 5, 251, 20, 206, 45, 157, 205, 135, 227, 139, 199, 209, 177, 197, 250, 203, 174, 203, 233, 95, 25, 10, 167, 163, 29, 35, 196, 219, 188, 190, 6, 23, 69, 68, 64, 26, 91, 44, 2, 9, 101, 216, 194, 189, 33, 113, 211, 102, 132, 69, 119, 31, 116, 186, 8, 77, 32, 41, 216, 60, 28, 21, 133, 71, 243, 169, 241, 162, 113, 91, 226, 61, 81, 174, 77, 62, 90, 31, 106, 112, 100, 243, 22, 147, 58, 52, 109, 63, 82, 146, 82 } Server DH Public Key: { 8, 60, 59, 13, 224, 110, 32, 168, 116, 139, 246, 146, 15, 12, 216, 107, 82, 182, 140, 80, 193, 237, 159, 189, 87, 34, 18, 197, 181, 252, 26, 27, 94, 160, 188, 162, 30, 29, 165, 165, 68, 152, 11, 204, 251, 187, 14, 233, 239, 103, 134, 168, 181, 173, 206, 151, 197, 128, 65, 239, 233, 191, 29, 196, 93, 80, 217, 55, 81, 240, 101, 31, 119, 98, 188, 211, 52, 146, 168, 127, 127, 66, 63, 111, 198, 134, 70, 213, 31, 162, 146, 25, 178, 79, 56, 116 } Anonymous *** ServerHelloDone [write] MD5 and SHA1 hashes: len = 383 0000: 02 00 00 4D 03 01 50 83 1E 0C 64 03 38 99 07 02 ...M..P...d.8... 0010: FB 40 29 20 42 F0 E3 B5 37 BE 02 ED 92 00 49 77 .@) B...7.....Iw 0020: 46 00 A0 09 1C CF 20 50 83 1E 0C F1 49 34 26 2E F..... P....I4&. 0030: 29 ED E2 C7 F6 9C 2D 03 F7 B6 2B DF 08 31 A9 BC ).....-...+..1.. 0040: 3F A0 29 66 C7 32 BE 00 34 00 00 05 FF 01 00 01 ?.)f.2..4....... 0050: 00 0C 00 01 26 00 60 E9 E6 42 59 9D 35 5F 37 C9 ....&.`..BY.5_7. 0060: 7F FD 35 67 12 0B 8E 25 C9 CD 43 E9 27 B3 A9 67 ..5g...%..C.'..g 0070: 0F BE C5 D8 90 14 19 22 D2 C3 B3 AD 24 80 09 37 ......."....$..7 0080: 99 86 9D 1E 84 6A AB 49 FA B0 AD 26 D2 CE 6A 22 .....j.I...&..j" 0090: 21 9D 47 0B CE 7D 77 7D 4A 21 FB E9 C2 70 B5 7F !.G...w.J!...p.. 00A0: 60 70 02 F3 CE F8 39 36 94 CF 45 EE 36 88 C1 1A `p....96..E.6... 00B0: 8C 56 AB 12 7A 3D AF 00 60 30 47 0A D5 A0 05 FB .V..z=..`0G..... 00C0: 14 CE 2D 9D CD 87 E3 8B C7 D1 B1 C5 FA CB AE CB ..-............. 00D0: E9 5F 19 0A A7 A3 1D 23 C4 DB BC BE 06 17 45 44 ._.....#......ED 00E0: 40 1A 5B 2C 02 09 65 D8 C2 BD 21 71 D3 66 84 45 @.[,..e...!q.f.E 00F0: 77 1F 74 BA 08 4D 20 29 D8 3C 1C 15 85 47 F3 A9 w.t..M ).<...G.. 0100: F1 A2 71 5B E2 3D 51 AE 4D 3E 5A 1F 6A 70 64 F3 ..q[.=Q.M>Z.jpd. 0110: 16 93 3A 34 6D 3F 52 92 52 00 60 08 3C 3B 0D E0 ..:4m?R.R.`.<;.. 0120: 6E 20 A8 74 8B F6 92 0F 0C D8 6B 52 B6 8C 50 C1 n .t......kR..P. 0130: ED 9F BD 57 22 12 C5 B5 FC 1A 1B 5E A0 BC A2 1E ...W"......^.... 0140: 1D A5 A5 44 98 0B CC FB BB 0E E9 EF 67 86 A8 B5 ...D........g... 0150: AD CE 97 C5 80 41 EF E9 BF 1D C4 5D 50 D9 37 51 .....A.....]P.7Q 0160: F0 65 1F 77 62 BC D3 34 92 A8 7F 7F 42 3F 6F C6 .e.wb..4....B?o. 0170: 86 46 D5 1F A2 92 19 B2 4F 38 74 0E 00 00 00 .F......O8t.... URT-, WRITE: TLSv1 Handshake, length = 383 [Raw write]: length = 388 0000: 16 03 01 01 7F 02 00 00 4D 03 01 50 83 1E 0C 64 ........M..P...d 0010: 03 38 99 07 02 FB 40 29 20 42 F0 E3 B5 37 BE 02 .8....@) B...7.. 0020: ED 92 00 49 77 46 00 A0 09 1C CF 20 50 83 1E 0C ...IwF..... P... 0030: F1 49 34 26 2E 29 ED E2 C7 F6 9C 2D 03 F7 B6 2B .I4&.).....-...+ 0040: DF 08 31 A9 BC 3F A0 29 66 C7 32 BE 00 34 00 00 ..1..?.)f.2..4.. 0050: 05 FF 01 00 01 00 0C 00 01 26 00 60 E9 E6 42 59 .........&.`..BY 0060: 9D 35 5F 37 C9 7F FD 35 67 12 0B 8E 25 C9 CD 43 .5_7...5g...%..C 0070: E9 27 B3 A9 67 0F BE C5 D8 90 14 19 22 D2 C3 B3 .'..g......."... 0080: AD 24 80 09 37 99 86 9D 1E 84 6A AB 49 FA B0 AD .$..7.....j.I... 0090: 26 D2 CE 6A 22 21 9D 47 0B CE 7D 77 7D 4A 21 FB &..j"!.G...w.J!. 00A0: E9 C2 70 B5 7F 60 70 02 F3 CE F8 39 36 94 CF 45 ..p..`p....96..E 00B0: EE 36 88 C1 1A 8C 56 AB 12 7A 3D AF 00 60 30 47 .6....V..z=..`0G 00C0: 0A D5 A0 05 FB 14 CE 2D 9D CD 87 E3 8B C7 D1 B1 .......-........ 00D0: C5 FA CB AE CB E9 5F 19 0A A7 A3 1D 23 C4 DB BC ......_.....#... 00E0: BE 06 17 45 44 40 1A 5B 2C 02 09 65 D8 C2 BD 21 ...ED@.[,..e...! 00F0: 71 D3 66 84 45 77 1F 74 BA 08 4D 20 29 D8 3C 1C q.f.Ew.t..M ).<. 0100: 15 85 47 F3 A9 F1 A2 71 5B E2 3D 51 AE 4D 3E 5A ..G....q[.=Q.M>Z 0110: 1F 6A 70 64 F3 16 93 3A 34 6D 3F 52 92 52 00 60 .jpd...:4m?R.R.` 0120: 08 3C 3B 0D E0 6E 20 A8 74 8B F6 92 0F 0C D8 6B .<;..n .t......k 0130: 52 B6 8C 50 C1 ED 9F BD 57 22 12 C5 B5 FC 1A 1B R..P....W"...... 0140: 5E A0 BC A2 1E 1D A5 A5 44 98 0B CC FB BB 0E E9 ^.......D....... 0150: EF 67 86 A8 B5 AD CE 97 C5 80 41 EF E9 BF 1D C4 .g........A..... 0160: 5D 50 D9 37 51 F0 65 1F 77 62 BC D3 34 92 A8 7F ]P.7Q.e.wb..4... 0170: 7F 42 3F 6F C6 86 46 D5 1F A2 92 19 B2 4F 38 74 .B?o..F......O8t 0180: 0E 00 00 00 .... [Raw read]: length = 5 0000: 15 03 01 00 02 ..... [Raw read]: length = 2 0000: 02 00 .. URT-, READ: TLSv1 Alert, length = 2 URT-, RECV TLSv1 ALERT: fatal, close_notify URT-, called closeSocket() URT-, handling exception: javax.net.ssl.SSLException: Received fatal alert: close_notify FYI, this works in iOS 6.0

    Read the article

  • OnClickListener onClick=true and selector

    - by azerto00
    I have not found any answer for my problem, so I need your help ... I have an LinearLayout which I want to be clickable in order to lunch another activity. So I implement an onClickListener to it. I created an selector for this LinearLayout in order that what someone click on it, the background change. I just don't understand that : If my LinearLayout doesn't have android:clickable="true" in the xml, I'm able to click on it and get what I want but the selector doesn't work. If I remove this line, it is the opposite .. the selector work but not the onClick event. So, can anyone can explain me why ? Just in case, here is my the content of my selector file : <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/btn_restaurants_background_state_pressed" android:state_pressed="true"></item> <item android:drawable="@drawable/btn_restaurants_background_state_pressed" android:state_focused="true"></item> <item android:drawable="@drawable/btn_restaurants_background_state_pressed" android:state_selected="true"></item> <item android:drawable="@drawable/btn_restaurants_background_state_normal"></item> </selector> Thanks you in advance

    Read the article

  • Accessing a vector<vector<int>> as a flat array

    - by user1762276
    For this array: vector<vector<int> > v; v.push_back(vector<int>(0)); v.back().push_back(1); v.back().push_back(2); v.back().push_back(3); v.back().push_back(4); I can output {1, 2, 3, 4} easily enough: cout << v[0][0] << endl; cout << v[0][1] << endl; cout << v[0][2] << endl; cout << v[0][3] << endl; To access it as a flat array I can do this: int* z = (int*)&v[0].front(); cout << z[0] << endl; cout << z[1] << endl; cout << z[2] << endl; cout << z[3] << endl; Now, how do I access the multidimensional vector as a flat multidimensional array? I cannot use the same format as accessing a single-dimensional vector: // This does not work (outputs garbage) int** n = (int**)&v.front(); cout << n[0][0] << endl; cout << n[0][1] << endl; cout << n[0][2] << endl; cout << n[0][3] << endl; The workaround I've found is to do this: int** n = new int* [v.size()]; for (size_t i = 0; i < v.size(); i++) { n[i] = &v.at(i).front(); } cout << n[0][0] << endl; cout << n[0][1] << endl; cout << n[0][2] << endl; cout << n[0][3] << endl; Is there a way to access the entire multidimensional vector like a flat c-style array without having to dynamically allocate each dimension above the data before accessing it? Speed is not critical in the implementation and clarity for maintenance is paramount. A multidimensional vector is just fine for storing the data. However, I want to also expose the data as a flat c-style array in the SDK so that it can be easily accessible by other languages. This means that exposing the vectors as an STL object is a no go. The solution I came up with works fine for my needs as I only evaluate the array once at the very end of processing to "flatten" it. However, is there a better way to go about this? Or am I already doing it the best way I possibly can without re-implementing my own data structure (overkill since my flatten code is only a few lines). Thank you for your advice, friends!

    Read the article

  • Accessing object's method within string

    - by Wild One
    Recently I was reading php documentation and found interesting note in string section: Functions, method calls, static class variables, and class constants inside {$} work since PHP 5. However, the value accessed will be interpreted as the name of a variable in the scope in which the string is defined. Using single curly braces ({}) will not work for accessing the return values of functions or methods or the values of class constants or static class variables. See www.php.net/manual/en/language.types.string.php It says, that I can't use curly syntax to get value returned by object's method call. Is it a mistake in manual or I misunderstood it, because I tried the following code and it works just fine: <?php class HelloWorld { public static function hello() { echo 'hello'; } } $a = new HelloWorld(); echo "{$a->hello()} world";

    Read the article

  • MySQL DDL error creating tables

    - by Alexandstein
    I am attempting to create tables for a MySQL database, but I am having some syntactical issues. It would seem that syntax checking is behaving differently between tables for some reason. While I've gotten all the other tables to go through, the table, 'stock' doesn't seem to be working, despite seeming to use the same syntax patterns. CREATE TABLE users ( user_id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT, username VARCHAR(30) NOT NULL, password CHAR(41) NOT NULL, date_joined DATETIME NOT NULL, funds DOUBLE UNSIGNED NOT NULL, PRIMARY KEY(user_id), UNIQUE KEY(username) ); CREATE TABLE owned_stocks ( id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT, user_id SMALLINT UNSIGNED NOT NULL, paid_price DOUBLE UNSIGNED NOT NULL, quantity MEDIUMINT UNSIGNED NOT NULL, purchase_date DATETIME NOT NULL, PRIMARY KEY(id) ); CREATE TABLE tracking_stocks ( ticker VARCHAR(5) NOT NULL, user_id SMALLINT UNSIGNED NOT NULL, PRIMARY KEY(ticker) ); CREATE TABLE stocks ( ticker VARCHAR(5) NOT NULL, last DOUBLE UNSIGNED NOT NULL, high DOUBLE UNSIGNED NOT NULL, low DOUBLE UNSIGNED NOT NULL, company_name VARCHAR(30) NOT NULL, last_updated INT UNSIGNED NOT NULL, change DOUBLE NOT NULL, percent_change DOUBLE NOT NULL, PRIMARY KEY(ticker) ); Am I just missing a really obvious syntactical issue? ERROR: #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'change DOUBLE NOT NULL, percent_change DOUBLE NOT NULL, last DOUBLE' at line 4

    Read the article

  • Making it look like the computer is thinking in TicTacToe game

    - by rage
    here is a slice of code that i've written in VB.net Private Sub L00_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles L00.Click, L01.Click, L02.Click, L03.Click, L10.Click, L11.Click, L12.Click, L13.Click, L20.Click, L21.Click, L22.Click, L23.Click, L30.Click, L31.Click, L32.Click, L33.Click Dim ticTac As Label = CType(sender, Label) Dim strRow As String Dim strCol As String 'Once a move is made, do not allow user to change whether player/computer goes first, because it doesn't make sense to do so since the game has already started. ComputerFirstStripMenuItem.Enabled = False PlayerFirstToolStripMenuItem.Enabled = False 'Check to make sure clicked tile is a valid tile i.e and empty tile. If (ticTac.Text = String.Empty) Then ticTac.Text = "X" ticTac.ForeColor = ColorDialog1.Color ticTac.Tag = 1 'After the player has made his move it becomes the computers turn. computerTurn(sender, e) Else MessageBox.Show("Please pick an empty tile to make next move", "Invalid Move") End If End Sub Private Sub computerTurn(ByVal sender As System.Object, ByVal e As System.EventArgs) Call Randomize() row = Int(4 * Rnd()) col = Int(4 * Rnd()) 'Check to make sure clicked tile is a valid tile i.e and empty tile. If Not ticTacArray(row, col).Tag = 1 And Not ticTacArray(row, col).Tag = 4 Then ticTacArray(row, col).Text = "O" ticTacArray(row, col).ForeColor = ColorDialog2.Color ticTacArray(row, col).Tag = 4 checkIfGameOver(sender, e) Else 'Some good ole pseudo-recursion(doesn't require a base case(s)). computerTurn(sender, e) End If End Sub Everything works smoothly, except i'm trying to make it seem like the computer has to "think" before making its move. So what i've tried to do is place a System.Threading.Sleep() call in different places in the code above. The problem is that instead of making the computer look like its thinking, the program waits and then puts the X and O together at the same time. Can someone help me make it so that the program puts an X wherever i click AND THEN wait before it places an O? Edit: in case any of you are wondering, i realize that the computers AI is ridiculously dumb, but its just to mess around right now. Later on i will implement a serious AI..hopefully.

    Read the article

  • Returning a private variable in JavaScript

    - by enrmarc
    I don't know why console.log(Set.current_index) shows 0 instead of 3. var Set = (function() { var set = []; var index = 0; function contains(set, e) { for (var i = 0; i < set.length; i++) { if (set[i] === e) { return true; } } return false; } var add = function(e) { if (!contains(set, e)) { set[index++] = e; } } var show = function() { for (var i = 0; i < set.length; i++) { console.log(set[i]); } } return { add: add, show: show, current_index: index }; })();? Set.add(20); Set.add(30); Set.add(40); Set.show(); console.log(Set.current_index);

    Read the article

  • Function for averages of tuples in a dictionary

    - by Billy Mann
    I have a string, dictionary in the form: ('the head', {'exploded': (3.5, 1.0), 'the': (5.0, 1.0), "puppy's": (9.0, 1.0), 'head': (6.0, 1.0)}) Each parentheses is a tuple which corresponds to (score, standard deviation). I'm taking the average of just the first integer in each tuple. I've tried this: def score(string, d): for word in d: (score, std) = d[word] d[word]=float(score),float(std) if word in string: word = string.lower() number = len(string) return sum([v[0] for v in d.values()]) / float(len(d)) if len(string) == 0: return 0 When I run: print score('the head', {'exploded': (3.5, 1.0), 'the': (5.0, 1.0), "puppy's": (9.0, 1.0), 'head': (6.0, 1.0)}) I should get 5.5 but instead I'm getting 5.875. Can't figure out what in my function is not allowing me to get the correct answer.

    Read the article

  • Assistance with regular expressions in Python

    - by da5id
    I am still learning REGEX, and I've run into an issue ... I am trying to separate a string that is composed of a mixture of letters and numbers that are in decimal format: AB0.500CD1.05EF2.29 Into something like this: list1 = AB,CD,EF list2 = 0.500,1.05,2.29 A complication to all this is that I also have strings that look like this: AB1CD2EF3 Which I'd also like to separate into this: list1 = AB,CD,EF list2 = 1,2,3 A previous inquiry yielded the following snippet, import re pattern = re.compile(r'([a-zA-Z]+)([0-9]+)') for (letters, numbers) in re.findall(pattern,cmpnd): print numbers print letters This example works fine for strings of the 2nd kind, but only "finds" the leading digit in the numbers that contain decimal places in the strings of the first kind. I've attempted an approach using the following line: pattern = re.compile(r'([a-zA-Z]+)([0-9]+(\.[0-9]))') But this results in an error: "ValueError: too many values to unpack" Thanks for any and all assistance!

    Read the article

< Previous Page | 5 6 7 8 9 10 11 12 13 14  | Next Page >