Posts

Showing posts from February, 2013

sql - What do OrientDB's functions do when applied to the results of another function? -

Image
i getting strange behavior on 2.0-m2 . consider following against gratefuldeadconcerts database: query 1 select name, in('written_by') wrote v type='artist' this query returns list of artists , songs each has written; majority of rows have @ least 1 song. query 2 now try: select name, count(in('written_by')) num_wrote v type='artist' on system (osx yosemite; orient 2.0-m2), see 1 row: name num_wrote --------------------------- willie_cobb 224 this seems wrong. tried better understand. perhaps count() causes in() @ written_by edges... query 3 select name, in('written_by') v type='artist' group name produces results similar first query. query 4 now try count() select name, count(in('written_by')) v type='artist' group name wrong path -- try let variables... query 5 select name, $wblist, $wbcount v let $wblist = in('written_by'), $wbcount = count($wbli

c# - Delegating Handler in ASP.Net Web API returning incorrect status code -

i have asp.net web api following delegating handler: public class authenticationhandler : delegatinghandler { public ilogger logger { get; set; } public authenticationhandler(ilogger logger) { this.logger = logger; } protected override task<httpresponsemessage> sendasync(httprequestmessage request, system.threading.cancellationtoken cancellationtoken) { x509certificate2 certificate = request.getclientcertificate(); if (certificate == null) { logger.logwarning("no certificate found on request."); return task<httpresponsemessage>.factory.startnew( () => request.createresponse(httpstatuscode.unauthorized)); } if (!isvalidcertificate(certificate)) { logger.logwarning("certificate found on request not valid. thumbprint : " + certificate.thumbprint); return task<httpresponsemessage>.facto

python - making loop until key is pressed in pygame -

in code, want move object while key pressed , stop when key released. however, moves 1 step when keep key pressed. here sample code. have printed (x,y) values. suggestion? thanks. x = 20 y = 20 def keydown(evt): global x, y if evt.type == pygame.keydown: if(evt.key == pygame.k_right): x += 2.0 if(evt.key == pygame.k_left): x -= 2.0 if(evt.key == pygame.k_up): y += 2.0 if(evt.key == pygame.k_down): y -= 2.0 if evt.type == pygame.keyup: if(evt.key == pygame.k_right or evt.key == pygame.k_left): x = x if(evt.key == pygame.k_up or evt.key == pygame.k_down): y = y while true: event in pygame.event.get(): if event.type == pygame.quit: pygame.quit() sys.exit() print(x, y) keydown(event) ps: tried posted somewhere in forum ( how can make sprite move when key hel

android - achartEngine. simple example -

Image
i'm creating simple graphic achartengine, breaks following error activity , don't why: here activity code, accessed buttom in previous activity. import org.achartengine.chartfactory; import org.achartengine.graphicalview; import org.achartengine.model.xymultipleseriesdataset; import org.achartengine.renderer.xymultipleseriesrenderer; import android.content.context; import android.support.v7.app.actionbaractivity; import android.widget.linearlayout; public class startactivity extends actionbaractivity { private graphicalview mchartview; private xymultipleseriesdataset dataset; private xymultipleseriesrenderer renderer; protected void onresume() { super.onresume(); if (mchartview == null) { linearlayout layout = (linearlayout) findviewbyid(r.id.linearlayout1); context context=getapplication(); mchartview = chartfactory.getbarchartview(context,dataset, renderer); layou

ruby on rails - Devise Invitable - Restricting Access to Only invited users -

i might searching wrong key words, can't find way restrict users invited allowed create account on rails site (or maybe i'm using devise-invitable wrong). assume, there should method call in before filter or flip switch on initializer/devise.rb i tried in users_controller.rb , had no luck using ruby doc reference before_filter: invited? i have read initializers/devise.rb , readme , didn't have luck. i think should make custom filter purpose. before_action :authenticate_user! before_filter :restrict_only_invited_users def restrict_only_invited_users redirect_to :root if current_user.invitation_accepted_at.blank? end

ios - Can i use images.xcassets at 3x only? -

i'm working on universal game app swift , spritekit. i'm using images.xcassets background , images in project. and have question. can add image @ 3x (2208px x 1536px) becuase images.xcassets automatically resize image 2x , 1x ? want know between add image size 1x,2x,3x , add image @ 3x only on performance or problems. some case iphone 6 use 2x (images.xcassets automatically resize 3x) slower use 2x this artwork resolution http://i.stack.imgur.com/5fdrl.png i'm sorry bad english. thank you there quite few tools out there helping out generating asset catalogs. google seems favour one: https://itunes.apple.com/us/app/asset-catalog-creator-app/id809625456?mt=12 if don´t scaling resources, possible add vector assets using pdf. rendered during build time: http://martiancraft.com/blog/2014/09/vector-images-xcode6/

angularjs - is it possible in angular to set the debug log level at runtime? -

is possible switch $logprovider.debugenabled([flag]); @ runtime? the current situation: the angular client load settings server @ run phase. depends on settings set method $logprovider.debugenabled([flag]) . thanks in advance, stevo the short answer is: no, not really. once application hass been configured through .config() block, no further configuration can take place after application has bootstrapped. this due way providers work; they're available @ configuration time. there might way force configuration, , manually re-inject new $log service of controllers, if there way that, i'm not sure how.

c - Array of pointers to char check for new string -

i have array of pointers chars store string console. how can check, if new string entered inkrement index? thought segmentation fault. char** arr; int = 0; int j = 0; arr = malloc(sizeof(char*) * 10); while (arr[i][j] != '\n') { scanf("%c", &arr[i][j]); j++; } i++; // read next string here you allocating memory pointers. need make pointers point memory location before writing it.like arr[i] = malloc(sizeof(char) *20);

c - Test for standard streams piping failed -

after creating function grab stdin, stdout & stderr , wanted test .. here test code: int fd[3]; char *buf = calloc(200, sizeof(char)); file *stream; pid_t pid; pid = opencmd(fd, "/bin/echo", (char *[]){"/bin/echo", "hello!"}); stream = fdopen(fd[2], "r"); while (fgets(buf, 200, stream) != null) printf("stderr: %s\n", buf); fclose(stream); stream = fdopen(fd[1], "r"); while (fgets(buf, 200, stream) != null) printf("stdout: %s\n", buf); fclose(stream); free(buf); closecmd(pid, fd); this not manage work intended. spent hour debugging , not manage trace problem, far managed go, realized using fdopen start using descriptors' streams not work (for reason), using functions work directly file descriptors (such write(2) & read(2) ) works fine. what might possible reason ? this excerpt: (char *[]){"/bin/echo", "hello!"}); missing final null parameter – user3629

jersey - How do I getAbsolutePathBuilder() outside of @Context -

i have simple jax-rs app written in jersey 2.13 use emit "links" using uribuilder derived through uriinfo injected via @context annotation. @context private uriinfo uriinfo; ... uribuilder uribuilder = uriinfo.getabsolutepathbuilder(); string prid = uuid.randomuuid().tostring(); uri pruri = uribuilder.path(prid).build(); ... builder.putlink(new link("self", pruri.tostring())); i find in of supporting classes need means of getting uribuilder derived uriinfo.getabsolutepathbuilder() without having benefit of using @context annotation. how do this? there someway can ask resource directly builder? how statically asking, what, class extends resourceconfig builder? how can getabsolutepathbuilder() outside of @context? you capture request in filter using containerrequestfilter , put uriinfo object thread local variable. below possible solution, not 100% complete not provide uriinfoholder class needs hold thread-local instance of uriinfo object. see

How to publish libraries from Ivy cache to artifactory Ivy repos -

we lost our ivy repository 3rd party libraries (a lot of them). thing have ivy cache sitting on build agent. decide move artifactory, ivy:install can copy dependencies repo another, ivy cache not repo. in addition, ivy cache keeps versions of jar file under same directory (ivy cache default pattern) - [organization]/[module]/[type]s/ (no revision). we'd sort them out different directories - [organization]/[module]/[revision]/[type]s/. after doing this, should new repo in artifactory function same other repository? in other words, miss creating repository in way? any appreciated. you can create new repository layout in artifactory match ivy cache layout: [org]/[module]/[type]s/[module](-[classifier])-[baserev](-[fileitegrev]).[ext] then create new local repository configured ivy cache layout , import content of ivy cache new local repository. create new virtual repository configured default ivy layout , include local repository created. virtual repository p

constructor - Why it keeps on telling me "variable card might not have been initialized" -

this java poker game project. @ beginning, defined card class. class card { /* constant suits , ranks */ static final string[] suit = {"clubs", "diamonds", "hearts", "spades" }; static final string[] rank = {"","a","2","3","4","5","6","7","8","9","10","j","q","k"}; /* data field of card: rank , suit */ private int cardrank; /* values: 1-13 (see rank[] above) */ private int cardsuit; /* values: 0-3 (see suit[] above) */ /* constructor create card */ /* throw myplayingcardexception if rank or suit invalid */ public card(int rank, int suit) throws myplayingcardexception { if ((rank < 1) || (rank > 13)) throw new myplayingcardexception("invalid rank:"+rank); else cardrank = rank; if ((suit < 0) || (suit > 3)) throw new myplayingcardexception("invalid suit:&q

oracle11g - Is there any easy way to create oracle partitions -

i wnat add table partitions. there easy way create partitions on table has 5000000 record in oracle 11g database. i searched cant find solution. create new table partitions , transfer data , index .. new table remove old table , rename new table name deletede table name

caching - CACHE-MANIFEST for Websphere 7 -

trying set appcache file described in html5 specs . requires file served mime type of text/cache-manifest. open console , navigate environment > virtual hosts > default_host > mime types , add new property. however, new property never shows in console view. have confirmed xml on file system contains entry. after restarting server , checking, still nothing. file continues served text/plain. ideas? is unsupported in version 7x of websphere?

Java JTable Not populating with DefaultTableModel -

i have jtable trying populate file names located in particular folder. i can load jtable , looks if being populated data, no test appears in jtable rows. i can tell loading files, when place 2 files in folder, jtable creates 2 rows when loads. can change number of files in folder, , when re run program, load exact number of rows files in folder. any ideas? used methods of populating several other tables, , seem work, i'm confused why 1 doesn't. package testtable; import java.awt.borderlayout; public class main extends jframe { public jpanel contentpane; public jtable table; public defaulttablemodel rulesmodel; /** * launch application. */ public static void main(string[] args) { eventqueue.invokelater(new runnable() { public void run() { try { main frame = new main(); frame.setvisible(true); } catch (exception e) { e.printstacktrace(); } } }); } /**

ios - cloudKit beta testing -

i'm trying have beta testers test app using cloudkit works fine problem cannot figure out how hit production (cloudkit) severs devices: "<ckcontainer: 0x170107080; containerid=<ckcontainerid: 0x17003ed20; containeridentifier=icloud.com.xxxx.mycloudkitapp, containerenvironment=\"sandbox\">>" any of knows how can modify devices or xcode proyect hit production servers? i'll appreciate help when sign app distribution automatically connect production database. there no need set code.

c++ - check if string contains back slash -

i use file dialog file name. use name in processing. problem file name contains backslash char \ , when use path in programming language must change \ character \\ . how can solve problem slash? when use path in programming language must change '\' char "\" that not true. first of all, escaping backslashes takes place adding backslash, not replacing single quotes double quotes. that's nonsensical. secondly, every programming language different many broad generalisations need in "any programming language" absurd. furthermore, in c++, when writing characters string literal need escape backslashes, because in string literals unescaped backslashes allow enter unreadable/unwriteable characters directly source code. once resulting string in memory, doesn't matter contains backslashes. you not have change anything.

iphone - Change font of text in anyfield using iOS Keyboard Extension -

i working on ios keyboard extension. need use custom font in keyboard extension. part completed. problem that, if type in safari or other app using keyboard extension, character typed should in custom font style. same application on app store works https://itunes.apple.com/us/app/id923893166?mt=8&ign-mpt=uo%3d4 i spent 1 day find way this, didn't find result. if here can me, please me on this. thanks in advance. you cannot change font in any textfield on ios. the developers have instead found sets of unicode characters cover alphabet , represented them users font. if copy paste phrase "ᏴᎬᎦᏆ" 1 of glowing reviews allegedly written user of keyboard (incidentally, ios 3rd-party keyboards cannot type reviews in app store) , paste unicodechecker, find unicode characters u+13f4, u+13ac, u+13a6, , u+13c6. the actual codes word "best" u+0042, u+0045, u+0053, , u+0054. if want make own unicode keyboard, list of "fonts" can foun

javascript - ng-grid row template mouse events don't work for an editable row -

i'm creating ng-grid editable column this: {field:'quantity', displayname:'quantity', enablecelledit:true, celltemplate:'mycelltemplate.html'} mycelltemplate.html: <div ng-click="alert('foo')" ng-mouseover="hovered=true" ng-class="{myhoverclass:hovered}"> <span>{{row.getproperty(col.field)}}</span> </div> the ng-click doesn't work (i.e. no popup), ng-mouseover doesn't work either. how template react mouse events? thanks

numbers - Difference between double and DOUBLE in C++ -

i wondered what's difference between double , double (from #include <windows> ) in c++. there's lot of question in java, that's totally different language. is double windows wrapper class double , or else? have different advantages? double c++ keyword while double implementation defined typedef. for example if include <windows.h> in project in ms vc++ ide shows double defined in wtypesbase.h like: typedef double double;

excel - Exit main sub procedure if called sub is false -

i have 'protection' sub procedure sub unprot_manually() can been seen below. have sub procedure refereed main procedure of workbook. call protection procedure prior allowing user run main procedure. current code below, user able run main procedure regardless of entering correct password. need create 'protection' function, define boolean, , pass parameter main sub? sub unprot_manually() dim password_input dim pass string application.screenupdating = false pass = "xxxxxx" password_input = application.inputbox("password", "awaiting user input..") if password_input = pass call unprot 'else 'msgbox ("incorrect, bye") 'msgbox ("incorrect") end if application.screenupdating = true end sub change sub function, , check return value. e.g. in main procedure, if unprot_manually rest of program else msgbox "incorrect passowrd" end if your other section become: function u

tsql - SQL Azure TEXTPTR is not supported -

according features not support in sql database , textptr , updatetext aren't supported in azure's sql database. there way can used insert/update big text/image fields, can avoid having entire column contents in memory? updatetext depricated since sql server 2005. should use update ... set ... .write instead.

PowerShell use xcopy, robocopy or copy-item -

the reason switching batch files powershell scripts improve error checking of process. cmdlet copying have advantages in regard? if batch file exists uses xcopy copy files filename individually there advantage converting syntax copy-item? what advantages of using robocopy, xcopy , copy-item (compared each other)? example robocopy have advantage when working large number of small files on reliable network. if script run simultaneously on hundreds of computers copy hundreds of files each of them affect decision? should decision focused on permissions of files? the primary advantage can send objects copy-item through pipe instead of strings or filespecs. do: get-childitem '\\fileserver\photos\*.jpeg' -file | ` where-object { ($_.lastaccesstime -ge (get-date).adddays(-1)) -and ($_.length -le 500000) } | ` copy-item -destination '\\webserver\photos\' that's kind of poor example (you copy-item -filter ), it's easy 1 come on-the-fly. it&

Error of SQL query on IBM netezza SQL database from Aginity workbench on Win7 -

i need sql query on ibm netezza sql database aginity workbench on win7. my query: select * table1 c , table2 b cast(c.id int) = b.id in table1, id character varying(20) , in table2, id int. table1: id value1 value2 '985' 'casdqwdc' '654.3184' // char table2: id value1 985 694381 // id int, value1 int i got error: error [hy000] error: pg_atoi: error in "id": can't parse "id" any appreciated. somewhere in column id in table1 there value can't converted integer. based on error, have used nzload or external table load data file has header row column labels without skipping row, , have 1 row value 'id' in column id. testdb.admin(admin)=> select cast('id' int); error: pg_atoi: error in "id": can't parse "id"

python giving function as output? -

my python function supposed merely print variables multitude of functions single line, target.get_target_type outputting don't understand have no idea how fix it. expected output string literal of 'x' or 'y'. the output: target behavior: <function target.get_target_type @ 0x102d89620> pursuer behavior: x mis-match from function: def interaction_report(self): print("target behavior: \t", target.get_target_type, "pursuer behavior: \t", self.pursue_type, "\t", self.match_string) refers to: def get_target_type(self): return self.__target_type you need call function (e.g. target.get_target_type() instead of target.get_target_type . if don't call it, end reference callable function object itself.

c++ - Debugger is jumping around, not sure what I did -

i using visual studio 2013 ultimate , having problem when step through code debugger jumping around. able find 2 articles here on stack overflow neither of them solved problem. auto = m_actorcomponents.begin(); while (it != m_actorcomponents.end()) { delete it->second; it->second = nullptr; = m_actorcomponents.erase(it); } in piece of code above, example, when try step through enters loop executes delete line, jumps erase line, jumps nullptr line. repeats pattern every iteration. different parts of code seem jump around sporadically. before happened playing around profile guided optimization believe has that, cannot figure out how fix it. have cleaned , rebuilt solution, deleted debug , release folders, etc. know how can turn off because makes difficult figure out going on. on side note, using _crtsetdbgflag(_crtdbg_alloc_mem_df | _crtdbg_leak_check_df); check memory leaks. there none upon program exit, yet everytime reload game level during runtime

php - Wordpress - Get higher hierarchy posts -

i'm trying create menu based on higher hierarchy posts custom post type. thing is, can't find way filter hierarchy get_posts function. this have far... <?php $args = array( 'orderby' => 'post_date', 'order' => 'desc', 'post_type' => 'pb_progproy', 'post_status' => 'publish', 'suppress_filters' => true ); $posts = get_posts( $args ); foreach( $posts $post ){ ?> <li> <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> </li> <?php } ?> i know give me posts regardless of

mysql - need database model for online game -

i need database model online game: the game should save characters have more or less type of character file: http://pastebin.com/tswdaxte every player has: -a username, password , bunch of ints/strings -a container "inventory" holds "items(id & amount)" in slot -a container "bank" holds items -a container "equipment" holds items -a friendslist holds longs (64 bit integers can converted usernames) -skills specified "id"(int) , "experience"(int) my current idea use following tables: -players -inventory -bank -equipment -friends -skills all containers id | amount | slot | owner_id every player should have own "id" auto-incremented but i'm not sure how primary keys & foreign keys system works in mysql , i'd prefer have professional instead of trying figure out things on own you use layout suggested tables players, inventory, bank (although i'd put inventory , bank 1 , have b

ios - is this a retain cycle in Objective C? -

i've declared property on uicollectionviewcell this: @property (nonatomic, copy) void(^onselection)(bool selected); i override -setselected: this: - (void)setselected:(bool)selected { [super setselected:selected]; if (self.onselection != null) { self.onselection(selected); } } then in -cellforitematindexpath: configure this cell.onselection = ^(bool selected) { //the compiler telling me might retain cycle dont think so... cell.tintcolor = [uicolor redcolor]; }; is retain cycle? thanks! yes is. instead should use weak+strong combo. __weak typeof(cell) weakcell = cell; cell.onselection = ^(bool selected) { __strong typeof(weakcell) strongcell = weakcell; //the compiler telling me might retain cycle dont think so... strongcell.tintcolor = [uicolor redcolor]; }; in particular case don't need block because can update cell in subclass inside of setselected: or handle tableview:didselectrowatindexpath: in tabl

C C++ Graphics program in Linux -

i have program in c language: http://rajababuman.blogspot.com/p/graphics-in-turbo-c.html . it works fine if use dosbox on win7 machine , using turboc++ , shows me it's doing. but, how can run following graphics program on linux machine (where don't have dosbox or turboc++)? ps : display environment variable set local machine's ip address show me gui/graphics on linux box i.e. if run "xclock", clock shows on machine successfully. i know turbo c windows tool , uses windows api. i don't have use graphics.h header file, if can simple c program on linux machine, when compile, gives me same output (as program giving me on windows machine) on linux machine (without me intsalling/using dosbox or turboc). ///////////////////////////////////////////////////////////////////////////////////////// //diagram of car /////////////////////////////////////////////////////////////////////////////////////// #include<stdio.h> #include<graphics.h> void main

RFT Behaving differently when run from a command line -

the following code behaves differently when executed rft ide vs. command line. public void browsererror() { startbrowser(""); sleep (1); testobject[] = find(atdescendant(".class", "html.htmlbrowser")); system.out.println("object found: " + to.length); logmessage(messtype.info, "object found: " + to.length); } if there 1 browser open when run code rft ide, length of "to = 1". however, when run command line "to = 0". it seems browser instance never gets registered never finds it. what's more puzzling code works on different machine, know in environment messed up. don't know is. thanks in advance. the problem experiencing due jvm used machine vs. jvm used rft. of writing, rft runs on java 1.7 , not support 1.8. rft uses version 1.7 execute scripts. when run script command line, uses computer's default jvm, in case version 1.8 when executed find command, coul

sql - Count of dates over a period of time -

i have table1 employee data below | empid | department | startdate | enddate | | 1 | d1 | 2014-02-05 | 2014-06-18 | | 1 | d3 | 2013-08-29 | 2014-02-05 | | 2 | d3 | 2014-05-07 | 2014-06-18 | | 2 | d4 | 2013-08-29 | 2014-05-06 | | 2 | d3 | 2014-06-19 | 2014-12-01 | i have table table2 absence data empid department absentcedate 1 d3 2013-09-24 1 d3 2013-09-30 1 d3 2013-10-25 1 d1 2014-02-06 1 d1 2014-02-08 2 d3 2013-08-30 2 d3 2013-09-30 2 d3 2013-10-30 2 d3 2014-11-11 2 d4 2014-05-10 i joined both tables find count of absence dates employee based on empid using teh following code: select t1.empid empid, t1.department department, count(absencedate) numdaysabsent , st

rest - NSIS inetc::put, cannot upload file: "Try setting the Content-type header." -

i trying use inetc::put upload styled layer descriptor (.sld) local geoserver instance has restful endpoint. error saying need set content-type, though am. inetc::put /silent /header "content-type: application/vnd.ogc.sld+xml" "http://username:password@localhost:8080/geoserver/rest/styles/mynewstyle" "$instdir/mynewstyle.sld" pop $0 detailprint "uploading styled layer descriptor: $0" this returns http 400 (request error). server log has following say: error [geoserver.rest] - not determine format. try setting content-type header. org.geoserver.rest.restletexception @ org.geoserver.rest.abstractresource.getformatpostorput(abstractresource.java:173) @ org.geoserver.rest.reflectiveresource.handlepost(reflectiveresource.java:116) @ org.restlet.finder.handle(finder.java:296) @ org.geoserver.rest.beandelegatingrestlet.handle(beandelegatingrestlet.java:37) @ org.restlet.filter.dohandle(filter.java:105) @ org.restlet.filter.handle(filter.java:

java - how do I implement a model by code in EMF? (Eclipse Modeling Framework) -

i have created model in emf. managed generate code (.genmodel file), looked files, kinda understand implementation of model, edit , editor plugin. yet fail understand, how make own instance of metamodel code. understand way code written, don't know put own stuff called. hope here can me, there no discussed emf thread on stackoverflow. regards, me short answer: take @ emf book . book understand how use generated code , how construct models (part iv). there 2 ways create model: programatically or using generated editor. editor allows create model in tree view. use editor need run editor plugin eclipse aplication (right click -> run as). once in nested eclipse should able use editor craete model. the model itslef not usefull , assume want load model read contents, modify them, query them, etc. first important thing know emf models persisted xmi files (name.xmi). global extension "xmi", in genmodel can oreffered extension (lets assume "soq"). x

awk - Use .gitignore to find if any files are cached in git -

my team using visual studio , accidentally pushed without using .gitignore. have .gitignore in place, however, files stilled stored in git cache. want search directory find these files i imagining doing like awk '/$/ {print $1} .gitignore | xargs git rm' or, since don't want test deleting everything, safer this awk '/$/ {print $1} .gitignore | xargs find -iname' but i'm off. can me? git ls-files friend here. git ls-files --exclude-standard -ic \ | xargs git rm --cached @aurelianus's answer simpler , better if unstaged changes aren't concern.

html - Styling multiple navbars css -

Image
i've got 2 navbars here , i'm trying put 1 on top of other no success. i'm learning how style , it's more difficult thought. answers. div.introduceyourself nav, div.introduceyourself nav ul, div.introduceyourself nav li div.introduceyourself nav { list-style: none; margin: 0; padding: 0; border: 0; font-size: 12px; font-family: helvetica; line-height: 1; } div.introduceyourself nav ul li.category{ float: left; } div.introduceyourself nav ul li { float: right; } div.stories nav, div.stories nav ul, div.stories nav li div.stories nav { list-style: none; margin: 0; padding: 0; border: 0; font-size: 12px; font-family: helvetica; line-height: 1; } div.stories nav ul li.category{ float: left; } div.stories nav ul li { float: right; } and here html code.. <div class="introduceyourself"> <nav> <ul> <li class="category">

Auto Preview Image in Javascript or Php -

i've tried many times solve problem, , yet not able solve it. search on google unfortunately, codes not running, sample codes searched on google. <div id='preview'></div> <form id="imageform" method="post" enctype="multipart/form-data" action='index.php'> <input type="file" name="photoimg" id="photoimg" /> </form> <script type ="text/javascript"> $('#photoimg').on('change', function() { $("#imageform").ajaxform({target: '#preview', //shows response image in div named preview success:function(){ }, error:function(){ } }).submit(); }); </script> <?php if(isset($_post) , $_server['request_method'] == "post") { $name = $_files['photoimg']['name']; $size = $_files['photoimg']['size']; $tm

javascript - How to decode encoded json to HTML JS -

i using drupal json field formatter encode html body field. i got result in json "\"\u2022 big eggplant\r\n\u2022 2 tomatoes cut in slices\r\n\u2022 1 green pepper cut in slices\r\n\u2022 250gm minced meat\r\n\u2022 \u00bdtbsp of salt\r\n\u2022 \u00bdtbsp dried oregano\r\n\u2022 1tsp black pepper\r\n\u2022 \u00bd cup chopped onions\r\n\u2022 \u00bc cup oil cook meat\"" how can decode using js ? i tried code not working fine function htmlbody(x){ var bodi=''; bodi=x.replace('\n', '<br />') // removes encoded newline characters bodi=x.replace('\t', '') // removes encoded tab characters bodi=x.replace(/(?:\s+)?<(?:\s+)?/g, '<') // removes whitespace before or after tag-start delimiter. bodi=x.replace(/(?:\s+)?>(?:\s+)?/g, '>') // removes whitespace before or after tag-stop delimiter. bodi=x.replace(/\s+/g, ' '); return bodi; }

least squares - Optimal order and scaling of matrices -

i have 2 tables a1 , a2 (for example a1=[0.4472,-0.8944;-0.8944 0.4472] a2=[-0.5558 0.9101;0.8313 0.41420] ) and want check if columns of a2 optimally ordered , scalled (its columns least-squares estimates of columns of a) , if not , make them. any help? thanks

java - Using a handler to delay a repeated task for a limited number of times -

i have program draws bunch of red boxes in shape of spiral. have working, except cant figure out how delay process can see spiral forming. had code in loop , moved runnable while loop , 500ms delay. program meant stop when onclick or if runs 49 times. i'm impatient see end result, because phone slows down when start spiral, , has no animation runnable run = new runnable(){ @override public void run(){ if(row>=0 && (dir==0 && (row==6 || grid[row+1][col]!=null)) || (dir==1 && (col==6 || grid[row][col+1]!=null)) || (dir==2 && (row==0 || grid[row-1][col]!=null)) || (dir==3 && (col==0 || grid[row][col-1]!=null))) dir++; dir=dir%4; switch(dir){ case 0: row++;break; //down case 1: col++;break; //right case 2: row--;break; //up case 3: col--;break; //left } grid[row][col] = new imagevi

python - Interpolating a difficult surface with a B-spline (scipy.interpolate.bisplrep) -

Image
i using scipy.interpolate bisplrep , bisplev interpolate 2d vector field. problem spline values @ test points vary far given values @ points (can't trust tck of bisplrep). vector field highly discontinuous in region. cutting out region, have improved interpolation bit, not enough. here picture of every 100th ray of 2967, point ray exits discontinuous area, , general area interested in evaluating @ (green) . to points feed bisplrep, took each of 3000 rays , made 100 points along line, starting @ point ray exits discontinuous area , ending 400 units later (roughly box shows, oblong circular). so, cut out discontinuous area not taking samples there. not grid, oblong semicircle donut of points. have default value put in mixed region, highly discontinuous @ boundary. the values angle of line according arctan2. here how call bisplrep: #pts numpy array of points sampled within green area values = lookup_values(pts) m = pts.shape[0] tck=bisplrep(pts[:,0],pts[:,1],values,k

save - Saving a text from UIAlertView -

i have written uialertview code textfield , want write code store whatever typed user pushable detail list. how can that? - (ibaction)newreference:(id)sender { uialertview *newreference = [[uialertview alloc] initwithtitle:@"new reference" message:@"enter name" delegate:self cancelbuttontitle:@"cancel" otherbuttontitles: @"done",nil]; newreference.alertviewstyle = uialertviewstyleplaintextinput; [newreference textfieldatindex:0].delegate = self; [newreference show]; } here go sir. per comment above, if want store data nsuserdefaults here how it: nsuserdefaults *defaults = [nsuserdefaults standarduserdefaults]; nsstring* savedata = [[newreference textfieldatindex:0] text]; [defaults setobject:savedata forkey:@"whatever key want here"]; [defaults synchronize]; then invoke or call it: nsstring* recalldata = [defaults objectforkey:@"whatever key named above"]; happy coding -

Find the relative position of a famo.us Surface -

is there way current position of famo.us surface? i mean, after render tree has done thing , modifiers have been multiplied, surface exists somewhere on screen. can't figure out how ask where. seems simple enough question. specifically, i'm building kind of scroll view , need test if contained surface has moved outside of bounding box. it looks surface has _matrix property use, seems crude way of doing it. what missing?

pdf - How to know cmap compatible with font in Itext? -

i check font's encoding (the font's type opentype font), result below : postscript name: hirakakupron-w3 available code pages: encoding[0] = 1252 latin 1 encoding[1] = 1251 cyrillic encoding[2] = 1253 greek encoding[3] = 932 jis/japan then, creat font code : font f = new font(basefont.createfont("hirafont.otf", "identity-v", basefont.embedded)); except "identity-v" , "identity-h", can't use other cmaps such ("unijisx0213-utf32-h/v ..."). , in font see many glyphs displayed in rotation of 90 degrees. how map char in unicode char's glyph rotation in font? example : '〔 ' (0x3014 12308 left tortoise shell bracket) map index 9265 in font ---------update code-------- pdfencodings.loadcmap("unijisx0213-utf32-v", pdfencodings.crlf_cid_newline); string temp = "a"; byte[] text = temp.getbytes("shift_jis"); string cid = pdfencodings.convertcmap("unijisx0213-utf3

java - rendering problems with netbeans -

i'm having issues running program on netbeans. says, uncompilable source code - cannot find symbol symbol: class renderer location: class box i know code runs because saw professor run on cmd, when tried run on netbeans wouldn't let me. sorry if sound noobish, started learning java. downloaded rendering file , extracted on cmd line. downloaded file used on command line don't know how import netbeans. appreciated! public class box { public box() { x = 25; y = 25; width = 20; height = 30; rotation = 0; name = "none"; visible = true; if (canvas == null) // drawing canvas = new renderer(); } public box(int top, int left, int w, int h, int r, string n) { x = left; y = top; width = w; height = h; rotation = r; name = n; visible = true; if (canvas == null) // drawing canvas = new renderer(); } public void draw() { canvas.add(x, y, width, height, rotation, name, visible); // drawing canvas.render(); // drawing } private int x; private int y; private int wi

C++ QuickSorting a vector and keeping the original index numbers -

i have working quicksort function, i'm not sure how retain original index numbers of unsorted data. ideas? thanks! here's function. can incorporate pair in there somehow? double nearestneighbor::partition(vector<double>& thelist, double start, double end) { int pivot = thelist[end]; int bottom = start - 1; int top = end; bool notdone = true; while (notdone) { while (notdone) { bottom += 1; if (bottom == top) { notdone = false; break; } if (thelist[bottom] > pivot) { thelist[top] = thelist[bottom]; break; } } while (notdone) { top = top - 1; if (top == bottom) { notdone = false; break; } if (thelist[top] < pivot) { thelist[bottom] = thelist[top]; break; } } } thelist[top] = pivot; return top; } //quicksort function double nearestneighbor::quicksort(vector<d

chrome tabs event don't work on background js -

in permission "background": { "scripts": [ "request.js" ] }, "browser_action": { "default_icon": "uefa.png", "default_popup": "popup.html", "default_title": "as2" }, "content_scripts": [ { "js": [ "content.js" ], "matches": [ "http://*/*", "https://*/*" ] } ], "description": "moving", "manifest_version": 2, "name": "as2", "permissions": [ "http://*/*", "https://*/*", "tabs", "webrequest", "webrequestblocking", "storage", "webnavigation", "\u003call_urls>", "cookies" ], "update_url": "https://clients2.google.com/service/update2/crx", "version": "1.4", , request.js

java - When to use string concat -

i have read quite few articles on +, stringbuilderappend , concat. but, if have 1 single concatenation best option? str1 + str2 use string builder use string concat i looking explanation when , 2 strings involved. also when 2 strings involved complexity of string concat o(n) n length of longest string? if you're doing single concatenation, use str1 + str2 . easy read, , translated string concat compiler, fine if you're not going through loop or something. in fact, it's faster using stringbuilder if you're going concatenate strings single time. see http://blog.codinghorror.com/the-sad-tragedy-of-micro-optimization-theater/ description of why shouldn't bother using string builder if you're not looping. also when 2 strings involved complexity of string concat o(n) n length of longest string? you that. i'd it's o(n) n combined length of 2 strings, since shortest string cannot, definition, order of magnitude larger longest

ruby - How to select thousands of file in chef recipe -

i have lot of csv files should placed in server. so put in directory my-cookbook/files/default/ , want load csv files using dir.glob method, don't know how set proper relative path it. dir.glob("#{relative_path}/*.csv").each |file| cookbook_file "/var/foo/#{file.basename(file)}" source file.basename(file) end end i tried dir.glob("*.csv") , didn't work. how can load files in files/default directory? this isn't how chef designed used. better off putting files in git repo or remote tarball , using things git or remote_file resources download them. cookbook_file hack small, one-off things. don't use much, recommend same.

Executing REDIS Command in Node.js -

i writing node app. app interacts redis database. that, i'm using node_redis . sometimes, want execute command using line of text. in other words, want pass through without using wrapper functions. instance, may have: set mykey myvalue i love able execute without having break apart text , call client.set('mykey', 'myvalue'); there way execute command against redis in node world? if so, how? thanks! you should able use client.send_command(command_name, args, callback) send arbitrary commands redis. args can empty , in case call client.send_command('set mykey myvalue', null, cb) .

ios - Possibilities of Singleton instance getting deallocated automatically -

i creating singleton instance below: +(mysingleton*)sharedinstance { static mysingleton sharedobject = nil; static dispatch_once_t predicate = 0; dispatch_once(&predicate, ^{ sharedobject = [[mysingleton alloc] init]; }); return sharedobject; } what possibilities of sharedobject getting deallocated automatically? how can sure sharedobject remain in memory until app terminated? as answer rightly points out, shared singleton never deallocated. there 2 parts answer "why", both of come following line: static mysingleton * sharedobject = nil; first, static . static , when used inside of function this, modifies lifetime of variable, changing automatic , implicit default, static . means variable exists entire lifetime of program. second, declaration makes sharedobject strong reference. variables in objective-c strong default, pedantic, have written: static __strong mysingleton * sharedobject = nil; so: ha

inventory management with excel -

my previous post seemed have been unclear posting again , try explain problem more using screenshots. https://www.dropbox.com/s/4x8wktbdo7jc21m/excel-screenshot.jpg?dl=0 now, let me explain screenshots. let's take 1 of raw materials in table, rosin (column b). whenever buy more rosin, mention quanity bought , date(column a) , have total quantity of rosin bought @ bottom using formula "=sum(b80:b91)". notice number of rows @ present 11 i.e. 80 91. still buying more rosin, when have entered data in these rows. i.e. when enter dates , quantity bought. the problem i'll have keep inserting more rows in there after every few days. , if keep doing column rosin(as other raw materials) become long i'll scrolling forever. so, there way enter amount of rosin bought , date without having insert more rows. here's link excel sheet created - https://www.dropbox.com/s/iod5y7jae6grmyz/brc%20goods%20received%20stock11.xlsx?dl=0 if think ms excel not right tool

linq - Code duplication or not? -

here question class design , code duplication. this scenario: have class having property called supportedflow. property read , return list of flowinfo object, each 1 representing flow (physical file sending external system) few attributes such flowtype (an object representing kind of flow, instance "customer flow" or "dossier flow"). some other classes in system building need know list of "supported flow type" , can reading property supportedflow of above object , applying simple linq query: supportedflow.select(p => p.flowtype).tolist() some other classes need similar list, obtained applying filter on supportedflow list means of linq object extension method where, istance list of supported flows matching criteria (example: customer - related supported flows). here question: in such scenario best design choice, adding new properties original object (such supportedflowtype or customerrelatedsupportedflows) apply proper linq query original

android - How to implemente OnClickListener in an activity? -

in application have simple activity 3 buttons, , not set individual onclicklistener each button, decided implement in activity, doesn't work. here code public class mainactivity extends activity implements view.onclicklistener{ @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); } private void checkforviolations(){ } @override public void onclick(view v) { switch (v.getid()){ case r.id.btncheck: checkforviolations(); break; case r.id.btnviewallviolations: intent violationlistintent = new intent(mainactivity.this,violationlistactivity.class); startactivity(violationlistintent); break; case r.id.btnsettings: intent settingsintent = new intent(mainactivity.this, violationlistactivity.class);

javascript - escape.alf.nu answers to questions 17,18 and 21 -

i found site escape.alf.nu . nerd sniped me hard , couldn't leave before solving or @ least knowing solutions challenges. answers blew mind. still can't solve 17, 18 , 21 , can't find on internet. 17 , 18 lead me read lot sop bypasses. bypasses (through frame names, address hashes, more recent postmessage()) require js code on both side. known can load javascript or css , maybe info out of requires specific input formats (even javascript error messages blocked in modern browsers). setting document.domain won't work though domains similar cant set on token17.alf.nu (or 18) iframe. it seems me blatant violation of sop can bypassed browser vulnerabilities (like ones found on android default browsers). against style of other challenges have 1 requires specific browser. in 18 says "i expect 1 won't work in browsers", sounds if expects work in (so not vulnerability), , more importantly - if contradicts previous level should apparently work in browsers.

SQL Server trigger to Prevent Duplicate Entries from my TimeLog Table -

i have timelog table took entries of employees in , out but due magnetic card reader machine take multiple entries of duplicate data the difference in entries few seconds (which might goes different minutes) unique identifiers: uid = user id type = in / out serial = card reader number checktime = time difference need check till 1 minute before my trigger: create trigger [dbo].[data_checkout] on [dbo].[tblname] after insert if exists (select * [dbo].[tblname] t inner join inserted on datepart(day, t.checktime) = datepart(day,i.checktime) , datepart(month, t.checktime) = datepart(month, i.checktime) , datepart(hour, t.checktime) = datepart(hour, i.checktime) , datepart(minute, t.checktime) = datepart(minute, i.checktime) , datepart(minute, t.checktime) = datepart(minute, dateadd(minut

ffmpeg - Script to make movie from images -

hello want script or way make video images. have folder lot of pictures named randomly "flowers.jpg", "tree.jpg", etc. i have "intro.jpg" photo want add @ start of every video. what want create video (any format, .avi etc) custom duration 2 photos this: intro.jpg (10-20 seconds or how want) + tree.jpg (1 hour or how want) intro.jpg + flowers.jpg ... , on. sorry being newbie, have no clue how accomplish this. the easiest way might use free online creation tool. can upload photos , specify duration. can add audio , transitions. my daughter uses animoto https://animoto.com/ or try this. https://www.wevideo.com/ if want make video locally easy in adobe premiere, imovie, sony vegas or number of easy use programs free version or free trials. by script mean code , if under environment? can use ffmpeg open source , command line , execute code. ffmpeg create video images if want guidance in building ffmpeg script or want use ffmpeg

angularjs - angular custom charting svg or canvas or d3 or html? -

i looking library/framework/or build scratch gets binds model , provides 2 way binding? svg or canvas best option. looks svg me. was looking @ d23.js , angular integration. allow create custom chart or should go ahead building scratch without using library/framework. so if svg, on clicking or dragging svg element should able call function in angular scope. please give pointers on start. i suggest use highcharts. can find angular module highcharts.

javascript - Can jQuery invalidHandler ScrollTop Via Iframe in Parent Window -

i have php form showing via iframe in parent window, php form scrolltop on own ok, once in iframe in parent window page, jumps directly error. there way add code below make scrolltop in iframe in parent window? $(function () { $("#frmformmail").validate({ invalidhandler : function() { $('html, body').animate({ scrolltop: $("#frmformmail").offset().top // scroll top form on error }, 'slow' ); }, // specify validation rules rules: { field_0: { // title required: true, minlength: 3 }, field_1: { // full name required: true, email: true, minlength: 5 }, field_2: { // address required: true, minlength: 20 }, field_3: { // age required: true, minlength: