[Solved] I have an array of dynamic data, how to display that with ordered list as mega menu

[ad_1] Couple of foreach loops should do the trick: <?php $arr = array( ‘properties’ => array( 0 => array( ‘sub’ => ‘hello’ ), 1 => array( ‘sub’ => ‘world’ ) ), ‘cars’ => array( 0 => array( ‘sub’ => ‘hello1’ ), 1 => array( ‘sub’ => ‘world2’ ) ) ); print_r($arr); echo ‘<ul>’; foreach ($arr … Read more

[Solved] How to split a python dictionary for its values on matching a key

[ad_1] from itertools import product my_dict = {‘a’:1, ‘chk’:{‘b’:2, ‘c’:3}, ‘e’:{‘chk’:{‘f’:5, ‘g’:6}} } def process(d): to_product = [] # [[(‘a’, 1)], [(‘b’, 2), (‘c’, 3)], …] for k, v in d.items(): if k == ‘chk’: to_product.append([(k2, v2) for d2 in process(v) for k2, v2 in d2.items()]) elif isinstance(v, dict): to_product.append([(k, d2) for d2 in process(v)]) … Read more

[Solved] How do I join on multiple columns in SQL Server and include columns in one table that aren’t present in other tables?

[ad_1] declare @t1 table ( col_a varchar(5) null ,col_b varchar(5) null ,col_c varchar(5) null ,col_d varchar(5) null ) declare @t2 table ( col_a varchar(5) null ,col_b varchar(5) null ,col_e varchar(5) null ) insert into @t1 values (‘Cat 1′,’Bla a’,’C-1′,’D-1′) ,(‘Cat 1′,’Bla a’,’C-2′,’D-2′) ,(‘Cat 1′,’Bla a’,’C-3′,’D-3′) ,(‘Cat 2′,’Bla b’,’C-4′,’D-4′) ,(‘Cat 2′,’Bla b’,’C-5′,’D-5′) insert into @t2 values … Read more

[Solved] Find number of rows of each column name [duplicate]

[ad_1] Assuming that there aren’t any partitioned table: USE [SpecificDatabank] SELECT sys.columns.name AS ColumnName, sys.tables.name AS TableName, sys.partitions.rows AS [Rows] FROM sys.columns JOIN sys.tables ON sys.columns.object_id = sys.tables.object_id JOIN sys.partitions ON sys.tables.object_id = sys.partitions.object_id and sys.partitions.index_id in (0,1) WHERE sys.columns.name LIKE ‘%ColumnName%’ 1 [ad_2] solved Find number of rows of each column name [duplicate]

[Solved] Null Pointer Exception, Cant figure out why? [closed]

[ad_1] I did not understand how the output you showed has one of the numbers multiplied by 100 in each element of String array. Based on my understanding of your question here is a solution. import java.util.Arrays; import java.util.Collections; import java.util.LinkedList; import java.util.stream.Collectors; import java.util.stream.IntStream; public class Shifts { public static void main(String[] args) { … Read more

[Solved] If textfield is empty do not send! – Help JavaScript [closed]

[ad_1] Yes, it has if/else statement, you may try this $(‘button’).click(function(){ var message = $(‘textarea’).val(); var old = $(‘#content’).html(); if(message.length==0) return false; $(‘#content’).html(old + ‘<p>’ + message); }); 1 [ad_2] solved If textfield is empty do not send! – Help JavaScript [closed]

[Solved] Hiding specific view in an activity

[ad_1] You can change the status of the views programmatically. You should use view.setVisibility(View.GONE) if you want to remove the view from the layout, and view.setVisibility(View.INVISIBLE) if you want to hide it. To put them back , use view.setVisibility(View.VISIBLE). [ad_2] solved Hiding specific view in an activity

[Solved] C++ vector matching [closed]

[ad_1] You code has undefined behavior because you are accessing them beyond the size. In v1 there will be 7 items, while in v2, there will be 3. But you are accessing both upto index 20. So the output can be anything. To avoid this, you can resize your vectors and then assign 1 to … Read more

[Solved] slow algorithm contest

[ad_1] Your code looks OK, you might make it faster by checking the words have the same length before the actual sort: while !STDIN.gets.chomp.empty? first_word, second_word = $_.downcase.split if first_word.length == second_word.length && first_word.chars.sort == second_word.chars.sort puts “YES” else puts “NO” end end 1 [ad_2] solved slow algorithm contest