Posts

Showing posts from February, 2015

.htaccess - Welcome page before WordPress (sub directory install) -

i installed wordpress sub directory: example.com/wp i use rewrite rule serve wordpress root uri: example.com # begin wordpress <ifmodule mod_rewrite.c> rewriteengine on rewritebase / rewriterule ^index\.php$ - [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . /index.php [l] </ifmodule> # end wordpress i want provide welcome page project launch: example.com/welcome.html it have simple welcoming message , should redirect working version of wordpress. have pretty urls enabled in wordpress. welcome.html page can link example.com/about , example, , show page of wordpress (as expected). however, cannot link home page of wordpress. use static page wordpress front page (let's call start ). when link example.com/wp , issue error 404 in wordpress. when link example.com/start , redirect welcome.html page. sounds confusing? hope still me. want: a) users directly access example.com should see welcome page. b) clic

c# - What is, and how do I determine the cause of this strange exception with drawing a Rectangle? -

Image
i'm trying draw rectangle in onpaint method of custom control. it's not don't know how, it's i'm trying time (as opposed creating new pen everytime onpaint called). using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.text; using system.threading.tasks; using system.windows.forms; namespace somenamespace { public partial class window : form { #region designer properties [browsable(true), displayname("formbordercolor"), category("appearance")] public color formbordercolor { get; set; } [browsable(true), displayname("formborderthickness"), category("appearance")] public float formborderthickness { get; set; } #endregion private pen formborderpen; private brush formborderbrush; private rectangle formborderrectangle; public window()

javascript - moment.js get yesterday time range from midnight to midnight -

how can time range yesterday midnight until midnight: example: yesterday 22.07.2015 result: 22.07.2015 00:00:00 (am) 22.07.2015 23:59:59 (pm) date format doesn't matter example. moment().subtract(1,'days').startof('day').tostring() "thu jul 30 2015 00:00:00 gmt-0600" moment().subtract(1,'days').endof('day').tostring() "thu jul 30 2015 23:59:59 gmt-0600"

javascript - CasperJS doesn't follow link on an ASP site -

i'm trying mimic browser behavior on site built asp, seems use lot of javascript based links , ui using casperjs. i'm pretty stuck, , not sure how next. i'm using: casperjs1.1.0-beta3 , phantomjs1.9.8 , , site url https://icsid.worldbank.org/apps/icsidweb/cases/pages/advancedsearch.aspx this html link want click on: <td> <a href="javascript:__dopostback('ctl00$m$g_ba040fcb_44f7_44fa_92d0_d088c5679794$ctl00$gvcasedetails','page$3')">3</a> </td> the site has ssl configuration problems, casperjs run additional flags work: casperjs --ignore-ssl-errors=true --ssl-protocol=tlsv1 icsid.js icsid.js tries open site , click on link next page of results. want check results. var casper = require('casper').create({ clientscripts: ["./jquery.min.js"], verbose: true, loglevel: 'debug', pagesettings: { loadimages: false, loadplugins: false, useragent: 

Scala data structure and complexity O(1) -

today had interview scala , request was: implement data structure fixed size n , these functionalities: get(index) set(index,value) setall(value) the complexity should o(1) example: val ds = ds(100) ds.set(4,5) ds.get(4) //would return 5 ds.set(1,4) ds.setall(10) ds.get(4) //would return 10 ds.get(7) //would return 10 ds.set(1,7) ds.get(1) //would return 7 please find code have sent below. question is right solution , if there better way of doing ? import scala.collection.mutable.hashmap trait operations { def get(index: int): int def set(index: int, value: int) def setall(value: int) } class ds(n: int) extends operations { var mymutablehashmap = new hashmap[int, int]().withdefaultvalue(0) def get(index: int) = mymutablehashmap(index) def set(index: int, value: int) = { if (index <= n) mymutablehashmap += (index -> value) } def setall(value: int) = { mymutablehashmap = new hashmap[int, int]().with

