Tuesday, January 1, 2019

email - Outlook 2010 - VBA MsgBox if more then 10 unread elements mails

I would like to start Outlook, then Outlook should only show ALL mailboxes, which have also unread emails.



At the moment, my VBA-Script expand all my mailbox folders / accounts.
But the list is unfortunately too long, now.



I am looking for a way to check unread elements.

I have tried it with a simple MsgBox, but does not work.



    Private Sub Application_Startup()
'Folder-Variable definieren
Dim objFolderIMAP01 As Outlook.Folder
Dim objFolderIMAP02 As Outlook.Folder
Dim objFolderIMAP03 As Outlook.Folder

'IMAP-Folder zuweisen (hier in Klammern mit Anführungszeichen den Namen der IMAP-Datendatei eintragen)
Set objFolderIMAP01 = Outlook.Session.Folders("MailBox1")

Set objFolderIMAP02 = Outlook.Session.Folders("MailBox2")
Set objFolderIMAP03 = Outlook.Session.Folders("MailBox3")

'Alle Unterordner selektieren (und damit aufklappen)
Call selectAllFolderRec(objFolderIMAP01)
Call selectAllFolderRec(objFolderIMAP02)
Call selectAllFolderRec(objFolderIMAP03)

'Posteingang als Startordnder auswählen
Call Outlook.ActiveExplorer.SelectFolder(objFolderIMAP01.Folders("Posteingang"))

Call Outlook.ActiveExplorer.SelectFolder(objFolderIMAP02.Folders("Posteingang"))
Call Outlook.ActiveExplorer.SelectFolder(objFolderIMAP03.Folders("Posteingang"))

'Info wenn mehr als 10 Emails ungelesen
If objFolderIMAP01.UnReadItemCount > 10 Then
MsgBox "Mailbox 1 ist voll!"
End If
If objFolderIMAP01.UnReadItemCount > 10 Then
MsgBox "Mailbox 2 ist voll!"
End If

If objFolderIMAP01.UnReadItemCount > 10 Then
MsgBox "Mailbox 3 ist voll!"
End If
End Sub

Sub selectAllFolderRec(objFolder As Outlook.Folder)
Dim lngCounter As Long
Dim bolSkipSelect As Boolean
bolSkipSelect = False
For lngCounter = 1 To objFolder.Folders.Count

If objFolder.Folders(lngCounter).Folders.Count > 0 And objFolder.Folders(lngCounter).Folders.UnReadItemCount > 10 Then
Call selectAllFolderRec(objFolder.Folders(lngCounter))
Else
If bolSkipSelect = False Then
Call Outlook.ActiveExplorer.SelectFolder(objFolder.Folders(lngCounter))
bolSkipSelect = True
End If
End If
Next lngCounter
End Sub

javascript - How to iterate through a json object?






Possible Duplicate:
I have a nested data structure / JSON, how can access a specific value?






I want to iterate through a json object which is two dimensional ...
for a one dimensional json object I do this



for (key in data) {

alert(data[key]);
}


what do i do about a two dimensional one??


Answer



There is no two dimensional data in Javascript, so what you have is nested objects, or a jagged array (array of arrays), or a combination (object with array properties, or array of objects). Just loop through the sub-items:



for (var key in data) {
var item = data[key];

for (var key2 in item) {
alert(item[key2]);
}
}

php - mysqli_stmt_close() expects to be parameter 1

I've been coding in PHP and connecting it up to MySql. I keep on getting an error




Warning: mysqli_stmt_close() expects parameter 1 to be mysqli_stmt, boolean given in C:\xampp\htdocs\xxxx on line 175




Is there anything wrong with this block of code?



 if(empty(trim($_POST['dept'])) && empty(trim($_POST['fname'])) && empty(trim($_POST['lname'])) && empty(trim($_POST['email'])) && empty(trim($_POST['cnum'])) && empty(trim($_POST['dob'])) && empty(trim($_POST['gender'])) && empty(trim($_POST['minitial'])) && strlen(trim($_POST['minitial'])) > 1   ){
$regerr = "Please complete your information";

}else{
$fname = trim($_POST['fname']);
$lname = trim($_POST['lname']);
$email = trim($_POST['email']);
$cnum = trim($_POST['cnum']);
$dob = trim($_POST['dob']);
$gender = trim($_POST['gender']);
$dept = trim($_POST['dept']);
$minitial = trim($_POST['minitial']);
}


