Posts

Showing posts from September, 2013

d3.js - How to add filters effects to Svg in d3 -

<svg viewbox = "0 0 1100 400" version = "1.1"> <desc> filter example </desc> <filter id = "i1"> <fegaussianblur in = "sourcealpha" stddeviation = "4" result = "blur1"/> <fespecularlighting result = "specout" in = "blur1" specularexponent = "20" lighting-color = "#bbbbbb"> <fepointlight x = "50" y = "100" z = "200"/> </fespecularlighting> <fecomposite in = "sourcegraphic" in2 = "specout" operator = "arithmetic" k1 = "0" k2 = "1" k3 = "1" k4 = "0"/> </filter> var svg=svg.selectall(".circle") .data(this.data) .enter().append("circle") .attr("class", "circle") .attr("r",functio

angularjs - Why isn't my view updating when changing the model of different directive scopes but bounded (what appears to be) correctly? -

i created plunkr problem: http://plnkr.co/edit/t2884mo6su9mv5xdqmnu?p=preview what i'm trying create directive goes in text box , makes suggestions type. typeahead widget of angularui team. don't use theirs because need more features in component. now, code consists in module has 2 directives. "typeahead" , "popup". problem when update model linking function of typeahead, changes don't reflected on popup until clicked. scopes seem fine, view, doesn't rendered. the test this: focus text box. blur it. click on gray box. - log gets updated should have in step 1 , 2. click 1 of items of list. - log gets updated focus , blur text box - log gets updated, view doesn't. click on gray box. - log shows happened in step 5. what i'm doing wrong? should take control on digest cycle? wouldn't know how. additional information (you may skip this): further features i'm after showing modal dialog when user wants create or edit

android - How to suppress lint on specific line/string in resources xml files? -

on android, suppress lint on specific string value or specific line on string.xml or other resources files. <string name="suppress_lint_string">suppress string</string> <string name="dont_suppress_lint_string">don\'t suppress string</string> i perform specific lint suppressing on specific strings , specific parts of layouts examples missing translations specific strings doesn't matter between languages. if want suppress specific rules in specific strings without suppressing whole file, can use annotations. strings.xml <?xml version="1.0" encoding="utf-8"?> <resources> <!--suppress missingtranslation --> <string name="suppress_lint_string">ignore translation</string> ... </resources> you can substitute missingtranslation other lint rule. http://tools.android.com/tips/lint/suppressing-lint-warnings

c++ - how do I use type_traits or template function specialization to consolidate template methods -

i trying consolidate number of similar function methods class similar 1 shown below , thought best way efficiently implement this, through use templates coupled either template function specialization or alternatively type-traits. newbie template specialization , type-traits understand basic concepts , why asking guidance on details. anyway starting point class smart buffer class has many similar method signatures listed below. class oldsafebuffer { public: intmax_t writeat(const intmax_t& rindex, const uint32_t val32); intmax_t writeat(const intmax_t& rindex, const int32_t val32); intmax_t readfrom(const intmax_t& rindex, uint32_t& rval32); intmax_t readfrom(const intmax_t& rindex, int32_t& rval32); intmax_t writeat(const intmax_t& rindex, const uint16_t val16); intmax_t writeat(const intmax_t& rindex, const int16_t val16); intmax_t readfrom(const intmax_t& rindex, uint16_t& rval16); intmax_t readfrom(cons

android - Application with 2 Activities Running Parallel -

i have application uses 2 activities, when clicking item in listview inside activity 1 goes activity 2 , adds new fragment it, , pressing button goes activity 1, activity 2 , fragments/controls destroyed, , clicking item in activity 1, creates new activity 2 , adds fragment it. is there anyway can run 2 activities in parallel? both running in parallel? use code start activity 2 intent intent = new intent(this, displaydataactivity.class); startactivity(intent); can keep reference in activity 1 clicking on listview items shows activity 2 if it's created? thanks i don't know why need that. check app architecture and/or ui - possibly wrong. but possible - need maintain 2 activity tasks ( google documentation ) use different taskaffinity activities create 2 tasks (separate activity stacks) override onback button if need - replace appropriate second activity intent call

c# - Setting checkbox values in MVC4 -

in html code want create checkboxes readonly , value depends on data database. setting readonly property fine , binding checkbox model. value on model (that came database) integer, not boolean. i'm doing @html.checkbox("myproperty", model.property == 2 ? true : false, new { @onclick = "return false" }) <label>some text label</label> so wondering if there way achieve without if statement thank advice know question old, perhaps worth mentioning perhaps more elegant way of doing creating property on model interpretation of .property value. class model //the name of model { //... public int property { get; set; } public bool myproperty { { return this.property == 2; } } } and in view: @html.checkbox("myproperty", model.myproperty, new { @onclick = "return false" }) <label>some text label</label>

r - Subset columns in dataframe X based on columns of dataframe Y -

i subset x data frame based in name collumns of y dataframe: my x dataframe: ne001 ne002 ne003 1 2 3 my y dataframe: ne001 ne003 10 5 my expected output: ne001 ne003 1 3 any ideas? thank you! ps. subset collumn name, not collumn number. this it: x[,names(x) %in% names(y)] perhaps want take closer @ r introduction text, see e.g. these r links .

I cant even call a function on different file of Javascript -

i have annoying bug within code, very simple. i've tried alot of things, couldn't work. i have tried using using script tag, , put code in there, like <script> function lol() { alert("hello world!"); } </script> and did this <body onload="lol();"> </body> don't me wrong, code works perfectly. except when using code javascript file outside of index.html file. <script src="src/other/setriox.js"></script> the javascript file named setriox.js has function called function loled() holds simple function of alert("hello world!"); now, when same exact thing body onload <body onload="loled();"> </body> it not being called. path setriox.js fine, not miss spelling or that. here github if want deeper on why loled() function not being called. https://github.com/setriox/portfolio is because have not closed comment on js file ?

php - Correct Syntax For Preparing MySQL INSERT INTO ON DUPLICATE KEY UPDATE? -

i have been troubleshooting code, searching stackoverflow find correct syntax php. can't figure out how on duplicate key update syntax works prepared statements: insert placements_by_date (dateval, placementname, placementid, campaignid, adname, format, tagid, impressions, clicks, leads, mediacost) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) on duplicate key update // here comes tricky syntax: dateval = values(dateval), placementname = values(placementname), placementid = values(placementid), campaignid = values(campaignid), adname = values(adname), format = values(format), tagid = values(tagid), impressions = ?, clicks = ?, leads = ?, mediacost = ? i have tried many variations: ...on duplicate key update dateval = values('$dateval'), placementname = values('$placementname'), placementid = values('$placementid'), campaignid = values('$campaignid'), adname = values('$adname'), format = values('$format'), tagid = value

python - matplotlib: Aligning twin y-axes -

Image
the answer question suggests play around set_ylim / get_ylim in order align 2 twin axes. however, not seem working out me. code snippet: fig, ax1 = plt.subplots() ylim = [miny, maxy] xlim = [0, 0.01] x in analysisnumbers: ax1.plot(getdata(x), vcoords, **getstyle(x)) ax1.set_yticks(vcoords) ax1.grid(true, which='major') ax2 = ax1.twinx() ax2.set_yticks(ax1.get_yticks()) ax2.set_ylim(ax1.get_ylim()) ax2.set_ylim(ax1.get_ylim()) plt.xlim(xlim[0], xlim[1]) plt.ylim(ylim[0], ylim[1]) plt.minorticks_on() plt.show() graph output (open image in new window): the twin axes should same, not. labels same, alignment not (see zeroes not line up). what's wrong? as tcaswell points out in comment, plt.ylim() affects 1 of axes. if replace these lines: ax2.set_ylim(ax1.get_ylim()) ax2.set_ylim(ax1.get_ylim()) plt.xlim(xlim[0], xlim[1]) plt.ylim(ylim[0], ylim[1]) with this: ax1.set_ylim(ylim[0], ylim[1]) ax2.set_ylim(ax1.get_ylim()) plt.xlim(xlim[0

wordpress - What am I missing? Facebook OG ignoring correct meta tags -

facebook's og debugger infuriatingly recognizes og meta tags except og:image, after refreshing cache. the image 200x200 jpg, fits size , ratio parameters, , i've tried i've found on here , elsewhere facebook see image. my site run through wordpress, , i've tried official , unofficial facebook/seo plugins. nada. at point, don't know do... am missing incredibly obvious? <?php global $smof_data; //get theme options ?> <!doctype html> <html <?php language_attributes(); ?>> <head> <meta http-equiv="content-type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>"> <html prefix="og: http://ogp.me/ns#"> <!-- facebook opengraph metadata --!> <meta property="fb:app_id" content="1494142140797388" /> <meta property="fb:admins" content="1324980113" /> <meta property=&quo

How to integrate PHP and C program? -

let me put problem in simple way. have written c program, keep in server. developing website using php, other users can have access stand alone c program. so here want php take input users , bring input , run c program , again take results of c program users using php(probably using same website itself). please suggest me how it. easier me understand if can tell me using simple program. example c program has function adds 2 numbers. users can provide input (the numbers) using website. php somehow interact c function , return results user. just use php exec command. i'm assuming have access actual c executable. http://www.php.net/manual/en/function.exec.php <?php // outputs username owns running php/httpd process // (on system "whoami" executable in path) echo exec('whoami'); ?>

ios - Read arabic text file and store to sqlite database -

i beginner of iphone developer. want read arabic text arabic.txt file , insert sqlite database.i used below code 2 lines 1 word example first line arabic string , second line empty string so, array count getting double. i have used below code. - (void)viewdidload { [super viewdidload]; nsstring* path = [[nsbundle mainbundle] pathforresource:@"arabic" oftype:@"txt"]; nsarray *data = [[nsstring stringwithcontentsoffile:path encoding:4 error:nil] componentsseparatedbycharactersinset: [nscharacterset newlinecharacterset]]; nsmutablearray *carr = [[nsmutablearray alloc]init]; for(int j = 0; j<[data count]; j++) { straaa =[data objectatindex:j]; // nslog(@"stringnm:%@",straaa); ttaa = [straaa utf8string]; // nslog(@"ttaal:%s",ttaa); nscharacterset *donotwant = [nscharacterset charactersetwithcharactersinstring

sql - How to get the RowID to put into an INSERT INTO statement -

i have 2 tables virtual_domains virtual_users. virtual_domains has list of valid domains emails server, example data: id name 1 example.org 2 example.com 3 example.net virtual_users keeps valid email addresses each domain, , links them domain belong, example data: id domain_id password email address 1 1 jack@example.org 2 1 thing john@example.org 3 3 goes annete@example.net 4 2 here bilbo@example.com insert new user, use syntax (auto_increment in use id column): insert databasename . virtual_users ( id , domain_id , password , email ) values ( default, '3', md5('somepassword'), 'kurt@example.net'); , add kurt@example.net 5th row em

node.js - require difference in javascript(spidermonkey) and nodejs -

in javascript(spidermonkey) //t1.js var a=function(){ }; a.prototype.dosomething=function(){ console("t1"); } t.js require ('t1.js'); var b1=new a(); b1.dosomething(); it equals: var a=function(){ }; a.prototype.dosomething=function(){ console("t1"); } var b1=new a(); b1.dosomething(); but in node.js t.js require ('./t1.js'); var b1=new a(); b1.dosomething(); it reports error: node t.js t.js: var b1=new a(); ^ referenceerror: not defined @ object.<anonymous> (/users/mymac/js/t.js:16:12) @ module._compile (module.js:456:26) @ object.module._extensions..js (module.js:474:10) @ module.load (module.js:356:32) @ function.module._load (module.js:312:12) @ function.module.runmain (module.js:497:10) @ startup (node.js:119:16) @ node.js:906:3 your comment welcome nodejs's module system not leak globals (unless asked to). if need export reference it,

java - How to differentiate between buttons in a ListView -

i want make list of connections , give user option connect 1 of them. <textview android:id="@+id/tvname" android:layout_width="225dp" android:layout_height="38dp" android:textsize="25sp" /> <button android:id="@+id/button1" android:layout_width="match_parent" android:layout_height="wrap_content" android:onclick="connect" android:text="connect" /> this basic structure of each item in list. after creating list, in "connect" function, not able not figure out button in list called it. have know connected particular connection. can please me out know position of button clicked? thank in advance. you can set onclick event in custom adapter's getview method. public view getview(final int position, view convertview, viewgroup parent) { layoutinflater inflater = getlayoutinflater();

Android Studio and ADT have different TypedArray values -

i have app build android studio , adt. adt others able build , run. myself use android studio. when else added custom ui control, android studio's version crash in ui has custom control in it. after intensive debugging, found out it's in android studio, typedarray of custom control has different values adt's version. how happen? did countless google search without success. can help? specifically, it's getdimension(int index, float defvalue) throwing exception, code of below: public float getdimension(int index, float defvalue) { index *= assetmanager.style_num_entries; final int[] data = mdata; final int type = data[index+assetmanager.style_type]; if (type == typedvalue.type_null) { return defvalue; } else if (type == typedvalue.type_dimension) { return typedvalue.complextodimension( data[index+assetmanager.style_data], mresources.mmetrics); } throw new unsupportedoperationexception("can't conver

xml - Best way to store and search large text data in android -

i developing constitution app android. want know best way store large text data. features want searchable , fast. if use sqlite3 how supposed create file , upload app, if use xml store it, searchable? speed matter. 1) sqlite can create fts (full text search) tables . it's table builtin index on every word. allows find data queries select * chapter chapter match 'someword' or select * chapter chapter match 'someword near/6 otherword' meaning 'where someword , otherword separated less 6 words'. 2) how include database in application, think have 2 options : build database beforehand (e.g. using python , has builtin sqlite bindings) , include in application's assets. include text file(s) assets , create database on first launch.

java - Why does Catch(object o) cause a compile error? -

try { } catch(object o) { } why leads compile error ? since objects inherit object class. you can catch objects derive throwable . see throwable (java platform) , states: the throwable class superclass of errors , exceptions in java language. objects instances of class (or 1 of subclasses) thrown java virtual machine or can thrown java throw statement. similarly, class or 1 of subclasses can argument type in catch clause.

java - WebView shows blank page when running behind proxy -

as simple possible: public class webviewsample extends application { public static void main(string[] args) { // tried without proxy configuration, same result. system.getproperties().put("proxyset", "true"); system.getproperties().put("proxyhost", "http://127.0.0.1"); system.getproperties().put("proxyport", 5677); launch(args); } @override public void start(final stage primarystage) { final webview webview = new webview(); webview.getengine().load("http://docs.oracle.com/javafx/"); primarystage.setscene(new scene(webview)); primarystage.show(); } } i'm using cntlm handle proxy authentication. (i'm running jdk8u5 ). what's wrong ? configuring https solves problem. system.setproperty("https.proxyhost", "127.0.0.1"); system.setproperty("https.proxyport", "5677&quo

Getting transparency to work in glumpy with pygame -

i have been having difficulties getting glumpy work transparent colormaps, , transparency in general. below simple script should draw 2 transparent glumpy images, 1 on top of other. second overwrites first, can't see 1 behind other. i have experimented different opengl enable/disable commands, no joy! or suggestions appreciated. from pylab import * import pygame pygame.locals import * import glumpy import opengl.gl gl import opengl.glu glu # set width , height of screen [width,height] size=[256,256] screen=pygame.display.set_mode(size,opengl|doublebuf) ## think here might work, i've ## experimented turining these off , on. suggestions? gl.gldisable(gl.gl_depth_test) gl.gldisable(gl.gl_lighting) gl.glenable(gl.gl_blend) gl.glblendfunc (gl.gl_src_alpha, gl.gl_one_minus_src_alpha) = np.random.rand(256,256).astype('f') a[0:128,:] = 1.0 b = np.random.rand(256,256).astype('f') b[:,0:128] = 1.0 # cmaps acm = glumpy.colormap.colormap("rd", (0

ios - Core Data segue issue with saving changes -

i had project working, , decided introduce settings page users make basic adjustments. entity name: "setting" attribute: "settingtimeoverrideslider" -> created nsmanagedobject subclass i added (and embedded) settingsviewcontroller, segue, named segue. on page i'm using button save changes. button called method in coreviewcontroller via [super saveanddismiss] , know gets in there (checked nslog). here's method: -(void)saveanddismiss { nslog(@"in save , dismiss"); nserror *error = nil; if ([self.managedobjectcontext haschanges]) { nslog(@"in save , dismiss - has changes"); if (![self.managedobjectcontext save:&error]) { // save failed nslog(@"save failed: %@", [error localizeddescription]); } else { // save succeeded nslog(@"save succeeded"); } } [self di

excel - Transferring array to another Worksheet -

in 1 worksheet called 'flange management sheet' have quite large data base of information , in sheet called 'cert sheet' have form i've created fields need filled fms. i select first cell in row of information , click button , cert sheet populated. i think way go using array. i've created this array(“a = q14”, “b = c12”, “d = q12”, “k = c11”, “l=c14”, “m=c16”, “n=c17”, “o = c19”, “p = q19”, “q=c18”, “t=c27”, “u=q27”, “x = c24”, “y = c25”, “z=q24”, “aa=q25”, “ab=q26”, “ad = l5", “ae = n30”) its , how implement in vba. this has come because have enter information manually in word document , there must simple way of auto populating. edit clarity - i'm looking using information on flange management matrix used populate form created on separate worksheet. in fmm sheet have - ao of fields 400 rows of relevant information under fields. example in column - 'tag id, column b - 'line no', column k - 'drawing number' etc..

angularjs - Any suggestions for what Node.js modules I should use for user log ins? -

i building website mean (mongodb, express, angular, node js) stack. want users able create account on site integrate facebook/twitter accounts. main 2 options considering right passport , express-jwt . i have been able find examples of integrating passport node/express, no examples of how handle things on front end angular. hard do? my main concern express-jwt have not found examples of using facebook log ins while there passport-facebook passport. help. by far best authentication passport. see link https://github.com/daftmonk/angular-passport if prove of worth you. go through article http://speakingaword.blogspot.in/2013/08/authentication-in-angularjs-nodejs-and.html can productive. hope asking.

concurrency - Parallel Programming Clarification and Concurrent Programming -

i've been reading on parallel , concurrent programming, , there 2 things still have not found answers , still confused about. 1) in places read parallel programming allows multiple processes executed simultaneously taking advantage of multiple cpus, while other places read taking advantage of multiple cores. right? understanding core part of cpu, it's not possible both definitions valid (unless i'm missing something). 2) have basic understanding of how concurrent programming works, fail see why faster 2 processes executed concurrently rather sequentially. example, if there 2 threads consisting of 4 computations require same amount of time processed: thread a: a1 a2 a3 a4 thread b: b1 b2 b3 b4 concurrent execution of threads possibly result in following execution: a1 b1 a2 b2 a3 b3 a4 b4. how faster if 2 threads sequentially executed: a1 a2 a3 a4 b1 b2 b3 b4? both methods of execution require 8 total computations, means total time same. on two-core ( m

Error in python search function -

i getting trying build search function searches through text files , prints search string if string found in text file. if users second string (quotesearch2) empty first string searched , printed (quotesearch1). why keep getting 2 syntax error messages lines 16 , line 23 (the code checker stoped after line 105 there may more after point).excuse code, beginner, not want alternative code complete function, want errors resolved. the error is: syntaxerror: invalid syntax def search(): import os.path print "you chose search option" validchars = "-.() %s%s" %(string.ascii_letters , string.digits) thisdir = raw_input("what directory search ? not: invalid characters stripped ") #ask user choose directory multi os compatibility thisdir = ''.join(y y in filesearch if y in validchars) filesearch = raw_input("what file search ? note: invalid characters stripped: ") #ask user file t search filesearch = '

sql - How to track which tables the database wrote data to? -

i use "lexware warenwirtschaft premium 2014" (a well-known merchandise management software in germany). uses sybase database. connect database using odbc connection(sql anywhere driver). database has 800+ tables. example when lexware creates new article, writes data different tables. is there way track tables lexware wrote data? as ad-hoc measure switch on odbc tracing, , review contents. http://support.microsoft.com/kb/274551 tells how windows client, , can find similar information linux/unix , other clients. you'd have parse trace file see queries inserted into. first step isolate sqlprepare , sqlexecdirect statements, , check them insert, update , other relevant sybase statements. note not you'd want ongoing solution, way find out odbc client if not have access e.g. logging information on database itself. however, trace slows down execution , generate large trace file if left running significant period.

ruby on rails - Retrieve Incoming Parameters in Rails4 -

i'm posting parameters remote url in rails4 application, /orders/:id route show controller method. the parameters sent service application , service returning bunch of parameters applications' /fail or /success pages depending on if response successful or not. can see incoming params logs. i create ordertransaction parameters in order controller, how can this? orders_controller.rb def success ### create ordertransaction here incoming parameters! @transaction = ordertransaction.new(????????) end def fail ### create ordertransaction here incoming parameters! @transaction = ordertransaction.new(????????) end incoming parameters in logs => started post "/orders/fail" 127.0.0.1 @ 2014-06-01 13:40:28 +0300 processing orderscontroller#fail html parameters: { "tranid"=>"", "type"=>"auth", "refreshtime"=>"5", "lang"=>"tr",

extjs4.2 - Is there any way to find the exact order in which the events of an Ext Js 4.2.0 component are fired? -

i know how can find, example, first event fires when click on tab of tab.panel in ext js 4.2.0, , if possible exact order of events involved when user clicks on tab. i'd start reading docs components. should able you: http://docs.sencha.com/extjs/4.2.2/#!/guide/components

url parameters - How to get right result from "whateverorigin.org" despite of question mark? -

i tried out "whateverorigin.org" overcoming cross-domain policy. works fine, except if url of other page contains parameters , question mark. var url = 'http://www.example.com/something?parameter=test'; $.getjson('http://whateverorigin.org/get?url=' + encodeuricomponent(url) + '&callback=?', function(data){ var html = ""+data.contents; $("#output").html(html); }); the question mark doesn't recognized, page not being found. there solution issue?

php - get referer after header("Location: http://B.com/"); -

a site a contains redirect @ site b . header("location: http://b.com/"); i need know whether user came a or not. on site b not possible referer $_server['http_referer']. thank in advance other working solutions. use variable data. header("location: http://b.com/?refferer=a");

java - Plain C++ objects in code accessed by JNI -

my android application has native c++ layer , java layer. java layer accesses native layer via jni calls. can c++ layer safely create c++ objects own internal use, , store them in c++ member variables? i'm talking c++ objects don't need accessed java code in way, i.e. managed , deleted in c++ layer. in other words, same object (via member variable) accessed throughout multiple jni calls, c++ layer needs access it. i need confirmation in matter, because know there special jni methods handling objects (relevant terms: local reference, global reference, etc.). if i'm correct, these apply objects visible (or created for) java code well. therefore, suppose native-only c++ objects can created , deleted in usual ways (such new , delete ), , java doesn't need know them. no special interoperability considerations necessary, long objects , references them reside exclusively in c++ layer. correct? can define c++ classes , methods in layer in same way if usual c++ appli

include assembly function in c++ MinGW -

i want include assembly function in c++. used google , found extern int test(int,int) works fine in c not in c++. have in c++? code: #include <iostream> extern int test(int,int); int main () { std::cout<<test(2,2); //here "../main.cpp:6: undefined reference `test'" return 0; } i'm using eclipse mingw. you can include assembly functions in c++ extern "c" . working example: #include <iostream> extern "c" int test(int,int); int main () { std::cout<<test(2,2); return 0; } mingw adds underscore function, have name _test in assembly.

javascript - iScroll move header up or down while scrolling -

i trying build function moves header 45px while scrolling down , reverse. should facebook header mobile app, or address-bar of chrome mobile browser or safari mobile browser. using scrolling iscroll plugin , managed let header moving while scrolling down , moving down again while scrolling up. not working. stuck while scrolling. this js code: function updateposition () { var wrapperposition = this.y; var laststopposition = $('#header').attr('data-last-value'); var distance = wrapperposition - laststopposition; var getmatrixstyle = window.getcomputedstyle($('#header').get(0)); var getmatrix = new webkitcssmatrix(getmatrixstyle.webkittransform); var matrixpositionheader = getmatrix.m42; var moveup = matrixpositionheader - 1; var movedown = matrixpositionheader + 1; if(wrapperposition >= -45 &a

if statement - How to make if loop in grails? -

i'm beginner in grails, please help. have in gsp <div class="right66"> <g:select class="time_pick" name="pick_day" placeholder="" from="${['dani', 'sati', 'minute']}" valuemessageprefix="book.category"/> </div> in translation: dani = days, sati = hours, minute = minutes. need save data in minutes user can choose if input in minutes, hours, or days. have if loop. know how if loop works don't know how write in grails. thinking this: n=1 if(params.type=dani){ n= 3600 }else if(params.type=sati) { n=60 } def minute=params.minute*n but how call chosen input "dani"? can't write params.type=dani. if loop go in controller in case? if need convert input minutes, should in controller or service. if here same in java or groovy. inputs view in params object in controller same name input's id. def minutes = params.in

c# - List.Distinct() causes my parameter to act like a value type -

i have simple list of integers called numbers. send list 2 methods: first uses random fill list 333 numbers between 1 , 100. @ end of filling i'm using 'distinct()' on list distinct random numbers, , prints out amount of items list has. second method receive list , prints out number of elements in also, 'count' property. how i'm working on same list time , different results? this code: class program { static list<int> numbers = new list<int>(); static random rnd = new random(); static void main(string[] args) { fillnumbers(numbers); countnumbers(numbers); console.readline(); } private static void countnumbers(list<int> numbers) { console.writeline("there {0} numbers list", numbers.count); } private static void fillnumbers(list<int> numbers) { (int = 0; < 333; i++)

javascript - How to use $watch within directive to update class (no jQuery)? -

i'm trying create app poll live data every 10 seconds or so. , if data changes should highlighted in view. have managed this, little jquery. want template in angular instead. this controller: angular.module('myapp.controllers', []) .controller('mainctrl', ['$rootscope', 'livedatapoller', function($rootscope, livedatapoller) { $rootscope.livedata = livedatapoller.getdata(); }]); this directive: angular.module('myapp.directives', []). directive('livevalue', function() { return { restrict: 'a', scope: { val: '=' }, link: function(scope, element, attrs) { scope.$watch('val', function(newvalue, oldvalue) { if(newvalue && oldvalue && (newvalue !== oldvalue)) { if(newvalue < oldvalue) { element.removeclass("up").addclass("down");

sorting - In Perl, how do I print hash keys in order of their (numerical) values? -

i have hash in keys strings , values single-digit numbers; here's slice of said hash: 'f92a0d43-a230-4bfd-b580-9eac5e0ce6cf' => 7, '26c4b622-969f-4861-bbab-dd506ea4b00a' => 1, 'afb1f925-4109-4b1d-967f-3958106e0bc3' => 3, 'a099a6dc-0c66-4683-94c3-29d6ef6947fd' => 1, 'e71c4860-224d-4b8d-ae9e-4700e9e65a97' => 2, i want print keys in order of descending values. slice listed there, output be: 'f92a0d43-a230-4bfd-b580-9eac5e0ce6cf' => 7 'afb1f925-4109-4b1d-967f-3958106e0bc3' => 3 'e71c4860-224d-4b8d-ae9e-4700e9e65a97' => 2 '26c4b622-969f-4861-bbab-dd506ea4b00a' => 1 'a099a6dc-0c66-4683-94c3-29d6ef6947fd' => 1 the order of keys identical values not matter. answers question: in perl, how can print key corresponding maximum value in hash? suggest using sort function; have: @values = sort { $b <=>

mysql not updating php form -

i have database content. i have page displays table of records. can click edit record wish, when click edit redirects new form , populates information form feilds. when edit form values , click submit supposed update record in database. i success message when update,but record doesnt update. form.php: <?php $emp_id= ($_get["id"]); $sql = "select * people id='$emp_id' limit 1"; $result = mysql_query($sql); $row_people = mysql_fetch_array($result); ?> <form method="post" action="update.php?id=<?php echo "$emp_id" ?>"> <input type="hidden" name="id" value="<?php echo "$row_people[id]"; ?>"> <fieldset> <legend><b>name</b></legend> fir

vba - How to associate a field in a form to a specific value in a table -

i'm new @ vba programming. have table contains 'id' , 'bidder' , form has 1 field 'text1', i'm trying make field display 'bidder' value 'id'=2. i thinking make query , store value in field, not sure if can that, text1.value= docmd.runsql "select bidder bidder_v3 (([id])='2')" is working, bad idea, don't know how solve one. i appreciate help. thank you! if want display single value use dlookup function text1.value= dlookup("bidder_vs","[bidder]","[id]='2'") this okay single value but, preferably, form based on query retrieves data need display. note docmd.runsql doesn't return anything, designed execute action-queries, such update queries.

java - Unable to access jarfile in Windows 8.1 -

i have problem trying install mondrian. installer .jar file. if double clik it, windows console opens, closes immediatly. if try console , write "java -jar mondrian", "error: unable access jarfile mondrian". i'm using windows 8.1. thanks help. you need full filename of jar file trying execute java -jar mondrian.jar regardless, think should referring mondrian installation guide , you'll see command need enter different attempting do.

c++ - Is it possible to get a raw pointer to std::vector<unsigned int> data? -

this question has answer here: how std::vector pointer raw data? 3 answers i have std::vector filled instructions proprietary hardware. have code construct buffer , manipulate fine. the problem need make use of library (c based) builds similar proprietary hardware instructions, library expects make raw memory available , return pointer it, library uses write commands. i accomplish following [pseudo code, nothing real code]: void* thelibrarycallback (void* clientdata, unsigned int thelibrarysize) { std::vector<unsigned int> cmd = reinterpret_cast<std::vector<unsigned int>>(clientdata); std::vector<unsigned int>::size_type cmdsize = cmd->size(); (int loop=0;loop<thelibrarysize; loop++) cmd->push_back(0xdeadbeef); return cmd->get_raw_pointer_at(sizeof(unsigned int)*cmdsize);

ios - Ifnull using FMDB -

i've switched ios app using plain sqlite using fmbd. it's going great , big fan. problem i'm having have used ifnull function in number of old sqlite calls, , doesn't seem work fmdb. message saying warning: not find column named 'columnname' i've tried number of different ways of calling statement, missing simple. is there way around this? any appreciated. i use ifnull fmdb , works perfect trivial, have tried: ifnull(columnname, "i sad, because null") columnname

boto python dynamodb scan attributes_to_get -

folks, docs boto vague @ best, why operation not working? from boto.dynamodb2.table import table import time print "scanning existing database" mytable = table('mytable') start = time.clock() my_query = mytable.scan(scan_filter=none, attributes_to_get=['something']) results = [] x in my_query: results.append(x['something']) elapsed = (time.clock() - start) print "scan operation took",elapsed print len(results) why work: #!/bin/env python import boto db = boto.connect_dynamodb() import time print "scanning existing database" table = db.get_table('current_fhv_drivers') start = time.clock() all_query = table.scan(attributes_to_get=['something']) results = [] x in all_query: results.append(x['something']) elapsed = (time.clock() - start) print "scan operation took",elapsed print len(results) seems you're trying table before creating connection. try: import

java - Reading an Object from environment.getProperty() -

i trying read environment.getproperty() . able read pass in key , retrive, trying read object(so make code generic). so environment values loaded json. say: {name:"xyz",class:"12"} so when pass in environment.getproperty("name") xyz. but want read of nature. {student:[student1:{name:"xyz",class"12"}, student2:{name:"abc",class:"11"}]} i tried using environment.getproperty("student",list.class) didn't resolve this. any comments?

strptime - Subsetting Data based on a date range in R -

update i've managed load data of first 1000000 rows using following code: newfile <- read.table("course_4_proj_1.txt", header=true, sep=";", na.strings = "?", nrows= 1000000, stringsasfactors=true) this head() returns, fyi head(newfile) date time global_active_power global_reactive_power voltage global_intensity 1 16/12/2006 17:24:00 4.216 0.418 234.84 18.4 2 16/12/2006 17:25:00 5.360 0.436 233.63 23.0 3 16/12/2006 17:26:00 5.374 0.498 233.29 23.0 4 16/12/2006 17:27:00 5.388 0.502 233.74 23.0 5 16/12/2006 17:28:00 3.666 0.528 235.68 15.8 6 16/12/2006 17:29:00 3.520 0.522 235.02 15.0 sub_metering_1 sub_metering_2 sub_metering_3 1 0 1

jquery - Alternative way to sort JSON file or at least, a drop-down list using javascript? -

is there alternative way sort json file or @ least, drop-down list other following code? json.sort(function(a, b){ return a.id - b.id; }); the reason takes long sort json file containing countries in world. here code: parsejsonfile("json/country.json", function(data) { data.sort(sortcountryname); localstorage.setitem("country", json.stringify(data)); }); // function sorting countries function sortcountryname(a,b){ return a.spanish.tolowercase() > b.spanish.tolowercase() ? 1 : -1; } **update : here small part of json file: { "code" : "please select country", "english" : "-- please select country --", "spanish" : "-- por favor seleccione el pa&#237s --" }, { "code" : "afg", "english" : "afghanistan", "spanish" : "afganist&#225n" }, { "code" : &qu

extjs - Ext-all.js not responding when showing/hiding grid columns -

i ran issue in ext-all.js file hangs when attempting show/hide grid columns. i'm using extjs 4.1.2 on mozilla firefox 25.0. os ubuntu 12.10, clarify. when user edits row via plugin, hidden fields become shown user can edit them. after editing complete columns become hidden again. controller.js: var hiddencolumns = []; //global array storing columns init: function() { this.control({ ... 'mygrid': { beforeedit: function() { me.columnsvisibility('show'); }, afterrender: function(){ var me = this, formdatapanel = me.getformdatapanel(), activegrid = formdatapanel.getlayout().getactiveitem(); (i=0; < activegrid.columns.length; i++) { if (activegrid.columns[i].hidden) { ext.array.push(hiddencolumns, activegrid.columns[i]); } } }, edit: function(editor, e) { var me = this, usersstore = me.getstore('users&#

c# - Need help to write web api wrapper for Silverlight project -

please bear me new silverlight. need write web api wrapper (i've named webclientwrapper ) supposed consume rest services. project uses silverlight 5 . facing many problems while writing such wrapper. there lot of examples demonstrating rest service consumption in c#. unfortunately none of them worked me. it's been challenge me done need. below requirements: 1) ui should not freeze while make request, 2) calling methods webclientwrapper should easier possible. 3) .net framework version of project should not changed. i tried following things far : 1) use of httpclient . referred link: http://www.asp.net/web-api/overview/web-api-clients/calling-a-web-api-from-a-net-client . problem approach cannot call readasasync method. calling method requires change in framework (i.e. replacing dlls or changing framework version) not feasible. 2) use of webclient . http://www.kastory.net/index.php?option=com_content&view=article&id=25:rest-web-service-in-c-with-silverli