Posts

Showing posts from September, 2010

changing CSS value with jquery -

when adapted-for-no-javascript page loads, 1 of styles loaded this: //accordion open .accordionitemcollapsed, .accordionitem.is-collapsed { max-height: 100%; } that way accordion open , content visible users without javascript. but when user has javascript enabled visits site, value changed automatically this: //accordion collapsed .accordionitemcollapsed, .accordionitem.is-collapsed { max-height: 0; } how best jquery? this quite elementary new jquery/js , bit lost googling solutions because search hits seem apply more complicated cases. instead of changing or injecting css, suggest adding no-js class body/html/container , removing jquery. your css this .accordionitemcollapsed, .accordionitem.is-collapsed { max-height: 0; } .no-js .accordionitemcollapsed, .no-js .accordionitem.is-collapsed { max-height: 100%; } the jquery straightforward $('html').removeclass('no-js'); this approach more efficient querying dom accordi

jquery - html table with data from database without populating database row id php -

i constructing html table data queried database using php. need perform edit,delete operations on table. saving database row id hidden input field in each table row. what doing when user clicks on particular row getting row id using jquery , performing edit/delete operations on database table using ajax,php but problem here when user inspects element can see ids of each row. if user technical expert can edit row id , change value of other rows in database table. generally how handle type of situations without populating database row id in table. if user kind of expert in inspector , manipulate hidden info, , has strictly not possible change, send guid or custom backend function encrypt / decrypt info user table..

angularjs - Express and Angular directory structure -

i want build website express , angular (no sql) started wondering right structure kind of app. for angular there directory structre here : app/ ----- shared/ // acts reusable components or partials of our site ---------- sidebar/ --------------- sidebardirective.js --------------- sidebarview.html ---------- article/ --------------- articledirective.js --------------- articleview.html ----- components/ // each component treated mini angular app ---------- home/ --------------- homecontroller.js --------------- homeservice.js --------------- homeview.html ---------- blog/ --------------- blogcontroller.js --------------- blogservice.js --------------- blogview.html ----- app.module.js ----- app.routes.js assets/ ----- img/ // images , icons app ----- css/ // styles , style related files (scss or less files) ----- js/ // javascript files written app not angular ----- libs/ // third-party libraries such jquery, moment, underscore, etc. index.html for expr

swift - Searching in Array of Dictionaries -

Image
i'm trying search values in array of dictionaries json. have tableviewcontroller uisearchresultsupdating . found example array of strings: func updatesearchresultsforsearchcontroller(searchcontroller: uisearchcontroller) { filteredtabledata.removeall(keepcapacity: false) let searchpredicate = nspredicate(format: "self contains[c] %@", searchcontroller.searchbar.text) let array = tabledata.filteredarrayusingpredicate(searchpredicate) filteredtabledata = array as! [string] self.tableview.reloaddata() } and don't know how made search in array this: ( { id = 3; name = testnewyork; }, { id = 2; name = testla; }, { id = 1; name = testwashington; } ) my tabledata = [] , filteredtabledata must array too please, help! you can use simple filter function this... tabledata : [[string : string]] = ... // json array of string, string dictionaries... filteredtabledata = tabledata.fi

sql - Mutuating Tables With Triggers? -

i using before insert or update trigger on table , want query same table in trigger. trigger each row. when compiled trigger complied without error , warnnings , in valid state. trigger not execute code querying table , after. all code doing checking if customer has used debitnote#(stored in attribute1) or not. if has used throw error else proceed. i unable this. mutuatuing table error?.any appreciated. create or replace trigger apps_appl.xx_ozf_dbtnum_ins_trg before insert or update on ozf_claim_lines_all each row when (new.org_id = 43) declare ln_cust_account_id number; ln_debit_cust_count number; le_claim_invalid exception; lv_attribute1 varchar2 (100); begin --get customer account id new claimid select cust_account_id ln_cust_account_id ozf_claims_all claim_id = :new.claim_id; --get count of records customer has same debitnote# select count (ocla.claim_line_id) ln_debit_cust_count ozf_claims_all oca,

vb.net - Filter The Entities by Linq -

here situation: i need bind entityset repeater. the old way is: reppackageproducts.datasource = package.packageproducts reppackageproducts.databind() note: package entity, packageproducts entityset now, need filter packageproducts base on own packageproductpricingvars's column isnew(true/false). i use linq this, cannot add statement: dim s = (from b in package.packageproducts select b.packageproductpricingvars).where... i'm stuck @ .where . not shows column name of packageproductpricingvars need filter. please give me hint. thank you! you have 2 options: 1- query syntex: dim s = p in package.packageproducts _ p.packageproductpricingvars.isnew = true _ select p.packageproductpricingvars 2- method syntax: dim s = package.packageproducts _ .where(function(p) p.packageproductpricingvars.isnew = true) _ .select(function(p) packageproductpricingvars)

ftp client - Unable to Upload file from SdCard to FTP Server using android -

