Htmlagilitypack and httpclient using two foreach statements

Windows Phone 8.0 Silverlight App.
I have the following code in my MainPage.xaml.cs...
protected async override void OnNavigatedTo(NavigationEventArgs e)
base.OnNavigatedTo(e);
string htmlPage = "";
string htmlPage2 = "";
using (var client = new HttpClient())
htmlPage = await client.GetStringAsync(http://pg1);
htmlPage2 = await client.GetStringAsync(http://pg2);
HtmlDocument htmlDocument = new HtmlDocument();
htmlDocument.LoadHtml(htmlPage);
foreach (var div in htmlDocument.DocumentNode.SelectNodes("//div[starts-with(@id, 'p66acd000')]"))
GameDeals newGameDeals = new GameDeals();
newGameDeals.dealTitle = div.SelectSingleNode(".//h2//a").InnerText.Trim();
newGameDeals.dealCover = div.SelectSingleNode("(.//img)[1]").Attributes["src"].Value;
newGameDeals.dealPriceText = div.SelectSingleNode(".//a[@class= 'GExclusive']").InnerText.Trim();
newGameDeals.dealPriceGold = div.SelectSingleNode(".//span[@class= 'GPrice ProductPrice']").InnerText.Trim();
newGameDeals.dealPriceSilver = div.SelectSingleNode(".//span[@class= 'SPrice ProductPrice']").InnerText.Trim();
gameDeals.Add(newGameDeals);
lstGameDeals.ItemsSource = gameDeals;
HtmlDocument htmlDocument2 = new HtmlDocument();
htmlDocument2.LoadHtml(htmlPage2);
foreach (var div in htmlDocument2.DocumentNode.SelectNodes("//div[starts-with(@class, 'copyContainer')]"))
GameDeals newGameDeals = new GameDeals();
newGameDeals.dealTitle = div.SelectSingleNode(".//h4").InnerText.Trim();
newGameDeals.dealCover = div.SelectSingleNode("(.//img)[1]").Attributes["src"].Value;
lstGameDeals.ItemsSource = gameDeals;
I retrieve data from both pages, however, the contents of page2 do no get passed over to the lstGameDeals in my MainPage.xaml.  Am I able to use two foreach, or is there something else I am doing wrong here?
Thanks.
Keith

Hi Keith,
I cannot use your code snippet in windows phone 8 silverlight app. I cannot see HttpClient class in wp 8 silverlight project. Can you share a repro project for more information? Use your OneDrive and share a link here.
Regards,
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. Click HERE to participate
the survey.

Similar Messages

  • Hi. I just bought a macbook air and I use two languages every day.  How can I quickly move to another language while Im typing. Thanks

    Hi. I just bought a macbook air and I use two languages every day.  How can I quickly move to another language while Im typing. Thanks

    still doesnt work.. I already selected 2 languages.. but i can change it just with the mouse. There is no shortcut for macbook air. cmd space doesnt work.

  • Workflow Lightroom 5: Developing and printing using two computers

    Hi,  I use Lightroom 5 on my mac to catalog and process my images.  My printer, however, is stored offsite. It is a Canon Pixma 100 airprinter and I also have a pc at that location. My question is this: is it possible to set a print on a mac, then transfer it to a thumb drive, and insert the thumb drive in the pc at the other location in order to print?  Do I need to have Lightroom on the pc as well, or can I just use the Canon software and not lose printing functionality (templates, paper choice, etc).  Would Lightroom Mobile work here? Any assistance greatly appreciated!  Thanks in advance. 

    You're allowed two installs. They can't be used simultaneously.
    Probably the easiest way to share a catalogue between them is to put it and your images on an external hard drive. Plug it into the machine you're using. If you can use USB3 or eSATA or FireWire, you'll get better performance than with USB2.
    Hal

  • How to make a check and stub using print/println statements

    ok...after all the great help i've gotten from people here.
    i need some help, again :)
    i have to print out a paycheck and stub to look like this (it's on my clan's counterstrike forums because i can't find out how to host it on this site and i dunno my PW to photobucket)
    http://www.cause4alarm.net/index.php?showtopic=2436
    it should let anyone view it, if not tell me and i'll figure out somewhere to host it.
    i need to know how to print out the x's around the sections, and how to put the info into those specific areas....i'm kind of asking a lot, i know. You can point me to a link that explains this sort of stuff or do it for me (i'd REALLY like that lol) or explain it yourself, i don't care. i have 2 hours and 25 minutes until i would like to go to bed, but i can always stay up longer if need be. I'll be looking in my book and on google as well.

    Cant view the image b/c I am not a member of that forum.
    However, look into String's format() method. It's probly what you're lookin for to making print statements line up nicely however you want them.

  • How can I use two drop down lists for one time value?

    I want to enter the length of time that someone does an activity in hours and minutes using two drop down lists, then enter them as a single time value (H:i:s) in Mysql.
    I've used the basic drop down lists, and a few different variations of the following with no success (seconds is a hidden field with a value of "00"):
                           GetSQLValueString(strftime('%H:%i:%s', strtotime($_POST["sleeptimemin"]." ".$_POST["sleeptimehr"]." ".$_POST["seconds"])), "date"),
    This returns 00:00:16, no matter what is selected on the drop down list.
    Any help would be appreciated.

    MySQL stores times in human-understandable format, using the 24-hour clock.
    GetSQLValueString($_POST['sleeptimehr'] . ':' . $_POST['sleeptimemin'] . ':00', "date"),

  • How to modify an EXTERNAL_TABLE and MAPPING using OMBplus

    I need to implement a QA--> Production migration technique using OMB+ scripting. We are using source safe for keeping the MDL files.
    As we have insufficient resources both environments are in the same database as different schemas. Configuration is as below;
    Source Schema: DWPROD_TST (test) and DWPROD (production)
    Target Schema: DWEXTRACT_TST (test) and DWEXTRACT (production)
    Source Flat File Module: DWEXTRACT_TST_INPUT (test) and DWEXTRACT_INPUT (production)
    Target Flat File Module: DWEXTRACT_TST_OUTPUT (test) and DWEXTRACT_OUTPUT (production)
    All schemas have their own locations and modules defined. Once a mapping is create in TST environment developers should check in the individual
    mdl files for the object they used for development. From is point the strategy I have follow is like below as I haven't seen a similar scenario before.
    I rename the mdl extensiton .zip. I unzip the file. I take the mdx file extracted and make a text based search/replace for all the test environment modules, locations... etc
    replacing them with production environment names. Then I run the OMB+ script below in order to import and deploy this object. This technique works for table and flat file object
    with slightly different OMB+ scripts. But I can not make it work for external tables and mappings and the reason that I can guess is the Configuration information of the Data File used
    as source for external table and target for the mapping I have developed. I can import the MDX successfully but cant deploy it. When i rigt click the mapping or the external file in OWB GUI
    and click on CONFIGURATION I can see that:
    For the MAPPING : Flat File Operator/(OperatorName)/Target Data File Location is still pointing to TEST environment even tough I have replaced all the TEST environment information with PRODUCTION.
    For the EXTERNAL_TABLE : Data File/(OperatorName)/Data File Location is still pointing to TEST environment even tough I have replaced all the TEST environment information with PRODUCTION.
    Is there any way to modify these LOCATION information for a MAPPING and an EXTERNAL TABLE OMB+. I read though all OWB+ scripting Reference but it sucks or I am so dumb.
    Or if you have an alternative solution for my problem I will be more then happy to read it.
    OMB+ Script for EXTERNAL_TABLE
    OMBCONNECT DWPROD/DWPROD@cakir:1521:orcl USE REPOSITORY 'OWBDB_SYS'
    OMBIMPORT MDL_FILE 'C:\\tfs\\stage\\externaltables\\XTRCT_XTRNL_INPUT_FILE\\XTRCT_XTRNL_INPUT_FILE.mdx' USE UPDATE_MODE MATCH_BY NAMES OUTPUT LOG TO 'C:\\tfs\\stage\\externaltables\\XTRCT_XTRNL_INPUT_FILE\\XTRCT_XTRNL_INPUT_FILE.log'
    OMBCC 'MY_PROJECT'
    OMBCONNECT CONTROL_CENTER
    OMBCOMMIT
    OMBALTER LOCATION 'XTRCT_DWEXTRACT_LOC' SET PROPERTIES (PASSWORD) VALUES ('PASSWORD')
    OMBALTER ORACLE_MODULE 'XTRCT_DWEXTRACT' ADD REFERENCE LOCATION 'XTRCT_DWEXTRACT_LOC' SET AS DEFAULT
    OMBALTER ORACLE_MODULE 'XTRCT_DWEXTRACT' SET PROPERTIES (DB_LOCATION) VALUES ('XTRCT_DWEXTRACT_LOC')
    OMBCOMMIT
    OMBREGISTER LOCATION 'XTRCT_DWEXTRACT_LOC'
    OMBCOMMIT
    OMBREGISTER LOCATION 'DWEXTRACT_INPUT'
    OMBCOMMIT
    OMBCC 'XTRCT_DWEXTRACT'
    OMBALTER EXTERNAL_TABLE 'XTRCT_XTRNL_INPUT_FILE' SET REFERENCE DEFAULT_LOCATION 'DWEXTRACT_INPUT'
    OMBCOMMIT
    OMBCREATE TRANSIENT DEPLOYMENT_ACTION_PLAN 'DEPLOY_PLAN' ADD ACTION 'TABLE_DEPLOY' SET PROPERTIES (OPERATION) VALUES ('REPLACE') SET REFERENCE EXTERNAL_TABLE 'XTRCT_XTRNL_INPUT_FILE'
    OMBDEPLOY DEPLOYMENT_ACTION_PLAN 'DEPLOY_PLAN'
    OMBDROP DEPLOYMENT_ACTION_PLAN 'DEPLOY_PLAN'
    OMBCOMMIT
    OMBDISCONNECT
    OMB+ Script for the mapping
    OMBCONNECT DWPROD/DWPROD@cakir:1521:orcl USE REPOSITORY 'OWBDB_SYS'
    OMBIMPORT MDL_FILE 'C:\\tfs\\stage\\mappings\\XTRCT_PROTOTYPE_XTRCTFILE_000\\XTRCT_PROTOTYPE_XTRCTFILE_000.mdx' USE UPDATE_MODE MATCH_BY NAMES OUTPUT LOG TO 'C:\\tfs\\stage\\mappings\\XTRCT_PROTOTYPE_XTRCTFILE_000\\XTRCT_PROTOTYPE_XTRCTFILE_000.log'
    OMBCC 'MY_PROJECT'
    OMBCONNECT CONTROL_CENTER
    OMBCOMMIT
    OMBALTER LOCATION 'XTRCT_DWEXTRACT_LOC' SET PROPERTIES (PASSWORD) VALUES ('PASSWORD')
    OMBALTER ORACLE_MODULE 'XTRCT_DWEXTRACT' ADD REFERENCE LOCATION 'XTRCT_DWEXTRACT_LOC' SET AS DEFAULT
    OMBALTER ORACLE_MODULE 'XTRCT_DWEXTRACT' SET PROPERTIES (DB_LOCATION) VALUES ('XTRCT_DWEXTRACT_LOC')
    OMBCOMMIT
    OMBALTER LOCATION 'XTRCT_DWPROD_LOC' SET PROPERTIES (PASSWORD) VALUES ('PASSWORD')
    OMBALTER ORACLE_MODULE 'XTRCT_DWPROD' ADD REFERENCE LOCATION 'XTRCT_DWPROD_LOC' SET AS DEFAULT
    OMBALTER ORACLE_MODULE 'XTRCT_DWPROD' SET PROPERTIES (DB_LOCATION) VALUES ('XTRCT_DWPROD_LOC')
    OMBCOMMIT
    OMBREGISTER LOCATION 'XTRCT_DWEXTRACT_LOC'
    OMBCOMMIT
    OMBREGISTER LOCATION 'XTRCT_DWPROD_LOC'
    OMBCOMMIT
    OMBREGISTER LOCATION 'DWEXTRACT_INPUT'
    OMBCOMMIT
    OMBREGISTER LOCATION 'DWEXTRACT_OUTPUT'
    OMBCOMMIT
    OMBCC 'XTRCT_DWEXTRACT'
    OMBCREATE TRANSIENT DEPLOYMENT_ACTION_PLAN 'DEPLOY_PLAN' ADD ACTION 'MAPPING_DEPLOY' SET PROPERTIES (OPERATION) VALUES ('CREATE') SET REFERENCE MAPPING 'XTRCT_PROTOTYPE_XTRCTFILE_000'
    OMBDEPLOY DEPLOYMENT_ACTION_PLAN 'DEPLOY_PLAN'
    OMBDROP DEPLOYMENT_ACTION_PLAN 'DEPLOY_PLAN'
    OMBCOMMIT
    OMBDISCONNECT
    Kind Regards,
    Emrah
    Edited by: cakire82 on Jul 29, 2009 12:57 PM

    If it helps, this is a chunk from a script I have which turned off the parallel loading hint on all targets in a given mapping which was required after we discovered that ANSI cross joins and parallel query do NOT work very well in Oracle 10.
    You can see that I OMBRETREIVE all table operators and then use a foreach loop to cycle through them.
    log_msg LOG  "Altering: $mapName"
    set tablist [OMBRETRIEVE MAPPING '$mapName' GET TABLE OPERATORS ]
    foreach tgt_tble $tablist {
        if [catch { set retstr [ OMBALTER MAPPING '$mapName' MODIFY OPERATOR    '$tgt_tble' SET PROPERTIES (LOADING_HINT) VALUES ('NOPARALLEL ("$mapName")')] } errmsg] {
            log_msg ERROR "Unable to set hint for table $tgt_tble of mapping $mapName "
            log_msg ERROR "$errmsg"
        } else {
            set print [ exec_omb OMBCREATE TRANSIENT DEPLOYMENT_ACTION_PLAN 'DEPLOY_PLAN' ADD ACTION 'MAPPING_DEPLOY' SET PROPERTIES (OPERATION) VALUES ('CREATE') SET REFERENCE MAPPING '$mapName' ]
            if [omb_error $print] {
                 log_msg ERROR "Unable to create Deployment plan for '$mapName'"
            } else {
                  set print [ exec_omb OMBDEPLOY DEPLOYMENT_ACTION_PLAN 'DEPLOY_PLAN' ]
                  if [omb_error $print] {
                      log_msg ERROR "Error on execute of Deployment plan for '$mapName'"
            OMBDROP DEPLOYMENT_ACTION_PLAN 'DEPLOY_PLAN'
            OMBCOMMIT
    }Ignore the exec_omb function as this is just a wrapper I built for OMB+ commands.
    As to passing parameters, look into argc and argv:
    if { $argc > 0 } {
         set i 1
         foreach arg $argv {
              puts "argument $i is $arg"
              incr i
      } else {
         puts "no command line argument passed"
      }You can also write interactive scripts if you prefer too. From earlier in the script above which turned off the parallel hint:
    puts ""
    puts -nonewline "Which mapping do you want to set to NOPARALLEL? "
    set mapName [gets stdin]I've even done loops to allow the user to perform the operation on multiple mappings, and to use pattern matching to determine which mappings to alter:
    set doLoop "1"
    while { [string match "1" $doLoop] } {
        puts -nonewline "What mapping to reconfigure (use name of generated plsql package)? "
        flush stdout
        set mapName [ string toupper [gets stdin] ]
        puts -nonewline "What value do you want to set as the maximum allowed errors? "
        flush stdout
        set eValue [gets stdin]
        set mapList [OMBLIST MAPPINGS '.*$mapName.*']
        if { [llength $mapList] == 0 } {
           log_msg ERROR "No mappings matching search string $mapName"
        } else {
            foreach mName $mapList {
                 puts -nonewline "Update mapping $mName (y/n)? "
                 flush stdout
                 set doThisUpdate [string toupper [gets stdin]]
                if { [string match "Y" $doThisUpdate ] } {
                    if [catch { set retstr [ OMBALTER MAPPING '$mName' SET PROPERTIES (MAXIMUM_NUMBER_OF_ERRORS) VALUES ( '$eValue')] } errmsg] {
                        log_msg ERROR "Unable to modify max errors on Mapping $mName"
                        log_msg ERROR "$errmsg"
                    } else {
                        set print [ exec_omb OMBCREATE TRANSIENT DEPLOYMENT_ACTION_PLAN 'DEPLOY_PLAN' ADD ACTION 'MAPPING_DEPLOY' SET PROPERTIES (OPERATION) VALUES ('CREATE') SET REFERENCE MAPPING '$mName' ]
                        if [omb_error $print] {
                            log_msg ERROR "Unable to create Deployment plan for '$mName'"
                        } else {
                            set print [ exec_omb OMBDEPLOY DEPLOYMENT_ACTION_PLAN 'DEPLOY_PLAN' ]
                            if [omb_error $print] {
                                log_msg ERROR "Error on execute of Deployment plan for '$mName'"
                        exec_omb OMBDROP DEPLOYMENT_ACTION_PLAN 'DEPLOY_PLAN'
                        exec_omb OMBCOMMIT
                } else {
                    log_msg LOG "Skipping update to mapping $mName"
        puts -nonewline "Do Another? (y/n) "
        flush stdout
        set doAnother [gets stdin]
        if { [string match "Y" [string toupper $doAnother] ] } {
            log_msg LOG "User requests more updates"
        } else {
            set doLoop "0"
    }Anyway - there is lots that you can do to parameterize script or make them interactive. Just spend a bit of time working through a couple of TCL tutorials and you'll be well on your way.
    +(Note: script chunks have been edited for clarity of the main point I wanted to illustrate and may contain missmatched braces or other syntax problems.)+

  • How to move node in treeView using two buttons ?

    Hello ,
    Am starter , and am working on a Winforms application.
    I browse an XML file , then I populate treeview in my interface. I want to move selected node in the two sens ( up and down)  using two button ( so not with events , normal drag and drop with mouse ) .
    - I select the nod 
    - I click on the up button , then the node take the new place ( something like , drop and insert maybe )
    I don't know if is possible to affect this events to button or they are another way to do this 
    this is my code concerning populating treeView :
    private void browseSourceFileBtn_Click(object sender, EventArgs e)
    var openSourceFile = openSourceFileDialog.ShowDialog();
    if (openSourceFile == DialogResult.OK)
    fichierSourcePath.Text = openSourceFileDialog.FileName;
    // Connect the XML FILE DATABASE to the application interface
    private void button1_Click(object sender, EventArgs e)
    if (openSourceFileDialog.FileName == String.Empty)
    MessageBox.Show("u should open a file", "Erreur de chargement", MessageBoxButtons.OK, MessageBoxIcon.Error);
    else
    try
    MessageBox.Show("plz wait ");
    statusLabel.Text = "Début de chargement du fichier";
    var doc = new XmlDocument();
    doc.Load(openSourceFileDialog.FileName);
    sourceTreeView.Nodes.Clear();
    var rootNode = new TreeNode(doc.DocumentElement.Name);
    sourceTreeView.Nodes.Add(rootNode);
    sourceTreeView.CheckBoxes = true;
    sourceTreeView.AllowDrop = true;
    DateTime starteTime = DateTime.Now;
    BuildNode(doc.DocumentElement, rootNode);
    DateTime endTime = DateTime.Now;
    TimeSpan duree = endTime - starteTime;
    sourceTreeView.ExpandAll();
    sourceTreeView.Nodes[0].EnsureVisible();
    string chargementTemps = "" + duree.Minutes + "min : " + duree.Seconds + "s : " + duree.Milliseconds + "ms";
    statusLabel.Text = "Chargement effectué avec succés en :" + chargementTemps;
    catch (Exception)
    sourceTreeView.Nodes.Clear();
    statusLabel.Text = "Echec de chargement";
    thanks u a lot 

    Hi Nico68er,
    According to your description, you'd like to move up or down the node in TreeView.
    By reseraching, I found this post in StackOverFlow is similar with your issue.http://stackoverflow.com/questions/2203975/move-node-in-tree-up-or-down
    From this answer.
    You can use the following extensions
    public static class Extensions
    public static void MoveUp(this TreeNode node)
    TreeNode parent = node.Parent;
    TreeView view = node.TreeView;
    if (parent != null)
    int index = parent.Nodes.IndexOf(node);
    if (index > 0)
    parent.Nodes.RemoveAt(index);
    parent.Nodes.Insert(index - 1, node);
    else if (node.TreeView.Nodes.Contains(node)) //root node
    int index = view.Nodes.IndexOf(node);
    if (index > 0)
    view.Nodes.RemoveAt(index);
    view.Nodes.Insert(index - 1, node);
    public static void MoveDown(this TreeNode node)
    TreeNode parent = node.Parent;
    TreeView view = node.TreeView;
    if (parent != null)
    int index = parent.Nodes.IndexOf(node);
    if (index < parent.Nodes.Count -1)
    parent.Nodes.RemoveAt(index);
    parent.Nodes.Insert(index + 1, node);
    else if (view != null && view.Nodes.Contains(node)) //root node
    int index = view.Nodes.IndexOf(node);
    if (index < view.Nodes.Count - 1)
    view.Nodes.RemoveAt(index);
    view.Nodes.Insert(index + 1, node);
    Child nodes will follow their parents.
    You could use this class in your program.
    If you want to move the node up. Call the Extensions.MoveUp(this.treeView1.SelectNode)
    private void button1_Click(object sender, EventArgs e)
                if (this.treeView1.SelectedNode != null)
                    Extensions.MoveUp(this.treeView1.SelectedNode);
    If you have any other concern regarding this issue, please feel free to let me know.
    Best regards,
    Youjun Tang
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Two collect statement from internal table

    Dear Experts,
    I want populate values to two internal tables from a internal table.
    can i use two collect statement for different internal table from a single internal table.
    advise please.
    Thanks in advance.
    R.Rajendran

    hi there....
    well u can very well use this thing.....
    use the two colect statements inside the loop which u will use  to read the records of the input table.
    hope it helps.
    do reward if it does.

  • It is possible to use two different accounts with a single Windows PC?

    My wife and I use two personal iPhone 5, with two different appleID. At home we only have a windows 7 PC connected via iCloud with my iPhone 5 and my iPad (with the same appleID). I wish I could also connected the iPhone 5 to my wife, but i can't do it! It is possible? If it is, how should I do? I installed the program iCloud accepts only one appleID...
    Thank you in advance who can help me!

    Setup 2 user accounts on your PC, one for your wife and one for you. Enter the relevant Apple ID into each user user account.

  • WAE 611-k9: how to config primary and backup for two WAE611s?

    hi,everyone:
    I want to config two WAE611 AS my proxy servers,the one is primary and the other one is as backup,so based-config guide(the primary and backup proxy server), i need config like this,
    http proxy outgoing host 10.1.1.1 8088 primary
    http proxy outgoing host 10.1.1.2 220
    but the host ip address 10.1.1.1 is my WAE611 interface f0/1 ip address or not?
    if not ,pls tell how to config primary and backup using two WAE611?
    thanks
    David

    hi,
    By the way,two WAE611 connect to cisco6509 on the same vlan.
    and I need WAE611 as my proxy server,there is not other proxy server in my LAN.
    thanks

  • Happy Holidays.  I have Adobe Actobat 7.0 Standard for quite a while, and I'm happy with it. I use it for mainly filings at the federal court.  They require PDF.  I use two computers in two different states for work.  I realize my Adobe 7.1 is a few years

    .  I have Adobe Actobat 7.0 Standard for quite a while, and I'm happy with it. I use it for mainly filings at the federal court.  They require PDF.  I use two computers in two different states for work.  I realize my Adobe 7.1 is a few years old, but sometimes I have difficulty using it with the other days downloading a boarding pass, and e filing at the USDC. .  There's a problem with Adobe Flash, media, etc.  and other Adobe programs, (which I use for downloading boarding passes for airlines, etc.) so basically I have to delete these other Adobe programs, besides the Adobe Acrobat 7.0 Standard if I want to 7.0 Standard to work.  I periodically download the updates, but there's still a problem. My question is:  Can or should I purchase another program to update the present Adobe Acrobat 7.0 standard, or just buy a new program such as the Adobe 11?  Am I mistakenly doing something wrong, such as when I download?  I'm an old valued customer so I don't want to spend a lot of money since I am replacing my Dell XP for a new computer now, and my other computer is a Dell Vista.
    I'd appreciate your valued advice.

    If you are getting a new computer (for a PC it would have Win 7 or 8), then you will need to purchase XI if you wish to continue using Acrobat. Acrobat 7 is not compatible with these systems (and probably the same for MAC systems), though sometimes workarounds are possible, though not easy to use. I guess the answer is to buy the new version. Try http://www.adobe.com/products/catalog/software._sl_id-contentfilter_sl_catalog_sl_software _sl_mostpopular.html, click on the Buy for Acrobat, and then select the version you want.

  • The new "foreach" statement and maps

    The new "foreach" statement requires an object that implements the java.lang.Iterable<T> interface.
    But why do not extend "for" for accepting objects that implements the Map interface?
    Map<String,String> m = new TreeMap<String,String>();
    for (String key, String value : m) {
         System.out.println (key + "=" + value);   
    }The current alternative
    Map<String,String> m = new TreeMap<String,String>();
    for (Map.Entry<String,String> e : m.entrySet()) {
         System.out.println (e.getKey() + "=" + e.getValue());   
    }is not so clean.

    The new "foreach" statement requires an object that
    implements the java.lang.Iterable<T> interface.Incidentally, I believe "foreach" also allows an object that is an array.
    But why do not extend "for" for accepting objects that
    implements the Map interface?I think that the use of "Iterable" is a very good idea. The interface contains just one method (iterator) and that method is inherently linked to the concept of "foreach". This means anyone can write their own class that implements Iterable, and their class can then be used with "foreach".
    If we specified that "foreach" also worked with Map (with its umpteen methods, only one of which (entrySet) is relevant to "foreach"), this would prevent people writing their own classes which iterate through pairs of values (unless those classes happened to implement Map).
    Ideally, there would be a new interface Pair<A,B> in java.lang (with getFirst() and getSecond() methods), and then if the compiler came across something like this:
        for (String str, Widget widget : items) { ... }where items is an instance of Iterable<Pair<String,Widget>>, then for each iteration, the "Pair" would be split into its component parts and stored in the variables "str" and "widget".
    Unfortunately, it would be difficult to retrofit this concept to java.util.Map, since it would require Map to introduce a new method:
    interface Map<K,V> extends Iterable<Pair<K,V>> {
        Iterator<Pair<K,V>> iterator();
    }and Map.Entry would need to extend Pair, and therefore introduce two new methods:
    interface Entry<K,V> extends Pair<K,V> {
        K getFirst();
        V getSecond();
    }Both of these changes would break huge amounts of existing code that uses Map or Map.Entry.
    Maybe one for Java 3 :)
    Geoff

  • How do I delete two old Apple ID's and just use my current Apple ID?

    I had an Apple ID with an AOL email, I switched over to yahoo. While making the switch I misspelled the yahoo email address. I could not delete it, so I made another yahoo email address ID. Eventually I lost access to my previous purchases that were associated with the faulty email address even though I was using my current (correct email) to log onto iTunes. I found this out when my Macbook crashed (iPhoto) and I could not access my previous purchases. Eventually I was able to convince Apple Account Security Support that I was the person who set up the account (I am living in Barcelona currently and calling for support cost a lot of euro on a pay as you go sim and holding for 1 hour is a big waste of euro, but I understand that Apple Support is busy BUT, if you (Chris and Tyler) say you will call a customer back if you are disconnected you should follow through, not leave the customer hanging) (A SHOUT OUT TO MERCEDES, SHE FOLLOWED THROUGH!!!) (Chris and Tyler you guys need additional customer training from Mercedes)
    Anyway, back on topic. By a stroke of luck, while I was on hold for 30 minutes, I found the crossed out password to my faulty email ID, I was able to view/restore ALL of my previous purchases. So, my problem now is that I still have two unused Apple ID's. I want to delete them and just use the current. I don't want to call Apple again because I cannot waste anymore euro on hold and I do not feel confident that the Account Security representative will call me back, Mercedes is an exception to that. It would be nice to resolve this by email correspondence OR and actual call from Apple Account Security.
    On a side note, I have purchased three Apple devices while here in Barcelona. Europe has a mandatory two year warranty, but if you have a US iTunes Account serial numbers written in for warranty information only are recognized by US one year warranty standards. Apple should Should acknowledge this loophole/oversight.
    So that's a brief summary as it relates to my question. Sorry for the length of it. I hope I can get some good opinions for a possible resolution for my question/issue.
    Thanks

    On a side note, I have purchased three Apple devices while here in Barcelona. Europe has a mandatory two year warranty, but if you have a US iTunes Account serial numbers written in for warranty information only are recognized by US one year warranty standards.
    Your account isn't US or Spanish or any country but should be associated with the country in which you are resident.  Your US account  becomes a Spanish account if that is where you now live but it is all the same AppleID.  Before you change country make sure you have downloaded and backed up any purchases from your previous country's store.  You will not be able to re-download them again once you change countries and it won't be easy to change countries to the previous one once you lose your payment method for the former country (as well as a wait period).  As long as you have them on your computer you will be okay.
    Change the country of your iTunes Store, App Store, iBooks Store, and Mac App Store account - http://support.apple.com/kb/ht6119 - "After you change the country of your account, you won't see the items you purchased from the previous country’s store in the Purchased section."
    Even if you do not change country you are not supposed to use your account outside the USA. The iTunes Store in a country is intended for use only by that country's residents, and only while they are in the country. To use the iTunes Store in a country you need a credit card (or other card type if acceptable in a country) issued in that country, billed to an address in that country, and also be physically present in that country when using the store.  You are also restricted to waiting 90 days between country changes.
    E.g., "The iTunes Service is available to you only in the United States, its territories, and possessions. You agree not to use or attempt to use the iTunes Service from outside these locations. Apple may use technologies to verify your compliance." - http://www.apple.com/legal/itune/us/terms.html#SERVICE
    As for the devices, I believe except for computers the warranties only apply in the country/region of purchase.  If you return to the USA with them you would have to return them to Spain for any service (and no, Apple will not ship them back to another country either direction -- you'll have to get a friend to take them in).
    Apple Hardware Warranties - http://www.apple.com/legal/warranty/ - select device, then model, then country, then view warranty button.  Look for:
    "IMPORTANT RESTRICTION
    Apple may restrict warranty service to the country where Apple or its Authorized Distributors originally sold the Apple Product." - http://www.apple.com/legal/warranty/products/iphone-english.html

  • I set up "Find My Iphone App" using the same apple id and password on two iphones. Now the app only finds the phone that I did the setup on first. Do I need a different apple id and password on each phone for the app to run correctly?

    I setup two iphones on "Find My Iphone App" Using the same apple id on each phone. Now the app finds only the phone I setup first. Do I need to use two different apple ids? If your answer is yes then how do I errase the setup in the second phone and assign a new id?

    As TJBUSMC1973 states, and as I said earlier, the Find My iPhone app has nothing to do with your use of Find My iPhone. The app is just used if necessary to locate another iOS device from that particular iOS device. To see if both of your devices are being located in Find My iPhone, log into www.icloud.com and select Find My iPhone. Both of the devices should appear. If they do not, then go into whichever of the devices does not appear and make sure that Find My iPhone is activated. It has to be activated through iCloud, and for both to show on the same map, they both have to have the same iCloud ID.

  • How can I extract an image from a website using HtmlAgilityPack and XPath? (C#)

    Hello, everyone. I have been making a Comic Viewer in C#, and I'm stumped on how to actually load the comics. I installed HtmlAgilityPack
    and I have the XPath for the image I need, so I did some research and added the following code:
    string url = "http://www.gocomics.com/bignate/2015/04/10";
    HtmlWeb web = new HtmlWeb();
    HtmlAgilityPack.HtmlDocument doc = web.Load(url);
    var imgsrc = doc.DocumentNode.SelectSingleNode("//*[@id=\"zoom_content\"]/img").Attributes["src"].Value;
    pictureBox1.ImageLocation = imgsrc;
    However, it throws an unhandled exception and the imgsrc ends up null. What am I doing wrong?

    Hi Ethan,
    As far as I know, Use the //img[@src] as XPath in selectNodes will work.
    HtmlNodeCollection imgs = doc.DocumentNode.SelectNodes("//img[@src]");
    After get the image Value, you should convert it to image in order to show in
    pictureBox1 control.
    Here are the code, I have already test on my side, It works as expected.
    private List<string> retrieveImages(string address)
    System.Net.WebClient wc = new System.Net.WebClient();
    List<string> imgList = new List<string>();
    HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
    doc.Load(wc.OpenRead(address)); //or whatever HTML file you have
    HtmlNodeCollection imgs = doc.DocumentNode.SelectNodes("//img[@src]");
    if (imgs == null)
    return new List<string>();
    //foreach (HtmlNode imgg in imgs)
    // if (imgg.Attributes["src"] == null)
    // continue;
    HtmlAttribute src = imgs[0].Attributes["src"];
    imgList.Add(src.Value);
    //Do something with src.Value such as Get the image and save it to pictureBox
    Image img = GetImage(src.Value);
    pictureBox1.Image=img;
    return imgList;
    private Image GetImage(string url)
    System.Net.WebRequest request = System.Net.WebRequest.Create(url);
    System.Net.WebResponse response = request.GetResponse();
    System.IO.Stream responseStream = response.GetResponseStream();
    Bitmap bmp = new Bitmap(responseStream);
    responseStream.Dispose();
    return bmp;
    In addition, if you still have issues about HtmlAgilityPack, since it is a 3rd open source class.  You can consider posting it in CodePlex forum for more efficient responses.
    https://htmlagilitypack.codeplex.com/
    Now I have moved your thread to "off-topic" forum. Thanks for your understanding.
    Best regards,
    Kristin
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

Maybe you are looking for

  • HP LaserJet 1010 driver for Mac

    Good afternoon, everyone! I need your help! I badly need an HP LaserJet 1010 driver for Mac OS X 10.7. It has been written that PowerPC programms are not supported any more. Don't know how to cope with this problem.

  • Random Screen Saver: How to remove iPhoto Library ?

    When you tag "Use Random Screen Saver" in the System Preference Pane, the Screen Saver browses all the iPhoto Library. How is it possible to get rid of that, as the "minus" button is not working (anyway it is grey for all the directories in the list)

  • Fatal Error : EXCEPTION_ACCESS_VIOLATION (0xc0000005).

    Hi All, I am trying to migrate one of the Enterprise Application to another enterprise application using the migrator tool, But i am getting the error................. A fatal error has been detected by the Java Runtime Environment: # EXCEPTION_ACCES

  • How to import non-HD movies from old iMovie

    Hi there, guess I am a little bit late for this, but until recently I had still the old iMovie (6 ?) version installed - whereas after migration to Snow Leopard and iMovie 09 (?) the older iMovie version isn't there anymore. So, how do I import the o

  • How Long does it take to receive a space grey iPhone 5s in November, 2013?

    I ordered online a 16 gb Space Grey iPhone 5s on November 5th.  The Verizon website said it would ship within 2 days of November 6th.  Well....it's almost the beginning of December and I'm still getting the "order being processed, check back tomorrow