CFARGUMENT help!

I'd like to use the existing function within a component.
Since that function is exactly what I need it would be great if I
don't have to rewrite the same query again and again.
The problem is, that existing CFFUNCTION accept 3 arguments,
while my calling page only passing 2 parameters. See the code
below:
This is the existing cffunction that I need to use:
<CFFUNCTION Name="getCOF" >
<cfargument name="Type" required="true">
<cfargument name="Client" required="true">
<cfargument name="FiscalYear" required="true">
<cfquery name="getInfo"
datasource="#Application.datasource#">
select id ,ins,year,seq,type,name,title
from cfname
where type = <cfqueryparam cfsqltype="CF_SQL_CHAR"
value="#Type#" />
and ins = <cfqueryparam cfsqltype="CF_SQL_CHAR"
value="#Client#" />
and year=<cfqueryparam cfsqltype="CF_SQL_CHAR"
value="#FiscalYear#" />
</cfquery>
<cfreturn getInfo>
</CFFUNCTION>
This is how I call this function within a component:
<cfinvoke component="com.COF" method="getCOF"
Type="U" Client="#u.group#" returnvariable="q_FNInfo">
So, I'm not passing Fiscal Year to the function that is
ecpecting argument for FiscalYear.
This function is used by other page where the calling page
passing Type, Client and FiscalYear
If I do not pass FiscalYear to this Function I will get error
saying the function has an argument called FiscalYear
that is set as required but not passed.
How can I still use the same function when I only passing 2
parameters instead of three, can it be done?
I'm on CF8,Sybase and Unix
Please help, thanks.

How can I still use the same function when I only passing 2
parameters instead of three, can it be done?
No. The attribute "required" means you must supply an
argument. It is quite clear why you have to. The function requires
all 3 arguments. The query uses them as filters. So, my question
is, why would you want to pass only 2 arguments?

