w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
While Sending Html Mails from my web application Recieved Mails contains Symbols like &ldquo,&rdquo, ‘
Check with another constructor for htmlView: ContentType mimeType = new System.Net.Mime.ContentType("text/html"); var htmlView = AlternateView.CreateAlternateViewFromString(bodyMessage, mimeType);

Categories : Asp Net Mvc

When using 32bit version of MySQL's .net connector to connect to a 64bit version of MySQL I get " Waiting for table metadata lock "
This doesn't sound like it has anything to do with 64/32 bit from the error message given. Have a look at this SO question and answer and see if that gives any clues: How do I find which transaction is causing a "Waiting for table metadata lock" state?

Categories : Mysql

Internet Explorer waiting for localhost forever
This problem may be caused by conflicts with IIS, if you have IIS installed You can reset IE settings.. for more visit http://windows.microsoft.com/en-us/windows7/Reset-Internet-Explorer-settings-in-Internet-Explorer-9 This tech guide describes the steps for resetting the advanced settings on Windows 7 for IE9.

Categories : Internet Explorer

c++ loop runs forever without waiting for input
You're writing a double 55.99 to an integer, so cin takes 55 and it has '.' in the buffer which is always !=-1 but never gets read into as integer.

Categories : C++

Queue.js to preload images is waiting forever? (Callbak)
Here is what queue.js is expecting from the callbacks: The callbacks follow the Node.js convention where the first argument is an optional error object and the second argument is the result of the task. Thus a simple version of your code might look like this: var loadImage = function(src, cb) { var img = new Image(); img.src = src; img.onload = function(){ cb(null, img); }; img.onerror = function(){ cb('IMAGE ERROR', null); }; }; queue() .defer(d3.json, "data/flare.json") .defer(d3.csv, "data/test.csv") .defer(loadImage, "img/test.png") .await( function(error, jsondata, csvdata, imagedata) { if (error) { console.log('error', error); } else { console.log('success', jsondata, csvdata, imagedata) } }); I'm not sure what (if anyt

Categories : Javascript

hibernate transaction will lock the row in table(MySQL)
The session.load() method has an overloaded method that take a third parameter which is a LockMode object: load(TaskFolder.class, 2, LockMode.UPGRADE); for example. Just look at the possible locks and choose the one you need.

Categories : Hibernate

Mysql gives me:"Can't open and lock privilege tables: Table 'host' is read only"
Answering my own question, The issue is with AppArmor. I am not sure why MySql is unable to access files even after uninstalling AppArmor. Reinstalled AppArmor and moved the MySql profile under disabled profiles of AppArmor, even then it did not work. I copied the database files under /var/lib/mysql/ and MySql stopped throwing errors

Categories : Mysql

Code gets stuck at acquiring wake lock while registering with GCM
You are using the com.google.android.gcm.GCMBroadcastReceiver broadcast receiver from the Google GCM client library. This class expects the intent service to be in the main package of your app (example.pro) but your intent service is in a different package - com.thinkappz.advancedtictactoe. That's why the receiver can't find the service. You should either move the GCMIntentService to the main package of your app, or override GCMBroadcastReceiver.

Categories : Android

