Finally, my free space!

25th June 2016 Welcome page No comments

Here we go, finally I established my blog, or actually “my free space” as I love to call it. 😉

I established this blog in order to publish code related articles, code hints, code workarounds and tips and tricks.

Here’s a small brief about me ( not small enough 😀 ).

It’s me Said Abdul Aziem Mohamed, a Webmaster Manager at DMG Group. I have a passion for User Experience and Web Development.

Everything I know about UI, UE, CSS, HTML, jQuery, PHP and MySQL was all self taught by looking online and buying books and video tutorials related to UX and Web Development. I have been continuously employed since high school and throughout college, which helped ramp me to my current positions at DMG. I’m also in love with my current position at DMG as Webmaster Manager.

I am discovering that I seriously enjoy user flow, User Experience and Web Development, and would like to transition my career towards this wire-framing and development path.

I love figuring out what makes users tick and click, also I adore developing easy to use and smooth back-ends.

I also am getting serious about my Web Design, so feel free to message me if you would like a web design, psd to html/css or anything else! I would currently like to learn (or get to know better): User Experience Research, SASS, HTML 5, jQuery/jQuery-UI, JavaScript, AJAX, IOS Development. ——-

Interesting Points of Discussion ——-

  1. What’s more important? Creating a product to create fantastic metrics? Or creating a product that creates a “good feeling” and a lasting impression?
  2. When should you use tables, and when should you use CSS? Always CSS for presentation, of course! But sometimes divinities will get you down. How do you get around that?
  3. Find me a way to wrap a really long word (like supercalifragilisticexpialidocious) onto the next line of a 20px width div in CSS that works in all browsers. (?)
  4. When to use CMS, and when to start a “From Scratch” website? Specialties: HTML Markup, CSS, User Experience, User Interface, Photoshop, Photography, Agile, JIRA, PHP, OOP, JavaScript, jQuery, PHP Frameworks.

Czy logowanie na urządzeniach z różnymi przeglądarkami jest intuicyjne w Janusz Casino Logowanie?

25th June 2025 Uncategorised No comments

Czy logowanie na urządzeniach z różnymi przeglądarkami jest intuicyjne w Janusz Casino Logowanie?

Table of Contents

Jakie są wymagania dotyczące logowania w Janusz Casino?

Wymagania dotyczące logowania w Janusz Casino są dość standardowe, co ułatwia proces zarówno dla nowych, jak i doświadczonych graczy. Aby zalogować się na swoje konto, użytkownik musi posiadać zarejestrowane konto, co oznacza, że wcześniej musiał przejść przez proces rejestracji. Wymagane są podstawowe dane, takie jak adres e-mail, hasło oraz, w niektórych przypadkach, dodatkowe informacje weryfikacyjne.

Użytkownicy powinni również zaktualizować swoje dane, aby uniknąć problemów z logowaniem. W przypadku zapomnienia hasła, Janusz Casino oferuje prosty proces resetowania, który jest dostępny na stronie logowania. Użytkownicy powinni pamiętać, że logowanie na urządzeniach mobilnych i stacjonarnych może różnić się nieco w zależności od przeglądarki, co ma znaczenie dla wygody korzystania z platformy.

Jakie przeglądarki są wspierane przez Janusz Casino?

Janusz Casino obsługuje szereg popularnych przeglądarek, co zapewnia użytkownikom elastyczność w wyborze urządzenia do logowania. Najczęściej używane przeglądarki to Google Chrome, Mozilla Firefox, Safari oraz Microsoft Edge. Każda z tych przeglądarek ma swoje unikalne cechy, co może wpływać na sposób, w jaki użytkownicy doświadczają logowania.

Warto zauważyć, że Janusz Casino stale aktualizuje swoją platformę, aby zapewnić pełne wsparcie dla najnowszych wersji przeglądarek. Użytkownicy powinni jednak unikać korzystania z przestarzałych wersji, ponieważ mogą one powodować problemy z logowaniem i dostępnością funkcji. Szczególnie w przypadku przeglądarek mobilnych, takich jak Opera Mini, użytkownicy mogą napotkać różne ograniczenia, które mogą utrudniać proces logowania.

