// above two queries in one statement. select * from 'table' where id IN ( select id from 'another_table' )
$('form').live("submit", function () { ShowProgress(); });
function DisplayQuestion() { board.innerHTML = ""; status.innerHTML = "Question " + (pos + 1) + " of " + questions.length; questn = questions[pos][0]; A = questions[pos][1]; B = questions[pos][2]; C = questions[pos][3]; D = questions[pos][4]; board.innerHTML += "<h3>" + questn + "</h3>"; board.innerHTML += "<label><input type='radio' name='choices' value='A'>" + A + "</label><br>"; board.innerHTML += "<label><input type='radio' name='choices' value='B'>" + B + "</label><br>"; board.innerHTML += "<label><input type='radio' name='choices' value='C'>" + C + "</label><br>"; board.innerHTML += "<label><input type='radio' name='choices' value='D'>" + D + "</label><br>"; board.innerHTML += "<button onclick='checkAnswer()'>Submit Answer</button>"; }
function DisplayQuestion() { status.innerHTML = "Question " + (pos + 1) + " of " + questions.length; question_ = "<h3>" + questions[pos][0] + "</h3>"; question_ += "<label><input type='radio' name='choices' value='A'>" + questions[pos][1] + "</label><br>"; question_ += "<label><input type='radio' name='choices' value='B'>" + questions[pos][2] + "</label><br>"; question_ += "<label><input type='radio' name='choices' value='C'>" + questions[pos][3] + "</label><br>"; question_ += "<label><input type='radio' name='choices' value='D'>" + questions[pos][4] + "</label><br>"; question_ += "<button onclick='checkAnswer()'>Submit Answer</button>"; board.innerHtml = question_ ; }
Dim sText As String sText = "DRAFT COPY" & vbCrLf & "NOT FOR MANUFACTURE" & vbCrLf & "CRITICAL SECTIONS NOT FILLED OUT"
Dim sText = "DRAFT COPY" & vbCrLf & "NOT FOR MANUFACTURE" & vbCrLf & "CRITICAL SECTIONS NOT FILLED OUT"
Dim oDrawDoc As DrawingDocument oDrawDoc = ThisApplication.ActiveDocument ' a reference to the active sheet. Dim oActiveSheet As Sheet oActiveSheet = oDrawDoc.ActiveSheet ' a reference to the GeneralNotes object Dim oGeneralNotes As GeneralNotes oGeneralNotes = oActiveSheet.DrawingNotes.GeneralNotes Dim oTG As TransientGeometry oTG = ThisApplication.TransientGeometry // uses of all the vars and containers // .... // bottom of your code / function / sub oDrawDoc = nothing oActiveSheet = nothing oGeneralNotes = nothing oTG = nothing
<IMG id="MyIMG" onHover="func_(this.id);"
$temp_output = "<br>" ; // init of the var $temp_output .= "message of your choice" ; // concatenation here, you add 'words' to the var. $temp_output .= "<html tag> with text, or script" ; // and , at end of your script, or before 'exit case', or end of scope : echo $temp_output ;
Me.GB_Table.Controls(i) Me.GB_Table.Controls(0) Me.GB_Table.Controls(250)
if typeof Me.GB_Table.Controls(0) is Label then dim temp_ctrl_label as Label = Me.GB_Table.Controls(0) temp_ctrl_label.Text = " Surprise !" end if
private function send_to_form( values as object/what you want ) dim Form2.the_var = values Form2.load/show() end function
model_pic = New PictureBox model_pic.Width = 120 model_pic.Height = 150 model_pic.BackgroundImageLayout = ImageLayout.Stretch model_lbl = new Label model_lbl.ForeColor = Color.White model_lbl.BackColor = Color.DodgerBlue model_lbl.TextAlign = ContentAlignment.MiddleCenter model_lbl.Dock = DockStyle.Top model_lbl.Font = New Font("Segoe UI", 8, FontStyle.Bold) While dr.Read Dim len As Long = dr.GetBytes(0, 0, Nothing, 0, 0) Dim array(CInt(len)) As Byte dr.GetBytes(0, 0, array, 0, CInt(len)) pic = model_pic pic.Tag = dr.Item("class").ToString lblname = model_lbl lblname.Tag = dr.Item("class").ToString // same for all purposes, there are constants/static values, keep them before the loop. // ..... AddHandler pic.Click, AddressOf Selectimg_Click AddHandler lblname.Click, AddressOf Selectimg_Click AddHandler lblprice.Click, AddressOf Selectimg_Click End While
const startTimeClientData = Date.now(); const clientRef = doc(FIRESTORE_DB, "clients", userId); const depositsRef = collection(clientRef, "deposits"); const withdrawalsRef = collection(clientRef, "withdrawals"); const dataPNLRef = query(collection(FIRESTORE_DB, "dataPNL"), orderBy("date", "desc"), limit(4)); const [clientDoc, depositsSnapshot, withdrawalsSnapshot, dataPNLSnapshot] = await Promise.all([ getDoc(clientRef), getDocs(depositsRef), getDocs(withdrawalsRef), getDocs(dataPNLRef), ]); console.log("Fetching client data:", Date.now() - startTimeClientData, "s");
const startTimeClientData = Date.now(); const [clientDoc, depositsSnapshot, withdrawalsSnapshot, dataPNLSnapshot] = await Promise.all([ getDoc(doc(FIRESTORE_DB, "clients", userId)), getDocs(collection(clientRef, "deposits")), getDocs(collection(clientRef, "withdrawals")), getDocs(query(collection(FIRESTORE_DB, "dataPNL"), orderBy("date", "desc"), limit(4)), ]); console.log("Fetching client data:", Date.now() - startTimeClientData, "s");
const announcementsRef = collection(FIRESTORE_DB, "announcements"); const latestAnnouncementRef = query(announcementsRef, orderBy("date", "desc"), limit(1)); const latestAnnouncementSnapshot = await getDocs(latestAnnouncementRef); setLatestAnnouncement(latestAnnouncementSnapshot.docs[0]?.data());
const latestAnnouncementSnapshot = await getDocs(query(collection(FIRESTORE_DB, "announcements"), orderBy("date", "desc"), limit(1))); setLatestAnnouncement(latestAnnouncementSnapshot.docs[0]?.data());
<button type="button" onclick="showPRock();computerRandom();" id="rockBtn">Rock</button> <button type="button" onclick="showPPaper();computerRandom();" id="paperBtn">Paper</button> <button type="button" onclick="showPScissors();computerRandom();" id="scissorsBtn">Scissors</button>
function push_item(_item){ if(_item.style.display === "none"){ _item.style.display = "block"; } else{ _item.style.display = "none"; }; // it will make the job for all items : push_item('rocks'); push_item('scissors'); push_item('papers');
using System; using System.Data; using Microsoft.Data.SqlClient; namespace SqlCommandCS { class Program { static void Main() { string str = "Data Source=(local);Initial Catalog=Northwind;" + "Integrated Security=SSPI"; string qs = "SELECT OrderID, CustomerID FROM dbo.Orders;"; CreateCommand(qs, str); } private static void CreateCommand(string queryString, string connectionString) { using (SqlConnection connection = new SqlConnection( connectionString)) { SqlCommand command = new SqlCommand(queryString, connection); command.Connection.Open(); ' <------ command.ExecuteNonQuery(); } } } }
while( resizing ){ refresh_controls() ; ) // too expensive , bad process , high cost of actions // take it easy while( resizing ) { // no action on controls ; } wait_for_stop_of_border_moving(){ resize_controls() };
var match=[]; var items=document.querySelectorAll('.date-list-swiper-slide'); console.table(items); for(let i of items) { i.querySelector('.slide-item-wrap').click(); document.querySelectorAll('.item').forEach(function(item,i) { // without let or var, because of 'void' is equal 'let' match.push({time:item.querySelector('.time-t').innerText,area_a:item.querySelector('.origin-area').innerText,area_b:item.querySelectorAll('.origin-area')[2].innerText}); }); } console.log(match); console.table(match);
z-index:10; // use another display stack with your menu above others. position:fixed; // fixed achieve to push out from main html code 'flow' elements, top:10%; // top position in % / px / em left:10%; // left position ....
INSERT INTO table(field_1, ....) VALUES ( value_1, .... ) ;
@media (max-width: 640px) { #divo{width:10%;} } @media (max-width: 1900px) { #divo{width:34%;} }
SELECT distinct(processID), MAX(date) FROM 'table' order by processID ASC
<form method="POST" action="?"> // it's equal to php_self, page_Y to page_Y
Path.getFullPath(env..specialfolder)
var _path = "the path" var _path_in_array = _path.split("/") // path_in_array will contains, with indexes, all the sub part of your path. // and to group again your path in a full one : the join() function var final_path = path_in_array.join() // look at this two function in .Net Help pages. for /split/ and /join/ // It could solve your question
<input name="skills[]" type="text"> <input name="skills[]" type="text"> <input name="skills[]" type="text"> <input name="skills[]" type="text"> // this way you can have a output for all the skills value, in the array 'skills'
function addSkill(){ document.getElementById('skillDiv').innerHTML+= "<input type='text' id='skill' required>"; } function redirect(){ document.getElementById("skill").removeAttribute("required"); // there are two tags 'skill' so // so DOM have an array with 2 slots. // watch your code by 'dev tools', you will see two tags 'id=skill' }
global $cnum , $dcnum ; // at top of script and page
#demo_tag{ background-color:blue; // apply at reading background-color:yellow; // apply at reading background-color:red; // apply at reading, then : // the background will be 'red', because of a 'sequential reading' of the css // the last value for the color is display to the user. }
#demo_tag{ background-color:purple; // the background will be purple , not red }
select * from SAP
class car = { constructor(){ this.color = 'Red'; this.machine = 12; } function particulars(){ console.log(this.color); console.log(this.machine); } } var audi = new car(); audi.particulars();
void fillVector(std::vector<T1>& vector) { // fill vector with values } void fillVector(std::vector<T2>& vector) { // fill vector with values } void fillVector(std::vector<T3>& vector) { // fill vector with values }
// include() and require() are deprecated since few years, because of security breachs. // go by 'require_once()' every time you have to import an external resource. // require_once() will load the resource one time instead of multiple times. // that a good reason to use only 'require_once()'.
// $_SESSION is an Array with values in, and all those values are sent by url, to the client. // you can set them, and get them back at each page call. // $_SESSION are transmit from server to client, and from client to server, it's 2 direction you can use. // all the $_SESSION are in the url fields with both names and values.
// the 'global' make a var reachable all over your php script and scopes. // put it at top of your code page, and use your var every where you need them. <?php global $var_one, $var_two ; ?> // by this keyword you make your vars as 'shared' through all your php pattern.
long long int substrCount (string s, int k) { return cal(s,k)-cal(s,k-1); // it's a substraction, providing the final difference value for a fixed 'k'. <- it's "answer" // try 'cal(s,k)' and try cal(s,k-1) alone by return. // it's math applying to get the number of answer ( a gap between k and k-1 ) // }
unset($sql1) ; unset($sql2) ; unset($sql3) ; unset($result1) ; unset($result2) ; unset($result3) ; // unset($var) ; it free the memory , it belong to 'best practices'. // when you have a big bunch of Datas, or concrete weight, it's useful. // you can apply unset() on all objects too : on $sql'N' , and on '$result'N''
"select * from categories" // as a main query, all others fields to get could be filter with 'if(!empty($rows['parent'])){ echo ... ;}
format("{0} {1} {2}{3}",to_str(var_0),var_1,var_2,var_3) ; format("{3} {1} {0}{2}",to_str(var_0),var_1,var_2,var_3) ; // works too. <pre> It's Strings Interpolation
function load_cart_item_number() { $.ajax({ url: 'action.php', method: 'get', data: { cartItem: "cart_item" }, success: function(response) { $("#cart-item").html(response); } });
$row['password'] === password_verify($password, $hash_password)) // the right operation return a boolean, // that make the equality hard. a password is wait, and the compare values could be 1 or 0
?- LP = not(true(LP)). // query LP = not(true(LP)). // allocation // this two lines could query to renew LP content and values, with a 'not' operation, LP is define with another value before this query. // and the query get all the results which are not the initial LP. // from line 1 to line 2, LP is fill after checking if the ?- query have results. // it's hard to guess like that, more details are needed
SELECT product_id, SUBSTRING(product_id,1,3) AS 'First_Part', SUBSTRING(product_id,6,2) AS 'Second_Part', SUBSTRING(product_id,9,9) AS 'Last_Part' FROM product
<?php $json_content = json_decode(file_get_contents("report/vdn.json"), true); // the Path is a constant. no need to allocate a var for it. $answer_output = "" ; // init one var, as 'empty String'. foreach ($json_content as $row){ $answer_output .= "<tr>" ; // .= is 'concatenating operator', to join 'Strings' together. $parts = explode(',', $row); foreach ($parts as $part){ $aux = explode(':"', $part); $answer_output .= "<td><center>" . str_replace('"','',$aux[1]) . "</center></td>"; // concatenating again, to get all the "<td> .... </td>" } $answer_output .= "</tr>"; } echo $answer_output ; // all rows are ready to display, and are store in the 'var $answer_output'. // using one simple 'echo' as answer for ajax call. echo when Ajax can be mutliple sure. but one single use of echo is more simple. unset($json_content) ; // equal to free() , the var is deleted. its content and values too. // 'unset()' clean the memory space occupied by the 'in-file values'. your server will thank you with this one. its' a good practice, remenber: unset($the_var); ?>
// add library : #include <string> // and use : double result = double(a) - double(b); cout << to_str(result) << endl ; // it's a Type Mismatch causing trouble.
$(document).ready(function() { // by this .ready() function, you apply just one time the 'change' trigger, at end of the DOM built. when the page loading is over. // Price checkboxes change event $('input[type=checkbox][id^=price]').change(function() { if ( !$('#price-all').is(':checked')) { // as condition, this one will be enough, because "> 0 " is always true with '#price-all' when checked $('ul#product-list').find('li').hide(); $('input[type=checkbox][id^=price]:checked').each(function() { // that a loop, if loop.length == 0 , you leave this processing function let price = $(this).attr('id').split('-')[1]; // 'let' is welcome for loop. unloading at end of scope to be refresh by another value.It's modern JScript $('ul#product-list').find('li').filter('[data-price="' + price + '"]').show(); }); } else if (!$('#price-all').is(':checked')) { $('ul#product-list').find('li').hide(); } else { $('ul#product-list').find('li').show(); } }); // Price all checkbox click event $("#price-all").click(function() { if($(this).is(':checked')) { $(".custom-checkbox .badge").show(); } else { $(".custom-checkbox .badge").hide(); } }); });
//from php side, you send a JS script, it will add in the DOM of your page. echo (" <script> alert(document.cookie); my_cookie_function() ; </script> ") ; // this way you'll have a firing function after php work.
<?php // top of your php script require_once('file_1.ext'); require_once('file_2.ext'); require_once('file_3.ext'); require_once('file_4.ext'); // and after , put your processing code.
Dim f As New frmViewReport // init f.CrystalReportViewer1.ReportSource = cr // setting f.CrystalReportViewer1.Zoom(1) // setting If frm_add_sale.PrintView_Opt = "Y" Then f.cmd_print_Click(New Object(), New System.EventArgs()) // action Else f.ShowDialog() // action End If // at end of use for 'f' f = nothing // delete from memory // or f.dispose() // delete from memory if 'f' is Disposable
console.log(the_var) ; console.table(the_array_var) ;
var_dump($the_var_all_types) ; print_r($var_arrays_object) ;
// in JS native : document.getElementById('the_id_selector').value = ""
// the loop before for (let x = 0; x < payload.info.tgdetails.length; x++) { processMultipleTag(sdk[i], payload[x], btn1) { // do stuff } }
doc.createelement(name, value)
with Xelement : // by multiple Elements to add with different depth : dim XELEM as Xelement = new Xelement(name_1 , new xelement("name_2", value_2) , value_1 ) node.add(XELEM)
select distinct ID , name , ( .... // then all the sub queries to apply 'maths' )
echo $item[0] ; // will provide datas
const site = document.querySelectorAll('.plain-text-display, #formatted-ticket-content'); for(let i = 0 ; i < site.length-1 ; i++){ if(site[i] != undefined){ site = site[i].textContent.split('\n').filter(line => line.includes('site')).map(line => line.split(', ')[0]); // rewriting site with the existing values }} it's not the modern style, but "old" ->for loop.
const site = document.querySelectorAll('.plain-text-display, #formatted-ticket-content').textContent.split('\n').filter(line => line.includes('site')).map(line => line.split(', ')[0]);
url: ...target.ext;...,data:document.getelementbyid('field').value , datatype : ....
$amount = 0 ; // value 0 $amount = $row['0']['amtpaid'] ; // by FETCH_ASSOC with lot of rows $amount = $row['0'] ; // one field at index 0 $amount = $_POST ; // a full $_POST array in the var $amount = $_GET['name'] ;// the field 'name' in $_GET $amount = $_COOKIE['id'] ; the value for 'id' pick in the cookie $amount; // discarding the value in, or init a var without value. Php is in C/C++ tail language // as Php is very reliable with "T types" (int) and (double) are 'optional' on lot of servers. those are cast operator, converting Type to one another. unset($amount) ; // free the var and its value, very good when big bunch of datas in a var, or object ( db / db result / curl ... )
Set getSoundDevices = objWMIService.ExecQuery("Select * from Win32_SoundDevice", , 48) // it's 'one way use' in your script
return Array.of(["Admin" , ["/api/masters/wing/manageWing"]]) ; the : as separator belong to JSON, use "," instead.
if( $sessionToken === $postToken ) {return true; }{ return false; }
var ClearSignatureButton = document.getElementById('ClearSignatureButton')
select cinema, month_name, sum(retail) // column needed as answer from tickets, retail // tables required where tickets.cinema = retail.cinema // linking the table , as equal 'join' group by month_name // merging months having MAX(ticket_sold) // applying one more criteria with 'MAX(column)' use