http://people.sabanciuniv.edu/berrin/cs512/lectures/WEKA/WEKA%20Explorer%20Tutorial-REFERENCE.pdf
Posted in Data Mining
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
#include <windows.h> #include <GL\glut.h> void myInit (void) { glClearColor(0.0,0.0,0.0,0.0); // sets background color to white // sets a point to be 4x4 pixels glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluOrtho2D(0.0, 500.0, 0.0, 400.0); // the display area in world coordinates. } void myDisplay(void) { glClear(GL_COLOR_BUFFER_BIT); // clears the screen glColor3f(0.5f,0.5f,0.5f) ;// setsthe drawing colour glPointSize(4.0); glBegin(GL_POLYGON); //bottom glVertex2i (20, 20); glVertex2i (320, 20); //top glVertex2i (20, 200); glVertex2i (320, 200); //left glVertex2i (20, 200); glVertex2i (20, 20); //right glVertex2i (320, 200); glVertex2i (320, 20); //glVertex2i (10, -50); glEnd(); //Left Window glColor3f(1.0f,0.0f,0.0f) ; glPointSize(4.0); glRectf(30,30,100,100); //Right Window glColor3f(1.0f,0.0f,0.0f) ; glBegin(GL_POLYGON); //bottom glVertex2i (200,30); glVertex2i (200, 100); //top glVertex2i (200, 100); glVertex2i (300, 100); //left glVertex2i (300, 100); glVertex2i (300, 30); //right glVertex2i (300, 30); glVertex2i (200, 30); //glVertex2i (10, -50); glEnd(); //door glColor3f(0.0f,0.0f,1.0f) ; glBegin(GL_POLYGON); //left glVertex2i (120,30); glVertex2i (120, 100); //top glVertex2i (120, 100); glVertex2i (170, 100); //right glVertex2i (170, 100); glVertex2i (170, 30); //bottom glVertex2i (120, 30); glVertex2i (170, 30); //glVertex2i (10, -50); glEnd(); //Triangle glColor3f(0.0f,1.0f,0.0f) ; glBegin(GL_POLYGON); //bottom glVertex2i (20, 200); glVertex2i (320, 200); //top glVertex2i (200, 310); glVertex2i (320, 200); //left glVertex2i (20, 200); glVertex2i (200, 310); //glVertex2i (10, -50); glEnd(); glFlush(); // sends all output to display; } int main (int argc, char **argv) { glutInit (&argc, argv); // to initialize the toolkit; glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB); // sets the display mode glutInitWindowSize (640, 480); // sets the window size glutInitWindowPosition (10, 10); // sets the starting position for the window glutCreateWindow ("My first OpenGL program!"); // creates the window and sets the title glutDisplayFunc (myDisplay); myInit(); // additional initializations as necessary glutMainLoop(); // go into a loop until event occurs return 0; } |
Actually we use this method to split string from a big sentence using regex.
Posted in Java, Language, Programming
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
package com.zakilive.sounddemo; import android.content.Context; import android.media.AudioManager; import android.media.MediaPlayer; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.log; import android.view.View; import android.widget.SeekBar; import android.widget.SeekBar.OnSeekBarChnageListener; import java.util.Timer; import java.util.TimerTask; Public class MainActivity extends AppCompatActivity{ MediaPlayer mtemplayer; AudioManager audioManager; public void playAudio(View view){ mtemplayer.start(); } public void pauseAudio(View view) { mtemplayer.pause(); } protected void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceSTate); setContentView(R.activity_main); mtemplayer = MediaPlayer.create(this,R.id.laugh); audioManager = (AudioManager) getSystemService(Context,AUDIO_SERVICE); int maxVolume = audioManager.getStreamMaxVolume(Audiomanager,STREAM_MUSIC); int currentVolume= audioManager.getSteamVolume(AudioManager,STREAM_MUSIC); SeekBar volumeControl = (SeekBar) findViewById(R.id.seekBar); volumeControl.setMax(maxVolume); volumeControl.setProgress(currentVolume); volumeControl.setOnSeekBarChangeListener(new OnSeekBarChangeListener(){ @Override public void onStartTrackingTouch(SeekBar seekBar){ } @Override public void onStopTrackingTouch(SeekBar seekBar) { } public void onProgressChnaged(SeekBar seekBar,int progress,boolean fromUser) { Log.i("SeekBar value",Integer.toString(progress)); audioManager.setStreamVolume(AudioManager.STREAM_MUSIC,progress,0); } }); final SeekBar scrubber = (SeekBar) findViewById(R.id.scrubber); scrubber.setMax(mtemplayer.getDuration()); new Timer().scheduleAtFixedRate(new TimerTask(){ public void run() { scrubber.setProgress(mtemPlayer.getCurrentPosition()); } },0,1000); scrubber.setOnSeekBarChanegListener(new OnSeekBarChangeListener()){ @Override public void onProgressChange(SeekBar seekBar,int Progress, boolean fromUser){ mtemPlayer.seekTo(progress); } @override public void onSTartTrackingTouch(SeekBar seekBar){ } @Override public void onSTopTrackingTouch(SeekBar seekBar) { } }); } } |
Posted in A ll Codes, Android
Started advanced Android app development training from Udemy..Hope for the best.Keep me in your prayers 🙂
Lectures:
About OpenGL colors:
http://www.cs.brandeis.edu/~cs155/OpenGL%20Lecture_02.pdf
https://en.wikibooks.org/wiki/OpenGL_Programming/Basics/Color
Setup:
https://openglprojects.com/setting-up-opengl-in-windows-linux-mac/
Tut:
http://www.lighthouse3d.com/tutorials/glut-tutorial/
http://ogldev.atspace.co.uk/www/tutorial03/tutorial03.html
https://www3.ntu.edu.sg/home/ehchua/programming/opengl/CG_Introduction.html
Vid:
https://www.youtube.com/watch?v=xCRzpNd5k3Y
https://openglprojects.com/opengl-project-ideas/
http://vtupro.blogspot.com/2014/10/opengl-mini-project-for-csisit-students.html
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
#include<windows.h> #include <GL/gl.h> #include <GL/glut.h> void display(void) { /* clear all pixels */ glClear (GL_COLOR_BUFFER_BIT); /* draw white polygon (rectangle) with corners at * (0.25, 0.25, 0.0) and (0.75, 0.75, 0.0) */ glColor3f (1.0, 0.25, 1.0); glBegin(GL_POLYGON); glVertex3f (0.25, 0.25, 0.0); glVertex3f (0.75, 0.25, 0.0); glVertex3f (0.75, 0.75, 0.0); glVertex3f (0.25, 0.75, 0.0); glEnd(); /* don't wait! * start processing buffered OpenGL routines */ glFlush (); } void init (void) { /* select clearing (background) color */ glClearColor (0.0, 0.0, 0.0, 0.0); /* initialize viewing values */ glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0); } /* * Declare initial window size, position, and display mode * (single buffer and RGBA). Open window with "hello" * in its title bar. Call initialization routines. * Register callback function to display graphics. * Enter main loop and process events. */ int main(int argc, char** argv) { glutInit(&argc, argv); glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB); glutInitWindowSize (500, 500); glutInitWindowPosition (100, 100); glutCreateWindow ("hello"); init (); glutDisplayFunc(display); glutMainLoop(); return 0; /* ISO C requires main to return int. */ } |
Output:
Steps:
1. Download the whole nlp from the site.
2. Copy stanford-postagger.jar file and paste it in the app>libs folder
3. Right click on it and click add to library.
4. Now write the example code available in the net with class tagText{} and in MainActivity.java
5. import library import import edu.stanford.nlp.tagger.maxent.MaxentTagger;
This video may help.
Update: It is giving errors with android.
Posted in Artificial Intelligence, Natural Language Processing(NLP)
Tagged android, stanford-nlp
Here yo can see what is triangular number:
https://en.wikipedia.org/wiki/Triangular_number
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
public class NumShape { public static void main(String[] args) { class Number{ int number; public boolean isTriangular(){ int x=1; int triangularNumber=1; while(triangularNumber<number) { x++; triangularNumber=triangularNumber+x; } if(triangularNumber==number){ return true; }else { return false; } } } Number myNumber = new Number(); myNumber.number=7; System.out.println(myNumber.isTriangular()); } } |
Posted in A ll Codes, Java, Problem Solution, Programming, Programming Problem Solving
Tagged Triangular number
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
#include<iostream> #include<cstdio> using namespace std; int main() { int testcase,star,i,j,k; cin>>testcase; for(i=0; i<testcase; i++) { cin>>star; for(j=0; j<star; j++) { printf("\n"); for(k=0; k<star; k++) { printf("*"); } } printf("\n"); } return 0; } |
Solution:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
#include<iostream> #include<cstdio> using namespace std; int main() { int testcase,i,num_range,j; cin>>testcase; for(i=1; i<=testcase; i++) { cin>>num_range; cout<<"Case "<<i<<":"; for(j=1; j<=num_range; j++) { if(num_range%j==0) { cout<<" "<<j<<" "; } } cout<<endl; } return 0; } |
1st approach:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
#include<iostream> #include<cstdio> using namespace std; int main() { int counts=0; for(int i=1000; i>=1; i--) { counts++; printf("%d\t",i); if(counts%5==0) { printf("\n"); } } return 0; } |
2nd approach:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
#include<iostream> #include<cstdio> using namespace std; int main() { for(int i=1000; i>=1; i--) { if((i!=1000)&&(i%5==0)) { printf("\n"); } printf("%d\t",i); } return 0; } |