Wednesday, March 12, 2014

FullStack vs ???? single stack ??

 

It has come to my attention that some developers only deal with one aspect of development. They do it well, but they don’t really even understand the rest. Some come from developing apps like MOS and customizations and addins/templates built over Frameworks and Existing systems.

I rememnber being asked “can you develop from scratch” and didn’t know there was another way. turns out, a lot of developers only know how to use systems, but not configure them, such as database from scratch, wcf, hibernate/entity mapping from scratch etc.. they know how to live in someone elses kingdom but do not reallt know how to build that kingdom themselves.

I believe in understanding the entire process, I really dislike the Frontend of UI, but I understand it. I am a server man myself.

HOWEVER

I think this new “fullstack developer” vs “????? single stack ? developer”  is problematic. I think requiring REAL developers to add “fullstack” to their name rather than deciding that “single stack” developers be singled out creates an imbalance.

Only my opinion ofcourse.

Group or ungroup shapes, pictures, or other objects in Word 2010

 

I have been using word 2010, didn’t check if this is true to other versions, but could not select multiple objects.

I usually go with stackoverflow with these questions, but couldn’t find such.

Found one on msdn, but the answer had ZERO points, yet it was the only one that worked.

original question taken from : http://social.msdn.microsoft.com/Forums/office/en-US/796feaad-0d94-4da6-bd72-e23942cbfc47/cant-select-multiple-objects-in-word-2010?forum=worddev

“I'm using Office 2010 Professional Plus 64-bit.  I can't select multiple objects in Word 2010 either by shift-clicking, control-clicking, rubber-banding or using control-a in either the main work area or in the selection pane.  There's no way to group objects or to make simultaneous canges to multiple objects.

Is this a bug or did Microsoft Office developers decide that people won't want to handle more than one object at a time in the future? Maybe that we are de-evolving back to monkeys or something? …“

 

and the solution I found by Wamer_ca who answered on  Wednesday, February 01, 2012 3:49 PM

to whom I could not award points as they closed the question, and awarded no one.

 

“ I have had this same problem off and on since moving to Office 2010 and I think I've found a solution.

I would take a screen shot and then want to add arrows or shapes to highlight specific areas. I wanted to group the shapes and screen shot together so that they would be perfectly aligned as the document evolved.

The problem was that I could not select all of the objects at the same time. The most frustrating part was that sometimes this would work and sometimes it would not. I was not sure what the reason was.

Well, I got it to work!

The default text wrapping style is “In Line with Text” when you paste the screen shot. Changing this to be “In front of Text” or “In Line with Text” allowed all of the objects (screen shot and shapes) to be selected and grouped together.

You can find the text wrapping feature by right clicking on the object and selecting “Format Object”. It is under the “Layout” menu.

I think the problem is when there is a difference between the text wrapping options for the different objects this prevents them from being selected together. Changing this is what fixed the problem for me. “

 

So to you Wamer_ca I say thankyou and Kudos. You helped me out.

Monday, March 10, 2014

ChromeCast your life








I just bought a chromecast and woah is it cool. I decided to write a tutorial/review of my experiences so far(3 hours)

CASTING Youtube video from my desktop to my device

image

Simple, when you install the chomecast it adds an icon
allowing you to send chrome tabs and youtube videos to the device.

Casting movies

Video Stream google chrome app

This has been at great debate on the internet forums, I found VideoStream for Chromecast it allows you to select a video file on your desktop and send it to the device incl mkv, avi, mpg, mp4 files. pretty cool. Does NOT support: subtitiles, video memory of where you are. When you’re playing the video, a new tab opens up allowing you to control the video Pause/Play and using a time slider on the video to seek in almost realtime (you need to press pause).

Cast entire screen (experimantal)

Another GREAT option is to view using : New CAST ENTIRE Screen (experimentimageal) : allows you to well, mmm cast your entire screen it’s experimental although I found no problems with it.

I used BSPLAYER (IMHO the best video player out there) to view a movie incl. sound:

imageAs you can see subtitles and video not a problem, you need to mute the laptop of course but that’s almost the only drawback and makes sense. the playback is great, even at 720p extreme I got great performance on my I7 HP ENVY laptop, but you can always switch to 720p or even 420 if you WIFI/Laptop/GPU is not up for the task.

 

 

 

View Videos from Samsung S3 device

I downloaded the app, and used Viral HD which I found only today, which is SOOOO COOOL. It allows background playback, and shows all the latest viral videos and on and on and on … and of course it includes CHROME CASTING. so I watched the very funny marauder top gear video (watch it its crazy funny) on my TV.

