• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 07:47
CEST 13:47
KST 20:47
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
Serral wins HomeStory Cup 2914Serral wins Maestros of the Game 243ByuL, and the Limitations of Standard Play3Team Liquid Map Contest #22: Results and Winners7Code S Season 2 (2026): RO4 and Finals Preview12
Community News
IntoTheTV X SOOP SC2 League : Weekly & Monthly4Clem: "I don't have that much hope in Blizzard"2ZeroSpace Early Access is Now Live!24Weekly Cups (July 13-19): Terran & Protoss rise; Zerg falters2Balance hotfix patch 5.0.16b (July 16)90
StarCraft 2
General
Reynor: GSL Loss Wasn't About Preparation Format Balance hotfix patch 5.0.16b (July 16) How would you feel about frequent/monthly balance patches for SC2? Clem: "I don't have that much hope in Blizzard" Weekly Cups (July 13-19): Terran & Protoss rise; Zerg falters
Tourneys
IntoTheTV X SOOP SC2 League : Weekly & Monthly INu's Battles#18 - Cure, herO, Rogue & ByuN RSL Revival: Season 6 - Qualifiers and Main Event Master Swan Open (Global Bronze-Master 2) WardiTV Summer Cup 2026
Strategy
[G] Having the right mentality to improve
Custom Maps
[M] (2) Industrial Park New Map Maker - Looking for Advice - Love or Hate
External Content
Mutation # 535 Assembly of Vengeance The PondCast: SC2 News & Results Mutation # 534 Burning Evacuation Mutation # 533 Die Together
Brood War
General
ASL22 General Discussion BW General Discussion How Famous was FlaSh before his Debut? Animated Gateway BGH Auto Balance -> http://bghmmr.eu/
Tourneys
Escore Tournament - Season 3 Small VOD Thread 2.0 [Megathread] Daily Proleagues [IPSL] Spring 2026 Grand Finals - This Weekend!
Strategy
Simple Questions, Simple Answers PvT advise for noobs Fighting Spirit mining rates Creating a full chart of Zerg builds
Other Games
General Games
ZeroSpace Early Access is Now Live! General RTS Discussion Thread Path of Exile Nintendo Switch Thread Diablo IV
Dota 2
Looking for a Dota Mentor Official 'what is Dota anymore' discussion
League of Legends
TSM pausing esports and CLG Dead
Heroes of the Storm
Heroes of the Storm 2.0
Hearthstone
Deck construction bug
TL Mafia
TL Mafia Community Thread TL Mafia Power Rank NeO.D_StephenKing vs This Guy From 1 Million Dance Vanilla Mini Mafia
Community
General
US Politics Mega-thread Artificial Intelligence Thread Russo-Ukrainian War Thread How to buy a book - shipping from Korea to Europe The Games Industry And ATVI
Fan Clubs
The IdrA Fan Club The HerO Fan Club!
Media & Entertainment
Anime Discussion Thread Series you have seen recently... Movie Discussion! [Req][Books] Good Fantasy/SciFi books
Sports
2024 - 2026 Football Thread TeamLiquid Health and Fitness Initiative For 2023 Formula 1 Discussion MLB/Baseball 2023 McBoner: A hockey love story
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread Simple Questions Simple Answers FPS when play League Of Legend on laptop
TL Community
Northern Ireland Global Starcraft The Automated Ban List
Blogs
How Games can Help with Majo…
TrAiDoS
Hello guys!
LIN1s
ASL S22 English Commentary…
namkraft
Poker (part 2)
Nebuchad
An Exploration of th…
waywardstrategy
Customize Sidebar...

Website Feedback

Closed Threads



Active: 4473 users

The Big Programming Thread - Page 494

Forum Index > General Forum
Post a Reply
Prev 1 492 493 494 495 496 1032 Next
Thread Rules
1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution.
2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20)
3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible.
4. Use [code] tags to format code blocks.
Nesserev
Profile Blog Joined January 2011
Belgium2760 Posts
June 25 2014 23:00 GMT
#9861
--- Nuked ---
sob3k
Profile Blog Joined August 2009
United States7572 Posts
Last Edited: 2014-06-26 00:01:54
June 25 2014 23:47 GMT
#9862
After getting quite solid with HTML/CSS I am trying to learn really basic PHP. I've read like a fucking bazillion sites on it and I still just don't understand the basics of how it works and what I need to do to actually get it running.