Generate One Level Menu From MySQL Table
Some quick solution that comes in mind right now (not tested) : function getCategories($parentID = 0, $level = 0) { $categories = array(); $query = 'SELECT * FROM `table` WHERE `Parent` = '.(int)$parentID.' ORDER BY `Order` ASC'; $dbCats = runQuery($query); // you have to implement this foreach ($dbCats as $cat) { $categories[] = str_repeat('-', $level) . '<a href="'.$cat->Link.'">'.$cat->Name.'</a>' . " "; $categories += getCategories($cat->ID, ++$level); } return $categories; } $categories = getCategories(); echo implode('', $categories); However, you should look into Open Cart for example and see how it extracts categories.

Categories : PHP

Application boost::thread stuck on mutex lock when compiled for ARM running on BeagleBone Black
Looks like an upgrade of boost to version 1.54 fixes the issue. Took some time to get the right packages because Debian Wheezy's boost stable release is 1.49, so I had to manually upgrade my cross-compilation platform. The app can now run up to 380 threads without any problems, this is more than enough for me.

Categories : C++

How class level lock is acquired
On similar grounds what is used as a mutex when we acquire a class level lock The class object itself will be used as mutex. The equivalent synchronized block for your static synchronized method will look like: public static int getCountTwo() { synchronized(ClassName.class) { return count++; } } ClassName is the name of the class containing that method. See JLS Section § A synchronized method acquires a monitor (§17.1) before it executes. For a class (static) method, the monitor associated with the Class object for the method's class is used. For an instance method, the monitor associated with this (the object for which the method was invoked) is used. Emphasis mine.

Categories : Java

To what level does MongoDB lock on writes? (or: what does it mean by "per connection"
It is not per connection, it is per mongod. In other words the lock will exist across all connections to the test database on that server. It is also a read/write lock so if a write is occuring then a read must wait, otherwise how can MongoDB know it is a consistent read? However I should mention that MongoDB locks are very different to SQL/normal transactional locks you get and normally a lock will be held for about a microsecond between average updates.

Categories : Mongodb

Is there any way, in Python, to programmatically change the CAPS LOCK/NUM LOCK/SCROLL LOCK states on a hidraw device
Using library at Jakub Wilk's library at http://jwilk.net/software/python-keyboardleds, it is pretty simple: lk = LedKit('/dev/input/event1') lk.num_lock.reset() lk.caps_lock.reset() The trick is to determine which input device your keyboard is. To figure that out, you look at /proc/bus/input/devices. (Thanks to Jakub for this solution) I tested this on two a keyboards: PS1 keyboard connected via PS1 to USB adaptor with Holtek chipset (04d9:1400) A cheap numeric keypad, also with Holtek chipset (04d9:1603), HT82M99E. Result: It works for the former but not the latter. Perhaps someone knows whether that's a driver issue or a problem of the hardware itself (not responding to requests from the driver).

Categories : Python

This query on mysql is taking forever to execute
Without seeing your database, it is hard to find a way to make it faster. Maybe you can try to turn your WHERE IN to INNER JOIN. To something like this SELECT * FROM myTable INNER JOIN myOtherTable ON (myTable.id = myOtherTable.id_registro) WHERE myOtherTable.id_forma = '$id_club' AND myOtherTable.fecha_visita LIKE '%$hoy%' ORDER BY myTable.id DESC Noted that you should sanitize your variable before putting it SQL query or using PDO prepare statement.

Categories : PHP

MySQL query taking forever to run, what is wrong?
Things to check: Log the queries being executed from your C# code. You may "think" the same query is being executed from MySQL shell, but there's always a chance it may not be. Look at the query plan for the query and see what indexes, etc. are being used. You may need to create an index on Timestamp, which may help performance tremendously.

Categories : C#

Why doesn't LOCK TABLES [table] WRITE prevent table reads?
The point of LOCK is so that other sessions do not modify the table while you are using it during your specific session. The reason that you are able to perform the SELECT query is because that's still considered part of the same MySQL session, even if you open up a new window.

Categories : PHP

mysql select distinct date takes FOREVER on database w/ 374 million rows
When you have a composite index on 2 columns, like your (symbol, date) primary key, searching and grouping by a prefix of they key will be fast. But searching for something that doesn't include the first column in the index requires scanning all rows or using some other index. You can either change your primary key to (date, symbol) if you don't usually need to search for symbol without date. Or you can add an additional index on date: alter table minute_data add index (date)

Categories : Mysql

Forever stop server.js returns "server.js is not a valid index for a forever process."
No idea why this worked, but for some reason it solved my problem. Well not entirely, but partially. When I su root and then run the forever commands, I am able to start and stopall without a hitch. Still getting the same error for forever stop server.js, so for whatever reason I'm unable to stop the server that way, but I got around it by being able to run forever stopall as su root.

Categories : Node Js

Got stuck with Mysql query
You can write a join where you join same table twice with different alias such as Select a.*, o1.*, o2.*, u.* from advise a left join object o1 on a.object1 = o1.objectid left join object o2 on a.object2 = o2.objectid left join user u on a.userid = u.userid .... this kind of join is possible, and solve your issue.

Categories : Mysql

Waiting for a DynamoDB table to be deleted from DB
The documentation link you are pointing to is for V1 of the Amazon DynamoDB API, which is deprecated. The V2 version, which introduced local secondary indexes, is contained in the com.amazonaws.services.dynamodbv2 package. Here is the V2 documentation for ResourceNotFoundException.

Categories : Amazon

MySQL is stuck in sorting state
So after a lot of tryouts with my.cnf i fixed the issue by: Decreasing query cache value Decreasing key buffer value Decreasing tmp table value Disabled performance schema I've just tested various configurations and know on full traffic (about 6k people online) my mysql stays on 50% load which is pretty awsome. No sql or modifications were made, just innodb tweaking. Not really sure if this is an answer for someone with the same issue but its my answer at least. My.cnf query_cache_limit=128M query_cache_size=128M query_cache_type=1 key_buffer_size=128M tmp_table_size=64M performance_schema=off

Categories : Mysql

Stuck on some multichoice questions for MYSQL
4c Add another column and you'll get the error Column count doesn't match value count at row 1 a) Doesn't matter as long as you don't want to insert duplicate keys b) Data will get truncated and a warning is produced, but not a fail d) Not true, you can specify whatever value you want (as long as it's not a duplicate if the column is primary key or has an unique index on it) e) Why should it break. You don't have to have a PK, though I'd strongly recommend to have one. 6a c, d and e are not unique, of course. Difference between a and b is, in b district is not needed to make it unique. Would it be good to have district in the automatically created index for primary keys? No. If you want to improve performance of queries on this table, one can assume that almost every field of

Categories : Mysql

Need bootstrap Popover to work on table row level from an in table column
<button class="popButton" id = "myPopover" rel="popover" data-toggle="popover" data-content="I'm a popover!">I do nothing!</button> <button id = "myTrigger" data-src="#myPopover">Click me</button> <script> $('#myTrigger').click(function(){ $($(this).data("src")).popover('toggle'); }); $(function() { $('.popButton').popover({ trigger: "manual", placement: "top" }); }); </script> Code Edited to be a remote trigger with working fiddle http://jsfiddle.net/vEzDp/2

Categories : Twitter

Waiting for 2 AJAX request to complet (d3.js) whit optimize the temp waiting?
You don't do this, you use the general callback concept: function dostuff(callWhenDone) { // ... d3.tsv(ajaxUrl, function callWhenTSVCompletes(data) { // ... d3.json(ajaxUrl, function callWhenJSONCompletes(header) { //... callWhenDone(); // now we're done. }); }); }

