Monthly Archives: January 2012

How to save your SharePoint password in Windows

For people who have an account with Office365, remembering the account password is quite straightforward. Office365 has their own custom security and thus we get a different log in form when we open an Access database that depends on Office365 (whether as a published web database or containing linked tables to lists on the site):

As you can see on the screenshot, you can simply check the checkboxes, “Remember Me” and “Keep me signed in” if you don’t want to get prompted for password again. Simple!

Great! But I’m not on Office365…

When you’re using a SharePoint server that’s maybe hosted somewhere else or on your network, and SharePoint is using its default setting, you’ll see a login like this:

(on Windows XP)

(on Windows 7)

The important thing to note here is that it’s not an Access thing. Access is basically calling Internet Explorer to authenticate for you. So it’s the Internet Explorer setting we want to work with, and hence why you wouldn’t find anything to do with managing authentication within Access.

“Remember Me” doesn’t mean what it says

A more accurate statement would be probably “Remember Me, if you’re allowed to”. People are understandably frustrated when they check the box then next time they still get challenged. What’s going on? Well, in name of security, Internet Explorer may not be permitted to save the password unless you make some changes to the settings. By default, it tries to automatically authenicate for Intranet, which isn’t appropriate in this case. Therefore you need to change it so that it uses username/password. To do this, we start with….

Start Menu -> Control Panel -> Internet Options:

On the dialog, select Trusted sites zone, then click the Sites button

On the dialog, clear the checkbox for “Require server verification…” and then enter the host name of your SharePoint server. You don’t need to enter the full address of where your Access application is published to or linked to, just the base address. So if your Access application has a SharePoint list linked to http://mySharePoint.local/sites/MySite, then you would just enter “mySharePoint.local”

Click “Close” to return to Internet Properties dialog, then click Custom Level.

Scroll all way to the bottom then select “Authenicate with current username and password”

Once you’re set the radio button, click OK, then OK again on Internet Properties dialog to close both dialogs and save the changes. Back on Control Panel, we go to User Account.

Note: From this point on, the steps diverge between Windows XP and Windows 7 — for those on Windows 7 scroll down further to see the steps for Windows 7.

On the Advanced tab, click Manage Passwords

Click the “Add” button.

On this page, enter the same server host name that you entered for sites dialog previously, then the username and password you use to log in to your SharePoint host.

Click OK, then Close then OK. You’re done with establishing the identity. You can now go to your Access application, login in then check the “Remember Me” this time and you won’t be challenged next time you run your Access application.

For Windows 7 users

As mentioned the last part of saving passwords diverge when you get into User Accounts. In User Accounts, you would select Manage Credentials.

On Credential Manager, select Add Generic Credentials

You would then enter the same hostname of your SharePoint server that you entered in Sites for Trusted Sites and your username/password you use to log in.

At this point, you can now run your Access Application, log in and check the “Remember Me” and it’ll actually remember next time you run your Access application.

Caveats

The steps I’ve outlined here are essentially the same steps that one would take to remember the login for any other SharePoint function. If you have your SharePoint server hosted somewhere other than Office365, they will likely have specific instructions that may differ slightly in allowing you to use “Remember Me” functionality. Thus, it may be good idea to consult with them first. Searching using “Remember Me SharePoint Internet Explorer” keywords usually will yield good results.

Furthermore, if you google a bit on the subject, you’ll find different methodologies. Some may recommend using Intranet zone instead of Trusted Sites zone in the Internet properties – there is indeed a subtle difference in behaviors between those two zones, so if you find the above instruction doesn’t work for you, give Intranet zone a try. This appears to be an version-specific issue for the Internet Explorer as well.

Can I use VBA to automate this?

This isn’t a final pronunciation but my guts says “No” on this subject. As mentioned, this is an Internet Explorer thing and Access needs to get the token after authentication, so while I believe there may be APIs that could allow you to simulate logging in, you’d be faced with problem of feeding that token to Access. One could argue this is a good thing since it makes it less likely that you’ll be hijacked and logged into someone else’s site. After all, saving passwords is a big enough security issue (e.g. it may mean someone could just waltz in, sit in any one of the workstation and they have access to the data). You could use the information above to at least get your users set up at the installation time, so it’ll be an one time thing.

Access Date Stuff – Useful Examples 3

Useful Examples

As with most things in Access, there are multiple ways to do most each of the things below, so I’ll list at least a couple of methods.  There may be more.

First Day of the Current Month

  • DateSerial(DatePart("yyyy", Date()), DatePart("m", Date()),1)
  • DateAdd("d",1-DatePart("d",Date()),Date())
  • CDate(CStr(DatePart("m",Date())) & "/1")

Used in a UDF (User Defined Function). Any of the above formulas can be substituted:

Function FirstofMonth(vdate As Date)
FirstofMonth = DateAdd("d",1-DatePart("d",Date()),Date())
End Function

Last Day of the Current Month

  • DateSerial(DatePart("yyyy",Date()),DatePart("m",Date())+1,1)-1
  • DateAdd("m",1,CDate(CStr(DatePart("m",Date())) & "/1"))-1

Used in a UDF (User Defined Function). Any of the above formulas can be substituted:

Function LastofMonth(vdate As Date)
LastofMonth =DateAdd("m",1,CDate(CStr(DatePart("m",Date())) & "/1"))-1
End Function

First Day of the Previous Month

  • DateSerial(DatePart("yyyy",Date()),DatePart("m",Date())-1,1)
  • DateAdd("m",-1,CDate(CStr(DatePart("m",Date())) & "/1"))

Used in a UDF (User Defined Function). Any of the above formulas can be substituted:

