Remove '.png' from string in sql server [duplicate] - sql-server

This question already has answers here:
Remove extensions from filename
(5 answers)
Closed 9 years ago.
Basically I have a column in SQL Server that has icon image names
It's kind of like
ICON
------------
Icon001
Icon002.png
Icon003.png
Icon004.png
Icon005
Icon006.png
Icon007.png
I'm trying to figure out how I can write a script to remove all of the .png from the ones that have it
I have tried
Update [dbo].[screen].[icon]
set ICON = ICON - '%.png%'
where ICON LIKE '%.png%'
But that doesn't work.
Can anybody help me?

Try
... set ICON=LEFT(icon, LEN(icon)-4 ) where ICON like '%.png'

...SET ICON = REPLACE(ICON, '.png','')
Should do the trick

Maybe something like
UPDATE icon SET icon = LEFT(icon, CHARINDEX('.png', icon) - 1) WHERE icon LIKE '%.png%'
A demo of something

Related

Table control alignment issue in winforms rdlc [duplicate]

This question already has answers here:
Windows Forms Graphic Issue on Windows 10 OS
(1 answer)
How to configure an app to run correctly on a machine with a high DPI setting (e.g. 150%)?
(6 answers)
Closed 1 year ago.
I am trying to render rdlc in winforms with
Me.ReportViewer1.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Local
I am getting table control alignment issue when rendering
but when printing it is displaying properly
below is the code I am using for render rdlc in winforms
Me.ReportViewer1.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Local
Dim LocalReport = Me.ReportViewer1.LocalReport
LocalReport.Refresh()
LocalReport.ReportPath = Application.StartupPath + "\\MessageReports\\Report2.rdlc"
Dim dsReportDataSource = New Microsoft.Reporting.WinForms.ReportDataSource()
dsReportDataSource.Name = "DataSet1"
dsReportDataSource.Value = dtCancelMessage
LocalReport.DataSources.Add(dsReportDataSource)
Me.ReportViewer1.RefreshReport()
I am using using dotnet framework 4.8
Is this the known issue or am I doing anything wrong

VB.Net MaskedTextBox array [duplicate]