Porównanie logowania na różnych przeglądarkach

W momencie logowania użytkownicy mogą zauważyć różnice w doświadczeniach w zależności od wybranej przeglądarki. Na przykład, logowanie na Google Chrome często jest najszybsze, dzięki jego optymalizacji i wsparciu dla nowoczesnych technologii webowych. Z kolei Mozilla Firefox może oferować lepszą prywatność, co jest istotne dla niektórych graczy.

Przykładowo, przy logowaniu na Safari, użytkownicy mogą napotkać ograniczenia związane z ustawieniami prywatności, co może wymagać dodatkowych kroków, aby zaakceptować pliki cookie. Warto zatem przeprowadzić testy na różnych przeglądarkach i wybrać tę, która najlepiej odpowiada indywidualnym preferencjom. Użytkownicy mogą również skorzystać z dostępnych zasobów online, aby znaleźć optymalne ustawienia dla swojej przeglądarki.

Problemy z logowaniem na starych przeglądarkach

Logowanie na starych wersjach przeglądarek może prowadzić do wielu problemów. Użytkownicy często zgłaszają trudności z wczytywaniem strony logowania lub z błędami w zakresie weryfikacji danych. Wiele nowoczesnych funkcji zabezpieczeń, takich jak SSL, może nie działać poprawnie na przestarzałych przeglądarkach, co naraża użytkowników na ryzyko.

Aby uniknąć tych problemów, rekomenduje się regularne aktualizowanie przeglądarek do najnowszej wersji. Użytkownicy, którzy korzystają z nieaktualnych przeglądarek, mogą również nie mieć dostępu do najnowszych funkcji oferowanych przez Janusz Casino. W rezultacie ich doświadczenie może być znacznie gorsze niż w przypadku korzystania z aktualnych wersji przeglądarek.

Jak poprawić doświadczenie logowania w Janusz Casino?

Aby poprawić doświadczenie logowania, użytkownicy powinni zwrócić uwagę na kilka kluczowych elementów. Przede wszystkim, dobrze jest korzystać z silnych i unikalnych haseł, które można przechowywać w menedżerze haseł. Dodatkowo, warto rozważyć włączenie dwuetapowej weryfikacji, co znacząco zwiększa bezpieczeństwo konta.

Innym aspektem jest optymalizacja ustawień przeglądarki. Użytkownicy powinni upewnić się, że pliki cookie są włączone, a blokady reklamowe nie zakłócają procesu logowania. Czasami, aby uzyskać najlepsze wyniki, warto przetestować różne przeglądarki i porównać, która z nich oferuje najlepsze wrażenia z logowania. Warto również śledzić aktualizacje i komunikaty od Janusz Casino, które mogą dotyczyć zmian w procesie logowania.

Funkcje bezpieczeństwa w procesie logowania

Bezpieczeństwo jest kluczowym aspektem każdego procesu logowania, zwłaszcza w przypadku platform hazardowych, takich jak Janusz Casino. Serwis stosuje wiele zaawansowanych technologii zabezpieczeń, aby chronić dane użytkowników. Wśród nich znajduje się szyfrowanie SSL, które zapewnia, że informacje przesyłane między użytkownikiem a serwisem są bezpieczne.

Dodatkowo, Janusz Casino wprowadza regularne kontrole bezpieczeństwa oraz aktualizacje, aby przeciwdziałać potencjalnym zagrożeniom. Użytkownicy są również zachęcani do korzystania z dwuetapowej weryfikacji, co znacząco zmniejsza ryzyko nieautoryzowanego dostępu do konta. Wartościowe jest również monitorowanie aktywności konta, aby szybko reagować na wszelkie nieprawidłowości.

Opinie użytkowników na temat logowania w Janusz Casino

Opinie użytkowników na temat logowania w Janusz Casino są mieszane. Wielu graczy chwali sobie intuicyjny interfejs oraz prosty proces logowania. Użytkownicy zazwyczaj podkreślają, że logowanie jest szybkie i bezproblemowe, co pozwala im skupić się na grze.

Z drugiej strony, niektórzy użytkownicy zgłaszają problemy z logowaniem na starszych przeglądarkach lub urządzeniach mobilnych. Często wymieniają frustracje związane z błędami w weryfikacji danych lub wolnym wczytywaniem się strony. Warto zauważyć, że doświadczenia mogą się różnić w zależności od indywidualnych ustawień i sprzętu, dlatego warto przeprowadzić dokładną analizę przed podjęciem decyzji o wyborze przeglądarki.

Jakie są alternatywy dla Janusz Casino logowania?

Dla osób poszukujących alternatyw dla Janusz Casino, istnieje wiele innych platform hazardowych oferujących różne podejścia do logowania. Niektóre z nich, takie jak Bet365 czy 888 Casino, oferują podobne funkcje, ale z różnymi opcjami logowania, takimi jak logowanie za pomocą mediów społecznościowych czy aplikacji mobilnych.

Warto jednak pamiętać, że każda platforma ma swoje unikalne wymagania i procedury logowania. Dlatego przed podjęciem decyzji o przejściu do innego serwisu, warto dokładnie zapoznać się z jego warunkami użytkowania oraz dostępnością funkcji, które są dla użytkownika istotne. Alternatywy mogą również oferować różne bonusy powitalne, które mogą wpłynąć na decyzję o wyborze serwisu.

Przyszłość logowania w Janusz Casino

Przyszłość logowania w Janusz Casino wydaje się być obiecująca, zwłaszcza w obliczu rosnącej konkurencji na rynku hazardowym. Serwis planuje wprowadzenie nowych funkcji, które mają na celu uproszczenie procesu logowania oraz zwiększenie bezpieczeństwa użytkowników. Możliwe jest wprowadzenie biometrii lub logowania za pomocą jednego kliknięcia, co z pewnością poprawiłoby komfort korzystania z platformy.

Dodatkowo, Janusz Casino może również skupić się na poprawie doświadczeń użytkowników na urządzeniach mobilnych, co jest kluczowe w dobie rosnącej popularności gier hazardowych na smartfonach. Udoskonalenie aplikacji mobilnej oraz dostosowanie interfejsu do różnych rozmiarów ekranów to kroki, które mogą przyciągnąć nowych graczy oraz zatrzymać obecnych.

Podsumowanie doświadczeń logowania w Janusz Casino

Podsumowując, logowanie w Janusz Casino jest w przeważającej części intuicyjne, zwłaszcza na nowoczesnych przeglądarkach. Użytkownicy doceniają prostotę oraz szybkość tego procesu, co pozwala na łatwe rozpoczęcie gry. Warto jednak pamiętać o potencjalnych problemach z logowaniem na starszych przeglądarkach oraz urządzeniach mobilnych.

Z perspektywy użytkownika, kluczowe jest, aby być na bieżąco z aktualizacjami oraz zaleceniami dotyczącymi bezpieczeństwa, co znacząco wpłynie na komfort korzystania z platformy. Janusz Casino ma przed sobą wiele możliwości rozwoju, co może przynieść jeszcze lepsze doświadczenia w przyszłości.

How to Minimize Payout Wait Times for Ontario Users with ToonieBet Withdrawal Time.

24th June 2025 Uncategorised No comments

How to Minimize Payout Wait Times for Ontario Users with ToonieBet Withdrawal Time.

Table of Contents

Understanding the ToonieBet Withdrawal Process

