Mr.M 62 Future Programmers

How many have websites here or own websites here?

Mr.M 62

I think what's next on this issue or on this kind of hack, I think they will change or advance from sim swop to hacking the actual phones without our knowledge.

Take a look at this, on your mobile you download an App then on the installation process it ask you to grant it permissions to all the technologies it will need or use that also including reading your SMSs, your phone book contacts, and sometimes even your location.

Now to me that's a very dangerous acts just like how WhatsApp does when you installing it, you login, then it sends you an SMS with the OTP, but as soon as that SMS reaches your system tray it reads it and get the code. So for a hacking App I think it can also do the same when they are spying on you for your banking details because as we are in the 4IR we have seen even banks push people to bank digital mostly their mobile Apps.

Now to me that look like the next big hit we should be prepared of as it is coming and it will hit very badly because I'm not yet sure if its possible to get the message on system tray then instantly remove it so it doesn't notify or ring the notification but if that's possible then people might really lose money and don't get notifications on their Apps because these Apps would get it first then remove it so not to ...

rproffitt commented: "Get that person an upvote." In reference to the Shareit comment. That's banned on some forums. +15

Mr.M 62

I've been hearing with this even here in RSA, people are complaining with this, I just wonder how they do it because it seems as if the victim is totally not aware of such.

rproffitt commented: Victims become aware when the losses happen. The SimSwap issue has changed my mind about using my smart phone for more than phone and games. +15

Mr.M 62

Well this is just a demo hosted on a free hosting service. It is meant to show how the library should work when you use it on your website. This is just a demo.

rproffitt commented: So that's the message I'd see if I used it? J.K.? +0

Mr.M 62

Thanks to Dani queen, I was also affected by this as well, tried to reset password but the email wasn't sent to me, I contacted her about this and she assisted me instantly. I was about to loose hope in gaining back my Daniweb account. Thank you Dani.

Mr.M 62

I managed to get the solution to this problem and the solution is:

<?php
$mysqli = new mysqli($host, $user, $password, $database);
// DO ERROR CHECKING HERE

$article_id = isset($_GET['id']) ? $_GET['id'] : false;

if ($article_id) {
  $query = <<< QUERY
SELECT * 
FROM 
  `ndlelabyte`.`messages` 
WHERE 
  `articleid` ={$article_id} 
LIMIT 0 , 30
QUERY;

  $result = $mysqli->query($query);
  if ($result) {
    while ($row = $result->fetch_object()) {
      echo <<< COMMENT
  <div class="col-xs-12">
    <div class="mbr-testimonial card">
      <div class="card-block"><p>{$row['comments']}</p></div>
      <div class="mbr-author card-footer">
      <div class="mbr-author-name">{$row['author']}</div>
    </div>
    </div>
  </div>
COMMENT;
    }
  }
}

Mr.M 62

You problem is here

        cmd = New OdbcCommand("insert into arsip values (?, ?, ?, ?)", conn)
        With cmd
            .Parameters.AddWithValue("?", TextNO.Text)
            .Parameters.AddWithValue("?", TextJenis.Text)
            .ExecuteNonQuery()
        End With
        conn.Close()

you have 4 values that need to be used but you only used 2.

If your database doen't have 4 fields then your code should be like this:

        cmd = New OdbcCommand("insert into arsip values (?, ?)", conn)
        With cmd
            .Parameters.AddWithValue("?", TextNO.Text)
            .Parameters.AddWithValue("?", TextJenis.Text)
            .ExecuteNonQuery()
        End With
        conn.Close()

Mr.M 62

So you mean I can call

form->label1->Text = "Text has changed from the out side.";
Application::Run(form);

as much as need and where ever I want to? I will have to try it out and see then.

Mr.M 62

Don't use to hijack other peoples posts. Here is a C# code.

foreach (ListViewItem iItem in ListView4.SelectedItems) {
    // I declared the variables I will use to keep track here.
    int Price_To_Deduct = 0;
    // I used Integer because I didn't format the numbers to money format so you can try using Double but I haven't tested that.
    int Current_Total_Price = 0;
    // This variable will contain the current total price which we will deduct from.
    int New_Total = 0;
    // This will contain the new total.
    Price_To_Deduct = iItem.SubItems(1).Text;
    Current_Total_Price = Label2.Text;
    // Retrieving the current total price so that we will do calculations.
    New_Total = Current_Total_Price - Price_To_Deduct;
    // Because I'm using a Label I now have to clear it and reUpdate it with the new total.
    Label2.Text = "";
    Label2.Text = New_Total;
}

Mr.M 62

I will strongly suggest that you first read tutorial that will introduce you to programming language as well as the IDE then read how to create your first program in that IDE, how to use controls etc. From there you will have some ideas onto where to start answering the questions.

Here we help by providing solutions to code problems (Errors), unfunctioning properly codes, etc.

Download pdfs, videos trust me it will help a lot.

Mr.M 62

