Thursday, September 24, 2015

Windows 10 upgrade stucks on Downloading Updates

That's what I had on my laptop. If you have the same issue, open a terminal as administrator and execute the following command to stop "Windows Update Service". You should see your installation continuing.

net stop wuauserv

Activate Windows 7 with your OEM key

Today, I decided to reinstall Windows 7 on my HP Laptop. I never activated it and I lost my original DVD. So I had no choice than install it from an original Windows 7 ISO downloaded on the web.

And that's why I discovered that pre-installed Windows 7 keys cannot be used to activate Windows. So, this is the solution. Open a terminal as administrator and execute the two following commands :

slmgr.vbs -ipk  XXXXX-XXXXX-XXXXX-XXXXX-XXXXX (where XXXX... is your OEM key)
slmgr.vbs -ato

Enjoy!

Tuesday, September 22, 2015

No more to_date in Oracle SQL

You should prefer something like that :

SELECT
  DATE '2015-08-01' AS d,
  TIMESTAMP '2015-08-01 15:30:00' AS ts
FROM DUAL;


This is conform to ISO8601.


Friday, September 18, 2015

Use Google Translate API for FREE

My company subscribed to Google Apps for Education. So, I though that access to Google Translate API would be included in our contract... but, that's not the case :(

Hummm... hummm... let's hack this for free.

Prerequisite is to have a Google account (even a free gmail account). What we will do is the create a sctipt on Google that will use the translate api freely and publish it as a REST web service which has the same JSON output format as the original.

Let's go!


  1. Connect to http://script.google.com and create an empty project.
  2. Copy paste the code below
  3. Publish it as web application
  4. Grant access to the url of your script to anonymous access if needed


var mock = {
  parameter:{
    q:'hello',
    source:'en',
    target:'fr'
  }
};


function doGet(e) {
  e = e || mock;
  
  var sourceText = ''
  if (e.parameter.q){
    sourceText = e.parameter.q;
  }
  
  var sourceLang = 'auto';
  if (e.parameter.source){
    sourceLang = e.parameter.source;
  }

  var targetLang = 'en';
  if (e.parameter.target){
    targetLang = e.parameter.target;
  }
  
  var translatedText = LanguageApp.translate(sourceText, sourceLang, targetLang)
  
  var json = {
    'data': {
      'translations' : [{
        'translatedText' : translatedText
        }]
       }
  };
   
  return ContentService.createTextOutput(JSON.stringify(json)).setMimeType(ContentService.MimeType.JSON);
}


The original Translation API from Google is https://www.googleapis.com/language/translate/v2?q=[encodedText]&target=[language]&source=[language]&key=APIKEY

Your's will be something like https://script.google.com/macros/s/AKfyxxxxx/exec?q=[encodedText]&target=[language]&source=[language]

The output formats of the two REST service are identicals.

Enjoy!


Wednesday, September 9, 2015

The great alternative to JRebel

I'm an old user and addict of JRebel. I started to use it on open source projects and in professional contexts. From the beginning, I've been convinced that the licensing mode was wrong because of its lifetime. Asking for license renewal each year is boring. So, I decided to look for FREE alternative solutions and finally I recently found one.

This solution is efficient for maven projects developed with Eclipse. It is base on :


I tested it with Java 7 & Java 8. I work on web applications that run on Tomcat. I developed wih Spring (IoC), sometimes Hibernate and Vaadin




Hotswap Agent installation consists on the deployment of a patch for your JVM. You just have to download the corresponding patch here : https://github.com/dcevm/dcevm/releases
Then, download the hotswap-agent.jar from here : https://github.com/HotswapProjects/HotswapAgent/releases

Once it is done, it supposes that you run your project with Maven. For example, I use to start my webapp projects with mvn tomcat7:run or mvn jetty:run.  It could be done from Eclipse directly from the context menu. Thus, you will not need Eclipse WTP anymore

The only thing you will have to do is to declare the following parameters to you JVM arguments like this : 

-XXaltjvm=dcevm -javaagent:/home/depellegrin/Applications/hotswap-agent.jar=autoHotswap=true