The withdrawal process at ToonieBet is designed to be straightforward, yet understanding the nuances can significantly affect the speed of your payouts. When you decide to withdraw funds, the platform first requires you to initiate the request through your account dashboard. This request is sent to the financial department, where it undergoes verification. During this stage, ToonieBet ensures that all withdrawal requests are legitimate, which can sometimes add to the processing time.

Once your request is verified, the actual withdrawal time can vary significantly depending on the method chosen. Players should be aware that while some methods are instantaneous, others may take several business days. Therefore, knowing how the process works, including the verification stage and the subsequent transfer to your chosen payment method, is crucial for minimizing wait times.

Various Withdrawal Methods and Their Times

ToonieBet offers a variety of withdrawal methods to accommodate the preferences of its users. Common options include bank transfers, e-wallets like PayPal and Skrill, and prepaid cards. Each method has its own unique processing times, which can significantly impact how quickly you receive your funds.

For instance, e-wallet withdrawals are often processed within 24 hours, making them one of the fastest options available. In contrast, bank transfers may take up to five business days to complete. Understanding these timelines can help users make informed decisions about which method to use based on their immediate needs. Below is a table summarizing the various withdrawal methods and their typical processing times:

Withdrawal Method Typical Processing Time
Bank Transfer 3-5 Business Days
PayPal Instant – 24 Hours
Skrill Instant – 24 Hours
Prepaid Card 1-3 Business Days

Common Reasons for Withdrawal Delays

Understanding the common reasons for withdrawal delays can empower users to avoid them. The most prevalent issues include incomplete account verification, insufficient funds in the player’s account, or discrepancies in banking information. If your account is not fully verified, ToonieBet may hold your withdrawal request until all documentation is confirmed. This verification process is critical for both security and compliance with gaming regulations.

Additionally, if there are any discrepancies in the banking details you provided, such as a mismatch with the name on your account or incorrect bank account numbers, it can lead to delays. Users must ensure that all submitted details are accurate and up to date to facilitate a smooth withdrawal process.

Verifying Your Account to Speed Up Withdrawal

ToonieBet requires users to verify their accounts before processing withdrawals. This step is not just a formality but a crucial aspect that can significantly impact the speed of your payout. By verifying your account early on, you can avoid unnecessary delays when you wish to withdraw your winnings. The verification process typically involves submitting identification documents, proof of address, and, in some cases, proof of payment method.

To expedite this process, it’s advisable to prepare these documents in advance and submit them as soon as you create your account. This proactive approach helps ToonieBet to verify your identity quickly, ensuring that you can withdraw funds without unnecessary waiting periods.

How to Choose Your Withdrawal Method Effectively

Choosing the right withdrawal method can greatly influence your payout wait times. When selecting a method, consider both the speed of processing and any associated fees. For example, while e-wallets typically offer quicker processing times, some may charge fees for withdrawals. On the other hand, bank transfers may not incur fees, but they usually take longer.

Another factor to consider is the availability of your preferred method. Not all users may have access to certain e-wallets or cards, especially if they are not widely used in Canada. Therefore, it’s essential to weigh the benefits of speed against potential costs and accessibility when making your decision.

Understanding ToonieBet Withdrawal Limits

ToonieBet has established specific withdrawal limits based on the method chosen and your account status. Understanding these limits is essential to plan your withdrawals effectively. For instance, while e-wallets might allow quicker access to funds, they often come with lower withdrawal caps compared to traditional bank transfers.

Being aware of your withdrawal limits can help you avoid situations where you might need to make multiple smaller withdrawals, which can be time-consuming. Additionally, if you find yourself consistently hitting your withdrawal limits, consider upgrading your account or verifying any additional documentation that could raise your limits.

The Role of Banking in Withdrawal Times

The banking institutions involved in the withdrawal process also play a crucial role in determining how quickly you receive your funds. Different banks have varying processing times for incoming transfers, which can affect your overall payout time. For example, some banks may process e-wallet transfers instantly, while others may take a few business days to reflect the funds in your account.

