Advanced HTTP Hacking Webinar Code

You can find all the code from my HTTP webinar in my special HTTP folder.

[Project source code]

This is the script I use to demonstrate HTTP Range requests through Telnet. Just copy and paste each block of code (including the trailing blank line) into a command window and it will run telnet and make the HTTP request. You can view the test file here. Read HTTP Status Codes (including 418), Methods, Headers, and Access Control (CORS).

telnet delphi.org 80
HEAD /http/httptestfile.txt HTTP/1.1
Host: delphi.org
Connection: close
telnet delphi.org 80
GET /http/httptestfile.txt HTTP/1.1
Host: delphi.org
Connection: close
telnet delphi.org 80
GET /http/httptestfile.txt HTTP/1.1
Host: delphi.org
Range: bytes=0-77
Connection: close
telnet delphi.org 80
GET /http/httptestfile.txt HTTP/1.1
Host: delphi.org
Range: bytes=115-154
Connection: close
telnet delphi.org 80
GET /http/httptestfile.txt HTTP/1.1
Host: delphi.org
Range: bytes=78-113
Connection: close
telnet delphi.org 80
GET /http/httptestfile.txt HTTP/1.1
Host: delphi.org	
Range: bytes=115-154,127-127
Connection: close

This last one stopped working because of a change on the web server.

Here are the images. They all are available as both JPG and BMP and are 640×472 in resolution.


original.jpg

blue.jpg

green.jpg

red.jpg

purple.jpg

teal.jpg

yellow.jpg

Here is the code I used to stream all 7 images into one image. HTTPClient is a TNetHTTPClient and HTTPReq is a TNetHTTPRequest on the form. The reason it uses Bitmap images is that they are an uncompressed stream of pixel data, so are easier to recombine into one image.

const
  baseurl: string = 'http://delphi.org/http/';
  files: array[0..5] of string = ('red.bmp','green.bmp','blue.bmp',
    'yellow.bmp','purple.bmp','teal.bmp');

procedure TForm34.Button1Click(Sender: TObject);
var
  resp: IHTTPResponse;
  chunk: Integer;
  mem: TMemoryStream;
  I: Integer;
begin
  resp := HTTPReq.Head(baseurl + 'original.bmp');
  chunk := resp.ContentLength div 12;
  ProgressBar1.Max := resp.ContentLength;
  resp := HTTPReq.Get(baseurl + 'original.bmp');
  mem := TMemoryStream.Create;
  try
    mem.LoadFromStream(resp.ContentStream);
    for I := 5 to 11 do
    begin
      ProgressBar1.Tag := chunk*i;
      if I < 11 then
        httpreq.CustomHeaders['Range'] := 'bytes=' + IntToStr(chunk*i) +'-' + IntToStr(chunk*i+chunk-1)
      else
        httpreq.CustomHeaders['Range'] := 'bytes=' + IntToStr(chunk*i) +'-';
      HTTPReq.MethodString := 'GET';
      button1.Text := files[i mod 6];
      HTTPReq.URL := baseurl + files[i mod 6];
      resp := HTTPReq.Execute();
      mem.Position := chunk*i;
      TMemoryStream(resp.ContentStream).SaveToStream(mem);
    end;
    Image1.Bitmap.LoadFromStream(mem);
  finally
    mem.DisposeOf;
  end;
end;

 

 

Posted in Source Code | Leave a comment

FireDAC MemTable Editing – New in 10.2 Tokyo

One of my favorite new features (beyond Linux) is the ability to edit the data in a TFDMemTable at design time. You could already edit the field defs, to set it up. This makes the TFDMemTable, which was already super flexible and powerful, even more flexible. You can use it to capture some small data at design time and then use visual live bindings or data binding to connect it to visual controls.

Edit TFDMemTable

Holger Flick has a great blog post on the topic too. Here is a video I made with Sarina that shows it in action.

What is your favorite new feature in Tokyo?

Posted in REST, Source Code, Tools | Leave a comment

Delphi Tokyo 10.2 Wallpaper

I’ve had a few requests for my Delphi Tokyo 10.2 wallpaper that I made. I found out that while this is a picture of Mt. Fuji in the background, this photo is from the Kyoto side, not the Tokyo side. I got the photo from Pixabay, which is a great free clip art site. They have many more Tokyo, Japan and Mt Fuji themed images if you want to make your own wallpaper.

Delphi Tokyo 10.2 WallpaperI purchased the sunglasses wearing spartan penguin from a different clipart site. The tattoo and scary eyes came from our internal creative team. I forget which one, but I’ve gotten a lot of mileage out of him. You can download my Photoshop file for this wallpaper if you want to tweak it.

Here is another collection of logos I put together for the T-Shirt contest. Pixabay also has pictures of speed, power, and success. I especially like this one:

