Posts

Showing posts from August, 2010

jquery - Menu Button when Browser Is Resized -

i have css , html in website, please tell me if jquery needed, or else... so, have been trying change header button can click on , make vertical list, here example . when browser full sized, header vertical, when minimized, header turns button (top right on example .) , when clicked on, becomes vertical list. here code: (body only) <body> <div class="mainheader"> <div class="container"> <div class="logo"> <a href="#"><img src="images/banner.png" width="300" height="100"></a> </div> <div class="nav"> <ul class="nav"> <li><a href="#">home</a></li> <li><a href="#">roster</a></li> <li><a href="#">gallery</a></li> <

php - HTTP request coming from mobile browser or an app? -

i want know whether request coming android app, ios app or mobile browser. i'm able distinguish between android app & browser. i'm using following code distinguish: if($_server['http_x_requested_with'] == 'com.example.user' ){ $curos='android'; } else{ $curos='mobile'; } does ios make such request? or have better solution? need because i'm using webview apps both android & ios platform. any appreciated.

android - AOSP compiled image for Nexus 9 doesn't boot -

hi has tried compile android 5 on nexus 9? manage compile fine when flash it doesn't boot. tried loads of different approaches, nothing. re-synced tree, started scratch, rebuilt, etc, nothing. if use factory images works. i noticed during aosp build vendor.img (included in factory image) not generated. issue? no idea how solve though, since followed build instructions letter. i'm out of options. help? thanks reason there's still no aosp device drivers nexus 9: https://developers.google.com/android/nexus/drivers for other nexus devices (4/5/6 etc) there's drivers nexus 9 there nada. looks motorola (or of device component vendors) did not want release drivers android developers. need device drivers e.g. bt, nfc, camera, sensors, audio, wi-fi, graphics, cell modem, camera, gps, usb etc). for reason can build aosp nexus 9 might not work out expected since device drivers missing. the binaries "missing" due this: https://plus.google

Export phpMyAdmin problems -

i have built wordpress site on local host through mamp , want export live site. believe have export wordpress database phpmyadmin, when select database , go export tab , push go on quick export method, taken screen , not downloadable box appears , no let me download database. if localhost operating system linux, advice export database manually. type on shell prompt while replacing what's inside brackets own values : mysqldump -u [your_username] -p[your_password] [wordpress_database_name] > /tmp/[wordpress_database_name].sql this export database inside /tmp/ folder in file called wordpress_database_name.sql. this command can used on windows if installed mariadb or mysql server, comes utilities needed export. have change directory in command prompt until inside binary utilities directory (it's "c:\program files\mariadb\bin\"), , type : mysqldump.exe -u [your_username] -p[your_password] [wordpress_database_name] > [wordpress_database_name].sq

axapta - Poduction Order Error -

when start production order http://www.hostingpics.net/viewer.php?id=650344311.png i error http://www.hostingpics.net/viewer.php?id=780294952.png i did not understand error ! your error is: period 28/03/2015 not exists. it means ledger posting needed, no ledger period date exists. resolution: create new fiscal year

oracle - SQL Developer "missing left parenthesis" -

can please me? trying make table coursework have problem foreign keys , don't know why... i error, when try , create table: "missing left parenthesis" create table avatar ( avatar_id number(3) constraint pk_avatar primary key, avatarname varchar(255), dob number(12), gender varchar(1), strength number(12), weapon varchar(255), species varchar(255), cost numbr(20), player_id number(3), foreign key references player(player_id), motheravatar_id number(3), foreign key references motheravatar(motheravatar_id), fatheravatar_id number(3), foreign key references fatheravatar(fatheravatar_id) ); try this create table avatar ( avatar_id number(3) constraint pk_avatar primary key, avatarname varchar(255), dob number(12), gender varchar(1), strength number(12), weapon varchar(255), species varchar(255), cost number(20), player_id number(3), constraint fk_playerid foreign key (player_id) references player(player_id), motheravatar_id number(3), constraint fk_mother

opengl - Using multiple textures for shader programming in Haskell -

i'm using textureobjects when reading in texture. read in 2 textures, , want dynamically switch between them, when try do: tunit =(\(textureobject x) -> x) texobj and activetexture $= (textureunit tunit) setuniform p "texunit" (textureunit tunit) it doesn't work, if replace tunit 0, works it'll draw last texture load. i'm using glutil's readtexture function load in texture. any thoughts? the textureunit local shader id , textureobject global texture id. wasn't binding textureobject again before setting active texture, using latest 1 bound.