Chromecast in the boardroom

As I am a well seasoned presenter,  I think chromecast is ideal for video projectors/ lcd TVs. I am sure someone will make a real powerpoint chromecast addin (maybe even me) but for now, using the “CASTING ENTIRE SCREEN” function I mentioned earlier, you can show presentations on your tv.  The constant GoogleCast is sharing your screen can be moved using the Anchor  so that’s not such a hassle.
I believe the biggest challenge will be around security. To use chomrecast one needs to be connected to your WIFI. although companies today offer “guest-wifi” enabling users to login to demilitarized (DMZ) servers and the internet, to which the boardroom can utilize to connect the chromecast to its guest-wifi.

The future of casting …

I believe we are seeing the first glimpses of streaming to other devices. the NFC allows streaming from one phone to another, the User experience is still new and requires tweaking to make it friendly and fun for the average user to use and cast , but it exists. The biggest problem I think will be privacy and security. the chromecast is a new generation of INNEXPENSIVE devices able to stream to any TV/Projector with an HDMI port. The time will come and we will start more and better apps and abilities for the different casting vendors.
As I said before, I believe the future is security related casting apps
Currently in its infancy, chromecast connects to your wifi, however, more and more will we see parties and get-togethers' where you might not know all your guests, so apps allowing secure tranfers without allowing strangers on your wifi, ability to create party queues and playlists for chromecast are around the corner.
One such app I saw today is the very badly named VBUKIT Chromecast app that allows casting to your device without giving your WIFI password to anyone. (check it out its pretty cool and the first of many security related chromecasting apps out there I believe). It works by running a server app on the computer connected to the chromecast and allowing anyone to scan a device code and upload their data to the “server” app running the queue on the device.

Monday, February 17, 2014

Java Noun Land

 

I was reading Steve Yegge’s post about Java Noun land. I was unable to comment in his post, I guess it’s too old, I’m too old or whatever.

I understand what he was talking about, I think the point was missed.

When taking out the garbage, their could be two approaches.

The User could have a function called User.TakeOut(garbage gc)

The Garbage could know how to remove itself Garbage.TakeOutBy(User u)

Or their could be an abstract function called Util.TakeOut (Doer do, Doee on)

This could then be utilized by any item wanting to be taken out, you could build a Utils library of verbs. Java core developers were afraid this would be too hard to maintain on large projects with novice programmers I think. So what they did was come up with Generics. Generics allows one to Write User.TakeOut<T>(T toremove) but the verb still belongs to User.

I see the point. We all do:

We all have Common modules, that include utility functions, very hard to attach to verbs. Stringutils class with static methods that are “kind” built for strings.

but a string is an array , so maybe Find<T[]>(T what) is more fitting to be put in ArrayUtils?

This is a conceptual decision and I have had to face them all my development life.(but since I have been programming since age of 13,14 I guess one can say my entire life)

C# has been using Delegates and Lambda, anonymous function etc. for a few versions now and I think for the optimal methodology it is the les rigid (Java guys don’t kill me here) of the languages.

 

I am currently researching NodeJS and IMHO C# could implement a working NodeJS architecture in its sleep with one hand tied behind its back. But would it be as efficient?

I don’t know….

What I like about C# is not the language somuch as the frameworks and stuff that I can just “use”. I hope the require modules willl be just as good in NodeJS.

Continuing with my research now. good day

Saturday, February 08, 2014

Visual Studio 2013 ultimate - comes without NUGET installed???

 

I am not one to whine.

I am trying to use the new ASP.NET identity framework.

Using http://www.asp.net/visual-studio/overview/2013/creating-web-projects-in-visual-studio#facebook I follow the tutorial (which is very well written as I looked it over).

So I try the template as instructed and YEE HAA :

image

Exception 0x80070002 Oh crap. a quick google search comes up with NADA helpful

 

Welp, I look at the different options and all I see is prerequisites:

http://www.nuget.org/packages/Microsoft.AspNet.Identity.EntityFramework/

and others

NUGET NUGET NUGET

A quick check and sure enough, Nuget is not installed????

are you kidding me ? VS 2013 Ultimate comes without nuget installed??? this also happened in vs 2012. Microsoft still hasn’t set this up. They have options to install Blend and Lightswitch (whatever that is) but they don’t have the foresight to install a key framework 80% of Visual studio is based on ? Are you $^&$ kidding me ?

So install

image

Downloaded, restarted the vs 2013, and sure enough

Now it’s working.

Nice going Microsoft … just after I said you rule for adding Facebook, Google and Twitter oAuth logins built in, you have to make me upset.

Tuesday, July 23, 2013

Tuesday, March 05, 2013

Comparing columns in excel

I have been teaching advanced excel for many years but have never released this tidbit
lets say you have to columns with almost the same data except for a few places how to compare .
immediate response: next column ==> =IF(A2=A3,"","NO")
but what if you want several columns to represent different test results?
image

Advanced conditional formatting to the rescue

The biggest issue students have with conditional formatting is its inquiry of the cell it is located on, so you cannot color a cell according to another's value.
INDIRECT to the rescue, INDIRECT is a function that allows you to write the address of the cell you wish to query and it will deliver the cells value.
So using concatenation and a few other text tricks:
CODE("A") will give me 65 which is the ascii number of A
CHAR(65) will return the char representation of the number 65 which is A
So CHAR(CODE("A")-1+2) will return B
COLUMN() returns the number of the column
ROW() returns the row number
If I am on row 3 column D (4)
Then CHAR(CODE("A")-1+COLUMN()-1)&amp;ROW() will return 'D3'
INDIRECT('D3') will return the value of D3
So the following statement
=INDIRECT(CHAR(CODE("A")-1+COLUMN()-1)&amp;ROW()) <> INDIRECT(CHAR(CODE("A")-1+COLUMN())&amp;ROW())
Is actually    C3 <> D3
which means return TRUE when the statement is FALSE since the conditional format requires a true/false response, the statement returns True when the format needs to change.

Monday, July 02, 2012

WCF KnownTypes and ServiceKnownTypes

 

When using a compiler one gets used to polymorphism.

How would you describe polymorphism? Polymorphism for data objects is little more than rearranging and adding data to a form.

I'd say someone invites it over to a party, you have the PartInfo class

public class PartyInfo
{
public string Address { get; set; }
public string Phone { get; set; }
}


Sara, your friend calls you up and informs you about three other parties, however these parties have other information, one has Theme information, another has data about the DJ, and a third includes ages of the people there.

public class PartyDJData : PartyInfo
{
public string DJ { get; set; }
public string PreviousPerformances { get; set; }
public string MusicTypesPlayed { get; set; }
}

public class PartyTheme : PartyInfo
{
public string Theme { get; set; }
public bool IsDressup { get; set; }
public bool IsDiscountForDressup { get; set; }
}

public class PartyAges: PartyInfo
{
int[] Ages { get; set; }
}
You're a very diligent person, and want to write this down.  Say you get a pad and paper, and start writing.
Party1:
Address : Yavne 24
Phone: 5555-FFF
 
Party2:
DJ : Joe Schmoe / Previous : saras bash, MusicTypes = House/ClubTrance.
Address: 123 kressent, drv
Phone: XXX-YYY
 
Party3:
Theme: Angels and demons, IsDressup = yeah, IsDiscountForDressup = yeah
Address = 154 vos str
phone: FFF-YYY
 
Party 4: 
Address : Hilton Hotel on the beach
Ages { 25-35}
Phone : GGG-XXX
 
 
now when you talk to your friend Adam, you tell him
You: “Hey Adam, and got the skinny on the good parties, get a pen!”
Adam: Ok, shoot!
Party1: {Address : Yavne 24, Phone: 5555-FFF}
Adam: ok cool
Party2: {Address: 123 kressent, drv, Phone: XXX-YYY}, oh and the dj is DJ “Joe Schmoe” who has Previously done saras bash he plays House/ClubTrance.
Adam: wait. Whos the DJ at the first party ? 
You: I don’t know
Adam: ok, next?
You: It’s a theme party! Theme: Angels and demons, it’s Dressup not required but you get DiscountForDressup!
Address = 154 vos str, phone: FFF-YYY
Adam: Whos the DJ ?
You: Dunno!
Adam: Is the party on kressent themed too ?
You: goo question, I think not.
Adam: Ok, lets continue with the list, then we can divide forces and fill out the rest of the info.
You: It’s ok theres only one more party, my sister told me about it.
its at Hilton on the beach man! oh and it caters to 25-35 so you will finally find someone to teach you some manners!
Adam:Yeah Whatever, so who’s the DJ ?
You: I dunno.
Adam: DUDE!!!!!!

Play-by-play serialization

so what happened here?
You had all kinds of different party the info data which you listed under the party info DTO.  They all derived from PartyInfo, but are not exactly the same and each have different attributes which Adam is not expecting.

When Adams started talking to you on the phone he could've asked you what kind of data are you gonna give me because than a I need to set up my pad correctly.  To which you might answer a different answer for every week.  Sometimes you had DJ information sometimes you have Theme information. !!  Sometimes you had both !!

Sometimes you had none.

But you're not willing to commit.  Not willing to tell him all the options.  So he has no way of knowing.

Adam expected you to give him the same information and details for every party.  He actually created the party info class and was trying to fill it up, but every time you added more details, and you didn't tell him in advance what kind of options to expect, so all this back and forth was in trying to figure out what to do with the new information and where to stick it in his pad!

What basically happened was he was distraught.
 


The KnownType Attribute


By relaying some information at the very beginning we could have helped Adam make sense of information.


If they would have written

[KnownType(typeof(PartyDJData))]
[KnownType(typeof(PartyTheme))]
[KnownType(typeof(PartyAges))]
public class PartyDataForTonight
{
public IEnumerable< PartyInfo > parties { get; set; }
}


Adam could have tried to figure out the data on his own.


So why can’t you just use Polymophism ?


Well Polymorphism makes more sense when you have a the TYPE of the instance at hand.


sometimes this is not the case.


The Deserializer (Adam) will go over the data and try to understand which PartyInfo you were referring to. For some reason they did not try the “try polymiphism first and if stuck shout” the moved directly to the “shout” part.


if you send a bunch of PartyInfo objects down the wire they will fail in deserialization. what you need to do is add the KnownType to them. his will help with understanding how to deal with them and what to deserialize given the chance.


this will prove to be performance degrading as for every “PossibleType” the deserializer will have to stop, ponder what class to deserialize this too and only then deserialize.


If


next time I’ll talk about ServiceKnown Type.

Tuesday, June 26, 2012

DBS Stuff

 

Files

Located under Files

image

clip_image001

Data: Initial at least 3 GB | Autogrowth, at least 100MB each iteration. Better to use in Megabytes rather than in Percent

Log: Initial size 7GB |Autogrowth at least 100MB each iteration.

FILE GROUPS

Different files, preferably on different machines

Allows tables, and in general SQL objects, to be created in different files