i'm newbie in android , want upload file sdcard ftp server. followed this tutorial it doesn't work me , got warning in logcat: 05-11 17:06:22.226: i/system.out(13571): [cds]rx timeout:0 05-11 17:06:23.994: i/uploadfile(13571): http response : bad request: 400 05-11 17:06:23.994: d/dalvikvm(13571): threadid=12: exiting 05-11 17:06:23.994: d/dalvikvm(13571): threadid=12: bye! could me please? code: ` import java.io.dataoutputstream; import java.io.file; import java.io.fileinputstream; import java.net.httpurlconnection; import java.net.malformedurlexception; import java.net.url; import android.app.activity; import android.app.progressdialog; import android.os.bundle; import android.util.log; import android.view.view; import android.view.view.onclicklistener; import android.widget.button; import android.widget.textview; import android.widget.toast; public class uploadtoserver extends activity { textview messagetext; button uploadbutton; int serverrespon

javascript - Link redirection with ID not working properly in mozilla, -

i having hectic problem 1 of website while working in mozilla, problem may seems small ruins time, hope can me. i have static website, there used anchor link link site webpage. while clicking on particular link page redirects page in same website. need land in different positions, used anchor links redirect. i attaching redirection code here. <a href="content/index.php#auto-vid" class="maroon"> <h3>heading</h3> <p>content</p> <div class="arrow-outer"> <span class="read_more">read more </span> <span class="arrow arrow-right"></span> </div> </a> this work cool in chrome , ie, not in mozilla, while click read more button, next page appear. it won't go particular id, instead keep remaining on top of page. i tried debug it, there see errors, this, empty string passed getelementbyid(). in jquery file.

javascript - Get array of object's keys -

i keys of javascript object array, either in jquery or pure javascript. is there less verbose way this? var foo = { 'alpha' : 'puffin', 'beta' : 'beagle' }; var keys = []; (var key in foo) { keys.push(key); } var foo = { 'alpha' : 'puffin', 'beta' : 'beagle' }; var keys = object.keys(foo); // ['alpha', 'beta'] // (or maybe other order, keys unordered). use object.keys . this es5 feature. means works in modern browsers will not work in legacy browsers . the es5-shim has implementation of object.keys can steal

mongodb - Mongoid geonear query with max distance not working properly -

i confused geonear query mongoid. seems missing , when m trying query points near given coordinates max distance 200 meters form controller following: coord.geo_near([params[:lon].to_i, params[:lat].to_i]).max_distance(200) i points available in collection in same order every set of coords provide. my model: class coord include mongoid::document include mongoid::geospatial field :message, :type => string field :location, type: point, spatial: true end i have created 2dsphere index mongo console: db.coords.createindex( { location : "2dsphere" } ) i have tried instead of 200 meters provide 0.2/111.2 in case max_distance works degrees in case m not getting results. use earth radius to search in 10km radius: coord.geo_near([params[:lon].to_f, params[:lat].to_f]).max_distance(10.fdiv(6_371))

osx - Cannot get HAX working for Android Emulator & the emulator appears to freeze -

i running os-x 10.10.2 yosemite on macbook air , have installed latest version of android studio (1.2) , has default sdk pre-configured. i trying setup intel haxm speed emulation - have setup ionic & cordova frameworks (as i'll using develop mobile apps). i using command start emulator: sudo cordova emulate android this begins process , opens android virtual device , 'android' word appears on screen. in terminal following: waiting emulator.... emulator: memory needed vm exceeds driver limit hax not working , emulator runs in emulation mode booting emulator (this may take while)............................... this appears 'stick' on screen - have installed intel haxm (1.2 installed) doesn't seem have been correctly configured - can suggest how fix. have changed ram used haxm 1gb , 768mb no joy.. can suggest ideas?

objective c - Combine two iOS apps into one -

i have situation 2 separate companies wish 'join' ios apps form single app (so 1 app store download required). apps have entirely separate code-bases. companies looking partner don't want 1 seeing each others code. a degree of fiddling code acceptable. is there way 'package' code-bases or binaries app 1 incorporated app2 without app2 developers having access app 1 code base? thanks sure, make 1 (or both) of apps libaries or frameworks can called other (to instantiate , open xib file , view controller parent view of "other" app). then source code kept separate , distinct 1 section another. but have work out solutions app delegate (uiapplicationdelegate) methods implemented in both applications. luck that!

data.table and R's ellipsis (i.e. '...'): pass by reference does not seem to work -

im trying manipulate large data table (~37 mb) in special way: other (unrelated) reasons have implemented 'hook' structure meaning overall process like 1) load data.table disk 2) fire hook 3) hook structure looks name ans checks whether user (=me :)) has bound function hook , if so, called 4) data processed further the functions this: data = readrds(pathtofile) data = data.table(data) firehook("after_data_read", data, [some other parameters]) some_more_processing(data) and region around firehook looks like hooksregistered = list( "after_data_read" = function(data, ...) { # stuff } ) firehook = function(hookname, ...) { (hooknameregistered in names(hooksregistered)) { if (hookname == hooknameregistered) { func = .global.hooksregistered[[hookname]] func(hookname, ...) } } } observe 1 needs cast object is data.table again (otherwise pass-by-reference not work), s

c# - MediaCapture grab single frame -

i'm trying grab single frame making use of mediacapture class. i've viewed various tutorials, of them focus on easy stuff. i've had @ following: access preview frame mediacapture , tutorial focuses on windows 10. so, first question is, possible? secondly, if so, have advice? many in advance! i assume tags desktop? because phone has had api capture preview frames ( photocapturedevice.getpreviewbuffer* , see here: https://msdn.microsoft.com/en-us/library/windows/apps/xaml/windows.phone.media.capture.photocapturedevice.aspx ). although keep in mind windows.phone.media.capture deprecated @ point. on desktop, might take full picture. won't slower, , because usb cameras have single stream capture types (preview, photo, video, see: https://msdn.microsoft.com/en-us/library/windows/apps/windows.media.capture.videodevicecharacteristic.aspx ), means streams run @ same resolution. look mediacapture.capturephototostreamasync() or capturephototostoragefileasync(

antlr - ANTLR3 Resolving Grammar With non-LL(*) decisions -

as homework should create parser vc language v10.1 using antlr. here work: grammar myvcgrm2; program : ( funcdecl | vardecl )* ; funcdecl : type identifier paralist compoundstmt ; vardecl : type initdeclaratorlist ';' ; initdeclaratorlist :  initdeclarator ( ',' initdeclarator )* ; initdeclarator : declarator ( '=' initialiser )? ; declarator : identifier identifier2  ; identifier2 : |'[' intliteral? ']' ; initialiser : expr                 |  '{' expr ( ',' expr ) *  '}' ; // primitive types type : 'void' | 'boolean' | 'int' | 'float' ; // identifiers identifier : id ; // statements compoundstmt : '{' vardecl*  stmt* '}' ; stmt : compoundstmt         |  ifstmt         |  forstmt         |  whilestmt         |  breakstmt         |  continuestmt         |  

html - How can you center a swf object? -

Image
my swf responsive it's hard center, i'm hoping find , easy way that. can object act img tag , centered in css? tested theory no luck. how make code center? have alternative can responsive , centered? it looks this: what below not helping. x try of these alternatives css positioning .hdiv { position: absolute; left: 0; top: 0; bottom: 0; right: 0; } object { position: absolute; left: 25%; top: 25%; width:50%; height: 50%; background:#000; } flexbox approach .hdiv { display:flex; justify-content:center; align-items:center; height:100vh; } object { background:#000; width:50%; height:50%; } note need prefix flexbox classes browsers , syntax might different , vh not supported older browsers. with css transform .hdiv {

python - Subplot with equal aspect ratio -

i plot 2 subplots in same row same aspect ratio. it's quite ugly otherwise ! so, usually, i'm using axes().set_aspect('equal') (because want remove axis, , can't use 'off' , 'equal') pylab doesn't work right here, 2nd picture appears my code: plt.subplot(1,2,1) axes().set_aspect('equal') plt.tricontourf(x_exp, y_exp, z_exp) plt.colorbar(shrink=0.9,drawedges=true, orientation='vertical') plt.axis('off') plt.title('tricontour') plt.subplot(1,2,2) axes().set_aspect('equal') plt.tricontourf(x_exp, y_exp, z_exp2) plt.colorbar(shrink=0.9,drawedges=true, orientation='vertical') plt.axis('off') plt.title('tricontour') plt.show() it work following line subplot doesn't have tricontourf plot ! fig = plt.figure() ax1 = fig.add_subplot(2,1,1, adjustable='box', aspect=0.3) ax2 = fig.add_subplot(2,1,2) do have idea figure out ? edit: sample of data i have used np

gcc - Compile with older libc (version `GLIBC_2.14' not found) -

i have compile program on current ubuntu (12.04). program should run on cluster using centos older kernel (2.6.18). cannot compile on cluster directly, unfortunately. if compile , copy program without changes error message "kernel old". the way understood it, reason not kernel version, version of libc used compilation. tried compile program dynamically linking libc cluster , statically linking else. research there lot of questions on none of answers worked me. here research on topic: this question explains reason kernel old message this question similar more specialized , has no answers linking statically proposed here didn't work because libc old on cluster. 1 answer mentions build using old libc, doesn't explain how this. one way compile in vm running old os. worked complicated. read you should not link libc statically apparently is possible compile different libc version option -rpath did not work me (see below) current state i copied

.htaccess - Preventing search engines from indexing Wordpress uploads -

a client has requested files within /uploads directory within wordpress not listed search engines. have tried following within robots.txt user-agent: * disallow: /wp-admin/ disallow: /wp-includes/ disallow: /wp-content/uploads/ and adding following .htaccess , changing browsers user agent googlebot, can still view files rewritecond %{request_uri} ^/wp-content/uploads rewritecond %{http_user_agent} googlebot rewriterule ^.*$ /404 [l,r=301] is there error in of above, or going wrong way? many in advance.

debian - dh_md5sums: Argument list too long -

i using debuild build debian packages. when building 1 of them (which contains quite lot of php files), following error: dh_installdocs dh_installchangelogs dh_perl dh_link dh_compress dh_fixperms dh_installdeb dh_gencontrol dpkg-gencontrol: warning: package amazing-php: unused substitution variable ${perl:depends} dh_md5sums can't exec "/bin/sh": argument list long @ /usr/share/perl5/debian/debhelper/dh_lib.pm line 241. dh_md5sums: (cd debian/amazing-php >/dev/null ; find . -type f ! -path "./etc/apache2/sites-available/amazing-php.conf" ! -path "./etc/amazing-php/extensions/arrays/arrayloopsinteractionparsertests.txt" ! < long list of files > when looking @ file using vi /usr/share/perl5/debian/debhelper/dh_lib.pm +241 can find system(join(" ", @_)) == 0 which launches subshell list of files (which long). seems bug me? is there workaround or something? i fixed adding dh_override_md