javascript - Securing a page with using passport.js, sails.js and sails generate auth -

how secure page cannot accessed non authenticated user? i've read answer this question haven't been able correctly secure page sails generate auth sails.js, using passport.js. thanks. when generated application, sessionauth policy must have been created . example policy created when generate sails app. not part of sails-generate-auth . to use secured routes, write configuration in config/policies.js file. securedcontroller: { // apply `sessionauth` policy of securedcontroller's actions '*': 'sessionauth', }; sails-generate-auth populate req.session.authenticated during login sessionauth policy behave expected if correctly configured config/policies.js file.

Django admin form error, never saves foreign key even if present -

Image
i know title confusing let me explain. implementing small wiki apphook django + django-cms project. trying add sections wiki, wiki pages can live specific sections allowing bit of structure. here model.py : from django.db import models djangocms_text_ckeditor.fields import htmlfield class wikipage(models.model): slug = models.slugfield(max_length=50,primary_key=true) name = models.charfield(max_length=50) content = htmlfield(blank=true) section = models.foreignkey('wikisection', related_name='pages', db_index=true) def __str__(self): return self.name class wikisection(models.model): slug = models.slugfield(max_length=50, primary_key=true) name = models.charfield(max_length=50) def __str__(self): return self.name here admin.py : from django.contrib import admin .models import wikipage, wikisection django import forms forms import wikipageform, wikisectionform class wikipageadmin(admin.modeladmin): form

javascript - What is the proper design pattern for keeping a list of coordinates on a responsive page? -

Image
i'm beginning make game can preview here . when it's done, classic snake game . i'm trying figure out right how retain list of coordinates positions on board in pixels of upper-left corner of boxes. the coordinates generated on page load function this.setcoords = function ( ) { // sets array of coordinates of upper-left corner of blocks on grid var boardheightwidth = $('#snake-board-holder > svg').height(); // need better way ... var blockheightwidth = boardheightwidth / this.numblocks; (var = 0; < numblocks; ++i) (var j = 0; j < numblocks; ++j) this.allcoords.push([i * blockheightwidth, j * blockheightwidth]); } for example, if board 588x588 pixels allcoords [[0,0],[0,38.4375],[0,76.875],[0,115.3125],[0,153.75],[0,192.1875],[0,230.625],[0,269.0625],[0,307.5],[0,345.9375],[0,384.375],[0,422.8125],[0,461.25],[0,499.6875],[0,538.125],[0,576.5625],[38.4375,0],[38.4375,38.4375],[38.4375,76.875],[38.4375,115

javascript - jquery validate with a character counter plugin -

i have page has fields validated using jquery-validate plugin, , wanted include twitter character counter on fields see how many chars left here demo http://jsfiddle.net/4k1vokgv/1/ $(document).ready(function() { $(".counter").charactercounter({ countercssclass: 'text-counter', limit: 1000, counterformat: 'characters remaining: %1', }); var validatorstrat = $("#strategyform").validate({ rules:{ exampleinputemail1: { required: true, }, zb_note: { required: true, maxlength: 140, }, zc_note: { required: true, maxlength: 140, }, }, submithandler: function(form) {} }); }); both character counters work fine until issue, when jquery-validate fires validation error (required, maxlength, etc), character counter stops working on element has error. i not believe issue character counter plugin itself. th

design - Photoshop - Resizing shape's layer style -

i'm working on icon made shapes , each shape used layer style. when enlarge icon "free transform path" of effects in layer style won't scale accordingly , different. there way scale icon without lossing effects? you can merge down layers 1 layer, try enlarging shape.

nlp - How can I get the correct position of each tag in several sentences in the indexed depedency of Stanford Parser? -

normally can splitting sentences , tokenize there's example: "there comes soldier... i... must go." tagging there/ex comes/vbz the/dt soldier/nn .../: i./nnp ./. ./. you/prp must/md go/vb ./. parse (root (s (np (ex there)) (vp (vbz comes) (np (np (dt the) (nn soldier)) (: ...) (np (nnp i.) (. .)))) (. .))) (root (s (np (prp you)) (vp (md must) (vp (vb go))) (. .))) universal dependencies expl(comes-2, there-1) root(root-0, comes-2) det(soldier-4, the-3) dobj(comes-2, soldier-4) dep(soldier-4, i.-6) nsubj(go-3, you-1) aux(go-3, must-2) root(root-0, go-3) the sentence doesn't stop @ first "...", @ second one. splitting sentences , count number of tokens not in case. (because regard 3 sentences.) is there other way can know parse tree belongs token? or parse tree substring of example? or directly position of tag in example(three sentences) ? it seems stanford inte

python - How to change return value of mocked obj? -

i have class with import pandas pd class foo(object): def __init__(self): self.info = pd.dataframe() def getdata(self): self.__readcsv() def __readcsv(self): self.info = pd.read_csv(self.filename) i have unit test class with class test(unittest.testcase): def test(self): mock = patch('foo.pandas.read_csv') foo().getdata() ... how can change pd.read_csv(self.filename) return value dataframe({'column1': series([1., 2., 3.]),'column2': series([4., 5., 6.])}) test whether self.info assigned, assertequal ? are using python 3 ? python 3 has built in mock library, python 2.x need use third party mock library ( http://www.voidspace.org.uk/python/mock/index.html ). to mock pd.read_csv can use following # python 3.x unittest.mock import patch # python 2.x # mock import patch import pandas pd class test(unittest.testcase): @patch('foo.pd.read_csv') def test(self, mock_read_cs

Why doesn't throw work in Swift? -

Image
any ideas why following doesn't work? func somefunction() throws { print ("this test") } i believe throws introduced in swift 2.0, if using earlier version not able use it. https://developer.apple.com/swift/blog/?id=29

c# - I want to print Count using Groupby and Left join in linq -

i having 2 list or table per below: query: var q = db.tbl_user_to_customermast .where(i => i.fk_membership_id == m.membershipid) .join( db.tbl_customermast, u => u.fk_customer_id, c => c.customerid, (u, c) => new { usercustomer = u, customer = c }) .where(i => i.usercustomer.fk_store_id == shopid).tolist(); output: list a: user_customer_id name =================================== 1 xyz 2 abc query: var rewards = q.join( db.tbl_rewardawardmast, => i.usercustomer.user_customer_id, j => j.fk_customer_userid, (i, j) => new { customer = i, reward = j }) .where(i => i.reward.rewarddate >= i.customer.usercustomer.membership_start) .groupby(i => i.reward.fk_customer_userid) .select(i => new { customerid = i.key, rewardcount = i.count()}) .tolist(); output: list b: user_custo

javascript - openSettings plugin cordova -

Image
i installed plugin opensettings via node.js command in project: cordova plugin add https://github.com/erikhuisman/cordova-plugin-opensettings.git but when use method opensettings.setting() logcat return me error: opensettings.settings error @ file:///android_asset/www/plugins/nl.tapme.cordova.opensettings/www/opensettings.js:23 this opensettings.js : cordova.define("nl.tapme.cordova.opensettings.opensettings", function(require, exports, module) { module.exports = opensettings = {}; opensettings.settings = function(app, callback) { cordova.exec( // success callback callback, // failure callback function(err) { console.log('opensettins.settings error'); }, // native class name "opensettings", // name of method in native class. "settings", // array of args pass method. [] ); }; opensettings.bluetooth = function (app, callback) { cordova

mysql - What is the best way to get sorted SQL query based on null values -

i have table in database want extract data in specific order. here example of table: create table `test` ( `field1` int(11) not null, `field2` int(11) default null, `field3` int(11) default null, unique key `field1_2` (`field1`,`field2`), unique key `field1_3` (`field1`,`field3`), ) engine=innodb default charset=utf8; valid entries in table is: field1 must filled field2 can either null or unique value based on field1 , field2 field3 can either null or uniqie value based on field1 , field3 the order want extract data is: all fields field2 , field3 null all fields field2 null , field3 values all fields field3 null , field2 values so far have used 3 queries connected union select * test field2 null , field3 null union select * test field2 null , field3 not null union select * test field2 not null , field3 null; i myself feel necessary code in order , hoped there better solution. so there better way? just put conditions sing

java - JFileChooser won't work properly -

i working jfilechooser , want make show file selection dialog display when fileitem1 clicked. here swingmenu class. question: missing/doing wrong in showfilechooser method? in advance. import javax.swing.*; import javax.swing.filechooser.filenameextensionfilter; import java.awt.event.actionevent; import java.io.file; import java.awt.event.actionlistener; /* *this class encapsulates build of menu bar , called drawpanelmain add jframe */ public class swingmenu extends jmenubar { /* * initializes jmenuitems added menu. necessary * access actionevent handler. includes filechooser used * actionevent of clicking on fileitem1. */ private jmenuitem fileitem1 = null; private jmenuitem fileitem2 = null; private jmenuitem edititem1 = null; private jmenuitem helpitem1 = null; private jmenuitem toolsitem1 = null; /* * create jfilechooser used in actionevent click on fileitem1 */ jfilechooser chooser = new jfilechooser("d

excel - Complicated lookup - based on specific value in list -

i need in finding formula can specific lookups. i have accounting spreadsheet 30,000 rows - example extract below: product nr. product date purchase or sale sale tat 12345 test product 12345 02.06.2014 purchase 12345 test product 12345 02.06.2014 sale 0 12345 test product 12345 30.09.2014 purchase 12345 test product 12345 30.09.2014 sale 0 23456 test product 23456 08.01.2014 purchase 23456 test product 23456 20.01.2014 sale 12 23456 test product 23456 12.06.2014 purchase 23456 test product 23456 13.06.2014 sale 1 23456 test product 23456 30.07.2014 purchase 23456 test product 23456 04.08.2014 purchase 23456 test product 23456 04.08.2014 sale 0 56789 test product 56789 07.01.2014 sale 56789 test product 56789 13.05.2014 sale 126 56789 test product 56789 03.12.2014 sale 204 each row either purchase or sale. need solution can, each sale, lookup previous purchase date -

javascript - Passing a parameter to http.get in Node.JS -

i'm doing http or https request (depends on url) , want pass same callback function both http or https request. problem want pass parameter callback function. how can it? for example how can pass myparameter callback function? var myparameter = 1 if(url.indexof('https') === 0 ) { https.get(url, callbackfunc); else{ http.get(url, callbackfunc); } function callbackfunc(res, myparameter){} first, change parameter order of callbackfunc to function callbackfunc(myparameter, res) { } (myparameter first can bind shown below, res) then can do: var boundcallback = callbackfunc.bind(null, myparameter); then use boundcallback instead of callbackfunc when call http or https get.

create android battery widget animated when charging -

i want create battery animated widget when battery charging.i want show images continuously. use imageview below: <imageview android:id="@+id/batterycharging_anim" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center" android:layout_centerhorizontal="true" android:src="@anim/batterycharging" /> and batterycharging anim file below: <?xml version="1.0" encoding="utf-8"?> <animation-list android:oneshot="false" xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/battery_c_10" android:duration="25" /> <item android:drawable="@drawable/battery_c_20" android:duration="25" /> <item android:drawable="@drawable/battery_c_30" an

c# - Admob on Windows 8.1 Universal Build -

i making cocos2d-x application windows 8.1 (universal). i include admob ads in it, there problem: cocos2d-x 3.7 creates pure c++ xaml project win 8.1 universal while admob sdk uses c#. any ideas how use admob in case? best regards from found far impossible use c# libs pure c++. need use winrt c++ component access native stuff. it possible c# project - c# calls c++ calls c# , works.

google app engine - Convert .OGG files to .MP3 on GAE and PHP -

i have recording module in website hosted on gae takes user's microphone, records .ogg file , uploads google cloud storage . i'm trying convert said file .mp3 file when it's done recording without having wait on page convert, can't seem find way php on gae . i've been looking @ ffmpeg php , , task queue , i'm not sure work on gae . what best way go accomplishing this? input.

ruby - Access variable from another rake namespace -

i have lot of rake tasks in nested namespaces. all tasks has pretty same structure, instead of writing documentation each, want generate documentation, using configuration variables exist in each namespace. small example: namespace :metadata |ns| config = {:data_location=>"/mnt/metadata/", :data_description=>"metadata system 5"} task :process |task| # code end end namespace :frontend_log |ns| config = {:data_location=>"/mnt/backend/", :data_description=>"logdata backend"} task :process |task| # code end end namespace :backend_log |ns| config = {:data_location=>"/mnt/backendlog/", :data_description=>"logdata backend"} task :process |task| # code end end imagine 150 more of these namespaces. namespace :documentation |ns| task :generate |task| # each namespace has configuration

How to improve MySQL "fill the gaps" query -

i have table currency exchange rates fill data published ecb. data contains gaps in date dimension e.g. holidays. create table `imp_exchangerate` ( `id` int(11) not null auto_increment, `rate_date` date not null, `currency` char(3) not null, `rate` decimal(14,6) default null, primary key (`id`), key `rate_date` (`rate_date`,`currency`), key `imp_exchangerate_by_currency` (`currency`) ) engine=innodb default charset=latin1 i have date dimension youd expect in data warehouse: create table `d_date` ( `date_id` int(11) not null, `full_date` date default null, ---- etc. primary key (`date_id`), key `full_date` (`full_date`) ) engine=innodb default charset=utf8 now try fill gaps in exchangerates this: select d.full_date, currency, (select rate imp_exchangerate rate_date <= d.full_date , currency = c.currency order rate_date desc limit 1) rate d_date d, (select distinct currency imp_exchangerate) c d.full_date >= (select min(r

Kibana and Elasticsearch compatibility with Spring Boot Starter -

i´m using spring boot starter 1.2.5 , kibana 4.1.1 , getting error due incompatible versions. question is: how update elastic search version eventhough using latest spring boot starter version? this of pom file: <!--- ... ---> <parent> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-parent</artifactid> <version>1.2.5.release</version> <relativepath/> </parent> <properties> <project.build.sourceencoding>utf-8</project.build.sourceencoding> <java.version>1.7</java.version> </properties> <dependencies> <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-data-elasticsearch</artifactid> </dependency> <!-- --> </dependencies> i guess fixed overriding version number of of transitive dependencies of spring-starter-da

javascript - Elevate NodeJS/Electron process on Windows -

i'm building app in electron/nodejs , @ point i'll need elevate privileges on windows specific task (only win7+ concern). how can programmatically? i'll take executing bash script if gets job done. thanks! in order uac elevate, use runas module: https://www.npmjs.com/package/runas

c++ - How to use WriteConsoleOutputAttribute function correctly -

Image
why following code const std::string text = "str"; handle stdout_handle = getstdhandle(std_output_handle); coord coords = { 0, 0 }; dword written = 0; writeconsoleoutputcharactera(stdout_handle, text.c_str(), text.size(), coords, &written); word attributes = foreground_green; writeconsoleoutputattribute(stdout_handle, &attributes, text.size(), coords, &written); results in this: what doing wrong? how can fix it? &attributes points array of length one, single green attribute. claim array text.size() long. result, copy random stack content next 2 cells. happens red-on-red. solution: std::vector<word> attributes(text.size(), foreground_green); writeconsoleoutputattribute(stdout_handle, &attributes[0] ...

c# - Google API Client Library for .NET - Missing documentation -

i'm trying generate page views , events asp.net mvc application using google analytics functionality available in library. the documentation seems lacking, , unable understand how send page views , events. within controller returns partialviewresult , need send page view google analytics service. so far i've found 2 examples of how use library https://developers.google.com/api-client-library/dotnet/get_started https://developers.google.com/api-client-library/dotnet/guide/batch however these various other api's not google analytics. example, in calendar api example there is: calendarservice.events.insert( event title, event description, time , date etc) which used add new entry user's google calendar. for example, can not do: analytics analyticsservice = new analyticsservice(); analytics.pageviews.send(client id, user browser, date time, etc); my question: how use google analytics api send page view in similar manner calendar api? appropriate meth

c# - Why my foreign key is NULL on inserting values -

i sqlserver beginner , had first created table customers see below : create table customers ( id int not null, name varchar(20) not null, age int not null, address char (25) , salary decimal (18,2) default 70000, not null identity(1, 1) primary key (id)); and inserted value in table this: insert [vims].[dbo].[customers] (name, age, address, salary) values('abheshekkabhai',21,'agra',70000.00); and done succesfully please see : http://prntscr.com/7w19cr \ after created table orders this: create table [vims].[dbo].orders ( id int not null identity(1, 1) primary key, date datetime, customer_id int foreign key (customer_id) references customers (id), amount int ); and insert data inside : insert [vims].[dbo].orders(date,amount) values(28,66000.00); i table on repetitively inserting record 6 times : http://prntscr.com/7w1a6j my problem when try insert data in foreign key column gives error saying there conflict of value of id between custom

r - Second and third Kaplan Meier plots exceeding set x limit -

Image
as can see picture above, second , third kaplan meier curves exceed x-limit , box set. i used exact same code 3 plots, changing actual survival object each time, y-axis labels , ranges. x-limit , labels same every plot. example of code below: par(mfrow=c(2,2)) surv.obj <- survfit(surv(start, stop, event) ~ factor(characteristic), data=dataset) par( mai=c(2,3,1.5,0.42) ) colours <- c("gray0", "gray75") # x-axis max( unlist(unname(summary(surv.obj)["time"] )) ) # 1274 plot(surv.obj, mark.time=f, col=colours, lty=1, lwd=2, yscale=100, xscale=1, fun="event", ylab="", xlab="follow-up (days)", xlim=c(0, 1280), xaxt="n", axes=f, cex.lab=1.8, cex.main=1.8 ) box("plot", lty=1) axis(2, cex.axis=1.5, at=c(0, 0.04, 0.08, 0.12, 0.16) ) axis(1, cex.axis=1.5, at=c(0, 300, 600, 900, 1200) ) with repeated 2 times next 2 curves. i know not 'plot specific' code issue, because whe

Group elements in a cell in matlab -

i have cell size of 1x142884 (i have 142884 elements in single cell) , interested group these elements in cell of 36 each. must have 142884 / 36 = 3969 cells. can me group cells each cell consist of 36 cells. edit here code yaml_file = 'feature000000'; yamlstruct = readyaml(yaml_file); feature0 = yamlstruct.features1; blocks_per_img = yamlstruct.blockperimg; you can download feature000000 file here use reshape follows: b = reshape(c,36,3969) you'll end cell b of size 36×3969, every row 1 of 36 items length 3969.

javascript - Phonegap build on Android keeps failing -

i working on phonegap app , wanted test on phone. android build keeps failing , can't figure out why. here log. help. i've tried building multiple times cant figure out wrong. build date: 2015-07-23 11:52:12 +0000 ---------------------------------------------- buildfile: /project/build.xml -set-mode-check: -set-debug-files: -check-env: [checkenv] android sdk tools revision 24.3.0 -setup: [echo] project name: insize [gettype] project type: application -set-debug-mode: -debug-obfuscation-check: -pre-build: -build-setup: [getbuildtools] using latest build tools: 20.0.0 [echo] resolving build target insize... [gettarget] project target: android 5.0.1 [gettarget] api level: 21 [echo] ---------- [echo] creating output directories if needed... [mkdir] created dir: /project/bin [mkdir] created dir: /project/bin/res [mkdir] created dir: /project/bin/rsobj [mkdir] created dir: /project/bin/rslibs [mkdir] created dir: /proj

android - XMPP connection closes on sending IQ Smack 4.1 -

i developing android application using smack 4.1 when send iq packet server, connection server(openfire) gets closed. here packet sending server. <iq id='pk1' type='get'><list xmlns='urn:xmpp:archive' with='ahmed@domain'<set xmlns='http://jabber.org/protocol/rsm'><max>10</max></set></list></iq> i have tested both sendstanza(stanza); , sendiqwithresponsecallback(iq, stanzalistener, exceptioncallback, timeout); this trying achieve xmppframework-retrieve-archived-messages-from-openfire-server thanks in advance.

Cygnus 0.8.2 doesn't work -

i have installed cygnus 0.8.2 in vm centos-6.5-x64. in config file agent.conf change following: cygnusagent.sinks.hdfs-sink.oauth2_token = xxxxxx cygnusagent.sinks.hdfs-sink.hdfs_username = myuser i run cygnus command: /usr/cygnus/bin/cygnus-flume-ng agent --conf /usr/cygnus/conf/ -f /usr/cygnus/conf/agent.conf -n cygnusagent -dflume.root.logger=info,console but when send xml message occurs error: the last packet sent server 0 milliseconds ago. driver has not received packets server.) 2015-07-23 14:46:02,133 (sinkrunner-pollingrunner-defaultsinkprocessor) [warn - com.telefonica.iot.cygnus.sinks.orionsink.process(orionsink.java:163)] event ttl has expired, no more re-injected in channel (id=617320308, ttl=0) 2015-07-23 14:46:02,133 (sinkrunner-pollingrunner-defaultsinkprocessor) [info - com.telefonica.iot.cygnus.sinks.orionsink.process(orionsink.java:193)] finishing transaction (1437651766-108-0000000000) 2015-07-23 14:46:02,637 (sinkrunner-pollingrunner-defaultsinkproces

java - Rounding off digit and decimals to Nearest Hundred -

hi have scenarios in i have verify integer 35.0k 34995 i converting 35.0 35000 string str = new double(casha).tostring().substring(0,casha.indexof('.')); int org=integer.parseint(str); org=org*1000; in have rounded off 34995 35000 in java program i got doing int rounded = ((34995+ 99) / 100 ) * 100; if(org==rounded){ system.out.println("pass"); }else { system.out.println("fail"); } which result in 35000 , verifying but not work values 147.7k(147700) , 147661(147000) 147000 how can compare values 147.7k 123.2k how convert .7 , 2. hundreds. please help, thanks. here way .7 , .2 string numberstring = "123.4k"; numberstring = numberstring.replace("k", ""); double numberdouble = new double(numberstring)*1000; integer numberinteger = numberdouble.intvalue(); system.out.println(numberinteger); output: 123400 so, after this, can run approximation on both numbers , see match. also, recommend

assembly - GAS Assembler operand type mismatch for `cmovz' -

i trying write simple assembly program. reason conditional moves seem give me error. if replace them normal mov instruction works. wrong following code? .section .data supported: .asciz "avx supported" notsupported: .asciz "avx not supported" .section .text .global main main: movq $1, %rax cpuid andq $0x10000000, %rcx cmovnz $supported, %rdi cmovz $notsupported, %rdi callq puts movq $0, %rax ret cpuid.s:15: error: operand type mismatch `cmovnz' cpuid.s:16: error: operand type mismatch `cmovz' if @ description of cmovcc in intel's manual you'll see source operand needs r/m64 (i.e. 64-bit register or memory location). $supported , $notsupported immediates, , therefore not qualify r/m64 . you this: movabs $notsupported,%rdi movabs $supported,%rbx testq $0x10000000, %rcx # checks desired bit without clobbering %rcx cmovnz %rbx,%rdi