Posts

Showing posts from June, 2004

Cannot Change Primary Key Because Of "incorrectly Formed Foreign Key Constraint" Error

Answer : The error Error on rename of ... errno: 150 - Foreign key constraint is incorrectly formed) happens because you are trying to drop a referenced primary key, even though you are disabling foreign key constraint checking with SET FOREIGN_KEY_CHECKS=0; Disabling foreign key checks would allow you to temporarily delete a row in the currency table or add an invalid currencyId in the foreign key tables, but not to drop the primary key. Changing a PRIMARY KEY which is already referenced by other tables isn't going to be simple, since you risk losing referential integrity between the tables and losing the relationship between data. In order to preserve the data, you'll need a process such as: Add a new Foreign key column ( code ) to each FK table Map the code foreign key from the previous currencyId via an update Drop the existing foreign key Drop the old currencyId foreign key column Once all FK's have been dropped, change the primary key on the

Asava Sundar Chocolate Cha Bangla Lyrics Code Example

Example: asava sundar chocolate cha bangla lyrics Asaawa sundar chocolate cha bangala Chnderi soneri chamachamata chaangala chocolate cha bngalyaala tofinch daar Shepatichya jhupakyaann jhaadun jaail khaar Gol gol lemanachya khidakya don 'ahaॅalo, haॅalo' karaayala chhotaasa fon Biskataanchya gach‍achiwar mor chhaanadaar Peparamintachya anganaat fuln laal laal Chaandichya jhaadaamaagn chaandoba rahaato Motyaachya fulaantun lapaachhapi khelato Unch unch jhokyaacha khel rngala Mainecha pinjara war taangala Kiti kiti sundar chaॉakaletacha bngala Chnderi soneri chamachamata chaangala

Android Lollipop Set Status Bar Text Color

Answer : You can not set the status bar text color by specifying any color explicitly But you can try below alternative which is Added in API 23, You can use "android:windowLightStatusBar" attribute in two ways "android:windowLightStatusBar" = true, status bar text color will be compatible (grey) when status bar color is light "android:windowLightStatusBar" = false, status bar text color will be compatible (white) when status bar color is dark <style name="statusBarStyle" parent="@android:style/Theme.DeviceDefault.Light"> <item name="android:statusBarColor">@color/status_bar_color</item> <item name="android:windowLightStatusBar">false</item> </style> You can check above api in below link - https://developer.android.com/reference/android/R.attr.html#windowLightStatusBar Here's a Java implementation of Gandalf458's answer. /** Changes the

Cassandra Full-Text Search