xcode - IOS Facebook SDK : what wrong with sharerDidCancel:(id<FBSDKSharing>)sharer delegate? -

i use facebook sdk worked except delegate " sharerdidcancel:(id)sharer ". when cancel share native dialog fb app, delegate " sharer:(id)sharer didcompletewithresults:(nsdictionary *)results " called ? can't handle users when post or cancel dialog share, bug of facebook sdk ios ? thanks helping! i've been digging through facebook sdk docs , found this : sharer:didcompletewithresults: when user shares. furthermore there postid key in results dictionary if user gave app publish_actions permissions. if user has not logged in facebook login, method called if user clicks on cancel. so, unless you're logged in, checking cancel won't work (which rubbish). looks might able give permissions , check postid though.

ios - A workaround for custom and "dynamic" notification sounds -

from apple documentation , can read for remote notifications in ios, can specify custom sound ios plays when presents local or remote notification app. sound files must in main bundle of client app. my app evolves around notifications, many other apps, , have ability add sounds later on, or @ least have kind of control on them. best scenario : on launch, app checks sound database online , downloads updates. but if sounds have in bundle, can't done. i have on 400mb of sounds, , obvious sounds, app store, , that's why i'd need control user, not download sounds. is there possible workaround can play sounds written on disk , not in bundle? or other possibility might think of can play custom push notification sound? if of help, app works 100% online, if there solution, can server-related. i understand i'm "no" best answer, need make sure. thank in advance. if app wants in app store, should follow apple documentation. say, can

java - Eclipse - Adding/Removing Projects to Server -

is there way automate (ant/maven) eclipse menu function add/remove project server? scenario : i'm using eclipse develop large liferay project multiple modules. deployment process rather large. have manually drag & drop modules onto running server in order. i'd call ant task that. note : i'm not talking simple hot deployment. need modules added server eclipse "knowing" it. whenever change code, module gets redeployed on fly. thanks in advance

asp.net mvc - Sitecore Authentication Persistence over Subdomains -

i trying configure website user can stay logged in if navigates different subdomain (seperate content trees in sitecore). just crystal clear, if have following domains: site.com ex1.site.com ex2.site.com and on, want user remain logged in when navigating between them. using sitecore authenticationmanager . could please me one? thanks in advance. as sitecore uses asp.net membership provider authentication , authorization of users , roles following should work: http://blog.nick.josevski.com/2013/06/12/cross-subdomain-asp-net-forms-authentication-for-local-developement/

dns - Java Resolve IPv6 incorrect -

Image
i'm trying resolve ipv6 address using java code wrote returns host name same given, while running nslookup resolve real name: . here java code: try { inet6address addr = (inet6address) inet6address.getbyname("2607:f8b0:4002:c06::65"); system.out.println("host: " + addr.gethostname()); } catch (unknownhostexception e) { e.printstacktrace(); } output: host: 2607:f8b0:4002:c06:0:0:0:65 why that? java have different dns resolver?

cloudfoundry - Bluemix ClearDB MySQL capacity limitation -

the mysql cleardb service in bluemix catalogue offered 1 single plan limited capacity (5mb , 4 connections) , free. have recommendation application requires mysql db higher capacity? should run hybrid application database on heroku , app on bluemix? although cleardb service in bluemix offers 'free' spark plan can go directly cleardb.com , use 1 of larger paid plans. in bluemix can create called user-provided service using cf cups command. user-provided service needs populated connection , credential details needed access cleardb service have created directly on cleardb.com there more information in bluemix docs on how run command. the obvious drawbacks of need manage service details in bluemix, if cleardb change server name example manually have update user-provided service in bluemix. in reality not occur (if @ all). other drawback have separate bill cleardb rather 1 single bill bluemix. i believe in future more plans 3rd party providers should made

PHPExcel converts dot after writing in comma -