// Check input errors before inserting in database
if(empty($usernameerr) && empty($passworderr) && empty($confirmpassworderr) && empty($regerr) ){

// Prepare an insert statement
$sql = "INSERT INTO login_info (username, password) VALUES (?, ?);
INSERT INTO user_info (fname, sname, minitial, contact_num, gender, dob, department) VALUES (?,?,?,?,?,CAST (? AS DATE),?);";

if($stmt = mysqli_prepare($link, $sql)){
// Bind variables to the prepared statement as parameters

mysqli_stmt_bind_param($stmt, "sssssssss", $param_username, $param_password, $param_fname, $param_sname, $param_minitial, $param_cnum, $param_gender, $param_dob, $param_department);

// Set parameters
$param_username = $username;
$param_password = password_hash($password, PASSWORD_DEFAULT); // Creates a password hash
$param_fname = $fname;
$param_sname = $lname;
$param_minitial =$minitial;
$param_cnum = $cnum;
$param_gender = $gender;

$param_dob = $dob;
$param_department = $dept;

// Attempt to execute the prepared statement
if(mysqli_stmt_execute($stmt)){

session_start();
$_SESSION['username'] = $username;
$_SESSION['usernumber'] = $mysqli_insert_id($link);
header("location: home-trabawho.php");

} else{
echo "Something went wrong. Please try again later.";
}
}

// Close statement
mysqli_stmt_close($stmt);
}

mysql - what is this error Cannot modify header information - headers already sent by that i get when i query my rest web-service built with php











I've built a web-service with framework CakePHP. when i query the service it does return the expected content but, it also gives me an error: Warning (2): Cannot modify header information - headers already sent by. What is this and how can i resolve this?


Answer



Could be that you try to set headers using header function after some of the content is already sent.


java - How to merge contents of an array?





For example, If I have an array



String[] myStringArray = new String[]{"x", "a", "r", "y"};


How do I make a singular string that is "xary"


Answer



String[] myStringArray = new String[]{"x", "a", "r", "y"};
StringBuilder builder = new StringBuilder();
for(String s:myStringArray)

builder.append(s);

System.out.println(builder );

What are the differences between "=" and "



What are the differences between the assignment operators = and <- in R?




I know that operators are slightly different, as this example shows



x <- y <- 5
x = y = 5
x = y <- 5
x <- y = 5
# Error in (x <- y) = 5 : could not find function "<-<-"



But is this the only difference?


Answer




What are the differences between the assignment operators = and <- in R?




As your example shows, = and <- have slightly different operator precedence (which determines the order of evaluation when they are mixed in the same expression). In fact, ?Syntax in R gives the following operator precedence table, from highest to lowest:






‘-> ->>’ rightwards assignment
‘<- <<-’ assignment (right to left)
‘=’ assignment (right to left)




But is this the only difference?



Since you were asking about the assignment operators: yes, that is the only difference. However, you would be forgiven for believing otherwise. Even the R documentation of ?assignOps claims that there are more differences:





The operator <- can be used anywhere,
whereas the operator = is only allowed at the top level (e.g.,
in the complete expression typed at the command prompt) or as one
of the subexpressions in a braced list of expressions.




Let’s not put too fine a point on it: the R documentation is (subtly) wrong [1]. This is easy to show: we just need to find a counter-example of the = operator that isn’t (a) at the top level, nor (b) a subexpression in a braced list of expressions (i.e. {…; …}). — Without further ado:




x
# Error: object 'x' not found
sum((x = 1), 2)
# [1] 3
x
# [1] 1


Clearly we’ve performed an assignment, using =, outside of contexts (a) and (b). So, why has the documentation of a core R language feature been wrong for decades?




It’s because in R’s syntax the symbol = has two distinct meanings that get routinely conflated:




  1. The first meaning is as an assignment operator. This is all we’ve talked about so far.

  2. The second meaning isn’t an operator but rather a syntax token that signals named argument passing in a function call. Unlike the = operator it performs no action at runtime, it merely changes the way an expression is parsed.



Let’s see.



In any piece of code of the general form …




‹function_name›(‹argname› = ‹value›, …)
‹function_name›(‹args›, ‹argname› = ‹value›, …)


… the = is the token that defines named argument passing: it is not the assignment operator. Furthermore, = is entirely forbidden in some syntactic contexts:



if (‹var› = ‹value›) …
while (‹var› = ‹value›) …
for (‹var› = ‹value› in ‹value2›) …
for (‹var1› in ‹var2› = ‹value›) …



Any of these will raise an error “unexpected '=' in ‹bla›”.



