Posts

Showing posts from January, 2015

model - MVC 5 difficult to Routing RedirectToAction. Not Open View -

i have problem: i have homecontroller call redirecttoaction("index", "userslist"); and work, when call action link (on index): @model ienumerable<whatsappsender.models.userslist> ... ... <p> @html.actionlink("create new", "create", "userslist") </p> // get: userslist/create public actionresult create() { ___ ok ___ arrive in point return view(); } not open create view, but if call directly http:// localhost:2250 / userslist/create it's work .............. than :) :) don't know try use href in paragraph <a href="@url.action("create","userslist")">create new</a>

c# - Open new View when new ViewModel is available? -

i relatively new wpf/mvvm. our current wpf project still prototype application, means haven't come designing of main layout. have designed reports (by reports, mean quite complicated usercontrol each of has configuration controls such comobbox or textbox , , datagrid , graph controls data want present) view and viewmodel . still prototype, need open new window displays of these usercontrol . in future, might change locate different usercontrol in different regions inside main window, layout of visual studio. main point is, our application include hundred of such usercontrol or call reports. different previous working projects had static layout/mainview. i still haven't figured out architecture it. our classic usage scenario let user select in menu report open, , have command (either in mainviewmodel, or in viewmodel of report) objects open new report. command generating new viewmodel ( viewmodel first case) , corresponding view should generated (by whom?), , new...

Elixir: struct default value from function -

can default value variables of struct defined function instead of raw value? a default value struct field expression evaluated @ time of struct definition. proof: # struct.exs defmodule m defstruct [a: io.gets("> ")] end # ... $ iex struct.exs erlang/otp 17 [erts-6.0] ... > hello interactive elixir (0.13.3-dev) - ... iex(1)> %m{} %m{a: "hello\n"} you can define function create struct , set of fields: # struct.exs defmodule m defstruct [a: nil] def new(val) %m{a: val} end end # ... m.new(123) #=> %m{a: 123}

tkinter Python variable.Get() -

when add text entry , confirm don't there nothing @ did try have failed , can plz me easy . thx from tkinter import * win = tk() def press(): win1 = tk() def confirm(): text=inp.get()+" "+inp1.get() print(text) win1.destroy() inp = stringvar() entry(win1, textvariable=inp).pack() inp1 = stringvar() entry(win1, textvariable=inp1).pack() t_okno1 = button(win1, text='pridaj', command=confirm) t_okno1.pack() b = button(win, text='pridaj tovar', command=press) b.pack() the win window won't appear unless call mainloop on it. b = button(win, text='pridaj tovar', command=press) b.pack() win.mainloop() and win1 should toplevel instance instead of tk in order process events. def press(): win1 = toplevel()

linux - Not getting proper prompt when using SHH -

Image
i logged account on bluehost using ssh , got unusual prompt. i expected show directory , typical prompt instead got bash . what you're seeing default bash prompt. when distro doesn't provide better 1 in /etc/profile or similar. can on platform ignoring environment , config files: env -i bash --norc to user@host:dir$ prompt debian , derived distros use, can add export ps1='\u@\h:\w\$ ' to .bash_profile

python - QDataWidgetMapper and validation -

i have tree view several columns. use qdatawidgetmapper connect each column 1 of several widgets on sidebar. data can changed double-clicking on cell in tree view or using widget on sidebar. one of columns has string data needs validated. created custom delegate, attached both tree view , data widget mapper. has qregexpvalidator, prevent invalid input while user typing. also, in setmodeldata(), has different validation check once user has pressed "enter". tree view, delegate works fine. mapped qlineedit, there 2 problems: the qregexpvalidator not called (presumably because createeditor() not used sidebar widget); user can type in bad input qlineedit. if data fails check during setmodeldata(), text in qlineedit not switch original text. when user clicks on other qlineedit, error message gets printed again. am going wrong way? here simplified example. replaced tree view list view simplicity: class testwidgetmappervalidate(qtgui.qmainwindow): def __...

