Daily Archives

Articles indexed Thursday December 23 2010

Page 3/28 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Highlight image borders with Ajax request.

    - by Tek
    First, some visualization of the code. I have the following images that are dynamically generated from jquery. They're made upon user request: <img id="i13133" src="someimage.jpg" /> <img id="i13232" src="someimage1.jpg" /> <img id="i14432" src="someimage2.jpg" /> <img id="i16432" src="someimage3.jpg" /> <img id="i18422" src="someimage4.jpg" /> I have an AJAX loop that repeats every 15 seconds using jQuery and it contains the following code: Note: The if statement is inside the Ajax loop. Where imgId is the requested ID from the Ajax call. //Passes the IDs retrieved from Ajax, if the IDs exist on the page the animation is triggered. if ( $('#i' + imgId ).length ) { var pickimage = '#i' + imgId; var stop = false; function highlight(pickimage) { $(pickimage).animate({color: "yellow"}, 1000, function () { $(pickimage ).animate({color: "black"}, 1000, function () { if (!stop) highlight(pickimage); }); }); } // Start the loop highlight(pickimage); } It works great, even with multiple images. But I had originally used this with one image. The problem is I need an interrupt. Something like: $(img).click(function () { stop = true; }); There's two problems: 1.)This obviously stops all animations. I can't wrap my head around how I could write something that only stops the animation of the image that's clicked. 2.)The Ajax retrieves IDs, sometimes those IDs appear more than once every few minutes, which means it would repeat the animations on top of each other if the image exists. I could use some help figuring out how to detect if an animation is already running on an image, and do nothing if the animation is already triggered on an image.

    Read the article

  • Really strange problem with jailbroken iPhone 4. Lags but fixes by running Cydia a second

    - by Charkel
    I have jailbreaked my iPhone 4 iOS 4.1 with both limera1n and greenpois0n and the outcome is the same. My phone is really slow opening apps. (including Phone.app an SMS.app) they take about 10-15seconds to load. BUT if I start Cydia for only one second everything goes back to normal. (Please note that I have to have 3G or WI-FI access to do this) Until I let my phone sit for about 15 minutes then it's the same again. Please note that if I don't exit the apps they seem to continue working but with a bit of lag. Cydia also seems to be the only app not affected by the delay. "Loding Data" appears as quick as normal. These issues did not start to appear until about 2 weeks after I jailbreaked my phone. I have tried running "speed test" while it's in its slow state. I start the app and the app loads for like 15 seconds and then the result shows everyhting is good. All green. Since Cydia seems for fix it temporarily i figured it's jailbreak-related and not hardware-related.

    Read the article

  • How to generate a user role grid

    - by Svish
    I have the following tables: users (id, username, ... ) roles (id, name) roles_users (user_id, role_id) I am wondering how I can create a nice sort of user-role-grid from that which an admin can use to administer roles to users in a clear way. What I would like is basically a table full of checkboxes sort of like this: Login Editor Admin Alice ¦ ¦ ¦ Bob ¦ ? ? Carol ¦ ¦ ? [Apply] Generating the table isn't too much of a deal, but I am very unsure how to handle it when it comes to how to name all the checkboxes and especially how to read and update the database in a not too clumsy way. Does anyone have any good advice or pointers on how to do this in a mostly clean way? I'm using the Kohana 3 framework, if there is anything there that can make this even easier, but I of course welcome any answer.

    Read the article

  • Simple SSH public/private key question

    - by James R.
    I am trying to learn this instead of just following guides so I can recommend proper actions when people do ask (and they do). Here is what I got down. First, generate both key with command such as this: ssh-keygen -b 2048 -t rsa -C comment -f ~/.ssh/id_rsa Then you push the public part of the key into authorized_keys2 file cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys2 (and then chmod it to 600 or similar) And you download the private key to your computer (id_rsa) and feed that in to Putty to be read and authenticate. Are these the correct steps to setting this public/private key authentication for passwordless login to SSH?

    Read the article

  • Deploy our own software using Puppet?

    - by Ken
    (Apologies in advance for the stupidity in this question. I'm normally a programmer, not a sysadmin, but I've taken it upon myself to automate some things, and clean up some other things which are automated but not in the prettiest way. :-) I've been looking around at various tools for automation of software deployment to a bunch of servers, like cfengine, Puppet, and Chef. So far, Puppet looks the most appealing, but I've certainly not committed to anything yet. These tools all look like they can do a great job of keeping a bunch of servers up-to-date with prepackaged software. What I don't get is: how does one use a tool (like Puppet) to manage deployments of our own internal software? I think I'm at a loss because I've seen a thousand tutorials showing how to keep Apache ensure => latest (which is pretty cool), but nothing that quite corresponds to my use-case today, which is something more like: when a human being pushes The Button, pull branch A from the version-control repository B run command C to compile it copy the binaries D to servers E1 through E10 on each server, run command F to make all changes take effect Puppet sounds great, and I totally see the advantage of declarative, idempotent configuration over some shell scripts, but I've not seen any tutorials for "you want to update your shell scripts to Puppet (or Chef, or cfengine) so here's what you should do". Is there such a thing? Is it obvious to other people how to take the things provided in the Puppet docs and replicate the behavior I want? Am I just not getting it? What it's sounding like to me, so far, is that the human being (#1) would manually package the software (#2 and #3) external to Puppet, manually update the Puppet config, which would trigger Puppet to update the servers ... maybe? (I'm a little confused here, as I'm sure you can tell.) Thanks!

    Read the article

  • directory with 980MB meta data, millions of files, how to delete it? (ext3)

    - by Alexandre
    Hello, So I'm stuck with this directory: drwxrwxrwx 2 dan users 980M 2010-12-22 18:38 sessions2 The directories contents is small - just millions of tiny little files. I want to wipe it from the filesystem but have been unable to. My first try was: find sessions2 -type f -delete and find sessions2 -type f -print0 | xargs -0 rm -f but had to stop because both caused escalating memory usage. At one point it was using 65% of the system's memory. So I thought (no doubt incorrectly), that it had to do with the fact that dir_index was enabled on the system. Perhaps find was trying to read the entire index into memory? So I did this (foolishly): tune2fs -O^dir_index /dev/xxx Alright, so that should do it. Ran the find command above again and... same thing. Crazy memory usage. I hurriedly ran tune2fs -Odir_index /dev/xxx to reenable dir_index, and ran to Server Fault! 2 questions: 1) How do I get rid of this directory on my live system? I don't care how long it takes, as long as it uses little memory and little CPU. By the way, using nice find ... I was able to reduce CPU usage, so my problem right now is only memory usage. 2) I disabled dir_index for about 20 minutes. No doubt new files were written to the filesystem in the meanwhile. I reenabled dir_index. Does that mean the system will not find the files that were written before dir_index was reenabled since their filenames will be missing from the old indexes? If so and I know these new files aren't important, can I maintain the old indexes? If not, how do I rebuild the indexes? Can it be done on a live system? Thanks!

    Read the article

  • Apache RewriteRule with a RewriteMap variable substitution for the VAL argument to environment variable

    - by Eric
    I have an Apache server that serves up binary files to an application (not a browser). The application making the request wants the HTTP Content-MD5 header in HEX format. The default and only option within Apache is Base64. If I add "ContentDigest on" to my VirtualHost, I get this header in Base64. So I wrote a perl script, md5digesthex.pl, that gives me exactly what I want: MD5 in HEX format but I'm struggling with the RewriteRule to get my server to send the result. Here is my current Rewrite recipe: RewriteEngine on RewriteMap md5inhex prg:/www/download/md5digesthex.pl RewriteCond %{REQUEST_URI} ^/download/(.*) RewriteRule ^(.*) %{REQUEST_URI} [E=HASH:${md5inhex:$1}] Header set Content-MD5 "%{HASH}e" env=HASH The problem is that I can't seem to set the HASH environment variable based on the output of the md5inhex map function. It appears this behavior is not supported and I'm at a lost as to how to formulate this...

    Read the article

  • Terminal command to send data (plain text string) to a port at a remote computer.

    - by Eddy
    I am trying to send data (plain text string) to a port at a remote computer using terminal utility. The string would be used to trigger something on the remote computer running a program that would listen to that specific port. I used netcat command and tried a few combination of the following but can't seem to get the parameter right. Can someone point me out where am I doing wrong? eddy-2:Desktop eddy$ nc IPADDRESS PORT woc.txt eddy-2:Desktop eddy$ nc IPADDRESS PORT < woc.txt P.S: woc.txt contains plain text string of the said command. Edit: I am trying to send a string from OSX to Windows XP where the specific port is open by default.

    Read the article

  • How can I restore my system from WIM files?

    - by Brian Henk
    I installed another OS on my netbook and decided I want to revert back to Windows 7 Starter. I was careful to keep the recovery partition, but even when I manage to boot to it, the system just restarts a few seconds after selecting "restore." I grabbed all the files from the recovery partition onto a flash drive. I also have been able to use this drive to boot a Windows 7 install, but it was unable to find the recovery partition. These WIM files seem to be the key to installing Windows again. How can I use them?

    Read the article

  • Copy from CDROM is very slow in Ubuntu

    - by ???
    I'm using the command to copy CDROM image: # dd if=/dev/sr0 of=./maverick.iso But it's very slow, at about 350k bytes/sec. I've searched the google, and try the command # hdparm -vi /dev/sr0 /dev/sr0: HDIO_DRIVE_CMD(identify) failed: Bad address IO_support = 1 (32-bit) readonly = 0 (off) readahead = 256 (on) HDIO_GETGEO failed: Inappropriate ioctl for device Model=DVD-ROM UJDA775, FwRev=DA03, SerialNo= Config={ Fixed Removeable DTR<=5Mbs DTR>10Mbs nonMagnetic } RawCHS=0/0/0, TrkSize=0, SectSize=0, ECCbytes=0 BuffType=unknown, BuffSize=unknown, MaxMultSect=0 (maybe): CurCHS=0/0/0, CurSects=0, LBA=yes, LBAsects=0 IORDY=yes, tPIO={min:180,w/IORDY:120}, tDMA={min:120,rec:120} PIO modes: pio0 pio1 pio2 pio3 pio4 DMA modes: sdma0 sdma1 sdma2 mdma0 mdma1 mdma2 UDMA modes: udma0 udma1 *udma2 AdvancedPM=no Drive conforms to: ATA/ATAPI-5 T13 1321D revision 3: ATA/ATAPI-1,2,3,4,5 * signifies the current active mode Seems like DMA is already on. And a device test gives: # hdparm -t /dev/sr0 /dev/sr0: Timing buffered disk reads: 2 MB in 6.58 seconds = 311.10 kB/sec # sudo hdparm -tT /dev/sr0 /dev/sr0: Timing cached reads: 2 MB in 2.69 seconds = 760.96 kB/sec Timing buffered disk reads: m 4 MB in 5.19 seconds = 789.09 kB/sec The CD-ROM device and disc should be okay because I can copy it very fast in Windows, using UltraISO utility. So I guess there is something not configured right in Ubuntu, is it?

    Read the article

  • convert full-disk RAID5 array to partition-based array?

    - by Delan Azabani
    I have a RAID 5 array, md0, with three full-disk (non-partitioned) members, sdb, sdc, and sdd. My computer will hang during the AHCI BIOS if AHCI is enabled instead of IDE, if these drives are plugged in. I believe it may be because I'm using the whole disk, and the AHCI BIOS expects an MBR to be on the drive (I don't know why it would care). Is there a way to convert the array to use members sdb1, sdc1 and sdd1, partitioned MBR with 0xFD RAID partitions?

    Read the article

  • (iphone) How to access CGRect member variable inside c++ class?

    - by Eugene
    i have a c++ class with CGrect variable and i'm getting segfault when trying to access it. class Parent { //with some virtual functions/dtors }; class Child { public: void SetRect(CGRect rect) { mRect = rect; } CGRect GetRect() { return mRect; } int GetIndex() { return mIndex; } private: CGRect mRect; int mIndex; }; i'm doing CGRect rect = childPtr->GetRect(); from object c code and it segfaults. I printed *childPtr just before the call and rect looks fine with intended data value. int index = childPtr->GetIndex(); from same object c code(*.mm), works fine though. Any idea why I'm getting segfaults? Thank you edit - It's got something to do with virtual functions. (gdb) p singlePuzzlePiece-GetRect() Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: KERN_PROTECTION_FAILURE at address: 0x00000001 0x00000001 in ?? () Cannot access memory at address 0x1 The program being debugged was signaled while in a function called from GDB. GDB remains in the frame where the signal was received. To change this behavior use "set unwindonsignal on" Evaluation of the expression containing the function (at 0x1) will be abandoned. (gdb) Somehow, the function is not properly compiled?

    Read the article

  • Git checkout doesn't change anything, and it's getting very frustrating

    - by Josh
    I really like git. At least, I like the idea of git. Being able to checkout my master project as a separate branch where I can change whatever I want without risk of screwing everything else up is awesome. But it's not working. Every time I checkout a branch to another branch, make changes to the one branch, and then checkout the original branch, I still have all the files and changes that happened in the other branch. This is getting extremely frustrating. I've read that this can happen when you have files open in the IDE while doing this, but I've been pretty careful about that and both closed the files in the IDE, closed the IDE, and shut down my rails server before switching branches, and this still happens. Also, running 'git clean -f' either deletes everything that happened after some arbitrary commit (and randomly, at that), or, as in the latest case, didn't change anything back to its original state. I thought I was using git correctly, but at this point, I'm at my wit's end here. I'm trying to work with a bunch of experimental code using a stable version of my project, but I keep having to manually track down and fix all the changes I made. Any ideas or suggestions? git checkout -b photo_tagging git branch # to make sure it's right # make a bunch of changes, creations, etc git status # see what's changed since before git add . # approve of the changes, I guess, since if I do git commit after this, it says no changes git commit -m 'these are changes I made' git checkout master git branch #=> *master # look at files, tags_controller is still there, added in photo_tagging # and code added in photo_tagging branch are still there in *master This seems to happen whether I do a commit or not on the branch.

    Read the article

  • Ruby: Add a method to the class of an input parameter

    - by TJB
    I'm just exploring ruby and was wondering about the theoretical possibility of adding a method to the class of an object. For example, define a method that takes in a parameter and would add a method to the class of that parameter (not just to the parameter object itself). Something like this example: class SomeClass end class AnotherClass end alpha = SomeClass.new beta = AnotherClass.new def AddHelloMethodTo param # This is where I'm trying to # add a method to the class of the parameter def param.class.Hello "Hello" end end AddHelloMethodTo alpha AddHelloMethodTo beta gamma = AnotherClass.new alpha.Hello beta.Hello gamma.Hello (Excuse me if I have syntax errors / typos I'm REALLY new to this!) Notice how I don't call the AddHelloMethodTo on gamma but I expect Hello to be defined because I added it to the class. Is this possible?

    Read the article

  • Android WebView viewport

    - by alex2k8
    With html below I expected that the green rectangle would occupy only half of the screen, but on practice it occupies the whole screen width. I tried other values for viewport width, no luck. Any ideas why it does not work? Html <html> <head> <meta name="viewport" content="width=640" /> </head> <body> <div style="width: 300px; height: 50px; background: green;">300px</div> <div style="width: 600px; height: 50px; background: yellow;">600px</div> </body> </html> Xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <WebView android:id="@+id/web_view" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </LinearLayout>

    Read the article

  • Twitter api and retweets

    - by Juan Manuel
    I'm trying to get the last tweet from the people I follow using the twitter api (http://api.twitter.com/1/statuses/friends.json&screen_name=[username]), but I noticed that if the user's last tweet is a retweet, the json data does not contain a "status" element. Using the "user timeline" api does not work either, the last tweet is the last non retweeted tweet. Is there a way to get the real last status, even if it's a RT, through the twitter API?

    Read the article

  • QtWebkit and hasPendingEvents() always True

    - by Deorf
    Hello. I use project webkit2png (slightly appended) to take screenshots in Linux. On the server running the latest version QtWebkit and Python 2.6 On some sites (eg 118114.cn) problem and the application hangs forever. Debug shows that the problem in this code snippet: while self.__loading:    if timeout 0 and time.time() = cancelAt:       raise RuntimeError("Request timed out on %s" % url)    while QApplication.hasPendingEvents():       QCoreApplication.processEvents() Full version of the source code is available here (lines 270-275) Somehow Loading-event hangs and hasPendingEvents can not be False. Most of the screenshots are created normally, but sometimes due to some URL drops my app: ( Does anyone know how to solve this problem and why the event hangs?

    Read the article

  • Where can we use "This" in Recursion methode...

    - by T_Geek
    Hi . I have a methode in a static class which try to convert bi*nar*y tre to list I'd like to make a recusion but I couldn't I've implemented some opertation in my class like add,delet,find.it's too easy to implement its . Here is the code class ARB { private: struct BT { int data; BT *l; BT *r; }; struct BT *p; public ARB(); ~ARB(); void del(int n); void add(int n); }; void ARB::del(int num) { //The code ,don't care about it }; main() { // BTR T; T.add(3); T.add(5); }; Here is what should we do to transfert the code from Benary tree tolist LLC ARB::changeit() { LLC x; while(this!=NULL) { x.add(this->data); // if(this.l==NULL) { x.print(); //To print the elemnts of List return(x); } else { x=changeit(this.l); } if(this.r!=NULL) { x.~LLC(); x=changeit(this.r); return(x); } } }

    Read the article

  • .NET Settings File Available Types

    - by Mashmagar
    When modifying a .NET settings file, I'm given a choice of types for a setting. However, not all of the types accessible by my project appear, even in the 'Browse' window. What determines if a type can be used for a setting file setting? I have a type I created that I would like to be able to save, and I want to know what I need to change about it to use it in a settings file. (VS 2008 - .Net 3.5)

    Read the article

  • Hello World Problem in Eclipse with Android 2.3 used min 7 instead of min 9

    - by Gnev
    */I am Having a Similar Problem.......... Any Suggestions/ package com.example.helloandroid6; import android.app.Activity; import android.os.Bundle; import android.widget.TextView; public class HelloAndroid extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); TextView tv = new TextView(this); tv.setText("Hello, Android Developers"); setContentView(tv); } }

    Read the article

  • What jquery rails 3 tutorial has worked well for you?

    - by finneycanhelp
    Hi! I have looked at several tutorials involving rails 3 and jquery. The tutorial at http://www.blog.bridgeutopiaweb.com/post/how-to-use-jquery-for-rails-3/ looked promising. However, I get the errors of document.on is not a function and $("a[data-remote=true]").livequery is not a function I get the feeling that I should look at another tutorial or just use jquery raw and not install a ruby gem for jquery. Any advice? Thanks!

    Read the article

  • Retrieving data from an encrypted text file?

    - by user
    Let's say I have a text file contains my data. data : ab bc de - encrypted data on text file : ba cb ed I want to find bc from text file, so I have to decrypt the text file with this code : SL:=TStringList.create; SL.LoadFromFile(textfile) SLtemp:=TStringList.create; for I := 0 to SL.Count - 1 do SLtemp.Add(ReverseString(SL[i])); //decrypt SL.Free; for I := 0 to SLtemp.Count - 1 do if SLtemp[i] = 'bc' then begin showmessage('found'); break; end; SLtemp.Free; I think my way is wasting resources. I have to load whole file to memory and decrypt them. I need some suggestions here to find quickly a specific line from an encrypted text. Thanks.

    Read the article

  • How to optimize this user ranking query

    - by James Simpson
    I have 2 databases (users, userRankings) for a system that needs to have rankings updated every 10 minutes. I use the following code to update these rankings which works fairly well, but there is still a full table scan involved which slows things down with a few hundred thousand users. mysql_query("TRUNCATE TABLE userRankings"); mysql_query("INSERT INTO userRankings (userid) SELECT id FROM users ORDER BY score DESC"); mysql_query("UPDATE users a, userRankings b SET a.rank = b.rank WHERE a.id = b.userid"); In the userRankings table, rank is the primary key and userid is an index. Both tables are MyISAM (I've wondered if it might be beneficial to make userRankings InnoDB).

    Read the article

  • PHP for loop isn't looping after APC installation

    - by BoRo
    So I installed APC and i all of the sudden my for loops only run once and increment the value then stops. I dont get what's going on, it worked fine before APC was installed. Any Suggestions? EDIT: I managed to narrow it down to the increment. for some reason if I have an array let's say string[], and have the for loop list through the values like with string[$i] It only does it for the first one, I can manually echo/print out the array elements to check if the array is the problem but all elements have the appropriate data/values. EDIT #2: Well the code looks something like (it scrapes a page for images and gets some data from it): $str = explode('<div class="images" align="center">',$str); for($i=1;$i<11;$i++){ $url3 = $str[$i]; $url3 = extstr3($url3,'class="filename">','</div>'); $urlname = extstr3($url3,'<a href="','</a>'); $name = extstr3($urlname,'target="_blank">','.jpg'); $url3 = extstr3($url3,'<a href="','" target="_blank">'); $name = str_replace ('_', ' ', $name); . . .

    Read the article

  • WordPress Business Directory - best approach

    - by NTulip
    I want to implement a business directory in WordPress and I am looking for feedback on the best approach: I have a categories and a businesses table Do I create a page for every business together with it's category relationship Do I create a page and assign it a template? What are the ups and downs with each approach? Looking for some answers from people that might of already done this and can speak from experience

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >