I am trying to make a simple check in liquid (the language on shopify) using a metafield (a value manually assigned to each item).
If you are unfamiliar with liquid you can check on the shopify forums as it is very easy o understand and very similar to most current languages, but I can use plain html or css in it as well if it'd be easier.
The metafield.global.release_date for the item in question has a string value of "17-10-2013". I can assign any value I choose as the release date, either in string or integer format. (I can for instance even embed a video).
What I want is to check the metafield.global.release_date of an item is newer or older then the current date, then simply change the output text to be either "item is available for Pre-Order", or "item is In Stock"based on the result.
The text output is simple and I can do it myself, the problem comes in reading the metafield release date as it is just plain text that is input by me for each individual item, I cannot figure out how to convert it to a format that can be used to check against the current date.
If I had more experience in css/html or had knowledge of java I may have been able to figure it out myself, but with my limited knowledge this is unfortunately something I cannot do yet.
Please can someone provide some simple code, such as an if-statement that I could use, if you need more information please just ask.
Thanks.
-EDIT-
Basically this is what I need the code to do:
-Check metafield.global.release_date
-Check Current Date
-If metafield.global.release_date > Current date THEN "Game is Available for Pre-Order"
-Else "Game is In Stock"
Related
This might be a stupid question but after all the research on best practices – including this great SO post that explains sanitizing, validation, escaping for storage and escaping for display – I am still confused.
I have built a routine where I sanitize user input – say, a comment post, or "edit my first name" string – with $value = filter_var($value, FILTER_SANITIZE_STRING);. Given a value of O'Hara, that gets rid of <a></a> and similar tags nicely. Then this new value gets validated: error if empty value and field is not nullable; or if too long; etc. Lastly, I save that value in the DB using a CakePHP query builder – which, of course, supports binding string values.
But when I then save that value in the DB, it is saved as O'Hara instead of O'Hara – because of said sanitization.
Am I supposed to decode it back / to yet another format? If so with which method?
Or, am I to use the sanitized version for validation but then the original value for DB stora-- that can't be it.
Or is FILTER_SANITIZE_STRING a flag I need to tweak? The tutorials I've seen [1] [2] suggest that the flag is enough.
I feel so dumb because that great post mentioned earlier seems to still not be enough for me. All I can find are posts from ~2012 that say you should bind.
Any help would be appreciated.
I'd like to implement an app with Dart on Flutter. I'm on my first approach with this new language and for the first time I meet this problem.
My app must necessarily work with a mobile phone number. I would like to see a ban on the insertion of unse prefixed telephone numbers or, alternatively, the typing of a number with more digits than expected. For example, in Italy the figures after +39 (0039) are at most 10. I probably thought I'd separate the two parts to make it easier to distinguish between lengths (one field where you select the country and another that allows you to enter the number).
Is there, as you know, a JSON that contains exactly: - the prefix of each state, - the length of the telephone number (excluding prefix), - name, *flag and *sigla (Italy, green-white-red, IT)?
Sifting through the web a little bit, I saw that flutter should actually provide already in itself with .demoTextFieldEnterITPhoneNumber, through GalleryLocalizations to do such a job, but I didn't quite understand if it bothers to control a particular regular expression for each nation or not. Could I copy and paste a number for example? Will nationality be automatically recognized?
In the end I think that such a control, so deep, is not possible so I would just need this, so make two fields, one with a list, which at the choice automatically fills in depending on the selected prefix, and a field on which the user types his number: in case of copied and pasted number check if that string also contains a +prefix.
Thank you very much, I need a lot, since my app will mainly revolve around a correct value for this field. :)
Try using the international_phone_input or country_code_picker flutter package. They are quite easy to implement
I'm trying to get the current time in UTC in a UWP application. This should be a simple matter of constructing a DateTime object
DateTime const now{ clock::now() };
and accessing its UniversalTime field. However, that field does not appear to have been projected into C++/WinRT.
How do I get the current time in UTC using C++/WinRT?
Looks like a documentation bug. That field doesn't exist in C++/WinRT. Instead, DateTime is projected as a std::chrono::time_point. But similar to C++/CX, the documentation for the struct (not the field) is still somewhat accurat - it has the same granularity as FILETIME. But even easier than extracting the value youself, winrt::clock provides static methods to_file_time and to_time_t that convert DateTime to
FILETIME or time_t, respectively.
I'll get the documentation fixed up, and I've been meaning to write a blog post about how C++/WinRT seamlessly interops with std::chrono for timekeeping. I'm a a fan of std::chrono, and incorporating it into C++/WinRT was my idea, so the haters know who to blame. :)
I need to change the value of an in-game currency called credits in an apk. After decompiling the apk on my mac, I opened its folder and spent some time searching for the credits value. And damn, it is near impossible! The code was converted to smali, in which numbers are referred to in hexadecimal form. I even tried searching for the hexadecimal value of the credits in the folder with command f, but I was still thrown into a bunch of confusion (there were a bunch of different hex values, most having nothing to do with the credits, or in part of an incrementing list - you would understand the disaster if you looked at smali). Problem is, I need to be able to search for the value of credits like you would with CheatEngine (for PC/Mac) or GameKiller (for Android). Mind you all, I'm not trying to violate property here, I'm doing it on a test application I have used many times before in my previous posts and reverse engineering, just to put my skills to use in some sort of platform.
I'm evaluating HTML5 Web Audio API example and trying to get it work. Here is what I'm working with. As far as I got I understood that it's using old API and I need to refactor function refreshFilterType() on line ~590. Link - www.smartjava.org/examples/webaudio-filters/
According to Web Audio BiquadFilterNode I need to rework switch statement and make it
and to use the new string-based values. (I.e. a value of "3" - the default lowshelf filter - needs to be passed into currentFilterType as "lowshelf"). I've tried to implement new BiquadFilterNode, but still it was unsuccessfully.
Thank you in advance.
I just opened a pull request with the necessary fixes. Or look at https://github.com/cwilso/smartjava.
...and actually, I note the real problem with the code you have is not that it's using numeric values - that's wrong, according to the spec, but it's still supported - it's line 663:
filter.type = currentFilterType;
currentFilterType is "3" - that is, the STRING "3" - and type now takes a string, so it's not being coerced. If you changed this line to
filter.type = parseInt(currentFilterType);
it would actually fix the problem (because filter.type accepts ints, and will coerce them to the appropriate string of "lowpass", etc. - but it doesn't accept the string of a number.)
However, this will fail in the long term, when we remove the deprecated types.