Thursday, October 18, 2012

Reading ZipEntry content from ZipInputStream

Context:

Java
MySQL
Zip

Problem:

I needed to search the content of a specific file in the Zip which was read in from the database.  I had no direct access to the Zip file except to the input stream of the Zip file.

Solution:

InputStream inStream = blob.getBinaryStream();  
// the blob contains the zip

ZipInputStream zipInStream = new ZipInputStream(inStream);

ZipEntry zipEntry = null;
while((zipEntry = zipInStream.getNextEntry()) != null) {
  String filename = zipEntry.getName();
  if(filename.matches("file_name_that_i_want_to_look_at") {
    StringWriter writer = new StringWriter();
    int i;
    while((i = zipInStream.read()) !=  -1) {
         writer.write(i);   
    } 

    String content = writer.toString();  // content of the file
  }
}

Saturday, October 13, 2012

How to remove Facebook synced contacts from iPhone running iOS 6

1. On your iPhone, go to Settings, you should see the Facebook app there.

2. In Facebook settings, turn "Contacts" off.




3. Hit the "Update all contacts"

Tuesday, October 2, 2012

Macally Folio Stand Case (Red/White) For iPhone 5 (SLIMCOVER5R)

 

 My order of this case arrived today from Macmall.  Here are some of my pros and cons:

Pros:
  • The case looks really nice.
  • The leather is shining.
  • The inside cover is soft.
  • The feel is good when holding in hand.
  • Not bulky.
  • Magnetic cover, holding the cover together when closed.
  • Feeling that phone is safe and secured in case.
Cons:
  • Unnecessary latch:  The pictures from the Macally don''t show it, but there's a little red plastic latch.  If you look at the picture above, there's that red latch in the middle.  There's one like that on the opposite side to hold the phone secured.  Why do I think it's a con?  Well, because I like to use it as a stand and having it there prevents me from doing so.  Having it there is unnecessary in my opinion (the other three you see in the picture above should be enough).  The latch makes it hard to quickly put it in stand mode.  You have to unlatch your phone first.  Maybe, it's just me, but I'm afraid that by taking phone out and putting it in may scratch that side of my phone.
  • The leather is very nice but not strong enough I think.  I was holding the case with the phone in my hand along with some boxes of hair dye (I was shopping for my mom :).  Unintentionally, I must have held it at such an angle that one of the corners of a box was poking at the case; now, I have a small cut on the case.  It was my fault.  Not sure if other kinds of leather would have had the same damage by the same force.  Since I got the white case, the cut is more visible.  Well, I guess the case did its job of protecting.  LOL
Overall:
  •  So far, I like it.  I know there's no perfect case.  I would have liked it a lot more if it were not for those two cons mentioned above.