Search Results

Search found 8286 results on 332 pages for 'defined'.

Page 178/332 | < Previous Page | 174 175 176 177 178 179 180 181 182 183 184 185  | Next Page >

  • Regular expression problem (PHP)

    - by Marcos
    Hello all. I have a little problem with my regular expression, that I use in PHP. My code identify all tags of my content and add a link in this image. My code is working when I use dinamycally, without any defined image. When I try with a imapge path, the code does not work. How can I solve this problem? Working code: $content = preg_replace('/(<img .*?src="(.+?)".*?>)/','<a class="nyromodal foto" href="'.$imagem_wordpress.'">\1</a>', $content); Problem code: $content = preg_replace('/(<img .*?src="ttp://mysite.com/files/2010/04/bac-gallery-site-matters-saline-project1.jpg".*?>)/','<a class="nyromodal foto" href="'.$imagem_wordpress.'">\1</a>', $content);

    Read the article

  • Copy constructor with more than one parameter

    - by Ravi Gupta
    I am learning C++ and was reading copy constructor from the C++: The Complete Reference. The books says that It is permissible for a copy constructor to have additional parameters as long as they have default arguments defined for them. However, in all cases the first parameter must be a reference to the object doing the initializing. But I am confused that how we are going to pass those additional parameters? I am sure there should be some way which is not given in the book and which I am unable to figure out. Can anyone help me out? EDIT: Also is it possible to pass these extra parameters in all three cases i.e. ¦ When one object explicitly initializes another, such as in a declaration ¦ When a copy of an object is made to be passed to a function ¦ When a temporary object is generated (most commonly, as a return value)

    Read the article

  • NAnt IF task doesn't seem to work

    - by goombaloon
    I'm trying the example from the NAnt documentation for the if task at: http://nant.sourceforge.net/release/0.85/help/tasks/if.html Specifically the following code... <if test="${build.configuration='release'}"> <echo>Build release configuration</echo> </if> where build.configuration has been defined beforehand as <property name="build.configuration" value="debug" overwrite="false" /> When I run it using nant.exe (version 0.91.3881.0), I get the following error: '}' expected Expression: ${build.configuration='release'} ^ I'm guessing I'm missing something simple?

    Read the article

  • Creating 'select' listboxes using FormHelper in CakePHP

    - by joec
    I have two models Category and Point. The associations are defined as: Category hasMany Point Point belongsTo Category I would like, when adding Points to my database, to be able to select the category it belongs to from a <select> box, along with the rest of the form data. Where would i need to set the category list and how could i do it? And how would i produce the select box? I assume it could be done with $form->input('categorieslist',array('type'=>'select')); //categorieslist needs //setting somewhere. But i am fairly new to Cake and not done much with associations before. Thanks.

    Read the article

  • CSS and control name mangling in content pages

    - by flashnik
    I have a simple website with a master-page. To set properties to elements on a content page (such as Textbox) I use CSS. In designer it works well but when I launch a site a style isn't apllied to controls. The reason is simple. To say, I have a TextBox with id="TextBox1" in content page, it is placed in ContentPlaceHolder1. In CSS file I set properties for object with id #TextBox1. When I launch a site due to master page name mangling it gets an id like ctl00_ContentPlaceHolder1_TextBox1 which is not defined in CSS file included in masterpage. What is a correct solution of this problem? Hardcoding mangled name doesn't seem to be good.

    Read the article

  • Flex 4: Defining a XML data model in an Actionscript Class

    - by Steve
    I'm really having a hard time accessing a data model I've defined in an Actionscript class in my Flex app. The following is my AS Class (Model.as): package { import mx.rpc.http.HTTPService; public class Model { private static var _instance:Model; public static function getInstance():Model { if (!_instance) _instance = new Model(); return _instance; } [Bindable] public var xml:mx.rpc.http.HTTPService = new mx.rpc.http.HTTPService(); Model.getInstance().xml.url = "http://127.0.01/RAF/DATAPOINTS.xml"; Model.getInstance().xml.resultFormat = "e4x"; } } I'm then trying to access this in my main application with the following code: Model.getInstance().xml.send(); var sectorList:XMLList = Model.getInstance().xml.lastResult; And it just keeps throwing errors. The errors are generic so I can't determine the source in debugging. Hope this is enough info...

    Read the article

  • Putting a dollar value on code quality

    - by Chris Nelson
    As noted in another thread, "In most businesses, code quality is defined in dollars." So my company has an opportunity to acquire a large-ish C code base. Obviously, if the code quality is good, the code base is worth more than if it's poor. That is, if we can readily read, understand, and update the code, it's worth more to us than if it's a spaghetti-coded mess. Without being able to see the code ahead of time, we'd like to set some objective measure as an acceptance criteria like "If the XXX measure is below the price will be discounted YY%." What criteria can we or should we measure and what tool can we use to measure it?

    Read the article

  • Java hashcode based on identity

    - by hjfreyer
    The default behavior of Object.hashCode() is to return essentially the "address" of the object so that a.hashCode() == b.hashCode() if and only if a == b. How can I get this behavior in a user-defined class if a superclass already defines hashCode()? For instance: class A { public int hashCode() { return 0; } } class B extends A { public int hashCode() { // Now I want to return a unique hashcode for each object. // In pythonic terms, it'd look something like: return Object.hashCode(this); } } Ideas?

    Read the article

  • How do I configure StructureMap to use a generic repository?

    - by simonjreid
    I have an interface IGenericRepository<TEntity> where TEntity : IEntity and an implementation GenericRepository<TEntity> where TEntity : Entity. I'm trying to inject a specific IGenericRepository<Section> into a class using StructureMap: ObjectFactory.Initialize(x => { x.For(typeof(IGenericRepository<>)).Use(typeof(GenericRepository<>)); }); But when I try to use ObjectFactory.GetInstance<IGenericRepository<Section>>(); I get: StructureMap Exception Code: 202 No Default Instance defined for PluginFamily System.Data.Common.DbConnection Any ideas why this is or what I'm doing wrong? Thanks in advance, Simon

    Read the article

  • What is recursion? -- In plain english.

    - by Christopher Altman
    I hear this word everyday, but cannot give a meaningful, concise, or plain-english answer to what it is. Recursion is defined by the bastian of knowledge as: Recursion in computer science is a method where the solution to a problem depends on solutions to smaller instances of the same problem.1 The approach can be applied to many types of problems, and is one of the central ideas of computer science.[2] Source Is recursion simply something that repeats itself to get a solution? I am looking for a "Recursion for Dummies" definition, and maybe simple examples. My goal is to be able to understand and explain recursion in my own words. I do not like simply thinking I know the meaning of something because I hear it referenced daily, but have not paused to form my own understanding.

    Read the article

  • Regexp to add attribute in any xml tags

    - by katsuo11
    Hello, I have well-formed xml documents into string variables. I want to use preg_replace to add a defined attribute to every xml tags. For example replace: <tag1> <tag2> some text </tag2> </tag1> by: <tag1 attr="myAttr"> <tag2 attr="myAttr"> some text </tag2> </tag1> So I basically need the regex expression to find any start tags and add my attribute, but I'm a complete regex noob. Thanks, kats

    Read the article

  • proper Django ORM syntax to make this code work in MySQL

    - by gtujan
    I have the following django code working on an sqlite database but for some unknown reason I get a syntax error if I change the backend to MySQL...does django's ORM treat filtering differently in MySQL? def wsjson(request,imei): wstations = WS.objects.annotate(latest_wslog_date=Max('wslog__date'),latest_wslog_time=Max('wslog__time')) logs = WSLog.objects.filter(date__in=[b.latest_wslog_date for b in wstations],time__in=[b.latest_wslog_time for b in wstations],imei__exact=imei) data = serializers.serialize('json',logs) return HttpResponse(data,'application/javascript') The code basically gets the latest logs from WSlog corresponding to each record in WS and serializes it to json. Models are defined as: class WS(models.Model): name = models.CharField(max_length=20) imei = models.CharField(max_length=15) description = models.TextField() def __unicode__(self): return self.name class WSLog(models.Model): imei = models.CharField(max_length=15) date = models.DateField() time = models.TimeField() data1 = models.DecimalField(max_digits=8,decimal_places=3) data2 = models.DecimalField(max_digits=8,decimal_places=3) WS = models.ForeignKey(WS) def __unicode__(self): return self.imei

    Read the article

  • Algorithm for non-contiguous netmask match

    - by Gianluca
    Hi, I have to write a really really fast algorithm to match an IP address to a list of groups, where each group is defined using a notation like 192.168.0.0/252.255.0.255. As you can see, the bitmask can contain zeros even in the middle, so the traditional "longest prefix match" algorithms won't work. If an IP matches two groups, it will be assigned to the group containing most 1's in the netmask. I'm not working with many entries (let's say < 1000) and I don't want to use a data structure requiring a large memory footprint (let's say 1-2 MB), but it really has to be fast (of course I can't afford a linear search). Do you have any suggestion? Thanks guys. UPDATE: I found something quite interesting at http://www.cse.usf.edu/~ligatti/papers/grouper-conf.pdf, but it's still too memory-hungry for my utopic use case

    Read the article

  • Reject (Hard 404) ASP.NET MVC-style URLs

    - by James D
    Hi, ASP.NET MVC web app that exposes "friendly" URLs: http://somesite.com/friendlyurl ...which are rewritten (not redirected) to ASP.NET MVC-style URLs under the hood: http://somesite.com/Controller/Action The user never actually sees any ASP.NET MVC style URLS. If he requests one, we hard 404 it. ASP.NET MVC is (in this app) an implementation detail, not a fundamental interface. My question: how do you examine an arbitrary incoming URL and determine whether or not that URL matches a defined ASP.NET MVC path? For extra credit: how do you do it from inside an ASP.NET-style IHttpModule, where you're getting invoked upstream from the ASP.NET MVC runtime? Thanks!

    Read the article

  • Display Computer Info on an ASP.NET Page

    - by Gene
    I want to build a page for end users to visit (in our MPLS Network) and it show the following information in regards to them: Computer Name OS Disk Space Memory IP Address Active Directory User Name Password Expiration Time (As defined by Global Policy) Maybe a few other things such as Trend Micro Office current version vs. their version, # of MS Updates needed (we utilize WSUS), and a few other things in the future. My question is how would I pull this information from the user when they visit the page? What is the proper function for this? Anyone have examples they wish to share for me to learn by if possible?

    Read the article

  • core-plot and NSDate (iPhone)

    - by Urizen
    I wish to plot a line graph where the x-axis is defined as a number of days between two dates and the y-axis is a value that varies on each of the days. I can plot the y values as an NSNumber but I have no idea how to set the ranges and the markup on the x-axis. I have looked at the date example in the "examples" directory of the core-plot distribution but have found it a little confusing. Does anyone know of a tutorial, or code sample, which might asist me in this regard? Thank you in advance.

    Read the article

  • Accessing parent 'this' inside a jQuery $.getJSON

    - by JP
    I'm going to assume that the overall structure of my code as it currently stands is 'best', otherwise this question gets too long, but if I've made any obvious mistakes (or if I've made life hard for myself) then please correct away! Using jQuery, I have a javascript 'class' set out something like this: function MyClass () { this.noise = "Woof" this.dostuff = function() { $.getJSON("http://cows.go",function(moo) { this.noise = moo.inEnglish; } } } var instance = new MyClass(); instance.doStuff() console.log(instance.noise) I'm expecting some kinda tea drinking moo in the console, but of course I'm getting an error about this.noise not being defined (because $.getJSON doesn't pass this through, right?) Any suggestions as to how to be able to affect instance.squeak for any and all instances of MyClass without interference?

    Read the article

  • How to update user info with restful_authentication plugin in Rails?

    - by benoror
    Hi people, I want to give the users to change their account info with restful_authentication plugin in rails. I added this two methods to my controller: def edit @user = User.find(params[:id]) end def update @user = User.find(params[:id]) # Only update password when necessary params[:user].delete(:password) if pàrams[:user][:password].blank? respond_to do |format| if @user.update_attributes(params[:user]) flash[:notice] = 'User was successfully updated.' format.html { redirect_to(@user) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @user.errors, :status => :unprocessable_entity } end end end Also, I copied new.html.erb to edit.html.erb. Considering that resources are already defined in routes.rb I was expecting it to work easily, bute somehow when I click the save button it calls the create method, instead of update, using a POST http request. Any ideas?

    Read the article

  • When to release the UIImage ?

    - by ragnarius
    I use the following code to draw a subimage UIImage* subIm = getSubImage( large, rect ); [subIm drawInRect:self.bounds]; where getSubImage is defined as follows UIImage* getSubImage(UIImage* uim, CGRect rc){ CGImageRef imref = CGImageCreateWithImageInRect(uim.CGImage, rc); UIImage* sub = [UIImage imageWithCGImage:imref]; CGImageRelease(imref); NSLog(@"subimage retainCount=%d", [sub retainCount]); // is 1 return sub; }//getSubImage Is the code correct? Is it safe to "CGImageRelease" imref? Has sub "CGImageRetained" imref? Should I release subIm (I get an error if I do)? Is subIm contained in the autorelease-pool, and , if so, how do I know this? In general, can one check if an object is contained in the autorelease pool (for debugging purpose)?

    Read the article

  • C Preprocessor: #define in C... advice

    - by vikramtheone
    Hi Guys, I'm making a big C project and I have never come across a situation like this before so, I need your advice. What is your opinion? Is it okay to have the constants defined within conditional preprocessors like I have done below or you advise me to do this some other way? Any drawbacks if I do it this way? Regards Vikram #define NUM_OCTAVES_4 //#define NUM_OCTAVES_5 #ifdef NUM_OCTAVES_4 #define OCTAVES 4 const unsigned char borders [4] = {11, 26, 50, 98}; #elif NUM_OCTAVES_5 #define OCTAVES 5 const unsigned char borders [5] = {11, 26, 50, 98, 194}; #endif

    Read the article

  • ASP.Net: User control with content area, it's clearly possible but I need some details.

    - by bert
    I have seen two suggestions for my original question about whether it is possible to define a content area inside a user control and there are some helpful suggestions i.e. http://stackoverflow.com/questions/1971498/passing-in-content-to-asp-net-user-control and http://stackoverflow.com/questions/1912283/asp-net-user-control-inner-content Now, I like the theory of the latter better than the former just for aesthetic reasons. It seems to make more sense to me but the example given uses two variables content and templateContent that the answerer has not defined in their example code. Without these details I have found that the example does not work. I guess they are properties of the control? Or some such? The former example seems workable but I'd prefer to go with the latter if someone could fill in the blanks for me. Thanks.

    Read the article

  • Flex 3 - Send a HTTP Get request from Flash and want Firefox to show Open With Box.

    - by Kash
    Hi all, I am a newb developer as far as Flex and Flash is concerned. This is what I'm trying to do: 1) Send a HTTP request to our server (with a custom made URL). The URL basically tells the server to send data in a CSV format. 2) The server sends a 200 OK response, which has Content-Type: application/csv and the payload is pure CSV data. What I wish to do is, when firefox gets this 200 OK response, I want it to show the standard Open with box (the one that shows up when you download some file). I tried doing this with HTTPService. I have a "Export to CSV" button on the flash component. Upon clicking that, the flash component is able to succesfully send the HTTP request. I however don't want Flash component to handle the response, so I don't have the 's "result" tag defined. But nothing happens. Any suggestions on how to do this.

    Read the article

  • Access to an inner type

    - by sohum
    A colleague of mine posted a question on an internal forum which got me thinking about whether this was possible through C#. Basically, he's got an interface as follows: public interface IProvider<T> { T GetT(); } Is it possible to use something that implements that interface as a type parameter to another generic class and have access to the type T without re-specifying it? For example: public class Foo<P> where P : IProvider<T> { P p; T GetInnerT() { return p.GetT(); } } This does not compile, because the type T is not defined and hence can't be used as a parameter for IProvider. Is something like this even possible? Just curious!

    Read the article

  • Entity Framework 4: C# !(ReferenceEquals()) vs !=

    - by Eric J.
    Unless a class specifically overrides the behavior defined for Object, ReferenceEquals and == do the same thing... compare references. In property setters, I have commonly used the pattern private MyType myProperty; public MyType MyProperty { set { if (myProperty != value) { myProperty = value; // Do stuff like NotifyPropertyChanged } } } However, in code generated by Entity Framework, the if statement is replaced by if (!ReferenceEquals(myProperty, value)) Using ReferenceEquals is more explicit (as I guess not all C# programmers know that == does the same thing if not overridden). Is there any difference that's escaping me between the two if-variants? Are they perhaps accounting for the possibility that POCO designers may have overridden ==? In short, if I have not overridden ==, am I save using != instead of ReferencEquals()?

    Read the article

  • How- XLST Transformation

    - by Yuan Ray
    Just wanted to ask on how to get the author names in the given xml sample below and put an attribut of eq="yes". EQ means Equal Contributors. This is the XML. <ArticleFootnote Type="Misc"> <Para>John Doe and Jane Doe are equal contributors.</Para> </ArticleFootnote> This should be the output in other form of XML. <AuthorGroups> <Authors eq="yes">John Doe</Authors> <Authors eq="yes">Jane Doe</Authors> </AuthorGroups> Assuming that JOhn Doe and Jane Doe are already defined in the list of authors but after the transformation, author tag should have the attribute eq="yes". Please help as I don't know much writing in xlst. Thanks in advance.

    Read the article

< Previous Page | 174 175 176 177 178 179 180 181 182 183 184 185  | Next Page >