Search Results

Search found 5637 results on 226 pages for 'triple slash comments'.

Page 73/226 | < Previous Page | 69 70 71 72 73 74 75 76 77 78 79 80  | Next Page >

  • Is there an efficient way to write this PHP if / else statement?

    - by nvoyageur
    I've written a simple issue tracker for my web app. I have some comments that I want to keep private (only a role of 'root' can see them). Is there a better way to write the following so I do not need the empty else section? $role will be 'root' or some other values $is_private will be true if the comment is private <?php // Don't show private comments to non-root users if ($is_private && 'root' != $role): // NON Root cannot see private else: ?> <div class="comment <?= $is_private ? 'private' : '' ; ?>"> <div class="comment-meta toolbar"> <?= $is_private ? 'PRIVATE - ': ''; ?> <span class="datestamp"><?= $created_at; ?></span> - <span class="fullname"><?= $fname . ' ' . $lname; ?></span></div> <p class="content"><?= nl2br($body); ?></p> </div> <?php endif; ?>

    Read the article

  • How do I save the edits for a checkbox that implements an email notification?

    - by Ralph The Mouf
    On my site, a user gets email notifications when someone comments on their profile, or comments on their blog etc...I have made a email settings page that has checkboxes to allow the user to decide to receive emails or not. This is what I am wrapping around the email notification code chunck for the pages that have the php mail: <?php if(isset($_POST['email_toggle']) && $_POST['email_toggle'] == 'true') { if(isset($_POST['commentProfileSubmit']) && $auth) { $query etc $to = etc } } My question is what do I put on the email settings script that has the actual check boxes to make them stay checked or unchecked once you submit your settings? Another words what do I put in the if(isset portion to implement the changes? if(isset($_POST['email_toggle']) && $_POST['email_toggle'] == 'true') { /* what do I put here? */ header("Location: Profile.php?id=" . $auth->id); mysql_query($query,$connection); /* input/check boxes and submit button */ <tr> <td class="email_check"> <input type="checkbox" name="email_toggle" value="true" checked="checked" /> Receive email Notifications When Someone Answers A Question You've Answered </td> </tr> <tr> <td> <input style="margin:10px 0px 0px 10px;" class="submit" type="submit" name="email_toggle" value="Save Settings" /> </td> </tr> }

    Read the article

  • cellForRowAtIndexPath not called for all sections

    - by Wynn
    I have a UITableView that has five sections. Just as the title describes cellForRowAtIndexPath is only being called for the first four. All connections have been made concerning the datasource and delegate. Also, my numberOfSectionsInTableView clearly returns 5. Printing out the number of sections from within cellForRowAtIndexPath shows the correct number, thus confirming that cellForRowAtIndexPath is simply not being called for all sections. What on earth is going on? I looked pretty hard for an answer to this question but could't find one. If this has already been answered please forgive me and point me in the correct direction. My cellForRowAtIndexPath: - (UITableViewCell *)tableView:(UITableView *)theTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [theTableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; } switch (indexPath.section) { case 0: cell.textLabel.text = ticket.description; break; case 1: cell.textLabel.text = ticket.ticketStatus; break; case 2: cell.textLabel.text = ticket.priority; break; case 3: cell.textLabel.text = ticket.customerOfficePhone; break; case 4: { //This never ever gets executed Comment *comment = [ticket.comments objectAtIndex:indexPath.row]; cell.textLabel.text = comment.commentContent; break; } } return cell; } My numberOfSectionsInTableView: - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 5; } My numberOfRowsInSection: - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { NSInteger numberOfRows; if (section == 4) { numberOfRows = [ticket.comments count]; } else { numberOfRows = 1; } return numberOfRows; } Any suggestions are appreciated. Thanks in advance.

    Read the article

  • Hot to log in to a website using installed twill?

    - by brilliant
    Hello, everybody!!!! I have just successfully installed TWILL on my computer with the help of one very supportive member of "StackOverflow" (you can check it out HERE) and have tried to run one of the simple examples on the twill documentation page (you can see that page HERE). Here is that example: Let's say my username on www.slash.org is lynxye and my password is mammal. When I try to enter that exanple code into my Python prompt, I can only enter the first line of the code bexcause when I click on "Enter" to start a new line, I get some error messages right away: The same happens when I try to enter this code into my terminal: I think I miss out on some basics here. Perhaps, I need to create a file that would contain that code and then run that file somehow, but I really don't know where I need to create that file and with what extensdion. Can anyone, please, help me with this?

    Read the article

  • Renamed MySQL table not renamed for INSERT queries?

    - by Austin Hyde
    After renaming one of my MySQL MyISAM tables from test_tablename to tablename, I have found that if I try to execute an INSERT (or REPLACE) query, I get the following message: 1146: Table 'dbname.test_tablename' doesn't exist I have triple-checked my database abstraction code, and verified this by running the query directly on the server. According to the MySQL server, the CREATE TABLE syntax is tablename, as expected, and when I run SHOW TABLES, it lists tablename as expected. Is there any reason for this to happen? More importantly, is there an easier way to fix this than dumping, dropping, re-creating, and reloading the table?

    Read the article

  • PHP issue json_decode echo array

    - by dfdf
    <?php $string = file_get_contents("http://www.reddit.com/r/news.json"); $array = json_decode($string, true); echo $array['data'][0]['children'][0]['data'][0]['title'][0]; ?> I've got a problem- the code doesn't echo anything. I'm kinda new to json_decode, so any help is appreciated :-) Edit: As a response to a comment, here's what print_r results to: Array ( [kind] => Listing [data] => Array ( [modhash] => [children] => Array ( [0] => Array ( [kind] => t3 [data] => Array ( [domain] => syracuse.com [banned_by] => [media_embed] => Array ( ) [subreddit] => news [selftext_html] => [selftext] => [likes] => [secure_media] => [link_flair_text] => [id] => 1qdtqr [secure_media_embed] => Array ( ) [clicked] => [stickied] => [author] => cadencehz [media] => [score] => 1552 [approved_by] => [over_18] => [hidden] => [thumbnail] => [subreddit_id] => t5_2qh3l [edited] => [link_flair_css_class] => [author_flair_css_class] => [downs] => 978 [saved] => [is_self] => [permalink] => /r/news/comments/1qdtqr/thousands_defend_grocery_store_employee_with/ [name] => t3_1qdtqr [created] => 1384215998 [url] => http://www.syracuse.com/news/index.ssf/2013/11/thousands_come_to_defense_of_clay_wegmans_employee_with_aspergers_syndrome_after.html#incart_m-rpt-2 [author_flair_text] => [title] => Thousands defend grocery store employee with Asperger's syndrome after customer yells at him for being too slow [created_utc] => 1384187198 [ups] => 2530 [num_comments] => 401 [visited] => [num_reports] => [distinguished] => ) ) [1] => Array ( [kind] => t3 [data] => Array ( [domain] => bostonherald.com [banned_by] => [media_embed] => Array ( ) [subreddit] => news [selftext_html] => [selftext] => [likes] => [secure_media] => [link_flair_text] => [id] => 1qddl6 [secure_media_embed] => Array ( ) [clicked] => [stickied] => [author] => boxofrain [media] => [score] => 2086 [approved_by] => [over_18] => [hidden] => [thumbnail] => [subreddit_id] => t5_2qh3l [edited] => [link_flair_css_class] => [author_flair_css_class] => [downs] => 2556 [saved] => [is_self] => [permalink] => /r/news/comments/1qddl6/motorcycle_stolen_in_1961_found_is_recovered_and/ [name] => t3_1qddl6 [created] => 1384199801 [url] => http://bostonherald.com/news_opinion/offbeat_news/2013/11/man_glad_stolen_motorcycle_found_after_46_years [author_flair_text] => [title] => Motorcycle stolen in 1961 found is recovered and will be returned to it 73 year old owner. [created_utc] => 1384171001 [ups] => 4642 [num_comments] => 141 [visited] => [num_reports] => [distinguished] => ) ) [2] => Array ( [kind] => t3 [data] => Array ( [domain] => hosted.ap.org [banned_by] => [media_embed] => Array ( ) [subreddit] => news [selftext_html] => [selftext] => [likes] => [secure_media] => [link_flair_text] => [id] => 1qe6gp [secure_media_embed] => Array ( ) [clicked] => [stickied] => [author] => donkey-kick [media] => [score] => 415 [approved_by] => [over_18] => [hidden] => [thumbnail] => [subreddit_id] => t5_2qh3l [edited] => [link_flair_css_class] => [author_flair_css_class] => [downs] => 334 [saved] => [is_self] => [permalink] => /r/news/comments/1qe6gp/atheist_mega_churches_take_hold_in_the_us_and/ [name] => t3_1qe6gp [created] => 1384224670 [url] => http://hosted.ap.org/dynamic/stories/U/US_ATHEIST_MEGACHURCH?SITE=AP&amp;SECTION=HOME&amp;TEMPLATE=DEFAULT&amp;CTIME=2013-11-10-17-03-15 [author_flair_text] => [title] => Atheist Mega Churches take hold in the US and around the world. [created_utc] => 1384195870 [ups] => 749 [num_comments] => 368 [visited] => [num_reports] => [distinguished] => ) ) [3] => Array ( [kind] => t3 [data] => Array ( [domain] => abcnews.go.com [banned_by] => [media_embed] => Array ( ) [subreddit] => news [selftext_html] => [selftext] => [likes] => [secure_media] => [link_flair_text] => [id] => 1qdie4 [secure_media_embed] => Array ( ) [clicked] => [stickied] => [author] => Hoosier_made [media] => [score] => 984 [approved_by] => [over_18] => [hidden] => [thumbnail] => [subreddit_id] => t5_2qh3l [edited] => [link_flair_css_class] => [author_flair_css_class] => [downs] => 400 [saved] => [is_self] => [permalink] => /r/news/comments/1qdie4/abc_news_amy_robach_has_mammogram_live_on_gma/ [name] => t3_1qdie4 [created] => 1384206209 [url] => http://abcnews.go.com/blogs/health/2013/11/11/abc-news-amy-robach-reveals-breast-cancer-diagnosis/ [author_flair_text] => [title] => ABC News’ Amy Robach has mammogram live on GMA. Results Reveal Breast Cancer Diagnosis. [created_utc] => 1384177409 [ups] => 1384 [num_comments] => 130 [visited] => [num_reports] => [distinguished] => ) ) // ECT... I CUT HERE BECAUSE IT WENT ON FOR A WHILE [after] => t3_1qdinr [before] => ) ) Here's the url to the exact output, I had to trim the code to fit the character limit so maybe there's something I messed up ! :P Okay: Link goes here...

    Read the article

  • Most efficient way to LIMIT results in a JOIN?

    - by johnnietheblack
    I have a fairly simple one-to-many type join in a MySQL query. In this case, I'd like to LIMIT my results by the left table. For example, let's say I have an accounts table and a comments table, and I'd like to pull 100 rows from accounts and all the associated comments rows for each. Thy only way I can think to do this is with a sub-select in in the FROM clause instead of simply selecting FROM accounts. Here is my current idea: SELECT a.*, c.* FROM (SELECT * FROM accounts LIMIT 100) a LEFT JOIN `comments` c on c.account_id = a.id ORDER BY a.id However, whenever I need to do a sub-select of some sort, my intermediate level SQL knowledge feels like it's doing something wrong. Is there a more efficient, or faster, way to do this, or is this pretty good? By the way... This might be the absolute simplest way to do this, which I'm okay with as an answer. I'm simply trying to figure out if there IS another way to do this that could potentially compete with the above statement in terms of speed.

    Read the article

  • Multiple mod rewrites in .htaccess

    - by Bob
    I want the following rules but I don't seem to get the right setup. <domain>/training-courses/ both with or without the slash at the end it should go to: <domain>/?index.php?page=training-courses and for each variable extra after this I want it to behave like this: <domain>/training-courses/success/another-value/and-yet-another/ to <domain>/?index.php?page=training-courses&val1=success&val2=another-value&val3=and-yet-another-value If it's not possible to have the option for unlimited leading variables, i'd like to have at least 2 variables after the page variable Is this possible? and how do I get this sorted out? I have this so far: RewriteEngine On RewriteRule ^test/([^/]*)/$ /test/index.php?pagina=$1&val1=$2 RewriteRule ^test/([^/]*)$ /test/index.php?pagina=$1&val1=$2 RewriteRule ^test/([^/]*)/([^/]*)/$ /test/index.php?pagina=$1&val1=$2 RewriteRule ^test/([^/]*)/([^/]*)$ /test/index.php?pagina=$1&val1=$2 RewriteRule ^test/([^/]*)/([^/]*)/([^/]*)/$ /test/index.php?pagina=$1&val1=$2&val2=$3 RewriteRule ^test/([^/]*)/([^/]*)/([^/]*)$ /test/index.php?pagina=$1&val1=$2&val2=$3

    Read the article

  • C# IF statement against SQLite query result

    - by jakesankey
    I have a C# application that I am attempting to check my sqlite db if a filename already exists in the FileName column, if it DOESN'T exist, execute some code.. Here is what I am working with. string[] files = Directory.GetFiles(@"C:\Documents and Settings\js91162\Desktop ", "R303717*.txt*", SearchOption.AllDirectories); foreach (string file in files) { string FileNameExt1 = Path.GetFileName(file); insertCommand.CommandText = @" SELECT * FROM Import WHERE FileName == FileNameExt1;"; } string contYes = insertCommand.ExecuteNonQuery(); if (string.IsNullOrEmpty(contYes)) { //more code } EDIT: added space in path so that slash doesn't eat quotation mark

    Read the article

  • How do I remove specific numbers from a string?

    - by user1666900
    I have this string in PHP Hopelessly Incredible |SPG:M| 766 STEAM_0:1:20130600 " banned "A Blatantly Obvious Hacker 740 STEAM_0:1:55386073 " (minutes "0") (reason "Multi-Hack") The Format of the string is: Name1 Number(0-3 digits) Steam_0:x:xxxx offense (banned/kicked/mute etc) Name2 Number(0-3 digits) Steam_0:x:xxxx time reason My goal is to remove the values 766 and 740 because it is just garbage. Those values can have single, double, and triple digits. The next step would be to strip STEAM_0:1:20130600 and STEAM_0:1:55386073 out of the string and capture it in a new variable. The only constant is STEAM_0: the rest can change. I am still learning regex but I fear this is a bit complicated for me to do. Some guidance would be most appreciative.

    Read the article

  • Alternative to Dispatch for ASP?

    - by Django Reinhardt
    Hi there, we've recently stumbled across the excellent Dispatch for ASP deployment plug in. It looks great apart from one thing: It doesn't work with Visual Studio 2010, at least for us, anyway. (It's supposed to work fine.) (Yes, we've tried everything: We've managed to get Dispatch working for another FTP site, but not the main one we regularly deploy to. We have managed to connect to our main site through FileZilla FTP, so the site itself is configured correctly. All settings have been triple checked, but the software still throws up weird errors (always to do with its internal libraries).) So does anyone know of any other comparable FTP-based, deployment plug-ins for Visual Studio?

    Read the article

  • What characters are widely supported in CSS class names?

    - by last-child
    As detailed here among other places, the only valid characters in a html/css class name is a-z, A-Z, 0-9, hyphen and underscore, and the first character should be a letter. But in practice, what characters are in fact supported by most browsers? More specifically, I wonder what browsers properly understands a slash (/) in a class name, and what browsers support class names starting with a number. I'm primarily interested in getting an answer for html rather than xhtml, in case there is a difference. Thank you.

    Read the article

  • CSS issue with multi-accordion

    - by Josh
    Alright, I got some help earlier with this, but it never truly got resolved. I'm pretty sure I'm having a CSS issue, but I just can't figure out how to correct it. Currently, I have these accordions working perfectly, they collapse, expand, expand again when told to etc. The problem I'm having is aligning the content within these accordion divs. Ideally, when everything is default (collapsed) all I want seen is the thumbnail image and the Headline. Then if the user wishes, they click on the headline and it expands and if they want to make a comment or view comments, they can click once again to expand that. Here's the thing, I have to make the height 62px so everything will fit in and just not float all over the place. This creates a problem with the "View Comments" to "Text Here" area, as you can tell it has outrageous space between the two. The other issue is, as I currently have it I'm forcefully indenting the article text so that it doesn't TEXT WRAP underneath the thumbnail image. Basically, I want it split into 2 columns so nothing ever goes beneath the image, but working with this accordion and divs inside the divs it's proving to be difficult for me. I've put up a demo here: http://www.notedls.com/demo

    Read the article

  • How do I write to command line from a WPF application?

    - by ben
    Hi I know how to write to console but if I write to console in my program and call my program from the command line it won't display anything. How do I make it so that when I say Console.WriteLine or Console.Out.Writeline ir prints to the command prompt from which it was called and not somewhere else? Once again I know how to do Console.WriteLine so it's not that :-p unless I'm doing it wrong. From what I can tell it's probably something to do with Console.SetOut(TextWriter t) this is a WPF application and I need it to post its data to the command line while still retaining the GUI at startup. I've triple checked and my code hits the print lines, I can actually see the lines being printed to the Visual Studio output window, it just won't display in the command line when I run it manually without VS. If possible I need to conditionally have the console display. ie if run from command line (or even with command arguments), display or post to the prompt, otherwise do not.

    Read the article

  • Allow a new line anywhere in the regex?

    - by Scott Chamberlain
    I am having a find a replace in a bunch of RTF documents, The basic pattern I need is \{(?:\\\*)?\\field\\fldlock\{\\\*\\fldinst ?MERGEFIELD ?((?:\\.*?)?[\w\[\]]+?)(?:\\.*?)?\}(?:\{\\fldrslt\})?\} However I then found out there could potentialy be a newline before each slash, so it turned in to this. \{(?:\s*\\\*)?\s*\\field\s*\\fldlock\s*\{\s*\\\*\s*\\fldinst\s*MERGEFIELD\s*((?:\\.*?)?[\w\[\]]+?(?:\s*\\.*?)?)?\s*\}(?:\s*\{\s*\\fldrslt\s*\})?\s*\} But then I hit this it fails fees totaling $\protect {\field\fldlock{\*\fldinst MERGEFIELD ENTEROUTSTANDINGVETERINARYF EES}}\plain\f0\fs24\prot Is there way have to have it match a new line anywhere in the search too without adding (?:\r?\n)? everywhere? EDIT To clear up confusion on the new lines. I need to keep the newlines in the document, I only want to remove the newlines if they are inside my match, so in the final example I posted it should replace fees totaling $\protect {\field\fldlock{\*\fldinst MERGEFIELD ENTEROUTSTANDINGVETERINARYF EES}}\plain\f0\fs24\prot with fees totaling $\protect ENTEROUTSTANDINGVETERINARYFEES\plain\f0\fs24\prot

    Read the article

  • Suggest encoding which removes slashes which I can use as the format for REST-style URL-paramteters

    - by Binary255
    Given a path to a REST style URL: http://site.com/rest/customer/foo/robot/bar/1 When you GET it, it returns a PDF to the foo-customer containing page 1 of the bar-URL. While foo is the name of the customer bar is an URL. The URL usually contains slashes and might look something like this: http://anothersite.com/interestingarticle.html As REST URL's separate arguments by slashes I can't just put it into the REST URL above. Which encoding should I use? I can't use Base 64 as it utilizes the slash as well. As a technical note I will encode the URL in a .NET-application and decode it in PHP.

    Read the article

  • Printing escape character

    - by danutenshu
    When I am given "d""\"/""b", I need to print out the statement character for character. (d, b, a slash, a backslash, and 5 quotes) in C++. The only errors that show now are the lines if(i.at(j)="\\") and else if(i.at(j)="\""). Also, how should the outside double apostrophes be excluded? #include <iostream> #include <cstdlib> using namespace std; int main (int argc, const char* argv[] ) { string i= argv[1]; for (int j=0; j>=sizeof(i)-1; j++) { if(i.at(j)="\\") { cout << "\\"; } else if(i.at(j)="\"") { cout << "\""; } else { cout << i.at(j); } } return 0; }

    Read the article

  • How do I subtract two dates in Django/Python?

    - by Ryan
    Hi! I'm working on a little fitness tracker in order to teach myself Django. I want to graph my weight over time, so I've decided to use the Python Google Charts Wrapper. Google charts require that you convert your date into a x coordinate. To do this I want to take the number of days in my dataset by subtracting the first weigh-in from the last weigh-in and then using that to figure out the x coords (for example, I could 100 by the result and increment the x coord by the resulting number for each y coord.) Anyway, I need to figure out how to subtract Django datetime objects from one another and so far, I am striking out on both google and here at the stack. I know PHP, but have never gotten a handle on OO programming, so please excuse my ignorance. Here is what my models look like: class Goal(models.Model): goal_weight = models.DecimalField("Goal Weight",max_digits=4, decimal_places=1) target_date = models.DateTimeField("Target Date to Reach Goal") set_date = models.DateTimeField("When did you set your goal?") comments = models.TextField(blank=True) def __unicode__(self): return unicode(self.goal_weight) class Weight(models.Model): """Weight at a given date and time """ goal = models.ForeignKey(Goal) weight = models.DecimalField("Current Weight",max_digits=4, decimal_places=1) weigh_date = models.DateTimeField("Date of Weigh-In") comments = models.TextField(blank=True) def __unicode__(self): return unicode(self.weight) def recorded_today(self): return self.date.date() == datetime.date.today() Any ideas on how to proceed in the view? Thanks so much!

    Read the article

  • How do I simplify my code?

    - by Mitchell Skurnik
    I just finished creating my first major application in C#/Silverlight. In the end the total line count came out to over 12,000 lines of code. Considering this was a rewrite of a php/javascript application I created 2 years that was over 28,000 lines I am actually quite proud of my accomplishment. After reading many questions and answers here on stackoverflow and other sites online, I followed many posters advice: I created classes, procedures, and such for things that I would have a year ago copied and pasted; I created logic charts to figure out complex functions; making sure there are no crazy hidden characters (used tabs instead of spaces); and a few others things; place comments where necessary (I have lots of comments). My application consists of 4 tiles laid out horizontally that have user controls loaded into each slice. You can have between one and four slices loaded at anytime. If you have once slice loaded, the slice takes up the entire artboard...if you have 2 loaded, each take up half, 3 a third, 4 a quarter. Each one of these slices represent (for the sake of this example) a light control. Each slice has 3 slider controls in it. Now when I coded the functionality of the sliders, I used a switch/case statement inside of a public function that would run the command on the specified slice/slider. The made for some duplicate code but I saw no way around it as each slice was named differently. So I would do slice1.my.commands(); slice2.my.commands(); etc. My question to you is how do I clean up my code even futher? (Sadly I cannot post any of my code). Is there any way to take this repetion out of my code?

    Read the article

  • JQuery multiple id index with form submit

    - by RussP
    Hi folks, not sure how to do this as ID's are ment to be unique but this is a dynamically series of forms generated from a php array - based on reading the file names in a directory - with the same ID. What I need to do is identify which form so the data can be processed. Here is the form echo '<form method="post" action="" id="frmwidget">'; echo '<tr>'; echo '<td>'; echo ucfirst($comments[0]); echo '</td><td>'; echo $comments[1]; echo '</td><td align="center">'; echo '<input type="checkbox">'; echo '</td>'; echo '</td><td align="center">'; echo '<input type="checkbox">'; echo '</td>'; echo '</td><td align="center">'; echo '<input type="checkbox">'; echo '</td>'; echo '</td><td align="center">'; echo '<input type="submit" id="cmdwidgets">'; echo '</td>'; echo '</tr>'; echo '</form>'; And here is my start of the Jquery $j(document).ready(function() { $j('#cmdwidgets').live('click',function(){ alert('Your widgets will load'); I will want to Ajax the form in here .. not just an alert $j('#wall').load("admin/inc/ajax-widgets.php"); return false; }); }); Yes I know the form could be 1 form not multiples, but for this purpose it needs to be multiple forms. And yes I know the form is incomplete i.e. field names etc. Any help/suggestions please - thanks in advance

    Read the article

  • Manipulating Directory Paths in Python

    - by G Ullman
    Basically I've got this current url and this other key that I want to merge into a new url, but there are three different cases. Suppose the current url is localhost:32401/A/B/foo if key is bar then I want to return localhost:32401/A/B/bar if key starts with a slash and is /A/bar then I want to return localhost:32401/A/bar finally if key is its own independent url then I just want to return that key = htt p://foo.com/bar - http://foo.com/bar I assume there is a way to do at least the first two cases without manipulating the strings manually, but nothing jumped out at me immediately in the os.path module.

    Read the article

  • error in a c code while trying to remove whitespace

    - by mekasperasky
    this code is the base of lexer , and it does the basic operation of removing the whitespaces from a source file and rewrites it into another file with each word in separate lines . But i am not able to understand why the file lext.txt not getting updated? #include<stdio.h> /* this is a lexer which recognizes constants , variables ,symbols, identifiers , functions , comments and also header files . It stores the lexemes in 3 different files . One file contains all the headers and the comments . Another file will contain all the variables , another will contain all the symbols. */ int main() { int i; char a,b[20],c; FILE *fp1,*fp2; fp1=fopen("source.txt","r"); //the source file is opened in read only mode which will passed through the lexer fp2=fopen("lext.txt","w"); //now lets remove all the white spaces and store the rest of the words in a file if(fp1==NULL) { perror("failed to open source.txt"); //return EXIT_FAILURE; } i=0; while(!feof(fp1)) { a=fgetc(fp1); if(a!="") { b[i]=a; printf("hello"); } else { b[i]='\0'; fprintf(fp2, "%.20s\n", b); i=0; continue; } i=i+1; /*Switch(a) { case EOF :return eof; case '+':sym=sym+1; case '-':sym=sym+1; case '*':sym=sym+1; case '/':sym=sym+1; case '%':sym=sym+1; case ' */ } return 0; }

    Read the article

  • Confused as to why my PHP include isn't working

    - by Sam
    I had a prototype of my website working correctly, meaning it connected to the database correctly. This was done with just one file called "connect.php" which had mysql_connect() and such inside it. I then separated the connect information into to separate files, one containing the account information (account.php) and one containing the connect function (connect.php), with correct information (I triple checked) and it isn't connecting properly. All I can think of is that I'm not including it the right way. This is what I have in a file: <?php include('account.php'); include('connect.php'); include('functions.php'); ..... ?>

    Read the article

  • jQuery: part of a function not executing

    - by SODA
    Hi. I have a tabbed setup on the page and I want to automatically make corresponding menu tab highlighted as well as corresponding content div show depending on # hash. Example: http://design.vitalbmx.com/user_menu/member_profile_so.html -- no hash, opens 1st tab http://design.vitalbmx.com/user_menu/member_profile_so.html#setup -- #setup, should open "Setup" tab As you can see it works for highlighting "Setup" tab. But content div does not change. The script is below: var tab_content_current = 1; switch (window.location.hash) { case '#activity': tab_content_current = 1; break; case '#friends': tab_content_current = 2; break; case '#photos': tab_content_current = 3; break; case '#videos': tab_content_current = 4; break; case '#setup': tab_content_current = 5; break; case '#forum': tab_content_current = 6; break; case '#blog': tab_content_current = 7; break; case '#comments': tab_content_current = 8; break; case '#favorites': tab_content_current = 9; break; case '#profile-comments': tab_content_current = 10; break; default: tab_content_current = 1; } if (tab_content_current != 1) { change_active_tab (tab_content_current); } function tabs_toggle (id) { if (id != tab_content_current) { change_active_tab (id); tab_content_current = id; } } function change_active_tab (id) { $j('.profile_tabs li').removeClass('active'); if (id < 8) $j('.profile_tab_'+id).addClass('active'); $j('.profile_content').hide(); $j('#profile_content_'+id).fadeIn(); } Note that it works when you actually click menu tabs. Any help to fix this problem would be greatly appreciated.

    Read the article

  • Why isn't this json/jquery function returning 10 results and why does it return 0 sometimes?

    - by Scarface
    Hey guys, quick question. I have a json function returning results from a php query but it is not working out because it seems to keep executing the query until all results are returned and sometimes returns 0 results (if I keep refreshing page, it returns 0 results sometimes). I want to limit results returned to 10 so I was wondering if anyone could point out the error of my code. Would really appreciate it. PS I am positive the query is returning the correct results and only 10 on its own. It just seems to be this one function that is not working out. SELECT time, user, comment FROM comments WHERE topic_id='$topic_id' ORDER BY time DESC LIMIT 10 var count=0; function prepare(response) { count++; var string = '<li class="list" id="list-'+count+'">' +'</li>'; return string; } $.getJSON(files+"comments.php?action=view&load=initial&topic_id="+topic_id+"&t=" + (new Date()), function(json) { if(json.length) { for(i=0; i < json.length; i++) { $('#shoutbox-list').prepend(prepare(json[i])); $('#list-' + count).fadeIn(1500); } var j = i-1; lastTime = json[j].time; } });

    Read the article

< Previous Page | 69 70 71 72 73 74 75 76 77 78 79 80  | Next Page >