def begin_import(request_type): print '[*] Begin import' csv_file = open(csv_file_name, "rb") table = csv.DictReader(csv_file) try: session = Session() session_row = FlurryAppMetric() for row in table: if request_type == "month": # Ignore time zone as the current table does not support it session_row.date = parse(row["dateTime"]).replace(tzinfo=None) session_row.api_key = row["app|apiKey"] session_row.country = row["country|iso"] session_row.active_users_month = row["activeDevices"] try: session.merge(session_row) session.commit() except SQLAlchemyError as e: print '[*] Failed to merge!' + str(e) except SQLAlchemyError as e: print '[*] SQLAlchemyError thrown: ' + str(e) session.rollback() session.close() finally: session.close() csv_file.close()
Retrive data From a CSV using Python and insert into sql
Truncate c# string
private static string TruncateString(string value, int maxLength) { if (string.IsNullOrEmpty(value)) { return value; } return value.Length <= maxLength ? value : value.Substring(0, maxLength); }
Collect Unity Console logs - Used for Global exception catcher
Catch all the engine logs and send it to your native console or have a fancy Unity GUI console
Application.logMessageReceived += (output, stackTrace, logType) => {
StringBuilder consoleLogs = new StringBuilder();
consoleLogs.AppendLine("[*] Begin console log information");
consoleLogs.AppendLine("LogMessage:" + output);
consoleLogs.AppendLine("StackTrace:" + stackTrace);
consoleLogs.AppendLine("LogType:" + logType.ToString());
consoleLogs.AppendLine("[*] End console log information");
Utils.SendLogsToConsole("Console Log", consoleLogs.ToString());
};
Resume Orientaion on iOS
NSArray *supportedOrientations = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"UISupportedInterfaceOrientations"]; for (NSString *orientation in supportedOrientations) { if ([orientation isEqualToString:@"UIInterfaceOrientationPortrait"] || [orientation isEqualToString:@"UIInterfaceOrientationPortraitUpsideDown"]) { NSLog(@"Portrait mode!"); NSNumber *value = [NSNumber numberWithInt:UIInterfaceOrientationPortrait]; [[UIDevice currentDevice] setValue:value forKey:@"orientation"]; } else if ([orientation isEqualToString:@"UIInterfaceOrientationLandscapeLeft"] || [orientation isEqualToString:@"UIInterfaceOrientationLandscapeRight"]) { NSLog(@"Landscape mode!"); NSNumber *value = [NSNumber numberWithInt:UIInterfaceOrientationLandscapeRight]; [[UIDevice currentDevice] setValue:value forKey:@"orientation"]; } }
GetManagerFromContext: pointer to object of manager ‘(null)’ is NULL (table index 5)
UNITY3D FATAL ERROR ON STARTUP WORKAROUND
.entry-meta
.entry-header
This morning starting up Unity 5.1.0 greeted me with the following message and a blank project selection window (I have unity configured to ask me which project to load on startup)
Fatal error!
GetManagerFromContext: pointer to object of manager ‘(null)’ is NULL (table index 5)
GetManagerFromContext: pointer to object of manager ‘(null)’ is NULL (table index 5)
Update
Confirmation from Unity that this is a bug in the updater and they have now disabled this server side checking for versions 5.1.0f3 – 5.1.1f1 so hopefully that’s the last we see of it!
Solution
Many thanks to @Rusty_Bolt on twitter who tweeted to suggest switching WiFi/Internet off which lead me to the following steps. Switching WiFi off would indeed allow unity to start, however after quitting and starting again if WiFi was on (usually is!) it would crash again.
- Switch your internet connection off
- Load Unity and select a project
- Switch your internet connection on
- Now within Unity load a new project via File->OpenProject
- Quit unity
Hopefully now when you start unity everything is back to normal!
Other things I tried
As part of trying to track this down I tried the following, none of which helped.
- Delete all unity settings from ~/Library/Preferences
- Delete my Unity license file from Library/Application Support/PACE Anti-Piracy/License Files see link
- Moved all of my unity projects to a different location to ensure they were not involved
- Deleted Unity
- Installed Unity
Source: http://trusteddevelopments.com/2015/06/26/unity3d-fatal-error-on-startup-workaround/
Install homebrew on Mac OSX
xcode-select --install After that: ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" Source : https://coolestguidesontheplanet.com/installing-homebrew-os-x-yosemite-10-10-package-manager-unix-apps/
Initialize SqlAlchemy database
def initialize_db(config): url = URL( config["driver"], config["username"], config["password"], config["hostname"], None, config["database"], {'charset': 'utf8'}) # hack for sqlite databases url = str(url) engine = create_engine(url, encoding = config["encoding"], echo = config["echo"]) return engine def insert_into_database(): db = initialize_db(settings.DATABASE_ENGINE) db.echo = False connection = db.connect() metadata = MetaData(db) //Settings.py //Add your credentials DATABASE_ENGINE = { "driver": "", "hostname": "", "username": "", "password": "", "database": "", "encoding": "latin1", "echo": False }
Subscribe to:
Posts (Atom)