How to send arguments into transform function in R -

i trying create following function: mysplit_col <- function(df, colname, sepstr=':', firstname='part1', secondname='part2'){ df_split<- strsplit(as.character(df[,colname]), split=sepstr) transform(df, firstname= sapply(df_split, "[[", 1),secondname= sapply(df_split, "[[", 2)) } > mydf name position 1 hla 1:1-15 2 hla 1:2-16 3 hla 1:3-17 > dput(mydf) structure(list(name = structure(c(1l, 1l, 1l), .label = "hla", class = "factor"), position = structure(1:3, .label = c("1:1-15", "1:2-16", "1:3-17"), class = "factor")), .names = c("name", "position" ), class = "data.frame", row.names = c("1", "2", "3")) > mysplit_col_(mydf, 'position') name position firstname secondname 1 hla 1:1-15 1 1-15 2 hla 1:2-16 1 2-16

javascript - Conventions for ES6 iterables? -

i'm author of graph datastructure library javascript. i'm es6-ifying library. i want make more usable es6 programmers, means implementing iterable protocol . graph has multiple things iterate over, , multiple ways iterate on them (vertices, edges, successors, predecessors, vertices in topological order, etc.) i have idea of how design interface, i'd follow existing conventions if exist. here's example of how might 'vertices' part: class jsgraph { // ... vertices() { return { _graph: this, length() { return this._graph._vertexcount }, *[symbol.iterator]() { var keys = object.keys(this._graph._vertices); (let = 0; < keys.length; ++i) { yield [keys[i], this._graph._vertices[keys[i]]]; } } }; } // ... } if there existng convention should following (or problems code), feedback appreciated. you mi

JavaScript HtML get values from one input -

i can't find info in internet. wrote in 1 text box 2 values separated space .for example 44 55. how transform these input ​​into 2 variables ? assuming have input id myinput , then: document.getelementbyid("myinput").onclick=function(){ var firstvar = this.value.split(" ")[0]; var secondvar = this.value.split(" ")[1]; }

unity3d - Workaround for Unity5 iOS compile error with facebook-unity-sdk 6.2.1 -

i getting these errors when try compile on ios: on ios: fblinkshareparams *dialogparams = [[[fblinkshareparams alloc] init] autorelease]; /users/daniel/repositories/unity5/facebooktest/assets/facebook/editor/ios/fbunityinterface.mm:561:73: 'autorelease' unavailable: not available in automatic reference counting mode /users/daniel/repositories/unity5/facebooktest/assets/facebook/editor/ios/fbunityinterface.mm:662:15: no known class method selector 'publishinstall:withhandler:' now these don't seem of problem, there facebook developer here can give fast workaround this? how responsible @ facebook, why can't contact them directly? put -fno-objc-arc in compile flags of fbunityinterface.mm , , work

Is there a function in R that does what atoi() does in C? -

is there function in r atoi() in c? more precisely converts character integer. e.g. = 65, p = 80 , on ? chartoraw give hex value. can pass as.numeric decimal equivalent > as.numeric(chartoraw("a")) [1] 65 > as.numeric(chartoraw("p")) [1] 80

mysql - CodeIgniter- active record insert if new or update on duplicate -

is possible active record query in codeigniter update existing record if 1 exists or insert if doesnt, given key? i understand done first querying find existing record, i'm seeking efficient approach. basically looking might insert ... on duplicate key update - provided using mysql , id unique key on table. you'd have manually construct query , pass $this->db->query() function instead of built in active record helper functions of db driver. example: $sql = 'insert menu_sub (id, name, desc, misc) values (?, ?, ?, ?) on duplicate key update name=values(name), desc=values(desc), misc=values(misc)'; $query = $this->db->query($sql, array( $id, $this->validation->name, $this->validation->desc, $this->validation->misc

Android listView doesn't get update when adding new items -

i'm trying create app can add strings list activity, every time add new string list replaces old one. how can fix this? code list is. @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_show_list); button button = (button) findviewbyid(r.id.addbtn); button.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { startactivity(new intent(showlist.this, addtolist.class)); } }); intent = getintent(); bundle b = i.getextras(); if(b!=null) { string texttolist = b.getstring("listtext"); list<string> stuff = new arraylist<string>(); final arrayadapter<string> adapter = new arrayadapter<>(this, android.r.layout.simple_list_item_1, stuff); listview list = (listview) findv

c++ - GCC Templates: expected »(« before »>« token -

this question has answer here: where , why have put “template” , “typename” keywords? 5 answers i don't understand why following code doesn't compile: template< typename typearg > class data { public: struct selector1 { }; template< typename selector > void foo() { } }; template< typename typearg > class test { public: void test(); }; template< typename typearg > void test< typearg >::test() { data< typearg > data; data.foo< typename data< typearg >::selector1 >(); } i have tested gcc 4.6 , gcc 4.9. both give me same error: test.cpp: in member function »void test::test()«: test.cpp:28:51: error: expected »(« before »>« token test.cpp:28:53: error: expected primary-expression before »)« token can tell me needs done code compile? since type of

c# - Cancelling an HttpClient Request - Why is TaskCanceledException.CancellationToken.IsCancellationRequested false? -

given following code: var cts = new cancellationtokensource(); try { // "hot" task var task = new httpclient().getasync("http://www.google.com", cts.token); // request cancellation cts.cancel(); await task; // pass: assert.fail("expected taskcanceledexception thrown"); } catch (taskcanceledexception ex) { // pass: assert.istrue(cts.token.iscancellationrequested, "expected cancellation requested on original token"); // fail: assert.istrue(ex.cancellationtoken.iscancellationrequested, "expected cancellation requested on token attached exception"); } i expect ex.cancellationtoken.iscancellationrequested true inside catch block, not. misunderstanding something? that's case because httpclient internally (in sendasync ) using taskcompletionsource represent async operation. returns taskcompletionsource.task , that's task await on. it calls base

postgresql - @@SPID equivalent in Postgres -

is there equivalent @@spid in postgres or other way identify different connections same client process connected databases? pg_backend_pid() more details in manual: http://www.postgresql.org/docs/current/static/functions-info.html

c++ - i want to calculate the T(n) for the two algorithms -

i want know time complexity following 2 algorithms void main (){-----------------------------------------t(n) for(int a=1 ; a<=20 ; a++) {------------? if(a%2==0) -------------? cout<<"value even"; --------? else cout<<"value odd";--------? } } void main (){-----------------------------------------t(n) int x=1; {------------? int a=1; -------------? while(a<=n){--------? x=x*a; -------------? a=a+2; -------------? } cout<<x; } the idea calculate how execution time piece of code - typically algorithm, depends on input. if function takes n input how long take execute if n=5 or n=10. take double long? take same time? or take more double? in case: the first program doesn't depend on input o(n)=1. your second program depends on n. same stuff n/2 times due = + 2. o(n)=n/2. constants typically skipped , 1 write o(n) = n. if had code this: for (a=0; < n; a++) { // n times here (b

Monitor folders using unix bash -

i need shell script monitor folders given in command , notify user if file created inside them (the name of file read keyboard). i allowed use simple commands, not inotify... managed far: #!/bin/bash echo "please enter file want monitor: " read file_monitor #this infinite while while [ 1 ] ; #using test -e search file test -e $file_monitor && echo "the file has been created!" sleep 5 done i have find way stop while when file has been created, , search file in folders given in command line. can me, please? to exit loop, use break : test -e $file_monitor && echo "the file has been created!" && break i prefer break first, , echo after loop, or @mkemp6 suggested, directly use test condition loop. to check folders, loop through them, , check file in each one. break [n] exit within for, while, until, or select loop. if n specified, break n level

ruby - Rspec test to check input is within range 1-4 works once then fails -

my rspec test fails no matter input is. running test make sure input between 1-4 , seems work when input 3? require 'order' describe order 'gets dish input' order = order.new allow(order.input).to receive(:gets).and_return(:name) end 'checks input' order = order.new expect(order.input).to eq (1..4) end end calling order.rb class order def initialize input end def input puts 'please select number of dish' gets.chomp end def valid_range? input input.to_i.between?(1..4) end end thank you you write order class : class order attr_reader :dish_number def initialize @dish_number = input.to_i end def valid_dish? dish_number.between?(1, 4) end private def input puts 'please select number of dish' gets.chomp end end and corresponding spec should : require_relative '../order.rb' describe order 'gets dish number input'

Lua and patterns workaround -

i have string contains name of files (including complete fullpath) separated "|", @ end number indicated current file (is player). wanna keep name of files, right have use match function 2 times, 1 separation , other cut out path. wonder if , how possible one. ex. have: local s = "w:\\videos\\tokyo ghoul\\[tokyo ghoul][ep01]tragedia.mkv|w:\\videos\\tokyo ghoul\\[tokyo ghoul][ep02]incubación.mkv|w:\\videos\\tokyo ghoul\\[tokyo ghoul][ep03]paloma.mkv|w:\\videos\\tokyo ghoul\\[tokyo ghoul][ep04]cena.mkv|2"; so do: for val in s:gmatch('(.-)|') print(val); table.insert(list, { type = "item", icon = icon; text = val:match(".*\\(.*)")}); end i receive: [tokyo ghoul][ep01]tragedia.mkv [tokyo ghoul][ep02]incubación.mkv [tokyo ghoul][ep03]paloma.mkv [tokyo ghoul][ep04]cena.mkv what want use 1 gmatch function. hope can me. try for val in s:gmatch('.-\\(%[.-)|') print(

Is there Box rest api to fetch folders connected to a user? -

below rest api provides membership details of box user: https://api.box.com/2.0/users/335014321/memberships is there similar api fetch folders connected box user? i have tried below rest endpoint gave response status : 405,"code":"method_not_allowed". https://api.box.com/2.0/users/335014321/folders you not able folders connected box user without oauth token user. if admin of box enterprise account. can use as-user header. can take @ https://box-content.readme.io/reference#as-user-1 you have access token admin able use as-user call sending support ticket box support ask them activate application allow usage of as-user.

javascript - JSON.parse give me an error but JSONLint say it's a valid json -

i'm trying make graphic jqplot extracting values vía mysql ajax, have read information this, i'm , me it's little embarrasing making question. it's causing me big headache :( i've spent 20 days resolving can't alone myself, can me please? have tried (json.parse, parsejson, getjson, datatype html, datatype json, method , post.....) i know easy... why crash when try json.parse(resultado) ? http://jsonlint.com/ it's valid json, when try json.parse give me exception saying ("json.parse: unexpected character @ line 1 column 1 of json data") it seems [ character here php: <?php include('conex.php'); $datos=mysql_query("select * meteorologia"); $arrdatos = array(); while ($rs=mysql_fetch_assoc($datos)) $arrdatos[] = array_map('utf8_encode', $rs); echo json_encode($arrdatos); ?> i obtain: [{"fecha":"2015-01-01","ozono":"3","kt":"2","vv&

C# Error when saving a list to file -

program create use recording mouse , keyboard events. when create part saving record , use play later error below occur. code: public list<macroevent> events = new list<macroevent>(); stream stream = file.open("macro.bin", filemode.create); binaryformatter bin= new binaryformatter(); bin.serialize(stream, events); stream.close(); error getting: an unhandled exception of type 'system.runtime.serialization.serializationexception' occurred in mscorlib.dll additional information: type 'system.windows.forms.mouseeventargs' in assembly "system.windows.forms, version=4.0.0.0, culture=neutral, publickeytoken = b77a5c561934e089" not marked serializable. full stack trace a first chance exception of type 'system.runtime.serialization.serializationexception' occurred in mscorlib.dll stacktrace: ' @ system.environment.getstacktrace(exception e, boolean needfileinfo) @ system.environment.get_stacktrace() @

java - Web service response takes too much time -

i'm using jax-ws ri 2.1.6 in jdk 6 tomcat 6. i have tested consuming public webservice internet, response instant, when consume 1 server response takes around 5 minutes. nb: method publish return of string means load have nothing developing thing. thanks in advance the problem in publishing method. used endpoint.publish("http://192.168.1.103:8080/ws/helloworld3",new helloworld2impl()); this method response slow. the solution use wizard of eclipse of creating webservice publisher. wizard add files allows publishing webservice ounce server starts.

ember.js - ember-cli 0.2.1 - generated addon test cannot find mixin -

i have upgraded ember-cli 0.2.0 0.2.1 , ran following command generate mixin: ember g mixin listener the generate file place in addon/mixins/listener.js . the generated test looks this: import ember 'ember'; import listenermixin '../../../mixins/listener'; import { module, test } 'qunit'; module('listenermixin'); // replace real tests. test('it works', function(assert) { var listenerobject = ember.object.extend(listenermixin); var subject = listenerobject.create(); assert.ok(subject); }); the test fails following error message: could not find module dummy/mixins/listener imported dummy/tests/unit/mixins/listener-test my mixins should in /addons/ , not /app/ what need change tests find module? when upgraded 0.2.0 0.2.1 followed docs upgrading , ran steps in docs but line: ember init returned error assume it: generating addon in existing ember-cli project not supported. i ran issue on ember

sql server - Get Average amount of Months between sales in each row in SQL -

name customer stockcode description 3/01/2013 4/01/2013 5/01/2013 6/01/2013 7/01/2013 8/01/2013 9/01/2013 10/01/2013 11/01/2013 12/01/2013 1/01/2014 2/01/2014 3/01/2014 4/01/2014 5/01/2014 6/01/2014 7/01/2014 8/01/2014 9/01/2014 10/01/2014 11/01/2014 12/01/2014 1/01/2015 2/01/2015 3/01/2015 aag ice cream 564 243702 4/1 gal ja-rtu pineapple null null null 274.40 null null 313.60 null null null null null null null null 392.00 null null null null null null null null null aag ice cream 564 243701 4/1 gal ja-rtu strawberry null null null 660.00 null null null 660.00 null null null null null null null 660.00 null null null null null null null null null aag ice cream 564 248050 4/1 gal-rtu choc syrup null null null 534.00 null null 534.00 null

xcode - C language, what is wrong with this? -

this question has answer here: how scanf single char in c 8 answers i wanted make program can read right answers, check students answers comparing right answers , show points of each. problem every time insert first answer program skips second 1 , jumps third. here's how turns out every time: "insert answer 1: a insert answer 2: insert answer 3:" and here's code: #include <stdio.h> int main() { char v[30], a[30][20]; int i,j,c; (i=0; i<30; i++) { printf("insert answer %d: ", i+1); scanf("%c", &v[i]); } for(j=0; j<20; j++) { printf("student %d\n", j+1); (i=0; i<30; i++) { printf("insert answer %d: ", i+1); scanf("%c", &a[i][j]); } } for(j=0; j<20; j++)

html - CSS how to push text away from border -

Image
basically have code container holds widgets @ side of side: however can see text touching border. there anyway fix this? not sure how in css. .widget { margin-bottom:20px; border-style:clear; } .widget h2 { margin:0 0 10px 0; padding:0 5px; font-weight:normal; border-bottom:1px solid #21a1e1; } .widget .inner { margin:0 10px; border-style:clear; } /* aside */ aside { width:260px; float:right; border-top: 1px solid #21a1e1; border-left:1px solid #21a1e1; border-right: 1px solid #21a1e1; border-bottom: 1px solid #21a1e1; padding-left:0px; } assuming aside class class sidebar, can add margin-left: 20px; (or whatever value want) class definition: aside { width: 260px; float: right; border-top: 1px solid #21a1e1; border-left: 1px solid #21a1e1; border-right: 1px solid #21a1e1; border-bottom: 1px solid #21a1e1; padding-left: 0px; margin-left: 20px; // add here } the margin ou

amazon s3 - is it possible to store sessions with google cloud storage or s3? -

i searching cheap , scalable way store sessions within app ! so store sessions token , other parameter in 1 line, create empty file name token ! then can store file either in s3 or google cloud storage ! when check if session valid check if file exist !

twitter bootstrap - how to get search suggestions for foundations framework webapp? -

how search suggestions foundations framework webapp ? if bootstrap have used typeahead, etc foundations framework website , including bootstrap js , css causing conflict foundations css , js. how can search suggestions (similar typeahead bootstrap) foundations website according article , auto-complete search can implemented in zurb foundation using jquery this: <script> document.write('<script src=' + ('__proto__' in {} ? 'js/vendor/zepto' : 'js/vendor/jquery') + '.js><\/script>') </script> <script src="js/foundation.min.js"></script> html: <div class="row"> <div class="large-12 columns ui-widget"> <label for="tags">input label</label> <input id="tags" type="text" placeholder="large-12.columns"> </div> </div> js: <script> $(function() { var availablet

c++ - GoogleTest 1.7.0 `enum class` compile error -

when try , reference enum class test fixture, fails compile error ./gtest_mcp23s17.cpp:25:52: error: no type named 'hw_addr_6' in 'mcp23s17::hardwareaddress' tc_mcp23s17 _gpio_x(mcp23s17::hardwareaddress::hw_addr_6); ~~~~~~~~~~~~~~~~~~~~~~~~~~~^ however, if leave reference in test ( leaving other code untouched ), compiles without error , runs test expect. bug in googletest, or differentiates scenario far test concerned? test (generic) : [compiles] test(construction, whenobjectisconstructedthenaddressparameterisstored) { tc_mcp23s17 gpio_x(mcp23s17::hardwareaddress::hw_addr_6); expect_eq(0x4c, gpio_x.getspibusaddress()); } test fixture: [compiles] test_f(spitransfer, whenpinmodehasnotbeencalledthenthecallerschipselectpinishigh) { tc_mcp23s17 gpio_x(mcp23s17::hardwareaddress::hw_addr_6); expect_eq(high, getpinlatchvalue(ss)); } test fixture (with gpio_x declared in fixture class) : [fails] class spitrans

graph - How do I remove error bars from legend (matplotlib)? -

i plotting 4 sets of data on same graph, each set has different y values depending on variable p. in legend end 8 different element, 4 each different set of data , 4 error bars, shown here: http://i.stack.imgur.com/9zovm.png a simplified version of code shown below: import matplotlib.pyplot plt plt.plot(x1, y1, c='b', marker='o', label='p=0', markersize=4) plt.plot(x2, y2, c='g', marker='+', label='p=1', markersize=4) plt.plot(x3, y3, c='r', marker='*', label='p=2', markersize=4) plt.plot(x4, y4, c='k', marker='s', label='p=3', markersize=4) plt.errorbar(x1, y1, yerr=yerr0, color='b') plt.errorbar(x2, y2, yerr=yerr1, color='g') plt.errorbar(x3, y3, yerr=yerr2, color='r') plt.errorbar(x4, y4, yerr=yerr3, color='k') plt.ylabel("different y") plt.xlabel("different x") plt.xlim(xmin=0, xmax=maxx) plt.suptitle("different y vs diffe

c# - Error sending an Email MVC -

i'm trying send email mvc application, when tried send error message " could not find part of path 'c:\temp\67088830-4abc-41c6-afbe-6856bb817889.eml'. " @ line smtp.send(mail); any idea or suggestion on how solve error... also code send it. mailmessage mail = new mailmessage(); mail.to.add(configurationmanager.appsettings["to"]); mail.from = new mailaddress(configurationmanager.appsettings["from"]); mail.subject = configurationmanager.appsettings["subject"]; string body = "test"; mail.body = body; mail.isbodyhtml = true; smtpclient smtp = new smtpclient(); smtp.host = configurationmanager.appsettings["host"]; smtp.port = convert.toint32(configurationmanager.appsettings["port"])

c++ - to print the output prescribed -

#include<iostream> #include<math.h> #include<stdlib.h> using namespace std; main() { int q,a,b,i,number; cin>>q; while(q--) { cin>>a>>b; int a[b]; int number=1; for(i=0;i<b;i++) { if(i==0) { a[i]=number; number++; } a[i]=number; if(number>0) number=number*-1; } } } /*the above code tried little bit , it's incomplete , may incorrect too, may want print sequence 1,2,-2,3,-3,3,4,-4,4,-4,5,-5,5,-5,5..... till n , n size of array in c++?*/ chef's kid, junior chef loves playing different series. chef, impressed son's curiosity, gifts him special series s on birthday s=1,2,-2,3,-3,3,4,-4,4,-4,............. chef, eager check intelligence of son, gives him q queries solve. each query consists of 2 positions , b, , junior_chef required calculate sum of integers b. in

java - tableview not showing data from database -

i unable populate tableview. believe problem in controller, in way data being sent fxml file, because system out print (see below) shows have in database. please let me know did mistake. went on tutorials exist on that, nothing fits problem. thanks main app: package tableview; import javafx.application.application; import javafx.fxml.fxmlloader; import javafx.scene.parent; import javafx.scene.scene; import javafx.stage.stage; public class mainapp extends application { public static void main(string[] args) { // todo auto-generated method stub launch(args); } @override public void start(stage primarystage) throws exception { parent root = fxmlloader.load(getclass().getresource("view/fxmltable.fxml")); scene scene = new scene(root); primarystage.setscene(scene); primarystage.show(); } } controller: import tableview.model.person; public class fxmltablecontroller{ @fxml public tableview<person> tableview ; @fxml private ta

ios - Objective C Block - Convert Swift Not Working -

i've completed integration of photo library based on objective-c code, i'm stuck when trying re-write objective-c example code swift in 1 spot in particular. here objective-c code causing problem. __weak mhgallerycontroller *blockgallery = gallery; gallery.finishedcallback = ^(nsinteger currentindex,uiimage *image,mhtransitiondismissmhgallery *interactivetransition,mhgalleryviewmode viewmode){ nsindexpath *newindex = [nsindexpath indexpathforrow:currentindex insection:0]; [self.tableview scrolltorowatindexpath:newindex atscrollposition:uitableviewscrollpositionmiddle animated:no]; dispatch_async(dispatch_get_main_queue(), ^{ uiimageview *imageview = [(imagetableviewcell*)[self.tableview cellforrowatindexpath:newindex] iv]; [blockgallery dismissviewcontrolleranimated:yes dismissimageview:imageview completion:nil]; }); }; my assumption need set finishedcallback variable closure parameters - similar block above.as such tried same thin

How to check a partial similarity of two strings in C# -

is there function in c# check % of similarity of 2 strings? for example have: var string1="hello how doing"; var string2= " hi, how you"; and function(string1, string2) will return similarity ratio because words "how", "are", "you" present in line. or better, return me 60% of similarity because "how", "are", "you" 3/5 of string1. does function exist in c# that? a common measure similarity of strings so-called levenshtein distance or edit distance . in approach, defined set of edit operation defined. levenshtein distance minimum number of edit steps necessary obtain second string first. closely related damerau-levenshtein distance , uses different set of edit operations. algorithmically, levenshtein distance can calculated using dynamic programming , can considered efficient. however, note approach not take single words account , cannot directly express similarity in percent.

javascript - Call order with frames involved -

i have html page embedded iframe. possible reference global variable @ window.top without prefix (window.top or similar), or 1 have use full path access variable embedded frame. in quick test in google chrome not access variable @ window.top level without prefix, have sneaking suspicion has been possible earlier/in other browsers/in situations. question is: if there no variable sought name in iframe's local scope (the iframe's contentwindow), browser (some browsers?) automatically @ next higher level (the parent level window can belong frame/iframe or window.top) , return value/object? and: if there duplicate variable names @ local embedded iframe level , parent level, local level win out or can there situations the window.top version gains precedence? if there no variable sought name in iframe's local scope (the iframe's contentwindow), browser (some browsers?) automatically @ next higher level (the parent level window can belong frame/iframe or window.

c - The scanf function is accepting values infinately -

int n; int a[maxsize]; int b[maxsize]; int c[maxsize]; int i; printf("enter number of elements(disks)\n"); scanf("%d",&n); printf("enter elements in ascending order\n"); for(i=0;i<n;i++) { scanf("%d",&a[i]); } this works fine @ times, of times piece of code going infinite loop,the 'scanf' in loop accepting values infinitely,i tried using function (fflush) clear buffer contents,but still not working, please me out!! , please explain why !! the code posted cannot enter infinite loop, it's probable scanf() function blocking until input ctrl+d end input stream or maybe integer, problem handling input in dangerous way because not checking errors @ all, might want this #include <stdio.h> #include <stdlib.h> #define clearstdin() {int chr; while (((chr = getchar()) != eof) && (chr != '\n')); } while (0) #define somelargesize 1024 int main(void) { unsigned int index;

Python for loop only saves the last loop in my 2-d array -

i producing 1 dimensional random walks , want loop save maximum distance origin has been reached far, time progresses. 5 random walks produced. code: for j in range(5): r = rand(10000) t = range(10000) x = zeros(10000) y = zeros((10000, 5)) in range(10000): walk = r[i] if walk < 0.5: x[i] = x[i-1] - 1 y[:,j]= maximum.accumulate(abs(x)) else: x[i] = x[i-1] + 1 y[:,j]= maximum.accumulate(abs(x)) plot(t,x, label="walk %d" %(j+1)) title("1-d random walk (position versus time)") xlabel("time") ylabel("position") legend(loc="best") grid() the problem after loop iterates on set range (5) output 2-d array includes last iteration. somehow, overwhites previous ones, 10000x5 array last row filled in. how can make work? you've, reason, chosen execute y = zeros((10000, 5)) over , on again, each time through outer loop. as

python - readlines will always block the caller -

i'm reading programming python mark lutz, , came across bit: for pipe objects, effect of iterators may more useful avoiding loading entire result memory @ once: readlines block caller until spawned program finished, whereas iterator might not. what mean? if consider subprocess.popen example. if call command outputs lot of data subprocess.pipe calling proc.stdout.readlines() wait until command finishes. where if use iter for line in iter(proc.stdout.readline,"") , see output in real time , avoid having store output in memory. if had process each line of output make more sense process line line input came in using iter allows opposed blocking until command terminates using readlines .

android - onNewIntent is not being called - only every second time? -

i have notification setting up intent intent = new intent(ctx, mainactivity.class); intent.setflags(intent.flag_activity_new_task | intent.flag_activity_no_history); pendingintent pi = pendingintent.getactivity(ctx, 0, intent, pendingintent.flag_update_current); mbuilder.setcontentintent(pi); mnotificationmanager.notify(mainactivity.notification_result, mbuilder.build()); when notification, mainactivity.onnewintent() getting called every second time reason. have debug log statement in there, , literally every 2nd time, log not trigger. any thoughts? i not sure requirements, onnewintent declare in docs this called activities set launchmode "singletop" in package, or if client used flag_activity_single_top flag when calling startactivity(intent). in either case, when activity re-launched while @ top of activity stack instead of new instance of activity being started, onnewintent() called on existing instance intent used re-launch it. s

c# - Trouble parsing JSON Data -

i have following json data webservice: {"zip_codes":[{"zip_code":"36451","distance":0,"city":"grove hill","state":"al"}, {"zip_code":"36446","distance":8.031,"city":"fulton","state":"al"}]} i using newtonsoft.json library .net , trying parse above string cities. keep getting error. public list<string> getzipcodeswithinradius(string zipcode, string radius) { list<string> l = new list<string>(); string apikey = @"----"; string apiformat = @"radius.json"; string baseurl = @"http://www.zipcodeapi.com/rest/"; string url = baseurl + apikey + @"/" + apiformat + @"/" + zipcode + @"/" + radius + @"/mile"; webclient client = new webclient(); stream st

f# - Parsing "x y z" with the precedence of multiply -

i'm trying write parser mathematica language in f# using fparsec. i have written 1 miniml supports syntax f x y = (f(x))(y) high precedence function application. need use same syntax mean f*x*y and, therefore, have same precedence multiply. in particular, x y + 2 = x*y + 2 whereas x y ^ 2 = x * y^2 . how can accomplished? as stephan pointed out in comment can split operator parser 2 separate parsers , put own parser in middle space-separated expressions. following code demonstrates this: #i "../packages/fparsec.1.0.1/lib/net40-client" #r "fparsec" #r "fparseccs" open fparsec open system.numerics type expr = | int of biginteger | add of expr * expr | mul of expr * expr | pow of expr * expr let str s = pstring s >>. spaces let pint : parser<_, unit> = many1satisfy isdigit |>> biginteger.parse .>> spaces let high = operatorprecedenceparser<expr,unit,unit>() let low = operatorprecedenceparser&l

ruby - Rails 4 + ActiveRecord: group_by on column from different model -

i have these models: class user < activerecord::base has_many :car_votes has_many :cars end class car < activerecord::base belongs_to :user has_many :car_votess end class gamevote < activerecord::base belongs_to :user belongs_to :car end if want display cars user voted (and group output day when user voted cars): @voted_cars = @user.car_votes.order('car_votes.created_at desc').group_by { |r| r.created_at.to_date } so on output cars user voted grouped days user voted games. but group output according car_votes.created_at , according cars.created_at . how this? thank in advance. if associations allow this(try on rails console): @c = carvote.first puts @c.car.created_at and return value rather error, can do: @voted_cars = @user.car_votes.order('car_votes.created_at desc').group_by { |r| r.car.created_at.to_date }

2d arrays, functions, C -

the problem write function takes 2 dimensional array, 2 integers represent number of rows , columns in array, , prints out 2 x 2 array represents largest square in array. largest square means square sum of elements greatest in array. given array: 1 2 3 4 5 6 7 8 9 10 11 12 output should be: 7 8 11 12 though never learned subarray/matrixes , kadane algorithm in class i've been online day , im hopping close solution? (*my professor interested in function, we're not supposed submit full program) due yesterday im lost, please if can , in advance! /*void f(x) opens file take in given array*/ void largestsqaure(int array[row][column]) { file*ifp= fopen("largestsquare.txt", "r"); file*ofp= fopen("output.txt", "w"); for(r0w= 0; row < size; row++) fscanf(ifp, "%d", &array[row]); /*declaring variables*/ int maxsum = int_min, finalleft, finalright, finaltop, finalbottom;