"C://test/test/test.png" -> blub
blub = blub.Replace(@"/", @"\");
result = "C:\\\\test\\test\\test.png"
how does that make sense? It replaces a single / with two \
?
I have a very strange problem with a UITableview within a navigation controller on the iPhone simulator. Of the cells displayed, only some are correctly rendered. They are all supposed to look the same but the majority are missing the accessory I've set, scrolling the view changes which cell has the accessory so I suspect it's some sort of cell caching happening, although the contents are correct for each cell. I also set an image as the background and that was also only displaying sporadically but I fixed that by changing
cell.backgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"yellow-bar_short.png"]];
(which also only rendered a random cell with the background) to
cell.backgroundColor = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"yellow-bar_short.png"]];
I now need to fix the problem with the accessory only showing on a random cell. I tried moving the code from cellForRowAtIndex to willDisplayCell but it made no difference. I put in a log command to confirm that it is running through each frame.
Basically it's a table view (UITableViewCellStyleSubtitle) that gets its info from a server & is then updated by a delegate method calling reload. Code is:
-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
NSLog(@"%@", [NSString stringWithFormat:@"Setting colours for cell %i", indexPath.row]);
// Set cell background
// cell.backgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"yellow-bar_short.png"]];
cell.backgroundColor = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"yellow-bar_short.png"]];
cell.textLabel.backgroundColor = [UIColor clearColor];
cell.detailTextLabel.backgroundColor = [UIColor clearColor];
// detailTableViewAccessory is a view containing an imageview in this view's nib
// i.e. nib <- view <- imageview <- image
cell.accessoryView = detailTableViewAccessory;
}
// Called by data fetching object when done
-(void)listDataTransferComplete:(ArticleListParser *)articleListParserObject
{
NSLog(@"Data parsed, reloading detail table");
self.currentTotalResultPages = (((articleListParserObject.currentArticleCount - 1) / 10) + 1);
self.detailTableDataSource = [articleListParserObject.returnedArray copy]; // make a local copy of the returned array
// Render table again with returned array data (neither of these 2 fixed it)
[self.detailTableView performSelectorOnMainThread:@selector(reloadData) withObject:nil waitUntilDone:NO];
// [self.detailTableView reloadData];
// Re-enable necessary buttons (including table cells)
letUserSelectRow = TRUE;
[btnByName setEnabled:TRUE];
[btnByPrice setEnabled:TRUE];
// Remove please wait message
NSLog(@"Removing please wait view");
[pleaseWaitViewControllerObject.view removeFromSuperview];
}
I only included code that I thought was relevant, can supply more if needed. I can't test it on an iPhone yet so I don't know if it's maybe just a simulator anomaly or a bug in my code. I've always gotten good feedback from questions, any ideas?
<?php
function register_template(){
print_r(func_get_args());
# the result was an array ( [0] => my template [1] => screenshot.png [2] => nice template .. )
}
register_template( # unkown number of arguments
$name = "my template",
$screenshot = "screenshot.png",
$description = "nice template .. "
)
?>
BUT , I want the result array as $key = $value form , $key represents the parameter name.
I am trying to set my image:
detailedEventViewController.thumbnail.image = [UIImage imageNamed:@"amnesia.png"];
But the imageview appears blank. amnesia.png is in my resources group. The file exists.
Results of my log:
2011-01-08 10:52:32.822 HD Pocket Vacations[25271:207] Image: <UIImage: 0x66203b0>
2011-01-08 10:52:32.823 HD Pocket Vacations[25271:207] dEVC: <DetailedEventViewController: 0x6628340>
2011-01-08 10:52:32.824 HD Pocket Vacations[25271:207] thumbnail: (null)
I'm moving my application from 3.x to 4.x as I prepare for the app store and found that I need to have 2 copies of all my custom pngs - my question is how can I determine what img to show and when. Example - how do I know to show the Find.png vs the Find@2x.png
Is it "safe" or "correct" to look for 4.x specific apis or does the iphone have a way to determine what platform you are on at runtime?
Thank you in advance
I have a .h when I map all the image files names and xib names with #defines. For example, if I have an image called "buttonBackground.png" I map it in my .h as
#define BUTTON_BACKGROUND_PNG_FILE @"buttonBackground.png"
It's possible to detect when a resource is added to the bundle and create the correspond define with a script?
Hi there,
I'm creating a set of input fields and using javascript's .style.backgroundColor = "red" to change the colour of any invalid fields.
In Chrome, there is no problem. However, in Firefox, as soon as I touch the backgroundColor (even if I set it to white) then I get these strange shadow effects.
Does anyone know what's going on?
before: http://imgur.com/xYRLT.png
after: http://imgur.com/R1tdI.png
Currently, for things like background images, our css files have no domain specified. This works both in our development and production environments.
background-image: url(/images/bg.png);
For performance reasons (cookie-less domain), we'd like to switch this:
background-image: url(http://staticimagedomain.com/images/bg.png);
Ideally, we don't hard code those, so our development environments can still pull locally.
Any thoughts on how to best achieve this?
I'm creating a scrollable banner for my homepage with 'up' and 'down' button for user to scroll the banner. How do I make it so that the mouse scroller is able to scroll the banner too and also once I click on the down or up button the user will be able to see the transition of the banner scrolling upwards or downwards?
scroll script:
<script>
var t = 0;
function up()
{
t += 600;
with(document.getElementById("contents"))
{
if (t > 0)
t = 0;
if(style)
style.top = t + "px";
else
setAttribute("style", "top: " + t + "px");
}
}
function down()
{
t -= 600;
with(document.getElementById("contents"))
{
if(t < -clientHeight)
t = -clientHeight;
if(style)
style.top = t + "px";
else
setAttribute("style", "top: " + t + "px");
}
}
</script>
scrollable banner:
<table width="950px" height="600px">
<tr>
<td valign="top">
<div id="scrollable" style="height:600px; width:950px">
<div id="contents" style="height:600px; width:950px">
<table bgcolor="#dcdcdc" width="950px" height="600px">
<tr>
<td height="490px"></td>
</tr>
<tr>
<td height="100px"><img src="images/banner_title.png"/></td>
</tr>
</table>
<table bgcolor="#ffd07e" width="950px" height="600px">
<tr>
<td height="490px"></td>
</tr>
<tr>
<td height="100px"><img src="images/banner_title.png"/></td>
</tr>
</table>
buttons:
<table>
<tr>
<td width="30px"><a href="javascript:void(0)" onClick="up()"><img src="images/arrow_up.png"/></a></td>
<td width="30px"><a href="javascript:void(0)" onClick="down()"><img src="images/arrow_down.png"/></a></td>
</tr>
</table>
I use the following code
<menu image="chrome://mecho/content/ic.png" label="Mecho Submission Form" class="menu-iconic" id="mechi-menu" insertafter="context-copylink">
Firefox displays an icon in the menu; however when I use the following (for the submenu)
<menuitem label="App" image="chrome://mecho/content/icons/app.png" class="menu-iconic" onclick="mecho.add('katzcd','App')"/>
It doesn't show up!! any idea?
First, I can assume that all urls that end with jpeg, jpg, bmp, png or gif are images, and others aren't.
I thought of, and tried two solutions:
Matching the regular expression .(jpe?g|bmp|png|gif)$
Using ends-with to check each separately
But, it appears that neither of these exist in XPath 1.0, or at least, they don't exist in Firefox (I am writing a greasemonkey script, so it is only important for the path to work in Firefox).
I have a javasrcript variable
var hash = {
'.bmp' : 1,
'.gif' : 1,
'.jpeg' : 1,
'.jpg' : 1,
'.png' : 1,
'.tif' : 1,
'.tiff' : 1,
};
I want to display the values (.bmp, .gif, .jpeg, .jpg, .png, .tif, .tiff) of this "hash" object in my alert message. How can I do this? Please help.
I just started django and i want to access images uploaded by a user.
here is my model:
class Food(models.Model):
name = models.CharField(max_length=100)
price = models.DecimalField(max_digits=4, decimal_places=2)
quantity = models.IntegerField(blank=True, null=True)
description = models.CharField(max_length=200)
location = models.CharField(max_length=100)
time = models.DateTimeField()
photo_thumbnail = models.ImageField(upload_to="images")
photo_fullsize = models.ImageField(upload_to="images")
i stored the image in the "images" folder below
the html is this:
img src="{{steak.photo_thumbnail}}"
and
steak.photo_thumbnail = images/steak_and_egg_thumbnail_1.png
here is the error i get:
[06/Jul/2012 19:08:24] "GET /menu/ HTTP/1.1" 200 99
[06/Jul/2012 19:08:24] "GET /menu/images/steak_and_egg_thumbnail_1.png HTTP/1.1" 404 2127
Can I do an if inside Where?
or something that allows me to do the checks only if the field is not null (path=null)
SELECT
IF(path IS NOT NULL, concat("/uploads/attachments/",path, "/thumbnails/" , nome), "/uploads/attachments/default/thumbnails/avatar.png") as avatar_mittente
FROM prof_foto
WHERE profilo_id = 15
-- only if path != "/uploads/attachments/default/thumbnails/avatar.png"
AND foto_eliminata = 0 AND foto_profilo = 1
I have to fetch all the files from a folder and i am using the function GetFiles() like
string[] dirImages = Directory.GetFiles(strPathYearImages + intYear , "*.png");
where strPathYearImages="Images\Holiday\2010\"
but when i write the whole path like
string[] dirImages = Directory.GetFiles(@"E:\IWP\Images\Holiday\"+ intYear , "*.png");
i get the required result.
How to solve this problem? I dont want to use the whole path.
Help me out.
Regards,
Jigar <3
I need to serve images securely to validated users only (i.e. they can't be served as static files). I currently have the following Python view in my Django project, but it seems inefficient. Any ideas for a better way?
def secureImage(request,imagePath):
response = HttpResponse(mimetype="image/png")
img = Image.open(imagePath)
img.save(response,'png')
return response
(Image is imported from PIL.)
I'm aware of this topic: I've used it to change most of the editor colors, and that's great.
But that wasn't enought, there's still too much white (and I need to change it because it hurts my eyes).
I've searched in the preferences (both using Eclipse itself and editing the files) for instances of while (255,255,255) and changed them all. Looks like I'm missing something.
too much white in the UI:
http://www.imagebanana.com/view/gy89qf7/eclipse_too_much_white_1.png
totally white in this screen:
http://www.imagebanana.com/view/j8282wf/eclipse_too_much_white_2.png
When call setImageWithURL, it fails with following,
[UIImageView setImageWithURL:placeholderImage:]: unrecognized selector sent to instance 0x149a20
2011-12-14 18:11:38.060 [781:707] Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIImageView setImageWithURL:placeholderImage:]: unrecognized selector sent to instance 0x149a20'
I can confirm I have included SDWebImage project and required headers correctly as I can use the SDWebImageManager successfully.
Following is the code where I called the UIImageView category method setImageWithURL
NSURL* url = [NSURL URLWithString:@"www.abc.com/abc.png"];
[cell.imageView setImageWithURL:url placeholderImage:[UIImage imageNamed:@"abc.png"]];
I have an array of NSStrings:
Flower
Car
Tree
Cat
Shoe
Some of these strings have images associated with them; some don't. I can build an image name by appending .png to the name (e.g. Flower.png).
How do I check whether that image actually exists within the bundle before I try to load it into the view?
Sometimes I want a filename instead of what zsh guesses for me. For example, I have a PNG file without a proper .png suffix, which makes zsh think it isn't a picture and won't list it when I type Tab to complete arguments of display.
I am wondering if there is a key sequence that completes for a filename wherever the context is, like ^XC for _correct_filename, or how to configure zsh to do the thing?
It is the code:
self.view.backgroundColor= [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"yourimage.png"]];
My "yourimage.png" have some space that is transparency. But it shows me it becomes black. How can I change it to show the transparency instead of black color? thz.
Hello,
I believe this question has been asked a lot of times, and I have managed to overcome this problem before whenever it occurred. Just now, I feel stuck with it and can't find a proper solution to make it work in all browsers: it does work properly only in Firefox, while in IE and Safari its elements are somehow apart from each other. You can see the result here:
http://img813.imageshack.us/img813/8393/firefox.png
http://img812.imageshack.us/img812/8041/10990669.png
This is the code I use:
http://pastebin.com/n6KEjazp
Thank you very much in advance!
Suppose I have a span:
<span class="myspan"></span>
.myspan{
background: url(image.png) top left no-repeat;
}
How do I make it so that when people hover my span, it shows "image_hover.png"?