tag:blogger.com,1999:blog-2144122487810973982024-03-12T22:07:53.829-04:00Niggling AspirationsHopefully a headache helper.C. L. Joneshttp://www.blogger.com/profile/08276019161318944200noreply@blogger.comBlogger38125tag:blogger.com,1999:blog-214412248781097398.post-68709173918916257132021-01-27T17:03:00.002-05:002021-01-27T17:03:59.923-05:00How to programmatically fetch an NPM package's latest version with Node JS<p>We have several front-end modules, all of which utilize a shared enterprise UI/UX library. We needed a way to keep this shared library's dependency version in sync, therefore, we needed a way to programmatically pull the latest library package version from our local registry.</p><p>I am not a big fan of utilizing dependencies to do something which we can do ourselves with minimal effort. Therefore, I put together a quick function (with some help from the <a href="https://github.com/stdarg/npmview" target="_blank">npmview</a> project) which allows us to pull the latest package version using the undocumented npm API. Note that, because it's using the undocumented API that it could break at any time. I've tested the function with npm version 6.14.10 & 6.14.11 and it seems to work fine.</p>
<pre class="prettyprint">
<code class="language-js">const npm = require('npm');
function getLatestPackageVersion() {
return new Promise(function (resolve, reject) {
npm.load({ loglevel: 'silent' }, function (err) {
if (err) {
reject(`Failed to initialize NPM: ${err.toString()}`);
return;
}
// A hack to shut the NPM registry the hell up -- taken from npmview -- may not always work
if (npm && npm.registry && npm.registry.log && npm.registry.log.level) {
npm.registry.log.level = 'silent';
}
// Replace lodash with the package you'd like to fetch the latest version of
npm.commands.show(['lodash', 'version'], true, function (err, data) {
if (err) {
reject(`Failed to get latest package version: ${err.toString()}`);
return;
}
// Resolve with the latest package version
resolve(Object.keys(data)[0]);
});
});
});
}
async function main() {
try {
console.log('Latest version: ', await getLatestPackageVersion());
} catch (error) {
console.error('Error: ', error);
}
}
main();
</code></pre>C. L. Joneshttp://www.blogger.com/profile/08276019161318944200noreply@blogger.com0tag:blogger.com,1999:blog-214412248781097398.post-8248619154695252812020-10-19T11:16:00.009-04:002020-10-19T21:14:29.257-04:00Cinnamon boots to black screen with cursor, then restarts in a loop, the logs reference systemd / dbus timeout<p>I've been running Linux Mint now for ~10 years after earlier forays into Gentoo, Slackware & Arch. Back when I was a teenager and I didn't have the cash to purchase new
hardware and needed to squeeze every inch of performance out of my
machines, distributions which gave me fine-grained control of what was running in the kernel & user space not only gave me this last bit of performance, but also taught me a lot about running Linux & GNU in general.</p><p>Since moving over to Linux Mint, things have usually "just worked" without the need for me to actively manage my OS. Unfortunately, computers are computers and sometimes things break. I don't have to reboot often, though I do like to keep my machine up-to-date. After keeping my machine up for a month or two, I noticed that suddenly I was experiencing catastrophic failure--the network was working, but Network Manager was not. I was unable to perform many tasks on the machine, therefore, I rebooted.</p><p>The machine appeared to reboot fine, albeit taking ~5 minutes longer than normal, though once I entered into X is when I noticed that lightdm was <i>not</i> coming up--I would see a pointer on a black screen before X cycled into a loop, exiting to a blinking cursor and then back to the black screen with pointer.</p><p>Quickly dropping into my terminal & killing lightdm, I began reviewing the lightdm logs to see exactly where the problem lay. I saw several lines like so:</p><p><span style="font-family: courier; font-size: small;">WARNING: Failed to get list of logind seats: GDBus.Error:org.freedesktop.DBus.Error.TimedOut: Failed to activate service 'org.freedesktop.login1': timed out (service_start_timeout=25000ms)</span></p><p><span style="font-family: courier; font-size: x-small;"><span style="font-family: "Times New Roman"; font-size: medium;">And so:</span></span></p><p><span style="font-family: courier; font-size: small;">WARNING: Error getting user list from org.freedesktop.Accounts: GDBus.Error:org.freedesktop.DBus.Error.TimedOut: Failed to activate service 'org.freedesktop.Accounts': timed out (service_start_timeout=25000ms)</span></p><p>Thinking possibly that a package broke my system, I proceeded to perform an apt update / apt upgrade, though while running apt I also was seeing the following suspicious error:</p><div style="text-align: left;"><span style="font-size: small;"><span style="font-family: courier;">Error: Timeout was reached<br /></span><span style="font-family: courier;">Reading package lists... Done</span></span></div><div style="text-align: left;"><span style="font-family: courier; font-size: small;"><br /></span></div><div style="text-align: left;">Digging into my syslog also showed multiple service start failures, all pointing back to a DBus timeout:</div><div style="text-align: left;"><span style="font-size: small;"><br /></span></div><div style="text-align: left;"><div><span style="font-family: courier; font-size: small;">Oct 18 16:13:14 hostname accounts-daemon[1173]: error getting polkit authority: Error initializing authority: Error calling StartServiceByName for org.freedesktop.PolicyKit1: GDBus.Error:org.freedesktop.DBus.Error.TimedOut: Failed to activate service 'org.freedesktop.PolicyKit1': timed out (service_start_timeout=25000ms)</span></div><div><span style="font-family: courier; font-size: small;">Oct 18 16:13:14 hostname udisksd[1164]: Error initializing polkit authority: Error initializing authority: Error calling StartServiceByName for org.freedesktop.PolicyKit1: GDBus.Error:org.freedesktop.DBus.Error.TimedOut: Failed to activate service 'org.freedesktop.PolicyKit1': timed out (service_start_timeout=25000ms) (g-dbus-error-quark, 20)</span></div><div><span style="font-family: courier; font-size: small;">Oct 18 16:13:14 hostname ModemManager[1172]: <warn> failed to create PolicyKit authority: 'Error initializing authority: Error calling StartServiceByName for org.freedesktop.PolicyKit1: GDBus.Error:org.freedesktop.DBus.Error.TimedOut: Failed to activate service 'org.freedesktop.PolicyKit1': timed out (service_start_timeout=25000ms)'</span></div><div><span style="font-family: courier; font-size: x-small;"><br /></span></div><div>After doing some research I came across some posts regarding the transition away from /var/run/dbus as a standalone folder, and rather a symlink to /run/dbus:</div><div> </div><div><ul style="text-align: left;"><li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=75515">https://bugs.freedesktop.org/show_bug.cgi?id=75515</a></li><li><a href="https://bugs.launchpad.net/ubuntu/+source/dbus/+bug/811441">https://bugs.launchpad.net/ubuntu/+source/dbus/+bug/811441</a></li><li><a href="https://forums.gentoo.org/viewtopic-t-1090156-start-0.html">https://forums.gentoo.org/viewtopic-t-1090156-start-0.html</a> </li></ul> <br /></div><div><div>Clearly, there was something wrong with my /var/run configuration--after checking, it appears that some package had replaced /var/run with a real folder--instead of a symlink to /run.</div></div><div><br /></div><div>After re-creating the symlink with the following command and rebooting, everything was back to normal 🎉:</div><div><br /></div><div><span style="font-family: courier; font-size: small;">ln -s /run /var/run</span></div><div><span style="font-family: courier; font-size: x-small;"><br /></span></div><div><i>Note: After writing this blog post, I realized that the root cause of the issue & the solution were clearly documented on the Linux Mint Releases & Announcements form here: <a href="https://forums.linuxmint.com/viewtopic.php?t=331605">https://forums.linuxmint.com/viewtopic.php?t=331605</a></i></div></div>C. L. Joneshttp://www.blogger.com/profile/08276019161318944200noreply@blogger.com0tag:blogger.com,1999:blog-214412248781097398.post-48051390386474176702020-09-29T23:52:00.003-04:002020-09-29T23:52:55.822-04:00The npm pack command works fine manually, but refuses to work when utilizing a Gradle wrapper<p>It's been a while since my lost post and since then I've moved far into the world of JavaScript development (primarily the React/Angular space). I just came across something I spent <i>entirely</i> too long on, which I definitely want to share in case someone else makes the same mistake I did.</p><p>We recently began migrating our NPM pipelines to a Jenkins / Gradle based system. With the introduction of Gradle, we needed to create an NPM wrapper script which would be able to properly produce our library artifact (via npm pack), via the same steps are our current build system performed, and naturally in the same order.</p><p>Knowing this was the case, I went ahead and determined the steps which were currently called so I could test them manually and ensured they also produced the appropriate artifact. These steps were actually extremely simple & standard for an NPM library:</p><ul style="text-align: left;"><li>npm install</li><li>npm run build</li><li>npm pack</li><li>npm publish artifact-1.0.45.tgz --registry https://our-internal-registry.local/artifactory/api/npm/repo-artifact-npm</li></ul><p>Straight forward enough, I went ahead & developed a Gradle script which would call the first three steps in the appropriate order. Though the plugin has since been deprecated, I was already familiar with the <a href="https://plugins.gradle.org/plugin/com.moowork.node">com.moowork.node</a> Gradle plugin. Knowing I didn't need much to spin up a simple script, I went ahead & developed the following:</p><!--HTML generated using hilite.me--><div style="background: rgb(255, 255, 255) none repeat scroll 0% 0%; border-color: gray; border-image: none 100% / 1 / 0 stretch; border-style: solid; border-width: 0.1em 0.1em 0.1em 0.8em; border: medium solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"><pre style="line-height: 125%; margin: 0px;">apply <span style="color: #997700; font-weight: bold;">plugin:</span> <span style="background-color: #fff0f0;">"com.moowork.node"</span>
defaultTasks <span style="background-color: #fff0f0;">'artifactNpmPack'</span>
node <span style="color: #333333;">{</span>
download <span style="color: #333333;">=</span> <span style="color: #008800; font-weight: bold;">false</span>
<span style="color: #333333;">}</span>
task build <span style="color: #333333;">{</span>
dependsOn<span style="color: #333333;">(</span><span style="background-color: #fff0f0;">"artifactNpmPack"</span><span style="color: #333333;">)</span>
<span style="color: #333333;">}</span>
task <span style="color: #0066bb; font-weight: bold;">artifactNpmInstall</span><span style="color: #333333;">(</span><span style="color: #997700; font-weight: bold;">type:</span> NpmTask<span style="color: #333333;">)</span> <span style="color: #333333;">{</span>
args <span style="color: #333333;">=</span> <span style="color: #333333;">[</span><span style="background-color: #fff0f0;">'install'</span><span style="color: #333333;">]</span>
<span style="color: #333333;">}</span>
task <span style="color: #0066bb; font-weight: bold;">artifactNpmBuild</span><span style="color: #333333;">(</span><span style="color: #997700; font-weight: bold;">type:</span> NpmTask<span style="color: #333333;">)</span> <span style="color: #333333;">{</span>
args <span style="color: #333333;">=</span> <span style="color: #333333;">[</span><span style="background-color: #fff0f0;">'run'</span><span style="color: #333333;">,</span> <span style="background-color: #fff0f0;">'build'</span><span style="color: #333333;">]</span>
<span style="color: #333333;">}</span>
task <span style="color: #0066bb; font-weight: bold;">artifactNpmPack</span><span style="color: #333333;">(</span><span style="color: #997700; font-weight: bold;">type:</span> NpmTask<span style="color: #333333;">)</span> <span style="color: #333333;">{</span>
args <span style="color: #333333;">=</span> <span style="color: #333333;">[</span><span style="background-color: #fff0f0;">'pack'</span><span style="color: #333333;">]</span>
<span style="color: #333333;">}</span>
</pre></div><p>
<br />
This script should, when ran as <b>gradle build</b> essentially run the same commands as the manual ones above with no problems.</p><p>Unfortunately, I spent the next 12 hours delving into AV issues, file / folder auditing, ProcMon, and finally the NPM pack source code before determining the silly overlooked cause of my issue. What was my issue, one would ask? Well, see below (lifted from a <a href="https://stackoverflow.com/questions/46090032/npm-publish-causes-error-eperm-operation-not-permitted-unlink-errno-4" target="_blank">Stack Overflow</a> question as it's the exact same issue):<br /></p><pre class="lang-js s-code-block hljs javascript"><code>npm ERR! path c:\Temp\npm<span class="hljs-number">-20936</span>-b98f84c8\tmp\fromDir<span class="hljs-number">-02</span>dd5394\package.tgz
npm ERR! code EPERM
npm ERR! errno <span class="hljs-number">-4048</span>
npm ERR! syscall unlink
npm ERR! <span class="hljs-built_in">Error</span>: EPERM: operation not permitted, unlink <span class="hljs-string">'c:\Temp\npm-20936-b98f84c8\tmp\fromDir-02dd5394\package.tgz'</span>
npm ERR! at <span class="hljs-built_in">Error</span> (native)
npm ERR! { <span class="hljs-attr">Error</span>: EPERM: operation not permitted, unlink <span class="hljs-string">'c:\Temp\npm-20936-b98f84c8\tmp\fromDir-02dd5394\package.tgz'</span>
npm ERR! at <span class="hljs-built_in">Error</span> (native)
npm ERR! cause:
npm ERR! { <span class="hljs-attr">Error</span>: EPERM: operation not permitted, unlink <span class="hljs-string">'c:\Temp\npm-20936-b98f84c8\tmp\fromDir-02dd5394\package.tgz'</span>
npm ERR! at <span class="hljs-built_in">Error</span> (native)
npm ERR! errno: <span class="hljs-number">-4048</span>,
npm ERR! code: <span class="hljs-string">'EPERM'</span>,
npm ERR! syscall: <span class="hljs-string">'unlink'</span>,
npm ERR! path: <span class="hljs-string">'c:\\Temp\\npm-20936-b98f84c8\\tmp\\fromDir-02dd5394\\package.tgz'</span> },
npm ERR! isOperational: <span class="hljs-literal">true</span>,
npm ERR! stack: <span class="hljs-string">'Error: EPERM: operation not permitted, unlink \'c:\\Temp\\npm-20936-b98f84c8\\tmp\\fromDir-02dd5394\\package.tgz\'\n at Error (native)'</span>,
npm ERR! errno: <span class="hljs-number">-4048</span>,
npm ERR! code: <span class="hljs-string">'EPERM'</span>,
npm ERR! syscall: <span class="hljs-string">'unlink'</span>,
npm ERR! path: <span class="hljs-string">'c:\\Temp\\npm-20936-b98f84c8\\tmp\\fromDir-02dd5394\\package.tgz'</span> }
npm ERR!
npm ERR! Please <span class="hljs-keyword">try</span> running <span class="hljs-built_in">this</span> command again <span class="hljs-keyword">as</span> root/Administrator.</code></pre><p>Unfortunately, the solutions which worked for others here did not work for me. After losing my mind for almost 12 hours, I discovered that I was attempting to add the "./gradle/buildOutputCleanup/buildOutputClean.lock" file into the package when running "npm pack" -- this makes sense as I didn't previously have a ".gradle" directory, and somehow it slipped my mind that it must be added to .gitignore.</p><p>The solution was simply adding the following to .gitignore, and my build was successful:</p><pre class="lang-js s-code-block hljs javascript"><code># Gradle
# .gradle/ </code></pre><pre class="lang-js s-code-block hljs javascript"><code> </code></pre>C. L. Joneshttp://www.blogger.com/profile/08276019161318944200noreply@blogger.com0tag:blogger.com,1999:blog-214412248781097398.post-36924345162846568672017-11-15T10:12:00.004-05:002019-01-08T10:31:54.797-05:00Quickly find uninstall GUID of product in Programs and FeaturesEver get tired of digging through the registry HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall and HKLM\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall keys searching for a product? Luckily, there's a much faster way to find the GUID, simply run the following command--in this case, we are searching for the Symantec uninstall string:<br />
<br />
<span style="background-color: white; color: #222222; font-size: 14.3px;"><span style="font-family: "courier new" , "courier" , monospace;">wmic </span></span><span style="background-color: white; color: #222222; font-family: "courier new", courier, monospace; font-size: 14.3px;">product get | findstr Symantec</span><br />
<br />
Though the formatting of the result is off, it's still quite easy to locate the GUID and proceed to uninstall the product like so:<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">msiexec /x {guid}</span>C. L. Joneshttp://www.blogger.com/profile/08276019161318944200noreply@blogger.com0tag:blogger.com,1999:blog-214412248781097398.post-87049295064737357182017-11-09T16:10:00.001-05:002019-04-30T09:08:37.317-04:00Skype for Business / Lync 2013 Outlook Properties Dialog ImplementationSince the advent of Office 2013, I've been increasingly frustrated with the new Outlook contact cards, and the round-about way needed to access the legacy GAL properties dialog as shown below:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZF3DMi1PkCSF_RNNouWP6uvcwkphaTX9yTdLjX9zfl4T6_9e-_rbwMVxWZxq_7dvA4G_ic3uRPVk5wQI5sNs8dhXER0VqKGpJ2CbDLuSboPcMHOm9Tup3DKgNfiV7j0W7Ct8rBitJaFY/s1600/Untitled.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="481" data-original-width="596" height="321" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZF3DMi1PkCSF_RNNouWP6uvcwkphaTX9yTdLjX9zfl4T6_9e-_rbwMVxWZxq_7dvA4G_ic3uRPVk5wQI5sNs8dhXER0VqKGpJ2CbDLuSboPcMHOm9Tup3DKgNfiV7j0W7Ct8rBitJaFY/s400/Untitled.png" width="400" /></a></div>
<br />
After a ton of research, I discovered it's possible to add custom context menus within the Lync 2013 / Skype for Business client, as per <a href="https://msdn.microsoft.com/en-us/library/office/jj945535.aspx" target="_blank">this page from Microsoft</a>. From here, I needed to discover the API necessary to actually launch the legacy GAL properties dialog box. Doing a bit of research, I simply could not find an easy way to do this, the only thing I was coming across was the following registry key, which just launched the GAL properties box from within Outlook:<br />
<br />
<span style="background-color: white; color: #444444; font-family: monospace; font-size: 16px;">HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\common\contactcard</span><br />
<span style="background-color: white; color: #444444; font-family: monospace; font-size: 16px;">DWORD: TurnOnLegacyGALDialog</span><br />
<span style="background-color: white; color: #444444; font-family: monospace; font-size: 16px;">Value: 1 (enable)</span><br />
<span style="background-color: white; color: #444444; font-family: monospace; font-size: 16px;"><br /></span>
Nearly giving up after hours of digging through the API and searching, I was provided some help via <a href="https://stackoverflow.com/users/332059/dmitry-streblechenko" style="background-color: white; border: 0px; color: #0077cc; cursor: pointer; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; font-size: 13px; font-stretch: inherit; font-variant-numeric: inherit; line-height: inherit; margin: 0px; padding: 0px; text-decoration-line: none; vertical-align: baseline;">Dmitry Streblechenko</a> on <a href="https://stackoverflow.com/questions/47146387/is-there-any-way-to-launch-the-global-address-list-gal-properties-dialog-progr" target="_blank">StackOverflow</a> (thank you, Dmitry!).<br />
<br />
In the end, I ended up with a simple VBS and registry key:<br />
<br />
<table border="0" cellpadding="0" cellspacing="0" class="MsoNormalTable" style="border-collapse: collapse; mso-padding-alt: 0in 0in 0in 0in; mso-yfti-tbllook: 1184;">
<tbody>
<tr>
<td style="border: solid windowtext 1.0pt; padding: 0in 5.4pt 0in 5.4pt; width: 467.5pt;" valign="top" width="623"><div class="MsoNormal">
<b>LaunchGALProperties.vbs<o:p></o:p></b></div>
</td>
</tr>
<tr>
<td style="border-top: none; border: solid windowtext 1.0pt; padding: 0in 5.4pt 0in 5.4pt; width: 467.5pt;" valign="top" width="623"><div class="MsoNormal">
If WScript.Arguments.Count = 2 Then<o:p></o:p></div>
<div class="MsoNormal">
Dim objOutlook : Set objOutlook =
CreateObject("Outlook.Application")<o:p></o:p></div>
<div class="MsoNormal">
Dim objNamespace : Set objNamespace =
objOutlook.GetNamespace("MAPI")<o:p></o:p></div>
<div class="MsoNormal">
<o:p></o:p></div>
<div class="MsoNormal">
objNamespace.CreateRecipient(WScript.Arguments(1)).AddressEntry.Details()<o:p></o:p></div>
<div class="MsoNormal">
<o:p></o:p></div>
<div class="MsoNormal">
Set objOutlook = Nothing<o:p></o:p></div>
<div class="MsoNormal">
Set objNamespace = Nothing<o:p></o:p></div>
<div class="MsoNormal">
End If<o:p></o:p></div>
</td>
</tr>
</tbody></table>
<br />
<div>
<div class="MsoNormal">
<br /></div>
<table border="0" cellpadding="0" cellspacing="0" class="MsoNormalTable" style="border-collapse: collapse; mso-padding-alt: 0in 0in 0in 0in; mso-yfti-tbllook: 1184;">
<tbody>
<tr style="height: 12.4pt; mso-yfti-firstrow: yes; mso-yfti-irow: 0;">
<td style="border: solid windowtext 1.0pt; height: 12.4pt; padding: 0in 5.4pt 0in 5.4pt; width: 712.85pt;" valign="top" width="891"><div class="MsoNormal">
<b>LaunchGALProperties.reg<o:p></o:p></b></div>
</td>
</tr>
<tr style="height: 135.5pt; mso-yfti-irow: 1; mso-yfti-lastrow: yes;">
<td style="border-top: none; border: solid windowtext 1.0pt; height: 135.5pt; padding: 0in 5.4pt 0in 5.4pt; width: 712.85pt;" valign="top" width="891"><div class="MsoNormal">
Windows Registry Editor Version 5.00<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Office\16.0\Lync\SessionManager\Apps\{4C13AA00-01F0-428C-B582-38E4F726D97E}]<o:p></o:p></div>
<div class="MsoNormal">
"Name"="Outlook Properties"<o:p></o:p></div>
<div class="MsoNormal">
"ApplicationType"=dword:00000000<o:p></o:p></div>
<div class="MsoNormal">
"SessionType"=dword:00000000<o:p></o:p></div>
<div class="MsoNormal">
"ExtensibleMenu"="ConversationWindowRightClick;MainWindowRightClick;MainWindowActions;ConversationWindowActions;ContactCardMenu"<o:p></o:p></div>
<div class="MsoNormal">
"ApplicationInstallPath"="C:\\\\windows\\\\System32\\\\wscript.exe"<o:p></o:p></div>
<div class="MsoNormal">
"Path"="C:\\\\windows\\\\System32\\\\wscript.exe
C:\\\\temp\\\\LaunchGALProp\\\\LaunchGALProperties.vbs
\"%user-id%\" \"%contact-id%\""<o:p></o:p></div>
<div class="MsoNormal">
</div>
</td>
</tr>
</tbody></table>
</div>
<div>
Boom! After restarting Skype for Business, I was treated with the following view:</div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjif4LsmWH1lIQZ9Q8n0zgLJ_DilLpcP2qiDv09KdTBAy3KAFNQyTTKnH9AX8ohMF7aRYcFmSE-tBa8ZsXIvScTbuLilPSorw3otU4zWQAOHYkTaNiPu7tTeQYw2aoc_A3ifPrQ6q8WJt0/s1600/Untitled.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="363" data-original-width="234" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjif4LsmWH1lIQZ9Q8n0zgLJ_DilLpcP2qiDv09KdTBAy3KAFNQyTTKnH9AX8ohMF7aRYcFmSE-tBa8ZsXIvScTbuLilPSorw3otU4zWQAOHYkTaNiPu7tTeQYw2aoc_A3ifPrQ6q8WJt0/s320/Untitled.png" width="205" /></a></div>
<div>
<br /></div>
<div>
It's quite unfortunate that Microsoft removed this functionality within the newer versions of the Lync/Skype clients, but at least with a little bit of elbow grease I was able to recover it...for now.<br />
<br />
<b>UPDATE 04/29/2019:</b><br />
<b><br /></b>
It appears that the "wscript" command is no longer working (for some reason). I was able to workaround this by creating a C# project with the following source code:<br />
<br class="Apple-interchange-newline" />
<table border="0" cellpadding="0" cellspacing="0" class="MsoNormalTable" style="border-collapse: collapse; mso-padding-alt: 0in 0in 0in 0in; mso-yfti-tbllook: 1184;"><tbody>
<tr><td style="border: 1pt solid; padding: 0in 5.4pt; width: 467.5pt;" valign="top" width="623"><div class="MsoNormal">
<b>Program.cs</b></div>
</td></tr>
<tr><td style="border: 1pt solid; padding: 0in 5.4pt; width: 467.5pt;" valign="top" width="623"><div class="MsoNormal">
using System;<br />
<br />
namespace LaunchGALProps {<br />
<span style="white-space: pre;"> </span>class Program<br />
<span style="white-space: pre;"> </span>{<br />
<span style="white-space: pre;"> </span>static void Main(string[] args) {<br />
<span style="white-space: pre;"> </span>if(args.Length == 2)<br />
<span style="white-space: pre;"> </span>{<br />
<span style="white-space: pre;"> </span>dynamic objApp;<br />
<span style="white-space: pre;"> </span>dynamic objNamespace;<br />
<br />
<span style="white-space: pre;"> </span>objApp = Activator.CreateInstance(Type.GetTypeFromProgID("Outlook.Application"));<br />
<span style="white-space: pre;"> </span>objNamespace = objApp.GetNamespace("MAPI");<br />
<span style="white-space: pre;"> </span><br />
<span style="white-space: pre;"> </span>objNamespace.CreateRecipient(args[1]).AddressEntry.Details();<br />
<span style="white-space: pre;"> </span>}<br />
<span style="white-space: pre;"> </span>}<br />
<span style="white-space: pre;"> </span>}<br />
}</div>
<div class="MsoNormal">
<div>
<br /></div>
</div>
</td></tr>
</tbody></table>
</div>
<div>
If you do not have Visual Studio installed, but you DO have .NET v4+ installed, you can compile the application like so:</div>
<div>
<br /></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">C:\Windows\Microsoft.Net\v4.0.30319\csc.exe /out:LaunchGALProps.exe Program.cs</span></div>
<div>
<br /></div>
<div>
After my program was compiled, I was able to update my registry key values for <b>ApplicationInstallPath </b>and <b>Path</b> -- once this was done everything was working again.</div>
<div>
<br /></div>
<div>
<br /></div>
C. L. Joneshttp://www.blogger.com/profile/08276019161318944200noreply@blogger.com2tag:blogger.com,1999:blog-214412248781097398.post-863352308883134562017-07-14T10:58:00.003-04:002017-07-14T10:58:59.506-04:00Find All Servers in OU Utilizing dsqueryRecently at work I needed to pull all servers from a specific OU and <span style="font-family: Courier New, Courier, monospace;">Get-ADComputer</span> was not working for some reason. I didn't feel like taking the time to figure it out so I just reverted back to handy <span style="font-family: Courier New, Courier, monospace;">dsquery</span><span style="font-family: inherit;">:</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;">dsquery * OU=Test,DC=contoso,DC=local -scope subtree -limit 999999999 -filter "(&(objectClass=Computer)(objectCategory=Computer))" -attr sAMAccountName operatingSystem</span>C. L. Joneshttp://www.blogger.com/profile/08276019161318944200noreply@blogger.com0tag:blogger.com,1999:blog-214412248781097398.post-55597378859075925002017-07-12T18:02:00.001-04:002017-07-12T18:04:02.830-04:00JavaScript Convert String to Bytes FunctionJust wanted to post a quick JavaScript convert string to bytes function just for myself, but I figured someone else may find it useful:<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">function convertToBytes(str) {</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> var bytes = [];</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> for(var i = 0; i < str.length; ++i) {</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> var charCode = str.charCodeAt(i);</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> bytes = bytes.concat([charCode & 0xff, charCode / 256 >>> 0]);</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> }</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;"> return bytes;</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">}</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: inherit;">And my slightly improved, ES6 compatible version:</span><br />
<span style="font-family: inherit;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;">function convertToBytes(str) {</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> var bytes = [];</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> Array.from(str).forEach((char) => {</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> var charCode = char.charCodeAt(char);</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> bytes = bytes.concat([charCode & 0xff, charCode / 256 >>> 0]);</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> });</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;"> return bytes;</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">}</span><br />
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<span style="font-family: inherit;">That funky bytes concatenation line simply enables the function to work with Unicode characters.</span><br />
<span style="font-family: inherit;"><br /></span>
<span style="font-family: inherit;">All credit goes out to <a href="https://stackoverflow.com/questions/6226189/how-to-convert-a-string-to-bytearray" target="_blank">BrunoLM at StackOverflow.</a></span>C. L. Joneshttp://www.blogger.com/profile/08276019161318944200noreply@blogger.com0tag:blogger.com,1999:blog-214412248781097398.post-9823388174660321572015-12-14T13:26:00.000-05:002015-12-14T13:26:03.327-05:00Microsoft KB 3109103 Breaks WebSocketsRecently my gulp live reload broke like so:<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">ws://x.x.x.x:8080/LiveReload' failed: Error during WebSocket handshake: Unexpected response code: 200</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
Even though nothing changed, I noted patches had been installed over the weekend. After looking through which files were updated, I noticed that KB 3109103 patched <span style="font-family: Courier New, Courier, monospace;">Wshrm.dll</span>. I was unable to find much useful information on this DLL, but after looking into the description it appeared to have a lot to do with sockets: Windows Sockets Helper DLL for PGM. <br />
<br />
After removing the update & rebooting my web sockets started working again.C. L. Joneshttp://www.blogger.com/profile/08276019161318944200noreply@blogger.com0tag:blogger.com,1999:blog-214412248781097398.post-33297247217121662482015-12-02T15:28:00.001-05:002015-12-02T15:28:26.988-05:00MSI Installation Failure - 1328. Error applying patch.Wow this one killed me. After attempting to determine why I simply could not install Adobe DC with our package from enterprise (though only on certain machines) I really had to dig into this one. The package would first fail with a generic:<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">Product: Adobe Acrobat DC - Update 'Adobe Acrobat DC (15.006.30060)' could not be installed. Error code 1603.</span><br />
<br />
Knowing that this is a very generic error code, I began digging through a "l*v" generated log to determine the true source of the failure.<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">MSI (s) (84:88) [14:36:07:292]: Product: Adobe Acrobat DC -- Error 1328.Error applying patch to file C:\Config.Msi\PT2AFE.tmp. It has probably been updated by other means, and can no longer be modified by this patch. For more information contact your patch vendor. System Error: -1072807676</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;">Error 1328.Error applying patch to file C:\Config.Msi\PT2AFE.tmp. It has probably been updated by other means, and can no longer be modified by this patch. For more information contact your patch vendor. System Error: -1072807676</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
Aha, so it appeared that for some reason the MSP packaged with the MSI was failing to be applied. Scrolling up through the log I was able to identify the actual failing file itself:<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">MSI (s) (84:88) [14:36:07:292]: Executing op: CacheBaselineFile(Baseline=0,FileKey=adobe_caps.dll,FilePath=C:\Program Files (x86)\Adobe\Acrobat 2015\Acrobat\<b>adobe_caps.dll</b>,,Existing=0)</span><br />
<span style="font-family: Courier New, Courier, monospace;">MSI (s) (84:88) [14:36:07:292]: Executing op: PatchApply(PatchName=adobe_caps.dll,TargetName=C:\Program Files (x86)\Adobe\Acrobat 2015\Acrobat\adobe_caps.dll,PatchSize=81904,TargetSize=552632,PerTick=0,,FileAttributes=16384,PatchAttributes=0,CheckCRC=0)</span><br />
<span style="font-family: Courier New, Courier, monospace;">MSI (s) (84:88) [14:36:07:292]: Patch for file 'C:\Program Files (x86)\Adobe\Acrobat 2015\Acrobat\adobe_caps.dll' is redirected to patch 'C:\Config.Msi\PT2AFE.tmp' instead.</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
At this point I needed to dig deeper--I know that the package installed perfectly on other machines, so why not this one? Firing up Procmon, I was able to see that msiexec.exe was hitting the "adobe_caps.dll" file here:<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">C:\Windows\Installer\$PatchCache$\Managed\68AB67CA3301FFFF7706E0F060571500\15.6.30033</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
Being unfamiliar with the "$PatchCache$" folder, I did a little research and found that files can be cached here (and only cached ONCE) for any MSP file installed on your machine. Since the installer was being pulled across the network, it looks like a network hiccup occurred and a corrupt version of the "adobe_caps.dll" (showing as 0 KB) was stored in cache.<br />
<br />
To resolve the error, all that needed to be done was to remove the entire "68AB67CA3301FFFF7706E0F060571500" folder & reinstall! Bam!!C. L. Joneshttp://www.blogger.com/profile/08276019161318944200noreply@blogger.com5tag:blogger.com,1999:blog-214412248781097398.post-45897365190239780232015-11-19T10:52:00.002-05:002018-04-24T10:57:35.121-04:00Getting NW.js (node-webkit) v0.12.3 to work with Edge.jsThis is something I <i>needed</i> to get functioning for work. Luckily it wasn't so difficult--the hardest part was attempting to figure out why after I compiled Edge.js properly for NW.js v0.12.3 why it wouldn't actually attempt to load the native "edge.node" module.<br />
<br />
First things first, we need to make sure the following is installed on your machine:<br />
<br />
<a href="http://www.microsoft.com/en-us/download/details.aspx?id=8279" target="_blank">Windows 7 SDK 7.1</a><br />
<br />
Since I already do quite a bit of development on my machine I was lucky to already have VS 2013 & the Windows 7 SDK 7.1 installed.<br />
<br />
Next, go ahead and open up the "Windows SDK 7.1 Command Prompt" from the start menu.<br />
<br />
For the next steps, Vijay Kumar has provided some excellent steps <a href="https://github.com/tjanczuk/edge/issues/105" target="_blank">here</a>:<br />
<br />
<blockquote class="tr_bq">
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 14px; line-height: 22.4px; margin-bottom: 16px;">
Brief procedure for some one who might be interested.<br />
My code was in the directory C:\tdameri\xlsxcplus\test1<br />
I used the Windows 7 SDK 7.1 command prompt (you need to have Windows 7.1 SDK installed)<br />
Commands in the command prompt</div>
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 14px; line-height: 22.4px; margin-bottom: 16px;">
setenv /x86<br />
cd C:\tdameri\xlsxcplus\test1<br />
npm install edge<br />
cd C:\tdameri\xlsxcplus\test1\node_modules\edge<br />
nw-gyp configure --target=v0.8.4<br />
nw-gyp build</div>
<h2 style="background-color: white; border-bottom-color: rgb(238, 238, 238); border-bottom-style: solid; border-bottom-width: 1px; box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 1.75em; line-height: 1.225; margin-bottom: 16px; margin-top: 1em; padding-bottom: 0.3em;">
The build happened without errors.</h2>
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 14px; line-height: 22.4px; margin-bottom: 16px;">
Copy the edge.node file from edge\build\release folder<br />
and replace the edge.node files the edge\lib folder.</div>
</blockquote>
<br />
Unfortunately it wasn't so simple as it appeared my corporate proxy was blocking or throwing 403 errors when nw-gyp was attempting to pull the NW.js headers from the Amazon AWS site. After looking through a bit of the code, I discovered "install.js" did in fact contain proxy support:<br />
<br />
<blockquote class="tr_bq">
<pre style="background-color: #f7f7f7; border-radius: 3px; box-sizing: border-box; color: #333333; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 11.9px; font-stretch: normal; line-height: 1.45; margin-bottom: 16px; overflow: auto; padding: 16px; word-wrap: normal;"><code style="background: transparent; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 11.9px; line-height: inherit; margin: 0px; max-width: initial; overflow: initial; padding: 0px; word-break: normal; word-wrap: normal;">// basic support for a proxy server
var proxyUrl = gyp.opts.proxy
|| process.env.http_proxy
|| process.env.HTTP_PROXY
|| process.env.npm_config_proxy</code></pre>
</blockquote>
Woohoo! I was able able to simply SET my "HTTP_PROXY" environment variable and move forward. A quick note is that Vijay was building for x86 while I was building for x64, therefore, the only change I needed from his steps was modifying the first line to:<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">setenv /x64</span><br />
<br />
At this point, my custom "edge.node" was building properly:<br />
<br />
<div class="separator" style="clear: both; text-align: left;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjkxvKcFUxmeEBNGvFR2O4TGRnQppagfQhcaA4uTgc0GoitLykvVFqMch7JvbLqqV9Ocx_8qTEjyJXpvbp7PCSGKgB6BdXaETr2dto2SaNtgdE0CM3Cwxzs5IFc7y9RLlEWawXtoBIVIDw/s1600/Capture.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjkxvKcFUxmeEBNGvFR2O4TGRnQppagfQhcaA4uTgc0GoitLykvVFqMch7JvbLqqV9Ocx_8qTEjyJXpvbp7PCSGKgB6BdXaETr2dto2SaNtgdE0CM3Cwxzs5IFc7y9RLlEWawXtoBIVIDw/s1600/Capture.PNG" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Following Vijay's steps above, I found that even though we have build "edge.node," we now need to copy it from:</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "courier new" , "courier" , monospace;">node_modules/edge/build/Release/edge.node</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
Over to:</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "courier new" , "courier" , monospace;">node_modules/edge/lib/native/win32/x64/<version></version></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
Speaking of my old friend Vijay--it looked like he didn't realize which folder to copy the newly compiled binary to. In my case, I figured if I was running NW.js v0.12.3--why not copy it over to the "0.12.0" directory?</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Thinking I was in the clear I attempted firing up NW.js and discovered to my horror:</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg4DC8qByt6BHbC5Wwd1soGk2i5NXCROfxdbjTzvMuN8_B4ORGuauPKvfKMdXNlArlYO4PgbmSw6HUCRuviaTQrC9KZxDsJcpPanGJZBYhZr4n-TyKS49nahh0EIitIlZhGAkJOOTj_z1k/s1600/Capture.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg4DC8qByt6BHbC5Wwd1soGk2i5NXCROfxdbjTzvMuN8_B4ORGuauPKvfKMdXNlArlYO4PgbmSw6HUCRuviaTQrC9KZxDsJcpPanGJZBYhZr4n-TyKS49nahh0EIitIlZhGAkJOOTj_z1k/s1600/Capture.PNG" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
Boo! As it turns out, the error does in fact state Edge appears to be looking for a "v1.2.0" folder. Digging into the Edge.js code more, I discovered the following under "node_modules/edge/lib/edge.js":<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">var versionMap = [</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> [ /^0\.8\./, '0.8.22' ],</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> [ /^0\.10\./, '0.10.0' ],</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> [ /^0\.12\./, '0.12.0' ],</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> [ /^4\./, '4.1.1' ]</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">];</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
Aha! So since Edge is looking to match v1.2.0, I went ahead and modified the above to so:<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">var versionMap = [</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> [ /^0\.8\./, '0.8.22' ],</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> [ /^0\.10\./, '0.10.0' ],</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> [ /^0\.12\./, '0.12.0' ],</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> [ /^4\./, '4.1.1' ],</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> [ /^1\.2\./, '1.2.0' ]</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">];</span><br />
<br />
Then proceeded to create the following directory:<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">node_modules/edge/lib/native/win32/x64/1.2.0</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
And finally dumped all the files from the "0.12.0" files into this folder. After copying the files over, boomzy:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitxF4pJXwcsGrmPVl0nHUgb8xpCiu6-Y_tMzmQ1-jZadKgSKDfQlAy8X5G6BrbL5V3BJWGrvo-EMJUCZtclkRPTxOFjbc50QwT-n2eXvQ12Auhma_pajsZwGqsMEVl6JWT9q53Us-4Ji4/s1600/Capture.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitxF4pJXwcsGrmPVl0nHUgb8xpCiu6-Y_tMzmQ1-jZadKgSKDfQlAy8X5G6BrbL5V3BJWGrvo-EMJUCZtclkRPTxOFjbc50QwT-n2eXvQ12Auhma_pajsZwGqsMEVl6JWT9q53Us-4Ji4/s1600/Capture.PNG" /></a></div>
<br />
Hope this saves someone a headache.<br />
<br />
-CJ<br />
<br />C. L. Joneshttp://www.blogger.com/profile/08276019161318944200noreply@blogger.com3tag:blogger.com,1999:blog-214412248781097398.post-19140671432793801292015-05-06T15:48:00.002-04:002015-05-06T15:48:25.974-04:00ServiceStack v3, Angular, IIS Express, Windows Authentication & CORSI've recently busted my balls trying to get ServiceStack v3/Angular/IIS Express/Windows Authentication all working together in our corporate environment. It was a bit of a nightmare but it appears I finally have it all figured out. Sorry about the crappy formatting.<br />
<br />
First of all, I am running Visual Studio 2010 so I needed to ensure that SP1 was installed so I could properly configure my site from the Properties dialog of solution explorer. First things first, you'll need to ensure that both Anonymous Authentication & Windows Authentication are enabled on the site:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhI3DCF83lfb682RytBLhmJMgC7X-mI9HLaqq_ehYeMWo7IGh0Yg8_Rw6GHXSP99VhRZ2JKUexpoN5z-4UUHdh9vM8qNIO6ufepnWCBzZxkv43zDIs3l7fhRcNMNCKZqtAyluPBO6cSIMc/s1600/capture.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhI3DCF83lfb682RytBLhmJMgC7X-mI9HLaqq_ehYeMWo7IGh0Yg8_Rw6GHXSP99VhRZ2JKUexpoN5z-4UUHdh9vM8qNIO6ufepnWCBzZxkv43zDIs3l7fhRcNMNCKZqtAyluPBO6cSIMc/s1600/capture.png" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Once you've confirmed both are enabled, head over to your web.config file and be sure you ad the following to the system.web section (OPTIONS simply would not work with Windows auth):</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<pre><system.web>
<authorization>
<allow verbs="OPTIONS" users="*"/>
<deny users="?" />
</authorization>
</system.web>
</pre>
<br />
After this is added, implement Demis' (mythz) fallback service documented here (<a href="http://stackoverflow.com/questions/19254512/servicestack-corsfeature-global-options-handler-not-firing-on-certain-routes">http://stackoverflow.com/questions/19254512/servicestack-corsfeature-global-options-handler-not-firing-on-certain-routes</a>):<br />
<br />
Request:<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">[FallbackRoute("/{Path*}")]</span><br />
<span style="font-family: Courier New, Courier, monospace;">public class Fallback</span><br />
<span style="font-family: Courier New, Courier, monospace;">{</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public string Path { get; set; }</span><br />
<span style="font-family: Courier New, Courier, monospace;">}</span><br />
<br />
Service:<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">public class FallbackService : Service</span><br />
<span style="font-family: Courier New, Courier, monospace;">{</span><br />
<span style="font-family: Courier New, Courier, monospace;"> public object Any(Fallback request)</span><br />
<span style="font-family: Courier New, Courier, monospace;"> {</span><br />
<span style="font-family: Courier New, Courier, monospace;"> if (base.Request.HttpMethod == "OPTIONS")</span><br />
<span style="font-family: Courier New, Courier, monospace;"> return null;</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"> throw HttpError.NotFound(String.Format("{0} was not found", request.Path));</span><br />
<span style="font-family: Courier New, Courier, monospace;"> }</span><br />
<span style="font-family: Courier New, Courier, monospace;">}</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: inherit;">And finally you'll need to add the following to your AppHostBase in Global.asax:</span><br />
<span style="font-family: inherit;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;">base.Plugins.Add(new CorsFeature(</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>allowedOrigins: "http://FrontendUrlHere", allowCredentials: true, allowedMethods: "GET,POST,PUT,DELETE,OPTIONS"</span><br />
<br />
<span style="font-family: Courier New, Courier, monospace;">));</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: inherit;">Be sure you replace "FrontendUrlHere" with your front-end URL. Allowed origins of "*" do not work when allowCredentials is set to true due to security reasons.</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>C. L. Joneshttp://www.blogger.com/profile/08276019161318944200noreply@blogger.com0tag:blogger.com,1999:blog-214412248781097398.post-44525450624550667472015-04-03T08:47:00.002-04:002015-04-03T08:47:21.413-04:00PsExec -- Error deriving session key: The system cannot find the file specifiedSo this one's been driving me insane for a while (especially since I figured it out a while ago and never documented the solution). On some systems I would only be able to get PsExec working half the time...the other half the time I'd receive this infuriating error:<br />
<br />
<br />
<div class="code" style="-moz-border-radius: 10px 10px 10px 10px; -moz-box-shadow: 5px 5px 5px rgb(85, 85, 85); background: none repeat scroll 0% 0% rgb(162, 162, 162); border: 3px solid rgb(100, 100, 100); color: black; margin-bottom: 1em; padding: 6px;">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">C:\Users\CJ\Downloads>psexec \\chrlcltsbx803 -i -s cmd.exe</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br /></span>
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">PsExec v2.11 - Execute processes remotely</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">Copyright (C) 2001-2014 Mark Russinovich</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">Sysinternals - www.sysinternals.com</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br /></span>
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">Error deriving session key:</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">The system cannot find the file specified.</span></div>
<br />
So after running ProcMon to determine what file "couldn't be found," I realized--I was running PsExec as my elevated administrative user <i>without a profile</i>. As in: <span style="font-family: Courier New, Courier, monospace; font-size: x-small;">runas /noprofile /user:chrl\CJ cmd.exe</span>. Unfortunately, this doesn't seem to work due to something with HKCU cryptographic keys.<br />
<br />
Either way, the issue went away once running under my elevated account without the <span style="font-family: Courier New, Courier, monospace; font-size: x-small;">/noprofile</span> switch.
Hope this saves someone a headache.C. L. Joneshttp://www.blogger.com/profile/08276019161318944200noreply@blogger.com4tag:blogger.com,1999:blog-214412248781097398.post-33535847669559444852013-04-25T12:42:00.002-04:002013-04-25T12:42:37.961-04:00Lync 2010 Error Code: 500 Internal Server Error. The received certificate has expired. (-2146893016)Our CA certificate recently expired and we were experiencing a smorgasbord of issues after renewing the CA cert itself. One issue we were running into is that our Lync mobile clients stopped connecting, and our external clients were receiving the following error:<br />
<br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">Cannot synchronize with the corporate address book. This may be because the proxy server setting in your web browser does not allow access to the address book. If the problem persists, contact your system administrator.</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br /></span>
Knowing that this was most likely related to the certificate, I checked and found my certs were up to date and working properly on both the Front End and Edge servers. The next thing I checked was attempting to use the <a href="http://www.microsoft.com/en-us/download/details.aspx?id=36535" target="_blank">Microsoft Lync Connectivity Analyzer</a>. This threw an error stating:<br />
<br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">Server discovery failed for unsecured external channel against https://lyncdiscover.tneus.com/</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br /></span>
So I attempted accessing the URL directly from a web browser and came up with the following:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjfArE44alnAck61hNKat1XkS7jHYKWJH-ipA24TGmlqeuspuarC7_ojKhFPjQEih36gBMgquhyphenhyphenM9I-3pBILRkyeD37qP3yt2Lw2sfUP9eT9kWWYHDNLJKsAcJhkZWcXmDF__vcsJQxmiw/s1600/Capture2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="275" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjfArE44alnAck61hNKat1XkS7jHYKWJH-ipA24TGmlqeuspuarC7_ojKhFPjQEih36gBMgquhyphenhyphenM9I-3pBILRkyeD37qP3yt2Lw2sfUP9eT9kWWYHDNLJKsAcJhkZWcXmDF__vcsJQxmiw/s320/Capture2.png" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Hmm, so the certificate has expired? That's strange as I had previously checked both the FE & Edge servers. Next, I checked the TMG server and performed a rule test like so:</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgm5NoMEbcwNvie7ErPk1G9ZYtkuau4Us9BUx6GZzjzVgo9QfPcKaRFjnYoDR17D7k0aiStV522MVKiloPRTZ1xXFB0JAdKvbRQ3A1SEJXizZbX5O9u_KESMrw83b0r68Y5e42GQ9kYxOg/s1600/Capture.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgm5NoMEbcwNvie7ErPk1G9ZYtkuau4Us9BUx6GZzjzVgo9QfPcKaRFjnYoDR17D7k0aiStV522MVKiloPRTZ1xXFB0JAdKvbRQ3A1SEJXizZbX5O9u_KESMrw83b0r68Y5e42GQ9kYxOg/s320/Capture.PNG" width="312" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
In the screenshot the test has passed (I took this after implementing the fix), but originally the https://lyncdiscover.xxxxx.com:4443 had failed the test with the same error reported by the web browser. At this point I realized that the certificate could not be validated as I had not installed the new internal CA trusted root certificate within the TMG server. After installing the root CA certificate all issues were now resolved.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<br />C. L. Joneshttp://www.blogger.com/profile/08276019161318944200noreply@blogger.com1tag:blogger.com,1999:blog-214412248781097398.post-32440494398755151622012-06-11T12:02:00.000-04:002012-06-11T12:02:05.420-04:00Hyper-V Server 2008 - Error: 'The requested operation could not be completed due to a file system limitation'When attempting to attach a VHD (or simply create a new virtual machine for that matter) by utilizing the Hyper-V manager on a remote computer (to manage Hyper-V Server 2008) I was having issues--I was receiving the error <span style="background-color: white; color: #222222; font-family: 'Droid Serif', Georgia, 'Times New Roman', serif; font-size: 14px; line-height: 23px; text-align: left;">Error: 'The requested operation could not be completed due to a file system limitation' w</span>hich was not too simple to figure out.<br />
<br />
Turns out I was attempting to use a UNC path to point to the VHD (as I figured I would have to). This is not the case--instead, in the management console on the remote machine I needed to use the local path on my actual Hyper-V server.<br />
<br />
This resolved my issue.C. L. Joneshttp://www.blogger.com/profile/08276019161318944200noreply@blogger.com0tag:blogger.com,1999:blog-214412248781097398.post-65674876042361504562012-04-16T13:33:00.000-04:002012-04-16T13:33:40.400-04:00Exchange 2003--How to force message stuck in 'Messages with an unreachable destination' to retryI was in the middle of a migration from Exchange 2003 to 2010 and was troubleshooting public folder replication when I noticed my replication emails to the new public folder database were stuck in the unreachable messages queue.<br />
<br />
The solution is to simply restart the SMTP service:<br />
<br />
net stop smtpsvc<br />
net start smtpsvc<br />
<br />
Then the messages flowed out the appropriate connector.C. L. Joneshttp://www.blogger.com/profile/08276019161318944200noreply@blogger.com0tag:blogger.com,1999:blog-214412248781097398.post-31066589096904262492011-07-01T17:04:00.000-04:002011-07-01T17:04:31.447-04:00Exchange 2010 HTML Mailbox Size ReportNot the prettiest thing in the world but gets the job done by printing each user's mailbox size & total items into a HTML table:<br />
<br />
<span class="Apple-style-span" style="font-family: Tahoma; font-size: x-small;">get-mailbox -database "Mailbox Database 1706745955" | get-mailboxstatistics | where {$_.objectclass -eq "Mailbox"} | sort-object totalitemsize -descending | select-object @{label="User";expression={$_.DisplayName}},@{label=<br />
"Total Size (MB)";expression={$_.TotalItemSize.Value.ToMB()}},@{label="Items";expression={$_.ItemCount}} | convertto-html | out-file report.htm</span><br />
<br />
May need to modify the mailbox database name.C. L. Joneshttp://www.blogger.com/profile/08276019161318944200noreply@blogger.com2tag:blogger.com,1999:blog-214412248781097398.post-36456749568917599342011-02-10T19:50:00.000-05:002011-02-10T19:50:05.368-05:00Windows Vista Update Error 0x80072EFDCould not update Vista SP1 due to 0x80072EFD error, so I started out by manually updating to SP2. No success. This was driving me absolutely insane until I actually read the C:\windows\windowsupdate.log file.<br />
<br />
First, try resetting the HTTP proxy through an elevated command prompt with the following command:<br />
<br />
<code>netsh winhttp show proxy</code> <br />
<br />
If you are still receiving this error, be sure you follow this KB:<br />
<br />
http://support.microsoft.com/kb/836941<br />
<br />
If this does not resolve the problem, try resetting Windows Update Components with the following Microsoft Fix It:<br />
<br />
http://support.microsoft.com/kb/971058<br />
<br />
If this still does not work, be sure that WSUS GPO & registry settings are NOT in place!<br />
<br />
First check GPO:<br />
<br />
<b>Administrative Templates->Windows Components->Windows Update</b>, under the setting "Configure automatic updates." If this is already set to "Not configured," then check registry settings under:<br />
<br />
<strong>HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate</strong><br />
<br />
For any WSUS keys. Deleting the WSUS keys I found in the registry remediated my issue.C. L. Joneshttp://www.blogger.com/profile/08276019161318944200noreply@blogger.com0tag:blogger.com,1999:blog-214412248781097398.post-62268500601473093412011-02-01T23:17:00.001-05:002011-02-01T23:19:05.598-05:00Android Corporate Exchange Setup - Username or Password IncorrectI spent a lot of time ensuring ActiveSync was working properly for a client on Exchange 2010--they have a lot of iPhones and I wanted to be sure everything top-notch.<br />
<br />
When attempting to activate a Motorola Droid 2 with the Exchange server, I kept receiving the error "Username or password incorrect" despite the fact that the username & password were both in fact correct. I was also unable to enter a server name no matter what.<br />
<br />
<b>I managed to solve the issue by entering a completely incorrect email address (user@blah.com) before finally being prompted for the server.</b> After entering the FQDN of the mail server, I was able to successfully authenticate the account.C. L. Joneshttp://www.blogger.com/profile/08276019161318944200noreply@blogger.com13tag:blogger.com,1999:blog-214412248781097398.post-29526436110016179442011-01-31T17:24:00.000-05:002011-01-31T17:24:43.958-05:00Exchange 2010 - Can't Download OABDuring a migration from Exchange 2007->Exchange 2010, I could not figure out why my OAB would not download after deleting & re-creating it.<br />
<br />
Originally, we were having an issue where Outlook 2003 clients would throw "Task 'Microsoft Exchange Server' reported error (0x8004010F): "The operation failed. An object could not be found." when attempting to send/receive. I tracked the issue down to the OAB after a short Google search. <br />
<br />
Our OAB virtual directory was actually empty, and there was no GUID folder before I found the solution below.<br />
<br />
When attempting to download the OAB directly from Exchange 2010, one would receive the message: "An error occurred while opening the Microsoft Exchange Offline Address Book files," and event ID 27 (source: Outlook), "The operation failed," would be recorded in the application event log.<br />
<br />
<a href="http://social.technet.microsoft.com/Forums/en-US/exchangesvrclients/thread/278756b4-b44e-4d74-8a6d-38b1aa67d39f/">This post</a> provided the solution. After running the command in Exchange Management Console on the 2010 server:<br />
<br />
<div style="font-family: "Courier New",Courier,monospace;"><b>update-FileDistributionService</b></div><br />
I was able to download the OAB successfully from Outlook 2010.C. L. Joneshttp://www.blogger.com/profile/08276019161318944200noreply@blogger.com2tag:blogger.com,1999:blog-214412248781097398.post-50289711148176073252010-12-25T14:43:00.000-05:002010-12-25T14:43:27.129-05:00Disable OTA Updates AndroidOk Verizon was just pissing me off by pushing the OTA updates to my phone. After dealing with "Install later" for 3 weeks, I finally managed to disable OTA updates using a trick I found on a forum.<br />
<br />
First, make sure you have adb installed & that it can pick up your device. Next, adb shell into your device & type the following commands:<br />
<br />
<div style="font-family: "Courier New",Courier,monospace;"><span style="font-size: x-small;">su<br />
mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system<br />
cd /system/etc/security<br />
mv otacerts.zip otacerts.zip.bak<br />
mount -o ro,remount -t yaffs2 /dev/block/mtdblock3 /system<br />
sync<br />
reboot </span></div>C. L. Joneshttp://www.blogger.com/profile/08276019161318944200noreply@blogger.com0tag:blogger.com,1999:blog-214412248781097398.post-80600570966428248032010-11-03T03:22:00.010-04:002010-11-03T03:49:58.253-04:00Building MochaUI.js From GitThis one really drove me insane. I recently discovered JavaScript MooTools library & it's UI component, MochaUI. MochaUI provides a powerful & easy-to-use library for developing rich internet applications (RIAs).<br />
<br />
My issue began after finding that the version on the website was highly out of date. I was looking to use OmniGrid alongside MochaUI, but the latest released version is mochaui-0.9.7.<br />
<br />
After cloning the Git, I discovered that the new Demo contained far more features, and was much better laid out than the 0.9.7 release. I also found that the JavaScript files were provided as "source" to MochaUI. This confused the hell out of me, as how would I "build" JS files?! Three hours later after scouring Google & the terrible documentation on github, I managed to find <a href="http://tbela99.blogspot.com/2010/05/building-mootools-on-windows-with.html">this</a> blog post which pointed me in the right direction.<br />
<br />
It turns out each MooTools component contains a "package.yml" YAML file which is fed to a PHP script called "Packager." Package simply concatenates the source files listed in the manifest (package.yml) together. So much for "building" the JS :/.<br />
<br />
Here's the complete steps to produce a "mochaui.js" file from github.<br />
<br />
First, clone the MochaUI codebase & cd to the new directory:<br />
<br />
<div class="code" style="-moz-border-radius: 10px 10px 10px 10px; -moz-box-shadow: 5px 5px 5px rgb(85, 85, 85); background: none repeat scroll 0% 0% rgb(162, 162, 162); border: 3px solid rgb(100, 100, 100); color: black; margin-bottom: 1em; padding: 6px;"><span style="font-size: x-small;"><span style="font-family: "Courier New",Courier,monospace;">[user@box:~/Desktop/test]$ git clone git://github.com/mui/mochaui</span><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;">Cloning into mochaui...</span><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;">remote: Counting objects: 11437, done.</span><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;">remote: Compressing objects: 100% (4806/4806), done.</span><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;">remote: Total 11437 (delta 6610), reused 10172 (delta 5745)</span><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;">Receiving objects: 100% (11437/11437), 3.29 MiB | 2.85 MiB/s, done.</span><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;">Resolving deltas: 100% (6610/6610), done.</span></span><br />
<span style="font-size: x-small;"><span style="font-family: "Courier New",Courier,monospace;">[user@box:~/Desktop/test]$ cd mochaui/ </span></span></div>Next, I had to modify the "package.yml" file to point to the correct sources directory. The original was incorrect, containing the wrong path & core files. <b>Note: You must have the source files listed in this exact order, lest nothing will work properly.</b><br />
<br />
My new "package.yml" file looked like so:<br />
<br />
<div class="code" style="-moz-border-radius: 10px 10px 10px 10px; -moz-box-shadow: 5px 5px 5px rgb(85, 85, 85); background: none repeat scroll 0% 0% rgb(162, 162, 162); border: 3px solid rgb(100, 100, 100); color: black; margin-bottom: 1em; padding: 6px;"><span style="font-family: "Courier New",Courier,monospace; font-size: x-small;">name: "MochaUI"<br />
<br />
version: "0.9.8-dev"<br />
<br />
exports: "mochaui.js"<br />
<br />
web: "[mochaui.com](http://mochaui.com/)"<br />
<br />
description: "MochaUI, A web applications user interface library"<br />
<br />
license: "[MIT License](http://mochaui.com/demo/license.txt)"<br />
<br />
copyright: "© [AUTHORS.txt]"<br />
<br />
authors:<br />
- "[Chris Doty](http://polaropposite.com/)"<br />
- "[Greg Houston](http://greghoustondesign.com/)"<br />
- "Scott F. Frederick"<br />
- "Joel Lindau"<br />
- "Harry Roberts"<br />
<br />
sources:</span><br />
<span style="font-family: "Courier New",Courier,monospace; font-size: x-small;"> - "Source/Core/Core.js"<br />
- "Source/Core/Canvas.js"<br />
- "Source/Core/Content.js"<br />
- "Source/Core/Desktop.js"<br />
- "Source/Core/Column.js"<br />
- "Source/Core/Panel.js"<br />
- "Source/Core/Dock.js"<br />
- "Source/Core/Window.js"<br />
- "Source/Core/Modal.js"<br />
- "Source/Core/Themes.js"</span></div><br />
Next, I proceded the use the same steps above to clone Packager from: <span style="font-family: "Courier New",Courier,monospace; font-size: small;">git://github.com/kamicane/packager</span>.<br />
<br />
Once cd'ed into my packager directory, I ensured that I had PHP installed. That's an entirely different subject, but if you have access to the "php" command, enter the PHP interactive shell with the command "<span style="font-family: "Courier New",Courier,monospace;">php -a<span style="font-family: inherit;">"</span></span><br />
<br />
<div class="code" style="-moz-border-radius: 10px 10px 10px 10px; -moz-box-shadow: 5px 5px 5px rgb(85, 85, 85); background: none repeat scroll 0% 0% rgb(162, 162, 162); border: 3px solid rgb(100, 100, 100); color: black; margin-bottom: 1em; padding: 6px;"><span style="font-family: "Courier New",Courier,monospace; font-size: x-small;">[user@box:~/Desktop/test/mochaui/packager]$ php -a<br />
Interactive shell<br />
<br />
php > require_once('packager.php');<br />
php > $pkg = new Packager('<span style="color: red;">replace_with_path_to_package.yml</span>');<br />
php > $pkg->write_from_files('mochaui.js', $pkg->get_all_files());<br />
php > exit</span></div><br />
Once in the interactive shell, we need to include the "packager.php" file with the require_once() method. Once PHP knows about the Packager class, we can create a new instance.<br />
<br />
As per the git's documentation (<a href="https://github.com/kamicane/packager">https://github.com/kamicane/packager</a>), we can see that the constructor to the Packager instance is simply the path to the "package.yml" manifest file. In my case, this is simply the parent directory. Next, the <span style="font-family: "Courier New",Courier,monospace;">write_from_files()</span> method takes two parameters, but we really only need to know about the first. This is the output file name. Considering we are building the "mochaui.js" file, that's what the parameter will be.<br />
<br />
After exiting the PHP shell, your Packager should now contain the fully "built" mochaui.js file.<br />
<br />
Hopefully that'll save you some time & research :).C. L. Joneshttp://www.blogger.com/profile/08276019161318944200noreply@blogger.com3tag:blogger.com,1999:blog-214412248781097398.post-11491419389862686132010-11-01T16:16:00.002-04:002010-11-01T16:16:31.904-04:00Windows XP Left Pane MissingA client recently struggled when his XP workstation's left pane disappeared. This pane contains commons tasks such as emailing files.<br />
<br />
A simple registry modficiaton was needed to remediate the issue:<br />
<br />
<pre>Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced]
"WebView"=dword:00000001
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer]
"ClassicShell"=dword:00000000</pre><pre> </pre>After applying the fix, I killed the "explorer.exe" process, then re-opened it. The pane was now visible.C. L. Joneshttp://www.blogger.com/profile/08276019161318944200noreply@blogger.com1tag:blogger.com,1999:blog-214412248781097398.post-73474319423435874482010-10-06T03:34:00.003-04:002010-10-06T04:01:51.494-04:00Gnome Decent Dual Monitor Wallpaper SpanTired of trying to use compiz to have wallpaper span both screens, only to find your desktop icons disappear? <br />
<br />
A few months ago I embarked on a relentless search through mountains of RGBA patches, custom versions of nautilus, and failed attempts at allowing desktop icons to pierce through compiz's iron curtain.<br />
<br />
Finally created a decent method of having wallpaper span dual monitors in Gnome by overriding Gnome's "Spanned" desktop setting (I don't think it works right anyway) with a "Zoomed" dual monitor setting. I first tried this by scaling the image directly, but it looked like crap so I figure Zoom would be better to use. The result is not perfect, but definitely better than waiting 15 years for the Gnome team to come up with a plausible solution.<br />
<br />
The steps I took were for Arch Linux, but you can apply them equally well to any distribution, as long as you know how to make packages from source.<br />
<br />
After reading through <a href="https://bugzilla.gnome.org/show_bug.cgi?id=603551">this bug</a>, I realized I should be modifying the desktop settings directly.<br />
<br />
I checked my Gnome version through pacman, and proceeded to download the PKGBUILD straight from the <a href="http://repos.archlinux.org/wsvn/packages/gnome-desktop/trunk/">Arch SVN</a>. After receiving the source code, I ran "makepkg" once to ensure the source would compile properly, then proceeded to comment out the following lines in the PKGBUILD file:<br />
<br />
<div class="code" style="background: none repeat scroll 0% 0% rgb(162, 162, 162); border: 3px solid rgb(100, 100, 100); color: black; margin-bottom: 1em; padding: 6px;"><span style="font-family: "Courier New",Courier,monospace;">#source=(http://ftp.gnome.org/pub/gnome/sources/${pkgname}/2.32/${pkgname}-${pkgver}.tar.bz2)</span><br />
<span style="font-family: "Courier New",Courier,monospace;">#sha256sums=('blahblah')</span></div><div style="font-family: inherit;"><br />
</div><div style="font-family: inherit;">To ensure that the source code would not be downloaded again & overwrite my modifications.</div><div style="font-family: inherit;"><br />
</div><div style="font-family: inherit;">Next, I proceeded to open the "src/gnome-desktop-2.32.0/libgnome-desktop/gnome-bg.c" file, and commented out the following line, simply copying the Gnome "Zoom" option's code to the "Span" section of the case statement:</div><br />
<div class="code" style="background: none repeat scroll 0% 0% rgb(162, 162, 162); border: 3px solid rgb(100, 100, 100); color: black; margin-bottom: 1em; padding: 6px;"><span style="font-family: "Courier New",Courier,monospace;"><span style="font-family: inherit;">#if 0<br />
g_print ("original_width: %d %d\n",<br />
gdk_pixbuf_get_width (pixbuf),<br />
gdk_pixbuf_get_height (pixbuf));<br />
#endif<br />
<br />
switch (placement) {<br />
case GNOME_BG_PLACEMENT_SPANNED:<br />
<span style="color: blue;">// new = pixbuf_scale_to_fit (pixbuf, width, height);</span><br />
<span style="color: red;">new = pixbuf_scale_to_min (pixbuf, width, height);</span><br />
break;<br />
case GNOME_BG_PLACEMENT_ZOOMED:<br />
new = pixbuf_scale_to_min (pixbuf, width, height);<br />
break;<br />
<br />
case GNOME_BG_PLACEMENT_FILL_SCREEN:<br />
new = gdk_pixbuf_scale_simple (pixbuf, width, height,<br />
GDK_INTERP_BILINEAR);<br />
break;<br />
<br />
case GNOME_BG_PLACEMENT_SCALED:<br />
new = pixbuf_scale_to_fit (pixbuf, width, height);<br />
break;<br />
<br />
case GNOME_BG_PLACEMENT_CENTERED:<br />
case GNOME_BG_PLACEMENT_TILED:<br />
default:<br />
new = pixbuf_clip_to_fit (pixbuf, width, height);<br />
break;<br />
} </span> </span></div>Finally, in the next section continaing the "GNOME_BG_PLACEMENT_SPANNED" (around 20 lines down from the previous section), I made the following modification to the code--commenting out what is commented in blue, and replaced with the code in red:<br />
<br />
<div class="code" style="background: none repeat scroll 0% 0% rgb(162, 162, 162); border: 3px solid rgb(100, 100, 100); color: black; margin-bottom: 1em; padding: 6px;"> <span style="font-family: "Courier New",Courier,monospace;">scaled = get_scaled_pixbuf (placement, pixbuf, dest_width, dest_height, &x, &y, &w, &h);</span><br />
<br />
<span style="font-family: "Courier New",Courier,monospace;"> switch (placement) {</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> case GNOME_BG_PLACEMENT_TILED:</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> pixbuf_tile (scaled, dest);</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> break;</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> case GNOME_BG_PLACEMENT_ZOOMED:</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> case GNOME_BG_PLACEMENT_CENTERED:</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> case GNOME_BG_PLACEMENT_FILL_SCREEN:</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> case GNOME_BG_PLACEMENT_SCALED:</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> pixbuf_blend (scaled, dest, 0, 0, w, h, x + area->x, y + area->y, 1.0);</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> break;</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> case GNOME_BG_PLACEMENT_SPANNED:</span><br />
<span style="color: blue; font-family: "Courier New",Courier,monospace;"> // pixbuf_blend (scaled, dest, 0, 0, w, h, x, y, 1.0);</span><br />
<span style="color: red; font-family: "Courier New",Courier,monospace;"> pixbuf_blend (scaled, dest, 0, 0, w, h, x + area->x, y + area->y, 1.0);</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> break;</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> default:</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> g_assert_not_reached ();</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> break;</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> }</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> </span><br />
<span style="font-family: "Courier New",Courier,monospace;"> g_object_unref (scaled);</span> </div><br />
From here, I saved the source, ran "makepkg -f" again, installed the package, and restarted Gnome. Not perfect, but they are nice ;)<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj1BoxM25fKo1aGDjumvBQr-jCV4sH-6onhycI9S9tH-Oy4yScHT1-7iPBOYtiQWN1Mynqsoazc0tS2PYQKEaUcgcc28cjYQ36AbAV5G895brc6VCwWa1P1kfpPx75ekMF4Gaod6Y52UNo/s1600/3rd_boobs.jpeg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="239" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj1BoxM25fKo1aGDjumvBQr-jCV4sH-6onhycI9S9tH-Oy4yScHT1-7iPBOYtiQWN1Mynqsoazc0tS2PYQKEaUcgcc28cjYQ36AbAV5G895brc6VCwWa1P1kfpPx75ekMF4Gaod6Y52UNo/s320/3rd_boobs.jpeg" width="320" /></a></div>C. L. Joneshttp://www.blogger.com/profile/08276019161318944200noreply@blogger.com8tag:blogger.com,1999:blog-214412248781097398.post-14687370790949993812010-10-04T11:39:00.000-04:002010-10-04T11:39:40.430-04:00C++ -- Why do we not dereference when passing by reference?I recently got back into trying to teach myself C++, mostly through YouTube tutorials (<a href="http://www.youtube.com/user/outofmylaboratory">this guy's are pretty good</a>). I only went to IRC for an answer at one point, but would like to share something I found & wasn't able to Google on.<br />
<br />
Everyone should know how to use pointers when working with C++.. say we had:<br />
<br />
<div class="code" style="background: none repeat scroll 0% 0% rgb(162, 162, 162); border: 3px solid rgb(100, 100, 100); color: black; margin-bottom: 1em; padding: 6px;"><div style="margin: 0.5em 0pt;"><span style="font-family: "Courier New",Courier,monospace;">#include <iostream><iostream></iostream></iostream></span><span style="font-family: "Courier New",Courier,monospace;"><iostream></iostream></span><br />
<span style="font-family: "Courier New",Courier,monospace;">using namespace std;</span></div><div style="font-family: "Courier New",Courier,monospace; margin: 0.5em 0pt;"></div><div style="font-family: "Courier New",Courier,monospace; margin: 0.5em 0pt;"><br />
</div><div style="font-family: "Courier New",Courier,monospace; margin: 0.5em 0pt;">int main()</div><div style="font-family: "Courier New",Courier,monospace; margin: 0.5em 0pt;">{</div><div style="font-family: "Courier New",Courier,monospace; margin: 0.5em 0pt;"> int num = 5;</div><div style="font-family: "Courier New",Courier,monospace; margin: 0.5em 0pt;"> int *pnum = &num;</div><div style="font-family: "Courier New",Courier,monospace; margin: 0.5em 0pt;"> cout<<"integer num (@"<<pnum><<") = "<<*pnum;</pnum></div><div style="font-family: "Courier New",Courier,monospace; margin: 0.5em 0pt;"> return 0;</div><div style="margin: 0.5em 0pt;"><span style="font-family: "Courier New",Courier,monospace;">} </span></div></div><br />
Then we can see that integer <b>num</b> is set equal to five, and integer pointer <b>pnum</b> is set to the <i>address</i> of <b>num</b>. Normally, in C++, the "&" operator refers to the address of the object the operator is being applied to.<br />
<br />
In the case of passing values to function by reference, I was quite confused when I found that we do not in fact need to dereference the reference passed as an argument. For example:<br />
<br />
<div class="code" style="background: none repeat scroll 0% 0% rgb(162, 162, 162); border: 3px solid rgb(100, 100, 100); color: black; margin-bottom: 1em; padding: 6px;"><span style="font-family: "Courier New",Courier,monospace;">#include <iostream><br />
using namespace std;<br />
<br />
void increment_variable(int & x)<br />
{<br />
x++;<br />
return;<br />
}<br />
<br />
int main()<br />
{<br />
int num = 5;<br />
<br />
increment_variable(num);<br />
<br />
cout<<"integer num (@"<<&num<<") = "<<num><<endl;><br />
return 0;<br />
}</endl;></num></iostream></span></div><br />
In the <b>increment_variable(int & x)</b> function, we would think that to increment the value of the <b>x</b> variable, we would need to dereference the address of the <b>x</b> variable, which has been passed as a parameter. As shown by the code, this is not in fact the case! <br />
<br />
In reality, the "&" operator when used with pointers is a completely different operator than the "&" used when passing values to functions by reference.<br />
<br />
Do not get the two confused!C. L. Joneshttp://www.blogger.com/profile/08276019161318944200noreply@blogger.com0tag:blogger.com,1999:blog-214412248781097398.post-61333192299010404162010-09-25T16:29:00.001-04:002010-09-25T16:30:10.471-04:00VirtualBox Adventures & Recovering plaintext data from damaged driveAs a network tech, I should always follow the golden rule of backup up data. I recently attempted resizing a partition (after neglecting this pinnacle of IT) & completed destroyed a PHP web application I had been working on.<br />
<br />
The PHP web application was stored in a VM on the host's ext4 partition, and I had managed to destroy both the superblock & journal of the host's filesystem. After an unsuccessful attempt to restore the superblock from a backup on the drive, I figured the FS to be toast, but couldn't accept that the data had been completely lost.<br />
<br />
What I really should've done was taken a DD image from the get-go with the following command:<br />
<br />
<b><span style="font-family: "Courier New",Courier,monospace;"># dd if=/dev/sda4 of=/media/Storage/Drive_Backup.img</span></b><br />
<br />
After a bit of research and IRC chat, I was directed toward the following page: <a href="http://wiki.yak.net/592">http://wiki.yak.net/592</a>. The script seemed perfect for what I had needed to do. I knew the destroyed partition had only been 0.1% non-contiguous, so my hope was to completely recover the virtual hard disk image, or at least a repairable copy.<br />
<br />
To begin, I created a test, dynamically expanding VDI file & opened it within a hex editor:<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXqddBNjU0HvUPu-U0djh-mU2Ir9ot9-WTSNPuagdVmSiakZsae6DEZuU9cq1AD0K0aDsHnyewMRzVH6PVqj-X3bjcYid1uQEZgkNdGbR8FViOQcS01NtN2YvNDuXSC51wd_uGbqEaHzU/s1600/Screenshot.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="96" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXqddBNjU0HvUPu-U0djh-mU2Ir9ot9-WTSNPuagdVmSiakZsae6DEZuU9cq1AD0K0aDsHnyewMRzVH6PVqj-X3bjcYid1uQEZgkNdGbR8FViOQcS01NtN2YvNDuXSC51wd_uGbqEaHzU/s320/Screenshot.png" width="320" /></a></div><br />
I could now see that each VDI file began with the string "<<< Sun Virtualbox Disk Image >>>"--the idea was to copy a large amount of data past where the script managed to locate things string, and to chop off the residual data with a hex editor.<br />
<br />
I proceeded to test the procedure by placing the small test VDI file on an ext4 drive, searching for the data by reading the drive byte by byte, and copying only a small amount of data (~1mb) past the point where the magic string was found. The test was successful, though I still doubted I'd be able to recover a usable VDI file.<br />
<br />
After a bit of modification to the script posted above (<a href="http://wiki.yak.net/592">http://wiki.yak.net/592</a>), I was able to successfully pick up around 10 VDI files off my dead drive (arbitrarily sized to 4GB past the magic string). After a bit of searching through these recovered VDI files, I found the exact file I was looking for. Unfortunately, my suspicions were confirmed when GRUB was found, but damaged beyond repair.<br />
<br />
At this point, after a bit more research (<a href="http://www.linux.com/community/blogs/howto-read-a-virtualbox-vm-disk-wout-starting-the-vm.html">http://www.linux.com/community/blogs/howto-read-a-virtualbox-vm-disk-wout-starting-the-vm.html</a>), I began to realize that all a VDI file did was encapsulate the virtualized file system within VirtualBox metadata.<br />
<br />
From here, I scrapped the whole idea of recovering the VDI and went directly for the plain text data off the drive itself.<br />
<br />
To search through the drive, I ran the command:<br />
<br />
<b><span style="font-family: "Courier New",Courier,monospace;">$ grep -ab "php</span>" /dev/sda4 > grepped</b><br />
<br />
As I knew I was searching for plain text files that began with "php"--the search worked flawlessly. The "-b" option on grep, also records the decimal memory address where each instance of the string was found.<br />
<br />
When the search completed, I had a list of the location of every instance of the "php" tag on the drive. This was a massive amount of data to sift through, but I managed to find the location (or at least get close to the location) of the important data I needed, by refining the search with the code's filename; for example:<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhdSvjBIGI_8c_CmoDwi5kmm7xMymeGrAeLUV62TxZFhp_5kTg0zW5uB9AxmWfHdWSsRRJbi52YuafAFrYqfCqzlTf7fluN7EdX3QXuyKRBi47XkfVBzk71kRBvNAhBnSvoV9UeYbJKTRU/s1600/Screenshot-1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="154" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhdSvjBIGI_8c_CmoDwi5kmm7xMymeGrAeLUV62TxZFhp_5kTg0zW5uB9AxmWfHdWSsRRJbi52YuafAFrYqfCqzlTf7fluN7EdX3QXuyKRBi47XkfVBzk71kRBvNAhBnSvoV9UeYbJKTRU/s320/Screenshot-1.png" width="320" /></a></div><br />
Basically, we can see that a reference to the filename "<span style="font-family: "Courier New",Courier,monospace;">MY_Controller.php</span>" & a memory address of <span style="font-family: "Courier New",Courier,monospace;">391021232450</span> (decimal). After heading over to the offset through <a href="http://wxhexeditor.sourceforge.net/">wxHexEditor</a>, I can see quite clearly that my PHP code is in fact intact:<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiT1d7l9xs9cOco1GTYdB_Mg4_zMob1_oYa-sU5Eokd1lSM74Nkq7tBAdC-z4RlH3Oof8EFbg6h5_pJvGsa5VK3HiyVFtu-UO6PS_d2vlwNTSX77c9SNY-x7FBedUd1ZqX0OEyarzCO6n4/s1600/Screenshot-2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="167" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiT1d7l9xs9cOco1GTYdB_Mg4_zMob1_oYa-sU5Eokd1lSM74Nkq7tBAdC-z4RlH3Oof8EFbg6h5_pJvGsa5VK3HiyVFtu-UO6PS_d2vlwNTSX77c9SNY-x7FBedUd1ZqX0OEyarzCO6n4/s320/Screenshot-2.png" width="320" /></a></div><br />
<br />
And it's complete with formatting & indentation :). From here, I've simply copied & pasted out each file as I found them, though some were not quite as straightforward.<br />
<br />
It'll take a lot of hard work & determination to get your files back, so you need to decide whether it's worth it.<br />
<br />
Also try out <a href="http://www.cgsecurity.org/wiki/PhotoRec">PhotoRec</a> & <a href="http://foremost.sourceforge.net/">foremost</a> if you need to recover stuff that isn't plain text.<br />
<br />
(I may post a condensed version of this document with only a short summarization of plain text data recovery techniques if anyone actually reads this)<br />
<br />
-CJC. L. Joneshttp://www.blogger.com/profile/08276019161318944200noreply@blogger.com0