i generate excel file importing csv file. in csv has contents following numbers 4.0238484 5.3833888 dot seperated if write excel file column show me numbers in following format 4,0238484 5,3833888 want dot instead of comma. how can make it? phpexcel version 1.7.7 check locale settings version of ms excel using view generated file: if it's set locale uses decimal comma rather decimal point, see. floating point numbers in phpexcel managed decimal point (php doesn't offer alternative numbers), ms excel has own formatting rules based on locale.

vba - How do I Execute Visual Basic Exe and Crystal report in LAN -

hi have visual basic project exe runs fine on single machine want execute multi user in lan. have used crystal reports in project , database ms acess. please me how run project in lan.. a vb exe client architecture needs installing on each client machine using it. code in exe could/would connect external shared, singular resources on network (such databases, reporting servers etc.) actual exe typically duplicated upon each client computer. if need users open exe , have run on same machine, could create client shortcuts or use script createobject("application.namehere","servertorunappon") call &/or modify dcom settings app through dcomcnfg tool... however i'd sugguest instead re-evaluating architecture. possibly turning app better practice web-based or ms access shared mde+mdb solution clients connect to.

python - Updating a table from another table with multiple columns in sqlalchemy -

i want update multiple columns of 1 table according other multiple columns of table in sqlalchemy. i'm using sqlite when testing it, can't use `update table1 set col=val table1.key == table2.key" syntax. in other words, i'm trying create sort of update query: update table1 set col1 = (select col1 table2 table2.key == table1.key), col2 = (select col2 table2 table2.key == table1.key) in sqlalchemy: select_query1 = select([table2.c.col1]).where(table1.c.key == table2.c.key) select_query2 = select([table2.c.col2]).where(table1.c.key == table2.c.key) session.execute(table.update().values(col1=select_query1, col2=select_query2)) only i'd query once instead of twice, unless sqlite , mysql smart enough not make query twice themselves. i don't think can. thus, not answer, far long comment. you can compose query 2 columns (i guess knew that): select_query = select([table2.c.col1, table2.c.col2]).where(table1.c.key == table2.c.key) an

javascript - Rails: How to stop refreshing a page with two objects paginated in it? -

i have implemented will_paginate plug in on ror project. will_paginate done in 2 objects of same page, once of them gets clicked, whole page refreshes, , shows page @ top of view. how can make after click pagination bar, pagination changes no refresh happens, or if refresh happens, shows part of page (div) pagination effects? is there possible jquery/ajax way this? sure. in click event must insert "e.preventdefault()" before function retrive data: $('#yourelement').on('click', function(e) { e.preventdefault(); //your code }); don't forget "e" param in handler.

c++ - Get SubTag details of Tag [Boost Porperty_tree XML] -

i trying details of "subchapter" tag. not know how information inside tag. my xml looks this: <xml> <chapter> <name>first chapter</name> <link>xyz1</link> <chapter> <name>first sub-chapter</name> <link>xyz2</link> </chapter> </chapter> </xml> now want information of second chapter tag... c++ looks this: boost::property_tree::ptree pt; boost::property_tree::xml_parser::read_xml("file.xml", pt, boost::property_tree::xml_parser::trim_whitespace ); boost_foreach(const boost::property_tree::ptree::value_type& node, pt.get_child("xml")) { if( node.first == "chapter" ) { chapter chp; chp.name = node.second.get<std::string>("name"); chp.link = node.second.get<std::string>("link"); //boost::property_tree::ptree::value_typ

hadoop - How to use variables in hive load command -

i have multiple files load hive, this t47_corporation t47_cp_deposit t47_id_deposit t47_individual ... i try load using following command for var in t47*; hive -e "load data local inpath ${var} overwrite table ${var}_tmp"; done but got error failed: parseexception line 1:23 mismatched input 't47_id_deposit' expecting stringliteral near 'inpath' in load statement i using hive 0.13 how should finish this? thanks i found answer, thank u inspiration var in t47*; hive -e "load data local inpath \"${var}\" overwrite table ${var}_tmp"; done this executed successfully

python - Cythonise a pandas loop -

can show me how convert loop cython improve performance. need create static types using cdef performance else required: if have dataframe df column 'a'. in range(0, len(df.a)-1): if (i < len(df.a)-1): y= + 1 while ((np.abs(df.a[y]- df.a[i]) <= 0.015) & (y < len(df.a)-1)): y = y + 1 if df[a][y] - df[a][i] >= 0.015: df['dir_y'][i] = 1 #print(1) else: df['dir_y'][i] = -1 #print(-1) i pretty sure 'cythonise' not word seemed appropriate. without trying comment on whether write better in pandas without using cython (i don't know, it's worth trying), steps you'd need are: cdef iteration indices i , y integers: cdef int i,y (the cdefs go @ top of function they're in) cdef memoryview array access df.a / df['a'] through: cdef double[:] df_a_mv later df_a_mv = df.a (i've guessed @ type

html - Footer needs to stickk to the sidebar at all widths in a responsive theme -

Image
i using yahoo's purecss , trying create responsive site. facing issues. footer unfortunately, not aligning flush sidebar. the jsfiddle here the footer css .footer { background: none repeat scroll 0 0 rgb(100, 100, 100); border-top: 1px solid #eee; font-size: 87.5%; margin-top: 3.4286em; padding: 1.1429em; clear: both; text-align: center; width: 100%; max-width: 800px; } what's blocking expanding : max-width: 800px; is mean not aligning flush sidebar ?

c# - Sending a phrase (variable) from searcher (from view) to controller, asp.net mvc -

i'm trying create searcher in asp.net. i'm green it. i'm trying create in view , send controller variable, has text written in searcher. in moment, have smth --> question is, , how create , send variable , give data written in searcher? layout form class="navbar-form navbar-left" role="search"> @using (html.beginform("index", "searcher", formmethod.post, new { phrase = "abc" })) { <div class="form-group"> <input type="text" class="form-control" placeholder="wpisz frazÄ™..."> </div> <button type="submit" class="btn btn-default">@html.actionlink("szukaj", "index", "searcher")</button> } </form> controller public class searchercontroller : applicationcontroller { [httpget]

c# - How to read iCollection data in repository pattern - ASP.NET- MVC Entity Framework -

Image
i using repository pattern , unit of work in asp.net-mvc application. have generic repository crud operation , service class between unit of work , controller class; meaning controller class call unit of work access operation great encapsulate data access , business logic web application. now question how can icollection data within unit of work. taking example below student model public partial class student { public student() { this.studentcourses = new hashset<studentcourse>(); } public int studentid { get; set; } public string name { get; set; } public virtual icollection<studentcourse> studentcourses { get; set; } } course model public partial class course { public course() { this.studentcourses = new hashset<studentcourse>(); } public int courseid { get; set; } public string title { get; set; } public virtual icollection<studentcourse> studentcourses { get; set; } } stu

awk - how to merge 2 files in linux -

this question has answer here: how can merge 2 files? 4 answers i have file 1: line1 line2 line3 .... file 2: date1 date2 date3 ... and result should be: line1, date1 line2, date2 line3, date3 ... is there way on linux awk (i think) job on command line? lot you can use awk awk 'fnr==nr {a[nr]=$0;next} {print a[fnr]", "$0}' file1 file2 line1, date1 line2, date2 line3, date3 ...., ... fnr==nr {a[nr]=$0;next} when reading first file fil1 , store in array a {print a[fnr]", "$0} print out array a using line number index , data file2

ruby net/http sysread_nonblock: end of file reached (EOFError) -

i have following code: #!/usr/bin/env ruby require 'net/http' token = file.read("code.txt") uri = uri("https://private.http.server.with.self.signed.certs") http = net::http.new(uri.host, uri.port) http.use_ssl = true http.verify_mode = openssl::ssl::verify_none retjson = http.get("/api/conf/"+token) puts retjson.body and works fine on macbookpro13 mid 2010 8gb ram. the same code on new macbookpro15 mid 2014 16gb raises following exception: /users/lc/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/openssl/buffering.rb:174:in `sysread_nonblock': end of file reached (eoferror) /users/lc/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/openssl/buffering.rb:174:in `read_nonblock' /users/lc/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/net/protocol.rb:141:in `rbuf_fill' /users/lc/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/net/protocol.rb:122:in `readuntil' /users/lc/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/net/protocol.rb:132:in `readli