So it can basically be embedded right into HTML, do I need to download anything to get it running or is it already on my computer?

I need WAMP to emulate a server in order for it to run? Ok I downloaded WAMP and ran it, that's it? I don't have to do anything to set it up? How do I even know if its running (correctly)? How does the PHP script I write know about the server? WAMP says server offline....if I need it online how do I do that? How do I need to adjust everything when the site is done and set free into the wild?

I just don't understand the basic idea of whats going on here. What needs to be running, where data is going, what packages need to be installed and why.

EDIT: maybe I figured it out, fuck I hate learning brand new things from the internet with all the awful tutorials and ancient shit from 2008.
In Hungry Hungry Hippos there are no such constraints—one can constantly attempt to collect marbles with one’s hippo, limited only by one’s hippo-levering capabilities.
WolfintheSheep
Profile Joined June 2011
Canada14127 Posts
Last Edited: 2014-06-26 00:14:27
June 26 2014 00:13 GMT
#9863
On June 26 2014 08:47 sob3k wrote:
After getting quite solid with HTML/CSS I am trying to learn really basic PHP. I've read like a fucking bazillion sites on it and I still just don't understand the basics of how it works and what I need to do to actually get it running.

So it can basically be embedded right into HTML, do I need to download anything to get it running or is it already on my computer?

I need WAMP to emulate a server in order for it to run? Ok I downloaded WAMP and ran it, that's it? I don't have to do anything to set it up? How do I even know if its running (correctly)? How does the PHP script I write know about the server? WAMP says server offline....if I need it online how do I do that? How do I need to adjust everything when the site is done and set free into the wild?

I just don't understand the basic idea of whats going on here. What needs to be running, where data is going, what packages need to be installed and why.

EDIT: maybe I figured it out, fuck I hate learning brand new things from the internet with all the awful tutorials and ancient shit from 2008.


Sounds to me like you're trying to go from 0 to 100 in an instant.

PHP is not HTML, it runs the scripts and outputs HTML, and it's a purely server side framework. That basically means it has to be installed on your server, and your server has to know to run the relevant file extensions through the PHP interpreter (in Apache, you generally do this with the httpd.conf file).

The php files also have to be on the same server, so when you ask how it knows about the server, it doesn't. The server sees the .php file (or whatever extension you used), knows it should be accessible from the outside, and when someone tries to access it through a browser, it runs it through the interpreter which spits out the appropriate HTML output.

It also sounds like this is your first time setting up a web server, which is a whole other mess of worms.
Average means I'm better than half of you.
billy5000
Profile Blog Joined December 2010
United States865 Posts
June 26 2014 00:30 GMT
#9864
Are there numerous, practical use of closures? In a broad sense, it seems to allow functions hold some "state" but I haven't come across a time when I would use it, ever. It seems like I'm on the lookout to avoid it rather than to actually use it. I may be exaggerating a bit when I say that since all you have to do is create a private function, or an anonymous function that takes the outer function's variables as arguments instead.
Tiger got to hunt, bird got to fly; Man got to sit and wonder, 'Why, why, why?' Tiger got to sleep, bird got to land; Man got to tell himself he understand. Vonnegut
tofucake
Profile Blog Joined October 2009
Hyrule19229 Posts
June 26 2014 00:37 GMT
#9865
Closures are awesome. If you do anything with jQuery you'll use closures. I've been using them a lot more in PHP (in things like array_walk) since 5.5 too.
Liquipediaasante sana squash banana
sob3k
Profile Blog Joined August 2009
United States7572 Posts
June 26 2014 00:41 GMT
#9866
On June 26 2014 09:13 WolfintheSheep wrote:
Show nested quote +
On June 26 2014 08:47 sob3k wrote:
After getting quite solid with HTML/CSS I am trying to learn really basic PHP. I've read like a fucking bazillion sites on it and I still just don't understand the basics of how it works and what I need to do to actually get it running.

So it can basically be embedded right into HTML, do I need to download anything to get it running or is it already on my computer?

I need WAMP to emulate a server in order for it to run? Ok I downloaded WAMP and ran it, that's it? I don't have to do anything to set it up? How do I even know if its running (correctly)? How does the PHP script I write know about the server? WAMP says server offline....if I need it online how do I do that? How do I need to adjust everything when the site is done and set free into the wild?