Moreover, weekends and public holidays can also delay processing times, especially for bank transfers. Users should be mindful of these factors when planning their withdrawals. If you expect to receive funds quickly, it might be beneficial to use an e-wallet or other faster payment options.

How to Track Your Withdrawal Status

To stay informed about the status of your withdrawal, ToonieBet offers a tracking feature within their platform. After initiating a withdrawal, you can log into your account and check the status of your request. This feature provides transparency and helps you understand if your request is pending, processed, or completed.

In addition to online tracking, users can also reach out to ToonieBet’s customer support for updates. This can be especially useful if you encounter any unexpected delays. Having clear communication with customer support can provide you with peace of mind and assist in resolving any issues quickly.

Tips for Faster Withdrawals

To ensure that you receive your payouts as quickly as possible, consider implementing the following tips. First, always verify your account immediately after registration. By doing so, you eliminate potential delays when you decide to withdraw your funds. Additionally, choose your withdrawal method wisely by selecting the fastest option available to you.

Another helpful tip is to keep your banking information up to date. Ensuring that all details are correct will minimize the chances of discrepancies that could hold up your withdrawals. Lastly, consider withdrawing during weekdays to avoid delays associated with weekends and holidays.

The Benefits of Using ToonieBet for Gambling

ToonieBet offers several benefits that make it an appealing choice for Ontario users. First and foremost, the platform is fully licensed and regulated, ensuring a safe and secure gambling environment. This regulatory compliance means that users can trust that their funds and personal information are well protected.

In addition to security, ToonieBet provides a wide variety of games and betting options, catering to the diverse preferences of players. The user-friendly interface ensures that even newcomers can navigate the site with ease. Furthermore, the availability of multiple withdrawal methods enhances the overall user experience, allowing players to choose the option that suits them best. For those looking for a reputable online casino, ToonieBet Casino stands out as a top choice.

Fast Export of Large MySQL Data to Excel using Laravel and Python

30th September 2023 Uncategorised No comments

Introduction:
Handling large datasets can be a challenge. When tasked with exporting thousands of rows from a MySQL database using Laravel, I found traditional methods lacking. This article showcases a solution that marries Laravel, Python, and Pandas for efficient data export.

Why Python with Pandas?
Python’s Pandas module is a powerhouse for data manipulation. Its prowess in swiftly exporting large datasets to Excel makes it an attractive choice for this challenge.

Integrating Symfony/Process in Laravel:
The symfony/process extension in PHP is our bridge to the Python world. It facilitates the execution of shell commands, in this case, running our Python script.

Laravel Export Function:
This function is the core of our solution. Here’s a breakdown:

$result = DB::table('full_report');
// ... [Database querying based on request parameters]
$sql = $result->toSql();
$bindings = $result->getBindings();
$filledSql = vsprintf(str_replace('?', "'%s'", $sql), $bindings);
$filename = 'FullReport-' . Carbon::now()->timestamp . '.xlsx';
$process = new Process(['/opt/homebrew/bin/python3', 'export.py', $filledSql, $filename]);
$process->run();
if (!$process->isSuccessful()) {
    throw new ProcessFailedException($process);
}
return response()->json(['success' => 'Export started successfully!']);

Abstract:
The function begins by querying the database based on request parameters. It then generates the SQL query and its bindings. Finally, using the Symfony Process, it runs the Python script, passing the SQL query and filename as arguments.

AJAX Request:
The AJAX request serves as the trigger for our export function.

$.ajax({
    // ... [AJAX setup and data parameters]
    success: function(response) {
        if (response.success) {
            console.log("Success:", response.success);
        }
    },
    error: function(error) {
        console.error("Error:", error);
    }
});

Abstract:
This asynchronous request sends data parameters to the server. Upon successful data export, it provides feedback to the user. In case of errors, they are logged for debugging.

Python Script (export.py):
This script is responsible for fetching and exporting the data.