CREATE TABLE [dbo].[Status](
    [StatusId] [smallint] IDENTITY(1,1) NOT NULL,
    [Type] [nchar](50) NOT NULL,
CONSTRAINT [PK_Status] PRIMARY KEY CLUSTERED
(
    [StatusId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

 

Brown is the index Filegroup

Purple is the Table FileGroup

Primary is the default file group when none are created

 

LOG

Use a sequential writing hard disk - such as Raid 0 or Raid 1.

Full – saves everything, incl all bulk inserts (values), is reduced only when db is backed up| used for differential backups.

Bulk – saves almost everything, not including bulk inserts i.e. It only saves the size of the bulk insert without the data itself.

Simple – a cyclical log file that only saves data not yet committed as well as last check points.

DATA

User random access writing hard disk – such as Raid 5

Hebrew

Use collation "HEBREW_CI_AS"

Collation however only works for varchar

In general than adding data in Unicode don't forget to use N'מידע חשוב'! The N stands for Unicode.

SQL DDL

Decimal (Scale, Precision)

Scale – number of digits

Precision – number of digits (of scale) which are decimal.

SQL prefers INT over other types in general.

 

Nchar / Varchar

Nchar – char that is Unicode (not dynamic)

varchar - Variable (dynamic) sized data strings. (Penalty of size of string – 2bytes)

Nvarchar – Dynamic Unicode string (incl the penalty)

Unicode – takes up 2 chars for every char (2X the space)

Misc

Add Indexes to most ForeignKey constraints

DataBase projects

CLR allows to add Dot.NET CLR dlls that can plugin and create new "Functions", that run using Dot.Net engine per row (like any sql function).

To create ->

Visual Studio è New Projectè DataBase è SqlServerè CLR Database project

Service Broker

Like a crippled msmq.

Includes an Event driven DeQueue that can trigger a stored procedure

You can configure Max currents

Is Transactionable {with rollback support }

Tuesday, June 05, 2012

Publish and deploy

For those still looking, I had to make sure to:

  • Specify port 8172, use the default service name (msdeploy.axd), use https and check the box to allow untrusted certificates in the publish service url from Visual Studio:https://serveraddress:8172/msdeploy.axd

Also, I found this IIS article to be extremely helpful for setting up the service.

Pasted from <http://stackoverflow.com/questions/5490478/vs-2010-publish-using-web-deploy>

http://www.microsoftpdc.com/2009/FT56?type=wmvhigh

http://learn.iis.net/page.aspx/516/configure-the-web-deployment-handler/

When faced with :

Web deployment task failed.(Could not complete the request to remote agent URL 'https://dev1:8172/msdeploy.axd?site=Default web site'.)

Could not complete the request to remote agent URL 'https://dev1:8172/msdeploy.axd?site=Default web site'.

The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.The remote certificate is invalid according to the validation procedure.

clip_image001

The Service URL without the http:// defaults to https://

BUT, because Https means Secure, we need a certificate.

However the IIS is not configured with a certificate, so it fails

You need to check the
"Allow untrusted certificate" checkbox

Sunday, April 08, 2012

Web Deployment on IIS7

 

Transforms Web.Config.Release

http://vishaljoshi.blogspot.com/2009/02/web-deployment-with-vs-2010-and-iis.html

 

Install IIS7 Deployment

download Web Platform Installer for IIS7, only way I managed was to install chrome, and then download it.

image YAY microsoft, lock me out and make me install an UNSAFE browser just to do basic admin IT work.

http://technet.microsoft.com/en-us/library/dd569059.aspx

image

image

select custom

image

http://learn.iis.net/page.aspx/1022/how-to-configure-a-site-for-publishing-with-web-deploy/

Web Deploy 2.0 includes a new UI in IIS Manager to configure an IIS site for Web Deploy publishing. This UI serves two purposes:

  1. Sets up file system permissions to enable the Web Deploy publishing service to publish to the site
  2. Generates a publish settings file which can be used in tools like WebMatrix or Visual Studio 2010 to publish to the site without having to enter publishing settings manually

Let's say that we want to grant a local Windows user "JohnDoe" publishing access to the IIS site, contoso.com:

  1. Start IIS Manager by clicking Start > Run and typing "inetmgr.exe"
  2. Connect to the server you want to manage.
  3. Expand the Sites node and right click "contoso.com"
  4. Click Deploy > Configure for Web Deploy Publishing...
  5. The following UI will show - you can simply click "Setup" and the currently logged-in user will be granted Web Deploy publishing permissions.

 

Now try to publish from VS STUDIO 2010

If you get this error Could not load file or assembly bla bla bla one of its dependencies. An attempt was made to load a program with an incorrect format it might be a 32bit/64bit issue

Go to IIS -> Application Pool -> Advance Settings -> Enable 32-bit Assemblies

http://stackoverflow.com/questions/41449/i-get-a-an-attempt-was-made-to-load-a-program-with-an-incorrect-format-error-o

image

 

And now FINALLY

I works

Tuesday, April 03, 2012

Log4Net Configuration trouble

Recently i had some log4net configuration trouble

log4net has a feature in its configuration file where it tries to read Configuration name tags from the config file and locates them as writable properties on the class (Logger/Appender etc..) using reflection.

the function used is

protected void log4net.Repository.Hierarchy.XmlHierarchyConfigurator.SetParameter(XmlElementelement,objecttarget)
this function locates the property for you and updates its data if it finds it if not it fills your screen and logs with garbage until its fixed!
It will even locate the property if you write it in the wrong case.
However, it does not help you in locating your error. I do not expect log4net developers to write a “google-style” {did you mean xxx} function. But I think they could have a better log response
instead of a bland
LogLog.Error(declaringType, "XmlHierarchyConfigurator: Cannot find Property [" + name + "] to set object on [" + target.ToString() + "]");


It would be nicer (I think) to write something like

LogLog.Error(declaringType,
string.Format(
"{2}Reflection did not find Writeable Property/Field named [{0}]. Check ObjectBrowser for class {1} and see what writable attributes/fields exist. maybe misspelled? You XML Error is located in {3}"
, name, target.ToString(), "XmlHierarchyConfigurator", element.ParentNode.InnerXml)
);

which would give something like

XmlHierarchyConfiguratorReflection did not find Writeable Property/Field named [hello]. Check ObjectBrowser for object log4net.Repository.Hierarchy.DefaultLoggerFactory+LoggerImpl and see what writable attributes/fields exist. maybe misspelled? You XML Error is located in <level value=\"Info\" /><hello value=\"4\" /><appender-ref ref=\"LogFileAppender\" /><appender-ref ref=\"RSLogFileAppenderInfo\" /><appender-ref ref=\"RSLogFileAppenderFatal\" />"


for the error of adding the field “hello” to the XML.


This is at the very least a more helpful comment.


At least now I know what to look for. any attribute in log4nt configuration must have a real writeable field/property in the log4net object hierarchy.


good to know.


 


Mickey Perlstein

Preview Pane : Windows 7

 

forgot all about this one

taken from http://www.winvistaclub.com/t81.html

But, if you have a custom file type; and wish to register a plain text or a multimedia preview handler, for this custom file type, you can do so using this utility.

Winhelponline’s PreviewConfig Utility allows you add or remove preview handler for a file type. Its a very useful and a easy-to-use utility. Worth a check-out. Do read its ReadMe file first.

Friday, March 02, 2012

Console write Color Encoder

 

Sometimes I use a console logger, for simple apps.and it’s more important to see the data than the text for a programmer.

I have written a simple Console encoding app that spits color encoded console lines to the console.

I may some day write a log4net logger that does this, but for now:

public static string EncodeConsole(string message
, params object[] args)
{



string content = message;
string pattern = @"{(.*?)}";
MatchCollection mc = Regex.Matches(content, pattern
,RegexOptions.Compiled); //compiled is faster

#region make better Exception that string.format
if (mc.Count > args.Length)
{
string format1 = "you supplied {0} params, but require {1} in the template";
///erro message
string err = string.Format(format1, args.Length, mc.Count);
throw new FormatException( err );
}
#endregion

string encoded = message;
foreach (Match item in mc)
encoded = encoded.Replace(item.Value, ",#,").Replace(",,", ",");

var arr = encoded.Split(',');
string out_ = "";
int matchnum = 0;

for (int i = 0; i < arr.Length; i++)
{
if (arr[i][0] == '#')
{
Console.ForegroundColor = ConsoleColor.White;
Console.BackgroundColor = ConsoleColor.Blue;
var oldmatch = mc[matchnum].Value;
var g = oldmatch.Split(':');

//will always be 0 for data
string match = "{0}";
if (g.Length > 1)
match = "{0:" + g[1];

var data = string.Format(match, args[matchnum]);
arr[i] = data;
matchnum++;
}
else
Console.ResetColor();


Console.Write(arr[i]);
out_ += arr[i];

}
Console.WriteLine("");

return out_;
}



Tuesday, February 14, 2012

Visual Studio TFS very slow

It so happens that in Visual studio, the connection to a TFS server is through a possible proxy server. (A default one)

 

If you VS is slow to take TFS,

go to the

Visual Studio 10.0/Common7/IDE/devenv.exe.config file

go to the bottom

locate <system.net>

and add

    <system.net>
    <defaultProxy enabled="false" />
        <settings>
            <ipv6 enabled="true"/>
        </settings>
    </system.net>
    <appSettings>
        <add key="TestProjectRetargetTo35Allowed" value="true" />
    </appSettings>
</configuration>

this will stop it from looking for your TFS server on the internet

Thursday, December 15, 2011

A Reflective Question

I was recently asked a Question in an interview about Creating a function that can read reflection of certain aspects off a class instance. (some version of debugger … I guess)

anyway, here’s my solution (using recursion of course)

private static string Reflective(string instanceName, Type type, object obj, int depth)
{
StringBuilder sb = new StringBuilder();

string format = "* <{0}> {1}";
for (int i = 0; i <= depth; i++)
format = ("\t") + format;

sb.AppendFormat("\n" + format,
type.Name, instanceName);

if (obj == null)
return sb.ToString()
+ "-> {Null}";

FieldInfo[] fields = type.GetFields();
foreach (FieldInfo fld in fields)
{
format = "<{2}> {0}={1}";
for (int i = 0; i <= depth; i++)
format = ("\t") + format;
if (fld.FieldType.IsPrimitive)
{
string val = (obj==null)? "NULL" : fld.GetValue(obj)+"";
sb.AppendFormat("\n\t" + format,
fld.Name, val, fld.FieldType.Name);
}
else
{
sb.Append(
Reflective(fld.Name, fld.FieldType,
fld.GetValue(obj),
depth+1));
}
}
return sb.ToString();
}
}



How to use



var computer = new Computer
{
CPUs = 4,
Display = null,
AnotherDisp = new Monitor {
Height = 768, Width = 1024, Zoom = 2
}

};


string s = Reflective("computer", computer.GetType(), computer, 0 );
Console.WriteLine(s);



Will print out



* <Computer> computer

        * <Monitor> Display-> {Null}


        <Int32> CPUs=4


        * <Monitor> AnotherDisp


                <Int32> Width=1024


                <Int32> Height=768


                <Int32> Zoom=2


Thursday, December 08, 2011

Android Source Files

 

for some reason, the open-source project Google setup for android with all the Git’s and Repos and stuff is very well mainained but requires a degree in particle physics to understand.

This is especially true, if you’re just trying to look under the hood of android and not interested in joining the project per-say or  uploading stuff of your own to a Git repository.

I come from Windows and am unused to becoming an IT specialist to install and use development software.

looking around different blogs and sites I finally found a likeminded individual interested in spreading the joy of SIMPLE and EASY rather than COMPLEX and REQUIRES HOURS OF UNDERSTANDING to do android things.

I want to develop for android, not be part of a complex Operating System’s development team (at least not for now).

I found a blogger who has likeminded views on the subject.

http://mobilebytes.wordpress.com/2010/06/30/classes-source-for-eclipse/

He has downloaded, stripped, mapped, vm’s and refitted the sources for android classes ready for Eclipse.

I uploaded them to megaupoad as well to lower this bloggers bandwidth problems (in case he pays for them)

and here they are:

Android version source megaupload URL I uploaded it to
1.5 r3 http://www.megaupload.com/?d=OL71VL2F
1.6 r2 http://www.megaupload.com/?d=B5F0R1AV
2.01 r1 http://www.megaupload.com/?d=MIJOHYYI
2.1 r1 http://www.megaupload.com/?d=93048HL0
2.2 froyo http://www.megaupload.com/?d=UJRSNLHN

 

In case you don’t know how to wire this up:

Step 1

Download the source codes into a directory such as c:\android\android-sdk-source\

SNAGHTML498a857

Step 2

1) open eclipse, open a project you wish to view the source of:

 

Right click on android.jar – select image

2) Select properties (last one on the context menu) or press Alt-Enter

