Search the Community
Showing results for tags 'code'.
-
As the title suggests : what is the most horrendous solution you ever came up with to solve a problem. if you have been programming for a while you certainly have some in your collections , the pieces of code where you tought , "i really shouldnt leave this inhere, this is an atrocity , but it works great! so ..." ill start with a python (but yours can be any language) ones , i have quite many of them but these are the simplest: unlike in C, python does not have a bitflip operator , in C we have '~' , but it does a different thing in python : however if you mess around enough you eventually get to : and if you do some swapping around over strings of the bits it even works for multibyte binary numbers (eg for a series of input that get all inverted or so) this one really is but anyway im looking forward to anything you have came up with that your kinda proud of but really is beter not seen by someone assessing your code
-
Hi all, I'm writing to ask if anyone has ever been able to make an LCD display like this one work on Linux. I don't mind if I have to code something out for this to work, but I have no idea where to start. I do not want to download the TT RGB PLUS 2.0 Software, and honestly would rather just sell the panel before having to install it. If anyone has any ideas, or if it's a lost cause, I'd love to hear the advice. TIA :)
-
Hi! Yet again, I've got an issue. The problem occurs when I sleep my pc and I try to login back into windows. When this happens it says "Something went wrong and your PIN isn't available (code: 0x80280013). Click to set up your pin again." What fixes it is a simple restart and we're back in without resetting any PIN at all. Now I just feel really confused what's causing this issue when I sleep my pc. This has only happened when swapping over to windows 11. Do you think re applying the pin again may fix it or what? Please help! Many Thanks, Fire. SCS
-
Hey guys I'm a freshman IT student and our professor tasked us to make a POS System I want to make a temporary name for my JLabel so that I can just change the value when I call the method of the formula but its not working because it treats the name of the temporary variable as a String (I declared it as a String cus idk what else to declare it xd) Main method code: Method code with the formula that I want to call: What I'm trying to achieve: I placed a JLabel with the square thingy as the text ("") and I want to change its color depending on the value of the stock... It would basically act as a status indicator for the stock
-
Okay so im making a website, and i like to see what I'm doing, and that's pretty easy when developing for 1920x1080 but not when you want to make it responsive to for example mobile devices, because then i cant see what the fuck I'm doing. Can anybody give me some tips on how to see what I'm doing? because when i do it in the device toolbar of chrome it looks good in the resolutions i make but when my users visit the sites it looks different, and yes i upload the right things to public.html I'd appreciate it if someone could tell me how i can see what I'm doing, Thanks in advance! My current code: #gay-pic-1 { position: absolute; bottom: 500px; left: 1200px; } button:hover { box-shadow: 0 12px 16px 0 rgba(0,0,0,0.24), 0 17px 50px 0 rgba(0,0,0,0.19); } #gay-pic-2 { position: absolute; top: 1400px; left: 1200px; } #full-size { height: 100%; width: 100%; } #navigation-p { top: 1600px; left: 850px; } .buttons-text { position: absolute; font-size: 20px; font-weight: 400px; } #button-1 { top: 1660px; } #button-2 { top: 1735px; } #button-3 { top: 1810px; } .buttons { position: absolute; background: linear-gradient(to right, #dc47e4, #06c49b); height: 30px; left: 736px; width: 150px; } .block-1 { background: linear-gradient(90deg, #73eee4, #dc47e4); padding: 10px; position: relative; width: 1200px; height: 1900px; top: 40px; left: 320px; box-shadow: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23); } #social-btn-1 { background: linear-gradient(to right, #fc466b, #3f5efb); top: 1850px; } #social-btn-2 { top: 1775px; } #social-btn-3 { top: 1700px; } .social { background: linear-gradient(to right, #fc466b, #3f5efb); position: absolute; left: 825px; } html { align-items: center; } body { background: linear-gradient(to right, #890000, #D69901, #BABA0D, #2EAA03, #047A97, #350497, #8C0497); } * { text-align: center; } .gay-header { position: absolute; top: 64px; left: 850px; font-size: 40px; } #paragraph-1 { position: absolute; bottom: 750px; left: 380px; } #paragraph-2 { position: absolute; bottom: 675px; left: 380px; max-width: 750px; } #paragraph-3 { position: absolute; bottom: 500px; left: 380px; max-width: 750px; } #paragraph-4 { position: absolute; top: 500px; max-width: 750px; left: 380px; } #sexualization { position: absolute; top: 800px; left: 850px; font-size: 40px; } #paragraph-5 { position: absolute; top: 900px; max-width: 750px; left: 380px; } #paragraph-6 { position: absolute; top: 950px; max-width: 750px; left: 380px; } #paragraph-7 { position: absolute; top: 1000px; max-width: 750px; left: 380px; } /**Might have to increase the height between P-7 and p-8 depending on the google ads snippet**/ #paragraph-8 { position: absolute; top: 1250px; max-width: 750px; left: 380px; } #paragraph-9 { position: absolute; top: 1350px; max-width: 750px; left: 380px; } #paragraph-10 { position: absolute; top: 1400px; max-width: 750px; left: 380px; } #paragraph-11 { position: absolute; top: 1850px; max-width: 750px; left: 380px; } @media only screen and (max-device-width: 720px) and (max-device-height: 1560px) { #navigation-p { top: 3600px; left: 255px; font-weight: 1000; } .paragraphs-720x1560 { font-size: 26px; font-weight: 400; left: 120px; max-width: 500px; position: absolute; } .block-1 { left: 25px; max-width: 640px; height: 4100px; } .gay-header { top: 64px; left: 325px; } #gay-pic-1 { top: 350px; width: 600px; max-height: 150px; left: 75px; } #paragraph-1 { font-size: 26px; top: 175px; left: 120px; max-width: 500px; font-weight: 400; } #paragraph-2 { top: 500px; font-size: 26px; left: 120px; max-width: 500px; } #paragraph-3 { top: 750px; left: 120px; font-size: 26px; font-weight: 400; } #paragraph-4 { font-size: 26px; font-weight: 400; top: 1200px; left: 120px; } #gay-pic-2 { top: 1775px; left: 90px; max-height: 150px; width: 600px; } #sexualization { top: 1900px; left: 300px; } #paragraph-5 { font-size: 26px; font-weight: 400; top: 2000px; left: 120px; max-width: 500px; } #paragraph-6 { top: 2130px; left: 120px; } #paragraph-7 { top: 2260px; left: 120px; } #paragraph-8 { top: 2600px; left: 120px; } #paragraph-9 { top: 2700px; left: 120px; } #paragraph-10 { top: 2815px; left: 120px; max-width: 500px; } #paragraph-11 { top: 4000px; left: 120px; max-width: 500px; } #button-1 { top: 3650px; left: 275px; } #social-btn-1 { top: 3700px; left: 350px; } #button-2 { top: 3745px; left: 275px; } #social-btn-2 { top: 3795px; left: 350px; } #button-3 { top: 3840px; left: 275px; } #social-btn-3 { top: 3890px; left: 350px; } } @media only screen and (max-device-width: 393px) and (max-device-height: 851px) { .block-1 { width: 300px; height: 3800px; } .gay-header { top: 64px; left: 165px; } #paragraph-1 { font-size: 18px; font-weight: 400; top: 150px; left: 50px; max-width: 300px; } #gay-pic-1 { max-height: 100px; width: 300px; left: 45px; top: 285px; } #paragraph-2 { font-size: 18px; font-weight: 400; max-width: 300px; left: 50px; top: 375px; } #paragraph-3 { font-size: 18px; font-weight: 400; max-width: 300px; left: 50px; top: 555px; } #paragraph-4 { font-size: 18px; font-weight: 400; max-width: 300px; left: 50px; top: 975px; } #gay-pic-2 { max-height: 100px; width: 300px; left: 45px; top: 1525px; } #sexualization { top: 1700px; left: 84px; } #paragraph-5 { font-size: 18px; font-weight: 400; max-width: 300px; left: 50px; top: 1800px; } #paragraph-6 { font-size: 18px; font-weight: 400; max-width: 300px; left: 50px; top: 1890px; } #paragraph-7 { font-size: 18px; font-weight: 400; max-width: 300px; left: 50px; top: 2020px; } #paragraph-8 { font-size: 18px; font-weight: 400; max-width: 300px; left: 50px; top: 2400px; } #paragraph-9 { font-size: 18px; font-weight: 400; max-width: 300px; left: 50px; top: 2500px; } #paragraph-10 { font-size: 18px; font-weight: 400; max-width: 300px; left: 50px; top: 2600px; } #navigation-p { top: 3300px; left: 150px; } #button-1 { top: 3400px; left: 100px; } #social-btn-1 { top: 3445px; left: 150px; } #button-2 { top: 3495px; left: 100px; } #social-btn-2 { top: 3540px; left: 150px; } #button-3 { top: 3590px; left: 100px; } #social-btn-3 { top: 3630px; left: 150px; } #paragraph-11 { max-width: 300px; left: 65px; top: 3700px; } }
- 3 replies
-
- css
- responsive
-
(and 3 more)
Tagged with:
-
After letting my computer set for about a year unplugged till I could get around getting a rma on my power supply well now I am getting error code 02, 94, and b2 and getting black screen only able getting into BIOS once. Also get white VGA light on all error codes and yellow green boot light with white vga light on error code 02. I have tried 2 different monitors, different hdmi and display port cables, different pcie slots, running no graphics card, using my old ryzen 5 1600 and x370 asus motherboard (getting same lights), unplugged all usb cables, different sata cable for boot drive, different sata ports on motherboard and updating bios. Only thing I haven't tried is a different graphics card as I don't have another one, different boot drive as I dont have another desktop and only a laptop (bought a internal hard drive to usb adapter) and reinstalling windows 10 and/or graphics driver.
-
Is there a way to trigger a function when a specific input box of a desktop application is changed, just like in JavaScript onchange event. Either with ahk(autohotkey) or through some other means/application. Plz let me know. By the way I love your YouTube channel and you guys all.
- 3 replies
-
- ahk
- autohotkey
- (and 4 more)
-
Longs story short, I need help. Im trying to make a "play again" button when the game says "Game Over", but I do not know how. Can anyone help? Code also attached to this post. You can edit the code all you like. The game is also attached to the attachments. Thank you. package neo.kaarmepeli; import java.awt.Color; import java.awt.Dimension; import java.awt.Font; import java.awt.FontMetrics; import java.awt.Graphics; import java.awt.Image; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import javax.swing.ImageIcon; import javax.swing.JPanel; import javax.swing.Timer; public class Board extends JPanel implements ActionListener { private final int B_WIDTH = 300; private final int B_HEIGHT = 300; private final int DOT_SIZE = 10; private final int ALL_DOTS = 900; private final int RAND_POS = 29; private final int DELAY = 140; private final int x[] = new int[ALL_DOTS]; private final int y[] = new int[ALL_DOTS]; private int dots; private int apple_x; private int apple_y; private boolean leftDirection = false; private boolean rightDirection = true; private boolean upDirection = false; private boolean downDirection = false; private boolean inGame = true; private Timer timer; private Image ball; private Image apple; private Image head; public Board() { initBoard(); } private void initBoard() { addKeyListener(new TAdapter()); setBackground(Color.black); setFocusable(true); setPreferredSize(new Dimension(B_WIDTH, B_HEIGHT)); loadImages(); initGame(); } private void loadImages() { ImageIcon iid = new ImageIcon("src/resources/dot.png"); ball = iid.getImage(); ImageIcon iia = new ImageIcon("src/resources/apple.png"); apple = iia.getImage(); ImageIcon iih = new ImageIcon("src/resources/head.png"); head = iih.getImage(); } private void initGame() { dots = 3; for (int z = 0; z < dots; z++) { x[z] = 50 - z * 10; y[z] = 50; } locateApple(); timer = new Timer(DELAY, this); timer.start(); } @Override public void paintComponent(Graphics g) { super.paintComponent(g); doDrawing(g); } private void doDrawing(Graphics g) { if (inGame) { g.drawImage(apple, apple_x, apple_y, this); for (int z = 0; z < dots; z++) { if (z == 0) { g.drawImage(head, x[z], y[z], this); } else { g.drawImage(ball, x[z], y[z], this); } } Toolkit.getDefaultToolkit().sync(); } else { gameOver(g); } } private void gameOver(Graphics g) { String msg = "Game Over"; Font small = new Font("Helvetica", Font.BOLD, 14); FontMetrics metr = getFontMetrics(small); g.setColor(Color.white); g.setFont(small); g.drawString(msg, (B_WIDTH - metr.stringWidth(msg)) / 2, B_HEIGHT / 2); } private void checkApple() { if ((x[0] == apple_x) && (y[0] == apple_y)) { dots++; locateApple(); } } private void move() { for (int z = dots; z > 0; z--) { x[z] = x[(z - 1)]; y[z] = y[(z - 1)]; } if (leftDirection) { x[0] -= DOT_SIZE; } if (rightDirection) { x[0] += DOT_SIZE; } if (upDirection) { y[0] -= DOT_SIZE; } if (downDirection) { y[0] += DOT_SIZE; } } private void checkCollision() { for (int z = dots; z > 0; z--) { if ((z > 4) && (x[0] == x[z]) && (y[0] == y[z])) { inGame = false; } } if (y[0] >= B_HEIGHT) { inGame = false; } if (y[0] < 0) { inGame = false; } if (x[0] >= B_WIDTH) { inGame = false; } if (x[0] < 0) { inGame = false; } if (!inGame) { timer.stop(); } } private void locateApple() { int r = (int) (Math.random() * RAND_POS); apple_x = ((r * DOT_SIZE)); r = (int) (Math.random() * RAND_POS); apple_y = ((r * DOT_SIZE)); } @Override public void actionPerformed(ActionEvent e) { if (inGame) { checkApple(); checkCollision(); move(); } repaint(); } private class TAdapter extends KeyAdapter { @Override public void keyPressed(KeyEvent e) { int key = e.getKeyCode(); if ((key == KeyEvent.VK_LEFT) && (!rightDirection)) { leftDirection = true; upDirection = false; downDirection = false; } if ((key == KeyEvent.VK_RIGHT) && (!leftDirection)) { rightDirection = true; upDirection = false; downDirection = false; } if ((key == KeyEvent.VK_UP) && (!downDirection)) { upDirection = true; rightDirection = false; leftDirection = false; } if ((key == KeyEvent.VK_DOWN) && (!upDirection)) { downDirection = true; rightDirection = false; leftDirection = false; } } } } package neo.kaarmepeli; import java.awt.EventQueue; import javax.swing.JFrame; public class Snake extends JFrame { public Snake() { initUI(); } private void initUI() { add(new Board()); setResizable(false); pack(); setTitle("Snake"); setLocationRelativeTo(null); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } public static void main(String[] args) { EventQueue.invokeLater(() -> { JFrame ex = new Snake(); ex.setVisible(true); }); } } Board.java Snake.java matopeli.rar
-
Hello everyone, I have been struggling to find out what exactly is causing this issue. I am setting up a wordpress.org website at home and it seems I'm running to a PHP problem so I'm curious if anyone has any insight at to what might be happening. I did already post a support topic over on WordPress but its not travel very much. Some things in this post are WordPress specific but I think this may be a PHP issue ultimately. I can not get past the step on connecting to the SQL database for setting it up for the first time. In the Debug log I get the following: PHP Fatal error: Uncaught Error: Call to undefined method wpdb::mysqli_connect() in E:\Website\wwwroot\wp-includes\wp-db.php:632 What is my Setup: Windows Server 2012 R2 IIS 8 Webserver PHP 8.0.11 Mysqlnd 8.0.11 WordPress 5.8.1 My SQL 8.0.26 What I have confirmed: •The Mysqli extension is enabled and ran a script on the site to show what's being loaded (php print_r(get_loaded_extensions());) •The Mysqli can connect to my database by using $conn = new mysqli(information goes here); •I do have full admin rights to the database on localhost •IIS Webserver has correct Modify permissions for the website directories and a Temp Directory •Other PHP code is executing as intended such as the examples above to confirm the webserver is able to do so. •wp-config.php has the correct login information •WP_USE_EXT_MYSQL argument does not exist in wp-config.php file What have I tired so far: •Restarting everything •Trying another fresh install •Switching to PHP 7.4 (stops at the same error) •Experimented with different code replacing line 632 in wp-dp.php with example code above $conn = If I could perhaps get some help with what exactly is going wrong or if it seems like I have not tried something. Thank you =)
-
Greetings! The other day my pc started giving a long beep, three short beep post code on startup. It does this every time now but proceeds into my os. The problem is I can no longer access BIOS as that's the only time I get no output. I've tried moving my gpu to a secondary PCIE slot and the behavior is the same. I haven't tried getting to BIOS via integrated but that's less of a concern than my gpu maybe being on it's way out or whatever's going on? ASUS mobo, i9-9900k, Gtx980, anyone with some knowledge to drop on me to figure this guy out?
-
-
Recently, I just got my pc done and upon turning it on, it didn't boot into bios for the first time. So I updated the bios and it booted. Installed windows, updated and benchmarked. I was trying to ramp up my mem speeds thru DOCP, however, I just can't get a boot. So I managed to keep it at 3466Mhz with timings 18-20-20-20-40 1.35V. It did work... for 9 hours until it just hung and won't boot again. It's stuck at a post code error 7A. I have already reseated my ram and cpu just like in the forums. I also cleared my CMOS and reflash BIOS but still didn't work. Any suggestions? Specs: Ryzen 3700x X470 Asus ROG Crosshair VII WiFi 16x2 Corsair CMW32GX4M2Z3600C18 Memory
-
So I have a code which calculates the class average, boys highest mark, girls highest mark, lowest mark etc. When I enter the number of boys value below 10, I can enter any number of girls in the class and calculate many marks as I need (As seen in image) Now the problem is when I enter number of boys value as 10 or above I can't enter number of girls value greater than 10... It simply crashes and shoes a message as shown in the image. And I have another problem in my code where I can successfully display the index who got the highest mark in both boys and girls but I can't display the index who got the lowest mark in both boys and girls... If I try to to it shows "The lowest mark in [boys/girls]* is [boy/girl]* 0 with 0 marks" *Statements are separate Here is my code (THIS IS C PROGRAM) #include <stdio.h> #include <stdlib.h> int bhigh(int b[], int c) //*Finding highest mark in boys*// { int i, index = 0; for (i = 1; i <= c; i++) if (b[i] > b[index]) index = i; return index; } int blow(int b[], int c) //*Finding lowest mark in boys*// { int i; int min = b[1]; for (i = 1; i <= c; i++) if (b[i] < min) min = b[i]; return min; } int ghigh(int g[], int d) //*Finding highest mark in girls*// { int i, index = 0; for (i = 1; i <= d; i++) if (g[i] > g[index]) index = i; return index; } int glow(int g[], int d) //*Finding lowest mark in girls*// { int i; int min = g[1]; for (i = 1; i <= d; i++) if (g[i] < min) min = g[i]; return min; } int main() { int i,c,d; int *b,*g; int bhighlocation, bmaximum, blowlocation, bminimum; int ghighlocation, gmaximum, glowlocation, gminimum; float sum1=0,sum2=0,avg1,avg2,clsavg; printf("C PROGRAM FOR A CLASS MARK LIST FOR BOYS AND GIRLS\n\n"); //*Getting no. of boys*// printf("Enter the number of boys: "); scanf("%d",&c); b=(int*)malloc(c*sizeof(int)); //*Getting boys marks*// printf("\nEnter the marks of boys :\n"); for(i=1;i<=c;i++) { printf(" -Enter marks of boys %d: ",i); scanf("%d",&b[+i]); } //*Getting no. of girls*// printf("\nEnter the number of girls: "); scanf("%d",&d); g =(int*)malloc(d*sizeof(int)); //*Getting girls marks*// printf("\nEnter the marks of girls :\n"); for(i=1;i<=d;i++) { printf(" -Enter mark of girl %d: ",i); scanf("%d",&g[+i]); } //*Computing average marks of boys*// for(i=1;i<=c;i++) { sum1 = sum1+b[i]; } avg1=sum1/c; printf("\nThe average of boys marks is : %.2f\n",avg1); //*Computing average marks of girls*// for(i=1;i<=d;i++) { sum2 = sum2+g[i]; } avg2=sum2/d; printf("The average of girls marks is : %.2f\n",avg2); //*Computing overall class average*// clsavg=(avg1+avg2)/2; printf("The overall class average is : %.2f\n",clsavg); //*Printing highest mark between boys*// bhighlocation = bhigh(b, c); bmaximum = b[bhighlocation]; printf("\nHighest mark in boys is boy %d with %d marks.\n", bhighlocation, bmaximum); //*Printing lowest mark between boys*// printf("Lowest mark in boys is %d\n", blow(b, c)); //*Printing highest mark between girls*// ghighlocation = ghigh(g, d); gmaximum = g[ghighlocation]; printf("\nHighest mark in girls is girl %d with %d marks.\n", ghighlocation, gmaximum); //*Printing lowest mark between girls*// printf("Lowest mark in girls is %d\n", glow(g, d)); return 0; } Sorry if my code's too large.....
-
I have absolutely no idea how to get started all I did was downbload Unity and the latest version. Any tips on how to get started, would really appreciate it
-
This is my C program for reading and displaying flight ticket details... Pls compile and see the errors then help me fix it.... I am blankly saying this bcoz IDK how to explain my issue.... I promise this will be easier to fix than my last code.......... There are some pointer errors that's what I need to fix... Thanks BTW #include <stdio.h> typedef struct { int ptickno; char pname[100]; char flightname[100]; char fdate[100]; char fltime[100]; char class[100]; char gate[100]; char seat[100]; char from[100]; char to[100]; }passenger; void input_output(passenger p1[100]) { int i=0; int n; int *ticket; ticket=&p1->ptickno; char *passname, *airplanename, *airdate, *airtime, *flclass, *airgate, *airseat, *flyfrom, *flyto; passname=p1->pname; airplanename=p1->flightname; airdate=p1->fdate; airtime=p1->fltime; flclass=p1->class; airgate=p1->gate; airseat=p1->seat; flyfrom=p1->from; flyto=p1->to; printf("ENTER THE NUMBER OF TICKETS YOU WANT TO ENTER : "); scanf("%d",&n); for(i=0;i<n;i++) { printf("\n********************************************"); printf("\nENTRY FOR PASSENGER %d :", i+1); printf("\n\nEnter ticket number : "); scanf("%d",&p1[i](*ticket)); printf("Enter name of passenger : "); scanf("%s",p1[i](passname)); printf("Enter name of flight : "); scanf("%s",p1[i](airplanename)); printf("Enter date of flight : "); scanf("%s",p1[i](airdate)); printf("Enter time of flight : "); scanf("%s",p1[i](airtime)); printf("Enter class : "); scanf("%s",p1[i](flclass)); printf("Enter gate : "); scanf("%s",p1[i](airgate)); printf("Enter seat : "); scanf("%s",p1[i](airseat)); printf("Enter from : "); scanf("%s",p1[i](flyfrom)); printf("Enter to : "); scanf("%s",p1[i](flyto)); printf("********************************************\n"); } for(i=0;i<n;i++) { printf("\n********************************************"); printf("\nTICKET DETAILS OF PASSENGER %d",i+1); printf("\n\nTICKET NUMBER : %d",p1[i](*ticket)); printf("\nNAME OF PASSENGER : %s",p1[i](passname)); printf("\nNAME OF FLIGHT : %s",p1[i](airplanename)); printf("\nDATE OF FLIGHT : %s",p1[i](airdate)); printf("\nTIME OF FLIGHT : %s",p1[i](airtime)); printf("\nCLASS : %s",p1[i](flclass)); printf("\nGATE : %s",p1[i](airgate)); printf("\nSEAT : %s",p1[i](airseat)); printf("\nFROM : %s",p1[i](flyfrom)); printf("\nTO : %s",p1[i](flyto)); printf("\n********************************************"); } } int main() { passenger p[100],*pptr; pptr=&p[0]; input_output(pptr); return 0; }
- 14 replies
-
Good day everyone, I'm new in programming and using c language, I'am currently exploring and trying out but I expected my program to work but I don't know what the problem, What should I do? #include<stdio.h> void Entry_Array() { int Em_Num[10],a,r,c,t,p,s,m; int Hours_W[10]; char Em_Stat[10]={'r','R','p','P','c','C','t','T'}; char C_Stat[10]={'s','S','m','M'}; printf("Enter the Employee Number:\n"); for(a=0;a<10;a++) { scanf("%d",&Em_Num[a]); } printf("Enter the Employment Status:\n"); for(a=0;a<10;a++) { scanf("%s",&Em_Stat[a]); } printf("Enter the Civil Status:\n"); for(a=0;a<10;a++) { scanf("%s",&C_Stat[a]); } printf("Enter the Hours Work:\n"); for(a=0;a<10;a++) { scanf("%d",&Hours_W[a]); } for(a=0;a<10;a++) { printf("\nEmployee Number:%d\n",Em_Num[a]); printf("Employment Status:%c\n",Em_Stat[a]); printf("Civil Status:%c\n",C_Stat[a]); printf("Hours Work:%d\n",Hours_W[a]); } } void Search_Array() { int Em_Num[10],a,r,c,t,p,s,m; int Hours_W[10],Search,Flag; int G_Inc,Net_Inc,RPD,RPH,OTH,OT,Basic,P_Health; float SSS,P_i,T_Ded; char Em_Stat[10]={'r','R','p','P','c','C','t','T'}; char C_Stat[10]={'s','S','m','M'}; printf("Enter the Employee Number to be Search:"); for(a=0;a<10;a++) { scanf("%d",&Search); } printf("\n"); for(a=0;a<10;a++) { if(Em_Num[a]==Search) { Flag=1; break; } } if(Flag==1) { switch(Em_Stat[a]) { case 'R': RPD=800; break; case 'P': RPD=600; break; case 'C': RPD=500; break; case 'T': RPD=450; break; default: RPD=400; break; } RPH=RPD/8; if(Hours_W[a]>120) { OTH=Hours_W[a]-120; OT=1.5*(RPH*OTH); Basic=120*RPH; G_Inc=Basic+OT; } else { Basic=Hours_W[a]*RPH; G_Inc=Basic; } if(C_Stat[a]=='S'||C_Stat[a]=='s') { P_Health=500; } else if(C_Stat[a]=='M'||C_Stat[a]=='m') { P_Health=300; } else { P_Health=400; } if(G_Inc>12000) { SSS=0.1; P_i=0.05; } else if(G_Inc>5000) { SSS=0.08; P_i=0.03; } else if(G_Inc<=5000) { SSS=0.05; P_i=0.02; } T_Ded=P_Health+SSS+P_i; Net_Inc=G_Inc-T_Ded; printf("\nEmployee Number:%d\n",Em_Num[a]); printf("Employment Status:%c\n",Em_Stat[a]); printf("Civil Status:%c\n",C_Stat[a]); printf("Hours Work:%d\n",Hours_W[a]); printf("Gross Income=%d",G_Inc); printf("Total Deduction=%f\n",T_Ded); printf("Net Income=%d\n",Net_Inc); } else { printf("\nEmployee Number is not Found"); } } void Update_Array() { int Em_Num[10],a,r,c,t,p,s,m; int Hours_W[10],Search,Flag,TBU,TU; int G_Inc,Net_Inc,RPD,RPH,OTH,OT,Basic,P_Health; float SSS,P_i,T_Ded; char Em_Stat[10]={'r','R','p','P','c','C','t','T'}; char C_Stat[10]={'s','S','m','M'}; printf("Enter the Employee Number to be Updated:\n"); scanf("%d",&TBU); for(a=0;a<10;a++) { if(Em_Num[a]==TBU) { printf("Enter the Values to Update:\n"); scanf("%d",&TU); Em_Num[a]=TU; printf("Successfully Updated the Values\n"); } else { printf("The Employee Number does not exist\n"); } } } void Display_Array() { int Em_Num[10],a,r,c,t,p,s,m; int Hours_W[10],Search,Flag,TBU,TU; int G_Inc,Net_Inc,RPD,RPH,OTH,OT,Basic,P_Health; float SSS,P_i,T_Ded; char Em_Stat[10]={'r','R','p','P','c','C','t','T'}; char C_Stat[10]={'s','S','m','M'}; switch(Em_Stat[a]) { case 'R': RPD=800; break; case 'P': RPD=600; break; case 'C': RPD=500; break; case 'T': RPD=450; break; default: RPD=400; break; } RPH=RPD/8; if(Hours_W[a]>120) { OTH=Hours_W[a]-120; OT=1.5*(RPH*OTH); Basic=120*RPH; G_Inc=Basic+OT; } else { Basic=Hours_W[a]*RPH; G_Inc=Basic; } if(C_Stat[a]=='S') { P_Health=500; } else if(C_Stat[a]=='M') { P_Health=300; } else { P_Health=400; } if(G_Inc>12000) { SSS=0.1; P_i=0.05; } else if(G_Inc>5000) { SSS=0.08; P_i=0.03; } else if(G_Inc<=5000) { SSS=0.05; P_i=0.02; } T_Ded=P_Health+SSS+P_i; Net_Inc=G_Inc-T_Ded; printf("\nEmployee Number:%d\n",Em_Num[a]); printf("Employment Status:%c\n",Em_Stat[a]); printf("Civil Status:%c\n",C_Stat[a]); printf("Hours Work:%d\n",Hours_W[a]); printf("Gross Income=%d",G_Inc); printf("Total Deduction=%d\n",T_Ded); printf("Net Income=%d\n",Net_Inc); } void Choice() { int Choice; char Answer; do { printf("----MENU----\n\n 1.ENTRY \n 2.SEARCH \n 3.UPDATE \n 4.DISPLAY \n 5.EXIT\n\n"); printf("Enter Choice: "); scanf("%d",&Choice); switch(Choice) { case 1: Entry_Array(); break; case 2: Search_Array(); break; case 3: Update_Array(); break; case 4: Display_Array(); break; case 5: printf("Do you want to Exit?"); break; default: printf("Invalid Input\n"); break; } printf("Do you wish to exit[y/n]:\n"); scanf("%s",&Answer); }while(Answer=='n'||Answer=='N'); } void main() { Choice(); }
-
Hi all! I wish to share the discovery i made for deleting the last line in the console on python 3, I hope this can help someone, any questions please redirect to me, Thanks, Blake code: import os import sys import time #last line deletion def delete_last_line(): "Use this function to delete the last line in the STDOUT" #cursor up one line sys.stdout.write('\x1b[1A') #delete last line sys.stdout.write('\x1b[2K') ###DEMO### print("this line will delete in 5 seconds") time.sleep(5) delete_last_line() The link to the github with the code and more is : https://github.com/Blake-McCullough/LastLinePython3Delete/tree/main Attached is also the file for deleting the last line if u wish to just download it. Last line python 3 delete.py
-
I am using Microsoft Visual Studio 2017 and i am getting the following errors about my code C2276, C2143, C2673, C2143, C2059 all of the errors point to this code Application::Application() { m_Window = std::unique_ptr<Window>(Window::Create()); m_Window->SetEventCallback(BIND_EVENT_FN(OnEvent)); // all errors are on this line } Application::~Application() { } this the part I am have so much trouble with my full project is on GitHub at https://github.com/TheFBIMaster/Bobcat if you need to see all the code before running run the generate.bat file it is a Premake run command
- 3 replies
-
- c++
- microsoft visual c++
-
(and 2 more)
Tagged with:
-
I've been struggling to find a way to do this for a while, i have a laser profiler (scanner) that I have retro fitted to a CNC router to scan surfaces to look at the undulations, I have to export these out of the proprietary software to a .csv file in order to stich multiple together (still working on this but am close) but i have then no way of viewing these images again as the software does not then allow you to import the .csv file back into it and will only open a .lhi file. I don't need it back into that software as i can use fusion 360 to open it, but i need to make it into a file format that will understand. fusion 360 allows a lot of 3d file types, and does have an option to import .csv files but it doesn't seem to work with the way the original software wrights the .csv files I have attched the .csv file for reference any ideas would be greatly appreciated, Thanks csv_file.zip
- 12 replies
-
- code
- programming
-
(and 1 more)
Tagged with:
-
I created a purely Javascript solution to display a view counter during the wan show. Run it in the console if you're confortable with that kind of thing. The chat needs to be displayed within the page for the script to run properly. And the "secondsToRefresh" value will be the number of seconds before the counter shows up. Then the number of seconds it takes before it refreshes (I liked it at 1 second of refresh period, but one could argue it's not necessary, so I set it to 10 by default.) const secondsToRefresh = 10; //refreshes every 10 seconds, change value before running the script to refresh more or less often function refreshList() { var btn = document.querySelectorAll(`.chat-view-container.chat-messages-container:not(.hide) .header-button.btn-user-list, .chat-view-container.chat-users-container:not(.hide) .header-button.btn-user-list.btn-return-to-chat`)[0] if (btn) {btn.click()}; } window.setInterval(function() { var subTitle = document.getElementById("addedSh*t"); if (!subTitle) { subTitle = document.createElement("div"); subTitle = document.getElementsByClassName("video-title")[0].insertAdjacentElement("afterEnd", subTitle); subTitle.outerHTML = `<div class="video-title" id="addedSh*t"> <span class="title-text" style="font-size:12px" id="viewCount">View count: test</span> </div>`; } refreshList(); document.getElementById("viewCount").innerText = "View count: " + document.querySelectorAll(".chat-viewer-name.ng-star-inserted").length; refreshList(); //console.log(document.querySelectorAll(".chat-viewer-name.ng-star-inserted").length); }, secondsToRefresh * 1000);
-
Hello, I am not a programmer by any means but I do understand the basics of making my way through programming instructions. I take a lot of photographs and I was hoping to set up a program that will automatically copy the DCIM file from an inserted SD card and create a new folder with the days date as its name and save the file into that new folder on my PC hard drive. I was then also hoping for a secondary program that will backup an individual file to an external SSD whenever that SSD is connected to my PC. I realise this is probably a lot to ask, but google and youtube haven't been helping. I have tried to use Task Scheduler in conjunction with Event Viewer and USBLogView to no avail. (likely because I am unable to code anything from scratch) Please let me know if anyone has any suggestions for this. I am willing to learn the necessary programming language to help me out here. I'm not too keen on using a software downloaded from the internet to do these tasks as my photos are 99% NDA and sensitive. Thank you, xco This is a description of the above but i have included the file name paths.
- 11 replies
-
- photo
- app creation
-
(and 2 more)
Tagged with:
-
Not to take a piss on python , i actually like the languagee , especially the development speed you get with it. but... only in python are things that are an order of magnitude faster in other languages actually much much slower: Branching logic vs Branchless Logic: import random from time import perf_counter_ns,sleep testnrs = [random.randrange(0,5,1) for _ in range(2**20)] def branch(nr,idx,result): if nr < 1 : result|=int((str(abs(result))*9)[1:3]) elif nr == 1: result|=idx elif nr == 2: result|= 2*int(str(result)[0]) elif nr == 3 : result|=3*idx elif nr >= 4 : result|= nr*int(str(idx)[-1]) return result def nobranch(nr,idx,result): result|= (((int((str(abs(result))*9)[1:3])) * (nr < 1)) + ( (idx)*(nr==1)) + ( (2*int(str(result)[0])*(nr==2))) +( ((3*idx)*(nr==3)))+ ( (nr*int(str(idx)[-1])*(nr>=4)))) return result subtot1=0 ;start1=perf_counter_ns() for idx,nr in enumerate(testnrs): subtot1=branch(nr,idx,subtot1) time1=(perf_counter_ns()-start1)*10**-9 sleep(2) subtot2=0 ; start2=perf_counter_ns() for idx,nr in enumerate(testnrs): subtot2=nobranch(nr,idx,subtot2) time2=(perf_counter_ns()-start2)*10**-9 print(subtot1,'\t\ttime:\t\t',time1) print(subtot2,'\t\ttime:\t\t',time2) result: 4194303 : time: 3.047605361 4194303 : time: 9.314754315
-
- python3
- develpment
-
(and 2 more)
Tagged with:
-
Hey all together, So I have this weird Error going on inside my Visual Studio right now. Me and my coworkers decided to set up a onPrem Gitea for our company where we push our source code onto for better source control. This worked totally fine but then at some random point in time, my VS crashed and ever since them in not able to push my locally created commit-branch to the remote repository. The project template is an Blazor Server App running with ASP.NET Core 6. This problem only occured on my Notebook / in my VS, every other installation we have running on the machines of my coworkers are fine and still able to push and fetch to and from our remote repo. The errormessage my Output prompt of VS is giving me says the following: Error encountered while pushing branch to the remote repository: Git failed with a fatal error. Git failed with a fatal error. Custom certificate bundle not found at path: C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt Custom certificate bundle not found at path: C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt Custom certificate bundle not found at path: C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt cannot spawn askpass: No such file or directory could not read Username for 'http://IP.Adress.Of.Our.Server': terminal prompts disabled Failed to push the branch to the remote repository. See the Output window for more details. Im running the following os/versions: Windows 11 Visual Studio 2022 (v17.1.1) Gitea-Version: 1.15.6 I'd be super happy if someone can help me with that. If you need addtional information, please let me know. Cheers Nightcore
-
Okay...I was utterly stupid a long time ago and reinstalled windows 11 (was doing a clean slate thing) without backing up the recovered file. I found a way to recover said file via an official file recovery tool from Microsoft. So, I received the file and of course it is broken. I expected that to be honest. The revelation I had was that when I opened up in a notepad or notepad++ it showed up with code, broken obviously. It seems like I can fix this issue, but that is very slim to none. Sadly, it is in a proprietary format of Musescore3. I'm asking here first because this is the first forum I think of when it comes to tech problems. I don't expect much because it's a recovered file after a reinstall of Windows 11. If all I am doing seems like the wrong place to put my inquiry here, please direct me to a more suitable forum (e.g.coding forums). This file is important to me. Yes, I'm a new account on this website. I technically had an old account on here, but it was deleted when I deleted my facebook a long time ago. But this comment stands: If this is in the wrong place, please, oh please tell me, where to place it to get the most attraction. Hint of Lime (1st Attempt).mscz
- 2 replies
-
- file
- musescore3
-
(and 3 more)
Tagged with: