示例#1
0
void findDuplicatesWrapper() {
    Utilities uobj;
    uint64_t *random;
    random = uobj.generate_random_array();
    int count = uobj.count_duplicates(random);
    free(random);
    cout << "Duplicates:" << count << endl;
}
示例#2
0
void UtilitiesWrapper() {
    Utilities utils;
    char inp[256];
    char *lowerInp;
    strcpy(inp, "LIRIL");
    lowerInp = utils.toLowerCase(inp);
    cout << "TOLOWER:" << lowerInp << endl;
    free(lowerInp);
}
int main()
{
  int m = pow(2, 2);
  int n = pow(2, 8);
  cout << m << endl;
  cout << n << endl;
  
  double s1 = sin(5.0, 3.0);
  double s2 = sin(3.4, 2.7);
  cout << s1 << endl;
  cout << s2 << endl;
  
  return 0;
}
	/**
	 *
	 * Virtual function execute that will be overridden by other objects and will return which ever instantiated object to UI or Kernel (which ever needs it)
	 *
	 */
	 void Utilities::execute(){
		 Utilities* util;

		 while(util != NULL){
			 util = displayMenu();

			 if(util != NULL){
				 util->execute();
			 }
		 }

		 //This will be replaced with reference to the Kernel and the pointer "util" passed for scheduling and execution
		 /*if(util != NULL){
			 util->execute();
		 }*/


		 //TODO need access to the memory management system in order to pass the pointer to the created utility object
	}
示例#5
0
   void
   UtilitiesTester::Test()
   {
      TestReceivedHeaderParse_();
      TestComputerName_();

      Utilities utilities;
      if (utilities.IsValidIPAddress("127.0.0.A"))
         throw;

      if (!utilities.IsValidIPAddress("127.0.0"))
         throw;

      if (Configuration::Instance()->IsIPv6Available())
      {
         if (!utilities.IsValidIPAddress("2001:0db8:0000:0000:0000:0000:1428:07ab"))
            throw;

         if (!utilities.IsValidIPAddress("001:0db8:0000:0000:0000::1428:07ab"))
            throw;

         if (!utilities.IsValidIPAddress("2001:db8::1428:7ab"))
            throw;

      }
   }
示例#6
0
   void
   UtilitiesTester::Test()
   {
      _TestReceivedHeaderParse();
      _TestComputerName();

      Utilities utilities;
      if (utilities.IsValidIPAddress("127.0.0.A"))
         throw;

      if (!utilities.IsValidIPAddress("127.0.0"))
         throw;

      if (TCPServer::HasIPV6())
      {
         if (!utilities.IsValidIPAddress("2001:0db8:0000:0000:0000:0000:1428:07ab"))
            throw;

         if (!utilities.IsValidIPAddress("001:0db8:0000:0000:0000::1428:07ab"))
            throw;

         if (!utilities.IsValidIPAddress("2001:db8::1428:7ab"))
            throw;

      }
   }