Function FirstofPrevMonth(vdate As Date)
FirstofPrevMonth=DateAdd("d",1-DatePart("d",Date()),Date()) – 1
End Function

Last Day of the Previous Month

  • DateSerial(DatePart("yyyy", Date()), DatePart("m",Date()),1)-1
  • DateAdd("d",1-DatePart("d",Date()),Date()) – 1
  • CDate(CStr(DatePart("m",Date())) & "/1") – 1

Used in a UDF (User Defined Function). Any of the above formulas can be substituted:

Function LastofPrevMonth(vdate As Date)
LastofPrevMonth=DateAdd("d",1-DatePart("d",Date()),Date())–1
End Function

First Day of the Next Month

  • DateSerial(DatePart("yyyy",Date()),DatePart("m",Date())+1,1)
  • DateAdd("m",1,CDate(CStr(DatePart("m",Date())) & "/1"))

Used in a UDF (User Defined Function). Any of the above formulas can be substituted:

Function FirstofNextMonth(vdate As Date)
FirstofNextMonth = DateAdd("m",1,CDate(CStr(DatePart("m",Date()))& "/1"))
End Function

Last Day of the Next Month

  • DateSerial(DatePart("yyyy",Date()),DatePart("m",Date())+2,1)-1
  • DateAdd("m",1,CDate(CStr(DatePart("m",Date())+1) & "/1")-1)

Used in a UDF (User Defined Function). Any of the above formulas can be substituted:

Function LastofNextMonth(vdate As Date)
LastofNextMonth = DateAdd("m",1,CDate(CStr(DatePart("m",Date())+1) & "/1")-1)
End Function

First Day of This Week

  • DateDiff("d",Weekday(Date()-1,1),Date())
  • Date()-Weekday(Date())+1

Used in a UDF (User Defined Function). Any of the above formulas can be substituted:

Function FirstofWeek(vdate As Date)
FirstofWeek= DateDiff("d",Weekday(Date()-1,1),Date())
End Function

Last Day of This Week

  • DateDiff("d",Weekday(Date()-1,1),Date())+6
  • Date()+(7-Weekday(Date()))

Used in a UDF (User Defined Function). Any of the above formulas can be substituted:

Function LastOfWeek(vdate As Date)
LastOfWeek= DateDiff("d",Weekday(Date()-1,1),Date())+6
End Function

First Work Day of This Week

  • DateDiff("d",Weekday(Date()-1,2),Date())
  • Date()-Weekday(Date())+2

Used in a UDF (User Defined Function). Any of the above formulas can be substituted:

Function FirstWorkdayOfWeek(vdate As Date)
FirstWorkdayOfWeek= DateDiff("d",Weekday(Date()-1,2),Date())
End Function

Last Work Day of This Week

  • DateDiff("d",Weekday(Date()-1,2),Date())+4
  • Date()+(6-Weekday(Date()))

Used in a UDF (User Defined Function). Any of the above formulas can be substituted:

Function LastWorkdayOfWeek(vdate As Date)
LastWorkdayOfWeek= DateDiff("d",Weekday(Date()-1,2),Date())+4
End Function

Number of Week Days

This function will calculate the number of week days between any two dates.

Function NumberOfWeekdays(begindate As Date,
                 EndDate As Date,
bolInclusive As Boolean) As Integer

Dim intCounter As Integer
Dim intMovingDate As Date
intCounter = 0
If bolInclusive Then
    intMovingDate = begindate
    EndDate = EndDate + 1
Else
    intMovingDate = begindate + 1
End If
Do While intMovingDate < EndDate
    If WeekDay(intMovingDate) <> 1 And WeekDay(intMovingDate) <> 7 Then
        intCounter = intCounter + 1
    End If
        intMovingDate = intMovingDate + 1
    Loop
NumberOfWeekdays = intCounter
End Function

Calling the function. (The third argument determines whether you want to include the begin and end dates in the weekday count.)

Sub testweekdays()
‘uses the FirstOfMonth function above. Literal dates like #1/1/2012# can also be used.
Dim intdays As Integer
    intdays = NumberOfWeekdays(FirstofMonth(Date), Date, True)
    MsgBox intdays
End Sub

image

Access Date Stuff–Using the Functions 2

Using Date Functions

Date functions (as indeed any built in or user defined functions) can be used in several ways within the database application:

  • Control Source
  • Queries
  • UDF (User Defined Functions)
  • Default Value of Field

Date Functions in the Control Source

Perhaps the easiest way to use date functions is directly in the ControlSource property of a form or report control.  What is a control?  Control is a general name for objects on forms or reports like textboxes, comboboxes, listboxes, buttons, and so forth.  Most of the time, this is going to be a textbox,

The ControlSource property determines where the control (textbox) will get it’s value.  On a "bound" control, this is usually a field from the underlying RecordSource (table or query) of the form or report.  However, controls can also be "unbound", which means it is not tied to a particular field.  In this case, you can use the Control Source to display any number of things.  An unbound control will ONLY display values.  They won’t be saved to the underlying table.

To use a date function in the ControlSource of a textbox, simply preface it with an equal sign (=), much like you do with a function in an Excel cell.

For instance to display the current date in a textbox:

=Date()

To display the someone’s age, you can use the DateDiff function to find the difference between the current date and their birth date which would have to be stored in a field like DOB.

=DateDiff("yyyy",[DOB],Date())

Notice that when the Date() function is used, you MUST use the parentheses after it.  If you don’t, Access will assume it’s a field named [Date] and it will produce an error.

Date Functions in Queries

Instead of calculating the date at the form level, you can also use the date functions in the query underlying the form or report.

To do the same age calculation in the Query Builder, I could add a calculated field like this:

