Posts

Showing posts from June, 2016

Brand New Soldering Iron Tip Turns Black, Solder Won't Stick

Image
Answer : As pointed out in the comments and other answer, you need to clean the tip. There are two options for cleaning, depending on what you have, or what came with the Iron. A Compressed Cellulose sponge, which has been wetted with water. You want it to be damp, but not soaking wet. If it is soaking it just cools the tip down and doesn't help clean it. If it is dry, the sponge will burn, putting more crap on the tip. Image from here A Brass Wire cleaning sponge. These are not the same as steel wool. Steel wool is an abrasive which will damage the tip (as will sand paper). The tips are made internally of copper which is great for heat transfer, but will be damaged/dissolved by the tin in the solder. To allow the tip to work, it is plated with Iron which will withstand the soldering process, and is key to ensuring the tip can be used. This plating is thin and can be easily damaged by abrasives, or scratching against things. The brass wire sponges are not abrasive,

Are Open Redirects A Security Concern?

Answer : YES , and its an OWASP top 10 violation: OWASP A10 - Unvalidated Redirect. These are valuable for phishing and spam. Recently it was uncovered that spammers where exploiting Open Redirect vulnerabilities on US .gov websites for profit.

How To Print Float In C Code Example

Example 1: format specifier fro float in printf printf ( "%0k.yf" float_variable_name ) Here k is the total number of characters you want to get printed . k = x + 1 + y ( + 1 for the dot ) and float_variable_name is the float variable that you want to get printed . Suppose you want to print x digits before the decimal point and y digits after it . Now , if the number of digits before float_variable_name is less than x , then it will automatically prepend that many zeroes before it . Example 2: printf c float printf ( "%.6f" , myFloat ) ; Example 3: c printf float value I want to print a float value which has 2 integer digits and 6 decimal digits after the comma . If I just use printf ( "%f" , myFloat ) I'm getting a truncated value . I don 't know if this always happens in C, or it' s just because I'm using C for microcontrollers ( CCS to be exact ) , but at the reference it tells that % f get just th

6 Ways To Call External Command In Python

Answer : In this tutorial, I will list number of the ways (6 at the moment) to call external programs and the advantages and disadvantages of each: os.system(command) # Execute the command (a string) in a subshell. This is implemented by calling the Standard C function system(), and has the same limitations. Changes to sys.stdin , etc. are not reflected in the environment of the executed command. Advantage: This is nice because you can actually run multiple commands at once in this manner and set up pipes and input/output redirection. os.system("some_command < input_file | another_command > output_file") Disadvantage: You have to manually handle the escaping of shell characters such as spaces This also lets you run commands which are simply shell commands and not actually external programs os.popen(command[, mode[, bufsize]])

Cloud Firestore: How Is Read Calculated?

Answer : Since you're reading 10 documents, so you'll be charged for 10 document reads. The number of read API calls you use is not relevant here. Also see: Firestore read/write pricing; does .limit(25) counts as 25 reads or one? Understanding Firestore Pricing Firestore Pricing - Does The Amount Of Documents In A Collection Matters? QuizApp - Firebase/ FireStore Reads I did a bunch of testing of this and can confirm that the Firebase Database tab uses an insane amount of reads. For me it incurred a 600+ read count every single time I opened it. If I clicked off that tab and back onto it, I would get another 600+ hit on read count. I monitored the usage of this using the GCP Usage for Firestore so I could avoid having that window open. This is an absurd cost, it has taken me into 100k+ reads by scrolling through it without realizing what was happening. You could even hit a million pretty easy if you were spending a lot of time in there doing something. In addi

How To Use Laravel Resource Route Code Example

Example 1: laravel route resources // Implicit Model Binding Routes can be created with one line using either: Route :: resource ( 'photos' , PhotoController :: class ) ; // OR Route :: resources ( [ 'photos' = > PhotoController :: class , 'posts' = > PostController :: class , ] ) ; php artisan make : controller PhotoController -- resource -- model = Photo // makes a controller with stubouts for methods: // index // create // store // show // edit // update // destroy Example 2: how to named route resource laravel Route :: resource ( 'faq' , 'ProductFaqController' , [ 'names' = > [ 'index' = > 'faq' , 'store' = > 'faq.new' , // etc... ] ] ) ; Example 3: Route::resource php artisan make : controller PhotoController -- resource Example 4: Route::resource Route :: resource ( 'photos' , Phot

Add String In Uniqid Php Code Example

Example: php unique id uniqid ( [ string $prefix = "" [ , bool $more_entropy = FALSE ] ] ) : string

Media Querry For Smart Phone Code Example

Example 1: css tricks media queries /* ----------- iPhone 4 and 4S ----------- */ /* Portrait and Landscape */ @ media only screen and ( min - device - width : 320 px ) and ( max - device - width : 480 px ) and ( - webkit - min - device - pixel - ratio : 2 ) { } /* Portrait */ @ media only screen and ( min - device - width : 320 px ) and ( max - device - width : 480 px ) and ( - webkit - min - device - pixel - ratio : 2 ) and ( orientation : portrait ) { } /* Landscape */ @ media only screen and ( min - device - width : 320 px ) and ( max - device - width : 480 px ) and ( - webkit - min - device - pixel - ratio : 2 ) and ( orientation : landscape ) { } /* ----------- iPhone 5, 5S, 5C and 5SE ----------- */ /* Portrait and Landscape */ @ media only screen and ( min - device - width : 320 px ) and ( max - device - width : 568 px ) and ( - webkit - min - device - pixel - ratio : 2 ) { }