Answer : AFAIK Datastax Enterprise Search is the (commercial) successor of Solandra. Cassandra 2.0 supports so called "custom secondary indexes". Custom secondary indexes are Java code. Your own implementation has to implement the abstract class org.apache.cassandra.db.index.SecondaryIndex (See http://www.datastax.com/documentation/cql/3.1/cql/cql_reference/create_index_r.html) I'm not sure whether implementations exist for Elasticsearch or Solr. I would not recommend to code all the weird full text search logic like stemming, multiple/exotic language support or even geo spatial stuff. But SecondaryIndex would be a good point to start integrating your favorite search engine.

Angular Material Npm Install Code Example

Example 1: install angular material ng add @angular/material Example 2: angular npm angular material npm i @angular/material Example 3: ng add @angular/material npm install --save @angular/material @angular/cdk @angular/animations

Bootstrap Padding Spacing Code Example

Example 1: bootstrap Margin and padding Use the margin and padding spacing utilities to control how elements and components are spaced and sized. Bootstrap 4 includes a five-level scale for spacing utilities, based on a 1rem value default $spacer variable. Choose values for all viewports (e.g., .mr-3 for margin-right: 1rem), or pick responsive variants to target specific viewports (e.g., .mr-md-3 for margin-right: 1rem starting at the md breakpoint). Margin Y 0 Margin Y 1 Margin Y 2 Margin Y 3 Margin Y 4 Margin Y 5 Margin Y Auto Example 2: bootstrap spacing The classes are named using the format {property}{sides}-{size} for xs and {property}{sides}-{breakpoint}-{size} for sm, md, lg, and xl. Where property is one of: m - for classes that set margin p - for classes that set padding Where sides is one of: t - for classes that set margin-top or padding-top b - for classes that set margin-bottom or padding-bottom l - for classes that set margin-left or paddi

Amd Ryzen 5 Vs Intel I7 10th Gen Code Example

Example: ryzen 5 vs intel i5 10th gen AMD won by 1 point overall they all are dope

Can Anyone Explain Laravel 5.2 Multi Auth With Example

Answer : After lots of digging and lots of questions & answers I have finally managed to work Laravel 5.2 Multi Auth with two table, So I'm writing Answer of my own Question. How to implement Multi Auth in Larvel 5.2 As Mentioned above. Two table admin and users Laravel 5.2 has a new artisan command. php artisan make:auth it will generate basic login/register route , view and controller for user table. Make a admin table as users table for simplicity. Controller For Admin app/Http/Controllers/AdminAuth/AuthController app/Http/Controllers/AdminAuth/PasswordController (note: I just copied these files from app/Http/Controllers/Auth/AuthController here) config/auth.php //Authenticating guards 'guards' => [ 'user' =>[ 'driver' => 'session', 'provider' => 'user', ], 'admin' => [ 'driver' => 'session', 'pro

1,90 Cm In Feet Code Example

Example: cm to foot 1 cm = 0.032808399 foot

Bcrypt.js Uss Code Example

Example 1: bcryptjs npm i bcryptjs # yarn yarn add bcryptjs Example 2: bcrypt >> > import bcrypt >> > password = b "super secret password" >> > # Hash a password for the first time , with a randomly - generated salt >> > hashed = bcrypt . hashpw ( password , bcrypt . gensalt ( ) ) >> > # Check that an unhashed password matches one that has previously been >> > # hashed >> > if bcrypt . checkpw ( password , hashed ) : .. . print ( "It Matches!" ) .. . else : .. . print ( "It Does not Match :(" )

Chart Js Doughnut Chart Add Width Code Example

Example: chartJs height var ctx = document . getElementById ( "myChart" ) ; ctx . height = 500 ;

Apache Spark: Map Vs MapPartitions?

Answer : Imp. TIP : Whenever you have heavyweight initialization that should be done once for many RDD elements rather than once per RDD element, and if this initialization, such as creation of objects from a third-party library, cannot be serialized (so that Spark can transmit it across the cluster to the worker nodes), use mapPartitions() instead of map() . mapPartitions() provides for the initialization to be done once per worker task/thread/partition instead of once per RDD data element for example : see below. val newRd = myRdd.mapPartitions(partition => { val connection = new DbConnection /*creates a db connection per partition*/ val newPartition = partition.map(record => { readMatchingFromDB(record, connection) }).toList // consumes the iterator, thus calls readMatchingFromDB connection.close() // close dbconnection here newPartition.iterator // create a new iterator }) Q2. does flatMap behave like map or like mapPart

Ansible Community.Sops

Collection version 1.0.4 Plugin Index These are the plugins in the community.sops collection Lookup Plugins sops – Read sops encrypted file contents Modules load_vars – Load sops-encrypted variables from files, dynamically within a task sops_encrypt – Encrypt data with sops Vars Plugins sops – Loading sops-encrypted vars files See also List of collections with docs hosted here.

Always Show Windows CPU Monitor Graphic In Taskbar

Image
Answer : I have three programs for you. All of them are free: 1. XMeters Taskbar appearance: Setting: So far I'm satisfied with this program. 2. RAM CPU (+DISK) Taskbar It turns your taskbar into a dynamic color-changing resource meter. 3. CleanMem Mini Monitor This one actually display a floating panel and an icon in the notification area rather than in taskbar. It also has more settings than the two above. you can start your pc up with task manager running minimized Right click your desktop and select New then shortcut Type in taskmgr and hit enter Hit enter again Right click the new shortcut and go to properties In the Run dropdown select "Minimized" Click Start and All Programs Find Startup and right click the folder and select Open Drag the new shortcut into that folder Now the taskmanager will always run - minimized - when the computer boots. The @Keltari solution looks good, but the 'Task Manager' icon is still displayed in th

Archlinux Vs Ubuntu Core?

Answer : There are many differences between Ubuntu and Arch Linux. With Ubuntu core, you get a ready-made distribution (based on Debian) aimed towards embedded devices. Arch Linux on the other hand "is what you make it". After installing Arch Linux you are left with a minimal GNU/Linux system (not based on any other distribution). It is then up to you to configure the system as you want it. To summarize; Ubuntu core is indeed tailored towards embedded systems, whereas with Arch Linux you will have to do the tailoring yourself. Arch Linux link: https://wiki.archlinux.org/index.php/Arch_Linux Ubuntu Core link: http://www.ubuntu.com/internet-of-things Since this is an embedded project. I suggest you use either buildroot or yocto. Having used both, I further suggest you use buildroot. Its easier to get started with. However, if you have the time to come up to speed, pick yocto. Either is fine and although I am big fan or Arch and Debian, either of these two buil

Bootstrap 4 Grid Div Code Example

Example 1: bootstrap grids examples .col-md-8 .col-md-4 Example 2: .col-12 bootstrap .col-12{ flex: 0 0 100%; max-width: 100%; } Example 3: bootstrap grid This code will create 4 boxes placed side by side, which will be dynamically positioned, according to the size of the screen. We define the following behavior: class = "col-lg-3" class = "col-md-4" class = "col-sm-6" One of four columns One of four columns One of four columns One of four columns

Add Selected Attribute To Option In Select Menu With JQuery

Answer : As of jQuery 1.6 "To retrieve and change DOM properties such as the checked, selected, or disabled state of form elements, use the .prop() method." $("#someselect option[value=somevalue]").prop("selected", "selected") Edit: Select Option: $("#someselect option[value=somevalue]").prop("selected", true) Deselect Option: $("#someselect option[value=somevalue]").prop("selected", false) Check out this previous detailled answer on SO: If you really want to maitain HTML output with selected attribute, and not only have jQuery maitaining the right selectedIndex attribute on the select element, you can hack with original settAttr() function: select[0].options[select[0].selectedIndex].setAttribute('selected','selected'); But as soon as you keep using jQuery methods for val() or ':selected', you should'nt get any problem, you could have problem only if you were par

C Bool Variable Code Example

Example 1: boolean in c # include <stdbool.h> bool x = true ; Example 2: c bool # include <stdbool.h>

Clear Skies Dragon Shout Refuses To Clear Winterhold

Answer : There are other things going on in Winterhold that could be affecting the weather. If you follow through the mage guild / college quest, you'll get an idea of what's troubling that region, and it's possible they'll elaborate further in DLC. It's likely by design that you cannot use the shout there. Actually, if you use the shout inside the Courtyard of the college, the weather clears and stays clear as long as you don't step out of college grounds... Weather turns back to snow almost as soon as you step back on the bridge to Winterhold... Might be linked to the fact that the town was destroyed by the elements while the college hardly suffered. The most likely explanation is that the town is indeed cursed, and the college warded against the curse somehow, and the Thu'um is not strong enough to overcome the curse without the help of the college's wards.

Cast Int To Enum In Java

Answer : Try MyEnum.values()[x] where x must be 0 or 1 , i.e. a valid ordinal for that enum. Note that in Java enums actually are classes (and enum values thus are objects) and thus you can't cast an int or even Integer to an enum. MyEnum.values()[x] is an expensive operation. If the performance is a concern, you may want to do something like this: public enum MyEnum { EnumValue1, EnumValue2; public static MyEnum fromInteger(int x) { switch(x) { case 0: return EnumValue1; case 1: return EnumValue2; } return null; } } If you want to give your integer values, you can use a structure like below public enum A { B(0), C(10), None(11); int id; private A(int i){id = i;} public int GetID(){return id;} public boolean IsEmpty(){return this.equals(A.None);} public boolean Compare(int i){return id == i;} public static A GetVa

Can USOShared Log Files Be Deleted?

Answer : ETL stands for Event Trace Log file which is created by Microsoft Tracelog, a program that creates logs using the events from the kernel in Microsoft operating systems. It contains trace messages that have been generated during trace sessions, such as disk accesses or page faults. ETL files are used to log high-frequency events while tracking the performance of an operating system. Microsoft Windows records application and system-level warnings, errors, or other events to these binary files called the event trace logs, which can then be used to troubleshoot potential problems. To answer your query, you may delete these files and deleting will not affect anything on your system. The abnormal part is why do you have so many of them. If you cannot remember having turned on tracing in some part of Windows, it will take real detective work to find it out.

Bootstrap Starter Template Free Download Code Example

Example 1: bootstrap starter template <! doctype html > < html lang = " en " > < head > <!-- Required meta tags --> < meta charset = " utf-8 " > < meta name = " viewport " content = " width=device-width, initial-scale=1, shrink-to-fit=no " > <!-- Bootstrap CSS --> < link rel = " stylesheet " href = " https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css " integrity = " sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T " crossorigin = " anonymous " > < title > Hello, world! </ title > </ head > < body > < h1 > Hello, world! </ h1 > <!-- Optional JavaScript --> <!-- jQuery first, then Popper.js, then Bootstrap JS --> < script src = " https://code.jquery.com/jquery-3.3.1.slim.min.js " i

All Compiler Errors Have To Be Fixed Before Entering Playmode Code Example

Example: all compiler errors have to be fixed before entering playmode HOW TO GET RID OF All "compiler errors have to be fixed before you can enter playmode" 1 - check in the console tab if you have some errors in a code you wrote //the ones in red are the ones that probably are bothering you 2 - if you already fixed all the errors and you didnt get rid of it, try restarting unity 3 - if it didnt work just make another project 4 - if it DIDNT work reinstall unity 5 - if it didnt work call the the tech support 6 - if it didnt work restart yourselve

Android Center Text On Canvas

Image
Answer : Try the following: Paint textPaint = new Paint(); textPaint.setTextAlign(Paint.Align.CENTER); int xPos = (canvas.getWidth() / 2); int yPos = (int) ((canvas.getHeight() / 2) - ((textPaint.descent() + textPaint.ascent()) / 2)) ; //((textPaint.descent() + textPaint.ascent()) / 2) is the distance from the baseline to the center. canvas.drawText("Hello", xPos, yPos, textPaint); Center with Paint.getTextBounds() : private Rect r = new Rect(); private void drawCenter(Canvas canvas, Paint paint, String text) { canvas.getClipBounds(r); int cHeight = r.height(); int cWidth = r.width(); paint.setTextAlign(Paint.Align.LEFT); paint.getTextBounds(text, 0, text.length(), r); float x = cWidth / 2f - r.width() / 2f - r.left; float y = cHeight / 2f + r.height() / 2f - r.bottom; canvas.drawText(text, x, y, paint); } Paint.Align.CENTER doesn't mean that the reference point of the text is vertically centered. The reference point