Posts

Showing posts from August, 2015

uiimageview - Why isn't the ImageView/background show in storyboard -

Image
i have added imageview background , added .png image actual image not show in storyboard when run shows. anyone know why case? see picture: i did solve , turned out name of .png caused problem. when changed "iphone5_frosty-568h@2x.png" shorter name worked.

linux - Changing OS destroying my game FPS (Java Slick 2D) -

recently changed hdd ssd , windows 7 linux ubuntu 14.4. i developping game (a pretty simple still nice , addictive one) on eclipse, using java language , slick 2d library. on windows game ran @ average 300 fps, correct , playable. had lags, wasn't bad. now had new linux, first thing did using apt-gest install eclipse, , imported project, linked jars , natives, and.. had enable fps show again notice running 30 fps, isn't playable @ all. can tell me wrong ?

python - urllib2.urlopen a local file, cross platform -

i'm trying open local file using urllib2 , have following code: r = urllib2.urlopen('file://' + some_path) while works on unix, not work on windows because of // . pythonic way have work cross-platform? use urllib.pathname2url : >>> import urllib >>> 'file:' + urllib.pathname2url(r'c:\path\to\something') 'file:///c:/path/to/something'

asp.net - What does sqllocaldb tracing do? -

the sqllocaldb command has trace option can set on or off, not clue tracing presumably controls, or trace output might found. does option anything? trace , trace output be?

javascript - Angular bootstrap modal toggle checked for data already present -

firstly apologize lengthy question cant post plunker because has services brings data backend. hence posted data can samples. i have angular js app uses bootstrap. have modal defined has following table: <div class="panel panel-default" style="float:left;width:525px;"> <div class="panel-body" data-spy="scroll" data-target="#navbar-example" data-offset="0" style="height:200px;overflow:auto;position:relative;"> <table class="table table-hover checkbox"> <tr> <th>course</th> <th>title</th> <th>credits</th> </tr> <tr ng-repeat="child in requirements"> {% verbatim %} <td class="vcenter"> <input type="checkbox" ng-checked="" ng-cli...

matlab - How to update data in a plot do create animations in octave -

i'm trying plot 2d array line line each time in loop pause command create animations. did in matlab , octave had plot command inside loop octave makes whole thing slower. saw somewhere can update data in plot, reason doesn't work. i'm doing wrong here? say x constant array d=(1*m) , y variable array d=(n*m). d -> dimensons h=plot(x,y(:,1),'-'); while true i=1:length(t) axis([0 l -a a]); hold on; set(h,'ydata',y(:,i)); pause(0.01) cla end end you shouldn't need hold on in code. following works fine in octave 3.8.1 fltk graphics toolkit: t = linspace (0, 2*pi, 100); y = sin (0.1*t); h = plot (t, y); f = 0.2:0.1:2*pi y = sin (f*t); set (h, 'ydata', y); endfor

c# - Rename classes using Visual Studio Project Template -

Image
i have created visual studio template using link: http://msdn.microsoft.com/en-us/library/ms185301.aspx . i able create dialog user enters custom message , gets displayed: namespace templateproject { class writemessage { static void main(string[] args) { console.writeline("$custommessage$"); } } } what want allow user rename class names want like: but see i'm getting errors of "unexpected character $" how can this? edit i see link: http://msdn.microsoft.com/en-us/library/eehb4faa(v=vs.110).aspx to enable parameter substitution in templates: in .vstemplate file of template, locate projectitem element corresponds item want enable parameter replacement. set replaceparameters attribute of projectitem element true. but above have not yet generated template yet still defining classes. understnad above step needs done in order parameter substitution enabled file-->new project scenario. ...

constructor - How do you create a complex variable in java? -

i'm using eclipse , messing around complex numbers. not sure how this. know how integer , double not complex type. found said complex c= new complex(1.0.3.0); // 1+3i but doesnt quite work out. gives error says constructor undefined? do have complex.class file in same folder other code? grabbed complex class here , created complex.class file javac complex.java , running following code (filenames example.java , example.class ) not problem: class example { public static void main(string [] args) { complex = new complex(1,2); } }

asp.net - Parameters in RedirectToAction don't passed down -

i'm trying pass down parameters action. there several parameters need pass down. when debugging, found simple types of parameters got values, whereas own class parameters null. return redirecttoaction("histories", new {myuser = user, sortorder = "name_desc" }); and here action method: public actionresult histories(applicationuser myuser, string sortorder, int? page) i did research , found , seems objects can serialized can passed down. so added annotation [serializable] on applicationuser class, , doesn't work. so i'm wondering what's best practice pass down objects? i know can put myuser session["currentuser"], don't old fashion. thank you. you have not passed int? page value, should this return redirecttoaction("histories", new {myuser = user, sortorder = "name_desc", page =1 }); or need use default parameter value this public actionresult histories(app...

unity3d - Unity web open custom html after build -

