Search Results

Search found 2694 results on 108 pages for 'dan smith'.

Page 51/108 | < Previous Page | 47 48 49 50 51 52 53 54 55 56 57 58  | Next Page >

  • Optimal way to initialize varying objects

    - by John Smith
    I have to initialize a lot of different types of objects based on an integer parameter. They all have the same overall initialization methods. At the moment I have the following code #def APPLE 1 #def PEAR 2 switch (t) { case APPLE: newobj = [[FApple alloc] init]; break; case PEAR: newobj = [[FPear] alloc] init]; break; default: retobj = nil; } I believe there must be a better way to do this. When I add FOrange I have to go and add another line here. What would be a better way?

    Read the article

  • Why is Zend Framework (Zend_Db_table) rejecting this SQL Query?

    - by Michael T. Smith
    I'm working on a simple JOIN of two tables (urls and companies). I am using this query call: print $this->_db->select()->from(array('u' => 'urls'), array('id', 'url', 'company_id')) ->join(array('c' => 'companies'), 'u.company_id = c.id'); which is out putting this query: SELECT `u`.`id`, `u`.`url`, `u`.`company_id`, `c`.* FROM `urls` AS `u` INNER JOIN `companies` AS `c` ON u.company_id = c.id Now, I'd prefer the c.* to not actually appear, but either way it doesn't matter. ZF dies with this error: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1" but I can run that query perfectly fine in my MySQL CLI. Any ideas how to fix up this query?

    Read the article

  • Create a PHP cache system in MySQL database?

    - by Zach Smith
    I'm creating a web service that often scrapes data from remote web pages. After scraping this data, I have a simple multidimensional array of information to use. The scraping process is fairly taxing on my server, and the page load takes a while. I was considering adding a simple cache system using a MySQL database, where I create one row per remote web page with a the array of information pulled from it stored as a JSON encoded string. Is this a good enough system? Or would something like a text file per web page be a better idea?

    Read the article

  • Why is my SSH session timing out in less than a minute?

    - by John Smith
    Within a minute of connecting to my remote Linux server through SSH, my session times out and I cannot contact the server until a few seconds have passed. Meanwhile, I'm connected to other servers without interruption. This is only happening when I establish connection from an hotel wireless AP. When I connect from my phone's Internet, the problem does not occur. Does anyone know what might be causing these unusual timeouts?

    Read the article

  • padding not shifting my logo

    - by paul smith
    I have a logo link that's using a background-image (css sprite). All works fine, but when I try to add a 20px padding to the top of the link (to give it more space for user to click the link), the background image is not moving down. Here is my css: a { background-image:url("sprite.png"); background-repeat:no-repeat; display:block; height:70px; width:70px; padding-top:20px; /* give top of the link more click space */ } And my html: <a href="#" style="background-position:0 0;"></a> What am I doing wrong?

    Read the article

  • Load php file wth xml header

    - by John Smith
    I have a php file with an xml header and xml code, named test.php. How do I load this file as an xml? The following doesn't work: $xml = simplexml_load_file('test.php'); echo $xml; I just get a white page. The test file is saved as php, as it's dynamic. It's loading data from the tradedoubler api. The xml looks something like this: <voucherList> <voucher> <id>115</id> <programId>111</programId> <programName>Program 111</programName> <code>AF30C5</code> <updateDate>1332422674941</updateDate> <startDate>1332370800000</startDate> <endDate>1363906800000</endDate> <title>Voucher number one</title> <shortDescription>Short description of the voucher.</shortDescription> <description>This is a long version of the voucher description.</description> <voucherTypeId>1</voucherTypeId> <defaultTrackUri>http://clk.tradedoubler.com/click?a(222)p(111)ttid(13)</defaultTrackUri> <siteSpecific>True</siteSpecific> </voucher> <voucher> <id>116</id> <programId>111</programId> <programName>Program 111</programName> <code>F90Z4F</code> <updateDate>1332423212631</updateDate> <startDate>1332370800000</startDate> <endDate>1363906800000</endDate> <title>The second voucher</title> <shortDescription>Short description of the voucher.</shortDescription> <description>This is a long version of the voucher description.</description> <voucherTypeId>1</voucherTypeId> <defaultTrackUri>http://clk.tradedoubler.com/click?a(222)p(111)ttid(13)url(http://www.example.com/product?id=123)</defaultTrackUri> <siteSpecific>False</siteSpecific> <landingUrl>http://www.example.com/product?id=123</landingUrl> </voucher> </voucherList>

    Read the article

  • Need help in understanding a SELECT query

    - by Grant Smith
    I have a following query. It uses only one table (Customers) from Northwind database. I completely have no idea how does it work, and what its intention is. I hope there is a lot of DBAs here so I ask for explanation. particularly don't know what the OVER and PARTITION does here. WITH NumberedWomen AS ( SELECT CustomerId ,ROW_NUMBER() OVER ( PARTITION BY c.Country ORDER BY LEN(c.CompanyName) ASC ) women FROM Customers c ) SELECT * FROM NumberedWomen WHERE women > 3 If you needed the db schema, it is here

    Read the article

  • inserts 'Array' into mysql table

    - by Noah Smith
    i want to insert an array into a mysql table. The array is produced by script scanning all the links, converting into absolute links and then displaying them in an array. i decided to mysql_query the array into the table but now i am stuck. it only posts 'Array', instead of every row from the array into a different row. Any ideas??! <?php require_once('simplehtmldom_1_5/simple_html_dom.php'); require_once('url_to_absolute/url_to_absolute.php'); $connect = mysql_connect("xxxx", "xxxx", "xxx") or die('Couldn\'t connect to MySQL Server: ' . mysql_error()); mysql_select_db("xxxx", $connect ) or die('Couldn\'t Select the database: ' . mysql_error( $connect )); $links = Array(); $URL = 'http://www.theqlick.com'; // change it for urls to grab // grabs the urls from URL $file = file_get_html($URL); foreach ($file->find('a') as $theelement) { $links[] = url_to_absolute($URL, $theelement->href); } print_r($links); mysql_query("INSERT INTO pages (url) VALUES ('$links[]')"); mysql_close($connect);

    Read the article

  • Customizing compare in bsearch()

    - by Richard Smith
    I have an array of addresses that point to integers ( these integers are sorted in ascending order). They have duplicate values. Ex: 1, 2, 2, 3, 3, 3, 3, 4, 4...... I am trying to get hold of all the values that are greater than a certain value(key). Currently trying to implement it using binary search algo - void *bsearch( const void *key, const void *base, size_t num, size_t width, int ( __cdecl *compare ) ( const void *, const void *) ); I am not able to achieve this completely, but for some of them. Would there be any other way to get hold of all the values of the array, with out changing the algorithm I am using?

    Read the article

  • Difference between [object variable] and object.variable in Obj-C?

    - by John Smith
    I was working on a program today and hit this strange bug. I had a UIButton with an action assigned. The action was something like: -(void) someaction:(id) e { if ([e tag]==SOMETAG) { //dostuff } } What confuses me is that when I first wrote it, the if line was if (e.tag==SOMETAG) XCode refused to compile it, saying error: request for member 'tag' in 'e', which is of non-class type 'objc_object*' but I thought the two were equivalent. So under what circumstances are they not the same?

    Read the article

  • Multiple PictureBoxs' C#

    - by Austin Smith
    I'm having a hard time figuring this out. I know pictureBox only lets you display one image a time. I'm trying to create a pictureBox for each image in my collection. For instance if I have ten images in my List, then the method should create ten pictureBox for those respective images so each one is displayes in a pictureBox. I'm not sure which would be better a for loop or a foreach loop instead. every time the loop increments both the varaiables XCoordinate and YCoordinate which are the location of the PictireBox shoulld increase so that the PictureBox won't overlap one another in the Form. The reason for the method is that the number of images in the collection can change everytime the application will run. That's why I'm not creating them manually. So after its done all the pictures in the list should appear in a picture.Box. The box should be all the same size the only difference is the location on the form and the images inside them. Please any help and I will be grateful

    Read the article

  • Unrecognized libraries and functions

    - by John Smith
    I am working in Eclipse 3.7.2 on Ubuntu 12.04 with C++. I have read about a few instances where libraries were not being recognized and the majority said to update the Paths and Symbols but that hasn't fixed my issue. I have 2 projects open in my workspace, one of which is already a completed project that has implemented functions and libraries with no errors from Eclipse. However, when I try to implement some of the same functions or include the same libraries in the 2nd project Eclipse can't resolve them. For example, #include <string> #include <stdio.h> strstr(p, "<Project>"); The include statement will be accepted and stdio.h will be found but the strstr function is not resolved even though it works fine in the other project. Any ideas as to why this might be happening? Thanks.

    Read the article

  • Php, in_array with no exactly match

    - by John Smith
    I want to do the following: $a = array(); $a[] = array(1,2); $a[] = array(2,5); $a[] = array(3,4); var_dump (in_array(array(2,5), $a)); this returns OK, as it expected, but if the source array is not fully matched: $a = array(); $a[] = array(1,2, 'f' => array()); $a[] = array(2,5, 'f' => array()); $a[] = array(3,4, 'f' => array()); var_dump (in_array(array(2,5), $a)); it returns false. Is there a way to do it with the built-in way, or I have to code it?

    Read the article

  • No class def find error

    - by John Smith
    I have the following piece of code which helps me to read the paths of all the files in a directory and its subdirectories : File dir = new File("directory path"); try { System.out.println("Getting all files in " + dir.getCanonicalPath() + " including those in subdirectories"); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } List<File> files = (List<File>) FileUtils.listFiles(dir, TrueFileFilter.INSTANCE, TrueFileFilter.INSTANCE); for (File file : files) { try { System.out.println("file: " + file.getCanonicalPath()); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } The problem is that I get a java.lang.NoClassDefFoundError: org/apache/commons/io/filefilter/TrueFileFilter error. I've imported the necessary libraries. I mention that I work on a plugin project. This code runs in a class with main function. I don't understand why it gave me this error. Thank you !

    Read the article

  • Navigate to browser from selected listbox binded hyperlink (windows phone7)

    - by Ryan Smith
    I am bindind rss items from the net to this page, I cannot Seem to navigate to the link of a selected items hyper link which through binding is string. can anyone help me to navigate to weblink from a listbox item when selected ??? <ListBox Height="712" HorizontalAlignment="Left" Name="listNews" VerticalAlignment="Top" Width="468" SelectionChanged="listNews_SelectionChanged" Margin="0,-22,0,0"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal" Height="132"> <Image Source="{Binding Avatar}" Height="73" Width="73" VerticalAlignment="Top" Margin="0,7,5,0"/> <StackPanel Width="370"> <TextBlock Text="{Binding Newstitle}" TextWrapping="Wrap" Foreground="#FFC8AB14" FontSize="28" /> <HyperlinkButton Name="{Binding NewsLink}" Content="{Binding NewsLink}" NavigateUri="{Binding NewsLink}" FontSize="18" ClickMode="Press" Click="Selected" /> </StackPanel> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox> private void listNews_SelectionChanged(object sender, SelectionChangedEventArgs e) { WebBrowserTask webBrowserTask = new WebBrowserTask(); webBrowserTask.URL = **???????;** webBrowserTask.Show();

    Read the article

  • jQuery: serializing array returns empty string

    - by John Smith
    I did not forget to add name attributes as is a common problem and yet my serialized form is returning an empty string. What am I doing wrong? HTML/javascript: <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script> <script> $( document ).ready( function() { $('#word_form').submit(function(e) { e.preventDefault(); console.log($(this).serialize()); //returns an empty string }); }); </script> </head> <body> <div id="wrapper"> <form name="word_form" id="word_form" method="POST"> <input type="image" name="thumbsUp" id="thumb1" value="1" src="http://upload.wikimedia.org/wikipedia/commons/8/87/Symbol_thumbs_up.svg" style="width:50px;height:50px;"> <input type="image" name="thumbsDown" id="thumb2" value="2" src="http://upload.wikimedia.org/wikipedia/commons/8/84/Symbol_thumbs_down.svg" style="width:50px;height:50px;"> </form> </div> </body> Thanks!

    Read the article

  • PHP and use of the Num_Of_Rows() function?

    - by Michael Smith
    Below is some PHP code that i have written, the problem occurs when it gets to the use of the num_of_rows(), it just does not seem to work and i cant figure out why? <?php try { $divMon_ID = array(); $divMon_Position = array(); $divMon_Width = array(); $divMon_Div = array(); $db = new PDO('sqlite:db/EVENTS.sqlite'); $result_mon = $db->query('SELECT * FROM Monday'); $totalRows = mysql_num_rows($result_mon); //for($counter=1; $counter<=10; $counter+=1) //{ //<div id="event_1" style="position:absolute; left: 0px; top:-39px; width:100px; font-family:Arial, Helvetica, sans-serif; font-size:small; border:2px blue solid; height:93px"> //$divMon_ID[]=$row['Id']; //$divMon_Position[]=$row['Origin']; //$divMon_P[]=$row['Position']; //} } catch(PDOException $e) { print 'Exception : '.$e->getMessage(); } ? I know that it is the "$totalRows = mysql_num_rows($result_mon);" statement because when i then comment it out, the page can load. Am i using the function in the wrong way? Thanks.

    Read the article

  • Cannot determine why pointer variable will not address elements in a string in this program?

    - by Smith Will Suffice
    I am attempting to utilize a pointer variable to access elements of a string and there are issues with my code generating a compilation error: #include <stdio.h> #define MAX 29 char arrayI[250]; char *ptr; int main(void) { ptr = arrayI; puts("Enter string to arrayI: up to 29 chars:\n"); fgets(arrayI, MAX, stdin); printf("\n Now printing array by pointer:\n"); printf("%s", *ptr); ptr = arrayI[1]; //(I set the pointer to the second array char element) printf("%c", *ptr); //Here is where I was wanting to use my pointer to //point to individual array elements. return 0; } My compiler crieth: [Warning] assignment makes pointer from integer without a cast [enabled by default] I do not see where my pointer was ever assigned to the integer data type? Could someone please explain why my attempt to implement a pointer variable is failing? Thanks all!

    Read the article

< Previous Page | 47 48 49 50 51 52 53 54 55 56 57 58  | Next Page >