Daily Archives

Articles indexed Wednesday December 19 2012

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

  • Why won't my Broadcom BCM4312 LP-PHY work with the STA driver?

    - by Jackson Taylor
    I tried the steps here for a 4312: https://help.ubuntu.com/community/WifiDocs/Driver/bcm43xx Both of these: sudo modprobe -r b43 ssb wl sudo modprobe wl return: FATAL: Module wl not found. FATAL: Error running install command for wl (this one is only for the second one actually) I tried the broadcom-sta, didn't work. What's confusing is down below in the next steps for STA with internet access it says to use the bcmwl one. So I install that and it succeeds but with some errors: sudo apt-get install bcmwl-kernel-source Reading package lists... Done Building dependency tree Reading state information... Done The following package was automatically installed and is no longer required: module-assistant Use 'apt-get autoremove' to remove it. The following NEW packages will be installed: bcmwl-kernel-source 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Need to get 0 B/1,181 kB of archives. After this operation, 3,609 kB of additional disk space will be used. Selecting previously unselected package bcmwl-kernel-source. (Reading database ... 168005 files and directories currently installed.) Unpacking bcmwl-kernel-source (from .../bcmwl-kernel-source_5.100.82.112+bdcom-0ubuntu3_amd64.deb) ... Setting up bcmwl-kernel-source (5.100.82.112+bdcom-0ubuntu3) ... Loading new bcmwl-5.100.82.112+bdcom DKMS files... Building only for 3.5.0-21-generic Building for architecture x86_64 Module build for the currently running kernel was skipped since the kernel source for this kernel does not seem to be installed. ERROR: Module b43 does not exist in /proc/modules ERROR: Module b43legacy does not exist in /proc/modules ERROR: Module ssb does not exist in /proc/modules ERROR: Module bcm43xx does not exist in /proc/modules ERROR: Module brcm80211 does not exist in /proc/modules ERROR: Module brcmfmac does not exist in /proc/modules ERROR: Module brcmsmac does not exist in /proc/modules ERROR: Module bcma does not exist in /proc/modules FATAL: Module wl not found. FATAL: Error running install command for wl update-initramfs: deferring update (trigger activated) Processing triggers for initramfs-tools ... update-initramfs: Generating /boot/initrd.img-3.5.0-21-generic jtaylor991@jtaylor991-whiteHP:~$ sudo modprobe wl FATAL: Module wl not found. FATAL: Error running install command for wl Then I do the modprobe wl commands listed above and it gives the above listed errors. It didn't work with the broadcom-sta driver either. I installed the b43 ones but nothing happened, and I don't know why so those are still installed. firmware-b43legacy-installer, b43-fwcutter and firmware-b43-lpphy-installer (yes it is a LP-PHY) are currently installed. If I go into System Settings Software Sources Additional Drivers it says "Using Broadcom 802.11 Linux STA wireless driver source from bcmwl-kernel-source (proprietary) But bcmwl-kernel-source isn't installed. I could try again but I remember rebooting and it still said this. What's funny is it found wireless networks during the Ubuntu setup/installation, I don't remember if I got it to connect or not though. I think it kept asking for a password when I put it in (yes it was right I showed password and looked at it) so I just ignored it. But right now the Enable Wireless option in the top right is just gone, it's just Enable Networking and I'm on ethernet on this HP Pavilion dv4-1435dx right here. If I run rfkill list it shows: 0: hp-wifi: Wireless LAN Soft blocked: no Hard blocked: no It was hard blocked at the beginning but unblocking it makes no change. Also it's a touch sensitive button, and it appears to be always orange no matter if it's enabled or not because when I touch it the hard blocked changes between yes and no in rfkill list. I think it was blue for a minute at one point. What is going on?!?! Help me! Lol, thanks for any and all of your time guys. Oh yeah this is Ubuntu 12.10 fresh install.

    Read the article

  • System in low graphics, deleted linux, grub rescue, can't access windows

    - by First timer
    So I'm pretty new to Ubuntu but I managed to install it with no big problems on both my desktop and netbook. When I installed it on my brother's netbook everything went horribly wrong and now I fear the system is close to beyond repair. The problem was first that it said it did not have any space left (seemed ridiculous since it had a lot). Then Ubuntu began booting into a "System is running in low graphics mode error" which I then tried to fix, using all the tips I could find in here but nothing helped. I think the graphics error and lack of space might have been related but I can't be sure. Finally I gave up repairing Ubuntu and went for a reinstall. Shouldn't have done that! I read that I should simply open Ubuntu through a live usb and choose GParted to delete the Linux partitions so I did and rebooted accordingly. Next, I was to install Ubuntu but now I am only given the option to wipe the whole disk for Ubuntu, not install along with windows 7. If I access GParted I can still see the ntfs partitions that hold windows 7 (there are 2: one labeled RECOVERY and another labeled OS and boot) so why can't I access them? Btw. the OS and boot has a little red mark with a warning that 1 cluster is referenced to multiple times, don't know what that means. If I boot without the live usb I am sent directly into a grub rescue "black screen of the computer will follow no orders". Please, I know that the easiest might be to simply wipe the whole thing clean but there are important files and programs on windows 7. Is there a way to just access windows? It is a dell inspiron 1018 mini netbook, so I have no cd input and no windows 7 installation cd.

    Read the article

  • Intel Fortran error #10001

    - by Ricardo
    I have a problem with the Intel Fortran compiler. It has been working fine in 8.04 and 10.04 LTS (well, some changes required during the installation due to the fact that 10.04 uses dash and not bash as the shell /bin/sh) Now I have upgraded to 12.04 and when compiling I get the following message: ifort: error #10001: could not find directory in which g++ resides Is there anybody that knows how to solve this problem?

    Read the article

  • Update Manager got stuck (but not frozen) while installing downloaded updates. What should I do?

    - by WarriorIng64
    I have just gotten my Ubuntu 12.04 LTS desktop computer reassembled after a trip back home and connected it to my parent's wireless Internet connection. The connection seems quite shaky (disconnects half the time, likely an ongoing issue with the wireless card I have installed), and it struggled to download updates because of the constant interruptions. Eventually, it managed to download the updated packages and started installing them. I got up and left it to do its work. When I came back, I saw it was still having trouble staying connected to the wireless (no surprise there), but then I noticed that it seemed like Update Manager had stopped making progress on the installation. I opened the Details pane to see what it was last doing: My guess was that the installation script for flashplugin-installer couldn't complete the download until I stabilized the Internet connection. I hooked my Ubuntu laptop up to my desktop via Ethernet and shared its wireless connection using this guide, and as I am typing this now from my desktop you can see that the connection issue was successfully worked around. However, even with a stable connection established, Update Manager seems "stuck" at its current position and won't go any further. It's not totally frozen, but I can't do anything beyond open/close the Details pane as the Cancel button is grayed out. I know it can cause big problems if updates are stopped during installation, but I'm at a loss as to how this situation should be handled. I'm sure it should finish normally if I can just find a way to restart Update Manager, but the question is how this should be approached. How can I safely get my updates to finish installing?

    Read the article

  • Unable to log in to ubuntu server 10.04 after trying to join windows domain

    - by nash
    I was trying to join our ubuntu 10.04 server to the windows domain and I ended up editing the pam.d configuration files. My aim was to have domain users log into the ubuntu server with their domain accounts in order to access some applications instead of creating new unix users each time. My system admin says the join was successful to the domain. Now I have no way of logging into the sever. Is there a way I can undo everything and get the server back to the original login using the local account? I will also appreciate if someone pointed me to some configuration that actually worked - I am still willing to try and make it work.

    Read the article

  • khotkey script calling bindings stop to work on switching to Quantal

    - by Adobe
    I have many scripts which I call with khotkey. For example I have a hotkey which executes: bk_starts_or_brings.bash 'Konsole' konsole On updating to Quantal -- it stops to work: if I call that key -- it searches bk_starts_or_brings.bash 'Konsole' konsole in google in default web-browser. I tried: sudo apt-get install --reinstall libgl1-mesa-glx libgl1-mesa-dri xserver-xorg-core sudo dpkg-reconfigure xserver-xorg sudo apt-get install build-essential cdbs dh-make dkms execstack dh-modaliases fakeroot libqtgui4 When I start the command from konsole -- it works as expected, but when I call it with khotkey -- it doesn't. I guess someone shadows my keybiding. Or some daemon is not run on startup.

    Read the article

  • How to improve battery life on a HP Pavilion dv6?

    - by user1793249
    I apologise if this question is too similar to the numerous others already asked, but I'm a beginner and I really need your help. So...I've installed Ubuntu 12.10 a few days ago and I have only been able to get up to one hour of battery life. When running Windows 7 I get up to 3-4 hours. My screen is ultra bright, even tough the screen brightness is set to the minimum (I installed xcalib to dim my screen, but it doesn't improve the battery life) I read about Jupiter and installed it, but it doesn't have a noticeable effect. Thanks for your time.

    Read the article

  • Connect to Google Talk without giving access to my full Google Account

    - by bneijt
    I would like to use Empathy as a Google Talk client. When I choose to go online, I'm asked to give [email protected] (Ubuntu) access to manage my online Photo's, Google Drive, Emails and Videos. I don't understand why Ubuntu has to have all these permissions on my Google account, does this mean Ubuntu will start syncing my Google account to Ubuntu One? Can I connect to Google Talk without granting access to my Videos, Emails and Photos to Ubuntu? What do you guys want with all my online things?

    Read the article

  • Dashboard to aggregate Google Analytics, Facebook, YouTube etc tracking data?

    - by Richard
    I'd like to see as much tracking data as possible about my online presence, in one single dashboard - so views/conversions from Google Analytics data, the performance of my Facebook campaigns via the Insights API, views/clicks from my YouTube campaigns, etc. This could be as simple as a graph with time on the x-axis, and key indicators from each source on the y-axis (conversions from Analytics, likes on Facebook, views on YouTube, etc). The idea is that I can see customer engagement with each source, over time. I can write my own such dashboard easily enough, but I wondered if there was something off-the-shelf that already did this. Apologies if this isn't the right forum for such a question - would appreciate tips for the best place to ask.

    Read the article

  • How to configure apache2 to just save certain POST requests without even passing them to application?

    - by Robert Grezan
    I'm running apache in front of glassfish server using BalancerMember. For performance reasons I would like that POST requests on certain endpoint are just saved to a file without passing them to application (and to return correct HTTP return code). How to configure apache to do that? EDIT: In other words, if a POST request is for path "http://example.com/upload" then the content of the post (body) should go into a file.

    Read the article

  • Does Wordpress have any SEO benifits on sites coded from scratch? [closed]

    - by Glycan
    Possible Duplicate: Do wordpress websites get indexed quicker by SE than a regular website? I have heard SEO experts suggest moving sites to Wordpress for SEO optimization. Googling offers some perspectives that confirm this (like this or somewhat more dubiously, this). Is this accurate? Some other places say that it doesn't matter, except that Wordpress configures all the meta correctly. In that case, what exactly must be configured?

    Read the article

  • Example of DOD design (on a generic Zombie game)

    - by Jeffrey
    I can't seem to find a nice explanation of the Data Oriented Design for a generic zombie game (it's just an example, pretty common example). Could you make an example of the Data Oriented Design on creating a generic zombie class? Is the following good? Zombie list class: class ZombieList { GLuint vbo; // generic zombie vertex model std::vector<color>; // object default color std::vector<texture>; // objects textures std::vector<vector3D>; // objects positions public: unsigned int create(); // return object id void move(unsigned int objId, vector3D offset); void rotate(unsigned int objId, float angle); void setColor(unsigned int objId, color c); void setPosition(unsigned int objId, color c); void setTexture(unsigned int, unsigned int); ... void update(Player*); // move towards player, attack if near } Example: Player p; Zombielist zl; unsigned int first = zl.create(); zl.setPosition(first, vector3D(50, 50)); zl.setTexture(first, texture("zombie1.png")); ... while (running) { // main loop ... zl.update(&p); zl.draw(); // draw every zombie } Or would creating a generic World container that contains every action from bite(zombieId, playerId) to moveTo(playerId, vector) to createPlayer() to shoot(playerId, vector) to face(radians)/face(vector); and contains: std::vector<zombie> std::vector<player> ... std::vector<mapchunk> ... std::vector<vbobufferid> player_run_animation; ... be a good example? Whats the proper way to organize a game with DOD?

    Read the article

  • Best choice for 3D Physics Engine for C#/XNA

    - by Nic Foster
    Since 2007 I've been working on the development of an open-source game engine, and have been using JigLibX for 3D Physics. However, the developers on the project have stopped contributing to it for over 2 years now, and it's lacking features I need, or have major bugs in certain features. What are some good choices for 3D physics engines that are written purely in C#? Are there any that are more complete than JigLibX? EDIT: I just stumbled upon an engine called BEPUphysics. It was supported up until May 2012, which is fairly recent. I may check it out, any information that you guys could give on how complete the engine is would be great.

    Read the article

  • Is there a Windows equivalent for eventfd?

    - by Leaurus
    I am writing a cross-platform library which emulates sockets behaviour, having additional functionality in the between (App-mylib-sockets). I want it to be the most transparent possible for the programmer, so primitives like select and poll must work with accordingly with this lib. The problem is when data becomes available (for instance) in the real socket, it will have to go through a lot of processing, so if select points to the real socket fd, app will be blocked a lot of time. I want the select/poll to unblock only when data is ready to be consumed (after my lib has done all the processing). So I came across this eventfd which allows me to do exactly what I want, i.e. to manipule select/poll behaviour on a given fd. Since I am much more familiarized with Linux environment, I don't know what is the windows equivalent of eventfd. Tried to search but got no luck. Anyone can help me, please?

    Read the article

  • UIButton receives touches at the wrong position after CABasicAnimaton applied

    - by Dmitry
    I need to add an animation to UIButton - simple moving animation. When I do this, the button moves, but the click area of that button remains at old position: UIButton *slideButton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; [slideButton addTarget:self action:@selector(clicked:) forControlEvents:UIControlEventTouchUpInside]; [slideButton setFrame:CGRectMake(50, 50, 50, 50)]; [self.view addSubview:slideButton]; CABasicAnimation *slideAnimation = [CABasicAnimation animationWithKeyPath:@"position"]; [slideAnimation setRemovedOnCompletion:NO]; [slideAnimation setDuration:1]; [slideAnimation setFillMode:kCAFillModeBoth]; [slideAnimation setAutoreverses:NO]; slideAnimation.fromValue = [NSValue valueWithCGPoint:CGPointMake(50, 50)]; slideAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(100, 100)]; [slideButton.layer addAnimation:slideAnimation forKey:@"slide"]; I already saw an answer to change the frame of the button at the end of the animation (like here UIButton receives touchEvents at the wrong position after a CABasicAnimaton) But it's not my case because I should give possibility to user to click on the button while it's moving... Also, I can't use another approaches (like NSTimer) as a replacement for CABasicAnimation because I will have a complex path to move the object... Thanks for Your help!

    Read the article

  • Pinvoke- to call a function with pointer to pointer to pointer parameter

    - by jambodev
    complete newbe in PInvoke. I have a function in C with this signature: int addPos(int init_array_size, int *cnt, int *array_size, PosT ***posArray, PosT ***hPtr, char *id, char *record_id, int num, char *code, char *type, char *name, char *method, char *cont1, char *cont2, char *cont_type, char *date1, char *date_day, char *date2, char *dsp, char *curr, char *contra_acc, char *np, char *ten, char *dsp2, char *covered, char *cont_subtype, char *Xcode, double strike, int version, double t_price, double long, double short, double scale, double exrcised_price, char *infoMsg); and here is how PosT looks like: typedef union pu { struct dpos d; struct epo e; struct bpos b; struct spos c; } PosT ; my questions are: 1- do I need to define a class in CSharp representing PosT? 2- how do I pass PosT ***posArray parameter across frm CSharp to C? 3- How do I specify marshaling for it all? I Do appreciate your help

    Read the article

  • subset complete or balance dataset in r

    - by SHRram
    I have a dataset that unequal number of repetition. I want to subset a data by removing those entries that are incomplete (i.e. replication less than maximum). Just small example: set.seed(123) mydt <- data.frame (name= rep ( c("A", "B", "C", "D", "E"), c(1,2,4,4, 3)), var1 = rnorm (14, 3,1), var2 = rnorm (14, 4,1)) mydt name var1 var2 1 A 2.439524 3.444159 2 B 2.769823 5.786913 3 B 4.558708 4.497850 4 C 3.070508 2.033383 5 C 3.129288 4.701356 6 C 4.715065 3.527209 7 C 3.460916 2.932176 8 D 1.734939 3.782025 9 D 2.313147 2.973996 10 D 2.554338 3.271109 11 D 4.224082 3.374961 12 E 3.359814 2.313307 13 E 3.400771 4.837787 14 E 3.110683 4.153373 summary(mydt) name var1 var2 A:1 Min. :1.735 Min. :2.033 B:2 1st Qu.:2.608 1st Qu.:3.048 C:4 Median :3.120 Median :3.486 D:4 Mean :3.203 Mean :3.688 E:3 3rd Qu.:3.446 3rd Qu.:4.412 Max. :4.715 Max. :5.787 I want to get rid of A, B, E from the data as they are incomplete. Thus expected output: name var1 var2 4 C 3.070508 2.033383 5 C 3.129288 4.701356 6 C 4.715065 3.527209 7 C 3.460916 2.932176 8 D 1.734939 3.782025 9 D 2.313147 2.973996 10 D 2.554338 3.271109 11 D 4.224082 3.374961 Please note the dataset is big, the following may not a option: mydt[mydt$name == "C",] mydt[mydt$name == "D", ]

    Read the article

  • Retrieving Data From formData in Rails jquery-file-upload

    - by CanCeylan
    I am trying to add additional form data by using https://github.com/blueimp/jQuery-File-Upload/wiki/How-to-submit-additional-form-data this tutorial for jQuery-File-Upload plugin in my Rails app. I'm following the instructions for Setting formData on upload start for each individual file upload. My problem is, after saving the files with their titles as explained in tutorial, I cannot show them in the final table, because I don't know how to reach the formData's values. How should I reach the data inside data.formData = inputs.serializeArray(); and post them next to each item ? Thanks.

    Read the article

  • Always get the correct datetime?

    - by Jesper Mansa
    I was wandering if there is a way/site/link whith the correct time? Not the servers datetime or the clients datetime. I'm using datetime to count down on my gaming site for when it is the users time to make a play. Users come from all ower the world so using the users client time would not match if its from the US to Europe. Then normally I would use the servers time, but somehow it skips 1.2 hours sometimes? I would like to make sure that everbody makes a timestamp from the same source and that source always is correct! Hoping for help and thanks in advance.

    Read the article

  • extra white line under li items that have no border

    - by isabel018
    I have a problem with extra white lines showing up under my list items. It's not a border as I haven't set any borders, except the one under My Account, it's just to show that the white line is not a border. The one under it is -- a 4px border the same color as the background. This problem occurred after I had resolved a conflict between my Nivo Slider and the Woocommerce plugin on my WP site. I got both of them to work together, but then this other issue with the list cropped up. Any ideas as to what caused this and how to fix it? Here's my CSS if that helps: #header #navigation ul.nav > li.current_page_item > a { color: #D4145A;} #header #navigation ul.nav > li:hover a { border-width: 0px 0px 4px; border-style: none none solid; border-color: -moz-use-text-color -moz-use-text-color rgb(212, 20, 90); -moz-border-top-colors: none; -moz-border-right-colors: none; -moz-border-bottom-colors: none; -moz-border-left-colors: none; border-image: none; background: none repeat scroll 0% 0% rgb(212, 20, 90);} and the HTML for it too: <nav id="navigation" class="col-full parent" role="navigation"> <ul id="main-nav" class="nav fl parent"> <li class="page_item"></li> <li class="page_item page-item-11"></li> <li class="page_item page-item-12"></li> <li class="page_item page-item-13 parent"></li> <li class="page_item page-item-15 current_page_item parent"> <a href=""></a> <ul class="children"></ul></li> </ul> </nav> Help please! I'm at my wits' end! Thanks!

    Read the article

  • change maxlength depending of the option selected

    - by tuner3000
    I've seen similar questions posted and tried to change them to meet my needs but I don't know enough about javascript to do it. I need that when a user change the dropdown select, the "titre text field" maxlength is dynamically changed a, b c and d max maxlength should be 40 and e maxlength should be 2 my code is below, I don't know why but it is not working correctly: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>title page</title> </head> <body> <script type="text/javascript"> function changeValue(dropdown) { var option = dropdown.options[dropdown.selectedIndex].value, field = document.getElementById('titre'); if (option == 'a' || option == 'b' || option == 'c' || option == 'd') { field.maxLength = 40; } else if (option == 'e') { field.value = field.value.substr(0, 2); // before reducing the maxlength, make sure it contains at most two characters; you could also reset the value altogether field.maxLength = 2; } }? </script> <form action="converter.php" method="post"> <h2>Feel all field below:</h2> <div> Title: <input type="texte" name="titre" id="titre" maxLength="40"/> Format: <select id="format" name="format" onchange="changeValue(this);"> <option value="a">A</option> <option value="b">B</option> <option value="c">C</option> <option value="d">D</option> <option value="e">E</option> </select> </div> <div> <textarea name="texte" style="width: 415px; height: 155px;"></textarea> </div> <div> <input type="submit" value="OK" /> </div> </form> </body> </html>

    Read the article

  • How to preserve the aspect ratio of video using AVAssetWriter

    - by Satoshi Nakajima
    I have a following code, which captures the video from the camera and stores it as a QuickMovie file using AVAssetWriter. It works fine, but the aspect ratio is not perfect because the width and height are hardcoded (480 x 320) in the outputSettings for AVAssetWriterInput. I'd rather find out the aspect ratio of the source video, and specify the appropriate height (480 x aspect ratio). Does anybody know how to do it? Should I defer the creation of AssetWriterInput until the first sampleBuffer? // set the sessionPreset to 'medium' self.captureSession = [[AVCaptureSession alloc] init]; self.captureSession.sessionPreset = AVCaptureSessionPresetMedium; ... // create AVCaptureVideoDataOutput self.captureVideo = [[AVCaptureVideoDataOutput alloc] init]; NSString* formatTypeKey = (NSString*)kCVPixelBufferPixelFormatTypeKey; self.captureVideo.videoSettings = @{ formatTypeKey:[NSNumber numberWithInt:kCVPixelFormatType_32BGRA] }; [self.captureVideo setSampleBufferDelegate:self queue:dispatch_get_main_queue()]; // create an AVAssetWriter NSError* error = nil; self.videoWriter = [[AVAssetWriter alloc] initWithURL:url fileType:AVFileTypeQuickTimeMovie error:&error]; ... // create AVAssetWriterInput with specified settings NSDictionary* compression = @{ AVVideoAverageBitRateKey:[NSNumber numberWithInt:960000], AVVideoMaxKeyFrameIntervalKey:[NSNumber numberWithInt:1] }; self.videoInput = [AVAssetWriterInput assetWriterInputWithMediaType:AVMediaTypeVideo outputSettings:@{ AVVideoCodecKey:AVVideoCodecH264, AVVideoCompressionPropertiesKey:compression, AVVideoWidthKey:[NSNumber numberWithInt:480], // required AVVideoHeightKey:[NSNumber numberWithInt:320] // required }]; // add it to the AVAssetWriter [self.videoWriter addInput:self.videoInput];

    Read the article

  • Explanation of output

    - by Anon
    My program class Building { Building() { System.out.print("b "); } Building(String name) { this(); System.out.print("bn " + name); } }; public class House extends Building { House() { System.out.print("h "); // this is line# 1 } House(String name) { this(); // This is line#2 System.out.print("hn " + name); } public static void main(String[] args) { new House("x "); } } We know that compiler will write a call to super() as the first line in the child class's constructor. Therefore should not the output be: b (call from compiler written call to super(), before line#2 b (again from compiler written call to super(),before line#1 ) h hn x But the output is b h hn x Why is that?

    Read the article

  • Change row table color with javaScript

    - by Slim Mils
    I try to change the background of rows in my table with javaScript but it's not working. This is my code. However I tried to create my table with html and it's work. P.S : I want to use webkit. Help please. Code : var table = document.getElementById("tab"); var rowCount = table.rows.length; for(var i=0;i<6;i++) { row = table.insertRow(rowCount); row.id = "row"+i; cell1 = row.insertCell(0); var content = document.createElement("output"); content.innerHTML = i ; cell1.appendChild(content); rowCount++; } $(document).ready(function(){ $('td').each(function(i) { $('#tab').on('click', '#row'+i, function(){ document.getElementById("row"+i).style.background = 'white'; //alert(i); }); }); //example2 $('#td1').on('click', function(){ document.getElementById("td1").style.background = 'white'; }); });

    Read the article

  • Should we use temporary variables for the returned values of functions?

    - by totymedli
    I thought about this: Is there a performance difference in these two practices: Store the return value of a function in a temporary variable than give that variable as a parameter to another function. Put the function into the other function. Specification Assuming all classes and functions are written correctly. Case 1. ClassA a = function1(); ClassB b = function2(a); function3(b); Case 2. function3(function2(function1())); I know there aren't a big difference with only one run, but supposed that we could run this a lot of times in a loop, I created some tests. Test #include <iostream> #include <ctime> #include <math.h> using namespace std; int main() { clock_t start = clock(); clock_t ends = clock(); // Case 1. start = clock(); for (int i=0; i<10000000; i++) { double a = cos(1); double b = pow(a, 2); sqrt(b); } ends = clock(); cout << (double) (ends - start) / CLOCKS_PER_SEC << endl; // Case 2. start = clock(); for (int i=0; i<10000000; i++) sqrt(pow(cos(1),2)); ends = clock(); cout << (double) (ends - start) / CLOCKS_PER_SEC << endl; return 0; } Results Case 1 = 6.375 Case 2 = 0.031 Why is the first one is much slower, and if the second one is faster why dont we always write code that way? Anyway does the second pratice has a name? I also wondered what happens if I create the variables outside the for loop in the first case, but the result was the same. Why?

    Read the article

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