Code Monkey Need BananaWhat terms do you use to describe Delphi, C++Builder, RAD Studio and the new 10.2 release? I’d love to see your wallpapers too!

Posted in News, Tools | Tagged , , , | Leave a comment

Meet HOSOKAWA Jun, our Japan MVP

I wanted to share a little about HOSOKAWA Jun, our Japanese MVP. He blogs at qiita.com/pik and you can follow him on Twitter @pik.

HOSOKAWA Jun and Jim

When I was in Tokyo I got to meet HOSOKAWA Jun. We have a lot of great developers in Japan (and I met a lot of them at the event there), but many of them work at a company that doesn’t allow them to also be an MVP. Luckily Mr. Hosokawa works for SerialGames and they are happy to have him as an MVP.

HOSOKAWA Jun

Don’t let his boyish good looks fool you, he is a senior software developer who started programming with Delphi in University. He’s worked with artificial intelligence and currently has an interest in virtual reality and mixed reality. While I was talking with him at dinner he showed me some components and development tools he’s created to make mobile app development a whole lot easier.

He was involved in the development of the Saitobaru Archaeological Museum of Miyazaki Prefecture BeaconFence powered app too.

Here is a little interview I did with him so you can learn more about him (translated from Japanese)

What I do

I develop applications and games. I use mainly Unity for game development, however I develop tools, components and plugins with Delphi & C/C++.

Recently, I am often doing more innovative development beyond games and applications. For examples, I am developing applications for VR/MR (Virtual Reality / Mixed Reality) devices such as Oculus rift and HoloLens. Also developmenting more technically complex algorithms and libraries.

Where I work

GiGO, a Sega arcade in Akihabara

I work for SERIALGAMES Inc. located in Akihabara, which is a state-of-the-art city of techno pop culture.  We hope to convey cutting-edge excitement by having our headquarters there.  

[Akihabara is a shortening of Akibagahara (“autumn leaf field”) after Akiba, a fire controlling deity. It is nicknamed Akihabara Electric Town (Akihabara Denki Gai). It is considered by many to be an otaku cultural center and a shopping district for video games, anime, manga, and computer goods.]

My background in development

When I was a junior high school student I started programing for the first time using BASIC. I started using Turbo Pascal 5.0 in a high school computer room. It is around this time that I also started working in assembly language and C / C++. When I entered university I studied artificial intelligence and produced evolution simulation of virtual life. I remember that Delphi 1.0 was released around this time, I was absorbed in programming. Of course, my artificial intelligence and other projects were developed in Delphi. Also, like many students, I love games and playing games when not sleeping.

And now, I am at a game production company where I can use state-of-the-art technology with artificial intelligence and virtual life technology.

What sort of development I am interested in

The technology I think that is particularly interesting recently is HoloLens / Windows Mixed Reality. When you can create HoloLens applications in Delphi there will be a lot of great apps.  

What I am excited about in the future

I think mobile devices such as Android and iOS are transitional technologies.

Ten years ago, as we could not imagine the iPhone. New hardware, software, and technology will surely appear in the next decade that we can’t imagine today. And I will be very happy to develop for it with Delphi.

HOSOKAWA Jun

Posted in MVP | Leave a comment

The Sarina DuPont Self Driving Car Episode

Talking to Sarina DuPont about her role with Embarcadero and the future of RAD Studio and the evolution of technology with automation and self driving cars.

Here are a few links discussed in this episode

[SoundCloud] [Download]

Posted in Audio podCast, podcast | Leave a comment

What’s In a Name and Advocacy Defined

When I started at Embarcadero, David I. asked me what I wanted my title to be. I went with Developer Evangelist since that was David’s title, and then he added Engineer on because of my years as a Software Engineer. I traveled the world and The cool thing is I’ve gotten to contribute a few pieces of code to the best development tool on the planet since joining too, so I made good on the Engineer title.

Lead World Wide Developer Evangelist and Engineer

As a Developer Evangelist I’ve alway described my job as mostly education related. My job is to help developers be awesome by educating them on our tools and the craft of software development. I figure if I can help our developers be awesome then the rest will take care of itself.

I find I am frequently educating both ways though. Sure, I focus on creating educational content for our developers, but also I’ll be in a planning meeting and I bring feedback from all the developers back to the product management and R&D teams.

So I was thinking, Evangelism is kind of a one-way thing. Sure, it is an important part of what I do, but I want to focus more on conversations and the two-way communication. So to that end I am changing my title.

Chief Developer Advocate and Engineer

In my mind Advocacy is a better description of what I do.  I’ll continue to play the Embarcadero Drum like I always have (even before joining Embarcadero) but I’ll also focus on being an advocate for our developer community within Embarcadero. The more I can do to improve that two way communication the better it is for everyone.

