Windows Mobile Support

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Thursday, 3 February 2011

Operatii CRUD pe tables in Windows Azure

Posted on 23:09 by Unknown
Se da obiectul de tip Point, cu doua propietati de tip int X si Y si un id tot de tip int, unde point implementeaza TableServiceEntity.

Initalizare:
//Initializare cont (se poate incarca din fisierul de configurare).
StorageAccountInfo account = ...
TableStorage tableStorage = TableStorage.Create(account);
//Creare tabel cu un anumit nume.
tableStorage.TryCreateTable("Point");
Salvare:
Point point = new Point();
...
TableStorageDataServiceContext context = table.GetDataServiceContext();
context.AddObject(point);
//Doar pe save se salveaza in tabel obiectul nostru.
context.Save();
Interogare:
TableStorageDataServiceContext context = table.GetDataServiceContext();
//Trebuie specificat numele tabelului. Un tabel poate sa contina orice tip de obiecte, chiar si de tipuri diferite.
var query = context .CreateQuery("Point").Where(item => item.Id == 10);
IEnumerable resultList = new TableStorageDataServiceQuery((DataServiceQuery)query).ExecuteAll();
Stergere:
//Dupa ce prin avem obiectul de tip Point( ajunge sa fie un obiect de tip Point care sa aibe partition key si row key corespunzator.
TableStorageDataServiceContext context = table.GetDataServiceContext();
context.DeleteObject(point);
context.SaveChanges()
Read More
Posted in adaugare, Azure, C#, Cloud, CRUD, lista, operations, stergere, table | No comments

Windows Azure - static properties & fields

Posted on 07:11 by Unknown
Variabilele de tip static pe Azure nu sunt chiar statice. Din cauza ca nu stim intr-un anumit moment pe ce instanta putem sa ajunge printr-un call, nu trebuie sa presupunem ca intre doua call-uri consecutive o sa ajungem pe aceiasi masina.
Aceasta problema apare mai ales in cazul variabilelor care le initializam printr-o metoda publica intr-un anumit moment diferit de initializarea aplicatiei.
Din aceasta cauza cel mai bine este sa lucram cu propietati, nu cu field-uri si sa avem un cod asemanator cu cel pentru Singleton.
        private static ObjA _item;
private static object _itemLock;
public static ObjA Item
{
get;
{
if(_item == null)
{
InitItem ();
}
return _item;
}
}

private static InitItem()
{
lock(_itemLock)
{
if(_item == null)
{
_item = Init;
}
}
}
Read More
Posted in Azure, field, property, static | No comments

Wednesday, 2 February 2011

ConvertAll - Conversia unei liste mult mai usor

Posted on 14:49 by Unknown
Avem urmatorul scenariu. O lista de elemente de tip A, pe care trebuie sa o convertim la o lista de tip B. Pentru a putea rezolva aceasta problema putem să implementam operatorul implicit sau explicit de conversie, iar apoi să iteram prin lista pentru a face conversia la tipul B.
List<A> listaA;
List<B> listaB;
...
foreach(A a in listaA)
{
listaB.Add(a);
}

sau
listaB.foreach(item=>listaB.Add(item));
Ambele soluții sunt rezonabile, dar e puțin mai greu de înțeles ca in spate se face o conversie. Pentru a face codul mai clar putem să facem in felul următor:
listaB = listaA.ConvertAll<B>(item => item)
Ce am scris mai sus? Fiecare element din listaA convertestel in tipul B si adaug-al in colecția care rezulta. item => item am putut sa scrie deoarece am presupus ca un operator de conversie implicita sau explicita intre cele doua tipuri a fost deja implementat.
In cazul in care acesta nu ar fi implementat am avea ceva asemanator:
Din
private B ConvertAToB(A a) { return new B(); ... }
...
List<A> listaA;
List<B> listaB;
...
foreach(A a in listaA)
{
listaB.Add(ConvertAToB(a));
}
Am avea:
private B ConvertAToB(A a) { return new B(); ... }
...
listaB = listaA.ConvertAll<B>(item => ConvertAToB(item));
Cea ce am scris mai sus se poate scrie si:
listaB = listaA.ConvertAll<B>(ConvertAToB);
Chiar daca folosim ConvertAll obtinem acelasi rezultat, doar ca folosind ConvertAll obtinem un cod mai clar. Urmatorul dezvoltator care o sa vina dupa noi o sa inteleaga ca aici facem oconversie.
Read More
Posted in convertAll, convertor, explicit, implicit, linq, operator | No comments

Tuesday, 1 February 2011

Cum sa verificam daca un path este valid

Posted on 14:05 by Unknown
Uneori avem nevoie să verificam dacă un path dat de utilizator este valid. Asa cum exista System.IO.File.Exist() exista pentru a face aceasta verificare si System.IO.Directory.Exist().
Iata mai jos si un exemplu:
string path = "d:/locatie";
if(System.IO.Directory.Exist(path))
{
//path-ul este valid.
} else
{
// path-ul nu este valid.
}
In cazul in care path-ul contine si numele unui fisier putem sa facem urmatorul artificiu:
string path = "d:/locatie/a.txt";
if(System.IO.Directory.Exist(GetDirectoryName(path)))
{
//path-ul este valid.
} else
{
// path-ul nu este valid.
}
Read More
Posted in director, Directory.Exist, exita, File.Exist, getdirectoryname, path, verificare | No comments

Monday, 31 January 2011

Cand sa folosim System.Thread.Timer

Posted on 22:39 by Unknown
In .NET putem sa alegem din 3 tipuri de timer:
  • System.Timer - thread timer;
  • System.Thread.Timer - server base timer;
  • System.Windows.Forms.Timer - windows base timer;
System.Windows.Forms.Timer se foloseste in general pe UI, cand trebuie sa facem update. System.Timer o sa il folosim de obicei de obicei pe partea de server cand vrem mai multe flexibilitate si mai mult optiuni. Din cele trei timer-uri, acesta are cele mai multe optiuni.
System.Thread.Timer, care rulează un nou thread pentru operațiile sale. Acesta este folositor când vrem sa facem operații asyncron.
System.Threading.Timer timer = new System.Threading.Timer(new TimerCallback(ExecutaCeva), null, 0, 2000);
...
private void ExecutaCeva(object obj)
{
....
}
Pentru a face disable/enable putem sa folosim:
timer.Change(Timeout.Infinite, Timeout.Infinite); //Disable.
timer.Change(0, 2000); //Enable.
Cea ce mi s-a parut foarte folositor la acest imer sunt parametrii lui Change si ultimii doi parametrii a contructorului. Prin intermediul lor putem sa specificam dupa ce perioada sa se apeleze metoda ExecutaCeva, iar apoi la ce interval de timp aceasta sa fie executa.
Sunt cazuri cand vrem ca primul apel ExecutaCeva sa fie facut dupa 1 secunda, iar apoi timer-ul sa apeleze aceasta metoda la 10 secunte. Pentru acest lucru daac am folostii System.Timer ar fi nevoie sa oprim timer-ul dupa prima executie, sa setam din nou intervalul de timp, iar apoi sa îl pornim din nou.
System.Thread.Timer ne permite sa facem in felul urmator:
System.Threading.Timer timer = new System.Threading.Timer(new TimerCallback(ExecutaCeva), null, 1000,10000);
varianta care o prefer eu este:
System.Threading.Timer timer = new System.Threading.Timer(new TimerCallback(ExecutaCeva), null, TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(10));
Este bine de stiut ca orice moment cand apelam metoda Change, timpul pana cand se apeleaza ExecutaCeva se modifica. Daca prima valoare este 0, atunci metoda pentru callback se apeleaza imediat, iar daca este Timer.Infinite atunci timer-ul este disable.
Cand al doilea parametru este 0 sau Timer.Infine, atuci timer-ul se executa o singura data.
Read More
Posted in change, control, schimbare timp, thread, timer | No comments

Cum sa salvezi un stream direct intr-un fisier

Posted on 14:51 by Unknown
Cred ca este a 2-a oara când întâlnesc aceasta cerința in decurs de câteva săptămâni.
Se da un stream și o locație unde trebuie salvat, se cere să se salveze conținutul la stream in locația data. Din păcate API-ul de .NET nu ne permite să facem acest lucru doar dintr-un apel.
O soluție propusa este următoarea:
        /// <summary>
/// Save the stream to the given location.
/// </summary>
/// <param name="stream">The stream.</param>
/// <param name="filePath">The file path where is saved.</param>
/// <param name="blockSize">The size of the buffer(in kB)</param>
public static void SaveStream(this Stream stream,String filePath,SeekOrigin seekOrigin=SeekOrigin.Begin,int blockSize=1)
{
//Set the poinder to the begin of the stream.
if(stream.CanSeek && seekOrigin==SeekOrigin.Begin)
{
stream.Seek(0, SeekOrigin.Begin);
}

//Removed the existing file.
if (File.Exists(CommandLineArguments.Instance.File))
{
File.Delete(CommandLineArguments.Instance.File);
}

//Save the stream to the given location.
using (var streamWrite = File.Create(CommandLineArguments.Instance.File))
{
byte[] buffer = new byte[1024*blockSize];
int read;

while ((read = stream.Read(buffer, 0, buffer.Length)) > 0)
{
streamWrite.Write(buffer, 0, read);
}
}
}
Iar un exemplu de utilizare:
Stream stream=...;
stream.Save("d:/a.txt");
In funcție de necesitați acest exemplu se poate extinde. Din păcate nu putem să facem un extension method pe File deoarece este o clasa statica.
Read More
Posted in extension, method, salvare in fisier, stream | No comments