Age: DateDiff("yyyy", [DOB], Date())

image

In SQL View, it would look like this:

SELECT FirstName, LastName, DOB, DateDiff("yyyy",[DOB],Date()) AS Age
FROM BirthDates;

Now, suppose instead of just listing everyone’s ages, I want to select just those records for people between 12 and 45.  I can add a criteria to my calculated field like this:

image

SELECT FirstName, LastName, DOB, DateDiff("yyyy",[DOB],Date()) AS Age
FROM BirthDates
WHERE DateDiff("yyyy",[DOB],Date()) Between 12 And 45;

Of course, that’s not the only way to do this.  I could also use the DateAdd function in the criteria of DOB, like this:

image

SELECT FirstName, LastName, DOB
FROM BirthDates
WHERE DOB Between DateAdd("yyyy",-12,Date()) And DateAdd("yyyy",-45,Date())

Here, I’m using the DateAdd with a negative value to subtract 12 and 45 years from the current date to yield the correct date range.

Date Functions in User Defined Functions (UDF)

Date functions can also be used in VBA code. If I use a particular date conversion frequently, I can create a User Defined Function (UDF) to calculate the value, which saves me from typing in the formula over and over.

For instance, if I need to calculate the age in many places, I could create the following function:

Function Age(DOB As Date) As String
    Age = (DateDiff("yyyy", [DOB], Date))
End Function

Notice that the current date function Date() is NOT followed by parentheses as it is in the ControlSource or in a Query.

This function can then be called from the ControlSource of a textbox:

image

or in a Query:

image

SELECT FirstName, LastName, DOB, age([DOB]) AS AgeInYears
FROM BirthDates;

In order to be used globally, that is, throughout the application, this function must be in a General Module rather than a module behind a form.  If it is in a module behind a form, it can ONLY be used in that form.

Date () in Default Value of Field

Lastly, you can use date functions in the Default Value of a field.  This can be useful if you want to enter a value when the record is created.  For instance, if you want the date and time the record was created, you can put =Now() in the Default Value property of a field.

image

Which will result in a the current date and time in the new record:

image

It is worth noting, however that this records the date and time that the record was CREATED, not when it was SAVED.  If the difference is important, you need to use a different method to calculate the date and time.

Similarly, if I wanted to create a date 30 days from the time the record is created, I could add:

=DateAdd("d",30,Date())

to the Default Value of the Net30 field:

image

There are some limitations, however.

You can’t use a User Defined Function in the Default Value property.  They can only be the built-in functions. You also can’t reference another field in the table.

So the following WILL NOT work in the Default Value:

=DateDiff("yyyy", [DOB], Date)
=Age([DOB])

Access Date Stuff–Functions 1

Date Functions

Microsoft Access has a variety of date functions to help you manipulate date values. Because there are so many functions, there are often multiple ways to do the same thing.  For instance, if I wanted to find the first day of this month, I could do:

DateAdd("d",1-DatePart("d",Date()),Date())
or
CDate(CStr(DatePart("m",Date())) & "/1")

And there are probably other ways as well. The purpose of this post is to explain how dates work and a few of the functions used to manipulate them.

What Are Dates?

First of all, in Access a date field stores both the date and time values as a double-precision number, that is, a whole number and decimal.  For instance, right this second, the date/time is 1/5/2012 6:53:04 AM. This value is actually stored as 40913.28686.

The whole number (40913) represents the date (1/5/2012).  This is the number of days since 1/1/1900.  The decimal (0.28686) is the fractional part of the day and represents the time (6:53:04 AM).

The implications of this is that if I want to add a day to a date value, I can simply add 1.  If I want to subtract 12 hours from a time, I can simply subtract 0.5.  This is all well and good if I am dealing only with days.  But if we want to add a month to, or find someone’s age in years or months, or add add 10 work days to a date, it becomes much more complicated.

This is where the built in date functions come in handy.  Used in combination, I can manipulate dates in terms of days, work days, weeks, months, and years; and times in hours, minutes, and seconds.

Date Functions

The some of the more useful date functions are:

  1. Date() / Now()
  2. DatePart()
  3. DateSerial()
  4. DateAdd()
  5. DateDiff()
  6. CDate()

Date() / Now()

The Date() function returns the current system date, that is, just the whole number part of the datetime (40913.0).  The Now() function returns the current date AND time, that is, both the whole number and decimal parts (40913.28686).

This is very useful (as we saw above) in determining dates relative to today’s date.  I’ll be using Date() in the examples below, but any date could be substituted.

DatePart()

The DatePart function allows you to determine the value of a given date in terms of specific intervals.  In other words, you can determine the year, month, day, week, quarter, etc, of a given date.  The syntax looks like this:

DatePart(interval, date [, firstdayofweek] [, firstweekofyear] )

Intervals:

yyyy

Year

q

Quarter

m

Month

y

Day of year

d

Day

w

Weekday

ww

Week

h

Hour

n

Minute

s

Second

The following are some examples intervals returned using DatePart:

DatePart("yyyy", Date()) returns 2012.
DatePart("m", Date()) returns 1.
DatePart("d", Date()) returns 5.
DatePart("h", Now()) returns 6.

As you can see, DatePart can also be used to return times, but you need to use the Now() function because the Date() function doesn’t return a time.

For more information, see the MS Knowledgebase article DatePart Function.

By the way, instead of the DatePart function, you can also use the Year(), Month(), Day() functions.  They work the same as the DatePart for each of their respective intervals.  I prefer to use DatePart because I can use it for everything.

DateSerial()

DateSerial(year, month, day)

The DateSerial function allows you to build a date value by giving values for the year, month, and day.  For instance, to build today’s date, I could do this:

