Posts

Showing posts from March, 2006

Blender How To Connect Vertices Code Example

Example 1: how to select all vertices in blender I'm Struggling Like U Example 2: how to connect two vertices in blender Guy below me

Android Sha1 Certificate Fingerprint Code Example

Example 1: android developer sha1 fingerprint keytool -list -v \ -alias androiddebugkey -keystore %USERPROFILE%\.android\debug.keystore Example 2: how to get sha 1 in android studio keytool -list -v -keystore "%USERPROFILE%\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android

Beautifulsoup Multiple Class Selector

Answer : Use css selectors instead: soup.select('div.A.B') You can use CSS selectors instead, which is probably the best solution here. soup.select("div.classname1.classname2") You could also use a function. def interesting_tags(tag): if tag.name == "div": classes = tag.get("class", []) return "A" in classes and "B" in classes soup.find_all(interesting_tags) table = soup.find_all("tr",class_=["odd","even"]) Try this way! Make sure you are using proper structure of those quotes and braces. It confused me.

Can't Reset MySQL (MariaDB) Root Password

Answer : I have found a solution that is as strange as the problem itself. Reboot MySQL/MariaDB using --skip-grant-tables (search for tutorials on the web). (not necessary at all, read my edits at the end of the post) Look at the plugin field into the mysql.user table: MariaDB [mysql]> SELECT user, plugin FROM user; +------+-------------+ | user | plugin | +------+-------------+ | root | unix_socket | | root | unix_socket | | root | unix_socket | | root | unix_socket | +------+-------------+ I had to reset the plugin field of each entry to a blank string. UPDATE user SET plugin=""; // without WHERE clause Also, make sure that a password is defined, because sometimes it seems to be erased (select on user, password fields). If not, update it with: UPDATE user SET password=PASSWORD("my_password") WHERE user="root"; Privileges parameters need to be saved explicitly: FLUSH PRIVILEGES; Then, restart MySQL in normal mode and

Ado Meaning Code Example

Example: ado stands for ActiveX Data Objects

AutoHotkey Gui, Add, Button Code Example

Example: gui button ahk Gui, Add, Button gLayer1 w80, Button ;The "g" command in a button (in this case gLayer1) is a goto command. If you press the button, it goes to layer1 Gui, Show ;Shows the gui Layer1: ;The layer that becomes active when you press the button MsgBox, You pressed the button ;A simple Messagebox

Casting Smallint To Boolean In PostgreSQL

Answer : CREATE OR REPLACE FUNCTION boolean1(i smallint) RETURNS boolean AS $$ BEGIN RETURN (i::smallint)::int::bool; END; $$ LANGUAGE plpgsql; CREATE CAST (smallint AS boolean) WITH FUNCTION boolean1(smallint) AS ASSIGNMENT;

(change) Vs (ngModelChange) In Angular

Answer : (change) event bound to classical input change event. https://developer.mozilla.org/en-US/docs/Web/Events/change You can use (change) event even if you don't have a model at your input as <input (change)="somethingChanged()"> (ngModelChange) is the @Output of ngModel directive. It fires when the model changes. You cannot use this event without ngModel directive. https://github.com/angular/angular/blob/master/packages/forms/src/directives/ng_model.ts#L124 As you discover more in the source code, (ngModelChange) emits the new value. https://github.com/angular/angular/blob/master/packages/forms/src/directives/ng_model.ts#L169 So it means you have ability of such usage: <input (ngModelChange)="modelChanged($event)"> modelChanged(newObj) { // do something with new value } Basically, it seems like there is no big difference between two, but ngModel events gains the power when you use [ngValue] . <select [

Bootstrap Border-width Code Example

Example 1: bootstrap border color < span class = " border border-primary " > </ span > < span class = " border border-secondary " > </ span > < span class = " border border-success " > </ span > < span class = " border border-danger " > </ span > < span class = " border border-warning " > </ span > < span class = " border border-info " > </ span > < span class = " border border-light " > </ span > < span class = " border border-dark " > </ span > < span class = " border border-white " > </ span > Example 2: border radius bootstrap Border-radius Add classes to an element to easily round its corners. < img src = " ... " alt = " ... " class = " rounded " > < img src = " ... " alt = " ... " class = " r

How To Fix Control Reaches End Of Non-void Function Code Example

Example: control reaches end of non-void function return result_of_calling_function ; //I need to write this, otherwise I will get an error.

Asterix Character Bash Case Statement Code Example