Similar Messages

  • Help needed for dynamic update form

    I could really use some advice - I've been asked to build a time tracking application (basically a timesheet) and I have a fair bit done but the part I am really struggling with is the best way to accommodate some of the specifications. I am NOT a programmer (I have some coldfusion experience but nothing really advanced) so I have not managed to sucessfully integrate the various methods I've found on the web so far. The database is created and so are all the queries, and I have also written a cfc to handle the drop-down menu logic needed but I don't really know how to integrate it with the form.
    Our production server has ColdFusion MX7 so all the great functionality in the CF8 examples I can't use.
    The issue is the user should ideally be able to add/edit/delete multiple rows at once- I like CFGRID, and the HTML version seems best. The main issue with the Flash version is the scrolling to get to the insert/delete buttons- I couldn't see how to get rid of that. A separate add and edit form could be ok depending on how easy it is to use.
    One problem I have is that I can't work out how to have default values with the grid (the userID which is a session variable, and the date which is constantly changing- there is a cfcalendar for the user to change date).
    The biggest hurdle is the related select drop-downs I need- it's not quite as simple as the city,state,postcode examples. For the first drop down the pick an option- and for only 2 of those options there is a second drop-down. Anything else and it stops there. For the second drop-down, there are 2 options, and depending on which one of these they pick the 3rd drop-down pulls a query from one or another table in the database (2 entirely different things). The three  options have different database tables. The main timesheet table just stores the id number from those tables (so I also need to display the names on the drop-down from the options tables not the number).
    I played with simple and complicated javascript and coldfusion solutions as well, but because it's a form to update records and also because of the above specs I just couldn't get anything to work right. I tried binding with the cfc and nothing would bind, plus I don't know how to make all happen without a page reload.
    Does anyone have any advice for the best approach to this? As I mentioned I've got tables, queries and even a cfc but I'm not too clear on how to put it all together properly within the constraints of MX7.
    PS I also can't post a lot of code because of where I work- I know that's not helpful but am looking for the best approach to this, then I can work on the details. Right now I am jumping from solution to solution and not getting anywhere.

    Well, a lot of code has come and gone because I couldn't make it work, where I'm currently at is:
    <cfform name="updateform" id="updateform" action="#CurrentPage#?#CGI.QUERY_STRING#">
      <cfgrid name="MainData" height="400" insertbutton="add" deletebutton="remove" query="getMainData" insert="yes" delete="yes" rowheight="20"  selectmode="edit" format="html">
      <cfgridcolumn name="id" display="no">
    <cfgridcolumn name="userID" display="no">
    <cfgridcolumn name="entrydate" display="no">
    <cfgridcolumn name="activityID" >
    <cfgridcolumn name="typeID">
    <cfgridcolumn name="projectID" values="#ValueList(getProjects.id)#" valuesdisplay="#ValueList(getProjects.name)#">
    <cfgridcolumn name="time" width="10">
    <cfgridcolumn name="comment" width="150">
    </cfgrid>
    <cfinput type="hidden" name="entrydate" value="#Session.username#">
    <cfinput type="hidden" name="entrydate" value="#editdate#">
    <cfinput name="update" type="Submit" value="Update">
    </cfform>
    ** for some reason getProjects.name doesn't work and causes an error. I haven't worked out how to get the default inputs for the date and user ID to work either. I also tried binding and a flash form somewhere along the way.
    ** the CFC is below, #ds# didn't work and I had to put in the actual DSN name, not sure why, but anyway this is the logic of the thing. Ideally I would like to use this logic with the cfgrid, but I'm not sure if that is possible? It seems like it would be the most user friendly approach.
    The CFC so far is:
    <cfcomponent>
       <cffunction name="getActivities" access="remote" returnType="query">
            <cfquery name="getActivities" datasource="#ds#">
    SELECT * FROM timesheet_activities
    </cfquery>
            <cfreturn getActivities>
        </cffunction>
        <cffunction name="getTypes" access="remote" returnType="query">
        <cfargument name="Activity" type="any" required="true">
        <cfif ARGUMENTS.Activity EQ "">
            <cfset getType = "">
        <cfelse>
            <cfquery name="getTypes" datasource="#ds#">
            SELECT * FROM timesheet_type
            </cfquery>
        </cfif>
        <cfreturn getTypes>
        </cffunction>
        <cffunction name="GetProjects" access="remote" returnType="query">
        <cfargument name="Activity" type="any" required="true">
        <cfargument name="Type" type="any" required="true">
        <cfif ARGUMENTS.Activity EQ "" OR ARGUMENTS.Type EQ "">
            <cfset LstProjects = "">
        <cfelseif ARGUMENTS.Activity EQ "1" OR "3">
        <cfquery name="getProjects" datasource="#ds#">
    SELECT id,name FROM projectsa
    WHERE completed = 'false'
    </cfquery>
    <cfelse>
    <cfquery name="getEProjects" datasource="#dse#">
    SELECT id,name FROM projectsb
    WHERE statusID = '6'
    </cfquery>
        </cfif>
        <cfreturn getProjects>
        </cffunction>
    </cfcomponent>
    Any attempts to actually use the cfc didn't work. I tried to use it with a normal html update form and got the message- failed to bind, Activity didn't exist. I also tried to bind it to a flash grid. The argument for Activity needs to come from the drop-down Activity type selected. Maybe I'm missing something.
    ETA:
    just moved everything to the live MX7 server (because my dev server is Coldfusion8) and I get the following:
    Attribute validation error for tag CFGRID. The tag does not allow the attribute(s) BINDONLOAD,BIND.
    Does this mean I definitely can't use the CFC with the cfgrid on MX7? Or is there a way to do it?
    Any advice would be greatly appreciated.

  • Need help in this jquery ajax response

    Hi Below is the code i got from internet trying to test but alwys getting false alert event the record does not xist in DB.
    Below is the code
    <script language="javascript" src="jquery-1.4.2.js"></script>
        <script type="text/javascript">
                $(document).ready(function() {    
                $('#username').blur(function() {    
                            $.ajax({            
                                    type: "POST",
                                    url: "checkUser.cfc?method=checkUsername",
                                    data: "username=" + this.value,
                                    datatype: "json",
                                    success: function(response) {                                   
                                    alert(response);                                                       
                                    if (response == true) {
                                    alert("true");   
                                    //$('#usernameResponse').css('display', 'none');
                                    //$('#submit').attr('disabled','disabled');
                                    } else {
                                    alert("flase");
                                    //$('#usernameResponse').css('display', 'inline');
                                    //$('#username').select();
                                    //$('#submit').attr('disabled','disabled');
        </script>    
    <form>     <div class="formcontainer">
                      <label>User Name:</label>
                      <input type="text" name="username" id="username" />
                      <span id="usernameResponse">Sorry, that username is taken</span>
                      </div>
                      <div class="formcontainer">
                          <label>Password:</label>
                          <input type="password" name="password" id="password" />
                       </div>     
                 <div class="formcontainer">
                <input type="submit" id="submit" value="Submit" />
                    </div>
                     </form>
    CFC File:
    <cfcomponent output="false">     
        <cffunction name="getAllUsernames" access="private" returntype="query" output="false">
                     <cfset var qGetAllUsernames = queryNew('userID,username') /> 
                     <cfset queryAddRow(qGetAllUsernames, 4) /> 
                     <cfset querySetCell(qGetAllUsernames, 'userID', 1, 1) />
                     <cfset querySetCell(qGetAllUsernames, 'userName', 'John', 1) />
                     <cfset querySetCell(qGetAllUsernames, 'userID', 2, 2) />
                     <cfset querySetCell(qGetAllUsernames, 'userName', 'Paul', 2) />
                     <cfset querySetCell(qGetAllUsernames, 'userID', 3, 3) />
                     <cfset querySetCell(qGetAllUsernames, 'userName', 'George', 3) />    
                     <cfset querySetCell(qGetAllUsernames, 'userID', 4, 4) />
                     <cfset querySetCell(qGetAllUsernames, 'userName', 'Ringo', 4) />
                     <cfreturn qGetAllUsernames />
        </cffunction> 
        <cffunction name="checkUsername" access="remote" output="false" returntype="string" returnformat="JSON">
            <cfargument name="username" type="string" default="" />
            <cfset var qAllUsernames = getAllUsernames() /> 
            <cfquery name="qCheckUsername" dbtype="query">
            SELECT * FROM qAllUserNames WHERE upper(username) = <cfqueryparam value="#ucase(arguments.username)#" cfsqltype="cf_sql_varchar" />
            </cfquery>
            <cfif qCheckUsername.recordcount>
            <cfreturn true>
            <cfelse>
            <cfreturn true>       
            </cfif>       
        </cffunction>   
    </cfcomponent>
    when i run cfc alone returns result like true or false but when i try to alert that response alert box of window size with all spaces and rsult comes so not able to tet if(reponse == true does not working.
    any help will be great thanks
    this is alert box poped with response
    true
    </td></td></td></th></th></th></tr></tr></tr></table></table></table></a></abbrev></acrony m></address></applet></au></b></banner></big></blink></blockquote></bq></caption></center> </cite></code></comment></del></dfn></dir></div></div></dl></em></fig></fn></font></form>< /frame></frameset></h1></h2></h3></h4></h5></h6></head></i></ins></kbd></listing></map></m arquee></menu></multicol></nobr></noframes></noscript></note></ol></p></param></person></p laintext></pre></q></s></samp></script></select></small></strike></strong></sub></sup></ta ble></td></textarea></th></title></tr></tt></u></ul></var></wbr></xmp>

    cfnew wrote:
        <cffunction name="checkUsername" access="remote" output="false" returntype="string" returnformat="JSON">
            <cfif qCheckUsername.recordcount>
            <cfreturn true>
            <cfelse>
            <cfreturn true>       
            </cfif>       
    3 things. Do you mean perhaps:
    1) name="IsUsernameValid"
    2) returntype="boolean"
    3) <cfif qCheckUsername.recordcount>
    <cfreturn true>
    <cfelse>
    <cfreturn false>       
    </cfif>

  • Please help!!! This expression must have a constant value

    I try to work with cfc and cfinvoke and not sure why I got this error. Searched
    in google for answer but still don't get any. Can anyone help please...not sure where
    I had it wrong...I thought my codes should work (?)
    When a form is submitted I have this codes in formaction.cfm, I captured all the form fields in a structure:
    <CFSET st_Registration = {Salutation="#Trim(Form.Salutation)#", FName = "#Trim(Form.FName)#", MName = "#Trim(Form.Mname)#",LName =  "#Trim(Form.LName)#" .......etc }/>
    Then I set all the required fields:
     <CFSET ReqFields ="Salutation,FName,LName,Addr1,City,State,Zip,Country,Phone,Email,username,password">
    <!--- Then send the structure and req. fiels list to a function located in a component to verify required fields ---><cfset CreateUserInfo = createObject("component", "airbucks.cfcomp.VerifyInput").init()> 
    <CFINVOKE component="#CreateUserInfo#" method="Verify_ReqFields" st_Registration = "#st_Registration#" RequiredFields ="#ReqFields#" returnvariable="VerifyResult">
    <CFIF #VerifyResult# IS "">
    <cfdump var="#st_Registration#">
    <CFELSE>
      <CFIF #st_Registration["Country"]# IS "USA">
    <CFINCLUDE template="registration_ret.cfm">
      <CFELSE>
    <CFINCLUDE template="registration_other_ret.cfm">
      </CFIF>
    </CFIF>
    <!--- Below is part of the component with the function for checking required fields --->
    <cfcomponent displayname="VerifyInputData" output="false"> <CFFUNCTION name="Init" access="public" returntype="any" output="false" hint="Returns an initialized component instance.">
     <!--- Return This reference. --->
     <cfreturn THIS />
     </CFFUNCTION>
     <!--- Verify required fields --->
     <CFFUNCTION name="Verify_ReqFields">
     <cfargument name="st_Registration" type="struct" required="true">
     <cfargument name="RequiredFields" type="string" required="true"> 
    <!--- check if req. fields are blank --->
     <CFSET ErrorList = "">
     <cfloop collection="#arguments.st_Registration#" item="KEY">
     <CFIF #Trim(st_Registration[KEY])# IS "">
     <CFSWITCH expression="#Trim(KEY)#">
     <CFCASE value="#arguments.RequiredFields#">
     <CFSET ErrorList = ListAppend(ErrorList, "#KEY#")>
     </CFCASE>
     </CFSWITCH>
     </CFIF>  
    </cfloop>
     <CFRETURN ErrorList >
     </CFFUNCTION>
      </cfcomponent>
        Here is the error:  
    The following information is meant for the website developer for debugging purposes.
    Error Occurred While Processing Request
    This expression must have a constant value.
    The error occurred in C:\Inetpub\wwwroot\AirBucks\registrationaction.cfm: line 55
    53 :                              
    54 : <!--- Verify required field based on the required list set above --->
    55 : <cfset CreateUserInfo = createObject("component", "airbucks.cfcomp.VerifyInput").init()>
    56 : <CFINVOKE component="#CreateUserInfo#" method="Verify_ReqFields" st_Registration = "#st_Registration#" RequiredFields ="#ReqFields#" returnvariable="VerifyResult">
    57 :      

    Thank you and I'll change my codes.
    When I did the following, I still get the same error.
    Isn't it CreateUserInfo is the object?
    <cfset CreateUserInfo = createObject("component", "airbucks.cfcomp.VerifyInput").init()>
    <CFSET VerifyResult = CreateUserInfo.Verify_ReqFields(st_Registration, ReqFields)> 
    Using cfinvoke used to work.
    The following information is meant for the website developer for debugging purposes.
    Error Occurred While Processing Request
    This expression must have a constant value.
    The error occurred in C:\Inetpub\wwwroot\AirBucks\registrationaction.cfm: line 54
    52 : <!--- Verify required field based on the required list set above --->
    53 :
    54 : <cfset CreateUserInfo = createObject("component", "airbucks.cfcomp.VerifyInput").init()>
    55 : <!---
    56 : <CFINVOKE component="#CreateUserInfo#" method="Verify_ReqFields" st_Registration

  • CF 9.01 Upgrade breaks Flex Gateway - Help!!!!

    I have an AIR app which is using DataServicesMessaging with subtopics enabled.  I can create the Consumer in AIR but when I subscribe, I get the following error:
    "Error","cfthread-0","08/31/10","21:03:35",,"CATALOG_ATTRIBUTES_831AE0FE-B7D2-90A5-87AD-CA C5E01116D9: Event handler exception."
    flex.messaging.MessageException: Event handler exception.
    at coldfusion.flex.CFEventGatewayAdapter.allowSend(CFEventGatewayAdapter.java:376)
    at flex.messaging.services.messaging.SubscriptionManager.addSubtopicSubscribers(Subscription Manager.java:330)
    at flex.messaging.services.messaging.SubscriptionManager.addSubtopicSubscribers(Subscription Manager.java:311)
    at flex.messaging.services.messaging.SubscriptionManager.getSubscriberIds(SubscriptionManage r.java:264)
    at flex.messaging.services.MessageService.pushMessageToClients(MessageService.java:495)
    at coldfusion.flex.CFEventGatewayAdapter.send(CFEventGatewayAdapter.java:250)
    at coldfusion.eventgateway.flex.FlexMessagingGateway.outgoingMessage(FlexMessagingGateway.ja va:204)
    at coldfusion.runtime.CFPage.SendGatewayMessage(CFPage.java:269)
    at cfCatalogService2ecfc315059253$func_CFFUNCCFTHREAD_CFCATALOGSERVICE2ECFC3150592531.runFun ction(C:\inetpub\wwwroot\staging9sites\staging9si\com\pmdm\suppliers\services\CatalogServi ce.cfc:110)
    at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472)
    at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:368)
    at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:55)
    at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321)
    at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:220)
    at coldfusion.runtime.UDFMethod.invokeCFThread(UDFMethod.java:201)
    at coldfusion.thread.Task.invokeFunction(Task.java:274)
    at coldfusion.thread.Task.run(Task.java:140)
    at coldfusion.scheduling.ThreadPool.run(ThreadPool.java:201)
    at coldfusion.scheduling.WorkerThread.run(WorkerThread.java:71)

    Rakshith,
    Thanks for your help!  Here's what I've got in my messaging-config.xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <service id="message-service"
        class="flex.messaging.services.MessageService"
        messageTypes="flex.messaging.messages.AsyncMessage">
        <adapters>
            <adapter-definition id="cfgateway" class="coldfusion.flex.CFEventGatewayAdapter" default="true" />
            <adapter-definition id="actionscript" class="flex.messaging.services.messaging.adapters.ActionScriptAdapter"/>
            <adapter-definition id="jms" class="flex.messaging.services.messaging.adapters.JMSAdapter"/>
        </adapters>
        <!-- ======================================== -->
        <!--  ColdFusion Messaging Gateway            -->
        <!-- ======================================== -->
        <destination id="ColdFusionGateway">
            <adapter ref="cfgateway" />
            <properties>
                <!--
                    Star ('*') means gatewayid is found in the 'gatewayid' message header.
                    To restrict this destination to a specific gateway, enter its ID here
                -->
                <gatewayid>PMSIMessages</gatewayid>
    <server>
    <durable>false</durable>
    <allow-subtopics>true</allow-subtopics>
    </server>
                <!--
                    If ColdFusion is running on a different host, enter that here.
                    Default is to expect ColdFusion and Flex to share the same web application.
    You must enter 'localhost' if CF and Flex are not in the same web app.
                <gatewayhost>10.1.1.1</gatewayhost>
                -->
                <!--
                    List the IP addresses of CF machines allowed to send messages to this destination
                    If not set, the default is to allow only this computer to connect.
                <allowedIPs>10.1.1.1,10.2.2.2</allowedIPs>
                -->
                <!--
                    Credentials to pass along in the headers as CFUsername/CFPassword.
                    It is generally better to use setRemoteCredentials() API on client.
                <remote-username></remote-username>
                <remote-password></remote-password>
                -->
                <!--
                    You can add general Flex Messaging network and server properties here.
                 -->
            </properties>
    <!-- You should use the ColdFusion specific channels -->
            <channels>
                <channel ref="cf-polling-amf"/>
            </channels>
        </destination>
        <destination id="clientNotifierGateway">
        <adapter ref="actionscript"/>
        <channels>
        <channel ref="java-amf"/>
        </channels>
         </destination>
    </service>
    Here's my gateway CFC:
    <cfcomponent output="false">
       <cffunction name="onIncomingMessage" access="remote" returntype="any">
             <cfargument name="event" type="struct" required="true"/>
    <cfscript>
          x = structNew();
          x['body'] = event.data;
          x['destination'] = "ColdFusionGateway";
          x['headers'] = structNew();
          x.headers['username'] = "System";
          x.headers['DSSubtopic'] = event.data.headers.DSSubtopic;
          x.lowercasekeys = "yes";
          </cfscript>
      <cfreturn x/>
    </cffunction>
    <cffunction name="allowSend" access="public" returntype="boolean">
    <cfargument name="subtopic" type="any" required="true"/>
    <cfreturn true/>
    </cffunction>
    <cffunction name="allowSubscribe" access="public" returntype="boolean">
    <cfargument name="subtopic" type="any" required="true"/>
    <cfreturn true/>
    </cffunction>
    </cfcomponent>
    Jeff

  • Help w Real Estate Tutorial

    I am adapting the Flash Form Real Estate tutorial and I am
    real close to getting everything working. Upon inserting a new
    listing it puts it in the MS SQL correctly but adds a blank row in
    the grid. If you refresh it shows up correctly. The only difference
    between the tutorial is that I need to get the primary key of the
    new insert. Help! I am so close but no matter what I do it comes
    back blank. ???????
    <cffunction name="fetch" output="false" hint="Returns a
    structure containing all the field of a property listing"
    access="public" returntype="struct">
    <cfargument name="dentallistingid" required="true"
    type="string" hint="Primary key"/>
    <cfset var getlistingQuery = ""/>
    <cfset var data = structnew() />
    <cfquery name="getlistingQuery"
    datasource="#variables.dsn#">
    SELECT *
    FROM dbo.Dentallisting
    where DentallistingID = select SCOPE_IDENTITY()
    </cfquery>
    <!--- create a structure with all the columns --->
    <!--- we are doing it manually because looping over the
    columns would make it all upper-case --->
    <cfset data["DentalListingID"] =
    getlistingQuery.DentalListingID />
    <cfset data["BrokerID"] = getlistingQuery.BrokerID />
    <cfset data["State"] = getlistingQuery.State />
    <cfset data["Location"] = getlistingQuery.Location />
    <cfset data["Description"] = getlistingQuery.description
    />
    <cfset data["Status"] = getlistingQuery.Status />
    <cfset data["PracticeType"] =
    getlistingQuery.PracticeType />
    <cfset data["Staff"] = getlistingQuery.Staff />
    <cfset data["Equipment"] = getlistingQuery.Equipment
    />
    <cfset data["ReasonSelling"] =
    getlistingQuery.ReasonSelling />
    <cfset data["ListingNumber"] =
    getlistingQuery.ListingNumber />
    <cfset data["Remarks"] = getlistingQuery.Remarks />
    <cfreturn data />
    </cffunction>

    I am adapting the Flash Form Real Estate tutorial and I am
    real close to getting everything working. Upon inserting a new
    listing it puts it in the MS SQL correctly but adds a blank row in
    the grid. If you refresh it shows up correctly. The only difference
    between the tutorial is that I need to get the primary key of the
    new insert. Help! I am so close but no matter what I do it comes
    back blank. ???????
    <cffunction name="fetch" output="false" hint="Returns a
    structure containing all the field of a property listing"
    access="public" returntype="struct">
    <cfargument name="dentallistingid" required="true"
    type="string" hint="Primary key"/>
    <cfset var getlistingQuery = ""/>
    <cfset var data = structnew() />
    <cfquery name="getlistingQuery"
    datasource="#variables.dsn#">
    SELECT *
    FROM dbo.Dentallisting
    where DentallistingID = select SCOPE_IDENTITY()
    </cfquery>
    <!--- create a structure with all the columns --->
    <!--- we are doing it manually because looping over the
    columns would make it all upper-case --->
    <cfset data["DentalListingID"] =
    getlistingQuery.DentalListingID />
    <cfset data["BrokerID"] = getlistingQuery.BrokerID />
    <cfset data["State"] = getlistingQuery.State />
    <cfset data["Location"] = getlistingQuery.Location />
    <cfset data["Description"] = getlistingQuery.description
    />
    <cfset data["Status"] = getlistingQuery.Status />
    <cfset data["PracticeType"] =
    getlistingQuery.PracticeType />
    <cfset data["Staff"] = getlistingQuery.Staff />
    <cfset data["Equipment"] = getlistingQuery.Equipment
    />
    <cfset data["ReasonSelling"] =
    getlistingQuery.ReasonSelling />
    <cfset data["ListingNumber"] =
    getlistingQuery.ListingNumber />
    <cfset data["Remarks"] = getlistingQuery.Remarks />
    <cfreturn data />
    </cffunction>

  • Need help... Context validation error for tag cfscript.

    Code:
        <cffunction name="computeHash" access="public" returntype="String">
          <cfargument name="password" type="string" />
          <cfargument name="salt" type="string" />
          <cfargument name="iterations" type="numeric" required="false" default="1024" />
          <cfargument name="algorithm" type="string" required="false" default="SHA512" />
          <cfscript>
            var hashed = '';
            var i = 1;
            hashed = hash( password & salt, arguments.algorithm, 'UTF-8' );
            for (i = 1; i <= iterations; i++) {
              hashed = hash( hashed & salt, arguments.algorithm, 'UTF-8' );
            return hashed;
          </cfscript>
        </cffunction>
    Error on web app:
    Context  validation error for tag cfscript.
    The start tag must have a matching  end tag. An explicit end tag can be provided by adding </cfscript>. If the  body of the tag is empty you can use the shortcut <cfscript .../>. The CFML compiler was processing:
    a cfscript tag beginning on line 11, column 12.
    a cfscript tag beginning on line 11, column 12.
    The  error occurred in xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\salty.cfc: line  11
    9 :        <cfargument name="iterations" type="numeric" required="false" default="1024" />
    10 :        <cfargument name="algorithm" type="string" required="false" default="SHA512" />
    11 :        <cfscript>
    12 :           var hashed = '';
    13 :           var i = 1;
    I am completely lost on why it's fumbling with why it says there's no closing tag.  Help!!!!
    Thanks

    What's on lines 1-7 of that file?
    That code compiles fine for me on CF8 & CF9, so that's not where the error is.
    You're not trying to compile it on any earlier version of CF than CF8 are you?  The < and ++ operators are not valid prior to CF8.  CFMX7 might see the < as a stray angle bracket, and get confused.  I don't have CFMX7 running here to test the exact error that would produce, sorry.
    Adam

  • Flex Project Help

    Ok on my flex app I have a place where they create a new
    client with session's, and each client has the ability to buy
    different add ons. I'm using a repeater to pull the add ons from
    the database then when checked, and submitted it will Insert the
    information back to the database. What I have, so far is when you
    click the submit button I get no errors, but it doesn't submit
    anything. My <cfmail looks like this.
    INSERT INTO
    glb_order_details
    (sessions,order_id,hosting_notification,product_id)
    SELECT '1',407,1, id
    FROM glb_products
    WHERE id IN(0)
    As you can see I'm trying to pull the product id from
    glb_products, but its choking on that. Here is my cfc query.
    <cffunction name="NewSessionTotal" access="remote"
    returntype="void">
    <cfargument name="sessions" default="" type="String"
    required="no">
    <cfargument name="order_id" default="" required="no">
    <cfargument name="hosting" default="" required="no">
    <cfargument name="product_idlist" default=""
    required="no">
    <cfquery name="SessionTotal" datasource="omnitrac">
    INSERT INTO
    glb_order_details
    (sessions,order_id,hosting_notification,product_id)
    SELECT
    '#arguments.sessions#',#arguments.order_id#,#IIF(arguments.hosting,DE("1"),DE("0"))#,
    id
    FROM glb_products
    WHERE id IN(#ListAppend(arguments.product_idlist,0)#)
    </cfquery>
    </cffunction>
    And here is my flex app code.
    var SelectedSalesProducts:Array=new Array();
    var SelectedSalesProductslist:String="";
    for (var i:int = 0; i < gsalesproducts.length; i++){
    if(fff0
    .selected){
    SelectedSalesProducts.push(r0.dataProvider.getItemAt(i).id);
    this.dataManager.NewSessionTotal(this.nsessiontotal.text,order_id,hosting.selected,Select edSalesProductslist);
    I know its the product_id code that cause everything to choke
    up, but I been working on this for 4 days and cannot find a
    solutions. Any help would be great.

    I found what was wrong. Here, is the fix :) in the flex app I
    needed to add this line
    SelectedSalesProductslist=SelectedSalesProducts.join(",");
    I forgot to join my string, and array. Also the biggest thing
    I missed was on this line
    SelectedSalesProducts.push(r0.dataProvider.getItemAt(i).id);
    Instead of id it actually needed to be product_id

  • Need help with CF component call, please

    Hi!
    I've been working with component lately but still learning. In one of my logic I need to use an existing component and I'm not sure how to correctly call the function and get the return result from that.
    Can anyone help me please?
    Basically I created a component:
    <cfcomponent displayname="X">
         <CFFUNCTION name="GetNames">
           <fargument name="1" type="String" required="TRUE">
           <cfargument name="2" type="String" required="TRUE">
           <!---- I do my work here ---->
            within my logic, I need to call an existing function located at
            in a different component And I  need to use the result returned by this function.
            (see below)
            I'm not sure how to correctly call that function from here
            Can I simply do:
            <cfinvoke component="the location of Y component" method="Compare" MyVar = "MyNames" Returnresult="Z">
            <CFIF #Z# NEQ 0>
                <!---  DO something --->
           <CFELSE>
              <!--- do something else --->
           </CFIF>
         </CFFUNCTION>
    </cfcomponent>
    This is the existing componen that I need to use. It's located at the same directory:
    <cfcomponent displayname="Y">
    <!--- assuming this is the function that I need to call --->
         <CFFUNCTION name="Compare" hint="verify names">
           <cfargument name="MyVar" type="String" required="TRUE">
          <cfscript>
                some logic here
                 return return_struct;
         </cfscript>
         </CFFUNCTION>
    </cfcomponent> 
    Please advice, thank you!

    I hopo the following example will be helpful for. Please let me know if you have any questions.
    childComponent.cfc:
    <cfcomponent displayname="childComponent">
        <cffunction name="childComponentFunction" access="remote" returntype="string">
            <cfargument name="myArgument" type="string" required="yes">
            <cfset var finalString="">
            <cfinvoke component="baseComponent" method="baseComponentFunction" returnvariable="finalString">
                <cfinvokeargument name="stringArgumentToReturn" value="#arguments.myArgument#">
            </cfinvoke>
            <cfreturn finalString>
        </cffunction>
    </cfcomponent>
    baseComponent.cfc:
    <cfcomponent displayname="baseComponent">
        <cffunction name="baseComponentFunction" access="public" returntype="string">
            <cfargument name="stringArgumentToReturn" required="yes" type="string">
            <cfreturn arguments.stringArgumentToReturn>
        </cffunction>
    </cfcomponent>
    FYI - There several other methods through which we can call functions of different functions.

  • Please help with cfscript error!

    When I run my app, I got this error:
    sdfst_catcherror is recording this error: Context validation
    error for tag cfscript.; The start tag must have a matching end
    tag. An explicit end tag can be provided by adding
    </cfscript>. If the body of the tag is empty you can use the
    shortcut <cfscript .../>.
    The CFML compiler was processing:
    a cfscript tag beginning on line 45, column 4.
    a cfscript tag beginning on line 45, column 4.
    When I checked my codes, all the
    <cfscript></cfscript> have the pairs. There are only 2
    pairs of <cfscript</cfscript> in this template.
    See my code structure below:
    <!--- the first <cfscript pair> --->
    <cfscript>
    function getTRS(var5)
    some codes here...
    return TRS;
    </cfscript>
    <cffunction name="FrmTxt" returntype="Struct">
    <cfargument name="EmpCodes" required="true"
    type="array">
    <cfargument name="EmpID" required="true"
    type="numeric">
    <cfquery name="GetEmpInfo>
    Select * from......
    </cfquery>
    <cfset varFrms = GetEmpInfo.EmpCodes>
    <cfset A_Key = 1>
    <cfset structFrmTxt = StructNew()>
    <!--- The second pair --->
    <cfscript>
    Some codes here....
    Need to output #TRS# returned by getTRS(var5) set above
    </cfscript>
    <cfreturn structFrmTxt>
    </cffunction>
    From other CF forum I learned that I can't put getTRS(var5)
    within the second <cfscript></cfscript> within
    <CFFUNCTION> pair
    it says "You can't put UDF within UDF or method within
    method". When I did originally, I got this error:
    Unable to complete CFML to Java translation, Error
    information unsupported statement: class
    coldfusion.compiler.ASTfunctionDefinition
    I'm stuck and can't find any resources to solve this problem
    anymore, please help!....

    When I checked my codes, all the
    <cfscript></cfscript> have the pairs.
    This error can often mean that you did not properly end a
    previous code
    block or line. So the closing </cfscript> is being
    considered part of
    that unclosed code. For me, it is often a missing semi-colon
    [;] on the
    last line I wrote, missing a closing curly bracket [}] could
    do it as well.
    Check your code, this is seldom more then missing a bit of
    syntax.

  • Attempting to use onRequestStart to execute when a specific page is called up. Please help

    Hello;
    I am trying ot use a little app I have for turning off background music from a dynic web site. It works nice if I reload the page. But I want to pass it off to the application.cfc file and let that file run the code and if a button is clicked, the application should catch it. (If I miss my guess, everytime you click a link in a cf site, the application.cfc is the first page read?) Does that include a page using ajax as a Iframe loader?Anyway. This is my application file code:
    <cfcomponent output="false" extends="ProxyApplication">
    <cffunction access="public" name="onRequestStart" output="true" returntype="any">
    <cfargument name="request" required="true" />
    <cfif not IsDefined("cookie.hitbox")>
    <embed src='../video/Roller Pop.wav' width="" height="" hidden='true' autostart='true'
    loop='true'></embed>
    <cfelseif IsDefined("deactivate")>
    <cfcookie name="#deactivate#" value="Off" expires="never" domain="myDomain.com"><!--- <cookie defined - stop music> --->
    <cfelseif IsDefined("engage")>
    <cfcookie name="#engage#" value="On" expires="now" domain="myDomain.com"><!--- <cookie removed music is on> --->
    <embed src='../video/Roller Pop.wav' width="" height="" hidden='true' autostart='true'
    loop='true'></embed>
    </cfif>
    </cffunction>
    </cfcomponent>
    this is part of a larger site. This application file sits in a sub directory pulling the info from the main application.cfc file in the main directory. Now, I want this code to fire every time the page www.mydomain.com/subdirectory/index.cfm file is pulled up.Is this possible this way? If so, how far am I off and can someone help me code this to work?
    Thank You!

    I tried it 2 ways. 1. was the way I posted on my last post. That error was a sytax error. I used your code in the link that executes the ajax.
    the 2nd way I tried it, was in the ajax script it's self. It throw a null not an object error.
    this is the script I tried the 2nd time.
    <script type="text/javascript">
    <!--- the document.getelement is added for sound control. this throws an error that states it is not an object--->
    document.getElementById("bgsound").stop();
    <!--- end sound control. The rest works the window, it functions 100%--->
    var loadedobjects=""
    var rootdomain="http://"+window.location.hostname
    function ajaxpage(url, containerid){
    var page_request = false
    if (window.XMLHttpRequest) // if Mozilla, Safari etc
    page_request = new XMLHttpRequest()
    else if (window.ActiveXObject){ // if IE
    try {
    page_request = new ActiveXObject("Msxml2.XMLHTTP")
    catch (e){
    try{
    page_request = new ActiveXObject("Microsoft.XMLHTTP")
    catch (e){}
    else
    return false
    page_request.onreadystatechange=function(){
    loadpage(page_request, containerid)
    page_request.open('GET', url, true)
    page_request.send(null)
    function loadpage(page_request, containerid){
    if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
    document.getElementById(containerid).innerHTML=page_request.responseText
    function loadobjs(){
    if (!document.getElementById)
    return
    for (i=0; i<arguments.length; i++){
    var file=arguments[i]
    var fileref=""
    if (loadedobjects.indexOf(file)==-1){ //Check to see if this object has not already been added to page before proceeding
    if (file.indexOf(".js")!=-1){ //If object is a js file
    fileref=document.createElement('script')
    fileref.setAttribute("type","text/javascript");
    fileref.setAttribute("src", file);
    else if (file.indexOf(".css")!=-1){ //If object is a css file
    fileref=document.createElement("link")
    fileref.setAttribute("rel", "stylesheet");
    fileref.setAttribute("type", "text/css");
    fileref.setAttribute("href", file);
    if (fileref!=""){
    document.getElementsByTagName("head").item(0).appendChild(fileref)
    loadedobjects+=file+" " //Remember this object as being already added to page
    </script>
    Now I have also been working with some scripts I found on the internet. They aren't working either. this one shows the most promiss. It loads the music, but won't allow me to stop it. I also believe I need to combine this function with the ajax code. Right now, I am trying to execute 2 scripts with one link. No errors, but it still isn't working. The sound also doesn't play in anything but IE with this script. I need it in all browsers. Maybe we can work with this?
    <head>
    <!-- the ajax script for the iframe--->
    <script type="text/javascript">
    var loadedobjects=""
    var rootdomain="http://"+window.location.hostname
    function ajaxpage(url, containerid){
    var page_request = false
    if (window.XMLHttpRequest) // if Mozilla, Safari etc
    page_request = new XMLHttpRequest()
    else if (window.ActiveXObject){ // if IE
    try {
    page_request = new ActiveXObject("Msxml2.XMLHTTP")
    catch (e){
    try{
    page_request = new ActiveXObject("Microsoft.XMLHTTP")
    catch (e){}
    else
    return false
    page_request.onreadystatechange=function(){
    loadpage(page_request, containerid)
    page_request.open('GET', url, true)
    page_request.send(null)
    function loadpage(page_request, containerid){
    if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
    document.getElementById(containerid).innerHTML=page_request.responseText
    function loadobjs(){
    if (!document.getElementById)
    return
    for (i=0; i<arguments.length; i++){
    var file=arguments[i]
    var fileref=""
    if (loadedobjects.indexOf(file)==-1){ //Check to see if this object has not already been added to page before proceeding
    if (file.indexOf(".js")!=-1){ //If object is a js file
    fileref=document.createElement('script')
    fileref.setAttribute("type","text/javascript");
    fileref.setAttribute("src", file);
    else if (file.indexOf(".css")!=-1){ //If object is a css file
    fileref=document.createElement("link")
    fileref.setAttribute("rel", "stylesheet");
    fileref.setAttribute("type", "text/css");
    fileref.setAttribute("href", file);
    if (fileref!=""){
    document.getElementsByTagName("head").item(0).appendChild(fileref)
    loadedobjects+=file+" " //Remember this object as being already added to page
    </script>
    <head>
    <body>
    <!--- sound code --->
    <SCRIPT LANGUAGE="JavaScript">
    <!--
    var aySound = new Array();
    // Below: source for sound files to be preloaded
    aySound[0] = "../video/Roller Pop.wav";
    // DO NOT edit below this line
    IE = (navigator.appVersion.indexOf("MSIE")!=-1 && document.all)? 1:0;
    NS = (navigator.appName=="Netscape" && navigator.plugins["LiveAudio"])? 1:0;
    ver4 = IE||NS? 1:0;
    onload=auPreload;
    function auPreload() {
    if (!ver4) return;
    if (NS) auEmb = new Layer(0,window);
    else {
    Str = "<DIV ID='auEmb' STYLE='position:absolute;'></DIV>";
    document.body.insertAdjacentHTML("BeforeEnd",Str);
    var Str = '';
    for (i=0;i<aySound.length;i++)
    Str += "<EMBED SRC='"+aySound[i]+"' AUTOSTART='TRUE' LOOP='TRUE' HIDDEN='TRUE'>"
    if (IE) auEmb.innerHTML = Str;
    else {
    auEmb.document.open();
    auEmb.document.write(Str);
    auEmb.document.close();
    auCon = IE? document.all.auIEContainer:auEmb;
    auCon.control = auCtrl;
    function auCtrl(whSound,play) {
    if (IE) this.src = play? aySound[whSound]:'';
    else eval("this.document.embeds[whSound]." + (play? "play()":"stop()"))
    function playSound(whSound) { if (window.auCon) auCon.control(whSound,true); }
    function stopSound(whSound) { if (window.auCon) auCon.control(whSound,false); }
    //-->
    </SCRIPT>
    <BGSOUND ID="auIEContainer">
    <!--- Ajax iframe window. when the page loads, it loads the image in the center--->
    <div id="rightcolumn"><img src="images/picFrameCenter.gif" width="354" height="263" /></div>
    <!--- this is the link that needs to stop the sound--->
    <a href="javascript:ajaxpage('mainVideo.cfm', 'rightcolumn');" onClick="javascript:stopSound(0);">image here</a>
    <!--- this is the link that needs to start the sound --->
    <a href="index.cfm" onClick="javascript:playSound(0);">my image here</a>
    <!--- these links don't need to interact with the sound at all --->
    <a href="javascript:ajaxpage('mainVideo1.cfm', 'rightcolumn');">image here</a>
    <a href="javascript:ajaxpage('mainVideo2.cfm', 'rightcolumn');">image here</a>
    <a href="javascript:ajaxpage('mainVideo3.cfm', 'rightcolumn');">image here</a>
    <a href="javascript:ajaxpage('mainVideo4.cfm', 'rightcolumn');">image here</a>
    </body>
    What do you think? I like your idea better though. I really think they need to work together. that means making it one script. correct? Sorry, I have been trying to get this all night and this morning. lol almost out of ideas

  • Help???.....911

    Hi:
    First what I'm trying to do is to secure my login
    application, Authenticate Users, Display users logged in and
    Display error messages in to my login page. For some reason;
    <else>, <abort>, and the other reasons explained above
    are not working. <CFLogin Tags don't work in some places. Still
    I can login; but I can't include the <include template/> tag
    because it will include that template in every Page. Here is my
    code for the application page any help will be appreciated.By the
    way I'm working in a Mac OSX.
    Thank you;
    Bebeivan

    just from a brief look at it, there are numerous wrong things
    with this...
    1) you have doctype and other declarations as you would in a
    html/cfm page - they are not needed in application.cfm page.
    2) you are using functions as you would in an
    application.cfc, but have doctype, head and body sections as in a
    regular .cfm page.... what are you using? cfc or .cfm?
    3) where is </cflogin>
    4) your many <cffif> tags are empty, and after them you
    have the actions you want to perform if cfif validates... like this
    code:
    <cffunction name="OnRequestStart">
    <cfargument name = "request" required="true"/>
    <cfif IsDefined("Form.logout")>
    </cfif>
    </cffunction>
    <cflogout>
    this will basically perform a logout ALWAYS
    there are just too many wrong things there to list them
    all...

  • Problem with threads and simulation: please help

    please help me figure this out..
    i have something like this:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class DrawShapes extends JApplet{
         private JButton choices[];
         private String names[]={"line", "square", "oval"};
         private JPanel buttonPanel;
         private DrawPanel drawingArea;
         private int width=300, height=200;
         public void init(){
              drawingArea=new DrawPanel(width, height);
              choices=new JButton[names.length];
              buttonPanel=new JPanel();
              buttonPanel.setLayout(new GridLayout(1, choices.length));
              ButtonHandler handler=new ButtonHandler();
              for(int i=0; i<choices.length; i++){
                   choices=new JButton(names[i]);
                   buttonPanel.add(choices[i]);
                   choices[i].addActionListener(handler);
              Container c=getContentPane();
              c.add(buttonPanel, BorderLayout.NORTH);
              c.add(drawingArea, BorderLayout.CENTER);
         }//end init
         public void setWidth(int w){
              width=(w>=0 ? w : 300);
         public void setHeight(int h){
              height=(h>=0 ? h : 200);
         /*public static void main(String args[]){
              int width, height;
              if(args.length!=2){
                   height=200; width=300;
              else{
                        width=Integer.parseInt(args[0]);
                        height=Integer.parseInt(args[1]);
              JFrame appWindow=new JFrame("An applet running as an application");
              appWindow.addWindowListener(
                   new WindowAdapter(){
                        public void windowClosing(WindowEvent e){
                             System.exit(0);
              DrawShapes appObj=new DrawShapes();
              appObj.setWidth(width);
              appObj.setHeight(height);
              appObj.init();          
              appObj.start();
              appWindow.getContentPane().add(appObj);
              appWindow.setSize(width, height);
              appWindow.show();
         }//end main*/
         private class ButtonHandler implements ActionListener{
              public void actionPerformed(ActionEvent e){
                   for(int i=0; i<choices.length; i++){
                        if(e.getSource()==choices[i]){
                             drawingArea.setCurrentChoice(i);
                             break;
    }//end class DrawShapes
    class DrawPanel extends JPanel{
         private int currentChoice=-1;
         private int width=100, height=100;
         public DrawPanel(int w, int h){
              width=(w>=0 ? w : 100);
              height=(h>=0 ? h : 100);
         public void paintComponent(Graphics g){
              super.paintComponent(g);
              switch(currentChoice){
                   case 0:     g.drawLine(randomX(), randomY(), randomX(), randomY());
                             break;
                   case 1: g.drawRect(randomX(), randomY(), randomX(), randomY());
                             break;
                   case 2: g.drawOval(randomX(), randomY(), randomX(), randomY());
                             break;
         public void setCurrentChoice(int c){
              currentChoice=c;
              repaint();          
         private int randomX(){
              return (int) (Math.random()*width);
         private int randomY(){
              return (int) (Math.random()*height);
    }//end class drawPanel
    That one's from a book. I used that code to start with my applet. Mine calls different merthod from the switch cases. Say I have:
    case 0: drawStart(g); break;
    public void drawStart(Graphics g){
      /* something here */
    drawMain(g);
    public void drawMain(graphics g){
    g.drawString("test", x, y);
    //here's where i'm trying to pause
    //i've tried placing Thread.sleep between these lines
    g.drawLine(x, y, a, b);
    //Thread.sleep here
    g.drawRect(x, y, 50, 70);
    }I also need to put delays between method calls but I need to synchronize them. Am I doing it all wrong? The application pauses or sleeps but afterwards, it still drew everything all at once. Thanks a lot!

    It is. Sorry about that. Just answer any if you want to. I'd appreciate your help. Sorry again if it caused you anything or whatever. .n_n.

  • Query Help

    Table1:
    ou store point
    LS LIB1 50
    LS LIB1 200
    LS LIB1 100
    LS LIB1 79
    I have to insert table1 to table2 by splitting into every 143point and assing serial number for every 143 from parameter.
    in aboce example we can split 3 time 143 like below table2 sample.
    Table2
    ou store point serial_number
    LS LIB1 50 101
    LS LIB1 93 101
    LS LIB1 107 102
    LS LIB1 36 102
    LS LIB1 64 103
    LS LIB1 79 103
    i tried below procedure its not working.
    table may have any order like below.
    Table1:
    ou store point
    LS LIB1 200
    LS LIB1 50
    LS LIB1 100
    LS LIB1 79
    then table2
    ou store point serial_number
    LS LIB1 143 101
    LS LIB1 57 102
    LS LIB1 50 102
    LS LIB1 36 102
    LS LIB1 64 103
    LS LIB1 79 103
    create or replace procedure assign_serial(from_num number,to_num number) is
    bal number(10);
    begin
    bal := 0;
    for c1 in(select * from table1)
    loop
    if c1.point <=143 then
    if bal=0 then
    bal=143-used;
    insert int0 table2 values(c1.ou,c1.store,used);
    elsif used > 0 then
    used=used-bal;
    insert int0 table2 values(c1.ou,c1.store,bal);
    bal=0;
    if used > 0 then
    insert int0 table2 values(c1.ou,c1.store,used);
    end if;
    bal:=143-used;
    end if;
    end loop;
    end;
    How to split and assign serial number,please hELP.

    .after giving serial num i have to change points in table1 to 0.The problem for SUm and split for every 143 is ,different OU and store is there.we have to know for which store points we earned serial number.
    i hope this below logic little satisfy except assign cardnum,please........ check and currect the logic
    LS LIB1 50
    LS LIB1 200
    LS LIB1 100
    LS LIB1 79
    --variable used and bal
    for c1 in(select * from table1)
    loop
    used := c1.points;
    if c1.point <=143 then
    if bal=0 then
    bal=143-used;
    insert int0 table2 values(c1.ou,c1.store,used);
    elsif used > 0 then
    used=used-bal;
    insert int0 table2 values(c1.ou,c1.store,bal);
    bal=0;
    if used > 0 then
    insert int0 table2 values(c1.ou,c1.store,used);
    end if;
    bal:=143-used;
    end if;
    end loop;

  • Help my safari doesnt open and gives me a crash report

    help my safari doesn't open and gives me a crash report ever since i downloaded a file from the internet. I have a macbook air (early 2014) with running os x yosemite version 10.10.1

    There is no need to download anything to solve this problem.
    You may have installed the "Genieo" or "InstallMac" ad-injection malware. Follow the instructions on this Apple Support page to remove it.
    Back up all data before making any changes.
    Besides the files listed in the linked support article, you may also need to remove this file in the same way:
    ~/Library/LaunchAgents/com.genieo.completer.ltvbit.plist
    If there are other items with a name that includes "Genieo" or "genieo" alongside any of those you find, remove them as well.
    One of the steps in the article is to remove malicious Safari extensions. Do the equivalent in the Chrome and Firefox browsers, if you use either of those. If Safari crashes on launch, skip that step and come back to it after you've done everything else.
    If you don't find any of the files or extensions listed, or if removing them doesn't stop the ad injection, then you may have one of the other kinds of adware covered by the support article. Follow the rest of the instructions in the article.
    Make sure you don't repeat the mistake that led you to install the malware. Chances are you got it from an Internet cesspit such as "Softonic" or "CNET Download." Never visit either of those sites again. You might also have downloaded it from an ad in a page on some other site. The ad would probably have included a large green button labeled "Download" or "Download Now" in white letters. The button is designed to confuse people who intend to download something else on the same page. If you ever download a file that isn't obviously what you expected, delete it immediately.
    In the Security & Privacy pane of System Preferences, select the General tab. The radio button marked Anywhere  should not be selected. If it is, click the lock icon to unlock the settings, then select one of the other buttons. After that, don't ignore a warning that you are about to run or install an application from an unknown developer.
    Still in System Preferences, open the App Store or Software Update pane and check the box marked
              Install system data files and security updates
    if it's not already checked.

Maybe you are looking for

  • Thinkpad Yoga cooling fan issue

    Hi, my TPY had been working pretty well for several weeks but last few days I´m experiencing an annoying issue - the cooling fan doesn´t engage when TPY gets hot under load, even when the core gets to 100 degrees Celsius and all the bottom and right

  • In iTunes, I have a number of tones stored.  I don't know how to access them to add to listed people on my iPhone. I would appreciate any help.

    In iTunes, I have a number of tones stored.  I don't know how to access them to add to listed people on my iPhone. I would appreciate any help.

  • HT2311 boot freezing after itunes 10.7 update

    after installing nad rebooting my system with the new version of itunes. i get nothing but the grey apple screen and the wheel of eternity. whats the best way to handle this? running 10.7.(current) on 1,1 mac pro, ssd, and 10 gigs ram. i unplugged al

  • Tune up of view query.

    Hi All, I have a view which is fetching 150,000 records on load of a form because of that the form is taking a long time to load. The problem here is i cannot use a PL as we are bound to supply small sql query's to Javascript pages. My query is simpl

  • Yosemite Mail freezes when importing mailboxes

    Dear all, I just updated my Mac to Yosemite. I did a fresh install (erased disk and then restore documents and data with Time Machine) and installed all updates. Everything is working flawlessly except Mail. I can't make it run. Every time I opened i