DateSerial(2012, 1, 5)

Of course, it’s not all that useful when using literal values, but I can also use variable, which makes it extremely useful.  For instance, I could use it to create a date one year from today’s date:

DateSerial(DatePart("yyyy", Date()), DatePart("m", Date()), DatePart("d", Date()))

So I can use the other date functions to build the separate intervals and then use the DateSerial to put them all together into a date value.

For more information, see the MS Knowledgebase article DateSerial Function.

DateAdd()

DateAdd(interval, number, date)

The DateAdd function allows you to add an interval to a given date.  The intervals are the same as those for the DatePart function, ie. year, month, day, week, etc. This is extremely useful because leap years and the different number of days in a month makes it difficult to accurately add some intervals by adding days.  The DateAdd function will accurately add intervals without any additional work on your part.

For instance, above, I built date one year from today with DateSerial.  However, I could do it much easier by using the DateAdd function:

DateAdd("yyyy", 1, Date())

A date six months is as easy as:

DateAdd("m", 6, Date())

For more information, see the MS Knowledgebase article DateAdd Function.

DateDiff()

DateDiff(interval, date1, date2 [, firstdayofweek] [, firstweekofyear] )

The DateDiff function allows you to find the interval between two dates.  The interval can be any of the standard intervals as seen in the DatePart function above, ie. year, month, day, week, etc.  This is the counterpart to the DateAdd function.

The DateDiff is really useful for determining age.  For instance, to find someone’s age in years, I can to this (assumes DOB is a field holding the date of birth):

DateDiff("yyyy",[DOB],Now())

But I could just as easily find the age in months:

DateDiff("m",[DOB],Now())

For more information, see the MS Knowledgebase article DateDiff() function.

CDate()

The CDate() function is not a date function so much as a data conversion function.  You can use the CDate function to convert a string value into a Date.  The string has to be a recognizable date:

"January 2, 2012"

"12/1/2012"

You have to be a little careful if you don’t use the US Standard date format of Month Day Year.  CDate will correctly interpret both "1 December, 2011" and December 1, 2011" as 12/1/2011.  But "12/1/2011" will evaluate to December 12 even if you meant it to be January 12.

While CDate is not a date function per se, it is sometimes useful for calculating certain date values.

For more information, see the MS Knowledgebase article: Conversion Functions.

How U.S. Lost Out on iPhone Work

When Barack Obama joined Silicon Valley’s top luminaries for dinner in California last February, each guest was asked to come with a question for the president.

But as Steven P. Jobs of Apple spoke,President Obama interrupted with an inquiry of his own: what would it take to make iPhones in the United States?

Not long ago, Apple boasted that its products were made in America. Today, few are. Almost all of the 70 million iPhones, 30 million iPads and 59 million other products Apple sold last year were manufactured overseas.

Why can’t that work come home? Mr. Obama asked.

Mr. Jobs’s reply was unambiguous. “Those jobs aren’t coming back,” he said, according to another dinner guest.

The president’s question touched upon a central conviction at Apple. It isn’t just that workers are cheaper abroad. Rather, Apple’s executives believe the vast scale of overseas factories as well as the flexibility, diligence and industrial skills of foreign workers have so outpaced their American counterparts that “Made in the U.S.A.” is no longer a viable option for most Apple products.

Apple has become one of the best-known, most admired and most imitated companies on earth, in part through an unrelenting mastery of global operations. Last year, it earned over $400,000 in profit per employee, more than Goldman Sachs, Exxon Mobil or Google.

However, what has vexed Mr. Obama as well as economists and policy makers is that Apple — and many of its high-technology peers — are not nearly as avid in creating American jobs as other famous companies were in their heydays.

Apple employs 43,000 people in the United States and 20,000 overseas, a small fraction of the over 400,000 American workers at General Motors in the 1950s, or the hundreds of thousands at General Electric in the 1980s. Many more people work for Apple’s contractors: an additional 700,000 people engineer, build and assemble iPads, iPhones and Apple’s other products. But almost none of them work in the United States. Instead, they work for foreign companies in Asia, Europe and elsewhere, at factories that almost all electronics designers rely upon to build their wares.

“Apple’s an example of why it’s so hard to create middle-class jobs in the U.S. now,” said Jared Bernstein, who until last year was an economic adviser to the White House.

“If it’s the pinnacle of capitalism, we should be worried.”

Apple executives say that going overseas, at this point, is their only option. One former executive described how the company relied upon a Chinese factory to revamp iPhonemanufacturing just weeks before the device was due on shelves. Apple had redesigned the iPhone’s screen at the last minute, forcing an assembly line overhaul. New screens began arriving at the plant near midnight.

A foreman immediately roused 8,000 workers inside the company’s dormitories, according to the executive. Each employee was given a biscuit and a cup of tea, guided to a workstation and within half an hour started a 12-hour shift fitting glass screens into beveled frames. Within 96 hours, the plant was producing over 10,000 iPhones a day.

“The speed and flexibility is breathtaking,” the executive said. “There’s no American plant that can match that.”

Similar stories could be told about almost any electronics company — and outsourcing has also become common in hundreds of industries, including accounting, legal services, banking, auto manufacturing and pharmaceuticals.

But while Apple is far from alone, it offers a window into why the success of some prominent companies has not translated into large numbers of domestic jobs. What’s more, the company’s decisions pose broader questions about what corporate America owes Americans as the global and national economies are increasingly intertwined.

“Companies once felt an obligation to support American workers, even when it wasn’t the best financial choice,” said Betsey Stevenson, the chief economist at the Labor Department until last September. “That’s disappeared. Profits and efficiency have trumped generosity.”

