HNHacker News
TopNewBestAskShowJobs

calloc

1,131 karma · joined September 3, 2010

submissionscomments
calloc··on The Bomb That Changed My Life
I don't know honestly, but the reason why I believe I jumped into action was because honestly I am a good and caring person and I will always attempt to help anyone that I can help.

I am unfortunately very much a push over in that regard as well, even-though I've been bitten multiple times I still continue to lend money to people that need it, I still continue to take my time out of my day to help them move, but most of the time I know that they wouldn't give me the time of day.

I just know that eventually it will pay off. I could have continued driving along without stopping, but I would have hated myself for it.

calloc··on The Bomb That Changed My Life
Jumping jacks was an example I used because it is completely out there, but most people will find it an insane request and their brain will snap out of it. Generally becoming helpful at that point.

I've always given direct orders to anyone that I saw. Either by pointing at them, or by naming something they are wearing.

calloc··on The Bomb That Changed My Life
I was taught something really cool by a police friend of mine, and that is the traffic light of awareness. There is green, orange/yellow and red.

What you are describing is living above "red". It doesn't matter where you are, what you are doing or who you are with you are constantly looking at peoples hands, faces, posture, and constantly assessing threats. Many people in law enforcement and military have the same experience as you.

The way I have heard it explained is as such:

green = this is where you feel most safe, this would be when you are home in bed, or when you are back in your old childhood room at your parents house.

orange = You are slightly alert, this can be your condition while driving, or walking on the street. You are aware of your surroundings, but you feel comfortable and at ease.

red = You are highly alert, you are scanning every single person, you are scanning all situations, you are watching for unexpected movement, you are watching facial expressions and body language, you are looking for exits, you know what locations would be safe and what locations wouldn't be safe. Some people have said they experienced a sort of tunnel vision in that you don't nothing anything but potential threats.

People that spend a long time in the red zone can have significant issues with PTSD, it can put you on edge, make it difficult to function in society. The reason why law enforcement feels like such an outsider compared to the general citizen is partly due to constantly being in the red. When they are around other police officers they can let their guard drop a little and feel less stressed.

I hope you soon start feeling like you don't have to do what you are doing. I've heard from friends that were in the military that for them it went away after a year or two of being out, but it has been difficult for them, you forever see all situations and people in a completely different light. Best of luck to you.

Note: I personally spend a lot of time in orange and red modes, part of this may be my life long martial arts training as well as having had attempted muggings. Even while at home I never leave orange, I have a hard time finding a place where I feel completely at ease/in the green.

calloc··on The Bomb That Changed My Life
Next time this happens, don't let the circle happen, start shouting orders at people. Become a manager on the spot. Tell them to do anything. Something as insane as telling them to do jumping jacks will work.

I've been in that situation before, I've been the first responder on site and while I have limited medical knowledge I knew enough to check pulses and verify that people were "okay", as soon as the second and third people showed up I started yelling orders at them. For some reason this causes them to do without asking "why" whatever you are telling them to do. Call 911, block off the road, turn on hazards, warn people coming down the roads, get a blanket, get water, I need a knife to cut the seatbelt.

Shout status updates to the person on the 911 call.

In my case a vehicle had caught on fire and I wanted to get everyone away as soon as possible. I started yelling at people to get out of the way at least a 100 ft and get down, I didn't want to risk an explosion (yes, I am aware of how unlikely it is, and it didn't happen this time) but there was a fire in the engine compartment. At that point a doctor had stopped, I was yelling at him to get away when he mentioned he was a doctor, I told him to help me get the person out of the vehicle that was on fire. Two other strong volunteers had made their way over to the other vehicle and were pulling the three people out of that vehicle (which had fared much better).

To this day I still don't remember faces, I don't remember much of what I did or how I did it, but I do remember a police officer telling me that I should consider myself a hero because I did what I should have done. He told me how the other people told him that I was yelling orders like a mad man and that I seemed to have the scene under full control. In reality I have no idea what went through my head, I have no idea how I was able to do what I did and what my thinking was like at the time. I had heard of the "By Stander" effect you mentioned before this, and I had been told what to do, but I have had no training at all.

