Tuesday, September 18, 2012

For romanians

Salutare, am un card cadou(transmisibil) de la emag in urma unei achizitii, valoarea cardului este de RON 103, daca cineva este interesat/a sa achizitioneze un produs din categoriile enumerate mai jos pana in data de 23 septembrie(adica duminica asta), lasati e-mail-ul intr-un comment si va voi trimite codul, e-mail-ul nu va fi facut public.
Eu nu pot sa-l folosesc deoarece nu am nevoie de nimic din aceste categorii.
Masini de spalat rufe
Masini de spalat vase
Cuptoare cu microunde
Plite incorporabile
Aparate frigorifice incorporabile
Masini de spalat vase incorporabile
Masini de spalat rufe incorporabile
Espressoare incorporabile
Laptop/notebook
Televizoare


Primu' venit, primu' servit!

Wednesday, September 12, 2012

Facebook Timeline Cleaner

Yesterday was assigned to make a tool(dirty and fast) to delete posts on facebook, it wasn't important how it accomplished it, but how much one has to interact with it before it's job is finished.
I have permission to share this code with you, without any warranty or restrictions.
NOTE: your posts don't actually get deleted, they use it for ad-analysis and probably other stuff.

What you need:
- Chrome browser
- facebook account
- a ton of stuff you want to delete fast

Step by step instructions:
  1. log into your facebook account
  2. click on your name on the top right corner of your page
  3. scroll down to a "year" that you want to wipe
  4. look at the top of the page(just bellow the "web address field in Chrome") for a few buttons, select "activity log"
  5. in activity log select "your posts" or whatever you want to delete
  6. click F12, this should bring the "javascript console" at the bottom of your Chrome browser
  7. copy-past the following code into the console and hit Enter key:
  8. now copy-past "grab_stories()" without quotes in the console, hit Enter and enjoy
NOTE: there are still some hick-ups, but for about 90%-ish of the time, you don't have to do anything, you can use the browser to do other things in other tabs BUT the tab in which the above javascript runs.
There's no way of selecting a period in the code, it won't detect that it has "nothing else to do", however, it will click on "More Activity" to grab more "ministories".

Tuesday, May 8, 2012

SynMiniMap updated to v. 1.1

SynMiniMap has been updated, update or get it by clicking here.

The new version carries a few fixes and enhancements:
added:

  • editor scroll using MiniMap(normal|reversed)
  • ability to override tab width, by default it will grab the editor's tab width, now you can override it and set it to 4 for example, very useful if editing html and suffering from div-itism
  • a few new properties inherited from TCustomControl

fixed:
  • flickering when scrolling "too many" lines at once
  • >
  • line calculation on click, Sublime Text doesn't have the option(or at least I'm not aware) to click on a line and automatically move the caret on it, SynMiniMap passes the line and char in the event data of the OnClick event