Companies and other economists say that notion is naïve. Though Americans are among the most educated workers in the world, the nation has stopped training enough people in the mid-level skills that factories need, executives say.

To thrive, companies argue they need to move work where it can generate enough profits to keep paying for innovation. Doing otherwise risks losing even more American jobs over time, as evidenced by the legions of once-proud domestic manufacturers — including G.M. and others — that have shrunk as nimble competitors have emerged.

Apple was provided with extensive summaries of The New York Times’s reporting for this article, but the company, which has a reputation for secrecy, declined to comment.

This article is based on interviews with more than three dozen current and former Apple employees and contractors — many of whom requested anonymity to protect their jobs — as well as economists, manufacturing experts, international trade specialists, technology analysts, academic researchers, employees at Apple’s suppliers, competitors and corporate partners, and government officials.

Privately, Apple executives say the world is now such a changed place that it is a mistake to measure a company’s contribution simply by tallying its employees — though they note that Apple employs more workers in the United States than ever before.

They say Apple’s success has benefited the economy by empowering entrepreneurs and creating jobs at companies like cellular providers and businesses shipping Apple products. And, ultimately, they say curing unemployment is not their job.

“We sell iPhones in over a hundred countries,” a current Apple executive said. “We don’t have an obligation to solve America’s problems. Our only obligation is making the best product possible.”

‘I Want a Glass Screen’

In 2007, a little over a month before the iPhone was scheduled to appear in stores, Mr. Jobs beckoned a handful of lieutenants into an office. For weeks, he had been carrying a prototype of the device in his pocket.

Mr. Jobs angrily held up his iPhone, angling it so everyone could see the dozens of tiny scratches marring its plastic screen, according to someone who attended the meeting. He then pulled his keys from his jeans.

People will carry this phone in their pocket, he said. People also carry their keys in their pocket. “I won’t sell a product that gets scratched,” he said tensely. The only solution was using unscratchable glass instead. “I want a glass screen, and I want it perfect in six weeks.”

After one executive left that meeting, he booked a flight to Shenzhen, China. If Mr. Jobs wanted perfect, there was nowhere else to go.

For over two years, the company had been working on a project — code-named Purple 2 — that presented the same questions at every turn: how do you completely reimagine the cellphone? And how do you design it at the highest quality — with an unscratchable screen, for instance — while also ensuring that millions can be manufactured quickly and inexpensively enough to earn a significant profit?

The answers, almost every time, were found outside the United States. Though components differ between versions, all iPhones contain hundreds of parts, an estimated 90 percent of which are manufactured abroad. Advanced semiconductors have come from Germany and Taiwan, memory from Korea and Japan, display panels and circuitry from Korea and Taiwan, chipsets from Europe and rare metals from Africa and Asia. And all of it is put together in China.

In its early days, Apple usually didn’t look beyond its own backyard for manufacturing solutions. A few years after Apple began building the Macintosh in 1983, for instance, Mr. Jobs bragged that it was “a machine that is made in America.” In 1990, while Mr. Jobs was running NeXT, which was eventually bought by Apple, the executive told a reporter that “I’m as proud of the factory as I am of the computer.” As late as 2002, top Apple executives occasionally drove two hours northeast of their headquarters to visit the company’s iMac plant in Elk Grove, Calif.

But by 2004, Apple had largely turned to foreign manufacturing. Guiding that decision was Apple’s operations expert, Timothy D. Cook, who replaced Mr. Jobs as chief executive last August, six weeks before Mr. Jobs’s death. Most other American electronics companies had already gone abroad, and Apple, which at the time was struggling, felt it had to grasp every advantage.

In part, Asia was attractive because the semiskilled workers there were cheaper. But that wasn’t driving Apple. For technology companies, the cost of labor is minimal compared with the expense of buying parts and managing supply chains that bring together components and services from hundreds of companies.

For Mr. Cook, the focus on Asia “came down to two things,” said one former high-ranking Apple executive. Factories in Asia “can scale up and down faster” and “Asian supply chains have surpassed what’s in the U.S.” The result is that “we can’t compete at this point,” the executive said.

The impact of such advantages became obvious as soon as Mr. Jobs demanded glass screens in 2007.

For years, cellphone makers had avoided using glass because it required precision in cutting and grinding that was extremely difficult to achieve. Apple had already selected an American company, Corning Inc., to manufacture large panes of strengthened glass. But figuring out how to cut those panes into millions of iPhone screens required finding an empty cutting plant, hundreds of pieces of glass to use in experiments and an army of midlevel engineers. It would cost a fortune simply to prepare.

Then a bid for the work arrived from a Chinese factory.

When an Apple team visited, the Chinese plant’s owners were already constructing a new wing. “This is in case you give us the contract,” the manager said, according to a former Apple executive. The Chinese government had agreed to underwrite costs for numerous industries, and those subsidies had trickled down to the glass-cutting factory. It had a warehouse filled with glass samples available to Apple, free of charge. The owners made engineers available at almost no cost. They had built on-site dormitories so employees would be available 24 hours a day.

The Chinese plant got the job.

“The entire supply chain is in China now,” said another former high-ranking Apple executive. “You need a thousand rubber gaskets? That’s the factory next door. You need a million screws? That factory is a block away. You need that screw made a little bit different? It will take three hours.”

In Foxconn City

An eight-hour drive from that glass factory is a complex, known informally as Foxconn City, where the iPhone is assembled. To Apple executives, Foxconn City was further evidence that China could deliver workers — and diligence — that outpaced their American counterparts.

That’s because nothing like Foxconn City exists in the United States.