Thanks that was my problem on how I could loop through this, I knew I need to loop through it but didn't know how because when I try For Each MyRow As DataRow In dvt.Rows it didn't do what I wanted till I find this.

Mr.M 62

Well because you not a modem manufacture, I think what will help you is to first detect USB/Ethernet cable insertion/removing. Every peripheral device connected to a computer usually first identifies it self into a computer and then offer/issue how it will be connected/contacted using(Port). So I think that might help as a start and my direct you to the right direction.

Once you have detected, you will have to check its description to see what it is: check this:

This is for detecting plugged and removed USB device with it drive letter:

 Public Enum WM_DEVICECHANGE_WPPARAMS As Integer
 DBT_CONFIGCHANGECANCELED = &H19
 DBT_CONFIGCHANGE = &H18
 DBT_CUSTOMEVENT = &H8006
 DBT_DEVICEARRIVAL = &H8000
 DBT_DEVICEQUERYREMOVE = &H8001
 DBT_DEVICEQUERYREMOVEFAILED = &H8002
 DBT_DEVICEREMOVECOMPLETE = &H8004
 DBT_DEVICEREMOVEPENDING = &H8003
 DBT_DEVICETYPESPECIFIC = &H8005
 DBT_DEVNODES_CHANGED = &H7
 DBT_QUERYCHANGECONFIG = &H17
 DBT_USERDEFINED = &HFFFF
 End Enum

 REM: Device info structure for table.

 Public Structure DEV_BROADCAST_HDR
 Public dbch_size As Int32
 Public dbch_devicetype As Int32
 Public dbch_reserved As Int32
 End Structure

 REM: Volume info Structure

 Private Structure DEV_BROADCAST_VOLUME
 Public dbcv_size As Int32
 Public dbcv_devicetype As Int32
 Public dbcv_reserved As Int32
 Public dbcv_uninmask As Int32
 Public dbcv_flags As Int16
 End Structure

 REM: Function to get drive letter

 Private Function GetDriveLetterFromMask(ByRef Unit As Int32) As Char
 For i As Integer = 0 to 25
 If Unit = (2 ^ i) Then
 Return Chr(Asc("A") + i)
 End If
 Next
 End Function

 REM: Implementation of WndProc() method

 Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
 If QueryCancelAutoPlay = 0 Then
 QueryCancelAutoPlay = RegisterWindowsMessage("QueryCancelAutoPlay")
 End If
 If m.Msg = ...

Mr.M 62

Just made some modifications on my code as follows:

 ConnDB()
 Dim da As New OleDbDataAdapter(("select username, regDate, birthdate, LastSeen from mytable;"), conn)
 Dim dt As New DataTable
 da.Fill(dt)
 Try
 If dt.Rows.Count > 0 Then
 Musername = dt.Rows(0).Item("username") & ""
 MregDate = dt.Rows(0).Item("regDate") & ""
 Mbirthdate = dt.Rows(0).Item("birthdate") & ""
 MlastSeen = dt.Rows(0).Item("lastSeen") " ""

Now this does give me the record on my client side but the problem is that its only give one record. Currently I have 5 records on my database, what I'm trying to do is get all these records data but only the selected columns.

I don't want to send out the complete person record but only a selected columns data I want to send.

I'm not sure if I have to use a For Each and if I have to use it. How could I apply to my scenario.

I've also looked through this https://www.commandprompt.com/ppbook/x5802 and found the plan that I've used on this code post. I saw another with select * from mytabe WHERE scondition = condition which would have perfectly answered/solved my problem if it had worked on me but it didn't. The client side just froze.

This would have answered because I would use the scondition where let say I want to get all the currently online users I would have done it like this: select * FROM myTable WHERE lastSeen = Online;" that would have solved my problem but this didn't work as I've stated that the client side just freezes. ...

Mr.M 62 Future Programmers

Hi Dw.

I have a MS Access database that has 9 columns what I want to do is to retrieve all data from a database only on 5 columns.

I think I have to use the select * from data but I don't know how to select the columns I want to retrieve because I can't use the WHERE test = '" because I want to retrieve all database records but only selected columns.

A very good example of what I want to achieve is thisselect all usernames, birthdates, last_seen_status now this is just an example where a database has users records in the database you may have as many columns as possible including name, surname, sex, location, username, last_seen_status,birthdates, registration_Date and more but only need to retrieve data from 'username,birthdates,last_seen_status` from the database for all the users that had registered or is registered in this database.

Hope I didn't confuse you on this. I saw something with wildcards but was a bit complicated the problem is that I didn't know how to apply it to my scenario. I saw it here: http//www.codeguru.com/columns/vb/doing-data-extraction-with-visual-basic.net.htm

Mr.M 62

Ok. I have just looked through the code and half of the attachment because of my internet. But I have some Questions.

Why you have

 With ProgressBar1
.Style = ProgressBarStyle.Blocks
.Step = 1
.Minimum = _MinProgressbarValue
.Maximum = _MaxProgressbarValue
.Value = _ProgressbarValue
End With

Twice and also why > because if the progress value is more then 100 the error is thrown?

Also if you say you are using a MDI then try something like this:

For Each xChild As Form In Me.MdiParent.MdiChildren
xChild.Close()
Next xChild

To see if all active child forms won't close.

Mr.M 62

I think what you will need is something like this "For i As String = F To O" but not sure if it works with alphabets and a you can notice I didn't add the "Step" because I don't know how in alphabets but in numbers the step would be "1" or "-1".

Then in your code you would need to change "F" to "i".

Mr.M 62

Yes that's achievable, you will have to make sure you have used an extension that is not used by any file, since the sample I did bellow only checks and get a list of files but an extension. Also since you will be working with two extension you will have to code them separately one for extracting which will search for ".gov" and change it to ".sql".

Suppose your path is "D:\Test\" and you have more then one file inside. So you can do it like this:

 Dim D As DirectoryInfo = New DirectoryInfo("D:\Test\")
 For Each File As FileInfo In D.GetFiles("*.sql")
 Dim OriginalFileName As String
 OriginalFileName  = File        
 Dim result As String
 result = Path.ChangeExtension(OriginalFileName, ".gov")
 File.Move(OriginalFileName ,result)
 Next

Now you can use the very same code above for searching for ".gov" files to change them back to ".sql". Also note that you will have to swap around the extension to set it back to the original.

You can place the above code under a button to change extension, then copy it again and past it on the button to set to original and on the code just change the extensions.

HTH.

Mr.M 62

Check the below code. You need to pull the image.

 Dim connection As New SqlConnection("connection string here")
 Dim command As New SqlCommand("SELECT Picture FROM MyTable
 WHERE ID = 1", connection)

 connection.Open()

 Dim pictureData As Byte() = DirectCast(command.ExecuteScalar(),
 Byte())

 connection.Close()

 Dim picture As Image = Nothing

 'Create a stream in memory containing the bytes that comprise
 the image.
 Using stream As New IO.MemoryStream(pictureData)
 'Read the stream and create an Image object.      from the data.
 picture = Image.FromStream(stream)
 End Using

Note how image is read from database before displaying.

Mr.M 62

Ow you can do as ddanbe said or put a label in your Form1, your choice and if you want to display a message then you can just hide the label and point Form1 to send message to this label then on Form2 point it to retrieve this message.

ddanbe commented: Good advice. +15

Mr.M 62

That's great. I think you may now mark this question as solved then.

Mr.M 62

@Dj yes I agree, I posted the use new line early then later when I was in front of my pc I then noticed that its not working. But I got your point there.

@Wishala you should have cleared that out, if so then you can use Dj's suggestion.

Mr.M 62

@DJ but there are situations where the items are retrieved somewhere maybe from a file or from a database then are added to a control, so I think we shouldn't stick much to the way of how the OP is adding because we may find that the data is retrieved some where else and it is dynamically updated so the OP may need to add it just like how he do, unless the data won't be updated at a later stage then the OP can add it internally or within IDE. Just saying

Mr.M 62

I've just worked with another project where the OP was also doing something similar except that, that's OP wanted to make more then one selections at the same time, as I worked with that's OP's question I noticed that even if you add the code for new line, the new line won't be added so I prefer you use ListBox instead of ListView, unless its a must do with a ListView.

ListView seemed to me that it had some limitations on doing things with it. With a ListBox what you require can be achieved so early.

Mr.M 62

An example based on your above code will be:

 List1 = Me.lsv1.Items.Add(Me.txtDescription.Text & Vb.NewLine)
 List1 = Me.lsv1.Items.Add(Me.txtPrice.Text & Vb.NewLine)

Something like this should help do what you intend to do.

Mr.M 62

You need to add

 &VbNewLine

at the end of the add statement so that when you click twice it will write the data on a new line below the previously added data.

Mr.M 62

Don't forget, if your question has been answered to mark it as solved.

Mr.M 62

The above is one URL address, it also have a very good example of how to use it.

Mr.M 62

Mr.M 62

WebClient.DownloadFile seem to be easy to work with, have a look at it.

stackoverflow.com/questions/4066082/download-file-in-vb-net-2010

Mr.M 62

Does the user have a place where s/he will enter the address or the browser retrieve the URL somewhere? If the user is the one entering the URL then you can simply check the entered address and if its youtube address then instruct WebBrowser to browse to that other address.

Also please capture and post here the error so we can see, also another thing is that before you can start doing anything with WebBrowser you need to start by this code:

  On Error Resume Next

  ' This should solve your problem.
  If WebBrowser1.Url.PathAndQuery.Equals("http://www.youtube.com") Then
 ' MsgBox("You have entered youtube website.")
 WebBrowser1.Navigate("http://www.google.com")
 Else
 ' MsgBox("Other address entered")
 End If

Hope that will answer your question.