Unable to set sheet zoom% to 120 using apache POI - apache-poi

How can I set sheet zoom% to 120 using Apache POI ?
I tried with sheet.setZoom(5,4) but its outputs to 125% zoom.
Also this method accepts only integers.
Any help would be appreciated.

The API docs for the Sheet interface in Apache POI state:
setZoom(int scale) - Window zoom magnification for current view
representing percent values.
and
setZoom(int numerator, int denominator)
Deprecated.
2015-11-23 (circa POI 3.14beta1). Use setZoom(int) instead.
So try:
sheet.setZoom(120);
Or to use the deprecated method on an older version of the API:
sheet.setZoom(12, 10);
Note, 5/4=1.25 which is the reason you get zoomed to 125%

Related

Set animation position

I'm using Godot 4 beta. I want to skip to a specific frame in an AnimationPlayer, but I'm getting:
Invalid set index 'current_animation_position' (on base: 'AnimationPlayer') with value of type 'float'.
Here's the related documentation: https://docs.godotengine.org/en/latest/classes/class_animationplayer.html#class-animationplayer-property-current-animation-position
I currently have one AnimationPlayer in my scene, named 'animation', with an animation named 'Animation' with "Autoplay on Load". The animation 'Animation' has a length of 4.x seconds.
Here's my code attached to the scene:
func _process(_delta):
if Input.is_action_just_released("skip_intro"):
if animation_player.current_animation_position < 1.3:
animation_player.current_animation_position = 1.3
else:
skip_intro()
Update (2)
I know I can use animation_player.advance(), but it adds to the relative time. I'm looking for a way to go to a fixed frame, not a relative frame.
As you can read in the documentation you linked current_animation_position only has a getter. It is a read-only property.
If you want to go to an specific time you can use the seek method.
I found that I can use play() before advance() to go to an absolute frame. But I'd appreciate any other way to do it inliner.
animation_player.play("Animation")
animation_player.advance(1.3)
IMO it should be allowed to rewrite the current_animation_position property.

Need to do a cross reference in Excel

I am needing to check that our Master Schedule is reflecting all physical work that falls into our SOW(Statement of Work).
I have a sheet that does this fairly simply, but I want to make it a simple cut and paste from our Schedule export, and that way it reflects that it is looking at current data vs data from several months ago.
I can handle the date part, but I can't seem to get the logic in my head right for how I should reference the data to double-check compliance.
Each SOW Paragraph has a number assigned to it, and that is what each task would refer to.
Activity Type
Activity ID
CAM
WBS
OBS
% Complete
SOW
ASAP
49.3.4.2.3.2.030
Pam
77.4.1.2
C.11.1
20%
1.0
ASAP
C2_4.20.010.011
Shaun
77.3.1
C.5.4.2
15%
3.6.1.2
ASAP
C2_4.20.010.012
Shaun
77.3.1
C.5.4.2
0%
3.6.1.2
ASAP
69.HP.5.1.2.15.30
Mark
77.1.1
C.11.1
50%
3.2
ASAP
C2_6.1.5.15
Brett
77.2.1
C.3.2.1
100%
5.0
ASAP
C2_2.10.55
Susan
77.2.1
C.5.4.1
60%
6.0
ASAP
29.3.2.11.1.20
Eric
77.4.1
C.11.1
20%
1.0
ASAP
1Z.DIL.0025
Adam
77.1.1
C.1.1
10%
1.1.2
Say this image is an export from our schedule.
I need to make sure that those SOW numbers are lined up with the full SOW for just the ID numbers with a C2. Below would be the example result.
SOW Number
In Master Schedule?
1.0
No
1.1
No
1.1.1
Yes
1.1.2
No
1.1.3
No
3.0
No
3.2
No
3.3
No
3.5
No
3.6
No
3.6.1
No
3.6.1.2
Yes
4.0
No
5.0
Yes
5.1
No
5.2
No
6.0
Yes
The logic I'm trying to figure out with the formulas is:
If A# is in MS_Tab $G:$G, does the ID number start with a C2? If Yes, list "Yes" under "In MS?", else list "No"
I tried to do a VLOOKUP first and of course, that is incorrect since it only looks for the first instance of the search. Then I thought of doing a VLOOKUPpaired with an HLOOKUP, but that still falls into the same problem. I read I could do Index and Match, but I haven't been able to get the logic to work for me.
Note: I cannot change the ID's to make my life easier, this is using an excel export from our master schedule.

