Trump Diehards Take Over Taylor Swift’s New App, Instantly Start Spewing Hate

The pop star has come under fire for her refusal to condemn the so-called alt right.

Taylor Swift launched a new app for her loyal fans last week and within just two days, it was overrun by President Donald Trump’s fans to spread homophobia.

In a Tuesday report from the Daily Beast, screen captures of the app reveal the newly launched app, “The Swift Life,” was taken over by dogged Trump supporters.

Swift’s followers rushed to the app stores and by Monday it was among the top trending apps. It gave Swift fans a place on social media to see exclusive videos, use “Tay-mojis” and have their own Swift-centric newsfeed. But the most popular feature, which allows supporters to meet each other and chat, was possessed by right-wing trolls. Many Swift fans already know each other and have met on Facebook and Twitter. They’ve formed a collective of fans ready to respond to any criticism of their favorite star.

While the singer’s fans all had something in common with Swift, their political ideologies don’t mesh well. When conversation turned to politics, the fans started in on Trump and hate aimed at Hillary Clinton.

“Republicans and Trump supporters have just as much right to be here as everyone. There are people who voted for him or may vote Republican but didn’t vote for him. They may not agree with his beliefs but at least he supports our troops,” on fan wrote.

The comment spawned an argument in the comments section which quickly devolved into other Swift fans saying things like, “I just don’t accept gays lesbians and bisexuals,” Britt said.

Another comment from Britt claimed that her husband serving in the military was safer with Trump in office. Hillary has “done some things I don’t agree with when it comes to the safety of our troops… at the end of the day it came down to what I felt was best. There are people who voted for reasons other than Trump being a bigoted, sexist, homophobe,” she wrote in another post. The backlash was swift.

Those who love Swift and Trump quickly flocked to the defense of their kin on social media. They demanded their freedom of speech be recognized.

“I downloaded Tay’s app and before you start criticising me I’m a trump supporter (sic),” one fan tweeted. “I don’t see why people talk politics in there???? Like helloooooo let’s talk about our fav. We should support Taylor and I’m so disappointed she didn’t have one million downloads a minute.”

Britt ultimately deleted all of her posts about the president before writing, “Speak now and forever hold your peace. Not on TSL. Speak now here and everyone jumps down your throat.”

“You don’t get to use ‘free speech’ as an excuse to be rude and hateful,” another fan responded.

Rumors spread of political posts being deleted by moderators while international Swift fans blasted Americans for “ruining the app” and “distracting from Taylor.”

 

 

When a user logs into the app it demands users “help make this a safe and inclusive place for everyone to enjoy.” They’re encouraged to report content, saying, “see anything inappropriate, including instances of bullying or harassment, please report it.”

Swift made news when she refused to speak out against neo-Nazis and white supremacists in the so-called “alt-right.” She ultimately became the darling of the far-right movement, although Swift has tried to remain non-political. However, in 2016 Swift drew attacks from feminist supporters, who alleged that she was using feminist ideals to sell records while secretly supporting the anti-feminist candidate.

In a Yahoo interview with Swift friend Todrick Hall, Swift’s politics came up and he shut down the speculation she was a closet Trump supporter.

“Yeah, many people have been tweeting me, ‘She supports Trump! She probably voted for Trump!’” he said. “They’re making this huge assumption, when Taylor has never to my knowledge come out and said anything about her being pro-Trump.”

While he wouldn’t confess any inside information on whether Swift was a closet white supremacist, he said she has been “nothing but a great person to me,” as an gay African-American man.

“Her family has welcomed me into their home and treated me like I was a member of the family,” he said. “They’ve welcomed every single person I’ve ever brought around them. I’ve never felt like there was ever a moment that I couldn’t be myself, and talk about the fact that I’m gay or whatever.”

“Maybe one day, Taylor will start being super-political, and using her voice to do the things that people think that she should be doing,” he added. “But even then, she will probably be ridiculed for not being vocal enough, or not being on the right side.”

Left-leaning Swift fans attacked the pop star just last week after she claimed she “couldn’t have asked for a better year.” They allege the comment was “tone deaf” to the horrors many people of color faced in wake of the Trump presidency.

“I mean, yeah there were Nazi’s and white supremacy marches, and families are being torn apart, and there were mass shootings, and people are losing health care, but none of that affects me, so 2017 was great!” one person said on Twitter.

 

 

Related Stories

  • Paul Krugman: The GOP Is Completely, Hopelessly Corrupt
  • How Fox News Is Waging ‘Psychological Warfare’ on the American People
  • Trump Judicial Nominee Withdraws After GOP Senator Publicly Humiliates Him

Understanding Synchronous and Asynchronous JavaScript – paRt_2: JavaScript – its DiFFereNt


In the first part of this post, we saw how the concepts of synchronous and asynchronous are perceived in JavaScript. In this second part, Mr K appears again to help us understand how the setTimeout() and AJAX APIs work.


Let’s go back in past to the story of Mr. K and the date you wanted to go on! but what if you leave a task for Mr. K before outing and tell him that he can only begin to work on this task five hours after he got your message. 
He isn’t happy about it! But why does Mr H leave a message in the queue instead of directly contacting Mr K? Because as I mentioned in the first part, the only way to contact Mr K is by leaving a message to him via phone call — no exceptions., remember, he doesn’t take a new message until he is done with the current one, and if he takes yours, he has to wait for five hours to even start on the task. So, to not be wasteful of time, he brings in a helper, Mr H.
Instead of waiting, he asks Mr H to leave a new message for the task in the queue after the given hours had passed, and moves on to the next message.
Five hours past; Mr H updates the queue with a new message. After he’s done processing all the accrued messages prior to Mr H’s, Mr K carries out your requested task. So, this way, you can leave a request to be complied upon at a later time, and not wait until it’s fulfilled.

1:-> The setTimeout() method

Suppose you have a set of code that you want to execute after a certain time. In order to do that, you just wrap it in a function, and add it to a setTimeout() method along with the delay time. The syntax of setTimeout() is as follows:
  • setTimeout(function, delay-time, arg…)
The arg… parameter stands for any argument the function takes, and delay-time is to be added in milliseconds. Below you can see a simple code example, that outputs “hey” in the console after 3 seconds.
  • setTimeout( function() { console.log(‘hey’) }, 3000 );
Once setTimeout() starts running, instead of blocking the call stack until the indicated delay time is over, a timer is triggered, and the call stack is gradually emptied for the next message (similarly to the correspondence between Mr K and Mr H).
When the timer expires, a new message joins the queue, and the event loop picks it up when the call stack is free after processing all the messages before it — thus the code runs asynchronously.

JavaScript call stack with timer
JavaScript call stack with timer

2:-> AJAX

AJAX (Asynchronous JavaScript and XML) is a concept that uses the XMLHttpRequest (XHR) API to make server requests and handle the responses.
When browsers make server requests without using XMLHttpRequest, the page refreshes and reloads its UI. When the processing of requests and responses are handled by the XHR API, and UI remains unaffected.

XMLHttpRequest we API
XMLHttpRequest we API

XMLHttpRequest Web API

Now, where is the “asynchronous” in this! Just using XHR code doesn’t mean it’s AJAX, because the XHR API can work in both synchronous and asynchronous ways.
XHR by default is set to work asynchronously; when a function makes a request using XHR, it returns without waiting for the response.
If XHR is configured to be synchronous, then the function waits until the response is received and processed before returning.

Code Example 1

This example presents an XMLHttpRequest object creation. The open() method, validates the request URL, and the send() method sends the request.

Asynchronous XHR

var xhr = new XMLHttpRequest();
xhr.open(“GET”, url);
xhr.send();
Any direct access to the response data after send() will be in vain, because send() doesn’t wait until the request is completed. Remember, XMLHTTPRequest is set to work asynchronously by default.

Code Example 2

The hello.txt file in this example is a simple text file containing the text ‘hello’. The response property of XHR is invalid, since it didn’t output the text ‘hello’.

Asynchronous XHR

var xhr = new XMLHttpRequest();
xhr.open(“GET”, “hello.txt”);
xhr.send();
document.write(xhr.response); // empty string
XHR implements a micro-routine that keeps checking for response in every millisecond, and triggers complimentary events for the different states a request goes through. When the response is loaded, a load event is triggered by XHR, which can deliver a valid response.

Asynchronous XHR

var xhr = new XMLHttpRequest();
xhr.open(“GET”, “hello.txt”);
xhr.send();
xhr.onload = function(){ document.write(this.response) } // writes ‘hello’ to the document
The response inside the load event outputs ‘hello’, the correct text.
Going the asynchronous way is preferred, as it doesn’t block other scripts until the request is completed.
If the response has to be processed synchronously, we pass false as the last argument of open, which flags the XHR API saying it has to be synchronous.

Synchronous XHR

var xhr = new XMLHttpRequest();
xhr.open(“GET”, “hello.txt”, false);
xhr.send();
document.write(xhr.response); // writes ‘hello’ to document

Conculsion

If you know how the puzzle fits, you can avoid confusion of stTimeout() and AJAX requests. You know that the delay time in setTimeout() does not indicate the time when the code execution starts, but the time when the timer expires and a new message is queued, which will only be processed when the call stack is free to do so.

Learn WebTechnology with Us!

Treasury Secretary Steve Mnuchin Seriously Claims Ignorance of CDC Banned Words Report

“It’s the first time I’m hearing of that,” he said.

During a CNN appearance, U.S. Treasury Secretary Steve Mnuchin told host Jake Tapper that he knew nothing about the reported directive from President Donald Trump’s administration for the Centers for Disease Control and Prevention, along with other divisions under the Department of Health and Human Services, to stop using a list of banned words.

“Policy analysts at the Center for Disease Control as well as other divisions at the Department of Health and Human Services were given a list of forbidden words,” Tapper said to the treasury secretary. “Why would the Trump administration tell the CDC not to use a term like ‘science-based’?”

“It’s the first time I’m hearing of that,” Mnucnin said with a straight face. “I’m not aware of the directive at all.

The banned words list reported by the Washington Post includes “vulnerable,” “diversity,” “entitlement,” “transgender,” “fetus,” “evidence-based” and “science-based.” 

Watch Mnuchin claim total ignorance below.

 

Related Stories

  • Former Fox News Analyst Tamara Holder Shares Explicit Details of Sexual Assault
  • Sarah Palin’s Son Track Palin Was Arrested in Alaska on Domestic Violence Charges
  • Watch This Conservative Slam Trump for Ignoring Russia Interference Intel Because It ‘Hurts His Little Feelings’

KeeP YoUr SmartPhone SaFe

Smartphones have evolved from being able to just check email and has now allowed us to do so many other things when paired with other devices. Nowadays, we can pay with our smartphones with digital wallet apps are able to store multiple credit cards. Most of our private information (together with other contact information) can be found in the apps on our smartphone through chatlogs, pictures, calendars, and notes.

Various reports have shown that Android malware is increasing year after year, so it’s more important now than ever to make sure your device is safe.

Following are the ways through which you can keep your smartphone safe

Activate a screen lock

Activate a screen lock  after a short period of inactivity (30 seconds, for example), your phone should auto-lock itself. It’s a must not only for your mobile device, but also for your laptop or tablet. This is the easiest way to keep intruders away. It’s also essential that you enforce automatic wiping of the device after 10 failed login attempts.

A screen lock is useful but won’t stop someone from removing your SIM card and using it on another phone. To prevent this from happening, set up a SIM card lock in the form of a PIN number that will need to be entered when a phone is turned on in order to connect to a network.
With both of these security measures in place, you can at least be safe in the knowledge that if a phone is stolen it will be of very little use to the average thief.

Secure individual apps

Download App Lock and add an extra level of security to individual apps, especially ones that contain personal data, such as social networks, email apps, or banking apps. You can set a different password for each app.

Automatic Back up your data

Backing up your data simply means keeping a duplicate data of all the data in your smartphone. There are many viruses in the internet nowadays that can just blast off your smarty pants to heaven. So if you keep a backup, then you can just not make a big deal out of it as you’ve a backup.

Turn Off Settings When Not In Use

Hackers are able to do all sorts of things that will surprise you. Turning off phone settings like Bluetooth, Location Services, Near Field Communication (NFC), Wi-Fi and even Cellular Data when not in use not only conserves smartphone battery but also gives hackers less access to your device.

Location Services and Bluetooth should not be turned on when not in use as apps can use lots of location data without you knowing it. As Bluetooth is constantly transmitting your devices’ location and presence, it is possible for hackers to use it to gain access and extract any kind of information found on your device.

Be careful about which apps you download

Apps from the Play Store are far less likely to contain malware than ones from other sources. Only downloading from the Play Store will significantly cut down your security risk. Take the time to look into an app’s reviews, developer, description and permissions before you download it.

Try an antivirus

If you are security conscious and still don’t trust your smart browser from protecting you from the viruses, just install an anti-virus in your smartphone. Anti-virus for smartphones are spreading like wildfire so you should get yourself one too.

Always buy an antivirus that is good. Go to sites line www.Cnet.com to check the reviews of anti-virus and then only buy it. Don’t just buy an anti-virus out just from the wind. Remember ‘less money, more work’
Nowadays, there are a lot of fake antiviruses in the market. Yeah! You read that right, fake antivirus.These fake anti-viruses tell you that they can be downloaded it for free which is true. Now, they don’t kill viruses they make viruses. So beware of these types.

Get a skin

After all the hard work that your device does for you, you can do it a favor and buying it new clothes or as some would put it, skin. Skins are not only new clothes for your smarty, it also make them look attractive plus as a bonus, when you drop your smartphone for whatsoever reason, this skin may just be little protective as a shield or something.

Activate remote device locator

In case your smartphone is ever lost or stolen, the easiest way to remotely locate it is by installing a dedicated app and making sure that the option to track its location is always turned on.

For iOS there’s the tracking solution called “Find my iPhone”, Microsoft has “Find my phone”, and Android has “Android Device Manager”.

Have a Factory Data Reset

If you’re planning on selling your phone, make sure you don’t forget to do a Factory Data Reset before you give it away.

This way you’ll wipe all the data that was stored on it, including access to your accounts, system and app data and settings, downloaded apps, photos, music or any other data.

Don’t root your phone

Although rooting offers a lot of new options, it can also remove some of the built-in safeguards. It doesn’t make it more likely that your phone will be infected with a virus, but it does mean that more damage can be done if it does occur.

Use a VPN to connect to public Wi-Fi networks

Using a public Wi-Fi network isn’t the most secure option, but it’s just so dam handy! If you don’t want to cut out using those networks altogether, you can compromise by using a VPN. That way, your phone will be much safer when you connect.

Android is an open source platform, it is more vulnerable to attacks as hackers can easily find vulnerabilities on each device; iOS or Windows Phone are less vulnerable because their system codes are not openly shared to the public.

Want to learn Android Programming?

Dice Brawl: Captain’s League

I have a strange fascination with the game Monopoly, must be some memory of my childhood where games weren’t as plentiful as today. But somehow the various computer versions of Monopoly never really excited me. But now I found a nice little game on iOS called Dice Brawl: Captain’s League, which is basically a pirate themed Monopoly on speed, and it is fun.

The board is much smaller, and there are only two players. It is styled as PvP, but the opponent always reacts so fast, and never quits, that I suspect it is fake PvP against an AI controlled opponent just using the name and deck of another player. That is pretty much the only sort of PvP I like. So just like in Monopoly you roll two dice, move around the board, and if you land on an empty spot you can build a fortress there. If you land on your own fortress you can increase its level. If you land on an enemy fortress, you take damage, but then you can try to attack it and conquer it. The player with the most fortresses after 8 turns wins, unless a player gets killed in combat earlier.

This being a mobile game, it comes free but then uses the Gacha game or lootbox mechanic. In the lootboxes you find captains, ships, and crew members of various rarities. By finding more of the same card, you can level that card up. And the various cards have skills which you can then use in battle. The obvious idea is that you spend money to buy lootboxes, but I found the game well playable without doing so.

Overall a fun little game which isn’t overly exploitive, unless you are the kind of player that easily gets sucked in by lootboxes.

3D printing larger objects

Since I bought my 3D printer I have printed hundreds of miniatures for my Dungeons & Dragons game. The miniatures are in a classic 1 inch = 5 feet that is 1:60 scale. So a typical medium sized miniature has a 25 mm base and is around 28 mm tall. As I have written earlier, the main problem of printing objects that size is that printing anything less than 1 mm thick tends to fail, so I had to “fatten” some miniatures or give them oversized weapons to work. Now that I have a good selection of miniatures, I am more often printing larger objects, and the challenges are different.

Now “larger objects” on my 3D printer are limited to 150 mm in any dimension due to the size of the printer itself. Over the last month I printed several objects that were at or close to that limit: Two dice towers, a hinged box, a card tray and two card holders for the 7th Continent, and JoyCon holders for the Nintendo Switch. Apart from the box, which was more of a tech demo to show that you can print a hinged object in one piece, the other objects would be either hard to get anywhere, or be much more expensive. Thus there is some utility to printing these larger objects yourself. The 3D printer also automatically makes items hollow, filled with some honeycomb structure, so a bulky 3D printed object is quite lightweight.

While with larger objects there are no more problems with too thin parts, the main downside of these objects is that the uneven surface is far more prominent. If you are used to holding plastic items in your hand which have a smooth and shiny surface, the 3D printed objects are notably different. Along the Z-axis the layer structure is very visible. And on inner surfaces where the printer had to move across empty space to get to the other side of the object there are irregular imperfections. To some extent you can clean the object up using a sanding sponge. But unless you want to spend hours sanding the object will never be totally smooth and shiny like a commercial injection-molded item.

I still don’t believe in a future where we all just 3D print everything we need instead of buying mass-produced items. However there are a few niche applications where a 3D printer can produce a larger object of some use.

At the Conservative Student Action Summit, Plenty of Old Names, Ideas

Selling old, increasingly discredited ideas to a youthful audience isn’t as easy as it sounds.

Thousands of student activists are headed to South Florida this week for the right-wing version of spring break. What’s being billed as the largest gathering of young conservatives in the country will feature a full roster of red-state crowd pleasers like Wisconsin Governor Scott Walker, Donald Trump Jr, Dinesh D’Souza and Sebastian Gorka. Attendees will also get “first-class activism and leadership training,” not to mention the chance to hobnob with the likes of James O’Keefe.

Meet Turning Point USA

Turning Point USA is the organizer behind the Student Action Summit and purports to be “the largest and most powerful campus activist program in America.” It’s certainly the best funded. While TPUSA was founded by 24-year-old Charlie Kirk, and presents itself as a student-driven group, the real power behind it is considerably older, not to mention wealthier. A number of Republican mega-donors have given massive financial support to the organization in hopes TPUSA can produce the next generation of right-wingers, at a time when most millennials are rapidly shifting left.

Grooming conservative activists isn’t TPUSA’s only goal. The group claims it seeks to “effectively push back against intolerance and bias against conservatives in higher education.” But as a review of recent campus controversies reveals, the real goal is to undermine trust in higher education by framing colleges as enemies of conservatism

Conservative victims

Consider the explosive issue of free speech on campus. Free speech is typically put forward as one of the reasons colleges must give a platform to “controversial” speakers like Richard Spencer to advocate ethnic cleansing, Milo Yiannopolous to publicly insult a transgender student or Charles Murray to explain why black people are genetically inferior to white people. But what about free speech that includes making an obscene gesture to a member of TPUSA? Unacceptable, as Courtney Lawton, a graduate student at the University of Nebraska discovered.

After Lawton was documented making an obscene gesture toward a student in a TPUSA booth in August 2017, the University of Nebraska removed her from her teaching position. As a group of professors pointed out in a letter to Chancellor Ronnie D. Green, silencing a university employee for offending a group that purports to be about campus free speech seems contradictory. But for the University of Nebraska, the political blowback was only beginning.

Since Lawton was removed, Republican officials have proposed cuts to the university budget and called for an end to tenure, and demanded that the university turn over faculty members who have publicly criticized members of the state government.

An unequivocal threat

The events at the University of Nebraska demonstrate just how far some administrations are willing to go to protect conservative students when their feelings are hurt. But TPUSA still portrays universities as a whole as an unequivocal threat. At the University of Wisconsin, a TPUSA chapter is appealing a suspension imposed by the student government after the group violated funding policy. The TPUSA chapter’s GoFundMe page doesn’t mention the violation. Instead, they imply “leftist pushback” is what really motivated the student government’s actions.

Maybe that’s why TPUSA has “secretly funnel[ed] thousands of dollars into multiple college student government elections to elect conservatives.” After all, if the only students in positions of power are those approved by TPUSA, then TPUSA chapters like the one at the University of Wisconsin aren’t likely to have to worry about pesky funding policies.

TPUSA doesn’t just target students who don’t share their political ideology. The organization targets professors as well, specifically through the infamous Professor’s Watchlist, which uses unreliable, incomplete or downright false information to target professors suspected of espousing liberal ideas.

Even the clothing sold by TPUSA pushes an anti-higher education agenda. One of its shirts reads, “I survived college without becoming a liberal.” 

In Prager we trust

The anti-higher education sentiment pushed by TPUSA raises a thorny question. If the students who are being feted at the Student Action Summit can’t trust their colleges and their professors, from whom should they get their education?

Dennis Prager, the founder of Prager U, is happy to help.

Prager U and TPUSA are deeply connected.  (TPUSA founder Charlie Kirk sits on Prager U’s advisory board while Prager U is a sponsor of TPUSA. Dennis Prager is also a featured speaker at the Student Action Summit.) Then there is their ideologically symbiotic relationship. TPUSA seeks to sow a distrust of higher education in young people, encouraging them to embrace conservative alternatives like Prager U. At the same time, Prager U’s videos push the kind of us vs them mentality that drives young people toward groups like TPUSA.

So what kind of education does Prager U offer? First, it’s important to note that Prager U is not a university at all, despite presenting its videos as “courses” that can be watched for “credits.” This appropriation of the language of a university gives a neutral veneer to highly partisan, misleading and simplistic videos that are presented as facts, not arguments.

Consider the “course” on feminism featuring Tammy Bruce, who bemoans that female college students don’t list “wife and mother” as a career goal and complains that feminists believe that they are equal to men in the “sexual arena.” Women are meant to “civilize men,” says Bruce, warning that when women don’t civilize men, society apparently “descend[s] into chaos and the law of the jungle.” And what about the contributions of men to women’s liberation? (This analysis goes into meticulous detail about all the problems with the “course.”)

The video on capitalism, featuring Jared Meyer, is equally problematic. It begins with the speaker declaring, “You can’t stand big government. Really. You can’t,” and ends by reminding viewers that they enjoy capitalism, “you practice it every day” and it’s “time to preach it.”

How can you tell you hate big government? It’s easy. Meyer explains that “going to the Apple Store [is] so fun, but going to the DMV [is] so painful.” The speaker fails to discuss areas like the environment, healthcare and infrastructure where what benefits a corporation can conflict with the needs of human beings. He also fails to address how the government has had to bail out corporations because their recklessness endangered the entire economy.

We shouldn’t be too hard on Meyer, though. After all, all of Prager U’s “courses” are only about five minutes long.

Hard sell

Spend enough time watching Prager videos and clicking around the TPUSA website and you too may be convinced that there’s a burgeoning “student movement for free markets and limited government.” But selling old, increasingly discredited ideas to a youthful audience isn’t as easy as it sounds. Getting 15- to 25-year-olds to embrace extreme free-market policies requires convincing them to overlook the fact that these same policies have directly contributed to financial meltdowns, and as George Monbiot writes, “the offshoring of wealth and power…[and] the slow collapse of public health and education [and] ecosystems.” Not to mention absurd levels of economic inequality that threatens to choke the very generation TPUSA is trying to appeal to.

Which may be why the biggest names at this week’s Student Action Summit aren’t young activists but right-wing hacks and has-beens, in search of a new market for the same tired products they’ve been selling for decades.

Basic Understanding of RMI : JaVa – is not MaVa

RMI logo

The Remote Method Invocation(RMI) is an API that provides a mechanism to create distributed application in Java. RMI allows a Java object to invoke method on an object running on another machine. RMI provides remote communication between java programs.

—Watch the Video to understand “Why we need RMI ?”—-



Concept of RMI application

A RMI application can be divided into two parts,
1. Client  program
2. Server program.
Server program creates some remote object, make their references available for the client to invoke method on it. A Client program make request for remote objects on server and invoke method on them. Stub and Skeleton are two important objects used for communication with remote object.

Stub and Skeleton

components of RMI

Stub acts as a gateway for Client program. It resides on Client side and communicates with Skeleton object. It establishes the connection between remote object and transmit request to it. Skeleton object resides on the Server side.

Stub Operation:

  • Acts as proxy for remote object.
  • Marshall parameters (converting the data or the objects in-to a byte-stream).
  • Send request and parameters to server skeleton.
Skeleton operation:
  • UN-Marshall parameters(converting the byte-stream back to their original data or object).
  • Perform computation
  • Marshall method return.
  • Send return object to client stub
RMI Registry
RMI registry is a server where :
  • Servers can register their object.
  • Clients can find server objects and obtain a remote references. Using the remote reference we can then invoke the required method.
                             
Watch this video to understand basic Implementation of RMI