import pandas as pd
import mysql.connector
import sys
import os
# ... [Database connection setup]
query = sys.argv[1]
filename = sys.argv[2]
df = pd.read_sql(query, cnx);
storage_path = os.path.join(os.path.dirname(__file__), '..', 'storage', 'app', 'public');
os.makedirs(storage_path, exist_ok=True);
df.to_excel(os.path.join(storage_path, filename), index=False);
cnx.close();

Abstract:
The script connects to the MySQL database using mysql.connector. It then fetches the data using Pandas based on the SQL query passed from Laravel. The data is saved as an Excel file in Laravel’s storage directory.

Conclusion:
By combining Laravel, Python, and Pandas, we achieve:

  • Speed: Rapid export of large datasets.
  • Flexibility: Harnessing the strengths of both PHP and Python.
  • Background Processing: Ensuring system responsiveness.

In web development, such integrative solutions can lead to enhanced efficiency and user satisfaction.

Teaser Slider

22nd March 2018 JavaScript and jQuery 6 comments

I have been looking for a while for a teaser slide the could do the following:

  1. Simple slider functionality.
  2. An option to tease for the next slide by small image within each slide.

All I found are normal slides that display a part of next slide. But what if I need to just promote with a small image, that not a must to be a part of next slide, while it’s like an Ad for it only.

That’s why I made this slider from scratch.

Here’s the Git Repository:

Teaser Slider Repository

Here’s the one page code, and your images should be inside ‘slides’ folder or whatever you want 😉

<!DOCTYPE html>
<html>
<head>
    <title>CairoCode Slider</title>
    <style>
        /*-CairoCoder Slide-*/
        .cc-wrapper {
            width: 960px;
            max-height: 495px;
            overflow: hidden;
            position: relative;
        }
        .cc-slide {
            display: none;
        }
        .cc-slide.cc-active {
            display: block;
        }
        .slide {
            width: 100%;
            float: left;
            height: auto;
        }
        .teaser {
            float: left;
            max-height: 100%;
            position: absolute;
            top: 0;
            right: -15%;
            opacity: 0.8;
            cursor: pointer;
            border-radius: 5px 0 0 5px;
            transition-timing-function: ease-in;
            transition: 0.25s;
        }
        .teaser:hover {
            right: 0;
            opacity: 1;
            transition-timing-function: ease-out;
            transition: 0.25s;
        }
    </style>
</head>
<body>
<div class="cc-slider">
    <ul class="cc-wrapper">
        <li class="cc-slide cc-active">
            <img class="slide" src="slides/slide1.png" alt="slide1">
            <img class="teaser" src="slides/teaser1.png" alt="teaser1">
        </li>
        <li class="cc-slide">
            <img class="slide" src="slides/slide2.png" alt="slide2">
            <img class="teaser" src="slides/teaser2.png" alt="teaser2">
        </li>
    </ul>
</div>
<script src="https://code.jquery.com/jquery-3.3.1.min.js"
        integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
        crossorigin="anonymous"></script>
<script>
    $('.teaser').click(function () {
        var next = $(this).parent().next('.cc-slide');
        $(this).parent().hide();
        if (next.length > 0) {
            next.show();
        } else {
            $('.cc-slide').hide().first().show();
        }
    });
</script>
</body>
</html>

How to shorten (terminal) command line (bash) prompt (hide computer name and user name) for Mac users and Linux

10th April 2017 Uncategorised No comments

Mac’s display name and username occupy space on the command line. some users who are working regularly on terminal may be disturbed by how long the computer name and username appears on the terminal line, here’s how to hide them.

Open Terminal, then go to Terminal menu > Preferences > Shell then select “Run command:” and write the following command:

PS1=”\w\$”;clear;

And here we go, no more computer name and username 🙂

 

Buttons should not have a “hand cursor” !

25th March 2017 UI No comments

han cursor

The hand cursor is for links

