int my_strcmp(const char *out, const char *in ){
for( ;*(in) , *(out) && *(in) == *(out); *out++,*in++ );
return *in <= *out ? *out > *in : -1 ;
}
I don't know why but it works )))
else if result !== true && result === false { return result !== true }
should I keep this in our project or nah
@define
class DedupConfig:
columns_to_dedup_by: Optional[List]
time_range_in_minutes: Optional[int]
timestamp_column_name: Optional[str]
leave_deduped_samples_in_time_range: Optional[int] = field(default=1)
def __attrs_post_init__(self):
if not self.timestamp_column_name:
raise ValueError(f"timestamp_column_name parameter must be provided")
if not self.columns_to_dedup_by:
raise ValueError(f"columns_to_dedup_by parameter must be provided")
if not self.time_range_in_minutes:
raise ValueError(f"time_range_in_minutes parameter must be provided")
<table class="table table-sm o_main_table" style="width='100%'">
<!-- ... thanks ...-->
</table>
Found that on a customer's project, wonder if my employee knows about inline css
const rola = (usr: IUserData) => {
let student = "student"
let edukator = "edukator"
let dziekanat = "dziekanat"
let admin = "admin"
if(usr.type===1){
return student
}
else if(usr.type===2){
return edukator
}
else if(usr.type===3){
return dziekanat
}
else if(usr.type===4){
return admin
}
}
public static Integer find(List<String> list, String name, int i) {
if(list.get(i).equals(name)) {
return i;
}
else return find(list, name, i+1)
}
public class Main {
public static void main(String[] args) {
try {
//code goes here
} catch (Exception e) {
System.exit(0);
}
}
}
<?php
// This code supposed to find adjacent items of a specific one
// $list is an array of ids
// $itemToSearch is an id that might be in the $list
foreach ($list as $item) {
next($list);
if ($item == $itemToSearch) {
break;
}
$previousItem = $item;
}
$nextItem = current($list);
The $list variable is a list of ids, e.g [1, 2, 3, 4, 5] The $itemToSearch is an id that might be in $list
//https://gist.github.com/nim4n136/7fa38467181130f5a2270c39d495101e
function decrypt($msg_encrypted_bundle, $password){
$password = sha1($password);
$components = explode( ':', $msg_encrypted_bundle );
$iv = $components[0];
$salt = hash('sha256', $password.$components[1]);
$encrypted_msg = $components[2];
$decrypted_msg = openssl_decrypt(
$encrypted_msg, 'aes-256-cbc', $salt, null, $iv
);
if ( $decrypted_msg === false )
return false;
return $decrypted_msg;
}
//////////////////////////////////////////
// Add ROI coordinates into Environment
//////////////////////////////////////////
AddROIcoordinatesIntoEnvironment();
It really helped me understand the code.
# 5-level loop, forgive me...
for xi, xs in enumerate(X):
for yi, ys in enumerate(Y):
for zi, zs in enumerate(Z):
lx, ly, lz = len(xs), len(ys), len(zs)
# construct points
xx, yy, zz = custom_meshgrid(xs, ys, zs)
world_xyzs = (
torch.cat(
[xx.reshape(-1, 1), yy.reshape(-1, 1), zz.reshape(-1, 1)],
dim=-1,
)
.unsqueeze(0)
.to(count.device)
) # [1, N, 3]
# cascading
for cas in range(self.cascade):
bound = min(2**cas, self.bound)
half_grid_size = bound / resolution
# scale to current cascade's resolution
cas_world_xyzs = world_xyzs * (bound - half_grid_size)
# split batch to avoid OOM
head = 0
while head < B:
tail = min(head + S, B)
# world2cam transform (poses is c2w, so we need to transpose it. Another transpose is needed for batched matmul, so the final form is without transpose.)
cam_xyzs = cas_world_xyzs - poses[
head:tail, :3, 3
].unsqueeze(1)
cam_xyzs = cam_xyzs @ poses[head:tail, :3, :3] # [S, N, 3]
# query if point is covered by any camera
mask_z = cam_xyzs[:, :, 2] > 0 # [S, N]
mask_x = (
torch.abs(cam_xyzs[:, :, 0])
< cx / fx * cam_xyzs[:, :, 2] + half_grid_size * 2
)
mask_y = (
torch.abs(cam_xyzs[:, :, 1])
< cy / fy * cam_xyzs[:, :, 2] + half_grid_size * 2
)
mask = (
(mask_z & mask_x & mask_y).sum(0).reshape(lx, ly, lz)
) # [N] --> [lx, ly, lz]
# update count
count[
cas,
xi * S : xi * S + lx,
yi * S : yi * S + ly,
zi * S : zi * S + lz,
] += mask
head += S
fn second_word(s: &String) -> &str {
let bytes = s.as_bytes();
let mut k = 0;
let mut n =0;
for (i, &item) in bytes.iter().enumerate() {
if item == b' ' {
k = k + 1;
if k == 1 {
n = i;
}
else if k == 2 {
return &s[1+n..i];
}
}
}
&s[..]
}
the code looks like shit
function deleteConfirm() {
var result = confirm("Are you sure to delete this customer ?");
if (result) {
return true;
} else {
return false;
}
}
String zeroPad(int number) {
return number < 10 ? "0" + number : String.valueOf(number);
}
You could just have done String.format("%02d", number);
namespace network
{
class ip
{
uint _IP;
public ushort this[int i]
{
get
{
switch(i)
{
case 0:
case 1:
case 2:
case 3:
return (ushort)(_IP>>(i*8));
default:
throw new IndexOutOfRangeException();
}
}
set
{
switch(i)
{
case 0:
case 1:
case 2:
case 3:
_IP=(((uint)value)<<i*8);
break;
default:
throw new IndexOutOfRangeException();
}
}
}
}
}
I have no idea what this does