Tuesday, November 20, 2012
Saturday, September 15, 2012
How to create java project in XCode 4
(1) Download the required file here and unzip it after download. http://www.2shared.com/file/vt3Flvvs/hellojava.html
Please choose the bottom blue download button in the download page.
(2) Create a new project in XCode 4, Choose "Other" -> "External Build System"
(3) Enter the Product Name say "project1". For Build Tool enter /usr/bin/ant
(4) Save the project in your disk
(5) Right click your "project1" in XCode 4 and Choose "Add Files to project1"
(6) Choose the file (build.xml) and folders (lib, resources, resources_macosx and src) in the unzipped file downloaded in step 1
Select "Copy items into destination group's folder (if needed)" and "Create groups for any added folders" and Press "Add" button.
(7) Edit build.xml and change the Project name attribute from "hellojava" to your Product Name say "project1"
(8) Edit Manifest and change the Main-Class from "hellojava" to your Product Name say "project1"
(9) Edit the filename hellojava.icns to Product Name say "project1.icns"
(10) Edit the filename hellojava.java to Product Name say "project1.java"
(11) Edit the class name in "project1.java" and change from "hellojava" to your Product Name say "project1" and then press "Command S" to save
(12) Press "Command B" to build
(13) Right click your "project1" in XCode 4 and Choose "Add Files to project1" again
(14) Choose folders (bin, dist and jars) from your save project location.
Select "Copy items into destination group's folder (if needed)" and "Create folder references for any added folders" and Press "Add" button.
(15) Select "Product" -> "Edit Scheme..." menu
(16) Select the "Run" Scheme and change the Executable "None"
(17) And Choose the "project1" app under the "dist" folder of the saved project location.
(18) Repeat the steps 16 and 17 but for the "Profile" Scheme.
(19) Press "Command R" to run. And a simple Hello World app is created with java source code.
(20) Modify the source code in "project1.java" to proceed further.
Here is the Xcode 4 Template for Java (v2)
http://www.2shared.com/file/hExLjJ1X/Java_Xcode4_template2.html
To install the template in Mac, use Terminal command
To Run after build (Command R), you have to do steps 15 to 18 above.
Please choose the bottom blue download button in the download page.
(2) Create a new project in XCode 4, Choose "Other" -> "External Build System"
(3) Enter the Product Name say "project1". For Build Tool enter /usr/bin/ant
(4) Save the project in your disk
(5) Right click your "project1" in XCode 4 and Choose "Add Files to project1"
(6) Choose the file (build.xml) and folders (lib, resources, resources_macosx and src) in the unzipped file downloaded in step 1
Select "Copy items into destination group's folder (if needed)" and "Create groups for any added folders" and Press "Add" button.
(7) Edit build.xml and change the Project name attribute from "hellojava" to your Product Name say "project1"
(8) Edit Manifest and change the Main-Class from "hellojava" to your Product Name say "project1"
(9) Edit the filename hellojava.icns to Product Name say "project1.icns"
(10) Edit the filename hellojava.java to Product Name say "project1.java"
(11) Edit the class name in "project1.java" and change from "hellojava" to your Product Name say "project1" and then press "Command S" to save
(12) Press "Command B" to build
(13) Right click your "project1" in XCode 4 and Choose "Add Files to project1" again
(14) Choose folders (bin, dist and jars) from your save project location.
Select "Copy items into destination group's folder (if needed)" and "Create folder references for any added folders" and Press "Add" button.
(15) Select "Product" -> "Edit Scheme..." menu
(16) Select the "Run" Scheme and change the Executable "None"
(17) And Choose the "project1" app under the "dist" folder of the saved project location.
(18) Repeat the steps 16 and 17 but for the "Profile" Scheme.
(19) Press "Command R" to run. And a simple Hello World app is created with java source code.
(20) Modify the source code in "project1.java" to proceed further.
Here is the Xcode 4 Template for Java (v2)
http://www.2shared.com/file/hExLjJ1X/Java_Xcode4_template2.html
To install the template in Mac, use Terminal command
mkdir -p ~/Library/Developer/Xcode/Templates/
unzip ~/Downloads/Java_Xcode4_template2.zip -d ~/Library/Developer/Xcode/Templates/
To Run after build (Command R), you have to do steps 15 to 18 above.
Saturday, September 8, 2012
How to decompile and recompile java program under Mac OS X
This Tutorial use XMind as an example.
1. Install JAVA SE6 (OS X v10.7/10.8) -> http://support.apple.com/kb/DL1572
JAVA SE6 (OS X v10.6) -> http://support.apple.com/kb/DL1573
JAVA SE5 & SE6 (OS X v10.5) -> http://support.apple.com/kb/DL1359
and install XMind (http://www.xmind.net/download/mac/)
2. Create environment folders and required library jar files for ant build
3. Use Java decompiler JD-GUI http://java.decompiler.free.fr/?q=jdgui to open/decompile the file ~/xmind.verify/lib/net.xmind.verify_3.3.0.201208102038.jar
4. save source code in JD-GUI for net.xmind.verify -> internal -> LicenseVerifier to folder ~/xmind.verify/src/net/xmind/verify/internal/
5. Modify LicenseVerifier.java as below
6. Create build environment for ant with build.xml (build.xml should be created in ~/xmind.verify/ folder) as below
7. ant clean & build
8. Update jar file and install to App folder
P.S. this is how to add line numbers to the source code and then convert the angle brackets for this blog.
1. Install JAVA SE6 (OS X v10.7/10.8) -> http://support.apple.com/kb/DL1572
JAVA SE6 (OS X v10.6) -> http://support.apple.com/kb/DL1573
JAVA SE5 & SE6 (OS X v10.5) -> http://support.apple.com/kb/DL1359
and install XMind (http://www.xmind.net/download/mac/)
2. Create environment folders and required library jar files for ant build
mkdir -p ~/xmind.verify/lib
mkdir -p ~/xmind.verify/src/net/xmind/verify/internal
cd ~/xmind.verify/lib
jar xvf /Applications/XMind.app/Contents/Resources/plugins/org.bouncycastle_1.4.7.jar bcprov-jdk15on-147.jar
cp /Applications/XMind.app/Contents/Resources/plugins/net.xmind.verify_3.3.0.201208102038.jar .
3. Use Java decompiler JD-GUI http://java.decompiler.free.fr/?q=jdgui to open/decompile the file ~/xmind.verify/lib/net.xmind.verify_3.3.0.201208102038.jar
4. save source code in JD-GUI for net.xmind.verify -> internal -> LicenseVerifier to folder ~/xmind.verify/src/net/xmind/verify/internal/
5. Modify LicenseVerifier.java as below
- LicenseVerifier.java Select all
/* 1 */ package net.xmind.verify.internal;
/* 2 */
/* 3 */ import java.util.ArrayList;
/* 4 */ import java.util.Collection;
/* 5 */ import java.util.Iterator;
/* 6 */ import java.util.List;
/* 7 */ import java.util.Properties;
/* 8 */ import java.util.Random;
/* 9 */ import net.xmind.signin.IAccountInfo;
/* 10 */ import net.xmind.signin.IAuthenticationListener;
/* 11 */ import net.xmind.signin.IDataStore;
/* 12 */ import net.xmind.signin.IXMindNetCommand;
/* 13 */ import net.xmind.signin.IXMindNetCommandHandler;
/* 14 */ import net.xmind.signin.XMindNet;
/* 15 */ import net.xmind.signin.internal.InternalXMindNet;
/* 16 */ import net.xmind.signin.internal.LicenseInfo;
/* 17 */ import net.xmind.signin.internal.XMindLicenseAgent;
/* 18 */ import net.xmind.signin.internal.XMindNetAccount;
/* 19 */ import net.xmind.signin.internal.XMindNetRequest;
/* 20 */ import net.xmind.verify.IValidity;
/* 21 */ import net.xmind.verify.IVerifyListener;
/* 22 */ import net.xmind.verify.ui.internal.ActivateProDialog;
/* 23 */ import org.bouncycastle.asn1.ASN1InputStream;
/* 24 */ import org.bouncycastle.asn1.ASN1Sequence;
/* 25 */ import org.bouncycastle.asn1.pkcs.RSAPublicKey;
/* 26 */ import org.bouncycastle.asn1.x509.SubjectPublicKeyInfo;
/* 27 */ import org.bouncycastle.crypto.CipherParameters;
/* 28 */ import org.bouncycastle.crypto.digests.MD5Digest;
/* 29 */ import org.bouncycastle.crypto.engines.RSAEngine;
/* 30 */ import org.bouncycastle.crypto.params.RSAKeyParameters;
/* 31 */ import org.bouncycastle.crypto.signers.PSSSigner;
/* 32 */ import org.bouncycastle.util.encoders.Base64;
/* 33 */ import org.eclipse.core.runtime.IProgressMonitor;
/* 34 */ import org.eclipse.core.runtime.IStatus;
/* 35 */ import org.eclipse.core.runtime.SafeRunner;
/* 36 */ import org.eclipse.core.runtime.jobs.IJobChangeEvent;
/* 37 */ import org.eclipse.core.runtime.jobs.Job;
/* 38 */ import org.eclipse.core.runtime.jobs.JobChangeAdapter;
/* 39 */ import org.eclipse.core.runtime.preferences.IEclipsePreferences;
/* 40 */ import org.eclipse.core.runtime.preferences.IScopeContext;
/* 41 */ import org.eclipse.core.runtime.preferences.InstanceScope;
/* 42 */ import org.eclipse.jface.preference.IPreferenceStore;
/* 43 */ import org.eclipse.jface.util.SafeRunnable;
/* 44 */ import org.eclipse.swt.widgets.Display;
/* 45 */ import org.eclipse.swt.widgets.Shell;
/* 46 */ import org.eclipse.ui.IWorkbench;
/* 47 */ import org.eclipse.ui.IWorkbenchWindow;
/* 48 */ import org.eclipse.ui.PlatformUI;
/* 49 */
/* 50 */ public class LicenseVerifier
/* 51 */ implements IAuthenticationListener, IXMindNetCommandHandler
/* 52 */ {
/* 53 */ private static LicenseVerifier INSTANCE = null;
/* 54 */ private static final int SALT_LENGTH = 32;
/* 55 */ private static final int PREFIX_LENGTH = 8;
/* 56 */ private static List<String> invalidLicenseKeys = new ArrayList<String>();
/* 57 */ private IValidity validity = null;
/* 58 */ private VerificationJob verifyJob = null;
/* 59 */ private Object jobLock = new Object();
/* 60 */ private List<ValidityNotifier> listeners = new ArrayList<ValidityNotifier>();
/* 61 */ private List<ValidityNotifier> callbacks = new ArrayList<ValidityNotifier>();
/* 62 */
/* 63 */ private LicenseVerifier() {
/* 64 */ XMindNet.addAuthenticationListener(this);
/* 65 */ XMindNet.addXMindNetCommandHandler("refresh", this);
/* 66 */ }
/* 67 */
/* 68 */ public void verify(int paramInt) {
/* 69 */ verify(null, paramInt, null, 0);
/* 70 */ }
/* 71 */
/* 72 */ public void verify(int paramInt, IVerifyListener paramIVerifyListener) {
/* 73 */ verify(null, paramInt, paramIVerifyListener, 0);
/* 74 */ }
/* 75 */
/* 76 */ public void verify(int paramInt1, IVerifyListener paramIVerifyListener, int paramInt2)
/* 77 */ {
/* 78 */ verify(null, paramInt1, paramIVerifyListener, paramInt2);
/* 79 */ }
/* 80 */
/* 81 */ public void verify(String paramString, int paramInt1, IVerifyListener paramIVerifyListener, int paramInt2)
/* 82 */ {
/* 83 */ if (((paramInt2 & 0x1) == 0) && (checkValid(this.validity, paramInt1))) {
/* 84 */ if (paramIVerifyListener != null)
/* 85 */ paramIVerifyListener.notifyValidity(this.validity);
/* 86 */ return;
/* 87 */ }
/* 88 */ if (paramIVerifyListener != null)
/* 89 */ synchronized (this.callbacks) {
/* 90 */ this.callbacks.add(new ValidityNotifier(paramIVerifyListener));
/* 91 */ }
/* 92 */ synchronized (this.jobLock) {
/* 93 */ if (this.verifyJob == null) {
/* 94 */ VerificationJob localVerificationJob = new VerificationJob(
/* 95 */ paramString, paramInt1, paramInt2);
/* 96 */ localVerificationJob
/* 97 */ .addJobChangeListener(new JobChangeAdapter()
/* 98 */ {
/* 99 */ public void done(IJobChangeEvent paramAnonymousIJobChangeEvent) {
/* 100 */ synchronized (LicenseVerifier.this.jobLock) {
/* 101 */ LicenseVerifier.this.verifyJob = null;
/* 102 */ }
/* 103 */ LicenseVerifier.this
/* 104 */ .setValidity((IValidity)paramAnonymousIJobChangeEvent
/* 105 */ .getResult());
/* 106 */ }
/* 107 */ });
/* 108 */ localVerificationJob.schedule();
/* 109 */ this.verifyJob = localVerificationJob;
/* 110 */ } else {
/* 111 */ this.verifyJob.updateActionName(paramString);
/* 112 */ this.verifyJob.updateRequiredStatus(paramInt1);
/* 113 */ this.verifyJob.updateStyle(paramInt2);
/* 114 */ }
/* 115 */ }
/* 116 */ }
/* 117 */
/* 118 */ public void addVerifyListener(IVerifyListener paramIVerifyListener) {
/* 119 */ synchronized (this.listeners) {
/* 120 */ this.listeners.add(new ValidityNotifier(paramIVerifyListener));
/* 121 */ }
/* 122 */ }
/* 123 */
/* 124 */ public void removeVerifyListener(IVerifyListener paramIVerifyListener) {
/* 125 */ synchronized (this.listeners) {
/* 126 */ Object[] arrayOfObject = this.listeners.toArray();
/* 127 */ this.listeners.clear();
/* 128 */ for (int i = 0; i < arrayOfObject.length; i++) {
/* 129 */ ValidityNotifier localValidityNotifier = (ValidityNotifier)arrayOfObject[i];
/* 130 */ if (localValidityNotifier.listener != paramIVerifyListener)
/* 131 */ this.listeners.add(localValidityNotifier);
/* 132 */ }
/* 133 */ }
/* 134 */ }
/* 135 */
/* 136 */ private void setValidity(IValidity paramIValidity) {
/* 137 */ paramIValidity = cloneValidity(paramIValidity);
/* 138 */ IValidity localIValidity = cloneValidity(paramIValidity);
/* 139 */ if (notifyAllCallbacks(localIValidity))
/* 140 */ return;
/* 141 */ notifyAllListeners(localIValidity);
/* 142 */ notifyLicenseAgent(localIValidity);
/* 143 */ this.validity = paramIValidity;
/* 144 */ if ((paramIValidity.getCode() & 0x6) != 0)
/* 145 */ verifyLicenseKeyValidity();
/* 146 */ }
/* 147 */
/* 148 */ private void verifyLicenseKeyValidity() {
/* 149 */ IPreferenceStore localIPreferenceStore = VerifyPlugin.getDefault()
/* 150 */ .getPreferenceStore();
/* 151 */ final String str1 = localIPreferenceStore.getString("licenseKey");
/* 152 */ final String str2 = localIPreferenceStore.getString("licenseEmail");
/* 153 */ Thread localThread = new Thread(new Runnable() {
/* 154 */ public void run() {
/* 155 */ if (!LicenseVerifier.checkLicenseKeyValidity(str2, str1)) {
/* 156 */ LicenseVerifier.invalidLicenseKeys.add(str2 + "|" + str1);
/* 157 */ LicenseVerifier.this.verify(7, null, 3);
/* 158 */ }
/* 159 */ }
/* 160 */ });
/* 161 */ localThread.setDaemon(true);
/* 162 */ localThread.setPriority(1);
/* 163 */ localThread.start();
/* 164 */ }
/* 165 */
/* 166 */ private static boolean checkLicenseKeyValidity(String paramString1, String paramString2)
/* 167 */ {
/* 168 */ return true;
/* 169 */ }
/* 170 */
/* 171 */ private boolean notifyAllCallbacks(IValidity paramIValidity)
/* 172 */ {
/* 173 */ ArrayList localArrayList=null;
/* 174 */ synchronized (this.callbacks) {
/* 175 */ localArrayList = new ArrayList<ValidityNotifier>(this.callbacks);
/* 176 */ this.callbacks.clear();
/* 177 */ }
/* 178 */ Iterator localIterator = localArrayList.iterator();
/* 179 */ while (localIterator.hasNext()) {
/* 180 */ ValidityNotifier vn = (ValidityNotifier)localIterator.next();
/* 181 */ if (vn.notifyValidityCallback(paramIValidity))
/* 182 */ return true;
/* 183 */ }
/* 184 */ return false;
/* 185 */ }
/* 186 */
/* 187 */ private void notifyAllListeners(IValidity paramIValidity) {
/* 188 */ Object[] arrayOfObject1 = this.listeners.toArray();
/* 189 */ for (Object localObject : arrayOfObject1)
/* 190 */ ((ValidityNotifier)localObject)
/* 191 */ .notifyValidityListener(paramIValidity);
/* 192 */ }
/* 193 */
/* 194 */ private void notifyLicenseAgent(IValidity paramIValidity)
/* 195 */ {
/* 196 */ InternalXMindNet.getInstance()
/* 197 */ .getLicenseAgent()
/* 198 */ .licenseVerified(
/* 199 */ new LicenseInfo(paramIValidity.getCode(),
/* 200 */ paramIValidity.getException(), paramIValidity
/* 201 */ .getLicensedTo()));
/* 202 */ }
/* 203 */
/* 204 */ public void postSignIn(IAccountInfo paramIAccountInfo) {
/* 205 */ verify(7, null, 3);
/* 206 */ }
/* 207 */
/* 208 */ public void postSignOut(IAccountInfo paramIAccountInfo) {
/* 209 */ if ((this.validity != null) && ((this.validity.getCode() & 0x1) != 0)) {
/* 210 */ saveLocalData(null, null, null, null);
/* 211 */ setValidity(createValidity(1024));
/* 212 */ }
/* 213 */ }
/* 214 */
/* 215 */ public boolean handleXMindNetCommand(IXMindNetCommand paramIXMindNetCommand) {
/* 216 */ refreshValidity(paramIXMindNetCommand.getContent());
/* 217 */ return true;
/* 218 */ }
/* 219 */
/* 220 */ private void refreshValidity(IDataStore paramIDataStore) {
/* 221 */ if (paramIDataStore == null)
/* 222 */ return;
/* 223 */ if ((this.validity != null) && ((this.validity.getCode() & 0x6) != 0))
/* 224 */ return;
/* 225 */ String str1 = paramIDataStore.getString("user");
/* 226 */ String str2 = paramIDataStore.getString("uid");
/* 227 */ if ((str1 == null) || (str2 == null))
/* 228 */ return;
/* 229 */ IAccountInfo localIAccountInfo = XMindNet.getAccountInfo();
/* 230 */ if ((localIAccountInfo == null) ||
/* 231 */ (!str1.equals(localIAccountInfo.getUser())))
/* 232 */ return;
/* 233 */ String str3 = extractExpiration(paramIDataStore, str2);
/* 234 */ int i;
/* 235 */ //int i;
/* 236 */ if (str3 == null)
/* 237 */ i = 4096;
/* 238 */ else
/* 239 */ i = parseExpiration(str3, str2);
/* 240 */ saveLocalData(str2, str3, null, null);
/* 241 */ this.validity = createValidity(i, str1);
/* 242 */ }
/* 243 */
/* 244 */ private static boolean checkValid(IStatus paramIStatus, int paramInt) {
/* 245 */ return (paramIStatus != null) && (hasValidity(paramIStatus, paramInt));
/* 246 */ }
/* 247 */
/* 248 */ private static boolean hasValidity(IStatus paramIStatus, int paramInt) {
/* 249 */ return (paramIStatus.getCode() & paramInt) != 0;
/* 250 */ }
/* 251 */
/* 252 */ private static void saveLocalData(String paramString1, String paramString2, String paramString3, String paramString4)
/* 253 */ {
/* 254 */ IPreferenceStore localIPreferenceStore = VerifyPlugin.getDefault()
/* 255 */ .getPreferenceStore();
/* 256 */ savePreference(localIPreferenceStore, "licenseEmail", paramString4);
/* 257 */ savePreference(localIPreferenceStore, "licenseKey", paramString3);
/* 258 */ savePreference(localIPreferenceStore, "uid", paramString1);
/* 259 */ savePreference(localIPreferenceStore, "expiration", paramString2);
/* 260 */ flushStore();
/* 261 */ }
/* 262 */
/* 263 */ private static void savePreference(IPreferenceStore paramIPreferenceStore, String paramString1, String paramString2)
/* 264 */ {
/* 265 */ if ((paramString2 != null) && (!"".equals(paramString2)))
/* 266 */ paramIPreferenceStore.setValue(paramString1, paramString2);
/* 267 */ else
/* 268 */ paramIPreferenceStore.setValue(paramString1, "");
/* 269 */ }
/* 270 */
/* 271 */ private static void flushStore() {
/* 272 */ IEclipsePreferences localIEclipsePreferences = InstanceScope.INSTANCE
/* 273 */ .getNode("net.xmind.varify");
/* 274 */ if (localIEclipsePreferences != null)
/* 275 */ try {
/* 276 */ localIEclipsePreferences.flush();
/* 277 */ }
/* 278 */ catch (Throwable localThrowable) {
/* 279 */ }
/* 280 */ }
/* 281 */
/* 282 */ private static String extractExpiration(IDataStore paramIDataStore, String paramString) {
/* 283 */ if (!paramIDataStore.has("expireDate"))
/* 284 */ return null;
/* 285 */ long l = paramIDataStore.getLong("expireDate");
/* 286 */ if (l <= 0L)
/* 287 */ return null;
/* 288 */ if (paramIDataStore.getBoolean("expired"))
/* 289 */ l = 0L;
/* 290 */ StringBuffer localStringBuffer = new StringBuffer(64);
/* 291 */ localStringBuffer.append('`');
/* 292 */ localStringBuffer.append('\t');
/* 293 */ localStringBuffer.append('\n');
/* 294 */ localStringBuffer.append(Long.toString(l, 16));
/* 295 */ String str = Cryptus.encrypt(localStringBuffer.toString(), paramString);
/* 296 */ return str;
/* 297 */ }
/* 298 */
/* 299 */ private static int parseExpiration(String paramString1, String paramString2) {
/* 300 */ String str = Cryptus.decrypt(paramString1, paramString2);
/* 301 */ if ((str != null) && (!"".equals(str)) && (str.startsWith("`\t\n"))) {
/* 302 */ long l = Long.parseLong(str.substring(3), 16);
/* 303 */ if (System.currentTimeMillis() < l)
/* 304 */ return 1;
/* 305 */ return 2048;
/* 306 */ }
/* 307 */ return 1024;
/* 308 */ }
/* 309 */
/* 310 */ private static IValidity cloneValidity(IValidity paramIValidity) {
/* 311 */ return new Validity(paramIValidity.getSeverity(),
/* 312 */ paramIValidity.getPlugin(), paramIValidity.getCode(),
/* 313 */ paramIValidity.getMessage(), paramIValidity.getException(),
/* 314 */ paramIValidity.getLicensedTo());
/* 315 */ }
/* 316 */
/* 317 */ private static IValidity createValidity(int paramInt) {
/* 318 */ return createValidity(paramInt, null, null, false);
/* 319 */ }
/* 320 */
/* 321 */ private static IValidity createValidity(int paramInt, String paramString) {
/* 322 */ return createValidity(paramInt, paramString, null, false);
/* 323 */ }
/* 324 */
/* 325 */ private static IValidity createValidity(int paramInt, Throwable paramThrowable)
/* 326 */ {
/* 327 */ return createValidity(paramInt, null, paramThrowable, false);
/* 328 */ }
/* 329 */
/* 330 */ private static IValidity createValidity(int paramInt, String paramString, Throwable paramThrowable, boolean paramBoolean)
/* 331 */ {
/* 332 */ if (paramBoolean)
/* 333 */ return new Validity(8, "net.xmind.varify", 1, null, paramThrowable,
/* 334 */ paramString);
/* 335 */ return new Validity(0, "net.xmind.varify", 1, null, paramThrowable,
/* 336 */ paramString);
/* 337 */ }
/* 338 */
/* 339 */ public static LicenseVerifier getInstance()
/* 340 */ {
/* 341 */ if (INSTANCE == null)
/* 342 */ INSTANCE = new LicenseVerifier();
/* 343 */ return INSTANCE;
/* 344 */ }
/* 345 */ private static class ValidityNotifier {
/* 346 */ private IVerifyListener listener;
/* 347 */ private Display display;
/* 348 */
/* 349 */ public ValidityNotifier(IVerifyListener paramIVerifyListener) {
/* 350 */ this.listener = paramIVerifyListener;
/* 351 */ this.display = Display.getCurrent();
/* 352 */ }
/* 353 */
/* 354 */ public void notifyValidityListener(final IValidity paramIValidity) {
/* 355 */ if (this.display != null) {
/* 356 */ if (!this.display.isDisposed())
/* 357 */ this.display.syncExec(new Runnable() {
/* 358 */ public void run() {
/* 359 */ SafeRunner.run(new SafeRunnable() {
/* 360 */ public void run() throws Exception {
/* 361 */ LicenseVerifier.ValidityNotifier.this.listener
/* 362 */ .notifyValidity(paramIValidity);
/* 363 */ }
/* 364 */ });
/* 365 */ }
/* 366 */ });
/* 367 */ }
/* 368 */ else SafeRunner.run(new SafeRunnable() {
/* 369 */ public void run() throws Exception {
/* 370 */ LicenseVerifier.ValidityNotifier.this.listener
/* 371 */ .notifyValidity(paramIValidity);
/* 372 */ }
/* 373 */ });
/* 374 */ }
/* 375 */
/* 376 */ public boolean notifyValidityCallback(final IValidity paramIValidity)
/* 377 */ {
/* 378 */ if ((this.listener instanceof IVerifyCallback)) {
/* 379 */ final boolean[] arrayOfBoolean = new boolean[1];
/* 380 */ arrayOfBoolean[0] = false;
/* 381 */ if (this.display != null) {
/* 382 */ if (!this.display.isDisposed())
/* 383 */ this.display.syncExec(new Runnable() {
/* 384 */ public void run() {
/* 385 */ SafeRunner.run(new SafeRunnable() {
/* 386 */ public void run() throws Exception {
/* 387 */ ((IVerifyCallback)LicenseVerifier.ValidityNotifier.this.listener)
/* 388 */ .handleValidity(paramIValidity);
/* 389 */ }
/* 390 */ });
/* 391 */ }
/* 392 */ });
/* 393 */ }
/* 394 */ else SafeRunner.run(new SafeRunnable() {
/* 395 */ public void run() throws Exception {
/* 396 */ arrayOfBoolean[0] = ((IVerifyCallback)LicenseVerifier.ValidityNotifier.this.listener)
/* 397 */ .handleValidity(paramIValidity);
/* 398 */ }
/* 399 */ });
/* 400 */ return arrayOfBoolean[0];
/* 401 */ }
/* 402 */ notifyValidityListener(paramIValidity);
/* 403 */ return false;
/* 404 */ }
/* 405 */ }
/* 406 */
/* 407 */ private static class VerificationJob extends Job {
/* 408 */ private List<String> actionNames = new ArrayList<String>(2);
/* 409 */ private int requiredStatus;
/* 410 */ private int style;
/* 411 */ private IPreferenceStore prefStore;
/* 412 */ private IStatus validity;
/* 413 */ private String licenseKey = null;
/* 414 */ private String licenseEmail = null;
/* 415 */ private String user = null;
/* 416 */ private String authToken = null;
/* 417 */ private String uid = null;
/* 418 */ private String expiration = null;
/* 419 */ private XMindNetRequest retrieveUIDRequest = new XMindNetRequest(true);
/* 420 */ private XMindNetRequest retrieveSubscriptionRequest = new XMindNetRequest(
/* 421 */ true);
/* 422 */
/* 423 */ private ActivateProDialog inputDialog = null;
/* 424 */
/* 425 */ public VerificationJob(String paramString, int paramInt1, int paramInt2) {
/* 426 */ super("");
/* 427 */ if (paramString != null)
/* 428 */ this.actionNames.add(paramString);
/* 429 */ this.requiredStatus = paramInt1;
/* 430 */ this.style = paramInt2;
/* 431 */ this.prefStore = VerifyPlugin.getDefault().getPreferenceStore();
/* 432 */ this.validity = LicenseVerifier.createValidity(1024);
/* 433 */ setSystem(true);
/* 434 */ }
/* 435 */
/* 436 */ public void updateActionName(String paramString) {
/* 437 */ if (paramString != null)
/* 438 */ this.actionNames.add(paramString);
/* 439 */ }
/* 440 */
/* 441 */ public void updateRequiredStatus(int paramInt) {
/* 442 */ this.requiredStatus &= paramInt;
/* 443 */ }
/* 444 */
/* 445 */ public void updateStyle(int paramInt) {
/* 446 */ this.style = mergeStyle(this.style, paramInt, 1, true);
/* 447 */ this.style = mergeStyle(this.style, paramInt, 2, true);
/* 448 */ this.style = mergeStyle(this.style, paramInt, 4, false);
/* 449 */ this.style = mergeStyle(this.style, paramInt, 8, false);
/* 450 */ }
/* 451 */
/* 452 */ private static int mergeStyle(int paramInt1, int paramInt2, int paramInt3, boolean paramBoolean)
/* 453 */ {
/* 454 */ if (paramBoolean)
/* 455 */ return paramInt1 & (
/* 456 */ paramInt2 & paramInt3 | paramInt3 ^ 0xFFFFFFFF);
/* 457 */ return paramInt1 | paramInt2 & paramInt3;
/* 458 */ }
/* 459 */
/* 460 */ protected IStatus run(IProgressMonitor paramIProgressMonitor) {
/* 461 */ verify(paramIProgressMonitor);
/* 462 */ if ((paramIProgressMonitor.isCanceled()) &&
/* 463 */ (!LicenseVerifier.checkValid(this.validity, 7)))
/* 464 */ this.validity = LicenseVerifier.createValidity(1024, null,
/* 465 */ null, true);
/* 466 */ LicenseVerifier.saveLocalData(this.uid, this.expiration,
/* 467 */ this.licenseKey, this.licenseEmail);
/* 468 */ return this.validity;
/* 469 */ }
/* 470 */
/* 471 */ private boolean isValid() {
/* 472 */ return LicenseVerifier.checkValid(this.validity,
/* 473 */ this.requiredStatus);
/* 474 */ }
/* 475 */
/* 476 */ private void verify(IProgressMonitor paramIProgressMonitor) {
/* 477 */ verifyVindy(paramIProgressMonitor);
/* 478 */ if (paramIProgressMonitor.isCanceled())
/* 479 */ return;
/* 480 */ if (isValid())
/* 481 */ return;
/* 482 */ verifyLocalData(paramIProgressMonitor);
/* 483 */ if (paramIProgressMonitor.isCanceled())
/* 484 */ return;
/* 485 */ if (((this.style & 0x8) == 0) && (
/* 486 */ (isValid()) || ((this.style & 0x2) != 0)))
/* 487 */ return;
/* 488 */ waitForWorkbenchReady(paramIProgressMonitor);
/* 489 */ if (paramIProgressMonitor.isCanceled())
/* 490 */ return;
/* 491 */ openInputDialog(paramIProgressMonitor);
/* 492 */ }
/* 493 */
/* 494 */ private void waitForWorkbenchReady(IProgressMonitor paramIProgressMonitor)
/* 495 */ {
/* 496 */ if (System.getProperty("org.xmind.cathy.app.status") == null)
/* 497 */ return;
/* 498 */ try {
/* 499 */ do {
/* 500 */ if (paramIProgressMonitor.isCanceled())
/* 501 */ return;
/* 502 */ Thread.sleep(500L);
/* 503 */ }
/* 504 */ while (!
/* 505 */ isWorkbenchReady());
/* 506 */ } catch (InterruptedException localInterruptedException) {
/* 507 */ }
/* 508 */ }
/* 509 */
/* 510 */ private boolean isWorkbenchReady() {
/* 511 */ return "workbenchReady".equals(
/* 512 */ System.getProperty("org.xmind.cathy.app.status"));
/* 513 */ }
/* 514 */
/* 515 */ private void verifyLocalData(IProgressMonitor paramIProgressMonitor) {
/* 516 */ loadLocalLicenseKey(paramIProgressMonitor);
/* 517 */ if (paramIProgressMonitor.isCanceled())
/* 518 */ return;
/* 519 */ if ((hasLicenseKey()) && (hasLicenseEmail())) {
/* 520 */ verifyProLicenseKey(paramIProgressMonitor);
/* 521 */ if (paramIProgressMonitor.isCanceled())
/* 522 */ return;
/* 523 */ if (!isValid())
/* 524 */ verifyPlusLicenseKey(paramIProgressMonitor);
/* 525 */ }
/* 526 */ if (paramIProgressMonitor.isCanceled())
/* 527 */ return;
/* 528 */ IStatus localIStatus = this.validity;
/* 529 */ boolean bool = LicenseVerifier.checkValid(localIStatus, 2);
/* 530 */ if (bool)
/* 531 */ return;
/* 532 */ loadLocalUserInfo(paramIProgressMonitor);
/* 533 */ if (paramIProgressMonitor.isCanceled())
/* 534 */ return;
/* 535 */ if ((hasUser()) && (hasAuthToken())) {
/* 536 */ loadLocalSubscriptionInfo(paramIProgressMonitor);
/* 537 */ if (paramIProgressMonitor.isCanceled())
/* 538 */ return;
/* 539 */ if ((hasUID()) && (hasExpiration())) {
/* 540 */ verifyLocalSubscriptionInfo(paramIProgressMonitor);
/* 541 */ if (isValid())
/* 542 */ return;
/* 543 */ }
/* 544 */ if (paramIProgressMonitor.isCanceled())
/* 545 */ return;
/* 546 */ verifySubscription(paramIProgressMonitor);
/* 547 */ if (isValid())
/* 548 */ return;
/* 549 */ this.validity = localIStatus;
/* 550 */ }
/* 551 */ }
/* 552 */
/* 553 */ private void loadLocalLicenseKey(IProgressMonitor paramIProgressMonitor) {
/* 554 */ this.licenseKey = this.prefStore.getString("licenseKey");
/* 555 */ this.licenseEmail = this.prefStore.getString("licenseEmail");
/* 556 */ }
/* 557 */
/* 558 */ private void loadLocalUserInfo(IProgressMonitor paramIProgressMonitor) {
/* 559 */ IAccountInfo localIAccountInfo = XMindNet.getAccountInfo();
/* 560 */ this.user = (localIAccountInfo == null ? null : localIAccountInfo
/* 561 */ .getUser());
/* 562 */ this.authToken = (localIAccountInfo == null ? null :
/* 563 */ localIAccountInfo.getAuthToken());
/* 564 */ }
/* 565 */
/* 566 */ private void loadLocalSubscriptionInfo(IProgressMonitor paramIProgressMonitor)
/* 567 */ {
/* 568 */ this.uid = this.prefStore.getString("uid");
/* 569 */ this.expiration = this.prefStore.getString("expiration");
/* 570 */ }
/* 571 */
/* 572 */ private void verifyLocalSubscriptionInfo(IProgressMonitor paramIProgressMonitor)
/* 573 */ {
/* 574 */ this.validity = LicenseVerifier.createValidity(
/* 575 */ LicenseVerifier.parseExpiration(this.expiration, this.uid),
/* 576 */ this.user);
/* 577 */ }
/* 578 */
/* 579 */ private void verifyProLicenseKey(IProgressMonitor paramIProgressMonitor) {
/* 580 */ if (LicenseVerifier.invalidLicenseKeys.contains(this.licenseEmail +
/* 581 */ "|" + this.licenseKey))
/* 582 */ this.validity = LicenseVerifier.createValidity(8192);
/* 583 */ else
/* 584 */ verifySignature(this.licenseEmail, this.licenseKey,
/* 585 */ "`_xmind.org\n9527\t", getProPublicKey(), 2,
/* 586 */ paramIProgressMonitor);
/* 587 */ }
/* 588 */
/* 589 */ private void verifyPlusLicenseKey(IProgressMonitor paramIProgressMonitor) {
/* 590 */ if (LicenseVerifier.invalidLicenseKeys.contains(this.licenseEmail +
/* 591 */ "|" + this.licenseKey))
/* 592 */ this.validity = LicenseVerifier.createValidity(8192);
/* 593 */ else
/* 594 */ verifySignature(this.licenseEmail, this.licenseKey,
/* 595 */ "*#xmind\nnet.3914\t", getPlusPublicKey(), 4,
/* 596 */ paramIProgressMonitor);
/* 597 */ }
/* 598 */
/* 599 */ private void verifySignature(String paramString1, String paramString2, String paramString3, byte[] paramArrayOfByte, int paramInt, IProgressMonitor paramIProgressMonitor)
/* 600 */ {
/* 601 */ if (paramString2.length() < 8) {
/* 602 */ this.validity = LicenseVerifier.createValidity(8192);
/* 603 */ return;
/* 604 */ }
/* 605 */ try {
/* 606 */ paramString1 = paramString2.substring(0, 8) + paramString1;
/* 607 */ paramString2 = paramString2.substring(8);
/* 608 */ byte[] arrayOfByte = Base32.decode(paramString2);
/* 609 */ if (isSignatureValid((paramString1 + paramString3).getBytes(),
/* 610 */ arrayOfByte, paramArrayOfByte))
/* 611 */ this.validity = LicenseVerifier.createValidity(paramInt,
/* 612 */ this.licenseEmail);
/* 613 */ else
/* 614 */ this.validity = LicenseVerifier.createValidity(8192);
/* 615 */ } catch (Exception localException) {
/* 616 */ this.validity = LicenseVerifier.createValidity(1073741824,
/* 617 */ localException);
/* 618 */ }
/* 619 */ }
/* 620 */
/* 621 */ private boolean isSignatureValid(byte[] paramArrayOfByte1, byte[] paramArrayOfByte2, byte[] paramArrayOfByte3)
/* 622 */ throws Exception
/* 623 */ {
/* 624 */ RSAEngine localRSAEngine = new RSAEngine();
/* 625 */ MD5Digest localMD5Digest = new MD5Digest();
/* 626 */ PSSSigner localPSSSigner = new PSSSigner(localRSAEngine,
/* 627 */ localMD5Digest, 32);
/* 628 */ localPSSSigner.init(false, parsePublicKey(paramArrayOfByte3));
/* 629 */ localPSSSigner.update(paramArrayOfByte1, 0,
/* 630 */ paramArrayOfByte1.length);
/* 631 */ return localPSSSigner.verifySignature(paramArrayOfByte2);
/* 632 */ }
/* 633 */
/* 634 */ private byte[] getProPublicKey() {
/* 635 */ return new byte[] { 77, 73, 71, 102, 77, 65, 48, 71, 67, 83, 113,
/* 636 */ 71, 83, 73, 98, 51, 68, 81, 69, 66, 65, 81, 85, 65, 65, 52,
/* 637 */ 71, 78, 65, 68, 67, 66, 105, 81, 75, 66, 103, 81, 67, 100,
/* 638 */ 54, 74, 99, 100, 109, 118, 100, 85, 83, 84, 112, 66, 78,
/* 639 */ 118, 114, 119, 55, 83, 49, 73, 100, 114, 110, 76, 106, 70,
/* 640 */ 79, 110, 50, 117, 112, 89, 120, 67, 52, 85, 101, 71, 121,
/* 641 */ 112, 101, 43, 68, 119, 85, 122, 52, 83, 113, 54, 115, 100,
/* 642 */ 67, 100, 119, 68, 83, 118, 56, 107, 114, 52, 82, 99, 77,
/* 643 */ 82, 83, 75, 55, 110, 77, 78, 55, 57, 79, 57, 104, 99, 121,
/* 644 */ 106, 90, 69, 103, 105, 119, 120, 57, 101, 75, 69, 74, 85,
/* 645 */ 99, 68, 82, 101, 112, 97, 48, 66, 121, 72, 115, 49, 56,
/* 646 */ 102, 71, 113, 74, 105, 52, 51, 110, 57, 47, 118, 71, 104,
/* 647 */ 99, 78, 84, 86, 120, 85, 109, 53, 109, 112, 74, 115, 103,
/* 648 */ 53, 82, 112, 51, 111, 74, 51, 56, 98, 68, 86, 69, 110, 55,
/* 649 */ 68, 55, 88, 116, 82, 101, 78, 78, 83, 78, 101, 113, 77,
/* 650 */ 111, 121, 112, 120, 105, 69, 114, 43, 113, 55, 110, 119,
/* 651 */ 73, 68, 65, 81, 65, 66 };
/* 652 */ }
/* 653 */
/* 654 */ private byte[] getPlusPublicKey() {
/* 655 */ return new byte[] { 77, 73, 71, 102, 77, 65, 48, 71, 67, 83, 113,
/* 656 */ 71, 83, 73, 98, 51, 68, 81, 69, 66, 65, 81, 85, 65, 65, 52,
/* 657 */ 71, 78, 65, 68, 67, 66, 105, 81, 75, 66, 103, 81, 67, 104,
/* 658 */ 105, 71, 48, 119, 72, 104, 43, 115, 68, 57, 49, 52, 54, 65,
/* 659 */ 98, 76, 75, 75, 76, 73, 101, 48, 98, 83, 87, 110, 122, 71,
/* 660 */ 65, 112, 106, 43, 120, 110, 101, 121, 69, 110, 65, 112, 57,
/* 661 */ 111, 116, 118, 83, 52, 105, 101, 48, 78, 77, 75, 72, 122,
/* 662 */ 101, 81, 89, 48, 118, 47, 107, 65, 89, 70, 51, 99, 102, 43,
/* 663 */ 114, 68, 113, 73, 68, 90, 85, 71, 109, 49, 79, 115, 105,
/* 664 */ 72, 75, 116, 57, 50, 112, 57, 72, 106, 119, 81, 48, 48, 89,
/* 665 */ 120, 117, 116, 87, 78, 116, 109, 109, 55, 90, 73, 104, 69,
/* 666 */ 57, 90, 89, 43, 116, 76, 100, 87, 78, 118, 116, 53, 107,
/* 667 */ 55, 52, 82, 47, 48, 100, 51, 75, 81, 69, 90, 76, 68, 82,
/* 668 */ 109, 80, 114, 98, 49, 109, 104, 116, 73, 65, 50, 89, 75,
/* 669 */ 108, 82, 50, 77, 116, 109, 51, 43, 82, 113, 68, 101, 50,
/* 670 */ 115, 90, 78, 109, 112, 71, 111, 102, 119, 73, 68, 65, 81,
/* 671 */ 65, 66 };
/* 672 */ }
/* 673 */
/* 674 */ private byte[] getVindyPublicKey() {
/* 675 */ return new byte[] { 77, 73, 71, 102, 77, 65, 48, 71, 67, 83, 113,
/* 676 */ 71, 83, 73, 98, 51, 68, 81, 69, 66, 65, 81, 85, 65, 65, 52,
/* 677 */ 71, 78, 65, 68, 67, 66, 105, 81, 75, 66, 103, 81, 68, 98,
/* 678 */ 73, 106, 85, 74, 67, 47, 121, 76, 77, 83, 106, 113, 74, 76,
/* 679 */ 99, 48, 116, 81, 43, 98, 54, 97, 69, 97, 103, 66, 68, 70,
/* 680 */ 47, 101, 105, 81, 100, 70, 51, 49, 103, 79, 103, 98, 52,
/* 681 */ 113, 105, 54, 85, 54, 113, 56, 97, 81, 65, 43, 65, 85, 84,
/* 682 */ 56, 67, 101, 87, 68, 102, 108, 83, 119, 100, 85, 53, 118,
/* 683 */ 55, 86, 53, 86, 98, 111, 56, 86, 102, 47, 119, 75, 81, 75,
/* 684 */ 119, 119, 113, 114, 48, 119, 98, 56, 66, 87, 85, 53, 51,
/* 685 */ 85, 121, 120, 121, 65, 73, 115, 121, 68, 118, 77, 110, 77,
/* 686 */ 114, 118, 51, 119, 85, 101, 48, 71, 98, 68, 102, 82, 76,
/* 687 */ 53, 108, 105, 101, 101, 49, 98, 105, 75, 99, 75, 103, 100,
/* 688 */ 104, 107, 73, 121, 53, 88, 89, 114, 109, 77, 86, 49, 74,
/* 689 */ 48, 50, 74, 49, 79, 89, 98, 109, 115, 69, 110, 49, 107, 70,
/* 690 */ 99, 122, 122, 116, 115, 47, 72, 79, 119, 73, 68, 65, 81,
/* 691 */ 65, 66 };
/* 692 */ }
/* 693 */
/* 694 */ private CipherParameters parsePublicKey(byte[] paramArrayOfByte) throws Exception
/* 695 */ {
/* 696 */ byte[] arrayOfByte = Base64.decode(paramArrayOfByte);
/* 697 */ ASN1InputStream localASN1InputStream = new ASN1InputStream(
/* 698 */ arrayOfByte);
/* 699 */ ASN1Sequence localASN1Sequence = (ASN1Sequence)localASN1InputStream
/* 700 */ .readObject();
/* 701 */ SubjectPublicKeyInfo localSubjectPublicKeyInfo = new SubjectPublicKeyInfo(
/* 702 */ localASN1Sequence);
/* 703 */ RSAPublicKey localRSAPublicKey =
/* 704 */ RSAPublicKey.getInstance(localSubjectPublicKeyInfo.parsePublicKey());
/* 705 */ return new RSAKeyParameters(false, localRSAPublicKey.getModulus(),
/* 706 */ localRSAPublicKey.getPublicExponent());
/* 707 */ }
/* 708 */
/* 709 */ private void verifyVindy(IProgressMonitor paramIProgressMonitor) {
/* 710 */ String str = checkValidVindy(paramIProgressMonitor);
/* 711 */ if (str != null)
/* 712 */ this.validity = LicenseVerifier.createValidity(0, str);
/* 713 */ }
/* 714 */
/* 715 */ private String checkValidVindy(IProgressMonitor paramIProgressMonitor) {
/* 716 */ String str1 =
/* 717 */ System.getProperty("org.xmind.product.distribution.id");
/* 718 */ if ((str1 == null) || ("".equals(str1)) ||
/* 719 */ (!str1.startsWith("vindy")))
/* 720 */ return null;
/* 721 */ String str2 =
/* 722 */ System.getProperty("org.xmind.product.distribution.vindy.org");
/* 723 */ if ((str2 == null) || ("".equals(str2)))
/* 724 */ return null;
/* 725 */ String str3 =
/* 726 */ System.getProperty("org.xmind.product.distribution.vindy.time");
/* 727 */ if ((str3 == null) || ("".equals(str3)))
/* 728 */ return null;
/* 729 */ String str4 =
/* 730 */ System.getProperty("org.xmind.product.distribution.vindy.name");
/* 731 */ if ((str4 == null) || ("".equals(str4)))
/* 732 */ return null;
/* 733 */ String str5 = str2 + str3;
/* 734 */ IStatus localIStatus = this.validity;
/* 735 */ verifySignature(str5, str4, "^xmap61\nbg4[d\t",
/* 736 */ getVindyPublicKey(), 2, paramIProgressMonitor);
/* 737 */ if (isValid())
/* 738 */ return str2;
/* 739 */ this.validity = localIStatus;
/* 740 */ return null;
/* 741 */ }
/* 742 */
/* 743 */ private void verifySubscription(IProgressMonitor paramIProgressMonitor) {
/* 744 */ retrieveUID(paramIProgressMonitor);
/* 745 */ if (paramIProgressMonitor.isCanceled())
/* 746 */ return;
/* 747 */ if (hasUID())
/* 748 */ retrieveSubscription(paramIProgressMonitor);
/* 749 */ }
/* 750 */
/* 751 */ private void openInputDialog(final IProgressMonitor paramIProgressMonitor)
/* 752 */ {
/* 753 */ final Properties localProperties = new Properties();
/* 754 */ if (this.licenseEmail != null)
/* 755 */ localProperties.setProperty("licenseEmail", this.licenseEmail);
/* 756 */ if (this.licenseEmail != null)
/* 757 */ localProperties.setProperty("licenseKey", this.licenseKey);
/* 758 */ if (this.user != null)
/* 759 */ localProperties.setProperty("user", this.user);
/* 760 */ final Job local1 = new Job("Verify Pro License Key")
/* 761 */ {
/* 762 */ protected IStatus run(IProgressMonitor paramAnonymousIProgressMonitor) {
/* 763 */ doVerifyLicenseKey(paramAnonymousIProgressMonitor);
/* 764 */ return LicenseVerifier.VerificationJob.this.validity;
/* 765 */ }
/* 766 */
/* 767 */ private void doVerifyLicenseKey(IProgressMonitor paramAnonymousIProgressMonitor)
/* 768 */ {
/* 769 */ paramAnonymousIProgressMonitor.beginTask(null, 1);
/* 770 */ if ((paramIProgressMonitor.isCanceled()) ||
/* 771 */ (paramAnonymousIProgressMonitor.isCanceled()))
/* 772 */ return;
/* 773 */ LicenseVerifier.VerificationJob.this
/* 774 */ .loadInfoFromInput(localProperties);
/* 775 */ if ((paramIProgressMonitor.isCanceled()) ||
/* 776 */ (paramAnonymousIProgressMonitor.isCanceled()))
/* 777 */ return;
/* 778 */ if (LicenseVerifier.VerificationJob.this.hasLicenseKey())
/* 779 */ {
/* 780 */ if (LicenseVerifier.VerificationJob.this
/* 781 */ .hasLicenseEmail())
/* 782 */ LicenseVerifier.VerificationJob.this
/* 783 */ .verifyProLicenseKey(paramAnonymousIProgressMonitor);
/* 784 */ }
/* 785 */ if ((!paramIProgressMonitor.isCanceled()) && (
/* 786 */ paramAnonymousIProgressMonitor.isCanceled()));
/* 787 */ }
/* 788 */ };
/* 789 */ local1.setSystem(true);
/* 790 */ final Job local2 = new Job("Verify Plus License Key")
/* 791 */ {
/* 792 */ protected IStatus run(IProgressMonitor paramAnonymousIProgressMonitor) {
/* 793 */ doVerifyLicenseKey(paramAnonymousIProgressMonitor);
/* 794 */ return LicenseVerifier.VerificationJob.this.validity;
/* 795 */ }
/* 796 */
/* 797 */ private void doVerifyLicenseKey(IProgressMonitor paramAnonymousIProgressMonitor)
/* 798 */ {
/* 799 */ paramAnonymousIProgressMonitor.beginTask(null, 1);
/* 800 */ if ((paramIProgressMonitor.isCanceled()) ||
/* 801 */ (paramAnonymousIProgressMonitor.isCanceled()))
/* 802 */ return;
/* 803 */ LicenseVerifier.VerificationJob.this
/* 804 */ .loadInfoFromInput(localProperties);
/* 805 */ if ((paramIProgressMonitor.isCanceled()) ||
/* 806 */ (paramAnonymousIProgressMonitor.isCanceled()))
/* 807 */ return;
/* 808 */ if (LicenseVerifier.VerificationJob.this.hasLicenseKey())
/* 809 */ {
/* 810 */ if (LicenseVerifier.VerificationJob.this
/* 811 */ .hasLicenseEmail())
/* 812 */ LicenseVerifier.VerificationJob.this
/* 813 */ .verifyPlusLicenseKey(paramAnonymousIProgressMonitor);
/* 814 */ }
/* 815 */ if ((!paramIProgressMonitor.isCanceled()) && (
/* 816 */ paramAnonymousIProgressMonitor.isCanceled()));
/* 817 */ }
/* 818 */ };
/* 819 */ local2.setSystem(true);
/* 820 */ final Job local3 = new Job("Verify License Key")
/* 821 */ {
/* 822 */ protected IStatus run(IProgressMonitor paramAnonymousIProgressMonitor) {
/* 823 */ doVerifySubscription(paramAnonymousIProgressMonitor);
/* 824 */ return LicenseVerifier.VerificationJob.this.validity;
/* 825 */ }
/* 826 */
/* 827 */ private void doVerifySubscription(IProgressMonitor paramAnonymousIProgressMonitor)
/* 828 */ {
/* 829 */ paramAnonymousIProgressMonitor.beginTask(null, 1);
/* 830 */ if ((paramIProgressMonitor.isCanceled()) ||
/* 831 */ (paramAnonymousIProgressMonitor.isCanceled()))
/* 832 */ return;
/* 833 */ LicenseVerifier.VerificationJob.this
/* 834 */ .loadInfoFromInput(localProperties);
/* 835 */ if ((paramIProgressMonitor.isCanceled()) ||
/* 836 */ (paramAnonymousIProgressMonitor.isCanceled()))
/* 837 */ return;
/* 838 */ if (LicenseVerifier.VerificationJob.this.hasUser())
/* 839 */ {
/* 840 */ if (LicenseVerifier.VerificationJob.this
/* 841 */ .hasAuthToken())
/* 842 */ LicenseVerifier.VerificationJob.this
/* 843 */ .verifySubscription(paramAnonymousIProgressMonitor);
/* 844 */ }
/* 845 */ if ((!paramIProgressMonitor.isCanceled()) && (
/* 846 */ paramAnonymousIProgressMonitor.isCanceled()));
/* 847 */ }
/* 848 */
/* 849 */ protected void canceling() {
/* 850 */ LicenseVerifier.VerificationJob.this.retrieveUIDRequest
/* 851 */ .abort();
/* 852 */ LicenseVerifier.VerificationJob.this.retrieveSubscriptionRequest
/* 853 */ .abort();
/* 854 */ super.canceling();
/* 855 */ }
/* 856 */ };
/* 857 */ local3.setSystem(true);
/* 858 */ final IWorkbench localIWorkbench = PlatformUI.getWorkbench();
/* 859 */ Display localDisplay = localIWorkbench.getDisplay();
/* 860 */ if ((localDisplay == null) || (localDisplay.isDisposed()))
/* 861 */ return;
/* 862 */ if (paramIProgressMonitor.isCanceled())
/* 863 */ return;
/* 864 */ localDisplay.syncExec(new Runnable() {
/* 865 */ public void run() {
/* 866 */ IWorkbenchWindow localIWorkbenchWindow = localIWorkbench
/* 867 */ .getActiveWorkbenchWindow();
/* 868 */ Shell localShell = localIWorkbenchWindow == null ? null :
/* 869 */ localIWorkbenchWindow.getShell();
/* 870 */ if ((localShell != null) && (localShell.isDisposed()))
/* 871 */ localShell = null;
/* 872 */ LicenseVerifier.VerificationJob.this.inputDialog = new ActivateProDialog(
/* 873 */ localShell,
/* 874 */ LicenseVerifier.VerificationJob.joinStr(LicenseVerifier.VerificationJob.this.actionNames),
/* 875 */ LicenseVerifier.VerificationJob.this.requiredStatus,
/* 876 */ LicenseVerifier.VerificationJob.this.validity
/* 877 */ .getCode(),
/* 878 */ localProperties,
/* 879 */ (LicenseVerifier.VerificationJob.this.style & 0x4) != 0,
/* 880 */ (LicenseVerifier.VerificationJob.this.style & 0x8) != 0,
/* 881 */ local1, local2, local3);
/* 882 */ int i = LicenseVerifier.VerificationJob.this.inputDialog
/* 883 */ .open();
/* 884 */ if (i == 1) {
/* 885 */ local1.cancel();
/* 886 */ local2.cancel();
/* 887 */ local3.cancel();
/* 888 */ LicenseVerifier.VerificationJob.this.cancel();
/* 889 */ paramIProgressMonitor.setCanceled(true);
/* 890 */ }
/* 891 */ }
/* 892 */ });
/* 893 */ if ((LicenseVerifier.hasValidity(this.validity, 1)) && (hasUser()) &&
/* 894 */ (hasAuthToken())) {
/* 895 */ long l = System.currentTimeMillis() + 604800L;
/* 896 */ InternalXMindNet.getInstance().getAccount()
/* 897 */ .signedIn(this.user, this.authToken, l, true);
/* 898 */ }
/* 899 */ }
/* 900 */
/* 901 */ private static String joinStr(Collection paramCollection) {
/* 902 */ StringBuffer localStringBuffer = new StringBuffer(
/* 903 */ paramCollection.size() * 10);
/* 904 */ Iterator localIterator = paramCollection.iterator();
/* 905 */ while (localIterator.hasNext()) {
/* 906 */ String str = (String)localIterator.next();
/* 907 */ if (localStringBuffer.length() > 0)
/* 908 */ localStringBuffer.append(", ");
/* 909 */ localStringBuffer.append(str);
/* 910 */ }
/* 911 */ return localStringBuffer.toString();
/* 912 */ }
/* 913 */
/* 914 */ private void loadInfoFromInput(Properties paramProperties) {
/* 915 */ this.licenseEmail = paramProperties.getProperty("licenseEmail");
/* 916 */ this.licenseKey = paramProperties.getProperty("licenseKey");
/* 917 */ this.user = paramProperties.getProperty("user");
/* 918 */ this.authToken = paramProperties.getProperty("token");
/* 919 */ }
/* 920 */
/* 921 */ private void retrieveSubscription(IProgressMonitor paramIProgressMonitor) {
/* 922 */ this.retrieveSubscriptionRequest
/* 923 */ .uri("/_res/verify/%s", new Object[] { this.user })
/* 924 */ .addHeader("UID", this.uid).get();
/* 925 */ if ((paramIProgressMonitor.isCanceled()) ||
/* 926 */ (this.retrieveSubscriptionRequest.isAborted()))
/* 927 */ return;
/* 928 */ int i = this.retrieveSubscriptionRequest.getCode();
/* 929 */ IDataStore localIDataStore = this.retrieveSubscriptionRequest
/* 930 */ .getData();
/* 931 */ if ((i == 200) && (localIDataStore != null)) {
/* 932 */ this.expiration = LicenseVerifier.extractExpiration(
/* 933 */ localIDataStore, this.uid);
/* 934 */ if (this.expiration == null)
/* 935 */ this.validity = LicenseVerifier.createValidity(4096);
/* 936 */ else
/* 937 */ this.validity = LicenseVerifier.createValidity(
/* 938 */ LicenseVerifier.parseExpiration(this.expiration,
/* 939 */ this.uid), this.user);
/* 940 */ } else if (this.retrieveUIDRequest.getException() != null) {
/* 941 */ this.validity = LicenseVerifier.createValidity(1073741824,
/* 942 */ this.retrieveUIDRequest.getException());
/* 943 */ } else if ((i >= 500) || (i < 400)) {
/* 944 */ this.validity = LicenseVerifier.createValidity(1073741824);
/* 945 */ }
/* 946 */ }
/* 947 */
/* 948 */ private void retrieveUID(IProgressMonitor paramIProgressMonitor) {
/* 949 */ this.retrieveUIDRequest
/* 950 */ .uri("/_res/uid/%s", new Object[] { this.user })
/* 951 */ .setAuthToken(this.authToken).get();
/* 952 */ if ((paramIProgressMonitor.isCanceled()) ||
/* 953 */ (this.retrieveUIDRequest.isAborted()))
/* 954 */ return;
/* 955 */ int i = this.retrieveUIDRequest.getCode();
/* 956 */ IDataStore localIDataStore = this.retrieveUIDRequest.getData();
/* 957 */ if ((i == 200) && (localIDataStore != null))
/* 958 */ this.uid = localIDataStore.getString("uid");
/* 959 */ else if (this.retrieveUIDRequest.getException() != null)
/* 960 */ this.validity = LicenseVerifier.createValidity(1073741824,
/* 961 */ this.retrieveUIDRequest.getException());
/* 962 */ else if ((i >= 500) || (i < 400))
/* 963 */ this.validity = LicenseVerifier.createValidity(1073741824);
/* 964 */ }
/* 965 */
/* 966 */ private boolean hasLicenseKey() {
/* 967 */ return (this.licenseKey != null) && (!"".equals(this.licenseKey));
/* 968 */ }
/* 969 */
/* 970 */ private boolean hasLicenseEmail()
/* 971 */ {
/* 972 */ return (this.licenseEmail != null) &&
/* 973 */ (!"".equals(this.licenseEmail));
/* 974 */ }
/* 975 */
/* 976 */ private boolean hasUser() {
/* 977 */ return (this.user != null) && (!"".equals(this.user));
/* 978 */ }
/* 979 */
/* 980 */ private boolean hasAuthToken() {
/* 981 */ return (this.authToken != null) && (!"".equals(this.authToken));
/* 982 */ }
/* 983 */
/* 984 */ private boolean hasUID() {
/* 985 */ return (this.uid != null) && (!"".equals(this.uid));
/* 986 */ }
/* 987 */
/* 988 */ private boolean hasExpiration() {
/* 989 */ return (this.expiration != null) && (!"".equals(this.expiration));
/* 990 */ }
/* 991 */
/* 992 */ protected void canceling() {
/* 993 */ this.retrieveUIDRequest.abort();
/* 994 */ this.retrieveSubscriptionRequest.abort();
/* 995 */ final ActivateProDialog localActivateProDialog = this.inputDialog;
/* 996 */ if (localActivateProDialog != null) {
/* 997 */ IWorkbench localIWorkbench = PlatformUI.getWorkbench();
/* 998 */ if (localIWorkbench != null) {
/* 999 */ final Display localDisplay = localIWorkbench.getDisplay();
/* 1000 */ if ((localDisplay != null) && (!localDisplay.isDisposed()))
/* 1001 */ localDisplay.asyncExec(new Runnable() {
/* 1002 */ public void run() {
/* 1003 */ if (localDisplay.isDisposed())
/* 1004 */ return;
/* 1005 */ localActivateProDialog.close();
/* 1006 */ }
/* 1007 */ });
/* 1008 */ }
/* 1009 */ }
/* 1010 */ super.canceling();
/* 1011 */ }
/* 1012 */ }
/* 1013 */ }
6. Create build environment for ant with build.xml (build.xml should be created in ~/xmind.verify/ folder) as below
- ~/xmind.verify/build.xml Select all
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="jar">
<!--ant build file to recompile jar-->
<property environment="env"/>
<property name="project.base.dir" value="."/>
<property name="xmind.class.path" value="/Applications/XMind.app/Contents/Resources/plugins"/>
<property name="name" value="net.xmind.verify_3.3.0.201208102038"/>
<property name="javafilename" value="LicenseVerifier"/>
<property name="app.dir" value="/Applications/XMind.app/Contents/Resources/plugins" />
<property name="src" value="${project.base.dir}/src"/>
<property name="test" value="${project.base.dir}/test"/>
<property name="reference" value="${project.base.dir}/lib"/>
<property name="build" value="${project.base.dir}/build"/>
<property name="classes" value="${build}/classes"/>
<property name="lib" value="${build}/lib"/>
<path id="reference.class.path">
<pathelement path="${java.class.path}" />
<fileset dir="${reference}">
<include name="*.jar" />
</fileset>
<fileset dir="${xmind.class.path}" includes="*.jar"/>
</path>
<target name="init">
<mkdir dir="${build}"/>
<mkdir dir="${classes}"/>
<mkdir dir="${lib}"/>
</target>
<target depends="init" name="pre.compile.test">
</target>
<target depends="pre.compile.test" name="compile.src">
<javac debug="on" memoryMaximumSize="256m" memoryInitialSize="256m" fork="true" includeantruntime="false" destdir="${classes}" srcdir="${src}">
<classpath refid="reference.class.path" />
<compilerarg value="-Xlint:unchecked"/>
</javac>
</target>
<target depends="compile.src" name="compile.test">
<javac debug="on" memoryMaximumSize="256m" memoryInitialSize="256m" fork="true" includeantruntime="false" destdir="${classes}">
<src path="${test}"/>
<classpath refid="reference.class.path" />
<compilerarg value="-Xlint:unchecked"/>
</javac>
</target>
<target depends="compile.src" name="jar">
<echo>=== BUILDING ${name}.jar ===</echo>
<jar destfile="${lib}/${name}.jar">
<zipfileset src="${reference}/${name}.jar" excludes="**/${javafilename}*.class"/>
<fileset dir="${classes}" excludes="**/Test.class"/>
</jar>
</target>
<!-- INSTALL -->
<target name="install" depends="jar">
<echo>=== INSTALLING ${name}.jar ===</echo>
<copy file="${lib}/${name}.jar" tofile="${app.dir}/${name}.jar" overwrite="true" />
</target>
<target name="clean">
<delete dir="${build}"/>
</target>
</project>
7. ant clean & build
cd ~/xmind.verify
ant clean jar
8. Update jar file and install to App folder
cd ~/xmind.verify/
ant install
P.S. this is how to add line numbers to the source code and then convert the angle brackets for this blog.
awk '{printf("/* %3d */ %s\n", NR,$0)}' filename | sed 's/</\</g;s/>/\>/g' > filenamenumbered.txt
Friday, August 31, 2012
Pascal for XCode 4
See here http://www.objectivepascal.com
Free Pascal Compiler -> http://www.freepascal.org/
Direct Link -> http://nchc.dl.sourceforge.net/project/freepascal/Mac%20OS%20X/2.6.0/fpc-2.6.0.intel-macosx.dmg
XCode 4 Template is here http://dl.dropbox.com/u/28343282/ObjP/Xcode_Templates.html
This is the script to add pascal syntax coloring in Xcode 4
- addpascalsyntax.sh Select all
#!/bin/bash
#
# Updates Xcode 4 and to support Pascal language syntax coloring
#
set -e
# Assumes Xcode 4+.
XCODE_MAJOR_VERSION=`xcodebuild -version | awk 'NR == 1 {print substr($2,1,1)}'`
if [ "$XCODE_MAJOR_VERSION" -lt "4" ]; then
echo "Xcode 4.x not found."
exit 1
fi
# Path were this script is located
SCRIPT_PATH="$(dirname "$BASH_SOURCE")"
# Set up path for PlistBuddy helper application which can add elements to Plist files
PLISTBUDDY=/usr/libexec/PlistBuddy
# Filename path private framework we need to modify
#DVTFOUNDATION_PATH="/Developer/Library/PrivateFrameworks/DVTFoundation.framework/Versions/A/Resources/"
#DVTFOUNDATION_PATH="/XCode4.3/Library/PrivateFrameworks/DVTFoundation.framework/Versions/A/Resources/"
# This framework is found withing the Xcode.app package and is used when Xcode is a monolithic
# install (all contained in Xcode.app)
DVTFOUNDATION_PATH="/Applications/Xcode.app/Contents/SharedFrameworks/DVTFoundation.framework/Versions/A/Resources/"
# Create Plist file of additional languages to add to 'DVTFoundation.xcplugindata'
cat >AdditionalLanguages.plist <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Xcode.SourceCodeLanguage.Pascal</key>
<dict>
<key>languageSpecification</key>
<string>xcode.lang.pascal</string>
<key>fileDataType</key>
<array>
<dict>
<key>identifier</key>
<string>com.apple.xcode.pascal-source</string>
</dict>
</array>
<key>id</key>
<string>Xcode.SourceCodeLanguage.Pascal</string>
<key>point</key>
<string>Xcode.SourceCodeLanguage</string>
<key>languageName</key>
<string>Pascal</string>
<key>version</key>
<string>1.0</string>
<key>documentationAbbreviation</key>
<string>pascal</string>
<key>conformsTo</key>
<array>
<dict>
<key>identifier</key>
<string>Xcode.SourceCodeLanguage.Generic</string>
</dict>
</array>
<key>name</key>
<string>Pascal Language</string>
</dict>
</dict>
</plist>
EOF
# Backup
cp "$DVTFOUNDATION_PATH/DVTFoundation.xcplugindata" "$DVTFOUNDATION_PATH/DVTFoundation.xcplugindata.bak"
# Now merge in the additonal languages to DVTFoundation.xcplugindata
$PLISTBUDDY "$DVTFOUNDATION_PATH/DVTFoundation.xcplugindata" -c 'Merge AdditionalLanguages.plist plug-in:extensions'
# Get rid of the AdditionalLanguages.plist since it was just temporary
rm -f AdditionalLanguages.plist
# Copy in the xclangspecs for the languages (assumes in same directory as this shell script)
#cp "$SCRIPT_PATH/Pascal.xclangspec" "$DVTFOUNDATION_PATH"
# Remove any cached Xcode plugins
rm -f /private/var/folders/*/*/*/com.apple.DeveloperTools/*/Xcode/PlugInCache.xcplugincache
echo "Syntax coloring must be manually selected from the Editor - Syntax Coloring menu in Xcode."
Tuesday, August 28, 2012
How To Migrate Windows 7 to a Solid State Drive
Basically, I follow this guide to migrate windows 7 hard disk to a new SSD hard disk http://www.howtogeek.com/97242/how-to-migrate-windows-7-to-a-solid-state-drive/
The essential steps are
1. Create a system repair disc in a CD/DVD http://windows.microsoft.com/is-IS/windows7/Create-a-system-repair-disc
2. Backup your system hard disk to external HD using Windows 7 Backup Utility. And after backing up, Windows 7 will prompt you with an option to create a system repair disc in case you have forgotten the first step.
3. Find the recovery disk for the PC and download the LAN or WLAN drivers from the support site of the PC Manufacturer and with your Windows 7 Product Key on hand (which is usually a sticker on the PC).
4. Do this before you clone your hard disk in Windows command prompt (Run as Administrator)
slmgr /upk
slmgr /rearm
So that the cloned SDD hard disk will not get "not genuine" warning after boot up and that Windows 7 will prompt you to re-renter the Windows 7 Product Key and activate again.
5. I use Clonezilla using partition to partition clone (as my target hard disk is larger than the source partition), and after cloning, switch the new SSD HD as the second one in boot sequence in the BIOS, while the DVD drive as the first one to boot. Moreover the old Windows 7 hard disk has to be detached from the PC. Make sure you remove the power and/or battery before you add or remove physically parts of the PC.
6. After cloning to SDD, you need to boot up the machine using system repair disc that you created earlier, as the Boot Manager is missing in the cloned SSD hard disk
7. After boot up the system repair disc, you have to use the command prompt to assign the drive letter of the cloned SSD hard disk to C
Diskpart
List disk
Select disk n (where n is your SSD’s number as provided by the previous command)
ASSIGN LETTER=C
Active
Exit
8. You may need to boot up your machine using the system repair disc several rounds in order for repairing the startup.
9. After boot up the machine using the cloned SSD harddisk, the OS will prompt you to enter the Windows 7 Product Key.
10. In case you want to have a clean install of Windows 7 rather than cloning, you must have your recovery disk for the PC Manufacturer and hardware drivers and all the program install disks on hand.
Saturday, August 25, 2012
Friday, August 3, 2012
Windows 7 CD Key
Windows 7 Ultimate Retail Key
Windows 7 Professional Retail Key
Windows 7 Home Premium Retail Key
Windows 7 Home Basic Retail Key
J783Y-JKQWR-677Q8-KCXTF-BHWGC C4M9W-WPRDG-QBB3F-VM9K8-KDQ9Y 2VCGQ-BRVJ4-2HGJ2-K36X9-J66JG MGX79-TPQB9-KQ248-KXR2V-DHRTD FJHWT-KDGHY-K2384-93CT7-323RC THHH2-RKK9T-FX6HM-QXT86-MGBCP KH2J9-PC326-T44D4-39H6V-TVPBY D8BMB-BVGMF-M9PTV-HWDQW-HPCXX TFP9Y-VCY3P-VVH3T-8XXCC-MF4YK
Windows 7 Professional Retail Key
HWRFF-2FFYX-XFXP2-DYFC3-BX3B7 YT9K9-4R938-3TVXX-3Q3QT-9HBXM C3X7Y-R6WWH-BRXRD-FY84C-FXWHK XJBR4-M42Q4-QPJ9C-BRDRJ-KHPVY TF3Q7-YYP8R-D78R7-W9Q9M-DXVBK J8D39-J2WM3-6368H-JV8G9-BYJJQ P3H89-V3P2R-JVBTF-YM2J2-FTMT3 RGM4T-3VT6B-GTYPY-3FHP2-HV2YJ TTY4D-RDKK9-TYB2T-68WJW-M69KJ
Windows 7 Home Premium Retail Key
PPBK3-M92CH-MRR9X-34Y9P-7CH2F Q8JXJ-8HDJR-X4PXM-PW99R-KTJ3H 8489X-THF3D-BDJQR-D27PH-PJ3HC TWF78-W7H8T-KXD8C-YDFCQ-HK4WG BFTWY-X2PJR-VJP8V-KGBPJ-FWBMP RHVHB-VYF67-9FT4M-2WXR8-P3C6R 38CGD-Q6RHB-37BVW-Y3XK7-3CJVC 86GG2-DBVT6-KYQQ6-XFK9R-896MF 4CBPF-W7GXG-J4J8F-GHG79-Q9YT8
Windows 7 Home Basic Retail Key
P4DBR-8YPT6-KHRB8-6T7RW-GMXGV FGTCF-8JBG2-4BK4G-36JWB-PFQXB CW4KD-MK47X-JYQ7Y-DKKTR-86TH7 37X8Q-CJ46F-RB8XP-GJ6RK-RHYT7 GDK6B-87QP9-F9WYK-PP327-BQ622 72C8D-KQ9Y4-FGBCD-WY9WG-BD92C GV7X4-92M4D-6F69V-RFGP9-3FBBD 4JCWB-FVHJJ-XCPKC-CTWDP-QQQ9M WXM3Y-H2GDY-TKFQH-6GQQF-7VG8P
Thursday, June 28, 2012
How to compile GCC 4.6.3 on Mac OS X
(1) Download Source Code and untar
(2) Build it
(3) Test it
~/local/bin/g++-4.6.3 -std=c++0x test_lambda.cpp -o test_lambda
./test_lambda
mkdir -p gcc463
cd gcc463
#get the source
curl -O ftp://gcc.gnu.org/pub/gcc/infrastructure/gmp-4.3.2.tar.bz2
curl -O ftp://gcc.gnu.org/pub/gcc/infrastructure/mpc-0.8.1.tar.gz
curl -O ftp://gcc.gnu.org/pub/gcc/infrastructure/mpfr-2.4.2.tar.bz2
curl -O http://ftp.gnu.org/gnu/gcc/gcc-4.6.3/gcc-4.6.3.tar.bz2
#untar
tar xjf gmp-4.3.2.tar.bz2
tar xjf mpfr-2.4.2.tar.bz2
tar xzf mpc-0.8.1.tar.gz
tar xjf gcc-4.6.3.tar.bz2
(2) Build it
- buildgcc463.sh Select all
#!/bin/bash
export CXX=/usr/bin/g++
export CC=/usr/bin/gcc
export CPP=/usr/bin/cpp
export LD=/usr/bin/ld
export RANLIB=/usr/bin/ranlib
export AS=/usr/bin/as
export AR=/usr/bin/ar
GMP="`pwd`/gmp-4.3.2"
MPFR="`pwd`/mpfr-2.4.2"
MPC="`pwd`/mpc-0.8.1"
GCC_SRC="`pwd`/gcc-4.6.3"
PREFIX=~/local
if [ ! -f $PREFIX/lib/libgmp.dylib ] ; then
rm -fr $GMP/build
mkdir -p $GMP/build
cd $GMP/build
echo "configure gmp ..."; ../configure --prefix=$PREFIX --build=x86_64-apple-darwin11
echo "building gmp ..."; make && make install
fi
if [ ! -f $PREFIX/lib/libmpfr.dylib ] ; then
rm -fr $MPFR/build
mkdir -p $MPFR/build
cd $MPFR/build
pwd
echo "configure mpfr ..."; ../configure --prefix=$PREFIX --with-gmp=$PREFIX --build=x86_64-apple-darwin11
echo "building mpfr ..."; make && make install
fi
if [ ! -f $PREFIX/lib/libmpc.dylib ] ; then
rm -fr $MPC/build
mkdir -p $MPC/build
cd $MPC/build
echo "configure mpc ..."; ../configure --prefix=$PREFIX --with-gmp=$PREFIX --with-mpfr=$PREFIX --build=x86_64-apple-darwin11
echo "building mpc ..."; make && make install
fi
rm -fr $GCC_SRC/build
mkdir -p $GCC_SRC/build
cd $GCC_SRC/build
../configure --prefix=$PREFIX --with-gmp=$PREFIX --with-mpfr=$PREFIX --with-mpc=$PREFIX --enable-checking=release --program-suffix=-4.6.3 --enable-languages=c,c++,objc,obj-c++
make -j 4 && make install
(3) Test it
- test_lambda.cpp Select all
//Program to test the new C++11 lambda syntax
#include <iostream>
using namespace std;
int main()
{
cout << [](int m, int n) { return m + n; } (2, 4) << endl;
return(0);
}
~/local/bin/g++-4.6.3 -std=c++0x test_lambda.cpp -o test_lambda
./test_lambda
Tuesday, June 19, 2012
androideabi Utilities Binaries
These are the utilities for Android Terminal Access
Download here
http://apiexplorer.googlecode.com/files/androideabi_binary.zip
bash 4.1 (requires root)
make (useful for GCC Plugin for C4droid)
python (standalone script requires PythonForAndroid_r4.apk)
perl (standalone script requires perl_for_android_r1.apk)
vim (with multibyte support)
wget (in case your busybox's wget was broken with bad address)
curl (how I build this ? -> here)
utelnetd (telnet daemon, utelnetd -p 1025 -l /system/bin/bash &)
scp
ssh
rsync
Instructions:
root the device and push these utilities to /system/bin/ or /system/xbin and chmod 04755 or chmod 755, if your /system folder is readonly, you might need Root Explorer to mount it as RW.
vim with multibyte support
Before the use of vim, you should setup TERM as
And for editing UTF-8 File, use
Download here
http://apiexplorer.googlecode.com/files/androideabi_binary.zip
bash 4.1 (requires root)
make (useful for GCC Plugin for C4droid)
python (standalone script requires PythonForAndroid_r4.apk)
perl (standalone script requires perl_for_android_r1.apk)
vim (with multibyte support)
wget (in case your busybox's wget was broken with bad address)
curl (how I build this ? -> here)
utelnetd (telnet daemon, utelnetd -p 1025 -l /system/bin/bash &)
scp
ssh
rsync
Instructions:
root the device and push these utilities to /system/bin/ or /system/xbin and chmod 04755 or chmod 755, if your /system folder is readonly, you might need Root Explorer to mount it as RW.
adb push bash /system/bin/bash
adb shell "chmod 04755 /system/bin/bash"
su -c /system/bin/bash
vim with multibyte support
Before the use of vim, you should setup TERM as
export TERM=xterm
And for editing UTF-8 File, use
vim --cmd "set encoding=utf-8" myfile.txt
Wednesday, May 30, 2012
[How to] Install Android 4.0 under VMware
1) Download image from http://www.buildroid.org/Download/android-x86-vm-20120307.iso.gz and decompress it
2) Use VMWare to mount the iso and create a virtual machine
Type : FreeBSD
Harddisk : 10G
Ram : 512MB
3) Choose Install Android-x86 to harddisk
4) Create partition and format the primary partition and then create a fake SD Card for 2G
5) After Android OS started. Run the Terminal Emulator inside the Android to get the IP Address. Type "netcfg" inside the Terminal
say the ipaddress is 172.16.85.133
6) To push file or app to the Android OS under VMWare, you need to install Android SDK. (say installed in ~/android-sdk-macosx/)
7) For example, to push Music to the sdcard
8) To compile and install a sample app to the Android OS
# -r option is to reinstall
~/android-sdk-macosx/platform-tools/adb install -r bin/MainActivity-debug.apk
9) Shell access
2) Use VMWare to mount the iso and create a virtual machine
Type : FreeBSD
Harddisk : 10G
Ram : 512MB
3) Choose Install Android-x86 to harddisk
4) Create partition and format the primary partition and then create a fake SD Card for 2G
5) After Android OS started. Run the Terminal Emulator inside the Android to get the IP Address. Type "netcfg" inside the Terminal
say the ipaddress is 172.16.85.133
6) To push file or app to the Android OS under VMWare, you need to install Android SDK. (say installed in ~/android-sdk-macosx/)
7) For example, to push Music to the sdcard
~/android-sdk-macosx/platform-tools/adb connect 172.16.85.133
~/android-sdk-macosx/platform-tools/adb push ~/Mymusic.mp3 /sdcard/Music/
8) To compile and install a sample app to the Android OS
~/android-sdk-macosx/platform-tools/adb connect 172.16.85.133
cd ~/android-sdk-macosx/samples/ActionBarCompat/
~/android-sdk-macosx/tools/android update project -t 1 -p .
ant debug
~/android-sdk-macosx/platform-tools/adb install bin/MainActivity-debug.apk
# -r option is to reinstall
~/android-sdk-macosx/platform-tools/adb install -r bin/MainActivity-debug.apk
9) Shell access
~/android-sdk-macosx/platform-tools/adb connect 172.16.85.133
~/android-sdk-macosx/platform-tools/adb shell
Friday, May 25, 2012
Galaxy Notes ICS 4.0.3 update
May 24 2012.
N7000ZSLPF – 4.0.3 – 2012 May – N7000OZSLPF – Hong Kong
N7000DXLP9 – 4.0.3- 2012 May – N7000OLBLP6 – Singapore
N7000DXLP9 – 4.0.3 – 2012 May – N7000OLBLP6 – Philippines (Sun)
N7000ZSLPF – 4.0.3 – 2012 May – N7000OZSLPF – Taiwan Download
N7000DXLP9 – 4.0.3 – 2012 May – N7000OLBLP6 – Singapore (SingTel)
May 23 2012.
N7000DDLP8 – 4.0.3 – 2012 May – N7000ODDLP5 – India
N7000DDLP8 – 4.0.3 – 2012 May – N7000ODDLP5 – Sri Lanka
N7000DDLP8 – 4.0.3 – 2012 May – N7000ODDLP5 – Bangladesh
N7000DDLP8 – 4.0.3 – 2012 May – N7000ODDLP5 – Nepal
May 22 2012.
N7000DXLP9 - 4.0.3 – 2012 May - N7000OLBLP6 - Thailand
N7000DXLP9 - 4.0.3 – 2012 May - N7000OLBLP6 - Malaysia
N7000DXLP9 - 4.0.3 – 2012 May – N7000OLBLP6 - Indonesia
N7000DXLP9 - 4.0.3 – 2012 May - N7000OLBLP6 – Vietnam
May 2012.
N7000XXLPY - 4.0.3 – 2012 May - N7000OXALPY - Open Germany
Download kies 2.0 from Samsung as OTA update may be later
http://www.samsung.com/in/consumer/mobile-phone/mobile-phone/galaxy-note/GT-N7000ZBAINU-support
Wednesday, May 23, 2012
epub title and cover tips
OEBPS/content.opf
.
.
- OEBPS/content.opf Select all
<metadata xmlns:opf="http://www.idpf.org/2007/opf" xmlns:dc="http://purl.org/dc/elements/1.1/"> <dc:title>Book Title</dc:title> <dc:creator>Author Name=</dc:creator> ... ... <meta name="cover" content="cover-image"/> </metadata> <manifest> <item id="ncx" href="content.ncx" media-type="application/x-dtbncx+xml"></item> <item id="cover-image" href="images/cover.jpg" media-type="image/jpeg"/> <item id="cover" href="cover.html" media-type="application/xhtml+xml"/> ... </manifest>
- OEBPS/cover.html Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Cover<=</title> <style type="text/css"> img { max-width: 100%; } </style> </head> <body> <div id="cover-image"> <img src="images/cover.jpg" alt="Book Title"/> </div> </body> </html>
.
.
Monday, May 14, 2012
How to convert GarageBand Mac project file to GarageBand iPad
Suppose you have a GarageBand project in Mac and want to convert to iPad, you should change 2 files
projectData and metadata.plist using TextWrangler or TextEdit
change the word x86_64 to iPad1,1
and change macos to ios
and drag the project file say MySong.band to iTunes under GarageBand App
If you know how to use command in Terminal
change the word x86_64 to iPad1,1
and change macos to ios
and drag the project file say MySong.band to iTunes under GarageBand App
If you know how to use command in Terminal
cd MySong.band sed -i.bak 's/x86_64/iPad1,1/g;s/macos/ios/g' projectData sed -i.bak 's/x86_64/iPad1,1/g;s/macos/ios/g' Output/metadata.plist rm *.bak Output/*.bak
Wednesday, January 25, 2012
hosts
127.0.0.1 activate.adobe.com
127.0.0.1 practivate.adobe.com
127.0.0.1 ereg.adobe.com
127.0.0.1 activate.wip3.adobe.com
127.0.0.1 wip3.adobe.com
127.0.0.1 3dns-3.adobe.com
127.0.0.1 3dns-2.adobe.com
127.0.0.1 adobe-dns.adobe.com
127.0.0.1 adobe-dns-2.adobe.com
127.0.0.1 adobe-dns-3.adobe.com
127.0.0.1 ereg.wip3.adobe.com
127.0.0.1 activate-sea.adobe.com
127.0.0.1 wwis-dubc1-vip60.adobe.com
127.0.0.1 activate-sjc0.adobe.com
Subscribe to:
Posts (Atom)