i made custom html file unity web project. though after building project, opens default pre-made one. there way make unity open own html file instead of default one? you're looking web player templates manual page . in assets folder, create folder named webplayertemplates , , put template in there. you'll need html file. make easier, unity in html tokens can replace data project. for example, 1 such tag %unity_web_path% , replaced path built project file. some tags include: unity_web_name name of webplayer. unity_width unity_height onscreen width , height of player in pixels. unity_web_path local path webplayer file. unity_unityobject_url in usual case page download unityobject2.js unity’s website (ie, offline deployment option disabled), tag provide download url. unity_unityobject_dependencies unityobject2.js have dependencies , tag replaced needed dependencies work properly. in every deployment i've seen, webpl...

iframe - Wikis - Is there a wiki in which one can create, within a page, "windows" (partial frames) to other pages? -

in "classic" wiki application 1 creates pages , uses hyperlinks inside content of pages link them in meaningful way. is there wiki allows 1 "pull" content page own? (as in create similar html snippet shows content of page, inline content on own page) apparently, feature called creating page "inclusion" or "transclusion" instead of linking page, pulls content of page 1 you're in. mediawiki has it, wagn.org has , lot of others too.

c - Why do I need to cast value of -1 as a char (when compiled for AVR microcontroller) -

i new embedded c , c. think may misunderstanding basic here , appreciate help. i have following function outputs "return -1" expect if run on windows (compiler: gnu gcc compiler). #include <stdio.h> char test(); int main() { if (test() == -1 ) { printf("return -1"); } else { printf("return not -1"); } return 0; } char test() { return -1; } if compile avr hardware, outputs "return not -1" cannot understand (compiler: gnu gcc compiler, avr-gcc (winavr 20100110) 4.3.3). if change first line to: if (test() == char(-1) ) { then outputs "return -1" expected both scenarios. why need explicitly cast -1 char? the issue seems whether or not char signed or unsigned , happens implementation specific . you might able around using signed char wherever need use negative values. furthermore, wise ensure you're using same data types in comparison (assumin...

c# - Using a generic type as a return type of an async method -

