Should I make multiple SQLite databases for better concurrency?
I'm very new to SQL and relational databases (just started learning last
week) and I'm in the process of upgrading my website and currently keep
all my data in XML files. It works, but the new site would be better
suited from what I hear a relational database can do, and it looks like
SQLite is best for me. One of my concerns is concurrency, even though 99%
of the data will be read-only (which I understand SQLite is pretty good
at) 99% of the time. Other things, like page view counters for certain
pages will constantly require small writes. I'm still learning database
design and want to do it right. Would it make sense to make separate
databases for things that get written to a lot, that way making the main
database far less susceptible to concurrency issues? Is it possible to do
a "foreign key" type reference (I still haven't used foreign keys yet, but
think I understand them) across databases? As each view count would point
to some primary key in the main database. Thanks for any help!
Busto
Saturday, 31 August 2013
Set cron job issue
Set cron job issue
I am first time trying to set cron job in my linux server. I want to set
every 10 mins my file will run. The cron works fine but the problem is
that the cron run as following
00:00 00:10 00:20
but i want it in this way
00:05 00:15 00:25
I am first time trying to set cron job in my linux server. I want to set
every 10 mins my file will run. The cron works fine but the problem is
that the cron run as following
00:00 00:10 00:20
but i want it in this way
00:05 00:15 00:25
How can I get the base address of the target process after DLL injection?
How can I get the base address of the target process after DLL injection?
After I've successfully injected my dll into my target process, say
"target.exe", how can I get the base address of "target.exe"?
I've tried GetModuleHandle(0) and GetModuleHandle("target.exe") but it
doesn't seem to be right and I'm not sure how to debug. I've tried to
print it like this:
//retrive target's base address
DWORD EXEBaseAddr = (DWORD) GetModuleHandle((LPCWSTR)"target.exe");
std::stringstream sstr;
sstr << EXEBaseAddr;
std::string str = sstr.str();
String^ str3 = gcnew String(str.c_str());
baseAddressLBL->Text = str3;
I had to cast it at the end again because I'm using a Windows Form (not
sure if that's what it's called) to print the address in my interface.
After I've successfully injected my dll into my target process, say
"target.exe", how can I get the base address of "target.exe"?
I've tried GetModuleHandle(0) and GetModuleHandle("target.exe") but it
doesn't seem to be right and I'm not sure how to debug. I've tried to
print it like this:
//retrive target's base address
DWORD EXEBaseAddr = (DWORD) GetModuleHandle((LPCWSTR)"target.exe");
std::stringstream sstr;
sstr << EXEBaseAddr;
std::string str = sstr.str();
String^ str3 = gcnew String(str.c_str());
baseAddressLBL->Text = str3;
I had to cast it at the end again because I'm using a Windows Form (not
sure if that's what it's called) to print the address in my interface.
Shadow on bottom image like facebook
Shadow on bottom image like facebook
I would like know how is made the shadow on bottom image, i tried to check
to the source code but I not found nothing. Any idea? Thank you
I would like know how is made the shadow on bottom image, i tried to check
to the source code but I not found nothing. Any idea? Thank you
PHP gettext translate in wrong language when running from shell
PHP gettext translate in wrong language when running from shell
I have a complete PHP app, with MySQL.
All strings are using gettext, and I have 2 translations, Spanish and
English.
Original strings are written in Spanish.
it is working perfect, but, when I run a cron job, to send a report email,
it is sent using English, when it should send in spanish.
The problem isn't related to the mail code, since it works ok when I run
the cron file on the browser, plus, my email system first save it to the
DB then it sends them, and the message is already stored in English on the
DB.
So, I know my problem is the cron file is not using the correct language.
I use this code to set the language in a config file, included in ALL
files.
$language = "ES_AR.utf8"; //this is the locale name on the linux machine.
putenv("LANG=$language");
setlocale(LC_ALL, $language);
$domain = 'messages';
bindtextdomain($domain, APP_PATH . "/locale");
textdomain($domain);
As I said it works good.
I put this code at the top of the cron file, and the problem persists.
So the question is, is there something I can do to force a language when
running the cron file from shell??
Thanks!!!
I have a complete PHP app, with MySQL.
All strings are using gettext, and I have 2 translations, Spanish and
English.
Original strings are written in Spanish.
it is working perfect, but, when I run a cron job, to send a report email,
it is sent using English, when it should send in spanish.
The problem isn't related to the mail code, since it works ok when I run
the cron file on the browser, plus, my email system first save it to the
DB then it sends them, and the message is already stored in English on the
DB.
So, I know my problem is the cron file is not using the correct language.
I use this code to set the language in a config file, included in ALL
files.
$language = "ES_AR.utf8"; //this is the locale name on the linux machine.
putenv("LANG=$language");
setlocale(LC_ALL, $language);
$domain = 'messages';
bindtextdomain($domain, APP_PATH . "/locale");
textdomain($domain);
As I said it works good.
I put this code at the top of the cron file, and the problem persists.
So the question is, is there something I can do to force a language when
running the cron file from shell??
Thanks!!!
NLog adding Header Footer dynamically at run time
NLog adding Header Footer dynamically at run time
I want to add header and footer at run time dynamically. Meaning that
after I added them they will start appearing at my rolling log files.
I managed to add only one line like this.
LayoutWithHeaderAndFooter tt = new LayoutWithHeaderAndFooter();
tt.Header = @"----------------- Logging started on ${longdate}
------------------";
tt.Layout = @"${date:format=HH\:mm\:ss.fff} ${level} ${logger}
${message}";
tt.Footer = @"----------------- Logging finished on ${longdate}
-----------------";
And then I am adding it to my file target fileTarget.Layout = tt;
Any idea how to to it to more than one line with collection of messages or
something similar...
I want to add header and footer at run time dynamically. Meaning that
after I added them they will start appearing at my rolling log files.
I managed to add only one line like this.
LayoutWithHeaderAndFooter tt = new LayoutWithHeaderAndFooter();
tt.Header = @"----------------- Logging started on ${longdate}
------------------";
tt.Layout = @"${date:format=HH\:mm\:ss.fff} ${level} ${logger}
${message}";
tt.Footer = @"----------------- Logging finished on ${longdate}
-----------------";
And then I am adding it to my file target fileTarget.Layout = tt;
Any idea how to to it to more than one line with collection of messages or
something similar...
Friday, 30 August 2013
How to get Facebook user data by asp.net?
How to get Facebook user data by asp.net?
How can I get the Facebook user details without click on login button as
the code below . as when user accept allow the app to display on his
Facebook page i can get all user Facebook details .
public partial class DefaultPage : System.Web.UI.Page
{
protected void Login(object sender, EventArgs e)
{
FaceBookConnect.Authorize("user_photos,email",
Request.Url.AbsoluteUri.Split('?')[0]);
}
protected void Page_Load(object sender, EventArgs e)
{
FaceBookConnect.API_Key = "111111111111111";
FaceBookConnect.API_Secret = "xxxxxxxxxxxxxxxxxx";
if (!IsPostBack)
{
if (Request.QueryString["error"] == "access_denied")
{
ClientScript.RegisterStartupScript(this.GetType(),
"alert", "alert('User has denied access.')", true);
return;
}
string code = Request.QueryString["code"];
if (!string.IsNullOrEmpty(code))
{
string data = FaceBookConnect.Fetch(code, "me");
FaceBookUser faceBookUser = new
JavaScriptSerializer().Deserialize<FaceBookUser>(data);
faceBookUser.PictureUrl =
string.Format("https://graph.facebook.com/{0}/picture",
faceBookUser.Id);
pnlFaceBookUser.Visible = true;
//lblId.Text = faceBookUser.Id;
//lblUserName.Text = faceBookUser.UserName;
lblName.Text = faceBookUser.Name;
//lblEmail.Text = faceBookUser.Email;
ProfileImage.ImageUrl = faceBookUser.PictureUrl;
//btnLogin.Enabled = false;
}
}
}
}
public class FaceBookUser
{
public string Id { get; set; }
public string Name { get; set; }
public string UserName { get; set; }
public string PictureUrl { get; set; }
public string Email { get; set; }
}
How can I get the Facebook user details without click on login button as
the code below . as when user accept allow the app to display on his
Facebook page i can get all user Facebook details .
public partial class DefaultPage : System.Web.UI.Page
{
protected void Login(object sender, EventArgs e)
{
FaceBookConnect.Authorize("user_photos,email",
Request.Url.AbsoluteUri.Split('?')[0]);
}
protected void Page_Load(object sender, EventArgs e)
{
FaceBookConnect.API_Key = "111111111111111";
FaceBookConnect.API_Secret = "xxxxxxxxxxxxxxxxxx";
if (!IsPostBack)
{
if (Request.QueryString["error"] == "access_denied")
{
ClientScript.RegisterStartupScript(this.GetType(),
"alert", "alert('User has denied access.')", true);
return;
}
string code = Request.QueryString["code"];
if (!string.IsNullOrEmpty(code))
{
string data = FaceBookConnect.Fetch(code, "me");
FaceBookUser faceBookUser = new
JavaScriptSerializer().Deserialize<FaceBookUser>(data);
faceBookUser.PictureUrl =
string.Format("https://graph.facebook.com/{0}/picture",
faceBookUser.Id);
pnlFaceBookUser.Visible = true;
//lblId.Text = faceBookUser.Id;
//lblUserName.Text = faceBookUser.UserName;
lblName.Text = faceBookUser.Name;
//lblEmail.Text = faceBookUser.Email;
ProfileImage.ImageUrl = faceBookUser.PictureUrl;
//btnLogin.Enabled = false;
}
}
}
}
public class FaceBookUser
{
public string Id { get; set; }
public string Name { get; set; }
public string UserName { get; set; }
public string PictureUrl { get; set; }
public string Email { get; set; }
}
Subscribe to:
Comments (Atom)