Search Results

Search found 3785 results on 152 pages for 'photo tom'.

Page 14/152 | < Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >

  • How to mutate rows of data frame - replacing one value with another

    - by rhh
    I'm having trouble with what I think is a basic R task. Here's my sample dataframe named 'b' Winner Color Size Tom Yellow Med Jerry Yellow Lar Jane Blue Med where items in the Winner column are factors. I'm trying to change "Tom" in the dataframe to "Tom LLC" and I can't get it done. Here's what I tried: Simple way: b$winner[b$winner=='Tom'] = as.factor('Tom LLC') but that failed with "invalid factor level, NAs generated" Next I tried a more advanced route: name_reset = function (x, y, z) { if (x$winner == y) {x$winner = z} } b = adply(b,1,name_reset,'Tom','Tom LLC') but that failed with "Error in list_to_dataframe(res, attr(.data, "split_labels")) : Results are not equal lengths" I feel I'm missing something basic. Can someone redirect me or offer suggestions on the code I wrote above? Thank you very much

    Read the article

  • How can I process an image in .NET for a full-page print with a quality like Windows Photo Gallery d

    - by Triynko
    I'm writing a printing routing in C#, using the .NET PrintDocument class, handling the OnPrintPage event. I've managed to maximize the margins and print the Image in landscape mode, but it simply does not look as good as when I print the same image file from Windows Photo Gallery (formerly Windows Picture and Fax Viewer), the default image preview program in Windows Vista. I noticed an option there for selecting "Sharpen Image for Printing", but what does that do? I've thought about printing copies of the image from Windows Photo Gallery first, then sending the sheets through the printer a second time to print the custom overlays I need, but it's hard to make it line up every time, since the printer sucks the sheet in without the kind of precision I need... so I really need to do ALL the drawing commands within C#, including the image. Does anyone know how to perform pre-processing on the bitmap so that it prints as nicely as Windows Photo Gallery does it? Are there any simple print drivers that can intercept Photo Gallery printing output as a standard image file (bmp, png, etc.) that can be read by the .NET Image class? I'm all for creativity here.

    Read the article

  • ObjectiveFlickr - how to call getSizes on a photo ID not known until the response?

    - by Jonathan Cohen
    Hi guys, I'm building a free music instrument iPhone app with the Flickr API and ObjectiveFlickr.A random photo from the interestingness list is displayed in the background, but I can't center it without knowing its size. (so I can reset the UIWebView frame) I've been researching this for awhile, and if the answer is super easy, please have some mercy on a noob - it's my first time playing with a web service API. =) Since I don't know the photo ID until after I receive the response from the interestingness feed, how would I call flickr.photo.getSizes on the response? This is what I have so far: - (void)flickrAPIRequest:(OFFlickrAPIRequest *)inRequest didCompleteWithResponse:(NSDictionary *)inResponseDictionary{ int randomResponse = arc4random() % 49; photoDict = [[inResponseDictionary valueForKeyPath:@"photos.photo"] objectAtIndex:randomResponse]; NSString *photoID = [photoDict valueForKeyPath:@"id"]; NSLog(@"%@",photoID); NSURL *photoURL = [flickrContext photoSourceURLFromDictionary:photoDict size:OFFlickrMediumSize]; NSString *htmlSource = [NSString stringWithFormat: @"<html>" @"<head>" @" <style>body { margin: 0; padding: 0; } </style>" @"</head>" @"<body>" @"<img src=\"%@\" />" @"</body>" @"</html>" , photoURL]; [webView loadHTMLString:htmlSource baseURL:nil]; }

    Read the article

  • How to load entities into private collections using the entity framework

    - by Anton P
    I have a POCO domain model which is wired up to the entity framework using the new ObjectContext class. public class Product { private ICollection<Photo> _photos; public Product() { _photos = new Collection<Photo>(); } public int Id { get; set; } public string Name { get; set; } public virtual IEnumerable<Photo> Photos { get { return _photos; } } public void AddPhoto(Photo photo) { //Some biz logic //... _photos.Add(photo); } } In the above example i have set the Photos collection type to IEnumerable as this will make it read only. The only way to add/remove photos is through the public methods. The problem with this is that the Entity Framework cannot load the Photo entities into the IEnumerable collection as it's not of type ICollection. By changing the type to ICollection will allow callers to call the Add mentod on the collection itself which is not good. What are my options? Edit: I could refactor the code so it does not expose a public property for Photos: public class Product { public Product() { Photos = new Collection<Photo>(); } public int Id { get; set; } public string Name { get; set; } private Collection<Photo> Photos {get; set; } public IEnumerable<Photo> GetPhotos() { return Photos; } public void AddPhoto(Photo photo) { //Some biz logic //... Photos.Add(photo); } } And use the GetPhotos() to return the collection. The other problem with the approach is that I will loose the change tracking abilities as I cannot mark the collection as Virtual - It is not possible to mark a property as private virtual. In NHibernate I believe it's possible to map the proxy class to the private collection via configuration. I hope that this will become a feature of EF4. Currently i don't like the inability to have any control over the collection!

    Read the article

  • flickr.photos.search strange behavior with nested xml response

    - by JohnIdol
    I am querying flickr with the following request: view-source:http://www.flickr.com/services/rest/?method=flickr.photos.search&api_key=MY_KEY&text=cork&per_page=12&&format=rest if I put the above url in the browser I get the following as I would expect: <rsp stat="ok"> <photos page="1" pages="22661" perpage="12" total="271924"> <photo id="4587565363" owner="46277999@N05" secret="717118838d" server="4029" farm="5" title="06052010(001)" ispublic="1" isfriend="0" isfamily="0" /> <photo id="4587466773" owner="25901874@N06" secret="32c5a1a57f" server="4002" farm="5" title="black wine cork 2 BW" ispublic="1" isfriend="0" isfamily="0" /> <photo id="4588084730" owner="25901874@N06" secret="b27eef5635" server="4032" farm="5" title="black wine cork 2" ispublic="1" isfriend="0" isfamily="0" /> <photo id="4587457789" owner="43115275@N00" secret="ae0daa0ab6" server="4034" farm="5" title="Matthew" ispublic="1" isfriend="0" isfamily="0" /> <photo id="4587443837" owner="49967920@N07" secret="2b4c1a58de" server="4066" farm="5" title="Two car garage" ispublic="1" isfriend="0" isfamily="0" /> <photo id="4588050906" owner="45827769@N06" secret="72de138f7e" server="4067" farm="5" title="Dabie Mountains, Central China" ispublic="1" isfriend="0" isfamily="0" /> <photo id="4587979300" owner="36531359@N00" secret="e5f8b30734" server="3299" farm="4" title="stroll" ispublic="1" isfriend="0" isfamily="0" /> <photo id="4587304769" owner="7904649@N02" secret="995062f550" server="4034" farm="5" title="IMG_4325" ispublic="1" isfriend="0" isfamily="0" /> <photo id="4587306827" owner="7904649@N02" secret="b92d7ff916" server="4050" farm="5" title="IMG_4329" ispublic="1" isfriend="0" isfamily="0" /> <photo id="4587311657" owner="7904649@N02" secret="bb1b34ccf8" server="4053" farm="5" title="IMG_4336" ispublic="1" isfriend="0" isfamily="0" /> <photo id="4587933110" owner="7904649@N02" secret="f733b1d482" server="3300" farm="4" title="IMG_4334" ispublic="1" isfriend="0" isfamily="0" /> <photo id="4587930650" owner="7904649@N02" secret="9bc202b3ed" server="4018" farm="5" title="IMG_4331" ispublic="1" isfriend="0" isfamily="0" /> </photos> </rsp> Now I've got something very simple PHP to query the exact same url, called from javascript through AJAX - it all works as I can see putting a breakpoint in my javascript function that handles the response: function HandleResponse(response) { document.getElementById('ResponseDiv').innerHTML = response; } Looking at response value in the snippet above I see what I expect (xml formed as above) - then the strangest thing happens: when I inspect the DOM instead of having photo elements all as children of photos they're all nested within each other. What amI missing - How is this possible in light of the fact that the response string is definitely formed as I would expect it to be?

    Read the article

  • Software Engineer's explanation of Facebook photo privacy, with UML diagram?

    - by Alex R
    Facebook photo privacy is more complex than most people think - including the bloggers who fill the Internet trying to explain it in simple terms. Not only there is the basic album-level privacy setting to consider, but also what happens with Tagging (and related privacy settings) as well as the Share button when clicked by a Friend. Has anybody seen a good, engineering-type (e.g. UML) diagram? I envision it should include the various privacy "states" a photo can be in, what causes state transitions, and the characteristics of each state? Thanks

    Read the article

  • How to factory reset an EPSON Stylus Photo 1290 printer?

    - by Harry Wood
    How do I do factory reset on an EPSON Stylus Photo 1290 printer? The printer is refusing to work. It seems to be in some error state. I've tried re-installing drivers etc, but the printer itself seems to run some diagnostic routine when I switch it on, but will not do anything else. It will not move the carousel ready for me to change the printer cartridge or any other Is there'e some sequence of button presses on the printer to do a factory reset? The printer has three buttons on the front, plus a yellow button when the hood is open (as shown in this photo)

    Read the article

  • Is Protune for video only or may be used for photo too?

    - by Green
    I have Hero3+ Black Edition. I can't understand if Protune is for video only or may be applied for photos? The manual says it is both for video and for photo (page 35): High-Quality Image Capture Protune’s high data rate captures images with less compression, giving content creators higher quality for professional productions. Film/TV Rate Standard While shooting in Protune, you have the option of recording video in cinema quality 24 fps to easily intercut GoPro content with other source media without the need to perform fps conversion. But at the same time their site says that Protune is for video only: To record Protune footage, you’ll need to turn Protune ON in your camera’s settings menu. What for is Protune? Photo? Video? Or both?

    Read the article

  • GalleryView Jquery

    - by kwek-kwek
    I am trying to implement this JqueryGallery to my website(big gray box). Now my problem is that the images doesn't appear. here is my header code: <link href="css/galleryview.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="js/jquery-1.3.2.min.js"></script> <script type="text/javascript" src="js/jquery.easing.1.3.js"></script> <script type="text/javascript" src="js/jquery.galleryview-2.1.1.js"></script> <script type="text/javascript" src="js/jquery.timers-1.2.js"></script> <script type="text/javascript"> $(document).ready(function(){ $('#photos').galleryView({ panel_width: 655, panel_height: 336, transition_speed: 1500, transition_interval: 5000, nav_theme: 'dark', border: '1px solid white', pause_on_hover: true, }); }); </script> Here is my gallery code: <div id="photos" class="galleryview"> <div class="panel"> <img src="http://spaceforaname.com/img/gallery/01.jpg" /> <div class="panel-overlay"> <h2>Effet du soleil sur le paysage</h2> <p>Photo by <a href="http://www.sxc.hu/profile/tomharry" target="_blank">tomharry</a>. View full-size photo <a href="http://www.sxc.hu/photo/158829" target="_blank">here</a>.</p> </div> </div> <div class="panel"> <img src="http://spaceforaname.com/img/gallery/02.jpg" /> <div class="panel-overlay"> <h2>Eden</h2> <p>Photo by <a href="http://www.sxc.hu/profile/emsago" target="_blank">emsago</a>. View full-size photo <a href="http://www.sxc.hu/photo/152865" target="_blank">here</a>.</p> </div> </div> <div class="panel"> <img src="http://spaceforaname.com/img/gallery/03.jpg" /> <div class="panel-overlay"> <h2>Snail on the Corn</h2> <p>Photo by <a href="http://www.sxc.hu/profile/baines" target="_blank">baines</a>. View full-size photo <a href="http://www.sxc.hu/photo/34453" target="_blank">here</a>.</p> </div> </div> <div class="panel"> <img src="http://spaceforaname.com/img/gallery/04.jpg" /> <div class="panel-overlay"> <h2>Flowers</h2> <p>Photo by <a href="http://www.sxc.hu/profile/jazza" target="_blank">jazza</a>. View full-size photo <a href="http://www.sxc.hu/photo/990169" target="_blank">here</a>.</p> </div> </div> <div class="panel"> <img src="http://spaceforaname.com/img/gallery/06.jpg" /> <div class="panel-overlay"> <h2>Alone Beach 2B</h2> <p>Photo by <a href="http://www.sxc.hu/profile/sgursozlu" target="_blank">sgursozlu</a>. View full-size photo <a href="http://www.sxc.hu/photo/738279" target="_blank">here</a>.</p> </div> </div> </div>

    Read the article

  • Best way to Store Passwords, User information/Profile data and Photo/Video albums for a social websi

    - by Nick
    Need some help figuring out how to best Store Passwords, User information/Profile data and Photo/Video albums for a social website? For photos/videos the actual photo/video + even encrypting the URL with the IDs to the photo/videos so other users cannot figure it out. Creating a site like myspace and designing retirement documents but i am unsure how to specify the security requirements for the database. Two things: 1) Protect from outside users 2) Protect all these from employees being able to access this info For #2, the additional question is: If we encrypt the user info and password so even the system admins cannot get in, how can we retrieve the user data tomorrow if someone flags the user's account as spam and admin needs to check it out or if law enforcement wants info on a user? Thanks.

    Read the article

  • SQL query for select distinct with most recent timestamp first

    - by Josh
    I have a mysql table with three columns: username, location, timestamp. This is basically a log of user activity of what location they are in and the time that they were there. What I want to do is select a distinct username+location where only the most recent item (by timestamp) is provided. So say the table consists of: tom roomone 2011-3-25 10:45:00 tom roomtwo 2011-3-25 09:00:00 tom roomtwo 2011-3-25 08:30:00 pam roomone 3011-3-25 07:20:23 I would want only these to be selected: tom roomone 2011-3-25 10:45:00 tom roomtwo 2011-3-25 09:00:00

    Read the article

  • Java MVC - How to divide a done text game into MVC?

    - by Zopyrus
    Been sitting here for hours now trying to figure this out, so a bit sympathy for this large question. :) The Goal: I simply want to divide my done code into MVC (Model View Controller) parts. I have the game logics done and text based - the code works fine. The Problem: Well, I want to implement this code into MVC, but where do explain for the MODEL that it should use text-based? Because the VIEW is only for the layout (graphically) correct? I am having a REALLY hard time figuring out where to begin at all. Any pointers would be so nice! Here is my game logics code: import mind.*; import javax.swing.*; import java.util.*; import java.lang.*; import java.awt.*; public class Drive { String[] mellan; boolean gameEnd, checkempty, checkempty2, enemy, enemy2; String gr,rd,tom; int digits; public Drive() { // Gamepieces in textform gr="G"; rd="R"; tom=" "; mellan = new String[7]; String[] begin = {gr,gr,gr,tom,rd,rd,rd}; String[] end = {rd,rd,rd,tom,gr,gr,gr}; //input Scanner in = new Scanner(System.in); mellan=begin; gameEnd=false; while (gameEnd == false) { for(int i=0; i<mellan.length; i++) { System.out.print(mellan[i]); } System.out.print(" Choose 0-6: "); digits = in.nextInt(); move(); checkWin(); } } void move() { //BOOLEAN for gameruls!!! checkempty = digits<6 && mellan[digits+1]==tom; checkempty2 = digits>0 && mellan[digits-1]==tom; enemy = (mellan[digits]==gr && mellan[digits+1]==rd && mellan[digits+2]==tom); enemy2 = (mellan[digits]==rd && mellan[digits-1]==gr && mellan[digits-2]==tom); if(checkempty) { mellan[digits+1]=mellan[digits]; mellan[digits]=tom; } else if (checkempty2) { mellan[digits-1]=mellan[digits]; mellan[digits]=tom; } else if (enemy) { mellan[digits+2]=mellan[digits]; mellan[digits]=tom; } else if (enemy2) { mellan[digits-2]=mellan[digits]; mellan[digits]=tom; } } void checkWin() { String[] end = {rd,rd,rd,tom,gr,gr,gr}; for (int i=0; i<mellan.length; i++){ } if (Arrays.equals(mellan,end)) { for (int j=0; j<mellan.length; j++) { System.out.print(mellan[j]); } displayWin(); } } void displayWin() { gameEnd = true; System.out.println("\nNicely Done!"); return; } // Kör Drive! public static void main(String args[]) { new Drive(); } } Here is how I defined my DriveView thus far: (just trying to make one button to work) import mind.*; import javax.swing.*; import java.util.*; import java.lang.*; import java.awt.*; import java.awt.event.*; public class DriveView extends JFrame { JButton ruta1 = new JButton("Green"); JButton ruta2 = new JButton("Green"); JButton rutatom = new JButton(""); JButton ruta6 = new JButton("Red"); private DriveModel m_model; public DriveView(DriveModel model) { m_model = model; //Layout for View JPanel myPanel = new JPanel(); myPanel.setLayout(new FlowLayout()); myPanel.add(ruta1); myPanel.add(ruta2); myPanel.add(rutatom); myPanel.add(ruta6); this.setContentPane(myPanel); this.pack(); this.setTitle("Drive"); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } void addMouseListener(ActionListener mol) { ruta2.addActionListener(mol); } } And DriveController which gives me error at compile import mind.*; import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.lang.*; public class DriveController { private DriveModel m_model; private DriveView m_view; public DriveController(DriveModel model, DriveView view) { m_model = model; m_view = view; view.addMouseListener(new MouseListener()); } class MouseListener implements ActionListener { public void actionPerformed(ActionEvent e) { String mening; mening = e.getActionCommand(); if (mening.equals("Green")) { setForeground(Color.red); } } } }

    Read the article

  • How to display image in grails GSP?

    - by Walter
    I'm still learning Grails and seem to have hit a stumbling block. Here are the 2 domain classes: class Photo { byte[] file static belongsTo = Profile } class Profile { String fullName Set photos static hasMany = [photos:Photo] } The relevant controller snippet: class PhotoController { ..... def viewImage = { def photo = Photo.get( params.id ) byte[] image = photo.file response.outputStream << image } ...... } Finally the GSP snippet: <img class="Photo" src="${createLink(controller:'photo', action:'viewImage', id:'profileInstance.photos.get(1).id')}" /> Now how do I access the photo so that it will be shown on the GSP? I'm pretty sure that profileInstance.photos.get(1).id is not correct. Thanks!!

    Read the article

  • How to create Ror style Restful routing in Asp.net MVC Web Api

    - by Jas
    How to configure routing in asp.net web api, to that I can code for the following actions in my ApiController inherited class? |======================================================================================| |Http Verb| Path | Action | Used for | |======================================================================================| | GET | /photos | index | display a list of all photos | | GET | /photos/new | new | return an HTML form for creating a new photo | | POST | /photos/ | create | create a new photo | | GET | /photos/:id | show | display a specific photo | | GET | /photos/:id/edit | edit | return an HTML form for editing a photo | | PUT | /photos/:id | update | update a specific photo | | DELETE | /photos/:id | destroy | delete a specific photo |

    Read the article

  • jquery/javascript - image resize to fit screen

    - by alberto
    not an expert programmer. i created this code to resize photos/images to fit the screen, considering the space available for the nav bar. the script happens on load of image, and on click of the navigation. is it a good piece of code, or could it be done better? any browser issues? in the html: $(document).ready(function(){ $("#photo").load(function(){ resize(); }); $(".navigation img").click(function(){ var imgPath = $(this).attr("src"); $("#photo").attr({ src: imgPath }); resize(); return false; }); }); while this is my function resize: resize = function() { var borderVt=150; //value based on css style. bottom bar + padding of photoContain var borderHz=40; //value based on css style photoContain padding $("#photo").css("width", "auto").css("height", "auto"); // Remove existing CSS $("#photo").removeAttr("width").removeAttr("height"); // Remove HTML attributes var origSizeW = $("#photo").width(); var origSizeH = $("#photo").height(); var ratioVt=(origSizeW/origSizeH); var ratioHz=(origSizeH/origSizeW); var winW = $(window).width(); var winH = $(window).height(); var screenSizeW=Math.round(winW-borderHz); var screenSizeH=Math.round(winH-borderVt); if (origSizeW>=origSizeH){ var newHeight = Math.round(screenSizeW*ratioHz); if (newHeight <= screenSizeH){ $("#photo").css("width", screenSizeW); // Set new width $("#photo").css("height", newHeight); } else{ $("#photo").css("height", screenSizeH); } } else{ $("#photo").css("height", screenSizeH); // Set new height } };

    Read the article

  • Why does Windows XP (during a rename operation) report file already exists when it doesn't?

    - by Hawk
    From the command-line: E:\menu\html\tom\val\.svn\tmp\text-base>ver Microsoft Windows [Version 5.2.3790] E:\menu\html\tom\val\.svn\tmp\text-base>dir Volume in drive E is DATA Volume Serial Number is F047-F44B Directory of E:\menu\html\tom\val\.svn\tmp\text-base 12/23/2010 04:36 PM <DIR> . 12/23/2010 04:36 PM <DIR> .. 12/23/2010 04:01 PM 0 wtf.com3.csv.svn-base 1 File(s) 0 bytes 2 Dir(s) 170,780,262,400 bytes free E:\menu\html\tom\val\.svn\tmp\text-base>rename wtf.com3.csv.svn-base com3.csv.svn-base A duplicate file name exists, or the file cannot be found. E:\menu\html\tom\val\.svn\tmp\text-base>dir Volume in drive E is DATA Volume Serial Number is F047-F44B Directory of E:\menu\html\tom\val\.svn\tmp\text-base 12/23/2010 04:36 PM <DIR> . 12/23/2010 04:36 PM <DIR> .. 12/23/2010 04:01 PM 0 wtf.com3.csv.svn-base 1 File(s) 0 bytes 2 Dir(s) 170,753,064,960 bytes free E:\menu\html\tom\val\.svn\tmp\text-base>` I don't know what to do about this, as there is no other file in this directory. Why does Windows XP report that there is already a file here named com3.csv.svn-base when there is clearly no other file here?

    Read the article

  • How to invoke a delegate with a null parameter?

    - by Rodney Burton
    I get a null exception if I try to pass a null parameter to a delegate during an invoke. Here's what the code looks like: public void RequestPhoto() { WCF.Service.BeginGetUserPhoto(Contact.UserID, new AsyncCallback(RequestPhotoCB), null); } public void RequestPhotoCB(IAsyncResult result) { var photo = WCF.Service.EndGetUserPhoto(result); UpdatePhoto(photo); } public delegate void UpdatePhotoDelegate(Binary photo); public void UpdatePhoto(Binary photo) { if (InvokeRequired) { var d = new UpdatePhotoDelegate(UpdatePhoto); Invoke(d, new object[] { photo }); } else { var ms = new MemoryStream(photo.ToArray()); var bmp = new Bitmap(ms); pbPhoto.BackgroundImage = bmp; } } The problem is with the line: Invoke(d, new object[] { photo }); If the variable "photo" is null. What is the correct way to pass a null parameter during an invoke? Thanks!

    Read the article

  • How to generate lots of redundant ajax elements like checkboxes and pulldowns in Django?

    - by iJames
    Hello folks. I've been getting lots of answers from stackoverflow now that I'm in Django just be searching. Now I hope my question will also create some value for everybody. In choosing Django, I was hoping there was some similar mechanism to the way you can do partials in ROR. This was going to help me in two ways. One was in generating repeating indexed forms or form elements, and also in rendering only a piece of the page on the round trip. I've done a little bit of that by using taconite with a simple URL click but now I'm trying to get more advanced. This will focus on the form issue which boils down to how to iterate over a secondary object. If I have a list of photo instances, each of which has a couple of parameters, let's say a size and a quantity. I want to generate form elements for each photo instance separately. But then I have two lists I want to iterate on at the same time. Context: photos : Photo.objects.all() and forms = {} for photo in photos: forms[photo.id] = PhotoForm() In other words we've got a list of photo objects and a dict of forms based on the photo.id. Here's an abstraction of the template: {% for photo in photos %} {% include "photoview.html" %} {% comment %} So here I want to use the photo.id as an index to get the correct form. So that each photo has its own form. I would want to have a different action and each form field would be unique. Is that possible? How can I iterate on that? Thanks! {% endcomment %} Quantity: {{ oi.quantity }} {{ form.quantity }} Dimensions: {{ oi.size }} {{ form.size }} {% endfor %} What can I do about this simple case. And how can I make it where every control is automatically updating the server instead of using a form at all? Thanks! James

    Read the article

  • SQL Latest photos from contacts (grouped by contact)

    - by kitsched
    Hello, To short version of this question is that I want to accomplish something along the lines of what's visible on Flickr's homepage once you're logged in. It shows the three latest photos of each of your friends sorted by date but grouped by friend. Here's a longer explanation: For example I have 3 friends: John, George and Andrea. The list I want to extract should look like this: George Photo - 2010-05-18 Photo - 2010-05-18 Photo - 2010-05-12 John Photo - 2010-05-17 Photo - 2010-05-14 Photo - 2010-05-12 Andrea Photo - 2010-05-15 Photo - 2010-05-15 Photo - 2010-05-15 Friend with most recent photo uploaded is on top but his or her 2 next files follow. I'd like to do this from MySQL, and for the time being I got here: SELECT photos.user_id, photos.id, photos.date_uploaded FROM photos WHERE photos.user_id IN (SELECT user2_id FROM user_relations WHERE user1_id = 8) ORDER BY date_uploaded DESC Where user1_id = 8 is the currently logged in user and user2_id are the ids of friends. This query indeed returns the latest files uploaded by the contacts of the user with id = 8 sorted by date. However I'd like to accomplish the grouping and limiting mentioned above. Hopefully this makes sense. Thank you in advance.

    Read the article

  • [Concept] How does unlink() find the file to delete?

    - by Prasad
    My app has a 'Photo' field to store URL. It uses sfWidgetFormInputFileEditable for the widget schema. To delete the old image when a new image is uploaded, I use unlink before setting the value in the over-ridden setter and it works!!! if (file_exists($this->_get('photo'))) unlink($this->_get('photo')); Photos are stored in uploads/photos and when saving 'Photo' only the file name xxx-yyy.zzz is saved (and not the full path). However, I wish to know how symfony/php knows the full path of the file to be deleted? Part 2: I am using sfThumbnailPlugin to generate thumbnails. So the actual code looks like this: public function setPhoto($value) { if(!empty($value)) { Contact::generateThumbnail($value); // delete current Photo & create thumbnail $this->_set('photo',$value); // setting new value after deleting old one } } public function generateThumbnail($value) { $uploadDir = sfConfig::get('app_photo_upload'); // path to upload folder if (file_exists($this->_get('photo'))) { unlink($this->_get('photo')); // delete full-size image // path to thumbnail $thumbpath = $uploadDir.'/thumbnails/'.$this->get('photo'); // read a blog, tried setting dir manually, doesn't work :( //chdir('/thumbnails/'); // tried closing the file too, doesn't work! :( //fclose($thumbpath) or die("can't close file"); //unlink($this->_get('photo')); // doesn't work; no error :( unlink($thumbpath); // doesn't work, no error :( } $thumbnail = new sfThumbnail(150, 150); $thumbnail->loadFile($uploadDir.'/'.$value); $thumbnail->save($uploadDir.'/thumbnails/'.$value, 'image/png'); } Why can't the thumbnail be deleted using unlink()? is the sequence of ops incorrect? Is it because the old thumbnail is displayed in the sfWidgetFormInputFileEditable widget? I've spent hours trying to figure this out, but unable to nail down the real cause. Thanks in advance.

    Read the article

  • parsing xml with php, children

    - by moustafa
    Hello I successfully created my parser Everything is working great except one thing since my xml is formated a little different and I am totally lost on how to assign variable to the children of . xml portion <item> <url /> <name /> - <photos> <photo>1020944_0.jpg</photo> <photo>1020944_1.jpg</photo> <photo>1020944_2.jpg</photo> </photos> <user_id /> </item> PHP code <? global $insideitem, $tag, $name, $photos, $user_id; global $count,$db; $db = mysql_connect("localhost", "user","pass"); mysql_select_db("db_name",$db); $result = mysql_query("SELECT user_id FROM table,$db); while ($myrow = mysql_fetch_array($result)){ $uid=$myrow['user_id']; $UN_ID[$uid]=$uid; } $count=1; $count2=1; // ########################################################## // ************* START ELEMENT FUNCTION ********************* // ########################################################## function startElement($parser, $name, $attrs) { global $insideitem, $tag, $name, $photos, $user_id; if ($insideitem) { $tag = $name; } elseif($name == "ITEM"){ $insideitem = true; } } function endElement($parser, $name) { global $insideitem, $tag, $name, $photos, $user_id; global $count,$count2,$db,$UN_ID; if ($name == "ITEM") { if(!$UN_ID[$unique_id]){ $name=addslashes($name); $photo1=addslashes($photo); $photo2=addslashes($photo); $photo3=addslashes($photo); $photo4=addslashes($photo); $user_id=addslashes($category); $sql = "INSERT INTO table ( name, photo1, photo2, photo3, photo4, user_id ) VALUES ( '$name', '$photo', '$photo', '$photo', '$photo', '$user_id', )"; $resultupdate = mysql_query($sql); } $name=''; $photos=''; $user_id=''; } } function characterData($parser, $data) { global $insideitem, $tag, $name, $photos, $user_id; if ($insideitem) { switch ($tag) { case "NAME": $name .= $data; break; case "PHOTOS": $photos .= $data; break; case "USER_ID": $user_id .= $data; break; } } } $xml_parser = xml_parser_create(); xml_set_element_handler($xml_parser, "startElement", "endElement"); xml_set_character_data_handler($xml_parser, "characterData"); $fp = fopen("../myfile.xml","r") or die("Error reading RSS data."); while ($data = fread($fp, 4096)) // Parse each 4KB chunk with the XML parser created above xml_parse($xml_parser, $data, feof($fp)) // Handle errors in parsing or die(sprintf("XML error: %s at line %d", xml_error_string(xml_get_error_code($xml_parser)), xml_get_current_line_number($xml_parser))); fclose($fp); // ########################################################## // *********************** FREE MEMORY ********************** // ########################################################## xml_parser_free($xml_parser); ?> The number of tags can range between 1-4. I have tried searching everywhere for info on how to do this and tried everything but I just cant get it. After several days of this giving me headaches I really hope some one can enlighten me.

    Read the article

  • How can I transfer photo's from my Kodak camera that normally would use KODAK EASYSHARE Software?

    - by Ryan
    Normally I would plug my camera into my Windows XP pc, and the software would auto start, and transfer the files to a set location. I need to be able to perform the same or similar function on my PC installed with Ubuntu 10.04 (LTS). I would like to plug the camera in (USB), and then be able to select the files I want. At the moment, the camera does not seem to recognise the PC. I do not want to rely on the Windows PC anymore.

    Read the article

< Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >