text:
Q: Update Room Database I am trying to update Notes in the room database in My UpdateActivity But it does not update in the database it does not give an error(Works fine) but does not update data in database.
Here is UpdateActivity.
My log value gives the correct result that I typed in EditText But did not update in the Database.
package com.example.keepnotes;

import static android.content.ContentValues.TAG;

import android.os.Bundle;
import android.util.Log;
import android.widget.Button;
import android.widget.EditText;

import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;

import java.util.Objects;

public class UpdateActivity extends AppCompatActivity {

    DatabaseHelper databaseHelper;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_update);

        Toolbar toolbar_add = findViewById(R.id.toolbar_update_activity);
        setSupportActionBar(toolbar_add);
        Objects.requireNonNull(getSupportActionBar()).setDisplayHomeAsUpEnabled(true);
        toolbar_add.setNavigationIcon(R.drawable.back_button);
        toolbar_add.setNavigationOnClickListener(view -> onBackPressed());

        EditText title = findViewById(R.id.update_activity_title);
        EditText text = findViewById(R.id.update_activity_text);
        Button updateBtn = findViewById(R.id.Update_button);
        databaseHelper = DatabaseHelper.getDatabase(UpdateActivity.this);

        String titleText = "";
        String bodyText = "";

        Bundle extras = getIntent().getExtras();
        if (extras != null) {
            titleText = extras.getString("title");
            bodyText = extras.getString("text");
        }
        title.setText(titleText);
        text.setText(bodyText);
        updateBtn.setText(R.string.update);

        Notes notes = new Notes(titleText,bodyText);

        updateBtn.setOnClickListener(view -> {
            notes.setTitle(title.getText().toString());
            notes.setText(text.getText().toString());
            databaseHelper.notesDao().updateNotes(notes);
            Log.d(TAG, "onCreate: " + notes.title + notes.text);
            finish();
        });

    }
}

I think there is any problem in initializing Notes
Notes notes = new Notes(titleText,bodyText);

I initialized like this in my activity.
here is Notes class.
package com.example.keepnotes;

import androidx.room.ColumnInfo;
import androidx.room.Entity;
import androidx.room.Ignore;
import androidx.room.PrimaryKey;

@Entity(tableName = "notesTable")
public class Notes {

    @PrimaryKey(autoGenerate = true)
    public int id;

    @ColumnInfo(name = "title")
    public String title;

    @ColumnInfo(name = "text")
    public String text;

    Notes(int id, String title, String text) {
        this.id = id;
        this.text = text;
        this.title = title;
    }

    @Ignore
    Notes(String title, String text) {
        this.text = text;
        this.title = title;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }
}

here is NotesDao class
    package com.example.keepnotes;

import androidx.lifecycle.LiveData;
import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.Query;
import androidx.room.Update;

import java.util.List;

@Dao
public interface NotesDao {

    @Query("SELECT * FROM notesTable")
    List<Notes> getAllNotes();

    @Query("SELECT * FROM notesTable")
    LiveData<List<Notes>> findAllNotes();

    @Insert
    void addNotes(Notes note);

    @Update
    void updateNotes(Notes note);

    @Delete
    void deleteNotes(Notes note);

}

How can I resolve this?

A: As mentioned in the comments, you will need the primary key (probably an integral id) of the Notes entry you want to update.
It looks like you are using putExtra to pass information about an existing Notes object that lives in a different Activity. If that existing Notes object (call it noteToUpdate) was retrieved from the database, it should contain the primary key you need. You can add another key/value pair to the Intent in the original Activity with something like putExtra("id", noteToUpdate.id). Then, in the UpdateActivity, you can use something along the lines of noteId = extras.getString("id") to retrieve the id.
Once you have this noteId, you can replace Notes notes = new Notes(titleText, bodyText); with a call to a constructor that accepts an id. Alternatively, you could write something like notes.setId(noteId) after the object is constructed. With the primary key now set correctly, the updateNotes call should work.
Edit: if I misinterpreted your comments and there is no id field (or similar), please share the Notes entity structure and primary key.

A: There are two main ways to update with Room via an @Dao annotated interface or abstract class. You can use the convenience update method which is used by using the @Update annotation. The other way is to use an UPADTE SQL statement.

Using @Update
If you use the @Update annotated function then you pass the object to be updated to the function. Room then builds the UPDATE SQL on your behalf. However to ensure that the correct row(s) in the database are updated and not all rows (which could be a disaster), Room uses the value of the field(s) that make up the primary key (the field annotated with @PrimaryKey or fields using the primaryKeys parameter in the @Entity annotation).
The likely cause of your issue is that neither the titleText nor the bodyText are, or together form, the primary key and as such the primary key is a default value (very often 0 either explicitly or implicitly if the primary key is a java primitive such as long or int) and as such there is no row with such an id to be updated. In which case nothing is updated which is not an error as far as SQLite is concerned.
So if you have
@Update
void update(Notes note);

Then the generated SQL will be something like
UPDATE notes SET titleText='the_value_extracted_from_the_titleText_field_of_the_passed_Notes_object', bodyText = 'the_value_extracted_from_the_bodyText_field_of_the_passed_Notes_object' WHERE the_primaryKeyField='the_value_from_the_primaryKeyFields_of_the_passed_Notes_object'

*

*where the_value_from_the.... is an explanation of the value not the actual value.

If this is the issue then to use the @Update convenience method you need to set the field or fields that form or forms the primary key. e.g. notes.setId(the_respective_id); before doing the update.
The convenience method will also returns an integer that will have the number of rows that have been updated.
So if you have
@Update
int update(Notes note);

and then use :-
if (databaseHelper.notesDao().updateNotes(notes) > 0) {
    .... do something here if you want to indicate successful update
} else {
    .... do something here if you want to indicate that nothing was updated
}

Using @Query
An alternative approach could be to use the second method, i.e. supply your own UPDATE statement via an @Query such as:-
@Query("UPDATE notes SET titleText=:newTitleText, bodyText=:newBodyText WHERE titleText=:originalTitleText AND bodyText=:originalBodyText;")
void update(String newTitleText, String newBodyText, String originalTitleText, String originalBodyText);

*

*where original.... would be the values as obtained from the intent extras.

*IMPORTANT NOTES

*

*If the combination of the originalTitleText and originalBodyText values is not unique then multiple rows would be updated.

*If you know that titleText would be a unique value for every row then you could just use WHERE titleText="originalTitleText

*A primary Key MUST be unique and therefore why using the primary is recommended for the WHERE clause of the UPDATE.

*

*of course you could make the other columns or combinations have a unique index but that is beyond the cope.

*There is an exception (known SQLite feature/bug), that Room doesn't allow to be used in that NULL is considered a unique value but the use of IS NULL will indicate any NULL and likewise IS NOT NULL will indicate no NULLs

*The number of updated rows is not returned using this method


text:
Q: How can I automatically deploy my app after a git push on multiple servers I have a system written in PHP, running on various clients over a VPN. The code is versioned in Bitbucket.
I would like a solution to automate the process in all these clients, manually is becoming unviable.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Do python files need to be on the same drive as the plugin Python-mode for its functionality to work I'm using the plugin python-mode for gVim on a windows machine.
I have the following python-mode specific settings in my vimrc file:
"------------------------------------------------------------
" settings for Python-mode
" "-----------------------------------------------------------
map <Leader>g :call RopeGotoDefinition()<CR>
let ropevim_enable_shortcuts = 1
let g:pymode_rope_goto_def_newwin = "vnew"
let g:pymode_rope_extended_complete = 1
let g:pymode_breakpoint = 0
let g:pymode_syntax = 1
let g:pymode_syntax_builtin_objs = 0
let g:pymode_syntax_builtin_funcs = 0
map <Leader>b Oimport ipdb; ipdb.set_trace() # BREAKPOINT<C-c>

"Better navigating through omnicomplete option list
set completeopt=longest,menuone
function! OmniPopup(action)
    if pumvisible()
        if a:action == 'j'
            return "\<C-N>"
        elseif a:action == 'k'
            return "\<C-P>"
        endif
    endif
        return a:action
endfunction

inoremap <silent><C-j> <C-R>=OmniPopup('j')<CR>
inoremap <silent><C-k> <C-R>=OmniPopup('k')<CR>

These were suggested in this tutorial.
vimrc is on my M: drive.
Now if I open vim (set to open in the M: drive) and then open a python file on say the P: drive and then try to save that file I get the following error message:

If I move the file pi.py to the M: drive then everything is happy but surely to use files in vim it shouldn't be a condition that the file being edited is on the same drive as vim?
Can I change my settings for Python-mode to function on files from other drives?

EDIT
Python-mode has the following setting which looks promising:

" Additional python paths
  let g:pymode_paths = []

