convert criteria object to list in mysql db - mysql

When i am using oracle database the following query is executed perfectly in hibernate.But i am trying to using mysql db means it doesn't work it throws an following Exception "Source Not Found Exception " in the detail of 'source attachment does not contain the source for the file mysqlIO.class'.
import org.hibernate.Criteria;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.SessionFactory;
import org.hibernate.criterion.Projections;
import org.hibernate.criterion.Restrictions;
import org.hibernate.criterion.Criterion;
import com.hibernatehelper.HibernatePlugin;
import com.cir.hibernatebean.CIRMTradeCopiesSlab;
Criteria cr = sesInsert.createCriteria(CIRMTradeCopiesSlab.class);
//cr.add(Restrictions.eq("mtcsbrncode","MDS"));
Criterion criterion = Restrictions.eq("mtcsbrncode", "MDS");
cr.add(criterion);
List AgentRecList=cr.list();

Related

Convert plain text / wiki syntax to HTML with Jira ScriptRunner (show bullet points, checkmark smileys, etc.)

I am trying to retrieve the text of the most recent comment I typed in a JIRA issue page, here is a screenshot of the most recent comment I typed:
I am using this code in the Jira script runner to retrieve the last comment I have typed in:
import com.atlassian.jira.component.ComponentAccessor
import java.text.SimpleDateFormat
import com.opensymphony.util.TextUtils
import com.atlassian.jira.issue.comments.*
import org.w3c.dom.*;
import javax.xml.parsers.*;
import groovy.xml.*
import grrovy.util.*;
import org.xml.sax.InputSource;
import java.io.*;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import java.io.*;
import javax.xml.transform.*;
import javax.xml.transform.dom.*;
import javax.xml.transform.stream.*;
def commentManager = ComponentAccessor.getCommentManager()
Comment comment = commentManager.getLastComment (issue)
if(comment != null) {
SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MMM/yy HH:mm", Locale.ENGLISH)
def body = comment.body //.replaceAll("[\r\n]+","\n")
body= """<div style="max-height:100px; overflow:auto;" title="${comment.authorFullName} added last comment - ${dateFormat.format(comment.created)}">
<span style="white-space: pre-wrap;">${TextUtils.htmlEncode(body)}</span>
</div>"""
return body
}
The output of the code above is the following:
I would like the output to be displayed as in its original format meaning, I would like the bullet points to appear, the smiley to appear and the green checkmark to appear as well. I don't want to see the stars and the code color and the smiley abbreviation :) I would like the output to look like the following:
How can I fix this?
You need to render wiki-syntax source to HTML output and use existing wiki renderer.
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.RendererManager
import com.atlassian.jira.issue.fields.renderer.JiraRendererPlugin
import com.atlassian.jira.issue.fields.renderer.IssueRenderContext
RendererManager rendererManager = ComponentAccessor.getComponentOfType(RendererManager.class);
JiraRendererPlugin renderer = rendererManager.getRendererForType("atlassian-wiki-renderer");
String lastComment = "* 1\n* 2\n* 3:)\n* {color:#FF0000}(/){color}"
return renderer.render(lastComment, null)

Dart Getting error: Undefined name 'csvCodec'. (undefined_identifier) when using csv package

Getting error -
error: Undefined name 'csvCodec'. (undefined_identifier at [easy_csv] example\exa.dart:10)
I implemented decoder example from dart csv package like -
import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'package:csv/csv.dart';
main() async {
final input = new File('foo.csv').openRead();
final fields =
await input.transform(utf8.decoder).transform(csvCodec.decoder).toList();
}
Issue is now solved.
As with Dart 2, csv was no longer able to be a codec & corresponding
documentation was not removed.
This change is now reflected in documentation
Example code for reading csv file & printing them on according latest version 4.0.3
import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'package:csv/csv.dart';
main() async {
//TODO Change file_name
String file_name = 'foo.csv';
final input = File(file_name).openRead();
//Every csv row is converted to a list of values.
//Unquoted strings looking like numbers (integers and doubles) are by default converted to ints or doubles.
final fields = await input.transform(utf8.decoder).transform(new CsvToListConverter()).toList();
print(fields);
}