a previous question made me wonder why following method raise compile time error: the return type of async method must void, task or task public async t mymethodasync<t>() t : task { // irrelevant code here returns task } since know @ compile time t task or derived type, why won't work? edit the reason i'm asking method may return task or task<t> . let's method can return either , don't want duplicate code. of course theoretical , isn't ment production purposes. edit 2 found great article lucian wischik: why must async return task three problems: just because t " task or derived type" doesn't mean it's task or task<t> . expect if called mymethodasync<mycustomtask> mycustomtask derives task ? the compiler needs know whether it's building state machine returning task or task<t> when compiles method - uses different helper classes in different cases if async method...

xml - Shared property -

i have few plugins maven use same list of elements. it looks like: <configuration> <sourcedirectory>/path/to/source</sourcedirectory> <outputdirectory>/path/to/output</outputdirectory> <basepackage>com.example</basepackage> <imports> <import>some/file/location</import> <import>another/file/location</import> <import>and/another/file</import> <import>and/another/file</import> <import>and/another/file</import> <import>and/another/file</import> <import>and/another/file</import> <import>and/another/file</import> <import>and/another/file</import> </imports> </configuration> i want each configuration have different src/output , base package, share same list of imports. is there way share xml properties across configurations?

c# - Async Socket reading multiple messages as one -

in "client" have following piece of code: socket.send(asciiencoding.utf8.getbytes("test0"), socketflags.none); socket.send(asciiencoding.utf8.getbytes("test1"), socketflags.none); socket.send(asciiencoding.utf8.getbytes("test2"), socketflags.none); in "server" have following: public void readcallback(iasyncresult ar) { stateobject state = (stateobject)ar.asyncstate; socket handler = state.worksocket; int read = handler.endreceive(ar); if (read > 0) { string aux = encoding.ascii.getstring(state.buffer, 0, read); //rest of code... my problem is: aux "test0test1test2"... expecting readcallback called 3 times, 1 each send ... being called once... have make readcallback behave expected? i using tcpclient socket type , had problem. has nagle algorithm . able solve problem setting nodelay property true, allows data sent if buffer not yet full. edit: after reading qu...

bash - Use sudo to change file in root directory -

i'm trying write script configure resolv.conf , /etc/network/interfaces automatically. i'm running commands "sudo", i'm getting "permission denied" errors. sudo apt-get --assume-yes install vsftpd sudo "nameserver 8.8.8.8" >> /etc/resolv.conf sudo python setinterfaces.py sudo chattr +i /etc/network/interfaces sudo apt-get --assume-yes install lamp-server^ lines 2 , 3 permission denied errors, lines 1 , 5 did run. setinterfaces.py supposed overwrite /etc/network/interfaces'. setinterfaces.py works when pointed @ home folder not the interfaces` file. any idea? have changing ownership? ideally i'd 1 command script, can call , run. i'm writing script people not experienced in *nix. the sudo command executes command give under root account. in simplest form, syntax is: sudo command args... for example: sudo whoami prints root . if type, did in question: sudo "nameserver 8.8.8.8" >...

clr - What's the recommended way to read/write a .NET assembly from Java? -

it seems there plenty of tools emit .net assemblies .net itself, there doesn't seem library in jvm space same. for instance, wikipedia asm mentions: asm java-centric @ present, , not have backend exposes other bytecode implementations (such .net bytecode, python bytecode, etc.). i can't imagine issue hasn't come before, i'm unable find hints how has been solved in past.

javascript - Repeated countdown -

Image
i'm trying write script in plain javascript counts down 2 specific points in time, 1 after other, repeating every day. i'm not sure how done. specifically: have lunchtime, , have dinnertime on first day (both being date objects). every day, want following behaviour (more or less). at lunch-time of first day, "lunch time" text in green. , there's countdown dinner-time of day. , once reach "dinner-time", following and repeat every day, indefinitely. i'm not sure how done using pure javascript. currently, have handy piece of javascript thus: times = [lunchtime, dinnertime]; var = new date(); var next = times.pop(); var timeremaining = - next.gettime(); settimeout(stylefxn, timeremaining); the function stylefxn following: function stylefxn(){ //change styling on site } and i'm able make time switch lunch dinner on first day, never again afterwards. of course , cannot assume lunch-time , dinner-time every day ...

excel - Save PPT shapes as PNG images -

i have excel (.xlsm) opens existing ppt , uses vba modify several slides. there several shapes on each slide , .xlsm has vba modifies shapes. (the slides have designs on them different size business cards filled in spreadsheet names,...) now want "select all" shapes on slide "group"(not sure term correct). want export group .png image file. save location can same folder location of .xlsm file (doesn't matter). this different exporting each slide .png.(which can do). in case business card designs on each slide different sizes. need images size of "group" on slide. the vba code within .xlsm file (not ppt) several posts show vba code within .pptm file works fine if using ppt code doesn't seem work when put in .xlsm file drive .png creation excel. ====================== pc latest of software. pulling hair out on one. can help.

javascript - Perform jQuery operations on an HTML page that was retrieved via Ajax? -

let's you're retrieving complete html page using ajax. have page of html in variable. assuming need find , extract data page, how do it? traditionally i've done using regular expressions, i'm wondering if there's way perform jquery operations on retrieved source code instead. simplify things tremendously, jquery built parsing html dom trees. i'm thinking maybe appending retrieved source current page dom in hidden form...? there better way? jquerys parsehtml might looking for: http://api.jquery.com/jquery.parsehtml/

php - Is $_SESSION safe from sql injects? -

i use pdo access mysql database, , want use in. sadly don't seam work prepare, wrote function function is_numeric_array($array){ if(!is_array($array)) return is_numeric($array); if(is_array($array)) foreach($array $int) if(!is_numeric($int)) return false; return true; } then used this if(!is_numeric_array($_session['story'])){ die("error, array contains non-integers"); } $query = "("; for($i = 0; $i<count($_session['story']); $i++) $query .= $_session['story'][$i].(count($_session['story'])-1 != $i ? "," : ""); $query .= ")"; //collect data needed $stories = openconnection() -> query("select * `stories` `id` in {$query}") -> fetchall(); i know it, looks ugly. don't want sql injects. you don't have test input being numeric, because in mysql, string e.g. ...

c# - SignalR IHubContext and thread safety -

in code sample below i've implemented signalr hub supposed implement following functionality: clients may listen changes of foo instances invoking hub's subscribe method bunch of ids treated group names interally unsubscribing works analog invoking unsubscribe the service layer of web application may notify connected clients subcribed appropriate ids (groups) change has occured invoking onfoochanged is safe use singleton hub context or need fetch every time inside onfoochanged ? feedback on implementation of other methods welcome well. i'm new signalr after all. [export] public class foohub : hub { private static readonly lazy<ihubcontext> ctx = new lazy<ihubcontext>( () => globalhost.connectionmanager.gethubcontext<foohub>()); #region client methods public void subscribe(int[] fooids) { foreach(var fooid in fooids) this.groups.add(this.context.connectionid, fooid.tostring(cultureinfo.invariantculture)); } pu...

java - Cloning a LinkList without using any builtin functions. -

i went interview today , question got thrown @ me. can't come answer. the gig slist2 = slist1.clone(); if change things in slist1 (e.g editing object) not affect similar object in slist2. attempt it, create new nodes whenever cloning object part failed. thinking object.clone() question state no built-in function allowed. slist2.head = new node(); node newlist = slist2.head; node head = slist1.head; slist.head.(all data) = head.(all data); while(head.hasnext()){ head = head.next(); node newguy = newnode(); newnode.(all data) = node.(all data) newlist.next = newguy; } this follow through old list, manually copying data new node , tacking node on new list

facebook graph api v2.0 - App asking about itself with an app token -

is there app token equivalent "/me" alias? in other words, there way application can ask data without having hardcode application id in "/{app-id}" request? essentially, want app id , could extract app token, token supposed opaque , string manipulation extraction seems hokey. before hokey thing, wondering if there's better way application ask itself. /app shortcut 'current app' , work user access token, page access token or app access token example: https://graph.facebook.com/v2.0/app?access_token=<app access token> response: { "category": "utilities", "daily_active_users": "0", "daily_active_users_rank": 1079202, "icon_url": "https://fbstatic-a.akamaihd.net/rsrc.php/v2/ye/r/7sq7wkjhi_5.png", "link": "https://www.facebook.com/apps/application.php?id=[snipped]", "logo_url": "https://fbcdn-photos-c-a.akamaih...

android - How to count items in a directory? -

i need count number of items in directory in android, example; how many files there in "layout" directory? if count array do (int = 0; < array.lenght; i++){ count++; } how change "array.lenght" suitable directory? i'm doing because want create x-number of views depending on amount of items in drawable. if add new ".xml" in drawable directory, app generate view item automatically because of for-loop. the android resources identified constants in r class generated aapt. reflection can count number of fields (e.g. drawables): int getdrawablescount() { return r.drawable.class.getfields().length; }

Jenkins on openshift " Cartridge for not found" -

i tried create simple jenkins setup on openshift. here steps followed: 1. create new openshift app using "jenkins server" cartridge. 2. log in new jenkins server using supplied username , password. 3. create simple freestyle build shell build step echos text. 4. run build the new build appears briefly in jenkins server ui , disappears, checked log in jenkins server app find error messages. may 29, 2014 4:55:41 pm hudson.plugins.openshift.openshiftcloud reloadconfig info: reload responsecode: 200 may 29, 2014 4:55:41 pm hudson.plugins.openshift.openshiftcloud reloadconfig info: config reload result: may 29, 2014 4:55:41 pm hudson.plugins.openshift.openshiftslave <init> info: creating slave 15mins time-to-live may 29, 2014 4:55:41 pm hudson.plugins.openshift.openshiftcloud provision warning: caught com.openshift.client.openshiftexception: cartridge not found. retry 0 more times before canceling build. may 29, 2014 4:55:46 pm hudson.plugins.openshift.openshiftcl...

mysql - PHP PDO is ruining my $_POST values? -

edit: edit of original code: (i changed if "if($_post['break'] != "")" test , doesnt work, neither of other varients i've tried. if($_server['request_method'] != 'post') { echo '<form method="post" action=""> category name: <input type="text" name="cat_name" /> category description: <textarea name="cat_description" /></textarea> <input type="checkbox" value="break">is table break?<br> <input type="submit" value="add category" /> </form>'; } $sql= 'insert categories(cat_name, cat_description, isheader) values (:cat_name, :cat_description, :isheader)'; $stmt = $dbh->prepare($sql); if($_post['break'] != ""){ $isbreak = true; } else{ $isbreak = false; } ...

linux - (Virtual PC on USB device:) How to locate KATE session data on an external hard disk? (NOT inside /home/... ) -

normal location (in ubuntu linux) user settings of kate editor: /home/username/.kde/share/apps/kate/ i want make automatically being written instead external device, like: my hard disk nr. 2 (via usb) / there in partition 12 path like: /hd2/part12/conf/kate/ so far did not find how-to this. remark: why want this? i want obtain portable computing: external hard disk should instantly jobs when branched computing device equipped linux ubuntu (desk top, notebook, live dvd). i have implemented way perl programs initialize identical work environment when starting session on linux pc. there 2 problem cases: kate , thunderbird. for reason of clarity, question here done kate - easier case. solutions thunderbird appreciated, too. additional problem thunderbird top directory gets specific coded name, differing each pc / each user. improvisation: it possible copy perl programs kate setup files external hard disk, , there corresponding location when using other lin...

bash - system command returns strange value -

i have script #!/bin/bash npid=$(pgrep -f procname | wc -l) echo $npid if [ $npid -lt 3 ];then service procname start; fi when procname running, works fine showing correct number $npid . fails when there isn't procname running. should return zero, returns npid=3 , 3. same problem see ps auxw | grep procname | grep -v grep | wc -l well. something trivially wrong couldn't figure out, suggestions ? * edit # returns nothing if therisn't process name poopit running pgrep -f poopit # in case when no process running, below returns 0 if typed on bash cmd line pgrep -f poopit | wc -l # if running, pgrep -f poopit | wc -l 17 # if running, script $npid shows 19

android - What exactly happens when finish() is called on a non-top activity -

suppose somehow have reference activity not on top of activity stack. can call finish() on activity, , happen in such case? also, legitimate reason hold on reference non-top activity? saving reference in static field way have access non-top activities against best practice. finish() on activity, , happen in such case? i'm sure can. end black screen non-top activity if still visible on screen. also, legitimate reason hold on reference non-top activity? i think have consider whether design correct if have keep reference activity in background. lead lot of memory leaks if keep old activity hanging around gc cannot collect. saving reference in static field way have access non-top activities you should use class constants.java put in static fields non-top activity , reuse values constants.java.

c# - Selecting the grouping Key in an Entity Framework query that groups by anonymous type ends up returning one key per grouped object -

i have table id name city ... more columns ---------------------------------------------- 1 nate boston ... 2 john boston ... 2 john boston ... 3 sam austin ... (for reasons beyond control, id duplicated in cases) and have entity framework model setup this, in general working pretty well. having issue while trying unique list. var result = db.table.groupby(t => new { id = t.id, name = t.name, city = t.city }).select(g => g.key) problem is, query returns following: id name city ----------------------------- 1 nate boston 2 john boston 2 john boston 3 sam austin i thought going crazy, fired linqpad, ran same query , got expected results: id name city ----------------------------- 1 nate boston 2 john boston 3 sam ...

python - Why does my function call affect my variable sent in the parameter? -

so part of /r/dailyprogrammer's challenge on trying out few simple tasks in new programming language, tried out python after having dabbled in slightly. there had recreate bubble-sort in python , came with: def bubble(unsorted): length = len(unsorted) issorted = false while not issorted: issorted = true in range(0, length-1): if(unsorted[i] > unsorted[i+1]): issorted = false holder = unsorted[i] unsorted[i] = unsorted[i+1] unsorted[i+1] = holder mylist = [5,6,4,2,10,1] bubble(mylist) print mylist now code works flawlessly far can tell, , precisely problem. can't figure out why bubble function affect variable mylist without me returning it, or setting anew. this bugging me it's python type thing :) or i'm silly man indeed. i'm not sure reason of confusion is, if think each time when write func(obj) whole object copied stack, you're ...

sql - Stored Procedure cant detect SET? -

im trying make stored procedure reads different .dbf files every time execute it, making dynamic stored procedure. problem is, im not in sql yet , im having errors. error: procedure or function 'readdbf' expects parameter '@sql', not supplied. i know missing and/or making makes stored procedure not understand please can point in in right direction? this code: ` use devssis go exec master.dbo.sp_msset_oledb_prop n'vfpoledb', n'allowinprocess', 1 go create procedure readdbf ( @path nvarchar(1000), @name nvarchar(50), @sql varchar(max) ) begin set @sql = 'select * openrowset(''vfpoledb.1'', ''' + @path +'''; ''; '', ''select * ''' + @name + ''')' end exec @sql go ` im using sql 2005 btw i suspect want define @sql local variable in stored procedure, not parameter: create procedure readdbf ( @path nvarchar(1000), @name nvarchar...

repository - Git: Reference has invalid format: 'refs/heads/SomeBranch' -

i new git , following error occurs: fatal: reference has invalid format: 'refs/heads/somebranch' (conflict through use of capital , small initial letters) unexpected end of command stream somebranch (capitalized!) deleted earlier (local , on remote) , working on local branch somebranch (not capitalized!). then, git add local changes , git commit -m "some changes" -a . error occured while git push , when git push -u origin somebranch . somebranch not yet in repo. make backup of entire project (just in case) , do awk '!/conflict/' .git/packed-refs > tmp && mv tmp .git/packed-refs

python - optparse: Support additional prefixes on integer arguments? -

optparse supports '0b', '0' , '0x' prefixes on integer arguments signify binary, octal , hexadecimal respectively. need support additional prefixes, including '%' binary , '$' hex. one way patch optparse._parse_num , follows: oldparsenum = optparse._parse_num def newparsenum(val, type): val = re.sub('^%', '0b', val) val = re.sub('^\$', '0x', val) return oldparsenum(val, type) optparse._parse_num = newparsenum although work, seems quite fragile. there better approach? you define own option-handler/-callback: parser.add_option("-c", action="callback", callback=my_callback) to handle special cases or extend syntax. take documentation determine if sufficient , better (monkey-)patching.

c# - Close a form on CheckChanged event -

i have section of code, opens form when box checked, closes when box unchecked: private void chkdupe_checkedchanged(object sender, eventargs e) { if (chkdupe.checked == true) { input = 1; cableid_controller.showduplicateview(main_menu, this); } else if (chkdupe.checked == false) { // close form. formcollection fc = application.openforms; foreach (form frm in fc) { if (frm cableid_duplicateview) { frm.close(); } } } } it opens form fine, when uncheck box, error: invalidoperationexception . collection modified; enumeration may not execute. i know has foreach loop, can't think of way substitute else. can provide suggestions? you modifying application.openforms collection while iterating it. need create copy before iterate on copy instead of original collection var fc = application.openforms.oftype<form>().tolist(); a...

ruby on rails - How to set the hAxis interval with Google Visualization -

Image
i have used google visualization display chart, when multiple rows of data-table makes chart looks messy, how can set horizontal axis interval when there many columns of data? example: have range of horizontal axis each month want set horizontal axis range in every 3 months. you can use d3 time intervals generate clean ticks on google chart. d3.time.intervals generate list can pass in haxis.ticks option. for example: ticks = d3.time.months( new date(2013, 5, 1), // start new date(2014, 2, 1), // stop 3) // step // set chart options var options = { title: 'your data', width: 400, height: 300, haxis: {ticks: ticks} }; http://jsfiddle.net/s7etx/2/

Thrift list as a mutable type -

as taken thrift website's documentation , thrift list "an ordered list of elements. translates stl vector, java arraylist, native arrays in scripting languages, etc." why these lists expressed mutable types? doesn't promote slower object types don't take advantage of native arrays? don't understand why default - - translation of list in thrift mutable array type. as taken thrift website's documentation, thrift list "an ordered list of elements. translates stl vector, java arraylist, native arrays in scripting languages, etc." why these lists expressed mutable types? one has keep in mind type system of thrift designed portability across languages first , important goal in mind. that's reason why there signed integers. furthermore, idl types should considered abstract concept , describes more intent of particular type rather referring concrete syntax construction in, let's say, java, c++ or python. leads second part of ...

php - Overlayed angled axis limits -

Image
first off, isn't of programming question (syntax , such), me trying figure out issue). apologize if isn't right area, or right site. record, being calculated in php, data gotten sql database. i've been working on map system x-y coordinate system, however, way laid out in 'cells', organized on larger scale standard grid system (right x+, y+) tricky part, actual 'contents' laid out x , y axis on angle, making general idea this: the red lettering shows "cell coordinates" (marked solid black outlines) the black lettering inside 'cells' content coordinates. cell 0,0 starts content 0,0, , cell 0,1 starts 5,5 way shows in product (cell outlined--ignore mis-matched river tiles) positioning staggered overlap appearance. in product y axis runs diagonal, , x axis runs perpendicular. i know find content coord 'root' coord (relative 0,0) goes this: $contentrootx=($cellx+$celly)*5; $contentrooty=($celly-$cellx)*5; my issue coming...

jsp - How to direct the output of java program through HTML/CSS? -

i trying create web application using java , java server pages .i want output of java file display on jsp(web page) ..i new jsp don't know how include java program jsp file , output variables...i have searched didn't found me...any code or link tutorial helpful.... consider filename is: xyz.java , want display value of one of variable . and want display value of 1 of variable. first of if class not accessible in jsp need import class <%@ page import="com.my.yourclass" %> second need call method of class want output or said want use value of variable make sure should initialized can directly use jsp expression. <%= new yourclass().variablename; %> you can use directly display variable value html page make sure variable should accessible means should not private. you can use scriplet that for example: <% system.out.println("hello!!"); %>

haskell - (Type) safely retrieving an element of a vector -

i attempting write function getcolumn :: int -> vector n e -> e that retrieves i'th item vector of size n . these vectors defined follows: data natural 0 :: natural succ :: natural -> natural type 1 = succ 0 type 2 = succ 1 type 3 = succ 2 type 4 = succ 3 data vector n e nil :: vector 0 e (:|) :: e -> vector n e -> vector (succ n) e infixr :| is there way write getcolumn function in way compiler reject code if int big vector 's size? how write function? first, need singleton type naturals. singletons run-time representations of type-level data, , they're called singleton types because each of them has single value. useful because establishes one-to-one correspondence between values , represented type; knowing either type or value lets infer other. this lets circumvent limitation haskell types cannot depend on haskell values: our types depend on type index of singleton, type index can in turn determined value of...

shell - How to extract a specific number sequence in a file -

hi wanted ask regarding on how create shell script reads file extracts values outputs in file here content of file: some.ip.address,,0530,,,**134148.117132,134148.117176,134148.117693,134148.117712**,,,,,,134148.114552,,,,,0000016972,172.28.61.176,,,443,192.168.5.208,,,109,0,0,0,0,0,92,14,0,0,0,0,,,,200,,,text/html,,get ?fname=111.txt&seqnum=0000016972 http/1.1 some.ip.address,,0530,,,134118.111838,134118.111881,134118.112469,134118.112488,,,,,,134118.109233,,,,,0000016912,172.28.61.176,,,443,192.168.5.208,,,109,0,0,0,0,0,92,14,0,0,0,0,,,,200,,,text/html,,get ?fname=111.txt&seqnum=0000016912 http/1.1 some.ip.address,,0530,,,134148.120441,134148.120471,134148.120955,134148.120973,,,,,,134148.117845,,,,,0000016973,172.28.61.176,,,443,192.168.5.208,,,109,0,0,0,0,0,92,14,0,0,0,0,,,,200,,,text/html,,get ?fname=111.txt&seqnum=0000016973 http/1.1 some.ip.address,,0530,,,134118.114515,134118.114559,134118.115044,134118.115061,,,,,,134118.111938,,,,,0000016913,172.28.61.176,...

cordova - PhoneGap - Issue adding local plugin -

i'm developing first phonegap plugin , having issues getting work. i've created directory in plugins directory , have created 1 java file (android), plugin.xml , javascript asset file. i'm trying run using following command: phonegap local plugin add plugins\com.test.phonegap.plugins.myfirstplugin i following error message: { [error: enoent, no such file or directory 'c:\projects\messenger\plugins\com.test.phonegap.plugins.myfirstplugin\plugin.xml'] errno: 34, code: 'enoent', path: 'c:\\projects\\messenger\\plugins\\com.test.phonegap.plugins.myfirstplugin\\plugin.xml', syscall: 'open' } [error] enoent, no such file or directory 'c:\projects\messenger\plugins\com.test.phonegap.plugins.myfirstplugin\plugin.xml' when navigate file, notice contents of plugin's directory have been cleared (really annoying...) , replaced file .fetch.json. i'm running on windows 7 using phonegap 3.4 , node version 0.10.5. ...

bigdata - How execute a mapreduce programs in oozie with hadoop-2.2 -

2.2.0 , oozie-4.0.0 in ubuntu. cant able execute mapreduce programs in oozie. i uisng resource manager port number jobtracker 8032 in oozie. while scheduling in oozie goes running state , running in yarn after time getting error this(below) in hadoop logs , still running in oozie logs error: 2014-05-30 10:38:14,322 info [rmcommunicator allocator] org.apache.hadoop.mapreduce.v2.app.rm.rmcontainerrequestor: getresources() application_1401425739447_0003: ask=3 release= 0 newcontainers=0 finishedcontainers=0 resourcelimit=<memory:1024, vcores:-1> knownnms=1 2014-05-30 10:38:17,296 info [socket reader #1 port 47412] securitylogger.org.apache.hadoop.ipc.server: auth successful job_1401425739447_0003 (auth:simple) 2014-05-30 10:38:17,316 info [ipc server handler 0 on 47412] org.apache.hadoop.mapred.taskattemptlistenerimpl: jvm id : jvm_1401425739447_0003_m_000002 asked task 2014-05-30 10:38:17,316 info [ipc server handler 0 on 47412] org.apache.hadoop.mapred.taskattemptlist...

CUDAGRIND - MEMORY TRANSACTION CHECKING FOR CUDA in windows -

i using cuda c in visual studio. checking memory use cuda-memccheck . while going through sites found cudagrind of valgrind provides more details of error of memory.and further misunderstanding or found can used in linux system. right?? or can cudagrind applied in windows check memory error???

java - Customizing Field Name Serialization in Jackson Object Mapper -

say have bean: public class mybean { public string onemississipi; public int mybestfriend; //getters&setters&bears,oh my. } and using com.fasterxml.jackson databinding transform instances of pojo json output... how customize serialization of field names , can scoped global/class/field level? e.g. wish dasherize field names: { "one-mississipi": "two mississippi", "my-best-friend": 42 } i have spent hours in google , trawling through jackson code in order find out field serialization occurs, can't seem see anywhere may delegate custom field processing. does have ideas functionality lies if any? appreciated implement propertynamingstrategy , inside resolving methods use annotatedmethod , annotatedfield or annotatedparameter declaring class. can custom annotation on class , apply custom naming depending on it. the biggest problem approach it's not possible actual concrete class being serialized...

objective c - Is there a native function that checks if a value is inside of an enum? -

i'm trying put uilabel s inside of nsdictionary , i'm using tags key, problem is, not of labels inside of view needed, tags of uilabel s needed inside of enum. so want is, check tag if exist inside of enum add dictionary tag key. for (nsobject *obj in [self.formview subviews]) { if ([obj iskindofclass:[uilabel class]]) { uilabel *label = (uilabel *)obj; // here want add check before line labeldict[[nsstring stringwithformat:@"%d",label.tag]] = label; } } for future readers: if iterating on nsarray type of object code above, should use nsarray function enumerateobjectsusingblock instead, this answer , doesn't more pretty: [self.formview.subviews enumerateobjectsusingblock:^(id obj, nsuinteger idx, bool *stop) { if ([obj iskindofclass:[uilabel class]]) { uilabel *label = (uilabel *)obj; if ( label.tag >= textfieldtype_min_val && label.tag <= textfieldtype_max_val ) { ...

ios - XCode Library Search Paths Slash Issue -

Image
i adding library @ custom path, non-recursive relative path e-g "$(srcroot)/crittercismsdk-crashonly3.3.4" when drag , drop or add library via build phases> link binary libraries auto add slash "\" , path becomes \"$(srcroot)/crittercismsdk-crashonly3.3.4\" i have large number of libraries , hard remove slashes. happens every time add library or framework. please tell me issue , how can resolve it. i using xcode version 5.0.2

sh: variable substitution with heredoc -

below part of script cat "${pos}" | /usr/bin/iconv -f cp1251 -t utf-8 | uniq | sed -en "/^client_id.*/!p" | while read line ..... ...... cat >> "$tmpfile" << eof insert ......; eof done as can see iteration write sql statenment tmp-file. launched script regular user makes output expect, cron job - nothing. after investigation have found problem. when use "$tmpfile" without "" script works ok. so, can explain me why happens? os: freebsd, bourne shell. iirc, cron doesn't source files login shell does, end different settings environment variables. path $tmpfile pointing contains spaces when run cron example. also, on systems (depending on setup), cron uses different shell. if start script command line, example /usr/bin/sh might used, whereas when started cron , /bin/sh used. (i have no experience *bsd, have observed on linux.)

c# - IsolatedStorageSettings in wpf -

i converting silverlight application wpf application. in silverlight application have this private static isolatedstoragesettings usersettings = isolatedstoragesettings.applicationsettings; public static string division { { if (usersettings.propertyvalues["division"] != null) { return (string)usersettings["division"]; } else { return string.empty; } } set { if (usersettings.propertyvalues["division"] != null) { usersettings["division"] = value; } else { usersettings.divison = value; } } } but when copying class wpf project error the type or namespace 'isolatedstoragesettings' not found (are missing using directive or assembly reference) i have got using...

asp.net - How retrieve value from string collections in c# -

i have collection defined by: public class companymodel { public string compnname { get; set; } public string compnaddress { get; set; } public string compnkeyprocesses { get; set; } public string compnstandards { get; set; } } then stored names , addresses collection data table: list<companymodel> companies = new list<companymodel>(); for(int = 0; < dt.rows.count; i++) { companies.add(new companymodel { compnname = dt.rows[i]["companyname"].tostring(), compnaddress = dt.rows[i]["address"].tostring() }); } my question how retrieve each compnname collection ? tried this foreach (companymodel company in companies) { string compnyname = company.compnname; but return me blank result. the simplest option use linq, e.g. var names = companies.select(c => c.compnname);

file - Highscores using python / Saving 10 highscores and ordering them -

i making game on python , tkinter, , save highscores of game. have entry wich takes name of player , assign global (name1) , global (score1) in wich score saved. the thing need file stores best 10 highscores, showing them biggest score lowest. my question is: how make that? how can save name , score file? how can save scores order? (including name asociated score) i confused using methods of .readline() , .write() , .seek() , of those. edit: i need this: the globals name1, wich lets "john" , score1, wich @ end of game have int object. so after few games, john achieved 3000 on score, , 3500, , 2000. the highscores file should like: john 3500 john 3000 john 2000 and if mike comes out , play , achieve 3200 score, file should this: john 3500 mike 3200 john 3000 john 2000 the max amount of players on highscore must ten. if there ten highscores saved, , bigger 1 comes out, lowest score must althought ignored or deleted. (i need file because n...

opengl es - How to maintain WebGL Canvas aspect ratio? -

i have canvas i'm drawing via webgl. canvas sized: 640 width x 480 height. im drawing simple square in middle. surprised find when drawn looks little stretched horizontally. what need make square proper (no stretching)? note have not played viewport settings. im going thru webgl tutorials. left edge of canvas has x = -1.0, right has x = +1.0, top edge has y = 1.0 , bottom edge has coordinate of y = -1.0. in words, coordinates normalized across viewport (xy, z-coord handled different). such coordinates in clipspace. the ratio between width , height of viewport known aspect ratio. aspect ratio used when constructing projection matrix . when don't use projection matrix transform coordinates clipspace, directly providing coordinates will, depending on size of viewport, scaled accordingly. find more details projecton matrices here , here . to solve problem, divide x-coord aspect ratio.

c# - Display vs Edit Mode in MVC -

i creating mvc 5 web project collects numerical data user. majority of fields nullable decimals , have requirement display them various decimal places while maintaining full precision when writing database. the view model has properties such as: public decimal? tonnesoffoo { get; set; } public decimal? tonnesofbar { get; set; } the view renders controls as: @html.textboxfor(model => model.tonnesoffoo, "{0:n1}", new { @class = "form-control" }) @html.textboxfor(model => model.tonnesofbar, "{0:n3}", new { @class = "form-control" }) this works , presents data needed when form posted writing rounded values database. is there way around without having "actual" , "display" properties in view model , using jquery sync them up? there kind of editor template use handle situation? update using suggestion m.ob have managed working. i no longer using in-line formatting, instead using 2 data attributes, 1 ful...