Datastage: String to Timestamp to milli seconds conversion

I'm trying to insert timestamp with milli seconds into a database. I tried following steps but haven't had any luck.
Extend field value to milli seconds , with length 26 and scale 3.
Used StringToTimestamp(timestampInString,"%yyyy-%mm-%dd %hh:%nn:%ss.3"), Resulting null value in output.
Modified the default time Stamp in job properties to %yyyy-%mm-%dd %hh:%nn:%ss.3
Design :
Sequential file --> TX --> destination (SQL/Seq file)
Could you please assist a solution for this?
What you tried looks good so far with one exception:
length 26 and scale 3
Using Db2 for example you would need to specify length 26 precision 6.
26 and 3 do not fit as
%yyyy-%mm-%dd %hh:%nn:%ss has length of 20
Specifying microsenonds is extended attriute is also necessary.
Have a try and provide more details of the target system if you still have problems
try below command in transformer stage and set the target data type as per the requirement, it will give the required result:
StringToTimestamp(Columnname,"%yyyy-%mm-%dd %hh:%nn:%ss.3")
Most important thing is to override the default NLS settings in the job with expected format (%yyyy-%mm-%dd %hh:%nn:%ss.3) which you have already completed.
Now, for the microseconds part which is not being displayed, you can enable the Microseconds extended attribute for the field in the target stage used.
Also you can refer this link from IBM which explains a similar scenario

Problems with jqPlot / Primefaces extender and Date values

so here's the thing.
I've got plenty of persisted "Snapshots" containing a java.sql.Timestamp and (for the sake of simplicity) an int as data.
I have a JSF page containing a primefaces 3.4.1 <p:lineChart> and behind that a ManagedBean that contains the model for the chart.
Let's say I then select a time range and fetch all the Snapshots in between that range.
and populate the data model for the chart with all the Timestamps (x-axis) and all the integers (y-axis).
So what i do while populating is:
data = new HashMap<Object, Number>();
List<Snapshot> allSnapshots = persistenceService.getAllSnapshots();
for(int i = 0; i < allSnapshots.size(); i++) {
Snapshot s = allSnapshots.get(i);
data.put(new Date(s.getTimestamp().getTime()), s.getData());
}
chartModel.getSeries().get(0).setData(data);
(Note: in the example code I just fetch all Snapshots, as I quickly just generated a hundred or so).
I set up the chart like this:
<p:lineChart id="chart" value="#{backingBean.chartModel}" xaxisAngle="-90">
<f:convertDateTime pattern="HH:mm:ss"/>
</p:lineChart>
It works ok but when the model contains a hundred data points, the xaxis is just overcrowded with all the tickmarks.
What I then did is to use the primefaces' option to use a jqplot extender function.
So I just add extender="extend" as attribute for the chart, where extend is the following js function :
function extend() {
this.cfg.axes = {
xaxis: {
renderer: $.jqplot.DateAxisRenderer,
rendererOptions: { tickRenderer: $.jqplot.CanvasAxisTickRenderer },
tickOptions: {
showGridline: true,
formatString: '%H:%M',
angle: -90
}
}
}
}
This is the current version of it..
After hours of reading and trial and error, I still cannot get it right, as the following things are just never right:
The tick marks never get rendered as the Date never gets converted.
At the moment this is just ignored and the formatString itself is
displayed...
Additional tick marks are created left and right of the actual data,
I dont want that.
When I only give autoscale: true as option for the jqplot extender,
I would expect just the spacing between the marks turn ok. But what
then happens is, that the spacing is cool but the original date
labels turn into just bare numbers starting from 0 to the amount of data available.. !?
I am getting a little tired from dealing with this.....maybe I am doing something fundamentally wrong. Otherwise I have no idea why this is so complicated..
Thanks for any advice!
Cheers
Chris
EDIT:
Ok thanks to perissf, I checked this one : https://stackoverflow.com/a/14287971/870122
With the suggested extender I get the following output :
http://www.abload.de/img/clipboard01y6sgj.png
(sorry I cannot post the image directly due to new user restrictions :-/ )
As you can see the tick marks are rendered correctly as HH:MM, thats very nice.
But as you also can see another quite weird problem occurs:
The given time range of the snapshots is
Start time: 2013-01-28 13:01:25.415
End time: 2013-01-28 13:14:32.145
I collected these as UTC timestamps with System.currentTimeMillis() while the JVM is set to UTC in the glassfish config.
As you notice, the datapoints in the plot are shifted one hour, they start at 14:01, which looks like the values have been auto-converted to my current timezone which is UTC+1. But the leftmost xaxis tick is placed at around the original UTC value at 13:00.
I collect the timestamps UTC as I dont know in which actual timezone the application will be running, but I'd like to display the "translated" time value. So the auto shift to my timezone is a nice feature, but the xaxis scaling is actually not nice and weird.
Any suggestions how I get rid of that ?
Cheers
Chris
EDIT2:
Ok while debugging the rendered page with Firebug I stumbled upon the jqplot internal variables in the plot object, which seem to contain the min and max values for the xaxis.
Min is set to the original min UTC value which is around 13:00, and max is set to the shifted UTC+1 value around 14:15.
Somehow the min value is not shifted accordingly to the automatic timezone adjustments.
All other values, that is dataBounds, data itself and so on, are all shifted nicely by one hour.
I opened a issue at Bitbucket jqplot issue tracker
Let's see.
Bye
Chris
i finally debugged the jqplot renderer and found some lines of code that cause this behaviour.
For anyone interested, please find the bugfix in the comment section here:
Bitbucket issue tracker
Thanks for any help
I'm very interested in this fix but the issues on BitBucket are in a restricted area so I cannot access it. So I had myself to try to fix this AxisDateRenderer and fortunately I did :)
So the Primefaces (6.0) chart uses an old version of the JQPlot library. A bug in this version sets the minimum date axis bound being not the first value exactly, but a time older according to the locale time zone of the user browser. For example, if the first value is at 12:00 and your GMT is GMT+1, then the date axis bound minimum will be at 11:00 instead of 12:00 !
The minVale
The following line (in createTicks function) should bed replaced (note the code is written minified below)
ad = ad.getTime() + ad.getUtcOffset();
By the next line:
ad = Math.floor((ad.getTime() - ad.getUtcOffset())/r) * r + ad.getUtcOffset();
Non minified line to replace:
min = min.getTime() + min.getUtcOffset();
With:
min = Math.floor((min.getTime() - min.getUtcOffset())/tempti) * tempti + min.getUtcOffset();
Note that I have tried to update the chart.js of Primefaces to an earlier version , but the chart do not work anymore. I will wait for the next update of Primefaces hoping that a newer version is used. I also don't know which version of JQPlot is used in Primefaces 6.0