This question already has answers here:
What is a NullReferenceException, and how do I fix it?
(27 answers)
Closed 5 years ago.
Hello I have a code and blah blah blah...
The problem is I have a maskedtextbox(s) in a row (12 of them to be exact) and i want to give them a specific value from array. Is it possible to do it by loop?
I tried this:
This is the declaration:
Dim BiA11() As MaskedTextBox = New MaskedTextBox() {BiA11_1, BiA11_2,
BiA11_3, BiA11_4, BiA11_5, BiA11_6, BiA11_7, BiA11_8, BiA11_9, BiA11_10,
BiA11_11, BiA11_12}
And this is the code later in the program:
For index As Integer = 0 To 11
BiA11(index).Text = ""
Next
Yes I know now that i am pusshing nothing to the MaskedTextBox but this was only for my test. But the visual studio gives me this error:
System.NullReferenceException: Object reference not set to an instance of an object.
BiA11() – Nothing.
In the end I want to push to the textboxes strings from an array throgh loop (it will save a quantum of space because I have 132 of these textboxes.
Thank you for your time.
********************EDIT********************
So I found an answer
First of all in the declaration i changed the array a little bit:
Dim BiA11() As MaskedTextBox = New MaskedTextBox(11) {}
The declaration takes a place in the Public Class Form1
Then in the sub that handels the first events of appication in the first lines I filled the array with the references of the MaskedTextBox('s)
BiA11 = {BiA11_1, BiA11_2, BiA11_3, BiA11_4, BiA11_5, BiA11_6, BiA11_7, BiA11_8, BiA11_9, BiA11_10, BiA11_11, BiA11_12}
And then finaly when it comes to deleting all of the MaskedTextBox('s) i just puted this for loop inside and it worked for me.
For index As Integer = 0 To 11
BiA11(index).Text = ""
Next
No exceptions and the MaskedTextBox('s) are clear. Thank you for all your help. Hope that this will come in handy when someone will have similiar problem.
The issue is presumably that you have got that first code snippet at the class level. In that case, it will be executed before the constructor, in which case your controls haven't been created yet. What you need to do is declare the array variable at the class level:
Private BiA11 As MaskedTextBox()
and then create and populate the array inside the Load event handler of the form:
BiA11 = {BiA11_1, BiA11_2, BiA11_3, BiA11_4, BiA11_5, BiA11_6, BiA11_7, BiA11_8, BiA11_9, BiA11_10, BiA11_11, BiA11_12}

Displaying Parse Data to ContainerList

I want to display data from Parse in a list from GamesScores class using Container in Codename One, this is what I've tried so far and it's not showing anything nor giving any errors:
Container container = findListCont();
container.setLayout(BoxLayout.y());
container.setScrollableY(true);
ParseQuery<ParseObject> query = ParseQuery.getQuery("GameScore");
List<ParseObject> results = (List<ParseObject>) query.find();
System.out.println("Size: " + results.size());
container.addComponent(results, f);
Please help me out, I'm a new in Codename One. If there tutorials on it, please share or anything to help me achieve the desired results.
I'm actually shocked this isn't failing. You are using the add constraint to place the object result as a constraint and you add the form object into the container...
You need to loop over the results and convert them to components to add into the layout. It also seems that you are using the old GUI builder which I would recommend against.
Generally something like this rough pseudo code should work assuming you are using a box Y layout:
for(ParseObject o : results) {
MultiButton mb = new MultiButton(o.getDisplayValue());
f.add(mb);
}
f.revalidate();

How to visualize LabelMe database using Matlab

The LabelMe database can be downloaded from http://www.cs.toronto.edu/~norouzi/research/mlh/data/LabelMe_gist.mat
However, there is another link http://labelme.csail.mit.edu/Release3.0/
The webpage has a toolbox but I could not find any database to download. So, I was wondering if I could use the LabelMe_gist.mat which has the following fields. The field names contins the labels for the images, and img perhaps contains the images. How do I display the training and test images? I tried
im = imread(img)
Error using imread>parse_inputs (line 486)
The filename or url argument must be a string.
Error in imread (line 336)
[filename, fmt_s, extraArgs, msg] = parse_inputs(varargin{:});
but surely this is not the way. Please help
load LabelMe_gist.mat;
load('LabelMe_gist.mat', 'img')
Since we had no idea from your post what kind of data this is I went ahead and downloaded it. Turns out, img is a collection of 22019 images that are of size 32x32 (RGB). This is why img is a 32 x 32 x 3 x 22019 variable. Therefore, the i-th image is accessible via imshow(img(:,:,:,i));
Here is an animation of all of them (press Ctrl+C to interrupt):
for iImage = 1:size(img,4)
figure(1);clf;
imshow(img(:,:,:,iImage));
drawnow;
end

ios change the tabbaritem's badge in the AppDelegate [duplicate]

This question already has answers here:
Best way to update badgeValue of UITabBarController from a UIView
(3 answers)
Closed 9 years ago.
oh! i try to change the badge of tabbarItem in the AppDelegate;then it do work, but the tabarItem doesn't show! my code :
UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:#"MainStoryboard" bundle:nil];
UITabBarController *tabBarController = (UITabBarController *)[storyBoard instantiateViewControllerWithIdentifier:#"MainIdentifier"];
[[tabBarController.tabBar.items objectAtIndex:1] setBadgeValue:[NSString stringWithFormat:#"199"]];
(i also see the site How to set tabBarItem's badge from AppDelegate.m (tabBarView is not root View))
You can upvote the original answer here by Jim Rota
Access Tab Bar Controller:"
UITabBarController *tabController = (UITabBarController *)self.window.rootViewController;
Then set the badge
[[tabController.viewControllers objectAtIndex:1] tabBarItem].badgeValue = #"New!";

Resources