In any other context, = refers to the assignment operator call. In particular, merely putting parentheses around the subexpression makes any of the above (a) valid, and (b) an assignment. For instance, the following performs assignment:



median((x = 1 : 10))


But also:




if (! (nf = length(from))) return()


Now you might object that such code is atrocious (and you may be right). But I took this code from the base::file.copy function (replacing <- with =) — it’s a pervasive pattern in much of the core R codebase.



The original explanation by John Chambers, which the the R documentation is probably based on, actually explains this correctly:




[= assignment is] allowed in only two places in the grammar: at the top level (as a complete program or user-typed expression); and when isolated from surrounding logical structure, by braces or an extra pair of parentheses.








A confession: I lied earlier. There is one additional difference between the = and <- operators: they call distinct functions. By default these functions do the same thing but you can override either of them separately to change the behaviour. By contrast, <- and -> (left-to-right assignment), though syntactically distinct, always call the same function. Overriding one also overrides the other. Knowing this is rarely practical but it can be used for some fun shenanigans.


performance - Tactics for using PHP in a high-load site




Before you answer this I have never developed anything popular enough to attain high server loads. Treat me as (sigh) an alien that has just landed on the planet, albeit one that knows PHP and a few optimisation techniques.






I'm developing a tool in PHP that could attain quite a lot of users, if it works out right. However while I'm fully capable of developing the program I'm pretty much clueless when it comes to making something that can deal with huge traffic. So here's a few questions on it (feel free to turn this question into a resource thread as well).



Databases



At the moment I plan to use the MySQLi features in PHP5. However how should I setup the databases in relation to users and content? Do I actually need multiple databases? At the moment everything's jumbled into one database - although I've been considering spreading user data to one, actual content to another and finally core site content (template masters etc.) to another. My reasoning behind this is that sending queries to different databases will ease up the load on them as one database = 3 load sources. Also would this still be effective if they were all on the same server?




Caching



I have a template system that is used to build the pages and swap out variables. Master templates are stored in the database and each time a template is called it's cached copy (a html document) is called. At the moment I have two types of variable in these templates - a static var and a dynamic var. Static vars are usually things like page names, the name of the site - things that don't change often; dynamic vars are things that change on each page load.



My question on this:



Say I have comments on different articles. Which is a better solution: store the simple comment template and render comments (from a DB call) each time the page is loaded or store a cached copy of the comments page as a html page - each time a comment is added/edited/deleted the page is recached.



Finally




Does anyone have any tips/pointers for running a high load site on PHP. I'm pretty sure it's a workable language to use - Facebook and Yahoo! give it great precedence - but are there any experiences I should watch out for?


Answer



No two sites are alike. You really need to get a tool like jmeter and benchmark to see where your problem points will be. You can spend a lot of time guessing and improving, but you won't see real results until you measure and compare your changes.



For example, for many years, the MySQL query cache was the solution to all of our performance problems. If your site was slow, MySQL experts suggested turning the query cache on. It turns out that if you have a high write load, the cache is actually crippling. If you turned it on without testing, you'd never know.



And don't forget that you are never done scaling. A site that handles 10req/s will need changes to support 1000req/s. And if you're lucking enough to need to support 10,000req/s, your architecture will probably look completely different as well.







  • Don't use MySQLi -- PDO is the 'modern' OO database access layer. The most important feature to use is placeholders in your queries. It's smart enough to use server side prepares and other optimizations for you as well.

  • You probably don't want to break your database up at this point. If you do find that one database isn't cutting, there are several techniques to scale up, depending on your app. Replicating to additional servers typically works well if you have more reads than writes. Sharding is a technique to split your data over many machines.






  • You probably don't want to cache in your database. The database is typically your bottleneck, so adding more IO's to it is typically a bad thing. There are several PHP caches out there that accomplish similar things like APC and Zend.


  • Measure your system with caching on and off. I bet your cache is heavier than serving the pages straight.

  • If it takes a long time to build your comments and article data from the db, integrate memcache into your system. You can cache the query results and store them in a memcached instance. It's important to remember that retrieving the data from memcache must be faster than assembling it from the database to see any benefit.

  • If your articles aren't dynamic, or you have simple dynamic changes after it's generated, consider writing out html or php to the disk. You could have an index.php page that looks on disk for the article, if it's there, it streams it to the client. If it isn't, it generates the article, writes it to the disk and sends it to the client. Deleting files from the disk would cause pages to be re-written. If a comment is added to an article, delete the cached copy -- it would be regenerated.


plot explanation - Why did Peaches&#39; mom hang on the tree? - Movies &amp; TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...