I just don't understand the basic idea of whats going on here. What needs to be running, where data is going, what packages need to be installed and why.

EDIT: maybe I figured it out, fuck I hate learning brand new things from the internet with all the awful tutorials and ancient shit from 2008.


Sounds to me like you're trying to go from 0 to 100 in an instant.

PHP is not HTML, it runs the scripts and outputs HTML, and it's a purely server side framework. That basically means it has to be installed on your server, and your server has to know to run the relevant file extensions through the PHP interpreter (in Apache, you generally do this with the httpd.conf file).

The php files also have to be on the same server, so when you ask how it knows about the server, it doesn't. The server sees the .php file (or whatever extension you used), knows it should be accessible from the outside, and when someone tries to access it through a browser, it runs it through the interpreter which spits out the appropriate HTML output.

It also sounds like this is your first time setting up a web server, which is a whole other mess of worms.


yes, the web server stuff is the hard part right now. Unfortunately I need to learn how to set up basic forms/interactivity etc, which requires PHP, and to mess around in PHP I need the server so it seems like I gotta do it.
In Hungry Hungry Hippos there are no such constraints—one can constantly attempt to collect marbles with one’s hippo, limited only by one’s hippo-levering capabilities.
delHospital
Profile Blog Joined December 2010
Poland261 Posts
June 26 2014 16:00 GMT
#9867
On June 26 2014 09:30 billy5000 wrote:
Are there numerous, practical use of closures? In a broad sense, it seems to allow functions hold some "state" but I haven't come across a time when I would use it, ever. It seems like I'm on the lookout to avoid it rather than to actually use it. I may be exaggerating a bit when I say that since all you have to do is create a private function, or an anonymous function that takes the outer function's variables as arguments instead.

Closures are a concept central to functional programming. In languages such as Haskell or ML, functions that conceptually take more than one argument, in reality take only one argument and return a closure (that, conceptually, takes one less argument).

For example, 'max', when applied to two numbers, checks which one is bigger, and returns it. But, if you give it only one number, it will return a closure which remembers that number, and "waits" for the second one. When can it be useful? Let's say you have a list of integers, and some of them are negative. However, you don't like negative numbers and want to replace them with zeros. The easiest way to do it is to 'map' over the list, providing 'max 0' as the function to execute on each element.

So, in this case, it allows you to reuse existing functions, while in most languages you would have to do it by hand.
aksfjh
Profile Joined November 2010
United States4853 Posts
June 26 2014 16:17 GMT
#9868
On June 25 2014 21:49 urboss wrote:
yeah you are probably right.
I thought that one could start with the assumption that both images are the same person and then stop the algorithm as soon as it becomes clear that the images are not the same person.
That would save some time for the negatives, but since it is only one image the speed gain is probably only marginal.

The way graphics processing works, there is little you can do to speed up the process. The computationally difficult part is the algorithm to turn the visual image into a data set you can work with in a meaningful way. Just getting to the point where you're making judgments about the person is (wild guess) 95% of the processing power/program time. After that, it's usually just lots of subtraction and/or division to determine likeness.
urboss
Profile Joined September 2013
Austria1223 Posts
June 26 2014 16:56 GMT
#9869
I'm just wondering, what are the advantages of functional programming?
Can you write normal software with functional languages?
Under what circumstances would you prefer a functional language?
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
June 26 2014 17:47 GMT
#9870
The advantage is that you don't have to worry about side effects.
Functional languages are just as powerful as other languages; of course you can write "normal" software.

You shouldn't think of functional programming as some form of programming opposite to OOP or such. In it's essence, functional programming just means that you use immutable data (and let the compiler worry about efficiency).

Functional programming is on the rise, and chances are immutability is going to be a big deal when you try to code for highly parallel environments. Which your CPU will eventually turn into, and your GPU already is.
If you have a good reason to disagree with the above, please tell me. Thank you.
Nesserev
Profile Blog Joined January 2011
Belgium2760 Posts
June 26 2014 18:02 GMT
#9871
--- Nuked ---
Qwurty2.0
Profile Joined February 2013
United States7 Posts
June 27 2014 01:34 GMT
#9872
On June 26 2014 09:41 sob3k wrote:
Show nested quote +
On June 26 2014 09:13 WolfintheSheep wrote:
On June 26 2014 08:47 sob3k wrote:
After getting quite solid with HTML/CSS I am trying to learn really basic PHP. I've read like a fucking bazillion sites on it and I still just don't understand the basics of how it works and what I need to do to actually get it running.

So it can basically be embedded right into HTML, do I need to download anything to get it running or is it already on my computer?

I need WAMP to emulate a server in order for it to run? Ok I downloaded WAMP and ran it, that's it? I don't have to do anything to set it up? How do I even know if its running (correctly)? How does the PHP script I write know about the server? WAMP says server offline....if I need it online how do I do that? How do I need to adjust everything when the site is done and set free into the wild?

I just don't understand the basic idea of whats going on here. What needs to be running, where data is going, what packages need to be installed and why.

EDIT: maybe I figured it out, fuck I hate learning brand new things from the internet with all the awful tutorials and ancient shit from 2008.


Sounds to me like you're trying to go from 0 to 100 in an instant.

PHP is not HTML, it runs the scripts and outputs HTML, and it's a purely server side framework. That basically means it has to be installed on your server, and your server has to know to run the relevant file extensions through the PHP interpreter (in Apache, you generally do this with the httpd.conf file).

The php files also have to be on the same server, so when you ask how it knows about the server, it doesn't. The server sees the .php file (or whatever extension you used), knows it should be accessible from the outside, and when someone tries to access it through a browser, it runs it through the interpreter which spits out the appropriate HTML output.

It also sounds like this is your first time setting up a web server, which is a whole other mess of worms.


yes, the web server stuff is the hard part right now. Unfortunately I need to learn how to set up basic forms/interactivity etc, which requires PHP, and to mess around in PHP I need the server so it seems like I gotta do it.


If you don't want to set up a completely separate server, you can install XAMPP, which basically simulates a server on your computer. You install it to your C:/ drive, place your website files in the htdocs folder (make sure you change your .html to .php). After that you go to the control panel and start apache.

Then you go to your browser, type in "http://localhost/[path-to-file-here]", and viola, your php file should work.

This is, of course, simplified, but there are numerous videos on YouTube that will show you how to do it if you get stuck. It's pretty easy.

If you actually want to set up a separate server, then that can be a hassle.
Amnesty
Profile Joined April 2003
United States2054 Posts
Last Edited: 2014-06-27 03:42:22
June 27 2014 01:48 GMT
#9873
Is anyone familiar with libtiff using C++?

I need to read a black and white image, put the data as bools in a 2D array, flip a few bits. Then save the the array back into a tiff.
I've had no luck. After reading in the data, it still looks compressed.

Im just using a small 30x30 tiff image with a few pixels set. If you need this file lemme know and i can message you.

Any help would be so much appreciated!!!!!!

Basically, this code is the example code in the documentation. I tried looking for similar questions already answered on stackoverflow for a few hours and no luck. I've been at this almost all day.
+ Show Spoiler +


#include <stdio.h>
#include <tiffio.h>
#include <memory>
#include <fstream>
#include <iostream>
#pragma comment(lib,"libtiff.lib")

int main(int argc, char *argv[])