So in vimrc I've added
let g:pymode_paths = ['P:\Comp Apps\Python\']
But still if I open a .py file from that location i get the same error message.

A: If I execute :lcd %:p:h then the python-mode plugin seems to be working. I can also use set autochdir in my vimrc: not sure if there are any disadvantages to using this setting.


text:
Q: 'Add GRASS vector layer' button in QGIS 2.16.2 with GRASS 7.0.4? I could not find 'Add GRASS vector layer' button in QGis 2.16.2 with GRASS 7.0.4?
Can someone help?

A: I think that button has been depreciated for some time. You can follow the instructions described in:

*

*Loading GRASS raster and vector layers

*Importing data into a GRASS LOCATION via drag and drop


text:
Q: Getting error trying to run script with SQLTools I tryed to use the SqlTools extansion for VSCorde and wanted to run the script with it and gives me this erros (I'm using github codespaces)
[1674681282366] INFO  (ext): EXECUTING COMMAND => sqltools.getConnections
[1674681282367] INFO  (ls): REQUEST RECEIVED => connection/GetConnectionsRequest
[1674681282368] INFO  (ls): REQUEST RECEIVED => connection/GetConnectionsRequest
[1674681282369] INFO  (ls): REQUEST RECEIVED => connection/GetConnectionsRequest
[1674681284190] INFO  (ext): EXECUTING COMMAND => sqltools.getConnections
[1674681284191] INFO  (ls): REQUEST RECEIVED => connection/GetConnectionsRequest
[1674681284191] INFO  (ls): REQUEST RECEIVED => connection/ConnectRequest
[1674681284192] INFO  (ls): Connection instance created for panel.
    ns: "conn-manager"
[1674681284193] ERROR (ls): {"code":-1,"data":{"driver":"MySQL","driverOptions":{"mysqlOptions":{"authProtocol":"default"}}},"name":"Error"}
    ns: "conn"
[1674681284193] ERROR (ls): Connecting error: {"code":-1,"data":{"driver":"MySQL","driverOptions":{"mysqlOptions":{"authProtocol":"default"}}},"name":"Error"}
    ns: "conn-manager"
[1674681284193] ERROR (ls): Open connection error
    ns: "conn-manager"
[1674681284194] ERROR (ext): ERROR: Error fetching records. connect ECONNREFUSED 127.0.0.1:3306, {"code":-1,"data":{"driver":"MySQL","driverOptions":{"mysqlOptions":{"authProtocol":"default"}}}}
    ns: "error-handler"```


text: Q: PCM Audio file and volume I'm working with raw pcm files(with no headers) and I was wondering, does anyone know the calculation to find the current volume of a section of sound? I have all the information on the file, such as the sample rate, channels, bits per sample, etc. I figure there must be some type of equation.


text:
Q: Why Ubuntu 2204 hangs on first run? After installing Ubuntu 22.04 Completes, it reboots and before the ubuntu logo appears, the system stops. I tried to install in every way possible with no positive results.
I boot live session and start Gparted. The partition that corresponds to EFI presents this warning:  "Unable to read the contents of this file system!
Because of this some operations may be unavailable.
The cause might be a missing software package.
The following list of software packages is required for fat32 file system support:  dosfstools, mtools. ".   This is a BIOS machine, core i7, 8GB RAM, hdd 1TB, Gforce g600. Thanks a lot for your help.


text:
Q: Compile java to object files compatible with C/C++ So I am working(actually still planning) on a GUI project, and I need control over every single pixel on the window. I have done a lot of Java and I know how to do that, the problem is that I want to do all the logic on C++(because I just love how it works) and I don't even know how to  setup a GUI in C++(I already took a small look at Qt, but I haven't done anything great).
So I had this idea of writing all the GUI related things in Java and somehow compile java source files to object files that can be linked with the rest of C++ code. This is just a personal project I am working on so I don't care if I lose the cross-compatibility of Java.
Thanks to anyone who took time to read this.

A: Look into JNI. Years ago, when doing the game of life in programming class, I chose to have a C function do the pixel work, just like you are thinking of, because it, ahem, back then, made the graphics work run many times faster. Noticeably, back then anyway.

*

*Write the Java Program and Compile

*Generate header file from java class

*Write the C Program

*Generate Shared Library File

*Run Java Program

Here's one of probably many resources to show you.


text:
Q: How to add / remove validators in a substrate network I would like to add / remove validators from an already existing substrate private network.
Following the tutorial for starting aprivate network, I was able to create a raw customSpec and start a new chain with the validators.
However, I am not sure how to add new / remove old validators to the network. So these are the steps I tried:

*

*edit customSpecs.json to desired validators

*build new raw_customSpecs.json

*restart node with new raw_customSpecs.json

*use the hex code in the new raw_customSpecs to upgrade the runtime with sudo via polkadotjs, similar to the given example.

I would like to get some pointers as to how to do this properly because I am still unable to set new validators with the steps I have taken.
Thanks!

A: You have various ways to add/remove validators. Using chain-spec is one of them, but you are on the wrong path trying to apply a runtime upgrade with the spec. A runtime upgrade will typically only update one storage item, :code, which is the code of your runtime. On the other hand, your validators are stored in other storage items in the pallet_staking and pallet_session module. So indeed applying the runtime upgrade will not get you anywhere.
Indeed, if you are fine with restarting your node, you can alter the initial validators and run your chain again, after you have updated your step 1:

edit customSpecs.json to desired validators

To do it on the fly, you need to look into how staking pallet is working. You can bond new accounts and if the ValidatorCount is more than the current number of validators, the next election round will elect the new account. Of course, a node with the private key of this newly bonded account must be present in the network for everything to work well. You can use sudo to increase ValidatorCount.


text:
Q: Exclude an .erb asset from cache in rails I have an assets, projects.css.scss.erb, like this :
<% Project.all.each do |project| %>
  $color: <%= project.color %>;
  #project-<%= project.id %> {
    .carousel {
      border-color: $color;
    }
  }
<% end %>

Its goal is to generate as many projects specific css directives as projects count. This assets is include in my application.css.scss with a require directive.
All works fine !
But problem comes when i add a new project or when i change a project's color... Rails doesn't compile the asset anymore because the source has no changes...
I'm looking for a solution to force rails to always recompile projects.css.scss.erb or to exclude it from the sprockets cache...
Someone knows a solution ??
UPDATE
Another way could be recompile projects.css.scss.erb only when a new project is created or a project is modify.


text:
Q: Where can I get trained in Speech? I want to increase my speech skill in Skyrim so that I can sell any item to any merchant.
Where can I find someone who will train me in the Speech skill?

A: There are many places all over the world of Skyrim where you can be taught speech.
Information about speech can be found on the wiki here.
One of the methods of gaining speech as written on the wiki:

Method Two
During the Dark Brotherhood quest, "Recipe for Disaster", Anton Virane (the Chef of the Understone Keep in Markarth) can be intimidated repeatedly to level Speech. This can be accomplished by:

*

*When talking with him, after saying "For the Dark Brotherhood, that can be easily arranged. (Intimidate)", he will respond "The Dark Brotherhood?".

*If the conversation is immediately exited, the Dragonborn can begin to talk to him again and quickly skip through most of the conversation.

*Exiting the conversation at the same time as before increases Speech.
This can be repeated forever.

Check that wiki page though, too much to explain here, it shows EVERYTHING on it.
Speech Trainers
Adept --- Dro'marash --- Khajiit Caravans (Travels between Riften and Dawnstar)
Adept --- Revyn Sadri --- Sadri's Used Wares in Windhelm
Adept --- Ronthil --- Castle Volkihar (Only available with The Elder Scrolls V: Dawnguard)
Expert --- Ogmund --- Markarth  (Can be found in the Silver-Blood Inn)
Master --- Giraud Gemane --- Bards College in Solitude


text:
Q: Check the validity of the following argument
According to my studies, an argument is considered valid if and only if the conjunction of the premises implies the conclusion.
i.e $$p(p \to [q \to (r \to s)]) \to s$$ is a tautology.
One way to do this is to show that the above function can be reduced to 1 with standard simplifications
please see my working out in the attached picture. I managed to reduce this function to 1 and thus the argument should be valid, however the answers says that the argument is invalid.
If I am wrong, then why am I able to reduce this function to 1?
If I am correct, please let me know
my solution:

A: Consider the counter example $p=1$ and $q=r=s=0$
\begin{align}
f=&p(p\to(q'+r'+s))\to s\\
=&1(1\to(0'+0'+0))\to 0\\
=&1(1\to1)\to 0\\
=&1\to0=0
\end{align}

If I am wrong, then why am I able to reduce this function to $1$ ?

The problem is your last step, $(p'+p)(p'+qrs')+s$ does not equivalent to $1$. Instead apply Negation law indeed $(p'+p)=1$, and by Identity law it's $(p'+qrs')+s$.
\begin{align}
f=&p(p\to(q'+r'+s))\to s\\
=&p'+(p'+q'+r'+s)'+s\\
=&p'+pqrs'+s\\
=&\underline{(p'+p)}(p'+qrs')+s\\
=&\underline{(1)}(p'+qrs')+s\neq1
\end{align}


text:
Q: Kendo grid's Select command operation configuration Among Edit and Destroy, Kendo grid has a Select command too. But it seems there's no configuration for this operation. Do you know how can I use it? Any better way of JS binding like custom commands? Notice that it doesn't have a click event.
This line is in my Kendo grid, columns section.
columns.Command(command => { command.Select(); command.Edit(); command.Destroy(); });

A: Well, I found no better way than using a custom command.
Custom command inside grid:
command.Custom("select").Text("Select").Click("select");

and JS handler code:
<script>
    function select(e) {
        var grid = $("#grid").data("kendoGrid");
        var item = grid.dataItem(grid.select());
        var data = item.Title;
        alert(data);
    }
</script>

A: Another way to call this will be:
  function select(e){
    var row = $(e.currentTarget).closest("tr");
    var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
    alert(dataItem.Title);
 }


text:
Q: CryptoJs AES Decryption Error: Malformed UTF-8 data in Nativescript-Angular I got an error while decrypting the encrypted data. My goal is to encrypt a pdf file in PHP and decrypt it in nativescript to display the pdf natively in the app. I'm posting this as a last resort because I've read similar posts regarding my issue but none work for me. The data is encrypted in PHP using openssl and will be decrypted in nativescript using cryptoJs for AES decryption and jsrsasign for RSA decryption of the key and the IV. I pretty much appreciate anything that would help me. There might be something wrong with how I did it but I'm not sure what it is. Here's my progress so far.
Encryption in PHP (RSA+AES).

Already tested in decrypting the data successfully in PHP. So it's safe to assume that it can be decrypted.

$data = // Is a pdf file
//get public key
$publicKey = // API CALL to get the public key
// get mime type of file
$dataFormat['docMimeType'] = "application/json";
// compute the hash of the file before encryption
$dataFormat['hash'] = hash('sha256', $data);
// generate random two 16 bytes long encryption key
$secretKey1 = openssl_random_pseudo_bytes(16);
$secretKey2 = openssl_random_pseudo_bytes(16);
// concatenate the two key to make the 32 bytes long AES encryption key
$secretKey = $secretKey1.$secretKey2;

// RSA Encryption of the keys and IV
// encrypt the aes encryption key with the public key
openssl_public_encrypt($secretKey1, $dataFormat['key1'], $publicKey, OPENSSL_PKCS1_OAEP_PADDING);
openssl_public_encrypt($secretKey2, $dataFormat['key2'], $publicKey, OPENSSL_PKCS1_OAEP_PADDING);
// Encoding the encrypted keys to base64
$dataFormat['key1'] = base64_encode($dataFormat['key1']);
$dataFormat['key2'] = base64_encode($dataFormat['key2']);

// AES Encryption
// generate random iv
$iv = openssl_random_pseudo_bytes(16);
// encrypt iv with the public key
openssl_public_encrypt($iv, $dataFormat['iv'], $publicKey, OPENSSL_PKCS1_OAEP_PADDING);
$dataFormat['iv'] = base64_encode($dataFormat['iv']);
// Manually doing the padding - Zero padding
$pad = 32 - (strlen($data) % 32);
$clear = $data . str_repeat(chr(0), $pad);

// encrypt the data with the aes encryption key
$dataFormat['doc'] = openssl_encrypt($clear, 'AES-256-CBC', $secretKey, OPENSSL_RAW_DATA|OPENSSL_ZERO_PADDING, $iv);
$dataFormat['doc'] = base64_encode($dataFormat['doc']);

// save file to the cloud which will then be fetch by the app in nativescript for decryption
// save cipher
file_put_contents($cipherfile, json_encode($dataFormat));
// $cipherfile is the .enc file that will be uploaded to the cloud

Sample pkcs#8 private key in pem format
-----BEGIN PRIVATE KEY-----
MIIJQgIBADANBgkqhkiG9w0BAQEFAASCCSwwggkoAgEAAoICAQCuLqpkKI65J7wd
e+UfjDf3B9iCwJbqZ5B4b68q+e6yZbYapi8KZT3E71KNxZXe0sMuBXM4XhlmjSMr
a5PM8FiXxQ5u1+1BAuRjyiWF13IVYPctedel4h9nPONdQ9xi7tTR4Ez+YtpJ3xbi
IGuvMQ8VblUCEIJskMhljei9hT2ioJ/xZ5IGwrntA2QUtxXUBaKv0hNlJSXTlfsW
9lzGfBl7USRD9fjb+6PJntFurkb3PEgskI4y667Ias5IYKhjxl2xfXjaZ1WzB/Xt
7RGsucLEJwevx8W4xYiOyzluM2Bh4vPLBHjpFTd0zcXdQCXoO0jXAHbdey1jX9M+
AQ2JdhFMfUd2neTgTDuB7G3zL4F+nn33P1k931AVPmCDasGQdoGJpSjo4meowLLP
1S7bQlxBUede8f9Jb0vKVd1Rr7WTVLnj8vOJR1H9f4K93hxbepaGXQMQM051snKf
nvDSE1I6tLDFHf2Jzo7rG6DDKAckcwlNJaPgLzjyMu7jaqs5x877r7L9mTPlgFYZ
QLpSy0eHtxNkpJL6hhSeovGgk3VeHsJjDwGxdqhqy4xGgH8m5jHcb4L4RFkyo4rh
MRDNLGVFvR0gMD0XVXPLKc6lCni+kndyJalAGAxUCKhUj9jd8JEjh46QU0WilOdK
2iIgA0gCSQg/3IwgHBKCTwuaWCXmnQIDAQABAoICADTmd1lz9+TD7J4Hws6SB20/
NMKBO1R1n6r0QH8M6THFMkllr2O428mz5Z6pI5tI535SqWu1KIG827GUOo9Db6So
dHm1mpjkB/lGq566kCtuB6QIHTaENoVkOKlastRZNMmJFdksrJ9C4fBLaGkMvUgE
+kxmNzZBwpsVPlpQ3SdHIUxv6CmlelJBdWPVNwvtqjs70igl4Bcitd+DcynVBugs
/JanXa1x/4x8b57tzx/HbyQZwxYz/iFgTsYslPe4hzwgn1O1jpGRGV/pYDTVNhHc
yLjaM3Kqi47Sqd6OO/d+tgwyj4Y6q10OIcnQcbLWToj92xvpDR/hOobaSwI0mYvg
rgZ3siie4zZgQLem3L0E4wECqSQcGft1STIs2LtjfZz4gabSLLXs2XGhOEy8vqo4
mbhzKubpv/MGBS9CELyqRaPabkLgwclWXxr1K79NDLeiYWnMgJbVftc8fUA28Xw0
vbBQHkLwR039ZEO/1rXk94frlzzLWWCpgfflqgjtG50bURVEvLHKTgV4pKbgPdSq
K/bguv6csFTitlGuzFJFee+p/aGc4Ank35/qG3W+fhPRybnA8OQgD9ESDIL/14Iz
/LR1wQPCVIPqIyffRETkVS4sNPvOzvbb7jf5m/DaNZcAicZHUFdahdCVjNT6GRYH
KfLNzZ3IbHfn044j1ZgBAoIBAQDnxHJYv024YVY9x889lkYqpbGC3Sr8ONNM7AhE
3dmyekmjvswEAybi+VvVXFGBa1E13hECI44ZU6gOhPxPfA0jgB01GkbpP0oJATXu
2u3hxHKxlusgI60u3y4GDJMs2lT1W7WUtTE4Kdf2azoOcxjYEmBZlnvcVekNNmrA
8pRurf9BxgrgZt+1YKjIVgHiYDNJyc5fU00FhAonZdXwlQqYQAWwzT9yeQx+TTt0
JmDO1UTohHn4PkgisrCX94GI/q5Kj6lyadi4uySq3+Hq9PsomqcUp9GKCkLV1VSH
Vj1ET+mvkq+ryBlw694XmwfhBWfo2o34cro6hC18FJKi8Js1AoIBAQDAZOE2bMVk
x8muw3dluIv7QLyb1vHkwv4/mDExRfl9U8wRe9G0+9zoOku7yORw8uf9h3BX8Z8V
Q35lFCZc7qI+XdA0+Pw02wIsubGnjiEi9JbEnjNNEM+jZmsSdFbsahG0tbdIEPMn
Iz62QrD4T9sYUopj7z0w2jz4AHqfaDN0pWHLK7S0dD6ADe5ToaWho/ldo7VjEFrh
6n0wfsU4TcqnRzzNkiKnJdCoFQA42z7Cu9eHb/CT/nPAYdjokGG0WJJcV3BUmOJg
Ua0ZLryBuaBRp9+gmtixQ9isLHezeDQkw3lacYAgM+F9VJgI8LvaDbbFbSe1LJfP
UJc9AQl3AyLJAoIBAQClSTILHJM+1Rv9/0tKrqrnqzcHDtei/JuklgfnpRel8xQl
VOKGUgEfiZn2dVojI/fMpMwYbGbgpQqLIEgYH233TVyHDHBZ06rm9RgTecqAYesx
v2F7kDXn4X4fDkS/jg1c1cSPgxDQ7vZ3ZE0JFQg4wBI6kdlPb20+4PoNFHLK5AfQ
Tn5fPr53ybFU/hFl8hlhnCwzS2L4dgwPwM5sPr5Jig8E4btH1hAU2tt1oBEWMH5u
HFwnr7MeG7VZC0gz/P0ra3z6fYXzaHNj8Tpap8+eS3ywfGYxPdQgT31y7wvOdfdA
ISprJc8O+wduaj+aOJK8O3FYJ+mr5avSe5F/5nupAoIBAFTv9HF3ocm1Xje2ec7B
o6L/2ISgZ1hMMbzXrtgHAXcv+Ia7eECDdOpdWjQEI74trvfBxHo+5LGZg4KSW8Fp
ZN1Nw26vgYDAM3yVWnYTjFOHUcxp31IlmtWTkK+sBvgGd9yk4M6DFSXxLG2Akep+
LsbVId2usAASSRpf88LOWPElVkBBAl0seK9F9zKayanL33pUnO6oOMdGI5C2VtFd
npstGw3Sd1P9oNmjs95mBJYqIaPcaoSbsHR9fipmG4xoEe2MeL4QZNiLFnVoqbZH
whxqlZKs6f+QaWbRluL3rWWRmtCwDRWqceFH6HsB9Jz2svsEDqSwlDDlbm9zNr+A
9ekCggEASDc9pzs3bjDTCqOB1MhbDdDBj+9skp9saiOJmCyuhtoNerx8nEGRB3QM
mHRafusbE9gMwZ8zvnxz3SOxw/76xG8IMxVpVB0zyNSFYeB78jU7HsbORzDUDCae
0afeSikfTCz1WU9VsWsspUfsA3meApENK5eu9xFfVkqCXj/l/1pElrAFUK1uXGlN
P6XeOiE7rZr+tkwD8phPB0+5sUfaMH4+sB84rCU1vizinrxntslCay0WjGyCY8sc
ea0/rJmd9TmBU6JIi5oLyZuNqxYBn8qD0jvkg7g6AhH7/TcpLMDAINeh4Hkj84Lx
LFzA9Qx4EmEK73S8UTxk/9eDLFMhfA==
-----END PRIVATE KEY-----

Sample output (to work with): The content of the file will look something like this.
{
  "docMimeType": "application/json",
  "hash": "253cd9d4f849084f276c649a5155512c5b0bb68c8f7cbde33cc529f68c672168",
  "key1": "dxUYOfiIEchLeha/Hu3dUd6MzucwABf8/Q9eUPgJAhEhmjrsf1MXnXOtcPCNGE/8bXEU6Iv3XIcLjImhaFBF8aYoDbS6GjnhPMeGpRQN8+raXrfm/5J9rlRjUImSyZUUnwgJ7vkHP22F9I8rrZywA5QgHiK97vyp7y2cv1H9y2tT5kukrDxhvWWBHoii+V0pA0SCEviPrlWjopyL/SpiaUfoG/L97Rdg7k181c1pHR5S+dWRAy190aU/IFo7VZXQ6FuqWd0TyoOEeBoAwrxTXG+03OXs7qqZwlFdHtCZ6ehrUl8Kkcbbv7O2PBOFsHnla5c+7aSDQ69xCHXmzoxB+dTbu5OY0E8TFWLD6V8QVe2Y5q79Nybf9r56YZDX6sqKK5uZqJDQB9wQUWHhM5hE7mzP7Ll1IVC4sAml+k2qrwJqOaDDN0eUidR+X31LXDEO9+y3g6NrlsNTROttiF0jC1oKyN5y+OOwxx0OEntXYUsM1Z8iQ9QQBHL418EF/FoEwmTVcg/7Lg20Qdgp21mv0ihMmYssB0EmopzH9yQ6d4eEp4Wh5krO2Ph73zJx6RvjVu1JfkoMmZ8fxwlHs+Xe09WE828NCWTW2WheP63V+fQZ07nm9c/BcITCmiQ9376wYh3+Hj+o6/N+et1nf0vO9zbooUI+V3Hd/m0wUnBxm+s=",
  "key2": "stkiCTyRmKfU7OhGfsqQyvi2UZ2syRjAdD4Sk0N/x+JMYX2Dr5rlwV+EH5TG388uvoPH7NSalPrprF+Nlm+YEVhYS0E5SBXJiIEFixT5AIQ9rhAHD/WFfxjvHainhiHhoLcX5rQ6C0zGCNUZaH0X4I4v8r575rbklTqSgCs3ueGDX9mAQKj2q5eJMIfRh+mAwQq7lhTk4TbGxL6LAyWxYL+Zw4R5ljUl6uK0o5Vwpn7I2xdAIQs6J7jW6jDfMT+5mbk06nrba09ysKdJILe8je97SyBRR5y+OHfJF5EArTSKwnLrAp/DXE40DP8BHOheL/PNxoKzIEkOX0Cu3aAXmHR6SLJxtwKGEHn5tzUvBzx54h2K5iEh2C8Wvkqqi7m+DcmxnrjYKEjmP7jzUvSMIob7EBcJ+wHvE9s5aPCK1MbKqK1UbHHkHRHsk8tgZsv/PC8A0+wdlMKI30GL1B9wcck7Fottgnc1eGzdFjbnEirLHeihaJPJOjkjiz1RtkOQHgd6l9bzUTMUnCq0melgSlut68akgvGM7kTtHhEY27sHj8UGF5zjTS+KPYzpi17Wp/9TgWpETxXsewvtBP9oCl/L+ZhhUrRihZOctSgTzFTZpIyrlx9ZDg0A0MU/Q2AyhBU0r9dzowyApDUu/TWPdj2Z9p/DX7c0i5y4IK7TOX0=",
  "iv": "Y2RdcAtnid52Ueu2MDdh2bY1aJBysk2UTstPdCAILU+RqcZCtgp+f5kLlRweG7Kgst88oZrJy6B/33F2WMqQ1qx1AqK+WthG+gVg15YC50OGaKGNuBAFSdFCJli2MLIE4s8ItXH2VmgxkGGE3ETuz3b7fheUJOUpUKcc3Kz0HmZiyo5eXsB4lNSXsaTP5Z8kaQcHDfacu9UORF9RUM2tfUH4IzAkU3ENPEM4cTP27HFRsFAeuXAcNAAYUQws9HVQFtg9pXAyuN0GUzD4GksL/3M0Y8CvITewLQDRHSBSljspPtF+lFqS3ZQTxAbtqxjEf6/Q1dCP1CIeiXEi2it8GEKZzWhH7385qW383JIBk1b9HjT7+26w2s7AqpLSevK5iOis+4sHzqEix9MHsOUp4OEcQ+BAYFkYiFlmPeo4tNgg9sRuIrgQwaEvCgHG2IoboURqCRs6iRnS4j8dHyvG5acavSEm0ozouqt4KBVoZt/chq8hpxH123kRIeuZH1qTsmzfSInAJLKpW2ky+nLifjOrSCA1D7ZDpfykACa1PpP+I6LgjMkWoQ/zkd70hz28fD+tpDWBJPngDcxnCz8UbZRma9psVEsw/4IOWQr3yy+V4Y9+xllLzZLy1YbEcdewsh/FXjLkhWqic3uPPyNlLWqzpHqBqTvgpPwU31zyJks=",
  "doc": // data is too large to be included in the post. If you want to see the full version of the sample output I created a gist in github https://gist.github.com/ketuvin/cba7e7215dbdd67ea8b10050ecbbcd3f
}

In nativescript this file will then be fetched and will be processed from JSON to array. And will then be decrypted.
Decryption in Nativescript

import * as cryptoJs from "crypto-js"
import { KJUR, KEYUTIL } from "jsrsasign"

/**
  @params encryptedFile - the file to be decrypted
  @params pem - the pkcs#8 private key (cipher=aes-256-cbc)
*/
decryptFile(encryptedFile, pem) {
    // load key
    let privateKey = KEYUTIL.getKey(pem);

    // Base64 Decode using cryptoJs
    let key1 = cryptoJs.enc.Base64.parse(encryptedFile['key1']).toString();
    let key2 = cryptoJs.enc.Base64.parse(encryptedFile['key2']).toString();
    let iv = cryptoJs.enc.Base64.parse(encryptedFile['iv']).toString();
    let doc = cryptoJs.enc.Base64.parse(encryptedFile['doc']).toString();

    console.log("Base64 Decoded Key1: "+key1);
    console.log("Base64 Decoded Key2: "+key2);
    console.log("Base64 Decoded IV: "+iv);

    // RSA Decryption of the keys and IV using jsrsasign
    let decryptedKey1 = KJUR.crypto.Cipher.decrypt(key1, privateKey, "RSAOAEP");
    let decryptedKey2 = KJUR.crypto.Cipher.decrypt(key2, privateKey, "RSAOAEP");
    let decryptedIV = KJUR.crypto.Cipher.decrypt(iv, privateKey, "RSAOAEP");

    console.log("RSA Decrypted Key1: "+decryptedKey1);
    console.log("RSA Decrypted Key2: "+decryptedKey2);
    console.log("RSA Decrypted IV: "+decryptedIV);

    // Concatenate the keys to make up the AES key
    let decryptedKey = decryptedKey1 + decryptedKey2;

    console.log("AES KEY (Key1+Key2): "+decryptedKey);

    // Convert to wordarray
    let parsedkey = cryptoJs.enc.Utf8.parse(decryptedKey);
    let parsedIV = cryptoJs.enc.Utf8.parse(decryptedIV);

    // AES Decryption using crypto-js
    let decrypted = cryptoJs.AES.decrypt(doc, parsedkey, {
        iv: parsedIV,
        mode: cryptoJs.mode.CBC,
        padding: cryptoJs.pad.ZeroPadding
    }).toString(cryptoJs.enc.Utf8);  // Error: Malformed Utf-8 data

    return decrypted;
}

In console,
See actual log here

Base64 Decoded Key1: 0a5b90147517916c338fb8aa359d3f53a542eed1d482e42dd93eea0735a5d5a64dc219cdc703ba0a88cbf10b7feae82d2d4fe5a389f296cba8452b5e3371166c903aae2f64223f561821bb61f7be1ea41d96ac64d0e47da601041aef88ab9ded35c40240f7615e001f624b22966107539f98c499607e4b2760a162a963a854dffbfe955afec959b069101a49d1f765e729ff7035f0beb8ce06a1b3776a62f8c7db5b3efcfb1b0c1231f654e6aa075667621e99abbb6ba78a6fd81061c59de1024da81d2a8cc42dc84fa5af61c3d5b1a009cca2b4543e66974dce60f6631c490564be8494d0324fb1d7a8e7067feba5dd38653c936895247557e380e31e118af7a1886063e867acf58a3f63ab98bfa619b6a18518be68675a072d5a5217bc7ca4c5dba601ab7560e42dce1aadeca5a7fe0eba50f5d1c997eaf25d8dbbfded2cbea6402b121df8691f1673c243d1a8195e0af2a3b938fa271ecda93984ba9eef24912169ccabfd7a8f9fd2c4aa710e174f10d04914d7107c2a4fa54b463d002cc2347d4429604b2e1bb536a74f754f1f931362c90168e841ee05717e23323d627a938b582af62fb64c2d55442932517194eedf89d265523fe6f6ccdcd9c90fe5c76f9b3220c4a4fecfb4e84075167092b3971d52cfafba904f5b00ea14878df6b47bfbae29a97d1a4fa7caa995baddb6280f4939091fe2531d39b80759971d55ee
VM38 bundle.ad8287f8f3cbaa7f8ee5.hot-update.js:109 Base64 Decoded Key2: 2ba192411fb0a2ceeca359d389b4cacfa0f87f7a3a0c7168ad1e2e92d4952b4ab6465b7ad8975e2b735bd6c9489d4c34462df636ef3b4d7fdc6ed56cdb9cd3bab96539a420ca630721cb378df95371f1f7b10cf2dc9f7f149816b920be2a2dd0006052176ec10fee093672526e0b3eb8488a5ad1dee25a34e754c5c4b0a99478173501609bcb35dd5e99355b660485eee8f3fed8b3fcbc4873e760a303682ccd0f0aceea1c9da419bfec5d78619cbe5d22bfd34cc055e3ce7c3c596029b9c393b2039823e29b465ca4581e80015052c4ac4c63d9ffdafa995c0b1c2bc0cb10f194a99989467a7958956d29cea1efa271a6239110316fa9ea9f4bfe2f8a509db86e68245ae930f27b327e49f799757fc868985cfb93a24e7686b2d55966365ba506acd9e63e64b63ccf98024fcd472b2d69cee7a20904ba07556ac8ba6f05d8ec60c18e958dfb100b29d6409efb164caec3d35dfaf39f83ef59c3db1fa21fe684c6c13a403c52cec4b593b153e6ad79607f7f5e4dbfcb4c64ec058846278e06d0cdf72afee431a10bb12a2955ca78ea105da0607942d8af226e64fd2803310090f7e69c96fd634b82e946213bf073952bef8dcbdab11be4b197c144bacd10f6231c043795f855fd2042e2370bc64cdbefdbc9180e48b3d8aff957e8c998b92b8c5c2e8a2cc25f79c40f7633842b839313dbf6547b34d4d8f7974c09f54f9a20d8
VM38 bundle.ad8287f8f3cbaa7f8ee5.hot-update.js:110 Base64 Decoded IV: 4bba6438c3360e5d18080afc3edde5f3bcb81f3690cb152758b15ebf5377b6f4fe6b8008fce35fb7f966251b7405916626c3fe2caa61c9e183f87ced6b3f5cee8e336c32d23f0646c18c38aa2ce98dcfb9bfb3f32a02bdf9f3d16e36ef501d564316300203dc42b416c512530161952ddeef7d016b7af9b5c757ed6a43646efe34615db7674ec9446d1bf3aa8e8832a81b601bde8b2281c6fbe441d7bb2e8c3a7f26204e51078857b13d31b117df82850e20c6bf38110b7a52d62f78fd571204a50ae9ac3c11300eef05b48d43d7bd64532e50e9b03add4c826f9bb2804f8c5362f5f6ec5526219c2519f9e04742b92b52db45d7d717fd0fe43a2c31f59634a958811e07e095c3f9e4f8562ae999ef0761411d7de71751a80e0332d6aaa298d090c23790ee1439e8f5b2b9d8d80bf5834306a9be47a476f31dd9ec71c9e254eb48dce2139cc4170ca42f385ef408a2e8425a60b443ef41d8725a0399a81cfa53117c931c7c066f25614182117b18b9a1e5302a0bcc866560f2309d5c9d2dedcbed2782b1a3535d0b2532d0d7f7ff9d89296054fa12a00b54401fc4b098f2011506f25165618eae95bfcd83d097f1ca897e83528a22dfaa11c7978daa9fbca33b246f395417376162967275ecbdad7007c93b9b3e40377814c632926a01ff93b62dd583cb9ae4b5e5cb2fa338de4e3acaeb22be7622bfb6bbfbbf56dafb07e093
VM38 bundle.ad8287f8f3cbaa7f8ee5.hot-update.js:115 RSA Decrypted Key1: g.œ'Æ‹wvüXã2¸¶
VM38 bundle.ad8287f8f3cbaa7f8ee5.hot-update.js:116 RSA Decrypted Key2: lÖÑCò®|f.üØÁ}]
VM38 bundle.ad8287f8f3cbaa7f8ee5.hot-update.js:117 RSA Decrypted IV: KN¿N8ª1Ê°YëLr"e
VM38 bundle.ad8287f8f3cbaa7f8ee5.hot-update.js:119 AES KEY (Key1+Key2): g.œ'Æ‹wvüXã2¸¶lÖÑCò®|f.üØÁ}]
VM9 vendor.js:20948 ERROR Error: Malformed UTF-8 data

A: I solved the problem! (Technically though I was asking the wrong question). I realized it was because I parse the secretkey and IV using UTF-8 encoding when in fact I should have use Latin1. I checked the encoding of the data and it was ISO-8859-1 in which I recently learned that is also known as Latin1. So I change this chunk of code
let parsedkey = cryptoJs.enc.Utf8.parse(decryptedKey);
let parsedIV = cryptoJs.enc.Utf8.parse(decryptedIV);

to
let parsedkey = cryptoJs.enc.Latin1.parse(decryptedKey);
let parsedIV = cryptoJs.enc.Latin1.parse(decryptedIV);

and my aes decryption is now like this
let decrypted = cryptoJs.AES.decrypt(doc, parsedkey, {
    iv: parsedIV,
    mode: cryptoJs.mode.CBC,
    padding: cryptoJs.pad.ZeroPadding
}).toString(cryptoJs.enc.Latin1);

Now I can process the pdf and display it natively in my app. Hope this helps with others who have a similar situation as mine.


text:
Q: Emptying Trash with Dovecot IMAP On a Debian Squeeze system I run an IMAP server using Dovecot with messages being stored in the Maildir format.  The server is accessed by various clients, including Thunderbird, Evolution and RoundCube.
When a user deletes a message it is moved to the Trash folder.  (I am unsure if all clients also mark the messages as deleted when moving them.) However, beyond that no action is taken.  Hence I am forced to periodically remind all users to explicitly empty their Trash every few months.
Does Dovecot provide an easy means of automatically deleting Trashed messages older than n days?  I've seen mention to an expunge cron-job but it seems to delete all messages older than a certain number of days as opposed to just those in Trash.

A: The Plugin that @hostemaster mentioned is not really needed if you don't deal with thousand of users.
Just create an easy script like this:
#!/bin/bash
#
DOVEADM="/usr/local/dovecot/bin/doveadm";

$DOVEADM expunge -A mailbox Trash savedbefore 90d
$DOVEADM expunge -A mailbox Junk  savedbefore 60d

And run it daily as an cronjob.
This will remove all messages from Trash that are older than 90 days, or from Junk if older than 60 days.

A: Expire plugin delete mails from specified mailboxes after a designated number of days.
http://wiki2.dovecot.org/Plugins/Expire


text:
Q: How to convert array to object? I have a array different objects
{
  prac:[{
         "name":"xxx",
         "id":"1"
        }],
  abc: [{
        "description":"this is test description",
         "status":"active"
       }]
  }

Here I want to convert prac array to object.

A: You should take the first element of the array. That's it

var obj = {
  prac: [{
    "name": "xxx",
    "id": "1"
  }],
  abc: [{
    "description": "this is test description",
    "status": "active"
  }]
};

obj.prac = obj.prac[0];

console.log(obj);

A: Try this :

var jsonObj = {
  prac:[{
         "name":"xxx",
         "id":"1"
        }],
  abc: [{
        "description":"this is test description",
         "status":"active"
       }]
  };

var arrObj = jsonObj.prac;

function toObject(arr) {
  var newJson = {};
  for (var i = 0; i < arr.length; ++i)
    newJson[i] = arr[i];
  return newJson;
}

console.log(toObject(arrObj));


text:
Q: Can a particle be identified when one knows $\left$ and the Cherenkov angle $\theta_c$? I have a question about if it would be possible to identify a particle by measuring the energy loss due to ionization $\langle dE/dx\rangle$ and the Cherenkov angle $\theta_c$. I assume that we know what the material properties ($n$, $\rho$, $Z$ and $A$) are although that's not given explicitly.
My attempt at an answer:
I have two equations, one for the Cherenkov angle ($\beta = 1/n \cos \theta_c$) from which I can retrieve the ratio $p_X/m_X$, and one for the energy loss (the Bethe formula as given here) which I can solve for $\frac{z^2}{m_X}$. But as far as I know I have 3 unknowns: the momentum of the particle $p_X$, the mass of the particle $m_X$, and the charge of the particle $z_X$.
So I guess that I can obtain at best a ratio $m_X/z^2$ with those two measurements, which is not really enough to identify the particle unless I know its charge (from its motion maybe?). Is that the correct conclusion?


text:
Q: Returning ordered json data inside filter.js using JsonQuery I'm using filter.js from https://github.com/jiren/filter.js - great script.
var FJS = FilterJS(products, '#products', {
    template: '#productfinder-template',
    search: {ele: '#searchbox'},
    callbacks: {
        beforeAddRecords: function(records){
            var jq = JsonQuery(records);
            console.log(jq.order({'artnr': 'asc'}).exec());
        },
        afterFilter: function(result){
            $('#total_products').text(result.length+' records found');
        }
    }
});

Inside the callback "beforeAddRecord" i called the JsonQuery "order" function and the result is an ordered Json list, just the way i wanted. The problem is getting this result on the screen.
Has anyone have experience with this script?

A: Did some testing and found following working. I put the code on a button click for testing purposes.
jQuery("#xselected").on('click', function(){
    var jq = JsonQuery(products);
    products = jq.order({'artnr': 'asc','category':'asc'}).exec();
    FJS.removeRecords({});
    FJS.addRecords(products);
    FJS.filter;
});

Removed all records from the filter and added them back after using the order function from JsonQuery.

A: I can't comment yet, so I will post this as a second answer. I was encountering some strange behavior from the code posted by recoder, where the data from "products" was doubling when I switched between filters. This wasn't a big deal with small numbers of items, but when I added more, and sorted multiple times, it started to slow everything down.
The issue is not with FJS, but with the "on click" function. It apparently saves all the data from each change event for the session. To fix this, just add .unbind()before the .on().
jQuery("#xselected").unbind().on('click', function(){
    var jq = JsonQuery(products);
    products = jq.order({'artnr': 'asc','category':'asc'}).exec();
    FJS.removeRecords({});
    FJS.addRecords(products);
    FJS.filter;
});


text:
Q: condition on a vector of logicals if I do the following:
x <- c(TRUE, TRUE, FALSE)
if(x) {
    print("hey there")
}

x is evaluated as TRUE because the first element is TRUE. I would like the condition to evaluate to TRUE only if every element of x is TRUE. I think there must be an easy way that I'm missing (I have searched). I thought that all.equal would be what I wanted (so I could check that "all elements of x are equal to TRUE"), but it serves a different purpose.
I know it's not ideal (it doesn't even check to see if x is a logical), but the best I've come up with so far is to do something like this:
xu_if <- function(x) {
    sum(x) == length(x)
}
if(xu_if(x)) {
    print("hey there")
}

What is the best way to do this?

A: all() is the function you are looking for
x <- c(TRUE, TRUE, FALSE)
if(all(x)) {
    print("hey there")
}
# >

x <- c(TRUE, TRUE, TRUE)
if(all(x)) {
    print("hey there")
}
# [1] "hey there"

A: one line to do the trick
print(!any(!x))


text:
Q: How to run Word macro (replace text) from Powershell? I am looking for a way to replace text in word documents through powershell.
By using a macro in normal.dot (all documents) and passing the find and replace text with the powershell script.
Macro
Sub Machine()

    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = $Text
        .Replacement.Text = $ReplaceText
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
End Sub

Powershell script
$Desktop = [Environment]::GetFolderPath("Desktop")
$Document = "$Desktop\HL2532-00E.docx"

$Text = "2532-00"
$ReplaceText = "2532-35"

$Word = New-Object -ComObject Word.Application
$Document = $Word.Documents.Open("$Document")
$Word.Run("Machine")
$Document.Save()
$Word.Quit()
$a=[System.Runtime.InteropServices.Marshal]::ReleaseComObject($Word)

A: You do not define any variables in your macro. You'll have to update it to something like this:
Sub Machine(FindText,ReplaceText)

    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = FindText
        .Replacement.Text = ReplaceText
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
End Sub

Then when you call it from PowerShell you just add those arguments on after the name of the macro:
$Word.Run("Machine",$Text,$ReplaceText)

Or you can skip the macro and just do it all within PowerShell using the Find.Execute() method (documented here).
$Document = "$home\Desktop\HL2532-00E.docx"

$Text = "2532-00"
$ReplaceText = "2532-35"

$Word = new-object -ComObject Word.Application
$Document = $Word.Documents.Open($Document)
$Find = $Document.Content.Find
$Find.ClearFormatting()|out-null
$Find.Execute($Text, $false, $false, $false, $false, $false, $true, 1, $false, $ReplaceText, 2)
$Document.Save()
$Word.Quit()
$a=[System.Runtime.InteropServices.Marshal]::ReleaseComObject($Word)

The syntax for the Execute method is this:
Execute(FindText, MatchCase, MatchWholeWord, MatchWildcards, MatchSoundsLike, MatchAllWordForms, Forward, Wrap, Format, ReplaceWith, Replace)

Most of those are $true/$false, with the FindText and ReplaceWith being strings. The two odd ones are Wrap and Replace that are enums where 1 = wdFindContinue and 2 = wdReplaceAll. You can find links to those enums on the page linked above.


text:
Q: Joining two a ViewModel This is the model:
public class ProCar
{

    public string ProductName { get; set; }

    public int ProductYear { get; set; }

    public string CarBrand { get; set; }

    public int CarEngine { get; set; }

}

I'm using this LINQ. How to save to a List of ProCar.
List<Product> p1 = db.Products.ToList();
List<Car> c1 = db.Cars.ToList();
List<ProCar> query = from pList in p1
join cList in c1 on pList equals cList.ProductId
select new { ProductName = pList.ProductName, ProductYear = pList.ProductYear, CarBrand = cList.CarBrand, CarEngine = cList.CarEngine };
return View();

Cannot find the issue.

A: Assuming you have relation between Product and Car :
var query = from product in db.Products
            join car in db.Cars on product.Id equals car.ProductId//The relation between car and product
            select new ProCar
            {
                ProductName = product.ProductName,
                ProductYear = product.ProductYear,
                CarBrand = car.CarBrand,
                CarEngine = car.CarEngine
            };

List<ProCar> proCarList = query.ToList();

See Join Clause

A: You are creating an anonymous list type that is unable to find/cast List type of ProCar. So you need to specify for tightly couply model binding as below
List<ProCar> query = ( from pList in p1
join cList in c1 on pList equals cList.ProductId
select new ProCar
 {
       ProductName = product.ProductName,
       ProductYear = product.ProductYear,
       CarBrand = car.CarBrand,
       CarEngine = car.CarEngine
}).ToList();


text:
Q: Get value of SQL Var conformed on varchar text I have the next script example:
DECLARE @lCode INT
DECLARE @lText VARCHAR(400)
DECLARE @lConditionName VARCHAR(40)
DECLARE @Aux VARCHAR(400)

SET @lCode = 1234;
SET @lConditionName = 'Code'

SET @Aux = '@l' + @lConditionName

SET @lText = 'SELECT * FROM Table WHERE Code = ' + @Aux

PRINT @lText

The result is:
SELECT * FROM Table WHERE Code = @lCode

How can i obtein the value of @Aux Var like this?
SELECT * FROM Table WHERE Code = 1234

A: DECLARE @lCode INT
DECLARE @lText NVARCHAR(400)
DECLARE @lConditionName NVARCHAR(40)
DECLARE @Aux NVARCHAR(400)

SET @lCode = 1234;
SET @lConditionName = N'Code'

SET @Aux = N'@l' + @lConditionName

SET @lText = N'SELECT * FROM Table WHERE Code = ' + @Aux

PRINT @lText

EXEC  sp_executesql @lText, N'@lcode INT', @lcode

A: You can try this :
DECLARE @lCode INT
DECLARE @lText NVARCHAR(400)
DECLARE @lConditionName NVARCHAR(40)
DECLARE @Aux NVARCHAR(400)

SET @lCode = 1234;
SET @lConditionName = N'Code'

SET @Aux = N'@l' + @lConditionName

SET @lText = N'SELECT * FROM Table WHERE Code = ' + @Aux

set @lText = N'Print ' + @Aux
print @lText
EXEC  sp_executesql @lText, N'@lcode INT', @lcode

Output
Print @lCode
1234


text:
Q: SeekBar Thumb Background Issue Attache the image for reference Image Screenshot
Please find the code of my layout below..I m new to android ..Trying to learn...Stuck with this from past few days...
I dont want to see that background as white for thumb
Let me know in case any details are required..
Attache the image for reference
Thumb.xml:
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape = "oval"
    android:tintMode="multiply">
    <gradient
        android:angle="360"
        android:endColor="@color/colorPrimaryDark"
        android:startColor="@color/colorPrimaryDark" />
    <size
        android:height="5dp"
        android:width="5dp"/>
</shape>

SeekBar:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
    <item android:id="@android:id/background">
        <shape android:shape="rectangle">
            <corners android:radius="5dp"/>
            <gradient
                android:endColor="#6c6e6a"
                android:startColor="#61635f" />
        </shape>
    </item>
  <item android:id="@android:id/secondaryProgress">
        <clip>
            <shape android:shape="rectangle" >
                <corners android:radius="5dp" />
                <gradient
                    android:endColor="#303F9F"
                    android:startColor="#303F9F" />
            </shape>
        </clip>
    </item>
    <item android:id="@android:id/progress">
        <clip>
            <shape android:shape="rectangle" >
                <corners android:radius="5dp" />
                <gradient
                    android:endColor="#303F9F"
                    android:startColor="#303F9F"  />
            </shape>
        </clip>
    </item>
</layer-list>

Content:
<SeekBar
        android:id="@+id/ProgressBar"
        android:layout_width="fill_parent"
        android:layout_height="20dp"
        android:progress="20"
        android:progressDrawable="@drawable/seekbar_size"
        android:thumb="@drawable/thumb3"
       />


text:
Q: What does boost::asio::write guarantee (ACK, Checksum)? I have a questions concerning boost::asio::ip::tcp::socket and the  associated write functions. From reading the Wikipedia article on the TCP, I understand, that TCP contains acknowledgement messages as well as checksums. Unfortunaly, I can't find any information on this in the boost::asio reference. As far as I understand boost::asio uses the OS implementation of the TCP, which should contain both features.
My question is what do the functions boost::asio::write or boost::asio::async_write guarantee when called with an boost::asio::ip::tcp::socket. So what does it mean if the function returns/the callback function is called without error. I can imagine some possibilities:

*

*Basically nothing, It only means that the program told the OS to send the data, but nothing more.

*Data is underway, meaning that the OS acknowledged that it has send the data.

*Data has arrived, meaning that a acknowledgement message from the other side was received.

*Data has arrived and is not corrupted, same as 3. plus that the checksum adds up.

If it is not 4. is there a way to enforce this using boost::asio (I mean within boost::asio, not implementing it yourself)?

A: It is #1, which is the way it should be.  There are no guarantees that the data will ever be sent.
You think you want #4, but you really don't.  The fact that the remote peer's network stack received the correct data is probably irrelevant to your application.  You really want to know whether the data was received and processed correctly, which is beyond the scope of TCP, but easy enough to implement on top of TCP.  (I recommend reading up on the OSI Model for an introduction to what TCP can be expected to do.  Basically, you want to ensure that your data gets to the right application, or perhaps more, and TCP only ensures that it gets as far as the computer that the application is running on.)
To do what you want, send an in-band acknowledgement over the TCP link.  You can also put the SHA-2 or some other hash of the data in the acknowledgement.  You can also wait to send the acknowledgement until the data has been processed — e.g., wait until it has been written to disk and fsync() has been called.

A: Locally detected errors will be reported. Connection error will also be reported.
If you are using TCP, tcp-ack failure will be reported, but maybe at a later read or write call (when the os is notified of the tcp-hack failure).
So you can't be sure that when you issue a write that it is actually received. no write error means that the os knows currently no errors on the tcp connection you are using and that he buffered your data internally to transmit it to the tcp peer.


text:
Q: Custom listview using button OnClickListener i have created a custom listview with an ImageView, two TextViews and a Button
now i am facing issue when i try to set onClicklistner to that button
i want different method to be done for every button
here is my code for customlistview class
i have used temporary onclicklistner for that button which shows the toast "Bought"
what i want to do is that after clicking the button i have to return the price of the food.
class CustomListView extends ArrayAdapter {
public CustomListView(Context context, String[] resource) {
    super(context,R.layout.custom_view , resource);
}
Toast toast= null;

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    LayoutInflater MyInflater = LayoutInflater.from(getContext());
    View CustomView = MyInflater.inflate(R.layout.custom_view, parent, false);
    String SingleItem= (String) getItem(position);
    final TextView text =(TextView)CustomView.findViewById(R.id.Itemname);
    final ImageView Image= (ImageView)CustomView.findViewById(R.id.icon);
    final TextView Pricetag= (TextView)CustomView.findViewById(R.id.PriceTextView);
    text.setText(SingleItem);
    switch (SingleItem)
    {
        case "Chicken":
            Image.setImageResource(R.drawable.desert1);
            Pricetag.setText("Rs 300");
            break;
        case "soap":
            Image.setImageResource(R.drawable.desert2);
            Pricetag.setText("Rs 300");
            break;
        case "Fish":
            Image.setImageResource(R.drawable.fish);
            Pricetag.setText("Rs 100");
            break;
        default:
            Image.setImageResource(R.drawable.myimage);
            Pricetag.setText("Rs 0.00");
            break;
    }

    final Button Buybutton= (Button)CustomView.findViewById(R.id.BuyButton);

    toast = Toast.makeText(getContext(), "", Toast.LENGTH_LONG);
    Buybutton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            toast.setText("Bought");
            toast.show();

        }
    });

    text.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

            toast.setText(text.getText().toString());
            toast.show();

        }
    });
    return CustomView;
 }
}

A: For the record, there should be a better way to do this, using food-id or other approach to prevent this, but based on your request, here we go:
1- in getView() when you get a reference on the button i.e:
final Button Buybutton= (Button)CustomView.findViewById(R.id.BuyButton);

do a one more step:
Buybutton.setTag(10);

10 here could be any other number, and you need to find a way to determine which number to use for each button, also it could be a string , ex value of SingleItem
Buybutton.setTag(SingleItem);

2- at onClick() you need to find out what the value assign to the view (button) and based on this value call the proper method:
@Override
public void onClick(View v) {
    if (v.getTag().toString().equals("xxxxx")){
        doSomething();
    }else if (v.getTag().toString().equals("yyyy")){
        doAnotherThing();
    }else if (v.getTag().toString().equals("zzzzz")){
        doSomething12();
    }
    //and so on...
}

this approach used String as value in setTag() and getTag()
if you use integers, just replace the condition as belwo:
if (Integer.parseInt(v.getTag().toString()) == 10)

EDIT:
If i understand well, then you need to:
Buybutton.setTag(SingleItem);

and onClick():
@Override
public void onClick(View v) {
    showPriceTag(v.getTag().toString());
}

add method showPriceTag():
public void showPriceTag(String type){
    switch (type)
        {
            case "Chicken":
                //set the price tag data ...
                break;
            case "soap":
                //set the price tag data ...
                break;
            case "Fish":
                //set the price tag data ...
                break;
            default:
                //set the default price tag data ...
                break;
        }
}


text:
Q: get maximum value from foreach object list swiftui How can I get a maximum value from my object with a let?
var body: some View{
    ZStack{
           ForEach(schoolClasses, id: \.self) { studentList in

                 let oldestStudent = studentList.max { $0.age < $1.age } //this does not work, trying to return the oldest student

                 HStack{
                  //extra code to use the oldest student
                 }
          }
       }
   }

How I can use that let value inside the HStack?
Right now it gives me build error: The compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions

A: Try this approach, as shown in this example code, to obtain and use the
oldest student in a list of Student:
struct StudentList: Hashable {
    var students = [ Student(age: 5), Student(age: 6), Student(age: 8), Student(age: 3)]
    //...
}

struct Student: Identifiable, Hashable {
    let id = UUID()
    var age: Int
    //... name etc...
}

struct ContentView: View {
    @State var schoolClasses = [StudentList()]

    var body: some View{
        ForEach(schoolClasses, id: \.self) { studentList in
            if let oldestStudent = studentList.students.max(by: { $0.age < $1.age }) {
                HStack{
                    // Text(oldestStudent.name)
                    Text("oldest student age: \(oldestStudent.age)")
                }
            } else {
                Text("no oldest student available")
            }
        }
    }
}

A: Your code implies that schoolClasses is a nested array [[SchoolClass]]
which makes no sense.
A reasonable data structure is an array of students in each class
struct Student {
    let age: Int
}

struct SchoolClass: Identifiable {
    let id = UUID()
    var students : [Student]
}

In SwiftUI it's good practice to keep as much computing stuff as possible out of the view.
Add a computed property to SchoolClass
struct SchoolClass: Identifiable {
    let id = UUID()
    var students : [Student]

    var oldestStudent : Student? {
        if students.isEmpty { return nil }
        return students.max { $0.age < $1.age }
    }
}

In the view write
var body: some View {
    ZStack {
        ForEach(schoolClasses) { schoolClass in
            if let oldestStudent = schoolClass.oldestStudent {

                 HStack {
                     //extra code to use the oldest student
                 }
             }
         }
    }
 }


text:
Q: Get index of each component in Svelte slot Is there a way to loop through all the children in a Svelte component?
Goal
I'm working on creating a list component in Svelte with this syntax (ideally).
<List>
  <ListItem>Item 1</ListItem>
  <ListItem>Item 2</ListItem>
  <ListItem>Item 3</ListItem>
</List>

However, the list should have quite a bit of interactivity.

*

*Users should be able to click on an item and select it

*Only the first item should be tabbable (tabindex={0})

*Users should be able to use arrow keys / enter key to select a list item

*+more that's not relevant to the question

Check out the Material Design web components for demos.
Issue
To do this, elements need to know their "position" in the list. For instance, the first list item needs to know that it's the first to set the correct tabindex. And to use arrow keys to navigate the list, you need to know "Item 2 is active" to switch to "Item 3" on arrow down.
Is there a way to loop through all the children in a component?
Or alternatively, a way to achieve the Material Design list behavior through composition?
I know it's possible to achieve this by using a data prop instead of composition. But for my use case, composition will likely be much better in the long run.
React equivalent
If you're familiar with React, I looking for something that works like this incredibly simplified example.
const List = (props) => {
  return (

      {React.Children.forEach(props.children, (child, index) => (
        child.props.tabIndex = index === 0 ? 0 : -1
      ))}

  )
}

const ListItem = (props) => {
  return
{props.children}

}

A: I used a register function in the parent (your List component) for a pulldown menu component.
Something like:
List component:
  function nested(nestedText, clicked = false) {
    if (clicked) {
      // clicked and then do something
      ...
    } else {
      // register listItem
      register = [...register, nestedText];
      return register.length - 1;  // itemIdx
    }
  }
  setContext('nested', nested);

Item component:
let text, itemIdx, thisObj;
const nested = getContext('nested');

onMount(() => {
  text = thisObj.textContent;
  itemIdx = nested(text);  // register item
  ...
});

Item component html:
 {
     nested(text, true);
  }}"
  bind:this={thisObj}>
  <slot />


text:
Q: C simple input Questions Given a case like below :

2
+

-1
3
5

-2
4
6

-

-10
0
1
2
3

0
2
4
6

The input consists of the number of test cases, m, in the first line and followed by m groups of an operator and two lists of sorted integers in a strictly increasing order.
I want to store the integer in two list, but I have problem how to determine when the second list is needed. Is there any method that I can use "\n" as a point to determine the use of second list.
int main()
{
int cases;
scanf("%d\n", &cases);
printf("%d\n", cases);

char temp[100];
while(fgets(temp, 100, stdin) != NULL){
    if(strcmp(temp, "+\n") == 0)
        printf("operator");
    if(strcmp(temp, "\n") == 0)
        printf("blank line");
}

return 0;
}

A: Going through your question - it seems like you are provided with test cases. In case as you know there are possibly no chance of getting bad input - you can do simple things.
First input is a number denoting the number of testcases - so you can do use scanf over here to get the input (Infact you can read this using a fgets too and convert it using atoi/strtol). Once you get it, use fgets to read each line.
Now how you check that it is operator or number? You can check the content of the line. For operator it can be as simple as checking the first character of the input line.
How do you understand that you are getting a different group? It is observable that there is a blank line containing \n in between groups of numbers. So when you get that you can be sure that for input of one group is being taken.
The same way like this, you can understand about the list that you are getting as input.
Converting those numbers which are taken as string can be done using atoi or strtol(Better choice as providing error checking).
Understanding when input ends can be done by checking the return value of fgets it will return NULL when there is nothing to read.


text:
Q: Replace find_by_sql with a regular query I have this query:
tag_names = Tag.find_by_sql "SELECT GROUP_CONCAT(' ', name) FROM tags WHERE id IN (#{tag_ids.join(',')}) AND tag_type = 'Communication_Ways'"

Is there a way to do it in rails with: Tag.find(:all, ???)
The problem is that this query does not return anything because GROUP_CONCAT returns a string and not a Tag model.

A: can you please try this :
You can use calculate method to do GROUP_CONCAT : http://api.rubyonrails.org/v3.2.13/classes/ActiveRecord/Calculations.html#method-i-calculate
Tag.select(:name).where(:id => tag_ids, :tag_type => 'Communication_Ways').calculate(:group_concat, "name separator ' '")

Update For Rails 2.3.8
calculate method in Rails 2.3.8 : http://api.rubyonrails.org/v2.3.8/classes/ActiveRecord/Calculations/ClassMethods.html#M001705
Tag.find(:all, :select => 'name', :conditions => ["id IN (?) AND tag_type = (?)", tag_ids.join(', '), 'Communication_Ways']).calculate(:group_concat, "name separator ' '")

A: If tag_ids is an array, I would try:
tag_names = Tag.find(:tag_id = tags_ids).map(&:name).uniq.join(',')

Rails will translate an array of [tag_ids] into the IN statement.
You might have to fiddle the syntax a little for 2.3.8, I use rails 3 and 4.


text:
Q: Peer dependencies issue in eslint-config-next (with Typescript) I create a new project with Next.js using pnpm, and i got this error for typescript depencencies missing from pnpm:
 WARN  Issues with peer dependencies found
.
└─┬ eslint-config-next 13.2.3
  ├── ✕ missing peer typescript@>=3.3.1
  └─┬ @typescript-eslint/parser 5.54.0
    ├── ✕ missing peer typescript@"*"
    └─┬ @typescript-eslint/typescript-estree 5.54.0
      ├── ✕ missing peer typescript@"*"
      └─┬ tsutils 3.21.0
        └── ✕ missing peer typescript@">=2.8.0 || ...

my package.json :
{
  "name": "nextjs-project",
  "version": "1.0.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  },
  "dependencies": {
    "@chakra-ui/react": "^2.5.1",
    "@emotion/react": "^11.10.6",
    "@emotion/styled": "^11.10.6",
    "eslint": "8.35.0",
    "eslint-config-next": "13.2.3",
    "framer-motion": "^10.0.1",
    "next": "13.2.3",
    "react": "18.2.0",
    "react-dom": "18.2.0"
  }
}

well it's normal since i didn't install typescript, i know i can solve this if i install it, however for this small project i am not using typescript, so is there a way to fix this error without installing typescript since i don't use it ? or i have no choice but to remove eslint-config-next ?


text:
Q: Displaying stylesheets / js from single source under multiple domains I have about 20 or so domains that are used as landing pages. These 20 domains all for the most part have the same styling, images, and js files. Instead of having to manually update stylesheets or js files for each and every domain anytime I make a change, I want them all to be from one single source. My problem is that these domains are setup as add-on domains on cpanel. If I use ../, it does not work, it just uses the domain the page is under instead of the parent domain.

*

*What is the best way of setting up a single source for all files and at the same time have code as clean as possible?

A: I figured out why just linking them all from a single domain didn't work. I had cloudflare enabled and I was seeing cached pages. After turning development mode on, the changes worked.


text:
Q: Left outer join one-to-one in Entity Framework I have a problem related with a one-to-one relationship in Entity Framework 6.1.3.
I have 2 classes.
public class Package
{
    public Guid Id { get; set; }
    public string PackageNo { get; set; }
    public double SendingCost{ get; set; }
    public virtual PackageAppointment PackageAppointment { get; set; }
}

public class PackageAppointment
{
    public DateTime Date { get; set; }
    public virtual Package Package { get; set; }
}

and the map class for PackageAppointment is:
public class PackageAppointmentMap
{
    public PackageAppointmentMap()
    {
        Property(x => x.Date).IsRequired();

        HasRequired(x => x.Package).WithOptional(x => x.PackageAppointment).Map(x => x.MapKey("PackageId"));

    }
}

Everything works fine. I don't have any issue with the relationship. The problem is querying database. Every time I query the Package entity in the database using the context, the SQL Server profiler generates something like this.
LINQ query:
var data = await Task.Run(() => GenericService.GetAll().Select(x => x.PackageNo));

SQL Server profiler:
SELECT
    [Extent1].[Id] AS [Id],
    [Extent1].[PackageNo] AS [PackageNo],
    [Extent1].[SendingCost] AS [SendingCost],
    [Extent2].[Id] AS [Id1]
FROM
    [dbo].[Package] AS [Extent1]
LEFT OUTER JOIN
    [dbo].[PackageAppointment] AS [Extent2] ON [Extent1].[Id] = [Extent2].[PackageId]

Every query I do using context.Package... without retrieving data form the PackageAppointment (or any other one to one relationship) Entity Framework generates a left outer join.
The actual condition in my project is that Package entity has 5 one to one relationships. The performance is very low because of this.
Maybe I should change the relationship or something else. Really i don't know what to do to fix this performance issue.
Please advise.

A: You can change your relationship between Package and PackageAppointment to this:
public PackageAppointmentMap()
{
    Property(x => x.Date).IsRequired();

    HasOptional(x => x.Package)
        .WithOptionalPrincipal(x => x.PackageAppointment)
        .Map(x => x.MapKey("PackageAppointmentId"));
}

This will make your Package table contain FK PackageAppontmentId, and your query will not have this join. Also changing relationship to Package.HasRequired(x=>x.PackageAppointment) will also work (for possible reason see below)
After that accessing Packages:
var query = dbContext.Packages.ToString();

Returns:
SELECT
    1 AS [C1],
    [Extent1].[Id] AS [Id],
    [Extent1].[PackageNo] AS [PackageNo],
    [Extent1].[SendingCost] AS [SendingCost],
    [Extent1].[PackageAppointmentId] AS [PackageAppointmentId]
    FROM [dbo].[Packages] AS [Extent1]

On the other hand, accessing PackageAppointmentss:
var anotherQuery = dbContext.PackageAppointments.ToString();

Will result in query:
SELECT
    1 AS [C1],
    [Extent1].[Id] AS [Id],
    [Extent1].[Date] AS [Date],
    [Extent2].[Id] AS [Id1]
    FROM  [dbo].[PackageAppointments] AS [Extent1]
    LEFT OUTER JOIN [dbo].[Packages] AS [Extent2] ON ([Extent2].[PackageAppointmentId] IS NOT NULL) AND ([Extent1].[Id] = [Extent2].[PackageAppointmentId])

[EDIT]
Why this happens?
It mostly looks like this is done for Change Tracking.
Scenario:
You have a PackageAppointment that has a required Package. That means, that your PackageAppointment table has Foreign Key PackageId, so when you load PackageAppointment, change tracker has all the information about PackageAppointment to track all possible changes to the entity, and changing PackageAppointment.Package reference is tracked easily - you compare PackageAppointment.PackageId in the entity that you loaded even if you did not really load a record from Package table, that's associated with that PackageAppointment (lazy loading = off).
On the other hand, if you load Package, you have a property PackageAppointment that you can change to reference another PackageAppointment. But to track this change, you have to somehow get PackageAppointment.Id associated with this Package. Since Package table has no Foreign Key from itself to PackageAppointment table, you have to make a join to get PackageAppointment.Id, associated with this Package. In other words, if you don't do this join, change tracking for this entity will be ineffective and will make you load referenced PackageAppointment if you do any change to it, which might have been ineffective.
To prove that, try putting .AsNoTracking() for this specific query and check the query returned.
So the code
var trackingQuery = dbContext.PackageAppointments.ToString();

Console.WriteLine("==========================");
Console.WriteLine("Query with Change Tracker enabled");
Console.WriteLine(trackingQuery);
Console.WriteLine("==========================");
Console.WriteLine("\n\n");

var noTrackingQuery = dbContext.PackageAppointments.AsNoTracking().ToString();

Console.WriteLine("==========================");
Console.WriteLine("Query with Change Tracker disabled");
Console.WriteLine(noTrackingQuery);
Console.WriteLine("==========================");

Results to the following output:
==========================
Query with Change Tracker enabled
SELECT
    1 AS [C1],
    [Extent1].[Id] AS [Id],
    [Extent1].[Date] AS [Date],
    [Extent2].[Id] AS [Id1]
    FROM  [dbo].[PackageAppointments] AS [Extent1]
    LEFT OUTER JOIN [dbo].[Packages] AS [Extent2] ON ([Extent2].[PackageAppointmentId] IS NOT NULL) AND ([Extent1].[Id] = [Extent2].[PackageAppointmentId])
==========================

==========================
Query with Change Tracker disabled
SELECT
    [Extent1].[Id] AS [Id],
    [Extent1].[Date] AS [Date]
    FROM [dbo].[PackageAppointments] AS [Extent1]
==========================

As you can see, LEFT OUTER JOIN magically disappeared here, which proves that this is related to Change Tracking system.


text:
Q: Unable to find the proper way to handle recovery in Spring Kafka with a batch of messages I'm working on a really simple Spring Boot app which will process messages from a single topic and then persists this batch into a Cassandra database.
I trying to use Spring Kafka with a batch of messages and every time when my onMessage() method throws a MyKafkaRetryException then a endless loop of reprocessing is starting but I expect that after the retries are exhausted the batch of messages is moved to the DLT. (If I throw any other exception then a message is immediately moved to DLT.) I just configured a RecoveringBatchErrorHandler with my own exception classification. So I don't know whats wrong here.
    @Bean
    public RecoveringBatchErrorHandler recoveringBatchErrorHandler(
        RetryProperties retryProperties,
        ConsumerRecordRecoverer consumerRecordRecoverer)
    {
        ExponentialBackOff backOff = new ExponentialBackOff(retryProperties.getInitialInterval().toMillis(), retryProperties.getMultiplier());
        backOff.setMaxInterval(retryProperties.getMaxInterval().toMillis());
        backOff.setMaxElapsedTime(retryProperties.calculateMaxElapsedTime().toMillis());

        RecoveringBatchErrorHandler errorHandler = new RecoveringBatchErrorHandler(consumerRecordRecoverer, backOff);
        errorHandler.setClassifications(
            ImmutableMap.of(
                MyKafkaRetryException.class, true),
            false);

        return errorHandler;
    }

    @Bean
    public ConcurrentKafkaListenerContainerFactory<?, ?> batchKafkaListenerContainerFactory(
            ConsumerFactory<Object, Object> kafkaConsumerFactory,
            RecoveringBatchErrorHandler recoveringBatchErrorHandler)
    {
        ConcurrentKafkaListenerContainerFactory<Object, Object> factory = new ConcurrentKafkaListenerContainerFactory<>();
        factory.setConsumerFactory(kafkaConsumerFactory);
        factory.setBatchListener(true);
        factory.setBatchErrorHandler(recoveringBatchErrorHandler);
        return factory;
    }

I'm using Spring Kafka 2.6.9 and JDK 1.8_261 on OSX

A: The RecoveringBatchErrorHandler works in conjunction with the BatchListenerFailedException, which you must throw to indicate which record in the batch failed.
That way, the offsets of the prior records are committed and the remainder of the batch replayed.
Any other exception will cause the entire batch to be redelivered indefinitely because it delegates to a SeekToCurrentBatchErrorHandler which has no recovery mechanism since we don't know which record failed. While the provided BackOff is used, when it is exhausted, the last back of interval is used for the additional retries.
https://docs.spring.io/spring-kafka/docs/current/reference/html/#recovering-batch-eh
Or, you can use a RetryingBatchErrorHandler, which will send the entire batch to the DLT when retries are exhausted.


text:
Q: How to Make Language Specific Url in Asp.Net Project? I used westwind globalization library http://west-wind.com/westwind.globalization/ on my project to implement multiple languages. Everything is working fine.
Only one problem is that I get culture reference variable at the end of url as http://localhost:18106/LangTest?LocaleId=en.
I want culture reference variable in between domain and page name like http://localhost:18106/en/LangTest.
Acutally I want to do like Microsoft web site http://www.microsoft.com/en-us/default.aspx for example.

A: You need to use IRouteHandler and you need to create custom routes.
By default, Web Forms use file system request handling. For example the MyWebsite/contact.aspx request searches for the contact.aspx file located under the root menu.
MyWebsite/superheroes/superheroes.aspx should look for the superheroes.aspx file located inside the superheroes file under the root menu.
Using the global.asax file you may add our own handling.
All you need is to call a method, having a RouteCollection parameter, from within the Application_Start method.
So you need to create a method called RegisterRoutes and place it within a new file called MyRouteConfig.cs
Here is example:
using System;
using Microsoft.AspNet.FriendlyUrls;
using System.Web.Routing;
using System.Web;
using System.Web.UI;
using System.Web.Compilation;

public static class MyRouteConfig
{
   public static void RegisterRoutes(RouteCollection routes)
   {
        routes.EnableFriendlyUrls();
        routes.MapPageRoute("superheroes", "superhero/{SuperheroName}", "~/superheroes.aspx");
        routes.MapPageRoute("languageSuperheroes", "{language}/superhero/{SuperheroName}", "~/superheroes.aspx");
        routes.Add(new System.Web.Routing.Route("{language}/{*page}", new LanguageRouteHandler()));
  }

   public class LanguageRouteHandler : IRouteHandler
   {
       public IHttpHandler GetHttpHandler(RequestContext requestContext)
       {
           string page = CheckForNullValue(requestContext.RouteData.Values["page"]);
           string virtualPath = "~/" + page;

           if (string.IsNullOrEmpty(page))
           {
               string language= CheckForNullValue(requestContext.RouteData.Values["language"]);
               string newPage = "/home";

               if (!string.IsNullOrEmpty(language))
                   newPage = "/" + language + newPage;
               HttpContext.Current.Response.Redirect(newPage, false);
               HttpContext.Current.Response.StatusCode = 301;
               HttpContext.Current.Response.End();

              //Otherwise, route to home
              //page = "home";
           }

          if (!virtualPath.Contains(".aspx"))
                virtualPath += ".aspx";

           try
           {
               return BuildManager.CreateInstanceFromVirtualPath(virtualPath, typeof(Page)) as IHttpHandler;
           }
           catch
           {
               return null;
           }
       }
   }
}

Please have a look to this article:
http://dotnethints.com/blogs/localization-using-routing-system-on-a-web-forms-project-


text:
Q: Centering navbar buttons in bootstrap I'm trying to get my hands onto some web designing and I was not able to figure out how to make the navigation buttons in my project centered. I would like the buttons from Home to Page 3 centered and was wondering if there was a simple way to do that in the HTML file alone without needing a separate CSS class.

    <!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>Bootstrap 101 Template</title>

    <link href="css/bootstrap.min.css" rel="stylesheet">

      Website Name

Home

Page 1

Page 2

Page 3

A: Make some changes in Bootstrap.CSS
May be like this...
.nav navbar-nav
{
    position: absolute;
    width: 100%;
    left: 0;
    text-align: center;
    margin: auto;
}

Check here => bootply

A: The only way you can accomplish this is by adjusting some CSS properties. Basically remove the float from navbar-nav and center the text. But if you really want them to be centered, you have to account for the navbar-brand class by assigning it a width and adding a negative margin equal to half that width to the navbar-nav.
See working Example Snippets.

@media (min-width: 768px) {
  .navbar.navbar-default {
    height: 50px;
  }
  .navbar.navbar-default .container-fluid,
  .navbar.navbar-default .container {
    text-align: center;
  }
  .navbar.navbar-default .navbar-nav {
    display: inline-block;
    float: none;
    margin-left: -75px;
  }
  .navbar.navbar-default .navbar-brand {
    width: 150px;
  }
}

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />

      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-nav" aria-expanded="false"> Toggle navigation

      </button> Website Name

Home

Page 1

Page 2

Page 3

Mobile Center

.navbar.navbar-default .container-fluid,
.navbar.navbar-default .container {
  text-align: center;
}
@media (min-width: 768px) {
  .navbar.navbar-default {
    height: 50px;
  }
  .navbar.navbar-default .navbar-nav {
    display: inline-block;
    float: none;
    margin-left: -75px;
  }
  .navbar.navbar-default .navbar-brand {
    width: 150px;
  }
}
@media (max-width: 767px) {
  .navbar-default .navbar-brand.navbar-brand-centered {
    position: absolute;
    left: 50%;
    display: block;
    width: 150px;
    text-align: center;
    top: 0;
  }
  .navbar.navbar-default > .container .navbar-brand.navbar-brand-centered,
  .navbar.navbar-default > .container-fluid .navbar-brand.navbar-brand-centered {
    margin-left: -75px;
    margin-top: 0;
    margin-bottom: 0;
  }
}

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />

      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-nav" aria-expanded="false"> Toggle navigation

      </button> Website Name

Home

Page 1

Page 2

Page 3

A: Using this css will get your navigation button in center position.
navbar .navbar-nav {
    display: inline-block;
    float: none;
}

.navbar .navbar-collapse {
    text-align: center;
}

DEMO


text:
Q: How to implement chat functionality in windows phone 7 I want to implement a simple online chat application in WP7.
I am using Matrix SDK to implement chat on my WP7
This is how I am trying to connect but I am not able to connect and send any messages.
Neither the events are getting fired..I am not getting any exception also..
what have I done wrong????
Please guide me
Thanks in advance
XmppClient xmppConn;
xmppConn = new XmppClient();
Jid jidUser = new Jid("username");
xmppConn.Username = jidUser.User;
xmppConn.Password = "password";
    xmppConn.SetXmppDomain(jidUser.Server);
xmppConn.Uri = new System.Uri("http://server.com:7070/http-bind/",UriKind.RelativeOrAbsolute);
xmppConn.Status = "Testing on Windows Phone 7";
xmppConn.Show = Matrix.Xmpp.Show.Chat;
try
        {
            xmppConn.Open();
            xmppConn.OnLogin += new EventHandler<Matrix.EventArgs>(xmppConn_OnLogin);
            //xmppConn.OnPresence += new EventHandler<PresenceEventArgs>(xmppConn_OnPresence);
            // xmpp.OnLogin += new EventHandler<Matrix.EventArgs>(xmpp_OnLogin);
        }
        catch
        {
            Console.WriteLine("Wrong login data!");
        }
    }

private void SendButton_Click(object sender, System.EventArgs e)
    {
        // loose focus to hide keyboard
        this.Focus();
        messages.Add(new ChatMessage()
        {
            Side = MessageSide.Me,
            Text = TextInput.Text
        });

        var pm = new PresenceManager(xmppConn);
        string sub_id = "xxxxxxxxx";
        Jid jid = sub_id;
        pm.Subscribe(jid);
        xmppConn.Send(new  Message(new Jid(jid), MessageType.chat, TextInput.Text));
        xmppConn.OnMessage += new EventHandler<MessageEventArgs>(xmppConn_OnMessage);
        TextInput.Text = "";
    }

A: Take a look at SignalR for real time web based communications (including chat).
There is an official sample for Windows Phone 8 and also a 3rd party helper for WP7.

A: Before doing anything on xmpp you first need to set OnBind Event of xmmp class.
Reason: Most of the xmpp works asynchronously.When you call something like client.Open it returns immediately so you first need to wait for OnBind event.


text:
Q: Beacon Registered, but response indicates wrong UID I successfully registered a beacon using Google Proximity API but the response indicates a different UID
Request URL
https://proximitybeacon.googleapis.com/v1beta1/beacons:register
Request
{
    "advertisedId": {
        "type": "EDDYSTONE",
        "id": "0x2f234454f4911ba9ffb6"
    },
    "status": "ACTIVE",
    "latLng": {
        "latitude": 51.4935657,
        "longitude": -0.1465538
    }
}

Response
{
  "beaconName": "beacons/3!d31d9fdb7e38e787f8f75d5b6bd7df6f",
  "advertisedId": {
    "type": "EDDYSTONE",
    "id": "0x2f234454f4911ba9ffbw=="
  },
  "status": "ACTIVE",
  "latLng": {
    "latitude": 51.4935657,
    "longitude": -0.14655379999999998
  }
}

If you notice carefully, the UID in the response does not match with the UID in POST request. Also, I tried the https://proximitybeacon.googleapis.com/v1beta1/beacons?q=status:active GET and I am still seeing slightly different UID.

A: I'm assuming the strings you have in your code above are not actually what's being sent around because they shouldn't work at all.
There is an issue where: if you base64 encode the hex representation of the beaconID, and NOT the binary representation. It looks as though the server would erroneously accept this, but interpret it differently. That will be fixed soon.
So, instead of doing this:
var b64id = Base64Encode("abcdef0123456789abcdef0123456789");

You want to be doing:
var b64id = Base64Encode(HexToBinary("abcdef0123456789abcdef0123456789"));

I.e.
if you have the hex string for the id: abcdef0123456789abcdef0123456789, make sure that your code produces the base64 string: q83vASNFZ4mrze8BI0VniQ== — that is what you should be sending the server in the "id" field.
A BeaconID is 16 bytes long, that will show up as a 32 character hex string.  The resulting base64 string encoding that beaconID should be about 23-24 characters long.
Hope that helps.


text:
Q: Is it possible to use a self certified SSL certificate on XAMPP that can be used with telegram bot webhooks Is it possible to use a self certified SSL certificate on XAMPP that can be used with telegram bot webhooks? I am trying to set up my telegram bot, I am currently using "getupdates" method. Therefore I am trying to set up webhooks but it dosent work. Does anyone have experience or advice on using webhooks with XAMPP?
I am using the example telegram code shown here
{"ok":true,"result":true,"description":"Webhook is already set"}


text:
Q: Subclassing IASKAppSettingsViewController I'm trying to tweak the behavior of the default IASKAppSettingsViewController so it can provide custom subviewcontrollers (as for type = PSChildPaneSpecifier) for custom views (type = IASKCustomViewSpecifier).
I've tried to subclass IASKAppSettingsViewController without adding any new functionality to the code.
However when I load up my own subclass the settings view is completely empty - even for a bare subclass. When I switch back to the default IASKAppSettingsViewController everything works again as expected.
I've tried setting breakpoints various places in my subclass and everything seems to be working fine - except that nothing is displayed.
I've tried looking for clues in the documentation, but can't seem to find anything that explains why. The documentation for InAppSettingsKit even states that it's designed for subclassing.
What am I missing here? Any clues are appreciated - or even better a small step-by-step guide for dummies.
Updated with code:
Setting up the flipside view. It works with the standard IASKAppSettingsViewController but fails with my empty derived MyCustomSettingsViewController
- (IBAction)showInfo:(id)sender
{
    // Setup navigation controller for settings view
    MyCustomSettingsViewController *settings = [[MyCustomSettingsViewController alloc] init];
    //IASKAppSettingsViewController *settings = [[IASKAppSettingsViewController alloc] init];
    settings.delegate = self;
    settings.showDoneButton = YES;
    UINavigationController *navigation = [[UINavigationController alloc] initWithRootViewController:settings];
    navigation.navigationBar.barStyle = UIBarStyleBlack;
    [settings release];

    // Display the settings
    navigation.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
    [self presentModalViewController:navigation animated:YES];
    [navigation release];
}

A: Try to add this method to your subclass:
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    return [super initWithNibName:@"IASKAppSettingsView" bundle:nibBundleOrNil];
}

If you don't do that, the default implementation of IASKAppSettingsViewController kicks in and it tries to find a nib named after your class name, in this case "MyCustomSettingsViewController.nib". This probably doesn't exist.
This happens because the default implementation of -init calls -initWithNibName:nil bundle:nil and nil as the filename means to search for a default nib.

A: Try setting breakpoint on initialization steps and if you are adding that as a subview/ pushing on navigation controller. Use NSLogs for each method so you can find the issue. If nothing works send me the code (create a demo code using IASKAppSettingsViewController) to recerate the problem then I'll look into the issue.


text:
Q: ModelChoiceField always raises : "Select a valid choice. That choice is not one of the available choices" In forms I have multiple dependent choice fields. but I am getting same error for all the dependent choice fields i tried but it wont come please help me.I am fresher.
forms.py
class IssuecreateForm(forms.ModelForm):
    def __init__(self,*args, **kwargs,):
        self.projects = kwargs.pop("projects",None)
        # self.issues = kwargs.pop("issues",None)
        # self.rootcause = kwargs.pop("rootcause",None)
        super(IssuecreateForm, self).__init__(*args, **kwargs)
        self.fields['SUMMARY'].widget.attrs.update({'class' : 'form-control','placeholder': 'Enter Summary'})
        self.fields['SUMMARY'].label='Summary'
        self.fields['DESCRIPTION'].widget.attrs.update({'class' : 'form-control mb-4','placeholder': 'Enter Description'},required=False)
        self.fields['DESCRIPTION'].label='Description'
        self.fields['ENVIRONMENT'].widget.attrs.update({'class' : 'form-control mb-4','placeholder': 'Enter Description'},required=False)
        self.fields['ENVIRONMENT'].label='Environment'
        self.fields['PROJECT'].queryset = self.projects
        self.fields['LINKED_ISSUES'].choices = [(x.ID, x.SUMMARY) for x in Issues.objects.all()]
    LABELS =forms.MultipleChoiceField(widget=forms.Select({'class': 'lable-select', 'name':"lable-select", "multiple":"multiple"}), choices=OPTIONS,required=False)
    CREATED_DATE_TIME=forms.DateTimeField(initial=datetime.datetime.today(),required=False)
    PROJECT = MyModelChoiceField(queryset=Project.objects.all(),widget=CustomSelectOption(attrs={'class':'mt-2'}))
    PRIORITY = MyModelChoiceField(queryset=Priority.objects.none(),widget=CustomSelectOption(attrs={'class':'mt-2','name':'issue-types'}))
    TYPE = MyModelChoiceField(queryset=IssueType.objects.none(),widget=CustomSelectOption(attrs={'class':'mt-2'}))
    LINKED_ISSUE_TYPES = ModelChoiceField(queryset=LinkedIssueType.objects.none(), empty_label='----------Select Linked Issue Type---------')
    # STATUS = ModelChoiceField(queryset=IssueStatus.objects.none(), empty_label='----------Select Status---------')
    RESOLUTIONS = ModelChoiceField(queryset=Resolution.objects.none(),required=False, empty_label='----------Select Resolution---------')
    ROOT_CAUSES = ModelChoiceField(queryset=RootCause.objects.none(),required=False, empty_label='----------Select Rootcause---------')
    PROCESS_AREAS = ModelChoiceField(queryset=ProcessArea.objects.none(),required=False, empty_label='----------Select Process Area---------')
    FUNCTIONAL_AREAS = ModelChoiceField(queryset=FunctionalArea.objects.none(),required=False, empty_label='----------Select Functional Area---------')
    # DEFECT_TYPE = ModelChoiceField(queryset=DefectType.objects.none(), empty_label='----------Select Defect Type---------')
    ASSIGNEE = MyModelChoiceField(queryset= PmUser.objects.none(),widget=CustomSelectOption(attrs={'class':'mt-2'}),required=False)
    REPORTER = MyModelChoiceField(queryset= PmUser.objects.none(),widget=CustomSelectOption(attrs={'class':'mt-2'}),required=False)
    SPRINTS = ModelChoiceField(queryset=Sprint.objects.none(),required=False, empty_label='----------Select Sprint---------')
    LINKED_ISSUES = forms.MultipleChoiceField(widget=forms.Select({"class":"issue-list", "name":"issue-list", "multiple":"multiple"}),choices = [],required=False)
    # EPIC_LINK = forms.MultipleChoiceField(widget=forms.Select({"class":"issue-list", "name":"issue-list"}),choices = [])
    DURATION_CHOICES=forms.ChoiceField(widget=forms.RadioSelect(attrs={'placeholder': 'METHOD_TYPE','class':'myclass'}),required=False,choices=DURATION_CHOICES)
    class Meta:
        model = Issues
        fields ='__all__'
        exclude=['CREATOR','UPDATOR','CREATED_DATE_TIME','UPDATED_DATE_TIME','EPIC_LINK','WATCHER','PARENT','LINKED_ISSUES','ORDER','SERIAL_NUMBER','COLOR','DEFECT_TYPE','STATUS','EPIC_NAME']
        widgets = {
            'START_DATE': DateInput(),
            'DUE_DATE': DateInput(),
            'ESTIMATION_TIME': DurationInput(),
            }


text:
Q: How to loop a specific String Caesar Cipher vb10 I am creating a program with an encrypt and decrypt function. The problem is it should only work on the static string on the code. It should loop when the input plain text is the last. For example the String is "ABCDE...Z1234567890" when i input 0 and the key is 2 the Cipher text should be B. I have four textboxes for the key, the input, the plaintext and the ciphertext. Here's my code.
Public Class Form1
       Dim key As Integer
Const Intext As String = "abcdefghijklmnopqrstuvwxyz1234567890"
Private Sub btCipher_Click(sender As Object, e As EventArgs) Handles btCipher.Click

    Dim plain, s, r As String
    Dim i, j As Long
    key = Val(txtKey.Text)
    plain = txtInput.Text
    For i = 1 To Len(plain)
        r = Mid$(plain, i, 1)
        j = (InStr(1, Intext, r))
        If key > 36 Then
            s = s & Mid$(Intext, j + (key - 36), 1)
        Else
            s = s & Mid$(Intext, j + key, 1)
        End If

    Next i

    txtResult.Text = s
End Sub

Private Sub btDecipher_Click(sender As Object, e As EventArgs) Handles btDecipher.Click

    Dim plain, s, r As String
    Dim i, j As Long
    key = Val(txtKey.Text)
    plain = txtResult.Text
    For i = 1 To Len(plain)
        r = Mid$(plain, i, 1)
        j = (InStr(1, Intext, r))
        If key > 36 Then
            s = s & Mid$(Intext, j + (key - 36), 1)
        Else
            s = s & Mid$(Intext, j - key, 1)
        End If
    Next i

    txtText.Text = s
End Sub End Class

My Problem is its not looping. Maybe someone can help. Thank you.

A: I'm not sure why your code isn't working, but try this code instead:
Public Class Form1

    Const Intext As String = "abcdefghijklmnopqrstuvwxyz1234567890"

    Private Function Transcode(text As String, map As Dictionary(Of Char, Char)) As String
        Return New String(text.Select(Function(x) If(map.ContainsKey(x), map(x), x)).ToArray())
    End Function

    Private Sub btCipher_Click(sender As Object, e As EventArgs) Handles btCipher.Click
        Dim key = Val(txtKey.Text)
        Dim map = _
            Intext _
                .Zip(Intext.ToCharArray().Concat(Intext.ToCharArray()).Skip(key), Function(f, t) New With {f, t}) _
                .ToDictionary(Function(x) x.f, Function(x) x.t)
        txtResult.Text = Transcode(txtInput.Text, map)
    End Sub

    Private Sub btDecipher_Click(sender As Object, e As EventArgs) Handles btDecipher.Click
        Dim key = Val(txtKey.Text)
        Dim map = _
            Intext _
                .Zip(Intext.ToCharArray().Concat(Intext.ToCharArray()).Skip(key), Function(f, t) New With {f, t}) _
                .ToDictionary(Function(x) x.t, Function(x) x.f)
        txtText.Text = Transcode(txtResult.Text, map)
    End Sub

End Class

I've tested the algorithm and it works fine.