Search Results

Search found 17342 results on 694 pages for 'custom draw'.

Page 148/694 | < Previous Page | 144 145 146 147 148 149 150 151 152 153 154 155  | Next Page >

  • htaccess: Custom redirect from any folder to home.

    - by xRobot
    I have site with these files and foldes: /index.php ( that include php files contained in folder1 and folder2 ) /config.php /folder1/ /folder2/ I want this: when a user point to any folder ( folder1, folder2 or any other folder ) then he is redirected to index.php How could I do that ?

    Read the article

  • Image-free, custom-styled search bar

    - by Jon
    I'm working with the designer and he sent me the following design for the search bar on our webpage: I'm very much against using images in webpage design unless completely necessary, so I'm hoping that I can recreate the whole search bar widget in CSS. I know how to do border-radius, gradients, box-shadows, etc, so that's not a problem. Question: Assuming CSS3 browser compatibility, how can I go about recreating the actual search button (the magnifying glass portion) with the double curved edge, and the slight drop shadow on the bottom left? Thoughts: My initial feeling was that the search button would be circular and free-standing, then overlap the search input div with a negative left-margin, but then I was unsure how I would get that drop shadow. Edit: I'm not completely opposed to using an image for the magnifying glass, but I've seen a similar icon created in CSS before. Would an image vs. pure CSS end up loading at the same speed, or should I do all I can do in pure CSS?

    Read the article

  • Output custom messages based on row value

    - by decimal
    I've made a simple guestbook mysql/php page. An entry is displayed if the approve column has a value of 1. For the adminstrator, I want to display either "message approved" or "not approved". Here's my code: while ($row = mysql_fetch_array ($r)) { print "<p>Guest:" .$row['name']. "</p> <p>Date:" .$row['date']. "</p> <p>Comment:". $row['comment']. "</p>"; if ($row['approve'] = '1') { print '<p>YES, the message has been approved</p>'; } else { print '<p>NO, it hasn\'t been approved</p>'; } Whatever value the if statement checks approve is equal to, all approve values are output as that value.

    Read the article

  • Check if NSString exists in custom object in NSArray

    - by Paul Peelen
    I have an NSArray with Store objects. Each Store object has two NSString objects; StoreID and Name. I would like to check quickly if an ID exists in this NSArray with Store objects. Example: Store *s1 = [[Store alloc] init]; s1.name = @"Some Name"; s1.id = @"123ABC"; Store *s2 = [[Store alloc] init]; s2.name = @"Some Other Name"; s2.id = @"ABC123"; NSArray *array = [[NSArray alloc] initWithObjects:s1, s2, nil]; NSString *myIdOne = @"ABCDEF"; NSString *myIdTwo = @"123ABC"; BOOL myIdOneExists = ...? BOOL myIdTwoExists = ...? Its the ...? I need to figure out. I know I can do this using a for loop and break when found... but this seems to me like an nasty approach since the NSArray could contain thousands of objects,... theoretically. So I would like to know about a better solution.

    Read the article

  • Intersection() and Except() is too slow with large collections of custom objects

    - by Theo
    I am importing data from another database. My process is importing data from a remote DB into a List<DataModel> named remoteData and also importing data from the local DB into a List<DataModel> named localData. I am then using LINQ to create a list of records that are different so that I can update the local DB to match the data pulled from remote DB. Like this: var outdatedData = this.localData.Intersect(this.remoteData, new OutdatedDataComparer()).ToList(); I am then using LINQ to create a list of records that no longer exist in remoteData, but do exist in localData, so that I delete them from local database. Like this: var oldData = this.localData.Except(this.remoteData, new MatchingDataComparer()).ToList(); I am then using LINQ to do the opposite of the above to add the new data to the local database. Like this: var newData = this.remoteData.Except(this.localData, new MatchingDataComparer()).ToList(); Each collection imports about 70k records, and each of the 3 LINQ operation take between 5 - 10 minutes to complete. How can I make this faster? Here is the object the collections are using: internal class DataModel { public string Key1{ get; set; } public string Key2{ get; set; } public string Value1{ get; set; } public string Value2{ get; set; } public byte? Value3{ get; set; } } The comparer used to check for outdated records: class OutdatedDataComparer : IEqualityComparer<DataModel> { public bool Equals(DataModel x, DataModel y) { var e = string.Equals(x.Key1, y.Key1) && string.Equals(x.Key2, y.Key2) && ( !string.Equals(x.Value1, y.Value1) || !string.Equals(x.Value2, y.Value2) || x.Value3 != y.Value3 ); return e; } public int GetHashCode(DataModel obj) { return 0; } } The comparer used to find old and new records: internal class MatchingDataComparer : IEqualityComparer<DataModel> { public bool Equals(DataModel x, DataModel y) { return string.Equals(x.Key1, y.Key1) && string.Equals(x.Key2, y.Key2); } public int GetHashCode(DataModel obj) { return 0; } }

    Read the article

  • ASP.NET Custom Control - Template Allowing Literal Content

    - by Bob Fincheimer
    I want my User Control to be able to have Literal Content inside of it. For Example: <fc:Text runat="server">Please enter your login information:</fc:Text> Currently the code for my user control is: <ParseChildren(True, "Content")> _ Partial Public Class ctrFormText Inherits FormControl Private _content As ArrayList <PersistenceMode(PersistenceMode.InnerDefaultProperty), _ DesignerSerializationVisibility(DesignerSerializationVisibility.Content), _ TemplateInstance(TemplateInstance.Single)> _ Public Property Content() As ArrayList Get If _content Is Nothing Then Return New ArrayList End If Return _content End Get Set(ByVal value As ArrayList) _content = value End Set End Property Protected Overrides Sub CreateChildControls() If _content IsNot Nothing Then ctrChildren.Controls.Clear() For Each i As Control In _content ctrChildren.Controls.Add(i) Next End If MyBase.CreateChildControls() End Sub End Class And when I put text inside this control (like above) i get this error: Parser Error Message: Literal content ('Please enter your login information to access CKMS:') is not allowed within a 'System.Collections.ArrayList'. This control could have other content than just the text, so making the Content property an attribute will not solve my problem. I found in some places that I need to implement a ControlBuilder Class, along with another class that implements IParserAccessor. Anyway I just want my default "Content" property to have all types of controls allowed in it, both literal and actual controls.

    Read the article

  • Custom font in iPhone Development

    - by Sreelal
    Hi, I am developing an iPhone application which needs to show some font in language other than English like Malayalam or Arabic. Is it possible to do that? Please give me appropriate direction to do this. Thanks in advance.

    Read the article

  • Setting custom UITableViewCells height

    - by Vijayeta
    I am using a custum UITableViewCell which has some labels, buttons and imageviews to be displayed. There is one label in the cell whose text is a NSString object and the length of string could be variable. Due to this, I cannot set a constant height to the cell in the UITableViews: heightForCellAtIndex method. The cell's height depends on the labels height which can be determined using the NSStrings sizeWithFont method. I tried using it, but it looks like I'm going wrong somewhere. How can it be fixed? Here is the code used for initializing the cell. if (self = [super initWithFrame:frame reuseIdentifier:reuseIdentifier]) { self.selectionStyle = UITableViewCellSelectionStyleNone; UIImage *image = [UIImage imageNamed:@"dot.png"]; imageView = [[UIImageView alloc] initWithImage:image]; imageView.frame = CGRectMake(45.0,10.0,10,10); headingTxt = [[UILabel alloc] initWithFrame: CGRectMake(60.0,0.0,150.0,post_hdg_ht)]; [headingTxt setContentMode: UIViewContentModeCenter]; headingTxt.text = postData.user_f_name; headingTxt.font = [UIFont boldSystemFontOfSize:13]; headingTxt.textAlignment = UITextAlignmentLeft; headingTxt.textColor = [UIColor blackColor]; dateTxt = [[UILabel alloc] initWithFrame:CGRectMake(55.0,23.0,150.0,post_date_ht)]; dateTxt.text = postData.created_dtm; dateTxt.font = [UIFont italicSystemFontOfSize:11]; dateTxt.textAlignment = UITextAlignmentLeft; dateTxt.textColor = [UIColor grayColor]; NSString * text1 = postData.post_body; NSLog(@"text length = %d",[text1 length]); CGRect bounds = [UIScreen mainScreen].bounds; CGFloat tableViewWidth; CGFloat width = 0; tableViewWidth = bounds.size.width/2; width = tableViewWidth - 40; //fudge factor //CGSize textSize = {width, 20000.0f}; //width and height of text area CGSize textSize = {245.0, 20000.0f}; //width and height of text area CGSize size1 = [text1 sizeWithFont:[UIFont systemFontOfSize:11.0f] constrainedToSize:textSize lineBreakMode:UILineBreakModeWordWrap]; CGFloat ht = MAX(size1.height, 28); textView = [[UILabel alloc] initWithFrame:CGRectMake(55.0,42.0,245.0,ht)]; textView.text = postData.post_body; textView.font = [UIFont systemFontOfSize:11]; textView.textAlignment = UITextAlignmentLeft; textView.textColor = [UIColor blackColor]; textView.lineBreakMode = UILineBreakModeWordWrap; textView.numberOfLines = 3; textView.autoresizesSubviews = YES; [self.contentView addSubview:imageView]; [self.contentView addSubview:textView]; [self.contentView addSubview:webView]; [self.contentView addSubview:dateTxt]; [self.contentView addSubview:headingTxt]; [self.contentView sizeToFit]; [imageView release]; [textView release]; [webView release]; [dateTxt release]; [headingTxt release]; } textView = [[UILabel alloc] initWithFrame:CGRectMake(55.0,42.0,245.0,ht)]; this is the label whose height and width are going wrong.

    Read the article

  • Dotnetnuke menu custom root

    - by Yobi21
    Is there anyway to use the built-in DNN Menu module to display a menu based at a different root node other than the current tab node? Given the following structure: Page1 -child1_1 -child1_2 Page3 Page2(hidden) -child2_1 -child2_2 In this scenario I will be having 2 menus on this skin. One will be normal navigation based off of the current node and the other will be a set of 'static' links to pages located outside the current node. When on Page1 the normal navigation will show Page1, Page3 and the children of Page1 nested under Page1. The 'static' links will use 'Page2' as their root and will show child2_1 and child2_2.

    Read the article

  • how do you convert data frame to a custom json format

    - by user1471980
    I need to convert a data frame to json fomrat in R. My data frame y is this: dput(y) structure(list(Name = structure(c(38L, 23L, 16L, 35L, 21L, 6L, 34L, 15L, 46L, 1L, 43L, 28L, 39L, 27L, 7L, 20L, 14L, 44L, 48L, 36L), .Label = c("server09", "server10", "server11", "server12", "server13", "server14", "server15", "server16", "server17", "server18", "server19", "server20", "server21", "server22", "server23", "server24", "server25", "server26", "server27", "server28", "server29", "server30", "server31", "server32", "server33", "server34", "server35", "server36", "server37", "server38", "server39", "server40", "server41", "server42", "server43", "server44", "server45", "server46", "server47", "server48", "server49", "server50", "server51", "server52", "server53", "server54", "server55", "server56", "server57", "server58"), class = "factor"), Date = c(1372737600, 1372737602, 1372737609, 1372737617, 1372737618, 1372737618, 1372737643, 1372737646, 1372737648, 1372737652, 1372737654, 1372737660, 1372737665, 1372737671, 1372737699, 1372737701, 1372737718, 1372737721, 1372737728, 1372737731), Cpu = c(3.9025, 36.3042, 2.6075, 3.1338, 0.9474, 0.149, 5.4401, 2.5652, 0.3612, 3.2651, 1.8703, 13.8967, 4.2438, 5.4401, 2.468, 0.9147, 1.4637, 7.2528, 6.119, 7.7009)), .Names = c("Name", "Date", "Cpu"), row.names = c(1L, 42L, 83L, 84L, 125L, 126L, 127L, 168L, 169L, 202L, 203L, 236L, 277L, 318L, 359L, 360L, 361L, 362L, 395L, 396L), class = "data.frame") I need my json file to look like this: [{ "name":'server13', "data": [ [1372737600,3.9025], [1372737602,10], [1372737609,10] ... [1372737731,20] ] }, { "name":'server14', "data": [ [1372737600,4], [1372737602,10], [1372737609,10] ... [1372737731,30] ] }] I used rjson package as the following: p <- toJSON(as.list(y)) I get this output: "{\"Name\":[\"server13\",\"servar14\",...],\"Date\":[1372737600,1372737602,..],\"Cpu\":[3.9025,36.3042,..]}" Is there an easy way to do this in R?

    Read the article

  • How to custom query using ORM in Fuelphp?

    - by viyancs
    I have a problem when I want to query table using ORM ,example I have article table with field id,author,text. My code like this : // Single where $article = Model_Article::find()->where('id', 4); print_r($article); that't code will be fetch all field on table article, it's like select * from article where id = 4 Try Possibility $article = Model_Article::find(null, array('id','title'))->where('id', 3); the response is object(Orm\Query)#89 (14) { ["model":protected]=> string(10) "Model_Article" ["connection":protected]=> NULL ["view":protected]=> NULL ["alias":protected]=> string(2) "t0" ["relations":protected]=> array(0) { } ["joins":protected]=> array(0) { } ["select":protected]=> array(1) { ["t0_c0"]=> string(5) "t0.id" } ["limit":protected]=> NULL ["offset":protected]=> NULL ["rows_limit":protected]=> NULL ["rows_offset":protected]=> NULL ["where":protected]=> array(1) { [0]=> array(2) { [0]=> string(9) "and_where" [1]=> array(3) { [0]=> string(5) "t0.id" [1]=> string(1) "=" [2]=> int(3) } } } ["order_by":protected]=> array(0) { } ["values":protected]=> array(0) { } } that's is not return id or title field. but when i'm try by adding get_one() method $article = Model_Article::find(null, array('id','title'))->where('id', 3)->get_one(); id is return , but title is not and another field, i don't know why ? Reference ORM Discussion FuelPHP it's say ORM currently will be select all column, no plans to change that at the moment. My Goal I want to query in orm like this select id,owner from article where id = 4 it's will be return only id & owner, how i can get that using orm ?

    Read the article

  • how to render custom columns with a GenericTreeModel

    - by Giorgio Gelardi
    I have to display some data in a treeview. The "real" data model is huge and I cannot copy all the stuff in a TreeStore, so I guess I should use a GenericTreeModel to act like a virtual treeview. Btw the first column is the classic icon+text style and I think I should declare a column with a CellRendererPixbuf (faq sample), but I'm not sure what the model methods on_get_n_columns() and on_get_value() should return. It's both a Pixbuf and a string value for the same column. Any help will be appreciated.

    Read the article

  • securing a webservice for use from a custom iphone app only

    - by mme
    I want to create an iphone application which consists of two parts: The app itself and a server side component. On a users request, the app sends data to the server which is to be handled by human operators. To prevent abuse from an iphone app user, the id of the iphone is sent along with the request, and the operators can blacklist pranksters to deny their iphone access to the service. So far so good. Now the problem is: Someone could easily discover the address of the serverside component, and write a script to send bogus requests, using multiple IP addresses etc. So my question is: how can I defend myself against this? Captchas to protect against scripted attacks or requiring the user to register himself are not an option for this particular application. If I had control of the download, I would associate a unique ID with each downloaded app, but obviously this is not an option with the appstore. What would be your approach to make the server side part more secure?

    Read the article

  • Custom punctuation function making script run over the php's 60s runtime limit

    - by webmasters
    I am importing allot of product data from an XML file (about 5000 products). When I run the script I can make it work in about 10-12 seconds. Now, when I add this punctuation function which makes sure each product description ends with a punctuation sign, the code runs until the php 60 seconds loadtime on my server but I'm not getting any errors. I have error reporting turned on. I just get a final error that the script could not load in 60 seconds. The question is, looking at this function, is it that resource consuming? What can I do to make it faster? function punctuation($string){ if(strlen($string) > 5){ // Get $last_char $desired_punctuation = array(".",",","?","!"); $last_char = substr($string, -1); // Check if $last_char is in the $desired_punctuation array if(!in_array($last_char, $desired_punctuation)){ // strip the $mytrim string and get only letters at the end; while(!preg_match("/^[a-zA-Z]$/", $last_char)){ $string = substr($string, 0, -1); $last_char = substr($string, -1); } // add "." to the string $string .= '.'; } } return $string; } If the function is ok, the long runtime must come from something else which I'll have to discover. I just want your input on this part.

    Read the article

  • form_form and custom parameter in path_prefix

    - by fguillen
    Hi people, I have this route: # config/routes.rb map.namespace :backshop, :path_prefix => '/:shop_id/admin' do |backshop| backshop.resources :items end And I want to use the form_for magic to reuse the same form on both: new and edit views: <% form_for [:backshop, @item] do |f| %> This used to works, and used to build a create url for the item or update url for the item depending on the status of the @item object. But this is not working on this case because the routes don't exists without the shop_id parameter, and I don't know how to say to the form_for something like this: <% form_for [:backshop, @item], :shop_id => @shop do |f| %> Because it tries to use the @item like the :shop_id parameter. Or like this <% form_for [:backshop, @shop, @item] do |f| %> Because it tries to build this url: backshop_shop_order_path I Know I can just to extract the form_for declaration from the partial and do different calls on depending if new or edit: <% form_for( @item, :url => backshop_items_path( @shop ) ) do |f| %> and <% form_for( @item, :url => backshop_item_path( @shop, @item ) ) do |f| %> But I just wanted don't do this because I have a bunch of models and is a few boring :) Thanks for any suggestion f.

    Read the article

  • Fake location for the device (custom)

    - by AtomRiot
    I know there are a few apps out there to fake a devices location but specifically what i want to do is use a location grabbed from a url. What direction should I look for setting the location on the device. The scenario i have is a jailbroken Wi-Fi iPad tethered to a nexus one. The nexus one would host a background service that when a request is recieved, it would respond with gps data of its current location. The jailbroken ipad would have a background service that either updated the location on a time interval, or on a per request basis (depending on how i have to implement it) by submitting a request to the tethered nexus one service. That data would then be set on the ipad and an application requesting location would get the service data. The goal is to recreate the location faker app's functionality with the exception of the spoofed location comes from the nexus ones gps via the service but i have not yet found out how to set the location data for the device. I can ofcourse implement this in a per app basis but it would be awesome to have any app be able to use it.

    Read the article

  • C# Custom user settings class not saving

    - by Zenox
    I have the following class: [Serializable] [XmlRoot ( ElementName = "TextData", IsNullable = false)] public class TextData { private System.Drawing.Font fontColor; [XmlAttribute ( AttributeName = "Font" )] public System.Drawing.Font Font { get; set; } [XmlAttribute ( AttributeName = "FontColor" )] public System.Drawing.Color FontColor { get; set; } [XmlAttribute ( AttributeName = "Text" )] public string Text { get; set; } public TextData ( ) { } // End of TextData } // End of TextData And Im attempting to save it with the following code: // Create our font dialog FontDialog fontDialog = new FontDialog ( ); fontDialog.ShowColor = true; // Display the dialog and check for an ok if ( DialogResult.OK == fontDialog.ShowDialog ( ) ) { // Save our changes for the font settings if ( null == Properties.Settings.Default.MainHeadlineTextData ) { Properties.Settings.Default.MainHeadlineTextData = new TextData ( ); } Properties.Settings.Default.MainHeadlineTextData.Font = fontDialog.Font; Properties.Settings.Default.MainHeadlineTextData.FontColor = fontDialog.Color; Properties.Settings.Default.Save ( ); } Everytime I load the the application, the Properties.Settings.Default.MainHeadlineTextData is still null. Saving does not seem to take effect. I read on another post that the class must be public and it is. Any ideas why this would not be working properly?

    Read the article

  • Custom view in popupview controller

    - by amok
    Hello there - I create a new project using splitview template (iPad). So far so good. What I am trying to accomplish now it have my own view (which in a NIB) in popupview controller. By default the template provides the table which I don't want to use. How can I do that?

    Read the article

  • (JQuery) How to call a custom function before following link

    - by morpheous
    I want to achieve the following behavior in a page link. When the link is clicked, I want to: First, send (POST) some data back to the server Second, allow the browser to navigate to the url that the link was pointing to. I am relatively new to JQuery, and here is my first attempt below. I will be grateful to any jQuery gurus in here to fillin the blanks (and maybe point out how the snippet below may be improved). <html> <head>test page</head> <body> <div><a id="hotlink" href="http://www.example.com">Clik and see</a></div> </body> <script type="text/javascript"> $(document).ready(function(){ $('hotlink').click(function(){ //AJAX Post data here ... //follow the link url (i.e. navigate/browse to the link) ... }); }); </script> </html>

    Read the article

  • Placing text on UIView in custom location

    - by JAM
    I am trying to calculate a position to place label on the screen. The goal is to place "word" label in lower right corner of the first square block If yellowish square is defined as myView = [[UIView alloc] initWithFrame:CGRectMake(100, 100, 70, 70)]; [self.view addSubview:myView]; [myView setBackgroundColor:[UIColor colorWithHexString:@"FFFFEC"]]; Using it, i'd like to place a label in it's lower right corner l1 = [[UILabel alloc] init]; [l1 setText:@"word"]; [l1 setFrame:CGRectMake(myView.frame.origin.x + myView.frame.size.width, myView.frame.origin.y + myView.frame.size.height, 700, 700)]; [l1 setFont:[UIFont fontWithName:@"Arial" size:10.0]]; [l1 setBackgroundColor:[UIColor colorWithHexString:@"CCFFFEC"]]; [l1 setTextAlignment:UITextAlignmentRight]; [l1 sizeToFit]; This is what happens: The matter here obviously, is in a correct offset. Knowing the font and size of text, how can one correctly calculate it?

    Read the article

  • Custom spring bean

    - by Hari
    Hi, I want to convert some of our internal API into a spring bean that we can use in other projects. This API needs some instantiation and other logic which I want to encapsulate in this bean so that we can just put the bean into our app context with necessary propoerties alone. I remember having read an article on this somewhere in the past - but cant find it now. Any pointers to something similar will be helpful

    Read the article

< Previous Page | 144 145 146 147 148 149 150 151 152 153 154 155  | Next Page >