Search Results

Search found 3484 results on 140 pages for 'chris dwyer'.

Page 79/140 | < Previous Page | 75 76 77 78 79 80 81 82 83 84 85 86  | Next Page >

  • NSStream sockets missing data

    - by Chris T.
    I am trying to pull some sample data from FreeDB as a proof of concept, but I am having a tough time retrieving all of the data off the incoming stream (I am only getting the last bits for the final query listed here (if handshakeCode = 3) I think this may be something with the threading on the main runloop, but I am not sure. Odd thing is when the buffer size is larger than 1-2 bytes (which works as expected), I seem to be losing access to the data programmatically (the totalOutput variable on the first set of data is incomplete). I set up a packet capture, and it looks like those 1024 bytes are coming across the wire, but the app just isn't working with it. It looks like the next event is coming through and basically taking over. I tried using an NSLock to no avail as well. If I drop the buffer size down to 1 or 2, things seem to be reading just fine. This is probably obvious to someone who does this all the time, but this is my first foray into this with something I am familiar with, technology wise in other languages / platforms. The following code will show you what is happening. Run with the buffer set to 1024, and you will see a short final string, but once you set it to 1, you will see the amount of data I was expecting (I was even expecting it to be split, so that's not a big worry) #import <Foundation/Foundation.h> #import <Cocoa/Cocoa.h> //STACK OVERFLOW CODE: @interface stackoverflow : NSObject <NSStreamDelegate> { NSInputStream *iStream; NSOutputStream *oStream; int handshakeCode; NSString *selectedDiscId; NSString *selectedGenre; } -(void)getMatchesFromFreeDB; -(void)sendToOutputStream:(NSString*)command; @end @implementation stackoverflow -(void)getMatchesFromFreeDB { NSHost *host = [NSHost hostWithName:@"freedb.freedb.org"]; [NSStream getStreamsToHost:host port:8880 inputStream:&iStream outputStream:&oStream]; [iStream retain]; [oStream retain]; [iStream setDelegate:self]; [oStream setDelegate:self]; [iStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; [oStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; [iStream open]; [oStream open]; handshakeCode = 0; //not done any processing } -(void)stream:(NSStream *)aStream handleEvent:(NSStreamEvent)eventCode { switch(eventCode) { case NSStreamEventOpenCompleted: { NSLog(@"Stream open completed"); break; } case NSStreamEventHasBytesAvailable: { NSLog(@"Stream has bytes available"); if (aStream == iStream) { NSMutableString *totalOutput = [NSMutableString stringWithString:@""]; //read data uint8_t buffer[1024]; int len; while ([iStream hasBytesAvailable]) { len = [iStream read:buffer maxLength:sizeof(buffer)]; if (len 0) { NSString *output = [[NSString alloc] initWithBytes:buffer length:len encoding:NSUTF8StringEncoding]; //this could have also been put into an NSData object if (nil != output) { //append to the total output [totalOutput appendString:output]; } } } NSLog(@"OUTPUT , %i:\n\n%@", [totalOutput lengthOfBytesUsingEncoding:NSUTF8StringEncoding], totalOutput); NSArray *outputComponents = [totalOutput componentsSeparatedByString:@" "]; //Attempt to get handshake code, since we haven't done it yet: if (handshakeCode == 1) { //we are just getting the sign-on banner: //let's move on: handshakeCode = 2; } else if (handshakeCode == 2) { handshakeCode = [[outputComponents objectAtIndex:0] intValue]; if (handshakeCode == 200) { NSLog(@"---Handshake OK %i", handshakeCode); NSMutableString *query = [NSMutableString stringWithString:@"cddb query f3114b11 17 225 19915 36489 54850 69425 87025 103948 123242 136075 152817 178335 192850 211677 235104 262090 284882 308658 4430\n"]; handshakeCode = 3; [self sendToOutputStream:query]; } } else if (handshakeCode == 3) { //now, we are reading out the matches: if ([[outputComponents objectAtIndex:0] intValue] == 200) //found exact match: { NSLog(@"Found exact match"); selectedGenre = [outputComponents objectAtIndex:1] ; selectedDiscId = [outputComponents objectAtIndex:2]; if (selectedGenre && selectedDiscId) { //send off the request to get the entry: NSString *query = [NSString stringWithFormat:@"cddb read %@ %@\n", selectedGenre, selectedDiscId]; [self sendToOutputStream:query]; handshakeCode = 4; } } } } break; } case NSStreamEventEndEncountered: { NSLog(@"Stream event end encountered"); break; } case NSStreamEventErrorOccurred: { NSLog(@"Stream error occurred"); break; } case NSStreamEventHasSpaceAvailable: { NSLog(@"Stream has space available"); if (aStream == oStream) { if (handshakeCode == 0) { handshakeCode = 1; [self sendToOutputStream:@"cddb hello stackoverflow localhost.localdomain test .01BETA\n"]; } } break; } } } -(void)sendToOutputStream:(NSString*)command { const uint8_t *rawCommand = (const uint8_t *)[command UTF8String]; [oStream write:rawCommand maxLength:strlen(rawCommand)]; NSLog(@"Sent command: %@",command); } @end int main (int argc, const char * argv[]) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; stackoverflow *test = [[stackoverflow alloc] init]; [test getMatchesFromFreeDB]; NSRunLoop *runLoop = [NSRunLoop currentRunLoop]; [runLoop run]; [pool drain]; return 0; } Any help is much appreciated! Thanks

    Read the article

  • Anybody got a C# function that maps the SQL datatype of a column to its CLR equivalent?

    - by Chris McCall
    I'm sitting down to write a massive switch() statement to turn SQL datatypes into CLR datatypes in order to generate classes from MSSQL stored procedures. I'm using this chart as a reference. Before I get too far into what will probably take all day and be a huge pain to fully test, I'd like to call out to the SO community to see if anyone else has already written or found something in C# to accomplish this seemingly common and assuredly tedious task.

    Read the article

  • [ASP.NET] Difficulties using custom control - RichTextEditor

    - by Chris
    I am working on a school project that uses ASP.NET. I found this TextEditor control ( http://blogs.msdn.com/kirti/archive/2007/11/10/rich-text-editor-is-here.aspx ) that I am trying to include but it isn't working. The error I am getting is: Error Rendering Control - TextEditor. An unhandled exception has occurred. Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index. I see this error when I go Design part of the editor. I just don't understand this error at all. Also I am a lil bit confused as there is no parameter called index. :( What I have done is reference the binary in my project and then on the page I am trying to use it have registered its namespace and assembly with this line: <%@ Register Assembly="RichTextEditor" Namespace="AjaxControls" TagPrefix="rtt" %> I then go ahead and try to add the control to the page with this line of code: <rtt:richtexteditor ID="TextEditor" Theme="Blue" runat="server" /> Any help would be much appreciated. I haven't done anything like add a custom control before.

    Read the article

  • multiple polls with email submit function

    - by Chris Mousdale
    I want to add a 4 sets of polls that each have around 4 radio buttons each for answers - then i would like to add an 'enter your email address' field below these polls. Finally I would like the submit button after the email field to 'submit' the data from the polls and the email address entered - so only one submit button. Just to make things even better, I would like some form of validation, that will not pass the form unless all 4 polls have a radio button pressed and a valid email. All this is then to go into a MySQL database. I have the email validation bit nailed - so thats fine.. it's the multiple polls bit thats getting me - I cannot get it to work?! Do i have to effectively add 5 forms? Any help would be greatly appreciated.

    Read the article

  • FileNotFound exception when trying to write to a file

    - by Chris Knight
    OK, I'm feeling like this should be easy but am obviously missing something fundamental to file writing in Java. I have this: File someFile = new File("someDirA/someDirB/someDirC/filename.txt"); and I just want to write to the file. However, while someDirA exists, someDirB (and therefore someDirC and filename.txt) do not exist. Doing this: BufferedWriter writer = new BufferedWriter(new FileWriter(someFile)); throws a FileNotFoundException. Well, er, no kidding. I'm trying to create it after all. Do I need to break up the file path into components, create the directories and then create the file before instantiating the FileWriter object?

    Read the article

  • Windows batch files: .bat vs .cmd?

    - by Chris Noe
    As I understand it, .bat is the old 16-bit naming convention, and .cmd is for 32-bit Windows, i.e., starting with NT. But I continue to see .bat files everywhere, and they seem to work exactly the same using either suffix. Assuming that my code will never need to run on anyhting older than NT, does it really matter which way I name my batch files, or is there some gotcha awaiting me by using the wrong suffix?

    Read the article

  • PHP Form: After getting results adding a new table row when entering new information.

    - by Chris
    Hello, Although probarly quite simple, i cannot seem to find the following. The form takes certain data, and then represents the data in a table. Next step i click the hyperlink that takes me back to the form. Now my question is how exactly do i make it possible when filling in the same form again so both results are displayed in the same table? Then filling in a other form with data adds another row and so on. Regards. The code below (pardon me that it is not english). <?php session_start(); ?> <!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> <title>ExpoFormulier</title> <body> <?php if (!empty($_POST)) { $standnaam = $_POST["standnaam"]; $oppervlakte = $_POST["oppervlakte"]; //value in the form van checkboxes op 1 zetten! $verdieping = isset($_POST["verdieping"]) ? $_POST["verdieping"] : 0; //if checkbox checked value 1 anders 0 $telefoon = isset($_POST["telefoon"]) ? $_POST["telefoon"] : 0; $netwerk = isset($_POST["netwerk"]) ? $_POST["netwerk"] : 0; if (is_numeric($oppervlakte)) { $_SESSION["standnaam"]=$standnaam; $_SESSION["oppervlakte"]=$oppervlakte; $_SESSION["verdieping"]=$verdieping; $_SESSION["telefoon"]=$telefoon; $_SESSION["netwerk"]=$netwerk; header("Location:ExpoOverzicht.php"); //verzenden naar ExpoOverzicht.php dmv header } else { echo "<h1>Foute gegevens, Opnieuw invullen a.u.b</h1>"; } } ?> <form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post" id="form1"> <h1>Vul de gegevens in</h1> <table> <tr> <td>Standnaam:</td> <td><input type="text" name="standnaam" size="18"/></td> </tr> <tr> <td>Oppervlakte (in m^2):</td> <td><input type="text" name="oppervlakte" size="6"/></td> </tr> <tr> <td>Verdieping:</td> <td><input type="checkbox" name="verdieping" value="1"/></td> <!--value op 1 zetten voor checkbox! indien checked is value 1 --> </tr> <tr> <td>Telefoon:</td> <td><input type="checkbox" name="telefoon" value="1"/></td> </tr> <tr> <td>Netwerk:</td> <td><input type="checkbox" name="netwerk" value="1"/></td> </tr> <tr> <td><input type="submit" name="verzenden" value="Verzenden"/></td> </tr> </table> </form> Second File: <?php session_start(); ?> <!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> <title>ExpoOverzicht</title> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <link href="StyleSheetExpo.css" rel="stylesheet" type="text/css" /> </head> <body> <h1>Overzicht van de ingegeven standen in deze sessie</h1> <?php $standnaam = $_SESSION["standnaam"]; $oppervlakte = $_SESSION["oppervlakte"]; $verdieping = $_SESSION["verdieping"]; $telefoon = $_SESSION["telefoon"]; $netwerk = $_SESSION["netwerk"]; $result1 = 0; //telkens declaren anders fout "undefined variable" $result2 = 0; $result3 = 0; $prijsCom = 0; $prijsVerdieping = 0; for ($i=1; $i <= $oppervlakte; $i++) { if($i <= 10) { $tarief1 = 1 * 100; $result1 += $tarief1; } if($i > 10 && $i <= 30) { $tarief2 = 1 * 90; $result2 += $tarief2; } if($i > 30) { $tarief3 = 1 * 80; $result3 += $tarief3; } } $prijsOpp = $result1 + $result2 + $result3; if($verdieping == 1) { $prijsVerdieping = $oppervlakte * 120; } if(($telefoon == 1) || ($netwerk == 1)) // eerst deze OR conditie of anders gebruikt de code alleen nog maar 20 { $prijsCom = 20; } if(($telefoon == 1) && ($netwerk == 1)) { $prijsCom = 30; } $totalePrijs = $prijsOpp + $prijsVerdieping + $prijsCom; echo "<table class=\"tableExpo\">"; echo "<th>Standnaam</th>"; echo "<th>Oppervlakte</th>"; echo "<th>Verdieping</th>"; echo "<th>Telefoon</th>"; echo "<th>Netwerk</th>"; echo "<th>Totale prijs</th>"; echo "<tr>"; echo "<td>".$standnaam."</td>"; echo "<td>".$oppervlakte."</td>"; echo "<td>".$verdieping."</td>"; echo "<td>".$telefoon."</td>"; echo "<td>".$netwerk."</td>"; echo "<td>".$totalePrijs."</td>"; echo "</tr>"; echo "</table>"; ?> <a href="ExpoFormulier.php">Terug naar het formulier</a> </body> </html> </body> </html>

    Read the article

  • NSXMLParser rss issue NSXMLParserInvalidCharacterError

    - by Chris Van Buskirk
    NSXMLParserInvalidCharacterError # 9 This is the error I get when I hit a weird character (like quotes copied and pasted from word to the web form, that end up in the feed). The feed I am using is not giving an encoding, and their is no hope for me to get them to change that. This is all I get in the header: < ?xml version="1.0"? < rss version="2.0" What can I do about illegal characters when parsing feeds? Do I sweep the data prior to the parse? Is there something I am missing in the API? Has anyone dealt with this issue?

    Read the article

  • Using Proguard for Android in Eclipse Problem

    - by Chris
    I have taken a fresh install of Eclipse and all the latest Android tools and want to use Proguard on existing project, but for now I have created a new blank one. I have added a proguard.cfg file to my project added proguard.config=proguard.cfg to my default.properties Now when I try to export I get the following error [2010-12-12 10:36:35 - ApplicationTest] Proguard returned with error code 1. See console [2010-12-12 10:36:35 - ApplicationTest] 'C:\Program' is not recognized as an internal or external command, [2010-12-12 10:36:35 - ApplicationTest] operable program or batch file. [2010-12-12 10:36:35 - ApplicationTest] '-jar' is not recognized as an internal or external command, [2010-12-12 10:36:35 - ApplicationTest] operable program or batch file. I know it means there is a filepath setup incorrectly, question is where the heck is as I have looked through the general properties and project properties and can't see any reference to proguard or obfuscation so am stuck on what to change Any help appreciated.

    Read the article

  • Can I use XText for a DSL involving an XML file type?

    - by Chris
    I have defined a small DSL that is mostly written in the form of different types of XML files in conjuction with some property files. This works very well but I wish to create an Eclipse Editor to make editing these files easier for beginners (I already have a working parser). The main XML file can reference some items from the .properties files and vice-versa. THe main xml file can also reference other XML files. Certain options should only be available in the main xml file based on the contents of the .properties files and based on some osgi plugins that can be added to the DSL project (the syntax is dynamic depending on context). The structure of the language is fixed but the options available in each attribute or the choice of attributes themselves changes depending on metadata contained in plugin .jar files. Questions: Does XText support dynamic syntax (validation changes depending on external factors)? Does XText support XML files / .properties files? Thank you very much for your help in advance.

    Read the article

  • ASP.net User Controls and business entities

    - by Chris
    Hi all, I am currently developing some user controls so that I can use them at several places within a project. One control is a about editing a list of addresses for a customer. Since this needs to be done at several places within the project I want to make it a simple user control. The user control contains a repeater control. By default the repeater displays one address item to be edited. If more addresses need to be added, the user can click on a button to append an additional address to be entered. The user control should work for creating new addresses as well as editing existing ones. The address business entity looks something like this: public class Address { public string Street { get; set; } public City City { get; set; } public Address(string street, City city) { Check.NotNullOrEmpty(street); Check.NotNull(city); Street = street; City = city; } } As you can see an address can only be instantiated if there is a street and a city. Now my idea was that the user control exposes a collection property called Addresses. The getter of this property collects the addresses from the repeater and return it in a collection. The setter would databind the addresses to be edited to the repeater. Like this: public partial class AddressEditControl : System.Web.UI.UserControl { public IEnumerable<Address> Addresses { get { IList<Address> addresses = new List<Address>(); // collect items from repeater and create addresses foreach (RepeaterItem item in addressRepeater.Items) { // collect values from repeater item addresses.Add(new Address(street, city)); } return addresses; } set { addressRepeater.DataSource = value; addressRepeater.DataBind(); } } } First I liked this approach since it is object oriented makes it very easy to reuse the control. But at some place in my project I wanted to use this control so a user could enter some addresses. And I wanted to pre-fill the street input field of each repeater item since I had that data so the user doesn't need to enter it all by his self. Now the problem is that this user control only accepts addresses in a valid state (since the address object has only one constructor). So I cannot do: IList<Addresses> addresses = new List<Address>(); addresses.Add(new Address("someStreet", null)); // i dont know the city yet (user has to find it out) addressControl.Addresses = addresses; So the above is not possible since I would get an error from address because the city is null. Now my question: How would I create such a control? ;) I was thinking about using an Address DTO instead of a real address, so it can later be mapped to an address. That way I can pass in and out an address collection which addresses don't need to be valid. Or did I misunderstood the way user controls work? Are there any best practices?

    Read the article

  • Table Design For SystemSettings, Best Model

    - by Chris L
    Someone suggested moving a table full of settings, where each column is a setting name(or type) and the rows are the customers & their respective settings for each setting. ID | IsAdmin | ImagePath ------------------------------ 12 | 1          | \path\to\images 34 | 0          | \path\to\images The downside to this is every time we want a new setting name(or type) we alter the table(via sql) and add the new (column)setting name/type. Then update the rows(so that each customer now has a value for that setting). The new table design proposal. The proposal is to have a column for setting name and another column for setting. ID | SettingName | SettingValue ---------------------------- 12 | IsAdmin        | 1 12 | ImagePath   | \path\to\images 34 | IsAdmin        | 0 34 | ImagePath   | \path\to\images The point they made was that adding a new setting was as easy as a simple insert statement to the row, no added column. But something doesn't feel right about the second design, it looks bad, but I can't come up with any arguments against it. Am I wrong?

    Read the article

  • Protecting Data Feed for iPhone App

    - by Chris
    I am creating an App that pulls data from a file on my server. That file gets data from my database, based on GET values that are passed through the URL. I would like to keep this feed closed - that is, I don't want people finding the datasource and reading the data on their own. I considered sending an alphanumeric id along with the url string, but if they can find the URL that I am calling, then there won't be anything preventing them from grabbing that alphanumeric id also. I am looking for any ideas or experiences that might help me here. Thanks.

    Read the article

  • Displaying a popup widget in QT over application border

    - by Chris Kaminski
    Let's say that I have an application frame, and I want to show a popup QCalendarWidget over on the right side of the frame. Normally, QT will clip the edges of the QCalendarWidget, cutting it in half and not displaying the rest, as it would be over the right side border. Is there a way to work around this limitation without resorting to implementing a QDialog? I want the widget to be visible outside the bounds of it's container.

    Read the article

  • add ms ajax accordion pane at runtime loses previous pane issue

    - by Chris Conway
    I have an AjaxControlToolkit accordion control that i'm trying to load panes at runtime. When I click a button inside a listview, it should add a new pane to the accordion control. Here is the code that adds the pane in the onitemcommand event within the listview var pane = new AccordionPane { ID = key }; pane.HeaderContainer.Controls.Add(new LiteralControl(label.Text)); pane.ContentContainer.Controls.Add(LoadControl("~/UserControls/Covers/" + e.CommandArgument + ".ascx")); accordion.Panes.Add(pane); And this will successfully show a webcontrol inside the accordion control. But when I click on another button in the listview, the accordion is reset and it only shows the new pane instead of appending a new pane. Is there any way to keep the previous pane visible across postbacks like this? By the way, each of the webcontrols that are loaded in the accordion have input fields that will need to be persisted across postbacks as well. thanks!

    Read the article

  • Connecting to a network drive programmatically and caching credentials

    - by Chris Doggett
    I'm finally set up to be able to work from home via VPN (using Shrew as a client), and I only have one annoyance. We use some batch files to upload config files to a network drive. Works fine from work, and from my team lead's laptop, but both of those machines are on the domain. My home system is not, and won't be, so when I run the batch file, I get a ton of "invalid drive" errors because I'm not a domain user. The solution I've found so far is to make a batch file with the following: explorer \\MACHINE1 explorer \\MACHINE2 explorer \\MACHINE3 Then manually login to each machine using my domain credentials as they pop up. Unfortunately, there are around 10 machines I may need to use, and it's a pain to keep entering the password if I missed one that a batch file requires. I'm looking into using the answer to this question to make a little C# app that'll take the login info once and login programmatically. Will the authentication be shared automatically with Explorer, or is there anything special I need to do? If it does work, how long are the credentials cached? Is there an app that does something like this automatically? Unfortunately, domain authentication via the VPN isn't an option, according to our admin. EDIT: If there's a way to pass login info to Explorer via the command line, that would be even easier using Ruby and highline.

    Read the article

  • armv6 / armv7 errors when compiling for iPhone

    - by Chris
    I am having problems trying to compile my App to my iPhone. I upgraded to the new SDK and have 4.0 on my phone... which I did not do that. I am compiling for 3.1.2 - It works fine in the simulator but when I "build" for the Device, it gives me this line of errors: Link /Users/me/Apps/myapp/build/app.build/Debug-iphoneos/app.build/objects-normal/armv7/appname In /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.3.sdk/user/lib/libz.dylib, missing required architecture armv7 in file then the actual failure occurs on: Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2 failed with exit code 1 Any help would be greatly appreciated

    Read the article

  • A good Design-by-Contract library for Java?

    - by Chris Jones
    A few years ago, I did a survey of DbC packages for Java, and I wasn't wholly satisfied with any of them. Unfortunately I didn't keep good notes on my findings, and I assume things have changed. Would anybody care to compare and contrast different DbC packages for Java?

    Read the article

  • Manually listing objects in Django (problem with field ordering)

    - by Chris
    I'm having some trouble figuring out the best/Djangoic way to do this. I'm creating something like an interactive textbook. It has modules, which are more or less like chapters. Each module page needs to list the topics in that module, grouped into sections. My question is how I can ensure that they list in the correct order in the template? Specifically: 1) How to ensure the sections appear in the correct order? 2) How to ensure the topics appear in the correct order in the section? I imagine I could add a field to each model purely for the sake of ordering, but the problem with that is that a topic might appear in different modules, and in whatever section they are in there they would again have to be ordered somehow. I would probably give up and do it all manually were it not for the fact that I need to have the Topic as object in the template (or view) so I can mark it up according to how the user has labeled it. So I suppose my question is really to do with whether I should create the contents pages manually, or whether there is a way of ordering the query results in a way I haven't thought of. Thanks for your help!

    Read the article

  • Schema qualified tables with SQLAlchemy, SQLite and Postgresql?

    - by Chris Reid
    I have a Pylons project and a SQLAlchemy model that implements schema qualified tables: class Hockey(Base): __tablename__ = "hockey" __table_args__ = {'schema':'winter'} hockey_id = sa.Column(sa.types.Integer, sa.Sequence('score_id_seq', optional=True), primary_key=True) baseball_id = sa.Column(sa.types.Integer, sa.ForeignKey('summer.baseball.baseball_id')) This code works great with Postgresql but fails when using SQLite on table and foreign key names (due to SQLite's lack of schema support) sqlalchemy.exc.OperationalError: (OperationalError) unknown database "winter" 'PRAGMA "winter".table_info("hockey")' () I'd like to continue using SQLite for dev and testing. Is there a way of have this fail gracefully on SQLite?

    Read the article

  • Drupal Adding Span inside A tags in Nice Menus

    - by Chris
    I am trying to add drop down menus to a drupal theme which uses text sliding door CSS rounding. The current version uses a primary links injection of the span into the a tags, which works fine. But doesn't support drop down menus. Working code: <?php print theme('links', $primary_links, array('class' => 'links primary-links')) ?> In the template with a template.php file addition: <?php // function for injecting spans inside anchors which we need for the theme's rounded corner background images function strands_guybrush_links($links, $attributes = array('class' => 'links')) { $output = ''; if (count($links) > 0) { $output = '<ul'. drupal_attributes($attributes) .'>'; $num_links = count($links); $i = 1; foreach ($links as $key => $link) { $class = $key; // Add first, last and active classes to the list of links to help out themers. if ($i == 1) { $class .= ' first'; } if ($i == $num_links) { $class .= ' last'; } if (isset($link['href']) && ($link['href'] == $_GET['q'] || ($link['href'] == '<front>' && drupal_is_front_page()))) { $class .= ' active'; } $output .= '<li'. drupal_attributes(array('class' => $class)) .'>'; if (isset($link['href'])) { $link['title'] = '<span class="link">' . check_plain($link['title']) . '</span>'; $link['html'] = TRUE; // Pass in $link as $options, they share the same keys. $output .= l($link['title'], $link['href'], $link); } else if (!empty($link['title'])) { // Some links are actually not links, but we wrap these in <span> for adding title and class attributes if (empty($link['html'])) { $link['title'] = check_plain($link['title']); } $span_attributes = ''; if (isset($link['attributes'])) { $span_attributes = drupal_attributes($link['attributes']); } $output .= '<span'. $span_attributes .'>'. $link['title'] .'</span>'; } $i++; $output .= "</li>\n"; } $output .= '</ul>'; } return $output; } ?> So I have added the [Nice Menu module][1] which works well and allows the drop down menu functions for my navigation which is now addressed from the template using: <?php print theme_nice_menu_primary_links() ?> The issue is that the a tags need to have spans inside to allow for the selected state markup. I have tried every angle I could find to edit the drupal function menu_item_link which is used by nice menus to build the links. E.g. I looked at the drupal forum for two days and no joy. The lines in the module that build the links are: function theme_nice_menu_build($menu) { $output = ''; // Find the active trail and pull out the menus ids. menu_set_active_menu_name('primary-links'); $trail = menu_get_active_trail('primary-links'); foreach ($trail as $item) { $trail_ids[] = $item['mlid']; } foreach ($menu as $menu_item) { $mlid = $menu_item['link']['mlid']; // Check to see if it is a visible menu item. if ($menu_item['link']['hidden'] == 0) { // Build class name based on menu path // e.g. to give each menu item individual style. // Strip funny symbols. $clean_path = str_replace(array('http://', '<', '>', '&', '=', '?', ':'), '', $menu_item['link']['href']); // Convert slashes to dashes. $clean_path = str_replace('/', '-', $clean_path); $class = 'menu-path-'. $clean_path; $class .= in_array($mlid, $trail_ids) ? ' active' : ''; // If it has children build a nice little tree under it. if ((!empty($menu_item['link']['has_children'])) && (!empty($menu_item['below']))) { // Keep passing children into the function 'til we get them all. $children = theme('nice_menu_build', $menu_item['below']); // Set the class to parent only of children are displayed. $class .= $children ? ' menuparent ' : ''; // Add an expanded class for items in the menu trail. $output .= '<li id="menu-'. $mlid .'" class="'. $class .'">'. theme('menu_item_link', $menu_item['link']); // Build the child UL only if children are displayed for the user. if ($children) { $output .= '<ul>'; $output .= $children; $output .= "</ul>\n"; } $output .= "</li>\n"; } else { $output .= '<li id="menu-'. $mlid .'" class="'. $class .'">'. theme('menu_item_link', $menu_item['link']) .'</li>'."\n"; } } } return $output; } As you can see the $output uses menu_item_link to parse the array into links and to added the class of active to the selected navigation link. The question is how do I add a span inside the a tags OR how do I wrap the a tags with a span that has the active class to style the sliding door links? drupal.org/project/nice_menus drupal.org/node/53233

    Read the article

  • Sharepoint designer is replacing french characters with &#65533;

    - by chris
    First of all, I'm not a web designer, I'm a programmer, so I'm working a bit out of my knowledge area. However, as the person in my office who has some working knowledge of French, I'm stuck with this issue. The Problem: Sharepoint Designer is replacing all French accented characters with the &#65533; (square box or diamond-? �) character. It doesn't appear to matter if I enter the 'é' character as alt-130 (in either design or source or as &eacute; Everything works fine when editing, but when the file is saved and loaded into a browser, it replaces the characters. When reloading into designer, the file shows the 65533 symbol. EDIT: More info. I use &#233; and save, close SP designer, Reloading SP designer will show the é (instead of the code) in source. Next reload will have replaced it with &#65533; Question 1: (more important) HOW DO I STOP THIS!? Question 2: (more interesting) Why does this happen? Charset is iso-8859-1

    Read the article

  • Download MMS content on Blackberry

    - by Chris
    Hi I am relatively new to coding for the blackberry and I need to write a java application that can capture all incoming and outgoing MMS data from a Blackberry device. I have gotten the capturing of outgoing MMS's sorted with the use of A sendListener, but the problem comes with the incoming MMS's. If I use a MessageListener that processes only those of type BinaryMessage, i can capture the binary notification SMS that comes in when there is an incoming MMS. From this notification, i can get the senders MSISDN as well as the URL on the MMSC where the content is stored. To get the actual MMS content, i presume i need to download it from this URL, but im unable to get this working. I have tried just opening a HTTPConnetion to this URL, opening an inputStream on it and reading from there, but i retrieve no content. If i manually go to that URL on the blackberry, i can see the content fine (and of course the blackberry can download it automatically anyway). Can anyone please help me asap on how i can get the mms content for incoming MMS's. Thanks alot

    Read the article

  • .htacces - moving all posts in root to a new category

    - by Chris
    Could anyone please help me? I am at the last chance saloon and losing a lot of traffic. Any help would be greatfully received. After a year based on my permalink structure, all posts were in the root so have been picked up by Google as: snowmenu.com/postname Since changing my categories and permalink structure, I need the years worth of posts on Google to be redirected to: snowmenu.com/ski-snowboard-winter-sports-news/postname Is there a way to make this happen via .htaccess? Thank you very much to anyone who's able to help me.

    Read the article

< Previous Page | 75 76 77 78 79 80 81 82 83 84 85 86  | Next Page >