Posts

Showing posts from February, 2013

Add another object from a file to a Javascript Object Array -

im trying build cart functionality user add single product array of products or objects. var product = { "name": "bike", "price": "900", "idproduct": "1" }; now store product in plain json text.stringify function that. var jsonstring = json.stringify(product); now take jsonstring , convert object or object array so. var jsonobjectarray = json.parse(jsonstring); now im going create new same json object type diff values. var product2 = { "name": "car", "price": "12000", "idproduct": "2" }; it seems jsonobjectarray doesnt have push method because got deserialized single object namely product1, should can add product2 jsonobjectarray member of aray , repeat process multiple times. jsonobjectarr

Specify a specific double precision literal in c# -

how can specify specific double precision literal or value in c#? for example, use constant of largest double value less 1 in program. largest double less 1 1.11111111 11111111 11111111 11111111 11111111 11111111 1111 x 2^(-1) in binary. expressing big-endian double in hex 0x3fe f ffff ffff ffff i can generate following code: var largestdoublelessthanonebytes = new byte[] {0x3f, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; if (bitconverter.islittleendian) largestdoublelessthanonebytes = largestdoublelessthanonebytes.reverse().toarray(); double largestdoublelessthanone = bitconverter.todouble(largestdoublelessthanonebytes, 0); bitconverter can't used in declaration of const , can't used in place of literal value. using this tool , can come literal 9.99999999999999888977697537484e-1 , ends being same double. bitconverter.tostring(bitconverter.getbytes(9.99999999999999888977697537484e-1)) == "ff-ff-ff-ff-ff-ff-ef-3f" . is there other way specific doubl

node.js - How to tie up express sessions with socket.io -

how tie sessions in express 4 socket.io session data can both retrieved , saved in both directions? authentication in socket.io token-based jwt the same socket shared in multiple vhosts eg: global.socket.of('/secure').on('connection', function(socket){ console.log('client connected "secure" socket'); }); app.js var port = 3000, jwtsecret = '26fed98d8c6c7c54f485f1ee7ffe44d2e1feae28'; var app = require('express')(), vhost = require('vhost'), server = require('http').createserver(app), socketiojwt = require('socketio-jwt'); // start server socket.io global.socket = require('socket.io').listen(app.listen(port, function(){ console.log('express server listening on port '+port); })); // socket authentication global.socket.set('authorization', socketiojwt.authorize({ secret: jwtsecret, handshake: true })); // virtual hosts app.use(vhost('s

file - Read the third string only java -