AWS Lambda: Clarification On Retrieving Data From Event Object

Image
Answer : Lambda is standalone service that doesn't need to be integrated with API Gateway. queryStringParameters , body , body mapping templates , all of this is specific not to Lambda, but to Lambda - API Gateway integration. If you are using Lambda with other services then the data is usually passed directly via event object and there is not much of a reason to pass it in some other way. For example, you can subscribe Lambda function to S3 bucket and use it to programatically process events such as file being uploaded to your bucket. In this case, information such as bucket name, object key, object data, metadata, ... will be passed directly via event object. And, when using Lambda with API Gateway, why would you want to use body mapping templates to pass data to your Lambda function directly via event object? Because you can reuse that function much easier for other purposes (if viable in your scenario), because your Lambda function will have much simpler interface,

Arrays.asList() Vs Collections.singletonList()

Answer : Collections.singletonList(something) is immutable whereas Arrays.asList(something) is a fixed size List representation of an Array where the List and Array gets joined in the heap. Arrays.asList(something) allows non-structural changes made to it, which gets reflected to both the List and the conjoined array. It throws UnsupportedOperationException for adding, removing elements although you can set an element for a particular index. Any changes made to the List returned by Collections.singletonList(something) will result in UnsupportedOperationException . Also, the capacity of the List returned by Collections.singletonList(something) will always be 1 unlike Arrays.asList(something) whose capacity will be the size of the backed array. I would just add that the singletonlist is not backed by an array and just has a reference to that one item. Presumably, it would take less memory and can be significant depending on the number of lists you want to create. Th

Chrome Ipad Extensions Code Example

Example: chrome extension on ipad No, Chrome extensions do not work on iPad or iPhone. There is no web browser for the iPad that allows a desktop-level extension. It is not Apple’s policy to allow developers to include downloadable module engines in their apps, for multiple reasons which also include Apple’s security restrictions.

Colorzilla Gradient Generator Code Example

Example 1: css gradient generator /*CSS Gradient Generator*/ https://cssgradient.io/ /*Example*/ .My-Class { background: linear-gradient(to right, blue/*Color1*/, dodgerblue/*Color1*/); } Example 2: css gradient generator background: linear-gradient(Direction (keyword or degrees), color1 10% (10% width), color2 width (it's not neccessary), ...);

Angular 10 Ngstyle Conditional Example

Example 1: conditional style angular < div [ngStyle] = " { ' color ' :employee.country === ' India ' ? ' orange ' : ' red ' } " > </ < div > Example 2: ngstyle conditional < div [ngClass] = " { ' class1 ' : true, ' class2 ' : false} " > </ div > <!--passed as an object-->

1 Bit Is Equal To Byte Code Example

Example: 1 byte is equal to how many bits 1 byte = 8 bits

Best Ide's For Javascript Code Example

Example: best javascript ide Depends on your habits - If you like powerfull IDE that includes everything, Webstorm is a good start but it is quiet greedy. Otherwise, Visual studio code is a good choice, it's lighter, but need more configuration and installing extensions (like snippets, linter, debugger, ...). At the end, you can approximally get to WebStorm performances but in this case you take what you need, so it takes less time to start/dev. There are also some other apps like notepad (if you're suicidal), vim, atom, brackets, ... But the support / community on WS/VSC are juste colossal.

AWS Lambda TooManyRequestsException: Rate Exceeded

Image
Answer : As noted by Michael , this is the error message you will see when you reach the documented default " safety " limit of 100 concurrent invocations : " AWS Lambda has a default safety throttle of 100 concurrent executions per account per region. If you wish to submit a request to increase the throttle of 100 concurrent executions you can visit our Support Center ..." The solution was to open a support ticket providing the following info: Limit increase request 1 Service: Lambda Region: EU (Ireland) Limit name: concurrent requests (average duration * average TPS) New limit value: 2000 And then in the body of the ticket/request try to estimate your usage pattern: Expected average requests per second: 200 Expected peak requests per second: 2000 Expected function duration: 2 seconds Function memory size: 1000mb Invocation Type: Request-response Event Source: Api Gateway & Lambda<->Lambda It can take a while to get a res

Bootstrap Tabs In Carousel Code Example

Example: bootstrap tabs < nav > < div class = " nav nav-tabs " id = " nav-tab " role = " tablist " > < button class = " nav-link active " id = " nav-home-tab " data-bs-toggle = " tab " data-bs-target = " #nav-home " type = " button " role = " tab " aria-controls = " nav-home " aria-selected = " true " > Home </ button > < button class = " nav-link " id = " nav-profile-tab " data-bs-toggle = " tab " data-bs-target = " #nav-profile " type = " button " role = " tab " aria-controls = " nav-profile " aria-selected = " false " > Profile </ button > < button class = " nav-link " id = " nav-contact-tab " data-bs-toggle = " tab " data-bs-target = " #nav-contact " type = " button &

Array Length Python Code Example

Example 1: size array python size = len ( myList ) Example 2: python get array length # To get the length of a Python array , use 'len()' a = arr . array ( ‘d’ , [ 1.1 , 2.1 , 3.1 ] ) len ( a ) # Output : 3 Example 3: find array length python array = [ 1 , 2 , 3 , 4 , 5 ] print ( len ( arr ) ) Example 4: python array length len ( my_array ) Example 5: find array length in python a = arr . array ( 'd' , [ 1.1 , 2.1 , 3.1 ] ) len ( a )