Now, in your Java console, you will see extra logs like this :


These extra logs show your HotSwap Agent activity. This is helpfull because in some cases, hot reloading doesn't work. It also happens with JRebel, but honestly (and fortunately) in less cases than this free agent.


Dynamic Source Lookup


Next step : the debugger. If you want to hotswap code changes, you also need to debug it. But, then projects are started with Maven in debug mode (Debug As... instead of Run As... ), Eclipse doesn't link the source code with the code which is executed. To fix this problem, just install the Eclipse plugin from the menu Help > Install new software as it is explained in the project's page here : https://github.com/ifedorenko/com.ifedorenko.m2e.sourcelookup.



That's all. I hope you will enjoy your new life with dynamic reloading of code changes and enjoy the benefits of a strongly compiled programming language like Java associated with the flexibility of an interpreted language. 




Monday, January 12, 2015

A bit of progress on the island.

I'm focusing on making a playable alpha version this month: usability, balance, polish, a bit more content, stuff like that. I usually hate blogposts that are just a list but here you go.

Completed this week:
  • start screen
  • help screen
  • r.i.p screen
  • worldgen screen
  • death from too little food
  • death from too much food
  • death from too little water
  • death from too much water
  • death from too little stamina
  • death from too much stamina

Remaining to do items:
  • death from being too cold for too long
  • death from being too hot for too long
  • save
  • load
  • day/night transitions
  • map screen only shows what you have explored
  • show vague data instead of exact on play screen (morning instead of 6:42, hot instead of 98 deg, thirsty instead of 100/1000 etc.)
  • message log
  • instead of consuming the entire plant, place it - or parts of it - in inventory
  • eat parts of plants in inventory
  • replant plants from inventory
  • inland lakes and ponds
  • saltwater/freshwater
  • drinking freshwater is good, drinking saltwater is bad
  • rework and balance weather
  • rework and balance hunger, thirst, and exhaustion
  • make some plants grow next to same kind
  • add plant types and stats
  • status effects form stats being too low or too high for too long
  • status effects from eating certain plants
  • remove many hard-coded worldgen parameters
  • worldgen options
  • add caves
  • add ruins

Monday, January 5, 2015

Hunger and thirst on the island

I didn't have much time this week but managed to change how elevation is handled and added some basic stats.

Hurting from walking on thorny bushes near a mountain.

There's still different levels of height in the lowlands but after a certain height (8 or 9 I think) it changes into solid mountain. I think it's a decent compromise that allows the simplicity of not having real z-levels but still having small slopes and mountainsides to dig through. Eventually the mountains will have caves and the lowlands will have ruins and other things to explore.

You can now eat plants to replenish your food, drink water to replenish your water, and sleep to replenish stamina. Thorny plants have a chance to reduce your hp when walking through them, tangled plants have a chance to prevent your from walking through them, and other plants will affect your hunger, thirst, and stamina when eaten.

Not bad for one month.



This month I'll focus on making a playable alpha version.

Vague to do list:
  • start screen
  • help screen
  • r.i.p screen
  • worldgen screen
  • death from too little food
  • death from too much food
  • death from too little water
  • death from too much water
  • death from too little stamina
  • death from too much stamina
  • death from being too cold for too long
  • death from being too hot for too long
  • save
  • load
  • day/night transitions
  • map screen only shows what you have explored
  • show vague data instead of exact on play screen (morning instead of 6:42, hot instead of 98 deg, thirsty instead of 100/1000 etc.)
  • message log
  • instead of consuming the entire plant, place it - or parts of it - in inventory
  • eat parts of plants in inventory
  • replant plants from inventory
  • inland lakes and ponds
  • saltwater/freshwater
  • drinking freshwater is good, drinking saltwater is bad
  • rework and balance weather
  • rework and balance hunger, thirst, and exhaustion
  • make some plants grow next to same kind
  • add plant types and stats
  • status effects form stats being too low or too high for too long
  • status effects from eating certain plants
  • remove many hard-coded worldgen parameters
  • worldgen options
  • add caves
  • add ruins

Popular Posts