RMI IMPLEMENTATION

    RMI Architecture

    Creating simple RMI application involves following steps:

    • Define a remote interface.
    • Implementing remote interface.
    • create and start remote application
    • create and start client application

    Define a remote interface

    A remote interface specifies the methods that can be invoked remotely by a client. Clients program communicate to remote interfaces, not to classes implementing it. To be a remote interface, a interface must extend the Remote interface of java.rmi package.
    import java.rmi.*;
    public interface AddServerInterface extends Remote
    {
    public int sum(int a,int b);
    }

    Implementation of remote interface

    For implementation of remote interface, a class must either extend UnicastRemoteObject or use exportObject() method of UnicastRemoteObject class.
    import java.rmi.*;
    import java.rmi.server.*;
    public class Adder extends UnicastRemoteObject implements AddServerInterface
    {
    Adder()throws RemoteException{
    super();
    }
    public int sum(int a,int b) throws RemoteException
    {
    return a+b;
    }
    }

    Create Server and host rmi service

    You need to create a server application and host rmi service Adder in it. This is done using rebind() method of java.rmi.Naming class. rebind() method takes two arguments, first represent the name of the object reference and second argument is reference to instance of Adder
    import java.rmi.*;
    import java.rmi.registry.*;
    public class Server{
    public static void main(String args[]){
    try{
    AddServerInterface addService=new Adder();
    Naming.rebind("Sum",addService);
    //addService object is hosted with name Sum

    }catch(Exception e){System.out.println(e);}
    }
    }

    Create client application

    Client application contains a java program that invokes the lookup() method of the Naming class. This method accepts one argument, the rmi URL and returns a reference to an object of type AddServerInterface. All remote method invocation is done on this object.
    import java.rmi.*;
    public class Client{
    public static void main(String args[]){
    try{
    AddServerInterface st=(AddServerInterface)Naming.lookup("rmi://localhost/Sum");
    System.out.println(st.Sum(25,8));
    }catch(Exception e){System.out.println(e);}
    }
    }

    Steps to run this RMI application

    • compile all the java files
      javac *.java
    • Start RMI registry
      start rmiregistry
    • Run Server file
      java Server
    • Run Client file in another command prompt pass localhost at run time
      java Client localhost
    Goals of RMI
    • To minimize the complexity of applications.
    • Minimize the difference between working with local and remote objects
    • Make writing reliable distributed applications as simple as possible

    Would you like learn Java and get Certified from Oracle ?

    Elemental Evil: Session 10

    In the previous session the group had attacked Feathergale Spire, the first stronghold of the elemental evil cult of air. There they had killed the lord of the tower, his guest Glasstaff (a mage they had been chasing since several sessions before) and three knights, before escaping from the top of the tower with magical para-glider suits. While having escaped unseen, the attack hadn’t gone unnoticed. So while they were at breakfast the next morning in the tavern in Red Larch, a local poultry merchant came in telling the news: “Bandits” had attacked Featherscale Spire, and the survivors of the Feathergale Society had decided to quit the tower, leaving only a single guardian behind. The merchant was quite distraught over the news, as he had had a nice business selling provisions to the tower, which now needed much less of them.

    Feigning concern the group then went to the tower, this time ringing the bell at the front door. As chance would have it, the sole guardian of the tower was Savra, a young noble, who knew Theren from Waterdeep. Being a novice of the cult and a bit naive and trusting towards somebody she knew, Savra told the group that “the prophetess” aka Aerisi Kalinoth (the lady on the cover of the Princes of the Apocalypse book) had come and taken the rest of the Feathergale Society with her through the magical portal into the temple below. Asking about the door the group learned that the cults knew there were 4 keys to open the portal, but as nobody had all 4 keys that was not the usual way to open it; instead the prophetess opens the door with the help of her magical spear. Savra has no means to contact the prophetess or the rest of the Feathergale Society, and was told to wait in the tower. While Theren was chatting with Savra, other group members searched the tower, but of course everything of value or incriminating had been removed.

    From there the group moved towards the Dessarin River, with the idea to move north from there and find Rivergard Keep, the suspected stronghold of the elemental evil cult of water. Near the river they came upon a scene where a group of water cultists was harassing a bear, with the bear curiously shouting for help in common. A fight ensued in which the group slew the cultists and rescued the druid/bear. The rescued druid, Varigo, was very grateful and gave them his most prized possession, the Talking Bear Statuette, a magical item allowing a druid in wild shape to talk and even cast 1 spell per transformation. [DM’s note: Our druid needed a boost due to the weird power curve of the moon druid compared to other classes, which results him being powerful at level 2, but not growing in power much until level 6, while everybody else surpasses him at level 5. It also solves the stupid problem that moon druids sometimes would like to remain in animal shape between fights, but would then be excluded from discussing plans with the rest of the group.] Varigo also told the group that he was on the way to Scarlet Moon Hall to witness the Rite of the Wicker Giant, a ritual that is supposed to restore nature’s balance in the troubled region.

    The next day the group reached Rivergard Keep. The keep was well guarded, with patrols on the walls. So after some discussion on how to approach the group decided to climb the wall during the night under cover of a silence spell. They killed the wall guard, and then entered through a door into the second floor of the keep. There they managed to kill 6 crushing wave reavers (the elite soldiers of the keep) without raising an alarm. Having thus successfully infiltrated the keep, we stopped the session there, to continue in the new year.

    On a personal note, the player of the paladin was absent, so my wife played her character. That was the first time my wife played a real role-playing game. I don’t think she will play frequently, but it is nice that she now knows a bit better what we are doing when we play.

    Does PHP & XML work together in the same place ? LoL , Yes, they do !

    PHP and XML


    XML stands for Extensible Markup Language. A markup language is used to annotate text or add additional information. These annotations are not shown to the end-user, but are needed by the ‘machine’ to read and subsequently process the text correctly.An XML document is plain text and contains tags delimited by < and >.
    XML plays a significant role in the present world of web development, it is perfectly useful for those who wish to make use of web technologies for distributing information across the web.
    XML is used to format a document with a web browser. It is an influential and effectual tool to process a document’s contents and therefore, creating own tags is possible with XML. It works well with any operating system and maintains a great amount of flexibility, which is very essential for the web development scenario. 

    Parsing an XML Document

    Parsing is usually applies to text  it is  the act of reading text and converting it into a more useful in-memory format, “understanding” what it means to some extent.
    An XML Parser is a parser that is designed to read XML and create a way for programs to use XML.

    PHP – Simple XML

    PHP 5’s new SimpleXML module makes parsing an XML document, well, simple. It turns an XML document into an object that provides structured access to the XML.
    The simple XML parser is used to parse Name, attributes and textual content.
    The simple XML functions are shown below:


    simplexml_load_file():

    This function accepts file path as a first parameter and it is mandatory:
    simplexml_load_file(($fileName,$class,$options,$ns,$is_prefix)

    simplexml_load_string():

    This function accepts the string instead of file reference.
    simplexml_load_string($XMLData,$class,$options,$ns,$is_prefix)

    simplexml_import_dom():

    This function accepts DOM formatted XML content and it converts into simple XML.
    simplexml_load_string($DOMNode,$class)
    Assuming we’ve got our XML file above saved as a file called sctpl.xml in the same folder as our php file, we can read the whole feed into an object with the following code.

    <?php
    $sctpl = consultancy('sctpl.xml');
    ?>


    PHP – Simple XML GET:

    Get Node Values:

    Consider following XML file:
    sctpl.xml:
    <SCTPL>

    <Location >
    <address>4/B wing,Trishul Apartments,Sindhi Society Rd Number1,Chembur, Mumbai.
    </address>
    <phno> 022-25277413 </phno>
    <facebook>https://www.facebook.com/suvenconsultants/</facebook>
    <youtube>https://www.youtube.com/user/rockyjagtiani</youtube>
    <Location>

    </SCTPL>

    Following Code will return value of address,phno,facebook,youtube nodes:

    Example

    <?php
    $xml=simplexml_load_file(“sctpl.xml”) or die(“Error: Cannot create object”);
    echo $xml->Address . “<br>”;
    echo $xml->phno . “<br>”;
    echo $xml->facebook . “<br>”;
    echo $xml->youtube; ?>
    Output of above code will be:
    4/B wing,Trishul Apartments,Sindhi Society Rd Number 1,Chembur, Mumbai 

    022-25277413

    https://www.facebook.com/suvenconsultants/

    https://www.youtube.com/user/rockyjagtiani


    Get Node Values of Specific Elements

    Consider another XML file:

    SuvenConsultancy.xml:
    <SCTPL>

    <Location name=”Chembur”>
    <address>4/B wing,Trishul Apartments,Sindhi Society Rd Number1,Chembur, Mumbai.
    </address>
    <phno> 022-25277413 </phno>
    <facebook>https://www.facebook.com/suvenconsultants/</facebook>
    <youtube>https://www.youtube.com/user/rockyjagtiani</youtube>
    <Location>

    <Location name=”Kandivali”>
    <address>510, 5th Floor , Ghanshyam Enclave,Link Road, Lalji-pada JunctionKandivali West, Mumbai
    </address>
    <phno> 022-28674177</phno>
    <facebook>https://www.facebook.com/suvenconsultants/</facebook>
    <youtube>https://www.youtube.com/user/rockyjagtiani</youtube>
    <Location>

    </SCTPL>
    The following example gets the node value of the <phno> element in the first and second <location>elements in the “SuvenConsultancy.xml” file: 

    Example

    <?php
    $xml=simplexml_load_file(“SuvenConsultancy.XML”or die(“Error: Cannot create object”);
    echo $xml->location[0]->phno“<br>”;
    echo $xml->location[1]->phno;
    ?>
    The output of the code above will be:
    022-25277413
    022-28674177

    Get Attribute Values:

    The following example gets the attribute value of the “name” attribute of the first <location> element:

    Example

    <?php
    $xml=simplexml_load_file(“SuvenConsultancy.xml”or die(“Error: Cannot create object”);
    echo $xml->location[0][‘name’];
    ?>
    The output of the code above will be:
    Chembur

    Want to learn Web Technologies?