How to change language on Adobe CC to english? (On Mac)

*note: i tested this only on Photoshop

Just follow these steps:

  1. Close Photoshop or whatever you’ve opened
  2. Go to Finder > Preferences and check first checkbox (Show all filename extensions) and close the window
  3. Go to Finder > File > New File Window then select Applications
  4. Go to Adobe Photoshop CC > Locales > tr_TR > Support Files
  5. Rename the extension of .dat file to .bak

That should do the trick. Now when you opened your photoshop, it should be using English language

Yorum bırakın

Filed under Adobe

How to Load UIViewController programmatically with Swift?

Sometimes you may have to display a view with an element that you cannot or should not create an outlet with it. In that occasions, this is what you need:

let vc : AnyObject! = self.storyboard?.instantiateViewControllerWithIdentifier("myTargetViewController")

self.showViewController(vc as UIViewController, sender: vc)

But in order to make this thing work; Open your storyboard, display Identity Inspector at right pan of your Xcode and copy “myTargetViewController” to that view controller’s Storyboard ID. That should do the trick ;)

Yorum bırakın

Filed under Swift

How to Write to NTFS Drives in OS X

First of all, chmod is not the answer.

  1. sudo nano /etc/fstab
  2. Write “LABEL=drivename none ntfs rw,auto,nobrowse” in fstab
  3. kntrl-O & kntrl-X shotcuts will write and save your changes
  4. Unmount your drive from Mac
  5. Unplug your drive from Mac
  6. Plug your drive back in
  7. Within Finder’s menu bar, click “Go to Folder”
  8. Type /Volumes in “Go to Folder” screen. This will display all drives whether they’re available or not
  9. Drag your drive into Favourites, left of current Finder screen.

This is how you do it.

Yorum bırakın

Filed under Mac OS X

Cannot start PyCharm No JDK found

If have an error message like “ERROR: Cannot start PyCharm No JDK found. Please validate either PYCHARM_JDK, JDK_HOME or JAVA_HOME environment variable points to valid JDK installation.” while trying to install pycharm on ubuntu, this how you fix it:

 sudo apt-get purge openjdk*
 sudo add-apt-repository ppa:webupd8team/java
 sudo apt-get update
 sudo apt-get install oracle-java7-installer

Yorum bırakın

Filed under Python, Ubuntu

How to Run Bash Scripts within Python?

There are 2 different approaches:


import os
os.system('echo "hello"')


import subprocess
subprocess.call("./myBashScript.sh", shell=True)

Some say first approach is deprecated but i think they haven’t faced any problem when all you need is a single line command to run within different parameters. So, in my opinion each one has it’s own advantage.

Yorum bırakın

Filed under Python

How to split text files into small subsets with Python?

This is how you do it:

lines_per_file = 500
smallfile = None
with open('processedTotal.txt') as bigfile:
   for lineno, line in enumerate(bigfile):
      if lineno % lines_per_file == 0:
         if smallfile:
            smallfile.close()
         small_filename = 'set_{}.txt'.format(lineno + lines_per_file)
         smallfile = open(small_filename, "w")
      smallfile.write(line)
   if smallfile:
      smallfile.close()

Yorum bırakın

Filed under Python

SCP (Secure Copy) through SSH

Copying file/folder to host:

scp SourceFile user@host:directory/TargetFile
scp -r /local/folder/directory/ user@host:/target/folder/directory

Copying file/folder from host:

scp user@host:directory/SourceFile TargetFile
scp -r user@host:directory/SourceFolder TargetFolder

Note that if the remote host uses a port other than the default of 22, it can be specified in the command. For example, copying a file from host:

scp -P 2222 user@host:directory/SourceFile TargetFile

Yorum bırakın

Filed under Linux, Mac OS X

How to log all input/output in a terminal session?

Start logger : script myTerminalSession.log

Stop logger : exit

Yorum bırakın

Filed under Ubuntu

How to delete all indexed data on Apache Solr?

curl http://localhost:8983/solr/update --data '<delete><query>*:*</query></delete>' -H 'Content-type:text/xml; charset=utf-8'

curl http://localhost:8983/solr/update --data '<commit/>' -H 'Content-type:text/xml; charset=utf-8'

Yorum bırakın

Filed under Solr

Persistent Data Storage with NSUserDefaults in Swift

If you need to store data between restarts of your iOS apps or occasions like that, then you probably need to use NSUserDefaults. Below you may see how to store data with NSUserDefaults. And as far as i understand, concept is named as Persistent Data Storage.

    override func viewDidLoad() {
        super.viewDidLoad()
        
        // creating variables and initializing -> setObject(variable_value, variable_name)
        NSUserDefaults.standardUserDefaults().setObject("Timur", forKey: "name")
        NSUserDefaults.standardUserDefaults().setObject("Yildirim", forKey: "surname")
        NSUserDefaults.standardUserDefaults().setInteger(24, forKey: "age")
        NSUserDefaults.standardUserDefaults().setBool(true, forKey: "isOnline")
        NSUserDefaults.standardUserDefaults().setFloat(3.14159, forKey: "pi")
        NSUserDefaults.standardUserDefaults().setDouble(2.71828, forKey: "euler")
        
        let blog = NSURL(string: "https://timuraykutyildirim.wordpress.com/");
        NSUserDefaults.standardUserDefaults().setURL(blog!, forKey: "myBlog")
        
        
        // sync initialized data into iOS
        NSUserDefaults.standardUserDefaults().synchronize()
        
        /* The exclamation mark at the end of this statement,
           if we would not have that, our output would be (Optional 24)
           so with ” ! ” we are telling xcode that the value does exist indeed. */
        println(NSUserDefaults.standardUserDefaults().objectForKey("age")!)
    }

Testing

Suppose you don’t have any iOS device when you want to test this code.  This is how you should do it:

  1. First, run the code as it is.
  2. Click “Stop Running” button on your Xcode
  3. Close your simulator (CMD+Q)
  4. Comment-in the decleration of your variable. In my case, it’s the line with  << setInteger(24, forKey: “age”) >>
  5. Run your application again. It’ll still print variable.
  6. Click “Stop Running” button on your Xcode
  7. Click (iOS Simulator) >> (Reset Content and Settings…) in your simulator’s File menu
  8. Close again your simulator (CMD+Q)
  9. Run your application one more time and this time it won’t work as it shouldn’t have in the first place.

Yorum bırakın

Filed under Swift