Sunday, 25 December 2016

Empowering our consumers to be what they truly want to be

  • Why do we do what we do?
     - Consumers are at the core of our being. We exist to improve the life of our consumers ( young Arab consumers in a patriarchical society)


  • What does success look like? 
    - We will improve the life of our consumers by nurturing and empowering them to become what they truly want to become.

How must we act to ensure success?

    - We believe each woman has inner strength and is a woman of substance. We will be the inner voice of each of those woman who has forgotten this fact. We will remind her of her inner strength and thus inspire her to belief in her own self to be more.
    - We will honor women of substance who have succeeded despite all odds. These women of substance will in turn inspire other women to recognize the strength within, and therefore to march towards their dream with forceful self belief.
    - We will do this in a manner which is warm, empathetic and nurturing. We will encourage, not judge or be preachy. In short , we will nurture and inspire.

Saturday, 30 July 2016

Finding A gene in DNA Solution Quiz 1 --Java Programming: Solving Problems with Software


Finding A URl on a Page Java Code --Java Programming: Solving Problems with Software


/**
 * Write a description of URLFINDER here.
 *
 * @author (your name)
 * @version (a version number or a date)
 */
import edu.duke.*;
import java.io.*;
public class URLFINDER
{
    public void asd(){
        URLResource file = new URLResource("http://www.dukelearntoprogram.com/course2/data/manylinks.html");
        for ( String item : file.words() ) {
            String itemLower = item.toLowerCase();
            int pos = itemLower.indexOf("youtube.com");
            if ( pos != -1 ) {
                int beg = item.lastIndexOf("\"", pos);
                int end = item.indexOf("\"", pos + 1);
                System.out.println(item.substring(beg + 1, end));
        }
    }
  }
}

Code For finding aProtien string in a DNA --Java Programming: Solving Problems with Software

import edu.duke.*;
import java.io.*;
public class TagFinder{
    public String findProtein(String dna){
        int start = dna.indexOf("atg");
        int stop = dna.indexOf("tag", start +3);
        if (start == -1){
            return "no starton protein found";
        }
      
        if ((stop-start)%3==0){
            return dna.substring(start,stop+3);
        }
        else{
            return"not not a protein because of Divisible factor";
        }
    }
    public void testing()
    {
        String a = "cccatggggtttaaataataataggagagagagagagagttt";
        String ap = "atggggtttaaataataatag";
        //String a = "sdafsdfsdatgccctagdsfsdfgsffd";
        //String ap = "atgccctag";
        //String a = "atgcctag";
        //String ap = "";
        //String a = "ATGCCCTAG";
        //String ap = "ATGCCCTAG";
        String result = findProtein(a);
        if (ap.equals(result)){
            System.out.println("sucess for "+ap + "length " + ap.length());
        }
        else{
            System.out.println("mistake for input:"+a);
            System.out.println("got:"+result);
            System.out.println("not:"+ap);
        }
    }
    public void realTesting(){
      DirectoryResource dr = new DirectoryResource();
      for (File f : dr.selectedFiles()){
        FileResource fr = new FileResource(f);
        String s =fr.asString();
        System.out.println("read "+s.length()+" character");
        String result = findProtein(s);
        System.out.println("found "+ result);
        }
    }
}

Sunday, 24 July 2016

Iterables In Java Main Quiz --Java Programming: Solving Problems with Software


 

Batch GrayScale Images Practice Quiz Solutions --Java Programming: Solving Problems with Software


Converting Images to Gray Scale And Saving A Copy Of Them(Multiple) -- Java Programming: Solving Problems with Software


import edu.duke.*;
import java.io.File;
public class GrayScaleConverter {

    //started with the image i wanted(inImage)

    public ImageResource makeGray(ImageResource inImage){

    //I Made a blank image of the same size

        ImageResource outImage = new ImageResource(inImage.getWidth(),inImage.getHeight());

    //for each pixelin outImage

        for(Pixel pixel : outImage.pixels()){

    //look at the corresponding pixel in inImage

            Pixel inPixel = inImage.getPixel(pixel.getX(),pixel.getY());

    //compute inPixel's red + inPixel's blue + inpixel's green

    //divide that sum by 3(call it average)

    int average = (inPixel.getRed()+inPixel.getGreen()+inPixel.getBlue())/3;

    //set pixel's red to average

    pixel.setRed(average);

    //set pixel's green to average

    pixel.setGreen(average);

    //set pixel's blur to average

    pixel.setBlue(average);

    }

     return outImage;

    }  
   

    public void SelectAndConvert(){

        DirectoryResource dr = new DirectoryResource();

        for (File f : dr.selectedFiles()){
        ImageResource inImage = new ImageResource(f);
        ImageResource gray = makeGray(inImage);
        String fname = inImage.getFileName();
        String newfname = "copy-" + fname;
        gray.setFileName(newfname);
        gray.draw();
        gray.save();
        }

    } 

}