The hand (and often underlined text) signifies a link. Links are not buttons. Links came along with the web. To help users understand that they are different, they are given the hand cursor. It serves as an extra clue. Here’s why:

  1. Clicking a link opens a web page or resource.
  2. (On desktop) I can right-click on a link and do many things (that I can’t do with a button). Open in new tab/window, save a link, copy address, add to reading list, bookmark it and more.
  3. (On mobile devices) I can tap and hold on a link and get a similar context menu as per the previous point.
  4. A link also tells me that I am just going somewhere else. I am not modifying any data or making changes in anyway (like a button is likely to do).

When a button has the hand cursor, it subtly suggests that the user is interacting with a link when they’re not. If you want to give visual feedback when the user hovers, you can do so with other style changes such as background colour. A well-designed button does not need a hand cursor to help the user realise it does something.

The hand cursor is reserved for links. This is because they are unique in their behaviour. Browsers and Operating Systems have done the work for you — because contrary to popular belief — browsers know best.

Links have always been handled this way since the web came along — this is the convention of the web that you need not innovate on. You can rest easy knowing that browsers have you covered. This leaves you and your team to solve real problems.

Microsoft’s design guides talk about weak affordance:

Text and graphics links use a hand […] pointer […] because of their weak affordance. While links may have other visual clues to indicate that they are links (such as underlines and special placement), displaying the hand pointer on hover is the definitive indication of a link.

To avoid confusion, it is imperative not to use the hand pointer for other purposes. For example, command buttons already have a strong affordance, so they don’t need a hand pointer. The hand pointer must mean “this target is a link” and nothing else.

Apple’s Human Interface Guidelines states that the hand cursor should be used when “the content is a URL link”. W3C User Interface guidelines says the same thing again with “The cursor is a pointer that indicates a link”.

Reference:
Buttons shouldn’t have a hand cursor

Get data from specific table within past x of months

4th September 2016 MySQL No comments

Here’s how to get data from specific table within past 20 months of current data.

The problem is that you need to get exactly the start of first month in the same period in the criteria you specified. in below MySQL query, you can achieve that easily.

SELECT * FROM `table`
WHERE `date` BETWEEN DATE_SUB(DATE_SUB(CURDATE(), INTERVAL 20 MONTH), INTERVAL DAY(DATE_SUB(CURDATE(), INTERVAL 20 MONTH)) -1 DAY) AND CURDATE()

Prevent CSS and JavaScript files caching !

4th September 2016 JavaScript and jQuery No comments

Simple Client-side Technique

In general, caching is good.. So there are a couple of techniques, depending on whether you’re fixing the problem for yourself as you develop a website, or whether you’re trying to control cache in a production environment.

General visitors to your website won’t have the same experience that you’re having when you’re developing the site. Since the average visitor comes to the site less frequently (maybe only a few times each month, unless you’re a Google or hi5 Networks), then they are less likely to have your files in cache, and that may be enough. If you want to force a new version into the browser, you can always add a query string to the request, and bump up the version number when you make major changes:

<script src="/myJavascript.js?version=4"></script>

This will ensure that everyone gets the new file. It works because the browser looks at the URL of the file to determine whether it has a copy in cache. If your server isn’t set up to do anything with the query string, it will be ignored, but the name will look like a new file to the browser.

On the other hand, if you’re developing a website, you don’t want to change the version number every time you save a change to your development version. That would be tedious.

So while you’re developing your site, a good trick would be to automatically generate a query string parameter:

<!-- Development version: -->
<script>document.write('<script src="/myJavascript.js?dev=' + Math.floor(Math.random() * 100) + '"\><\/script>');</script>

Adding a query string to the request is a good way to version a resource, but for a simple website this may be unnecessary. And remember, caching is a good thing.

It’s also worth noting that the browser isn’t necessarily stingy about keeping files in cache. Browsers have policies for this sort of thing, and they are usually playing by the rules laid down in the HTTP specification. When a browser makes a request to a server, part of the response is an EXPIRES header.. a date which tells the browser how long it should be kept in cache. The next time the browser comes across a request for the same file, it sees that it has a copy in cache and looks to the EXPIRES date to decide whether it should be used.