3) In the window that comes up, under Java source Attachment select External file, then find the source file you downloaded in my case C:/Android/android-sdk-sources/android-sdk-1.6_r2-src.jar

image

4) click Open on the Windows Folder

5) and OK on the eclipse, and you should be all sourced up.

usage:

Click F3 on an android class such as BroadcastReceiver.class and you will see the source code.

image

Word of warning to the Debuggers out there.

YOUR USE OF ANDROID SOURCES and Versionage does not mean the EMULATOR is using the same version - if your app is for android 1.6 (as most should be) and your emulator is 2.2, the source you should attach is 2.2 as the emulator works under 2.2 and not 1.6

make sense?

Good luck

Mickey Perlstein

Sunday, November 27, 2011

Mobility conference

Today I went to the mobility conference. Here are a few things that I learned:

When developing a mobile app you need to ask yourself a couple of questions:

Stickiness over time - will the user be installing it and forgeting all about it or will she be using it always.

  • stickiness will be created also by using Facebook and twitter and other such posts in social media.
  • viral is very important - word of mouth is much better than buying your users (i.e. Advertising)
      • create value to the user
      • make it social
      • make it enjoyable
      • make it very viral
  • very little apps offered to VCs are life-changing ones
  • lowering the customer acquisition costs - interesting someone else to use it - if the only way I can use it is if you use it -  it helps you use it - and helps me gain new customers.

Respond to every support call

Challenges facing the mobile market:

  • Security on mobile is challenging
  • Discoverability is very hard
  • Revenue streams are shocking
  • new challenges - the mobile market place brings in bouncers - a new phase of rejects from the marketplace/apple/google etc.  adds and other layer of challenges
  • Problems with revenue streams especially when direct to consumer
  • Ad revenue alone is a bad model
  • Different mobile users are of different user types and should be considered accordingly

What is the user experience, what the apps does the user usually use. Do your best to create a single application connected to all the application's the user uses, or unifying them.  Try changing the UIx using the same backend(s). 

The new user paradigm : There is no such thing as the final user - all users are middle users, and will be RE sending an edited version of the data in a new way to someone else – who will again be a middle user recreating and sending it to someone else.  So the data itself needs to be dynamic and available (perma links).

Analytics are very important!!!  Not only in web but even more so in mobile apps.  What's tabs are pressed, how the user uses a system, what gestures are used etc.

The smart phone is not always connected, think not connected systems think synchronization

Real time collaboration - the users are used to real time collaboration with their colleagues, think constant syncing with server think multiple user interface think multiple users.

Platforms: every couple of months and you platform comes out, each platform comes with its own resolution, abilities, controls and OS.

IMG_20111127_150413

Try to think cross-platform: maybe abstraction layers like HTML 5, phonegapp, flex

UIX

  • All female users are righties (except for a small promil)
  • Most male users are righties
  • A lot of male users are colorblind

idea of Cool:

  • Users need to be set in a certain zone
  • There should be a flow to the application - remember when you scroll on the iPhone the scrolling continues even for a bit - even though you've stopped scrolling

The user’s mental image should agree with the user's experience

REACTION   VISUALIZATION
  SIMILAR DIFFERENT
