Categories
Mastering Development

Yii2- Hide admin settings based on user role

I have a tree in which I am displaying nodes and their child nodes. I want to hide the non admin options to a user whose not an admin. By default, the isAdmin is true. For checking user roles I have done the following. <?= TreeView::widget([ ‘query’ => \common\models\MdcNode::find()->addOrderBy(‘root, lft’), ‘headingOptions’ => [‘label’ => ‘Root’], […]

Categories
Mastering Development

Custom register table just reloads page laravel auth

I’m trying to change the default users table from Laravel auth to a custom estudiante (student in spanish) table, but after all the changes when I click the register button the page just gets reloaded but the insert doesn’t happen and I don’t get any errors. Mi Auth.php file is ‘defaults’ => [ ‘guard’ => […]

Categories
Mastering Development

Android Studio no access to internet

My app to access a simple JSON and display it runs perfectly fine on the emulator(PIXEL 2 API 24) but not on any actual device I connect to it. Tried with both S8 and Note10, neither have data saver on either. I even checked the apps data use afterwards and it said "0 B". Here […]

Categories
Mastering Development

CASE statement in SQL throws ORA-00905

I have the below code in Cognos. When I validate it throws ORA-00905. SELECT (CASE WHEN #prompt(‘prompt_name’,’string’,"’A’")# = ‘A’ then ABC = ‘S’ ELSE ABC END) FROM table_name; Thanks for the help!!!

Categories
Mastering Development

My String Class has errors when using C functions

Hello this is my first time making a string class I get an error with memcpy, with strlen and on line 41 which I have commented. I am using repl.it so I am not sure if that is the reason but any help will be appreciated! #include <iostream> #include <string> class String { private: char* […]

Categories
Mastering Development

JSON to Avro Decoding – AvroTypeException: Expected field name not found

I am using Avro 1.8.2 and I am trying to convert JSON into a GenericRecord DatumReader<GenericData.Record> datumReader = new GenericDatumReader<>(schema); Decoder decoder = DecoderFactory.get().jsonDecoder(schema, jsonStr); datumReader.read(null, decoder) I get JSON data from a third party and I have no control over the elements. The AVRO schema is { "namespace":"com.avro.generated", "type":"record", "name":"TestEvent", "fields":[ {"name":"userId","type":"string"}, {"name":"frm","type":"string"}, {"name":"issuerName","type":"string"}, […]

Categories
CMS Mastering Development Wordpress

Excerpt – First Sentence & Read More

I am using this function to limit the excerpt to the first sentence… function hello_first_sentence( $string ) { $sentence = preg_split( ‘/(\.|!|\?)\s/’, $string, 2, PREG_SPLIT_DELIM_CAPTURE ); return $sentence[‘0’] . $sentence[‘1’]; } add_filter( ‘get_the_excerpt’, ‘hello_first_sentence’, 10, 1 ); However, for some reason, I am unable to add the "read more" after the excerpt… any help?

Categories
CMS Mastering Development Wordpress

Excerpt – First Sentence & Read More

I am using this function to limit the excerpt to the first sentence… function hello_first_sentence( $string ) { $sentence = preg_split( ‘/(\.|!|\?)\s/’, $string, 2, PREG_SPLIT_DELIM_CAPTURE ); return $sentence[‘0’] . $sentence[‘1’]; } add_filter( ‘get_the_excerpt’, ‘hello_first_sentence’, 10, 1 ); However, for some reason, I am unable to add the "read more" after the excerpt… any help?

Categories
Mastering Development

How to match a word in javascript?

I am trying to match word in javascript if i use ‘if’ and ‘split’ method each time I stuck in the case-sensetive. If I am using regExp then if a part of word matched it returned true (i.e : hii , /hi/). What I do do to match case-insensitive and whole word should be match. […]

Categories
Mastering Development

How do I prevent a JTable from taking a certain input in the specified column?

I am trying to get a JTable to only accept input in a certain format for each column. For example, in a table with 5 columns the ones at indexes 3 and 4 should only accept numeric values. I know about RowFilter and RowFilter.regexFilter(…) because of this post, but that hides the entire row instead […]