Import statements in ES2015

Are there any ways I could execute the import inline? See example below:
import $ from 'jquery';
import dt from 'datatables.net-bs';
import dtbuttons from 'datatables.net-buttons-bs';
import csv from 'datatables.net-buttons/js/buttons.html5.js';
// Attach the plugin - Could this be done inline in the import statments above?
dt(window,$);
dtbuttons(window,$);
csv(window,$);
Larsi
It is not possible with import statement. You can do it with different module loader. For example it is possible with node's built-in require:
import $ from 'jquery';
require('datatables.net-bs')(window, $);
require('datatables.net-buttons-bs')(window,$);
require('datatables.net-buttons/js/buttons.html5.js')(window,$);

1046:type was not found or was not a compile-time constant: ArrayCollecton

In my flash AS3 code it shows the error
1046:type was not found or was not a compile-time constant:
ArrayCollecton
at following lines.
var expenses:ArrayCollection;
var gep:ArrayCollection = new ArrayCollection([{voltage1:0 ,current1:0 ,voltage2:0, current2:0, voltage3:0 ,current3:0, voltage4:0 ,current4:0}]);
var pow:ArrayCollection = new ArrayCollection([{voltage1:0 ,power1:0 ,voltage2:0 ,power2:0, voltage3:0 ,power3:0, voltage4:0 ,power4:0}]);
I have imported following to my code.
import fl.controls.Label;
import fl.controls.Button;
import fl.transitions.Tween;
import fl.transitions.easing.*;
import flash.display.MovieClip;
import flash.net.URLRequest;
import flash.display.Loader;
import flash.events.Event;
import fl.controls.CheckBox;
import fl.controls.RadioButtonGroup;
import flash.events.TimerEvent.TIMER_COMPLETE;
I feel like the error is related to importing array collection.How array colection can be imported .Is it like import fl.collections.ArrayCollection;?
ArrayCollection is part of the Flex framework.
You need to include this framework: http://www.actionscript.org/forums/showthread.php3?t=168463
Then import ArrayCollections that way:
import mx.collections.ArrayCollection;
Links:
Use ArrayCollection in Flash CS5
How can I use ArrayCollection like feature in ActionScript 3.0 Flash IDE?

actionscript 3.0 type coercion failed when dispatching error event

I try to dispatch an error event in an AS3 application:
dispatchEvent( new ErrorEvent( ErrorEvent.ERROR, false, false, "my error message"));
but I get the following runtime error:
TypeError: Error #1034: Type Coercion failed: cannot convert flash.events::ErrorEvent#2c04239 to com.adobe.protocols.dict.events.ErrorEvent.
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at my line of code..
these are my import statements at the top of the file:
import flash.display.MovieClip;
import flash.events.ErrorEvent;
import flash.events.Event;
import flash.events.EventDispatcher;
import flash.filesystem.File;
import flash.filesystem.FileMode;
import flash.filesystem.FileStream;
import flash.security.IURIDereferencer;
import flash.security.ReferencesValidationSetting;
import flash.security.RevocationCheckSettings;
import flash.security.SignatureStatus;
import flash.security.XMLSignatureValidator;
import flash.utils.ByteArray;
import mx.utils.Base64Decoder;
import mx.utils.Base64Encoder;
import mx.utils.SHA256;
what's going on?
thanks
Sometimes that... happens. Between the IDE and Flash's ability to get confused, I'm surprised it doesn't happen more. I suspect the error is actually in your listener though.
Change your event handler to specify flash.events.ErrorEvent.
function errorHandler( event:flash.events.ErrorEvent ):void
If that doesn't work, you can always either handle all Events or you can use the fully qualified name while constructing the ErrorEvent.