What to do when your program doesn't work.

A huge number of posts here seem to relate to code that has been written (one presumes by the poster), but which doesn't work.
I get the impression that people don't know what to do next.
It's really not that difficult. When you're writing your program you constantly have in mind what you expect will happen as a result of each bit of code that you put.
If at the end of the day, the program as a whole doesn't behave as you expected, then somewhere in there there must be a point at which the program starts doing something that doesn't correspond to what you anticipated. So, you add some System.err.println statements to test your beliefs.
Consider this program that tests whether a number is prime.
public class Test
    public static void main(String args[])
        // Get the number to test.
        int number = Integer.parseInt(args[0]);
        // Try each possible factor.
        int factor;
        for(factor = 2; factor < number; factor++)
            // See whether it is really a factor.
            if(number / factor == 0)
                break;
        if(factor == number)
            System.out.println("Number is not prime.");
        else
            System.out.println("Number is prime.");
}Straight forward enough, but it doesn't actually work :( It seems to say that every number is not prime. (Actually, not quite true, but I didn't test it that carefully, since it didn't work).
Now, I could scrutinise it for errors, and then, having failed to find the problem, I could post it here. But let's suppose I'm too proud for that.
What might be going wrong. Well, how sure am I that I'm even managing to capture the number of interest, number. Let's put in a System.err.println() to test that.
Is the program in fact trying the factors I expect? Put in System.err.println() for that.
Is the program correctly determining whether a number is a factor? Need another System.err.prinln (or two) for that.
public class Test
    public static void main(String args[])
        // Get the number to test.
        int number = Integer.parseInt(args[0]);
        System.err.println("Number to check is " + number);
        // Try each possible factor.
        int factor;
        for(factor = 2; factor < number; factor++)
            System.err.println("Trying factor " + factor);
            // See whether it is really a factor.
            if(number / factor == 0)
                System.err.println(factor + " is a factor.");
                break;
            System.err.println(factor + " is not a factor.");
        if(factor == number)
            System.out.println("Number is not prime.");
        else
            System.out.println("Number is prime.");
}Let's try with on the number 6.
The output is:
Number to check is 6
Trying factor 2
2 is not a factor.
Trying factor 3
3 is not a factor.
Trying factor 4
4 is not a factor.
Trying factor 5
5 is not a factor.
Number is not prime.
Whoah! That's not right. Clearly, the problem is that it's not correctly deciding whether a number is a factor. Well, we know exactly where that test is done. It's this statement:
            if(number / factor == 0)Hmm.... let's try 6 / 3, 'cos 3 is a factor.
6 / 3 = 2.
But that's not zero. What the.... Oh - I see, it should have been number % factor.
Ok - let's fix that, and run it again.
Now the output is:
Number to check is 6
Trying factor 2
2 is a factor.
Number is prime.
Not the right answer, but at least it's now figured out that 2 is a factor of 6. Let's try a different number.
Number to check is 9
Trying factor 2
2 is not a factor.
Trying factor 3
3 is a factor.
Number is prime.
Again, got the right factor, but still the wrong answer. Let's try a prime:
Number to check is 7
Trying factor 2
2 is not a factor.
Trying factor 3
3 is not a factor.
Trying factor 4
4 is not a factor.
Trying factor 5
5 is not a factor.
Trying factor 6
6 is not a factor.
Number is not prime.
Aagh! Obvious - the final test is the wrong way round. Just fix that, remove that System.err.println()s and we're done.
Sylvia.

Consider this program that tests whether a number is
prime.
[attempt to divide by each integer from 2 to n-1]At risk of lowering the signal to noise ratio, I
should point out that the algorithm given is just
about the worst possible.
I know that the point was to illustrate debugging
and not good prime test algorithms, and I disagree
with the correspondent who thought the post was
condescending.
Anyway, the java libraries have good prime testing
methods based on advanced number theory research that the
non-specialist is unlikely to know. Looking at the java
libraries first is always a good idea.
Even with the naive approach, dramatic improvements
are possible.
First, only try putative divisors up to the square root
of the number. For 999997 this is about 1000 times faster.
Next only try dividing by prime numbers. This is about
7 times faster again. The snag, of course, is to find the
prime numbers up to 1000, so there might not be much
advantage unless you already have such a list. The sieve
of Erastosthenes could be used. This involves 31 passes
through an array of 1000 booleans and might allow an
improvement in speed at the expense of space.
Sorry if I've added too much noise :-)

