Monday, 6 October 2014

Annex 4.0 RTS released!

We mentioned it a few days ago, but you can now download the latest 4.0 version of the RTS Annex: Conquer the World.


Changes:
– 2 New Factions: Alliance Renegades and NEO Republic
– Shadow Organization units: Vixen (hero) and Sentinel
– New Tilesets: Apocylapse, Metropolitian, Overcast, Brightland, and Outland
– Increased Level cap, unit re-balancing and refined gameplay.
– New Technology tree options: Simple Battle, Simple Deployed, Ready for War, and Insanity.
– All Technology trees now have a (D) Double Damage or (H) Half Damage variation.
– Improved graphics, lighting, and particle effects
– Save + load game feature
– New maps and scenarios
– New soundtrack, voice overs and sound effects.
– FOSS (Free and Open Source Software) license
It's especially great to see them switch to a fully FOSS licensing model!

P.S.: Unrelated, but Unvanquished also got a new Alpha 32 release just now.

Wednesday, 1 October 2014

Windows 10 Technical Preview Launched (Its just Testing)

Microsoft has recently launched the Windows 10 Technical Preview. Its just for the research purpose. You can call it a Beta Version of Windows 10. Its features seems to be a combination of Windows 8 and previous windows. Start Menu of Windows 8 is made better in Windows 10 and search is also provided in the start menu. Interested users can download it from preview.windows.com.



Windows 10 is expected to be released by mid of 2015. Till then it will gather the feedback from users of Windows 10 Technical Preview and polish it.

Windows 10 will run on a number of devices ranging from smart phones to desktops. Its screen size will range from 4 Inch to 85 inch. It will also be used on servers.



The overview of Windows 10 in the video seems to be good. Especially those who are using Windows 8 and miss the start menu of Windows XP will be the first to order it.

Tuesday, 30 September 2014

Solution for "stop spamming us. you're wasting your time" at Hacker News / Ycombinator

solution for "stop spamming us. You are wasting your time"
If you get this message on trying to post something at Hacker News / Ycombinator (not dependently of submitting method: bookmark or site form), it means, the site you try to post is flagged by any HN admin as spam. By mistake or not is another question - i know the case, when YouTube was flagged as spam there. Anyway our intention is not to dispute with HN admins whether our list is spam or not, but rather just to post a link, what we want to post. Deleting cookies doesn't help. But the working solution is simple:
Read full article »

Dynamic Image Map that works when window is resized

Last time i was creating an image map in my website and found my self into a state where image was dynamically resized by browser to fit it into the space. But it created a problem in the image map. Coordinates of Image Map were same as before, while image was resized by the browser. In such a situation i need my image map coordinates to be changed dynamically.
I tried to find a solution to this problem and found that i am not alone facing this problem. Finally i found a solution called dynamic image map. This technique need some java script to be implemented with your image map. This technique is not a tough one. Just follow the following steps.

How to create a dynamic image map with javascript



  • Copy the following code

!function(){"use strict";function a(){function a(){function a(a){function c(a){return a*b[1===(d=1-d)?"width":"height"]}var d=0;return a.split(",").map(Number).map(c).map(Math.floor).join(",")}for(var b={width:h.width/i.width,height:h.height/i.height},c=0;f>c;c++)e[c].coords=a(g[c])}function b(){i.onload=function(){(h.width!==i.width||h.height!==i.height)&&a()},i.src=h.src}function c(){function b(){clearTimeout(j),j=setTimeout(a,250)}window.addEventListener?window.addEventListener("resize",b,!1):window.attachEvent&&window.attachEvent("onresize",b)}var d=this,e=d.getElementsByTagName("area"),f=e.length,g=Array.prototype.map.call(e,function(a){return a.coords}),h=document.querySelector('img[usemap="#'+d.name+'"]'),i=new Image,j=null;b(),c()}window.imageMapResize=function(b){function c(b){if("MAP"!==b.tagName)throw new TypeError("Expected <MAP> tag, found <"+b.tagName+">.");a.call(b)}Array.prototype.forEach.call(document.querySelectorAll(b||"map"),c)},"jQuery"in window&&(jQuery.fn.imageMapResize=function(){return this.filter("map").each(a)})}();

  • Paste it in a blank notepad
  • Save that notepad as MapResizer.js
  • Upload it on your website server. (If you don't have file uploading access, then use yourjavascript.com to upload that file and get its url in your email). You will need the URL of MapResizer.js in the next step.
  • After </map> paste the following code in your HTML document.
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
 <script src="Paste complete url of mapresizer.js" type="text/javascript"></script>
 <script type="text/javascript">
  $('map').imageMapResize();
 </script>

Friday, 26 September 2014

Android ListView with Custom Layout

MainActivity.java

package com.customlistviewdemo;

import android.app.Activity;
import android.os.Bundle;
import android.widget.ListView;


public class MainActivity extends Activity {
ListView listview;
int[] img_resource = {R.drawable.apple,R.drawable.banana,
R.drawable.cherry,R.drawable.mango,R.drawable.orange,R.drawable.strawberry,R.drawable.tomato};
    String[] name = {"Apple","Banana","Cherry","Mango","Orange","Strawberry","Tomato"};
    String[] Qty = {"100 kg","150 kg","300 kg","250 kg","500 kg","300 kg", "220 kg"};
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        listview = (ListView) findViewById(R.id.main_list_view);
        FruitAdapter adapter = new FruitAdapter(getApplicationContext(),R.layout.row_layout);
        listview.setAdapter(adapter);
       int i = 0;
        for(String Name : name )
        {
        FruitClass obj = new FruitClass(img_resource[i],Name, Qty[i]);
        adapter.add(obj);
        i++;
        }
    }
}


