
my friend sopan posted this awesome link on facebook. its about the art work, mathematical art actually, of Maurits Cornelis Escher who explored many cool mathematical ideas through his works.
I almost wish I hadn't gone down that rabbit-hole — and yet — and yet — it's rather curious, you know, this sort of life!
The art of being happy lies in the power of extracting happiness from common things.
~Henry Ward Beecher
http://www.phdcomics.com/comics/archive.php?comicid=562
signed by sheetal
CREATE TABLE temp AS SELECT * FROM sampleTable;
DROP TABLE sampleTable;
CREATE TABLE sampleTable AS SELECT * FROM temp;
DROP TABLE temp;
--A journey of a thousand mile begins with a single step --
* Right click on your bundle and select Export. Choose “Plug-in Development->Deployable Plugins and Fragments”.
* Select destination folder (for example /home/pc/Desktop)
* Click “Finish”
somedir/
configuration/
config.ini
eclipse.exe
plugins/
org.eclipse.equinox.common_3.3.0.jar
org.eclipse.equinox.launcher.win32.win32.x86_1.0.0/
eclipse_1017a.dll
[other launcher fragment content]
org.eclipse.equinox.launcher_1.0.0.jar
org.eclipse.osgi_3.3.0.jar
org.eclipse.update.configurator_3.2.100.jar
< your_bundle1 >.jar
< your_bundle2 >.jar
osgi.bundles=< your_bundle1 >.jar@start,< your_bundle2 >.jar@start
osgi.bundles=org.eclipse.equinox.common@2:start, org.eclipse.update.configurator@3:start
eclipse.ignoreApp=true
osgi.noShutdown=true
eclipse -console
osgi>
osgi>ss
start < bundle id >
A mother duck hatches her eggs and, while most of her ducklings are normal, one is grey, too large, and too clumsy to fit in among the others. Though she tries to accept him, the entire barnyard realizes that he simply does not belong and after a period of harassment he leaves to fend for himself. He is sheltered by an old woman in her poor cottage, but her cat and her hen will not accept him and he is forced to set off once again on his own. He wanders for the entire summer and fall, for no one will take him in, and he nearly freezes to death in an icy pond. Though he is rescued by a human, he cannot live in captivity, and he returns to the wild.
By the end of winter, he is miraculously still alive. He comes to a pond in a park or garden, where beautiful white swans are swimming. He is drawn to their beauty, though he has no reason to think that they will treat him better than anyone else has. Still, he thinks, even if they kill him, he must approach them. To his surprise, the beautiful creatures welcome and accept him; gazing at his reflection, he sees that he too is a swan. The children declare that he is the most beautiful swan of them all, yet he is not proud, for a good heart is never proud. Because of all that he suffered he now appreciates his happiness so much more.
<result name="success" type="stream">
<param name="contentType">image/jpeg</param>
<param name="inputName">imageStream</param>
<param name="contentDisposition">filename="document.pdf"</param>
<param name="bufferSize">1024</param>
</result>
package downloadexample;
import org.apache.struts2.dispatcher.StreamResult;
import com.opensymphony.xwork2.ActionInvocation;
/**
* This class for result-type="myStream"
*
* <result-types> <result-type name="myStream" default="false"
* class="downloadexample.DynamicStreamResult"/>
*
* </result-types>
*
* It extends StreamResult Used to download file as a stream.
*
* @author sheetal
*
*/
public class DynamicStreamResult extends StreamResult{
@Override
protected void doExecute(String finalLocation,
ActionInvocation invocation)
throws Exception {
//get name of downloaded file
String downloadedFileName = invocation.getStack().
findValue(conditionalParse
("name", invocation));
contentDisposition = "filename=\""
+downloadedFileName + "\"";
//get file size
contentLength = ""+ invocation.getStack().findValue(
conditionalParse("size", invocation));
// get type of file
contentType = ""+ invocation.getStack().
findValue(
conditionalParse("description", invocation));
/*
Executes the result given a final location
(jsp page, action, etc) and
the action invocation (the state in which
the action was executed).
*/
super.doExecute(finalLocation, invocation);
}
}
<s:form action="downloadFile" validate="true">
<s:textfield label="Search file"
name="name" required="true"/>
<s:textfield label="Define file type (image/jpeg, text/plain, application/pdf)"
name="description" required="true"/>
<s:submit value="Find file"/>
</s:form>
private String name;
//holds name of downloaded file
private InputStream inputStream;
//holds stream of downloaded file
private String description;
//holds the content type of the downloaded file
private long size;
//holds the content size of the downloaded file
//method for downloading file
public String downloadFile()
{
/*
let, method searchFile(String fileName)
does the searching for us
& returns InputStream of the file if found
and null otherwise.
*/
this.inputStream = searchFile(name);
if(inputStream !=null)
{
return Action.SUCCESS;
}
else
{
//handle error
return Action.ERROR;
}
}
//write setter getter methods
public InputStream getInputStream() throws Exception
{
return inputStream;
}
public String getName()
{
return name;
}
public void setName(String name)
{
this.name = name;
}
public String getDescription()
{
return this.description;
}
public void setDescription(String description)
{
this.description = description;
}
// write getter setter for attribute size
<!-- custom result type for file download -->
<result-types>
<result-type name="myStream"
default="false"
class="downloadexample.DynamicStreamResult"/>
</result-types>
<!-- action for downloading file-->
<action name="downloadFile"
method="downloadFile"
class="<action-class-name>">
<result type="myStream"/>
<result name="error">jsps/your_error_page.jsp</result>
</action>
<result name="success" type="stream">
<param name="contentType">${contentType}</param>
<param name="inputName">imageStream</param>
<param name="contentDisposition">filename="${fileName}"</param>
<param name="bufferSize">${bufferSize}</param>
</result>