c# - Text label automatically updates with temperature reading every one second -

i created code read temperature reading memory address using memoryreader.dll found online, , list temperature reading in label currenttemp.text. the thermometer updating, i'd label update temperature. able interrupt loop updating temperature clicking button, allow me change other features on menu (not yet implemented). i couldn't figure out way have start/stop button edits variable accessible both button1_click method , stop_click method, have stop_click method change status.text label on off, allows on off control. right code works except for loop. when add loop in, causes application freeze when click start button, , temperature value on form not update. i searched thoroughly on stackoverflow , google, couldn't seem find answer work. here's code: using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.text; using system.windows.forms; using memoryeditor;...

c# - How do I make IIS recognize a directory as a program's folder? -

Image
because of licensing issues 3rd party software (it not necessary me go why) have install, designed run off server, onto people's local computers. program asp.net c# program uses web.config , iis. have go around everyone's machine use program , set iis. test how program look, have tried on machine. error: this error can caused virtual directory not being configured application in iis this means, guess, have tell local iis program directory using under localhost/wwwroot program directory. how do that? in iis expand site folder under (most default website), right-mouse click on folder application in , select "convert application" you may need configure application pool used application (e.g. make sure .net framework version matches 1 used application)

web services - jquery invoke 500 InternalServerError -

