[Solved] Make 2 arrays from one array [closed]

You can try something like this: int[] arr= {-1, -2, 0, 1, 2}; int p=0; int n=0; for(int i=0; i<arr.length-1; ++i) { if(arr[i]>=0) { p=p+1; } else { n=n+1; } } int[] posarr=new int[p]; int[] negarr=new int[n]; p=0; n=0; for(int i=0; i<arr.length-1; ++i) { if(arr[i]>=0) { posarr[p]=arr[i]; p=p+1; } else { negarr[n]=arr[i]; n=n+1; } } … Read more

[Solved] “java.lang.NoClassDefFoundError: javax/mail/MessagingException” (Using spigot / Bukkit) (Eclipse) [closed]

1) Have you used following 2 jars ? mail.jar activation.jar 2) Try switching to latest jars if issue still persist. 3) Make sure jar are available in class-path and there are no version conflicts. 4) Try upgrading you java version to 1.6+ if using lower versions. 5) Add the jars to your WEB-INF/lib folder Add … Read more

[Solved] Insert HTML dynamically based on CSS class with Javascript

What about ? <body class=”en”> <script> if($(‘body’).hasClass(‘de’)) { $(‘body’).html(‘<div id=”de”>some html</div>’); } else if($(‘body’).hasClass(‘en’)) { $(‘body’).html(‘<div id=”en”>some other html</div>’); } else if($(‘body’).hasClass(‘es’)) { $(‘body’).html(‘<div id=”es”>another html</div>’); } else { … } </script> Dynamic : var bodyClass = $(‘body’).attr(“class”); var bodyValue = $(‘#’ + bodyClass).html(); $(‘body’).html(bodyValue); But you should verify that body has a class and … Read more

[Solved] WPF Shaped Button – Visaul Studio/Blend

You need to create a ControlTemplate for the Button. This can be done both in Blend and Visual Studio. I did it in VS2015. Here is your code: But, for the future, try to do some work yourself before posting the question. Include just enough code to allow others to reproduce the problem. For help … Read more

[Solved] If condition issues in swift

You need to check whether an array has an element or not. if addonCategory.count > 0 { // array has element } else { // array hasn’t element } Alternatively you can use guard let or if let to check. Using if let if let addonCategory = subCategoryModel[tappedIndex.section].items[tappedIndex.row].addonCategory, addonCategory.isEmpty { print(addonCategory) print(“Hello”) } else { … Read more

[Solved] Find difference b/w avg salary of departments

MINUS is the set minus operator in Oracle and is called EXCEPT in SQL Server and doesn’t seem to exist in MySQL (at least I couldn’t find it). But you don’t seem to want a set minus but an arithmetic minus. Try SELECT (SELECT avg(sal) FROM employee WHERE dept=”SC”) – (SELECT avg(sal) FROM employee WHERE … Read more

[Solved] Making a query with a single row out

You can do conditional aggregation : select id, sum(case when type=”x” and location = ‘L’ then amount else 0 end) as sumofXandL, . . . from table t group by id; 0 solved Making a query with a single row out