How To: Add Style in OSCommerce tep_image function [duplicate] - oscommerce

This question already has an answer here:
Adding class attribute to osCommerce tep_image function
(1 answer)
Closed 8 years ago.
Oscommerce function tep_image:
This is the code:
tep_image(DIR_WS_IMAGES . "partners_grey_top2.png", "ksa shopping", "395", "36");
How to add style?

The fifth argument of the tep_image function in a stock version of osCommerce accepts custom parameters. If you want to add, say, a CSS class like class="product_image", you would alter your function to look like this
tep_image(DIR_WS_IMAGES . "partners_grey_top2.png", "ksa shopping", "395", "36", 'class="product_image"');

Related

Flutter remove null values from list [duplicate]

This question already has answers here:
How to convert a List<T?> to List<T> in null safe Dart?
(2 answers)
type 'List<Widget?>' is not a subtype of type 'List<Widget>' in type cast
(3 answers)
Closed 1 year ago.
I have a List of optional DateTimes. So the List can actually have null values inside. But now I need to remove all these null-values, to get a List<DateTime, instead of a List<DateTime?>. How is that possible?
I tried it like this:
List<DateTime> timesOfDayNotNull = timesOfDay.where((time) => time != null).toList();
But this is giving me:
A value of type 'List<DateTime?>' can't be assigned to a variable of type 'List'.
What am I missing here? Any help is appreciated!

Remove specific characters from string to tidy up URLs [duplicate]

This question already has answers here:
Extracting rootdomains from URL string in Google Sheets
(3 answers)
Closed 2 years ago.
Hi I have a column of messy URL links within Google Sheets I'm trying to clean up, I want all formats of website links to be the same so that I can run a duplicate check on them.
For example, I have a list of URLs with various http, http://, https:// etc. I am trying to use the REGEXREPLACE tool to remove all http combination elements from the column entries, however cannot get it to work. This is what I have:
Before:
http://www.website1.com/
https://website2.com/
https://www.website3.com/
And I want - After:
website.com
website2.com
website3.com
It is ok if this takes place over a number of formulas and thus columns to the end result.
try:
=ARRAYFORMULA(IFERROR(REGEXEXTRACT(INDEX(SPLIT(
REGEXREPLACE(A1:A, "https?://www.|https?://|www.", ), "/"),,1),
"\.(.+\..+)"), INDEX(IFERROR(SPLIT(
REGEXREPLACE(A1:A, "https?://www.|https?://|www.", ), "/")),,1)))
or shorter:
=INDEX(IFERROR(REGEXEXTRACT(A1:A, "^(?:https?:\/\/)?(?:www\.)?([^\/]+)")))
You can try the following formula
=ArrayFormula(regexreplace(LEFT(P1:P3,LEN(P1:P3)-1),"(.*//www.)|(.*//)",""))
Please do adjust ranges as needed.

How to query in Mongo for a String based on expressions [duplicate]

This question already has answers here:
Matching a Forward Slash with a regex
(9 answers)
Closed 3 years ago.
I have lot of Data in Mongo DB, I wanted to query based on a String value and that value contains a url
"url" : "http://some-host/api/name/service/list/1234/xyz"
I got records count when executed the below query
db.mycollection.find({url:"http://some-host/api/name/service/list/1234/xyz"}).count()
I want to get all the records which match with
some-host/api/name/service/list/
I tried using below saamples
db.mycollection.find({url:"some-host/api/name/service/list/"}).count()
Got zero records
db.mycollection.find({url:/.*"some-host/api/name/service/list/".*/}).count()
Got error
db.mycollection.find({"url":/.*"some-host/api/name/service/list/".*/}).count()
Got error
db.mycollection.find({"url":/.*some-host/api/name/service/list/.*/}).count()
Got Error
db.mycollection.find({"url":/.*some-host//api//name//service//list//.*/}).count()
Got ...
...
Then no response
Did you try with something like this:
db.mycollection.find({'url': {'$regex': 'sometext'}})
Please check also here

EmberJS, String interpolation in a helper call [duplicate]

This question already has an answer here:
Concatenation string with variable in emblem.js
(1 answer)
Closed 7 years ago.
I have this helper call in my template:
{{my-helper id='myID'}}
And I want to make the id param value a bit more dynamic, for example:
{{#each charts as |chart|}}
{{my-helper id='chart' + chart.id}}
{{/each}}
How I can I use string interpolation and concatenation to create a value for a param in a helper call?
You can use the concat helper to do this:
{{#each charts as |chart|}}
{{my-helper id=(concat 'chart' chart.id)}}
{{/each}}
It's not ES2015 String interpolation, but it will do what you want.

how to get model field type for validation in django [duplicate]

This question already has answers here:
how to get field type string from db model in django
(3 answers)
Closed 9 years ago.
I have tried:
field = model._meta.get_field_by_name(field_name)[0]
my_type = field.get_internal_type
This does not work as it gives back some bound method like:
<bound method URLField.get_internal_type of <django.db.models.fields.URLField:my_url>>
I want something I can world with like CharField, URLField, DoubleField, etc.
How can I get something like URLField so that I can validate if the url is well formed for example?
In Python, if you want to call a function or method, you have to use parentheses around the arguments. If there are no arguments, you just use empty parentheses.
What you're doing is just referencing the method itself, not calling it.
Here's a simplified example:
>>> def foo():
... return 3
>>> foo()
3
>>> foo
<function __main__.foo>
You can't "extract" the result from the function; you have to call it.*
So, in your example, just change the second line to this:
my_type = field.get_internal_type()
* OK, in this case, because the function just always returns a constant value, you could extract it by, e.g., pulling it from the source or the func_code.co_consts tuple. But obviously that won't work in general; if you want to get, say, the value of datetime.now(), it's not stored anywhere in the now method, it's generated on the fly when you call the method.