Posts

Showing posts from March, 2012

c# - Simultaneous Sorting/Removing data from a List -

currently have list of integers. list contains index values point "active" objects in another, larger list. if smaller list of "active" values becomes large, triggers loop iterates through small list , removes values have become inactive. currently, removes them ignoring inactive values , adding them second list (and when second list gets full again same process repeated, placing them first list , on). after trigger occurs, list sorted using quicksort implementation. fine , dandy. -------question--------- however, see potential gain of speed. imagining combining removal of inactive values while sorting taking place. unfortunately, cannot find way implement quicksort in way. because quicksort works pivots, means if values removed list, pivot try access slot in list not exist, etc etc.. (unless i'm thinking wrong). so, ideas on how combine 2 operations? can't seem find sorting algorithms fast quicksort handle this, or perhaps i'm not seeing ho

ios - How to remove xib file for UIViewController class? -

Image
i want remove xib file uiviewcontroller classes. please let me know, if 1 know how remove or delete xib file. you can delete .xib file, if want new .xib view controller, create new xib then give viewcontroller file's owner's custom class , finally, link viewcrontroller's view , .xib

java - Regarding adding spring jmx functionality in the below application -

i new world of jmx , far have explored used in monitoring , managing applications , since interested in spring jmx , have developed interface , class , could please advise me how make in perfect jmx specially spring , settings need done in spring xml this ... package dustin.jmx.modelmbeans; /** * interface expose model mbean via spring. */ public interface simplecalculatorif { public int add(final int augend, final int addend); public int subtract(final int minuend, final int subtrahend); public int multiply(final int factor1, final int factor2); public double divide(final int dividend, final int divisor); } and below class.. package dustin.jmx.modelmbeans; public class simplecalculator implements simplecalculatorif { /** * calculate sum of augend , addend. * * @param augend first integer added. * @param addend second integer added. * @return sum of augend , addend. */ public int add(final int augend, final int addend) {

How to Make Dynamic Forms Between Two Models Ruby on Rails 3+ -

i searching 2 days , still can't make form using 2 models , , didn't understand formhelper view, not useful me , way make dynamic form between 2 models in rails 3.2 ? video old version of rails :( don't know do.. is episode can used in rails 3.2 ?? http://railscasts.com/episodes/88-dynamic-select-menus **i need detailed example please* * i think you're looking fields_for - http://apidock.com/rails/actionview/helpers/formhelper/fields_for .

Plone 4.3 migration - AttributeError: type object 'IIntIds' has no attribute '__iro__' -

after migrating plone 4.1 + dexterity site plone 4.3 site's /manage_workspace becomes inaccessible. database migration cannot performed. the zmi root can still accessed. traceback (innermost last): module zpublisher.publish, line 237, in publish_module_standard module zpublisher.publish, line 179, in publish module zope.event, line 31, in notify module zope.component.event, line 24, in dispatch module zope.component._api, line 136, in subscribers module zope.component.registry, line 321, in subscribers module zope.interface.adapter, line 585, in subscribers module plone.transformchain.zpublisher, line 119, in applytransformonfailure module plone.transformchain.zpublisher, line 79, in applytransformonsuccess module plone.transformchain.zpublisher, line 55, in applytransform module zope.component._api, line 172, in queryutility module zope.component.registry, line 163, in queryutility module zodb.connection, line 860, in se

java - org.json.JSONObject.getLong gives imprecise result -

Image
in android, can see attached figure, json received server "id=-705156352446547 2446 " code jsonobject.getlong("id") gives -705156352446547 2512 . i can see every getlong conversion has imprecise result(or lose precision?) in last 4 digits. there missed? my settings: java 1.6.0_41, android 4.1.2, intellij 12 ide. long.parselong(jsonobject.getstring("id")) gives precise result.

c# - Pass values + upload file -

i using asp.net c# , telerik tools. question is, tring pass values of (textbox, drop down list , file uploaded details) asp page using java script, nothing work , want file content , pass ?? can give me solution? please! on page1: <script type="text/javascript"> function getradwindow() { var owindow = null; if (window.radwindow) owindow = window.radwindow; else if (window.frameelement.radwindow) owindow = window.frameelement.radwindow; return owindow; } function populatecityname(arg) { var cityname = document.getelementbyid("cityname"); cityname.value = arg; } function returntoparent() { //create argument returned parent page var oarg = new object(); //get city's name

node.js - Handlebars SWAG library -

i'm new in handlebars , i'm trying use swag library custom helpers unsuccess. example try display in file.handlebars {{lowercase "bender should not allowed on tv"}} , error error: not find property 'lowercase' ran npm install swag my app.js is: var express = require('express') , http = require('http') , routes = require('./routes') , path = require('path') ,swag = require('swag') , handlebars = require('handlebars'); var app = express(); var engines = require('consolidate'); app.engine('handlebars', engines.handlebars); app.configure(function() { app.set('view engine', 'handlebars'); app.set('views', __dirname + '/views'); app.set('port', process.env.port || 3000); app.use(express.favicon()); app.use(express.logger('dev')); app.use(express.bodyparser()); app.use(express.methodoverride()); app.use

wpf - Cannot implicitly convert type 'System.Linq.IQueryable<AnonymousType#1>' to 'System.Collections.Generic.List -

i newbie in .net world, trying achieve result linq. please help. following error getting. error 4 cannot implicitly convert type 'system.linq.iqueryable' 'system.collections.generic.list'. explicit conversion exists (are missing cast?) ..business\dal\globalrequest.cs 39 27 business public observablecollection<accountsummary> getaccountsummary() { observablecollection<accountsummary> list; list = listdata in (from in dbc.accounts join b in dbc.ledgers on a.account_id equals b.account_id t2 t2data in t2.defaultifempty() a.is_mannual == convert.tochar("y") select new { account_id = a.account_id, account_name = a.account_name, amount = t2data.amount == null ? 0 : t2d

jquery - If div becomes larger then a specific height, make it static? -

i have div height controlled jquery. have script expands height ("show more"). problem is, div set position: fixed; , when expand enough content outside window, cant see it. what jquery script makes div static , not fixed when expands outside window. #left { width: 250px; height: auto; margin-top: 167px; position: fixed; float: left; } i have no idea how write this. thanks in advance! have nice day. edit: forgot, i'll post expand jquery function if needed, didn't think so. something this: $('#left').css('position', 'static'); or better: $('#left').toggleclass('expanded'); with css: #left.expanded {position: static;} demo: http://jsfiddle.net/wpuzm/

c# - How to detect if CPU is 32 or 64 bit -

i want detect capabilities op cpu's (especially if 32/64 bit cpu) the machines running on 32-bit os (winxp) , want detect if these machine capable 64 bit os installed. (btw: @ point know how detect number of cores...) you can use wmi more details each cpu, following properties available in win32_processor class you can use following code value of each property : managementobjectsearcher searcher = new managementobjectsearcher("root\\cimv2", "select * win32_processor"); managementobjectcollection cpus = searcher.get() foreach (managementobject queryobj in cpus) { console.writeline("addresswidth : {0}", queryobj["addresswidth"]); //on 32-bit operating system, value 32 , on 64-bit operating system 64. console.writeline("datawidth: {0}", queryobj["datawidth"]); //on 32-bit processor, value 32 , on 64-bit processor 64 console.writeline("architecture: {0}", queryobj["architecture&q

dll - Native Library in java using eclipse -

please let me know how use native lib. in eclipse. more: using aspriseocr.dll in our project image processing. sys can't find dll file in java library path. getting below error: exception in thread "main" java.lang.unsatisfiedlinkerror: no aspriseocr in java.library.path @ java.lang.classloader.loadlibrary(classloader.java:1682) @ java.lang.runtime.loadlibrary0(runtime.java:823) @ java.lang.system.loadlibrary(system.java:1030) @ com.readimage.readimg.main(readimg.java:37) i had same problem. resolved putting below .dll ../java(version)/jre/bin folder: aspriseocr.dll, asprisejtwain.dll, devil.dll, ilu.dll vishal srivastava

iphone - Facebook graph api -

whenever click facebook, pop-up shows "you have authorized app ", everytime login through facebook.can remove popup. using facebook sdk 2.x ios. it checked whether session there or not , continues logged in condition if (![[delegate facebook] issessionvalid]) { [[delegate facebook] authorize:permissions]; } else { nslog(@"seesion found"); [self apifqlime]; }

iPhone NSMutableArray loading background image from url -

i have nsmutablearray stores url image. , nsmutablearray called userpic. server prints out url: not json or anything, url. i can see in output in xcode shows url, how url in userpic background? im trying addsubview image background. if unclear, sorry that. let me know. please try use one.and think url @ index 0 of array. nsurl *imgurl = [nsurl urlwithstring:[userpic objectatindex:0]]; // put particular index image url in array... nsdata *imgdata = [[nsdata alloc]initwithcontentsofurl:imgurl]; uiimage *img = [uiimage imagewithdata: imgdata]; [newview setbackgroundcolor:[uicolor colorwithpatternimage:img]]

html - Jquery datepicker restrict dates in second date field based on selected date in first date field -

i using jquery date picker , have following code when user selects date, field below populated date +1 $('#dt2').datepicker({ dateformat: "dd-m-yy" }); $("#dt1").datepicker( {dateformat: "dd-m-yy", mindate: 0, onselect: function(date){ var date2 = $('#dt1').datepicker('getdate'); date2.setdate(date2.getdate()+1); $('#dt2').datepicker('setdate', date2); i restrict dates in dt2 field should not below date in dt1 field. e.g. if date selected in dt1 01-may-2013 , user allowed pick date after 01-may-2013 , not less 02-may-2013 how can restrict date picking in date field 2? i created jsfiddle you. i'm not 100% sure if it's "foolproof" prevent users manually typing date set inputs readonly e.g. <input type="text" id="dt1" readonly="readonly"> at moment check dt2 onclose , if date below dt1s date co

How to show or hide a social sharing buttons div on mouseover using jquery -

i trying work out how show hidden shearing (facebook, google+, twitter) divs when hovering on 1 div. take example animation of sharing round div on top right side : http://www.gethyapp.com/ please see have done : http://goo.gl/6xdm8 here have done in code: html <div class="share">share <div class="line"></div> <div class="facebook">fb</div> <div class="google-plus">g+</div> <div class="twitter">t</div> </div> css .share{ background-color: #da251d; width: 50px; height: 50px; -webkit-border-radius: 50%; -moz-border-radius: 50%; border-radius: 50%; position: relative; } .share .facebook, .share .google-plus, .share .twitter, .share .line { display:none; } .facebook{ background-color: #ffff00; width: 0px; height: 0px; -webkit-border-radius: 50%; -moz-border-radius: 50%; border-radius: 50%;

App on iphone 5 failed to install using itunes -

i new iphone development. know in order make apps ios devices either need have developer account or jailbreak ios device. jailbroke iphone 5. made simple hello world app iphone , converted .ipa. when install via itunes, first see icon on iphone , see installing. after completion, pops message app failed install . how can fix problem? why not installing? http://www.securitylearn.net/2012/12/26/build-ipa-file-using-xcode-without-provisioning-profile/ try it full , can directly run app on device

Prolog: Clauses are not together in source-file -

i have piece of code: % family tree female(pen). male(tom). male(bob). female(liz). female(pat). female(ann). male(jim). parent(pam, bob). parent(tom, bob). parent(tom, liz). parent(bob, ann). parent(bob, pat). parent(pat, jim). i error: warning: clauses of female/1 not in source-file warning: clauses of male/1 not in source-file what purpose of error? mean, file compile , run fine , aware of meaning of error. why? notice enforce best practice? i new logic programming. thanks! correct, warning enforce best practices, put related clauses in source file. other that, proximity of clauses each other in source file not matter, long relative order not change.

Same Custom web part feature not activated in Two Web application-Sharepoint 2010 -

we have created custom web part , activated feature in web application .it working fine create new web application , activate web part feature custom web part not working in created web application , error message displayed " the file attempting save or retrieve has been blocked website server administrators " note:feature activated in both web application

forms - Inserting drop down value into MySQL table -

i have site, people supposed able arrange meetings users within system. i'm having difficulties getting start , endtime form appear in mysql database, i'm using timestamp format saving values. me figuring out i'm going wrong? <?php $page_title = "create event"; //check if form has been submitted if (isset($_post['submitted'])) { $errors = array(); //initialize error array // check event name if (empty($_post['event_name'])) { $errors[] = 'you have not given event name.'; } else { $en = trim($_post['event_name']); } // check event location if (empty($_post['location'])) { $errors[] = 'you have not determined meeting taking place.'; } else { $l = trim($_post['location']); } if (empty($_post['starttime'])) { $errors[] = 'you have not determined when meeting starting.'; } else { $s = tr

PHP: How to get referrer URL? -

i have page (only index) customers can send me emails , want see website visitor coming from? how can referrer url php? tried $_server['http_referer'] it's empty time. how can this? thank you! here $_server contains ("---- censored ----" censored me) array(31) { ["document_root"]=> string(33) "/home/anything/public_html/design" ["gateway_interface"]=> string(7) "cgi/1.1" ["http_accept"]=> string(129) "text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/webp, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1" ["http_accept_encoding"]=> string(13) "gzip, deflate" ["http_accept_language"]=> string(14) "en-us,en;q=0.9" ["http_cache_control"]=> string(8) "no-cache" ["http_connection"]=> string(10) "keep-alive" ["http_cookie"]=> str

android - toast is displayed before getting GPS location -

when press button start getting location , toast message comes , shows lat:0 lon:0 (the initialized values). after few seconds must press again button location , shows location. what can that? (as understand , if use delay doesn't solve problem.i want toast message wait until location) if(gps.cangetlocation()){ latitude = gps.getlatitude(); longitude = gps.getlongitude(); toast.maketext(getapplicationcontext(), "your location \nlat: " + latitude + "\nlong: " + longitude, toast.length_long).show(); ... i used sth like: private void showtoast() { new thread() { public void run() { try { while (message) { runonuithread(new runnable() { @override public void run() { if(gps.cangetlocation()){

static - Java ClassFormatError: Method "<error>" class has illegal signature -

im getting error on line 1 , line 2. line 1 says illegal start of expression. dont understand why line 1 illegal public class myart { public static void main(string argv[]) { myart m = new myart(); m.amethod(); } public void amethod() { static int i; // line 1 system.out.println (i); // line 2 } } you cannot decalre static field inside method: public class myart { public static void main(string argv[]) { myart m = new myart(); m.amethod(); } //you can have non-static method since //calling through myart object m public void amethod() { int i=0; // removed static, otherwise program won't compile system.out.println (i); // line 2, if not initialized compilation fail variable refrenced } }

c++ - Child objects are (seemingly) randomly set to NULL or an 'illegal object'; how to debug that? -

i use cocos2d-x game porting cocos2d-iphone. original programmer seems have used 'feature' of objective-c not crash on calls nil objects way lot of sloppy things. if related don't know, however, in code never call release() manually , not delete or that. don't call ->removeobject() @ (although not result in same issue have). now problem: when game running, @ random moments (they won't random seem way obviously) child nodes set null. , not affect code als cocos2d internals. example: cclog("----------------"); for(int j = 0; j < this->getchildren()->count(); j++) { ccobject *child = this->getchildren()->objectatindex(j); enemysprite *enemy = dynamic_cast<enemysprite*>(child); if (enemy != null) { cclog("enemy tag %d found", enemy->gettag()); } } enemysprite *enemy = dynamic_cast<enemysprite*>(this->getchildbytag(i)); if (enemy == null)

html - Whats the best way to print a dynamic table in javascript? -

i using datatables.net library don't print output (instead, format own printable table looks different style of data-table, keep data-table style display non-print purposes). one option library has export data table javascript object, can access data datable , whatever want. so options solution be: 1) create separate html page table & css prepared , printing via window.open() query string parameters , window.print() on-load of that. 2) same #1 big hidden input field , form post/request. 3) stay on same page, dynamically draw table, hide don't want print, window.print(), remove dom newly added table , re-show non-printable stuff. what guys think, 1 of solution, or there better option? note: data-set not massive, as 30 rows , 10 columns. well nobody seems have input on yet ive decided move forward using form post method & hidden fields. example of can seen here: posting javascript , creating hidden field on fly that link points answer on else

asp.net - SQL update attribute -

i have table of milestones in primary key id_milestone , table tasks foreign key id_milestone. each task attribute completion in percentage. milestone have attribute of completion in percentage. need update completion of milestone @ 100 percent until have completed all tasks set 100 percent. have dropdownlist interval 10 percent , users update progress. sorry english. create table milestone ( id_milestone integer not null , nazev_milniku varchar2 (30) , ) ; create table milestone_complete ( id_milestone integer not null , completed integer ) ; create table tasks ( id_tasks integer not null , id_milestone integer not null , name_task varchar2 (30) , ) ; create table tasks_complete ( id_task integer not null , completed integer ) ; this calculate percentage of milestones using percentages of tasks. update [milestones] set [p

actionscript 3 - Action Script. How to disable keyboard? -

how disable keyboard keys in action script? i'm creating flash "memory" game, idea discover 2 equal cards. when 2nd card discovered shown 750 milliseconds, in time player can't actions. when use mousechildren = false; player can't click mouse time, can use keyboard arrows/enter/space/tab buttons... need disable time. here part of code: { trace("wrong"); _message = "wrong"; message_txt.text = _message; _secondcard = event.currenttarget; var timer:timer = new timer(750, 1); timer.addeventlistener(timerevent.timer_complete, flipback); timer.start(); stage.addeventlistener(keyboardevent.key_down, blindkeyboard);//added here stage.addeventlistener(keyboardevent.key_up, blindkeyboard);//added here mousechildren = false;

How to add invisible tags to google search -

i have drop down menu , google search box next embedded on web page. , want such thing: when user searches on google search, selected keyword drop down menu should applied automatically this code have right now <form method=get action="http://www.google.com/search"> <input type=hidden name=ie value=utf-8> <input type=hidden name=oe value=utf-8> <table bgcolor="#ffffff"><tr><td> <select name = "type"> <option value=""> choose type </option> <option value="bitmap">bitmap</option> <option value="vector">vector</option> </select> <input type=text name=q size=25 maxlength=255 value=""> <input type=submit name=btng value="search"> </td></tr></table> with javascript. i'd recommend learning javascript , using library such jquery simplify javascript coding. in pa

haskell - Make [StackExp] instance of Expr class -

i make class expr arithmetic operations class expr mul :: -> -> add :: -> -> lit :: integer -> i want "parse" this: mul ( add (lit 3) (lit 2)) (lit 4) = (3+2)*4 and have data type: data stackexp = pushi integer | pushb bool | add | mul | , | or deriving show and type program = [stackexp] --i use type function of stack calculator later my task is: need make instance of expr type program more concrete - want make transformation: mul ( add (lit 3) (lit 2)) (lit 4) ->>> [pushi 2, pushi 3, add, pushi 4, mul] i have problems because receive [[stackexp]] @ output of instance declaration. my try: instance expr program lit n = (pushi n):[] add exp1 exp2 = exp1:(exp2:[add]) mul exp1 exp2 = exp1:(exp2:[mul]) i don't know how concatenate sub-expressions list ---------------- compiler error looks this------------------------ c

uiimage - ios6 how to compose 2 images -

i trying overlay play button on image thumbnail currentl thumbnail displayed using : if(nil != self.analysis.image) { self.imageview.image = self.analysis.image; } i tried use thumbnail background image , , play button transparency image, doesn't appear @ ... if(nil != self.analysis.image) { self.imageview.backgroundcolor = [uicolor colorwithpatternimage:self.analysis.image]; self.imageview.image = [uiimage imagenamed:@"whitebackground.png"]; } what's best way compose them ? my fault ! the coding right...!! whitebackground.png transparent .... have use display button image .... if(nil != self.analysis.image) { self.imageview.backgroundcolor = [uicolor colorwithpatternimage:self.analysis.image]; self.imageview.image = [uiimage imagenamed:@"displaybutton.png"]; }

php - Can't figure out why SMTP email does not work to the same domain it's sending from -

i have php customer input form sends out smtp mail company hosting form. reason emails not reaching recipient's email. if substitute in other email address not on domain works out fine. can list multiple addresses on to: line , others email not desired info@ email address. cannot change sending domain since web hosting won't send mail when mismatched. thought might have sending email address , receiving being same changed from: address "onlineform@" instead of "info@" made no difference. i'm perplexed what's happening here. can send email directly other account "info@" email address , works fine. i've asked them check client and server junk mail folders , both clean. ideas on what's going on or how further diagnose issue? i've simplified code down relevant parts below , snippet code same thing. <?php $email_to = "info@domain.tld"; $email_subject = "subject line here"; $email_message = "email

ruby on rails - Is a migration necessary for generating an ID in a has_many/belongs_to relationship? -

i have rails app 2 related classes. pet has_many toys, , toy belongs_to pet. in order have index of toys pets (meaning every toy want have index identifier stating pet belongs to), need add migration adding pet_id column each toy (to toys table), or automatically done rails has_many - belongs_to relationship? you need add pet_id column toys table if table doesn't have one. has_many , belongs_to create methods ease writing code.

php - Submit form values without loading a new page -

i have form using pass values page , working . is there anyway without opening page form action set? i think can done using ajax , javascript echo "<form name=\"android\" method=\"post\" action=\"http://www.example.com\" target=\"_blank\">"; echo "<input type=\"hidden\" name=\"appid\" value=\"$appid\" />"; echo "<input type=\"hidden\" name=\"pushmessage\" value=\"$pushmessage\" />"; echo "<input type=\"hidden\" name=\"username\" value=\"$user\" />"; echo "<input type=\"hidden\" name=\"pass\" value=\"$pass\" />"; echo "<input type=\"hidden\" name=\"publisherid\" value=\"createcoolapps\" />"; //echo "<input type=\"submit\" value=\"push\" name=\"sub\" />&q

PHP Accept line breaks using REGEX -

i want allow line breaks text area input in regex being removed? $n= ereg_replace("[^a-za-z0-9[:blank:][:space:]&.\n\r\\/+-]+", "", $_request['input']); use /m modifier regex. http://www.php.net/manual/en/reference.pcre.pattern.modifiers.php m (pcre_multiline) by default, pcre treats subject string consisting of single "line" of characters (even if contains several newlines). "start of line" metacharacter (^) matches @ start of string, while "end of line" metacharacter ($) matches @ end of string, or before terminating newline (unless d modifier set). same perl. when modifier set, "start of line" , "end of line" constructs match following or before newline in subject string, respectively, @ start , end. equivalent perl's /m modifier. if there no "\n" characters in subject string, or no occurrences of ^ or $ in pattern, setting modifier has no effect.

Bezier curve using opengl C++ -

Image
i need plot point in bezier curve under curve. output ب did curve need know how plot point under curve shown in picture below. code: #include <stdlib.h> #include <math.h> #include <gl/glut.h> #if !defined(glut_wheel_up) # define glut_wheel_up # define glut_wheel_down 4 #endif /* set initial size of display window. */ glsizei winwidth = 600, winheight = 600; /* set size of world-coordinate clipping window. */ glfloat xwcmin = 50.0, xwcmax = -50.0; glfloat ywcmin = 50.0, ywcmax = -50.0; class wcpt3d { public: glfloat x, y, z; }; void init (void) { /* set color of display window white. */ glclearcolor (1.0, 1.0, 1.0, 0.0); } void plotpoint (wcpt3d bezcurvept) { glbegin (gl_points); glvertex2f (bezcurvept.x, bezcurvept.y); glend ( ); } /* compute binomial coefficients c given value of n. */ void binomialcoeffs (glint n, glint * c) { glint k, j; (k = 0; k <= n; k++) { /* compute n!

java - How to have LevelLoader method 'ignore' undefined entities? -

i using method of loading xml file game level similar this: private void loadlevel(int levelid) { final simplelevelloader levelloader = new simplelevelloader(vbom); final fixturedef fixture_def = physicsfactory.createfixturedef(0, 0.01f, 0.5f); levelloader.registerentityloader(new entityloader<simplelevelentityloaderdata>(levelconstants.tag_level) { public ientity onloadentity(final string pentityname, final ientity pparent, final attributes pattributes, final simplelevelentityloaderdata psimplelevelentityloaderdata) throws ioexception { final int width = saxutils.getintattributeorthrow(pattributes, levelconstants.tag_level_attribute_width); final int height = saxutils.getintattributeorthrow(pattributes, levelconstants.tag_level_attribute_height); // todo later specify camera bounds , create invisible walls // on beginning , on end of level. return gamescene.this; } }); levelloader.registerentityloader(new entityload

Redirecting html page with javascript -

i have combo-box redirects user specific page. redirect, if use window.location.href = ... when hit back, automatically redirects again. , if use window.location.replace (...) they can't go back, because history gets replaced new page. i have thought it's common scenario, wanted ask if knows trick i'm missing? thanks just check position of syntax. put inside function or event. use below syntax : window.location = "your_url";

Facebook Scraper seeing only parts of header -

i couldn't see obvious reason differences, pretty new coding facebook friendliness. i've got page on site shows flickr albums: http://jpgme.co.uk/sports/index.php?type=sets at moment headers source looks this: <!doctype html public '-//w3c//dtd xhtml 1.0 transitional//en' 'http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd'> <html xmlns:fb="http://ogp.me/ns/fb#" xmlns='http://www.w3.org/1999/xhtml'> <head> <meta http-equiv='content-type' content='text/html; charset=utf-8' /> <title>blue line ice hockey photography - professional ice hockey photography in greater manchester & beyond</title> <link href='http://jpgme.co.uk/sports/themes/blackstripe/css/blackstripe.css' rel='stylesheet' type='text/css' /> <link rel='alternate' type='application/rss+xml' title='blue line ice hockey photography - professional ice

python - Distance for each intersected points of a line in increased order in 2D coordinate -

Image
i calculating distance between a(x0,y0) , b(x1,y1) points in 2d (x,y). i have following code represents intersected points of each cell in given 2 boundary points, a(x0,y0) , b(x1,y1). def intersected_points(x0, x1, y0, y1): # slope m = (y1 - y0 )/( x1 - x0) # boundary of selected points x_ceil = ceil( min (x0, x1 )) x_floor = floor( max(x0, x1)) y_ceil = ceil( min(y0, y1)) y_floor = floor( max(y0, y1)) # calculate intersected x coordinate ax = [] x in arange(x_ceil, x_floor + 1, 1): ax.append([ x, m * ( x - x0 ) + y0 ]) # calculate intersected y coordinate y in arange(y_ceil, y_floor + 1, 1): ax.append([ ( y - y0 ) * ( 1./m ) + x0, y ]) return ax sample values: intersected_points(1.5, 4.4, 0.5, 4.1); output: [ [2.0, 1.1206896551724137], [3.0, 2.3620689655172411], [4.0, 3.6034482758620685], [1.9027777777777779, 1.0], [2.7083333333333335, 2.0], [3.5138888888888893, 3.0],

templates - Python lambdas in Jinja2 -

i use jinja2 website template engine, , helper functions used in templates i've implemented macros, one. it's python code: def arrow_class_from_deg(angle): if angle none: return '' arrow_directions = [ (0, 'n'), (45, 'ne'), (90, 'e'), (135, 'se'), (180, 's'), (225, 'sw'), (270, 'w'), (315, 'nw'), (360, 'n') ] return min(arrow_directions, key=lambda (ang, _): abs(ang - angle))[1] it returns css class arrow, closest specified angle. function (and be) used in templates, makes sense implement in in templates too, namely macro. however, trying noticed jinja2 doesn't seem support python lambdas. true, , if yes how write function better (i hope loop isn't necessary here)? register filter: your_jinja_env.filters['arrow_class'] = arrow_class_from_deg and in template: <something class="{{ angle | arrow_class }}">bla

jquery - for_form increment issue increment object -

i overlooking has me stumped....i have form display survey (it rendered in a partial) , using :remote => true pass controller (update) thru , ajax call via jquery, when render view via js.erb replace question next question , id next id render in original form (in hidden fields) thats not doing job first display after submit renders next question text id not incrementing , next submit call submitting first record. there js command increment in erb. my code shown here below <%= form_for(@category, :remote => true) |f| %> <ul id='questionarea'> <%=@current_question %> </ul> <div id = 'hidden_field_usr' > <%=f.hidden_field :user_id, {:value => params[:id]} %> </div> <div id = 'hidden_field_question' > <%=f.hidden_field :question_id, {:value => @current_question_id} %> </div> <%=f.fields_for @answer |a| %> <ul id= 'answerarea'> <%= a.radio_button(:agree

paypal javascript button - how to specify browser success url? -

i prototyping payment via paypal , stuck on how specify url browser should redirect/link after payment. <script src="paypal-button.min.js?merchant=stan-facilitator@merkwelt.com" data-button="buynow" data-name="new bot" data-quantity="1" data-amount="0.99" data-shipping="0" data-tax="0" data-callback="http://www.merkwelt.com/people/stan/paypal/success.html" data-env="sandbox" ></script> i aware difference between callback (for reporting) , return url (what happens in browser). browser redirect site after payment has been handled. how can that? it feels missing since should standard setting using buttons. got it, url can specified data-return . <script src="paypal-button.min.js?merchant=stan-facilitator@merkwelt.com" data-button="buynow" data-name="new bot" data-quantity="1&q

mysql - Field with numbers and letters -

i have table in have field requires 3 letters , 3 numbers (that have between values 2000 & 7000). i've been reading around, , i'm still not sure better way handle issue, whether can simple datatype, instance char(6), or if there has field contains 3 letters, , field contains 3 numbers check restriction ensure values of field between 2000 & 7000. any can offer me, glad. in advance you may have give more specificity requirements, sounds me single column best option -- if order matters. if letters , numbers have meanings separately, should in 2 columns. otherwise, you'll end having concatenate them together. char(6) fine long know always 6 characters exactly. can't enforce such specific limit 2000 7000 @ column level anyway (which 4 numbers, isn't it?)

.net - Define a color as a system color within a theme in WPF -

i want define solidcolorbrush resource in wpf application (or rather in assembly several applications may refer to). in themes want color explicitly defined in resource dictionary making theme, in example classic theme want color system color. for example: aero.normalcolor.xaml : <solidcolorbrush x:key="{componentresourcekey typeintargetassembly={x:type l:myclass}, resourceid=mycolor}" color="#ff3399ff"/> classic.xaml: <solidcolorbrush x:key="{componentresourcekey typeintargetassembly={x:type l:myclass}, resourceid=mycolor}" color="{dynamicresource {x:static systemcolors.highlightcolorkey}}"/> this brush should available application name mycolor can re-defined on theme level. if defined above works should when color defined literal (i.e. when using aero theme), when referring systemcolors dynamic resource (in classic.xaml) exception say

how to generate random numbers with sequence in R -

i need generate random numbers between 20 , 50 5 increments. example, numbers must 20, 25, 30, 25, 50, 45 etc. difference between numbers should 5. i tried this: x<-floor(runif(50,20,50)) this gives me number between 20 , 50. there easy way in r? i think arun referring this: set.seed(123) sample(seq(from = 20, = 50, = 5), size = 50, replace = true) # [1] 30 45 30 50 50 20 35 50 35 35 50 35 40 40 20 50 25 20 30 50 50 40 40 50 40 # [26] 40 35 40 30 25 50 50 40 45 20 35 45 25 30 25 20 30 30 30 25 20 25 35 25 50

MySQL and C#.Net Stored Procedure and multiple parameter -

i developing (converting application db ms sql mysql) application using c#.net , mysql. c# code , stored procedure working perfect in ms sql when trying ingrate mysql getting parameter error. c# code below , mysql stored procedure running (tested in editor using call key work , parameter) public datatable alapvalidateuser(string email, string password,string type) { datatable dt = new datatable(); cmd = new mysqlcommand("useridvalidation"); cmd.commandtype = commandtype.storedprocedure; cmd.connection = cnn; string pass = reencryptpassword(password); mysqlparameter pramemail = new mysqlparameter("@v_emailid", email); pramemail.direction = parameterdirection.input; cmd.parameters.add(pramemail); mysqlparameter prampassword = new mysqlparameter("@v_password", pass); prampassword.direction = parameterdirection.input; cmd.parameters.add(prampassword);

better Java IPC@Linux tactic: (a) java.nio File API on /dev/shm or (b) JNI to shmctl(2)? -

we want write java 7 program boot (via 2 cmd line invokes) 2 separate jvm process instances. want these 2 processes communicate each other using native linux kernel shared-memory ipc resources. does have insight of these 2 approaches may have more merit? use java.nio.* api on /dev/shm use jni bridge c++ code makes native shmctl() system calls ? i vote "nio , /dev/shm". but before making final decisions, should consider other options, including clip: http://ambientideas.com/blog/index.php/tag/java/page/2/ http://ltsllc.com/talks/20090407_ipc.pdf inter jvm communication sockets, message queues , named pipes other ipc methods wouldn't dismiss out-of-hand. imho...

c++ - String splitting and multiplication after conversion to double -

i'm trying write function gets string it's argument, searches if there 'p' or 'e' in it, splits onto separate strings, replaces " p " " 3.14... " , " e " " 2.71... ", converts strings onto double , multiplies converted strings. example, when argument " 123.45p4e9.2 ", function splits onto " 123.45 ", " p ", " 4 ", " e " , " 9.2 ", replaces characters constants: " 123.45 ", " 3.14... ", " 4 ", " 2.71... " , " 9.2 ", after converts of them onto double , multiplies: 123.45*3.14*4*2.71*9.2 . the problem when give string number, without 'p' or 'e' (for example " 2.4 " or " 32 "), returns 0. however, when give " e ", " p ", or " ep ", returns " 2.71... ", " 3.14... " or " 8.53... ", in in case works well. problem back, w