New mLearning Authoring Offerings - Wave #1

Posted on 12:36 by Unknown
As detailed in my list of mobile learning predictions for 2011, a collection of smart and savvy authoring tool vendors offering solutions for online training delivery will start to introduce specialized tools that will enable some form of single sourcing that outputs mobile-friendly content with little or nominal effort over and above what's already been invested to create online courseware and training materials.  It took no longer than the end of January for new product announcements to be made by two of the leading authoring tool vendors who are now offering both Flash and HTML5 course publication output options to instructional designers using their respective applications. Let's take a quick look at both companies and their respective offerings:

Rapid Intake's mLearning Studio.  Garin Hess and his team over at Rapid Intake have announced a new suite of tools called mLearning Studio that will allow content authors to output SCORM-conformant courseware along with included assessments as either web-friendly Flash courseware or mobile-friendly HTML5 packages with the click of a button.  I got to play around with some early content samples and found their mobile packaging to be clean, flexible and very well structured for playback on compatible mobile devices based on Apple's iOS or on Android-based mobiles or tablets. We are still experimenting to determine if the produced content can be easily managed when downloaded and secured to a mobile device for offline playback using the app-based approach but online delivery works quite nicely with gesture-based navigation, nice media support and engaging assessment capabilities.  Moreover, we really like what we see in their "version 1.0" effort here and look forward to seeing where they can take it all when supporting legacy mobile devices like the ever popular BlackBerry in the enterprise as well as newer smartphones like those based on Microsoft's Windows Phone 7 OS that don't fully support the HTML5 spec as of yet. Rapid Intake is considering releasing their mobility options as both a standalone mlearning authoring tool as well as via an extension to their core Unison offering. You can learn more about the upcoming release of mLearning Studio in a video featured on their web site here.

Harbinger Group's Raptivity.  Raptivity is a well regarded "rapid interactivity builder" application used by many companies to "add some spice" to their online learning courses through the delivery of interactive exercises. To facilitate wider mobile delivery of these interactions, Vikas Joshi and his team over at Harbinger have added new functionality that allows IDs to output defined interactions as either Flash or HTML5 packages that can then be assigned and taken via online or offline delivery.  No word yet as to whether the mobile-friendly Raptivity interactions can also be embedded into a Rapid Intake mLearning Studio-based mobile course but given these two companies have interacted fully in the past, its logical to think they will at some point. You can learn more about the new mobile-friendly Raptivity offering here.

We are excited every time new tools are introduced and these two organizations are leading the way in 2011 by delivering viable options for mobile learning content creation and delivery where there's much to gain and not much at all IDs need to learn to make the jump from online to mobile for their learning communities.
Read More
Posted in | No comments
Newer Posts Older Posts Home
Subscribe to: Posts (Atom)

Popular Posts

  • E-Learning Vendors Attempt to Morph Mobile
    The sign should read: " Don't touch! Wet Paint !" I had a good chuckle today after receiving my latest emailed copy of the eLe...
  • Content Types - Level 6: Rich Media
    Level 6: Rich Media NOTE: This is part 7 of 7 and the conclusion of this continuing series; please see earlier posts for more background inf...
  • CDN is not the only solution to improve the page speed - Reverse Caching Proxy
    I heard more and more often think like this: “If your website is to slow, you should use a CDN.” Great, CDN is THE solution for any kind of ...
  • Publishing our CellCast Widget for iPad
    The rush has been on this week as our development team worked to design a new version of our CellCast Widget specifically for Apple's up...
  • NetCamp 2012 - Windows 8 development experience
    During this week I participate to NetCamp 2012.  This was the 6th NetCamp event and is organizing by Evensys. NetCamp is a dedicated event f...
  • SQL - UNION and UNION ALL
    I think that all of us used until now UNION in a SQLstatement. Using this operator we can combine the result of 2 queries. For example we wa...
  • Password/Token/PIN definition
    Password, Token, PIN, Passcode… every day we use this items when we need to authenticate in different systems. I observed that there are tim...
  • Shared Access Signature and URL encoding on Windows Azure
    Playing a little with Shared Access Signature was quite nice. In this moment this new functionality has a great potential. Playing a little ...
  • Content Types - Level 4: Reference
    Level 4: Reference Materials & Static Content NOTE: This is part 5 of 7 in a continuing series; please see earlier posts for more backgr...
  • Patterns in Windows Azure Service Bus - Message Splitter Pattern
    In one of my post about Service Bus Topics from Windows Azure I told you that I will write about a post that describe how we can design an a...

