void servercontroller::saveSessionConfig()
{
    QDictIterator<KSircProcess> ksp(proc_list);
    for (; ksp.current(); ++ksp ) {
	ChannelSessionInfoList channels;

	QDictIterator<KSircMessageReceiver> ksm(ksp.current()->getWindowList());
	for (; ksm.current(); ++ksm )
	    if(ksm.currentKey()[0] != '!') { // Ignore !ksm's (system created)
		ChannelSessionInfo sessionInfo;

		sessionInfo.name = ksm.currentKey();
		sessionInfo.port = ksp.current()->serverPort();
		KSircTopLevel *topLev = dynamic_cast<KSircTopLevel *>( ksm.current() );
		if ( topLev && topLev->isTopLevel() ) {
#ifdef Q_WS_X11
		    NETWinInfo winInfo( qt_xdisplay(), topLev->winId(), qt_xrootwin(), NET::WMDesktop );
		    sessionInfo.desktop = winInfo.desktop();
#endif
		}

		channels << sessionInfo;
	    }

	if ( !channels.isEmpty() )
	    m_sessionConfig[ ksp.currentKey() ] = channels;
    }
}
Beispiel #2
0
int main()
{
	char s[256];
	char *text = (char *) malloc(256);
	char *key = (char *) malloc(256);
	char *stream = (char *) malloc(256);
	char *enc = (char *) malloc(256);
	char *dec = (char *) malloc(256);

	int p;
	printf("Enter Plain Text : ");       
    scanf("%s",text);
    printf("Enter your KEY : ");
    scanf("%s",key);
	

	ksp(s,key,strlen(key));
	prga(s,stream,strlen(key));

	printf("\nThe Encrypted Text : ");
	for(p=0;p<strlen(text);p++)
	{
		enc[p] = stream[p] ^ text[p];
	}
	printf("%s\n",enc);        

	printf("\nThe Decrypted Text : ");
	for(p=0;p<strlen(text);p++)
	{
		dec[p] = stream[p] ^ enc[p];
	}
	printf("%s\n",dec);        

	return 0;
}
Beispiel #3
0
void FnirtFileWriter::common_coef_construction(const string&            fname, 
                                               const basisfield&        fieldx,
                                               const basisfield&        fieldy,
                                               const basisfield&        fieldz,
                                               const Matrix&            aff)
{
  volume4D<float>       coefs(fieldx.CoefSz_x(),fieldx.CoefSz_y(),fieldx.CoefSz_z(),3);
  vector<float>         ksp(3,1.0);
  try {
    const splinefield& f = dynamic_cast<const splinefield& >(fieldx);
    ksp[0] = float(f.Ksp_x()); ksp[1] = float(f.Ksp_y()); ksp[2] = float(f.Ksp_z());
    if (f.Order() == 2) coefs.set_intent(FSL_QUADRATIC_SPLINE_COEFFICIENTS,f.Vxs_x(),f.Vxs_y(),f.Vxs_z());
    else if (f.Order() == 3) coefs.set_intent(FSL_CUBIC_SPLINE_COEFFICIENTS,f.Vxs_x(),f.Vxs_y(),f.Vxs_z());
  }
  catch (...) {  
    try {
      const dctfield& f = dynamic_cast<const dctfield& >(fieldx);
      coefs.set_intent(FSL_DCT_COEFFICIENTS,f.Vxs_x(),f.Vxs_y(),f.Vxs_z());
      throw FnirtFileWriterException("common_coef_construction: Saving of DCT coefficients not yet implemented");
    }
    catch (...) {
      throw FnirtFileWriterException("common_coef_construction: Unknown field type");
    }
  } 
  coefs.setxdim(ksp[0]); coefs.setydim(ksp[1]); coefs.setzdim(ksp[2]);
  Matrix  qform(4,4); 
  qform = IdentityMatrix(4);
  qform(1,4) = fieldx.FieldSz_x(); 
  qform(2,4) = fieldx.FieldSz_y(); 
  qform(3,4) = fieldx.FieldSz_z();
  coefs.set_qform(NIFTI_XFORM_SCANNER_ANAT,qform);
  coefs.set_sform(NIFTI_XFORM_SCANNER_ANAT,aff);
  vector<shared_ptr<ColumnVector> > coefp(3);
  coefp[0]=fieldx.GetCoef(); coefp[1]=fieldy.GetCoef(); coefp[2]=fieldz.GetCoef();  
  for (unsigned int v=0; v<3; v++) {
    ColumnVector  c = *(coefp[v]);
    for (unsigned int k=0, vindx=0; k<fieldx.CoefSz_z(); k++) {
      for (unsigned int j=0; j<fieldx.CoefSz_y(); j++) {
        for (unsigned int i=0; i<fieldx.CoefSz_x(); i++) {
          coefs(i,j,k,v) = c.element(vindx++);
	}
      }
    }
  }

  save_orig_volume4D(coefs,fname);
}
Beispiel #4
0
 double probability(double x) const
 {
   return ksp(x);
 }