{
TIFF *image;
uint16 photo, bps, spp, fillorder;
uint32 width;
tsize_t stripSize;
unsigned long imageOffset, result;
int stripMax, stripCount;
char *buffer, tempbyte;
unsigned long bufferSize, count;
// Open the TIFF image

if((image = TIFFOpen("test.tiff", "r")) == NULL)
{
std::cout << "Could not open incoming image\n" << std::endl;
system("Pause");
return (42);
}

int imageWidth, imageLength, tileWidth, tileLength;
TIFFGetField(image, TIFFTAG_IMAGEWIDTH, &imageWidth);
TIFFGetField(image, TIFFTAG_IMAGELENGTH, &imageLength);
TIFFGetField(image, TIFFTAG_TILEWIDTH, &tileWidth);
TIFFGetField(image, TIFFTAG_TILELENGTH, &tileLength);

TIFFSetField(image)
std::cout << "Image Width: " << imageWidth << std::endl;
std::cout << "Image Height: " << imageLength << std::endl;
std::cout << "Tile Width : " << tileWidth << std::endl;
std::cout << "Tile Height : " << tileLength << std::endl;


// Check that it is of a type that we support
if((TIFFGetField(image, TIFFTAG_BITSPERSAMPLE, &bps) == 0) || (bps != 1))
{
fprintf(stderr, "Either undefined or unsupported number of bits per sample\n");
return(43);
}
if((TIFFGetField(image, TIFFTAG_SAMPLESPERPIXEL, &spp) == 0) || (spp != 1))
{
fprintf(stderr, "Either undefined or unsupported number of samples per pixel\n");
return(44);
}
// Read in the possibly multiple strips
stripSize = TIFFStripSize (image);
stripMax = TIFFNumberOfStrips (image);
imageOffset = 0;
bufferSize = TIFFNumberOfStrips (image) * stripSize;
if((buffer = (char *) malloc(bufferSize)) == NULL)
{
fprintf(stderr, "Could not allocate enough memory for the uncompressed image\n"); return(42);
}
for (stripCount = 0; stripCount < stripMax; stripCount++)
{
if((result = TIFFReadEncodedStrip (image, stripCount, buffer + imageOffset, stripSize)) == -1)
{
fprintf(stderr, "Read error on input strip number %d\n", stripCount);
return(45);
}
imageOffset += result;
}
std::cout << "strip count: " << stripMax << std::endl;

// Deal with photometric interpretations
if(TIFFGetField(image, TIFFTAG_PHOTOMETRIC, &photo) == 0)
{
fprintf(stderr, "Image has an undefined photometric interpretation\n");
return(46);
}
if(photo != PHOTOMETRIC_MINISWHITE)
{
// Flip bits
printf("Fixing the photometric interpretation\n");
for(count = 0; count < bufferSize; count++)
buffer[count] = ~buffer[count];
}

// Deal with fillorder
if(TIFFGetField(image, TIFFTAG_FILLORDER, &fillorder) == 0)
{
fprintf(stderr, "Image has an undefined fillorder\n");
// return(47);
}
if(fillorder != FILLORDER_MSB2LSB)
{ // We need to swap bits -- ABCDEFGH becomes HGFEDCBA
printf("Fixing the fillorder\n");
for(count = 0; count < bufferSize; count++)
{
tempbyte = 0;
if(buffer[count] & 128) tempbyte += 1;
if(buffer[count] & 64) tempbyte += 2;
if(buffer[count] & 32) tempbyte += 4;
if(buffer[count] & 16) tempbyte += 8;
if(buffer[count] & 8) tempbyte += 16;
if(buffer[count] & 4) tempbyte += 32;
if(buffer[count] & 2) tempbyte += 64;
if(buffer[count] & 1) tempbyte += 128;
buffer[count] = tempbyte;
}
}
// Do whatever it is we do with the buffer -- we dump it in hex
if(TIFFGetField(image, TIFFTAG_IMAGEWIDTH, &width) == 0)
{
fprintf(stderr, "Image does not define its width\n");
return(48);
}

std::fstream file("output.txt",std::ios_base::out);
for(int i = 0; i < bufferSize; ++ i)
{
file << buffer[i];
}
file.close();

std::cout << bufferSize << std::endl;
system("Pause");

return 0;
}






The sky just is, and goes on and on; and we play all our BW games beneath it.
Nesserev
Profile Blog Joined January 2011
Belgium2760 Posts
Last Edited: 2014-06-27 03:30:23
June 27 2014 03:28 GMT
#9874
--- Nuked ---
Amnesty
Profile Joined April 2003
United States2054 Posts
June 27 2014 03:41 GMT
#9875
On June 27 2014 12:28 Nesserev wrote:
Show nested quote +
On June 27 2014 10:48 Amnesty wrote:
+ Show Spoiler +
Is anyone familiar with libtiff using C++?

I need to read a black and white image, put the data as bools in a 2D array, flip a few bits. Then save the the array back into a tiff.
I've had no luck. After reading in the data, it still looks compressed.

Im just using a small 30x30 tiff image with a few pixels set. If you need this file lemme know and i can message you.

Any help would be so much appreciated!!!!!!

Basically, this code is the example code in the documentation. I tried looking for similar questions already answered on stackoverflow for a few hours and no luck. I've been at this almost all day.


#include <stdio.h>
#include <tiffio.h>
#include <memory>
#include <fstream>
#include <iostream>
#pragma comment(lib,"libtiff.lib")