The facility has 230,000 employees, many working six days a week, often spending up to 12 hours a day at the plant. Over a quarter of Foxconn’s work force lives in company barracks and many workers earn less than $17 a day. When one Apple executive arrived during a shift change, his car was stuck in a river of employees streaming past. “The scale is unimaginable,” he said.

Foxconn employs nearly 300 guards to direct foot traffic so workers are not crushed in doorway bottlenecks. The facility’s central kitchen cooks an average of three tons of pork and 13 tons of rice a day. While factories are spotless, the air inside nearby teahouses is hazy with the smoke and stench of cigarettes.

Foxconn Technology has dozens of facilities in Asia and Eastern Europe, and in Mexico and Brazil, and it assembles an estimated 40 percent of the world’s consumer electronics for customers like Amazon, Dell, Hewlett-Packard, Motorola, Nintendo, Nokia, Samsung and Sony.

“They could hire 3,000 people overnight,” said Jennifer Rigoni, who was Apple’s worldwide supply demand manager until 2010, but declined to discuss specifics of her work. “What U.S. plant can find 3,000 people overnight and convince them to live in dorms?”

In mid-2007, after a month of experimentation, Apple’s engineers finally perfected a method for cutting strengthened glass so it could be used in the iPhone’s screen. The first truckloads of cut glass arrived at Foxconn City in the dead of night, according to the former Apple executive. That’s when managers woke thousands of workers, who crawled into their uniforms — white and black shirts for men, red for women — and quickly lined up to assemble, by hand, the phones. Within three months, Apple had sold one million iPhones. Since then, Foxconn has assembled over 200 million more.

Foxconn, in statements, declined to speak about specific clients.

“Any worker recruited by our firm is covered by a clear contract outlining terms and conditions and by Chinese government law that protects their rights,” the company wrote. Foxconn “takes our responsibility to our employees very seriously and we work hard to give our more than one million employees a safe and positive environment.”

The company disputed some details of the former Apple executive’s account, and wrote that a midnight shift, such as the one described, was impossible “because we have strict regulations regarding the working hours of our employees based on their designated shifts, and every employee has computerized timecards that would bar them from working at any facility at a time outside of their approved shift.” The company said that all shifts began at either 7 a.m. or 7 p.m., and that employees receive at least 12 hours’ notice of any schedule changes.

Foxconn employees, in interviews, have challenged those assertions.

Another critical advantage for Apple was that China provided engineers at a scale the United States could not match. Apple’s executives had estimated that about 8,700 industrial engineers were needed to oversee and guide the 200,000 assembly-line workers eventually involved in manufacturing iPhones. The company’s analysts had forecast it would take as long as nine months to find that many qualified engineers in the United States.

In China, it took 15 days.

Companies like Apple “say the challenge in setting up U.S. plants is finding a technical work force,” said Martin Schmidt, associate provost at the Massachusetts Institute of Technology. In particular, companies say they need engineers with more than high school, but not necessarily a bachelor’s degree. Americans at that skill level are hard to find, executives contend. “They’re good jobs, but the country doesn’t have enough to feed the demand,” Mr. Schmidt said.

Some aspects of the iPhone are uniquely American. The device’s software, for instance, and its innovative marketing campaigns were largely created in the United States. Apple recently built a $500 million data center in North Carolina. Crucial semiconductors inside the iPhone 4 and 4S are manufactured in an Austin, Tex., factory by Samsung, of South Korea.

But even those facilities are not enormous sources of jobs. Apple’s North Carolina center, for instance, has only 100 full-time employees. The Samsung plant has an estimated 2,400 workers.

“If you scale up from selling one million phones to 30 million phones, you don’t really need more programmers,” said Jean-Louis Gassée, who oversaw product development and marketing for Apple until he left in 1990. “All these new companies — Facebook, Google, Twitter — benefit from this. They grow, but they don’t really need to hire much.”

It is hard to estimate how much more it would cost to build iPhones in the United States. However, various academics and manufacturing analysts estimate that because labor is such a small part of technology manufacturing, paying American wages would add up to $65 to each iPhone’s expense. Since Apple’s profits are often hundreds of dollars per phone, building domestically, in theory, would still give the company a healthy reward.

But such calculations are, in many respects, meaningless because building the iPhone in the United States would demand much more than hiring Americans — it would require transforming the national and global economies. Apple executives believe there simply aren’t enough American workers with the skills the company needs or factories with sufficient speed and flexibility. Other companies that work with Apple, like Corning, also say they must go abroad.

Manufacturing glass for the iPhone revived a Corning factory in Kentucky, and today, much of the glass in iPhones is still made there. After the iPhone became a success, Corning received a flood of orders from other companies hoping to imitate Apple’s designs. Its strengthened glass sales have grown to more than $700 million a year, and it has hired or continued employing about 1,000 Americans to support the emerging market.

But as that market has expanded, the bulk of Corning’s strengthened glass manufacturing has occurred at plants in Japan and Taiwan.

“Our customers are in Taiwan, Korea, Japan and China,” said James B. Flaws, Corning’s vice chairman and chief financial officer. “We could make the glass here, and then ship it by boat, but that takes 35 days. Or, we could ship it by air, but that’s 10 times as expensive. So we build our glass factories next door to assembly factories, and those are overseas.”

Corning was founded in America 161 years ago and its headquarters are still in upstate New York. Theoretically, the company could manufacture all its glass domestically. But it would “require a total overhaul in how the industry is structured,” Mr. Flaws said. “The consumer electronics business has become an Asian business. As an American, I worry about that, but there’s nothing I can do to stop it. Asia has become what the U.S. was for the last 40 years.”

Middle-Class Jobs Fade

