Updating the Perm Gen Memory Jenkins - MacOSX - macos

I am trying to update the Perm Gen Memory in Jenkins, from what I have read adding this to the org.jenkins.plist file would do the trick but it is not changing it for me:
<key>-XX:PermSize</key>
<string>512m</string>
<key>-XX:MaxPermSize</key>
<string>1024m</string>
When I use the Jenkins monitoring tool is still tells me that:
Perm Gen Memory: 81mb
Am I doing something wrong?
Thanks

According to http://mgrebenets.github.io/mobile%20ci/2015/02/01/jenkins-ci-server-on-osx, you should be using <string> but not <key>, eg:
<string>-XX:MaxPermSize=1024m</string>
<key> denotes a section. In this case, you are setting program arguments that fall under the <key>ProgramArguments</key> section. What you specified as key sections is probably confusing the launcher. Look at that link for a complete example and compare to yours.
Abridged example:
<plist version="1.0">
<dict>
<key>Label</key>
<string>homebrew.mxcl.jenkins</string>
<key>ProgramArguments</key>
<array>
..... more props here...
<string>-XX:MaxPermSize=256m</string>
.... more props here
</array>
... more stuff here...
</dict>
Also note the instructions for properly restarting (unloading/loading) the instance so that the changes are applied. Once you restart it, confirm that the options you set translated properly to the command line:
ps aux | grep java
The properties should be properly formatted as follows:
-XX:PermSize=512m -XX:MaxPermSize=1024m

Related

Xcode - Archives not in organizer

Today I was looking to make an archive in Xcode 12 and suddenly I can no longer see the Archives in Window -> Organizer (it will not open automatically as supposed). It will show me the alert with Build Succeeded but no archive to upload on Test Flight. I was looking in ~Library/Developer/Xcode/Archives and is there but I can't see it in Organizer.
Any reason and maybe a solution for this?
Make sure you have the correct app selected. For example, this app I have no archives shown:
But once I select the correct app, it works:
I have managed to find a solution for this. So I was using react native mapbox package which seem to have some pods issues as per this thread https://github.com/react-native-mapbox-gl/maps/issues/1097#issuecomment-770064084
Looks like the archive was malformed
Try the follow:
1 - Close XCode.
2 - Go to /Library/Developer/XCode/Archives.
3 - Find the .xarchive file that you just archived.
4 - Delete the folders that are not the targets that you just archived (if exist):
Products/Applications/your-app-dev.app
Products/Applications/your-app-stage.app
5 - Open the Info.plist file (still from the .xarchive file).
6 - Complete the file with the part that is missing:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>ApplicationProperties</key>
<dict>
<key>ApplicationPath</key>
<string>Applications/your-app.app</string>
<key>Architectures</key>
<array>
<string>arm64</string>
</array>
<key>CFBundleIdentifier</key>
<string>com.your-app.app</string>
<key>CFBundleShortVersionString</key>
<string>2.2</string>
<key>CFBundleVersion</key>
<string>42</string>
<key>SigningIdentity</key>
<string>Apple Development: Your Name (SOMEKEY123)</string>
<key>Team</key>
<string>123456789</string>
</dict>
<key>ArchiveVersion</key>
<integer>2</integer>
<key>CreationDate</key>
<date>2021-05-16T00:28:17Z</date>
<key>Name</key>
<string>your-app</string>
<key>SchemeName</key>
<string>your-app</string>
</dict>
</plist>

How to simulate keyboard and mouse events using CGEventPost in login window mac OS?