Finding the name of method in jquery -

i trying find method names in html code. find method name in 'onclick' attribute , make operations. this current code: <div class="button" style="width: 60px; float: right;" onclick="closemodaldialog('dialogattachmentmodal');">blabla</div> i want write jquery this: $('closemodaldialog').attr('id','btnclosemodal'); and want show this: <div class="button" id="btnclosemodal" style="width: 60px; float: right;" onclick="closemodaldialog('dialogattachmentmodal');">blabla</div> i know, selector must id or class. want add attribute this.(because have more 'button' class , want add one) possible? how can succeed? thx in advance , sorry language. you can use 'attribute begins selector' this: $('[onclick^="closemodaldialog"]').prop('id', 'btnclosemodal'); note it's better p

uibutton - iOS: How to handle multiple buttons created dynamically with one iBAction? -

i have created radio , check box buttons programmatically according web service response, number of buttons varies. following code create buttons: for(int j = 0; j < nintoptioncount; j++) { uilabel * lbloption = [[uilabel alloc] initwithframe: cgrectmake(50, ylabel, 250, 21)]; //lbloption.backgroundcolor = [uicolor yellowcolor]; lbloption.text = [arrmoptionname objectatindex:j]; lbloption.textcolor = [uicolor blackcolor]; lbloption.font = [uifont systemfontofsize:14.0f]; [viewdetail addsubview:lbloption]; intoptionid = [[arrmoptionid objectatindex:j] intvalue]; if (inteventchoice == 1) { btnradio = [[uibutton alloc]initwithframe:cgrectmake(5, ylabel, 22, 22)]; [btnradio addtarget:self action:@selector(radiobuttonpress:) forcontrolevents:uicontroleventtouchupinside]; [btnradio setimage:[uiimage imagenamed:@"btn_radio.png"] forstate:uicontro

windows - How to make GNU make command recognized anywhere -

i installed gnu-make. added path. however, it's recognized in path. mean, when write: c:\program files\gnuwin32\bin>make works , gives me response: make: *** no targets specified , no makefile found. stop. but, when write: c:>make says, make isn't recognized internal or external command. it's solved. restarting device

(swift) remove "\" character from string? -

i have string contains few \ , want remove of them. can tell me how can that. have tried stringbyreplacingoccurrencesofstring it's not working out me. var str = "\\dagdahughuad\\dajughdaug" var str2 = str.stringbyreplacingoccurrencesofstring("\\", withstring: "", options: nsstringcompareoptions.literalsearch, range: nil) print(str2) this output dagdahughuaddajughdaug

How to implement linear interpolation method in java array? -

i working on simple linear interpolation program. , having troubles when implementing algorithm. assuming there 12 numbers whole, we'll let user input 3 of them(position 0, position 6 , position 12). program calculate other numbers. here piece of code achieve this: static double[] interpolate(double a, double b){ double[] array = new double[6]; for(int i=0;i<6;i++){ array[i] = + (i-0) * (b-a)/6; } return array; } static double[] interpolate2(double a, double b){ double[] array = new double[13]; for(int i=6;i<=12;i++){ array[i] = + (i-6) * (b-a)/6; } return array; } as can see, used 2 functions. want find universal function job. however, don't know how find common way represent i-0 , i-6 . how fix it? according floating point linear interpolation , know maybe should add formal parameter float f . not quite understand float f mean , how modify code based on it. me? thank you. if want interpolate intervals d

ruby on rails - how to add 'glyphicon glyphicon-user' and 'glyphicon glyphicon log-in' in this code? -

my code coming wrong: have tried coming wrong <ul class="nav navbar-nav navbar-right"> <li> <span class="glyphicon glyphicon-user"> <%= link_to 'signup', {:controller =>'users', :action => 'new'} %></span> </li> <li> <span class="glyphicon-log-in"> <%= link_to 'login', {:controller =>'sessions', :action => 'new'} %></span> </li> </ul> try this: <ul class="nav navbar-nav navbar-right"> <li> <%= link_to raw('<span class="glyphicon glyphicon-user"></span>'), {:controller =>'users', :action => 'new'} %> </li> <li> <%= link_to raw('<span class="glyphicon glyphicon-log-in"></span>'), {:controller =>'sessions', :action => 'new'} %> </li> </ul>

html - Google App Engine and PHP Blank Page after deploying to the cloud. (Ubuntu 14.04 LTS) -

Image
i'm trying make app lets users authenticate before login service. i'm using google app engine , php; application works fine in computer after deploy google cloud, php files doesn't work. have files in root directory. this app.yaml application: civil-topic-94103 version: 1 runtime: php55 api_version: 1 handlers: - url: /registration.php* script: registration.php - url: /login.php* script: login.php - url: / static_files: homepage.html upload: homepage.html # access static resources in root directory - url: /(.*) static_files: \1 upload: (.*) this login.html file: <html> <head> <title>login</title> </head> <body> <p><b>please login</b></p> <br> <form action="login.php" method="post"> user: <input type="text" name="username"><br> pass: <input type="text" name="password"><br>

c++ - Implicit conversion with more than one parameter, and operator overloading -

i reading "the c++ programming language" book. below relevant code class complex { public: complex(double r, double i): re{r}, im{i} {} complex(double r): complex{r,0} {} complex(): complex{0,0} {} complex& operator-=(complex z) { this->re -= z.re; this->im -= z.im; return *this; } private: double re,im; }; inline complex operator-(complex a, complex b) { return -= b; } inline complex operator-(complex z) { return{ 0, 0 } - z; } the unary operator- gives error - syntax error : missing ';' before '-' however, both of following variants considered correct compiler inline complex operator-(complex z) { return 0 - z; } and inline complex operator-(complex z) { return {-z.real(), -z.imag()}; } i think implicit conversion in happening in both these cases. why inline complex operator-(complex z) { return {0,0} - z; } flagged error? edit - fixing return type of operator-= function call, , a

javascript - Greasemonky: How to return count and value of specific div class? -

lets have following on page: <div class="data-container">john</div> <div class="data-container">dave</div> <div class="data-container">bob</div> how can use javascript in greasemonkey count each "data-container" class, extract value (i.e. john) , display info popup? so: 1) john 2) dave 3) bob here got far isn't working: var elements = document.getelementsbyclass("data-container"); for(var i=0;i<elements.length;i++){ document.body.innerhtml= document.body.innerhtml.replace(/<div class=\"data-container\">/g,"<p style=\"text-align: center;\"><span style=\"font-size:16px;\"><strong><span style=\"background-color:#ffff00;\">"+ elements[i].classname + "</span></strong></span></p><div class=\"data-container\">"); } edit cbwll! here current w

