PCL Zip temp files location

define(‘PCLZIP_TEMPORARY_DIR’, ‘/usr/www/temp/’);

http://www.phpconcept.net/pclzip

Automate Excel faster

Turn off Screen Updating

Application.ScreenUpdating = False
at the end:
Application.ScreenUpdating = True

Turn On Manual calculation

Sub GoToManual()

Dim xlCalc As XlCalculation

xlCalc = Application.Calculation

Application.Calculation = xlCalculationManual

On Error GoTo CalcBack

‘YOUR CODE

Application.Calculation = xlCalc

Exit Sub

CalcBack:

Application.Calculation = xlCalc

End Sub

import flash.media.Sound;

import org.osmf.events.MediaPlayerStateChangeEvent;
import org.osmf.events.TimeEvent;
import org.osmf.events.PlayEvent;
import org.osmf.events.SeekEvent;

[Embed (source=”/html/data/a24x1x1.mp3″ )]
private var bounce_01:Class;
private var bounce_01_mp3:Sound = new bounce_01();
private var _soundChannel:SoundChannel;
private var _currentSndPosition:Number;
private var isPlayingSound:Boolean;

public function playSound():void {
isPlayingSound = true;
trace(“play Sound”);
_soundChannel = bounce_01_mp3.play();
_soundChannel.stop();

}

//myVideoPlayer.addEventListener(MediaPlayerStateChangeEvent.MEDIA_PLAYER_STATE_CHANGE, vpMediaPlayerStateChangeHandler);
//myVideoPlayer.addEventListener(TimeEvent.CURRENT_TIME_CHANGE, vpMediaPlayerSeekChangeHandler);

protected function vpMediaPlayerStateChangeHandler(event:MediaPlayerStateChangeEvent):void {
trace(event.state);
if(event.state == “paused”) {
if (isPlayingSound == true) {
_currentSndPosition = _soundChannel.position;
trace(_currentSndPosition);
_soundChannel.stop();}
}
else if (event.state ==”playing”) {
if (isPlayingSound == true) {
_soundChannel.stop();
_soundChannel = bounce_01_mp3.play(_currentSndPosition);
}
}
}

protected function vpMediaPlayerSeekChangeHandler(event:TimeEvent):void {
_currentSndPosition = event.time * 60;
trace(“TIME”);
trace(event.time);
}

HTML limit access to mp3/swf

SetEnvIf Referer otherdomain.co.uk internal
#

order Deny,allow
Deny from all
allow from env=internal

display chinese stored in mysql

mysql_query(“SET character_set_results=utf8”, $conn);
mb_language(‘uni’);
mb_internal_encoding(‘UTF-8’);
mysql_select_db($dbname, $conn);
mysql_query(“set names ‘utf8′”,$conn);

Event Handler

Friend Sub AddHandlerEx()

Dim application2 As ESRI.ArcGIS.Framework.IApplication = CType(My.ThisApplication, ESRI.ArcGIS.Framework.IApplication)
Dim mxDocument As ESRI.ArcGIS.ArcMapUI.IMxDocument = application2.Document
Dim activeView As ESRI.ArcGIS.Carto.IActiveView = mxDocument.ActiveView
Dim map As ESRI.ArcGIS.Carto.IMap = activeView.FocusMap
‘Step 2: Create an instance of the delegate using the AddressOf operator and add it to
‘the AfterDraw event.
m_ActiveViewEventsSelectionChanged = New ESRI.ArcGIS.Carto.IActiveViewEvents_SelectionChangedEventHandler(AddressOf OnActiveViewEventsSelectionChanged)
‘Step 3: Dynamically associate an event handler to the delegate object.
AddHandler CType(map, ESRI.ArcGIS.Carto.IActiveViewEvents_Event).SelectionChanged, m_ActiveViewEventsSelectionChanged

End Sub

