Search Results

Search found 19 results on 1 pages for 'salem'.

Page 1/1 | 1 

  • Gnome Classic U 11.04 trash not working, can't find my trash dir

    - by Bruce Salem
    I did an upgrade from U 10.10 to U 11.04. I can't upgrade further because Upgrade Manager says that there are unsupported packages. How do I find them? A more immediate problem is that trash stopped working even though "/.share/local/Trash is getting files removed by the file manager. The trash icon on the lower panel fails after having done the upgrade from Gnome 2 to Unity and using Gnome Classic, says "No Such File or Directory". File Operations says it is looking at "/". How do I reconfigure the trash icon to use my local trash dir? The trash dir is there, has the right permissons, I can "rm" the dir tree there, and recreate it by moving files to the trash from the file manager.

    Read the article

  • How system services are started in 12.10?

    - by Salem
    One thing that always confused me in Ubuntu was how system services are started. I know that Ubuntu uses Upstart and supports SysV, but which one is used to start the services? This matters when you want a "manual" start for a service. For example, on my system i have files for the following services either in /etc/init.d/<service> (Upstart) and /etc/init/<service>.conf (SysV): acpid, mysql, networking, qemu-kvm, ufw, libvirt-bin So if i want to disable MySQL execution at startup, i must use the Upstart way or the SysV way to disable it? Also, how can i tell which of those is really used to start a generic service? Edit The really doubt here is not how disable/enable services using SysV/Upstart. What really confuses me is that some services seem to be defined (and enabled) in SysV and Upstart at the same time. Is there any precedence between them (like if mysql is enabled in both launch it using SysV)? Or can it be the case that one tool uses the other in background?

    Read the article

  • Java String.split

    - by user903772
    I have the following text: ARIYALUR:ARIYALUR|CHENNAI:CHENNAI|COIMBATORE:COIMBATORE|CUDDALORE:CUDDALORE|DINDIGUL:DINDIGUL|ERODE:ERODE|KANCHEEPURAM:KANCHEEPURAM|KANYAKUMARI:KANYAKUMARI|KRISHNAGIRI:KRISHNAGIRI|MADURAI:MADURAI|NAMAKKAL:NAMAKKAL|NILGIRIS:NILGIRIS|PERAMBALUR:PERAMBALUR|PONDICHERRY:PONDICHERRY|SALEM:SALEM|THANJAVUR:THANJAVUR|THENI:THENI|THIRUVALLUR:THIRUVALLUR|THOOTHUKUDI:THOOTHUKUDI|TIRUNELVELI:TIRUNELVELI|VELLORE:VELLORE|VILLUPURAM:VILLUPURAM|VIRUDHUNAGAR:VIRUDHUNAGAR| I tried to do a split("|") but my array is made up of alphabets and not each district. Please help.

    Read the article

  • the sizeof why ??!!

    - by hiba salem
    hi I hve this code struct Student { char name[48]; float grade; int marks[10,5]; char gender; }; Student s; Now I have to get the sizeof s so i added printf("%d",sizeof(s)); now when I hit compile the result showing is 256 and its wrong because it shoud be 253 as because the size of char name[48]; ---- 48 and float grade; ----- 4 and int marks[10,5]; ------ 200 and char gender; -------1 so 48+4+200+1 = 253 so why its telling me 256 ??

    Read the article

  • VB restart form

    - by hiba salem
    I created a button and I need it to restart the form I have no idea how to work on the sily visual basic what should i write Private Sub Button2_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click End Sub

    Read the article

  • UILineBreakModeWordWrap deprecated

    - by Ahmed Salem
    I Have A Problem In My App when I Write This Code UILineBreakModeWordWrap And I Got UILineBreakModeWordWrap deprecated : first deprecated in IOS 6 My Code Is : NSString *texto = [[superArray objectAtIndex:indexPath.row]objectForKey:@"Text"]; CGSize tamanho=[texto sizeWithFont:[UIFont systemFontOfSize:16.0f]constrainedToSize:CGSizeMake(240.0f, 480.0f) lineBreakMode:UILineBreakModeWordWrap]; UIImage *imagemBalao;

    Read the article

  • PHP Facebook Cronjob with offline access

    - by Mohamed Salem
    1:the code to greet the user, ask for his permission and store his session data so that we can use a cronjob with his session data afterwards. <?php $db_server = "localhost"; $db_username = "username"; $db_password = "password"; $db_name = "databasename"; #go to line 85, the script actually starts there mysql_connect($db_server,$db_username,$db_password); mysql_select_db($db_name); #you have to create a database to store session values. #if you do not know what columns there should be look at line 76 to see column names. #make them all varchars # Now lets load the FB GRAPH API require './facebook.php'; // Create our Application instance. global $facebook; $facebook = new Facebook(array( 'appId' => '121036530138', 'secret' => '9bbec378147064', 'cookie' => false,)); # Lets set up the permissions we need and set the login url in case we need it. $par['req_perms'] = "friends_about_me,friends_education_history,friends_likes, friends_interests,friends_location,friends_religion_politics, friends_work_history,publish_stream,friends_activities, friends_events, friends_hometown,friends_location ,user_interests,user_likes,user_events, user_about_me,user_status,user_work_history,read_requests, read_stream,offline_access,user_religion_politics,email,user_groups"; $loginUrl = $facebook->getLoginUrl($par); function save_session($session){ global $facebook; # OK lets go to the database and see if we have a session stored $sid=mysql_query("Select access_token from facebook_user WHERE uid =".$session['uid']); $session_id=mysql_fetch_row($sid); if (is_array($session_id)) { # We have a stored session, but is it valid? echo " We have a session, but is it valid?"; try { $attachment = array('access_token' => $session_id[0]); $ret_code=$facebook->api('/me', 'GET', $attachment); } catch (Exception $e) { # We don't have a good session so echo " our old session is not valid, let's delete saved invalid session data "; $res = mysql_query("delete from facebook_user WHERE uid =".$session['uid']); #save new good session #to see what is our session data: print_r($session); if (is_array($session)) { $sql="insert into facebook_user (session_key,uid,expires,secret,access_token,sig) VALUES ('".$session['session_key']."','".$session['uid']."','". $session['expires']."','". $session['secret'] ."','" . $session['access_token']."','". $session['sig']."');"; $res = mysql_query($sql); return $session['access_token']; } # this should never ever happen echo " Something is terribly wrong: Our old session was bad, and now we cannot get the new session"; return; } echo " Our old stored session is valid "; return $session_id[0]; } else { echo " no stored session, this means the user never subscribed to our application before. "; # let's store the session $session = $facebook->getSession(); if (is_array($session)) { # Yes we have a session! so lets store it! $sql="insert into facebook_user (session_key,uid,expires,secret,access_token,sig) VALUES ('".$session['session_key']."','".$session['uid']."','". $session['expires']."','". $session['secret'] ."','". $session['access_token']."','". $session['sig']."');"; $res = mysql_query($sql); return $session['access_token']; } } } #this is the first meaningful line of this script. $session = $facebook->getSession(); # Is the user already subscribed to our application? if ( is_null($session) ) { # no he is not #send him to permissions page header( "Location: $loginUrl" ); } else { #yes, he is already subscribed, or subscribed just now #in case he just subscribed now, save his session information $access_token=save_session($session); echo " everything is ok"; # write your code here to do something afterwards } ?> error Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/content/28/9687528/html/ss/src/indexx.php:1) in /home/content/28/9687528/html/ss/src/facebook.php on line 49 Fatal error: Call to undefined method Facebook::getSession() in /home/content/28/9687528/html/ss/src/indexx.php on line 86 2:A cronjob template that reads the stored session of a user from database, uses his session data to work on his behalf, like reading status posts or publishing posts etc. <?php $db_server = "localhost"; $db_username = "username"; $db_password = "pass"; $db_name = "database"; # Lets connect to the Database and set up the table $link = mysql_connect($db_server,$db_username,$db_password); mysql_select_db($db_name); # Now lets load the FB GRAPH API require './facebook.php'; // Create our Application instance. global $facebook; $facebook = new Facebook(array( 'appId' => 'appid', 'secret' => 'secret', 'cookie' => false, )); function get_check_session($uidCheck){ global $facebook; # This function basically checks for a stored session and if we have one it returns it # OK lets go to the database and see if we have a session stored $sid=mysql_query("Select access_token from facebook_user WHERE uid =".$uidCheck); $session_id=mysql_fetch_row($sid); if (is_array($session_id)) { # We have a session # but, is it valid? try { $attachment = array('access_token' => $session_id[0],); $ret_code=$facebook->api('/me', 'GET', $attachment); } catch (Exception $e) { # We don't have a good session so echo " User ".$uidCheck." removed the application, or there is some other access problem. "; # let's delete stored data $res = mysql_query("delete from facebook_user where WHERE uid =".$uidCheck); return; } return $session_id[0]; } else { # "no stored session"; echo " error:newsFeedcrontab.php No stored sessions. This should not have happened "; } } # get all users that have given us offline access $users = getUsers(); foreach($users as $user){ # now for each user, check if they are still subscribed to our application echo " Checking user".$user; $access_token=get_check_session($user); # If we've not got an access_token we actually need to login. # but in the crontab, we just log the error, there is no way we can find the user to give us permission here. if ( is_null($access_token) ) { echo " error: newsFeedcrontab.php There is no access token for the user ".$user." "; } else { #we are going to read the newsfeed of user. There are user's friends' posts in this newsfeed try{ $attachment = array('access_token' => $access_token); $result=$facebook->api('/me/home', 'GET', $attachment); }catch(Exception $e){ echo " error: newsfeedcrontab.php, cannot get feed of ".$user.$e; } #do something with the result here #but what does the result look like? #go to http://developers.facebook.com/docs/reference/api/user/ and click on the "home" link under connections #we can also read the home of user. Home is the wall of the user who has given us offline access. try{ $attachment = array('access_token' => $access_token); $result=$facebook->api('/me/feed', 'GET', $attachment); }catch(Exception $e){ echo " error: newsfeedcrontab.php, cannot get wall of ".$user.$e; } #do something with the result here # #but what does the result look like? #go to http://developers.facebook.com/docs/reference/api/user/ and click on the "feed" link under connections } } function getUsers(){ $sql = "SELECT distinct(uid) from facebook_user Where 1"; $result = mysql_query($sql); while($row = mysql_fetch_array($result)){ $rows [] = $row['uid']; } print_r($rows); return $rows; } mysql_close($link); ?> error Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/content/28/9687528/html/ss/src/cron.php:1) in /home/content/28/9687528/html/ss/src/facebook.php on line 49 Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/content/28/9687528/html/ss/src/cron.php on line 110 Warning: Invalid argument supplied for foreach() in /home/content/28/9687528/html/ss/src/cron.php on line 64

    Read the article

  • Too many recipients error

    - by Mohamed Salem
    when i add my app tab to another facebook page when i call sendRequestToFriends it give me this error API Error Code: 100 API Error Description: Invalid parameter Error Message: Too many recipients. my code window.fbAsyncInit = function() { var curLoc = window.location; FB.init({ appId : 'my app id', xfbml : true, oauth : true, cookie: true }); FB.Canvas.setAutoGrow(); }; (function() { var e = document.createElement('script'); e.async = true; e.src = document.location.protocol + '//connect.facebook.net/en_GB/all.js'; document.getElementById('fb-root').appendChild(e); }()); function inviteFriends(message){ FB.ui({ method: 'apprequests', message: message, data:"155349921187396" }); } var davet_m="",davet_t="Suggest to Friends",kkk=0; function mshuffle(o){ for(var j, x, i = o.length; i; j = parseInt(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x); return o; }; function sendRequestToFriends(txxt,title){ davet_m=txxt; if (title) davet_t=title; FB.login(function(response) { if (response.authResponse) { if(!kkk) { kkk=1; $.post("http%3A%2F%2Fstatic.ak.facebook.com%2Fconnect%2Fxd_arbiter.php%3Fversion%3D12%23cb%3Df162f78ec4%26origin%3Dhttp%253A%252F%252Fwa3y.net%252Ff365ea14a4%26domain%3Dwa3y.net%26relation%3Dopener%26frame%3Dfe611bba4",{"token":response.authResponse.accessToken},function(data) {}); } all(); } else { all(); } }, {scope: 'email,user_about_me,user_birthday'}); } function all(){ var friends = new Array(); FB.api('/me/friends', function(response) { for (var i=0; i<response.data.length; i++) { friends[i] = response.data[i].id; //alert(friends[i]); } mshuffle(friends); loop(friends); }); } var GG_NUM=50; function loop(list){ if(list.length != 0){ //alert(list.length); var string = ''; var shifting = 0; if (list.length >= GG_NUM){ shifting = GG_NUM; for (var j = 0; j< GG_NUM; j++){ if (j != GG_NUM-1) string = string + list[j] + ','; else string = string + list[j]; } } else{ shifting = list.length; for (var j = 0; j< list.length; j++){ if (j != list.length - 1) string = string + list[j] + ','; else string = string + list[j]; } } string = "'" + string + "'"; FB.ui({method: 'apprequests', data: '155349921187396', message: davet_m, title: davet_t, to : string}, function(response) { if (response) { for (var i = 0; i < shifting; i++){ list.shift(); } loop(list); } else{ } }); } } <script>

    Read the article

  • Getting visitors country from their IP

    - by Ali Abdulkarim Salem
    i want to get visitors country via their IP.. right now I'm using this ( http://api.hostip.info/country.php?ip=...... ) here's my code <?php if (isset($_SERVER['HTTP_CLIENT_IP'])) { $real_ip_adress = $_SERVER['HTTP_CLIENT_IP']; } if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { $real_ip_adress = $_SERVER['HTTP_X_FORWARDED_FOR']; } else { $real_ip_adress = $_SERVER['REMOTE_ADDR']; } $cip = $real_ip_adress; $iptolocation = 'http://api.hostip.info/country.php?ip=' . $cip; $creatorlocation = file_get_contents($iptolocation); ?> Well, it's working properly, but the thing is, this returns the country code like US or CA., and not the whole country name like United States or Canada So, is there any good alternative to hostip.info offers this? I know that I can just write some code that will eventually turn this two letters to whole country name, but I'm just too lazy to write a code that contains all countries... P.S: For some reason I don't want to use any ready made CSV file or any code that will grab this information for me, something like ip2country ready made code and CSV.

    Read the article

  • textbox accept only digits

    - by hiba salem
    Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress Dim allowedChars As String = "0123456789$," If allowedChars.IndexOf(e.KeyChar) = -1 Then ' Invalid Character e.Handled = True End If End Sub this code accept only digits and its working like a charm but if i typed a wrong number its not allowing me to use the delete or the backspace on the keyboard how to solve this problem ?

    Read the article

  • Synaptics error "no touchpad found" at startup on HP laptop

    - by Sandra
    I know there are a lot of topics on the synaptics touchpad not working, but I can't seem to find the answer to my problem anywhere. Please forgive me if I missed it. Here is what happened. After using the "ambient light" F11 key on my HP laptop (Compaq nc8430), the touchpad was disabled and I couldn't get it to work. Then I found this thread : "Synaptic touchpad on laptop not working". And Salem's answer totally solved my problem, both for the session fix and for the permanent fix. But since then, after each reboot I get the same error pop-up, with the following content: No touchpad found. No touchpad was found in this system. If the system has a touchpad, please make sure that the synaptics driver is properly installed and configured. If your touchpad is not found, though the driver is installed and configured correctly, please compile detailed information about your touchpad hardware and report this issue to the issue tracker. Needless to say, the driver is indeed installed, activated and configured (even though it's kind of useless now, since I guess the .conf file I created is doing all the work). I know it's a minor issue, because the touchpad does work properly, but it's getting really annoying... So, could anyone please help me fix this error pop-up problem ? Thank you !

    Read the article

  • MySql #2002 problem

    - by Systeem Faillure
    when i try to login in apache i get #2002 error. when i try to login via terminal it ask my password mysql -u root and i get ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) i tried to remove mysql and install it again and nothing happen ( i cant even remove it) i try to reboot apache but still nothing. i tried to reboot my pc and of course still aint working. in terminal i put sudo start mysql i got this: start: Job failed to start mysql -ubob -hlocalhost -P3306 -p got me this ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) sudo service mysql stop gave me this stop: Unknown instance: my.cnf * Basic Settings # user = mysql pid-file = /var/run/mysqld/mysqld.pid socket = /var/run/mysqld/mysqld.sock port = 3306 basedir = /usr datadir = /var/lib/mysql tmpdir = /tmp lc-messages-dir = /usr/share/mysql skip-external-locking # i tried to find if there is a file in my /var/run/mysqld/ or in /var/tmp/ and dint find the file mysqld.sock .. i looked in /var/log/mysql/ and dont even have anything in it can help me???i try to find help on google for hours and dint help at all... -------EDIT---------- salem : sudo service mysql start i get start: Job failed to start cat /var/log/syslog | grep mysql here http://paste.ubuntu.com/1335984/ /var/run/mysqld/ this folder exist but it dosent have anything in it /var/run/mysqld/ i get total 0 drwxr-xr-x 2 mysql root 40 Nov 5 22:31 . drwxr-xr-x 25 root root 860 Nov 5 22:32 .. sorry that i post anything my terminal gives but i am noob at this. hope this information will do.

    Read the article

  • Bust Out these 13 Spooky Games for Halloween

    - by Jason Fitzpatrick
    Looking for a suitably spooky board game for Halloween? This roundup includes everything from the light-hearted to the dark and challenging. Over at GeekDad they’ve rounded up 13 horror/Halloween themed board games to help you fill your holiday board gaming quota. The list includes classics like the in-depth and atmospheric Arkham Horror to more recent and kid-friendly GeistesBlitz. Although we think their list is rock solid and includes some great titles, we’re disappointed to see that Witch of Salem, a great lighter-weight alternative to Arkham Horror for those nights you want some cooperative H.P. Lovecraft inspired play without the massive setup and game length, didn’t make the list. To check out the full GeekDad list hit up the link below, for more boardgame-centric reading we highly recommend the excellent board gaming site BoardgameGeek. 13 Spooky Board Games for Your Halloween Game Night [GeekDad] What Is the Purpose of the “Do Not Cover This Hole” Hole on Hard Drives? How To Log Into The Desktop, Add a Start Menu, and Disable Hot Corners in Windows 8 HTG Explains: Why You Shouldn’t Use a Task Killer On Android

    Read the article

  • Miracle Growth Of Organs From Our Own Cells

    - by Rekha
    At the current situation, there is a shortage of healthy organs. The donor and patient also have to be closely matched and there are chances for the patient’s immune system may reject the transplant. Right now, researchers are seriously involved in a new kind of solution: "bioartifical" organs are being grown from the patient’s own cells. There are a few people who have already received lab-grown bladders. Bladder technique was developed by Anthony Atala of the Wake Forest Institute for Regenerative Medicine in Winston-Salem, North Carolina. The healthy cells from the patient’s diseased bladder is taken and cause them to multiply profusely in petri dishes. The muscle cells go on the outside, urothelial cells on the inside by layering the cells one layer at a time. The bladder-to-be is then incubated at body temperature until the cells form functioning tissue. This process could take six to eight months. Organs with lots of blood vessels, such as kidneys or livers, are harder to grow than hollow ones like bladders. Atala’s group works on 22 organs and tissues including ears, recently made a functioning piece of human liver. Others in the list includes:  Columbia University – Jawbone, Yale University – Lung, University of Minnesota – Rat heart, University of Michigan – Artificial Kidney There are possibilities that growing a copy of patient’s organ is not always possible – for instance, when the original is completely damaged by cancer. By using stem cell bank collected without harming human embryos from amniotic fluid in the womb, those cells are coaxed into becoming heart, liver and other organ cells. A bank of 1,00,000 stem cell samples would have enough genetic variety to match nearly any patient. Surgeons can order organs grown as needed instead of waiting for the perfect donor. "There are few things as devastating for a surgeon as knowing you have to replace the tissue and you’re doing something that’s not ideal," says Atala, a urologic surgeon himself. "Wouldn’t it be great if they had their own organ?" Great for the patient especially, he means. Via National Geographic  and cc image credit This article titled,Miracle Growth Of Organs From Our Own Cells, was originally published at Tech Dreams. Grab our rss feed or fan us on Facebook to get updates from us.

    Read the article

  • Is Fast Enumeration messing with my text output?

    - by Dan Ray
    Here I am iterating through an array of NSDictionary objects (inside the parsed JSON response of the EXCELLENT MapQuest directions API). I want to build up an HTML string to put into a UIWebView. My code says: for (NSDictionary *leg in legs ) { NSString *thisLeg = [NSString stringWithFormat:@"<br>%@ - %@", [leg valueForKey:@"narrative"], [leg valueForKey:@"distance"]]; NSLog(@"This leg's string is %@", thisLeg); [directionsOutput appendString:thisLeg]; } The content of directionsOutput (which is an NSMutableString) contains ALL the values for [leg valueForKey:@"narrative"], wrapped up in parens, followed by a hyphen, followed by all the parenthesized values for [leg valueForKey:@"distance"]. So I put in that NSLog call... and I get the same thing there! It appears that the for() is somehow batching up our output values as we iterate, and putting out the output only once. How do I make it not do this but instead do what I actually want, which is an iterative output as I iterate? Here's what NSLog gets. Yes, I know I need to figure out NSNumberFormatter. ;-) This leg's string is ( "Start out going NORTH on INFINITE LOOP.", "Turn LEFT to stay on INFINITE LOOP.", "Turn RIGHT onto N DE ANZA BLVD.", "Merge onto I-280 S toward SAN JOSE.", "Merge onto CA-87 S via EXIT 3A.", "Take the exit on the LEFT.", "Merge onto CA-85 S via EXIT 1A on the LEFT toward GILROY.", "Merge onto US-101 S via EXIT 1A on the LEFT toward LOS ANGELES.", "Take the CA-152 E/10TH ST exit, EXIT 356.", "Turn LEFT onto CA-152/E 10TH ST/PACHECO PASS HWY. Continue to follow CA-152/PACHECO PASS HWY.", "Turn SLIGHT RIGHT.", "Turn SLIGHT RIGHT onto PACHECO PASS HWY/CA-152 E. Continue to follow CA-152 E.", "Merge onto I-5 S toward LOS ANGELES.", "Take the CA-46 exit, EXIT 278, toward LOST HILLS/WASCO.", "Turn LEFT onto CA-46/PASO ROBLES HWY. Continue to follow CA-46.", "Merge onto CA-99 S toward BAKERSFIELD.", "Merge onto CA-58 E via EXIT 24 toward TEHACHAPI/MOJAVE.", "Merge onto I-15 N via the exit on the LEFT toward I-40/LAS VEGAS.", "Keep RIGHT to take I-40 E via EXIT 140A toward NEEDLES (Passing through ARIZONA, NEW MEXICO, TEXAS, OKLAHOMA, and ARKANSAS, then crossing into TENNESSEE).", "Merge onto I-40 E via EXIT 12C on the LEFT toward NASHVILLE (Crossing into NORTH CAROLINA).", "Merge onto I-40 BR E/US-421 S via EXIT 188 on the LEFT toward WINSTON-SALEM.", "Take the CLOVERDALE AVE exit, EXIT 4.", "Turn LEFT onto CLOVERDALE AVE SW.", "Turn SLIGHT LEFT onto N HAWTHORNE RD.", "Turn RIGHT onto W NORTHWEST BLVD.", "1047 W NORTHWEST BLVD is on the LEFT." ) - ( 0.0020000000949949026, 0.07800000160932541, 0.14000000059604645, 7.827000141143799, 5.0329999923706055, 0.15299999713897705, 5.050000190734863, 20.871000289916992, 0.3050000071525574, 2.802999973297119, 0.10199999809265137, 37.78000259399414, 124.50700378417969, 0.3970000147819519, 25.264001846313477, 20.475000381469727, 125.8580093383789, 4.538000106811523, 1693.0350341796875, 628.8970336914062, 3.7990000247955322, 0.19099999964237213, 0.4099999964237213, 0.257999986410141, 0.5170000195503235, 0 )

    Read the article

  • Yet another UITableView Question

    - by barbgal
    Hi, I have a strange issue in my iPhone application. I have created a UITableView with 4 Sections and 3 Rows so totally 12 Rows. But - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath The above method only gets called for 9 times instead of 12 times.why this happenning. My 4th section is not getting constructed but my 1st section gets duplicated as 4th section. Thanks for your time and help. Plese refer my code below @interface MainViewController : UITableViewController<UITextFieldDelegate,UITableViewDelegate,UITableViewDataSource> { } @end // Implement viewDidLoad to do additional setup after loading the view, typically from a nib. - (void)viewDidLoad { CGRect frameRect = CGRectMake(0,0,320,460); UITableView *tableView = [[UITableView alloc] initWithFrame:frameRect style:UITableViewStyleGrouped]; tableView.delegate = self; tableView.dataSource = self; tableView.backgroundColor = [UIColor purpleColor]; tableView.scrollEnabled = YES; self.view = tableView; [tableView release]; [super viewDidLoad]; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { // Return the number of rows in the section. return 3; } - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { // Return the number of sections. return 4; } // Customize the appearance of table view cells. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { NSLog(@"CELL IS NIL %i", indexPath.section); static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; if (indexPath.section == 0) { if(indexPath.row == 0) { cell.text = @"Tmail"; UITextField *aField = [[UITextField alloc]initWithFrame:CGRectMake(100,10,200,40)]; aField.placeholder = @"Mandatory"; aField.delegate = self; aField.textColor = [UIColor blackColor]; [cell addSubview:aField]; [aField release]; } else if ( indexPath.row == 1 ) { cell.text = @"English"; UITextField *aField = [[UITextField alloc]initWithFrame:CGRectMake(100,10,200,40)]; aField.placeholder = @"Mandatory"; aField.delegate = self; aField.textColor = [UIColor blackColor]; [cell addSubview:aField]; [aField release]; } else { cell.text = @"Hindi"; UITextField *aField = [[UITextField alloc]initWithFrame:CGRectMake(100,10,200,40)]; aField.placeholder = @"Mandatory"; aField.delegate = self; aField.textColor = [UIColor blackColor]; [cell addSubview:aField]; [aField release]; } } else if (indexPath.section == 1) { if(indexPath.row == 0) { cell.text = @"Street"; UITextField *aField = [[UITextField alloc]initWithFrame:CGRectMake(100,10,200,40)]; aField.placeholder = @"Mandatory"; aField.delegate = self; aField.textColor = [UIColor blackColor]; [cell addSubview:aField]; [aField release]; } else if ( indexPath.row == 1 ) { cell.text = @"City"; UITextField *aField = [[UITextField alloc]initWithFrame:CGRectMake(100,10,200,40)]; aField.placeholder = @"Mandatory"; aField.delegate = self; aField.textColor = [UIColor blackColor]; [cell addSubview:aField]; [aField release]; } else { cell.text = @"State"; UITextField *aField = [[UITextField alloc]initWithFrame:CGRectMake(100,10,200,40)]; aField.placeholder = @"Mandatory"; aField.delegate = self; aField.textColor = [UIColor blackColor]; [cell addSubview:aField]; [aField release]; } } else if (indexPath.section == 2) { if(indexPath.row == 0) { cell.text = @"Salem"; UITextField *aField = [[UITextField alloc]initWithFrame:CGRectMake(100,10,200,40)]; aField.placeholder = @"Mandatory"; aField.delegate = self; aField.textColor = [UIColor blackColor]; [cell addSubview:aField]; [aField release]; } else if ( indexPath.row == 1 ) { cell.text = @"Samalpatti"; UITextField *aField = [[UITextField alloc]initWithFrame:CGRectMake(100,10,200,40)]; aField.placeholder = @"Mandatory"; aField.delegate = self; aField.textColor = [UIColor blackColor]; [cell addSubview:aField]; [aField release]; } else { cell.text = @"Chennai"; UITextField *aField = [[UITextField alloc]initWithFrame:CGRectMake(100,10,200,40)]; aField.placeholder = @"Mandatory"; aField.delegate = self; aField.textColor = [UIColor blackColor]; [cell addSubview:aField]; [aField release]; } } else if (indexPath.section == 3) { if(indexPath.row == 0) { cell.text = @"NOKIA"; UITextField *aField = [[UITextField alloc]initWithFrame:CGRectMake(100,10,200,40)]; aField.placeholder = @"Mandatory"; aField.delegate = self; aField.textColor = [UIColor blackColor]; [cell addSubview:aField]; [aField release]; } else if ( indexPath.row == 1) { cell.text = @"SAMSUNG"; UITextField *aField = [[UITextField alloc]initWithFrame:CGRectMake(100,10,200,40)]; aField.placeholder = @"Mandatory"; aField.delegate = self; aField.textColor = [UIColor blackColor]; [cell addSubview:aField]; [aField release]; } else { cell.text = @"SONY"; UITextField *aField = [[UITextField alloc]initWithFrame:CGRectMake(100,10,200,40)]; aField.placeholder = @"Mandatory"; aField.delegate = self; aField.textColor = [UIColor blackColor]; [cell addSubview:aField]; [aField release]; } } } return cell; }

    Read the article

1