To this day I still have slight PTSD. I have had terrible dreams about what I do remember, the person on the passenger side of the car which was on fire whose head was so smashed in from hitting the front dashboard (no seatbelt, no airbags) that it was completely missing, blood everywhere (blood is also surprisingly slippery ...) and trying to make sure everyone was safe that was showing up to "help".

calloc··on Google's Android Update Alliance Is Already Dead
Yes, I found your stuff through a Stackoverflow post you created.
calloc··on Google's Android Update Alliance Is Already Dead
The CTR mode in bouncy castle does not allow one to do partial block encryption. So if you want to encrypt 4 bytes you need to pad it to the full 16 bytes. It will always want to do a full block.

This also means that you can't do a partial offset into the CTR. You can increment the counter correctly, but you can't start encrypting from within a partial block.

Lets say you need to encrypt 17 bytes and write them to a file, which later can be opened in append mode to append more data to it using AES-128/CTR-BE mode:

  1234567890ABCDEF\0
C-style terminated string.

That is 2 blocks in CTR mode (1 full block used, 1 partial block (1 byte out of a 16 byte block)).

The next time you open the file you want to append data to it, what you would do is this:

  1. Load your previous key, and counter into AES-128/CTR
  2. Increment the counter by the full blocks already used
  3. Update the location into the current block by encrypting a random byte
  4. Provide the rest of your plaintext which will now be correctly encrypted for appending to an already encrypted segment
Now you can read your file back using the following:

  1. the AES key, counter for the start of the file
  2. Use CTR to "decrypt" the content from start to finish
So that would look something like this in Java code with JCE:

  Cipher c = Cipher.getInstance("AES/CTR/NoPadding");
  SecretKeySpec keySpec = new SecretKeySpec(aeskey, "AES");
  IvParameterSpec ivSpec = new IvParameterSpec(iv);
  c.init(Cipher.ENCRYPT_MODE, keySpec, ivSpec);
I've left out some stuff like creating the iv (really the counter), so now if we wanted to advance into the first block what we could do (and this works with JCE) is this:

  c.update(new byte[count]);
Where count contains the amount we want to offset into the next block.

On JCE this does exactly what I described above, it moves forward "count" characters into the next block and then you can do:

  CipherOutputStream cipher_out = new CipherOutputStream(output, c);
where "output" is DataOutputStream(new FileOutputStream("filename", true)) which is a file opened in append mode. Now you can write stuff to the file using the normal functions used by an OutputStream. This will then correctly append your new data to the end of the file so that if you start reading at the beginning of the file you can read through the end and get valid data. (We are using this to encrypt log files that are opened in Append only mode).

Where BouncyCastle breaks down is that you can not use c.update() to move forward into the block, thus appending is not possible because if you don't end on a block boundary your next write is going to have overlap. The only thing you can do in c.update() is provide it the amount of bytes that is the same as the block size. So you have to pad all input into c.update() to 16 bytes. Basically instead of being a stream cipher that allows seeking it has become yet another block cipher.

calloc··on Famous Last Words by Bosses I've Had
It does, only in informal speech does it not imply death. If you get electrically shocked and don't die then you were not electrocuted.
calloc··on Famous Last Words by Bosses I've Had
Whenever people ask me questions I will throw back the "I don't understand", and mean it. Sometimes their questions are inane and I really don't have an answer for it, but many other times the biggest issue is that people aren't giving me a clear view of what they want when they are asking me.

"What is it you are trying to accomplish?" is usually my second question after "I don't understand". Hopefully I can find out what exactly they are trying to accomplish and what they have now to help them.

calloc··on Google's Android Update Alliance Is Already Dead
This fragmentation is already causing issues for myself and many other developers. I work at a small startup doing gov't work and we develop Android applications that talk to massive server based backends. Yay cloud!

On 2.2 we were seeing issues with the GC not firing enough, especially after shutting down a thread and no longer requiring the data allocated therein and thus we would run out of memory (heap size being set to 24 MB), on our 2.3 devices we were not seeing that issue because 1, the heap size was set to 32 MB, but 2, because our app used much less memory, from what we could see when a thread went away the GC properly cleaned up the memory associated with it, not only that but the same functionality had a difference of almost 5 MB of heap size. The 2.3 VM was more efficient compared to the 2.2 VM.

