Search the Community
Showing results for tags 'programming'.
-
Hi, I've taken the 'poor guy" approach and I've made a docker image to backup a remote MySQL/MariaDB server into a remote git repository (ie. GitLab, GitHub, etc). I'd like to listen to your opinion on this form of backup, potential security threats, optimization tips, etc And, its free and open source. I'm open to Pull/Merge requests: https://gitlab.com/franciscocb/mariadb-git-backup-docker
-
- programming
- development
-
(and 4 more)
Tagged with:
-
Anyone got any got concentration tips for when they're programming/coding? So far I've narrowed it down to Go to sleep no later than 10:30pm If working on an area you know thoroughly (and don't need to think about), listen to instrumental music If working on a different area you will need more problem solving elements, don't listen to music If people are chatting around you then listening to music may be better however being totally isolated is probably best. Changing up my scenery seems to help. If I'm particularly struggling with a piece of work I'll take my laptop away from my desk to the downstairs main table, it's not got the full tech setup but mentally it helps me. No more than 2 coffees in a 4ish hour period, I may physically be very awake if I have more but I would basically be a zombie mentally after that; I don't know why. If you're really stuck on a problem, try rubber duck debugging where you explain your problem to something, your methodical approach of explaining the problem usually reveals the answer ( I do prefer explaining to real people though) Surround yourself with people who are interested in programming (struggled to program in my spare time when all my friends were artists, guess all I wanted to do was draw! lol ) (If working from home) Have a main area dedicated to working, e.g. If possible don't be gaming in the same room that you do work, have that 'work environment' Don't need that taking up brain space. There's probably some things I could do in terms of dietary changes but I've not really experimented with it Anything in particular work for yous?
- 7 replies
-
- programming
- working
-
(and 1 more)
Tagged with:
-
Hi, I wanna buy a gaming laptop and I have 3 options which are very similar in hardware but 1 differs in it's original price vastly than the other 2. I don't know which brands are considered better or something like that, and I wanted to get your recommendations please. The first one is Gigabyte Aorus 15G which goes 1500 after a supposedly huge discount off the alleged original 2200. This is the one with the far higher original price than the others. The second is HP OMEN 17 (2020) which goes for 1450 and it's virtually identical to the Aorus except it has 17.3" screen and it's GPU is 2070 and not the 2070 max Q - I am unaware if that makes a big difference. The third is MSI GL75 Leopard 10SFK-029 which is 1400 and is like the HP OMEN except it also has a 1 TB HDD. So my questions in order of importance are: Which do you recommend? Do you have any idea why the Aorus, which has almost identical HW (slight tradeoff - better GPU, smaller screen) goes for such a higher original price? And also, do you think I should wait for the new laptops which will have the 30xx series GPUs? I don't know when those will appear and how much I should expect them to cost, but considering the 30xx sell cheaper, maybe it's worth waiting? Bonus question - if you happen to be a programmer, would these laptops be suitable for that as well? Compile / build code fast ect...? Thanks a lot!!!
- 7 replies
-
- gaming laptop
- programming
-
(and 1 more)
Tagged with:
-
This is a topic among many that I would like to make a video on for my hobbyist electronics business that I am in the process of opening up so I thought I would share my very early stage written up tutorial to the fine people of the LTT Forum. I figured I would go full master exploder with the juicy bits to blow your mind. Later on I will include hardware and software examples and possibly how this correlates to motherboard RGB headers. I will also probably be writing other tutorials as I go along. Probably more basic ones to start with after this for the less initiated lol. Sorry for the terrible quality of the writing as I can read and write better C++ then and I can read and write English (even though its my first language lol.) Probably will turn this into a mega thread with all the tutorials that I write up. Or maybe throw them up as blog posts with links idk. Depends on how receptive the community is. TODO: Remove vulgar language Add figure numbers for each image and subsequent referrals in each applicable paragraph Resize images for better formatting Any images that are not from the datasheets replace with my own Make some images related to data Write Code Create hardware designs Create Github repo Move everything into the github repo Find more issues with this post and subsequently log them here. This article is intended as high level overview on various types of RGB strips, their operation and techniques for successfully utilizing them. The LEDs being discussed are single colour 4 pin RGB strips, 3 pin addressable RGB WS2812B strips and finally 4 pin addressable RGB APA102/SK9822 LED strips. All or most of this information will also apply to bare LEDs of these types and LED matrices of these types as well. If there is any information that you believe to be incorrect please let me know. If there is any spelling mistakes, grammar or formatting issues please let me know as well. I will be more than happy to fix any issues with this article. Any comments or questions please feel free to post! Definitions for the context of this write up: RGB is Red, Green, Blue RGBW is Red, Green, Blue, White (the reason I use white and not amber is that A is typically associated with alpha channel which is what lets you set the opacity of pixels in an image so evidently that's not the right term to be using in our context because LEDs have no opacity value. ) We as humans typically use numbers in the decimal system or base 10. This means we have ten distinct digits per position ranging from 0 to 9. Exceeding 9 would now start counting in the next highest position e.g. 10. Each number position is 10 times the position to the right of it. So to compose a number such as 4682 you would break it down into thousands, hundreds, tens and ones or 4000 + 600 + 80 + 2 However computers work in a completely different numeral system. This system is known as binary meaning there are only two digits per position which are 0 and 1. Except instead of Base 10 we're now Base 2 so each number position is 2 times the value to the right of it. So to count in binary you would go from 0000 which is decimal 0. 0001 which is decimal value 1. 0010 is decimal value two. 0011 is decimal value 3. 0100 is decimal value 4..so on so forth. Individual positions in binary are commonly referred to as bits. So a 16 bit number would have 16 positions like so 0100 0010 0000 0010 0100. A Byte is a collection of 8 bits and it is the smallest unit of data that a microprocessor will use. From now on I will use () to represent individual bytes RGB colour information in computers is a numerical representation of intensities (also known as saturation) of the primary colours or channels in binary. These are typically stored as 24 bits or 3 Bytes of data for a total of 16,581,375 colours. RGBW is 32bits or 4 Bytes of data for a total of 4,228,250,625 colours. You can get more color depth and formats but this beyond the scope of what I want to write as its not applicable to what we want to do. This gives each channel or colour 8 bits of data each for the Intensity of the colour. So in order to get the 16 million colours you would multiply 255 x 255 x 255( x 255 for white). So in order for us to get full solid red colour we would have a value of 255 for the red byte, 0 for the green byte, 0 for the blue byte or in binary (1111 1111)(0000 0000)(0000 0000). . Lets now say we wanted solid purple for a colour. This would be represented by a mixture of the Red and Blue channels. To numerically represent this it would be 255 for our red byte, 0 for our green byte, and 255 for our blue byte. This in binary is (1111 1111)(0000 0000)(1111 1111). Moving onto computer memory we will look at how everything is stored within a computer. You've probably heard the terms 32bit or 64 bit processors before but what does this actually mean. What this comes down to is the number of bits that the processor can naturally process in addition to how much memory it can address. (There's way more to this but this in it self is a cluster fuck of a subject. Also note to self find a nicer way to put this ) Notice the italics on natural because this leads us into the next portion which is data Words. Words are the natural unit of data for a given processor and what this means by natural unit is that it easily matches the number of bits that our processor can work on. So if we have a 64bit processor that means the word size will be 64 bits or 8 bytes. Onto the memory addressing. A memory address is a binary number that has the same number of bits as your processor. This numbered address corresponds to a byte of data stored in memory. So if you have a 32Bit processor you can only address up to 4GB of RAM (232). If you have a 64Bit processor this is over 17 Exabytes of RAM that you can access(264). So how do you order your bytes of data into memory? Well there are 2 ways which is either Big Endian(BE) or Little Endian(LE) also known as Endianness. In a big endian system your most significant byte (the most significant digits) is stored at the smallest memory address. In little endian we have the exact opposite where the least significant bytes are stored at the smallest address. If you need help visualizing this imagine memory address as a latter. The rung at the bottom is the smallest memory address while the top rung is the biggest memory address. You either put the biggest part of the number followed by the smaller digits starting at the bottom and working your way up or you do the exact opposite where the smallest digits at the bottom working your way up to the top with the bigger digits for big endian and little endian respectively. (If you want a brain twister then try to think about doing both of these methods at the same time because they're computers that work with both.) If you're wondering what an x86 / x86_64 (Intel/AMD 32/64bit processors) use its little endian. So I've explained what binary is and how it is used to represent images and colours and now its time to explain the other side of the coin which is Electrical signals. We will start with and explanation of what Voltage is and how we use it. Voltage is known as an Electrical Potential Difference which is represented by the SI unit Volt or V. This is called a Potential Difference because its a difference of charges or energy between 2 points. This is much like gravitational potential energy where the energy lies between 2 different points or heights. Example: If an object is on the ground it has a potential energy of zero because its already at the lowest point it can be. But if an object is raised to say 10 meters it now has a 10 meter difference in potential energy because it can fall 10 meters to the ground. So now that we know what a potential difference is we can now apply it to voltage. So on a circuit you would have power source such as a battery which has a negatively charged terminal and a positively charged terminal. This now our source of potential difference because one terminal is positive and the other is negative. If this was a car battery for example it would be at 12 Volts which means the positive terminal has positive charge that is 12V higher than the negative terminal. (Though in some unique cases you can have -12V which can be really useful but beyond scope.) By default charges want to balance or cancel them selves out so how is this useful to us? Their desire to be balanced creates immense pressure that when harnessed is how you produce work. So now in a circuit if we force them through a certain path they will now do work for us to get to the other positively charged terminal. So this work that is done could be a light bulb turning on, a microprocessor operating, heating element heating up etc. Electrical Signals are the way in which represent or encode data to a voltage value. This all comes back to numerical representations of a given property. So an Analog signal is way of continuously representing electrical signals from infinity to infinity using voltages. Coming back to numerical representations you would assign a range to a dataset and a range of voltages that corresponds to that dataset. If we were to look at a temperature sensor it has (for our context) 2 properties: 1) The temperature range it is capable of measuring. 2) The voltage range it can output. So if our temperature sensor is capable of measuring 0 to 100 C° and it does this over a range of 0V to 5V then by measuring the voltage we can determine the temperature. So if we measure the voltage and its at 2.5V then we know the sensor is measuring 50C°. Pretty easy right? Lets move on. The binary numeral system that I discussed earlier is extremely useful to electrical signals because a lot of the time they're either on or they're off which is 1 and 0 respectively. This is what's known as digital because the voltage is being expressed by a series of digits. This differs from analog because analog is stateless as it maps to a range and not two different distinct states like digital does. These states are high voltage potential and low voltage potential which maps to binary 1 and binary 0. So that leaves us with only 2 possibilities for a signal which really isn't all that useful on its own. But if we add into the mix the possibility that we can change states over time then we can suddenly do a lot more with it such as represent binary numbers. Now that we know what an Analog and Digital Signal to Clock signals and no its not the thing that you stare at all day when you're in class or at work but it is related. I mentioned previously that digital signals on they're own are not all that useful because you can only do two different things with them which is either turn something on or turn something off. But I eluded to the fact that if you do that over time you can now represent data. So if you have a piece of circuitry that constantly turns on and of at a set frequency you have a clock. The time between two of the same states is a known unit of time. So if we had an awfully slow clock of 10Hz (Frequency represented by Hertz Hz is the count of how many times a specific event happens in a one second period. ) it means that the clock changes between states 10 times per second. So if we were to divide one second by the amount of times our clock pulses (10Hz) you would have 100ms (milliseconds or 0.1 seconds) between pulses. So a clock signal does two things for a circuit it keeps track of time and subsequently provides synchronicity. Lets keep the head hurting train moving and go onto PWM or Pulse Width Modulation. Simply put PWM is a way of representing or translating a digital signal to an analog one using a square wave that vary the width of. PWM has 3 components to it which are duty cycle, frequency and range. We already know what frequency is so we will skip straight to duty cycle which is a portion of time that a digital signal stays in a specific state vs an opposite state represented by a percentage. So if we had a frequency of 100Hz and we held a high signal for half of a clock pulse (or half the duration) we would have a duty cycle of 50%. If we had 5V as our source voltage and we used a PWM with a 50% duty cycle we would be left with a voltage of half of our source voltage so in this case that would be 2.5V. So by varying the duty cycle you now can see how we can represent analog signals digitally. Another thing we have to talk about regarding digital data is data transmission. There's two approaches that exist when transmitting bits one is called Serial and the other is Parallel. Parallel for the most part has been phased out but it still does exist in limited fashions and devices. Parallel data transmission works by sending multiple bits simultaneously to the target device. This can be any number of bits (There's issues with the more lines you add...but out of scope) for example you may have a parallel data connection that uses 8 data lines so that it is capable of transferring 8 bits of data or a byte at a time. This is contrasted by serial data transmission in which a single bit is transferred one by one by a single data line(There are serial protocols that utilize more than one data line). This typically includes a clock signal to synchronize the transmission of the data bit between devices. Depending on the protocol variation (or the device implementation) data may be sent or received on a rising edge or the falling edge of a clock cycle. There's also three primary categories of communication between devices. The most basic is call simplex (go figure) in which data only travels one way at all times. It works by one device sends data to another but the other device doesn't talk back. The other 2 categories allow for data communication both ways. These are called full duplex and half duplex. In half duplex the data line is shared by both devices. This much like walkie talkies where only one person can talk at a time. On the other hand full duplex has at least 2 data lines allowing for both devices to communicate at the same time. This works by one device using one data line while the other is used by the 2nd device to send data back to the first device. At their core an LED you may know as basically a high tech single colour lightbulb. (There's a few exceptions to this but they're beyond scope.) If you give it a voltage and it turns on and if you vary that voltage you change the brightness also known as the intensity. LEDs are type of diode so they typically operate on the 2V to 5V range. If one were to apply 5V to the LED it will be very bright and if we just give it 2V it will barely be on. Knowing that we can map an analog range to this. Now the gears might be turning in your head on how to do so but we just discussed it earlier. The solution is simply PWM this means we can take our 24bit data and translate it into an analog signal. But wait we have a problem LEDs are only one colour so the solution is take 1 LED from each colour that we need and feed it a PWM signal. This is where our RGB data comes in which we will feed each PWM signal (frequency would also be selected but not needed for our example.) the byte that corresponds to the LEDs color. So now if we had the colour Purple we would have the Red and the Blue LED on but not the green. If we wanted white we would turn on each LED to the same intensity (assuming we don't have a white LED channel.). So that's the most basic primitive type of RGB LED strip is where you have 4 wires that are Red channel, Blue channel, Green channel and ground. You might find your self asking why I said you need an LED for each separate channel when there is only one LED for all the colours. This is because they will combine multiple different colored LEDs onto a single package. Lets combine everything discussed and talk about how addressable LEDs work. The working principle of addressable LED's is that instead of applying a PWM signal across the entire strip we will apply it to each individual LED. The way this works is instead of our microprocessor encoding our digital signal to an analog one through PWM we will leave it up to another piece of circuitry that is an Integrated Circuit. This integrated circuit can either be integrated directly into the LED module it self or it can be a stand alone chip on a circuit board with stand alone LED's. These integrated circuits LED modules come in two flavors WS2812B and APA102. The first one we will talk about is the WS2812B as this is the most commonly available. There is a grand total of 4 pins for each module. These are as follows: Vdd (Source Voltage), Di (Data In), Do (Data Out), and Vss (Ground). These modules are at their core are a PWM Shift Register which is an electrical circuit that consists of numerous (24 on this module) storage cells. These shift registers have 2 data pins on them one is for data in and the other is for data out. When you send a data bit to the data in pin you push that data into the first cell. When you send the second data bit it pushes the first bit into the 2nd cell and the 2nd bit occupys the first cell. You do this until you have filled register. It looks a little like this: colour byte >> Shift Register (0010 0101) >> (), (0001 0010) >> (1), (0000 1001) >> (01), .....(0000 0000) >> (0010 0101) Now that you have filled your register you're probably thinking your done but how do you get data to the other LEDs? Well you keep pushing bits down the line because remember there is a Do or Data Out pin. So your register keeps pushing bits out as you push bits in allowing to move data into next led. This whole process is essentially one big pipe where you push bits in on side and they come out the other. The proper term for this is called Cascading. Do you remember endianness well... it also applies the transfer of bits from once device to another but this time there's no memory addresses to deal with but simply is it the most significant bit (MSBit) first out or is it the least significant (LSBit)? In our case with WS2812B LEDs the most significant bit is sent out first. If you look at the diagram you may also notice that the order of the colour bytes is not RGB but rather GRB. We know that Blue is the first byte to be sent. So the order of transmission is Blue LSBit -> Red LSBit -> Green LSBit -> Green MSBit. We also have to take into account that the LEDs at the end of the strip will be first bytes of data that we will send. We have now established how to send data to our LEDs and in what order but there's more to it than that with these LEDs. The reason there is more to it is because these LEDs don't take a simple High signal or low Signal from your microprocessor. If we look at the supplied timing diagram it shows both a high period and a low period for which to encode a binary 1 or a binary 0. This is because these LED's don't have a clock signal into them that allows you to synchronize the data transmission. Instead if you hold your data pin high for x amount of time and then hold the pin low for x amount of time you encode a bit. These timings can be found in the table below. So in order for us to encode a binary 0 we would have to look at T0H and T0L these correspond to high voltage time and low voltage time. So to have a binary 0 you would need to hold the data pin high for 0.4us and then hold it low for 0.85us. To encode a Binary 1 we need to look at the two remaining rows which is T1H and T1L. Which corresponds to 0.8us and 0.45us respectively. So for every bit we need to output we have to see what its binary value is so that we can hold the data pin at the voltage levels for the time needed and then move onto the next bit after that. After we have shifted all the data to the LEDs we then need to use the Reset command to lock the data in after which the LEDs will lock into the colour that we sent. To send the reset signal its as simple as holding the data pin low for 50us after we sent our last bit. One easy way we can achieve sending this data is through PWM because if you look back at the timing diagram it looks awfully like a PWM diagram. You can set your PWM frequency to that of the total bit encode time (assuming nominal) which is 1MHz ( Some microprocessors may be incapable of this.) Now if you set your PWM duty cycle to 64% you will encode a binary 1 ever cycle and if you set it to 32% you will encode binary 0. So now you just have to set duty cycle for every cycle of the PWM to encode your data. Easy Peasy. If your microprocessor is incapable of this you would need to structure your program to account for time that the bit is held high and for the time that the bit is held low and modulate the voltage level that way. Because the WS2812B's are timing based Bit Banging it leaves something to be desired for refresh rates and for the total number of LED's that you can run in total (assuming you have the RAM on the controller to hold as many LED's as you need.) If you say wanted to run these LEDs at 30Hz (30 FPS) you would only have 33ms to update your LEDs and lock them in. So the fastest (According to the data sheet) that we can encode a bit on these LEDs is 0.65us. So lets convert 33ms to microseconds. Shift the decimal place over 3 positions and we have 33000ms per frame to update LED's. We need 50us to send the reset signal so we can take that right of the top so that we have 29950us to work with. So 29950 divide by (0.65us x 24 bits) is 1919 LEDs. You want to run those LEDs at 60FPS well your left with less than half after that. Moving onto the other type of LEDs which are the APA102 LEDs. These guys are very similar to the WS2812B but they have 2 extra pins Ci and Co which are clock in and clock out. Since these have clock pins they use the pulse of the clock and the current state of the Data in pin to encode a binary 1 or binary 0. In addition our data format changes from GRB to BGR. There is also a little bit more information that we have to send at the beginning and end of each frame and with every colour value. At the start of every frame we will have to send a start frame which is 32bits of binary 0's. After this for each LED we will send 3 binary 1 bits followed by a 5 bit (32 level) global saturation modifier. This global modifier will scale the brightness of the LED while preserving the exact colour. After that you will send your data in BGR format starting with the MSbit. Once you're done sending your colour you will end the entire operation with an end frame which is simply another single 32bit group of zero's that are pushed down the line. To recap the APA102's you send a start frame at the beginning of every update to signal that you intend to write new data followed by packets consisting of 3 high bits followed by 5bit global brightness number followed by 24bits of BGR colour data. You repeat this packet for every LED in the string and then finish it off with an end frame consisting of 32bits of zeros to each LED to lock in the colour. This entire process is very similar to a serial data protocol called SPI or Serial Peripheral Interface. Its a 3 wire full duplex synchronous data transmission protocol that has 2 data lines and 1 Clock signal. The Data lines are MOSI or Master Out Slave In and MISO or Master In Slave Out while the clock signal is called SCK. Since the LED's don't communicate back to us we really only need the MOSI line and the SCK line. Many boards allow us to configure how fast we want to send data, whether that data is sent on a rising or falling clock edge and if we want LSBit or MSBit first. So already we can get off very easy by using the hardware features of many microcontrollers and processors. For the APA102 we can send data at very fast rates (10MHz+) and we need to send them on a rising clock edge. That's all you really need for basic APA102 operation. However with the APA102's the data needed in total is a little misleading because you most likely will require more data sent. This more specifically has to do with the end frame. Since these LED's require a rising clock edge to validate data the other LEDs in the line wouldn't have enough time to validate incoming data because the rising edge window is too short. So the way the APA102 designers fixed this is by delaying the data output by about half a clock cycle back so that there's enough time for the next LED to monitor the data line and read the data in. The consequence of this is that for every LED the data gets delayed by an additional half clock. So what the end frame has to do with is that its only purpose is to push the rest of the bits to the last of the LEDs with additional clock pulses. The number of clock pulses needed is half of the LED count because each LED is a half clock more behind the previous LED. So if you only used the datasheets recommend 32bits only 64 LEDs would be locking in the new data. Where as if you send half the number of your LED's as a total bit count each containing 0's you subsequently lock in the data for every LED. The end!!! Now go blow your mind!!!!!
-
Hey guys, so what license could I use for my app that I'm going to sell? I'm hesitant of using open source licenses cause this software won't be open-source and I want to upload it to GitHub as part of my portfolio. Are there any licenses that can be used for commercial apps? Thanks in advance for the help! Kind Regards PrimeMinister
- 8 replies
-
- programming
- licencing
-
(and 3 more)
Tagged with:
-
Hello there, I want to buy a budget game development and 3d modeling pc. I am thinking of a 1665/1650 4 gb vram, a ryzen 3 3100, 8 gb of ram at 3000 mhz,what you thing and what you recommand me and also what keyboard should i choose, i am not a big gamer so gaming part is not important. Thanks!
- 5 replies
-
- game development pc
- 3d modeling pc
-
(and 2 more)
Tagged with:
-
Budget (including currency): 1000euros max Country: Austria Games, programs or workloads that it will be used for: For honor,RDR2,Kingdome come deliverence,Assasins creed black flag,maybe vallhala.And do a bit of programming,which is not taxing Other details (existing parts lists, whether any peripherals are needed, what you're upgrading from, when you're going to buy, what resolution and refresh rate you want to play at, etc): I want a pc that will let me play at 1080p for 60 fps.My monitor is 60hz 1080p,will later upgrade to ultrawide 1440p. I just want to play singleplayer games at 60hz high settings.I dont need future proofing,i will buy a new pc if i need it in couple years again,but atm budget is pretty tight so lower the cost is,the better. I will buy pc from Agando.de,they have better prices,they make clean pcs,good cable management.Every shop is out of stock everywhere,and i save money doing this. I honestly dont have idea what to buy,so any help is great.
-
I am planning to buy new monitor. But i am not sure should i go with 1440p ultrawide or normal 4k monitor. Purpose of this monitor will be coding and web browsing,so 60hz is enough. What do you guys recommend?
-
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
-
Hi guys! I am looking for recommendations for a laptop to replace the one I use right now. It's Lenovo ideapad 700 from 2016, with Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz 2.59 GHzi7 7600HQ, more info you can find here - https://www.notebookcheck.net/Lenovo-IdeaPad-700-15ISK-80RU0009GE.167197.0.html I am looking for a solid upgrade on which to program and play games in my spare time. My budget is around 1500 EUR. Thanks for the help in advance!
-
Hey, I've been planning for a new pc build. I'll mainly be using it for programming, i.e. in unreal or unity and in vs code, and also a bit of gaming (probably minecraft, rocket league and maybe cyberpunk). Any recommendations on what parts I should use budget of 2500$ virginia usa (NVIDIA gpu preferably)
- 4 replies
-
- coding
- programming
-
(and 1 more)
Tagged with:
-
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
-
Hello to all developers out here. Can you answer what kind of build are you running,laptop or desktop. In what languge are you primarily coding,and what software´s do you use. I am gonna build pc or buy laptop in next few months,and would like to plan my budget accordingly.
- 18 replies
-
- programming
- workstation
-
(and 3 more)
Tagged with:
-
Hi, so im looking to make a image scroll on hover to show a preview of a webpage. This page is a good example of this https://nycwebdev.io/ . Mine is just a popout image that needs to scroll. I will attach the HTML and CSS to this post. and here is whats currently happening with my code. https://gph.is/g/4L3YoqP I've looked around a lot and cant find a good answer. Thanks in advanced for the help. <div class="col"> <a href="http://www.sekisuiplasticsusa.com"> <div class="card"> <img id="cardimg" src="Manufacturing images\Sekisuibig.PNG" alt="Avatar" style="width:100%;"> <div class="large"> <img src="Manufacturing images\Sekisuibig.PNG" class="large-image" alt="Avatar" style="width:250px; height: 250px;"> </div> <div class="cardtext"> <h6>Sekisui Kasei USA</h6> </div> </div> </a> </div> .large { position: absolute; left: -9999px; z-index: 1000; background-repeat: no-repeat; overflow:hidden; } a:hover .large { left: 20px; top: -150px; border-radius: 4px; box-shadow: 1px 1px 3px 3px rgba(127, 127, 127, 0.15); } a:hover .large-image { transform: translate(0, -25%); } .large-image { transition: all .3s ease-out; margin-left: 0px; object-fit: none; margin-top: 0; object-position: 50% 0%; }
-
Hi Community, I am new here, I wrote this software for different use's I may have. Any comments about the Cartoon affect on linus? Any comments, opinions, advice, and criticism is greatly appreciated. Cheers, Sean
- 5 replies
-
- graphics
- programming
-
(and 3 more)
Tagged with:
-
Everytime I install windows it reboots then goes back to the same install windows screen idk what’s wrong
- 5 replies
-
- windows10
- programming
-
(and 3 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:
-
Hey guys, so I want to get some feedback for this little password generator/manager app I'm currently making for PC (specifically for Windows) as well as getting some advice for the future, so here goes for the advice.. Where can I release the app exclusively for PC (for now) without paying monthly fees? Is it a good idea to make the app open-source? Would this be a good thing to add to a portfolio or should I convert the code to a more well-known language first? (It's all going to be and is coded all in Delphi Pascal, because it's the only language I know at the moment) Any other suggestions and stuff regarding the app's GUI,etc.. I'm still going to tinker and whatnot but I can't do as much as I'd like rn as I'm in my first round of final exams. And this is the pre-pre-pre-alpha version of my final idea for the app, it's only a really basic password generator at the moment. Link to the github of the app : https://github.com/Kiryu02/SimPasGen Thanks in advance for the feedback/advice! Regards Ya Boi Minister
- 10 replies
-
- programming
- programming help
-
(and 3 more)
Tagged with:
-
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:
-
I am looking to buy a laptop with the intend for programming, but would also like games to be an option. I am located in Ireland, looking to spend maximum 600-700 euro. I will mainly be using this to program when I am not home, but would also like to game, though it does not need to be for heavy games. 16gb ram preferred, and AMD is preferred.
-
I'm curious if there is an updated set of resources to learning/advancing in Clojure since the last time that I looked for such a thing. I've been using the mid-2010s resources on it mostly (i.e. Clojure for the Brave and True and the like). Anyone have a more refreshed list on the latest and greatest in Clojure resources?
- 2 replies
-
- lisp
- programming
- (and 4 more)
-
So poking around the interwebs, I found this interesting little info generator for any website you pop in: https://tinywow.com/web/detect . Wonderful as it is, I find it brings up a question as to what CMS means in this instance. The closest I can think of is a Content Management System. Is that correct? What exactly is going on here? I have theories but don't wish to speculate just yet.
-
I recently wrote a python script that scrapes local power outages from the internet and I would like to create a integration that runs this script daily and displays this data in a HomeAssistant table component type thing. How would I go about doing that ? The current output of the script is a DataFrame exported as csv and I would not be opposed to changing that to make the integration work. I would also like to make the integration publicly available for people in my area to use.
-
- homeassistant
- programming
-
(and 1 more)
Tagged with:
-
The Software Enigma Machine blog Pt. 1
Mira Yurizaki posted a blog entry in Yurizaki's Tech Ramblings
Since enough people seemed interested in a status I posted some time ago that I thought, hey, it might be a good idea to do a write up. It'll be short enough that it'll actually end! The Outline This section is just to provide an outline of this series: Part 1 What is the Enigma Machine? Why did I choose to implement the Enigma machine? Before Programming Begins: Understanding the theory of the Enigma Machine Finding a programming environment Part 2 Programming the features Rotors Rotor housing Part 3 Plug Board Part 4 GUI If you'd like to look at the source code, it's uploaded on GitHub. A bit of background: What is the Enigma Machine? During World War II, everyone had their way of encrypting and decrypting messages. The Germans used a modified commercial product that did this called the Enigma Machine. It has a key for every letter (in my case, 26 for the English alphabet). Each key was electrically wired up so that when it was pressed, an electrical connection was made through it, then to a few rotors where it would come out to another key, which would light up a bulb corresponding to that key. So if you pressed A, it would get scrambled into something like D. Since it was electrically connected, you could also do something like swap letters so that the input would get swapped or the output would get swapped. From Wikipedia, here's a basic diagram of how it works (Pressing A results in a D, though it would've resulted in an S if not for the plug board connection in item 8): Though it wouldn't do much good if pressing A always resulted in a D. To solve this, every time a key is pressed, a rotor advances. In this case, the right most one. And when that makes a full revolution, it advances the next one, and so on. This makes it so that pressing the same letter always results in a different one. A key element in the Enigma machine was the reflector element (item 6). This was required due to how the machine was designed, which introduced a flaw in that a letter cannot encode to itself. To decode the message, you take the encoded message, set the rotors to same position as when the encoding started, then type in the encoded message. The machine will light up the decoded letter for each encoded one. In short, the Enigma machine is a rotating substitution cipher. Each combination of rotor positions represents a different substitution cipher that it rotates through automatically. There was also another substitution cipher in the form of the plug board, but this was manually entered and static. Why did I choose to implement the Enigma machine? I was thinking of some simple projects to do on the side. While nice complex projects can be fun, they can also be a pain and having something done feels more like a sense of an accomplishment than getting 50% there on a complicated project after dumping hours into it. The Enigma Machine came up because I figured it'd be a relatively good challenge and yet it's simple in theory. So it shouldn't be hard to debug and verify it works. And also World War II is my favorite time period, with the Enigma having interesting stories around it. Before Programming Begins Most successful programming projects, or just any real project, needs a lot of planning and research ahead of time before the work can really begin. Poorly researched aspects can cause hiccups in the future that may not make themselves apparent until a lot of work has already started. Understanding the Theory of the Enigma Machine There isn't much point in trying to program something if you don't understand how the system works in general. So step one is to understand how the Enigma Machine works. The most interesting part was the rotors, which aren't really that complex: there are input pins and output pins, and the input pins wire to an arbitrarily picked output pin. So the overall requirements for this system to work is: The pin mapping of the rotors should be randomly generated. However, this should not be uncontrolled random generation. That is, the user needs to input the RNG seed. Otherwise, the usefulness of the program is only good for that instance of the program. Each new instance would have a different randomly generated set of rotors with no way of setting it to what another instance used. For each rotor, an "input" must map to an "output" such that if you give the rotor an "input" value, it returns an "output" value. But if you give it the "output" value, it returns the "input" value. That is: If I give the rotor 1 and it returns 3, if I give the rotor 3, it returns 1. Each time a rotor is used, depending on its position, it needs to "advance". That is the next time I use the rotor, the mapping needs to be offset for the same input. For example: If the letter "A" maps to pin 1 on the rotor, the next time I feed the letter "A" into the rotor, it goes to pin 2 instead. The plug board has a similar idea, in that it's also a substitution cipher that works in the same way as the rotors, namely it needs the second requirement. However, they behave differently as far as the system is concerned so they need different sets of logic to function. These are: The plug board does not automatically advance. i.e., the mapping doesn't change automatically. The mapping can change based on the user needs. The rotors are more or less permanently wired. The plug board, as the name implies, has plugs the user can connect wires into and disconnect said wires. The user-changeable mapping presents a problem, say we have a mapping of A -> B, which means B -> A, and another mapping of C -> D, which means D -> C. What if I want to wire A -> C? The question will be answered in the section where I talk about the plug board design. Then there's the path of how a key press turns into a lit lamp: A key press goes to the plug board to be remapped. By default, the letter maps to itself. The output of the plug board goes into the input if the first rotor. The output of the first rotor goes into the input of the second pin for pin (i.e., rotor 1 outputs pin 2, so it goes into pin 2 of rotor 2) Repeat for N-rotors The output of the last rotor goes into the reflector, which spits out a value to go back into the nth rotor's "output" side, this spits out something on the "input" side. The "input" of the rotor goes into the "output" pin of the previous rotor, and repeat until the "input" of Rotor 1 is given. The returned "input" goes into the plug board to be remapped. The output of the plug board then spits out the letter. The key pressing and lamps are merely inputs and outputs. They don't affect the theory of operation of how the Enigma Machine works. Figuring out What Language/Environment to Use I wanted this to have a GUI, because eventually I would need to have that keyboard + "light" interface. And because there are components in the Enigma Machine that do independent things and there could be multiples of one of them, I felt a language that supported object-oriented design is best. So these were the requirements for the language and environment I wanted: What has good GUI framework support? What supports object-oriented design? What features of the language makes things like manipulating entries in data structures or creating multiple instances of an object easier? What environment is easy to setup? Out of what I do know: Python: Python has a few GUI libraries, but my experience with this is limited. And what experience I do have isn't quite pleasant (to be fair, it was only with Tcl). I'm aware there are frameworks to make this easier, but I didn't want to spend time looking and testing them out. C++: Similar issue as I have with Python: I'm aware GUI libraries exist, my experience with them are limited (at least from a fresh start), and I don't want to spend too much time learning this. C: While the state of each rotors can be separated and business logic can just take in the state of rotors to work with, this would be hard than I'd like. Plus the issue with finding a GUI framework, though it's likely any C code I'd write would be called from C++ GUIs. JavaScript/HTML: I could, in theory, make the Enigma with this. But I didn't consider it for no reason other than it didn't cross my mind. C#: I'm sure there's some way of writing and compiling C# in a bare bones manner, but I use Visual Studio for C# work. And having worked with Visual Studio and C# to quickly write tools for work, I decided to go with this. Yes I'm aware Visual Studio has C++ support, but I don't have much experience with it. At least for developing Windows Form apps. There's also another reason why I went with C#: I know it has a lot of data structures that make my life easier, because they come with a bunch of methods that help do what I want. And it's not just the language that has nice features that I want that's included, but setting up a C# development environment is stupid easy. It's just download and install Visual Studio. If I spent a day just setting up my tools, the project would've likely be dead in the water. I like to think of myself as a lazy developer. Not in that my code is lazily written (most of the time, anyway), but I don't want to spend all day doing something that feels like it should take 10 minutes. The tools exist to make my job easier. If the tool doesn't appear do that, it's a poor tool. With the planning phase done, the next entry will go over the programming process and how things were built. > On to part 2 -
As a way to expand my skill set and give me something to do in my spare time on programming, I've taken up learning what is called full stack web development. In it's most high level description, that means dabbling in both the front-end (client app, web page, etc.) and back-end (server, database, etc.) of the development process. To ease going into this, because I didn't want to learn almost a half-dozen languages, I've stuck with Node.js and MongoDB, as both use ECMAscript. Essentially all that means is I have to learn JavaScript. This has been a key point in where I'm going with the title. A full web application is made up of several independent pieces Pieces like the server, the database, the client, and others. These pieces are independent form each other, yet they still need to talk to each other and perform as a cohesive unit. If one of these breaks or isn't developed well, the whole application can have a bad time. Multi-threading means asynchronicity Synchronicity in this means that everything runs in order as you might expect while reading the code. Asynchronicity means that some code can execute right away, some code will be skipped, and some code will be put to the side, only to be run later. If there is something you run into a lot of in JavaScript, it's that a lot of things are asynchronous. You have a lot of things on a web page that are waiting for user input. However, the web site can't freeze itself or force the user to do things in a specific order, because this decreases the quality of the user experience. In a server, when you do a database request, you don't want this hanging the entire server because a database request can take a while. You want the server to go right back to serving other people's requests if the current one is going to take a while and can be put off to the side. In JavaScript, these are handled by mechanisms such as callbacks and Promises. For example, here's some client code I've written, requesting to the server to get a list of groups: var getInfo = function(){ // Making an HTTP GET request $http.get('/groups/getList?index=' + $scope.startIndex) .then( function(response){ if (response.data.status === 30000){ $scope.groupList = $scope.groupList.concat(response.data.groupList); $scope.startIndex += response.data.groupList.length; } else { console.log("There was an error getting groups. Code:" + response.data.status); } }, function(response){ console.log("There was an error getting groups. Code:" + response.data.status); }); // Script resumes from here after making the HTTP GET request console.log("I made a HTTP GET request!"); }; The first part has the client make an HTTP GET request to the server to a particular URL for getting a list of groups. Since the server isn't going to respond instantaneously, the client will put this action off to the side and continue executing. What happens then is the client will execute console.log("I made a HTTP GET request!"); immediately afterwards. Essentially, for the moment since the data isn't available, it skips everything from the HTTP request function to the comment about where the script resumes. When the server sends the data back to the client, a signal is generated to let the client know to go back and execute the code that was skipped. This is a key point in multi-threaded programming. Things need to be asynchronous. The application needs to be able to put tasks that are waiting for something else to be cast to the side and signal the application when the result comes in. People may be sharing resources and you need to manage them An example is on Wikipedia. What if two people are editing a page at the same time, but adding different things to the page? How do you handle them both saving data? This is a common issue with multi-threading programming. One way of handling it the server having a token that only one person can take. If the token was taken, then nobody else can touch the page until the token is released. Another solution is if someone submits their edit, then another does, you can respond "hey, someone made changes already." Web application development gives you more control in the debugging process This part makes understanding how each bit interact with each other easier. One of the hardest things about developing and debugging multi-threaded applications is that a lot of things happen on the OS and processor level. It can be hard to poke into those to figure out what's going on. Like when you want to pause the execution of the application in the source code, you're not quite sure which thread you're on. When you're doing web application development, each instance you are accessing the web page can be thought of as a process or a thread in the entire application. In this way, you can pause one instance's execution and know exactly which one you're poking at. In another sense, you may be able to control aspects behind the scenes, such as latency and such. It's harder to see how a local application will behave with hiccups and such without clunky methods, but you can certainly add latency to your network or simulate it another way without adding debug code or whatnot. It's practical and relatively easy to setup! One of the hardest problems with learning something about software development is what to do with it. I'm finding full stack web development practical to learn because it touches upon something we all use in our daily lives. So instead of trying to figure out a local application you can run that can be multithreaded, try developing a website server and a client to go with it. The flip side is it's very visible and you can see your results. Now I say it's relatively easy to setup, but it still has a learning curve. In my case, at the barest minimum you need to learn HTML and JavaScript. CSS is highly recommended. Then again, multi-threaded programming isn't a beginner level concept either. But if you take an afternoon to study, you can certainly get a web server setup: https://www.tutorialspoint.com/nodejs/nodejs_express_framework.htm My development setup at the moment is: VirtualBox with Lubunutu Node.js with Express as the server framework. MongoDB for the database. This is a document-oriented database, as opposed to a relational database like SQL. Whatever text editor of choice you want (I use Atom).
-
- programming
- web app
-
(and 1 more)
Tagged with: