27 Kasım 2012 Salı

JIRA REST API - Updating Status

You can change a status with executing the transition.

  • You should give the transition id. "{transition\": {\"id\": \"61\"}"
  • The url should be :  "http://localhost:8080/rest/api/2/issue/TAI-39/transitions?expand=transitions.fields" SElect the issue that you want to update.
  • You shoul use "POST"
  • Here is the curl command: curl -D- -X POST -H "Authorization: Basic YWRtaW46SDF0MXQ=" --data "{\"transition\": {\"id\": \"81\"}}" -H "Content-Type: application/json" "http://localhost:8080/rest/api/2/issue/TAI-39/transitions?expand=transitions.fields"
  • Here is the java implementation:          
  •                                                                
    public static String httpGet() throws IOException {         
    URL url = new URL("http://localhost:8080/rest/api/2/issue/TAI-39/transitions?expand=transitions.fields");         
    HttpURLConnection conn = (HttpURLConnection) url.openConnection();  
    conn.setDoOutput(true);         
    conn.setDoInput(true);                 
    String credentials = "username" + ":" + "password";        
     String encoding = Base64Converter.encode(credentials.getBytes("UTF-8"));   
    conn.setRequestProperty("Authorization", String.format("Basic %s", encoding));  
    conn.setRequestMethod("POST"); 
    conn.setRequestProperty("Content-Type", "application/json");    
      conn.connect();                  
     String st = "{\"transition\": {\"id\": \"91\"}}";    
     System.out.println(st);      
      byte[] outputBytes = st.getBytes("UTF-8");     
     OutputStream os = conn.getOutputStream();  
    BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));        
     StringBuilder sb = new StringBuilder();        
     String line;         
    while ((line = rd.readLine()) != null) {           
    sb.append(line);         
    }         
    rd.close();             
    conn.disconnect();        
    System.out.println("sb: "+ sb.toString());         
    return sb.toString();     
    }

JIRA REST API - Edit Issues


  • When you want to update a field with JIRA REST API, first write it i json format.  Ex: I want to update the summary of an issue.        
  • {"fields": {"summary":{"name":"bahar"}}}
  •  You can try it with curl commant whether it works or not.
  •   curl -D- -X PUT -H "Authorization: Basic YWRtaW46SDF0MXQ=" --data "{\"fields\":{\"summary\":\"bahar\"}}"   -H "Content-Type: application/json" "http://localhost:8080/rest/api/2/issue/TAI-9"
  •  You should use PUT for updating.
  • Don't forget to add "\" backslash  before the double quotes.
  • You should encode your username:password with base 64 encode.
  • encoder 
  • write your username:password, and the output will be "YWRtaW46SDF0MXQ= " something like this. Write the output to the authorization. 
  • Ex: "Authorization: Basic YWRtaW46SDF0MXQ="  
  • "http://localhost:8080/rest/api/2/issue/TAI-9" is the issue that you want to update.
  •   You can do the same thing with java code.Here is the method:   
     public static String updateSummary() throws IOException {
     
        URL url = new URL("http://localhost:8080/rest/api/2/issue/TAI-9");
        HttpURLConnection conn = (HttpURLConnection) url.openConnection();
        conn.setDoOutput(true);
        conn.setDoInput(true);

        String credentials = "username" + ":" + "password";
        String encoding = Base64Converter.encode(credentials.getBytes("UTF-8"));
        conn.setRequestProperty("Authorization", String.format("Basic %s", encoding));
       
        conn.setRequestMethod("PUT");
        conn.setRequestProperty("Content-Type", "application/json");
       
        conn.connect();
      
        String st="{\"fields\":{\"summary\":\"bahar\"}}"

        byte[] outputBytes = st.getBytes("UTF-8");
        OutputStream os = conn.getOutputStream();
        os.write(outputBytes);
        os.flush();
       
        BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
        StringBuilder sb = new StringBuilder();
        String line;
        while ((line = rd.readLine()) != null) {
          sb.append(line);
        }
        rd.close();

        conn.disconnect();
        return sb.toString();

    }                                                                                                                               

  • you can use Base64Convertor.java class. Download
  • Here is the atlassian documentation for updating issue via JIRA REST API. atlassian

8 Kasım 2012 Perşembe

JIRA - Create Custom Fields with Code

You can automatically create custom fields with code within your plugin for JIRA.
Here is an  example method to do this. This method creates four custom fields.

public void createAllCustomFields(){
        CustomFieldType fieldType = customFieldManager.getCustomFieldType("com.atlassian.jira.plugin.system.customfieldtypes:textfield");
        try {
            CustomField contactName = customFieldManager.createCustomField("Contact Name", "Name of the contact", fieldType , null, null, null);
            customFieldManager.createCustomField("Contact Surname", "Surname of the contact", fieldType , null, null, null);
            customFieldManager.createCustomField("Contact Phone", "Phone number of the contact", fieldType , null, null, null);
            customFieldManager.createCustomField("Contact Email", "Email address of the contact", fieldType , null, null, null);
        } catch (GenericEntityException e) {
       
            e.printStackTrace();
        }
        System.out.println("createAllCustomFields is called !!!!!!!!!!!!!!!!!!!!!");
    }

Plugin Development Tips


2 Kasım 2012 Cuma

Create some marketing materials












 
 plugin logo














A plugin logo that is a 72x72px PNG/JPG/GIF image. Atlassian strongly recommends a chiclet-style background for the logo (check out this free Photoshop template). This format works best with upcoming changes to the user interfaces of UPM and the Atlassian Marketplace.
plugin icon The plugin icon that is a 16x16px PNG/JPG/GIF pixel version of your plugin logo or an appropriate derivation of it.
banner

Currently, UPM 2.0 does not display banners but later versions will. Moreover, a banner is required by the Atlassian Marketplace. So, since ArfX's functionality (nothing really) is likely to work in future versions of both JIRA and UPM, this example adds a banner to show up when the software supports it. 

Here is how to add it to your plugin

Plugin Metadata Files used by UPM and Marketplace


Velocity Guide

Velocity is a Java-based template engine. It permits web page designers to reference methods defined in Java code. Web designers can work in parallel with Java programmers to develop web sites according to the Model-View-Controller (MVC) model, meaning that web page designers can focus solely on creating a well-designed site, and programmers can focus solely on writing top-notch code. Velocity separates Java code from the web pages, making the web site more maintainable over the long run and providing a viable alternative to JSPs.

Velocity - Guide

<HTML>
<BODY>
Hello $customer.Name!
<table>
#foreach( $mud in $mudsOnSpecial )
   #if ( $customer.hasPurchased($mud) )
      <tr>
        <td>
          $flogger.getPromo( $mud )
        </td>
      </tr>
   #end
#end
</table>

1 Kasım 2012 Perşembe

Reusing the configurations in each run

Suppose you added some data on to virtual JIRA, how do you retain it when you clean start-up JIRA next time?
This is where a new SDK command comes to our rescue.
After the atlas-run is finished, that is, after you pressed Ctrl + C, execute the following command:
atlas-create-home-zip
This will generate a file named generated-test-resources.zip under the target folder.
Copy this file to the /src/test/resources folder or any other known locations. Now modify the pom.xml to add the following entry under configurations in the maven-jira-plugin:
<productDataPath>${basedir}/src/test/resources/generated-test-
resources.zip</productDataPath>

Modify the path accordingly. This will reuse the configurations the next time you run
atlas-run.

13 Eylül 2012 Perşembe

Confluence Increase Maximum Heap Size


You can only view Maximum Heap Size  from Confluence > Administration > System Information.

To Edit:

Do not set your memory using CATALINA_OPTS this is overridden by JAVA_OPTS.
On Linux
  • In the unpacked Confluence standalone directory, edit the file bin/setenv.sh
  • Edit the line beginning with JAVA_OPTS= substituting new values for -Xms (starting memory) and -Xmx (maximum memory)
  • Leave the rest of the options in that line unchanged
An example of a minimal setting for a large system - max heap size is set to 1Gb :
JAVA_OPTS="-Xmx1024m $JAVA_OPTS -Djava.awt.headless=true "

Reference

FishEye Upgrade Guide


1. Download Fisheye
2. Extract the new FishEye archive into a directory such as <New FishEye home directory>.
3. Shut down the old FishEye instance if it is running.
4. Copy <FishEye home directory>/config.xml to <New FishEye home directory>.
5. Copy  the <FishEye home directory>/var directory to <New FishEye home directory>/var.
6. Copy the <FishEye home directory>/cache directory to <New FishEye home directory>/cache.
7. Start FishEye from the new installation by running <New FishEye home directory>/bin/run.sh.

linux commands:

wget -c http://www.atlassian.com/software/fisheye/downloads/binary/fisheye-2.8.0.zip

unzip fisheye-2.8.0.zip

<FishEye home directory>/bin ./stop.sh

cp <FishEye home directory>/config.xml <New FishEye home directory>/config.xml

<New FishEye home directory> rm -rf var

<New FishEye home directory> mkdir var