Similar Messages

  • What to do when Outlook AutoArchive doesn't work

    AutoArchive feature helps us manage the space in the mailboxes or on the e-mail server that were are using by automatically moving items to an archive location. These items can be Email messages, Calendar items, Tasks, Notes, Journal entries.
    However, sometimes some users may find that Outlook AutoArchive doesn’t work as expected, this can be frustrating. In this article I’ll introduce some steps to troubleshoot this issue, I hope it will be helpful to those who meet the issue.
    Always check the Default AutoArchive settings first
    When AutoArchive is not working properly, the first thing we should do to troubleshoot the issue, is to make sure the AutoArchive setting is correct.
    I’ll take Outlook 2013 for example, go to FILE tab -> Options -> Advanced -> AutoArchive -> AutoArchive Settings… button, we will see the AutoArchive window below:

    To make AutoArchive work, make sure the first checkbox has been selected and you have configured how frequently you want AutoArchive to run.

    If you select “Prompt before AutoArchive runs”, it will notify you before AutoArchive runs.

    If you want to delete expired items, select “Delete expired items (e-mail folders only)”.

    You should select “Archive or delete old items”, or only expired items will be deleted.

    Select “Show archive folder in folder list” to let the archive.pst appear in the folder list, which helps you find archived items easily.

    You can set the age of the items that you want to archive in the field of “Clean out items older than x”, the age is based on the last Modified date by default. I’ll introduce this later in this article.

    Then you need to decide whether to move old items to an archive .pst file, or permanently delete old items. Once you have your choice, you can apply these settings to all folders now and click OK to save the settings.
    AutoArchive doesn’t work on one specific folder?
    Apart from the default settings, each folder can be set with its own AutoArchive settings different from the global settings.
    Right click on the folder and select Properties -> AutoArchive tab.

    You can select “Do not archive items in this folder” if you want this folder to be an exception of AutoArchive.

    If you select “Archive items in this folder using the default settings”, you will archive items in this folder using the default settings as it states, and the “Default Archive settings” button below is referring to the same AutoArchive
    window as FILE -> Options -> Advanced -> AutoArchive -> AutoArchive Settings.

    If you want the AutoArchive settings for this folder to be different from the Default AutoArchive settings, select “Archive this folder using these settings”. The age of items can be set to a different one, you can even select a separate
    .pst file to archive items in this folder. After everything is decided, click OK to save the settings.
    Please note these settings are specific to each folder and are not applied to subfolders. Please configure the settings individually for each folder.
    Modify the ArchiveIgnoreLastModifiedTime registry value
    Outlook archive works based on the last modified date and time by default, if you
    reply, forward, move, edit, save, import an item, the modified date will change, this may cause the AutoArchive not to archive the item.
    If you want to let Outlook to archive items based on the received date, you need to set the ArchiveIgnoreLastModifiedTime registry value.
    Since serious problems might occur if you modify the registry incorrectly, please back up registry in Windows first:http://windows.microsoft.com/en-US/windows7/Back-up-the-registry
    To create the ArchiveIgnoreLastModifiedTime registry value, follow these steps:
    Press Win + R to start Run, type
    regedit in the Open box, and then click OK.
    Locate and then click the following registry subkey:
    HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Outlook\Preferences (Outlook 2010)
    HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\Outlook\Preferences (Outlook 2013)
    On the Edit menu, point to New, click
    DWORD Value, type ArchiveIgnoreLastModifiedTime, and then press ENTER.
    Right-click ArchiveIgnoreLastModifiedTime, and then click
    Modify.
    In the Value data box, type 1, and then click
    OK.
    Exit Registry Editor and restart Outlook to make the registry take effect.
    Once the registry key is added, check if Outlook archives the items properly. We can try manually archiving:
    Go to FILE tab -> Info -> Cleanup Tools -> Archive, select the folders that you want to archive and archive criteria, click OK. Outlook should then archive the items based on the received date.
    The Archive .pst file
    As the Archive storage file, the .pst file may cause AutoArchive not working issue. If the .pst file is corrupted or too large, AutoArchive may not work as expected.
    Scanpst.exe is an Inbox repair tool to fix Outlook Data Files like .ost and .ost files, it can be used to fix a corrupted .pst file. To find Scanpst.exe, browse to the locations below:
    For Outlook 2013 on a 32-bit version of Windows:
    <disk drive>\Program Files\Microsoft Office 15\root\office15
    For Outlook 2013 on a 64-bit version of Windows:
    <disk drive>\Program Files(x86)\Microsoft Office 15\root\office15
    For Outlook 2010 on a 32-bit version of Windows:
    <disk drive>:\Program Files\Microsoft Office\Office14
    For Outlook 2010 on a 64-bit version of Windows:
    <disk drive>:\Program Files\Microsoft Office(x86)\Office14
    When the tool is opened, type the path and the file name of the .pst file or click Browse to locate the file by using the Windows file system, and then click Start.
    More details about the tool can be found in this kb below:
    How to repair your Outlook personal folder file (.pst)
    http://support.microsoft.com/kb/272227/en-us
    Another scenario is the .pst file is full. For Outlook 2003 and Outlook 2007 the default limit is 20GB and for Outlook 2010 and Outlook 2013 the limit is 50GB.
    You won’t be able to add items to the archive .pst file when the file reaches 19GB or 47.5GB, once the .pst file gets too large, I suggest you create a new .pst file to archive the items.
    One more thing to remember, don’t store the .pst file on the network share, which we always reminder our users of.
    Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.

    Consider this program that tests whether a number is
    prime.
    [attempt to divide by each integer from 2 to n-1]At risk of lowering the signal to noise ratio, I
    should point out that the algorithm given is just
    about the worst possible.
    I know that the point was to illustrate debugging
    and not good prime test algorithms, and I disagree
    with the correspondent who thought the post was
    condescending.
    Anyway, the java libraries have good prime testing
    methods based on advanced number theory research that the
    non-specialist is unlikely to know. Looking at the java
    libraries first is always a good idea.
    Even with the naive approach, dramatic improvements
    are possible.
    First, only try putative divisors up to the square root
    of the number. For 999997 this is about 1000 times faster.
    Next only try dividing by prime numbers. This is about
    7 times faster again. The snag, of course, is to find the
    prime numbers up to 1000, so there might not be much
    advantage unless you already have such a list. The sieve
    of Erastosthenes could be used. This involves 31 passes
    through an array of 1000 booleans and might allow an
    improvement in speed at the expense of space.
    Sorry if I've added too much noise :-)

  • What to do when your iphone camera isnt working?

    My phone camera screen never works, I turn on the app and its a black screen and then it just eventually freezes. Sometimes the front camera works but never the back and its random because it was working this morning but it wont work now. other apps like snapchat that involve the camera also aren't working and I don't know how to solve this problem...

    Try resetting your phone. Press and hold the Home and Sleep button for 10 seconds or so until the Apple logo appears.
    If that doesn't work restore your phone to new but not from a backup. Use iTunes to restore your iOS device to factory settings
    If that does't solve the problem then it's likely a hardware issue. Make an appointment at an Apple store and have it examined.

  • How to disable switch control when your Siri doesn't work.

    There's alot of people who managed to turn their switch control off by Siri or by triple click. How ever I disabled my Siri and was stuck at lock screen with no screen feedback. Went thru alot of online remedys and all didn't work. I'm sure there are a few who had this problem. So what I did was -
    i hold home and power button to off my i pad. Then turn it on again. (When it just loaded to main screen you will have a few sec before switch control works again. )So when you are in main screen , triple click  to get the accessibility box and off switch control. By tapping on the option. It worked for me. Hope it works for you. The Internet don't have much to help ref switch control which is irritating. Hope this post helps.

    I am so sorry for sending the same thread for so many times, there is a problem with my brower.

  • How to find apple ID when your email doesn't work

    Can anyone assist - I"m overseas and I have limited access to any of normality of getting things sorted
    I lost my iphone5, however I can't remember my apple ID to access find my iphone app - I've tried to use apple to find my account but none of my email address work in locating me.. can anyone offer help?

    See this
    Apple ID: How to find your Apple ID

  • HT4259 I have been trying for hours to extend my Extreme Gen 5 network with an Express Gen 2.  But no matter what I do or try, it doesn't work.  What does happen is my internet gets block somehow when the Express looks like it's set up and 'green' - no in

    I have been trying for hours to extend my Extreme Gen 5 network with an Express Gen 2.  But no matter what I do or try, it doesn't work.  What does happen is my internet gets blocked somehow when the Express is online and looks like it's set up perfect and 'green' - but no internet connection for anything even though the Extreme is green and the modem is good.  Once I disconnect the Express, everything is good again.
    I've tried LAN, WAN, though a switch, direct connect, Extreme set to Extend the network, the Express set to be an extension.  Most of the time I get an error trying to update the Express.  But when it seems to be set up perfect, the entire house can't get to the internet.  Just when it looks right, it is so wrong.
    If anyone can give me exact steps (e.g., "...from the Base Station menu, select the Restore Default Setting option" vice "...just restore the defaults..."), I would greatly appreciate it.  I'm left to the conclusion that the Express is faulty.  I've been using Airport Utility 6.2 from Mountain Lion on one computer and Airport Utility 5.6.1 from Snow Leopard on another computer (the latter give more control while the former just want you to 'forget' the Express).

    I finally got it working.  I was trying to set it up ethernet.  My biggest mistake was when the new Express came on, I did not select 'Continue' - I went straight to manual thinking that I would get the most setup options in manual mode.  So everything I initially tried always resulted in 'wireless'.  Even when I would update or restore default settings, the Express would not completely restart. Or sometimes I would get an error. So most of the time I had to unplug it.  So when it came back up, none of my changes were retained. But there were a lot of times when everything was green and appeared to be fine. But anytime the ethernet cable was plugged in, no more internet.
    So here's the weird part.  When I finally tried 'continue' (vice manual), I would get 4 options.  One would be 'ethernet' extended.  So I would select it, it gave me green lights, all looked good, and still the same problem.  This is when I got frustrated.  I thought I had exhausted all possible combinations.
    But somehow when trying continue again after another restore, I only got 3 options.  One was the same ethernet extended option (can't remember what the missing 4th one was).  And this time it worked - it gave me the big green circle with the checkmark saying it was successful.  I don't know what I did different, but I know now that it won't work if 4 options come up to choose from.  It will work if only 3 options come up.  And success if only verified by the big checkmark.  Had anyone anywhere said the checkmark declaring success is validation, then maybe I wouldn't have gone down so many rabbit holes thinking it should have been successful.
    As for which Airport Utility I prefer, 6.2 looks nice, but it would just ignore the Express and would want me to 'forget' it and would not let me edit it.  Airport Utility 5.6.1 was the one that I ended up using the most and finally had success with.  It still strikes me as odd that there is no manually way to pick ethernet, it can only be choosen following a 'restore defaults', and only from the 3-option list (the 4-option list had the same ethernet choice, but it no worky).
    Thanks for the response.  I really do appreciate it.
    Aiport Extreme Gen5 - internet access and router
    Airport Express Gen2 - connected via ethernet, extending my wireless
    - configured while connect directly to the Extreme, but now on a switch (16-port hub)
    Using Airport 5.6.1
    1) Restore Defaults from Base Station menu
    2) Following restart, Select Continue
    3) Of the 3 option presented, select 'ethernet.... extend network...'
      - if 4 options are present, may not work
    4) Wait for the green circle with the big white checkmark.
    5) Connected Express to the switch where a cable went to other end of house - works.
    Dead-zone went from 2mbps to 24mbps.
    I probably spent 4 hours chasing my tail in anger.  The correct way took about 5 minutes total.
    Thanks again.

  • What happens when your lock button stops working?

    what happens when your lock button stops working?

    The world end.
    Seriously, nothing "happens". 
    are you asking how to fix it?  If so, why don't you just ask?

  • When forced quit doesn't work???

    What do I do when forced quit doesn't work?? This happens occasionally when something freezes, like Logic did today. I force quit, and wait... and wait... and nothing happens. I try and restart and it keeps coming up with the same window: Logout timed out, please force quit to continue or cancel.
    Anyways I hit force quit over and over and nothing happens. I resolve to holding the button and manually restarting the computer. How can I get this thing to force quit?!!
    - All updated
    - Repaired permissions
    - Repaired disk (nothing was wrong anyways)

    Funny you should ask as I had the EXACT same problem this afternoon.
    I had to do a hard restart.
    But, then I got the gray spinning startup.
    So, I had to restart from my backup drive (thank you SuperDuper!).
    Then, 5 minutes later my internal hard drive reappeared.
    Then, I restarted from my internal drive.
    I had this problem in April (I took notes) and Apple replaced my hard drive.
    Your mileage may vary.

  • SAPGUI login scripting program doesn't work.

    I used a program which is called for sap login through local SAPGUI.
    I call this program, then sapgui is called and then ID and PW is filled with existing value.
    It worked well. however, we upgrade SAP frrom R/3 4.7 to ECC 6.0 and SAPGUI version is also changed.
    after uprading, my program doesn't work.
    although sapgui version is changed, my program can login R/3 4.7 server. but my program can't login ECC 6.0 server.
    In case of ECC 6.0 server, my program can call SAPGUI. however, it can't fill the ID and PW. so it cant login.
    I can't get the source of my program because I received only execution file.
    Can you suggest any solution? such as, change the dll file.
    Plz give me the solution!!!.

    Dear J-Philippe,
    I'm just getting started with SAP GUI Scripting through the COM interface and I seem to be running into the same issue.
    You seem to be referring to a work-around mentioned in the README (#4). I don't know where the README is located, could you (or somebody else) please post the work-around or the README or location thereof?
    By the way, here's the code I'm running (it's Python):
    import win32com.client
    wrapper = win32com.client.Dispatch("SapROTWr.SapROTWrapper")
    sap_gui = wrapper.GetROTEntry("SAPGUI")
    application = sap_gui.GetScriptingEngine
    connection = application.FindById("con[0]") # returns /app/con[0]
    session = connection.FindById("ses[0]") # throws exception
    The last statement fails with an exception "The control could not be found by id".
    When I use connection.Children(0) instead I get the exception "The enumerator of the collection cannot find an element with the specified index"
    Same results when using SapGui.ScriptingCtrl.1.
    Thanks!
    Edited by: brucevdk on Jan 31, 2011 7:51 PM
    I found the mentioned SAP note 1526624 somewhere (I don't yet have access to the official resource) and it made me think that perhaps I'm not dealing with the same issue. I'm also not sure what CreateObject is and if it's similar to the Dispatch functionality above (I'm just getting started with COM Programming). I'll play around with the recorder at work tomorrow to see if scripting works at all.

  • Firefox stopped updating a while ago for unknown reason;now stuck at v 2.0.0.20-- trying to manually update from your site doesn't work.

    Firefox stopped updating a while (couple of years) ago for some unknown reason. The button is checked for automatic updates. It was a while before I noticed, so now I've been stuck at v 2.0.0.20 for some time, and trying to manually update from your site doesn't work.
    No update available will work, since I missed some. I can't even see what most of the buttons are on these pages of your site. Do I need to reinstall Firefox, as some people have suggested to me, and if so, how do I go about doing that? I'm not particularly computer program savvy.
    Thanks,
    Taav

    Which version of Mac OS are you running?<br />
    Is that a OS X 10.2 or 10.3 version?<br />
    The last Firefox version that works on OS X 10.2 and 10.3 is 2.0.0.20.
    *https://ftp.mozilla.org/pub/mozilla.org/firefox/releases/2.0.0.20/mac/en-US/
    The last Firefox version that runs on Mac OS X 10.4 is Firefox 3.6.28.
    *https://ftp.mozilla.org/pub/mozilla.org/firefox/releases/latest-3.6/
    *http://www.mozilla.org/en-US/firefox/3.6.28/system-requirements/
    Current Firefox versions require a Mac with an Intel processor and OS X 10.6 (Firefox 16 runs on Intel Mac OS X 10.5).
    *http://www.mozilla.org/firefox/23.0/system-requirements/
    For an unofficial Firefox 17.0.8 ESR compatible version that runs on a PowerPC Mac with OS X 10.4.11 or OS X 10.5.8 you can look at TenFourFox.

  • What happened to online text..doesn't work anymore

    what happened to online text..doesn't work anymore since they upgraded their website

    i know you can send text messages through your email...just like a regular email all you do is send it to [email protected] dont use a subject just use the body of the email and its easiest to keep them short..i would do a test one to your phone first just so you see how it looks. hope that helps

  • When Apple Care Doesn't Work

    Has anyone had problems getting something solved through Apple Care technical support? This is the second time for me with this computer. Last time, over a year ago, they finally paid to have it put in the shop. I've been dealing with them with this issue since November. Two regular level and two specialists have tried to help me. We've done all of the regular stuff, making more room on the hard drive, resetting the PRAM, taking stuff off and reinstalling the system software. The last was done on Friday. I'm still having problems. It totally freezes up at odd times. Sometimes there are black lines across the screen. It is now (since the reinstall) not recognizing my external hard drive and saying it can't open itunes. I'm so frustrated! Not only do my kids need the computer for homework, but I have a part-time home business and need to print shipping labels etc. as well as look up information related to my business. Any suggestions? I've had Macs almost since they came out and this really makes me want to get a PC. I realize they can have problems, too, but at least they are cheaper.

    "Will Apple keep making updates to 10.4"
    That final version update of Tiger is 10.4.11.
    "Should I buy 10.5? It's been my feeling that since this particular computer has had so many problems I shouldn't spend any more money on it unless I am convinced it will continue working well (or begin working well) for a while. " I wouldn't think it would be advisable to upgrade to Leopard until your Mac is stable.
    "Re: When Apple Care Doesn't Work
    Posted: Mar 1, 2009 9:35 PM
    Robert,
    Unfortunately we don't have an Apple store here. I hear there may be one soon. There are various people who contract with Apple to do repairs, so maybe I need to go to one of those. The question, then, is, how do I get Apple to pay. Since my computer is still under Apple Care and since I've had extended problems with it, they should, right?
    Carolyn,
    I didn't list all of the things that have been tried on it in the past four months...hard to remember. I had done the disk utility probably twice before. I did update to 10.4.11, as you suggested. How does this work with updating? Will Apple keep making updates to 10.4 even though they have 10. 5 out? Should I buy 10.5? It's been my feeling that since this particular computer has had so many problems I shouldn't spend any more money on it unless I am convinced it will continue working well (or begin working well) for a while.
    I didn't understand all of your directions. I found the disk utility, although it wasn't listed under the finder menu bar. I" There is a Disk Utility application on your hard drive. Applications/Utilities.
    "Were you suggesting running disk utility on the install disk? " Yes!
    " There wasn't anything to select anywhere that said Utilities/Startup Disk. " Ok, when you boot from your restore disk, you hold down the C key until you see the Apple logo on your screen. An Installer window will open. Do not proceed with any installations. Instead, from the Menu Bar (very top of your screen), select Utilities/Startup. That will open the window where you can then select your MacintoshHD 10.4 icon and click Restart. Without doing this, your Mac doesn't know disk to boot from.
    "Sorry, it's been a rough week. Maybe I'm not understanding something obvious." No problem. Sometimes you just have to sit back and take a deep breath, or call it a night and work on it in the morning. I understand ... these tasks can be daunting at times.
    Carolyn

  • What to Do When Your iPad is Not Charging?

    When you first bought your iPad, did you plug it into your PC and become frustrated when you discovered that it wouldn’t take a charge? Were you disappointed to discover that the iPad doesn’t charge through PCs and you have to plug it into the wall to get it to work? Most newer Mac computers (2008 and later) will charge the iPad. However, those of us who have a Mac are not immune to the trials and tribulations of the “Not Charging” message that can appear without warning. For anyone who has experienced, or will experience the “Not Charging” message on their iPad, we have a couple of suggestions.
    A couple of weeks ago, I got a “Not Charging” message on my iPad when I plugged it into the 10 watt USB 2.0 power adapter that was plugged into my wall. Surprised by this development, I assumed there was something wrong with my plug and took my third-generation iPad to my office, where I plugged it into my computer and got the same message. “Oh, no,” I thought. Something is wrong. If this has happened to you, don’t worry. Nine times out of 10, there is nothing wrong. You just need to do a little trouble-shooting.
    First of all, only plug your iPad into a PC if it is absolutely necessary. It will take hours to fill the battery up and you have to leave it in sleep mode (the iPad, that is). You see, even though your iPad may have a “Not Charging” message, it is charging. It is just doing it very slowly. In a pinch, leave your iPad plugged in, even if you don’t think it is getting a charge. You’ll at least increase the percentage a little.
    If you have plugged your iPad into something that has previously worked to charge it, there are a few things to check out before making your Genius Bar appointment. The first, and most obvious is to make sure the power adapter is a 10 watt charger. The iPad, especially the third-generation one, will not charge with anything less than 10 watts. Next, make sure the iPad is properly plugged in (I know it sounds patronizing, but you’d be surprised at how often the problem is just an unplugged power source). Check the connection from the wall to the plug and the plug to the iPad. If you are sure that everything is as it should be, try another socket, and then try another cord. Lastly, plug another Apple device into the same cord. If you’re iPhone charges, but your iPad doesn’t, there may be a problem.
    Once you’ve determined that it is not your power adapter, try turning your iPad on and off again. To shut your iPad down, hold the “Home” button and “Sleep” button at the same time for a couple of seconds. When the slider bar appears, slide to shut down the iPad. Wait 30 seconds and turn it back on by holding the Home and Sleep buttons at the same time. When the iPad is back online, plug it in again to see if that fixed the problem.
    If you have been able to charge your iPad from your Mac previously, but are suddenly faced with the “Not Charging” message, when you plug it into the computer, check your connection first. Then, make sure the USB cord that you are trying to charge your iPad with is plugged directly into the Mac. Don’t plug the cord into a multi-cord hub that is plugged into the computer or the USB port on the keyboard. The iPad needs a lot of juice. If it is plugged into some third-party source, it may not send the amount of juice needed to charge the device.
    If your USB cord is plugged directly into the computer and you still see the message, try blowing air into the iPad’s dock connector. You could also use a folded piece of paper to loosen dust particles. You should also make sure that none of the docking pins are broken. Those tiny little pieces of metal can be snapped off very easily.
    There have also been some known issues with external 30-pin devices being plugged into the iPad that cause it to malfunction for a short period of time. For example, if you have recently used the iPad camera adapter, it may cause the device to charge improperly. The best way to remedy that is turning your iPad on and off again. However, sometimes, you just have to wait for it to clear out.
    Just to summarize, here are some of the things that may be causing your iPad to show a “Not Charging” message:
    Wall socket is bad
    Not using a 10-watt power adapter
    10-watt power adapter is bad
    USB 2.0 cord is bad
    Device is plugged into a PC
    Device is plugged into a multi-port USB hub or instead of directly into the Mac
    Dock connector is dusty
    Docking pin is broken
    Device was recently used in conjunction with camera adapter.

    Thanks for sharing it! great!

  • SignalExpr​ess program doesn't work when reloaded

    I am new to SignalExpress and am trying to do a simple program in as a example to show a customer how to use a USB-6008 as a device to control and measure one of their devices.  I am using digital outputs and they work correctly when I first enter and run the program.  However if I exit and reload the same program, any "digital port output" blocks that precede a "Sequence" block fail to correctly output a "1".  My sequence blocks have "allow hardware reuse" checked (so I can flip the same bits in different parts of the program).
    I can tell when a "digital port output" block isn't going to work correctly by turning on the "preview" pane for it.  If the "Value to Write" box is "High" this pane should show a filled radio button.  This is set correctly when I first create the block.  But if I close SignalExpress and reload the program this radio button will not be filled, and the USB-6008 won't correctly set the output to a "1".
    If I manually set the output control to "0" and then back to "1", then the radio button will be filled again, and the program will work correctly again.
    At first glance this appears to be a bug.  Any help or suggestions appreciated.  A copy of the SignalExpress VI and screen snapshots is attached.  Thanks.
    Chuck
    When it works correctly (note radio button near top is filled):
    When it doesn't work correctly (note all setttings are the same but radio button near top is empty):
    This shows a snapshot of the Sequence block:
    Attachments:
    SignalExpress_Digital_Problem.zip ‏238 KB

    Thanks for looking at this.  Sorry about the duplicate post, but I realized I had put it in the wrong place and couldn't figure out how to delete it from the first string.
    I was using the Sequence blocks so that I could set a digital line high, wait for 30 ms, set it low, and then make an ADC measurement and a limit test.  Then if that passed other patterns would be generated.  When I tried to do this is seperate blocks I was told I couldn't use the same resource without using the Sequence block with resource sharing turned on.  That was why I added the Sequence block.
    Chuck

  • What to do when your iPhone 6 has a small/tiny dot on the top of the screen?

    I just bought my new iPhone 6, but when i powered it up i noticed a small dot on the top of the screen, It left for one day, now its back.
    Does my warranty cover it and what will happen when I take it to get repaired?
    Will they fix it or replace it?
    Thanks

    If you say it was gone for one day, you may try resetting your device. This won't delete your data stored on the phone.
    Press and hold the Sleep/Wake button
    Press and hold on the Home button
    Keep holding both buttons until the display turns off and back on with Apple logo on it.
    Alternatively, you may go to Settings - General - Reset - Reset All Settings
    If this does not help, I believe you need to have your iPhone checked and repaired at your local Apple Store as it may be a hardware problem.
    Apple specialists will most likely fix your device.

Maybe you are looking for