示例#7
0
int GetAPIRuntime() {
	return _Utilities.API_GetAPIRuntime();
}
示例#8
0
int GetTimestamp() {
	return _Utilities.API_GetTimestamp();
}
示例#9
0
int GetAPIVersion(char *&version) {
	return _Utilities.API_GetAPIVersion(version);
}
示例#10
0
void PhoenixGlobals::setConfigPath( const QString &path ) {
    m_config_path = path;
    utilities.createFolder( path );
}
示例#11
0
void PhoenixGlobals::setSavePath( const QString &path ) {
    m_save_path = path;
    utilities.createFolder( path );
}
示例#12
0
void PhoenixGlobals::setArtworkPath( const QString &path ) {
    m_artwork_path = path;
    utilities.createFolder( path );
}
示例#13
0
void PhoenixGlobals::setBiosPath( const QString &path ) {
    m_bios_path = path;
    utilities.createFolder( path );
}
示例#14
0
// Utilities
int IsAPIUpdateAvailable() {
	return _Utilities.API_IsAPIUpdateAvailable();
}
示例#15
0
//-------------------------------------------------------------------------------------
// Name: main()
// Desc: The application's entry point
//-------------------------------------------------------------------------------------
void __cdecl main()
{
	CSimpleIniA ini(true, true, true);
	std::map<std::string, bool> Settings;

	Utilities u;
	// Try mounting the game directory; at console startup it's not mounted
	u.MountGameDirectory();
	if (ini.LoadFile("g:\\settings.ini") < 0)
	{
		ini.Reset();

		std::string IniText(
			" LaunchCode was created by CLK.\n\n"			\
			" What can this app do?\n"									\
			"    - Remove console signature checks\n"					\
			"    - Remove RSA signature checks\n"						\
			"    - Set RoL LEDs\n"										\
			"    - Remove profile breakpoints (freezing when viewing some profiles)\n"\
			"    - Remove XampHeapAllocExplicit breakpoints (some bullshit)\n"	\
			"    - Enable hidden partitions for Xbox 360 Neighborhood\n"		\
			"    - Add additional, customizable partitions to Neighborhood\n"	\
			"    - Set the default account password for PartnerNet accounts\n"	\
			"    - Set the display gamertag\n"							\
			"    - Make the console think you have a gold membership\n" \
			" -> Instructions/Limitations:\n"							\
			" - Account password length must not exceed 11 characters.\n"\
			" - Each Neighborhood partition should match the following"	\
			    "criteria, otherwise it will not be mounted:\n"			\
			" ~ NeighborhoodName must not exceed 35 characters\n"		\
			" ~ DevicePath must not exceed 61 characters\n"				\
			" ~ DevicePath must be formatted as so:\n"					\
			"  - \"\\Device\\Harddisk0\\Partition1\\Devikit\"\n"		\
			"    - The following are all valid basic paths:\n"			\
			"      - \\Device\n"										\
			"      - \\Device\\Harddisk0\\SystemPartition\n"			\
			"      - \\Device\\Harddisk0\\Partition1\n"					\
			"      - \\Device\\Flash\n"									\
			"      - \\Device\\Mu0System\n"								\
			"      - \\Device\\Mu1System\n"								\
			"      - \\Device\\Mass0\n"									\
			"      - \\Device\\Mass1\n"									\
			"      - \\Device\\Mass2\n"									\
			"      - \\Device\\BuiltInMuSfcSystem\n"					\
			"      - \\Device\\Harddisk\\SystemExtPartition\n"			\
			"      - \\Device\\Harddisk\\SystemAuxPartition\n"			\
			"      - \\Device\\BuiltInMuUsb\\Storage\n"					\
			"      - \\Device\\BuiltInMuUsb\\StorageSystem\n"			\
			"      - \\Device\\BuiltInMuUsb\\SystemExtPartition\n"		\
			"      - \\Device\\BuiltInMuUsb\\SystemAuxPartition\n"		\
			"      - \\Device\\BuiltInMuMmc\\Storage\n"					\
			"      - \\Device\\BuiltInMuMmc\\StorageSystem\n"			\
			"      - \\Device\\BuiltInMuMmc\\SystemExtPartition\n"		\
			"      - \\Device\\BuiltInMuMmc\\SystemAuxPartition\n"		\
			"      - \\Device\\HdDvdRom\n"								\
			"      - \\Device\\HdDvdStorage\n"							\
			"      - \\Device\\HdDvdPlayer\n"							\
			"      - \\Device\\TransferCable\n"							\
			"      - \\Device\\Mass0PartitionFile\\Storage\n"			\
			"      - \\Device\\Mass1PartitionFile\\Storage\n"			\
			"      - \\Device\\Mass0PartitionFile\\StorageSystem\n"		\
			"      - \\Device\\Mass1PartitionFile\\StorageSystem\n"		\
			"      - \\Device\\Harddisk0\\Cache0\n"						\
			"      - \\Device\\Harddisk0\\Cache1\n"						\
			"      - \\Device\\NetworkStorageCache\n"					\
			"      - \\Device\\UpdateStorage\n"							\
			"      - \\Device\\Harddisk0\\TitleURLCachePartition\n"		\
			"      - \\Device\\DeviceAuth\n"							\
			"      - \\Device\\BuiltInMuUsb\\ReservationPartition\n"	\
			"      - \\Device\\LauncherData\n"							\
			"\n\n\n\nGreets to the following people:\n"					\
			"gabe_k, Xenon.7 (Xenomega), paul (British dude), rickshaw, skitzo, kiwi, dual\n" \
			"yolo."
			);

		std::fstream readme("g:\\readme.txt", std::ios::trunc | std::ios::in | std::ios::out);
		readme << IniText;
		readme.close();

		ini.SetBoolValue("settings", "SetLeds", true);
		ini.SetBoolValue("settings", "PatchRsaPubCrypt", true);
		ini.SetBoolValue("settings", "RemoveConsoleSignatureChecks", true);
		ini.SetBoolValue("settings", "RemovePackageRsaChecks", true);
		ini.SetBoolValue("settings", "RemoveProfileBreakpoints", true);
		ini.SetBoolValue("settings", "RemoveXampHeapAllocExplicitBreakpoints", true);
		ini.SetBoolValue("settings", "SetAsStartupApplication", true);
		ini.SetBoolValue("settings", "EnableHiddenPartitions", true);
		ini.SetBoolValue("settings", "EnableExtraNeighborhoodDrives", true);

		ini.SetBoolValue("settings", "SetGamertag", true);
		ini.SetBoolValue("settings", "SetGoldMembership", true);
		ini.SetBoolValue("settings", "EnableXamWatsonOutput", true);

		ini.SetValue("Network", "AccountCreatePassword", "meth=friend");
		ini.SetValue("Network", "OnlineGamertag", "[test]DRUG DEALER"); // MODIFY THIS LINE TO YOUR DEFAULT GAMERTAG
		//ini.SetBoolValue("xshell", "WriteCustomBackground", false);
		//ini.SetValue("xshell", "DevKitBackground", "bg_image_blue.png");
		//ini.SetValue("xshell", "TestKitBackground", "bg_image_gray.png");

		ini.SetValue("LEDs", "TopLeft", "Inverted");
		ini.SetValue("LEDs", "TopRight", "Normal");
		ini.SetValue("LEDs", "BottomLeft", "Mix");
		ini.SetValue("LEDs", "BottomRight", "Off");
		
		ini.SetValue("NeighborhoodDrive1", "DevicePath", "");
		ini.SetValue("NeighborhoodDrive1", "NeighborhoodName", "");

		ini.SetValue("NeighborhoodDrive2", "DevicePath", "");
		ini.SetValue("NeighborhoodDrive2", "NeighborhoodName", "");

		ini.SetValue("NeighborhoodDrive3", "DevicePath", "");
		ini.SetValue("NeighborhoodDrive3", "NeighborhoodName", "");

		ini.SetValue("NeighborhoodDrive4", "DevicePath", "");
		ini.SetValue("NeighborhoodDrive4", "NeighborhoodName", "");
		
		ini.SaveFile("g:\\settings.ini");
		ini.LoadFile("g:\\settings.ini");
	}
	CSimpleIniA::TNamesDepend keys;
	ini.GetAllKeys("settings", keys);
	CSimpleIniA::TNamesDepend::iterator it;
	for (it = keys.begin(); it != keys.end(); it++)
	{
		const char *key = ((*it).pItem);
		bool Enabled = ini.GetBoolValue("settings", key, NULL);
		Settings[std::string(key)] = Enabled;
	}

	keys.clear();
	ini.GetAllKeys("Network", keys);
	NetworkSettings ns;
	for (it = keys.begin(); it != keys.end(); it++)
	{
		std::string key((*it).pItem);
		std::string value = ini.GetValue("Network", key.c_str(), NULL);
		if (key == "AccountCreatePassword")
			ns.AccountCreationPassword = value;
		else if (key == "OnlineGamertag")
			ns.Gamertag = value;
	}

	std::vector<Utilities::Drive> drl;
	char Section[20] = {0};
	for (int i = 1; i < 5; i++)
	{
		keys.clear();
		sprintf(Section, "NeighborhoodDrive%d", i);
		ini.GetAllKeys(Section, keys);
		Utilities::Drive d;
		for (it = keys.begin(); it != keys.end(); it++)
		{
			std::string key  = ((*it).pItem);
			std::string value = ini.GetValue(Section, key.c_str(), NULL);
			if (key == "NeighborhoodName")
				d.NeighborhoodName = value;
			else if(key == "DevicePath")
				d.Path = value;
		}
		if (!d.NeighborhoodName.size() || !d.Path.size())
			continue;
		else
			drl.push_back(d);
	}

	if (Settings[std::string("SetLeds")])
	{
		LEDState TL = LEDState::ORANGE, TR = LEDState::RED, BL = LEDState::ORANGE, BR = LEDState::RED;
		keys.clear();
		ini.GetAllKeys("LEDs", keys);
		for (it = keys.begin(); it != keys.end(); it++)
		{
			std::string key(((*it).pItem));
			std::string value(ini.GetValue("LEDs", key.c_str(), NULL));
			LEDState *CurrentLed = nullptr;
			if (key == "TopLeft")
				CurrentLed = &TL;
			else if (key == "TopRight")
				CurrentLed = &TR;
			else if (key == "BottomLeft")
				CurrentLed = &BL;
			else if (key == "BottomRight")
				CurrentLed = &BR;

			if (CurrentLed == nullptr)
				continue;

			if (value == "Inverted")
				*CurrentLed = LEDState::RED;
			else if (value == "Normal")
				*CurrentLed = LEDState::GREEN;
			else if (value == "Mix")
				*CurrentLed = LEDState::ORANGE;
			else if (value == "Off")
				*CurrentLed = LEDState::OFF;
		}
		u.SetLeds(TL, TR, BL, BR);
	}
	if (Settings[std::string("PatchRsaPubCrypt")])
		u.PatchRsaPubCrypt();
	if (Settings[std::string("RemoveConsoleSignatureChecks")])
		u.RemoveConsoleSignatureChecks();
	if (Settings[std::string("RemovePackageRsaChecks")])
		u.RemovePackageRsaChecks();
	if (Settings[std::string("RemoveProfileBreakpoints")])
		u.RemoveProfileBreakpoints();
	if (Settings[std::string("RemoveXampHeapAllocExplicitBreakpoints")])
		u.RemoveXampHeapAllocExplicitBreakpoints();
	if (Settings[std::string("EnableXamWatsonOutput")])
		u.EnableXamWatsonOutput();

	if (ns.AccountCreationPassword != "")
		u.SetDefaultAccountPassword(ns.AccountCreationPassword);
	if (Settings[std::string("SetGamertag")] && ns.Gamertag != "")
		u.SetGamertag(ns.Gamertag);
	if (Settings[std::string("SetGoldMembership")])
		u.SetGold();
	if (Settings[std::string("EnableExtraNeighborhoodDrives")])
		u.AddExtraDrives(drl);
	else if (Settings[std::string("EnableHiddenPartitions")])
		u.EnableHiddenDrives();
	if (Settings[std::string("SetAsStartupApplication")])
		u.EnableApplicationStartup();
	u.PatchControllerDisconnect();

	// Return to launcher
	u.LaunchXshell();
}
示例#16
0
int main(int argc, char* argv[])
{

    int numOfParticles , numOfSamples;
    double landmarkThreshold;
    const char *filepath = NULL;
    const char *database = NULL;
    config_t cfg, *cf;
    cf = &cfg;
    config_init(cf);
    if (!config_read_file(cf, "config.cfg"))
        return(EXIT_FAILURE);
    config_lookup_int(cf, "particles" , &numOfParticles);
    config_lookup_int(cf, "samples" , &numOfSamples);
    config_lookup_float(cf, "landmarkThreshold" , &landmarkThreshold);
    config_lookup_string(cf, "filepath" , &filepath);
    config_lookup_string(cf, "database" , &database);

    DBWrapper dbwr(database);
    SMC smc;
    Utilities ut;
    dataBuffer dataPoints  = ut.readFile("-----", filepath);

    int timeStates = dataPoints.size();

    Params baseparams;
    vector < StateProgression > particles(numOfParticles, timeStates);
    smc.infer( &particles, & dataPoints, baseparams, numOfParticles , numOfSamples);
    Landmarks observations;
    for(unsigned int i = 0; i< particles[0].stateProg[0].size(); i++){
        Landmark land(smc.numOfLandmarks , particles[0].stateProg[0][i],i);
        observations.addLandMark(land);
    }

    Landmarks landmarks   =  dbwr.getCurrentLandmarks();
    vector<double> current_observations;
    std::map<int, int >  landmark_associations;

    for(unsigned int i=0; i<observations.size(); i++)
    {
        if(landmarks.size()==0)
        {
            dbwr.insertLandmark(& observations.landmarks[i].distribution);
            landmarks  =   dbwr.getCurrentLandmarks();
            current_observations.push_back(0);
            continue;
        }
        vector< vector< double > > distanceFeatures  = landmarks.extractDistances(& observations.landmarks[i],  & ut);
        bool found = false;
        for(unsigned int ijk = 0 ; ijk<distanceFeatures.size(); ijk++){
            if( distanceFeatures[ijk][0]<.3 && distanceFeatures[ijk][1]<20 && found ==false){
                landmark_associations.insert(std::make_pair(i, landmarks.landmarks[ijk].getId()));
                current_observations.push_back(ijk);
                found  =true;
                break;
            }
        }
        if(found==false){
            dbwr.insertLandmark(& observations.landmarks[i].distribution);
            current_observations.push_back(observations.size());
            landmarks = dbwr.getCurrentLandmarks();
            landmark_associations.insert(std::make_pair(current_observations.back(), landmarks.landmarks.back().getId()));
        }
    }
    ofstream myfile;
    myfile.open ("/home/panos/Desktop/aggregated.txt",std::ofstream::out | std::ofstream::app);
    myfile << "[";
    for(unsigned int i =0 ; i< dataPoints[0].size() ; i++)
        myfile <<  dataPoints[0][i][0] << " " << dataPoints[0][i][1] << " " << dataPoints[0][i][2] << " " << landmark_associations[particles[0].assignments[i]]<< endl;
    myfile<< "]";
    myfile.close();
    return 0;
}