Posts

Showing posts from July, 2013

Android: MediaRecorder start failed : -16 -

i've been trying implement video camera. never worked because of mysterious error (-16) on recorder.start(). here code: private void initrecorder(int width, int height) { recorder.setaudiosource(mediarecorder.audiosource.camcorder); recorder.setvideosource(mediarecorder.videosource.camera); parameters params = camera.getparameters(); list<size> sizes = params.getsupportedpreviewsizes(); size optimalsize = getoptimalpreviewsize(sizes, width, height); params.setpreviewsize(optimalsize.width, optimalsize.height); camcorderprofile cphigh = camcorderprofile .get(camcorderprofile.quality_low); recorder.setprofile(cphigh); file mediafile = null; if (environment.getexternalstoragestate().equals( environment.media_mounted)) { mediafile = new file( android.os.environment.getexternalstoragedirectory() + &qu

c# - Providing a Generic to Mock -

i attempting generalize test code in solution mvc project. because we're writing same test each controller, thought use generics make 1 test needed. unfortunately, i'm getting error: error 1 type 'trepo' must reference type in order use parameter 't' in generic type or method 'moq.mock<t>' here's relevant code. can provide more if needed. testbase.cs public class testbase<tcontroller, tobject, trepo> tcontroller : irmccontroller<tobject> trepo : irmcrepository { public mock<trepo> repo { get; set; } } companiestest.cs public class companiestest : testbase<companiescontroller, company, icompanyrepository> thanks help. in moq, mock<t> class has class constraint on generic type. here's how it's defined: public class mock<t> : mock t : class so if intend use in class must define same class constraint in addition irmcrepository : public class testbase<tcontroll

Plot Multiple Coords on Google Map -

i need plot multiple markers on google map , having trouble placing more 1 marker. this works: https://maps.google.com/maps?q=26.549431,-81.847559 this not: https://maps.google.com/maps?q=26.549431,-81.847559&q=26.549579,-81.847757 is there way send 2 coordinates google maps , return 2 markers? using staticmap in google map api did trick: http://maps.google.com/maps/api/staticmap?zoom=9&size=640x480&maptype=roadmap%20&markers=label:1|26.785,-82.045&markers=label:2|26.651,-82.0&markers=label:3|26.7,-81.75634&markers=label:4|26.6,-81.89&markers=label:5|26.475,-81.79&markers=label:6|26.41,-81.76&markers=label:7|26.42,-81.78&markers=label:8|26.43,-81.80&markers=label:9|26.44,-81.82&markers=label:10|26.45,-81.84&sensor=false

ember.js - Ember: render template as view property -

i have view i'd declare in hbs: {{view app.componentview title="text field" optionstemplate="textfieldoptions" }} {{view app.componentview title="static label" optionstemplate="statiffieldoptions"}} then in view definition i'd following: app.componentview = ember.view.extend({ templatename="blah", attributebindings:["data-type", "draggable", "title", "rel", "data-trigger", "data-content"], optionstemplate:null, "data-content": function() { var renderedoptionstemplate = em.xxx(this.get("optionstemplate")); return renderedoptionstemplate; }.property(), //snip }); what i'm looking should put in place intead of em.xxx call there. possible? can using either partial or template or whatever...

django - How to permanetly fix a mysql error: Data truncated for column with an alter table statement? -

i have field logo=models.imagefield(upload_to="restaurant_detail/restaurant_detail", help_text = "upload restaurant logo") this returns error, data truncated column 'logo' @ row 1 so go ahead fix statement alter table my_table modify logo varchar(500) (i increase characters.) this works everytime reset database have again and when try , execute alter statement above , insert data, still fails data truncated column 'logo' @ row 1 error. how permanently fix without having alter table time? change field definition to: logo = models.imagefield(max_length=500, upload_to="restaurant_detail/restaurant_detail", help_text="upload restaurant logo") i added max_length kwarg tells django how many chars field can store , cause database field created appropriately.

css - Transition of one layer with multiple background layers -

i have imput field in form multiple(two) backgrounds this: background: url(framework/images/search.png) no-repeat 6px 7px, /*this magnifying glass icon - important later */ rgba(200,200,200,0.1); then i've got transition: transition:background 0.2s linear, box-shadow 0.5s linear; and on focus of input field: input:focus, { background:rgba(0,0,0,0.1); box-shadow:0px 1px 0px rgba(0,0,0,0.1) inset; } basically (or should) when input field active background changes darker color transitions. box shadow makes inner effect of inside border. case when background of 1 element (only background color). when added icon on higher layer background wont change, box-shadow works. think browser confused how change color of bitmap image. my question is: there way transition 1 layer of background (address somehow), bitmap image stay same , color change? thank you. edit: jsfiddle -> http://jsfiddle.net/8drtt/ http://jsfiddle.net/8drtt/1/ input:focus

optimization - Computation time insanely long in python -

i'm running code, consist in find average values. in ~6 million lines csv (ssm_resnik.txt), first row 1 reference, second row , third value 'distance' between 2 references. such distances arbitrarly defined biological criteria not important issue. of the references versus... of references, hence huge csv more 6 millions of lines. in csv (all_spot_uniprot.txt) have ~3600 spot's (first column), each of them 1 or more reference (third column). values same of huge csv. need compare each of 3600 of spot ref of second file other 3600-1 ref's in same file. of possible combinations, if exists, in first, huge csv file (ssm_resnik.txt). all_spot_uniprot.txt, each 2 spot ref's serve iterator correspondent reference (in third column) , iterate on huge csv file that, if exists, show value 2 "vs" reference. what problem code? well... 10 seconds each iteration, 3600 *3600 *10 = 129.600.000 seconds = 1500 days (almost 5 years). happens in core i3, in mac. below

html - Send mouse event to element via javascript -

so have element behind another, it's still visible(its covered partially element itself, otherwise covered margin attribute of element above). want trigger mouse event when mouse over, doesn't passed because of element in front. know how calculate if on , how point it, don't know how send event onmouseover or hover or onmouseout . if helps pointing @ using document.getelementbyid("<calculated id>") . know works because it's id based off of location within grid, have calculate position of mouse , relate grid. also event supposed happen(but isn't because of things in front of it), :hover triggers simple transition animation via css. document.getelementbyid('elementinfront').addeventlistener('mouseenter', function(){ document.getelementbyid('elementbehind').doyourstuff(); });

javascript - model.save setting the url and making a call back on success -

i'm trying method work: that.model.save(null, // i'm calling that.model because nested in method { url: 'some url', success: function(model, response) { // update stuff }, error: function(model, response) { // throw error. } }); but reason not call success method or error method. comments i'm calling methods... don't want specifics of methods i'm calling. save method works, not call eater of methods. also if try , call method alrady made like: success: that.somemethod() javascript throws: uncaught typeerror: illegal invocation any appreciated. the method looks fine uses same arguments backbone describes: model.save([attributes], [options]) the scenario success/error handlers being overridden somewhere prototype chain , not calling handlers.

coldfusion - Public functions become remotely accessible when implementing onCFCRequest() -

some background: i'm using oncfcrequest() handle remote cfc calls separately regular cfm page requests. allows me catch errors , set mime types cleanly remote requests. the problem: i accidentally set of remote cfc functions public access instead of remote , realized still working when called remotely. as can see below, implementation of oncfcrequest() has created gaping security hole entire application, an http request used invoke public method on http-accessible cfc. repro code: in application.cfc: public function oncfcrequest(string cfc, string method, struct args){ cfc = createobject('component', cfc); return evaluate('cfc.#method#(argumentcollection=args)'); } in cfc called remotely: public function publicfunction(){ return 'public function called remotely!'; } question: i know check meta data component before invoking method verify allows remote access, there other ways approach pro

python - How do mixed definitions work in enum? -

i trying use c program (via dynamic libraries) python , ctypes module. several constants defined in header file important me, unsure of how enum being used set values. the obvious ones, think understand like: enum{thing1, thing2, thing3}; thing1=0, thing2=1, thing3=3 but, this? enum{thing1=-1, thing2, thing3}; is result: thing1=-1, thing2=1, thing3=2 ? what one? enum{thing1=1, thing2, thing3, thing4=-1} ? i don't have easy way test this, hoping can explain way enum works in context. c books looked in seemed cover either first case or case each value explicitly defined, not mixed case. many in advance! the value of first enum constant 0, unless specified otherwise. the value of other enum constant 1 more value of previous, unless explicitly specified. so enum{thing1=-1, thing2, thing3}; sets thing2 = 0, thing3 = 1 , and enum{thing1=1, thing2, thing3, thing4=-1} sets thing2 = 2, thing3 = 3 (and thing4 = -1 explicitly given).

internet explorer - How to make IE8/9 submit input type="file" when javascript triggered dialog open -

if have input type="file" somewhere, , on click of link triggers click on file input. user picks file. in ie8/9 if user clicks on button type="submit" first click clears data in file input, second submits blank form. how allow submission of input type="file" post javascript click trigger. some notes: the click triggered consequence of click event. within event. the input type="file" not set display: none. no attempt manipulate user input done ideas? i've been struggling same problem, , i'm yet come across clean solution. i have however, discovered work-around. please note the solutions below disregard best practices (in humble opinion) , if has better, more standards-compliant way of doing this, please post here. fixing button click event after fair amount of research, seems lot of people using trick whereby absolutely position <input type="file" /> on button, , set opacity zero. means

actionscript 3 - Stop function creating bitmaps/reduce cpu overload/reduce lag -

hi i'm noticing following code producing noticeable chunk of lag when incorporated. public function impassable_collisions():void { //prevent player moving through impassable mcs each(var mc:movieclip in impassable) { var bitmap = createbitmapclone(mc); //return clone of bitmap of mc, accounting transformations var bounds:rectangle = player.getrect(bitmap); var playercenterx:number = bounds.left + bounds.width * .5; var playercentery:number = bounds.top + bounds.height * .5; //test pixel perfect collision against shape based on point , radius, //returns angle of hit or nan if no hit. var hitangle:number = hittestpointangle(bitmap, playercenterx, playercentery, player.height/2); if(!isnan(hitangle)){ // move player away object player.x -= int(math.cos(hitangle) * player.speed*timediff); player.y -= int(math.sin(hitangle) * player.speed*timediff); } }

python - What is the significance of the number 4 when one feeds a callback to the show argument of a Tkinter Entry Box? -

question why random ascii character selector function outputting fours, , significance of number 4 in context? why not recieving error message? remember, question not how solve issue, why particular number output. background , code i trying creating basic email client. thought cool password box show random characters instead of obvious *. so, created function chose random ascii letter. import random import string def random_char(): char_select = random.randrange(52) char_choice = string.ascii_letters[char_select] return char_choice when run in interactive terminal, spits out random letter. but, when run through widget self.password = entry (self, show = lambda: random_char()) i met bunch of fours. extra credit if have time, please visit related question, how have tkinter entry box repeat function each time character inputted? the show parameter accepts value not callback. tkinter taking callback object , trying convert string , when typ

jQuery Waypoints from Greasemonkey -

i'm attempting use jquery waypoints plugin greasemonkey script, , can't seem basic tests work. know of reason waypoints wouldn't work user script? @require lines: // @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js // @require http://cdn.jsdelivr.net/jquery.waypoints/2.0.2/waypoints.min.js script: $('div.container').waypoint(function(){ alert('you hit bottom'); },{ offset: 'bottom-in-view' }); interestingly, if div "container" class exists, script breaks, , code outside statement not run. if change selector find non-existent element, rest of script runs fine. does have idea what's going on here? i'm banging head against wall. thanks! ps. i've tried pasting waypoints plugin code directly script (instead of using cdn), , same results. unfortunately, extension not written many other jquery extensions. uses this , , jquery in, let's say, "unfortunate" way

full text search - What is the maximum possible value range of MATCH ('...' IN NATURAL LANGUAGE MODE) in MySQL? -

mysql provides fulltext indexes, can retrieved match (col1,col2,...) against (expr [search_modifier]) construct. there several full-text search variants, 1 of them (and default one) natural language full-text search . so maximal possible value of match ('...' in natural language mode)? example: this query select courses.id, courses.title, match (coursedata.title) against ('basketball') relevance courses join coursedata on coursedata.id = courses.coursedata_id match (coursedata.title) against ('basketball') > 0 returns result table column relevance , we're storing relevance value of coursedata.title rows 'basketball' . or relevance value of 'basketball' coursedata.title rows? anyway, we're storing there output of match(...) function. in case i'm geting values 0 3.695953130722046 . there not small limit possibilities of query output. instead of reaching huge limit, freeze down

java - Can't check instance variable values in static method in Eclipse debugger -

i want keep track of values of instance variable, , breakpoint starts @ static method. can't check instance variable value. there way that? searched on google, found no clue. is because instance can't accessed in static method? you pass variable tracking method. although make note every time can remove when done testing. but honestly, if don't have access variable within method, won't change time have exited method, unless have multiple threads. therefore, can set breakpoint after/before method called.

Parse error on input '=' something wrong with my Haskell -

this simple function: len [] = 0 len (x:xs) = 1 + len xs and have loaded in ghci using :l , aways got error parse error on input = . i run in computer, it's ok. computer mac. there wrong haskell? you need newline between 2 patterns len function. works fine: $ cat len.hs len [] = 0 len (x:xs) = 1 + len xs $ ghci ghci, version 7.4.1: http://www.haskell.org/ghc/ :? loading package ghc-prim ... linking ... done. loading package integer-gmp ... linking ... done. loading package base ... linking ... done. prelude> :l len.hs [1 of 1] compiling main ( len.hs, interpreted ) ok, modules loaded: main. *main> len [] 0 *main> len [1] 1 *main> len [1,2,3] 3 *main> since mentioned it's mac, perhaps have newline-convention incompatibility. make sure text editor , ghci agree constitutes newline on platform.

ruby - How to configure or get Chef::Client if I have a Chef::Node with the API alone -

i have chef, workstation , nodes provisioned through hosted chef. need work on nodes in ruby script, not cookbook/recipe, using chef::search query them. i have array of chef::nodes in script, , want handle on each node's chef-client can run recipe on each one. remember not doing regular chef run, need mimic chef run does: pulls down nodes, expands run_lists , run recipes on them needed. why? because, not provisioning; need check status of nodes , select particular 1 run recipe on. nodes provisioned mongo , need maintenance replica set. cannot run sequential recipes , cannot run 1 of nodes. so need is: given chef::node got form chef::search::query , how 1 chef-client or load new chef::client ? i have extensively looked @ api , chef::client class doesn't seem telling me how. there initialize , loadnode nothing takes node. i think can lot of asking using knife-exec . allows you, if have api key, manipulate data on chef server ruby script. inc

postgresql - Where is the call to split files in postgres when they are greater than 1gb? -

according http://www.postgresql.org/docs/current/static/storage-file-layout.html "when table or index exceeds 1 gb, divided gigabyte-sized segments. first segment's file name same filenode; subsequent segments named filenode.1, filenode.2, etc." i wondering in source code dealt with. have been searching last few hours have had no luck edit: if can lead me code writes pages buffer disk appreciated well. you're looking src/backend/storage/smgr/smgr.c , src/backend/storage/smgr/md.c relfilenode management. main file referred relfilenodebackend , forks forknumber . start backend/storage/smgr/readme . git grep find things lot faster; quick cd src; git grep --color relfilenode helped find relevant areas of codebase. buffer cache management , dirty write-out quite separate. it's complicated use of bgwriter (background writer), eagerly writes dirty buffers in shared memory disk without blocking actively working backend(s). i'm not familiar

Maven not adding JAR to project when using mvn compile but does when using mvn eclipse:eclipse -

i need download quartz scheduler. added dependency pom.xml , nedded sl4j scheduling. here pom.xml <dependency> <groupid>log4j</groupid> <artifactid>log4j</artifactid> <version>1.2.17</version> <exclusions> <exclusion> <groupid>org.slf4j</groupid> <artifactid>slf4j-api</artifactid> </exclusion> </exclusions> </dependency> <dependency> <groupid>org.slf4j</groupid> <artifactid>slf4j-log4j12</artifactid> <version>1.5.6</version> <exclusions> <exclusion> <groupid>log4j</groupid> <artifactid>log4j</artifactid> </exclusion> </exclusions> </dependency> <dependency> <groupid>org.quartz-scheduler</groupid> <artifactid>quartz</artifactid>

objective c - Class Cluster as a Singleton? -

sorry length of post; meant document journey problem. i have question shared object in cocoa app needs change time time , how best store it's accessible few different places. bear me. class implementation the shared object implemented class cluster (i.e., https://stackoverflow.com/a/2459385/327179 ) looks following (note document merely class name; not indicative of actual class does): in document.h : typedef enum { documenttypea, documenttypeb } documenttype; @interface document : nsobject {} - (document *) initwithdocumenttype:(nsuinteger)documenttype; - (void) methoda; - (void) methodb; @end in document.m : @interface documenta : document - (void) methoda; - (void) methodb; @end @interface documentb : document - (void) methoda; - (void) methodb; @end @implementation document - (document *)initwithdocumenttype:(nsuinteger)documenttype; { id instance = nil; switch (documenttype) { case documenttypea: instance = [[docum

How to split this string in Java regex? -

this string: string strpro = "(a0(a1)(a2 , on)...(an))"; content in son-() may "", or value of strpro, or pattern, recursively, sub-() sub-tree. expected result: str1 "a0(a1)" str2 "(a2 , on)" ... strn "(an)" str1, str2, ..., strn e.g. elements in array how split string? you can use substring() rid of outer paranthesis, , split using lookbehind , lookahead ( ?<= , ?= ): string strpro = "(a0(a1)(a2 , on)(an))"; string[] split = strpro.substring(1, strpro.length() - 1).split("(?<=\\))(?=\\()"); system.out.println(arrays.tostring(split)); this prints [a0(a1), (a2 , on), (an)]

c# - Using ThreadStart my UI stuck -

i'm new threading ui not responding till completion of process. 1 tell me what's wrong here. reduced code: static string replacedname = "", replacedwith; private void startprocess(string fpath, string rno) { if (fpath != "" && rno != "") { .... unzip(fpath, path.getdirectoryname(fpath) + "\\" + replacedwith); directoryinfo dir = new directoryinfo(path.getdirectoryname(fpath) + "\\" + replacedwith); foreach (fileinfo file1 in dir.getfiles("*.zip")) { unzip(file1.fullname, path.getdirectoryname(file1.fullname)); file.delete(file1.fullname); } } replacedname = ""; messagebox.show("completed"); }

about mysql installation in a LAMP environment -

when build lamp environment in ubuntu-12.10, first installed mysql mysql-5.5.12.tar.gz,but told me can not find configure file,it here: root@tryandchange-qth6:/usr/local/src# cd mysql-5.5.12 root@tryandchange-qth6:/usr/local/src/mysql-5.5.12# ./configure --prefix=/usr/local/mysql bash: ./configure: 没有那个文件或目录(not exists document or file) who can tell me why?or tell me way build lamp environment, not 'apt-get install'. xampp has downloadable linux binaries, download, extract , run /path/to/xampp/xampp start - i'd recommend easiest way set lampp stack. link xampp linux obviously eschewing use of apt, working knowledge apache/php/mysql become obsolete , have work keep them secured , up-to-date.

ruby on rails - Belongs_to only recognized by console, not server -

i've got weird problem project. i've got 2 models, 1 link , other category. i've got index view links should listed, corresponding category names. when running server , trying use <%= link.category.name %> i error page following: undefined method `name' nil:nilclass but when open console , write: link = link.find(1) #there 1 link link.category.name it returns correct category name. here models , schema.rb: class link < activerecord::base attr_accessible :category_id, :description, :title, :url, :visible belongs_to :category scope :visible, lambda { where(visible: true) } end . class category < activerecord::base attr_accessible :name has_many :links end . activerecord::schema.define(:version => 20130420070717) create_table "categories", :force => true |t| t.string "name" t.datetime "created_at", :null => false t.datetime "updated_at", :null => fals

Difference between git diff (git patch) and git push -

git push used push changes remote repository. git diff shows changes made since last pull operation remote repository. git diff synonymously used git patch . after getting difference, patch applied through git am or git apply repository updation. so, these 2 commands fundamentally same or there difference between git diff , git push ? git push push changes made in file repository. last step make add change project. git diff used see changes made different files since last commit. shows line added or removed project. the basic flow goes this. you make changes in project. -> git add -> git diff if want see changes have been made -> commit using git commit -> push committed changes repository using git push . if new git, learn interactive tutorial http://try.github.com/

java - How to create a Servlet Filter in Eclipse in the absence of web.xml? -

i using eclipse 3.6.2 , developing dynamic web app project. need use servlet filter. ( coming netbeans web.xml automatically created ) while creating project didn't click on generate deployment descriptor , eclipse not allowing me create it. there way use servlet filter without web.xml ? please let me know if want more info on this. ( creating project anew not option since huge setup take me weeks given work schedule ) found no answers in existing questions ! thank in advance !

javascript - Java script editor or IDE for linux -

i'm new node js , looking , free editor (with auto complete capabilities) or ide (if can rune nodejs great) linux. (ofcourse cross platform 1 better :d) appreciated :d i recommend sublime ubuntu , sublimetext-nodejs

unix - Trying to get first letter from first name in nawk script to html -

why line 17 not working (commented in code)?: #!/bin/nawk -f begin { print "<html>" print "<body>" print " <table border=2>" print " <tr>" print " <th>name</th>" print " <th>username</th>" print " <th>email</th>" print " </tr>" } { print " <tr>" print " <td>" $2 " " $1"</td>" print " <td>"'{substr($1,1,1)}' "</td>" ###### line 17 print " <td>" $3 "</td>" am allowed put statement in line 17? im trying first letter of first name. the single quotes in line should removed. quoting allows shell parse substr , not want

csv - creating heatmap with R with eye-tracker data -

Image
i have table composed following data frame,x,y which resulting data several eye tracking analysis. create heatmap using r, following i tried several script found online, none of them gave me result. how can do? here sample data ignore first 2 columns task,visualization,frame,x,y 1,b,1,383,221 1,b,1,632,356 1,b,1,947,663 1,b,1,546,206 1,b,1,488,272 1,b,1,578,752 1,b,1,415,261 1,b,1,693,158 1,b,1,684,528 1,b,1,592,67 1,b,1,393,180 1,b,1,1033,709 1,b,1,1080,739 1,b,1,711,523 1,b,1,1246,49 1,b,1,742,69 1,b,1,601,370 1,b,10,902,684 1,b,10,517,241 1,b,10,583,86 1,b,10,582,754 1,b,10,426,257 1,b,10,575,229 1,b,10,697,150 1,b,10,379,520 1,b,10,390,286 1,b,10,618,396 1,b,10,710,143 1,b,10,383,188 1,b,10,1026,713 1,b,10,1078,625 1,b,10,713,521 you can type of plot quite using stat_bin2d ggplot2 : library(ggplot2) ggplot(dat, aes(x = x, y = y)) + stat_bin2d(bins = 10) this simple binning, @romanlustrik suggested perform kind of kernel smoothing. can done us

How to Avoid Constraint SQL Server 2008 -

i have problem. got 2 tables, 1 foreign key. table , table b create table kdtrans int (5) primary key insert values (1),(2),(3) then want insert in table b create table b kdtrans int (5) primary key, foreign key kdtrans references a(kdtrans) insert b values (1),(2),(3),(4),(5) these query error cause of constraint. should avoid constraint. wont insert new record in table a. it possible disabling constraint might drop thing supposed guarantee no longer true. to disable constraint can use create table ( kdtrans int primary key ) insert values (1), (2), (3) create table b ( kdtrans int primary key constraint fk foreign key references a(kdtrans) ) alter table b nocheck constraint fk insert b values (1), (2), (3), (4), (5) to drop use alter table b drop constraint fk

php - Does MySQL queue queries? -

what happens if there 2 people sending same query @ same time database , 1 makes other query return different? i have shop there 1 item left. 2 or more people buy item , query arrives @ exact same time on mysql server. guess queue if so, how mysql pick first 1 execute , can have influence on this? sending same query @ same time queries not run in parallel it depends on database engine. myisam, every query acquires table level lock meaning queries run sequentially queue. of other engines may run in parallel. echo_me says nothing happens @ exact same time , cpu not @ once that's not true. it's possible dbms run on machine more 1 cpu, , more 1 network interface. it's very improbable 2 queries arrive @ same time - not impossible, hence there mutex ensure paring/execution transition runs single thread (of execution - not necesarily same light weight process). there's 2 approaches solving concurent dml - either use transactions (where each user g

windows - Distribtuing free software without source code -

is place source forge can distribute free windows application without giving away source code? i have concerns open source distribution. people take simple app , tweak , fiddle until dysfunctional or lost original purpose or flaky on worked monster many glitches. can ruin app's reputation , functionality. wholly support idea of giving away software write don't agree giving away source code too. just open free site (like wordpress or godaddy) , put binaries there. need upload them server, publish link them ("new version available!").

c# - Updating PartialView mvc 4 -

ey! how refresh partial view data out of model? first time, when page loads it's working properly, not when call action. structure i've created looks like: anywhere in view: @{ html.renderaction("updatepoints");} my partialview "updatepoints": <h3>your points @viewbag.points </h3> at controller have: public actionresult updatepoints() { viewbag.points = _repository.points; return partialview("updatepoints"); } thanks help! update thanks help! used jquery/ajax suggested, passing parameter using model. so, in js: $('#divpoints').load('/schedule/updatepoints', updatepointsaction); var points= $('#newpoints').val(); $element.find('pointsdiv').html("you have" + points+ " points"); in controller: var model = _newpoints; return partialview(model); in view <div id="divpoints"></div> @html.hidden(

ios - Detect which lesson is closest to now -

i'm having array different times of lessons. here's example kind of information array contains: 09.00 - 10.00, 11.00 - 12.00, 13.00 - 14.00, 15.00 - 16.00 i'm displaying these lessons in uipickerview in order let user choose desired time. want pickerview automatically preselect lesson closest actual time. somehow have compare actual date. has idea how that? thanks in advance! this give current hour:minutes nsdateformatter *dateformat = [[nsdateformatter alloc] init]; [dateformat setdateformat:@"hh:mm"]; nsstring *str = [dateformat stringfromdate:[nsdate date]]; then can find difference , check minimum. now can put condition : if (hh <= 10 ) { // 09:00 - 10:00 should come } else if (hh == 10 && mm < 30 ) { // 09:00 - 10:00 should come } else if (hh == 10 && mm > 30 ) { // 11:00 - 12:00 should come } else if (hh <= 12 && mm < 30 ) { // 11:00 - 12:00 should come } else if

.net - Sort a List(Of Tuple) -

i have list this: dim results_list new list(of tuple(of string, string, long)) with contents: (b, a, 5000) (g, a, 1000) (b, b, 8000) (g, b, 2000) can use linq (or whateverelse not using slow for) sort items long numbers in ascending mode this?: (g, a, 1000) (g, b, 2000) (b, a, 5000) (b, b, 8000) var sorteditems = list.orderby(t => t.item3);

sql server - How to filter displayed products according to their category in C# -

Image
this question has answer here: how filter displayed products according producttype in tabcontrol- tabpages in c# 4 answers okay. after several hours of thinking decided ask question again since couldn't make work though had guidance answers in previous question. here's original question now i'm creating point of sale system , want display products dynamically in database buttons on tabcontrol - tabpages according producttype. problem is, products tabpags buttons can't sort them out each tabpage according producttype same list of products display on every tabpage below. and database. private void createtabpages() // create tab pages each producttype { con.open(); sqldataadapter sda = new sqldataadapter("select distinct producttype, description tblproducttype", con); datatable dt = new data

javascript - How to permanently change the DOM on an HTML file -

i'm making windows 8 store app using html, javascript, , css. app allows user make lists, , manage items inside of lists. i've managed edit lists , want, problem once close app, reset, because none of changes dom made (such elements added or removed) saved, , lose of lists , items made. possible edit dom in such way edits actual html file, did still there once open app again? if not, alternate methods saving user data once app closed? thanks, daniel this may late hope helps. you can use html local storage.with local storage, web applications can store data locally within user's browser. before html5, application data had stored in cookies, included in every server request. local storage more secure, , large amounts of data can stored locally, without affecting website performance. unlike cookies, storage limit far larger (at least 5mb) , information never transferred server. local storage per origin (per domain , protocol). pages, 1 origin, can store

webgl - Using sample2D as position in vertex shader -

i'm learning how manipulate particles fbo in webgl, tried store position texture , use position reference, nothing came on stage. fragment shaders precision mediump float; void main() { gl_fragcolor = vec4(vec3(1.0), 1.0); } </script> vertex render shader script attribute vec2 atextureuv; uniform sampler2d utexture; void main() { vec4 texture = texture2d( utexture, atextureuv ); gl_position = vec4( texture.rgb, 1.0 ); gl_pointsize = 3; } </script> js script // determine uvs var uvs = new float32array([ 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 1.0, 1.0 ]) var uvbuffer = gl.createbuffer(); gl.bindbuffer( gl.array_buffer, uvbuffer ); gl.bufferdata( gl.array_buffer, uvs, gl.static_draw ); gl.enablevertexattribarray( defaultprogram.atextureuvloc ); gl.vertexattribpointer( defaultprogram.atextureuvloc, 2, gl.float, false, 0, 0); // texture initialization for(var = 0; < particlecount; i++) { initialdata.push( math.random(),

css - custom fonts not working in my rails app? -

i'm trying use custom font in rails app, can't figure out i'm doing wrong. i've created folder called fonts in assets folder 2 fonts i'm using. , call 2 fonts in css file called home.css.scss.erb css: @font-face { font-family: 'proxima nova'; src: url('<%= asset_path(/assets/fonts/proximanova-regular.otf) %>', font); font-weight: normal; font-style: normal; } @font-face { font-family: 'gotham'; src: url('<%= asset_path(/assets/fonts/gotham-medium.ttf) %>', font); font-weight: normal; font-style: normal; } then in config folder in application.rb i've added config.assets.paths << "#{rails.root}/app/assets/fonts" but still doesn't seem working.. ideas why? i've used custom fonts before never need use asset_path helper. using relative path in css should enough. settings similar these: # config/application.rb config.assets.paths << rails.root.join("asset

iphone - UiBarButtonItem background image not showing until first tap -

in appdelegate.m file have created following button style: uiimage *backbtnimage = [uiimage imagenamed:@"back.png"]; [[uibarbuttonitem appearance] setbackbuttonbackgroundimage: backbtnimage forstate: uicontrolstatenormal barmetrics: uibarmetricsdefault]; [[uibarbuttonitem appearance] setbackbuttonbackgroundimage: backbtnimage forstate: uicontrolstatehighlighted barmetrics: uibarmetricsdefault]; for reason background image shows on each view after space button is tapped once - loads everytime each view after that. i've tried cleaning project no avail. hmm, if running on simulator, try reseting content , settings, if doesnt work, know ios devices have issues caching, try changing photo name.png in both actual file , reference in xcode.

python - Popen new process group on linux -

i spawning processes popen (python 2.7, shell=true) , sending sigint them. appears process group leader python process, sending sigint pid returned popen, pid of bash, doesn't anything. so, there way make popen create new process group? can see there flag called subprocess.create_new_process_group, windows. i'm upgrading legacy scripts running python2.6 , seems python2.6 default behavior want (i.e. new process group when popen). bash not handle signals while waiting foreground child process complete. why sending sigint not anything. behaviour has nothing process groups. there couple of options let child process receive sigint : when spawning new process shell=true try prepending exec front of command line, bash gets replaced child process. when spawning new process shell=true append command line & wait %- . cause bash react signals while waiting child process complete. won't forward signal child process. use shell=false , specify full paths

python - Syntax error on def -

from tkinter import * class nodo: def __init__(self,x,y=none): self.valor=x self.sgte=y class cola (nodo): def __init__(self,n): self.capa=n self.prim=none self.ulti=none def vacio(self): if self.prim==none: return true return false def lleno(self): a=self.prim b=0 while a!=none: a=a.sgte b=b+1 if b==self.capa: return true else: return false def existe (self,x): a=self.prim while a!= none: if a.valor== x: return true a=a.sgte return false def poner (self,x): nodo=nodo(x,none) if x.isalpha()==true or x.isdigit()==true: if self.lleno() == true: raise colallena() if self.existe()==true: raise yaexiste() if self.vacio() ==true: self.prim=nodo self.ult

cookies - Getting past the facebook login while using wget -

i'm trying save webpages of form www.example.com?country=austria the website www.example.com requires login via facebook. if click on link http://www.example.com/social_auth/?p=social_auth_index&action=login&type=facebook brings me facebook login page type in username , password , i'm redirected www.example.com?country=austria . how can past using wget ? here things tried: wget --keep-session-cookies --save-cookies cookies.txt -o login.rsp http://www.example.com/social_auth/?p=social_auth_index&action=login&type=facebook grep authenticity_token login.rsp this generates cookie file of following format: www.example.com false / false 0 xlbs xlbs|udasn|ugzyt www.example.com false / false 0 phpsessid bqkvq1edug387fg314svn7cmgf5 what need afterwards?

.net - Calling method implemented in WCF service from client with out configuration file -

i have wcf service hosted in dll, have generated proxy code using svcutil.exe, below client code, basichttpbinding binding = new basichttpbinding(); binding.security.mode = basichttpsecuritymode.none; endpointaddress epa = new endpointaddress("http://localhost:8001/myapplication/deploy/deployservice/"); deployclient client = new deployclient(binding, epa); deploystatus = client.deploy(mystringargument, true); when executing this, getting error there no endpoint listening @ [http://localhost:8001/myapplication/deploy/deployservice/] accept message. caused incorrect address or soap action service configuration file is, <?xml version="1.0"?> <configuration> <appsettings> <!-- configurable client send timeout, in seconds --> <add key="dasclientsendtimeoutseconds" value="1500" /> </appsettings> <system.web> <compilation debug=