SIMILAR positive nothing/positive
DIFFERENT BAD!!! N/A

if the users visual experience is the same*  and the reaction is similar meaning the same gestures apply the same interaction takes place the user uses the same cognitive abilities to manipulate the screen then to the reaction is a positive one

However, if the users visual experience is the same however the reaction required by the user is different such as scrolling vs.  Gesturing, right clicking vs. long press, gesturing with two fingers vs.  Selecting with a mouse Et cetera, the user's learning curve would be longer, and their overall experience would be bad.

* the screen looks the same on a desktop and on the mobile or on the tablet/pad

Friday, November 04, 2011

QR Codes and Contact information - part 2

Because of Error Correction
you can ad readable text too (not a lot)

QR Codes and Contact information

-- This blog is being written by Microsoft Windows 7 speech recognition software, so if there are some errors I missed, please excuse me.

Today I was reading a LinkedIn article by Lynne, more a blog post actually. I dunno if it's her company or if she works there is this is an advertisement, but still it intrigued me.

http://www.linkedin.com/groupItem?view=&gid=1062177&type=member&item=78767032&commentID=57065334&report%2Esuccess=8ULbKyXO6NDvmoK7o030UNOYGZKrvdhBhypZ_w8EpQrrQI-BBjkmxwkEOwBjLE28YyDIxcyEO7_TA_giuRN#commentID_57065334

Recently I was at a DLD conference where I met someone who had an iPhone 4, she insisted that we connect through WhatsApp so she could send me full contact record that would be installed directly into my phone - including all her numbers, contact information and even a picture.

This got me thinking, I was out of business cards and there were too many people in the conference so Internet was a problem and slow plus the fact that the lot of foreign dignitaries were there and not all of them had Internet. EVERYONE had some form of smartphone (iPhone 3, iPhone 4, android, windows mobile phone, and even some new Nokia phones).

There has to be some kind of method to communicate data between these phones.

vCard doesn't work for android, although it used to work for my old Nokia e71.

Then I saw Lynne’s blog post (above) and decided there must be a better way.

WhatsApp contact transferring is not the solution - but it is the doorway though which I entered the field.

So Googling my way around, I started reading about QR Codes, and found out that their are different identifiers hidden in the text part of the QRCode.

The first one I found was the MATMSG

According to NT DoCoMo Japan, these are the identifiers available:

1. MATMSG: - this will automatically a allow you to open an email, the TO, the Subject and the body as well as your signature can be embedded into QR code. I don't know why one would use this, as it is almost an invasion of privacy for nontechnical people, this would be a nice way of stealing their e-mail address all they need to do is just click enter on their phone and you have their email. But whatever I'm not the cyber police, and I really like the expression

“When you make something idiot proof - they just invent a better idiot”

2. MEBKM - this allows you to install a bookmark in one's browser, the NAME and URL are fields.

3. LAPL – don’t know if this really works, because obviously we're not using NT DoCoMo but it's supposed to start an application according to its ADF key (whatever that is).

4. MECARD - the holy grail.

Allows one to send contact information directly into your contact application. I've tested this on android with success, and I'm about to test this also on other devices soon (hopefully yours)Open-mouthed smile

Contact Grabber

So using any QR Code generator, in the text option, you can add your own contact information. The fields are:

Field Info Comment
N: your Name When a field is divided by a comma (,), the first half is treated as the last name and the second half is treated as the first name.
TEL: your phone number 1 to 24 digits
TEL-AV: your number for Video Calls 1 – 24 digits
EMAIL: your email
ADR: Address The fields divided by commas (,) denote PO box, room number, house number, city, prefecture, zip code and country, in order.
BDAY: your birthday 8 digits consist of the year (4 digits), month (2 digits) and day (2 digits), in order.
URL: your homepage
NICKNAME: Your nickname
NOTE: a note I would probably add something about you as well as the conference. This will help the receiver remember where they met you

Then I found this bad boy http://www.quickmark.com.tw/en/qrcode-datamatrix-generator/?qrmecard

Which is exactly to make a universal contact for your smartphone.

This is My contact info if you want to check and see if it works for you.

111004140850 MECARD:
N:Perlstein,Mickey;
TEL:+972-checktheQRCODE;
EMAIL:pitronot-AT-bigfoot.com;
URL:http\://mperlstein.blogspot.com;NOTE:Server/Client/Mobile Developer and Consultant. I offer unique services in all aspects of your Technical project\, from conceptualization\, through Financial and Strategic Models all the way to Product launch.;;

So create your contact data, save it on your phone’s picture gallery, and let someone scan it off your phone.

YAY for old technology.