Categories : Ajax

stuck mysql find last working day in previous month
if you subtract the day of current month then you will get the last day of previous month (DATE_SUB(CURDATE(),INTERVAL DAYOFMONTH(CURDATE()) DAY)) For example, on the 12th of the month if we subtract 12 days,then well get the the last day of the previous month:

Categories : Mysql

mySQL phpMyAdmin with Google Chrome: stuck on loading
I had the same issue and turns out, i had a python console running where I had opened up an sqlalchemy session and querying against the same database. Im guessing the rows from the table got locked and when i was trying to do any operation from the phpmyadmin interface, the database was not responding I killed the python console and phpmyadmin started responding as before. So long story short - check if there any other processes that have locked the tables in the database

Categories : Google Chrome

Mysql Order By String that contains numbers stuck to letters
The ORDER BY column+0 as suggested in comment by @Strawberry works. But as of myself, I prefer explicit CAST for code self-documentation (this will prevent future "optimization" of your code by someone deleting that "pointless" +0 ;): mysql> SELECT c,CAST(c AS DECIMAL),c+0 from T order by CAST(c AS DECIMAL) ASC; +--------------------------+--------------------+------+ | c | CAST(c AS DECIMAL) | c+0 | +--------------------------+--------------------+------+ | 22mm Diamond Core Drill | 22 | 22 | | 28mm Diamond Core Drill | 28 | 28 | | 32mm Diamond Core Drill | 32 | 32 | | 178mm Diamond Core Drill | 178 | 178 | | 187mm Diamond Core Drill | 187 | 187 | +------------------------

