c++ encryption with rotation

I’m having some issues in creating a function that encrypts a word using a rotation number the user inputs. Here is what I have so far:

string encryptWord(string word, int num)
  string newWord;
  newWord = word;
  for(int i = 0; i < word.length(); i++)
      newWord[i] = tolower(word[i]);
      if((word[i] >= 'a') && (word[i] <= 'z'))
          newWord[i] = word[i] + (num % 26);
          if(newWord[i] > 'z')
            newWord[i] = newWord[i] - 26;

  return newWord;


now in my main when I test it out with

cout << encryptWord("xyz", 6);

the output I get is: de

Similarly, for decryption I have

string decryptRotWord(string word, int num)
  string newWord;
  num = num % 26;
  int index;
  for(int i = 0; i < word[i]; i++)
      newWord[i] = tolower(word[i]);
      if(word[i] >= 'a' && word[i] <= 'z')
          index = word[i] - num;
          if(index < 'a')
              index = index + 26;
          newWord[i] = index;
  return newWord;


read more

Testing 7-Zip archives from a python script

So I’ve got a python script that, at it’s core, makes .7z archives of selected directories for the purpose of backing up data. For simplicty sake I’ve simply invoked 7-zip through the windows command line, like so:

def runcompressor(target, contents):
print("Compressing {}...".format(contents))
archive = currentmodule
archive += "{}\\{}.7z".format(target, target)
os.system('7z u "{}" "{}" -mx=9 -mmt=on -ssw -up1q0r2x2y2z1w2'.format(archive, contents))

Which creates a new archive if one doesn’t exist and updates the old one if it does, but if something goes wrong the archive will be corrupted, and if this command hits an existing, corrupted archive, it just gives up. Now 7zip has a command for testing the integrity of an archive, but the documentation says nothing about giving an output, and then comes the trouble of capturing that output in python.

read more

Whats the reason for my app is getting force closed every single time?

im trying to make a music application and just made my listview of songs list and its getting force closed. i have mentioned the user permissions for reading the external storage then also… here’s the code

package com.smp.ravirathore.music;
import android.graphics.Typeface;
import android.os.Environment;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import java.io.File;
import java.util.ArrayList;

public class FileList extends AppCompatActivity {

TextView text_list;
ImageView backimg;
ListView listsongs;
String[] genuinesongs;

protected void onCreate(Bundle savedInstanceState) {
    backimg = (ImageView) findViewById(R.id.imageView);
    text_list = (TextView) findViewById(R.id.text_list);
    listsongs = (ListView) findViewById(R.id.list_songs);
    Typeface font = Typeface.createFromAsset(getAssets(), "journal.ttf");
    ArrayList<File> songs = find(Environment.getExternalStorageDirectory());
    genuinesongs = new String[songs.size()];
    for (int i = 0; i <= songs.size(); i++) {

        genuinesongs[i] = songs.get(i).getName().toString().replace("mp3","");
   ArrayAdapter<String> adp = new ArrayAdapter<String>(getApplicationContext(),R.layout.activity_file_list,
   R.id.text_list, genuinesongs);

public ArrayList<File> find(File root){
    ArrayList<File> arrayList = new ArrayList<File>();
    File[] files = root.listFiles();
    for(File single : files){
        if(single.isDirectory() && !single.isHidden()){
            if(single.getName().endsWith(".mp3") || single.getName().endsWith(".wav")){

    return arrayList;

public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.menu_file_list, menu);
    return true;

public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();

    //noinspection SimplifiableIfStatement
    if (id == R.id.action_settings) {
        return true;

    return super.onOptionsItemSelected(item);

read more

What is social marketing? SEO blog provides tips, tricks, and advice for improving websites and doing better search, social, content, and brand digital marketing 2017