Luckily I’m not alone in my advocacy role though. All of our Software Consultants and Support Engineers spend their days talking to you, our community, more than I do. They are regularly bringing your feedback to meetings and making suggestions. Our Product Management team is also out on the front lines, talking to customers and doing what they can to incorporate the needs of developers into our products.

A few other titles that were suggested:

  • Agent of Awesome Developer Technology
  • Master Chief Advocate
  • Geek Guru
  • Developer Rockstar
  • King of the Geeks
  • Top Nerd
  • Community Coordinator
  • He Who is Always Online
  • Mr. Overflowing Inbox

All of which I love, and are fairly accurate (especially the last two).

Posted in News | Leave a comment

Meet the Tokyo Engineers & MVP

I got to sit down with some of the engineers in Tokyo to talk about C++Builder, RAD Studio and Delphi. C++Builder is big in Japan. Maybe even bigger than Delphi (which is saying a lot.) It was great to put faces with the names of these great guys who I’ve only corresponded with over email or social media before.

Aiso-san, Mohri-san & Inoue-san are all software consultant engineers. Aiso-san and Inoue-san where part of the presentation #0315inTokyo with Fujii-san and I. The 4th engineer in the back of the photo below is Kenji Umeda, a support engineer that isn’t on Twitter for me to link to.

Kazutaka Aiso Haruyuki Mohri Kazuhiro INOUE
Kazutaka Aiso Haruyuki Mohri Kazuhiro Inoue
Tokyo Engineers

And here is a picture of Fujii-san and myself . . . . in the back you can see HOSOKAWA Jun, our MVP in Japan.

Fujii-san

Here is a couple better pictures . . .

HOSOKAWA Jun and Me

Including one from when we went to dinner . . . with Fujii-san and Aiso-san.

HOSOKAWA Jun

Here are a few more pictures of our fantastic dinner too, if you are into that sort of thing . . .

Dinner in Tokyo Dinner in Tokyo  Dinner in Tokyo
Dinner in Tokyo Dinner in Tokyo

Posted in MVP, News | Leave a comment

Making the Huge World of Delphi Small Again

The world of Delphi is HUGE. It love seeing all the different types of apps being built and seeing users all over the world. This week I was in Tokyo for their #0315inTokyo event announcing 10.2 Tokyo coming soon. In a surprising turn of events Eric Bonilha of Digifort from Brazil was in Tokyo on vacation too.

He stopped by the Tokyo office of Embarcadero for a quick visit. He showed off the latest version of his Digifort Mobile client and the engineers here showed him some of the things they are working on with BeaconFence for a local museum. A lot of fun.

Eric and I in Tokyo

We are all excited for the upcoming 10.2 Tokyo release adding support for Linux!

It is happenstance meetings like this that show how global Delphi and Embarcadero really are.

Go Delphi!

Posted in News | Leave a comment

Join us for Live Coding!

Last week Craig Chapman and myself launched our first LiveCoding event. It was a lot of fun, and we are doing another event tomorrow, March 2nd at 11 AM US Central Time (find the time in your zone.) We will be on Craig’s Channel this week.

Last week on my channel I worked on building a REST client. If you are familiar with Delphi, it makes REST clients really, really easy, but I tried to make it a little more complicated to dive into some of the in’s and out’s of building REST clients.

Craig has a big project he is starting work on to build an API Header Auto Generator for Delphi. This will include both client and server side development. He is looking at the fantastic UniGUI web framework to power the web, so this will be a lot of fun.

I am looking forward to see other Delphi Developers on LiveEdu.tv!

LiveCode Coding with Craig and Jim

 

Posted in LiveCoding | Leave a comment

Nick Hodges New Book: Dependency Injection In Delphi

If you’ve been following along, this is Nick’s 3rd book in recent years, following on the heals of Coding in Delphi and More Coding in Delphi. This time around he has teamed up with Embarcadero MVP Stefan Glienke to cover the topic of Dependency Injection in depth and complete detail.

This book covers Dependency Injection from A to Z. In it you’ll learn about Constructor Injection, Property Injection, and Method Injection. You’ll learn about the right and wrong way to use the Dependency Injection Container.

Nick Hodges Dependency Injection In DelphiHere is the Chapter List:

  • What is Dependency Injection
  • Benefits of Dependency Injection
  • Constructor Injection
  • Property Injection
  • Method Injection
  • Using the Container
  • A Simple Migration Example
  • Advanced Uses of the Container
  • Dependency Injection Anti-patterns
  • A Full, Useful Example
  • Final Thoughts

Run out and buy your copy now!

Nick Hodges Stefan Glienke Coding In Delphi More Coding In Delphi

Posted in News | Leave a comment