Friday, June 15, 2012
carvoeiro vilanova
New site for Vila Nova in Carvoeiro.
Vila Nova Carvoeiro - Apartments & Restaurant
Thursday, November 10, 2011
How to Turn On SIM900 with arduino.
Some times the module was working ok, and others not so ok. :)
The main problem was in turning on method of the SIM900.
The solution:
Turn off and Then Turn on the SIM900.
The arduino code with the NewSoftSerial:
#define GSM_ON_PIN 8
int AvrHardwareHelper::TurnOffGsm()
{
mySerial.println("AT+CPOWD=1");
delay(3000);
digitalWrite(GSM_ON_PIN, LOW);
delay(2000);
digitalWrite(GSM_ON_PIN, HIGH);
delay(2500);
return atCommandResult;
}
int AvrHardwareHelper::TurnOnGsm(char* pin, int pinSize)
{
mySerial.println("AT+CFUN=1");
delay(600);
mySerial.flush();
mySerial.println("AT");
delay(600);
int numberOfBytesRead = 0;
while((mySerial.read()) > 0)
{
numberOfBytesRead++;
}
if(numberOfBytesRead==0)
{
digitalWrite(GSM_ON_PIN, HIGH);
delay(1200);
digitalWrite(GSM_ON_PIN, LOW);
delay(2500);
}
mySerial.flush();
delay(2000);
.... Do the rest here, at+cpin, etc....
}
pinMode(GSM_ON_PIN, OUTPUT); // sets pin 5 as output
mySerial.begin(9600);
TurnOffGsm();
TurnOnGsm("1234", 4);
This is the main difference with all the samples on the web.
If someone is searching for more info, please just leave a comment.
Friday, October 28, 2011
Arduino sprintf too big for AVR
The limit i had for my program was of 30000 bytes, so it's too much.
So, don't use it.
Wednesday, August 11, 2010
Import your contacts from excel to your nokia phone using ovi
Use javascript.
Inject the script, using firebug or something with a javascript console.
The batch is something like this:
document.getElementById('firstName').value = 'me'; document.getElementById('mobile').value = '22222222'; javascript:com.ovi.contacts.quickAddContact();
You can add email and last name.
Step by step:
1.Logon on ovi.com.
2.Go to contacts tab.
3.Use the excel with your contacts
4.Use the following formulas to generate the right commands:
=CONCATENATE("document.getElementById('firstName').value = '";B2;"';")
=CONCATENATE("document.getElementById('mobile').value = '";C2;"';")
javascript:com.ovi.contacts.quickAddContact();
5.Then copy the generated cells, copy it and run it using firebug.
I will put the sample excel.
Cheers,
Moleiro
Tuesday, June 08, 2010
Virtual PC Differencing Disks cool link
Tuesday, May 18, 2010
Carvoeiro Vila Nova
Vila Nova - Praia do Carvoeiro
The goal is to create a nice site with some java script with nice menus, date picker and other stuff, but without forgetting the accessibility issue. Well, with JQuery, you can do it all.
It's very easy to do it, check the nice calendar, menu ( yes a asp:menu ) and the image gallery.
Developing the asp:menu was easy, you must make use of adapters, for further reading check the css friendly adapters project: http://www.asp.net/cssadapters/.
If you are looking for one date pickers, try the jquery samples. Check one nice project about using the jquery datepicker in asp.net: http://www.west-wind.com/weblog/posts/213015.aspx
There are still things to work out, like some issues with accessibility, and some other bugs :).
If you want detials, just post a comment a will reply ASAP.
By the way, if you ever came to Portugal, enjoy the wonderfull beach of Carvoeiro, and have a nice meel at the pool on Vila Nova.
Wednesday, November 25, 2009
Cool Sql Tip, Auto Inc On Update
SET @counter = 0
UPDATE #tmp_Users
SET @counter = counter = @counter + 1
Please read the rest of the cool article:
http://haacked.com/archive/2004/02/28/sql-auto-increment.aspx
Friday, October 30, 2009
Set a Property Value to Null given a tree of objects and the path
This code was developed by Snippet Compiler (once again).
These code could be used in other things. The original prupose was to set some properties to null, from a given path to the property as a string.
using System;
using System.Collections.Generic;
using System.Reflection;
public class Type1
{
string _Value1 = "Value1";
public string Value1
{
get { return _Value1; }
set {_Value1 = value; }
}
public string Dummy
{
get {return "dummy";}
}
}
public class Type2
{
protected string _Value2;
public Type2(string v)
{
this._Value2 = v;
}
public string Value2
{
get { return _Value2; }
set { Console.WriteLine("someone is setting me to" + (value??"null")); _Value2 = value; }
}
}
public class Type3
{
Type2[] v = new Type2[2]{ new Type2("Value221"), new Type2("Value222") };
public Type1 Value11
{ get { return new Type1(); }}
public Type2[] Value22
{ get { return v; } set {v=value;} }
public void PrintMe()
{
object obj1 = this.GetType().InvokeMember("Value11", BindingFlags.GetProperty, null, this, new Object[0]);
System.Console.WriteLine(obj1.ToString());
object obj2 = this.GetType().InvokeMember("Value22", BindingFlags.GetProperty, null, this, new Object[0]);
object[] objArray2 = (object[])obj2;
foreach(object currentObj in objArray2)
{
System.Console.WriteLine(currentObj);
}
}
}
public class MyClass
{
public static object SetPropertyToNull(object obj, string propertyName, string propertyValues, bool setFatherToNull)
{
if (obj == null)
{
return null;
}
int firstDotPropertyName = propertyName.IndexOf(".");
string childPropertyName = String.Empty;
string remainingPropertyName = String.Empty;
//Get the property name no eval and the remaining string of the property name
if (firstDotPropertyName < 0)
{
firstDotPropertyName = 0;
childPropertyName = propertyName;
remainingPropertyName = String.Empty;
}
else
{
int remainningPropertyLength = (propertyName.Length - firstDotPropertyName - 1);
remainingPropertyName = propertyName.Substring(firstDotPropertyName + 1, remainningPropertyLength);
childPropertyName = propertyName.Substring(0, firstDotPropertyName);
}
//Get the type
Type initType = obj.GetType();
//Get the child object
object objChild = initType.InvokeMember(childPropertyName,
BindingFlags.GetProperty, null, obj, new object[0]);
//As default the object will not be changed
object returnedObj = objChild;
if (String.IsNullOrEmpty(remainingPropertyName))
{
//If the element is the rigth one, set it to null
if (String.IsNullOrEmpty(propertyValues) || (propertyValues.IndexOf(String.Format(".{0}.", objChild))) >= 0)
{
initType.InvokeMember(childPropertyName,
BindingFlags.SetProperty, null, obj, new Object[] { null });
if (setFatherToNull)
{
obj = null;
}
}
}
else
{
//If dealing with an array, process all the elements
if (objChild is Array)
{
for (int arrayCount = 0; arrayCount < (objChild as object[]).Length; arrayCount++)
{
returnedObj = SetPropertyToNull((objChild as object[])[arrayCount], remainingPropertyName, propertyValues, setFatherToNull);
(objChild as object[])[arrayCount] = returnedObj;
}
returnedObj = objChild;
}
//otherwise process the remaining object tree
else
{
if (!String.IsNullOrEmpty(remainingPropertyName))
{
returnedObj = SetPropertyToNull(objChild, remainingPropertyName, propertyValues, setFatherToNull);
}
}
initType.InvokeMember(childPropertyName,
BindingFlags.SetProperty, null, obj, new Object[] { returnedObj });
}
return obj;
}
public static void Main()
{
Type3 obj = new Type3();
WL("Before...");
obj.PrintMe();
SetPropertyToNull(obj, "Value22.Value2", null, true);
WL("After");
obj.PrintMe();
RL();
}
#region Helper methods
private static void WL(object text, params object[] args)
{
Console.WriteLine(text.ToString(), args);
}
private static void RL()
{
Console.ReadLine();
}
private static void Break()
{
System.Diagnostics.Debugger.Break();
}
#endregion
}
Monday, October 12, 2009
Email in dev
Cool config to save the emails on a folder without the need for a smtp server:
<system.net>
<mailSettings>
<smtp deliveryMethod="SpecifiedPickupDirectory">
<specifiedPickupDirectory pickupDirectoryLocation="c:\temp\maildrop\"/>
</smtp>
</mailSettings>
</system.net>
Check the full post:
Thursday, August 13, 2009
Ajax Culture Sys.CultureInfo (Ajax em Português)
How to change the ajax culture to a new one?
1. Save a copy of MicrosoftAjax.js ( you can find it on System.Web.Extensions thru Reflector tool)
2. Put it in the web server, in my case “/scripts”
3. Duplicate the file and rename it to MicrosoftAjax.PT-pt.js
4. Edit the file MicrosoftAjax.PT-pt.js and do some replace of strings (ex: month names)
5. Edit the ScriptManager (The value “PT-pt” from the ResourcesUICultures attribute is used to get the MicrosoftAjax.PT-pt.js)
<asp:ScriptManager ID="ScriptManager" runat="server" EnableScriptLocalization="true" EnableScriptGlobalization="true">
<Scripts>
<asp:ScriptReference Name="MicrosoftAjax.js" Path="~/Scripts/MicrosoftAjax.js" ResourceUICultures="PT-pt" />
</Scripts>
</asp:ScriptManager>
Ref: http://msdn.microsoft.com/en-us/magazine/cc135974.aspx
and http://msdn.microsoft.com/pt-br/magazine/cc135974.aspx
You are done.
Wednesday, August 12, 2009
Use Custom Objects in Project Settings
1.Add a new setting, set the name and one of displayed types.
2.Inside your VS.Net open the Settings with the Xml Editor.
3.Locate your new setting:
<Setting Name="ReplaceSomething" Type="System.String" Scope="Application">
<Value Profile="(Default)">
</Value>
</Setting>
4.Edit the Type attribute in my case, i changed to:
<Setting Name="ReplaceSomething" Type="RegExHttpModule.RegExReplaceRule" Scope="Application">
<Value Profile="(Default)">
</Value>
</Setting>
5.And now place the Xml Serialization version of the object:
<Setting Name="ReplaceSomething" Type="RegExHttpModule.RegExReplaceRule" Scope="Application">
<Value Profile="(Default)">
<RegExReplaceRule xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<UrlRegularEx>1</UrlRegularEx>
<FileContentRegularEx>2</FileContentRegularEx>
<FileContentReplace>3</FileContentReplace>
</RegExReplaceRule>
</Value>
</Setting>
6.Now you can close de Xml Editor and click over the Settings file.
Disable multiple postback
How to disable multiple postbacks from a asp.net page ( the easy way, not the best):
1. Use asp.net Button control, check for OnClick and OnClientClick Property
2.OnClientClick you should add a call to the function DisableButtonOnPostBack:
<asp:Button ID="Button1" runat="server" OnClientClick="return Navigate();" onclick="Button1_Click" Text="Button" />
3.And then add the javascript.
<script type="text/javascript">
function DisableButtonOnPostBack() {
if (!this.disabled) {
this.disabled = true;
return true;
}
else {
return false;
}
}
</script>
Friday, June 26, 2009
Free UnZip And Run Mdx Query Tool (Tested on Sql Server Analysis Services 2005)
Are you looking for a nice mdx qyery tool:
http://www.mosha.com/msolap/mdxstudio.htm
You don’t need to install it, just unzip and run it.
I tested it on SQL Server Analysis Services 2005, and worked.
Tuesday, May 19, 2009
Tuesday, May 12, 2009
Monday, May 04, 2009
Dll not found. Reflection.
If you have a error something like this one:
File Not Found. at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) at System.Reflection.Assembly.Load(String assemblyString) at System.Web.Configuration.CompilationSection.LoadAssembly(String assemblyName, Boolean throwOnFail) at System.Web.UI.TemplateParser.LoadAssembly(String assemblyName, Boolean throwOnFail) at System.Web.UI.TemplateParser.AddAssemblyDependency(String assemblyName, Boolean addDependentAssemblies) at System.Web.UI.TemplateParser.ProcessDirective(String directiveName, IDictionary directive) at System.Web.UI.BaseTemplateParser.ProcessDirective(String directiveName, IDictionary directive) at System.Web.UI.TemplateControlParser.ProcessDirective(String directiveName, IDictionary directive) at System.Web.UI.PageParser.ProcessDirective(String directiveName, IDictionary directive) at System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding)
Try this:
From the Vs.net command ptompt, run the tool Fuslogvw.exe.
On settings select the "log bind failures to disk" option, and choose a local path for the log, and click ok.
Run you app, and after the error, select the refresh button, the dll missing should appear. If you select it, with double click you sould have some info to help you.
WARNING: After you are done, disable the log.
Thanks Mister Daniel for this info.
Cheers.
Tuesday, March 03, 2009
Configure the S.O. proxy settings to all users
Use proxycfg to display the current proxy setting.
Use the option “proxycfg –d”, to disable the proxy setting.
Use the option “proxycfg -u” to copy the proxy settings from the Internet Explorer user current settings
Search strings in files, the good old way
FINDSTR
The Command Help (FINDSTR /?)
Utilize espaços para separar múltiplas cadeias de procura, excepto se o
argumento incluir o prefixo /C. Por exemplo, 'FINDSTR "quem está" x.y'
procura "quem" ou "está" no ficheiro x.y. 'FINDSTR /C:"quem está" x.y'
procura "quem está" no ficheiro x.y.
Online Help
Thursday, July 10, 2008
BizTalk Must Have Documentation
Just a small note for some good documentation. I keep forgetting or losing this links. :)
For installation, administration and monitoring:
For HardCode Sql Queries:
BizTalkServer2004AdvancedMessageBoxQueries.doc
And just the BizTalk Community Bible:
http://www.codeplex.com/bloggersguide/Release/ProjectReleases.aspx?ReleaseId=14524
Wednesday, June 18, 2008
Teste do Windows Live Writer
Parece que agora a coisa está a começar a mexer.
Na mesma aplicação (leve), temos RSS Reader, Mail, Contactos Newsgroups, Autor de Blog, Messenger.
Aquilo que gosto (desta fase de teste) é o facto de ser uma aplicação sem leve. Pena é que a funcionalidade de descarregar mails de outras contas seja para pagantes.