Are web workers allowed to access a canvas object?
vendredi 8 juillet 2016
Splitting the output of MySQL Group_Concat()
What is the equivalent Atom Indent Guides like in Brackets?
What is the equivalent Atom Indent Guides like the one Bracket has showing vertical lines connecting matching beginning/opening and ending/closing brackets or keywords?
How can enter more than 4000 data entry in mysql database.?
Can Someone Decode Sha1 (user +password+salt)
const admin_user = 'nimda';
const admin_pass = 'df4044de3cf4f69e87974bc740f6a9b80554f51e'; // sha1(user + password + salt)
const admin_salt = 'avwbeebk';
PhpMyadmin : Select value from any table in a database
How to search a value from any column of any table of a database? I've almost 200 tables in my db, so that its not possible to search one by one.
Use Ruby database on Rails
I created a mysql database with Ruby. I want to use it on my Rails app. How can I do it? How can I read data with Rails without any database?
Oracle alternative for mysql REPLACE INTO
In mysql we use
REPLACE INTO
to insert if row doesn't exist and to update if it exists.
Is there a corresponding command in Oracle?
jeudi 7 juillet 2016
Automatically importing products into Woocommerce
I am trying to find a way to automatically import products into Woocommerce. I was wondering if someone had any experience with this, whether using a CSV or directly writing to the database.
CSS Styling and write Jquery inside a CSS class
what is the true sql statement for show something like list of products
Can't access folder from subdomain?
How to do MySQL update query in r
In MySQL, what I did is:
update table set group = 1 where log(id) < 0
I wanna do same thing in R but I have no idea
What should I do?
How to hide an external download link ?? [on hold]
I want to hide a download link as done by google in this url??
https://www.google.com/webdesigner/thankyou/
How to accomplish it ?
Formatting flask-wtf submit button using bootstrap
pagespeed module goes back to default after EasyApache update on cPanel server
On cPanel server, after running update of EasyApache, pagespeed module goes back to default - meaning all changes in pagespeed.conf are been removed and looks like it overwritten with default pagespeed.conf file. Is it possible to prevent it somehow?
Do you have to include <link rel="icon" href="favicon.ico" type="image/x-icon" />?
I didn't include the following line of code in my head tag, however my favicon still appears in my browser:
<link rel="icon" href="favicon.ico" type="image/x-icon" />
What's the purpose of including it?
How to convert UTC timezone to getTimezoneoffset()?
Here is the UTC date/time: 2014-06-01 12:00
how can i convert the above date and time to a new timezone with this:
new Date().getTimezoneOffset(); or even this:
-(new Date().getTimezoneOffset() / 60);
Mute Video in Safari
Safari doesn't support the mute attribute in a video tag. So the following video will not be muted in Safari:
<video id="video" width="180" autoplay="true" muted="true"></video>
How can a video be muted in Safari?
sql caching disadvantage?
I have a web server with a lot of web sites with many database operations, and i am tryng sql caching as a way to improve the performance of my server.
In general, is there any disadvantage about sql caching in a common environment?
Thanks
How to see full query from SHOW PROCESSLIST
When I issue SHOW PROCESSLIST query, only first 100 characters of the running SQL query are returned in the info column.
Is it possible to change Mysql config or issue a different kind of request to see complete query (the queries I'm looking at are longer than 100 characters)
for input type="number" how to set default value to 0
Form submit button embeded in gmail doesnt work
I want to embed a form in my mail content so that the reader can fill it and submit it. I see that it almost works except that in case of gmail, clicking on submit button does nothing. Is gmail deliberately doing this? Can I use javascript to overcome this?
How to use AJAX and servlets to display database values from a form?
I have a form with multiple buttons one for inserting into a MySQL table,other for viewing it,other for editing the table and final one for deleting the content. How can I implement this using a single servlet and Ajax for dynamically displaying the table after each operation. Please help :)
huge sql dump even after deleting large number of rows of data
The size of sql dump is same(30GB) even if I delete large number of rows from mysql (myisam) table
note: this variabe is innodb_file_per_table ON
mysql> delete from radacct where YEAR(acctstarttime)='2014';
Query OK, 1963534 rows affected (1 hour 30.58 sec)
How can I run a SQL text file on a MySQL database?
I am new to MySQL. I want to execute a text file containing SQL queries.
I tried to run source /Desktop/test.sql and received the error,
mysql> . homesivakumarDesktoptest.sql ERROR: Failed to open file 'homesivakumarDesktoptest.sql', error: 2
window.location to download file with large request data
We are using window.location() to download files from server. We are sending a JSON string along with request. As this being a GET request, I am forced to have restriction on the length of the JSON string. How can I send more data with window.location? sort of POST request to download the file.
mysql query to find price between size string attribute
In my table product size (width*hieght) will saving as below format
ID size Price
1 10*12 100
2 22*28 200
3 32*38 300
When a User will search a product with width 20 & height 25 ,Then i need to get price of 200 second row of table . Please help me to write a mysql query for this.
(Non-remote) Chome Dev Tools ("Inspect element") equivalent on Android?
Is there any way to have the Chrome Developer Tools or Firebug or something similar on Android without using another computer?
I'd like to use my Android Tablet + Bluetooth keyboard as a notebook replacement, and inspecting and debugging HTML/CSS/JavaScript is the only major feature I'm missing.
Thanks in advance!
How do I clear the contents of a div without innerHTML = "";
I have a div that is filled by JS created DOM elements,
I want the div to be cleared upon the JS function repeating, however I have heard that using document.getElementById('elName').innerHTML = ""; is not a good idea,
What is a valid alternative to doing this to clear the div's contents?
error with the replace function in mysql
I have a problem with the replace function in mysql for example
set @str = "Category, CategoryName, CategoryID";
SELECT REPLACE (@str, "Category", "125");
I would replace only the first word "Category" and here's the result:
125,125Name, 125ID
how to fix the problem
thank you in advance
Best text editor for HTML, CSS, PHP [on hold]
I have been using Sublime Text for more than 2 years now, but I don't manage to get LiveReload to work. So, I gave up and started looking for other similar programs that offer a plugin to auto reload the browser when changes are made and saved.
Is there a similar programme like Sublime Text?
Cheers!
mercredi 6 juillet 2016
Convert Mysql group by to ORM
I have a MySQL query that I need help converting to use django's ORM
select * from TABLE where ID=10 group by LOCATION order by DATE DESC
Thus far I have TABLE.objects.filter(id='10').order_by('-date') but I am unsure how to do the group by in Django.
Php - How to make an efficient user online and offline determiner ?
I have 1000 users and they have people to a peer like a G+ circle but i want to know if a person is online to chat but I have tried to update a chat database with a timestamp and its not as efficient I want to know if there is another way even if complex but efficeint Ideas pleas
Wrap a text within only two lines inside div
I want to wrap a text within only two lines inside div of specific width. If text goes beyond the length of two lines then I want to show elipses. Is there a way to do that using CSS?
e.g.
Sample text showing wrapping
of text in only two line...
Thanks
MySQL - How to delete rows where column does not contain certain values?
I'm trying to delete all rows where a specific column does not contain certain strings. Like this:
DELETE * FROM table
WHERE Disease NOT LIKE (Malaria, HIV, E. coli O157);
I get this error: #1064 - You have an error in your SQL syntax; near '* FROM table WHERE Disease NOT LIKE (Malaria' at line 1
Center image in a link
I am having an affiliate link and in it also an image. It looks like this:
<a href="my/link"> <img src="my/image"> </a> <img src="my/image"/>
How can I center the whole thing? I am using it inside a wordpress table through tablepress.
Thanks!
keeping form values after POST as a paramter of python file
I have a form, which one submitted goes to a php file and inserts values into DB(MySql).After successfully inserting values into DB,I want to use the values of this parameter form as a python file in another php file when i submitted .
file register.php -> file description.php (button start) -> file exucuter.php( execute pythonfile)
How to get saved images in Elgg
How much space does inserting 100GB data in 5 tables to SQL Server need?
There are 5 tables (files) which have about 100GB size, because of indexes the size increases in database. How much space do I need? I have not professional skill in Microsoft SQL Sever, is the importing needs any configuration for efficiency? I don't think MySQL can handle the data, is it right?
Could you tell me any advice or tip for this work?
NULL php variable inserting as blank into mysql db
I tried unsetting my $variable with unset($variable); and $variable = ($variable == '' ? NULL : $variable); (to set empty variables to NULL) and my var_dump is outputting NULL as intended, but my INSERT in the mysql database is showing up empty (blank). If I define $variable to foobar then it INSERTs foobar as intended. Any suggestions?
Make navbar collapse menu appear on all screen sizes
I have a question concerning bootstrap navbar. I want the collapse menu that appears on mobile, to also appear on larger devices. Since the code is rather large, I will have to share the codepen:
code link http://codepen.io/diazabdulm/pen/KMaREN
http://codepen.io/diazabdulm/pen/KMaREN
Formatting code with <pre> tag in React and JSX
I am trying to use the pre tag inside of JSX.When you use the pre tag in JSX, it doesn't format at all. Why? In order to use the pre tag I need to do something like this:
const someCodeIWantToFormat = "var foo = 1"
const preBlock = { __html: "<pre>" + pythonCode + "</pre>" };
return(
<div dangerouslySetInnerHTML={ preBlock } />;
)
Why?
mysql says database is corrupted but check says all tables are "OK"
Here is the error I get on startup: http://pastebin.com/1yM1wFMR
When I type mysqlcheck --all-databases -p it says all databases are "OK"
Also, mysql ONLY starts when innodb_force_recovery = is set to 2
How could I go about debugging this further?
how to sum of two coloumn of different tables where customer_name is same in both in php
I have two tables
- order_tb
- delivery_tb
I want to sum of their two column i.e paid amount from table order_tb and now_paid from table delivery_tb.
In both table the order_no is same.
Can anyone suggest me how to do that.
Ho to dispaly the three biggest numbers of one of the columns of a database table?
I have to write a php script to find the three biggest numbers of a column in a database table. This is my code so far, but it doesn't work .
<?php
$con=mysql_connect("localhost","root","");
$db=mysql_select_db("pool");
$res1=mysql_query("SELECT * FROM buy ORDER BY value LIMIT 3 ");
while($r1=mysql_fetch_array($res1)){
echo $r1['value'];
}
?>
MySql server PID not found
I have CentOS 6.4 with NGINX.
When I try to start/stop/restart mysql server (/etc/init.d/mysqld restart) I get this error:
MySQL server PID file could not be found! [FAILED]
Starting MySQL..The server quit without updating PID file ([FAILED]/mysql/mysqld.pid).
What can I do to solve this problem?
Thanks!
Update the date in the database with +1 month
I have a date column in my users what I want to update with a SQL query
With the SQL query I want to add 1 month to date column in my database.
I now have:
UPDATE users SET date=(+ 1 month)
When I run this query it is not working. So my question is, how can I make this working?
Update error in postgres SQL
CREATE TRIGGER INSERT_salesorderdetail
before insert on salesorderdetail
for each row
UPDATE customer
set number_of_items=IFNULL(number_of_items,0)+1
where new.customerid=customer.customerid;
I have 2 tables salesorderdetail and customer and i want each time i inserts a new item in salesorderdetail to update my columne in customer the number_of_items but for some reason i get a syntax error in update.
Google Search based Gif maker
I am required to create a gif maker which makes gif out of images(first 20) that we get while doing a Google Search on a keyword(User Input).
I am a beginner and I have an intermediate experience in Java, Html & Javascript I would like to know how to approach this problem statement. Will I be able to do this problem with my preferences(As said above)
Modifying WordPress Query --> Order By Custom Value In Another Table
increse numbers from 00000
How to add links within a HTML banner?
I'm sort of new here and to HTML so would appreciate any help greatly :)
So what I'm trying to do is create a responsive site with a banner. I can't seem to add image map tags to the banner as I have made it responsive.
Thank you for your help :)
Adding new row with a dropdown box with values from database using javascript?
No anchor link when refreshing page?
mysql - Convert SQL query to Rails2 ActiveRecord query
mardi 5 juillet 2016
Mutual friends sql with join (Mysql)
I have two tables
users table:
id|name
user_relationships
id | user_id | friend_id
and want to get names of mutual friends of 2 users. i.e:
user_relationships
1 | 1 | 3
2 | 2 | 3
users
3| sammy
users 1 and 2 have mutual friend 3. I want to get his name 'sammy' in one query.
How do I do that?
Deleting files from pre installed python folder of mac
Is it safe to delete files/folders from the site-packages folder?
/Library/Python/2.7/site-packages/mysql
The read me file in this folder says :
This directory exists so that 3rd party packages can be installed here. Read the source for site.py for more details.
I want to delete the files and folders to get rid of the connector/python i had installed earlier.
How summing qty by name in the barn and Item Name If the data obtained like this ? SQL
Why when I download the file, Chrome always says Faild - Network error
Connect to external database (MySQL) - Using Swift
How to close DOM Window jquery?
In example 3 on the below mentioned link http://swip.codylindley.com/DOMWindowDemo.html
Can you add a link within the window to close it?
Window.close(), self.close() and parent.window.removechid() aren't working
I think they have modified the functionality of close() in jQuery.DOMwindow.js
Plz help.
Storing sorting terms in URL so can be bookmarked
I am currently creating a simple single page application where you can sort entries by name and so on. What I am looking to accomplish is a way to store the current sort chosen (but not a different web page, something similar to a PHP Get). I am not very confident or familiar with Javascript, AJAX and so on because of this I do not know how to store and read from a URL in JS.
Antialiasing text on canvas
I have to create .pngs for a lot of clients that are printed by an industrial inkjet (ads on back of a children's magazines).
Unfortunately, all browsers seem to switch on antialiasing - no matter what I try. Neither CSS nor ctx.mozImageSmoothingEnabled=false; seem to work.
Does anyone have any idea to get text displayed on canvas WITHOUT any grey-scaled pixels trying to make the font sharper?
import sql file in php
I am trying to import a sql file throug php via shell_exec function. My code is as follows,
shell_exec("C:wampbinmysqlmysql5.6.12bin>mysql -h localhost -u root blank_db < C:wampwwwmy_websqlblank_db.sql")
My database name = "blank_db". and there is no password set for mysql.
The above command is running successfully in cmd. but not it in php
How do you handle optional parameters in PHP PDO?
I have a MYSQL table with 5 fields, 2 of which can be null. I have to write PHP PDO for insert and update commands so that users can edit the table. For insert I used a switch statement with 3 cases to account for optional fields. I started writing update when I realized I would need 16 cases for all combinations of fields since all but the primary key can be updated. Is there a more efficient way to accomplish this?
debugging with GDB throw "lost connection to mysql" errors
I tried to debug a program with gdb because it crashing randomly (after some days, after some hours..). But when I tried to debug it, my program throw these errors: "Lost connection to MySQL server" and "MySQL server has gone away"
I don't get these errors when I'm running my program without gdb, so what's the problem with the gdb?
I tried to incrase the max_allowed_packet to 256M in my.cnf, but not worked..
Connect to MAMP local server (MacBook) from Windows computer
I'm having trouble connecting to a local server hosted on a MacBook/MAMP. My .NET application (running on a Windows computer) smoothly connects to another Windows machine (MySQL server) with the same connection string "server=[computer's name]; user id=xxxx; password=xxxx; database=xxxx" but when I use this MacBook's name, I get the following error:
"Unable to connect to any of the specified MySQL hosts"
Note: File Sharing is turned on
Please help. Thanks!
Saving Html from Webpage and Prevent XSS
Form does not open in new tab
this is the code I am using, I have specified target="_blank" in the form however it doesn't open in a new tab.
<script>
function process()
{
var url="https://website.com/search/" + document.getElementById("url").value;
location.href=url;
return false;
}
</script>
<form action="https://website.com/search/" target="_blank" onSubmit="return process();">
Search: <input type="text" name="url" id="url"> <input type="submit" value="go">
</form>
Can't access my website hosted in godaddy from 2 devices in same wifi
Is it best practice to define global JavaScript objects in HTML?
mysql Group by in nested query
Data too long for column 'descr' at row 2
When I try this sql statement to execute
update claim cl set search_field = (select concat(cl.claim_description,' ', cl.legal_basis,' ',co.name) from contact co where cl.probable=1 and cl.search_field is null and co.id=cl.contact_id)
I get error above, and there is no column named descr. There is column named claim_description but it isn't descr
Does anyone have hint? Thank you
array unique not working in php
array unique not working in php? what am i doing wrong?
<?php
$selectquery=mysql_query("select menumanagement.*,usermanagment_permission.* from menumanagement,usermanagment_permission where usermanagment_permission.permission_menu_id=menumanagement.mn_id");
while($selectquery1=mysql_fetch_array($selectquery)) {
$menunam=$selectquery1["mn_menuname"];
$ddddd=array($menunam);
print_r(array_unique($ddddd));
}
?>
output:
Array ( [0] => Applicant )
Array ( [0] => Skill Set )
Array ( [0] => Applicant )
Array ( [0] => Add Employee )
Array ( [0] => Applicant )
Array ( [0] => Add Employee )
Array ( [0] => Skill Set )
How to compare a query to a table in sql
I have queries that finds people that are subscribed, and inserts their emails into a table. To update this, it always truncates the table and inserts all records in it again. Now I want this to not truncate and insert all the data each time (takes a long time for very large records), but do the selection and check with the old table if there was a change, and only add/remove those few records to the table.
Any Idea how would I approach this solution?
Find No. of newest entries in MySQL?
I use this query to get the newest 1 entry:
SELECT * FROM Data ORDER BY ID DESC LIMIT 1
I am using node-mysql in nodeJS, I would like to use the
rows[0].Data
So I can get the 4 newest entries in separate variables, how can I achieve this?
I am aware that I can up the DESC LIMIT to 4, to limit the results, but am still failing trying to get more than 1 result.
group_concat_max_len value gets changed to default on restart
MYSQL - Total registrations per day
Hide menu when page loaded - in bootstrap with toggle colapse menu, left right @ mobile [on hold]
I found this menu template in bootsnipp which works fine, except on mobile, I mean when page is loaded, both menus are already in the screen, and I would like that they are hiding when the page is loaded.
I'm having troubles in understand the javascript function, in other templates I've seen the "show/ hide .collapse" or the "hidden".
Could anyone be kind enough to help me fixing this feature?
Thanks a lot.
lundi 4 juillet 2016
Simplifying a drop down form input for date: day month year <html>
Play music dynamically in html
How can I download images in content?
I just want to download images in content with cURL.
For example: Visit any buzzfeed galleries and see content after title. you will see
- First content for image <img src="blabla.jpg">
- Second content for image <img src="blabla.jpg"> in content
Now I want to download that 1. bla bla with image to my server. I think its name "url to file" sorry for my english. Can you please help me? And also can it make with wordpress too?
Reference current element's height/width
Is there a way in CSS to refer to the width of the current element?
I would like to position an image to the left of another image using margin-left: -width but can't seem to find a way. The image is not a fixed size but it is half the paren't height, if that helps.
I found one other question asking something similar but that was 2+ years ago, before calc() was introduced, and I thought maybe there would now be a way to do it.
MySQL / MariaDB Strict Mode
I was developing some code using MySQL as a DB, with various indexes. I had MySQL running in strict mode.
As an experiment, I switched to MariaDB (also in strict mode) and found that many of indexes were failing because they were too long (above 767 bytes). If I remove Strict mode in MariaDB, the indexes seem to be created.
My question is: are those indexes actually being created, even though they are clearly too large?
If not, how do I deal with indexing VARCHAR strings?
Is there a variable for mysql that returns all?
I have a MySQL query using a WHERE clause based on a variable. I am trying to figure out if there is a way to set the variable to something like a wildcard that would return any value in that field?
WHERE c.call_state_id = $state
AND (follow_emp_id = $user_id OR follow_emp_id = 117)
ORDER BY $sort
Instead of limiting the results to 1 specific $user_id, I want to virtually eliminate the AND portion of the query.
input type=file show only button
Is there a way to style (or script) <input type=file /> element to have visible only "Browse" button without text field?
Thanks
Edit: Just to clarify why to I need this. I'm using multi file upload code from http://www.morningz.com/?p=5 and it doesn't need input text field because it never has value. Script just adds newly selected file to collection on page. It would look much better without text field, if it's possible.
Supplier-customer relationship in the same table
I'm no MySQL expert and I have to design a rather complex db for my level.
The problem I'm facing now consist in having a supplier-customer relationship within the same table (macro categories of companies):
Macro table
id name mega_id macro_customer_id
------------------------------------------
1 Furniture 2 2,4,5,35
I want to represent the fact that macro entry with id 1 has other macro companies (which are their customers) described within the same table.
Which is the best way to represent this?
Thanks!
Select results from 2 tables if no matches found in the third one
I have three tables
t1
--------------
userID
userEmail
userName
userType
t2
--------------
businessID
businessUserID
t3
--------------
recordID
recordBusinessID
I need to retrieve records if no results are found in t3
SELECT
t2.businessID,
t1.userEmail,
t1.userName
FROM t2
LEFT JOIN t1 ON (t1.userID = t2.businessUserID)
LEFT JOIN t3 ON (t3.recordBusinessID = t2.businessUserID)
WHERE userType = 'active'
AND t3.recordID IS NULL
It seems like I should be getting results, because my current t3 is empty, but I don't. What am I missing?
SQL Export all rows and Delete all rows
Does Statement.RETURN_GENERATED_KEYS generate any extra round trip to fetch the newly created identifier?
JDBC allows us to fetch the value of a primary key that is automatically generated by the database (e.g. IDENTITY, AUTO_INCREMENT) using the following syntax:
PreparedStatement ps= connection.prepareStatement(
"INSERT INTO post (title) VALUES (?)",
Statement.RETURN_GENERATED_KEYS
);
while (resultSet.next()) {
LOGGER.info("Generated identifier: {}", resultSet.getLong(1));
}
I'm interested if the Oracle, SQL Server, postgresQL, or MySQL driver uses a separate round trip to fetch the identifier, or there is a single round trip which executes the insert and fetches the ResultSet automatically.
Incorrect Padding error while decoding base64 encoding
I have tried to decode a PDF I stored as BLOB and save it into a file with .pdf extension. results[0][1] has the BLOB data extracted from database query.
blob_val=results[0][1]
if len(blob_val) % 4 != 0:
while len(blob_val) % 4 != 0:
blob_val = blob_val + b"="
decod_text = base64.b64decode(blob_val)
else:
decod_text = base64.b64decode(blob_val)
Eventhough i have added = at the end to correct padding errors, it is still showing incorrect padding error. why does it still shows this error even when we corrected it by "="?
Return boolean or 0/1 if rows in the columns are true
I have searched the net regarding this question but so far there are either no respone yet or it is not working
--------------------
formID | validation
2000 | true
2000 | false
2000 | true
I want it to return true if all rows for that grouped (formID) are all true else it will return false. It can be both in literal or 0/1. I will be using the returned value in java
Similar to this question but for MYSQL
Return true if all column values are true
Like statements parameterized @query%
I would like to ask your help about parameterizing a like statement.I need to get the rows which starts with the variable code. I have a problem with my sql statement in c#.whenever i try to use this:
SqlCommand sql2= sql.SelectCommand = new SqlCommand(@"Select *
from book
where Date like @date+'%'
order by Category,Paticulars,Description,Amount",
this.connection);
sql.SelectCommand.Parameters.AddWithValue("@date", code);
SqlDataReader reader=sql2.ExecuteReader();
it does not return anything.but if i tried to add a '%' before the date it works properly.
How to resize iframe with real size
I've visited lots of posts but none of them gived me an answer that works.
I want to resize an iframe to the parent, for example a div.
The iframe tag resizes dynamically the width, but not the height.
How can I dynamically resize both?
If I write: <iframe src="http..." width="100%" height="400"></iframe> it always is 400 px of height.
But if I put a % there too it doesn't resize properly.
And if I want to have the iframe width and height of the page it is referencing in src, how can I do it?
Stop Onclick Execution when middle click is pressed - javascript / jquery
This is something like my code:
<li class="dropdown" id="dropdown1"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown<b class="caret"></b></a>
<ul class="dropdown-menu">
<li id="li-1"><a href="#" onclick="Alert("li-1")">List1</a></li>
<li id="li-2"><a href="#" onclick="Alert("li-2")">List</a></li>
</ul>
</li>
but when middle click is pressed i want to stop execution of my onclick event
TypeError: not all arguments converted during string formatting. What am I not doing right
I have tried:
sql = "INSERT INTO "+ tablenane + " ("+ ",".join(headers) +") VALUES (" + ",".join(["%s"] * len(headers)) + ")"
and:
sql = "INSERT INTO "+ tablenane + " ("+ ",".join(headers) +") VALUES (" + ",".join(["?"] * len(headers)) + ")"
but still get the same error when I run cursor.executemany(sql, dataset)
dataset = [(a,b,c),(d,e,f)] - A list of tuples
Both columns and values are dynamic, because there 40 columns. All table columns are of type VARCHAR and I ensure the data is converted to string before insertion
Using python 2.7 and mysql
Validating an Email in JavaScript [duplicate]
This question already has an answer here:
- Validate email address in JavaScript? 48 answers
I'm using the pattern:
var pattern = /^[^s@]+@[^s@]+.[^s@]+$/;
So when I submit/send an email to myself from my contact form to test out a bunch of different email combinations, everything has worked except for:
whatever@yahoo.com && whatever@google.com
I'm not entirely sure why those two aren't being included, but I'd appreciate any assistance.
Insert at specific 'ID' into my table.
I need to write a PHP script using a database for school. Since my MySQL skills are currently dying, I would like to ask following question: Following problem: I need to insert 'upload' at a specific 'ID' into my table. It should make something like this: insert into PHP_Project() where ID = ;
$pdo = new PDO($this->dsn, $this->username, $this->password, $this->pdoAttributes);
$statement = $pdo->prepare('insert into PHP_Project(upload) where ID = ? values (?,?)');
$statement->bindParam(1, $filename);
$statement->bindParam(2, $projectID);
$statement->execute();
I hope somebody can help me. Thanks in advance!!
HTML PHP: Preventing an iframe from remembering session state on page refresh
Is there a way to declare an iframe in a page so that each time you refresh the page, it clears any session variables within it?
Right now i have a web application written in .NET MVC and on one of its pages it loads an iframe that points to another application written in PHP. basically what is happening is that the iframe is remembering session state when i refresh the whole page but would ideally like to re-start it each time. Are there any ways to do this? or would i need to call a logout script within the iframe on page refresh?
Android move footer up when keyboard is open
I'm designing a login html page which is loaded into an Android WebView. There are two text areas and a "Login" button fixed to the bottom of the page. My problem is that when the person types into the text area; the keyboard pops up and hides the login button.
How can I keep the "Login" button fixed to the bottom of the page but to the top of the keyboard?
I've tried :
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
And
android:windowSoftInputMode="adjustPan|adjustResize"
Neither makes a difference.
join three table in php
I have three table mainaccount, admitcard,result. mainaccount has 40 columns. I want to join all three column. So I can fetch easly all data from table by one query. I have a code. Is it true. Can any one check please. Because code is not running.
require"connection.php";
$result=mysql_query("select mainaccount.*,admitcard.*,result.* from mainaccount,
admitcard,
result
where mainaccount.email=admitcard.email
AND admitcard.email=result.email
AND mainaccount.email=result.email
AND mainaccount.email='$username'");
while($row=mysql_fetch_array($result))
{
extract($row);
if(mainaccount.payment=='done' && mainaccount.formfill=='done')
{
echo"hello";
}
Canvas - how to fill all circles at once, not one by one
I have while loop drawing circles one by one:
actx.shadowColor = 'rgba(0, 0, 0, 1)';
while (len--) {
var point = data[len];
actx.beginPath();
actx.arc(point[0] - 15000, point[1] - 15000, 10, 0, Math.PI * 2);
actx.closePath();
actx.fill();
}
It seems a little bit slow for me, so I am thinking how it could be optimized. I have found that the fill() function takes the longest, so I have tried put it after the loop, but it draws only the last circle.
- Is there any way how to fill all the circles at once?
- Or is there any other, faster method?
storing iframe current URL in sessionstorage not consist
I am storing to current url of an iframe in sessionstorage and then refreshing after a set time then reloading the iframe with the current url. But it will work for about 2-3 refreshes then it fails and goes to the iframe src URL. Can someone tell me how to optimize this script so it will work everytime.
<script>
if (sessionStorage.getItem('url') == null) {
window.location;
} else{
document.getElementById("iframe").src = sessionStorage.getItem('url');
};
sessionStorage.removeItem('url');
setTimeout(refresh, 500000);
function refresh () {
document.domain = 'company.com';
var myURL = document.getElementById("iframe").contentWindow.location.href;
sessionStorage.setItem('url', myURL);
window.location = window.location;
};
</script>
dimanche 3 juillet 2016
Should I use form to submit JSON data to REST api
Is it approved to use a html form to build interface to collect user data, convert it to domain model in front end and POST it to server using JSON?
I like to think the user input part as a logical form, event though the server expects JSON. For user it is all the same, so why not just to use a form to collect the data and implement a custom onSubmit method? Another option would be use detached input fields and buttons.
Is this considered a good practice to use forms for JSON POST and what are the good and bad consequences of this practice?
Securing MySQL over SSL [on hold]
During the last couple of months we built a small business environment. We're running a MySQL database on a provider who's not offering MySQL over SSL. As it turns out, it's quite difficult to find a provider. Here come my two questions:
- Can you recommend a good provider to host our database with SSL support?
- Do you have any hardware recommendations for hosting it ourselves? As mentioned, we're a small business, basically 3 people using the database to work on orders (~20 a day) with minor commits to the database. I thought about something Raspberry style but I'm concerned about performance. I'd appreciate any input on that matter.
laravel 4.2 storing/uploading profilce picture and retrieving from database
i m new to laravel 4.2 i'm am developing a web application ..now i want to store a profile picture into database.
this is my controller file code
public function profilepicture(){
$data = Input::hasfile('file');
DB::table('company')->insert(array('data'=>$data));
return Redirect::to('/companyreg');
}
this is from route file
Route::any('/company_profile','CompanyController@profilepicture');
this is form view
<form method="post" action="{{url('/company_profile')}}">
<input type="file" name="file" />
<input type="submit" name="submitfile" value="upload" />
</form>
Send POST request data to Mysql Database using Node.js
So I have created a POST route in Express.js and I am trying to create a signup page. I am able to get the form data using req.body but I am unable to send the data to mysql database. I already have functions in the database but I am not sure how to send the data there. Can someone help me here? This is my POST route that I have:
router.post('/register', function(req, res) {
var firstName = req.body.firstName;
var lastName = req.body.lastName;
var email = req.body.email;
var confirmEmail = req.body.confirmEmail;
var password = req.body.password;
var confirmPassword = req.body.confirmPassword; });
Better way to get 15 tables results at a time in MySql
I have some 20 tables. These tables have only id(primary key) and description(varchar). But the data is a lot. Almost 400 rows for one table. Right now I have to get data of at least 15 tables at a time. Right now giving call one by one. Means in on session I am giving 15 calls. This is making my process slow. Can any one suggest any better way to get the results from the database. I am using MySQL database and using Java Springs on server side. Will making view for all combine help me ? Need a solution that will fasten my process. The application is becoming slow because of this issue.
Thankyou.
How to make Bootstrap dropdown-item as hyperlink
How do I get a non-input element to send with the form?
I have an HTML form. All of the inputs are standard except for the slider. I made the slider out of divs instead of using <input type="range">, so I could add extra functionality and style it easier. How do I get the custom input to be part of the form?
I could've put together a query string and redirected the browser with JavaScript:
window.location.assign("/post?author=" + $("#name").val() + "&rating=" + document.elementFromPoint($("#slider-grabber").position().top + 20, $("#slider-grabber").position().left + 5).innerHTML + "&content=" + $("#content").val());
But that only works for a GET request, and my form sends a POST request.
Laravel: Display query with 10 random rows from mysql with paginate
I want to get from database 10 random rows and then display it on paginate.
One page should display only 1 row and next button should display next row etc.
Also i have column that contains category id so for the first page i want to display row with cat_id = 1 for third page i want to display row that have cat_id = 3.
Please tell me is it possible? I have no idea how to do it.
For now i have controller:
$rows=Row::all()->random(10)->paginate(1);
And it says that there is no paginate method :(
Limit for FOUND_ROWS()?
I'm trying to speed up some SQL queries. My SQL query on pagination is like this (3rd page):
SELECT
SQL_CALC_FOUND_ROWS book_id, book_title
FROM
books
LIMIT 40, 60
And then getting all result count:
SELECT FOUND_ROWS();
But if the result count is huge (milions of books) then FOUND_ROWS() can took very long time.
The fact is that there is no need to count milions of rows (books) and the answer "10000+" is enough for usual user.
Is possible something like this? Pseudocode:
SELECT FOUND_ROWS(LIMIT 10000)
Yesterday and today date in mysql
My date column in my database is in this format: date('Y-M-j H:i:s');.
A am trying to run a query to get all transactions done today and another one for all transactions done yesterday. Please help on best way to do this.
I tried the below but it wasn't working
$yesterday = date("Y-M-j 00:00:01", strtotime("-1 day"));
$yesterday2 = date("Y-M-j 23:59:59", strtotime("-1 day"));
$query_syesterday = "SELECT sum(amount), sum(amtnaira) FROM transactions WHERE transtype = 'buy' AND batch !='' AND date BETWEEN '$yesterday' AND '$yesterday2'";
$syesterday = mysql_query($query_syesterday, $egold1) or die(mysql_error());
$row_syesterday = mysql_fetch_assoc($syesterday);
$totalRows_syesterday = mysql_num_rows($syesterday);
Generate HTML pages from CSV data
I have a .csv file with some data.
I want to make one HTML page for each row. Like for the first row, a page which has all the info.
When user enters the page like for the first row, he should see the details like this :
The champions skins and runes are the additional data i want to display on individual pages but not the main table.
Please someone help me out.
Thanks.
how to assign and set foreign keys from primary key in MVC5
i have two tables tbl_Dues and tbl_Violator. tbl_violator's primary key VID is auto seeded and is treated as a foreign key in tbl_dues I would like to create violator table then in the dues table also create on same index and VID of Violator table must store in VID(foreignkey) of Dues table and when i click create then it must save the record to both tbl_Dues and tbl_Violator
Here is my model i want both VID in tbl_Dues and tbl_Violator to be the same:
[![enter image description here][1]][1]
How to print object values correctly to a DIV using innerHTML?
mysql get all intervals of datetime based on interval hour
I have the following table with datetime type as follows
Id interval_time processed_time
1 2016-07-22 08:00:00 2016-07-22 09:25:00
2 2016-07-22 09:00:00 2016-07-22 10:30:00
3 2016-07-22 14:00:00 2016-07-22 15:23:00
4 2016-07-22 15:00:00 2016-07-22 14:27:00
5 2016-07-22 16:00:00 2016-07-22 15:24:00
6 2016-07-22 17:00:00 2016-07-22 16:40:00
I need to get the all missed interval_time for last 24 hours with the given input time.
I need to get all missed intervals which doesn't exists in table as follows.
2016-07-22 10:00:00
2016-07-22 11:00:00
2016-07-22 12:00:00
2016-07-22 13:00:00
here i can join the table with the list of all intervals of last 24 hours , but how can i get the last 24 hours list with hour as interval.
Positioning titles and img
pivot rows to columns based on condition
I have a table like so
id student_id score
1 1 45
2 2 55
3 2 75
4 3 80
5 1 90
6 2 78
7 3 55
8 1 45
9 1 65
I want to arrange it like this
student_id s1 s2 s3 s4
1 45 90 45 65
2 55 75 78 -
3 80 55 - -
the concept of pivot is
SELECT
item_id,
MAX(IF(property_name = 'property_value1', value, NULL)) AS alias1,
MAX(IF(property_name = 'property_value2', value, NULL)) AS alias2,
...
...
...
FROM
table
GROUP BY
item_id;
which i cannot really figure out in my case, as i am creating the columns s1 - s4 by occurrence, i.e the first score for each student becomes s1, second becomes s2 etc.
how do i solve this
MySql - Create a table and select from it in the same procedure
I’m trying to execute this simple code as a procedure in MySql using the PHPMyAdmin
CREATE TEMPORARY TABLE IF NOT EXISTS jobs AS (SELECT
*
FROM
all_jobs
WHERE
job_object_type LIKE 'jobName'
OR
job_object_type LIKE 'jobStatus');
SELECT
*
FROM
jobs
But I’m getting an error (#1064) because of my second SELECT query. I’m coming from MS-SQL and there the SELECT would be executed without any problems. How can I execute the CREATE TABLE X query and direct after that the SELECT * FROM X query in the same procedure?
EDIT: forgot to mention that I’m using the MariaDB
Convert SnakeCase DDL to PascalCase for table and columns
Convert SnakeCase Db sql to PascalCase for Table and Columns. IS there a best way to do it ? Example of snakeCase below is in MYSQL and converted to MSSQL.
DROP TABLE IF EXISTS `addresses`;
CREATE TABLE `addresses` (
`id` int(11) NOT NULL default '0',
`line1` varchar(255) default NULL,
`line2` varchar(255) default NULL,
`city` varchar(255) default NULL,
`state` varchar(35) default NULL,
`zip` varchar(10) default NULL,
`plus_four` varchar(4) default NULL,
`country` varchar(255) default NULL,
`foreign_id` int(11) default NULL,
PRIMARY KEY (`id`),
KEY `foreign_id` (`foreign_id`)
) ENGINE=InnoDB;
Want to Convert it to
CREATE TABLE [dbo].[Company](
[CompanyKey] [nvarchar](15) NOT NULL,
[Name] [nvarchar](50) NULL,
CONSTRAINT [PK_Company] PRIMARY KEY CLUSTERED
(
[CompanyKey] ASC
)
MySQL #1243 Unknown prepared statement handler (stmt) given to EXECUTE
Webpage image sequencer begins to lag after time
http://www.henryneilson.com/HyBird3/Test.html
I have this image sequencing landing page, that I'm working on^
The sequencer pre-loads about 186 images and shows them sequentially when the document is scrolled.
After all the images are loaded, everything runs smoothly,however after perhaps 10-20 seconds the whole thing starts to lag. It seems that the script is keeping up with changing the image number, but the image won't visually update in the fine increments it should. I just skips frames horribly.
I know I should compress the images more but if it works initially I don't see how it "develops" this lag?
Selecting certain columns from a single row that contain @
I am attempting to extract a single row from a MySQL database table, but with certain parameters specified. The username of the row has to match what was used to login, and the variable $groupname must match as well. I only want to pull out data from the columns whose data contains the @ symbol (so that I know it's an email). What is the best way to do this?
EDIT: The table has the following rows: id, timestamp, username, groupname, and group emails labelled ge1-ge10. I want to pull out only the ge columns from a single row that have content.
Passing a JavaScript variable to a html <select> attribute
I am trying to pass a variable from JavaScript to value attribute of the select tag. Here is my code:
<script>
if (window.location.href.substring(0, 9) === "http://ww") {
var home_var = "bing.com";
var home_var = "poem.com";
} else if (window.location.href.substring(0, 9) === "https://p") {
var home_var = "https://px.multiscreensite.com/index.php?url=bing.com";
var poem_var = "https://px.multiscreensite.com/index.php?url=poem.com";
} else {
var home_var = "1";
var_poem_var = "2";
}
console.log(home_var);
</script>
<select OnChange="window.location.href=this.value">
<option>Tagged Stuff and Navigation</option>
<option value=HOME_VAR>Home Page</option>
</select>
How to get a border around this polygon?
I have created a shape with 5 corners using polygon as shown below.
This is the css needed to make it:
div {
width: 280px;
height: 280px;
background: #1e90ff;
-webkit-clip-path: polygon(75% 0%, 100% 50%, 75% 100%, 0% 100%, 0 48%, 0% 0%);
clip-path: polygon(75% 0%, 100% 50%, 75% 100%, 0% 100%, 0 48%, 0% 0%);
border: 3px solid black;
border-bottom-left-radius: 15px;
border-top-left-radius: 15px;
}
Unfortunately I cannot get it to add a black border all around the shape (it is missing on the right side). How would I do that?
I have created a fiddle here.
how to combine two columns in mysql
its a doubt. I have two tables one table contains student name,roll number,subject id for example
JOHN 22 1,2
SAM 33 2,1
ROY 32 1,2
here 1,2 is my subject id. where one belongs to subject1 & 2 belongs to subject2 both are optional for a particular student.
And the second table contain subject1 and subject2 mark.
i want to combine both subjects mark into one column for corresponding students. pls help me
SELECT table1.roll_num,table1.student_name,
CASE
WHEN FIND_IN_SET(8, 'table1.subject_id') THEN sub1
ELSE sub2
END AS subject_mark
FROM table2
JOIN table1 ON table1.student_id = table2.student_id
WHERE division = 'A
ORDER BY table1.roll_num asc
samedi 2 juillet 2016
How to detect user input as "zero" and force user to give valid reason in text box given
Is it posible to use CSS in this way in PHP?
I'm trying to use CSS within PHP code but it seems that I can't use CSS in the way that I'm trying. why?
<?php
$username = "Daved";
$password = "hello!";
?>
<html>
<head>
</head>
<body>
<?php
echo "<div style="font-size: 32px; background-color:#f00; color:#fff; width:200px;">And Operation</div>";
if($username == "Daved" && $password == "hello!"){
echo "<p>The Password and UserName are correct!</p>";
}
else {
echo "<p>You are not a member!</p>";
}
?>
</body>
</html>
Ok, It's a true way to use CSS like this, or I must to try using style in another way?
000webhost mysql connection error
I am trying to connect to my database using the following code:
<?php
$mysql_host = "mysql*.000webhost.com";
$mysql_database = "a******_account";
$mysql_user = "a******_admin";
$mysql_password = "******";
// Create connection
$con=mysqli_connect($mysql_host, $mysql_user, $mysql_password, $mysql_database);
// Check connection
if (mysqli_connect_errno($con))
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
};
?>
Does anyone know what is going on? The error messages are:
Warning: mysqli_connect() [function.mysqli-connect]: (28000/1045): Access denied for user 'a******_admin'@'0.0.0.0' (using password: YES) in /home/a3996154/public_html/index.php on line 18
and
Failed to connect to MySQL: Access denied for user 'a******_admin'@'0.0.0.0' (using password: YES)
how to add image inside canvas arc
I want to add image inside arc but image should be moved with arc. Currently I have some code and it's working for repeat but when it put no-repeat argument then it gets blank inside arc.
Here is what I am looking for but the image is not centered properly: Image is a wheel.
Here is the code
canvas = document.createElement('canvas');
ctx = canvas.getContext("2d");
var img = new Image();
img.src = (window.location.origin + window.location.pathname) + 'assets/files/' + (wheel.logoURL);
img.onload = function() {
var pattern = ctx.createPattern(img, 'repeat');
ctx.beginPath();
ctx.arc(centerX, centerY, 50, 0, PI2, false);
ctx.closePath();
ctx.fillStyle = pattern;
ctx.fill();
ctx.stroke();
}
How to place an "inline image" in form before upload?
I want to allow users to write a post and upload images inline through out it (like a CMS blog post).
Writing the file upload script is easy. But allowing a "place inline" button / functionality is proving to be tricky.
Is there a tutorial on how to do this?
I'm messing around with some JavaScript to allow it. Also, I'm not sure if I should display the inline tmp image or actually upload the file (with a separate upload button than the full form upload button) and show the actual image loc before the form is submitted? I'm all over the place on this right now.
How should I go about this?
Thank you.
Rails can't connect to external mysql server despite Privileges
I run rails on my local dev environment but the mysql instance is on a separate server.
When trying to open a page in the app I get this error:
Access denied for user 'username'@'myhostname.lan' (using password: YES)
When I ssh into the server running mysql and run this command SELECT Host from mysql.user WHERE User='username'; I get the following:
+---------------------+
| Host |
+---------------------+
| % |
| myhostname.lan |
| localhost |
+---------------------+
All of these entries were created with GRANT ALL PRIVIELEGES ON dbname.* TO ...
So why can I not connect given that both the any-host wildcard % is in the list as well as the hostname I try to connect from specifically?
Calling addEventListener hundreds of times
Let's assume that I have hundreds of submit buttons on a HTML page. When a submit button is clicked, it calls a JavaScript function called TiedotNettiin which uses jQuery.post() for sending some information to the webserver.
Would it be a good idea to use JavaScript and its addEventListener hundreds of times on a HTML page? Does this require much system resources?
Or would it be better to set interval and run my JavaScript function TiedotNettiin, let's say, every 10 seconds? It would wait 10 seconds, collect all clicks within 10 seconds, make an array, and finally send that array with all new information to the server. This would happen in every 10 seconds instead of every submit button click.
Is there better alternatives?
Thanks for opinions and ideas.
Can't drop table after creating table with wrong engine
I'm trying to drop a table containing several hundred thousand column-based records. Normally when creating the database I use a column-based engine (infinidb) but in this case I forgot to include the ENGINE statement. So the database is pretty much unusable for my needs. Now I have a database full of tables that are taking forever to drop (it's been two hours and nothing has happened). I tried the ALTER TABLE table ENGINE=INFINIDB command but again, it's taking forever (see above re: two hours).
Is there another way to get rid of this database? E.g. manually going into the /mysql/ directory and deleting the database? I guess I could just rename it and leave it, but I'd rather get rid of it entirely so it's not taking up space.
MariaDB error 1064 on UPDATE statement
I need some help here:
I run 2 queries separately on the same table and one yields an error, the other is ok. The only difference is the SET value. take a look:
UPDATE `CRM_Masterlist` SET `contact_status`=1 WHERE `contact`=8888
Result:
SQL query: UPDATE
CRM_MasterlistSETcontact_status=1 WHEREcontact=8888 Matched rows: 0
Anyone has any idea?
UPDATE `CRM_Masterlist` SET `contact_status`=0 WHERE `contact`=8888
Result:
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'FROM
CRM_MasterlistWHEREcontact=8888' at line 1
Bootstrap scrollspy is not working on appearing text
I have a checkbox and when that specific checkbox is checked it shows some text above:
$('#pck-94').click(function() {
$('#pico-info').toggle(this.checked);
});
this wil toggle the text which works and than I wanted to set a scrollspy which scrolls to the text which appears when checkbox is checked here is the html:
<span id="pico-info">(het verjaardagsfeestje Pico Patat is voor kinderen vanaf 4 jaar en maximale lengte 1.30m)</span>
and this is the scrollspy code where the checked is never logged:
if($('input#pck-94').prop('checked')){
console.log('check');
$('body').scrollspy({ target: '#pico-info' });
}
Here a fiddle : LINK
How can I use variables with "LineString"
I keep getting this error message every time I run this code:
DELIMITER $$
CREATE PROCEDURE BBOX(IN X FLOAT, IN Y FLOAT, IN E FLOAT)
BEGIN
DECLARE A, B, C, D , R FLOAT;
SET R = E/69;
SET A = X - R;
SET B = Y + R;
SET C = X + R;
SET D = Y - R;
SELECT NAME, ASTEXT(LOCATION) FROM POINTS WHERE MBRContains(GeomFromText('LINESTRING(A B,C D)'),LOCATION);
END $$
DELIMITER ;
ERROR 3037 (22023): Invalid GIS data provided to function st_geometryfromtext.
I'm trying to create a Bounding Box procedure that searches for points in my database that are an entered number of miles apart from an starting point.
How to get value of key from properties file javaScript
I have some javascripts in my html code, I want to get the strings form my language.properties file; Here is my language.properties file:
not_yet= you cant do this.
key=key
This is my javascript code:
var not= you cant do this.
How can I do it?
For example in my html I did somthing like this:
<fmt:setBundle basename="language" />
<th><label style="float:right;"><fmt:message key="key" /></label></th>
I saw some sulotion to do that in javaScript code but it's not working for me:
var someJSValue = '${language.key}';
Thank you!
Invalid token #end - Struts Velocity
I placed the following code in enter-protein.vm
<html>
<head>
<meta http-equiv="CONTENT-TYPE" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<h1> Enter Protein VELOCITY </h1>
#sform ("action = enter-protein")
#stextfield ("name=enteredProtein")
#ssubmit("value=Enter")
#end
<div>Amount entered: #sproperty ("value = enteredProtein")</div>
<div> Total for the day : 100 grms </div>
<div> #sproperty ("value=goalText")</div>
</body>
</head>
</html>
I get an error at #end as
Invalid token
#end
I also included additional directories like commons-collections-3.2.jar, velocity-1.6.2.jar, velocity-tools-view.2.0.jar
Generating line graphs with MySQL+PHP+Morris.js
Html table filled using php echo and css?
How do I make a empty 5x5 table styled with borders so it looks like a grid, then fill it with the numbers 1-25 using a php loop. This is what I have been able to accomplish so far.
html:
<table>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
</table>
Php
for($i=1; $i<=25; ++$i) {
echo $i "<td>";
}
Css
table {
border-collapse: collapse;
}
table, td {
border: 1px solid black;
}
Is An Empty Tag Such As <a href="#"> Valid For Accessibility Purposes?
Fifo sorting a sql table
Image fade to new image on hover
MySQL - Querying for records created "today", but date is in UTC
I currently store my datetimes in UTC, and for all purposes, it's worked fine so far. But now I want to query for records created on a particular day, like today, in my own timezone, which is Eastern.
Due to the difference in hours, records I'm creating at the moment will have tomorrow's date. For instance, the date portion would currently be 2016-06-20 in my timezone, but UTC is 2016-06-21.
How could I accurately get records for a particular day in my own timezone when the records are stored as UTC? I was thinking that I could use the convert_tz function to convert the stored value to Eastern, and use that as part of my where clause. That way the dates match up. Is that a reliable solution?
How to exclude a column during fitering in JavaScript
I have a JavaScript (jquery) to filter output of my query. But wen try to filter output table, filter finds hidden column values.
I need to exclude this hidden column during filtering.
Here is the code:
var $rowsActiveUser = $('#ku_list tr');
$('#search_ku').keyup(function() {
var val = $.trim($(this).val()).replace(/ +/g, ' ').toLowerCase();
$rowsActiveUser.show().filter(function() {
var text = $(this).text().replace(/s+/g, ' ').toLowerCase();
return !~text.indexOf(val);
}).hide();
});
and fiddle is here fiddle is here
If you filter "9c" u will see 2 output. One of is in hidden column, other is in MAC address column. I want to exclue hidden one in my filter process. How can I modify my script?
Check a radio button with javascript
HTML form variable for execution
i have a HTML form which takes any linux command as an input and I want to execute that command on the server and provide output back to the user. My issue is I am not able to pass the command entered in the textbox to Linux using execCode function. Following is my code.
Please advise how can i get this thing working. Thanks.
<form name="runCommand" method="GET">
iDirect Command Name:<br>
<input type="text" name="command" >
<!--input type="text" -->
<br><br>
var = document.getElementById("command").value
<!--input type="submit" value="Run Command" onclick="execCode('echo document.getElementById("command").value');return false"-->
<input type="submit" value="Run Command" onclick="execCode('echo var');return false">
</form>
Thanks in advance.
How do I get the element being edited?
I have an HTML div element that has contenteditable set to "true." The div contains a div inside it that has contenteditable set to "inherit." That div also has a child div with contenteditable set to "inherit." Here's what the HTML code looks like:
<div contenteditable="true">
text
<div contenteditable="inherit">
text
<div contenteditable="inherit">
text
</div>
text
</div>
text
</div>
The problem is, I can't find a way to get the selected element in JavaScript, because document.activeElement always returns the root div no matter which child is in focus.
How do I get the most specific element that's being edited, not just the uppermost ancestor?
What is a MYSQL Table (Prefix)? How do I use this with OSTICKETS
I'm trying to install a contact ticketing system osTickets
I don't have much knowledge at all of SQL, I've created a database and a username (linked them together).
I'm getting an error message:
Unable to connect to MySQL server: Access denied for user 'part-box_ost'@'localhost' (using password: YES)
Maybe this is because of the MySQL Table Prefix?
What can I do? Do I need to create a Table? if so what do I add?
vendredi 1 juillet 2016
Propel Code for Join over Columns from mulitple table
I have the below query that i am trying to convert to propel in php
select destinationdir.* from destinationdir
left join sourcedir on sourcedir.path = destinationdir.path
where destinationdir.pullrequestid = '421603579'
and destinationdir.checksum <> sourcedir.checksum
I managed to write upto below code(not sure if its right)
$c = new Criteria();
$c->addJoin(DestinationdirTableMap::COL_PATH,SourcedirTableMap::COL_PATH,Criteria::LEFT_JOIN);
$c->add(DestinationdirTableMap::COL_PULLREQUESTID,$pullrequestid,Criteria::EQUAL);
$result = SourcedirQuery::create('Test', $c)->toString();
For the above i get
SELECT FROM destinationdir LEFT JOIN sourcedir ON
(destinationdir.path=sourcedir.path) WHERE destinationdir.pullrequestid=:p1
Params: destinationdir.pullrequestid => 621440992
I dont understand how to add "destinationdir.checksum <> sourcedir.checksum" into the propel code.
Any help would be appreciated.
How to circumvent the infamous "unterminated string literal" error?
I attempted to load a simple HTML file into a canvas (browser = ff 3.66).
var canvas= document.getElementById('oneElement');
var ctx= canvas.getContext('2d');
var img= new Image();
ctx.drawImage(img, 0, 0, img.width, img.height);
img.src = 'data:text/html,<table><tr><td>data 1<td>data 2</td></tr>
<tr><td>data 3><td>data 4</td></tr>
<tr><td>data 5><td>data 6</td></tr>
</table>
';
How can I get around this problem?
simple form using bootstrap and php script completely not working
This is a html code for a simple contact form using bootstrap styling and the action linked in form tag to form_check.php I have been hitting my head hard as clicking the submit button doesnt perform any action and gives no output for even the simplest php script.
Heres the html part:
and heres the php script part in its simplest form still it is not working
Please help me out as even clicking the submit button performs no action at all. thanku in advance
Why does an I inside a span inside a button show up as IJ in Safari
I wrote the following code
<button>
<span style="font-weight:500;">I</span>
</button>
but when I run it on Safari I get a button with IJ instead of I written on it. It works just fine on Chrome.
Safari
Chrome
I've noticed this only happens when I have a span inside a button and the font-weight is exactly 500. This issue happens whenever there's an I, for example, if the button read TRY IT NOW it would show up in my Safari as TRY IJT NOW.
I'm running Safari 9.1 (10601.5.8.3).
How to get php site output in html in android webview?
Iam new to android.Iam trying to build an app which uses webview.when webview opens a php url is opening in webview,it contains input field of number ,when user gives input and hit the submit button data is appearing(the data page is also in php)how to get the data page in html? this is my code public class MainActivity extends AppCompatActivity { private WebView webview;
/**
* ATTENTION: This was auto-generated to implement the App Indexing API.
* See https://g.co/AppIndexing/AndroidStudio for more information.
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final WebView webview = (WebView) findViewById(R.id.webView);
webview.setWebViewClient(new WebViewClient());
webview.getSettings().setJavaScriptEnabled(true);
webview.loadUrl("https://somesite.etc/index.php?service=something");
}
public class myWebClient extends WebViewClient
{
@Override
public boolean shouldOverrideUrlLoading(WebView view, String Url) {
view.getUrl();
view.loadUrl(toString());
return false;
}
}}
JavaScript inserting images using string variable as their URL
I'm using JavaScript to parse a XML file. One of the XML's attribute is an URL which links to an image. eg. http://localhost/pic.jpg
As the parsing goes on, I use an variable to hold each URL(which is a string variable) and hoping that I can show these images in a table.
The following is part of my code:
for(i = 0; i < row.length; i++)
{
// looping through the XML file
var Logo1 = row[i].getElementsByTagName("Logo")[0].childNodes[0].nodeValue;
//Logo1 is the string which is a URL
document.write("<img src= 'Logo1' width='256' height='128'>");
}
I use Chrome, but the images won't load.... enter image description here
Can someone help?
Loop through database record to generate table
I want to construct an html table based on the returned results from the database. Assuming I have a table called constraints in my database and a column called riskName and it has these values: Security, Financial, Legal and Technical as shown in the image below. How do i loop through my database and come up with this table. I have tried different approach but no has worked. Here is my code so far:
<?php
error_reporting(0);
$optioner = 12;
$getObs = $db->prepare("SELECT * FROM constraints WHERE constraintsID = ?");
$riski->bindParam(1, $optioner);
$riski->execute();
$result = $riski->fetch(PDO::FETCH_ASSOC);
while($getObs->fetch(PDO::FETCH_ASSOC)){
echo "<tr><td>".($result['riskName'])."<td><tr>";
//...other code
}
?>
</tbody>
<?php };
?>
Inline CSS being stripped on <td> in Gmail (Internet Explorer) and Yahoo (Windows)
I am building HMTL emails and I use nested tables to layout the email. To change text I apply the styles directly to the < td > tags and this works for the most part across the board. I am noticing though on SOME heavily nested tabled (Greater then 5) the style is being removed completely on Gmail in Internet Explorer, and on Yahoo in various browsers (on a PC). Below is my code:
(This code is ~5 tables deep)
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td style="padding-bottom:10px;font-family:'Century Gothic',Arial, Helvetica, sans-serif; font-size:26px; color:#202020;">The Latest</td>
</tr>
</table>
Has anyone ran into this before or know why they might be stripping the style? It's not only text styles but the padding is also removed on these < td > tags.
Strange issue with mysql php pdo
form model binding in laravel 5.2
VBA: handling data in Document Object Model
I am currently trying to scrap data from a website using VBA. I am following this tutorial and hence my code is the following one:
Sub Foo()
Dim appIE As Object
Set appIE = CreateObject("internetexplorer.application")
With appIE
.Navigate "https://www.ishares.com/it/investitore-privato/it/prodotti/251843/ishares-euro-high-yield-corporate-bond-ucits-etf"
.Visible = True
End With
Do While appIE.Busy
DoEvents
Loop
Set allRowOfData = appIE.document.getElementsByClassName("visible-data totalNetAssets")
Dim myValue As String
myValue = allRowOfData.Cells(1).innerHTML
MsgBox myValue
End Sub
Unfortunately there are some differences between data I want to scrap and those ones used in the example: this line
myValue = allRowOfData.Cells(1).innerHTML
is wrong according to VBA debug.
Anyone could provide me with some explanations about why that doesn't work and how am I supposed to pick the right method to scrap HTML pages?
Email signature zoom on iOS Mail
How to set form value dynamically?
I have following code in Node.js:
<% var count = JSON.parse(data).Count;
var countInAPage = 10;
for(i = 0; i < count[0].count / countInAPage; i++) { %>
<form method="get" id="button-form" hidden>
<input type="text" name="from" value=
<% i * countInAPage; %>
>
<input type="text" name="to" value=
<% (i + 1 ) * countInAPage; %>
>
</form>
<button type="submit" form="button-form" value="Submit"><%- i + 1; %></button>
<% } %>
In above code count is coming from back end. Now i want to loop the HTML content, for doing so i need to assign the value for those above input type dynamically (as i tried above <% i * countInAPage; %>); but i am unable to do so.
So what would be the appropriate method or solution for such scenario, where i need to call get method on clicking the submit button?
Responsive image with description
How to stroke from top-center of rounded rectangle
summarize counts from multiple columns in a single table
I want to display count of data of two category on single display
my table like below :
table : funding
area client Donatur
-----------------------------------------
A Ox Mr.X
A Pr Mr.Y
A Qs Mr.Z
A Ts Mr.Z
B Rt Mr.X
C Ss Mr.X
C Sa Mr.Z
I want to display data to count based on area and donatur in on table like bellow
Donatur Count of Area Count of Client
--------------------------------------------------------
Mr.X 3 3
Mr.Y 1 1
Mr.Z 2 3
I have try to create query like below :
select count(client),count(area) from funding group by area,donatur
But i don't get any right number on one side, the result like below , same on both of them. It' should be like above
Donatur Count of Area Count of Client
--------------------------------------------------------
Mr.X 3 3
Mr.Y 1 1
Mr.Z 2 2
How to stop lines of code from automatically shifting to the next line whenever I resize the window of the editor?
I am using Sublime Text 2. When I am on an HTML file. If I resize the window. The code at the very end shifts down to the next line. How do I stop this from happening? I want the code to continue onward, so I will have to scroll side to side to see the rest of the code and not have the shift to the next line.
I have taken screenshots to better illustrate what I am referring to.
After window has been resized. Notice the number lines? How do I stop that? I'd rather scroll right to see the rest of the code instead of having the code jump to the next line.
I noticed this only happens in an HTML file.
Add event listener to DOM elements based on class,
I have a table, where each tr and td have only classes, I have a problem with selection of td element having the class I need.
HTML:
<table>
<tr class="data">
<td class="cell">1</td>
<td class="cell2"></td>
</tr>
<tr class="data">
<td class="cell">2</td>
<td class="cell2"></td>
</tr>
</table>
When mouseover td with class="cell" I have to get text between td on which my mouse and do something with this. This should be done with pure JavaScript, without frameworks. I tried:
var cell = document.querySelector('.cell');
function callback(){ //do something }
cell.addEventListener('mouseover',callback(),false);
It doesn't work, or maybe I did mistakes?
Easy way to do mysql "INSERT INTO" to Mysqllite
Hi I have the following Mysql code (Which i export from Mysql DB before I delete my tables from it). Now I have a MySQLlite DB, and I have the corresponding tables in this database. But when I run the INSERT INTO command exported from MySQL database is not seems to be working in MySQLlite. When I research I see that I need to manually add each row as one single INSERT INTO command. I have 100 of rows. It's almost impossible to do that. Any Idea guys how to do this insertion? Thanks in advance..
MYSQL INSERT INTO Command:
INSERT INTO `DEPT` (`id`, `dept_name`, `bp_name`, `standard`, `created_by_id`, `modified_by_id`, `date_created`, `date_modified`) VALUES
(23, 'DEQP', 'Kaizen', 'IEC 60812', 286, 286, '2016-05-16 14:32:30', '2016-05-19 14:25:06'),
(31, 'DEQP', 'test', 'IEC 60812', 286, 286, '2016-05-22 10:50:06', '2016-05-22 10:55:55'),
(32, 'IT', 'Design', 'IEC 60812', 286, 286, '2016-05-22 11:13:06', '2016-05-22 11:13:06');
Waterline ORM does not populate related data
I can't get the Waterline ORM to hydrate my join. https://github.com/balderdashy/waterline-docs
I have the following two models:
// primary model
identity: 'document',
tableName: 'document',
attributes: {
id: {
type: 'integer',
columnName: 'id',
primaryKey: true,
autoIncrement: true
},
// reference other models
data: {
model: 'document_data',
columnName: 'id',
},
},
// related model
identity: 'document_data',
tableName: 'document_data',
attributes: {
documentId: {
type: 'integer',
columnName: 'document_id',
primaryKey: true,
},
body: {
type: 'text',
columnName: 'body',
},
},
I can see the following logged:
MySQL.processChildren:
(SELECT * FROM document_data AS document_data WHERE document_id = 2 ORDER BY document_data.document_id ASC)
This is the correct query and I can confirm in the database.
But the data key is not populated in the document model. It's just an empty object data: {}