We have also found many issues with BouncyCastle, the default Android encryption/decryption library that we couldn't reproduce with Java JCE, we filed bugs with BouncyCastle and they said they were features/that we were using it wrong/that they wouldn't fix it. We ended up writing our own CTR block mode (no, we didn't rewrite AES) to fix one of the many issues we found with BouncyCastle.

Also, the SQLite version on the 2.x line of Android OS allows certain constructs that are technically not legal in the versions it claims to be but it accepts and ignores that bad input. The developer had taken output from MySQL workbench and put it in as SQL directly into the SQLite stuff on Android no realising some of his stuff was being ignored because it wasn't valid, no errors were thrown though. As soon as we ran our APK on an Android 3.0 tablet the app would crash because the SQLite there DOES throw errors. Yes it was a simple fix, but it shouldn't have been allowed in the first place!

We also found a whole range of issues with various different keyboards that you can download from the market. Some were causing our app to crash, others would cause the text entry field to show random characters yet when reading back the text from the field in code just the user inputted stuff was there. We'd have our software designed to have a button in a certain location but with certain keyboards up the button was no longer a clickable target and you had to first exit the keyboard. Looking at our bug tracker keyboard related issues are HUGE and there are plenty. It is even worse because the same keyboard on one device may work just fine but move to another device from a different manufacturer and it may be completely broken making it hard to verify bugs do exist.

We now have almost 20 test devices that we have to manually test our software on to make sure it looks right, that nothing is overlapping, and that it works correctly. Designing for multiple different sizes of screen, and then for landscape mode on those screens is absolutely horrible. On some screens elements get so stretched in landscape it just looks terrible and on others everything is so squashed together in portrait mode that it makes it hard for the user to accurately hit a target.

Fragmentation is driving me personally insane. I wonder how much of my work related stress is from having to deal with that kind of crap.

calloc··on TextMate 2 (Public) Alpha
Sorry, but there is no true enlightenment, in any text editor.

Other than vim off course ;-)

calloc··on Motorola wins patent suit against Apple in Germany, iPhone/iPad to be banned
> Apple tried to license the patent under FRAND (fair, reasonable, and non-discriminatory) terms but Motorola was again able to convince the court that if Apple was judged to have infringed, the damages involved would total more than the FRAND rates that were suggested.

That is from the article directly ... clearly that you are saying is not the case.

calloc··on Motorola wins patent suit against Apple in Germany, iPhone/iPad to be banned
Why are patents related to a wireless standard that one is required to use to interoperate with the networks not available for licensing?

How in the world is anyone supposed to even develop a cellular modem without infringing on these patents? Isn't there some licensing body like the one for MPEG that you can go to and get a blanket license to all of the tech?

calloc··on Down the GCHQ rabbit hole (or I think there really is a part 4)
It's perl. Just run it!
calloc··on Follow up to “Android graphics true facts”, or The Reason Android is Laggy
I have iOS 4.3.x on my iPhone 3G and it stutters compared to iOS 3 at the same time. So much so that when I got my iPhone 4S I noticed how much the iPhone 3G lagged and stuttered that I no longer use it, even as a simple iPod.
calloc··on Follow up to “Android graphics true facts”, or The Reason Android is Laggy
Except that all UI stuff is done in the applications main thread ...
calloc··on Fuck passwords
I wish banks in the United States started offering two factor authentication. If I want to log into my bank (Swiss bank) I input my card number, I then get a one time code from my bank, I insert my pin card into my card reader (not connected to the computer), I type in my pin number, I then type in the code I got from my bank. What I get back is another number that I then type into the browser field.

I am now logged into my bank. Now each time I try to do anything with my money (move it from checking to savings, or from checking to my dad, or savings to checking, or to investing) I have to insert my card, enter my pin, enter the number and give my bank the number that is generated.

That is secure. WAY more secure than what I currently have with BoA, ING, WF, First bank, Chase, and Capital One.

calloc··on RIM Takes $485M Hit Over Unsold PlayBook Tablets
A lot of companies that are still using blackberries are eyeing alternatives that they want to start using once their contracts run out. Several smaller companies I have spoke to used to be entirely Blackberry shops, but have recently switched to iPhone's and Android devices.
calloc··on US judge orders hundreds of sites "de-indexed" from Google, Facebook
Because ICANN is still governed by US rules, and while it would probably cause a LOT of damage they could seize any domain they wanted since they own the root DNS servers.
calloc··on Apple iPhone spontaneously combusts aboard flight in Australia
Don't give the politicians any ammo ...
calloc··on Linux Mint signs a partnership with DuckDuckGo
The only downside to DuckDuckGo is that the results it gives for some searches of friends names are extremely stale pulling up old mailing list posts from 2006/2007 rather than showing their new content from their personal blog. There seems to be a ridiculous amount of noise mixed in with signal which makes it a no-go for me or for even suggesting it to my family.
calloc··on Code sober, get things done drunk
I have personally programmed a lot while tipsy (never drunk, I am not sure I would want to read that code in the morning) and it allows me to get over the humps of writing that utility function that needed to be written but I was putting off, it allows me to just start putting code down in vim without really worrying whether or not it is good enough...

Let me quantify good enough a little better. I am a perfectionist, I tend to write my code methodically and slowly and over-think and overanalyse every last line, I refuse to write a piece of code if I don't think it is good enough.

When I drink alcohol it takes away all of the above and lets me just write the damn code. Most of the time (there have been times that I've been closer to drunk than sober) the code works exactly as required and it passes code reviews without issues. It compiles, it works, and is the "perfect" code for the situation. Sure three months down the line it may need to be re-factored a little bit to add a new feature that was decided on by management, but in the mean time it has shipped.

Now, please don't take my example and think that you can become a better programmer by simply going out and buying a bottle of vodka. It most likely won't work. Should you give it a try? Sure, what have you got to lose? Just don't become dependant on alcohol as a way to function in everyday life. Been there done that, and it is not pleasant at all.

calloc··on Ask HN: Programming movies/music (to help get in the zone)
This is exactly the case. I need background noise and movies can be awesome in that regard.
calloc··on Who else is behind SOPA?
They sue you. And then you have a long lengthy lawsuit ahead of you!
calloc··on Tumblr's anti-censorship message generated 87,834 phone calls to representatives
No, no longer the DoD but Department of Commerce ...
calloc··on RIAA claims you do not own your iTunes music purchases
Amazon has a list of all the books in your library. It is not inconceivable that Amazon could provide a list of what books its users are currently reading/have in their library (including books they are lending) and providing such a list to the publishers/guild.

Is that proof enough? Who knows. Is it easily faked? Yes. But that is always going to be the case with anything digital. You either choose to believe them or you don't.

calloc··on RIAA claims you do not own your iTunes music purchases
So I can sell that license under the first-sale-doctrine right?

I sell my license to perform this song on a personal media player and thereby promise that I will no longer perform the song on a personal media player that I hold in my possession.

calloc··on How to forcibly eject a CD/DVD from a MacBook Air USB SuperDrive
When you coil up the power cord, make a little loop then wrap it around the poles rather than pulling tight and around the poles.

This helps with strain relief and helps the power adapter stay perfectly in shape longer. I've had my MacBook Pro for 5 years now, same power adapter, haven't had to replace it yet.

calloc··on Airport full-body X-ray scanners banned across Europe as unsafe
I fly through Schiphol all of the time and I have opted-out without any issues before.

They had me walk around it, and they patted me down US style. The person on duty with a clipboard was asking people why they opted out and I explained to them that I do not feel comfortable that the machines are safe and that cancer runs in my family and I would prefer to not have exposure to ionizing radiation.

I am from The Netherlands and being able to speak in the agents native tongue probably helped as well.

calloc··on WordPress To Jekyll And Back Again
I am about to move my personal blog over to blogofile (like Jekyll, but written in Python) which has about 500 or so entries. Will let you know how long they take to build when done...
calloc··on Two New Fed GPS Trackers Found on SUV
Not if you are on the FBI's payroll :P
← PreviousPage 5 of 19Next →