Example 1: bash case statement case "$1" in start ) start ; ; stop ) stop ; ; restart ) stop ; start ; ; * ) echo $ "Usage: $0 {start|stop|restart}" exit 1 esac Example 2: bash case statement case expression in pattern1 ) statements ; ; pattern2 ) statements ; ; . . . esac

Cat Text Art Code Example

Example: cat text art _ | \ | | | | |\ | | /, ~\ / / X `-.....-------./ / ~-. ~ ~ | \ / | \ /_ ___\ / | /\ ~~~~~ \ | | | \ || | | |\ \ || ) (_/ (_/ ((_/

Arabic Lorem Ipsum Code Example

Example: lorem ipsum arabic "لوريم ايبسوم دولار سيت أميت ,كونسيكتيتور أدايبا يسكينج أليايت,سيت دو أيوسمود تيمبور أنكايديديونتيوت لابوري ات دولار ماجنا أليكيوا . يوت انيم أد مينيم فينايم,كيواس نوستريد أكسير سيتاشن يللأمكو لابورأس نيسي يت أليكيوب أكس أيا كوممودو كونسيكيوات . ديواس أيوتي أريري دولار إن ريبريهينديرأيت فوليوبتاتي فيلايت أيسسي كايلليوم دولار أيو فيجايت نيولا باراياتيور. أيكسسيبتيور ساينت أوككايكات كيوبايداتات نون بروايدينت ,سيونت ان كيولبا كيو أوفيسيا ديسيريونتموليت انيم أيدي ايست لابوريوم." "سيت يتبيرسبايكياتيس يوندي أومنيس أستي ناتيس أيررور سيت فوليبتاتيم أكيسأنتييوم دولاريمكيو لايودانتيوم,توتام ريم أبيرأم,أيكيو أبسا كيواي أب أللو أنفينتوري فيرأتاتيس ايت كياسي أرشيتيكتو بيتاي فيتاي ديكاتا سيونت أكسبليكابو. نيمو أنيم أبسام فوليوباتاتيم كيواي فوليوبتاس سايت أسبيرناتشر أيوت أودايت أيوت فيوجايت, سيد كيواي كونسيكيونتشر ماجناي دولارس أيوس كيواي راتاشن فوليوبتاتيم سيكيواي نيسكايونت. نيكيو بوررو كيوايسكيوم ايست,كيواي دولوريم ايبسيوم كيوا دولار سايت أم

AspectJ Maven Plugin Cannot Compile My Project

Image
Answer : It seems like a known issue http://jira.codehaus.org/browse/MASPECTJ-125 You can fix it by adding the following to your pom file. <complianceLevel>1.6</complianceLevel> Update: While the things I said about AspectJ Maven configuration in this answer are all correct, the root cause of the concrete problem at hand - bad Maven dependency management - is described in my other answer. It would be better if that one was the accepted answer and not this one. User codelion's hint makes sense, please change your <compilationLevel> tag (typo?) - to <complianceLevel> . There is no need to downgrade to plugin version 1.6, you can keep 1.7. There is also no need to specify the configuration again within the <execution> section, the one at plugin level is enough. Please note that the default AspectJ version in plugin 1.7 is 1.8.2, so maybe your runtime dependency on 1.7.4 works, but if I were you I would upgrade that one too, optimally in

Apple - Best Audio Converter For Mac

Image
Answer : My favorite converter is XLD. It converts to flac, splits cue files, it supports metadata correction (using CDDB), and embeds album artwork. It is the closest I could find to dBpoweramp. I use Max converter It can converts to many format but have some cons too :( My suggestion is the same presented here previously, but I use them for different things. Both Rip and XLD are good rippers for Mac. They support AccurateRip and use MusicBrainz for metadata, so you get certified rips with good tags. I always rip first to FLAC (single FLAC file + CUE) and them convert the rip into individual MP3 files. If I need to rerip, I go for the FLAC file, not the CD. If I used XLD for both tasks, I would be constantly messing with the configuration, changing from FLAC to MP3, and every now and then would forget and rip to the wrong format. So, I use XLD for the initial rip and Max to convert the FLAC into MP3. Later I learned about SBooth's Rip and started using it inst

Coding With Mosh Courses Code Example

Example: coding with mosh Master the Coding Skills to Become an Engineer Companies LOVE to Hire Hi ! His name is Mosh Hamedani. His life’s mission is to help novice and professional software engineers increase their skills, make more money and ultimately change their lives for the better.

Assignment With Line Continuation - Python

Answer : I don't think there is any problem with line continuation in Python. But sometimes I prefer this: big_variable['big_key']['big_value'] =( another_big_variable_that_pushes_line_over_79_characters ) It is useful in long expressions, too. Line continuation is a bit taboo, but not the end of the world. We must always strive to write code such that some other programmer down the line can understand what we were doing. Using the line continuation character \ is but one tool in our arsenal for achieving this goal of legibility. Naming conventions are another issue. As da Vinci said "Simplicity is the ultimate sophistication." If you can make variable names small AND understandable, then you are sophisticated ;-). It's too easy to just say var1, var2, var3 etc. Coming up with good names is a skill , which takes effort. Would you rather see a variable named ChiefExecutiveOfficerOfCompanysName or CEOName ? If you can combine if

Add Jquery To Html Code Example

Example 1: import js in html < script type = "text/javascript" src = "yourfile.js" > < / script > Example 2: jquery cdn google < script src = "https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js" > < / script > Example 3: html include jquery < ! -- Wrap inside the head tag -- > < script src = "https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js" > < / script > Example 4: how to use jquery < ! -- First either download , or use CDN and reference it -- > < ! -- Here we grab it from a CDN -- > < script src = "https://code.jquery.com/jquery-3.4.1.js" integrity = "sha256-WpOohJOqMqqyKL9FccASB9O0KwACQJpFTUBLTYOVvVU=" crossorigin = "anonymous" > < / script > < ! -- Lets say we have some < p > , with simple text we give it an id -- > < p id = "example" > Hello , world

Buscar Substring Php Code Example

Example 1: php string contains $mystring = 'abc' ; $findme = 'a' ; $pos = strpos ( $mystring , $findme ) ; Example 2: strpos php <?php $mystring = 'abc' ; $findme = 'a' ; $pos = strpos ( $mystring , $findme ) ; // El operador !== también puede ser usado. Puesto que != no funcionará como se espera // porque la posición de 'a' es 0. La declaración (0 != false) se evalúa a // false. if ( $pos !== false ) { echo "La cadena ' $findme ' fue encontrada en la cadena ' $mystring '" ; echo " y existe en la posición $pos " ; } else { echo "La cadena ' $findme ' no fue encontrada en la cadena ' $mystring '" ; } ?>

Change The Database Connection Dynamically In Laravel

Answer : This way you can set new parameter when it comes to database: \Config::set('database.connections.mysql.database', $schemaName); Remember about PURGE to persist this settings DB::purge('mysql'); Cheers! Well you can use the default database for user login and have a new field for the database name. Then whenever you need to query a different database, you can just change your db connection. Something like this $someModel = new SomeModel; $databaseName = "mysql2"; // Dynamically get this value from db $someModel->setConnection($databaseName); $something = $someModel->find(1); You can read more about it here. http://fideloper.com/laravel-multiple-database-connections you need to get the config first.. then alter the specific field then set it back.. $config = Config::get('database.connections.company'); $config['database'] = "company_tenant_$id"; $config['password'] = "test2123";

Body Of Http.DELETE Request In Angular2

Answer : The http.delete(url, options) does accept a body. You just need to put it within the options object. http.delete('/api/something', new RequestOptions({ headers: headers, body: anyObject })) Reference options interface: https://angular.io/api/http/RequestOptions UPDATE : The above snippet only works for Angular 2.x, 4.x and 5.x. For versions 6.x onwards, Angular offers 15 different overloads. Check all overloads here: https://angular.io/api/common/http/HttpClient#delete Usage sample: const options = { headers: new HttpHeaders({ 'Content-Type': 'application/json', }), body: { id: 1, name: 'test', }, }; this.httpClient .delete('http://localhost:8080/something', options) .subscribe((s) => { console.log(s); }); You are actually able to fool Angular2 HTTP into sending a body with a DELETE by using the request method. This is how: let body = { target: targetId, subset: "frui

Chartjs Treemap Example

Answer : Chart.js is great, but has small number of chart types. Chart.js is lib to use provided charts, not to create own chart types. D3.js is lib for producing data visualizations. See examples. You can find few treemap examples (i.e. this or this) done with d3.js This snippet is an example of the treemap module for chart.js. Also here are more examples and the documentation. var topTags = [ {tag:'python',num:133269},{tag:'javascript',num:109742},{tag:'java',num:65490},{tag:'c#',num:45445},{tag:'html',num:43767},{tag:'android',num:42657},{tag:'reactjs',num:38844},{tag:'php',num:34381},{tag:'sql',num:29996},{tag:'python',num:29942},{tag:'css',num:29654},{tag:'r',num:28319},{tag:'c++',num:27389},{tag:'node.js',num:25415},{tag:'angular',num:24093},{tag:'pandas',num:23826},{tag:'arrays',num:23075},{tag:'jquery',num:18968},{tag:'

Android: MediaPlayer SetVolume Function

Answer : This function is actualy wonderful. Thanks to it you can create a volume scale with any number of steps! Let's assume you want 50 steps: int maxVolume = 50; Then to set setVolume to any value in this range (0-49) you do this: float log1=(float)(Math.log(maxVolume-currVolume)/Math.log(maxVolume)); yourMediaPlayer.setVolume(log1,log1); //set volume takes two paramater Nice and easy! And DON'T use AudioManager to set volume! It will cause many side effects such as disabling silent mode, which will make your users mad! Following user100858 solution I just post my exact code that works: private final static int MAX_VOLUME = 100; ... ... final float volume = (float) (1 - (Math.log(MAX_VOLUME - soundVolume) / Math.log(MAX_VOLUME))); mediaPlayer.setVolume(volume, volume); soundVolume is the volume you would like to set, between 0 and MAX_VOLUME. So between 0 and 100 in this example. For Android MediaPlayer.setVolume , searching the web seems to show 0.0f

Can Anybody Please Explain (my $self = Shift) In Perl

Answer : First off, a subroutine isn't passed the @ARGV array. Rather all the parameters passed to a subroutine are flattened into a single list represented by @_ inside the subroutine. The @ARGV array is available at the top-level of your script, containing the command line arguments passed to you script. Now, in Perl, when you call a method on an object, the object is implicitly passed as a parameter to the method. If you ignore inheritance, $obj->doCoolStuff($a, $b); is equivalent to doCoolStuff($obj, $a, $b); Which means the contents of @_ in the method doCoolStuff would be: @_ = ($obj, $a, $b); Now, the shift builtin function, without any parameters, shifts an element out of the default array variable @_ . In this case, that would be $obj . So when you do $self = shift , you are effectively saying $self = $obj . I also hope this explains how to pass other parameters to a method via the -> notation. Continuing the example I've stated a

10001 Signed Binary To Decimal Code Example

Example 1: binary to decimal double binaryToDecimal ( char binary [ DIM ] ) { char binary2 [ DIM ] = "" , floa [ DIM ] = "" ; double decimal = 0 , negDec = 0 , flo = 0 ; int count = 0 , j = 0 , i = 0 , f = 0 , g = 0 , h = 0 , count1 = 0 , d = 0 , k = 0 ; while ( binary [ d ] != '\0' && binary [ d ] != '.' ) { d ++ ; } d -- ; if ( binary [ 0 ] == '-' ) { while ( binary [ k ] != '\0' ) { binary [ k ] = binary [ k + 1 ] ; k ++ ; } k = 0 ; while ( binary [ k ] == '0' ) { d -- ; k ++ ; } negDec = pot ( 2.000 , d * 1.000 , 1 ) ; } while ( binary [ i ] != '\0' && binary [ i ] != '.' ) { i ++ ; } i -- ; count = i ; h = i ; while ( binary [ h ] != '\0' ) { floa [ g ] = binary [ h + 2 ] ; g ++ ; h ++ ; } g -- ; count1 = g ; w

Brew Install Postgresql (upgrade) Error, Could Not Link - Dead Links To Old Non-existent Version

Answer : I had the similar problem but with another package. Turned out there had been a bunch of dead links pointing to the old version all other my file system. Here is what helped in my case: Run brew link <appname> (e.g. brew link postgress ); If completed successfully then you are golden, otherwise proceed with the next step; Take a look at the path in the error message (e.g. /usr/local/Cellar/postgresql/9.2.3/include/server ) transform the path by removing the Cellar/<app name>/<version> from it (e.g. /usr/local/include/server ) Find under that path all links referring to Cellar/<app name>/<version> and remove them; Goto step 1. Hope that helps brew update brew doctor is always first steps. to help finding files, update the files db sudo /usr/libexec/locate.updatedb this is similar to updatedb on ubuntu and you might want to alias it. then you may perform locate postgresql and learn more about where things are. Chanc