FruitAdapter.java

package com.customlistviewdemo;

import java.util.ArrayList;
import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class FruitAdapter extends ArrayAdapter{
private List list= new ArrayList();

public FruitAdapter(Context context, int resource) {
super(context, resource);
// TODO Auto-generated constructor stub
}
public void add(FruitClass object) {
// TODO Auto-generated method stub
list.add(object);
super.add(object);
}
static class ImgHolder
{
ImageView IMG;
TextView NAME;
TextView QTY;
}
@Override
public int getCount() {
// TODO Auto-generated method stub
return this.list.size();
}
@Override
public Object getItem(int position) {
// TODO Auto-generated method stub
return this.list.get(position);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
View row;
row = convertView;
ImgHolder holder;
if(convertView == null)
{
LayoutInflater inflater = (LayoutInflater) this.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
row = inflater.inflate(R.layout.row_layout,parent,false);
holder = new ImgHolder();
holder.IMG = (ImageView) row.findViewById(R.id.fruit_img);
holder.NAME = (TextView) row.findViewById(R.id.fruit_name);
holder.QTY = (TextView) row.findViewById(R.id.fruit_qty);
row.setTag(holder);
}
else
{
holder = (ImgHolder) row.getTag();
}
FruitClass FR = (FruitClass) getItem(position);
holder.IMG.setImageResource(FR.getFruit_resource());
holder.NAME.setText(FR.getFruit_name());
holder.QTY.setText(FR.getFruit_qty());
return row;
}

}

FruitClass.java

package com.customlistviewdemo;

public class FruitClass {
private int fruit_resource;
private String fruit_name;
private String fruit_qty;
public FruitClass(int fruit_resource, String fruit_name, String fruit_qty) {
super();
this.setFruit_resource(fruit_resource);
this.setFruit_name(fruit_name);
this.setFruit_qty(fruit_qty);
}
public int getFruit_resource() {
return fruit_resource;
}
public void setFruit_resource(int fruit_resource) {
this.fruit_resource = fruit_resource;
}
public String getFruit_name() {
return fruit_name;
}
public void setFruit_name(String fruit_name) {
this.fruit_name = fruit_name;
}
public String getFruit_qty() {
return fruit_qty;
}
public void setFruit_qty(String fruit_qty) {
this.fruit_qty = fruit_qty;
}

}

activit_main.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    >
<ListView 
    android:id="@+id/main_list_view"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_marginBottom="0dp"
    android:layout_marginTop="0dp"
    
    ></ListView>
  </RelativeLayout>

row_layout.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_marginTop="0dp" 
    android:layout_marginBottom="0dp"
    android:focusableInTouchMode="true"
    >
    
    <ImageView 
        android:id="@+id/fruit_img"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerVertical="true"
        android:paddingRight="10dp"
        android:paddingTop="10dp"
        android:paddingLeft="10dp"
        android:scaleType="centerCrop"
        />
    <TextView 
        android:id="@+id/fruit_name"
         android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_toRightOf="@+id/fruit_img"
        android:layout_centerVertical="true"
        android:paddingTop="10dp"
        />
     <TextView 
        android:id="@+id/fruit_qty"
         android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
           android:layout_centerVertical="true"
             android:paddingTop="10dp"
        android:paddingRight="10dp"
        />
    

</RelativeLayout>