int main(int argc, char *argv[]

{
TIFF *image;
uint16 photo, bps, spp, fillorder;
uint32 width;
tsize_t stripSize;
unsigned long imageOffset, result;
int stripMax, stripCount;
char *buffer, tempbyte;
unsigned long bufferSize, count;
// Open the TIFF image

if((image = TIFFOpen("test.tiff", "r")) == NULL)
{
std::cout << "Could not open incoming image\n" << std::endl;
system("Pause");
return (42);
}

int imageWidth, imageLength, tileWidth, tileLength;
TIFFGetField(image, TIFFTAG_IMAGEWIDTH, &imageWidth);
TIFFGetField(image, TIFFTAG_IMAGELENGTH, &imageLength);
TIFFGetField(image, TIFFTAG_TILEWIDTH, &tileWidth);
TIFFGetField(image, TIFFTAG_TILELENGTH, &tileLength);

TIFFSetField(image)
std::cout << "Image Width: " << imageWidth << std::endl;
std::cout << "Image Height: " << imageLength << std::endl;
std::cout << "Tile Width : " << tileWidth << std::endl;
std::cout << "Tile Height : " << tileLength << std::endl;


// Check that it is of a type that we support
if((TIFFGetField(image, TIFFTAG_BITSPERSAMPLE, &bps) == 0) || (bps != 1))
{
fprintf(stderr, "Either undefined or unsupported number of bits per sample\n");
return(43);
}
if((TIFFGetField(image, TIFFTAG_SAMPLESPERPIXEL, &spp) == 0) || (spp != 1))
{
fprintf(stderr, "Either undefined or unsupported number of samples per pixel\n");
return(44);
}
// Read in the possibly multiple strips
stripSize = TIFFStripSize (image);
stripMax = TIFFNumberOfStrips (image);
imageOffset = 0;
bufferSize = TIFFNumberOfStrips (image) * stripSize;
if((buffer = (char *) malloc(bufferSize)) == NULL)
{
fprintf(stderr, "Could not allocate enough memory for the uncompressed image\n"); return(42);
}
for (stripCount = 0; stripCount < stripMax; stripCount++)
{
if((result = TIFFReadEncodedStrip (image, stripCount, buffer + imageOffset, stripSize)) == -1)
{
fprintf(stderr, "Read error on input strip number %d\n", stripCount);
return(45);
}
imageOffset += result;
}
std::cout << "strip count: " << stripMax << std::endl;

// Deal with photometric interpretations
if(TIFFGetField(image, TIFFTAG_PHOTOMETRIC, &photo) == 0)
{
fprintf(stderr, "Image has an undefined photometric interpretation\n");
return(46);
}
if(photo != PHOTOMETRIC_MINISWHITE)
{
// Flip bits
printf("Fixing the photometric interpretation\n");
for(count = 0; count < bufferSize; count++)
buffer[count] = ~buffer[count];
}

// Deal with fillorder
if(TIFFGetField(image, TIFFTAG_FILLORDER, &fillorder) == 0)
{
fprintf(stderr, "Image has an undefined fillorder\n");
// return(47);
}
if(fillorder != FILLORDER_MSB2LSB)
{ // We need to swap bits -- ABCDEFGH becomes HGFEDCBA
printf("Fixing the fillorder\n");
for(count = 0; count < bufferSize; count++)
{
tempbyte = 0;
if(buffer[count] & 128) tempbyte += 1;
if(buffer[count] & 64) tempbyte += 2;
if(buffer[count] & 32) tempbyte += 4;
if(buffer[count] & 16) tempbyte += 8;
if(buffer[count] & 8) tempbyte += 16;
if(buffer[count] & 4) tempbyte += 32;
if(buffer[count] & 2) tempbyte += 64;
if(buffer[count] & 1) tempbyte += 128;
buffer[count] = tempbyte;
}
}
// Do whatever it is we do with the buffer -- we dump it in hex
if(TIFFGetField(image, TIFFTAG_IMAGEWIDTH, &width) == 0)
{
fprintf(stderr, "Image does not define its width\n");
return(48);
}

std::fstream file("output.txt",std::ios_base::out);
for(int i = 0; i < bufferSize; ++ i)
{
file << buffer[i];
}
file.close();

std::cout << bufferSize << std::endl;
system("Pause");

return 0;
}







Wait... so what's your problem? If you need help with your program, it's better to dump your own code in some thread-friendly fashion...

Btw, that code looks like someone programmed in C his whole life and then coded C++ for the first time... ugliest code that I've seen in a while...



It is ugly code taken from an example on libtiff site almost verbatim. Its a c library btw.

Part of the reason, i've had problems getting it to work correctly.
What i want to put the the tiff image into a 2D array, i can't even seem to get it to read into the 1D buffer array correctly currently using their examples.

Is anyone familar with this library?
The sky just is, and goes on and on; and we play all our BW games beneath it.
KaiserJohan
Profile Joined May 2010
Sweden1808 Posts
June 27 2014 10:14 GMT
#9876
I can recommend the FreeImage library, which libtiff amongst others are included. I use it to parse various image formats into my game engine-specific texture format.

I have a question, can someone explain why (Boost) coroutines are so supposedly amazing? I've heard people talk warmly about it, but I don't understand why. An example of a problem solved with coroutes would be awesome aswell
England will fight to the last American
Blisse
Profile Blog Joined July 2010
Canada3710 Posts
June 29 2014 06:35 GMT
#9877
What are your opinions on people saying "work to live but don't live to work" or other shit like "chase your dreams"? Other than that it's fucking stupid that people use these quotes like they know what they mean and so they sound cool and profound,

I find it stupid how many people in tech. get stuck in this hole where they think work should be everything they do, so "work work work side projects side projects side projects hack hack hack" all the fucking time and there's this equal community who never work on side projects and who keep the stupid "work to live but don't live to work" as a personal motto basically. It might be because I'm still in school but it's so annoying to hear how extreme both sides are, especially where some people keep advertising how much they're preparing work and side projects to get better jobs. And I get really upset reading stuff like this because I know people all across the spectrum and when i talk to them they really don't like having these mentalities projected onto them (i.e. expectation of doing lots of side projects if programming isn't the most important thing in their life).
There is no one like you in the universe.
Cyx.
Profile Joined November 2010
Canada806 Posts
June 29 2014 06:58 GMT
#9878
On June 29 2014 15:35 Blisse wrote:
What are your opinions on people saying "work to live but don't live to work" or other shit like "chase your dreams"? Other than that it's fucking stupid that people use these quotes like they know what they mean and so they sound cool and profound,

I find it stupid how many people in tech. get stuck in this hole where they think work should be everything they do, so "work work work side projects side projects side projects hack hack hack" all the fucking time and there's this equal community who never work on side projects and who keep the stupid "work to live but don't live to work" as a personal motto basically. It might be because I'm still in school but it's so annoying to hear how extreme both sides are, especially where some people keep advertising how much they're preparing work and side projects to get better jobs. And I get really upset reading stuff like this because I know people all across the spectrum and when i talk to them they really don't like having these mentalities projected onto them (i.e. expectation of doing lots of side projects if programming isn't the most important thing in their life).

I guess it's personal... I have problems with this sometimes too to be honest, but I'm more just not sure which side I'm going to end up on.

I mean, I'm pretty sure I would hate a job that was just *work*, you know? I can't stand the idea of a job that doesn't have some passion in it.

But I also don't want to be insane about it and I can see myself being one of the people who goes off the deep end. Especially since I want to get into video games... I'm kind of scared it's just going to chew me up and spit me out. And I'm going to think I like it the whole time until one day it's awful and I can't get out.

I dunno... it is really annoying when other people insist they know for me though ^^
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
Last Edited: 2014-06-29 07:54:00
June 29 2014 07:52 GMT
#9879
Always do what you want. But don't forget to inclue the consequences when deciding what you want.

I don't want to stay at home when I should be working because that'd get me fired and I'd lose my income. You should also apply this to dealing with people who tell you what you should do.

You may also apply this to this advice.
If you have a good reason to disagree with the above, please tell me. Thank you.
artynko
Profile Joined November 2010
Slovakia86 Posts
Last Edited: 2014-06-29 08:16:18
June 29 2014 08:14 GMT
#9880
On June 27 2014 01:56 urboss wrote:
I'm just wondering, what are the advantages of functional programming?
Can you write normal software with functional languages?
Under what circumstances would you prefer a functional language?


There is plenty of software written in a functional languages (couchDb for example). Functional programming really shines when it comes to manipulation of data (mainly collections) and making things run parallel (due to immutability). In a hybrid language like scala you usually end up making the architecture using the OO principles and then the low level algorithms are functional.

It hard to tell when would you prefer pure functional language, there are some cases where you want functional language because of a side benefit it provides, like erlang and the awesome VM it runs it, in that case you don't do erlang because erlang is functional and good for you project, you do elrnag becase the VM is incredible and writing the same stuff in C would take a lot longer. As for the hybrids I would say you always prefer a hybrid over pure OO, unfortunately you have to deal with the worse tooling, at least for the ones that I worked with. Also I may be biased since the only hybrids I worked with are scala and closure and in those cases you can always fallback to java.
Prev 1 492 493 494 495 496 1032 Next
Please log in or register to reply.
Live Events Refresh
CrankTV Team League
11:00
Crank Gathers S4: Playoffs
LiquipediaDiscussion
Escore
10:00
Season 3 Week 4
escodisco2289
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Lowko421
StarCraft: Brood War
Shuttle 1804
Hyuk 1168
Jaedong 563
Horang2 538
Mini 431
BeSt 419
firebathero 407
Light 313
Leta 288
Soulkey 226
[ Show more ]
Larva 205
actioN 185
EffOrt 176
Snow 173
Soma 168
JYJ 160
Dewaltoss 116
ggaemo 105
ZerO 85
Hyun 68
Rush 54
Mind 53
hero 48
Hm[arnc] 47
Bale 47
ToSsGirL 41
soO 36
[sc1f]eonzerg 34
sorry 33
Barracks 33
Sea.KH 31
Sharp 29
Shine 26
Free 24
Aegong 20
NaDa 19
Sexy 19
scan(afreeca) 18
Icarus 16
910 15
ajuk12(nOOB) 9
Rain 0
Dota 2
syndereN0
Counter-Strike
fl0m866
shoxiejesuss640
Other Games
gofns18700
FrodaN1499
singsing1490
B2W.Neo563
Happy284
crisheroes252
uThermal186
XaKoH 130
Liquid`LucifroN91
CosmosSc2 29
Trikslyr17
ZerO(Twitch)14
QueenE8
Organizations
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
[ Show 13 non-featured ]
StarCraft 2
• Berry_CruncH331
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• C_a_k_e 1210
• WagamamaTV392
Upcoming Events
WardiTV Summer Champion…
13m
IntoTheiNu 33
WardiTV0
Big Brain Bouts
4h 13m
Soulspirit vs goblin
TriGGeR vs Bunny
OSC
10h 13m
Korean StarCraft League
15h 13m
Afreeca Starleague
16h 13m
RSL Revival
21h 13m
Serral vs SHIN
herO vs Solar
Online Event
1d 3h
Replay Cast
1d 12h
RSL Revival
1d 21h
Clem vs ByuN
Rogue vs Lambo
OSC
2 days
[ Show More ]
WardiTV Weekly
2 days
Sparkling Tuna Cup
3 days
INu's Battles
3 days
Cure vs herO
ByuN vs Rogue
PiGosaur Cup
4 days
The PondCast
4 days
Kung Fu Cup
4 days
Patches Events
5 days
Replay Cast
5 days
CrankTV Team League
5 days
Replay Cast
6 days
CrankTV Team League
6 days
Liquipedia Results

Completed

Proleague 2026-07-22
HSC XXIX
Eternal Conflict S2 E3

Ongoing

CSL 2026 Summer (S21)
KCM Race Survival 2026 Season 3
Escore Tournament S3: W4
RSL Revival: Season 6
CranK Gathers Season 4: BW vs SC2 Team League
SCTL 2026 Spring
BLAST Bounty Summer Qual
Stake Ranked Episode 3
XSE Pro League 2026
IEM Cologne Major 2026
Stake Ranked Episode 2
CS Asia Championships 2026
Asian Champions League 2026
IEM Atlanta 2026
PGL Astana 2026

Upcoming

ASL S22 SEASON OPEN Day 2
Escore Tournament S3: W5
ASL Season 22: Qualifier #1
ASL Season 22: Qualifier #2
CSLAN 4
ASL Season 22
Blizzard Classic Cup 2026
HSC XXX
SC4ALL II: StarCraft II
Kung Fu Cup 2026 Grand Finals
Light Tournament 2026
Eternal Conflict S2 Finale
ESL Pro League Season 24
Stake Ranked Episode 4
Logitech G Connect 2026
SL StarSeries Fall 2026
FISSURE Playground #5
BLAST Open Fall 2026
Esports World Cup 2026
BLAST Bounty Summer 2026
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2026 TLnet. All Rights Reserved.