I have created a pre-login agent which uses CGEventPost for simulating keyboard. FYI I am developing a remote control app similar to teamviewer.
Keyboard
CGEventRef keyEvent = CGEventCreateKeyboardEvent( NULL, keyCode, down ) ;
CGEventPost( kCGHIDEventTap, keyEvent ) ;
CFRelease( keyEvent ) ;
Mouse
CGEventRef event = CGEventCreateMouseEvent(eventSource, eventType, mouseLocation, mouseButton );
CGEventPost(kCGHIDEventTap, event);
CFRelease(event);
Pre-login launch agent
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>my app label</string>
<key>LimitLoadToSessionType</key>
<string>LoginWindow</string>
<key>RunAtLoad</key>
<true/>
<key>WorkingDirectory</key>
<string>My app directory</string>
<key>ProgramArguments</key>
<array>
<string>app absolute path</string>
<string>service</string>
<string>myservice</string>
</array>
<key>KeepAlive</key>
<true/>
</dict>
</plist>
CGEventPost is not working, I get the following in the Console logs after login
Untrusted apps are not allowed to connect to
Window Server before login.
I have searched o chromium's remote control (which has keyboard and mouse simulation working) source code. They use CGEventPost for keyboard, but it works in login window.
https://cs.chromium.org/chromium/src/remoting/host/input_injector_mac.cc?rcl=0&l=42
They seem to use a sh file in privileged helper tools directory and use to to load the service, I tried putting our service in privileged helpers tool, but still the event handling fails.
The Deprecated API CGPostMouseEvent, CGPostKeyBoardEvent work without problem , but would really like to know how non deprecated keyboard API works in chromium.
There is undocumented (classic apple , security through obscurity) stuff you should add to binary's sections, in order to make CGEventPost magically work when running in LoginWindow Context.
If you are using gcc, add the following to the compile flags
gcc <YOUR SOURCES AND FLAGS> -sectcreate CGPreLoginApp __CGPreLoginApp /dev/null
If you are using XCode, add the following to Other Linker flags in the Build settings of the project:
"-sectcreate"
__CGPreLoginApp
__cgpreloginapp
/dev/null
Refer https://opensource.apple.com/source/IOHIDFamily/IOHIDFamily-700/IOHIDFamily.xcodeproj/project.pbxproj project file for the LDFLAGS

Newbie working on PopClip extension - AppleScript not working

I'm working on my first PopClip extension using AppleScript. I'm getting the following error when trying to install the Extension:
**
Cannot Install Extension
The path /Users/myuserdirectoryname/Desktop/ReminderNote.popclipext does no contain a valid PopClip extension.
Reason: No such file: (null)
**
I have narrowed down the problem to my AppleScript info in the Config.plist. Or so I think. When I remove the following from the Config.plist file, the extension loads fine. When I add these two lines, the error returns.
<key>AppleScript File</key>
<string>ReminderNote.applescript</string>
My ReminderNote.popclipext package includes 3 files:
Config.plist,
ReminderNote.applescript,
ReminderNote.png
Here is the full Config.plist, in case that will help.
thanks for any tips or guidance -- jay
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Version</key>
<integer>1</integer>
<key>Extension Name</key>
<string>ReminderNote</string>
<key>Extension Identifier</key>
<string>com.jel.ReminderNote</string>
<key>Extension Description</key>
<string>Create linked Reminder to Evernote using the selected text.</string>
<key>Extension Image File</key>
<string>ReminderNote.png</string>
<key>Actions</key>
<array>
<dict>
<key>Title</key>
<string>Reminder Note</string>
<key>AppleScript File</key>
<string>ReminderNote.applescript</string>
<key>Image File</key>
<string>ReminderNote.png</string>
<key>Long Running</key>
<true/>
</dict>
</array>
</dict>
</plist>
I think this could be some kind of filesystem caching bug within PopClip. Try quitting PopClip and restarting it

How can I suppress warnings in SublimeLinter for mixed spaces/tabs in comments?