Public Sub RemoveHandlerEx()
Dim application2 As ESRI.ArcGIS.Framework.IApplication = CType(My.ThisApplication, ESRI.ArcGIS.Framework.IApplication)
Dim mxDocument As ESRI.ArcGIS.ArcMapUI.IMxDocument = application2.Document
Dim activeView As ESRI.ArcGIS.Carto.IActiveView = mxDocument.ActiveView
Dim map As ESRI.ArcGIS.Carto.IMap = activeView.FocusMap
‘Step 4: Dynamically remove an event handler.
RemoveHandler CType(map, ESRI.ArcGIS.Carto.IActiveViewEvents_Event).SelectionChanged, m_ActiveViewEventsSelectionChanged
End Sub

modProgBar

modProgBar

Option Explicit On

Imports System.Windows.Forms

Module modProgBar

Public theProgBar As ProgressBar
Public theProgBarTitle As Label
Public theProgBarTitleMsg As String
Public theCallBtn As Button
Public theCallBtn2 As Button

Public Sub InitProgressBar(ByVal progMsg As String)
theProgBar.Minimum = 0
theProgBar.Maximum = 100
theProgBarTitleMsg = progMsg
theProgBarTitle.Text = progMsg & ” …”
theProgBar.Enabled = True
theProgBarTitle.Enabled = True
theCallBtn.Enabled = False
theCallBtn2.Enabled = False
End Sub

Public Sub StepProgressBar(ByVal thisNum As Long, ByVal totalNum As Long)
Dim currentPercent As Integer
‘currentPercent = Int((thisNum / totalNum) * 100)
currentPercent = modCommon.GetCeiling((thisNum / totalNum) * 100)
theProgBar.Value = currentPercent
theProgBarTitle.Text = theProgBarTitleMsg & ” (” & CStr(currentPercent) & “%) …”
System.Windows.Forms.Application.DoEvents()
End Sub

Public Sub EndProgressDialog(Optional ByVal isStep As Boolean = False)
theProgBar.Value = 0
IIf(isStep, theProgBarTitle.Text = AppName & ” – Step Done!”, theProgBarTitle.Text = AppName & ” – Task Done!”)
theProgBar.Enabled = False
theProgBarTitle.Enabled = False
theCallBtn.Enabled = True
theCallBtn2.Enabled = True
End Sub

End Module

button

With F
theProgBar = .progBar : theProgBar.Enabled = False
theProgBarTitle = .labProgTitle : theProgBarTitle.Text = “” : theProgBarTitle.Enabled = False
theCallBtn = .cmdOK
theCallBtn2 = .cmdCancel

.ShowDialog()

End With

module

Dim runflag As Long
runflag = 0 : modProgBar.InitProgressBar(“Exporting : “)

Do While Blah
runflag = runflag + 1 : modProgBar.StepProgressBar(runflag, Count)
Loop

modProgBar.EndProgressDialog()

Check if folder exists

Dim fs
fs = CreateObject(“Scripting.FileSystemObject”)
If fs.FolderExists(Me.txtFolder.Text) Then
modExcel.Export(Me.txtFolder.Text)
End If

Editing the source files in Eclipse PDT

Eclipse really wants to create a project directory to hold its metadata. However, there’s nothing that stops you from having a folder “within” a project but located outside of it.

File -> New Project

then

File -> New Folder, click “Advanced” and select “Link to folder in the file system”.

I’d suggest you avoid linking folders that exist as subdirectories of your workspace directory. Linking something that’s a subdirectory of a workspace directory will lead to a world of pain and resources being out of sync.

That is, create a project MyProject in /workspace/MyProject, but make sure foo-0.x.0 is in ~/foo or somewhere else not under /workspace.

However, if the folder is shared (from the server), it has to locate one level up, or else the “import” will fail.

iOS materials

Understanding @Class:
http://blog.prosight.me/index.php/2009/09/347

The at the end of declaring an interface: Calls a Protocol
http://blog.eddie.com.tw/2010/12/11/protocol-in-objective-c/

How to assign a Delegate

How to debug

Navigation Controllers
http://developer.apple.com/library/ios/#featuredarticles/ViewControllerPGforiPhoneOS/NavigationControllers/NavigationControllers.html#//apple_ref/doc/uid/TP40007457-CH103-SW1