Categories

  • .NET
  • .NET nice to have
  • #if DEBUG
  • 15 iunie 2011
  • 15 octombrie 2011
  • 2011
  • abstracta
  • action
  • adaugare
  • ajax
  • Amsterdam
  • Android
  • aplicatii
  • App Fabric
  • Apple iSlate
  • array
  • as
  • ASP.NET
  • AsReadOnly
  • Assembly comun
  • async
  • Asynchronous programming
  • asyncron
  • Autofac
  • AutoMapper
  • az
  • Azure
  • Azure AppFabric Cache
  • Azure backup solution
  • Azure Storage Explorer
  • azure. cloud
  • backup
  • BCP utility
  • bing maps v7
  • BitArray
  • BlackBerry
  • blob
  • BlobContainerPublicAccessType
  • breakpoint
  • bucuresti
  • C#
  • cache
  • CallerMemberName
  • CellCast
  • Certificate
  • CES
  • change
  • ChannelFactory
  • clasa
  • classinitialize
  • clean code
  • click event
  • close
  • Cloud
  • Cluj
  • cluj-napoca
  • Code contracts
  • code retrat
  • codecamp
  • CollectionAssert
  • Compact Edition
  • compara
  • Comparer T .Default
  • CompareTo
  • comparison
  • comunitate
  • concurs
  • Conditional attribute
  • configurare
  • connection string
  • container
  • content type
  • control
  • Convert
  • convertAll
  • convertor
  • cross platform
  • CRUD
  • css
  • custom properties
  • custom request
  • DACPAC
  • Daniel Andres
  • data sync service
  • database
  • date time
  • datetime
  • debug
  • default
  • delegate
  • dependency injection
  • deploy
  • DeploymentItem
  • design patterns
  • Dev de Amsterdam
  • development stoage
  • dictionary
  • diferente
  • digging
  • director
  • Directory.Exist
  • disable
  • dispatcher
  • dispose
  • dropdown
  • dynamic
  • EF
  • email
  • encoding
  • entity framework
  • enum
  • enumerable
  • Environment.NewLine
  • error
  • error 404
  • error handling
  • eveniment
  • event
  • ews
  • excel
  • exception
  • exchange
  • exita
  • explicit
  • export
  • extension
  • field
  • File.Exist
  • finalize
  • fire and forget
  • Fluent interface pattern
  • format
  • func
  • GC.SuppressFinalize
  • generic
  • getdirectoryname
  • globalization
  • gmail
  • hackathon
  • Hadoop
  • handle
  • HTML
  • html 5
  • Html.ActionLink
  • http://www.blogger.com/img/blank.gif
  • HttpModule
  • IComparable
  • IE
  • ienumerable
  • IIS
  • image
  • implicit
  • import
  • int
  • internationalization
  • Internet Explorer
  • interop
  • Ioc
  • IP Filter
  • iPhone
  • iQuest
  • IStructuralEquatable
  • ITCamp
  • itspark
  • java script
  • javascript
  • July 2012
  • KeyedByTypeCollection
  • KeyNotFoundException
  • Kinect SDK
  • lambda expression
  • LightSwitch Microsoft Silverlight
  • linq
  • list
  • lista
  • lista servicii
  • liste
  • Live Connect
  • Live ID
  • load
  • localization
  • lock
  • m-learning
  • MAC
  • Mango
  • map
  • mapare
  • mapare propietati
  • messagequeue
  • meta properties
  • method
  • MethodImpl
  • Metro App
  • Microsoft
  • Microsoft Sync Framework
  • mlearning
  • mlearning devices
  • Mobile Apps
  • mobile in the cloud
  • mobile learning
  • mobile services
  • Mobile Web
  • mongoDb
  • monitorizare
  • msmq
  • multitasking
  • MVC
  • MVC 3
  • MVVM
  • namespace
  • nextpartitionkey
  • nextrowkey
  • Ninject
  • nivel acces
  • no result
  • normalize
  • nosql
  • null expcetion
  • null object pattern
  • NullReferenceException
  • OAuth API
  • office
  • offline
  • Open ID
  • openhackeu2011
  • operations
  • operator
  • optimization
  • option
  • outputcache
  • OutputCacheProvider
  • override
  • paginare
  • pagination
  • path
  • persistare
  • Portable Library tool
  • Post event – CodeCamp Cluj-Napoca
  • predicate
  • predictions
  • prezentare
  • process
  • proiect
  • property
  • propietati
  • query
  • ReadOnlyCollection
  • ReadOnlyDictionary
  • referinta
  • reflection
  • remote
  • reply command
  • request
  • request response
  • resouce
  • REST
  • REST Client
  • RESTSharp
  • ronua
  • rss
  • rulare
  • salvare in fisier
  • sc
  • schimbare timp
  • select
  • select nodes
  • send
  • serializare
  • serialization
  • Server.Transfer. Resposen.Redirect
  • service bus
  • ServiceBase
  • servicecontroller
  • sesiune
  • session
  • Session_End
  • Session_Start
  • setup
  • Sibiu
  • signalR
  • Silverlight
  • sincronizare
  • Single Responsibility Principle
  • SkyDrive
  • skype
  • smartphones
  • smtp
  • Snapguide
  • sniffer
  • socket
  • solid
  • spec#
  • sql
  • Sql Azure
  • SQL CE
  • sql server 2008 RC
  • SRP
  • startuptype
  • stateful
  • stateless
  • static
  • stergere
  • store
  • store procedure
  • stream
  • string
  • string.join
  • struct
  • StructuralEqualityComparer
  • submit
  • switch
  • Symbian
  • Synchronized
  • system
  • tabele
  • table
  • techEd 2012
  • tempdata
  • test
  • testcleanup
  • testinitialize
  • testmethod
  • thread
  • timer
  • ToLower
  • tool
  • tostring
  • Total Cost Calculator
  • trace ASP.NET
  • transcoding
  • tuplu
  • tutorial
  • TWmLearning
  • type
  • unit test
  • unittest
  • UrlParameter.Optional
  • Validate
  • validation
  • verificare
  • video
  • view
  • ViewBag
  • virtual
  • visual studio
  • VM role
  • Vunvulea Radu
  • wallpaper
  • WCF
  • WebBrower
  • WebRequest
  • where clause
  • Windows
  • windows 8
  • Windows Azure
  • Windows Azure Service Management CmdLets
  • windows live messenger
  • Windows Mobile
  • Windows Phone
  • windows service
  • windows store application
  • Windows Task
  • WinRT
  • word
  • workaround
  • XBox
  • xml
  • xmlns
  • XNA
  • xpath
  • YMesseger
  • Yonder
  • Zip

