Community Member Featured
Member Avatar
Featured cereal 1,298 Gave Reputation to Reverend Jim in Visual Regular Expressions
For anyone who is having trouble with regular expressions, I suggest you have a look at [this site](https://regexper.com/#%5Cd%7B1%2C3%7D) by Jeff Avallone. It takes a regular expression in the native (cryptic) format and produces a visual display of the same expression. For example,

^[a-z0-9_-]{3,16}$

becomes

![Screenshot_(10).png](/attachments/large/3/8a654e76556ecc115d044b9d7626b810.png "align-center")

and the pattern for … First Post in Topic by Reverend Jim in Software Development
Member Avatar
I'm currently working on multithreading with PyAudio and Pygame, but when I try to run the audio, I get an error saying "OSError: [Errno -9996] Invalid output device (no default output device)."

So far I've tried these on Terminal:


>>> import pyaudio
>>> pa = pyaudio.PyAudio()

>>> pa.get_default_input_device_info()
{'name': 'Built-in … Topic by Christine_7 in Software Development
Member Avatar
Topic by UI in Web Development
php
In the specific case of Twitter, there is an API that allows to search through the public tweets of a specific account:

* https://dev.twitter.com/rest/public/search

You can check the libraries used to connect this service here and see how it is done:

* https://dev.twitter.com/resources/twitter-libraries#php

If you want to check the contents … Reply by cereal
Member Avatar
Pros,


Imagine you want to only provide your download link to those who tweet about you. Now, how would you code it ?
Let's make it simple for you to understand.
Let's say you want to write a php script that checks if a certain html element (eg. name=username) or … Topic by UI in Web Development
php
Member Avatar
Topic by klaus.veliu in Web Development
Ah the old sprintf ploy, eh? +1 sorry can.t give comment as on mobile. Wish Dani would sort that out! Reply by diafol
Member Avatar
Topic by klaus.veliu in Web Development
In addition: consider that a bind can be defined in the execute() method, so:

$stmt->execute([':id' => $id]);

You could change the queries to whitelist some expressions and add it as a variable, something like this should work and allow you to define multiple conditions:

$sql = "SELECT * FROM `names` … Reply by cereal
Member Avatar
Topic by klaus.veliu in Web Development
Hi,

`IS NOT NULL` is not a string, [it's an expression](https://dev.mysql.com/doc/refman/5.7/en/expressions.html). So, as far as I know, you cannot bind it into a prepared statement. Do two queries:

if($gjendja_id > 0)
{
$stmt = $dbconnection->prepare('SELECT a.dokumenti, a.datafillimit, a.datambarimit, b.programi, c.lloji_diplomes, d.ial, e.akreditimi FROM programet_akreditimet AS a INNER JOIN programet AS … Reply by cereal
Member Avatar
Hello,

Recently I am starting to code my scripts in PDO method to manage the information in a mysql database.
In this case I am having an issue how to use the best practice conditions when dealing with a POST **int** value.

With the posted values I am making a … Topic by klaus.veliu in Web Development
Member Avatar
Topic by KagaKuro in Web Development
Hehe, sure you can!

If you want to solve it, instead, read the notice, it says *Use of undefined constant session - assumed 'session'*, which means you probably wrote:

$autoload['libraries'] = array(session); # without quotes

Instead of:

$autoload['libraries'] = array('session'); # with quotes

By adding quotes the value is considered … Reply by cereal
Member Avatar
Featured cereal 1,298 Replied To a Post in Sorry for my absense
Topic by Dani in DaniWeb Community Feedback
Take care Dani! Reply by cereal
Member Avatar
Featured cereal 1,298 Began Watching Sorry for my absense
Sorry for my absense. I've been sick since late March. What started as a bad cold turned into bronchitis, and is on its way to walking pneumonia. :(

I'm on a cocktail of so many different cough syrups I'm awake maybe 4 hours a day. Topic by Dani in DaniWeb Community Feedback
Member Avatar
Topic by KagaKuro in Web Development
Open *application/config/autoload.php* and set **session** inside:

$autoload['libraries'] = array('session');

You can do the same with other libraries or helpers that you will use constantly, like database or form.

More info: https://codeigniter.com/user_guide/general/autoloader.html Reply by cereal
Member Avatar
cereal 1,298 Replied To a Post in Form input preview with printing
Topic by Lord_2 in Web Development
Hi,

it is not clear where you are having difficutiles. Reply by cereal
Member Avatar
cereal 1,298 Began Watching Form input preview with printing
I created an Php/Html form which will save to Database, the form is for Job application form, so i want it to preview the form details before final submission and also, on the final submission, there should be an area for the applicants to print the copy of their form … Topic by Lord_2 in Web Development
Member Avatar
Featured cereal 1,298 Replied To a Post in What is your current favorite hobby (besides technology) ?
Topic by jkon in Community Center
Mostly running, for few hours, 4 times per week, it's my break from everything. About plants, I don't have a garden anymore, but I have a small room with a French window exposed to south, I use it as a small greenhouse, with some plants... last year I grew up … Reply by cereal
Member Avatar
Some years ago I was in fishing , then Mountain biking  and almost one year now I am in gardening ( I still go for fishing or a biking ride in a near mountain) . I always knew that my relationship with earth , dirt , and plants provide me something … Topic by jkon in Community Center
Member Avatar
cereal 1,298 Replied To a Post in What To Download Today From Youtube ?
Topic by UI in Community Center
> Have you guys ever thought of building it ? It would sell well.

Hmm, that would infringe YouTube [terms of services (ToS)](https://www.youtube.com/t/terms) I suggest you to not try to monetize it, however, if you want to investigate it look at **youtube-dl** project on GitHub:

* http://rg3.github.io/youtube-dl/

I use it … Reply by cereal
Member Avatar
Fellow Programmers,

An hr before I roll off to sleep, I nearly always download for an hr entertainment or php tutorial videos from youtube. Got about 100 downloads at present on php tutorials. Was wondering what to download tonight and then something came to my mind:

https://www.youtube.com/results?search_query=mysqli+binding

However, you guys … Topic by UI in Community Center
Member Avatar
Featured cereal 1,298 Replied To a Post in Laravel Framework
Topic by davy_yg in Web Development
Open this link:

* https://www.visualstudio.com/downloads/

Click on **Other Tools and Frameworks** and download *Microsoft Visual C++ Redistributable for Visual Studio 2017* for your platform, that should install the missing library. The previous error was connected to the same issue. Reply by cereal
Member Avatar
Topic by KagaKuro in Web Development
It, probably, happens because you are calling the session inside `application/core/MY_Loader.php` but you are loading it from the controller, which is executed after the MY_Loader. Have you tried to autoload the session? Reply by cereal
Member Avatar
Topic by KagaKuro in Web Development
Okay,

consider to use the identical operator `===` on line 20:

if ($this->form_validation->run() == FALSE)

The `alpha_space_only()` callback can fail when using accented characters like `àèéìòùñ`, so you may want to replace the regex pattern to:

preg_match('/^[\p{L} ]+$/ui', $str)

a part this your code seems fine.

> But another error … Reply by cereal
Member Avatar
Topic by KagaKuro in Web Development
Hello KK,

from the screenshot is seems you are trying to load CI resources from outside the application folder. Is Contact.php a CI controller? Can you share it? Remember to remove address and password as the post is public. Reply by cereal
Member Avatar
Hello.
I'am using php codeigniter for my task here. i just have to use it.
its all set up at the first. so i kinda not understand the path.
I've read some of the explainatiion and try from scratch
but when I try to apply it to my task its … Topic by KagaKuro in Web Development
Member Avatar
Topic by UI in Web Development
php
Have you read this? http://php.net/manual/en/language.expressions.php
Basically a statement can be an expression. And:

> The simplest yet most accurate way to define an expression is "anything that has a value"

About tokens: in PHP it can be, strictly, used to define some parts of the language or used widely by … Reply by cereal
Member Avatar
Programmer Folks!

I first started learning php in September 2015. In 2 wks I read the whole tizag tutorial after understanding it.
http://www.tizag.com/phpT/syntax.php
(Browse the chapters list on the leftside of the page).

I was still "raw" in experience when I suddenly read that php 7 was out and when … Topic by UI in Web Development
php
Member Avatar
cereal 1,298 Replied To a Post in Clearing files using PuTTY/Terminal
Topic by adriculous in Databases
Hi,

I don't want to add confusion, but I wonder if there is an open process pointing to an unlinked file in that directory. Try something like:

lsof -nP +L1 | grep '(deleted)' | grep -i ".club"

from a terminal, to see if it outputs results. To be honest, I … Reply by cereal
Member Avatar
cereal 1,298 Began Watching Clearing files using PuTTY/Terminal
Hello, I've joined Daniweb months ago, but haven't really had the time to post here. I apologize if I posted in the wrong section, as I tried to look for the most specific one. So far I've seen `Linux/Unix > server` as the closest.

I'm currently stuck with my situation … Topic by adriculous in Databases
Member Avatar
Topic by dusk2dawm in Software Development
Hi!

In addition to previous suggestion: if the **path** is wrong or does not have write permissions Python would return:

sqlite3.OperationalError: unable to open database file

Instead you get:

sqlite3.OperationalError: no such table: Airports

Which can be generated if:

1. the database file name is wrong due, for example, to … Reply by cereal
Member Avatar
import sqlite3

datafile = 'XZ704.DB'
datadir = '/full_path_to/SQLITE_FILES/'
db = datadir+datafile

conn = sqlite3.connect(db)
cur = conn.cursor()

cur.execute("SELECT * FROM Airports LIMIT 1")

---

OperationalError: no such table: Airports

---

That works fine in a terminal but for some reason python 2.7 no like.

I have tried full path, relative … Topic by dusk2dawm in Software Development
Member Avatar
Featured cereal 1,298 Gave Reputation to diafol in Laravel Framework
Topic by davy_yg in Web Development
@cereal. I don.t think he.s answering any questions so that we can resolve this in under 30 posts. You.ve got more patience than me ;) Reply by diafol