Categories : Mysql

in which mode should i lock my table?
What you are looking for is an "auto-increment" column for the id. In many databases, you can define such a column in the create table statement. Oracle does not make this so easy but it is possible. The "book" solution would be to define a before insert trigger on the table. It would always look up the value of idEmp and then add 1. For performance reasons, you would define an index on the column. Another solution is to use a sequence. This is described here.

Categories : SQL

MySQL Write Lock Priority
The manual has it all: A request for a LOW_PRIORITY WRITE lock, by contrast, permits subsequent READ lock requests by other sessions to be satisfied first if they occur while the LOW_PRIORITY WRITE request is waiting [to be granted]. Nothing is mentioned about an effect on WRITE lock requests, so the LOW_PRIORITY modifier has no effect on concurrent them. Beware, though: The LOW_PRIORITY modifier has no effect as of MySQL 5.5.3 And: As of MySQL 5.6.5, it is deprecated and its use produces a warning. Use WRITE without LOW_PRIORITY instead.

Categories : Mysql

VB.NET and Microsoft Access: Old table entries stuck in DataGridView
It turns out that I was able to resolve this after digging around MSDN for a while more. When I set up the connection for my grid's data source, it sends you through a wizard that helps you set up things like the type of data (database) and the connection string, among other things. After proceeding past the connection string stage, a pop up window asks you if you'd like to store a local copy of the database file that will be automatically updated by some event or another. SAY NO!!! This file isn't updated at all, and VS2010 helpfully redirects your data source to the local copy, which is never updated, which results in old, useless data in your grids. After redoing the connection and not saving a local database copy, my grid finally reflects the current contents of my table. I hope this s

Categories : Vb.Net

L2S DBML Table Stuck as "Internal" Visual Studio
I believe I have finally found a solution: Open the .dbml file outside Visual Studio (e.g. Notepad) Locate the problematic table definition. Change AccessModifier="Internal" to AccessModifier="Public" Save and close the .dbml file Update the table definitions in the .designer.cs file with the public modifier if you have not already done so. In theory the dbml designer should be doing this for me when I change that property on the table but unfortunately it doesn't for these particular tables. Following these steps fixed the problem.

Categories : Visual Studio

Lock Table at the begin of a Transaction
The problem is that with PESSIMISTIC_READ you are blocking others UPDATE on the row with the highest ID. If you want to block other's SELECT you need to use PESSIMISTIC_WRITE. I know it seems strange since you're not going to UPDATE that row.. ..but if you want the other blocks while executing a SELECT you should lye and say: "Hay all.. ..I read this row and will UPDATE it".. ..so that they will not be allowed to read that row sinche the DB engine thinks that you will modify it before the commit. SERIALIZABLE itself according to the documentation converts all plain SELECT statements to SELECT ... LOCK IN SHARE MODE so does not more than what you're already doing explicitly.

Categories : Java

Lock entire mysql database from hibernate
IMHO this approach is not desirable. After acquiring a read lock on all tables (which can be easily done by parsing the information_schema.tables table), subsequent attempts to write in the database will be held until they time out. Besides, all locks acquired by a session are released at the end of the session. The locking session would need to be kept active in order to keep the locks. As an alternative, I would recommend revoking write permissions to the user the application connects as. To do it, please refer to this previous answer of mine. Or perhaps you can have two users, one with all privileges, one with only read privileges. When you want to put your application in read-only mode, just switch users.

Categories : Java

SQL Server Table Lock during bulk insert
Did you specify any "Table Lock" hint. If you want to Row-level lock Set "Table Lock" to off. or check this it will help you... http://technet.microsoft.com/en-us/library/ms180876(v=sql.105).aspx

