Best Article to Begin Mac Development

Being a long-term C# developer, I am starting to look at “learning” one of my passions, and that being “developing on Unix”.
Thus in searching and searching for the best way to “start” – this was by far the most outstanding article 🙂
Bit outdated – but the “concept” is good.
MacZealots > Articles > Beginning Mac Development

Don't be shellfish...Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInShare on TumblrEmail this to someone

Windows Service Execute Batch Script

It seems kind of pointless to create a “service” to execute a batch script; given Windows has a Scheduler etc.
But let’s just bare with the fact that we need to get it done for a moment (which I needed too – a sake of principal), and well my aim, was to move a set of reports from Server A to Server B. Server A obviously being the “host” with the Windows Service Running that executes the batch script. Now I created a basic window server, created an installer and deployed it to Server A.A.Sample code attached. Please Note – I set the “working directory” for the Batch Script; because seemingly even with the Batch File in the location of the “Windows Service Exe”, it could not find the Batch Script. Secondly, this is what my batch script was doing:

image
Sample code attached. Please Note – I set the “working directory” for the Batch Script; because seemingly even with the Batch File in the location of the “Windows Service Exe”, it could not find the Batch Script. Secondly, this is what my batch script was doing:

net use \10.11.11.10 omamonitor1hbof /user:omaoperator
xcopy /C /F /S /D:4-1-12 c:report*
\10.11.11.10reports

Now interestingly enough, if you “create a batch script” by doing; “Add” + New Text File (in Visual Studio) and you set the file to a CONTENT type – it messes up the encoding somehow and will cause the “Batch Script” to execute erroneously. Don’t do that! Add “Existing File”.

Now after I had figured all this out, the darn script still refused to “Execute”. I could see that “status messages”, and the error message – and this is what it said

image

Here’s the KB: http://support.microsoft.com/kb/214726

Simplistically, it appeared that because the box was part of a DOMAIN – in the net use I had to specifically add in the DOMAIN ala

net use \10.11.11.10reports /u:10.11.11.10omaoperator omamonitor1hbof
xcopy /C /F /S /D:4-1-12 c:report* \10.11.11.10report

But hold on it didn’t end there – oh the woes of “WINDOWS”. URGH *Ps. I really wish Windows would simplify the “Authentication” API’s!

Now after running this this showed up in the Error Log:

Error: System error 1219 has occurred.

Now the problem here, was that there was an existing “Share” open on the BOX and thus it would not execute – and thus the following had to be implemented, and thus our final product:

net use \10.11.11.10reports /d /YES
net use \10.11.11.10reports /u:10.11.11.10omaoperator omamonitor1hbof
xcopy /C /F /S /D:4-1-12 c:report* \10.11.11.10report

That’s it, think I’m going to work on my MAC for a bit – for some sanity!

Cheers

Don't be shellfish...Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInShare on TumblrEmail this to someone

Closures in JavaScript

I have been trying to grapple or get my head around “closures” and their necessity in problem-solving. Here are some of my thoughts.
a) Closure – is a “stack/frame” of memory that is accessible when a function returns with the “state” of the function. Added to the definition, is a function only “returns” a closure, when a function contains a nested function.
That is:
image
Note – the first alert will return nothing but a string version of the method (that is itemDownloading) – however it will return a ‘stack’ with state.
You can then call “itemDownloading” which will now call the “update” (inner function) and return 30.
Wikipedia also has a pretty sweet definition:
“A closure is a function defined within another scope that has access to all the variables within the outer scope.”
Other examples as it takes a while before it sticks:
http://howtonode.org/why-use-closure
http://jibbering.com/faq/notes/closures/#clClose

Don't be shellfish...Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInShare on TumblrEmail this to someone