Search Results

Search found 1582 results on 64 pages for 'pictures'.

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

  • Need advice on speeding up tableViewCell photo loading performance

    - by ambertch
    I have around 20 tableview cells that each contain a number (2-5) thumbnail sized pictures (they are VERY small Facebook profile pictures, ex. http://profile.ak.fbcdn.net/hprofile-ak-sf2p/hs254.snc3/23133_201668_2989_q.jpg). Each picture is an UIImageView added to the cell's contentview. Scrolling performance is poor, and measuring the draw time I've found the UIImage rendering is the bottleneck. I've researched/thought of some solutions but as I am new to iphone development I am not sure which strategy to pursue: preload all the images and retrieve them from disk instead of URL when drawing cells (I'm not sure if cell drawing will still be slow, so I want to hold off on the time investment here) Have the cells display a placeholder image from disk, while the picture is asynchronously loaded (this seems to be the best solution, but I'm currently not sure exactly how to do best do this) There's the fast drawing recommendation from Tweetie, but I don't know that will have much affect if it turns out my overhead is in network loading (http://blog.atebits.com/2008/12/fast-scrolling-in-tweetie-with-uitableview/) Thoughts/implementation advice? Thanks!

    Read the article

  • UITableViewCell imageView.contentMode doesn't work in 3.0

    - by JustinXXVII
    In UITableViewCellStyleDefault, setting the contentMode on the imageView has no result. If I change my build SDK to version 3.1, everything again works. I don't get any warnings or errors when compiling on 3.0 but this code: cell.imageView.contentMode = UIViewContentModeScaleAspectFit; cell.imageView.image = [UIImage imageNamed:[[NSString stringWithFormat:@"%@head.jpg",[gametype objectAtIndex:indexPath.row]]lowercaseString]]; seems to default to the UIViewContentModeCenter, so all of my pictures exceed the cell boundaries and encroach on neighboring cells. Let me reiterate that if I change my target to 3.1 everything works correctly and all pictures are scaled accordingly to fit in the default imageView Is this a known bug?

    Read the article

  • PHP extract GPS EXIF data

    - by Kami
    I would like to extract the GPS EXIF tag from pictures using php. I'm using the exif_read_data() that returns a array of all tags + data : GPS.GPSLatitudeRef: N GPS.GPSLatitude:Array ( [0] => 46/1 [1] => 5403/100 [2] => 0/1 ) GPS.GPSLongitudeRef: E GPS.GPSLongitude:Array ( [0] => 7/1 [1] => 880/100 [2] => 0/1 ) GPS.GPSAltitudeRef: GPS.GPSAltitude: 634/1 I don't know how to interpret 46/1 5403/100 and 0/1 ? 46 might be 46° but what about the rest especially 0/1 ? angle/1 5403/100 0/1 What is this structure about ? How to convert them to "standard" ones (like 46°56'48?N 7°26'39?E from wikipedia) ? I would like to pass thoses coordinates to the google maps api to display the pictures positions on a map !

    Read the article

  • WebClient DownloadStringCompleted Never Fired in Console Application

    - by azamsharp
    I am not sure why the callback methods are not fired AT ALL. I am using VS 2010. static void Main(string[] args) { try { var url = "some link to RSS FEED"; var client = new WebClient(); client.DownloadStringCompleted += new DownloadStringCompletedEventHandler(client_DownloadStringCompleted); client.DownloadDataCompleted += new DownloadDataCompletedEventHandler(client_DownloadDataCompleted); client.DownloadStringAsync(new Uri(url)); } catch (Exception ex) { Console.WriteLine(ex.Message); } } // THIS IS NEVER FIRED static void client_DownloadDataCompleted(object sender, DownloadDataCompletedEventArgs e) { Console.WriteLine("something"); } // THIS IS NEVER FIRED static void client_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e) { Console.WriteLine("do something"); var rss = XElement.Parse(e.Result); var pictures = from item in rss.Descendants("channel") select new Picture { Name = item.Element("title").Value }; foreach (var picture in pictures) { Console.WriteLine(picture.Name); Console.WriteLine(picture.Url); } }

    Read the article

  • Works using Django development server, but throws import error with Apache using mod_wsgi

    - by Raj
    I have a Django project that works fine with the development server that comes with it. No errors are produced at all when I use "django manage.py runserver" and the app works fine, but when I try to use it with mod_wsgi and Apache the browser displays "Internal Server Error" with a 500 error code and it generates an import error in the Apache error log. Here's the error in the log: ImportError: No module named registration I'm using the Django registration module which is located in a path like this: /opt/raj/photos/registration I know that the registration app is in the path because I can fire up a Python shell, import sys, and get a list of paths using sys.path. Here are some of the paths output from Python shell: sys.path ['', '/opt/raj/pyamf', '/opt/raj', '/opt/raj/pictures', '/opt/raj/pictures /registration', '/usr/lib/python2.6',....] Any thoughts would be appreciated.

    Read the article

  • Sening a file from memory (rather than disk) over HTTP using libcurl

    - by cinek1lol
    Hi! I would like to send pictures via a program written in C + +. - OK WinExec("C:\\curl\\curl.exe -H Expect: -F \"fileupload=@C:\\curl\\ok.jpg\" -F \"xml=yes\" -# \"http://www.imageshack.us/index.php\" -o data.txt -A \"Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1\" -e \"http://www.imageshack.us\"", NULL); It works, but I would like to send the pictures from pre-loaded carrier to a variable char (you know what I mean? First off, I load the pictures into a variable and then send the variable), cause now I have to specify the path of the picture on a disk. I wanted to write this program in c++ by using the curl library, not through exe. extension. I have also found such a program (which has been modified by me a bit) #include <stdio.h> #include <string.h> #include <iostream> #include <curl/curl.h> #include <curl/types.h> #include <curl/easy.h> int main(int argc, char *argv[]) { CURL *curl; CURLcode res; struct curl_httppost *formpost=NULL; struct curl_httppost *lastptr=NULL; struct curl_slist *headerlist=NULL; static const char buf[] = "Expect:"; curl_global_init(CURL_GLOBAL_ALL); /* Fill in the file upload field */ curl_formadd(&formpost, &lastptr, CURLFORM_COPYNAME, "send", CURLFORM_FILE, "nowy.jpg", CURLFORM_END); curl_formadd(&formpost, &lastptr, CURLFORM_COPYNAME, "nowy.jpg", CURLFORM_COPYCONTENTS, "nowy.jpg", CURLFORM_END); curl_formadd(&formpost, &lastptr, CURLFORM_COPYNAME, "submit", CURLFORM_COPYCONTENTS, "send", CURLFORM_END); curl = curl_easy_init(); headerlist = curl_slist_append(headerlist, buf); if(curl) { curl_easy_setopt(curl, CURLOPT_URL, "http://www.imageshack.us/index.php"); if ( (argc == 2) && (!strcmp(argv[1], "xml=yes")) ) curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headerlist); curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost); res = curl_easy_perform(curl); curl_easy_cleanup(curl); curl_formfree(formpost); curl_slist_free_all (headerlist); } system("pause"); return 0; }

    Read the article

  • How to save file and read

    - by Jessy
    Hello everyone, I create a program that place random image in grid layout format. The size of the grid layout is 6 x 6 = 36. Only 10 were filled with images (each image was different) and the rest were empty. freeimagehosting.net/uploads/bfb7e85f63.jpg How can I save it to a file and read it again, so it will display the same images with same placement on the grid? Here is the code that I used to save the images: //image file String []arrPic = {"pic1.jpg","pic2.jpg","pic3.jpg","pic4.jpg","pic5.jpg","pic6.jpg","pic7.jpg","pic8.jpg","pic9.jpg","pic10.jpg",,"pic11.jpg","pic12.jpg","pic13.jpg"}; ArrayList<String> pictures = new ArrayList<String>(Arrays.asList(arrPic)); ArrayList<String> file = new ArrayList<String>(); JPanel pDraw = new JPanel(new GridLayout(6,6,2,2)); ... //fill all grids with empty label for (int i =0; i<(6*6); i++){ JLabel lbl = new JLabel(""); pDraw.add(lbl); } ... //Choose random box to be filled with images for(int i=0; i<10; i++){ Boolean number = true; while(number){ int n = rand.nextInt(35); if(!(arraylist.contains(n))) number = false; arraylist.add(n); } //fill the grids with images for(int i=0; i<arraylist.size(); i++){ //select random image from arraylist int index = rand.nextInt (pictures.size()); String fileName = (String) pictures.get(index ); //find the image file icon = createImageIcon(fileName); //save the file in a new file file.add(fileName); //rescaled the image int x = rand.nextInt(50)+50; int y = rand.nextInt(50)+50; Image image = icon.getImage().getScaledInstance(x,y,Image.SCALE_SMOOTH); icon.setImage(image); //remove empty label and replace it with an image int one = (Integer) arraylist.get(i); pDraw.remove(one); final JLabel label; pDraw.add(label,one); }

    Read the article

  • Image rescale and write rescaled image file in blackberry

    - by Karthick
    I am using the following code to resize and save the file in to the blackberry device. After image scale I try to write image file into device. But it gives the same data. (Height and width of the image are same).I have to make rescaled image file.Can anyone help me ??? class ResizeImage extends MainScreen implements FieldChangeListener { private String path="file:///SDCard/BlackBerry/pictures/test.jpg"; private ButtonField btn; ResizeImage() { btn=new ButtonField("Write File"); btn.setChangeListener(this); add(btn); } public void fieldChanged(Field field, int context) { if (field == btn) { try { InputStream inputStream = null; //Get File Connection FileConnection fileConnection = (FileConnection) Connector.open(path); if (fileConnection.exists()) { inputStream = fileConnection.openInputStream(); //byte data[]=inputStream.toString().getBytes(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); int j = 0; while((j=inputStream.read()) != -1) { baos.write(j); } byte data[] = baos.toByteArray(); inputStream.close(); fileConnection.close(); WriteFile("file:///SDCard/BlackBerry/pictures/org_Image.jpg",data); EncodedImage eImage = EncodedImage.createEncodedImage(data,0,data.length); int scaleFactorX = Fixed32.div(Fixed32.toFP(eImage.getWidth()), Fixed32.toFP(80)); int scaleFactorY = Fixed32.div(Fixed32.toFP(eImage.getHeight()), Fixed32.toFP(80)); eImage=eImage.scaleImage32(scaleFactorX, scaleFactorY); WriteFile("file:///SDCard/BlackBerry/pictures/resize.jpg",eImage.getData()); BitmapField bit=new BitmapField(eImage.getBitmap()); add(bit); } } catch(Exception e) { System.out.println("Exception is ==> "+e.getMessage()); } } } void WriteFile(String fileName,byte[] data) { FileConnection fconn = null; try { fconn = (FileConnection) Connector.open(fileName,Connector.READ_WRITE); } catch (IOException e) { System.out.print("Error opening file"); } if (fconn.exists()) try { fconn.delete(); } catch (IOException e) { System.out.print("Error deleting file"); } try { fconn.create(); } catch (IOException e) { System.out.print("Error creating file"); } OutputStream out = null; try { out = fconn.openOutputStream(); } catch (IOException e) { System.out.print("Error opening output stream"); } try { out.write(data); } catch (IOException e) { System.out.print("Error writing to output stream"); } try { fconn.close(); } catch (IOException e) { System.out.print("Error closing file"); } } }

    Read the article

  • Java webapp: where/how to automatically set each picture's width/height

    - by NoozNooz42
    For several reasons, a lot of "webmaster guides" (like Google and Yahoo!'s webmaster guides/guidelines) repeats several times that it is better to always put the width and height attribute of the img tag. One of the most obvious reason is that the elements in the page won't seem to be "jumping around" to a new location after every picture is loaded (always setting the correct width/height sure gets rid of this behavior). And there are other reasons to follow these guidelines / best practices. So: if we consider that these are indeed good practices if there are a lot of pictures and they are changing often if pictures aren't changing between two .war re-deploy (that is: there's no user-contributed picture) if we don't want to manually edit all these width/height attributes How do we automatically/programmatically serve HTML pages where every img tag have their width/height attribute correctly set as the best practice recommend?

    Read the article

  • Important Security Issue: Is it possible to put binary image data into html markup code and then get

    - by Joern Akkermann
    Hi, it's an important security issue and I'm sure this should be possible. A simple example: You run a community portal. Users are registered and upload their pictures. Your application gives security rules wenever a picture is allowed to be displayed. For example users must be friends on each sides by the system, in order that you can view someone elses uploaded pictures. Here comes the problem: it is possible that someone crawls the image directories of your server. But you want to protect your users from such attacks. If it's possible to put the binary data of an image directly into the html markup, you can restrict the user access of your image dirs the user and group your web application runs of and pass the image data to your apache user and group directly in the html. The only possible weakness then is the password of the user that your web app runs as. Is there already a possibility? Yours, Joern.

    Read the article

  • Is it possible to put binary image data into html markup and then get the image displayed as usual i

    - by Joern Akkermann
    It's an important security issue and I'm sure this should be possible. A simple example: You run a community portal. Users are registered and upload their pictures. Your application gives security rules whenever a picture is allowed to be displayed. For example users must be friends on each sides by the system, in order that you can view someone else's uploaded pictures. Here comes the problem: it is possible that someone crawls the image directories of your server. But you want to protect your users from such attacks. If it's possible to put the binary data of an image directly into the HTML markup, you can restrict the user access of your image dirs the user and group your web application runs of and pass the image data to your Apache user and group directly in the HTML. The only possible weakness then is the password of the user that your web app runs as. Is there already a possibility?

    Read the article

  • Graphic programming over video playback

    - by ignatius
    I want to make some GUI mockup program for video player, so my idea is just to show some menu pictures over real video being playback. I have working program made with C and SDL just to load pictures and make a slideshow, but i don´t know how to put this over video with transparencies. Do you have a hint? ps. i usually program with python and C, so if there is any solution with this two i highly appreciate. Thanks!

    Read the article

  • RoR - Paperclip - How to set minimal width of an attachement

    - by sNiCKY
    Hi, my layout's requirement is to keep all thumbnails at 80px height, not higher, not smaller. In my model I set the style to :thumb= "500x80", so basically almost every picture which is not too wide gets its perfect miniature with 80px height. Sometimes, however, my pictures are narrow and high, so the thumb can have unclickable dimensions of like 5x80. So I dont want to crop pictures as long as thumbnails are not getting crazy narrow, but I think I can make a little sacrifice and crop them if thumb's width is getting smaller than 25px. So my questions is - is it possible in paperclip to set minimal proportions of a picture by which the style will be "500x80" and beyond that it will turn to sth like "25x80#"?

    Read the article

  • How to loop an executable command in the terminal in Linux?

    - by user1452373
    Let me first describe my situation, I am working on a Linux platform and have a collection of .bmp files that add one to the picture number from filename0022.bmp up to filename0680.bmp. So a total of 658 pictures. I want to be able to run each of these pictures through a .exe file that operates on the picture then kicks out the file to a file specified by the user, it also has some threshold arguments: lower, upper. So the typical call for the executable is: ./filter inputfile outputfile lower upper Is there a way that I can loop this call over all the files just from the terminal or by creating some kind of bash script? My problem is similar to this: Execute a command over multiple files with a batch file but this time I am working in a Linux command line terminal. Thank you for your help, Luke H

    Read the article

  • [c++] upload image to imageshack

    - by cinek1lol
    Hi! I would like to send pictures via a program written in C + +. - OK WinExec("C:\\curl\\curl.exe -H Expect: -F \"fileupload=@C:\\curl\\ok.jpg\" -F \"xml=yes\" -# \"http://www.imageshack.us/index.php\" -o data.txt -A \"Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1\" -e \"http://www.imageshack.us\"", NULL); It works, but I would like to send the pictures from pre-loaded carrier to a variable char (you know what I mean? First off, I load the pictures into a variable and then send the variable), cause now I have to specify the path of the picture on a disk. I wanted to write this program in c++ by using the curl library, not through exe. extension. I have also found such a program (which has been modified by me a bit) #include <stdio.h> #include <string.h> #include <iostream> #include <curl/curl.h> #include <curl/types.h> #include <curl/easy.h> int main(int argc, char *argv[]) { CURL *curl; CURLcode res; struct curl_httppost *formpost=NULL; struct curl_httppost *lastptr=NULL; struct curl_slist *headerlist=NULL; static const char buf[] = "Expect:"; curl_global_init(CURL_GLOBAL_ALL); /* Fill in the file upload field */ curl_formadd(&formpost, &lastptr, CURLFORM_COPYNAME, "send", CURLFORM_FILE, "nowy.jpg", CURLFORM_END); curl_formadd(&formpost, &lastptr, CURLFORM_COPYNAME, "nowy.jpg", CURLFORM_COPYCONTENTS, "nowy.jpg", CURLFORM_END); curl_formadd(&formpost, &lastptr, CURLFORM_COPYNAME, "submit", CURLFORM_COPYCONTENTS, "send", CURLFORM_END); curl = curl_easy_init(); headerlist = curl_slist_append(headerlist, buf); if(curl) { curl_easy_setopt(curl, CURLOPT_URL, "http://www.imageshack.us/index.php"); if ( (argc == 2) && (!strcmp(argv[1], "xml=yes")) ) curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headerlist); curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost); res = curl_easy_perform(curl); curl_easy_cleanup(curl); curl_formfree(formpost); curl_slist_free_all (headerlist); } system("pause"); return 0; }

    Read the article

  • getimagesize on alfresco image

    - by SupFrig
    i'm working on a front display for an alfresco filled with pictures. i'm building my pictures url like this : http://myHost.com:8080/share/proxy/alfresco-noauth/api/node/content/workspace/SpacesStore/bf0a8b21-b8d9-487d-a529-dee8c49d7c6f/filetitle.jpg?alf_ticket=myTicket where myHost is the server and myTicket is the ticket generated at this url : http://myHost.com:8080/alfresco/service/api/login?u=login&pw=password Picture is displaying correctly with this url, but i want to use phpthumb to resize it, and when i try to use it on my picture, i get an http 500 error on the script and the following log : PHP Warning: getimagesize(http://myHost.com:8080/share/proxy/alfresco-noauth/api/node/content/workspace/SpacesStore/bf0a8b21-b8d9-487d-a529-dee8c49d7c6f/filetitle.jpg?alf_ticket=myTicket): failed to open stream: HTTP request failed! HTTP/1.1 401 Non-Autorisé I shouldn't hit the authentification, since my link has a valid ticket (I don't hit authentification when i display normally my picture)

    Read the article

  • How to scale an image (in data URI format) in JavaScript (real scaling, not using styling)

    - by 103067513055141045393
    We are capturing a visible tab in a Chrome browser (by using the extensions API chrome.tabs.captureVisibleTab) and receiving a snapshot in the data URI scheme (Base64 encoded string). Is there a JavaScript library that can be used to scale down an image to a certain size? Currently we are styling it via CSS, but have to pay performance penalties as pictures are mostly 100 times bigger than required. Additional concern is also the load on the localStorage we use to save our snapshots. Does anyone know of a way to process this data URI scheme formatted pictures and reduce their size by scaling them down? References: Data URI scheme on http://en.wikipedia.org/wiki/Data_URI_scheme Chrome Extensions API onhttp://code.google.com/chrome/extensions/tabs.html The "Recently Closed Tabs" Chrome Extension onhttp://code.google.com/p/recently-closed-tabs

    Read the article

  • How to get which image (its position) is on focus in an Image Gallery?

    - by Spredzy
    Hi all, I am playing around with the Gallery widget. I would like to know how can we get the position of the image on focus in the gallery. For example having several pictures in my gallery, if I tap my finger to the right, pictures will come and go until it stop to one. How one can get the position of this one picture that is currently on focus ? I don't know if I was clear enough, if there is anything you want me to add do not hesitate. Thank you,

    Read the article

  • Desktop PC Raid 5 or JBOD?

    - by Sean Lim
    I have a desktop PC and I want to get alot of space for movies, music, and pictures. I probably will not be deleting files. I am running Windows 7 on my system. It is kind of silly I just want the physical drives to be labeled as a single letter drive. And probably map my video, documents, pictures and music on that single drive. The main reason I considered RAID 5 because I would be lazy to get the data I lost and hopefully that if I get a new drive, it would rebuild it. So my question is which would be better? A second question is can I get RAID card that has only 2 internal connectors and still do RAID 5? or do I have to get a RAID card that has 4 internal connectors.

    Read the article

  • Execute jQuery code when images have loaded from external resource

    - by Nick Swan
    Hi all, I'm getting users profile pictures from Facebook so their loading time varies quite a lot. When they have loaded I want to resize them. I have the resizing code working OK, but cannot get the actual code to execute reliably at the right time. According to the info I've found this should work: $('.userPic').load(function () { ... code to resize pictures }); But it doesn't seem 100% reliable. Any other hints or tips? Thanks Nick Swan

    Read the article

  • How to add OnClickListener in ViewPager

    - by Erdem Azakli
    I have problem with ViewPager and can't find answer.I want to Toast a message when pictures(view) clicked. I can't make, please help me. Example: click on the picture1 --Message"Picture1" click on the picture2 --Message"Picture2" Thanks a lot, Mypageradapter; package com.example.pictures; import android.content.Context; import android.media.AudioManager; import android.os.Parcelable; import android.support.v4.view.PagerAdapter; import android.support.v4.view.ViewPager; import android.view.LayoutInflater; import android.view.View; public class MyPagerAdapter extends PagerAdapter{ public int getCount() { return 6; } public Object instantiateItem(View collection, int position) { View view=null; LayoutInflater inflater = (LayoutInflater) collection.getContext() .getSystemService(Context.LAYOUT_INFLATER_SERVICE); int resId = 0; switch (position) { case 0: resId = R.layout.picture1; view = inflater.inflate(resId, null); break; case 1: resId = R.layout.picture2; view = inflater.inflate(resId, null); break; case 2: resId = R.layout.picture3; view = inflater.inflate(resId, null); break; case 3: resId = R.layout.picture4; view = inflater.inflate(resId, null); break; case 4: resId = R.layout.picture5; view = inflater.inflate(resId, null); break; case 5: resId = R.layout.picture6; view = inflater.inflate(resId, null); break; } ((ViewPager) collection).addView(view, 0); return view; } @SuppressWarnings("unused") private Context getApplicationContext() { // TODO Auto-generated method stub return null; } private void setVolumeControlStream(int streamMusic) { // TODO Auto-generated method stub } @SuppressWarnings("unused") private Context getBaseContext() { // TODO Auto-generated method stub return null; } @SuppressWarnings("unused") private PagerAdapter findViewById(int myfivepanelpager) { // TODO Auto-generated method stub return null; } @Override public void destroyItem(View arg0, int arg1, Object arg2) { ((ViewPager) arg0).removeView((View) arg2); } @Override public boolean isViewFromObject(View arg0, Object arg1) { return arg0 == ((View) arg1); } @Override public Parcelable saveState() { return null; } public static Integer getItem(int position) { // TODO Auto-generated method stub return null; } } OnPageChangeListener; package com.example.pictures; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.support.v4.view.ViewPager; import android.support.v4.view.ViewPager.OnPageChangeListener; import android.view.View; import android.widget.Button; import android.widget.Toast; public class Pictures extends Activity implements OnPageChangeListener{ SoundManager snd; int sound1,sound2,sound3; View view=null; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.picturespage); MyPagerAdapter adapter = new MyPagerAdapter(); ViewPager myPager = (ViewPager) findViewById(R.id.myfivepanelpager); myPager.setAdapter(adapter); myPager.setCurrentItem(0); myPager.setOnPageChangeListener(this); snd = new SoundManager(this); sound1 = snd.load(R.raw.sound1); sound2 = snd.load(R.raw.sound2); sound3 = snd.load(R.raw.sound3); } public void onPageScrollStateChanged(int arg0) { // TODO Auto-generated method stub } public void onPageScrolled(int arg0, float arg1, int arg2) { // TODO Auto-generated method stub } public void onPageSelected(int position) { // TODO Auto-generated method stub switch (position) { case 0: snd.play(sound1); break; case 1: snd.play(sound2); break; case 2: snd.play(sound3); break; case 3: Toast.makeText(this, "1", Toast.LENGTH_SHORT).show(); break; case 4: Toast.makeText(this, "2", Toast.LENGTH_SHORT).show(); break; case 5: Toast.makeText(this, "3", Toast.LENGTH_SHORT).show(); break; } } };

    Read the article

  • To Interface or Not?: Creating a polymorphic model relationship in Ruby on Rails dynamically..

    - by Globalkeith
    Please bear with me for a moment as I try to explain exactly what I would like to achieve. In my Ruby on Rails application I have a model called Page. It represents a web page. I would like to enable the user to arbitrarily attach components to the page. Some examples of "components" would be Picture, PictureCollection, Video, VideoCollection, Background, Audio, Form, Comments. Currently I have a direct relationship between Page and Picture like this: class Page < ActiveRecord::Base has_many :pictures, :as => :imageable, :dependent => :destroy end class Picture < ActiveRecord::Base belongs_to :imageable, :polymorphic => true end This relationship enables the user to associate an arbitrary number of Pictures to the page. Now if I want to provide multiple collections i would need an additional model: class PictureCollection < ActiveRecord::Base belongs_to :collectionable, :polymorphic => true has_many :pictures, :as => :imageable, :dependent => :destroy end And alter Page to reference the new model: class Page < ActiveRecord::Base has_many :picture_collections, :as => :collectionable, :dependent => :destroy end Now it would be possible for the user to add any number of image collections to the page. However this is still very static in term of the :picture_collections reference in the Page model. If I add another "component", for example :video_collections, I would need to declare another reference in page for that component type. So my question is this: Do I need to add a new reference for each component type, or is there some other way? In Actionscript/Java I would declare an interface Component and make all components implement that interface, then I could just have a single attribute :components which contains all of the dynamically associated model objects. This is Rails, and I'm sure there is a great way to achieve this, but its a tricky one to Google. Perhaps you good people have some wise suggestions. Thanks in advance for taking the time to read and answer this.

    Read the article

  • Serving images from Amazon S3 in PHP application

    - by luckytaxi
    So it just occurred to me that once I upload profile pics to S3, I have to figure out a way to keep track of the files. For example, if "susan" uploads 3 profile pics, I need to recall those 3 pictures and display it on her profile page if someone views her page. With that said, would the following work? User uploads picture from form Save file information (filename, user info, etc...) into DB and reference URL from S3 Upload photos to S3 When displaying pictures, I'll query the DB for the info and display the images from S3 accordingly.

    Read the article

  • Fading transition slideshow

    - by Simon Carlson
    I've got a JavaScript that produces a slideshow. It loads the pictures before starting the actual slideshow. Code below. var image1=new Image() image1.src="filename1.jpg" var image2=new Image() image2.src="filename2.jpg" var image3=new Image() image3.src="filename3.jpg" var step=1 function slideit(){ if (!document.images) return document.images.slide.src=eval("image"+step+".src") if (step<3) step++ else step=1 setTimeout("slideit()",1000) } And this is the required HTML for it to work: <img src="filename1.jpg" name="slide" /> Now, if I want to have fading transitions instead of just having new pictures popping up, how do I approach this? By fading I mean either have the old picture fade out, the new fade in or possibly and most likely both fade in/out. Can this be achieved with pure JavaScript and no jQuery or Ajax?

    Read the article

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