The first time Eric Saragoza stepped into Apple’s manufacturing plant in Elk Grove, Calif., he felt as if he were entering an engineering wonderland.

It was 1995, and the facility near Sacramento employed more than 1,500 workers. It was a kaleidoscope of robotic arms, conveyor belts ferrying circuit boards and, eventually, candy-colored iMacs in various stages of assembly. Mr. Saragoza, an engineer, quickly moved up the plant’s ranks and joined an elite diagnostic team. His salary climbed to $50,000. He and his wife had three children. They bought a home with a pool.

“It felt like, finally, school was paying off,” he said. “I knew the world needed people who can build things.”

At the same time, however, the electronics industry was changing, and Apple — with products that were declining in popularity — was struggling to remake itself. One focus was improving manufacturing. A few years after Mr. Saragoza started his job, his bosses explained how the California plant stacked up against overseas factories: the cost, excluding the materials, of building a $1,500 computer in Elk Grove was $22 a machine. In Singapore, it was $6. In Taiwan, $4.85. Wages weren’t the major reason for the disparities. Rather it was costs like inventory and how long it took workers to finish a task.

“We were told we would have to do 12-hour days, and come in on Saturdays,” Mr. Saragoza said. “I had a family. I wanted to see my kids play soccer.”

Modernization has always caused some kinds of jobs to change or disappear. As the American economy transitioned from agriculture to manufacturing and then to other industries, farmers became steelworkers, and then salesmen and middle managers. These shifts have carried many economic benefits, and in general, with each progression, even unskilled workers received better wages and greater chances at upward mobility.

But in the last two decades, something more fundamental has changed, economists say. Midwage jobs started disappearing. Particularly among Americans without college degrees, today’s new jobs are disproportionately in service occupations — at restaurants or call centers, or as hospital attendants or temporary workers — that offer fewer opportunities for reaching the middle class.

Even Mr. Saragoza, with his college degree, was vulnerable to these trends. First, some of Elk Grove’s routine tasks were sent overseas. Mr. Saragoza didn’t mind. Then the robotics that made Apple a futuristic playground allowed executives to replace workers with machines. Some diagnostic engineering went to Singapore. Middle managers who oversaw the plant’s inventory were laid off because, suddenly, a few people with Internet connections were all that were needed.

Mr. Saragoza was too expensive for an unskilled position. He was also insufficiently credentialed for upper management. He was called into a small office in 2002 after a night shift, laid off and then escorted from the plant. He taught high school for a while, and then tried a return to technology. But Apple, which had helped anoint the region as “Silicon Valley North,” had by then converted much of the Elk Grove plant into an AppleCare call center, where new employees often earn $12 an hour.

There were employment prospects in Silicon Valley, but none of them panned out. “What they really want are 30-year-olds without children,” said Mr. Saragoza, who today is 48, and whose family now includes five of his own.

After a few months of looking for work, he started feeling desperate. Even teaching jobs had dried up. So he took a position with an electronics temp agency that had been hired by Apple to check returned iPhones and iPads before they were sent back to customers. Every day, Mr. Saragoza would drive to the building where he had once worked as an engineer, and for $10 an hour with no benefits, wipe thousands of glass screens and test audio ports by plugging in headphones.

Paydays for Apple

As Apple’s overseas operations and sales have expanded, its top employees have thrived. Last fiscal year, Apple’s revenue topped $108 billion, a sum larger than the combined state budgets of Michigan, New Jersey and Massachusetts. Since 2005, when the company’s stock split, share prices have risen from about $45 to more than $427.

Some of that wealth has gone to shareholders. Apple is among the most widely held stocks, and the rising share price has benefited millions of individual investors, 401(k)’sand pension plans. The bounty has also enriched Apple workers. Last fiscal year, in addition to their salaries, Apple’s employees and directors received stock worth $2 billion and exercised or vested stock and options worth an added $1.4 billion.

The biggest rewards, however, have often gone to Apple’s top employees. Mr. Cook, Apple’s chief, last year received stock grants — which vest over a 10-year period — that, at today’s share price, would be worth $427 million, and his salary was raised to $1.4 million. In 2010, Mr. Cook’s compensation package was valued at $59 million, according to Apple’s security filings.

A person close to Apple argued that the compensation received by Apple’s employees was fair, in part because the company had brought so much value to the nation and world. As the company has grown, it has expanded its domestic work force, including manufacturing jobs. Last year, Apple’s American work force grew by 8,000 people.

While other companies have sent call centers abroad, Apple has kept its centers in the United States. One source estimated that sales of Apple’s products have caused other companies to hire tens of thousands of Americans. FedEx and United Parcel Service, for instance, both say they have created American jobs because of the volume of Apple’s shipments, though neither would provide specific figures without permission from Apple, which the company declined to provide.

“We shouldn’t be criticized for using Chinese workers,” a current Apple executive said. “The U.S. has stopped producing people with the skills we need.”

What’s more, Apple sources say the company has created plenty of good American jobs inside its retail stores and among entrepreneurs selling iPhone and iPad applications.

After two months of testing iPads, Mr. Saragoza quit. The pay was so low that he was better off, he figured, spending those hours applying for other jobs. On a recent October evening, while Mr. Saragoza sat at his MacBook and submitted another round of résumés online, halfway around the world a woman arrived at her office. The worker, Lina Lin, is a project manager in Shenzhen, China, at PCH International, which contracts with Apple and other electronics companies to coordinate production of accessories, like the cases that protect the iPad’s glass screens. She is not an Apple employee. But Mrs. Lin is integral to Apple’s ability to deliver its products.

