- Right-click the Windows icon and select Run to open the command prompt.
- Type regedit and press Enter.
- Navigate to HKEY_Local_Machine > SOFTWARE > Policies > Microsoft > Windows, then right-click the Windows directory and select New > Key.
- Name the new folder Windows Search.
- Right-click the Windows Search folder and select New > DWORD (32-bit) Value.
- Name the new file AllowCortana.
- Double-click the AllowCortana file to open it, set the value to 0, then select OK.
- Close the Registry Editor and restart your computer.
#1005 – Can’t create table ‘xxxxxx’ (errno: 150) [SOLVED]
If you are using xampp and you encounter this message during creation of a table, i have found that a lot of them pertain to the unit used to reference the field. If the master table used INT (11), when you reference it as a foreign key, you also need to use the same unit INT(11) as well.
In my case it was different. You see, i got this message because the table I used as a foreign key is the table ‘item’ whereas originally it was table ‘item_list’.
So just in case you encounter this one and still have problems, it might be the table name.
Learn and move forward
Coffee Cup
PHP Code for FB Plugin
Here is the code I used in integrating the fb plugin using iframe into the website.
Please replace the fields that require your actual account.
I also included an html tag .
Enjoy,
Coffee Cup
https://developers.facebook.com/docs/plugins/like-button JavaScript SDK Step 1: Include the JavaScript SDK on your page once, ideally right after the opening body tag. <div id="fb-root"></div> <script async defer crossorigin="anonymous" src="https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v14.0" nonce="F1YcA0n6"></script> Step 2: Place this code wherever you want the plugin to appear on your page. <div class="fb-like" data-href="https://www.facebook.com/PoshMotorcycleShop" data-width="200" data-layout="standard" data-action="like" data-size="small" data-share="true"></div> IFrame <iframe src="https://www.facebook.com/plugins/like.php?href=https%3A%2F%2Fwww.facebook.com%2FPoshMotorcycleShop&width=200&layout=standard&action=like&size=small&share=true&height=35&appId" width="200" height="35" style="border:none;overflow:hidden" scrolling="no" frameborder="0" allowfullscreen="true" allow="autoplay; clipboard-write; encrypted-media; picture-in-picture; web-share"></iframe> For Android the URL schema is: fb://page/page_id For iOS the URL schema is: fb://page?id=page_id https://developers.facebook.com/docs/plugins/like-button <html> <head> <title>Your Website Title</title> <!-- You can use open graph tags to customize link previews. Learn more: https://developers.facebook.com/docs/sharing/webmasters --> <meta property="og:url" content="https://www.your-domain.com/your-page.html" /> <meta property="og:type" content="website" /> <meta property="og:title" content="Your Website Title" /> <meta property="og:description" content="Your description" /> <meta property="og:image" content="https://www.your-domain.com/path/image.jpg" /> </head> <body> <!-- Load Facebook SDK for JavaScript --> <div id="fb-root"></div> <script async defer crossorigin="anonymous" src="https://connect.facebook.net/en_US/sdk.js#xfbml=1 &version={graph-api-version} &appId={your-facebook-app-id} &autoLogAppEvents=1" nonce="FOKrbAYI"> </script> <!-- Your like button code --> <div class="fb-like" data-href="https://www.your-domain.com/your-page.html" data-width="" data-layout="standard" data-action="like" data-size="small" data-share="true"> </div> </body> </html>
PHP Date Format
A common mistake that i always do is to forget the strtotime field
Here is where i usually use it.
Enjoy
Coffee Cup
*************************************************** //20221117 if ($pldate != '') { $pldate = date("m/d/Y", strtotime($pldate)); } if ($plcheck_date != '') { $plcheck_date = date("m/d/Y", strtotime($plcheck_date)); } ?> <div id="page-wrapper"> *************************************************** $pltype = $_POST['pltype']; $pltype = htmlspecialchars( $pltype, ENT_QUOTES); //20160904 if ($pldate != '') { $pldate = date("Y-m-d", strtotime($pldate)); } if ($plcheck_date != '') { $plcheck_date = date("Y-m-d", strtotime($plcheck_date)); $plcheck_date2 = date("Y-m-d", strtotime($plcheck_date)); } else { $plcheck_date2 = NULL; } ***************************************************
Delphi + Excel OLE Manipulation (Change Font, Masking and More)
Thought of saving this one here. For those who still use delphi in 2023, here are the features you can access. Just in case you have questions or issues encountered, just drop me a line
Coffee Cup
...control Excel with OLE? Autor: Thomas Stutz [ Print tip ] Tip Rating (503): uses ComObj; var ExcelApp: OleVariant; implementation procedure TForm1.Button1Click(Sender: TObject); const // SheetType xlChart = -4109; xlWorksheet = -4167; // WBATemplate xlWBATWorksheet = -4167; xlWBATChart = -4109; // Page Setup xlPortrait = 1; xlLandscape = 2; xlPaperA4 = 9; // Format Cells xlBottom = -4107; xlLeft = -4131; xlRight = -4152; xlTop = -4160; // Text Alignment xlHAlignCenter = -4108; xlVAlignCenter = -4108; // Cell Borders xlThick = 4; xlThin = 2; var ColumnRange: OleVariant; // Function to get the number of Rows in a Certain column function GetLastLine(AColumn: Integer): Integer; const xlUp = 3; begin Result := ExcelApp.Range[Char(96 + AColumn) + IntToStr(65536)].end[xlUp].Rows.Row; end; begin { Start Excel } // By using GetActiveOleObject, you use an instance of Word that's already running, // if there is one. try ExcelApp := GetActiveOleObject('Excel.Application'); except try // If no instance of Word is running, try to Create a new Excel Object ExcelApp := CreateOleObject('Excel.Application'); except ShowMessage('Cannot start Excel/Excel not installed ?'); Exit; end; end; // Add a new Workbook, Neue Arbeitsmappe ?ffnen ExcelApp.Workbooks.Add(xlWBatWorkSheet); // Open a Workbook, Arbeitsmappe ?ffnen ExcelApp.Workbooks.Open('c:\YourFileName.xls'); // Rename the active Sheet ExcelApp.ActiveSheet.Name := 'This is Sheet 1'; // Rename ExcelApp.Workbooks[1].WorkSheets[1].Name := 'This is Sheet 1'; // Insert some Text in some Cells[Row,Col] ExcelApp.Cells[1, 1].Value := 'SwissDelphiCenter.ch'; ExcelApp.Cells[2, 1].Value := 'http://www.swissdelphicenter.ch'; ExcelApp.Cells[3, 1].Value := FormatDateTime('dd-mmm-yyyy', Now); // Setting a row of data with one call ExcelApp.Range['A2', 'D2'].Value := VarArrayOf([1, 10, 100, 1000]); // Setting a formula ExcelApp.Range['A11', 'A11'].Formula := '=Sum(A1:A10)'; // Change Cell Alignement ExcelApp.Cells[2, 1].HorizontalAlignment := xlright; // Change the Column Width. ColumnRange := ExcelApp.Workbooks[1].WorkSheets[1].Columns; ColumnRange.Columns[1].ColumnWidth := 20; ColumnRange.Columns[2].ColumnWidth := 40; // Change Rowheight / Zeilenh?he ?ndern: ExcelApp.Rows[1].RowHeight := 15.75; // Merge cells, Zellen verbinden: ExcelApp.Range['B3:D3'].Mergecells := True; // Apply borders to cells, Zellen umrahmen: ExcelApp.Range['A14:M14'].Borders.Weight := xlThick; // Think line/ Dicke Linie ExcelApp.Range['A14:M14'].Borders.Weight := xlThin; // Thin line D邦nne Linie // Set Bold Font in cells, Fettdruck in den Zellen ExcelApp.Range['B16:M26'].Font.Bold := True; // Set Font Size, Schriftgr??e setzen ExcelApp.Range['B16:M26'].Font.Size := 12; //right-aligned Text, rechtsb邦ndige Textausrichtung ExcelApp.Cells[9, 6].HorizontalAlignment := xlright; // horizontal-aligned text, horizontale Zentrierung ExcelApp.Range['B14:M26'].HorizontalAlignment := xlHAlignCenter; // left-aligned Text, vertikale Zentrierung ExcelApp.Range['B14:M26'].VerticallyAlignment := xlVAlignCenter; { Page Setup } ExcelApp.ActiveSheet.PageSetup.Orientation := xlLandscape; // Left, Right Margin (Seitenr?nder) ExcelApp.ActiveSheet.PageSetup.LeftMargin := 35; ExcelApp.ActiveSheet.PageSetup.RightMargin := -15; // Set Footer Margin ExcelApp.ActiveSheet.PageSetup.FooterMargin := ExcelApp.InchesToPoints(0); // Fit to X page(s) wide by Y tall ExcelApp.ActiveSheet.PageSetup.FitToPagesWide := 1; // Y ExcelApp.ActiveSheet.PageSetup.FitToPagesTall := 3; // Y // Zoom ExcelApp.ActiveSheet.PageSetup.Zoom := 95; // Set Paper Size: ExcelApp.PageSetup.PaperSize := xlPaperA4; // Show/Hide Gridlines: ExcelApp.ActiveWindow.DisplayGridlines := False; // Set Black & White ExcelApp.ActiveSheet.PageSetup.BlackAndWhite := False; // footers ExcelApp.ActiveSheet.PageSetup.RightFooter := 'Right Footer / Rechte Fu?zeile'; ExcelApp.ActiveSheet.PageSetup.LeftFooter := 'Left Footer / Linke Fu?zeile'; // Show Excel Version: ShowMessage(Format('Excel Version %s: ', [ExcelApp.Version])); // Show Excel: ExcelApp.Visible := True; // Save the Workbook ExcelApp.SaveAs('c:\filename.xls'); // Save the active Workbook: ExcelApp.ActiveWorkBook.SaveAs('c:\filename.xls'); end; procedure TForm1.FormDestroy(Sender: TObject); begin // Quit Excel if not VarIsEmpty(ExcelApp) then begin ExcelApp.DisplayAlerts := False; // Discard unsaved files.... ExcelApp.Quit; end; end;
Bootstrap Website showing Date Picker using PHP
Using angular, a few of the requests were to make the date into a date picker. I have found the code and wanted to share it here
Enjoy,
Coffee Cup
<script src="https://code.jquery.com/jquery-2.2.3.min.js" integrity="sha256-a23g1Nt4dtEYOj7bR+vTu7+T8VP13humZFBJNIYoEJo=" crossorigin="anonymous"></script> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous"> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.6.0/js/bootstrap-datepicker.min.js"></script> <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.6.1/css/bootstrap-datepicker3.min.css"> <script> $( document ).ready(function() { $("#from-datepicker").datepicker({ format: 'yyyy-mm-dd' }); $("#from-datepicker").on("change", function () { var fromdate = $(this).val(); alert(fromdate); }); }); </script> <div class="form-group"> <label>Date</label> <input type="text" id="from-datepicker"/> </div>
“Interface not supported” error when attempting to open Excel or Word from Delphi
When using Delphi that outputs some text into Excel or Word, I encountered the error “Interface not supported” on one machine
The problem was that the previous version of Excel was uninstalled incorrectly on the machine. To fix it, I used these steps :
- Open the regedit editor.
- Open
HKEY_CLASSES_ROOT >> TypeLib >> {00020813-0000-0000-C000-000000000046}
(The Excel PIA key is {00020813-0000-0000-C000-000000000046})
3. Delete the version that you don’t have. Leave only the version that you have instaled. In my case it was Excel 2010 which is 1.7. For Excel 2013 is 1.8, and for Excel 2016 is 1.9
Here are the version controls
Excel HKEY_CLASSES_ROOT\TypeLib{00020813-0000-0000-C000-000000000046}\
- 1.7 is for Office 2010
- 1.8 is for Office 2013
- 1.9 is for Office 2016
Word HKEY_CLASSES_ROOT\TypeLib{00020905-0000-0000-C000-000000000046}\
- 8.5 is for Office 2010
- 8.6 is for Office 2013
- 8.7 is for Office 2016
PowerPoint HKEY_CLASSES_ROOT\TypeLib{91493440-5A91-11CF-8700-00AA0060263B}\
- 2.a is for Office 2010
- 2.b is for Office 2013
- 2.c is for Office 2016
Outlook HKEY_CLASSES_ROOT\TypeLib{00062FFF-0000-0000-C000-000000000046}\
- 9.4 is for Office 2010
- 9.5 is for Office 2013
- 9.6 is for Office 2016
Hope it helps
Coffee Cup
There are seven things that poor people do that the wealthy don’t
This is my first contribution to the field of wealth management. I sincerely hope that I will be able to assist someone in rising above the ruins of poverty. If you’ve had some of these ideas for a long time, it’s advisable to give them away and adapt new ones to help you become financially independent.
- Rich folks read or listen to audio books while poor people watch TV.
Garbage in, garbage out, as the saying goes. When you’re sitting in front of the television, you can’t come up with great ideas or inspirations. The television nowadays has been programmed to keep you captivated to the screen.
I’ve always thought that if you want to progress in life, you have to start with yourself. There is no other way to learn but to read the books written by great leaders about their lives.
Practical applications : You must seek out a mentor. YouTube is the next best thing to a library in my opinion. There are a plethora of success audiobooks and wealth audiobooks to pick from. Look for someone you want to be like. Listen for a time and then go for it if it makes sense.
- Poor people are paid on the basis of time, but wealthy people are rewarded on the basis of results.
You could be the best package counter or server in the restaurant at work. Because of the value you contribute to the market, you have a low income. If ten people can do the same job as you, you aren’t very valued at work.
The wealthy want to make a difference in the world, whether it’s for the environment or for humanity. The rich invest a great amount of time and effort into creating a product that meets a societal need. This is what value creation entails. Athletes are not compensated based on the number of hours they train, but rather on their performance.
Practical applications : You must re-invest in yourself. Study or follow a passion for something you’ve always wanted to do, such as photography or software development. You can study for 365 hours in a year if you study for an hour a day.
- Poor individuals blame others for their misfortune, whereas wealthy people accept responsibility for their own misfortune.
It is often simple for disadvantaged individuals to place blame on others. They can either blame the government or the boss for their position. Some even accuse God and the weather of being to fault. The city in which they resided, as well as their neighbors.
Rich individuals, on the other hand, take responsibility for their actions, whether they are good or harmful. What frequently happens is that wealthy people ponder about the problem or seek expert advice from others to address it.
Practical applications : We all have issues. It should be set aside for the needy. The rain poured on the rich and the poor alike. But there is a solution if you allow your mind to assist you in figuring out how to fix your difficulties.
- Poor people concentrate on saving, whilst wealthy people concentrate on investing.
This is when the uncles and aunts will tell you that we shouldn’t drink Starbucks to save a few bucks here and there. Alternatively, we may fly in economy throughout our trips.
Rich people, on the other hand, concentrate on increasing their wealth. Some investments are hazardous, but they pay off handsomely. The money you earn from your investment is utilized to buy things.
Practical applications : This one is quite difficult to begin. The goal is to set aside at least 40% of your income. We all make adjustments based on how much money we have left. After a year of this, the next stage is to hunt for dividend-paying investment products, such as the stock market or money markets.
- Poor individuals believe they know everything, whereas wealthy people are constantly learning.
Poor people are always expressing their views. They are always keen to share their political and sporting perspectives with the rest of the world. The most recent rumor or scoop in the society.
Wealthy people are perpetually humble and willing to learn. They often hang out with people who are wiser than they are.
Practical applications : You’ll need to surround yourself with business people or those who want to be business people for this one. If you want to be a competent app developer, choose someone to model yourself after. However, it is important to remember to replicate the great aspects of life and avoid the negative ones.
- Poor people believe money is the source of all evil, but wealthy people believe poverty is the source of all evil.
When we think of poor neighborhoods, we think of criminals, drugs, and a variety of other problems. If you think about it, bank robbers are not wealthy people. Money is a tool that may be used for either good or evil.
Rich people, on the other hand, began with the intention of assisting others. The money will then follow. They are compensated for solving challenges.
Practical applications : For a long time, families have avoided discussing money with their children, leaving them unsure of what to do with the money when it arrives. We need to modify this to show that money isn’t the problem; it’s what you do with it that is. You can still choose to use it for good or evil.
- The poor have a lottery mentality, while the wealthy have an action mentality.
People who are poor desire to buy lottery tickets. Winning is the only way to become wealthy. It’s all a coincidence. People who are wealthy take action. We’re confident that we’ll be able to pull it off. Do not put your faith on a lottery ticket.
Practical applications : Being reliant on luck has never made anyone wealthy. The term “burning the midnight oil” is one that everyone seems to be scared of. Rich people aren’t afraid to work all day if it means they’ll get closer to their objectives.
Video link : https://youtu.be/6c0d9Jlr8JE
Contact Us – How to send email with attachment in PHP
I have done a lot of contact us page in websites before and this one, i had to add email attachments as well. The secret to it was to upload it to your website before you can send it as an email attachment.
Recently I found a great website that does that.
Hope it helps somebody out there
Coffee Cup
<?php
// Recipient
$to = '[email protected]';
// Sender
$from = '[email protected]';
$fromName = 'CodexWorld';
// Email subject
$subject = 'PHP Email with Attachment by CodexWorld';
// Attachment file
$file = "files/codexworld.pdf";
// Email body content
$htmlContent = '
<h3>PHP Email with Attachment by CodexWorld</h3>
<p>This email is sent from the PHP script with attachment.</p>
';
// Header for sender info
$headers = "From: $fromName"." <".$from.">";
// Boundary
$semi_rand = md5(time());
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
// Headers for attachment
$headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$mime_boundary}\"";
// Multipart boundary
$message = "--{$mime_boundary}\n" . "Content-Type: text/html; charset=\"UTF-8\"\n" .
"Content-Transfer-Encoding: 7bit\n\n" . $htmlContent . "\n\n";
// Preparing attachment
if(!empty($file) > 0){
if(is_file($file)){
$message .= "--{$mime_boundary}\n";
$fp = @fopen($file,"rb");
$data = @fread($fp,filesize($file));
@fclose($fp);
$data = chunk_split(base64_encode($data));
$message .= "Content-Type: application/octet-stream; name=\"".basename($file)."\"\n" .
"Content-Description: ".basename($file)."\n" .
"Content-Disposition: attachment;\n" . " filename=\"".basename($file)."\"; size=".filesize($file).";\n" .
"Content-Transfer-Encoding: base64\n\n" . $data . "\n\n";
}
}
$message .= "--{$mime_boundary}--";
$returnpath = "-f" . $from;
// Send email
$mail = @mail($to, $subject, $message, $headers, $returnpath);
// Email sending status
echo $mail?"<h1>Email Sent Successfully!</h1>":"<h1>Email sending failed.</h1>";
?>
How to Fix Windows 10 “Cannot Connect to Printer” – Error 0x0000011b
I have a case that a newly installed windows 10 pc, although already shared the 2 printers, the pc on the network cannot establish share.
The system says ‘Connect to Printer’ error.
What you can do is to go to registry editor,
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print
right click and create new DWORD 32 Bit
RpcAuthnLevelPrivacyEnabled
right click and click Modify. it should be hexadecimal with 0
Next is to open the windows services and look for PrinterSpool
Then right click and then click RESTART
After that, you can now use File Explorer to add the printer remote thru the network.
Hope it helps
Coffee Cup