So believe it or not, it’s actually your server that is making that browser cache so persistent. You could adjust your server settings and change the EXPIRES headers, but the little technique I’ve written above is probably a much simpler way for you to go about it. Since caching is good, you usually want to set that date far into the future (a “Far-future Expires Header”), and use the technique described above to force a change.

If you’re interested in more info on HTTP or how these requests are made, a good book is “High Performance Web Sites” by Steve Souders. It’s a very good introduction to the subject.

Another useful article:

Can We Prevent CSS Caching?

Get the “text” of the selected “option” using PHP and JavaScript

19th August 2016 JavaScript and jQuery, PHP No comments

This is not something that can be done through PHP alone. The PHP script can only “see” the information which is posted (the value for the selected option that is posted). You can use javascript to alter a hidden input field with the text contents of a selected option, and this will be included in the $_POST array:

<form  action="test.php"  method="POST">  
    <select id="test" onchange="document.getElementById('text_content').value=this.options[this.selectedIndex].text">
     <option value="1">Test One</option>
     <option value="2">Test Two</option>
    </select>

<input type="hidden" name="test_text" id="text_content" value="" />
</form>

 

This will make the $_POST['test_text'] available with the selected index (but you should also force the onchange() function when the page loads so that it will be populated even if the user leaves the select field at the default value.

Differences between INDEX, PRIMARY, UNIQUE, FULLTEXT in MySQL

28th July 2016 MySQL No comments

Differences

  • KEY or INDEX refers to a normal non-unique index. Non-distinct values for the index are allowed, so the index may contain rows with identical values in all columns of the index. These indexes don’t enforce any restraints on your data so they are used only for making sure certain queries can run quickly.
  • UNIQUE refers to an index where all rows of the index must be unique. That is, the same row may not have identical non-NULL values for all columns in this index as another row. As well as being used to speed up queries, UNIQUE indexes can be used to enforce restraints on data, because the database system does not allow this distinct values rule to be broken when inserting or updating data.Your database system may allow a UNIQUE index to be applied to columns which allow NULL values, in which case two rows are allowed to be identical if they both contain a NULL value (the rationale here is that NULL is considered not equal to itself). Depending on your application, however, you may find this undesirable: if you wish to prevent this, you should disallow NULL values in the relevant columns.
  • PRIMARY acts exactly like a UNIQUE index, except that it is always named ‘PRIMARY’, and there may be only one on a table (and there should always be one; though some database systems don’t enforce this). A PRIMARY index is intended as a primary means to uniquely identify any row in the table, so unlike UNIQUE it should not be used on any columns which allow NULL values. Your PRIMARY index should be on the smallest number of columns that are sufficient to uniquely identify a row. Often, this is just one column containing a unique auto-incremented number, but if there is anything else that can uniquely identify a row, such as “countrycode” in a list of countries, you can use that instead.Some database systems (such as MySQL’s InnoDB) will store a table’s records on disk in the order in which they appear in the PRIMARY index.
  • FULLTEXT indexes are different from all of the above, and their behaviour differs significantly between database systems. FULLTEXT indexes are only useful for full text searches done with the MATCH() / AGAINST() clause, unlike the above three – which are typically implemented internally using b-trees (allowing for selecting, sorting or ranges starting from left most column) or hash tables (allowing for selection starting from left most column).Where the other index types are general-purpose, a FULLTEXT index is specialised, in that it serves a narrow purpose: it’s only used for a “full text search” feature.

Similarities

  • All of these indexes may have more than one column in them.
  • With the exception of FULLTEXT, the column order is significant: for the index to be useful in a query, the query must use columns from the index starting from the left – it can’t use just the second, third or fourth part of an index, unless it is also using the previous columns in the index to match static values. (For a FULLTEXT index to be useful to a query, the query must use all columns of the index.)