cp <FishEye home directory>/var/* <New FishEye home directory>/var/*

<New FishEye home directory> mkdir cache

cp <FishEye home directory>/cache/* <New FishEye home directory>/cache/*

<New FishEye home directory>/bin ./run.sh

Go to your fisheye 2.8, ex: http://localhost:8060/

12 Eylül 2012 Çarşamba

'java.sql.SQLException Got error 28 from storage engine' Error when Viewing a Page

Symptoms:

Viewing a page fails with this stack trace found in the atlassian-confluence.log:
...
org.springframework.jdbc.UncategorizedSQLException: Hibernate operation: Could not execute query; uncategorized SQLException for SQL []; SQL state [HY000]; error code [1030]; Got error 28 from storage engine; nested exception is java.sql.SQLException: Got error 28 from storage engine
Caused by: java.sql.SQLException: Got error 28 from storage engine
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1072)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3563)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3495)
...
Cause:

MySQL database server has no space left to work in its tmp directory.
Resolution:

Verify whether there is sufficient disk space on the MySQL database server.

Reference

30 new and updated Confluence tutorials



We now have 11 new and 19 updated Confluence tutorials – a great resource for plugin developers, nicely timed with the release of Confluence 4.3.
New Confluence tutorials:

Working with the Tasks REST API in Confluence

Sending Emails in a Plugin

Posting notifications in Confluence

Preformatted Table – Example of a User Macro

Panel Preformatted with Specific Colours – Example of a User Macro

Adding an Option to the Editor Insert Menu

Adding Keyboard Shortcuts to Confluence

Writing Integration Tests for your Plugin (to be published after review)

Altering Confluence page output using a Pipeline Transformer module (to be published after completion, some time in October)

Writing Soy Templates (to be published after review)

Defining a Pluggable Service in a Confluence Plugin (to be published after completion, some time in September)

Updated Confluence tutorials:

Extending Autoconvert

Adding Menu Items to Confluence

Creating a Cross-Platform Admin Configuration Form

Writing Macros for pre-4.0 versions of Confluence

Preventing XSS issues with macros in Confluence 4.0

Creating a new Confluence Macro

Extending the Macro Property Panel

Writing a Confluence Theme

Writing Unit Tests for your Plugin

Writing a Macro Using JSON

Developing Technical Documentation on Confluence Wiki

Developing a Knowledge Base on Confluence Wiki

Searching using the V2 Search API (in progress)

Writing a search result renderer (in progress)

Adding a Custom Action to Confluence (to be published after review)




11 Eylül 2012 Salı

confluence suddenly unusable -- java error

System Error
A system error has occurred — our apologies!
For immediate troubleshooting, consult our knowledge base for a solution.
If you would like to receive support from Atlassian's support team, ask your Confluence administrator to create a support issue on Atlassian's support system with the following information:
a description of your problem and what you were doing at the time it occurred
a copy of the error and system information found below
a copy of the application logs (if possible).
Your Confluence administrator can use the support request form to create a support ticket which will include this information.
We will respond as promptly as possible.
Thank you!
Return to site homepage…
The SystemInformationService could not be retrieved from the container. Therefore very limited information is available in this error report.
The SystemInformationService could not be retrieved due to the following error: java.lang.NullPointerException
Cause
com.atlassian.util.concurrent.LazyReference$InitializationException: java.lang.NullPointerException
at com.atlassian.util.concurrent.LazyReference.getInterruptibly(LazyReference.java:152)
caused by: java.lang.NullPointerException
at com.atlassian.spring.container.ContainerManager.getComponent(ContainerManager.java:33)

If you get this error message, permission error may cause this error.
To solve it,
1. Go to your confluence home directory
2. list all items with ls -al

testwww1:/usr/local/confluence-data# ls -al
total 152
drwx--S---  19 confluence confluence  4096 2012-08-20 10:27
(...)
drwxr-sr-x   2 root       confluence  4096 2012-07-10 15:41 plugins-cache

3. Then, (Our) Confluence is running with confluence user, so permissions were wrong (without writing for group). When I changed owner with:

chown -R confluence:confluence confluence
chown -R confluence:confluence confluence-data
 and restarted Confluence with
/etc/init.d/confluence restart
 it raised up and is working. Hope you will find it useful :)

4 Eylül 2012 Salı

How to add a facebook like button in a Confluence page?

1. You should create the code from the facebook developers' page for the page that you want to like.

          http://developers.facebook.com/docs/reference/plugins/like/


















2. Copy the generated code.
3. Create a confluence page or open editing for an existing one. Add a html-include macro.
4. Paste the copied code into it, and save the page.







5. Here it is!






Similiarly, you can add twitter follow button.

https://twitter.com/about/resources/buttons


31 Ağustos 2012 Cuma

Confluence - Enabling the html-include Macro

By default, the HTML macros are disabled. You should only turn on these macros if you trust all your users not to attempt to exploit them.


(info) You need to have System Administrator permissions in order to perform this function. 
To enable the HTML macros,
  1. Choose Browse > Confluence Admin.
  2. Select 'Plugins' in the left-hand panel. This will display the installed plugins active for this Confluence installation.
  3. Click' 'HTML macros', then click 'Enable Plugin'.

To embed an external page,
Use the following syntax:
{html-include:url=http://www.example.com}



29 Ağustos 2012 Çarşamba

Confluence Plugin - Business Dictionary (BuDict)



BuDict is used for displaying an information bubble above selected words in Confluence. The information bubble is displayed only when the mouse cursor is over the word, as shown in the next picture. This bubble includes an explanation or other specified text for the marked words (investment).










Budict manual 4.0 EN

marketplace

Upgrading Confluence on Linux









  1. Download the appropriate Confluence 'Linux 64-bit / 32-bit Installer' (.bin) file that suits your operating system (for the new version of Confluence) from the Confluence Download Center.
  2. Open a Linux console and change directory (cd) to the '.bin' file's directory.
    If the '.bin' file is not executable after downloading it, make it executable, for example:
    chmod a+x atlassian-confluence-X.Y.bin
    (where X.Y represents your version of Confluence)
  3. Execute the '.bin' file to start the upgrade wizard.
  4. When prompted to choose between creating a new Confluence installation or upgrading an existing installation, choose the 'Upgrade an existing Confluence installation' option.


16 Ağustos 2012 Perşembe

El Altı Notları

Çok unutkan oldum bugünlerde herşeyi unutuyorum ne yapmak lazım bu durumda herşeyi yazmak lazım :)


1. Connect Server with SSH (Mac/Linux)
Copy .PEM file to the machine from which you are going to connect.
Make sure permissions on .PEM file are appropriate (chmod 600 file.pem)
Connect with ssh command: ssh vcloud@ipaddress –i privkey.pem

2. Find Folder Command in Linux

find / -name 'httpdocs' -type d

3. Zip a Folder in Linux

zip -9 -r zip file folder name

4. Delete Non-empty Folder in Linux

rm -rf folder/

5. Creates new JAR (Java Archive) file named Project1.jar, compresses and stores Project1 directory and all its contents (including both data files and subdirectories).

jar cf Project1.jar Project1


6. Jar file in Linux

jar xf

7. How to Unzip Over an Existing Directory in Linux

Read more: How to Unzip Over an Existing Directory in Linux

unzip -o filename.zip -d dir

8. If it’s available a ssh access on the servers, using scp to transfer file from and to the server could be a very good option.



scp /localdir/localfilename.txt remoteuser@www.remotehost.com:/remotedir/remotefilename.txt

9. Wget is one of the powerful tools available there to download stuff from internet. You can do a lot of things using wget. Basic use is to download files from internet.

wget -c http://your-link-to/file



9 Ağustos 2012 Perşembe

JIRA Workflow Sharing Plugin

The JIRA Workflow Sharing Plugin enables sharing of workflows across JIRA instances.

The plugin allows JIRA administrators to export or import workflows in a zipped "workflow bundle" format.

Exported workflow bundles can be shared with any JIRA instance with little or no manual setup required.

JIRA Workflow Sharing Plugin

JIRA: Is it possible to set issue assignee based on "Issue Type" automatically?

Create separate workflows for each issueType.
Create a workflow scheme for your project mapping those workflows to the specific issueTypes.
Then (in the workflows) using the stock post function "Update Issue Field", set your Assignee field to the desired user for each individual issue type in the "Create" transition.

3 things to note: 1.) To get to the "Create" transition, click on the "Open" step and "Create" should be one of the Incoming Transitions. 2.) When adding the post function, be sure to place it after the "creates issue originally" function or you will get some nasty errors. 3.) Be sure to delete the post function "Assign the issue to the reporter" otherwise your issue will get re-routed to the reporter.

30 Temmuz 2012 Pazartesi

Customising the Dashboard Introduction Gadget

The default jira welcome message in the dashboard introduction gadget is shown in the below image:


To customize it in your jira;

1. Go to Administration > System > General Configuration

2. Click Edit Configuration

3. Paste your html code in the introduction section.

4. Click Udpate.

4. The introduction has changed!





Here is an html example:

<!DOCTYPE html>
<head>
</head>
<body>
</body>
<table>
<tr>
<td><img src="http://1.bp.blogspot.com/-aBRIS7m0d7c/UBZUvOT09eI/AAAAAAAAAUI/xuR7FCjSv8s/s1600/logo.png" width="250" height="150"/> </td>
<td><h3>Johnson Controls' e Hosgeldiniz</h3>

<p>Johnson Controls, global olarak teknoloji ve 150'den fazla ulkedeki hizmet veren end lideridir.</p></td>
</tr>
</table>

</html>

29 Temmuz 2012 Pazar

Disable the footer content in Confluence

Confluence defines its default footer something like in the below image.



add the stylesheet to the global stylesheet


#footer {
display: none;
}

 and all is fine :-)






23 Temmuz 2012 Pazartesi

Why is adding comments while attaching files so important in Confluence?

First of all, in Confluence adding attachments is very easy. You can drag and drop or
as follows:

To attach a file to a page from the computer's (or network's) file system:

Choose Tools > Attachments.
Choose Browse and navigate to the file.
Select the file and click Open.
Add a descriptive comment for the file (optional).
Choose Attach more files if required.
Choose Attach.

When you view attachments, shown as below:



The name of the attached file may not be enough to tell the content of it. Many times, you create a page, after a while when you view the page & attachments, probably you forget why you added it, etc. Luckily, confluence supports attachment properties (as shown in the above image).

These are:

1. Name
2. Size
3. Creator
4. Creation Date
5. Comment

In the image, only first attachment has a comment, and it is also meaningful for viewers except the creator :) However, there is no way to make comments required for attachments. At least I haven' t found it yet ;)

9 Temmuz 2012 Pazartesi

Groovy Development in JIRA

The task at hand was pretty simple - write a JIRA script to automatically handle e-mails that came in on a certain address, looking at the attachments, and then processing the e-mail as required.  However, with the minimal amount of documentation available on-line, it ended up taking a little bit longer than I had initially expected.  And so, I've decided to document my experiences here so that if anyone in the future needs to do something similar, they'll have at least one resource to look at.


Step 1. ScriptRunner
Due to the foresight of our QA Manager, (thanks man!) our JIRA environment had already been loaded with the Groovy ScriptRunner.  Consequently, I pretty much had the scripting language decided for me.  I set up a development instance of a JIRA server so that I wouldn't disrupt people's actual work while I was testing, and got to work.

Step 2. Working with JIRA Issues in Groovy
Our JIRA system was already set up to create issues based on e-mails delivered to the appropriate address, so now it was a matter of writing a script to process these issues once they came through the system. I knew that I was going to have to work with attachments, as well as add comments, and send e-mails, etc... I also wanted to be able to log information as I was working on the script to JIRA's default catalina.out file, so I went about finding the appropriate methods for accomplishing these things.

After some searching for the correct syntax I determined what I needed in order to manage logging, comments, and attachments:

import org.apache.log4j.Category;
import com.atlassian.jira.ComponentManager;
import com.atlassian.jira.issue.comments.CommentManager;
import com.atlassian.jira.issue.AttachmentManager;
import com.atlassian.jira.issue.attachment.Attachment;

// Logger

def Category log = Category.getInstance("com.onresolve.jira.groovy.PostFunction");

// Set the logging level to DEBUG

log.setLevel(org.apache.log4j.Level.DEBUG);

// Set up a comment manager and an attachment manager, as we will need to use these for working with the issues

CommentManager comment = ComponentManager.getInstance().getCommentManager();
AttachmentManager attachments = ComponentManager.getInstance().getAttachmentManager();

It turns out that the JIRA libraries have helper classes called CommentManager and AttachmentManager built in to make this process easier, so I set up instances of those objects for later use in the script.
I also wanted to log a debug message to catalina.out every time that I made a comment on the issue so that I could see the progress while I was tailing the file. To make this less of a headache, I created a method to manage this for me:
def doComment(commentManager, logger, issue, currentUser, text) {
  log.debug "Script Processing - ${issue.key} - Adding Comment - ${text}";
  comment.create(issue, currentUser, text, true);
}
Creating a comment requires an instance of the issue that we are working on (which the Groovy script is nice enough to give us with an 'issue' variable) as well as the username creating the comment, and the text of the comment.  I passed these into my method, along with the CommentManager and the Logger which I'd previouly instantiated, and used this method to create all of my comments.
Step 3. Working with Attachments This was probably the most non-intuitive part of the process and the main reason that I decided to write this entry. The first issue that had me scratching my head was this: Attachments in JIRA are not available when the issue is first created. We actually had to work around this process by activating this script when the issue was moved into In Progress as a result - so that I would be able to retrieve the attachments from the issue. Retrieving the list of attachments from the issue turned out to be fairly easy:
List attachments = attachmentManager.getAttachments(issue);

However, when it came to actually reading the contents of the attachment to the issue, the built-in Attachment Object in the JIRA library didn't seem to be of much help.

Methods were provided for finding the author, MIME Type, date created, etc... about the attachment, but nothing about the getting the actual text of the attachment itself.  This, however, was the entire reason that I needed the attachment object - I needed to be able to read the contents of a document attached to the original e-mail, and do the processing based on that.
 Luckily, I was able to find the file location on my development JIRA server where the attachments had been saved.  For example, it appeared that all of my attachments were saved in the following location on my server (this will be different based on which directory you have JIRA installed to, of course):
/usr/jira/data/attachments/

In that location were several directories, one for each of the different projects created on this JIRA instance.  Inside of those directories were more folders for each of the issues that had been created with attachments.  Using this information, I was able to determine the actual file path based on the issue that I was working with. From that point,it was a matter of reading the attachment file into a string and doing the appropriate parsing based on that data.
List attachments = attachmentManager.getAttachments(issue);

if (!attachments.isEmpty()) {
  for (Attachment a in attachments) {
    String filePath = "/usr/jira/data/attachments/PROJECT_ID/" + issue.getKey() + '/' + a.getId();
    def attachmentFile = new File(filePath);
    String attachmentContents = attachmentFile.text;

    // Do regex processing on the attachmentContents to determine what needs to be done
  }
}
Step 4. E-mails The last step of the process was to send an e-mail in cases where the attachment was unable to be parsed, or when some other issue didn't allow us to resolve this issue appropriately. I was able to write a simple method to handle this, using the documentation available on-line:
import com.atlassian.mail.Email;
import com.atlassian.mail.server.MailServerManager;
import com.atlassian.mail.server.SMTPMailServer;

def sendEmail(emailAddr, subject, body) {
  SMTPMailServer mailServer = ComponentManager.getInstance().getMailServerManager().getDefaultSMTPMailServer();

  if (mailServer) {
    Email email = new Email(emailAddr);
    email.setSubject(subject);
    email.setBody(body);
    mailServer.send(email);
  } else {
    // Problem getting the mail server from JIRA configuration, log this error
  }
}
Step 5. Finishing Up
These were the main issues I ran across while writing this script - and, as I mentioned earlier, tutorials on these nuances appear to be nearly non-existent on-line.  Hopefully, if anyone runs into these problems in the future this article will help them through the process.If you're working on JIRA/Groovy development and are looking for some guidance from someone's who has been there, or if you have questions about this tutorial, please feel free to connect with me on this site 
and send me a message, or comment on this blog.  I'm happy to answer anything that I can.

reference

4 Temmuz 2012 Çarşamba

JIRA nedir?


JIRA, projeleriniz içerisinde, belirli bir hayat döngüsü olan iş maddelerinin (issue) oldukça gelişmiş bir şekilde takibinin, yönetiminin ve raporlamasının yapılabilmesine olanak sağlayan, kendi ihtiyaçlarınıza ve kurumsal yapılanmanıza göre değiştirebildiğiniz-düzenleyebildiğiniz, JAVA platformu üzerinde geliştirilmiş web tabanlı güzel bir araç. 

Proje yönetimi içerisinde oldukça önemli bir yer tutan zaman ve kaynak planlaması gibi konular JIRA içerisinde oldukça profesyonel ve genişletilebilir bir altyapı sayesinde yönetilebiliyor.

JIRA'nın en güçlü yanlarından birisi de plugin altyapısı. JIRA uygulamasını kendi ihtiyaçlarınıza göre genişletebiliyor, kendi jira pluginlerinizi yazıp JIRA uygulaması içerisinde kullanabiliyorsunuz.

JIRA ile ilgili ayrıntılı bilgiler için:
http://www.atlassian.com/software/jira/ adresini ziyaret edebilirsiniz.                                   

3 Temmuz 2012 Salı

jQuery Syntax Examples


jQuery is a JavaScript Library.
jQuery greatly simplifies JavaScript programming.
jQuery is easy to learn.

jQuery Syntax Examples

$(this).hide()
Demonstrates the jQuery hide() method, hiding the current HTML element.
$("#test").hide()
Demonstrates the jQuery hide() method, hiding the element with id="test".
$("p").hide()
Demonstrates the jQuery hide() method, hiding all
elements.
$(".test").hide()
Demonstrates the jQuery hide() method, hiding all elements with class="test".

The Document Ready Function

You might have noticed that all jQuery methods, in our examples, are inside a document.ready() function:
$(document).ready(function(){

   // jQuery functions go here...

});
This is to prevent any jQuery code from running before the document is finished loading (is ready).
Here are some examples of actions that can fail if functions are run before the document is fully loaded:
  • Trying to hide an element that doesn't exist
  • Trying to get the size of an image that is not loaded


29 Haziran 2012 Cuma

Linux Commands – Top 20 Most Used

1.Files and Directories Management

  • ls – Lists files and directories content, I usually use “ls -la” to have a long listing with all the details and hidden files
  • cd – move from the current directory to a different folder
  • pwd – lists your current location
  • mv – this command can either change the name of a file, or move it to a different location.
  • locate – find any file on the Linux server, to get an updated index of files (if for example you just installed a whole bunch of RPM’s) run the command updatedb
  • ln – create a shortcut to a file or folder
  • tar – create or extract files out of a storage file. with the correct arguments it will also compress the files


2. Editing and Viewing
  • tail – lists the last 10 lines of a file, but you tell tell it to show any number of last lines
  • vi – the best command line editing software :)   a little hard to learn how to work this one at first, buts its worth the effort
  • cat – list the content of the file. better know how long is the file you are running this command on, or you will get a very long scrolling of lines that will fill up your screen

3. General

  • history – lists the last used commands on your Linux server
  • make – when compiling a software from source, this command will create the binaries
  • id – who am I right now? besides the philosophical angle, this command will show you as which user you will be running commands, I use this to check what is my status, and then sudo to the user I need
  • sudo – execute a command as another user – although  usually use it to change to root
  • ps – list the running processes on the server, it give more info like the process id, the parent process id, running time and much more
  • man – displays a manual page, whenever you are not sure about a specific command or config file, you should run “man command” to get info about it. to search the man database use “whatis command” to find which man file has the info you need
  • df – report file system disk space usage, use “df -h” to get a human formatted listing

14 Haziran 2012 Perşembe

Başucu SQL Komutları :)

Her seferinde syntax ını unutup tekrar bakıp hatırladığım ve bu döngüden sıkıldığım için bu yazımda yazıp kurtulcam :)

1. INSERT

INSERT INTO Persons (P_Id, LastName, FirstName)
VALUES (5, 'Tjessem', 'Jakob')

2. DELETE

DELETE FROM Persons
WHERE LastName='Tjessem' AND FirstName='Jakob'

3. UPDATE

UPDATE Persons
SET Address='Nissestien 67', City='Sandnes'
WHERE LastName='Tjessem' AND FirstName='Jakob'

4. SELECT

SELECT LastName,FirstName FROM Persons

28 Mayıs 2012 Pazartesi

Step by Step Php development

1. install jdk
2. install xampp
3. install netbeans
4. install Php Plugins
5. make a php project

Setting up a PHP Project in the NetBeans IDE

1. Start the IDE, switch to the Projects window, and choose File > New Project. The Choose Project panel opens.

2. In the Categories list, choose PHP.

3. In the Projects area, choose PHP Application and click Next. The New PHP Project > Name and Location panel opens.














4. In the Project Name text field, enter NewPHPProject.

5. In the Sources Folder field, browse for your PHP document root and create a subfolder there called NewPHPProject. The document root is the folder where the web server looks for files to open in the browser. The document root is specified in the web server configuration file. For example, on Xampp, the document root is XAMPP_HOME/htdocs.

6. Leave all other fields with their default values. Click Next. The Run Configuration window opens.














7. In the Run As drop-down list, select Local Web Site. The project will run on your local Apache server. Your other options are to run the project remotely via FTP and to run it from the command line.


8. Leave the Project URL at default.

9. Click Finish. The IDE creates the project.

10. The NewPHPProject tree appears in the Projects window and the project's index.php file opens in the editor and in the Navigator window.












11. Enter the following code inside the block:

echo "Hello, world! This is my first PHP project!";

12. To run the project, position the cursor on the NewPHPProject node and choose Run from the context menu. The figure below shows what you should see in the browser window:


Install Php plugins in netbeans

1. In start page, click Install Plugins

2. Select PHP or related ones from Available Plugins tab, and click install. restart netbeans.



NetBeans IDE Installation

1. Once you have downloaded the installer file, double-click the installer's icon to launch the installer.download

2. In the install wizard, respond to the License Agreement, then click Next.

3. Specify an empty directory within which to install NetBeans IDE.
Note: This NetBeans IDE will not disrupt the settings of your other NetBeans installations because the IDE automatically creates a new user directory when launched (${HOME}/.netbeans/5.5.1).

4. Choose the JDK you want the IDE to use from the list of suitable choices in the list, then click Next.

5. Verify that the installation location is correct and that you have adequate space on your system for the installation.

6. Click Next to begin the installation.

Installing XAMPP on Windows

1. Download the software from: here

2. Double-click the .exe file you downloaded.

3. Choose a language from the menu, and then click OK.Click the Next button.Click the Next button once again.

4. Click Install.

















5. Launch a Web browser, and, in the Location bar, type http://localhost/.




Installing the JDK on Windows

1. For the Sun version of the JDK, enter the URL download
2. From the Sun Developer Network page, scroll to find the heading J2SE v 1.4.2_12 SDK (that is, .12 or the latest version).
3. Select Download J2SE SDK.
4. From the Sun Developer Network page, accept the license agreement and scroll to the heading "Windows Platform - Java(TM) 2 SDK, Standard Edition 1.4.2_12".
5. Select and download Windows Installation, Multi-language.
6. Save and install the .exe file.
7. If prompted, install the JDK to C:\j2sdk1.4.2_10.
8. Set the JAVA_HOME environment variable to C:\j2sdk1.4.2_12. --> how to set JAVA_HOME

24 Mayıs 2012 Perşembe

Matlab - Traffic Sign Detection

GOAL: Implement a traffic sign detection program which detects location of the traffic sign(s) on a given image.


       Input image:                                                                                                                         Output image:




ALGORITHM

To detect a traffic sign in an image, the algorithm follows these steps:
1) Color detection
2) Conversion to grayscale
3) Edge and line detection with Hough transforms
4) Optimization of edges
5) Highlighting the found traffic signs in the image


Download

19 Mayıs 2012 Cumartesi

Proje Fuarı 2012

Anadolu Üniversitesi Mühendislik Fakültesi bu sene bitirme projelerini bir yarışmayla görücüye çıkarıyor.

Tarih: 28 Mayıs 2012
Yer: Bilgisayar Mühendisliği
Mühendislik-Mimarlık Fakültesi, Anadolu Üniversitesi
İki Eylül Kampusu, 26555, Eskişehir



Masaüstü Depolama Uygulaması - SDrive

Günümüzde veri depolama gerek maliyet gerekse güvenlik açısından şirket bazında bir problem teşkil ediyor. Varolan depolama seçenekleri için gigabyte başına depolama maaliyeti ödeyeceksiniz. Ayrıca gizlilik ve güvenlik için hiçbir garantisi yok çünkü verileriniz üçüncü şahısların sunucularında tutulmakta. Bu iki sorunun da çözümü şirketin kendi sunucularını kullanması. Ağ programlama ve java teknolojisi kullanılarak bir masaüstü uygulaması geliştirdik. Bu uygulama sayesinde verilerinize her yerden erişebileceksiniz, işten, evden, vs. Belgelerinizi artık usb flash bellekte taşımanıza, mailinizde saklamanıza gerek yok. Bilgisayarınızda herhangi bir klasör gibi görünüyor ama daha fazlası. Uygulama temelde dosya senkronizasyonuna dayanıyor. Şöyle ki; yeni bir dosya eklenmesi, varolan dosyada değişiklik veya dosyanın silinmesi durumu asenkron olarak algılanıyor ve sunucuda da aynı değişiklikler yapılıyor. Örneğin, işte ve evdeki bilgisayarınıza SDrive’ ı kurdunuz. İşteki bilgisayarınızda raporunuzu yazmaya başladınız, (SDrive’ a raporunuzu koydunuz). Eve gittiğinizde, evdeki bilgisayarınızda da raporunuzun var olduğunu göreceksiniz. Raporunuzu akşam tamamladınız. Hiç birşey yapmanıza gerek yok. Sabah işte bilgisayarınızda raporunuz hazır.


4 Mayıs 2012 Cuma

Java - Default Mail Client

When you want to direct client to mail sending, you can use java.awt.Desktop.
Here is an example:

article

import java.awt.*;
import java.io.IOException;
import java.net.URI;

public class RunningDefaultMailClient {
public static void main(String[] args) {
//
// Get an instance of Desktop. If the platform doesn't
// support Desktop API an UnsupportedOperationException
// will be thrown.
//
Desktop desktop = Desktop.getDesktop();

try {
//
// Open user-default mail client application.
//
desktop.mail();
} catch (IOException e) {
e.printStackTrace();
}

try {
//
// Open user-default mail client with the email message
// fields information.
//
// mailto:dummy@domain.com?cc=test@domain.com&
// subject=First%20Email&&body=Hello%20World
//
String message = "mailto:dummy@domain.com?subject=First%20Email";
URI uri = URI.create(message);
desktop.mail(uri);
} catch (IOException e) {
e.printStackTrace();
}
}
}

26 Nisan 2012 Perşembe

Creating JSP Web Application in Netbeans

1. In start page, click "Install Plugins".

2. Under Available Plugins, search for "Java Web Applications". Select it.
When you select, it automatically selects its dependencies.

3. Click Install.

4. File > New Project > Web > JSP

5. Name your project as HelloWeb.
















6. Click Next. Specify your server location.
I used Tomcat. Set its root directory.

7. Change body as
<body>
<h1>Hello Web !</h1>
</body>

8. Finally, Run index.jsp


How to extract the regions with different colors from the input image

I developed a MATLAB function color_extract that extracts the regions with different colors from
the input image using a color model different than RGB. The purpose of it is to use different color models.




Processing of Color Images:

1. Convert to another color model YIQ, HSV, etc.
(You can use matlab functions ex: rgb2hsv)
2. Process the image, make changes.
3. Then convert it back to RGB.
(You can use matlab functions ex: hsv2rgb)












Note: I used HSV. To obtain Hue values easily, you can use MS Paint by clicking "EditColors".























Download Code

25 Nisan 2012 Çarşamba

Install Apache Tomcat

1. Before downloading Tomcat, You must have the JDK installed, and be sure that the environment variables are set.
(JAVA_HOME and CLASSPATH)

2. download Tomcat !

3. Unzip the zip file anywhere.

4. After unzipping the file, navigate to the "bin" directory and start Tomcat by running the startup.bat file.

5. After starting Tomcat, open your browser and type the following URL: http://localhost:8080.
(Tomcat uses port 8080 by default)

Here it is!


ref

20 Nisan 2012 Cuma

Connect Four Game

"Connect Four" oyununu mutlaka oynamışsınızdır.
Oynamayanlar için : Connect Four Game
(Programa karşı oynuyorsunuz.Programda yapay zeka kullanıldı.)



















Download Code

16 Nisan 2012 Pazartesi

İlk Android Projem :)

Write a program which converts temperature degrees between Fahrenheit (F) and Celsius (C) in both directions.

1. Create Project

Select File → New → Other → Android → Android Project and create the Android project "de.vogella.android.temperature". Enter the following.




Press "Finish". This should create the following directory structure.

2. Create attributes
Android allows you to create static attributes, e.g. Strings or colors. These attributes can for example be used in your XML layout files or referred to via Java source code.

Select the file "res/values/string.xml" and press the "Add" button. Select "Color" and enter "myColor" as the name and "#3399CC" as the value.


Add the following "String" attributes. String attributes allow the developer to translate the application at a later point.

Name           Value
celsius        to Celsius
fahrenhei    to Fahrenheit
calc              Calculate


Switch to the XML representation and validate that the values are correct.

<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="hello">Hello World, Convert!</string>
<string name="app_name">Temperature Converter</string>
<color name="myColor">#3399CC</color>
<string name="myClickHandler">myClickHandler</string>
<string name="celsius">to Celsius</string>
<string name="fahrenheit">to Fahrenheit</string>
<string name="calc">Calculate</string>
</resources>
3. Add Views

Select "res/layout/main.xml" and open the Android editor via a double-click. This editor allows you to create the layout via drag and drop or via the XML source code. You can switch between both representations via the tabs at the bottom of the editor. For changing the position and grouping elements you can use the Eclipse "Outline" view.

The following shows a screenshot of the "Palette" view from which you can drag and drop new user interface components into your layout. Please note that the "Palette" view changes frequently so your view might be a bit different.


You will now create your new layout.

Right-click on the existing text object “Hello World, Hello!” in the layout. Select "Delete" from the popup menu to remove the text object. Then, from the “Palette” view, select Text Fields and locate "Plain Text". Drag this onto the layout to create a text input field. All object types in the section "Text Fields” derive from the class "EditText", they just specify via an additional attribute which text type can be used.

Afterwards select the Palette section "Form Widgets" and drag a “RadioGroup” object onto the layout. The number of radio buttons added to the radio button group depends on your version of Eclipse. Make sure there are two radio buttons by deleting or adding radio buttons to the group.




From the Palette section Form Widgets, drag a Button object onto the layout.

The result should look like the following.

4. Edit View properties
If you select a user interface component (an instance of View ), you can change its properties via the Eclipse "Properties" view. Most of the properties can be changed via the right mouse menu. You can also edit properties of fields directly in XML. Changing properties in the XML file is much faster, if you know what you want to change. But the right mouse functionality is nice, if you are searching for a certain property.

Open your file "main.xml". The EditText control shows currently a default text. We want to delete this initial text in the XML code. Switch to the XML tab called "main.xml" and delete the android:text="EditText" property from the EditText part. Switch back to the "Graphical Layout" tab and check that the text is removed.

Use the right mouse click on the first radio button to assign the "celsius" String attribute to its "text" property. Assign the "fahrenheit" string attribute to the second radio button.


From now on, I assume you are able to use the properties menu on user interface components. You can always either edit the XML file or modify the properties via right mouse click.

Set the property "Checked" to true for the first RadioButton.

Assign "calc" to the text property of your button and assign "myClickHandler" to the "onClick" property.

Set the "Input type" property to "numberSigned" and "numberDecimal" on your EditText.

All your user interface components are contained in a LinearLayout. We want to assign a background color to this LinearLayout. Right-click on an empty space in Graphical Layout mode, then select Other Properties → All by Name → Background. Select “Color” and then select "myColor" "in the list which is displayed.



















5. Change the Activity source code

package de.vogella.android.temperature;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.Toast;

public class ConvertActivity extends Activity {
private EditText text;

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
text = (EditText) findViewById(R.id.editText1);

}

// This method is called at button click because we assigned the name to the
// "On Click property" of the button
public void myClickHandler(View view) {
switch (view.getId()) {
case R.id.button1:
RadioButton celsiusButton = (RadioButton) findViewById(R.id.radio0);
RadioButton fahrenheitButton = (RadioButton) findViewById(R.id.radio1);
if (text.getText().length() == 0) {
Toast.makeText(this, "Please enter a valid number",
Toast.LENGTH_LONG).show();
return;
}

float inputValue = Float.parseFloat(text.getText().toString());
if (celsiusButton.isChecked()) {
text.setText(String
.valueOf(convertFahrenheitToCelsius(inputValue)));
celsiusButton.setChecked(false);
fahrenheitButton.setChecked(true);
} else {
text.setText(String
.valueOf(convertCelsiusToFahrenheit(inputValue)));
fahrenheitButton.setChecked(false);
celsiusButton.setChecked(true);
}
break;
}
}

// Converts to celsius
private float convertFahrenheitToCelsius(float fahrenheit) {
return ((fahrenheit - 32) * 5 / 9);
}

// Converts to fahrenheit
private float convertCelsiusToFahrenheit(float celsius) {
return ((celsius * 9) / 5) + 32;
}
}

6. Start Project

select Run-As → Android Application

ref