Looks like a silly problem...

I don't know why but I get always 0 values when I am tring to print a1 and a2 in Calculate function.
every time I send a value into sample so I don't know why it keeps giving me 0 for a1 and a2 and c.
class A
long a1;
long a2;
long c;
     void Calculate(long sample)
          a1= (((long)(0.222))*a1) + (((long)(0.15))*sample);
          a2= ((long)(1-0.25)*a2)+((long)0.25*(Math.abs(a1-sample)));
          c = a1 + (4*a2);
A
a1 =0 ; a2 =4;
     

try this
class A
long a1;
long a2;
long a3;
  public A()
     a1 = 5;
     Calculate(a1);
  void Calculate(long sample)
    a1= (((long)(0.222))*a1) + (((long)(0.15))*sample);
   System.out.println( "a1 is: "+a1 );
    a2= ((long)(1-0.25)*a2)+((long)0.25*(Math.abs(a1-sample)));
   System.out.println( "a2 is: "+a2 );
    c = a1 + (4*a2);
   System.out.println( "c is: "+c );
}

Similar Messages

  • Looks like a network problem but I don't think that's it.

    Okay so a co-worker (my boss actually) got an Ipod shuffle for Christmas. When he plugs it into the PC he get's a message that the Ipod on F:\ needs to be formatted. we've followed the steps and formatted it several times but following the steps only removes the path to the music, But here where I think a lot of the problem comes in, F is actually a networked drive that contains the mydocuments folder where the music is located, but whenever we plug the Ipod in it thinks it's the F drive so we loose the networked path and can't access it until we unplug the Ipod.
    I would think the fix for this would be to change the drive letter under the drive management but it's not showing up there or in my computer. Is there a setting in advanced somewhere to tell it to assign the Ipod a different letter drive or something like that? I haven't had any luck finding it. Or am I on the wrong path to fix it?
    Thanks
    Russ

    Thanks for the response. But as I said it wasn't showing up in the disk management. Anyway we did get it to show up in disk management after stopping and restarting the service (for some reason rebooting wasn't doing it for us though.)
    Again Thanks again for the help.

  • It looks like a battery problem, but isn't

    I have a 4G, purchased the end of 2004. I replaced the battery last year.
    The battery appeared to go again, so I replaced it again. The battery looked half charged when I connected it, though it said fully charged when I used someone else's charger (mine, for some reason, stoppped working???) I charged it over night anyway -- the instructions say at least 3 hours.
    Unfortunately, before I even used it, it is showing the same symptoms -- discharging rapidly after it's been fully charged. I disconnected the charger a couple of hours ago, and now the battery symbol says that it's almost totally discharged.
    Ideas?

    what is that icon
    It represents the mounted image.
    what do I need to do with it?
    You need to click on it. If there's an application inside, move that to the Applications folder. If there's a brown package icon inside, double-click it.
    (54182)

  • TOO many activations - looks like everyone has problem

    My case number is
    Case #0181489003
    I've been waiting since March 13. Still waiting to get it reset.
    If so many people are having this problem why isn't adobe trying to fix it? Is it b/c it is a free program?
    Thanks

    As a note to anybody submitting a support case for E_ACT_TOO_MANY_ACIVATIONS, provide both the AdobeID you are using the activate Digital Editions as well as the full and exact error message (with all the number/letters) and it will help get the problem resolved in a timely fashion.
    Such as in this case, although she opened the case on 3/13, and it was responded to with a request for her AdobeID within two hours, to which she responded with the AdobeID on 3/15 (2 days later).  The expected close rate after the correct information has been recieved is 3-5 days, and this has already been bumped up to the appropriate level and should be taken care of shortly, so I'm not going to jostle support's elbows on this one.

  • Looks like aol server problem is fixed at last

    finally getting email again on iphone

    Well done.
    I had a very similar problem which took them 6 months, and about 7 engineers, to trace to RF interference from next door, after whatever it was was switched off my connection has been 500k higher and totally stable.
    And a small cheap transistor radio is ideal to trace RF interference.
    I have to give full marks to the mods on this forum for perservering with my problem until it was solved.

  • I have a very slow FF7 on a Vaio 3D laptop....iChrome is running just fine, so looks like a FF problem....any help welcomed!

    very slow in all sites I usually access, specially 1&1

    Posting a url and lots more information has been known to help.
    :Perhaps [https://wiki.mozilla.org/Releases Firefox 8 (Nov 8th)] will do better.
    A couple of searches
    # [https://www.google.com/search?num=100&hl=en&newwindow=1&q=site%3Akb.mozillazine.org+-intitle%3Atalk+-inurl:%22/index.php?title=%22+-inurl%3A%22%2Findex.php%3Ftitle%3D%22+running%20slow+-intitle:talk&btnG=Search running slow] (MozillaZine)
    # [https://support.mozilla.com/en-US/search?a=2&q=running%20slow&is_solved=1&num_voted=0&num_votes=&asked_by=&answered_by=&q_tags=&created=0&created_date=&updated=0&updated_date=&sortby=0&a=1&w=2 running slow] (support questions)

  • Display has low luminosity - looks like as burn backlight

    Hello at all,
    I have many days this problem with my laptop, I try to fix it but I can't.
    Please guys help me to solve this problem with my laptop.
    First of all, the problem is when I start my laptop, the laptop start and boot normally but the screen has low luminosity.
    I think that looks like a clasical problem withn invert.
    I change the invert in my laptop but the problem remains...
    The next step which I try is the display, I change and the display from my laptop and I try it with new (and old invert) again the problem remains.
    The third step which I try to do is to change the motherboard.
    I change the motherboard and I try again but now with my old display because I send back the new display which I had bought from ebay. (new motherboard,new invert,old display--- the problem remains).
    After all that tries, I try to change and the cable from the display but again I have the same problem.
    My laptop begin normally, boot normally but the display has low luminosity.
    In this point, I want to tell you that when I connect my laptop with external screen HDMI Monitor, it works great!
    Do you something to suggest guys?
    Please help me.
    Thank you very much for your time...

    Hello @Gratsa ,
    To get your issue more exposure I would suggest posting it in the commercial forums since this is a commercial product. You can do this at Commercial Forums.
    Even though this is a Commercial product,  here is a link to resolving issues and check the display settings in the Notebook settings. This shows you how to calibrate your screen.
    You can do a system restore. System restore will help if something automatically updated and did not go well on the Notebook.
    Thanks.
    Please click “Accept as Solution ” if you feel my post solved your issue, it will help others find the solution.
    Click the “Kudos, Thumbs Up" on the bottom to say “Thanks” for helping!

  • Looks like a simple query but need your help

    Hello everyone,
    I have a simple problem but I can't get over it. Actually, it looks like a simple problem, but I can't do it. So,it's probably not... Anyone can help me with this?
    Imagine the following data:
    ALTER SESSION SET NLS_DATE_FORMAT = 'DD/MM/YYYY HH24:MI:SS';
    SELECT TRUNC(SYSDATE) - TO_DATE('01/01/11', 'DD/MM/RR') FROM dual; -- 564
    DROP TABLE runs;
    CREATE TABLE runs
      start_date DATE,
      end_date DATE
    -- generate some random data
    INSERT INTO runs(start_date)
      SELECT TO_DATE('01/01/11', 'DD/MM/RR') + trunc(dbms_random.value(0,564))
        FROM dual
    CONNECT BY LEVEL <= 10000;
    -- still generating sample data
    UPDATE runs
       SET end_date = start_date + dbms_random.value(0,20000) / 86400; -- 20000 sec is the max
    COMMIT; If you execute the previous "script", you'll end up with a table called RUNS with 10.000 records. Each record contains a start date and an end date which is max 20.000 second after the start date.
    What I would like to do is a report based on these data.
    I need something like this:
    (first week of 2011 started on sunday. So I go back to the last monday of 2010)
    WEEK_NUMBER                              AVG_FOR_MONDAY_BY_WEEK  CUMULATIVE_AVERAGE_FOR_MONDAYS
    Week 1: 26/12/2010 - 01/01/2011                                       9999                           88888
    Week 2: 02/01/2011 - 08/01/2011                                       1111                           22222
    ....For each week, I would like to have the average duration (which is the difference in seconds between end_date and start_date) by day (monday needs to have its average, tuesday, wednesday...too)
    And I also need a cumulative average by week and by days (mondays, tuesdays...). This cumulative average needs to be based on all the preceding rows.
    Can anyone help me with this query? I'm using Oracle 10g
    Thanks

    Hi,
    Something along these lines :
    alter session set nls_date_language = "english";
    with all_data as (
      select to_char(start_date, 'IYYYIW') as wk
           , to_char(start_date, 'dy') as dy
           , (end_date - start_date)*86400 as duration
      from runs
    week_data as (
      select wk
           , round(avg(case when dy = 'mon' then duration end)) as avg_mon
           , round(avg(case when dy = 'tue' then duration end)) as avg_tue
           , round(avg(case when dy = 'wed' then duration end)) as avg_wed
           , round(avg(case when dy = 'thu' then duration end)) as avg_thu
           , round(avg(case when dy = 'fri' then duration end)) as avg_fri
           , round(avg(case when dy = 'sat' then duration end)) as avg_sat
           , round(avg(case when dy = 'sun' then duration end)) as avg_sun
      from all_data
      group by wk
    select wk
         , avg_mon
         , sum(avg_mon) over(order by wk) as cum_avg_mon
         , avg_tue
         , sum(avg_tue) over(order by wk) as cum_avg_tue
         , avg_wed
         , sum(avg_wed) over(order by wk) as cum_avg_wed
         , avg_thu
         , sum(avg_thu) over(order by wk) as cum_avg_thu
    from week_data
    order by wk;
    WK        AVG_MON CUM_AVG_MON    AVG_TUE CUM_AVG_TUE    AVG_WED CUM_AVG_WED    AVG_THU CUM_AVG_THU
    201052                                                                                
    201101       9836        9836       8737        8737       9088        9088      12167       12167
    201102       7639       17475      10319       19056       7391       16479       8036       20203
    201103       8275       25750       8883       27939       8525       25004      11682       31885
    201104       7029       32779      10850       38789       7360       32364       7617       39502
    201105      10292       43071      11421       50210      11141       43505       9469       48971
    201106      11612       54683       9762       59972      11464       54969       9517       58488
    201107       8645       63328      10206       70178      10124       65093      11917       70405
    201108      11466       74794      11678       81856      10839       75932       9587       79992
    201109       8745       83539       6803       88659       8963       84895       9496       89488
    201110      10443       93982       8104       96763      10314       95209      10908      100396
    201111       8183      102165       9467      106230      11495      106704      12040      112436
    201112       8575      110740       9207      115437      10338      117042       9561      121997
    201113      10273      121013       6268      121705      11288      128330      12335      134332
    201114      10176      131189       8561      130266      10367      138697       7983      142315
    201115      10587      141776      12073      142339       8528      147225      12271      154586
    201116       9393      151169      10761      153100       7901      155126      10020      164606
    201117      11459      162628       9471      162571      10136      165262       8188      172794
    201118      11946      174574       9997      172568       9367      174629      10475      183269
    201119      12869      187443       9848      182416       7692      182321       9632      192901
    201120       9675      197118       7408      189824      11646      193967       9614      202515
    201121      10742      207860      10302      200126       9208      203175       7543      210058
    201122       8083      215943       8323      208449      10045      213220       9498      219556
    201123      11838      227781       8820      217269       8804      222024      10485      230041
    201124       8748      236529      12143      229412       9684      231708       8402      238443
    201125      11504      248033      10586      239998      10073      241781       9573      248016
    201126       7289      255322      14241      254239      10100      251881      11843      259859
    201127      10855      266177       9980      264219      10320      262201      11023      270882
    201128      11004      277181       9975      274194      11609      273810       8945      279827
    201129      10488      287669       9402      283596      11985      285795       9481      289308
    201130       7338      295007       8963      292559      11982      297777       8177      297485
    201131       9778      304785      10024      302583      10732      308509      10749      308234
    201132      10360      315145      12577      315160       8643      317152      10001      318235
    201133       9845      324990      10416      325576       9996      327148      10548      328783
    201134       9540      334530       8138      333714       9401      336549       9093      337876
    201135       7000      341530       9920      343634      10370      346919      10937      348813
    201136      11307      352837       8889      352523      12339      359258       8491      357304
    201137      11785      364622       9146      361669       9232      368490      11023      368327
    201138       7857      372479       6784      368453       8502      376992      12558      380885
    201139       9842      382321      10616      379069      10435      387427       7848      388733
    201140      10578      392899       9402      388471       8806      396233       9927      398660
    201141       6711      399610      13015      401486       9934      406167      10011      408671
    201142      10088      409698      10380      411866       7836      414003       9205      417876
    201143       8132      417830      11772      423638      10792      424795      10834      428710
    201144       9921      427751       7454      431092       9551      434346      10754      439464
    201145      13196      440947      11600      442692      11303      445649      10455      449919
    201146      12022      452969       8996      451688      10221      455870      12567      462486
    201147       8965      461934      10068      461756      10607      466477      13486      475972
    201148       9483      471417       9264      471020       9601      476078       8685      484657
    201149      11738      483155       9000      480020      10284      486362      11263      495920
    201150      10338      493493      10237      490257      10357      496719      10984      506904
    201151      10777      504270      11138      501395      10543      507262       9840      516744
    201152       9881      514151      10692      512087      11432      518694      10122      526866
    201201      11089      525240       8077      520164      12391      531085       9649      536515
    201202       9871      535111       8326      528490       9449      540534      10551      547066
    201203      10625      545736      11609      540099       9626      550160       5795      552861
    201204       8856      554592       9679      549778      10722      560882      11064      563925
    201205       9379      563971       9943      559721       8409      569291      11656      575581
    201206      10843      574814      10070      569791      12162      581453      10764      586345
    201207       8424      583238       8484      578275       8382      589835       8716      595061
    201208      11159      594397      10415      588690      11459      601294      11317      606378
    201209      11264      605661       8244      596934       9682      610976      10192      616570
    201210      11514      617175       9322      606256       9101      620077      10571      627141
    201211       9348      626523       7501      613757      12297      632374      11170      638311
    201212      10523      637046       7605      621362      10348      642722      10068      648379
    201213      10411      647457      11686      633048      10212      652934       9574      657953
    201214       9394      656851      10526      643574       8521      661455       9829      667782
    201215       8994      665845      12256      655830       8243      669698      10592      678374
    201216      11491      677336      10939      666769      12846      682544       9708      688082
    201217       9737      687073       9611      676380       7244      689788      10943      699025
    201218       9024      696097      11286      687666      10033      699821      10314      709339
    201219       9851      705948       9851      697517       9159      708980       9917      719256
    201220       7785      713733      10490      708007       8534      717514       8528      727784
    201221      11107      724840       8197      716204       8926      726440      10834      738618
    201222       8093      732933      11853      728057      11697      738137      10081      748699
    201223       9371      742304      10796      738853      11068      749205       9904      758603
    201224      10600      752904       8487      747340      10838      760043       8009      766612
    201225      11090      763994       9595      756935      10736      770779       9387      775999
    201226       8234      772228      12759      769694       9119      779898       8422      784421
    201227       9738      781966       9383      779077       8978      788876      11635      796056
    201228      11687      793653      10302      789379       9459      798335      10608      806664
    201229       9245      802898      11290      800669                 798335                 806664
    82 rows selected

  • Problem with slideshow in iPhoto. Photos look like they are all the right way up but when in slideshow action some are sideways.

    even though all photos look like they are the right way up, when the slideshow commences, some of them display sideways. I have tried re-rotating them - and still have same problem. Help please - need it for Saturday night !

    What version of iPhoto are you using?  Are you creating the slideshow directly from an album or are you using the slideshow mode?
    As a test launch iPhoto with the Option key held down and create a new, test library.  Import some photos and test to see if the same problem persists. Does it?
    OT

  • I am having a problem with pop pups and small windows with ads constantly opening up on my safari?? Thought that macs didn't get virus? this looks like one- any experts around? please help me fix it with your instructions? really don't know what to do...

    Hi everyone,
    I am having a problem with my Mac OS X 10.7.5 mac book air , there are constant pop pups and small windows with ads blinking constantly opening up on my safari in front of everything?? it is constantly interupting me and makes me mistakingly click on it then another new windows open behind the one im using..
    I am not too sure if thats a virus or trojan.. I always thought that macs didn't get virus? this looks like one to me… any experts around? please help me fix it with your instructions? really don't know what to do... thanks

    Those are not viruses. You have probably installed some malware:
    The Safe Mac » Adware Removal Guide
    Helpful Links Regarding Malware Protection
    An excellent link to read is Tom Reed's Mac Malware Guide.
    Also, visit The XLab FAQs and read Detecting and avoiding malware and spyware.
    See these Apple articles:
              Mac OS X Snow Leopard and malware detection
              OS X Lion- Protect your Mac from malware
              OS X Mountain Lion- Protect your Mac from malware
              About file quarantine in OS X
    If you require anti-virus protection Thomas Reed recommends using Dr.Web Light from the App Store. It's free, and since it's from the App Store, it won't destabilize the system. If you prefer one of the better known commercial products, then Thomas recommends using Sophos.(Thank you to Thomas Reed for these recommendations.) If you already use Sophos, then be aware of this if you are using Mavericks: OS X Mavericks- Sophos Anti-Virus on-access scanner versions 8.0 - 9.1 may cause unexpected restarts
    From user Joe Bailey comes this equally useful advice:
    The facts are:
    1. There is no anti-malware software that can detect 100% of the malware out there.
    2. There is no anti-malware that can detect anything targeting the Mac because there
         is no Mac malware in the wild, and therefore, no "signatures" to detect.
    3. The very best way to prevent the most attacks is for you as the user to be aware that
         the most successful malware attacks rely on very sophisticated social engineering
         techniques preying on human avarice, ****, and fear.
    4. Internet popups saying the FBI, NSA, Microsoft, your ISP has detected malware on
        your computer is intended to entice you to install their malware thinking it is a
        protection against malware.
    5. Some of the anti-malware products on the market are worse than the malware
        from which they purport to protect you.
    6. Be cautious where you go on the internet.
    7. Only download anything from sites you know are safe.
    8. Avoid links you receive in email, always be suspicious even if you get something
        you think is from a friend, but you were not expecting.
    9. If there is any question in your mind, then assume it is malware.

  • I am having problem with me Iphone4, looks like the mic of my phone is not working. no one can hear me if I make a call to them

    Can any one please help me I am having problem with me Iphone4, looks like the mic of my phone is not working. no one can hear me if I make a call to them. I have tried all restoring options but no use. please help me

    The mic on my iPhone4 has just quit also. Similar symptoms to yours in that people I'm talking to hear only static or my voice very faintly. The voice/memo recorder also only really records static.
    It happened suddenly and seemed to get better after a day or two but then went completely after another day.
    I'm returning it to Vodafone New Zealand shortly but will have to wait 5-10 days for a replacement. There are NO Apple accredited means to speed this procedure up in NZ.
    We don't even have a single physical Apple Store where you could walk in and talk to a Genius.

  • I've recently started to use Numbers but when I try to sync to iCloud it asks me to create a new iCloud account. Problem is I already have one and that's the one I want to use. Looks like I have the same situation on my iphone. Any guidance? Thanks.

    I've recently started to use Numbers on my macbook pro but when I try to sync to iCloud it asks me to create a new iCloud account. Problem is I already have one and that's the one I want to use.
    Looks like I have the same situation on my iphone.
    The only option I'm being given is to create an lCloud account.
    Any guidance? Thanks.

    The last thing you want is a second iCloud account. Try logging out and back in in System Preferences. If that doesn't work, I'd get AppleCare on the line.
    Jerry

  • I have a problem with mail autofilling info email addresses. Emails sent to me the from looks like this: Holiday in the United States email address . I have no idea what this Holiday in the United States is...How can I fix/change to my name?

    I have an irritating problem with mail autofilling info in email addresses. Emails sent to me the from looks like this: Holiday in the United States <my email address>. I have no idea what this Holiday in the United States is or how it got to be there...How can I fix/change to my name?
    I fixed the To: autofilling incorrectly by deleting my email address from the Previous Recipients List, but is there a way to stop that from coming up on emails that I receive?

    Have you checked your Mac address book? If your email is saved somewhere in your address book with the name "Holidays in the United States" it might be adding the name automatically in Mac Mail.
    Alternatively, try this:
    Delete an Email Address from Auto-Complete in Mac OS X Mail
    To remove an email address from the auto-complete list in Mac OS X Mail:
    Start typing the recipient's address or name in a new message.
    Select the desired address from the auto-complete list as if you'd compose an email to them.
    Click the small down arrow in the recipient.
    Select Remove from Previous Recipients List from the menu.
    You can also search for the unwanted address directly in the previous recipients list:
    Select Window | Previous Recipients from the menu in Mac OS X Mail.
    Highlight the address you want to remove.You can highlight multiple addresses by holding down the Command key.
    Click Remove from List.
    Source: About.com

  • Javascript is not working on some sites, and some sites also display in what looks like arabic. whats going on? how do i fix the javascript problem? javascript IS functioning in other browsers.

    Site displays fine in IE but in Mozilla, displays in text only, with the message: "Billboard requires a JavaScript enabled browser to get the full experience." Getting similar messages on other sites. Also, some sites are displaying in part English, part what looks like Arabic to me. Whats that about? Havent played with any language settings- in the browser OR on my computer. The affected sites listed are both displaying in text only. The login page for Mozilla website is one of the sites i mentioned displaying in part (Arabic?)

    Reload a web page and bypass the cache with:
    * Press and hold Shift and left-click the Reload button.
    * Press "Ctrl + F5" or press "Ctrl + Shift + R" (Windows,Linux)
    * Press "Cmd + Shift + R" (MAC)
    See [[Keyboard shortcuts]] and [[Mouse shortcuts]]
    * "Remove the Cookies" from sites that cause problems: Tools > Options > Privacy > Cookies: "Show Cookies"
    Start Firefox in [[Safe Mode]] to check if one of the add-ons is causing the problem (switch to the DEFAULT theme: Tools > Add-ons > Themes).
    * Don't make any changes on the Safe mode start window.
    See:
    * [[Troubleshooting extensions and themes]]
    * [[Troubleshooting plugins]]
    If it does work in Safe-mode then disable all extensions and then try to find which is causing it by enabling one at a time until the problem reappears.
    * Use "Disable all add-ons" on the [[Safe mode]] start window to disable all extensions.
    * Close and restart Firefox after each change via "File > Exit" (Mac: "Firefox > Quit"; Linux: "File > Quit")

  • I'm trying to migrate from mobileMe to iCloud but I have Snow Leopard (the latest version). It looks like Lion is no longer available because Mountain Lion comes out next month (July). The problem is mobileMe ends on June 30th. How can I migrate?

    I'm trying to migrate from mobileMe to iCloud but I have Snow Leopard (the latest version). It looks like Lion is no longer available because Mountain Lion comes out next month (July). The problem is mobileMe ends on June 30th. How can I migrate?
    My iphone and my ipad are compatible but when I try to go to icloud on my phone it says to do it on my computer.
    I would like to have my calendar, contacts, etc.. all sync like they do now. Is there a way to upgrade before June 30th? If not, will the gap be an issue or will I just be able to buy mountain lion and sync everything?
    Any suggestions?
    Thank you!

    You can buy Lion in the App Store now, but move to iCloud now. If you wait to Mountain Lion, you will only have Mail in Snow Leopard, so you will lose syncing unless you use Lion or Mountain Lion. It's up to you

Maybe you are looking for