but on our production server. works great in every other environment. web service runs fine on production, don't understand what's (apparently) corrupting exception throw in production. first, jquery. when checkbox checked, call web service try call "token assignment": if (chk.is(":checked")) { chk.invoke('assigntoken', params, function () { //go tree category, down header find count. var spntokencount = $this.closest('.category').find('.tokencount'); var tokencount = 1; if (!isnan(spntokencount.text())) { tokencount = parseint(spntokencount.text()); tokencount--; spntokencount.text(tokencount.tostring()); } if (tokencount == 0) { $this.closest('.category').find('.spnavailable').hide(); ...

How to save a int in a android app for when the app is reopen -

when app running receives number(id) it's used notification. i need save number when reopen application, number can retrieve, , application doesn't trow notification of same id. any suggestions on how appreciated? you can use sharedpreferences http://developer.android.com/reference/android/content/sharedpreferences.html saving data. saved data can retrieve sharedpreferences

npm does not install into node_modules -

i in directory containing node_modules directory ls > coverage etc gruntfile.js lib node_modules npm-debug.log package.json from directory, npm install spits out following: npm err! error: attempt unlock grunt-contrib-jshint@0.10.0, hasn't been locked npm err! @ unlock (/usr/local/lib/node_modules/npm/lib/cache.js:1434:11) npm err! @ cb (/usr/local/lib/node_modules/npm/lib/cache.js:675:5) npm err! @ /usr/local/lib/node_modules/npm/lib/cache.js:684:20 npm err! @ /usr/local/lib/node_modules/npm/lib/cache.js:1420:7 npm err! @ /usr/local/lib/node_modules/npm/node_modules/lockfile/lockfile.js:167:38 npm err! @ openreq.req.done (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:144:5) npm err! @ openreq.done (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:64:22) npm err! @ object.oncomplete (fs.js:107:15) npm err! if need help, may report *entire* log, npm err! including npm , node version...

excel - Using XLLoop for java -

Image
xlloop opensource framework java. example can use function java in excel. below simple example of usage: package org.boris.xlloop.util; import org.boris.xlloop.functionserver; import org.boris.xlloop.handler.*; import org.boris.xlloop.reflect.*; public class serverexample { public static void main(string[] args) throws exception { // create function server on default port functionserver fs = new functionserver(); // create reflection function handler , add math methods reflectfunctionhandler rfh = new reflectfunctionhandler(); rfh.addmethods("math.", math.class); rfh.addmethods("math.", maths.class); rfh.addmethods("csv.", csv.class); rfh.addmethods("reflect.", reflect.class); // create function information handler register our functions functioninformationhandler firh = new functioninformationhandler(); firh.add(rfh.getfunctions()); // ...

r - Error feeding value to read.csv: Must be character string -

i have function defining directory , file(s) loaded , analyzed. values being read in function, when called read.csv , not seem recognize file name. believe issue format, don't know. seems doing should except dt selectdata never created selectdata<-read.csv(z, header=true) . z being vector containing file name loaded. when debugging generated error: error in read.table(file = file, header = header, sep = sep, quote = quote, : 'file' must character string or connection as error said value being read not character, string or connection, tired set as.character , such no avail. must more simple missing. when run: warning message: in mean.default(selectdata$polutant, na.rm = true) : argument not numeric or logical: returning na but, really, selectdata never created (so, mean attempted, has no value) testfun <- function(directory, polutant, id) { setwd(directory) x <- polutant # not needed checking see if polutant has...

Python Random Playing Card Generator Game -

i'm attempting create program in python allow random card created using random function, suit , card number. code far shown below... import random num1 = random.randint(1,13) num2 = random.randint(1,4) cardnum1 = "" cardnum2 = "" input ("press enter key continue \n") if true: if num1 == 11: cardnum1 = "queen" elif num1 == 12: cardnum1 = "jack" elif num1 == 13: cardnum1 = "king" elif num1 < 10: cardnum1 = num1 elif num2 == 1: cardnum2 = "spades" elif num2 == 2: cardnum2 = "hearts" elif num2 == 3: cardnum2 = "diamonds" elif num2 == 4: cardnum2 = "clubs" print (cardnum1, cardnum2) if card number (num1) 11, 12 or 13, card jack, queen , king respectively. if variable num22 equal 1, 2, 3 or 4, card spades, hearts, diamonds , clubs respectively too. the issue have here rather ...

code documentation - Where are the groovy properties for jdk extensions documented? -

the groovy jdk docs, here http://groovy.codehaus.org/groovy-jdk/ don't seem show properties on objects. i'm familiar site: http://groovy.codehaus.org/ has examples allowing folks divine properties, @ least doesn't appear comprehensive. is there place find jdk extension classes includes properties? i suppose referring api . groovy 2.3.0 api comes new , feel

c# - Begin end asynchronuos method call -

here code snippet microsoft. have doubt in asynchronous method calling. since calling end.invoke after begin-invoke looks doing synchronous call. because waiting returned value of asynchronous call. what happens if asynchronous method didn't completes while calling end.invoke. can proceed next statement or have wait. if happening in multithreaded environment how handling callback signal correct thread. public void demoendinvoke() { methoddelegate dlgt = new methoddelegate (this.longrunningmethod) ; string s ; int iexecthread; // initiate asynchronous call. iasyncresult ar = dlgt.begininvoke(3000, out iexecthread, null, null); // useful work here. work want have // run @ same time asynchronous call. // retrieve results of asynchronous call. s = dlgt.endinvoke (out iexecthread, ar) ; messagebox.show (string.format ("the delegate call returned string: \"{0}\", , number {1}...

lua - attempt to call a nil value -

for = 1, groupa:getnumchildren() local sprite = groupa:getchildat(i) if cute.anim[1]:collideswith(sprite) youloose() end end local function youloose() local font3 = ttfont.new("billo.ttf", 20, " 1234567890abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz,?") local text7 = textfield.new(font2, "gameover") text7:setposition(200, 100) stage:addchild(text7) gamelost = bitmap.new(texture.new("gameover.jpg")) background : removefromparent() groupa : removefromparent() stage: addchild(gamelost) alert() end it gives error says 'attempt call global youloose (a nil value) , doing wrong? note collideswith not same collideswith ; if error posted correct, posted code different using. method called collideswith (it appears if 1 sprite1 ), used collideswith . alternatively, if code posted used, error attempt call collideswith(a nil value) , cute.anim[1] not sprite1 object, not n...

Google App Engine custom domains, subdomains and SSL -

i'm looking give gae app custom domain. still able use wildcard subdomains in same way myapp.appspot.com domain? for example, if navigate wildcardsub.myapp.appspot.com able grab wildcard subdomain , ssl works fine without problems. if change custom domain , navigate wildcardsub.mynewdomain.com , work same? ssl ? have set other custom domain up? i looking set similar structure appspot.com , each user given subdomain of main domain. example username.mydomain.com . any insight appreciated! thanks! yes able use subdomains wildcard mapping . note subdomain name has match version name. you need have proper ssl certs, specific subdomains. double subdomain certs, e.g. *.*.domain.com , not supported browsers anymore . single wildcard certs ok. afaik, can not "move" subdomain top level, e.g. wildcardsub.mynewdomain.com . have use wildcardsub.modulename.mynewdomain.com . can custom mapping, not wildcard mapping.

entity framework - Ef 6 RemoveRange in Linq -

iqueryable<portservicestariffdetail> detalis = _context.portservicestariffdetails .where(w => w.portservicestariffid == tariffid && w.portservicestariffdetailid == detailid); if (detalis.count() > 0) { var mydetial = detalis.groupby(g => new { g.startrate,g.endrate }).asqueryable(); _context.portservicestariffdetails.removerange(mydetial.asqueryable()); _context.savechanges(); } depends on start , end rate remove range, have raise issue anonymous type. can do??? argument 1: cannot convert 'system.linq.iqueryable>' 'system.collections.generic.ienumerable' try this foreach(var x in mydetial) { _context.portservicestariffdetails.removerange(x.tolist()); } _context.savechanges(); but don't understand why you're grouping remove it?

javascript - How to get specific dates between to Dates -

what code need specific dates in between dates? example, between may 5 , may 10, how can dates may 6 9, , save database? please . need :) i have table named tblreservation , , have field checkin , checkout , need dates between checkin , 'checkout' field , save database. don't know how code ? can please me out?

jquery - Send HTML from C# -

hi want append html in c# here code that rework = "<label class=\"assignmenticon\" title=\"tinyc count "+tinykcount+"\"bigcount:"+reworkcount+">" + samplecount + "</label>"; and code putting in jquery data tabl.so,it working absolutely fine in tooltip showing "tinyc count" , value want show bigcount along value in new line in tool tip bu unable append here tinykcount,reworkcount are variable passing c#,i can jquery dont want make additional call it try this: in controller: string rework = "<label class=\"assignmenticon\" title=\"tinyc count:" + tinykcount + "\n bigcount:" + reworkcount + "\">" + samplecount + "</label>"; you can pass view using viewbag controller viewbag.t = rework; in view: @html.raw(viewbag.t)

Setting anchor link color for single page applications with SammyJS -

i have following navigation structure in sammyjs app. <div id="sidebar-left" class="col-lg-2 col-sm-1"> <input type="text" id="txt-search-items" class="search hidden-sm" placeholder="search..." /> <div class="nav-collapse sidebar-nav collapse navbar-collapse bs-navbar-collapse"> <ul class="nav nav-tabs nav-stacked main-menu"> <li class="parent"> <a href="#/link1"><i class="fa fa-dashboard"></i><span class="hidden-sm">link 1</span></a> </li> <li class="parent"> <a class="dropmenu" href="#link2"><i class="fa fa-list-ul"></i><span class="hidden-...

ios - iBeacon Region monitoring: Not resumed when rebooting the phone EXCEPT if I set location background mode? -

all day tested monitoring of beacons app does. in general works ok: notifications in foreground work notifications in background work but after reboot doesn't work until launch app uses bluetoothle after works fine app well! but if set uibackgroundmode location in plist though, app gets region notifications fine after reboot. so... it? or whats deal here? :d under ios 7.1.1 btw the code minimal: https://github.com/radiusnetworks/ibeacon-background-demo/blob/master/backgrounddemo/bdappdelegate.m i did 2 things: first, reduced time took app launch >> doing stuff when app moves foreground. step 1 real app working on alone half solution i found out application in question tried access keychain in background while device locked moved later point , bing worked!

android - An error occurred evaluating root project .Could not create plugin of type 'AppPlugin' -

i have 18 applications trying execute using gradle. have tried gradle(1.6,1.8.1.9,1.10) while executing getting error : build failed total time: 3.817 secs d:\abc\def>gradle build failure: build failed exception. * where: build file 'd:\abc\def\build.gradle' line: 10 * went wrong: problem occurred evaluating root project 'abc'. > not create plugin of type 'appplugin'. * try: run --stacktrace option stack trace. run --info or --debug option more log output. build failed total time: 6.536 secs my build.gradle file : buildscript { repositories { mavencentral() } dependencies { classpath 'com.android.tools.build:gradle:0.6.3' classpath 'de.felixschulze.gradle:gradle-app-plugin:1.1+' } } apply plugin: 'android' apply plugin: 'app' repositories { mavencentral() } dependencies { compile project(':libraries:navigationdrawer') compile project(':libra...

memory management - Deallocate / Free / Release Functions -

is possible deallocate function? have huge initialisation function gets run once, possible deallocate after called it, , use storage? i'm interested in c, feel free post other language if language offers interesting behaviour. i understand functions aren't allocated on heap , cannot recycle memory, seem waste me. there no way using language features. but depending on system work on, os might on own normal memory management techniques. (but if so, "accident".) let me explain bit: program gets mapped memory , run. code hasn't been used time thrown out of memory. data put swap area on disk in order able "recycle" later, code present in executable file , can fetched there if needed again. of course, not happen on systems, linux , afaik windows works way.

java - Launching an Android application from within app -

to launch android application use below code works fine every application installed on phone except "phone" application itself. when attempt launch "phone" app not launced , no error message or displayed or exception thrown. this code i'm using launch application : launchapp(context, packagemanager, "com.android.phone"); /* * launch application * * @param c context of application * * @param pm related package manager of context * * @param pkgname name of package run */ public static boolean launchapp(context c, packagemanager pm, string pkgname) { // query intent lauching intent intent = pm.getlaunchintentforpackage(pkgname); // if intent available if (intent != null) { try { // launch application c.startactivity(intent); // if succeed return true; // if fail } catch (activitynotfoundexception ex) { // quick message notification...

java - Number Pyramid like Egyptian with decreasing numbers -

im working on pyramid on java. did stars. want decreasing numbers. i'm using input. assume input 5; 5 545 54345 5432345 543212345 my code is; int size = 11; (int = 1; <= size; i=i+2) { int spacecount = (size - i)/2; for(int j = 0; j< size; j++) { if(j < spacecount || j >= (size - spacecount)) { system.out.print(" "); } else { system.out.print("*"); } } system.out.println(); } i'm glad attention. lot. int size = 11; (int = 1; <= size; i=i+2) { int spacecount = (size - i)/2; for(int j = 0; j< size; j++) { if(j < spacecount || j >= (size - spacecount)) { system.out.print(" "); } else { system.out.print(n); } } system.out.println(); } something ? works numbers of 1 - 9. int h = 2...

algorithm - Count distinct array entries [with no add memory nor array changes] -

task count unique numbers of given array. saw numerous similar questions on so, here have additional requirements, weren't stated in other questions: amount of allowed additional memory o(1) changes array prohibited i able write quadratic algorithm, agrees given constraints. keep wondering, may 1 better on such problem? thank time. algorithm working o(n^2) def count(a): unique = len(a) ind = 0 while ind < len(a): x = a[ind] = ind+1 while < len(a): if a[i] == x: unique -= 1 break += 1 ind += 1 print("total uniques: ", unique) this similar problem follow-up question in chapter 1 (arrays , strings) cracking coding interview : implement algorithm determine if string has unique characters. if cannot use additional data structures? the answer (to follow-up question) if can't assume array (namely, not sorted, don't know size, e...

flash - how to italicize part of a string for a flex list/dataprovider? -

how make half string become italic after new line(\n)? doesnt work :( <?xml version="1.0" encoding="utf-8"?> <s:application creationcomplete="populate()" minheight="600" minwidth="955" xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:s="library://ns.adobe.com/flex/spark"> <fx:script> <![cdata[ import mx.collections.arraycollection; [bindable] public var listofpeople:arraycollection; public function populate():void { var testdata:string = "test\<i>ntest</i>,test\ntest\ntest"; listofpeople = new arraycollection(testdata.split(",")); } ]]> </fx:script> <s:list dataprovider="{listofpeople}" horizontalcenter="0" verticalcenter="0" /> fixed it. if wants kn...

forms - php loads before hitting ‘submit’ even when using if(isset($_GET["submit"])); ignores constant ‘GREETING’ -

i have been working on simple ‘get’ form on week , calling uncle. want form echo greeting constant before user hits ‘submit’- i.e. when page first loads. without hitting ‘submit’ response ‘no user input’ loads , ignores greeting. here code w/out if(isset($_get[“submit”])). when add if(isset..) greeting constant loads other actions ignored. code w/out isset: <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>a simple form</title> </head> <body> <form name="getform" action="<?php echo htmlentities($_server['php_self']);?>" method="get"> 1) colors of u.s. flag?<br> <input type="radio" name="question1" v...

c# - Binding label to a variable -

i starting wpf , trying setup binding between local variable , label. basicaly want update label when local variable changes. searching solution use textbox source not class variable , not sure works way. here code. public partial class mainwindow : window { int idcounter; public mainwindow() { initializecomponent(); binding b = new binding(); b.source = idcounter; b.mode = bindingmode.oneway; b.updatesourcetrigger = updatesourcetrigger.propertychanged; mylabel.setbinding(label.contentproperty,b); } private void button_click(object sender, routedeventargs e) { idcounter++; } } button work, idcounter changes value, not update in label guess binding wrong. can tell me wrong? thanks your code work if change class this... public partial class window1 : window, inotifypropertychanged { private int _idcounter; public int idcounter { { return _i...

asp.net - Populating listview web control from a datareader -

this first time trying use listviews , i've spent better part of day beating head against wall trying make work. i've created listview i'm trying populate data oracle db. i'm trying use datareader populate listview i'm having hard time making work. there lot out there on accomplishing listview form control not web control. appreciated. the furthest i've been able this: while reader.read dim obj new listviewdataitem((reader(0)), (reader(1))) lsvgeneratedforms.items.add(obj) end while but allows me read 2 objects (i need pull in 4) , run type conversion error db contains string & date datatypes. markup listview: <div class="generatedformsdivstyle" style="height:300px; overflow:scroll"> <asp:listview runat="server" id="lsvgeneratedforms"> <layouttemplate> <table id="tblformlist" border="0" cellpadding="0" cellspacing="0"> ...

android - How to pick right uri scheme for intent? -

i going through android's documentation looks missing something. don't know how find data uri should use intent actions. so according documentation intent has 2 primary information fields: action -- general action performed, such action_view, action_edit, action_main, etc. data -- data operate on, such person record in contacts database, expressed uri. examples of action/data pairs are: action_view content://contacts/people/1 -- display information person identifier "1". action_dial content://contacts/people/1 -- display phone dialer person filled in. action_view tel:123 -- display phone dialer given number filled in. note how view action what considered reasonable thing particular uri. action_dial> tel:123 -- display phone dialer given number filled in. action_edit content://contacts/people/1 -- edit information person identifier "1". finding action easy, have trouble finding uri matches it...

Java Tip Calculator for newbie -

i hope i'm posting in right place. i'm pretty new java (meaning third program besides 'hello world'). i have tip calculator i'm working on assignment. i'm not getting 'error' such, method splitting bill seems think each customer pays 'infinity'. have program set in 2 classes: tipcalc1 , tipcalc2 (no points originality of course). program appears run without issue besides 'infinity' issue. here's have far. assistance appreciated, thanks. ***tipcalc1 class:*** import java.util.scanner; public class tipcalc1 { public static void main(string[] args) { system.out.println("welcome tip calculator! "); tipcalc2 calculator = new tipcalc2(); system.out.println("please enter bill amount: "); tipcalc2.calbill(); system.out.println("what percentage tip?: "); calculator.perctip(); } } ***and tipcalc2 class dirty work:*** import java.util.s...

c++ - Array Value keeps adding calculated value to previous value of array -

my array keeps adding previous value of array value can out solve need calculated value not previous value added here's portion of code calculates , sorts value: (int = 0; < arraysize; i++) { angle = random_angle(angle, step_size); // compute initial speed, using selected angle. xspeed = initspeed * cos(2 * pi * angle / 360.0); yspeed = initspeed * sin(2 * pi * angle / 360.0); //look windspeed if (beaufort == 6) { wind = random_speed(strong_breeze_lo, strong_breeze_hi, step_size); wave = random_wave(b6_wave_lo, b6_wave_hi, step_size); } else if (beaufort == 5) { wind = random_speed(fresh_breeze_lo, fresh_breeze_hi, step_size); wave = random_wave(b5_wave_lo, b5_wave_hi, step_size); } else if (beaufort == 4) { wind = random_spee...

knockout.js - Template binding not working when source is null/undefined -

can explain me wrong view model or template in this example jsfiddle ? it doesn't work expected. view model contains object , object null . in view, there template binding object. object null, shouldn't render template. however, try render template , fails in example. if job object null don't want render template. according this article ryan , if viewmodel contains null object , there " template binding" object, won't render template. here view model: var job = function(title) { this.jobtitle = ko.observable(title); } var viewmodel = function(first, last) { this.firstname = ko.observable(first); this.lastname = ko.observable(last); //this.job = ko.observable(new job("software developer")); this.job = ko.observable(null); this.fullname = ko.computed(function() { return this.firstname() + " " + this.lastname(); }, this); }; ko.applybindings(new viewmodel("firstname", "lastname...

javascript - Highchart, One column as background for another -

there code http://jsfiddle.net/m4fpz/ $(function(){new highcharts.chart({ chart: { renderto:'shopperschart_container', height: 460, zoomtype: 'xy' }, credits: { enabled: false }, title: { text: '' }, xaxis: { categories: ['april - 2014', 'may - 2014'] }, yaxis: [{ labels: { enabled: false, style: { color: '#89a54e' } }, min: 0, opposite: true, title: { style: { color: '#89a54e' }, text: '' } }, { gridlinewidth: 0, labels: { enabled: true, style: { color: '#4572a7' } }, min: 0, title: { style: { color: '#4572a7' }, text: 'visitors' } }, { gridlinewidth: 0, labels: { enabled: false, style: { color: '#aa4643' } }, min: 0, opposite: true, title: { style: { color: '#aa4643' }, text: '' } }, { gridlinewidth: 0, labels: { enabled: false, style: { color: '#ff8b00' } }, min: 0, opposite: true, title: { style: { color: '#ff8b00' }, text: ...

javascript - Websocket can't connect but not throwing exceptions -

trying create connection websocket in js php server, can't connect server no exception thrown js try { var socket; var host = "ws://www.somecoolsite.com:9080/test.php"; var socket = new websocket(host); console.log("opening socket..."); socket.onopen = function () { console.log('socket status: ' + socket.readystate + ' (open)'); socket.send("2"); console.log("sent first package"); } socket.onconsole.log = function (msg) { console.log('received: ' + msg.data); } socket.onclose = function () { console.log('socket status: ' + socket.readystate + ' (closed)'); } } catch (exception) { console.log('error' + exception); } php on somecoolsite $server = stream_socket_server("tcp://localhost:9080", $errno, $errormessage); if ($server === false) { throw new unexpectedvalueexception("could ...

php - How to print more than one query result rows in html table? -

i have code: static function mcontent($chkbox){ $count = count($chkbox); foreach ($chkbox $value){ $count = count($value); for($i=0;$i>$count;$i++) { $sql = "select * `radio_city` chkid in (\"$value[$i]\")"; } } return db::select($sql); i have checkboxes having dynamic id's in index page on table (in td),so when user clicks checkboxes posting values next page , sending values mysql query have shown above(to select more 2 rows depends on user selection),so sending values query fetch rows database , need print in html table. array(8) { ["city"]=> string(1) "8" ["duration"]=> string(1) "0" ["frequency"]=> string(1) "0" ["hours"]=> string(1) "0" ["days"]=> string(1) "0" ["checkbox"]=> array(2) { [2]=> string(5) "bang2" [3]=> string(5) "bang3" } ["totlcost"]=>...

android - How to send/receive broadcast between service and activity -

i need send message smsreceiver class main_activity , can't it. tried out , searched but... . here code smsreceiver.java public class smsreceiver extends broadcastreceiver { // object of smsmanager final smsmanager sms = smsmanager.getdefault(); public void onreceive(context context, intent intent) { // retrieves map of extended data intent. final bundle bundle = intent.getextras(); try { if (bundle != null) { final object[] pdusobj = (object[]) bundle.get("pdus"); (int = 0; < pdusobj.length; i++) { smsmessage currentmessage = smsmessage.createfrompdu((byte[]) pdusobj[i]); string phonenumber = currentmessage.getdisplayoriginatingaddress(); string sendernum = phonenumber; string message = currentmessage.getdisplaymessagebody(); log.i("smsreceiver", "sendernum...

gtk3 - Can't set CSS to specified widget in GTK+ -

i'm using vala gtk+ , i'm trying add custom css specified widget. can add fe. backgroudn gtkwidget not #sidebar #sidebar { //it doesn't work color: white; } gtkwindow { // works background-color: red; } i'm adding class widget that: sidebar = new gtk.label("hello"); sidebar.set_name("sidebar"); and it's changes color gtkwindow, not label. any ideas? i haven't programmed in vala, should add class stylecontext. in c sidebar = gtk_label_new ("hello'); gtk_style_context_add_class ( gtk_widget_get_style_context ("mysidebar"), sidebar); also, style "si...

android - Delete item from gridview -

i know here many answers how delete items, can't make work. show errors. can look? added in adapter remove(position), think works wrongly. want after using onitemlongclicklistener delete file , thumbnail too. main: protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); final gridview grid = (gridview) findviewbyid(r.id.gridview); final thumbnailadapter thumbnails = new thumbnailadapter(this); grid.setadapter(thumbnails); grid.setonitemlongclicklistener(new adapterview.onitemlongclicklistener(){ @override public boolean onitemlongclick(adapterview<?> parent, view v, int position, long id) { final string imgpath = thumbnails.getimagepath(position); file file = new file(imgpath); file.delete(); thumbnails.remove(position); thumbnails.not...

autotools - Build tests depending on program sources -

i want build tests foo program. root makefile.am looks like: subdirs = src tests makefile.am src contains: bin_programs = foo foo_cxxflags = # lot of $(xxx_cflags) foo_ldadd = # lot of $(xxx_libs) foo_sources = # lot of source files makefile.am tests contains: check_programs = footesta footestb tests = footesta footestb footesta_sources = footesta.cpp footestb_sources = footestb.cpp these tests depend on foo symbols , consider create convenience library using foo_libadd = libfoo.la on top , place noinst_ltlibraries = libfoo.la in makefile.am 's src . on right way solve this? you on right way, suggest couple of different options too. first of all, i'd suggest using non-recursive automake instead of 3 makefile.am have 1 keep date, , reduces nasty factor of autotools. in particular, using convenience library method across separate makefile.am makes dependency tracking terribly complicated, means may or may not re-run tests if you're chang...