java - Avoid full file paths when importing files -

trying read image java, have this: image img = new image("file:e:/javaworkspace/project/src/resource/image.png"); however, not 1 going working on project , path works in machine. did try image img = new image("file:/resource/image.png") but leads filenotfound . don't know thing called in english, hope understand trying convey here. edit: i added folder "resource" via build path , trying input stream such: imageview imgview = new imageview(new image(this.getclass().getresourceasstream("/resource/image.png"))); needless say, nullpointerexception , according documentation, occurs when path doesn't exist. how can not exist after created via build path, exists in classpath. (yes, file there or can not copy folder? ) place image inside project folder rather using file system access file. can use this: image image = imageio.read(getclass().getresourceasstream("/resource/image.png")); to image file ever

java - Does akka actors will able to use websocket session ? does websocket connection closes before actors start using? -

i having 3 actors,able send data client first actor how session closing second,third actors.i want causing closing of session,i have tried onclose(..) method debug pointer not coming onclose(..) method.can 1 tell how intercept session closing ? public class schedulemgmtwebsocket extends basewebsocket { @onmessage public void onmessage(string message, session session) { actor1.tell(session); actor2.tell(session); } here when control comes out of onmessage session closes i.e whole web socket instance closes ?when instance closes actors no more can send data clients ? can expert clarify me please

android - Exported (Uploaded) apk to the Play store getting crashed -

i have published app on play store yesterday. app live when tried install app play store, not showing splash screen. it's show unfortunately stopped error. .apk project working fine. how fix this? i have used following reference upload apk on play store http://www.instructables.com/id/publishing-an-android-app-to-the-google-play-store/?allsteps you need check apk file uploaded play store.do install same , check crashlog .i sure issue apk need upload new. do clean project , export signed apk. and checking crash log remote devices need add library acra check post here how obtain crash-data android application?

javascript - re-sizing and re-centering a google map without access to a global variable "map" -

i have google maps implemented on page , want able resize , recenter after particular event. here code have found on internet: var center = map.getcenter(); google.maps.event.trigger(map, "resize"); map.setcenter(center); now cool dont have access "map" global. instead have been able use jquery selector map-canvas dom so: google.maps.event.trigger($("#map-canvas")[0], 'resize'); but using $("#map-canvas")[0]; doesnt work when try call getcenter() , setcenter(). ideas why? thanks your map variable instance of google map object, $("#map-canvas")[0] dom element, can't call method because google won't recognize it. in case, may scope problem why don't put map variable global , call everywhere e.g: var map; // google map object $(document).ready(function(){ var center = map.getcenter(); google.maps.event.trigger(map, "resize"); map.setcenter(center); }); and then, whenever

jquery integer post ajax php -> unrecognized expression 0 -

i have following, var = 0; $('.more').click(function(){ $.ajax({ type:"post", data{"num":i}, url:theurl, success:function(html){ $container.append(html); = i+18; etc. when post data , in php echo $_post['num']; getting error "syntax error, unrecognized expression: 0" , bunch of html following it. when don't include data number 0 works fine. going wrong here? if argument append doesn't begin html tag, it's treated jquery selector. should either wrap in div: $container.append("<div>" + html + "</div>"); or use .html() instead of .append() $container.html(function(i, oldhtml) { return oldhtml + html; });

Vba: SOLVING COMBOBOX -

basically have 2 combobox in userform using vba language. problem want display data automatically in combobox2 based on user selection in combobox 1. suggestion vba language? private sub userform_initialize() dim student() variant range("a2").select range(selection, selection.end(xldown)).select student = selection me.combobox1.list = student end sub here basics kind of linked choices : your code, without useless (and greedy) .select , better way last used row , assigning range array .value : private sub userform_initialize() dim student() variant student = range(range("a2"), range("a" & rows.count).end(xlup)).value me.combobox1.list = student end sub and there part you'll need work on : when change value of the combobox1 , it'll launch code, need refresh in there values proposed in combobox2 own tests, have no clue of doing. private sub combobox1_change() dim restrictedchoices() me.combobox2.clear 'clea

excel - Java Apache POI HSSF CellRangeAddressList -

i trying set app users download excel spreadsheet insert data , want 1 of cells in sheet have data validation drop down list. i following guidance on apache poi site ( https://poi.apache.org/spreadsheet/quick-guide.html#validation ) includes guidance utilize cellrangeaddresslist data type , constructor. here full code using apache site: hssfworkbook workbook = new hssfworkbook(); hssfsheet sheet = workbook.createsheet("data validation"); cellrangeaddresslist addresslist = new cellrangeaddresslist( 0, 0, 0, 0); dvconstraint dvconstraint = dvconstraint.createexplicitlistconstraint( new string[]{"10", "20", "30"}); datavalidation datavalidation = new hssfdatavalidation (addresslist, dvconstraint); datavalidation.setsuppressdropdownarrow(false); sheet.addvalidationdata(datavalidation); however, when use in code, netbeans giving me deprecated api error. there more recent and/or appropriate datatype should using.