Blog Archive

  • ▼  2013 (139)
    • ▼  November (17)
      • Service Bus - Optimize consumers using prefetch an...
      • Extract relative Uri using MakeRelativeUri method
      • Sync Group - Let's talk about Performance
      • [PostEvent] Slides from MSSummit 2013, Bucharest
      • How to get the instance index of a web role or wor...
      • Sync Group - A good solution to synchronize SQL Da...
      • Throttling and Availability over Windows Azure Ser...
      • How to monitor clients that access your blob storage?
      • Digging through SignalR - Dependency Resolver
      • [Event] Global Day of Coderetreat in Cluj-Napoca! ...
      • Windows Azure Service Bus - What ports are used
      • Debugging in production
      • Simple load balancer for SQL Server Database
      • [PostEvent] MSSummit 2013, Bucharest
      • How to read response time when you run a performan...
      • VM and load balancer, direct server return, availa...
      • Bugs that cover each other
    • ►  October (12)
    • ►  September (10)
    • ►  August (7)
    • ►  July (8)
    • ►  June (15)
    • ►  May (12)
    • ►  April (17)
    • ►  March (16)
    • ►  February (9)
    • ►  January (16)
  • ►  2012 (251)
    • ►  December (9)
    • ►  November (19)
    • ►  October (26)
    • ►  September (13)
    • ►  August (35)
    • ►  July (28)
    • ►  June (27)
    • ►  May (24)
    • ►  April (18)
    • ►  March (17)
    • ►  February (20)
    • ►  January (15)
  • ►  2011 (127)
    • ►  December (11)
    • ►  November (20)
    • ►  October (8)
    • ►  September (8)
    • ►  August (8)
    • ►  July (10)
    • ►  June (5)
    • ►  May (8)
    • ►  April (9)
    • ►  March (14)
    • ►  February (20)
    • ►  January (6)
  • ►  2010 (26)
    • ►  December (1)
    • ►  November (1)
    • ►  October (1)
    • ►  June (2)
    • ►  May (1)
    • ►  April (4)
    • ►  March (1)
    • ►  February (1)
    • ►  January (14)
Powered by Blogger.

About Me

Unknown
View my complete profile