SharePoint 2007 lists webservice - identify revision of list item

Using the lists webservice I retrieve the items from a list. In the XML returned I can see the attribute ows__IsCurrentVersion="1" which I assume is the same as the file object model (i.e. a boolean to say if it is current or not).
However I do not see a way to identify what revision it is? What should that attribute be?
By 'revision' do you mean version? If so, you are probably looking for one of these attributes:
ows_owshiddenversion is an Integer (ex: 8)
ows__UIVersion is an Integer (ex: 4096)
ows__UIVersionString is a String (ex: 8.0)
*edit*
Here is some more information after testing it using a Document Library. You should also check the other comments by Hugo and Janis, as they have some good information.
ows_owshiddenversion ows__UIVersion ows__UIVersionString
1 512 1.0
2 513 1.1
3 514 1.2
4 1024 2.0
5 1025 2.1
Most likely, what you are looking for is ows_owshiddenversion.
The columns in the list you are looking for are VersionID (usually 512, 1024, etc.) and VersionLabel (usually 1.0, 2.0, 3.0) and the attributes that Kit Menke pointed out will give you that information if you are using the Web Service.
You might want to have a look at the Versions web service if you need to do more work with the web services : http://server/_vti_bin/versions.asmx
Ill just add some info. You can use UIVersion (which is version id) or UIVersionString (which is user-friendly version label)
For example
label 0.1 -> id 1
label 1.0 -> id 512
label 1.1 -> id 513
label 2.0 -> 1024
label 2.2 -> 1026.
IsCurrentVersion will be true for latest MAJOR (published) version (2.0 or 3.0, but not 3.1). Minor version number is draft version.
Some insights about versioning i wrote in my own question & answer.

Resources