Search Results

Search found 51 results on 3 pages for 'taimur hamza'.

Page 2/3 | < Previous Page | 1 2 3  | Next Page >

  • Count Similar iTems in Array

    - by Taimur Hamza
    Hi guys, I need to count the similar elements in an array. For example, if i have an array, array[0,0,0,1,2,3,3].The number of 0's are 3 , no. of 1's are 1 , no. of 2's are 1 , no. of 3's are 2 in this array . I am sorry if this message has been posted before. Help is appreciated. Thanks in advance. Regards, THM P.S : Language is C/C++

    Read the article

  • Traceroute Theory

    - by Hamza Yerlikaya
    I am toying with trace route, my application send a ICMP echo request with a ttl of 0 every time i receive a time exceeded message i increment the ttl by one and resent the package, but what happens is I have 2 routers on my network i can trace the route through these router but third hop always ends up being one of the open dns servers same ip every time no matter where i traceroute to. AFAIK this is the correct traceroute implementation, can anyone tell me what i am doing wrong?

    Read the article

  • org-mode schedule weekly event for a period.

    - by Hamza Yerlikaya
    I would like to use agenda to keep track of my classes, assuming i have a com 355 class every week from march to june, <2010-03-23 Tue 10:40-12:10 +1w> this works but it schedules it indefinitely if i use, <2010-03-23 Tue 10:40-12:10 +1w>-<2010-06-23> it gets scheduled for everyday from march to june, how can i schedule this once a week for a period of time?

    Read the article

  • Java Implementing htonl

    - by Hamza Yerlikaya
    I am communicating with a server, each message sent to the server has to be padded with the length of the message, unsigned int len = htonl(msg.size()); In C running the length through htonl and padding the message works, in Java AFAIK byte order is already in network order so I assumed all I have to do is write the string length before the message to the stream, but this does not work am I missing something? stream.write(msg.length()); stream.write(msg.getBytes()); Stream is an OutputStream.

    Read the article

  • Calculating rgb vals for BufferedImage

    - by Hamza Yerlikaya
    I am using following snippet to build a 32 bit integer to use with setRGB of BufferedImage (bit-or (bit-shift-left a 24) (bit-or (bit-shift-left r 16) (bit-or (bit-shift-left g 8) b))) after writing colors reading them back reveals wrong colors is there a fault in my logic?

    Read the article

  • why is this C++ Code not doing his job

    - by hamza
    i want to create a program that write all the primes in a file ( i know that its a popular algorithm but m trying to make it by my self ) , but it still showing all the numbers instead of just the primes , & i dont know why someone pleas tell me why #include <iostream> #include <stdlib.h> #include <stdio.h> void afficher_sur_un_ficher (FILE* ficher , int nb_bit ); int main() { FILE* p_fich ; char tab[4096] , mask ; int nb_bit = 0 , x ; for (int i = 0 ; i < 4096 ; i++ ) { tab[i] = 0xff ; } for (int i = 0 ; i < 4096 ; i++ ) { mask = 0x01 ; for (int j = 0 ; j < 8 ; j++) { if ((tab[i] & mask) != 0 ) { x = nb_bit ; while (( x > 1 )&&(x < 16384)) { tab[i] = tab[i] ^ mask ; x = x * 2 ; } afficher_sur_un_ficher (p_fich , nb_bit ) ; } mask = mask<<1 ; nb_bit++ ; } } system ("PAUSE"); return 0 ; } void afficher_sur_un_ficher (FILE* ficher , int nb_bit ) { ficher = fopen("res.txt","a+"); fprintf (ficher ,"%d \t" , nb_bit); int static z ; z = z+1 ; if ( z%10 == 0) fprintf (ficher , "\n"); fclose(ficher); }

    Read the article

  • Using MailDir as a Backend for Gnus

    - by Hamza Yerlikaya
    I am using offlineimap to sync my gmail account to a locak maildir, then using gnus to read that directory everything is fine but gnus uses its own flags for marking read unread status of messages and they are not synced back to gmail. is there a way to force gnus to use standart maildir flags?

    Read the article

  • C: cross-platform RS232 serial library?

    - by Hamza
    Hi folks, I am looking for an open source cross-platform library for working with the serial port in C, something along the lines of the awesome pyserial library (Unfortunately I have to use C for this application) I have only found this one: http://www.teuniz.net/RS-232/ and that doesn't seem to have mention OSX compatibility. Any recommendations/comments would be greatly appreciated. Thanks.

    Read the article

  • radgrid insert using radwinow

    - by Hamza
    Hello Everybody, The company details page in my system has a user control to show the founders of the company, that user control represents the founders by using a Rad Grid and three buttons for insert/edit/delete founders, the founders grid is being bind by using a WCF service. the insert button calls a javascript method that opens a Rad Window in which the user can insert the data for a new founder my problem is: in the Add Founder Rad Window I shouldn't save the new founder in the database, when I press Add the Rad Grid should be closed and the new founder should be added to the founders Grid's datasource, and then the grid should be bind again the questions is: what is the best way to do that, I don't want to use sessions nor json, I tried to use another wcf service which takes two parameters: reference to the grid and the new founder, and in this wcf service I get the old datasource then add the new founder to it and finally rebind the grid again, but I have faced some problems like how can I send the reference to the grid from javascript method to a WCF service, also if I add more than one founder how can keep track of the new founders and the original datasource if any of you can lead me to an example similar to my case this would be very much appreciated, also any comments and feedback are most welcomed

    Read the article

  • Testing JavaMail Related Modules

    - by Hamza Yerlikaya
    Part of my application depends on JavaMail, moving arranging messages etc. Is it possible to test this module without firing a IMAP server to run the tests on? I am always stuck when it comes to testing stuff that depends on external servers or modules.

    Read the article

  • Guiding a Robot Through a Path

    - by Hamza Yerlikaya
    I have a field filled with obstacles, I know where they are located, and I know the robot's position. Using a path-finding algorithm, I calculate a path for the robot to follow. Now my problem is, I am guiding the robot from grid to grid but this creates a not-so-smooth motion. I start at A, turn the nose to point B, move straight until I reach point B, rinse and repeat until the final point is reached. So my question is: What kind of techniques are used for navigating in such an environment so that I get a smooth motion? The robot has two wheels and two motors. I change the direction of the motor by turning the motors in reverse. EDIT: I can vary the speed of the motors basically the robot is an arduino plus ardumoto, I can supply values between 0-255 to the motors on either direction.

    Read the article

  • Behavior Tree Implementations

    - by Hamza Yerlikaya
    I am looking for behavior tree implementations in any language, I would like to learn more about how they are implemented and used so can roll my own but I could only find one Owyl, unfortunately, it does not contain examples of how it is used. Any one know any other open source ones that I can browse through the code see some examples of how they are used etc? EDIT: Behavior tree is the name of the data structure.

    Read the article

  • High Frequency Trading

    - by Hamza Yerlikaya
    Over the last couple of weeks i have come across lots of articles about high frequency trading. They all talk about how important computers and software is to this but since they are all written from a financial point of view there is no detail about what does software do? Can anyone explain from a programmers point of view what is high frequency trading? and why is computer/software so important in this field?

    Read the article

  • How can i declare a Binary type

    - by hamza
    i need to work with a binary number i just write : const x = 00010000 ; & it doesn't work i know that i can use an hexadecimal number that have the same value as 00010000 but for more knowledge i want to know if there is a type in C++ for binary numbers & if there isn't ,is there another solution for my Problem ? thanks

    Read the article

  • Detecting Markers Using OpenCV

    - by Hamza Yerlikaya
    I am trying to detect various objects containing colored markers, so a red blue green marker identifies object A, and a red blue red marker identifies object B. My problem is I can't use template matching cause objects can be rotated, currently I am thinking about check for each color then find the object by checking the distance between colors but it seems inefficient, so my question is there a better way to do this?

    Read the article

  • OpenCv Error ( unhandeld exeption) after execute

    - by hamza
    Hi , i m using VS2010 i m trting to make a gray image more bright , the code did compile normaly but no change in the seconde picture , and an error message ( undhadled exeception .. .. ) showed up after that the execute is done showed up here is a peace of my code : int main(int argc, _TCHAR* argv[]) { IplImage *img = cvLoadImage("mra.jpg"); if (!img) { printf("Error: Couldn't open the image file.\n"); return 1; } //IplImage* new_image = getlargersize(img); double Min , Max ; Min = Max = 0 ; Max_Min (img , &Min , &Max); cout<<"the max value in the picture is :"<<Min<<" and the minimum value is :"<<Max<<endl ; IplImage* img2 = eclaircir(Min ,Max ,img); cvNamedWindow("Image:", CV_WINDOW_AUTOSIZE); cvNamedWindow("Image2:", CV_WINDOW_AUTOSIZE); cvShowImage("Image2:", img2); cvShowImage("Image:", img); cvWaitKey(0); cvDestroyWindow("Image2:"); cvDestroyWindow("Image:"); cvReleaseImage(&img2); cvReleaseImage(&img); return 0; } void Max_Min(IplImage* temp , double *min , double *max ){ CvScalar pix ; for (int i = 0 ; i < temp->height ; i++){ for (int j = 0 ; j < temp->width ; j++){ pix = cvGet2D(temp , i , j); if ( pix.val[0] >= *max ){ *max = pix.val[0]; } if ( pix.val[0] <= *min){ *min = pix.val[0]; } } } } IplImage* eclaircir (double min , double max , IplImage* image){ double temp = max - min ; CvScalar pix ; for (int i = 0 ; i < image->height ; i++){ for (int j = 0 ; j < image->width ; j++){ pix = cvGet2D(image , i , j); pix.val[0] = ( pix.val[0] - min)*255 ; pix.val[0] = pix.val[0]/temp ; cvSet2D(image , i , j , pix ); } } return image ; } thanks

    Read the article

  • Can I use a binary literal in C or C++?

    - by hamza
    I need to work with a binary number. I tried writing: const x = 00010000 ; But it didn't work. I know that I can use an hexadecimal number that has the same value as 00010000 but I want to know if there is a type in C++ for binary numbers & if there isn't, is there another solution for my problem?

    Read the article

  • why do we have to send the const " type " reference instead of just the types name to the constructo

    - by hamza
    i m trying to make a simple program ( & yes , it is a homework ) that can generate Dates , & like most of normal people : i made my Class attributes private , i tried to send the same type that i m working on to the constructor but the complier have not accept it , i did some research & i found out that in cases like that people generously send a const "type" reference to the constructor witch meant to me that have not understand OOP well so why do we have to send the const " type " reference instead of just the types name to the constructor ? & please give me some links or websites for beginners PS : sorry for my English

    Read the article

  • JFileChooser on OS X

    - by Hamza Yerlikaya
    JFileChooser looks nothing like the native widget. I seem to remember reading some hack to get it look like the native widget but searching for it know i can't seem to find it again i came across posts that suggest using java.awt.FileChooser but that class does not seem to be in the distribution. How can i make JFileChooser make look like the native widget?

    Read the article

  • Socket - Adress already in use

    - by Hamza Karmouda
    I'm new to socketand i try to code an Server and client on the same application just to see how it work. here's my code : public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); ((Button)this.findViewById(R.id.bouton1)).setOnClickListener(this); } public void onClick(View v) { TCPServer server = new TCPServer(); TCPClient client = new TCPClient(); server.start(); client.start(); } public class TCPServer extends Thread { @Override public void run() { try { ServerSocket s = new ServerSocket(8080,0,InetAddress.getLocalHost()); Socket cli = s.accept(); byte[] b = new byte[512]; int n; InputStream is = cli.getInputStream(); while((n=is.read(b))>0){ Log.d("TCPServer",new String(b)); if(new String(b).contains("\r\n\r\n"))break; b = new byte[512]; } OutputStream os = cli.getOutputStream(); os.write("Hello".getBytes()); } catch (Exception e) { e.printStackTrace(); } } } public class TCPClient extends Thread { @Override public void run() { try { Socket s = new Socket(InetAddress.getLocalHost().getHostAddress(),8080); //Socket s = new Socket("www.google.com",80); //Log.i("",s.getLocalAddress().getHostAddress()); byte[] b = new byte[512]; int n; if (s.isConnected()) { OutputStream os = s.getOutputStream(); os.write("Hi How are you \r\n\r\n".getBytes()); InputStream is = s.getInputStream(); while((n=is.read(b))>0){ Log.d("TCPClient",new String(b)); b = new byte[512]; } } s.close(); } catch (Exception e) { e.printStackTrace(); } } } the code work fine but just for the first time i click my button. the error is java.net.BindException: Address already in use .

    Read the article

  • BASH: Checking for environment variables

    - by Hamza
    Hi folks, I am trying to check the value of an environment variable and depending on the value do certain things and it works fine as long as the variable is set. When it isn't though I get a whole bunch of errors (as BASH is trying to compare the string I specify with an undefined variable, I guess) I tried implementing an extra check to prevent it happening but no luck. The block of code I am using is: #!/bin/bash if [ -n $TESTVAR ] then if [ $TESTVAR == "x" ] then echo "foo" exit elif [ $TESTVAR == "y" ] then echo "bar" exit else echo "baz" exit fi else echo -e "TESTVAR not set\n" fi And this the output: $ export TESTVAR=x $ ./testenv.sh foo $ export TESTVAR=y $ ./testenv.sh bar $ export TESTVAR=q $ ./testenv.sh baz $ unset TESTVAR $ ./testenv.sh ./testenv.sh: line 5: [: ==: unary operator expected ./testenv.sh: line 9: [: ==: unary operator expected baz My question is, shouldn't 'unset TESTVAR' nullify it? It doesn't seem to be the case... Thanks.

    Read the article

  • Get Object from memory using memory adresse

    - by Hamza Karmouda
    I want to know how to get an Object from memory, in my case a MediaRecorder. Here's my class: Mymic class: public class MyMic { MediaRecorder recorder2; File file; private Context c; public MyMic(Context context){ this.c=context; } private void stopRecord() throws IOException { recorder2.stop(); recorder2.reset(); recorder2.release(); } private void startRecord() { recorder2= new MediaRecorder(); recorder2.setAudioSource(MediaRecorder.AudioSource.MIC); recorder2.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP); recorder2.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB); recorder2.setOutputFile(file.getPath()); try { recorder2.prepare(); recorder2.start(); } catch (IllegalStateException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } } my Receiver Class: public class MyReceiver extends BroadcastReceiver { private Context c; private MyMic myMic; @Override public void onReceive(Context context, Intent intent) { this.c=context; myMic = new MyMic(c); if(my condition = true){ myMic.startRecord(); }else myMic.stopRecord(); } } So when I'm calling startRecord() it create a new MediaRecorder but when i instantiate my class a second time i can't retrieve my Object. Can i retrieve my MediaRecorder with his addresse

    Read the article

< Previous Page | 1 2 3  | Next Page >