Categories : SQL

Will Oracle lock the whole table while performing a DML statement or just the row
It depends what you mean by "lock". For 99.9% of what people are likely to care about, Oracle will acquire a row-level lock when a row is modified. The row-level lock still allows readers to read the row (because of multi-version read consistency, writers never block readers and readers never do dirty reads). If you poke around v$lock, you'll see that updating a row also takes out a lock on the table. But that lock only prevents another session from doing DDL on the table. Since you'd virtually never want to do DDL on an active table in the first place, that generally isn't something that would actually cause another session to wait for the lock.

Categories : Oracle

SELECT + INSERT + Query Cache = MySQL lock up
Try to reduce the query cache size significantly. 1G is probably too big. Start with 16M or 32M and adjust the query_cache_limit accordingly (256K?) - and move your way up as the read performance increases without reaching "Waiting for query cache lock" on writes. "Be cautious about sizing the query cache excessively large, which increases the overhead required to maintain the cache, possibly beyond the benefit of enabling it. Sizes in tens of megabytes are usually beneficial. Sizes in the hundreds of megabytes might not be." http://dev.mysql.com/doc/refman/5.6/en/query-cache.html

Categories : Mysql

Table Lock - Timeout - ADO connection to SQL server via Excel VBA
Ok, So I did more digging, and apparently the table is getting locked because of the select statement built in the "Get External Data Sources" data connection in Excel. Now I guess I need to figure out how to stop the table from getting locked through Excel unless there is a way I can force SQL server to not allow locks, is that possible? I think the problem can be fixed by writing a link to SQL server via VBA. Searching further...

Categories : Sql Server

A way to access global hash table "avoid" lock
I think complexity of your algorithm does not worth it's benefits. Practically there are many more simpler solutions. Before you start it's better to determine usage pattern. I can summarize them this way: HashTable readonly - initialize it once, reads are safe. Append only or read/write ratio is high - recreate hashtable each write and use Interlocked.CompareExchange to replace. Read/write ratio is low - use spinwait based Reader/Writer lock. And remember - the only way to determine the best solution for the problem is careful testing and measurement!

Categories : Multithreading

Communications link failure to MySQL during long LOCK TABLES
Finally, I found out about the real reason. MySQL's wait_timeout has nothing to do with problem--as long as a statement is running (no matter for how long), the database session is not in the state SLEEP and hence the session will never be closed by MySQL. The reason seems to be the Linux operating system (Debian 6 or 7), which closes the tcp connection after being idle for 2 hours (the concrete mechanism is unknown to me, maybe someone can elaborate on this?). To avoid the described timeouts, one needs to send more frequent tcp keep alive packets. To do so, one has to decrease /proc/sys/net/ipv4/tcp_keepalive_time (I decreased it from 7,200 to 60). cat 60 > /proc/sys/net/ipv4/tcp_keepalive_time does this temporarily; to retain it after a system reboot, one has to set net.ipv4.tcp_kee

Categories : Mysql

MySQL Cluster Error: Lock wait timeout exceeded
I have seen issue like that with tables with BLOB/TEXT entries + long running select. NDB uses a hidden table to store chunks for larger objects, and as a side effect unique key SELECT's create a shared read lock for the tables. See http://dev.mysql.com/doc/refman/5.6/en/mysql-cluster-limitations-transactions.html So on a two node cluster node2> show create table test; | test | CREATE TABLE `test` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `i` int(11) DEFAULT NULL, `v1` text, PRIMARY KEY (`id`), UNIQUE KEY `i` (`i`) ) ENGINE=ndbcluster AUTO_INCREMENT=3 DEFAULT CHARSET=latin1 | node2> set @@autocommit=0; Query OK, 0 rows affected (0.00 sec) node2> set @@tx_isolation='READ-COMMITTED'; Query OK, 0 rows affected (0.00 sec) node2> start transaction; node2> sele

Categories : Mysql

© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.