Mrs. Lin earns a bit less than what Mr. Saragoza was paid by Apple. She speaks fluent English, learned from watching television and in a Chinese university. She and her husband put a quarter of their salaries in the bank every month. They live in a 1,080-square-foot apartment, which they share with their in-laws and son.

“There are lots of jobs,” Mrs. Lin said. “Especially in Shenzhen.”

Innovation’s Losers

Toward the end of Mr. Obama’s dinner last year with Mr. Jobs and other Silicon Valley executives, as everyone stood to leave, a crowd of photo seekers formed around the president. A slightly smaller scrum gathered around Mr. Jobs. Rumors had spread that his illness had worsened, and some hoped for a photograph with him, perhaps for the last time.

Eventually, the orbits of the men overlapped. “I’m not worried about the country’s long-term future,” Mr. Jobs told Mr. Obama, according to one observer. “This country is insanely great. What I’m worried about is that we don’t talk enough about solutions.”

At dinner, for instance, the executives had suggested that the government should reform visa programs to help companies hire foreign engineers. Some had urged the president to give companies a “tax holiday” so they could bring back overseas profits which, they argued, would be used to create work. Mr. Jobs even suggested it might be possible, someday, to locate some of Apple’s skilled manufacturing in the United States if the government helped train more American engineers.

Economists debate the usefulness of those and other efforts, and note that a struggling economy is sometimes transformed by unexpected developments. The last time analysts wrung their hands about prolonged American unemployment, for instance, in the early 1980s, the Internet hardly existed. Few at the time would have guessed that a degree in graphic design was rapidly becoming a smart bet, while studying telephone repair a dead end.

What remains unknown, however, is whether the United States will be able to leverage tomorrow’s innovations into millions of jobs.

In the last decade, technological leaps in solar and wind energy, semiconductor fabrication and display technologies have created thousands of jobs. But while many of those industries started in America, much of the employment has occurred abroad. Companies have closed major facilities in the United States to reopen in China. By way of explanation, executives say they are competing with Apple for shareholders. If they cannot rival Apple’s growth and profit margins, they won’t survive.

“New middle-class jobs will eventually emerge,” said Lawrence Katz, a Harvard economist. “But will someone in his 40s have the skills for them? Or will he be bypassed for a new graduate and never find his way back into the middle class?”

The pace of innovation, say executives from a variety of industries, has been quickened by businessmen like Mr. Jobs. G.M. went as long as half a decade between major automobile redesigns. Apple, by comparison, has released five iPhones in four years, doubling the devices’ speed and memory while dropping the price that some consumers pay.

Before Mr. Obama and Mr. Jobs said goodbye, the Apple executive pulled an iPhone from his pocket to show off a new application — a driving game — with incredibly detailed graphics. The device reflected the soft glow of the room’s lights. The other executives, whose combined worth exceeded $69 billion, jostled for position to glance over his shoulder. The game, everyone agreed, was wonderful.

There wasn’t even a tiny scratch on the screen.

David Barboza, Peter Lattman and Catherine Rampell contributed reporting.

NYTIMES

Login with different user – SharePoint Designer 2010

Have you ever been in to a situation where you want to test something with the help of login with different user’s credentials? Well, we are talking about login in the SharePoint Designer.
If you have used designer then you must know that there is no way to log in with the different user straight. You need to close designer and re open if you wish to test something with different user’s credentials.
In SharePoint Designer 2010, we have an option to do that. However not many people know this. This is because the icon which allows us to do this almost goes unnoticed.

When you click on that small user icon on down left side, it allows you to login with different user without closing SharePoint Designer.

Word 2007 Integration Tidbits

So, this post is a quick step-by-step on a couple of cool things you can do with SharePoint 2007 and Microsoft Word 2007 integration.

  • Compare versions
  • Built in site columns related to Office files
Versioning

When versioning has been turned on in a document library’s versioning settings, you have the ability to not only view a list of versions from SharePoint in the browser, but you can view versions and visually compare them from within Microsoft Word 2007 and 2010.  Here’s how:

  1. Open a Word document that exists in a SharePoint document library with versioning turned on.
  2. Click the <Review> tab in Word. (in the ribbon at the top)
  3. Click the Compare button.
    image
  4. See that there are multiple options at this point.  You can not only compare versions to each other, but you can COMBINE revisions from multiple versions… into one single document.
  5. Click the <Specific Version> button.
    CropperCapture[46]
  6. See the list of versions, which is the same list you’d see from SharePoint. 
  7. Click the <More> button at the bottom, to get even more options.  You can compare WHAT in the documents gets compared!
  8. Click to select a previous version, and then click the <Compare> button.
  9. Now you’ll see the two documents side-by-side, with a list of all the differences.  If you don’t see both on the screen, click the <Show Source Documents> button in the ribbon.
Default Document Site Columns

When looking at the list of default site columns in a SharePoint site, you may have noticed some in a group called “Core Document Columns”.  Here’s how you can put a couple of those (Author & Keywords) to use, and how they inherently integrate with Office files!

  1. In a document library, go to Document Library Settings
  2. Click “Add from existing site columns”
  3. From the “Core Document Columns” group, select Author and Keywords, Add them to the right, and click OK
    CropperCapture[47]
  4. What does this do?  Try it out.  Upload a new document to the library.  Check it out, the Author field automatically defaults to the name of the person who originally created the document in Word. Click OK.
    CropperCapture[48]
  5. What about the keywords?  Next step is to go ahead and open the file in Word, in edit mode.  Click <File> and <Save As>.
    CropperCapture[49]
  6. See in the above screenshot.  There’s the “Tags” text box.  Type a couple of keywords in there, separated by semicolons, and click Save.
  7. Go back to the document library in SharePoint.  Notice that the keywords field is now filled in with the tags that you added in Word.