Here is a link to a screenshot of the warnings:
I would like to be able to use the "cmd+/" shortcut to quickly comment out sections of code. Whenever I do, I get a bunch of space/tab mixing errors. I am required to use tabs for coding standards, but it seems Sublime 3 forces spaces for the comments. I also enjoy the error checking for space/tab mixing through non-commented code, so I would like to leave that intact if possible.
Is there a way to modify Sublime's settings to change the commenting shorcuts functionality or is there a way to modify SublimeLinter-jshint's settings to ignore these warnings?
Thanks in advance.
The easiest way to do this is to remove the space from after the //. Open your Packages folder via Preferences -> Browse Packages... and create a folder called JavaScript. I assume you're on OS X, so the full path to the folder is ~/Library/Application Support/Sublime Text 3/Packages. Next, create a new file in Sublime with the following contents:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>Comments</string>
<key>scope</key>
<string>source.js, source.json</string>
<key>settings</key>
<dict>
<key>shellVariables</key>
<array>
<dict>
<key>name</key>
<string>TM_COMMENT_START</string>
<key>value</key>
<string>//</string>
</dict>
<dict>
<key>name</key>
<string>TM_COMMENT_START_2</string>
<key>value</key>
<string>/*</string>
</dict>
<dict>
<key>name</key>
<string>TM_COMMENT_END_2</string>
<key>value</key>
<string>*/</string>
</dict>
</array>
</dict>
<key>uuid</key>
<string>A67A8BD9-A951-406F-9175-018DD4B52FD1</string>
</dict>
</plist>
and save it in the Packages/JavaScript folder as Comments.tmPreferences. You'll notice that the TM_COMMENT_START value is //, whereas in the original it's //. Restart Sublime, and now when you're editing JavaScript or JSON files and hit Command ⌘/ your code will be commented out without the addition of a space.

Creating a simple Hello World tool that runs as a daemon

I built the Command Line tool (Foundation) template in Xcode. It just logs "Hello World" to the console.There is only one class in it main.m. Here's the code:
#import <Foundation/Foundation.h>
int main (int argc, const char * argv[])
{
#autoreleasepool {
// insert code here...
NSLog(#"Hello, World!");
}
return 0;
}
Now I want to run it as a daemon and log "Hello World" to the console every 10 seconds. So I moved the product/binary to /tmp on my Mac. I created the following plist for launchd:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>helloDaemon</string>
<key>ProgramArguments</key>
<array>
<string>/tmp/helloDaemon</string>
</array>
<key>StartInterval</key>
<integer>10</integer>
</dict>
</plist>
I loaded the plist using launchctl, but I do not see any "Hello World"s in the console. Instead, I get this:
11/03/2012 00:55:35.141 com.apple.launchd: (helloDaemon) Throttling respawn: Will start in 1 seconds
11/03/2012 00:55:45.141 com.apple.launchd: (helloDaemon) Throttling respawn: Will start in 2 seconds
11/03/2012 00:55:55.140 com.apple.launchd: (helloDaemon) Throttling respawn: Will start in 3 seconds
So what's going wrong?
Just add to your launchd plist
<key>StandardOutPath</key>
<string>/yourpath/sample.log</string>
You can tail -f it afterwards.
More info is here:
http://developer.apple.com/library/mac/technotes/tn2083/_index.html#//apple_ref/doc/uid/DTS10003794-CH1-SUBSECTION39
NSLog is not working because when you launch a demon process it does not have any standard io sockets or file handles attached to it. They have to be specifically allocated. A good resource for how to create a proper daemon and how to write the console and syslog is provided in the book "Advanced Mac OS X Programming (chapter 20) by Dalrymple & Hillegass.
They have define a skeleton program that addresses the io issues you highlight. I remembered reading it a while ago and thought that maybe someday I'd need it. The authors show a sample using the syslog.h lib using openlog() and syslog() for simple communications. They also show some other lower level methods for communication to files and even sockets (for servers, etc).
I always appreciate when someone can tell me how to do something rather than reference something, but in this case, that is the best I can do. good luck.
With the following keys in the plist file I get most of the logs. But sometimes I am confused if I get all the NSLog output in the log file. To me it seems sometime some logs line are missing.
I am not sure if all the NSLog output of a LaunchDaemon is logged or some are skipped due to system priority.
<key>StandardOutPath</key>
<string>/var/log/mydaemon.log</string>
<key>StandardErrorPath</key>
<string>/var/log/mydaemon.log</string>

Resources