Search Results

Search found 976 results on 40 pages for 'josh schwartzman'.

Page 32/40 | < Previous Page | 28 29 30 31 32 33 34 35 36 37 38 39  | Next Page >

  • using APIs with oauth for single user

    - by Josh
    I'm trying to make use of various APIs including twitter, youtube, etc because we want to embed recent entries (tweets, videos) on our website. However, since I'm just retrieving my own data, I'm wondering how I can do this simpler than the multi-step process required by OAuth. Twitter provides me with my own access token I can use directly, so that kinda works, but I can't find any such token in the YouTube documentation. So how am I supposed to make use of the api if I just want to get a simple list of stuff? how exaclty am I supposed to authenticate my own website to use my own account? I think i might have things all wrong and if so please point me in the right direction. I tried using rss feeds but they don't give me as much control over what I retrieve as using the API directly... any insight or suggestions are appreciated!

    Read the article

  • An error occurred loading a configuration file: Failed to start monitoring changes because the netwo

    - by Josh Stodola
    This error just started happening this morning in one particular project. When I try to publish the site it gives me this error and I can't complete the publish! Sometimes restarting Visual Studio magically fixes the problem, but it will just appear again later. Not only that, when I restart VS I lose all my "undo capabilities". There is a KB article on the subject, but it did not help. What can I do to stop this very annoying problem once and for all?

    Read the article

  • Hiding result sets from multiple selects in a stored procedure

    - by Josh Young
    I have a stored procedure that retrieves SQL queries as text and executes the statements using sp_executesql. Each of the dynamic queries is a count query in that it only returns the number of records found (select COUNT(id) from...). I am looping through a set of SQL queries stored as text and building a table variable out of the results. At the end, I am selecting all the results from the table variable as the result set that I want returned from the stored procedure. However, when I execute the stored procedure, I am naturally getting multiple result sets (one for each of the dynamic queries and one for the final select.) Is there any way I can suppress the results of a select statement executed through sp_executesql? I have found answers that reference storing the results in a temp table, but I don't have control of the query text that I am running so I can't change it to select into anything. Please help. Thank you for your time.

    Read the article

  • Does C++ require a destructor call for each placement new?

    - by Josh Haberman
    I understand that placement new calls are usually matched with explicit calls to the destructor. My question is: if I have no need for a destructor (no code to put there, and no member variables that have destructors) can I safely skip the explicit destructor call? Here is my use case: I want to write C++ bindings for a C API. In the C API many objects are accessible only by pointer. Instead of creating a wrapper object that contains a single pointer (which is wasteful and semantically confusing). I want to use placement new to construct an object at the address of the C object. The C++ object will do nothing in its constructor or destructor, and its methods will do nothing but delegate to the C methods. The C++ object will contain no virtual methods. I have two parts to this question. Is there any reason why this idea will not work in practice on any production compiler? Does this technically violate the C++ language spec?

    Read the article

  • Is there a way to efficiently yield every file in a directory containing millions of files?

    - by Josh Smeaton
    I'm aware of os.listdir, but as far as I can gather, that gets all the filenames in a directory into memory, and then returns the list. What I want, is a way to yield a filename, work on it, and then yield the next one, without reading them all into memory. Is there any way to do this? I worry about the case where filenames change, new files are added, and files are deleted using such a method. Some iterators prevent you from modifying the collection during iteration, essentially by taking a snapshot of the state of the collection at the beginning, and comparing that state on each move operation. If there is an iterator capable of yielding filenames from a path, does it raise an error if there are filesystem changes (add, remove, rename files within the iterated directory) which modify the collection? There could potentially be a few cases that could cause the iterator to fail, and it all depends on how the iterator maintains state. Using S.Lotts example: filea.txt fileb.txt filec.txt Iterator yields filea.txt. During processing, filea.txt is renamed to filey.txt and fileb.txt is renamed to filez.txt. When the iterator attempts to get the next file, if it were to use the filename filea.txt to find it's current position in order to find the next file and filea.txt is not there, what would happen? It may not be able to recover it's position in the collection. Similarly, if the iterator were to fetch fileb.txt when yielding filea.txt, it could look up the position of fileb.txt, fail, and produce an error. If the iterator instead was able to somehow maintain an index dir.get_file(0), then maintaining positional state would not be affected, but some files could be missed, as their indexes could be moved to an index 'behind' the iterator. This is all theoretical of course, since there appears to be no built-in (python) way of iterating over the files in a directory. There are some great answers below, however, that solve the problem by using queues and notifications. Edit: The OS of concern is Redhat. My use case is this: Process A is continuously writing files to a storage location. Process B (the one I'm writing), will be iterating over these files, doing some processing based on the filename, and moving the files to another location. Edit: Definition of valid: Adjective 1. Well grounded or justifiable, pertinent. (Sorry S.Lott, I couldn't resist). I've edited the paragraph in question above.

    Read the article

  • CSS issue with multi-accordion

    - by Josh
    Alright, I got some help earlier with this, but it never truly got resolved. I'm pretty sure I'm having a CSS issue, but I just can't figure out how to correct it. Currently, I have these accordions working perfectly, they collapse, expand, expand again when told to etc. The problem I'm having is aligning the content within these accordion divs. Ideally, when everything is default (collapsed) all I want seen is the thumbnail image and the Headline. Then if the user wishes, they click on the headline and it expands and if they want to make a comment or view comments, they can click once again to expand that. Here's the thing, I have to make the height 62px so everything will fit in and just not float all over the place. This creates a problem with the "View Comments" to "Text Here" area, as you can tell it has outrageous space between the two. The other issue is, as I currently have it I'm forcefully indenting the article text so that it doesn't TEXT WRAP underneath the thumbnail image. Basically, I want it split into 2 columns so nothing ever goes beneath the image, but working with this accordion and divs inside the divs it's proving to be difficult for me. I've put up a demo here: http://www.notedls.com/demo

    Read the article

  • how can I have a teammate restart heroku server from his machine

    - by josh
    I have a rails app up on heroku. Sometimes the server bombs out and I have to go to the console and execute heroku restart so that servers get restarted. This seems to fix the problem. However, I am not on my machine all the time. I would like to have a team member have this capability as well. For this to happen...what does he need to do? Does he need to first have access to the github repository so that he can push and pull code to the repository and then install heroku on his machine? Can this be done without git hub? can he just install heroku?

    Read the article

  • Is there a way to ignore Cache errors in Django?

    - by Josh Smeaton
    I've just set our development Django site to use redis for a cache backend and it was all working fine. I brought down redis to see what would happen, and sure enough Django 404's due to cache backend behaviour. Either the Connection was refused, or various other errors. Is there any way to instruct Django to ignore Cache errors, and continue processing the normal way? It seems weird that caching is a performance optimization, but can bring down an entire site if it fails. I tried to write a wrapper around the backend like so: class CacheClass(redis_backend.CacheClass): """ Wraps the desired Cache, and falls back to global_settings default on init failure """ def __init__(self, server, params): try: super(CacheClass, self).__init__(server, params) except Exception: from django.core import cache as _ _.cache = _.get_cache('locmem://') But that won't work, since I'm trying to set the cache type in the call that sets the cache type. It's all a very big mess. So, is there any easy way to swallow cache errors? Or to set the default cache backend on failure?

    Read the article

  • Hashing Function for Map C++

    - by Josh
    I am trying to determine a hash function which takes an input (i, k) and determines a unique solution. The possible inputs for (i, k) range from 0 to 100. Consider each (i, k) as a position of a node in a trinomial tree. Ex: (0, 0) can diverge to (1, 1) (1, 0) (1, -1). (1, 1) can diverge to (2, 2) (2, 1) (2, 0). Sample given here: http://www.google.com/imgres?imgurl=http://sfb649.wiwi.hu-berlin.de/fedc_homepage/xplore/tutorials/stfhtmlimg1156.gif&imgrefurl=http://sfb649.wiwi.hu-berlin.de/fedc_homepage/xplore/tutorials/stfhtmlnode41.html&h=413&w=416&sz=4&tbnid=OegDZu-yeVitZM:&tbnh=90&tbnw=91&zoom=1&usg=__9uQWDNYNLV14YioWWbrqPgfa3DQ=&docid=2hhitNyRWjI_DM&hl=en&sa=X&ei=xAfFUIbyG8nzyAHv2YDICg&ved=0CDsQ9QEwAQ I am using a map map <double, double> hash_table I need a key value to be determined from pairs (i, k) to hash to to value for that (i, k) So far I was only able to come up with linear functions such as: double Hash_function(int i, int k) { //double val = pow(i, k) + i; //return (val % 4294967296); return (i*3.1415 + k*i*9.12341); } However, I cannot determine a unique key with a certain (i, k). What kind of functions can I use to help me do so?

    Read the article

  • Sequence Point and Evaluation Order( Preincrement)

    - by Josh
    There was a debate today among some of my colleagues and I wanted to clarify it. It is about the evaluation order and the sequence point in an expression. It is clearly stated in the standard that C/C++ does not have a left-to-right evaluation in an expression unlike languages like Java which is guaranteed to have a sequencial left-to-right order. So, in the below expression, the evaluation of the leftmost operand(B) in the binary operation is sequenced before the evaluation of the rightmost operand(C): A = B B_OP C The following expression according, to CPPReference under the subsection Sequenced-before rules(Undefined Behaviour) and Bjarne's TCPPL 3rd ed, is an UB x = x++ + 1; It could be interpreted as the compilers like BUT the expression below is said to be clearly a well defined behaviour in C++11 x = ++x + 1; So, if the above expression is well defined, what is the "fate" of this? array[x] = ++x; It seems the evaluation of a post-increment and post-decrement is not defined but the pre-increment and the pre-decrement is defined. NOTE: This is not used in a real-life code. Clang 3.4 and GCC 4.8 clearly warns about both the pre- and post-increment sequence point.

    Read the article

  • Data Annotations validation Built into model

    - by Josh
    I want to build an object model that automatically wires in validation when I attempt to save an object. I am using DataAnnotations for my validation, and it all works well, but I think my inheritance is whacked. I am looking here for some guidance on a better way to wire in my validation. So, to build in validation I have this interface public interface IValidatable { bool IsValid { get; } ValidationResponse ValidationResults { get; } void Validate(); } Then, I have a base class that all my objects inherit from. I did a class because I wanted to wire in the validation calls automatically. The issue is that the validation has to know the type of the class is it validating. So I use Generics like so. public class CoreObjectBase<T> : IValidatable where T : CoreObjectBase<T> { #region IValidatable Members public virtual bool IsValid { get { // First, check rules that always apply to this type var result = new Validator<T>().Validate((T)this); // return false if any violations occurred return !result.HasViolations; } } public virtual ValidationResponse ValidationResults { get { var result = new Validator<T>().Validate((T)this); return result; } } public virtual void Validate() { // First, check rules that always apply to this type var result = new Validator<T>().Validate((T)this); // throw error if any violations were detected if (result.HasViolations) throw new RulesException(result.Errors); } #endregion } So, I have this circular inheritance statement. My classes look like this then: public class MyClass : CoreObjectBase<MyClass> { } But the problem occurs when I have a more complicated model. Because I can only inherit from one class, when I have a situation where inheritance makes sense I believe the child classes won't have validation on their properties. public class Parent : CoreObjectBase<Parent> { //properties validated } public class Child : Parent { //properties not validated? } I haven't really tested the validation in these cases yet, but I am pretty sure that anything in child with a data annotation on it will not be automatically validated when I call Child.Validate(); due to the way the inheritance is configured. Is there a better way to do this?

    Read the article

  • ASP.NET button click event still firing even through custom server-side validation fails

    - by Josh
    I am having a problem where my button click event is still firing even though my custom server-side validation is set to args.IsValid = false. I am debugging through the code and the validation is definitely being fired before the button click, and args.IsValid is definitely being set to false once the custom validation takes place, but it always makes its way to the button click event afterwards. Any ideas on why this is?

    Read the article

  • WCF Service returning 400 error: The body of the message cannot be read because it is empty

    - by Josh
    I have a WCF service that is causing a bit of a headache. I have tracing enabled, I have an object with a data contract being built and passed in, but I am seeing this error in the log: <TraceData> <DataItem> <TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Error"> <TraceIdentifier>http://msdn.microsoft.com/en-US/library/System.ServiceModel.Diagnostics.ThrowingException.aspx</TraceIdentifier> <Description>Throwing an exception.</Description> <AppDomain>efb0d0d7-1-129315381593520544</AppDomain> <Exception> <ExceptionType>System.ServiceModel.ProtocolException, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType> <Message>There is a problem with the XML that was received from the network. See inner exception for more details.</Message> <StackTrace> at System.ServiceModel.Channels.HttpRequestContext.CreateMessage() at System.ServiceModel.Channels.HttpChannelListener.HttpContextReceived(HttpRequestContext context, Action callback) at System.ServiceModel.Activation.HostedHttpTransportManager.HttpContextReceived(HostedHttpRequestAsyncResult result) at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.HandleRequest() at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.BeginRequest() at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.OnBeginRequest(Object state) at System.Runtime.IOThreadScheduler.ScheduledOverlapped.IOCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped) at System.Runtime.Fx.IOCompletionThunk.UnhandledExceptionFrame(UInt32 error, UInt32 bytesRead, NativeOverlapped* nativeOverlapped) at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP) </StackTrace> <ExceptionString> System.ServiceModel.ProtocolException: There is a problem with the XML that was received from the network. See inner exception for more details. ---&amp;gt; System.Xml.XmlException: The body of the message cannot be read because it is empty. --- End of inner exception stack trace --- </ExceptionString> <InnerException> <ExceptionType>System.Xml.XmlException, System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType> <Message>The body of the message cannot be read because it is empty.</Message> <StackTrace> at System.ServiceModel.Channels.HttpRequestContext.CreateMessage() at System.ServiceModel.Channels.HttpChannelListener.HttpContextReceived(HttpRequestContext context, Action callback) at System.ServiceModel.Activation.HostedHttpTransportManager.HttpContextReceived(HostedHttpRequestAsyncResult result) at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.HandleRequest() at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.BeginRequest() at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.OnBeginRequest(Object state) at System.Runtime.IOThreadScheduler.ScheduledOverlapped.IOCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped) at System.Runtime.Fx.IOCompletionThunk.UnhandledExceptionFrame(UInt32 error, UInt32 bytesRead, NativeOverlapped* nativeOverlapped) at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP) </StackTrace> <ExceptionString>System.Xml.XmlException: The body of the message cannot be read because it is empty.</ExceptionString> </InnerException> </Exception> </TraceRecord> </DataItem> </TraceData> So, here is my service interface: [ServiceContract] public interface IRDCService { [OperationContract] Response<Customer> GetCustomer(CustomerRequest request); [OperationContract] Response<Customer> GetSiteCustomers(CustomerRequest request); } And here is my service instance public class RDCService : IRDCService { ICustomerService customerService; public RDCService() { //We have to locate the instance from structuremap manually because web services *REQUIRE* a default constructor customerService = ServiceLocator.Locate<ICustomerService>(); } public Response<Customer> GetCustomer(CustomerRequest request) { return customerService.GetCustomer(request); } public Response<Customer> GetSiteCustomers(CustomerRequest request) { return customerService.GetSiteCustomers(request); } } The configuration for the web service (server side) looks like this: <system.serviceModel> <diagnostics> <messageLogging logMalformedMessages="true" logMessagesAtServiceLevel="true" logMessagesAtTransportLevel="true" /> </diagnostics> <services> <service behaviorConfiguration="MySite.Web.Services.RDCServiceBehavior" name="MySite.Web.Services.RDCService"> <endpoint address="http://localhost:27433" binding="wsHttpBinding" contract="MySite.Common.Services.Web.IRDCService"> <identity> <dns value="localhost:27433" /> </identity> </endpoint> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> </service> </services> <behaviors> <serviceBehaviors> <behavior name="MySite.Web.Services.RDCServiceBehavior"> <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --> <serviceMetadata httpGetEnabled="true"/> <!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information --> <serviceDebug includeExceptionDetailInFaults="true"/> <dataContractSerializer maxItemsInObjectGraph="6553600" /> </behavior> </serviceBehaviors> </behaviors> </system.serviceModel> Here is what my request object looks like [DataContract] public class CustomerRequest : RequestBase { [DataMember] public int Id { get; set; } [DataMember] public int SiteId { get; set; } } And the RequestBase: [DataContract] public abstract class RequestBase : IRequest { #region IRequest Members [DataMember] public int PageSize { get; set; } [DataMember] public int PageIndex { get; set; } #endregion } And my IRequest interface public interface IRequest { int PageSize { get; set; } int PageIndex { get; set; } } And I have a wrapper class around my service calls. Here is the class. public class MyService : IMyService { IRDCService service; public MyService() { //service = new MySite.RDCService.RDCServiceClient(); EndpointAddress address = new EndpointAddress(APISettings.Default.ServiceUrl); BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.None); binding.TransferMode = TransferMode.Streamed; binding.MaxBufferSize = 65536; binding.MaxReceivedMessageSize = 4194304; ChannelFactory<IRDCService> factory = new ChannelFactory<IRDCService>(binding, address); service = factory.CreateChannel(); } public Response<Customer> GetCustomer(CustomerRequest request) { return service.GetCustomer(request); } public Response<Customer> GetSiteCustomers(CustomerRequest request) { return service.GetSiteCustomers(request); } } and finally, the response object. [DataContract] public class Response<T> { [DataMember] public IEnumerable<T> Results { get; set; } [DataMember] public int TotalResults { get; set; } [DataMember] public int PageIndex { get; set; } [DataMember] public int PageSize { get; set; } [DataMember] public RulesException Exception { get; set; } } So, when I build my CustomerRequest object and pass it in, for some reason it's hitting the server as an empty request. Any ideas why? I've tried upping the object graph and the message size. When I debug it stops in the wrapper class with the 400 error. I'm not sure if there is a serialization error, but considering the object contract is 4 integer properties I can't imagine it causing an issue.

    Read the article

  • Do validations still fire in ASP.NET even if the controls are hidden?

    - by Josh
    I have a form that uses ASP.NET validations. I am using some inline C# in the aspx to show/hide certain controls depending on a user's role. I would use the Visible property, but there are so many of them, I just decided to do inline C# to show and hide (I know, not best practice, but bear with me for a second). I am having an issue where Page.IsValid is always set to False when I submit my form (when certain fields are being hidden). Will the validations still fire off even if the controls are not even rendered on the pag? Also, if this is not the case, is there an effective way of breaking down Page.IsValid to find out what is setting it to False? Thanks.

    Read the article

  • How to return a copy of the data in C++

    - by Josh Curren
    I am trying to return a new copy of the data in a C++ Template class. The following code is getting this error: invalid conversion from ‘int*’ to ‘int’. If I remove the new T then I am not returning a copy of the data but a pointer to it. template<class T> T OrderedList<T>::get( int k ) { Node<T>* n = list; for( int i = 0; i < k; i++ ) { n=n->get_link(); } return new T( n->get_data() ); // This line is getting the error ********** }

    Read the article

  • PHP/Javascript: Restart Form Button Isn't Working, Code Insde

    - by Josh K
    Basically I want a confirmation box to pop up when they click the button asking if they sure they want to restart, if yes, then it destroys session and takes them to the first page. Heres what i got... echo "<form id=\"form\" name=\"form\" method=\"post\" action=\"nextpage.php\">\n"; echo " <input type=\"button\" name='restart' value='Restart' id='restart' onclick='restartForm()' />"; and for the script... <script type=\"text/javascript\"> <!-- function restartForm() { var answer = confirm('Are you sure you want to start over?'); if (answer) { form.action=\"firstpage.php\"; session_destroy(); form.submit(); } else alert ('Restart Cancelled'); } // -- </script>"; EDIT: Note that pressing the button brings up the confirm box, but if you click okay nothing happens sometimes. Sometimes if u click cancel it still submits the form (To the original action)

    Read the article

  • SQL query to remove text within parentheses?

    - by Josh Fraser
    What is the best SQL query to remove any text within parenthesis in a mySQL database? I'd like something that works regardless of the position of the parenthesis in the text (beginning, middle, end, whatever). I don't care about keeping the text inside the parenthesis, just removing it. Thanks!

    Read the article

  • how to convert legacy query to ActiveRecord Rails way

    - by josh
    I have a query in my code as below @sqladdpayment = "INSERT INTO payments (orderid, ttlprodcost, paytype, paystatus,created_at,updated_at,userid,storeid) VALUES ('" + session[:ordersid] + "', '" + session[:totalcost] + "', '" + "1"+ "', '" + "complete" +"',current_date, current_date, '"+"1"+"','"+ "1"+"')" Here the table payments and primary key is orderid. Now, I know if I convert this to the ActiveRecord way then I will not have to put update_date, current_date because it will put that on it's own. It will also put orderid on it's own also (auto_increment). I am looking for a way to convert the above query to ActiveRecord Rails way but still be able to put orderid on my own (session[:ordersid]). I do not want to rely on auto_increment because then I will have to refactor lot of the other code. This might be a quick and dirty fix but I want to know whether this type of flexibility is offered in rails? I have wondered about this question many times. Why won't rails allow me to have that flexibility?

    Read the article

  • Problem with displaying my Image..

    - by Josh
    Here is my full problem so if anyone has any ideas or can offer some help, please let me know. I have a Website that will generate a Report and this Report takes some time to create. There is a MyReport.ASPX file that has a form1, Image1, and a ReportViewer control. There is also a MyReport.cs file that has C# code to generated a HTMLText string that the ReportViewer control will display. When I pull the Website up in the browser, the MyReport.cs file creates the Report before MyReport.ASPX ever gets called so my Image1 (which I need to display while the Report is being created) never gets displayed until AFTER the Report is created and displayed. What do you suggest I do here? If I did not supply enough information, please let me know what else you need to know and I will gladly post it. Thanks,

    Read the article

  • Passing a pointer to an array to glGenBuffers

    - by Josh Elsasser
    I'm currently passing an array to a function, then attempting to use glGenBuffers with the array that is passed to the function. I can't figure out a way to get glGenBuffers to work with the array that I've passed. I have a decent grasp of the basics of pointers, but this is beyond me. This is basically how the render code works. It's a bit more complex, (colours using the same array idea, also not working) but the basic idea is as follows: void drawFoo(const GLfloat *renderArray, GLuint verticeBuffer) { glBindBuffer(GL_ARRAY_BUFFER, verticeBuffer); glBufferData(GL_ARRAY_BUFFER, sizeof(verticeBuffer)*sizeof(GLfloat), verticeBuffer, GL_STATIC_DRAW); glVertexPointer(2, GL_FLOAT, 0, 0); glEnableClientState(GL_VERTEX_BUFFER); glDrawArrays(GL_TRIANGLE_FAN, 0, 45); glDisableClientState(GL_VERTEX_BUFFEr); } Thanks in advance for the help

    Read the article

  • How can I improve this SQL to avoid several problems with its results?

    - by Josh Curren
    I am having some problems with trying to search. Currently this will only return results that have at least 1 row in the maintenance_parts table. I would like it to return results even if there are 0 parts rows. My second problem is that when you search for a vehicle and it should return multiple results (multiple maintenance rows) it will only return 1 result for that vehicle. Some Background Info: The user has 2 fields to fill out. The fields are vehicle and keywords. The vehicle field is meant to allow searching based on the make, model, VIN, truck number (often is 2 - 3 digits or a letter prefix followed by 2 digits), and a few other fields that belong to the truck table. The keywords are meant to search most fields in the maintenance and maintenance_parts tables (things like the description of the work, parts name, parts number). The maintenance_parts table can contain 0, 1, or more rows for each maintenance row. The truck table contains exactly 1 row for every maintenance row. A truck can have multiple maintenance records. "SELECT M.maintenance_id, M.some_id, M.type_code, M.service_date, M.mileage, M.mg_id, M.mg_type, M.comments, M.work_done, MATCH( M.comments, M.work_done) AGAINST( '$keywords' ) + MATCH( P.part_num, P.part_desc, P.part_ref) AGAINST( '$keywords' ) + MATCH( T.truck_number, T.make, T.model, T.engine, T.vin_number, T.transmission_number, T.comments) AGAINST( '$vehicle' ) AS score FROM maintenance M, maintenance_parts P, truck T WHERE M.maintenance_id = P.maintenance_id AND M.some_id = T.truck_id AND M.type_code = 'truck' AND ( (MATCH( T.truck_number, T.make, T.model, T.engine, T.vin_number, T.transmission_number, T.comments) AGAINST( '$vehicle' ) OR T.truck_number LIKE '%$vehicle%') OR MATCH( P.part_num, P.part_desc, P.part_ref) AGAINST( '$keywords' ) OR MATCH( M.comments, M.work_done) AGAINST( '$keywords' ) ) AND M.status = 'A' GROUP BY maintenance_id ORDER BY score DESC, maintenance_id DESC LIMIT 0, $limit"

    Read the article

  • Python: Behavior of object in set operations

    - by Josh Arenberg
    I'm trying to create a custom object that behaves properly in set operations. I've generally got it working, but I want to make sure I fully understand the implications. In particular, I'm interested in the behavior when there is additional data in the object that is not included in the equal / hash methods. It seems that in the 'intersection' operation, it returns the set of objects that are being compared to, where the 'union' operations returns the set of objects that are being compared. To illustrate: class MyObject: def __init__(self,value,meta): self.value = value self.meta = meta def __eq__(self,other): if self.value == other.value: return True else: return False def __hash__(self): return hash(self.value) a = MyObject('1','left') b = MyObject('1','right') c = MyObject('2','left') d = MyObject('2','right') e = MyObject('3','left') print a == b # True print a == c # False for i in set([a,c,e]).intersection(set([b,d])): print "%s %s" % (i.value,i.meta) #returns: #1 right #2 right for i in set([a,c,e]).union(set([b,d])): print "%s %s" % (i.value,i.meta) #returns: #1 left #3 left #2 left Is this behavior documented somewhere and deterministic? If so, what is the governing principle?

    Read the article

  • Content cacheing with PHP and CodeIgniter

    - by Josh K
    I have a couple of things I'm working on, namely a page that issues five or six cURL requests and processing content on them. I'm working with CodeIgniter on a LAMP stack but am open to other options. Naturally I would prefer to not rewrite the application. I would like to know if there are any ready-made / easily learned caching methods. Primarily I'd like to check if the page has changed since I last scrapped it. If it has, redownload and present. If it hasn't, serve up a cached copy.

    Read the article

< Previous Page | 28 29 30 31 32 33 34 35 36 37 38 39  | Next Page >