known issues: <
  • if you've assigned the OnClick event, the "char" value passed in the event data is not always correct, needs fix, but it's not wrong by far, so, you can set the CaretX or not, but at least you can go to the correct line on click (:

There are no other notable changes, however, if you find it useful, and make fixes, enhancements, please consider sending it back so that others can benefit from it.

License:

I want to be clear on this, the license is Apache 2.0 because I think it's the most flexible one available on Google Code, however, whatever restrictions you may find in it, please don't take it into consideration, if you wish to contribute to the project then excellent, if not, there's no biggie, you can use the source as you wish, commercial, private, etc.

If you find bugs or want to request enhancements, please use the google code Issue Tab or e-mail me directly at duminicadorin at google's mail dot com (:

Enjoy!

Saturday, May 5, 2012

SynMiniMap or Sublime Text minimap ripoff

Some time ago, I've heard about Sublime Text, outstanding tool!

One of the things I like most about it, is the minimap, which is a scaled down version of the file which will help you have a bird's eye view of the file, this means that you can see somewhere between 100 and 200 lines in the minimap, while the text editor can only display about half of what the minimap can at best.

I've started thinking, wouldn't it be cool if there was something like that for SynEdit? googled-googled-googled, nada... okay, that kinda' sux... synedit is around for many years... oh well, started coding and here's the result(this is a screenshot of the included demo)

minimap demo
You can find the code at http://code.google.com/p/delphigeist-delphi-stuff It also includes a simple tabbed demo. Suggestions and bug fixes are welcomed!
The code is under apache license 2.0, whatever that means... if anyone can suggest the most "freely" license possible, I'm willing to change it.

Tuesday, May 1, 2012

Delphi-like MessageDlg in Javascript with jQuery

As you may already know, the good old MessageDlg function in Delphi is not available for web applications, so you're done to a few options: I've created my own MessageDlg function that is very close to the Delphi function, however, the dependencies are jQuery and jQuery UI
function MessageDlg( text, type, buttons, callback ) {
  /* code */
}
where
  • text: text to be displayed
  • type: dialog type, i.e. Information, Confirmation, Warning, Error
  • buttons: array of button types to be added on the dialog, ala delphi, i.e. [mbOK, mbYes, mbNo]
  • callback: function to be called when the user clicks a button, the function gets a integer parameter passed which is equal to the button type, i.e. mbOK = mrOK
Here's the code: filename.js

as you can see, the core of the function doesn't require that much code, however, I've added a few effects here and there to make it more eye pleasing and to be flexible, now the css part: filename.css

that's quite a bit of css for something so simple that could have been achieved using a table element, but hey, it works, also, it allows you to tweak things the way your heart dictates. Checkout http://code.google.com/p/delphigeist-javascript-stuff/ for code and other future stuff.

Friday, March 23, 2012

Multiple event handlers and more

If you want the sample app and skip reading, click here.
Yesterday I finished translating a C# application to Delphi, this application is part of an SDK.
While translating — even tho' my C# knowledge is limited — I couldn't help not noticing how easy it is to translate C# code to Delphi, well it shouldn't be a surprise since the chief architect behind Delphi and C# is the same person Anders Hejlsberg.
Since this was my first ever C# to Delphi translation, my initial thought was a "one-to-one" translation, however, while analyzing how the application works, I've realized that a "one-to-one" wouldn't be a good idea, normally, but in this case it was the fastest and easiest way in order to replicate original functionality and also be able to go back to the original code and see what was "missed" or "how it was done" down to the each method and variable definition.
Like with almost every programming task, you learn something new — or better ways of accomplishing something —, I've learned how C# handles events and how simple a lot of things can be defined, for example you can have multiple "event listeners or subscribers if you will" — like in Java and others — assigned, and when you call this event, all assigned handlers or subscribers will be called by forwarding the parameters.
Sadly, in Delphi we can't assign multiple event handlers by default, but that doesn't mean we can't simulate it, however it will involve more coding...
NOTE: this application was created using Delphi 2010, should work in any Delphi version that supports generics and even earlier versions if you rewrite specialized versions of TList.
While writing this demo application, I was thinking that it would be a good time to add extra magic that I think it could be useful for novice programmers, so, here's the uMagic.pas unit:

and of course Unit1.pas unit:

Well, that's about it for now, I hope you enjoy this demo!

Saturday, February 18, 2012

tDCS -- say what?

WARNING:
You should NOT experiment with tDCS WITHOUT MEDICAL SUPERVISION, experiments with tDCS were and are made on perfectly healthy people, therefore if you have any health issues whatsoever(even allergies), please consider only informing yourself about this subject and NEVER, under any circumstances, try to experiment.

Yesterday I've found out about tDCS -- no, it's not a Delphi class, but there should be one! -- while reading this article on gizmodo.com

Short Q&A:
Q: what does the name mean?
A: the longer version of the name is Transcranial Direct Current Stimulation


Q: is it dangerous?
A: let's put it this way: if you don't read enough about it(both pros and cons) and you're not ready to take the risk of going loco, then, maybe you shouldn't hook a battery to your head.


Q: applications?
A: some can be read here, here, here, here and of course google

In case you haven't checked the article on gizmodo, here's an image illustrating the idea behind it(courtasy of gizmodo.com)

The trouble with us currently, is that we don't have enough time these days to learn something new, tDCS could be a cheat that we can activate whenever we need, but we can't run around with a battery in our pocket or remember to charge it every day, because it can take some time to get used to and it can get pretty odd, so how can we cheat(yet again)?
It turns out that for quite a few years, there's a little device in our pocket or near us every day that we take special care of being charged, that's right! your mobile phone/tablet/laptop! but what do this three types of devices have in common? well, most of them have a mini usb, so with two wires hooked to your brain and plugged into your favorite device's usb port, tadam! you got yourself a tDCS on the go.

For the purpose of this article, I will choose an Android phone as a good device for experimenting, why? because it is very flexible, you can do a lot of weird stuff with it, after all, it is using a linux kernel...

The Cocktail:
- one rooted(it may be possible to play with it without rooting, not sure) Android phone
- an app that let's you fiddle with the usb
- a mini usb cable
now that you have everything you need, I assume that the app is capable of managing the amount of current the usb port will serve and that you have thought about this long enough, you can start experimenting!

Here are a couple of ideas:
- X second(s) on, X second(s) off
- X second(s) on, Y second(s) off
- take the rhythm of your favorite song, translate it into electrical impulses
- test your skills on something that puts your brain to work, first without tDCS and then with, but on different   games/tests/etc.
- test all or part of the above using an EEG(i.e. http://emotiv.com/, too expensive? then take a look at this) device
once you've started, I'm sure you can take experiments to a whole new level, next level, next level! (:

Since Free Pascal is capable of creating Android apps, maybe you should start there?

I would love to read your ideas regarding this project.

Was Ray Kurzweil right about singularity being near? I believe so, what do you think?


Sometime within the next couple of days, I'll post something that is partially related to this, but much more significant in terms of applications and lower health risk.

Blogroll(General programming and Delphi feeds)