i have file example : file.txt milano tirana paris madrid istanbul berlin and want read third words of each line paris , berlin. tried substring won't work because length changes. how can ? i'd recommend reading whole line, tokenizing splitting @ whitespace, , return index of value want. something this: package misc; /** * cityparser demo * @author michael * @link https://stackoverflow.com/questions/24420434/read-the-third-string-only-java/24420447#24420447 * @since 6/25/2014 8:36 pm */ public class cityparser { public static void main(string[] args) { int tokenindex = 2; cityparser parser = new cityparser(); (string arg : args) { system.out.println((string.format("line: '%s' tokenindex: %d token: %s", args, tokenindex, parser.gettoken(arg, tokenindex)))); } } public string gettoken(string line, int tokenindex) { string token = null; if ((line != null) &

Where is the download for the dotnet GMail APIs? -

the link specified: https://code.google.com/p/google-api-dotnet-client/wiki/apis#gmail_api points outdated page, , new reference on page not have either: https://developers.google.com/api-client-library/dotnet/apis/ i don't see on nuget either. [updated] it's ready , linked downloads page you'd expect: https://developers.google.com/gmail/api/downloads that links .net client docs: https://developers.google.com/api-client-library/dotnet/apis/gmail/v1 which has pointers libraries in nuget.

python - Transform a list of dicts to a new list of dicts with a different format -

what best approach transform existing list of dict shown below new list of dicts shown below? given: data = [{'count': 3}, {'day': '2013-07-14'}, {'count': 5}, {'day': '2013-04-14'}] expected output: newlist = [{'name': 'day', 'data': ['2013-07-14', '2013-04-14']}, {'name': 'count','data': [3, 5]}] it looks trying group data together. use dict() newlist, honestly... i'll add in conversion list @ end. basically iterate list of dicts, iterate dicts , add them new dict. using dict target easiest since let add appropriate list element. @ point, stop , use dict output, answer question fully... then convert dict list of dicts in format looking for. there might cleverer ways of doing dict , list comprehensions, might easier way if learning. data = [{'count': 3}, {'day': '2013-07-14'}, {'count': 5}, {

VLOOKUP in excel -

lets have 3 columns a b c 1 8 0 2 9 0.3 3 15 0.1 4 16 0.01 5 17 0.02 6 18 0.05 i need find values in column c greater 0.1 , less -0.1. can using conditional format tab. once these values found need find corresponding values in column , using values need find values in column b in difference between values in column , column b less 8. example, lets take 0.3 in column c, corresponding value in column 2. looking @ values in column b see 8-2<8, need print in column d. need print 9-2 since less 8. should not print 15-3 since value greater 8. know need use vlookup lost on how proceed . please me out? a b c d 1 8 0 2 9 0.3 6,7 3 15 0.1 4 16 0.01 5 17 0.02 6 18 0.05 output sample second row 6,7. way 6,7 follows. since in column c 0.3> 0.1 0.1 defined us(conditional format) , take values column b. each value

c# - Getting the correct connection string for EF in local db -

Image
pretty new , following instruction on asp.net mvc book, here how local db looks like: and here how connection string looks like: <add name="efdbcontext" providername="system.data.sqlclient" connectionstring="data source=(localdb)\v11.0;initial catalog=sportsstore;integrated security=true" /> have done wrong? when run app crashes message: an exception of type 'system.io.fileloadexception' occurred in ninject.dll not handled in user code additional information: not load file or assembly 'entityframework, version=6.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089' or 1 of dependencies. located assembly's manifest definition not match assembly reference. and message in browser: could not load file or assembly 'entityframework, version=6.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089' or 1 of dependencies. located assembly's manifest definition not match assembly reference. exception d

php - How to implement search for a tagging system? -

many types of systems use tags organize content, including blogs , stackoverflow. let's i'm making movies website , want users able tag movies, search movies using combinations of tags. here's sample database structure: movies: id, name movie_tag_options (used provide users list of available tag options): id, name movie_tags: id, m_id, mto_id let's there's movie called "transformers 9 - explosions" , has tags "action", "pg-13", , "terrible movie". want users able find movie performing search "action,pg-13,terrible movie". i explode string of tags in php array of tags: action pg-13 terrible movie so question is, how use tag names find movies these tags? movies can have other tags well, should returned if have of tags in search. the solution can think of denormalize tag name , store in movie_tags movie_tag_options (i.e. adding duplicate name column movie_tags ), constructing query in php generate

java - Two of my panels connect together when adding to the third panel -

Image
i trying add 2 panels in each has own components onto panel, when program executes 2 panels amalgamate each other. please check out code. import javax.swing.*; import java.awt.*; /* * 2 labels withdraw/deposit. * 2 textfields entering withdrawal/deposit amount. * 1 label balance, 1 non-editable textfield balance. * event listener on calculate button. * action performed: balance minors withdrawal plus deposit */ / ** * class manages input numbers. user input withdrawal/deposit amount * , program display balacne after transfers. * @author administrator * */ public class datapanel extends jpanel { public final int textfield_length = 10; public final int layout_vgap = 25; public final int layout_hgap = 15; /** * constructor sets layout, creates labels/fields. */ public jpanel pane1 = new jpanel(); public jpanel pane2 = new jpanel(); public jpanel pane = new jpanel(new gridlayout(1,2)); //create necessary fields , labels jlabel withdrawallabel = new jlabel("wi

c# - Multiple MVC5 websites using a single website for authentication (ASP.NET Identity v2) -

looking guidance on using asp.net identity provide single location logon / authentication across number of sites (that subdomains of common domain). the current setup have 2 websites: site1.example.com site2.example.com they present different views of system users, , share same backend database, , therefore same asp.net identity tables. logging on via either site logs on via same db. what want unify logon process via third site: auth.example.com the idea being user visits site1.example.com , clicks login button, redirected auth.example.com , performs log in, , redirected site1.example.com . if navigated site2.example.com , nice if seen authenticated already. what seem looking single sign on. https://github.com/thinktecture/thinktecture.identityserver.v3 1 , open source. think supports asp.net identity user service well.

html - Make overflow-auto only for the last part of the page -

i have page consist of 2 parts: first part can of various height , second part should take other size of visible page. height of elements inside of second part can big , part should scrollable. the closest thing came this fiddle , problem using fixed height of second element: .images{ overflow-y: auto; height: 350px; } one more time: not know height of first part, can not use height: 20% first one, , height: 80% second. any idea, how can fix it? add following jquery code: var windowheight = $(window).height(); var headerheight = $('.header').height(); var imagesheight = windowheight - headerheight; $('.images').height(imagesheight); don't forget include link main jquery in page: <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> you may keep in <head> section.

PackageStats data returning 0 in Android JB -

i working on custom application manager , try disk usage of installed package. so packagemanager.getpackagesizeinfo removed sdk on 0.9->1.0 update android.content.pm.packagestats(string pkgname) (cachesize, codesize, datasize) returns "0" has solution total disc space used installed package? this code: public long gettotalexternalsize(packagestats ps) { if (ps != null) { system.out.println("--uday-- entering inside ps! = null condition gettotalexternalsize!!! " + ps.codesize +" " + ps.datasize + " " + ps.cachesize +" , packagename " + ps.packagename ); return ps.externalcodesize + ps.externaldatasize + ps.externalmediasize + ps.externalobbsize; } system.out.println("--uday-- not entering inside ps! = null condition gettotalexternalsize!!!"); return size_invalid; }

ruby - expected one of [String, Regexp], got 1:Fixnum (TypeError) in page-object -

i trying find image , using if condition image exists? performing delete operation. if not addition. getting following error when doing so.. html: <div class="xicgridviewport"> <table id="patetrngrid-100228" class="xicgrid xicgridloaded" cellspacing="0" cellpadding="0"> <colgroup> <thead> <tbody> <tr id="id328" class=" xicgridrow0"> <td> <td> <td> <td> <td> <td> <td style="text-align: center;"> <td style="text-align: center;"> <a id="cellico

c# - Making instance values equal -

how make true???? student studentinstance1 = new student(); student studentinstance2 = new student(); studentinstance1.name = "qwerty"; studentinstance2.name = "qwerty"; if(studentinstance1==studentinstance2) i need answer how make instance values equal??? correct way override equals() , gethashcode() methods in student class. here article in msdn how it: http://msdn.microsoft.com/en-gb/library/ms173147(v=vs.90).aspx

codeigniter - Web app and API in same Laravel project? -

i trying figure out best way structure new project embark on. we have web app , mobile app both fed data api. web app done on installation of codeigniter , api done on separate installation of codeigniter. data, web app makes calls api , handles returned data. at point looks doing switch laravel web app , thinking might opportunity redo api of our rules have changed , might time off codeigniter altogether. now question: have read few sources of people building web app , api same laravel project , using routing control mapping of api , web app separately. while seems interesting idea makes me wonder if best practice wonder if heavy api traffic slow down web app , vice versa. question: would best practice keep api decoupled in own project or ok in same project? follow question to make call web app through api if not decoupled, call api route? better go through classes? in opinion have 2 choices: build api laravel ( response::json everywhere), build web app

loops - PHP For iOS Push Notifications, Sometimes More Than 1 Device -

i building app in using nsuserdefaults store various pieces of information, including devicetoken used apns on ios. way working user submits request, , adds entry xml, 1 of elements in xml called devicetoken. when responds request, triggers php @ bottom of page send push notification devicetoken of particular request. issue people have more 1 device, , nice send push notification of owner's devices. can see in code below, have 2 areas devicetokens. if xml contains 2 device tokens, great. issue ones there 1 token, fail deliver one. how can fix php able accept 2 devicetokens, still deliver if 1 available? <?php $first_name = $_post['first_name']; $last_name = $_post['last_name']; $title = $_post['title']; $devicetoken = $_post['devicetoken']; $devicetoken2 = $_post['devicetoken2']; $xml = simplexml_load_file("http://www.url.xml") or die("not loaded!\n"); $passphrase = 'passphrase'; // put alert

java - Ultimate Aim of Spring-Boot -

as may know spring4 comes new features, , 1 of important feature among them spring-boot. following links below http://docs.spring.io/spring-boot/docs/current-snapshot/reference/htmlsingle/#boot-documentation https://github.com/spring-projects/spring-boot spring-boot feature comes new class files in org.springframework.boot.* start spring application. there 2 question comes in mind that 1- javase, can start-up spring application previoues spring versions easly, new feature spring-boot simple boot 2- javaee, far know spring-boot not javase project, can start-up web projects well. in future spring-boot works application-server (like glassfish) although spring boot works spring 4+, technically different project. means can use spring 4 without spring boot code. the aim of spring boot provide easy way configure spring application providing sensible defaults , easy configuration options stuff commonly used (and otherwise have implemented) on , on again in our appli

unity3d - UCE0001: ';' expected. Insert a semicolon at the end -

i'm trying make gui.drawtexture clickable, error said "assets/script/guisettingonmenu.js(46,13): uce0001: ';' expected. insert semicolon @ end." can please me? //make clickable rect onbutton = new rect(640, 250, 80, 40); gui.drawtexture(onbutton, onnormal); if(input.getmousebutton(0)){ if (onbutton.contains(event.current.mouseposition)){ gui.drawtexture(onbutton, onhover); } } yup c# syntax in js goes var onbutton : rect = new rect(640, 250, 80, 40);

php - MySQL selecting "previous" max(id) WHERE -

i have table inserts data when kid checks in summer camp area. if kid < 12 years of age parents barcode must scanned allow kid entry young kids area (<12 years of age). the table has following columns. kcid uid id age room barcode date amber the data presented this. kcid uid id age room barcode date amber 25 1 1 30 1000 0001 6/26/2014 1:27:40 0 26 6 1 1 1000 0005 6/26/2014 1:27:40 0 the problem have need compare dates/hours know if kid entering or leaving camp area , via php send sms parents know kid outside particular area. i know can retrieve max(kcid) barcode = xxxx , return last inserted row, but, in order me retrieve said information kid must scanned, inserting new row , rendering max(kcid) useless in case. what need able select max(kcid) barcode = xxxx , select previous row record in barcode = xxxx found. way can compare dates , know if kid leaving or entering partic

winapi - Simple Hello World in x86 ASM - Windows console -

i'm trying run following hello word example in x86 assembly under windows: global _main extern _getstdhandle@4 extern _writefile@20 extern _exitprocess@4 section.text _main : ; dword bytes; mov ebp, esp sub esp, 4 ; hstdout = getstdhandle(std_output_handle) push - 11 call _getstdhandle@4 mov ebx, eax ; writefile(hstdout, message, length(message), &bytes, 0); push 0 lea eax, [ebp - 4] push eax push(message_end - message) push message push ebx call _writefile@20 ; exitprocess(0) push 0 call _exitprocess@4 ; never here hlt message : db 'hello, world', 10 message_end : following error when trying link assembled .obj file: error lnk2001: unresolved external symbol _getstdhandle@4 error lnk2001: unresolved external symbol _writefile@20 error lnk2001: unresolved external symbol _exitprocess@4 fatal error lnk1120: 3 unresolved externals source of example: how write hello world in assembler under w

rfc2616 - Content-Encoding vs Transfer Encoding in HTTP -

i have question on usage of content-encoding , transfer-encoding: please let me know if below understanding right: client in request can specify encoding types willing accept using accept-encoding header. so, if server wishes encode message before transmission, eg. gzip, can zip entity (content) , add content-encoding: gzip , send across http response. on reception, client can receive , decompress , parse entity. in case of transfer encoding, client may specify kind of encoding willing accept , perform action on fly. i.e. if client sends te: gzip; q=1, means if server wishes, can send 200 ok transfer-encoding: gzip , tries sending stream, can compress , send across, , client upon receiving content, can decompress on fly , perform parsing. is understanding right here? please comment. also, basic advantage of compressing entity on fly vs compressing entity first , transmitting across? transfer-encoding valid chunked responses not know size of entity before transmission?

java - Setting Margin / Inset for cells in Tablelayout in Swing -

Image
is there anyway set margin cell in tablelayout (for swing application) insets in gridbaglayout . i need space between cells in table. 1 solution adding rows or columns needed space. if solution applicable netbeans, more glad. there 2 tablelayout managers. clear thoughts ' tablelayout , more recent esoteric softwares' tablelayout . i provide simple example using both managers. put 6 buttons on window , add space between them. clear thoughts' solution package com.zetcode; import info.clearthought.layout.tablelayout; import java.awt.eventqueue; import javax.swing.borderfactory; import javax.swing.jbutton; import javax.swing.jframe; import javax.swing.jpanel; public class tablelayoutgaps2 extends jframe { public tablelayoutgaps2() { initui(); settitle("gaps"); setdefaultcloseoperation(jframe.exit_on_close); setlocationrelativeto(null); } private void initui() { jpanel base = new j

asp.net mvc - How to format numbers in C# MVC 4 to reflect a two decimal point currency? -

so i'm having trouble view wanting more numbers behind decimal point input want need. i using model: public class movie { public int id { get; set; } public string title { get; set; } public datetime releasedate { get; set; } public string genre { get; set; } [displayformat(dataformatstring = "{0:f2}", applyformatineditmode = true)] public decimal price { get; set; } } this in view: <div class="editor-label"> @html.labelfor(model => model.price) </div> <div class="editor-field"> @html.editorfor(model => model.price) @html.validationmessagefor(model => model.price) </div> it seem adding displayformat attribute movie.price isn't enough allow users enter numbers 2,79, if try they'll validation error. input field created @html.editorfor(model => model.price) instead requires number 2,790 (notice additional 0 added behind decimal). i

ios - Custom NSObject iniWithCoder not called -

i have custom object, levelcontent , contains properties. levelcontent conforms nscoding , , have implemented encodewithcoder: , initwithcoder: methods. save , fetch data parse.com. saving works fine this: nsdata *data = [nskeyedarchiver archiveddatawithrootobject:self.currentlevelcontent]; when fetch data, nsdata correctly, when try initialize levelcontent with downloaded data, initwithcoder: never gets called. try load levelcontent this: levelcontent *content = [nskeyedunarchiver unarchiveobjectwithdata:data]; here code encoding/decoding - (void)encodewithcoder:(nscoder *)acoder { [acoder encodeobject:self.tiles forkey:@"tiles"]; [acoder encodeobject:self.attributes forkey:@"attributes"]; [acoder encodeobject:self.level forkey:@"level"]; } - (instancetype)initwithcoder:(nscoder *)adecoder { if (self == [super init]) { self.tiles = [nsmutablearray array]; [self.tiles addobjectsfromarray:[adecoder decodeo

android - Unable to access sharedpreference from one class to another -

hi developing android opengl live wallpaper. unable access shared preference wallpaperservice renderer class.i getting error like: 06-26 01:42:38.285: e/androidruntime(4778): fatal exception: main 06-26 01:42:38.285: e/androidruntime(4778): java.lang.classcastexception: java.lang.integer cannot cast java.lang.string 06-26 01:42:38.285: e/androidruntime(4778): @ android.app.sharedpreferencesimpl.getstring(sharedpreferencesimpl.java:224) 06-26 01:42:38.285: e/androidruntime(4778): @ com.srashtaa.planets3dgalaxylivewallpaper.nehelesson08renderer.loadpreferences(nehelesson08renderer.java:155) 06-26 01:42:38.285: e/androidruntime(4778): @ com.srashtaa.planets3dgalaxylivewallpaper.nehelesson08renderer.setcontext(nehelesson08renderer.java:146) 06-26 01:42:38.285: e/androidruntime(4778): @ com.srashtaa.planets3dgalaxylivewallpaper.nehelesson08wallpaperservice$myengine.<init>(nehelesson08wallpaperservice.java:42) 06-26 01:42:38.285: e/androidruntime(4778): @ com.

mysql - Handling $resource request from PHP backend using SLIM -

i'm having problems accessing php backend angularjs. i have followed: http://coenraets.org/blog/2012/02/sample-application-with-angular-js/ routing angularjs , slim php some other's similar. i've tackled problem few days , still can't working. first way call php script app.controller('phonedetailctrl',function($scope, $modal, $resource) { var request_id = 1; var request = $resource('http://mobiiltelefonid24.ee/api/kasutatud_telefonid/'+request_id); $scope.request = request.get();} //this way code 200 119 empty chars.. figure routing should correct? second way tried app.controller('phonedetailctrl',function($scope, $modal, service) { $scope.request = service.get({id:1});} //this gives me code 200 119 empty chars... app.service('service', function ($resource) { return $resource('api/kasutatud_telefonid/:id', {}, { update: {method:'put'} });}); php code (using mysql db) require 'slim/slim.php

java - gradle ignoreFailures test property -

my build.gradle file following : apply plugin: "java" ... test { ... ignorefailures = "$ignorefailureprop" } and gradle.properties with ignorefailureprop=false when executed gradle clean build , unit test failures not mark build failed. i know default behaviour fail build, want explicitly set through property, change in without modifying build file the problem ignorefailureprop property string ignorefailures (which should boolean) set string , therefore true. you instead: apply plugin: "java" test { ignorefailures = ignorefailureprop.toboolean() } this should work.

c# - editor for Nullable in PropertyGrid -

i have create class inherit icustomtypedescriptor dynamicly load properties in propertygrid. need edit datetime inside. if type nullable<datetime> standart calendar editor not shown datetime works cant leave editor field empty (like want set value null ). note. im not using class attributes, need somehow solve problem using icustomtypedescriptor , propertydescriptor im using. nobody knows?

go - Why is my goroutine not executed? -

i'm learning go , wanted try goroutines , channels. here's code: package main import "fmt" func main(){ messages := make(chan string,3) messages <- "one" messages <- "two" messages <- "three" go func(m *chan string) { fmt.println("entering goroutine...") { fmt.println(<- *m) } }(&messages) fmt.println("done!") } and here's result: done! i don't understand why goroutine never executed. "entering goroutine" not printed , don't have error message. the fact goroutine starts, ended before doing because program stop right after printing done! : execution of goroutines independant of main program, stopped @ same program. basically, need process make program wait them. channel waiting number of messages, sync.waitgroup , or other tricks. you should read excellent post concurrency in go in golang blog.

java - install JDBC on Amazon E2 server getting error "com.mysql.jdbc" -

i have developed java aplication use jdbc. on different ubuntu computers. every thing works fine. when try run program on bitnami amazon e2 server part course me trouble. try { class.forname("com.mysql.jdbc.driver"); } catch (classnotfoundexception e) { system.err.println(e.getmessage()); return; } it throws message "com.mysql.jdbc.driver" i tried run following command works fine on ubuntu desktop installation openjdk. export clasexport classpath=:/usr/share/java/mysql-connector-java.jar:/usr/share/java/mysql-connector-java.jar but seams folders not same on e2 server. how find right path? add driver jar classpath.

javascript - Remove dash(-) from uuid generated by funciton __UUID in jmeter -

i new jmeter , calling $(__uuid) function in jmeter uuid. uuid generated this 14c5f969-ba57-4493-b4ba-01f1c8b6908d how remove dashes final result uuid 14c5f969-a574493b4ba01f1c8b6908d i calling $(__uuid) function "http request defaults" samples in jmeter path textfield set /end/fa7dbe2de11f4f08b3c941ff8b5b4c08/now/${__uuid}/ if i'm correctly getting question , want remove dashes path can done via beanshell pre processor . add child of http request(s) replacement required , put like string path = sampler.getpath(); sampler.setpath(path.replaceall("-","")); to "script" area. this code replace occurrences of dash symbols in http request path. see how use beanshell: jmeter's favorite built-in component guide more information regarding beanshell scripting in apache jmeter , kind of beanshell cookbook.

HtmlList: Select options in a select with padding -

i using property selecteditemsasstring htmllist object select multiple items in select-tag. myhtmllist.selecteditemsasstring = new string[] {"a"}; this works expected in demo, not in productive website, because there select-tag has left padding. <select multiple="multiple" style="padding-left: 12px; width: 400px;"> <option>a</option> <option>b</option> <option>c</option> </select> this results in mouse click far left of actual option , therefor no option selected. ideas how can make work without removing padding? you right. seems codedui bug me. instead of clicking list item control, clicks on top left corner of selected item row. as alternative can click , select items ourselves. var selecteditems = new string[] { "a", "c" }; // clear existing selections myhtmllist.selectedindices = new int[] { }; // select items myhtmllist.getchildren().cast<ht

Google Polymer Repeat value in range 1...n -

i've started messing polymer , i've done basic tutorial social media cards. in several cards care looped on repeat="{{post in posts}}" . repeat="{{post in range 1...10}}" . i'd use published property cols provide max value instead of 10. i've been able working setting cols property [1,2,...,9] unreasonable large set of values. i've expanded on using ready function , executing this.colsar = new array(cols) , in repeat `{{col in colsar}}. what best/correct method of looping on variable number of elements number determined property? to add lets cols property dynamically changed via select input. should cause re-draw when new value selected. generally best way use computed property express filtered array. something this: <template repeat="{{post in slice}}"> ... computed: { slice: 'sliced(posts)' }, sliced: function(posts) { return posts.slice(1, 3); } however, right now, computed pr

java - Put Sql Data to a Number Array -

i have problem. how can put data sql database number array. put them in graph i got nullpointerexception these command number[] series2numbers={s1nint[1]}; here full code opendb(); cursor c = mydb.getspalte(); while (c.movetoprevious()) { s1nint[i] = c.getint(1); i++; c.movetoprevious(); } c.close(); closedb(); number[] series2numbers={s1nint[1]}; and here exception: graph.onstart() line: 85 graph(fragment).performstart() line: 1801 fragmentmanagerimpl.movetostate(fragment, int, int, int, boolean) line: 937 fragmentmanagerimpl.movetostate(int, int, int, boolean) line: 1106 backstackrecord.run() line: 690 fragmentmanagerimpl.execpendingactions() line: 1571 fragmentmanagerimpl$1.run() line: 447 handler.handlecallback(message) line: 733 handler.dispatchmessage(message) line: 95 my getspalte() public cursor getspalte(){ string where= null; string order = "_id desc"; cursor c = db.que

Speech API that works both on Windows Phone and Windows 8.1 -

i'm trying write app work on windows phone , windows 8.1. the part running speech recognition. can't find single api shared between phone , 8.1. i have tried windows.phone.speech, works on phone. , have tried bing.speech, works on 8.1, , not phone. need 1 works on both. does google have api chance?

vb.net - When should I use multiple constructors? -

what difference between these 2 options? first option - multiple constructors public sub new(some parameters) 'do somthing end sub public sub new(other parameters) 'do end sub in case, use multiple constructors different parameters in order initialize different objects or create instance of class in different ways. second option - using optional parameters public sub new(optional values) 'do end sub in case, use optional parameters when want assign them.by using method can control objects want initialize or create instance of them. in first case, using method overloading invoke different functionality in different constructors based on method signature. functionality might include allowing parameters assume default values. using optional parameters more appropriate in constructor when only want parameters optional , you're not looking invoke different functionality in constructor, other allowing parameters set default if don&#

hadoop - Implementing a custom Apache pig algebraic UDF -

everyone i implemented custom aggregate pig udf. udf implements algebraic interface, , there 3 classes - initial, intermed , final work @ different phases. works correctly, inefficiently. the udf uses algorithm bit heavy - when running on single value. work more efficiently when running on bigger groups of data - - 100 @ time. observed initial class invoked single value, , later combined intermed , final classes. i aware there's accumulator interface such cases, not find documentation on how use algebraic udf. so question - there way me "force" pig pass more values initial calculation - either using accumulator interface or via other way. an explanantion or pointer documentation or sample appreciated. thanks amir it seems pig's algebraic initial function receive single value in tuple (at least according this blog post ). to solve issue, ended doing return single value in initial without processing @ all. intermed , final functions perform al

java - Convert date to friendly format using SimpleDateFormat -

i trying format date such mon jul 28 00:00:00 cdt 2014 bit more user friendly, such mon 6/28 . doing wrong? code: string date_string = "mon jul 28 00:00:00 cdt 2014"; simpledateformat inputformatter = new simpledateformat("ccc lll f hh:mm:ss zzz yyyy"); //please notice capital m simpledateformat outputformatter = new simpledateformat("ccc lll/yyyy"); try { date date = inputformatter.parse(date_string); string text = outputformatter.format(date); system.out.println(text); } catch (parseexception e) { e.printstacktrace(); } when use system.out.println see outputformatter set to, result is: sun jan/2015 try this.. change this.. simpledateformat outputformatter = new simpledateformat("ccc lll/yyyy"); to simpledateformat outputformatter = new simpledateformat("eee m/dd"); eee --> mon eeee -->

Does MSbuild require Visual Studio to be installed on the build server? -

can use msbuild without visual studio 2012? currently, have build server compiling , creating deployment copy of 1 of our projects, has visual studio professional edition installed. setting new build server now. need visual studio 2012 on new build server? if yes, how? googled couldn't find answer. no, don't need visual studio on build box. if recall correctly, msbuild installed part of .net framework - used be. depending on you're building, may find there some things easier working if install visual studio though - things portable class library profiles. while there non-vs installers available, i've found simpler install express edition of visual studio bundled build targets.

python - 'bea' is not defined? -

this question has answer here: error in python d not defined. [duplicate] 3 answers def money(): cashin = input("please insert money: £1 per play!") dif = 1 - cashin if cashin < 1.0: print ("you have inserted £", cashin, " must insert £", math.fabs(dif)) elif cashin > 1.0: print ("please take change: £", math.fabs(dif)) else: print ("you have inserted £1") menu() def menu(): print ("please choose artist: <enter character id>") print ("<bea> - beatles") print ("<mic> - michael jackson") print ("<bob> - bob marley") cid = input() if cid.upper == ("bea"): correct = input("you have selected beatles, correct? [y/n]:") if correct.upper() == ("

javascript - How to change style for before/after in Angular? -

i'm trying implement breadcrumbs triangles using before/after in css, shown in tutorial: http://css-tricks.com/triangle-breadcrumbs/ relevant snippets: <ul class="breadcrumb"> <li><a href="#">home</a></li> </ul> .breadcrumb li { color: white; text-decoration: none; padding: 10px 0 10px 65px; background: hsla(34,85%,35%,1); position: relative; display: block; float: left; } .breadcrumb li a:after { content: " "; display: block; width: 0; height: 0; border-top: 50px solid transparent; border-bottom: 50px solid transparent; border-left: 30px solid hsla(34,85%,35%,1); position: absolute; top: 50%; margin-top: -50px; left: 100%; z-index: 2; } however, i'm using directed flow, like: main_category >> sub_category >> details this flow starts main_category highlighted , other 2 parts dark, , t

MATLAB Warnings under fmincon -

i'm minimizing function fmincon routine. this function uses integral command several times. however, of integrals turns out inf or nan , don't want matlab show warning when happens (the function finite). i've tried using command warning('off','matlab:integral:nonfinitevalue') don't seem working when running optimization. it you're suppressing wrong message. inspect values of [a,b] = lastwarn inside output function ( opts = optimset('outputfcn', @myoutfcn); ) make 100% sure you're killing correct warning message. but have encountered annoying behavior before -- can't seem suppress warnings in matlab's own functions. those, have resort ugly , fragile hacks. you try warning off ... warning on which suppresses all warnings code contained in ' ... ' section. you use undocumented feature: temporarily promote warning error: ws = warning('error', 'matlab:integral:nonfinitevalue&#

java ee - JSF Expired ViewScope issue -

i using jsf2.2 & tomcat 6.0.35. have application, display & edit user details. sending ajax request processing on change of each input edit details & updating form. when try change input after long idle time (after 30 mins), getting nullpointerexception managed bean instance variable. server has cleaned instantiations idle long time, client-browser doesn’t know ? here code. commontemplate.xhtml <!doctype html> <html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:ui="http://java.sun.com/jsf/facelets"> <h:head> <title> vsp </title> <meta http-equiv="expires" content="0"/> <meta http-equiv="pragma" content="no-cache"/> <meta http-equiv="cache-control" content="no-cac

compilation - Java NoClassDefFoundError can't compile -

i have problem java. after compile main class main.java, command javac main.java use command java main in same directory main.class located, , see error message: exception in thread "main" java.lang.noclassdeffounderror: main (wrong name: main/main) @ java.lang.classloader.defineclass1(native method) @ java.lang.classloader.defineclass(classloader.java:788) @ java.security.secureclassloader.defineclass(secureclassloader.java:142) @ java.net.urlclassloader.defineclass(urlclassloader.java:447) @ java.net.urlclassloader.access$100(urlclassloader.java:71) @ java.net.urlclassloader$1.run(urlclassloader.java:361) @ java.net.urlclassloader$1.run(urlclassloader.java:355) @ java.security.accesscontroller.doprivileged(native method) @ java.net.urlclassloader.findclass(urlclassloader.java:354) @ java.lang.classloader.loadclass(classloader.java:424) @ sun.misc.launcher$appclassloader.loadclass(launcher.java:308) @ java.lang.classloader.loadclass(classloader.java:357) @ sun.la

.htaccess - url redirection from http://, www, and http://www to only https://domainname.com -

can me url redirecting .htaccess file? i want redirect url 1 , https://mydomain.com if types " www " or " http:// " or " http://www " or " https://www ", user should go https://mydomain.com thanks! amit you need 2 rules. in cases there double redirection tho. <ifmodule mod_rewrite.c> rewritecond %{http_host} ^www\.(.+)$ [nc] rewriterule ^ https://%1%{request_uri} [r=301,l] rewritecond %{server_port} !^443 rewriterule ^ https://%{http_host}%{request_uri} [r=301,l] </ifmodule> edit: remove www part. please note ssl cert match site.com not www.site.com, cause security alerts when access via https://www , i'm not sure can avoid htaccess rules. the first rule trigger , redirect https:// + www https:// without www , alert might fire anyway. give try.

c# - Pass model values to controller in using jQuery Post () -

the application in .net framework 3.5 , mvc framework 2.0 .net framework 3.5. have view in $.post passes parameters. need $.post , passes model values controller. in view below , how pass model in $.post function, controller gets value of textbox. need button , not submit button. the view is: <div> <label ="name"> name</label> &nbsp; <%=@html.textboxfor(m => m.name) %> <select id ="prod" style ="width:150px"> <option value ="gl">gl</option> <option value = "property"> property</option> <option value = "package">package</option> <option value = "island">island</option> </select> <input type="button" id="btnpost" value = "getvalue" /> </div> <script src="/scripts/jquery-1.4.1.min.js&