Skip to main content

Posts

Samba Centos root share error - You do not have permission to access in windows

Description: You have a Centos PC and trying to access the root user's Desktop from a Windows PC. You can see the shared folder in the \Network\Centos_PC_IP, but can't access the folder when you double click. The pop window arise with a error - You do not have permission to access in windows \\CENTOS_IP\\root. Contact your network administrator to request access.   Solution:   First you need to check you samba settings in your centos pc by command -   testparm   After that you need to do a little change o your /etc/samba/smb.conf file. Find the folder you shared from root in this file. It will be like -- [root] path = /root/Desktop read only = No Change it to - [root]   force user = root force group = root  path = /root/Desktop read only = No  And restart the samba by -- /sbin/service smb restart   And you are d...

How to share (read/write) any folder with root permissions in centos 6 or linux

Question: Now a days many people like software developers uses 2 or more OS. So the people who have multiple PC's with different OS need to share the files or folder between them. So how? Solution: Requirement: i.  Samba ii. LAN connection Step 1. Install samba by giving command in centos console -    yum install samba Step 2. Configure samba by opening smb.conf  vi /etc/samba/smb.conf i. Create a workgroup in which you are going to share the files/folders. by default it is like - workgroup = MYGROUP change it to -                                  netbios name = your_host_name workgroup = workgroup because windows system has default group named as WORKGROUP . ii. Now create a shared resource , wher...

How to start or open new activity or window from one window on button click

Requirement: You want to make an "app", which displays a login screen, and users can log in. If the login is correct,  open a new window, where users can do other staff. Then how can you do this? Ans: Step 1. Create a layout xml for the new window. In my case I have created one named newwindow.xml . The entry are as follows -- <?xml version="1.0" encoding="utf-8"?> <Gallery xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:background="#9999FF" >    </Gallery> Step 2. Create a class with extending Activity . Step 3. On that new class add -- public void onCreate(Bundle savedInstanceState) {         super.onCreate(savedInstanceState);         setContentView(R.layout.newwindow);     } Here newwindow is the lay...

How to add button action for multiple button in android

In android it is extreme necessary to use button and do many thing on click or touch of this button. So how you can do this ? Ans:   It's pretty simple! Just find out the -- findViewById(R.id.dummy_button).setOnTouchListener( mDelayHideTouchListener ); It is generated by default in new android sdk. The bold portion is the touch listener for button which is implemented on bellow of your main activity class. You can do your thing on overriden function OnTouch . If you want to do it for click and many button here is the way -- findViewById(R.id.dummy_button).setOnClickListener( ButtonListener ); View.OnClickListener ButtonListener = new View.OnClickListener(){         public void onClick(View view) {             switch (view.getId()) {                 case R.id.dummy_button:     ...

How to move or put the android button in the middle of the screen

Ques: How to centre buttons on screen horizontally and vertically ? Default Screen: Ans: You need to use a Relative Layout for android GUI in the activity_fullscreen.xml   or whatever you name it. You just need to add the android:layout_centerInParent="true" on your relative layout scope. In default android generate the layout as linear layout for your GUI activity. In that activity you can't use android:layout_centerInParent="true". It will generate warning as --- Invalid layout param in a LinearLayout: layout_centerInParent    activity_fullscreen.xml    /YourProject/res/layout    line 52    Android Lint Problem How?:    Step 1. First open the layout xml from /YourProject/res/layout . Step 2. Change all of the <FrameLayout> ... </FrameLayout> to <RelativeLayout> ... </RelativeLayout> .  Step 3.  Delete default button code porti...

Threaded multi Chat room client source code in c++ with MFC Part - 3

PREVIOUS ClientDlg.cpp is the class where all the action from user's are taken and initiated. The interaction with GUI to logic is so great and easy which will help any developer to understand the flow of code. Function for login -- void CClientDlg::OnBnClickedButton2() {     // TODO: Add your control notification handler code here     cTh = AfxBeginThread(     StaticThreadFunc,     this);         m_Thread_handle = cTh->m_hThread; } Start the thread for a login action. UINT __cdecl CClientDlg::StaticThreadFunc(LPVOID pParam) {     CClientDlg *pYourClass = reinterpret_cast<CClientDlg*>(pParam);     UINT retCode = pYourClass->ThreadFunc();     return retCode; } UINT CClientDlg::ThreadFunc() {     // Do your thing, this thread now has access to all the classes member variables     ...