Posts

Showing posts from September, 2015

Using 'OR' and 'AND' in SQL Server -

is using ( condition or condition b , condition c ) the same as ( condition , condition c) or (condition b , condition c) no. first condition is: (condition a) or (condition b , condition c) and second is: (condition , condition c) or (condition b , condition c) you can see difference between them.

Update existing design of a website, use of CSS -

i'd opinions if plan worthwhile or not. have existing site, , elements have css class defined. thought append each element has class new class: <div class="existingclass"> would turn into: <div class="existingclass newclass"> then, if want override attributes in "existingclass", in "newclass" (because last class attributes taken?). figure way, nothing break, not risk because not removing "existingclass". any problems plan? first know in existingclass . write newclass in such manner won't break layout. knowing in existingclass use tools firebug save time.

node.js - Sanitizing data before saving to Mongoose -

i trying create pre handler sanitizes data before written mongodb see: http://mongoosejs.com/docs/middleware.html i've tried following each property able sanitize it: blogschema.pre('save', function (next) { var obj = this; console.log(obj)//-> https://gist.github.com/daslicht/70e0501acd6c345df8c2 // i've tried following single items : object.keys(obj).foreach(function (key) { console.log('keys: ',obj[key]); }); //and: for(var key in obj) { console.log(obj[key]) } //and: _.each( self , function(value, key, list){ console.log('value:',key); }) next(); }) any of above approaches results following: thats output of: for(var key in obj) { console.log(obj[key]) } https://gist.github.com/daslicht/cb855f53d86062570a96 any know how each single property can sanitize it, please? ~marc [ed

select - MySql variable sequential calculation with group by do not work properly -

a table following , query give desired result. select col1, col2, col3, @a:=@a+(col2+col3) col4 test join (select @a:=0)t col1 | col2 | col3 | col4 ------------------------- | 1 | 1 | 2 b | 2 | 0 | 4 c | 3 | 0 | 7 | 0 | 2 | 9 but when use group not work properly. have solution? select col1, sum(col2)col2, sum(col3)col3, @a:=@a+sum(col2+col3) col4 test join (select @a:= 0)t group col1 col1 | col2 | col3 | col4 ------------------------- | 1 | 3 | 4 b | 2 | 0 | 2 << 6 c | 3 | 0 | 3 << 9 first row fetched correctly. row2 , row3 did not calculate previous row col4 value previous example. can not understand problem! try code, worked me :) select col1, col2,col3, @a:=@a+(col2+col3) col4 (select col1,sum(col2)col2,sum(col3)col3 test group col1) tes join (select @a:= 0)t i made fiddle : http://sqlfiddle.com/#!2/9b3ac/44 hope helps ;)

php - Not having any luck with preg_match -

im trying parse url last 2 / sections. need address (can that) , number(second section {ie:08078612,08248595} unless @ last , no address present {last url list example} {ie: 8274180}) optionally need last 3 digits of second numbers section.{ie 612,595,180} im not having luck heres code far. $url_list[] = $url; if(preg_match("/[0-9]/",substr(strrchr($url, '/'), 1))) { $url_list_mls[]= substr(strrchr($url, '/'), 2); $url_list_mls_last3[] = substr(strrchr($url, '/'), -3); } else { $url_list_mls[]= substr(strrchr($url, '/'), 1); $url_list_mls_last3[] = substr(strrchr($url, '/'), -3); } $url_list_addy[]= substr(strrchr($url, '/'), 1); example urls (part of full url endings examples) /a019/08078612/214-n-crest-avenue /a019/08248595/111-n-elroy-avenue /a019/8274180 im trying make 3 lists, address (last section) number (second section) , last 3 numbers of second section number. the original code

visual studio - TFS will not accept changes I've made to a Java project -

i using tfs's team explorer manage visual studio projects. recently, i've created new java project (not in visual studio) manually added tfs using source control control explorer in visual studio. after added java project tfs, made changes , bug fixes. then, went visual studio , opened source control explorer check in changes, tfs thinks no changes made. it seems needed check out project before making changes. guess erroneously expected tfs track automatically, okay. so, using source control explorer in tfs, checked out project, , tried check in pending changes. when tried check in, got following message: all of changes either unmodified files or locks. changes have been undone server. is there way convince server indeed project has changed? how can check in changes have made? thank help.

java - How to Configure JAXRS and Spring With Annotations -

i working on little spring web service project. here example route: package com.example.api; import javax.ws.rs.get; import javax.ws.rs.path; import javax.ws.rs.produces; import javax.ws.rs.pathparam; import javax.ws.rs.ext.provider; import javax.ws.rs.core.mediatype; @provider public class webserviceroutes { @get @path("/hello") public string health() { return "hello"; } } then in spring configuration class: package com.example.api; import org.springframework.context.annotation.bean; import org.springframework.context.annotation.configuration; @configuration public class springcontextconfiguration { @bean( destroymethod = "shutdown" ) public springbus cxf() { return new springbus(); } @bean public webserviceroutes webserviceroutes() { return new webserviceroutes(); } } and in web.xml: <?xml version="1.0" encoding="utf-8"?> <web-app version=&

php - How can I print all values in group option? -

i couldn't find. i've read , done of these: http://docs.mongodb.org/manual/reference/aggregation/ , these: http://php.net/manual/en/mongocollection.aggregate.php but couldn't make happen. i'm trying learn, complicated. mongodb complicated. this code: $hg = $collection_iddaa->aggregate(array( array('$project'=> array( 'lig_adi'=>1, 'ulke_adi'=>1, 'ulke_kisa'=>1, 'hometeam'=>1, 'awayteam'=>1, 'homegol'=>1, 'awaygol'=>1, 'baslangic'=>1, 'status'=>1, 'ptime'=>1 ) ), array( '$group' => array( '_id' => array('lig_adi'=>'$lig_adi', 'ulke_adi'=>'$ulke_adi'), "ulke_kisa" => array('$addtoset' => &

c - Strange behavior after fseek() has worked -

Image
i've came across strange behavior. while debugging, when while -loop loops @ first time: after going though /* "data-url" */ , /* "data-author" */ parts of code have next result in debugging windows -> watches : (i'm using code::blocks ide, ubuntu 13.04) the length of dataurl_tempstring 8 bytes, length of dataauthor_tempstring 11 bytes, length of dataname_tempstring 9 bytes... but after going through /* data-name */ part of code have the result confuses me: now not of size 8, 11 , 9 bytes! what matter? could me finding reason of such behavior? here code of function: int substring_search(char *fnamenew, char *strurl, char *strauthor, char *strname) { file *fp; file *ofp_erase; file *ofp; char ch_buf; int count = 0; char dataurl[8] = ""; char dataauthor[11] = ""; char dataname[9] = ""; char *dataurl_tempstring = &dataurl[0]; char *dataauthor_temp

Google Chrome Extension not working in canary 31.0.1605.1 canary aura -

i looked on getting started: building chrome extension page, , couldn't one-click kittens extension work on version of canary (31.0.1605.1 canary aura). if right click on , click on "inspect popup", extension shows developer window, won't work if click on it. it works in chrome dev version 30.0.1568.2, though. i downloaded files website. is problem code, google chrome canary, or else? thanks.

graph - Bell chart with PHP -

i looking way create bell curve in php. have tried jpgraph, , lined scatter graph, have no idea how align bell curve. honestly i've never used bell curve , i've got make 1 takes 3 inputs charity organization, have no idea how work, appreciated. i have quite understanding of php , if possibly paste code, find way understand it. simple bell curve for ($x = -m_pi; $x <= m_pi; $x += (m_pi / 20)) { echo sprintf('%+01.2f => %01.8f' . php_eol, $x, (cos($x) + 1) / 2); } but please explain 3 inputs: expected gaussian curve, mean, standard deviation , x value. bell curve special case of gaussian mean of 0 , standard deviation of 1, x value variable.

.htaccess - htaccess non www to www and remove subdomain www -

so i've got following rewrite code in htaccess rewriteengine on rewritecond %{http_host} ^[^.]+\.[^.]+$ rewriterule ^(.*)$ http://www.%{http_host}/$1 [l,r=301] // rewriteengine on rewritecond %{http_host} ^www\.([^\.]*)\.domain\.com$ [nc] rewriterule (.*) http://%1.domain.com$1 [r=301,l] works perfect redirecting non-www www domains. i've got subdomain, lets call ' sub.domain.com ' works find. if goto www.sub.domain.com , redirecting ' sub.domain.com/sub/ ' having idea why? none of rules have in question routes requests subdomain's folder. /sub/ should never there if wasn't in request. that said, of redirect rules need come before routing rules. routing rules being stuff internally routes requests other uri's, example: rewritecond %{http_host} ([^\.]*)\.domain\.com$ [nc] rewriterule (.*) /%1/$1 [l] that rule internall routes folder named same thing subdomain. if rule before redirect, both rules applied , redirected uri be

Move cursor to specific point on screen using ncurses c++ (Linux) -

i'd move cursor specific point on screen, can move logical point, cursor stay static on position. how work in c++ using ncurses ? obs.: i've tried use move(y, x); doesn't works from move(y,x) man page : this routine not move physical cursor of terminal until refresh called. did call refresh() after calling move(y,x)

python - Searching string for different substrings -

i have string. need know if of following substrings appear in string. so, if have: thing_name = "visa assessments" i've been doing searches with: any((_ in thing_name _ in ['assessments','kilobyte','international'])) i'm going through long list of thing_name items, , don't need filter, exactly, check number of substrings. is best way this? feels wrong, can't think of more efficient way pull off. you can try re.search see if faster. along lines of import re pattern = re.compile('|'.join(['assessments','kilobyte','international'])) ismatch = (pattern.search(thing_name) != none)

php - Sort Multidimensional array by a defined order -

this question has answer here: how can sort arrays , data in php? 7 answers i have example array, , sort each first level item ( 66000 , 66001 , 66002 ) in order: new store first in list, store relocation second in list, , didn't include underperforming stores in example array, last. need sorted open date how can sort them way? i believe need use usort accomplish this, don't understand usort function, can this? here function far... usort($mainpgarr, function($a, $b){ }); example original array: array( [66000] => array( [january] => array( [status] => new store [sales] => 100.00 [open] => 2013-05-01 ) [february] => array( [status] => new store [sales] => 200.00 [open] => 2013-05-01 ) [march] => array

localization - Translate open graph Facebook API with gender variations -

i'm trying translate custom open graph action. the problem in portuguese variation in sentence according "gender" of object in question. looked in documentation , saw can translate differently according "gender", did not find how tell gender of object facebook. i tried in various ways, creating field in object, sending information without field, none of ways facebook api identified, entering condition if gender had not been informed, know how solve question? i had same problem translating "male" or "female" value native language. solution this: var getfacebookdata = function(){ fb.api('/me?fields=gender,',function(response){ if (response.gender === 'male'){ var genero = 'hombre'; // change "male" value other } else { // "female" value other var genero = 'mujer'; }; $('#some_div_id').text('sexo: '+ genero); })}; i hope helps, greetings.

asp.net mvc 4 - HTML.ActionLink querystring param not passed to method -

examining code, don't see why fails. primary controller's index method looks this: public actionresult index(int appeventid = -1) there isn't querystring param, there's need route main page , pass particular id auto-display. default value of -1 indicates should display normally. works fine normally. in page, razor code generates valid hyperlink: @html.actionlink("back main", "index", "maincontroller", new { appeventid = -9 }, new { }) // things renamed protect innocent! when testing locally works charm. controller index method detects -9 particular value , specific case. however, when deployed on web server, application in subfolder, not root. works fine, in above case, generates url this: http://server/appsubfolder/?appeventid=-9 and above url looks correct, controller's index method not passed -9. is there limitation mvc app cannot deployed subfolder? i'm not 1 decided deploy way, i'm trying make sens

vb.net - Common class to few forms -

i find nice code making form semi transparent while moving. have multiproject solution 1 project common other , compiles dll referenced projects. code making form semitransparent needed few forms in every project not forms. i have problem on , how use code used forms. code: imports system.componentmodel public class clstransform inherits system.windows.forms.form private _opacityresize double = 0.5 private _opacitymove double = 0.5 private _opacityoriginal double private const wm_nclbuttondown long = &ha1 private const wm_nclbuttonup long = &ha0 private const wm_moving long = &h216 private const wm_size long = &h5 protected overrides sub defwndproc(byref m system.windows.forms.message) static lbuttondown boolean if clng(m.msg) = wm_nclbuttondown lbuttondown = true elseif clng(m.msg) = wm_nclbuttonup lbuttondown = false end if if lbuttondown if clng(m.msg) = wm_moving if me.opacity <> _opacitymove

php - Laravel4 duplicate / copy table row -

i'm sure there has quicker way following. wasn't able find how save laravel modal object new row without overwriting existing item. essentially, simpler of existing code: $olditem = item::find(1); $newitem = new item; $newitem->key = $olditem ->key; $newitem->name = $olditem ->name; $newitem->path = $olditem ->path; $newitem->save(); instead, copying id of row: $olditem = item::find(1); $newitem = $olditem; unset($newitem->id); $newitem->save(); you can try $newitem = item::find(1)->replicate()->save();

Encrypt data block with C/C++, platform independent -

say, if have byte array of various length , pass-phrase, quickest way encrypt in platform-independent way? ps. can make sha1 digest on pass-phrase how apply byte array -- doing simple repeated xor makes obvious. ps2. sorry, crypto guys, if i"m asking obvious stuff... a hash (like sha1) create one-way result, cannot decrypt hash. xoring data not secure means, don't that. if need able decrypt data, suggest using twofish uses symmetric key block cipher , not restricted licensing or patents (thus can find platform independent reference code).

Magento CE 1.7.0.2 - Unable to log in to admin panel with Chrome -

i'm having unusual issue , doesn't seem related other posts i've found. i'm logging magento install have setup through mamp on local. doesn't "invalid password" or of nature, refreshes itself. i've tried modifying .htaccess , posting magento forum nothing. hit "submit" , seems refresh page. redirect issue? works fine on firefox reason chrome won't allow access. this because of how chrome handles cookies , can happen on production sites local installs. fastest fix log db (with phpmyadmin, mysql workbench, whatever), go table core_config_data , find column labeled "path" entry matches "web/cookie/cookie_httponly" - should closer end. you'll need set value column null. clear cache /var folder , should good. some sites tell modify varien.php - i've tried , can end log file can grow 2gb or more because commented out fields magento references every time pull data cookie. not good. let me know if work

html - margin-top not working with margin: 0 auto -

i have relative positioned div want horizontal center. want @ height in middle of page. css below, put in middle horizontally not apply margin-top it position:relative; margin: 0 auto; text-align:center; color:white; opacity:0.75; margin-top:30px; what wrong?? give whirl ;) css: .info { width: 300px; height: 40px; position:absolute; top: 0; left: 0; right: 0; bottom: 0; margin: auto; text-align:center; color:white; opacity:0.75; background-color: #000; /*-- specify liking on background color --*/ line-height: 40px; vertical-align: middle; } html: <div> <div class="inner">post text here</div> </div> is seeking? here jsfiddle: http://jsfiddle.net/s5py5/7/ update: updated demo

c++ - specializing a template on bool + integral + floating-point return types -

i'd write function template returns random variable of various types (bool, char, short, int, float, double, along unsigned versions of these). i couldn't see how using latest c++11 standard library, since need use either uniform_int_distribution or uniform_real_distribution. thought specialize template: template<typename t> t randomprimitive() { std::uniform_int_distribution<t> dst; std::mt19937 rng; return dst(rng); } template<> bool randomprimitive<bool>() { std::uniform_int_distribution<signed char> dst; std::mt19937 rng; return dst(rng) >= 0 ? true : false; } template<typename t> typename std::enable_if<std::is_floating_point<t>::value, t>::type randomprimitive() { std::uniform_real_distribution<t> dst; std::mt19937 rng; return dst(rng); } under visual studio 2012 update 3, gives: error c2668: '`anonymous-namespace'::randomprimitive' : ambiguous call overloaded function when try compile:

php - Magento get option id for specified attribute set and value -

i've been searching hours , haven't found solution problem. need option id configurable product. current informations have sku, attribute set id , option label. how can fetch option id using these values? many can me. ** update ** here's sample of database table eav_attribute_option_value (from wich i'm guessing magento take value id) value_id option_id store_id value 729141 57 0 rose 729142 57 3 rose 729143 57 1 pink 728847 749 0 pink 728848 749 3 pink 728849 749 1 pink i need value id 57. when locale in french, right value. when switch english, id 749, attribute set. if want fetch option id : $productmodel = mage::getmodel('catalog/product')->load('1234', 'sku'); $attr = $productmodel->getresource()->getattribute("color"); if ($attr->usessource()) { echo $color_id = $attr->getsource()->get

iphone - UIImageView filter image into solid color -

i have colored icons transparent backgrounds. automatically able show flat versions of (solid color gray) depending on state of program. could core image filters? there way? i think i've did same thing before, have colored icon, needs keep shape , change color mono color. write extension uiimage. here code, hope you. uiimage+monoimage.h // // uiimage+monoimage.h // shiftscheduler // // created zhang jiejing on 12-2-11. // copyright (c) 2012. rights reserved. // #import <uikit/uikit.h> @interface uiimage (monoimage) // function create image context , draw image mask // clip context mask // fill color user choosed. // can create image shape specify color icon. + (uiimage *) generatemonoimage: (uiimage *)icon withcolor:(uicolor *)color; @end uiimage+monoimage.m // // uiimage+monoimage.m // shiftscheduler // // created jiejing zhang on 12-2-11. // copyright (c) 2012. rights reserved. // #import "uiimage+monoimage.h" @implementation

background - How add entitlement via ldid -

i have problems. want use in app next function: int sbslaunchapplicationwithidentifier(cfstringref displayidentifier, boolean suspended); i add springboardservices.framework in project i add url schemes app created file entitlement.xml with <?xml version="1.0" encoding="utf-8"?> <!doctype plist public "-//apple//dtd plist 1.0//en" "apple.com/dtds/propertylist-1.0.dtd"> <plist version="1.0"> <dict> <key>com.apple.springboard.launchapplications</key> <true/> </dict> </plist> paste entitlement.xml in `developer/xcode/deriveddata/myapp-efjwoxgwdyixnfassijmwtptxvlj/build/products/debug-iphoneos/ paste ldid in developer/xcode/deriveddata/myapp-efjwoxgwdyixnfassijmwtptxvlj/build/products/debug-iphoneos/ did ./ldid -sentitlement.xml myapp.app/myapp in console. it's working but saw problem: i did ./ldid -e myapp.app/myapp , saw next in console(double

MS Access VBA How to I supress the "Do you want to save changes" dialog for excel row deletes? -

similar question in ms access vba how delete row in excel however, problem excel asks "do want save changes made ...?" there way force saving of changes , disable message box? try docmd.setwarnings false, not work. you'll need add following code thisworkbook private sub workbook_beforeclose(cancel boolean) thisworkbook.save end sub if you're running vba in access , accessing excel object, save workbook (e.g. xlapp.thisworkbook.save ) in code before closing

mysql - Display an image from the database in Django? -

i have read db don't have ability change. know extremely inefficient store images in database. don't have control on one. need display image field in database. how can in django? retrieve image database binary, write directly http response content (with stringio?), set relevant image mimetype/header don't forget set content length in response. experiement 'streaming' if images huge. https://docs.djangoproject.com/en/1.5/ref/request-response/#httpresponse-objects

python - PySDL2 issue with SDL_Surface / LP_SDL_Surface -

im running win7 python 3.3 , pysdl2 0.5. when creating surfaces (no matter method) lp_sdl_surface instead of sdl_surface. lp_sdl_surface lacks of methods , attribute expect have. here issue using example code documentation : import os os.environ["pysdl2_dll_path"] = os.path.dirname(os.path.abspath(__file__)) import sys import ctypes sdl2 import * def main(): sdl_init(sdl_init_video) window = sdl_createwindow(b"hello world", sdl_windowpos_centered, sdl_windowpos_centered, 592, 460, sdl_window_shown) windowsurface = sdl_getwindowsurface(window) image = sdl_loadbmp(b"exampleimage.bmp") sdl_blitsurface(image, none, windowsurface, none) print(image.h) sdl_updatewindowsurface(window) sdl_freesurface(image) running = true event = sdl_event() while running: while sdl_pollevent(ctypes.byref(event)) != 0: if event.type == sdl_quit:

html - :before pseudo element overlaping edge of screen/browser -

the pseudo-element created :before seems overlap edge of screen. fiddling left doesn't fix it, , overlap edge of container element if place within 1 , move element. .hex:before { content: " "; position: absolute; height: 0px; width: 0px; float: left; border-right: 30px solid #6c6; border-top: 52px solid transparent; border-bottom: 52px solid transparent; left: -30px; } .hex { position: relative; float: left; width: 60px; height: 104px; background-color: #6c6; } .hex:after { content: " "; position: absolute; float: left; border-left: 30px solid #6c6; border-top: 52px solid transparent; border-bottom: 52px solid transparent; right: -30px; } below trivial html: <div class='board'> <div class="hex"></div> </div> you need offset main element, can either use left: 30px; or margin-left:30px inside .hex demo fid

ios - Animation when drawing with CGContext -

my question how animate drawing process when drawing cgcontextref . possible? assuming is, how? i have 2 code snippets animate. first 1 draws progress bar , second 1 draws simple line chart. drawing done inside subclass of uiview . progress bar nice , easy. want sort of draw out left. pretty sure require using other uirectfill dont know how accomplish it. - (void)drawprogressline { [bgcolor set]; uirectfill(self.bounds); [graphcolor set]; uirectfill(cgrectmake(0, 0, self.frame.size.width / 100 * [[items objectatindex:0] floatvalue], self.frame.size.height)); } the line chart bit more complex. really start drawing left line line completing towards right if how can fade in? code: - (void)drawlinechart { [bgcolor set]; uirectfill(self.bounds); [graphcolor set]; if (items.count < 2) return; cgrect bounds = cgrectmake(0, 50, self.bounds.size.width, self.bounds.size.height - 100); float max = -1; (graphitem *item in items)

What is Hudson doing with my Python script? -

i developing python script (here after script) searches through large log files search string. in normal use, called hudson front end. about hudson interface: hudson job creates temporary batch file on connected virtual machine (vm) calls script , passes parameters. have had hundreds of successful instances using setup, creating error. about script: log files contained in dozens of compressed .tgz files. script searches each log in each .tgz file. 1 of command line args script accepts true/false parameter called process_in_parallel . if process_in_parallel set true , each .tgz file searched in own thread (using multiprocessing module). if process_in_parallel set false , each .tgz file searched in sequence (using loop). what works: i have batch file on vm use testing script. can use .bat call script process_in_parallel set either (1a) true or (1b) false . of course, runs faster when true (about 4x faster). have quadruple-checked .bat passes same parameters

python - Passing list Between Functions -

i have code below change globals. of have read has said stay away globals... in example below want use "make_lists" print in "print_list" clear list. use globals this, suggestions on how avoid globals? i know add in 1 function, part of bigger function part having problems with. thank in advance. x_lst = [] def make_lists(): global x_lst x_lst.append("hello") def print_list(): global x_lst in x_lst: print(i) x_lst = [] def main(): make_lists() print_list() if __name__ =="__main__": main() to avoid using global, have use return keyword in function declaration return value, newly created list in our case. have use arguments in function declaration, placeholders of values in function. reason why don't need global value because passing list 1 function another. def make_lists(): return ['hello'] # creating list single value, # , return def print_

html - Does W3C allow <h#> elements to be display:inline;? -

doing code review, noticed heading using <span> tags instead of headings, suggested using <h4> tag, gain semantic benefits. context website footer, there various lists of links under different headings. <span>category 1 links</span> <ul> <li>link 1 in footer</li> <li>link 2 in footer</li> <li>link 3 in footer</li> <li>link 4 in footer</li> <li>link 5 in footer</li> </ul> the counterargument <h4> "block-level" element, whereas inline element needed. therefore didn't think element should changed. (and yes, knows css , familiar display: inline; property.) that sounds absolutely insane me--goes against thought best practice: separation of content , presentation, semantic web, purposes of html , css... yet in trying formulate response, came across this section in html 4.01 spec: certain html elements may appear in body said "block

asp.net - Ajax.Beginform + Partial view + Model state are not working together -

i have following create action method inside asp .net mvc :- public actionresult createvmnetwork(int vmid) { vmassignips vmips = new vmassignips() { technologyip = new technologyip() { technologyid = vmid}, istmsipunique = true, istmsmacunique = true }; return partialview("_createvmnetwork",vmips); } which render following partial view:- @model tms.viewmodels.vmassignips @using (ajax.beginform("createvmnetwork", "virtualmachine", new ajaxoptions { insertionmode = insertionmode.insertafter, updatetargetid = "networktable", loadingelementid = "loadingimag", httpmethod= "post" })) { @html.validationsummary(true) @html.hiddenfor(model=>model.technologyip.technologyid) <div> <span class="f">ip address&l

angularjs - how to deploy a yeoman build to aws node.js -

i'm new yeoman , trying basic yeoman generated angularjs site deployed elastic beanstalk. @ moment when deploy receive 502: bad gateway. able deploy simple nodejs app aws like server.js var http = require("http"); http.createserver(function(request, response) { response.writehead(200, {"content-type": "text/plain"}); response.write("hello world"); response.end(); }).listen(process.env.port || 8888); without specifying port in url, page works fine. not sure if relevant issue. the process using yeoman angular generator pretty standard ie. yo angular yo angular:controller testcontroller ..add directives / views etc.. grunt server -- serves pages correctly on port 9000 grunt -- creates dist folder at stage have working angularjs app locally, here follow same workflow deployed earlier hello world sample correctly ( commit git repo, provision image elastic beanstalk cli..etc..). made repo based on contents of /dist folder , deploye

ios - sqlite 3 "SQL error 'out of memory' (7)" objc -

hi can point out i'm doing wrong please? error this: sql error 'out of memory' (7) - (nsarray *)recipeinfo { nsmutablearray *retval = [[nsmutablearray alloc] init]; nsstring *query = [nsstring stringwithformat:@"select key, name recipes type = \'%@\'", self.recipetype]; nslog(query); sqlite3_stmt *statement; if (sqlite3_prepare_v2(_database, [query utf8string], -1, &statement, null) != sqlite_ok) { nslog(@"[sqlite] error when preparing query!"); nslog(@"%s sql error '%s' (%1d)", __function__, sqlite3_errmsg(_database), sqlite3_errcode(_database)); } else { while (sqlite3_step(statement) == sqlite_row) { int uniqueid = sqlite3_column_int(statement, 0); char *namechars = (char *) sqlite3_column_text(statement, 1); nsstring *name = [[nsstring alloc] initwithutf8string:namechars]; recipeinfo *info = [[recipeinfo alloc]

Client-sided password generator (Javascript) -

Image
i've stumbled upon desktop project (in particular executable program) generating random strings of data constantly/repetitively/continuously. here preview of below: however, i'd code within javascript. since idea pretty perplex, cannot start nothing , hoping if here has developed similar or has notion how go doing in javascript give me information or other resources, maybe jquery plugins or whatever. thank in advance! this not particularly hard, except javascript's math.random not high-quality source of random numbers. might @ of released implementations of web cryptography api ideas of how improve on that. once have that, converting stream of random numbers different formats should straightforward, , using mouse movements add entropy should not difficult. which parts strike particularly difficult? update : i posted partial version on jsfiddle . shows how field continually updated , frozen. doesn't cryptography. still need convert mouse

how to Disable All controls on the Silverlight Page -

i using silverlight in siverlight page want disable controls. i want disable entire page instead disabling individual control. setting isenabled property false of parent control should disable child controls. http://msdn.microsoft.com/en-us/library/system.windows.controls.control.isenabled(v=vs.95).aspx

Spring Config file -

i using spring 3.1.0 version. getting error while deployment due dispatcher-servlet.xml. here code using: <?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://www.springframework.org/schema/beans/spring-beans-3.1.xsd"> <context:component-scan base-package="com.mycompany.cart" /> <bean class="org.springframework.web.servlet.view.internalresourceviewresolver"> <property name="prefix"> <value>/web-inf/pages/</value> </property> <property name="suffix"> <value>.jsp</value> </property> </bean> </beans> error : error occurred during deployment: exception while loading app : java.lang.illegalstatee

cgpoint - I'm Having Problems with NSTimer in Xcode -

im making simple game on xcode , decided use nstimer in .m xcode found 3 problems code says assigning 'cgpoint' (aka 'struct cgpoint') in compatable 'int' twice , says use of undeclared game loop. great @implementation viewcontroller @synthesize bg, rock, platform1, platform2, platform3, platform4, platform5, platform6, platform7; @synthesize gamestate; @synthesize rockvelocity, gravity; // implement viewdidload additional setup after loading view, typically nib. - (void)viewdidload { [super viewdidload]; gamestate = kstaterunning; rockvelocity = cgpointmake (0, 0); gravity = cgpointmake (0, kgravity); [nstimer scheduledtimerwithtimeinterval: 1.0/60 target:self selector:@selector(gameloop) userinfo:nil repeats:yes]; - (void)gameloop { if (gamestate == kstaterunning) { [self gamestateplaynormal]; } else if (gamestate == kstategameover) { } } you need cgpointmake (0, 0); need make sure declare gameloop functio

javascript - Using custom attribute jQuery selectors with dropdown select (take 2) -

this issue making me want smash computer. have form, want calculate values selections on form. have 2 jsfiddles here, want have can make selections, calculate on click. can't form work on click. other fiddle uses on change , keyup functions. there issue on form well. if change first select "option 2", you'll see value select ends being "1.379999999996" instead of "1.38". why happening? fiddle click function js: $('#submit').click(function(){ var price=$(this).find("option:selected").attr('data-price'); var ink=$('#ink').val(); var loc1=$('#loc1').val(); var res= price*1 + ink*1 + loc1*1 ; $('#bleh').val( res || 0 ); }); fiddle change , keyup functions js: $('#ink, #loc1, .sel').on('keyup change',function(){ var price=$('option:selected', this).attr('data-price'); var ink=$('#ink').val(); var loc1=$('

java - Edit a specific cell in JTable on enter key and show the cursor -

i have added keylistner jtable on frame. on kepressed have code if (ke.getkeycode()==10) { int rowindex = jtable2.getselectedrow(); int colindex = jtable2.getselectedcolumn(); jtable2.editcellat(rowindex, colindex); ke.consume(); this edit cell cursor not shown till click on mouse do not use keylistener! swing designed use key bindings (see swing tutorial on how use key bindings ). bind action keystroke. by default: the enter key move cell selection next row the f2 key place cell in edit mode so want replace default action of enter key action of f2 key. done using key bindings: inputmap im = table.getinputmap(jtable.when_ancestor_of_focused_component); keystroke enter = keystroke.getkeystroke(keyevent.vk_enter, 0); keystroke f2 = keystroke.getkeystroke(keyevent.vk_f2, 0); im.put(enter, im.get(f2)); also, check out key bindings list of default bindings swing components.

How to Implement Google Map Tile Provider in android? -

i working on custom map app , want use google map tiles background ? there 1 class tileprovider in api don't know how initialize every time try goes ? tileprovider tileprovider=new tileprovider() { @override public tile gettile(int i, int i2, int i3) { return null; //to change body of implemented methods use file | settings | file templates. } }; how override gettile function tiles google map server? example appreciated ?i know gettile function need x,y , zoom value return tile. so quick answer can google map tiles following url: http://mt1.google.com/vt/lyrs={t}&x={x}&y={y}&z={z} where {t} type of map (satellite, road, hybrid, etc) , other attributes specifying coordinates , zoom level. the possible values {t} follows: default - m roads - h roads simplified - r satellite - s satellite hybrid - y terrain - t terrain hybrid - p that being said want make sure you're doing not violation of t

android - Andengine Anchor Center: Screen Capture is flipped vertically -

i using anchor center branch of andengine gles2. when make screen capture, file saves has image flipped vertically. know how either fix this, or how flip bitmap vertically? i assuming because in branch origin point (0,0) @ bottom left, rather top left. under hood using gl20.drawpixels(), if helps any. thanks help, in advance.

asp.net - How can we filter text from array -

i have array return data in size 3,6,9,12,15.. (multiplication of 3) datatable dt = new datatable(); string griddata = viewstate["showitem"].tostring(); string[] filterdata = griddata.split('^'); above array return data like.. filterdata [0] = "pizza"; (item) filterdata [1] = "2$"; (price) filterdata [2] = "2"; (quantity) filterdata [3] = "burger"; filterdata [4] = "5$"; filterdata [5] = "1"; filterdata [6] = "cesa"; filterdata [7] = "7$"; filterdata [8] = "3"; want enter above data column wise in database like: item price quantity total(price*quantity) now want run loop add data of particular field like: for (int nindex = 0; nindex < filterdata.length; nindex++) { datarow drow = dt.newrow(); drow["productitem"] = filterdata[nindex].tostring(); (add item) drow["cost"] = filterdata[nindex].tostring();

Row level locking not working as expected in rails/mysql -

i have following relation parent has_many children child belongs_to parent and following code block activerecord::base.connection.transaction lock_acquired = true if child.parent.lock! , child.parent.status == 1 child.parent.update_attributes(:status => 2) else lock_acquired = false end if lock_acquired # other code follows here end end the above code block making sure 1 of children able change parent status @ time , hence lock! method , status check expression. somehow broken. though parent status changed 2 1 of children, child somehow able pass through if statement. there multiple processes running of course thought lock take care of that. looks lock given before transaction block completed. may lock works differently expected. insights helpful. thanks. i'm not quite sure why updated code wouldn't work, there 1 odd thing it: you're using lock! though returns true/false value, can ever return model instance (if lock a

iphone - Why the revmob ads flickering? -

i have integrated revmob sdk in application full screen ads shown when clicked cross button ads become flickering please help. well seems issue revmob ad's servers. backend problem occurs when data isn't coming correctly. if have implemented ad framework correctly following tutorial provided(which relatively easy implement) there no issue on development side. put question forums , they'll you. hope helps.

android - How to create a release signed apk file using Gradle? -

i have gradle build create release signed apk file using gradle. i'm not sure if code correct or if i'm missing parameter when doing gradle build ? this of code in gradle file: android { ... signingconfigs { release { storefile file("release.keystore") storepassword "******" keyalias "******" keypassword "******" } } } the gradle build finishes successful, , in build/apk folder see ...-release-unsigned.apk , ...-debug-unaligned.apk files. any suggestions on how solve this? easier way previous answers: put ~/.gradle/gradle.properties release_store_file={path keystore} release_store_password=***** release_key_alias=***** release_key_password=***** modify build.gradle this: ... signingconfigs { release { storefile file(release_store_file) storepassword release_store_password keyalias release_

Does facebook open graph's fb:explicitly_shared require approval even for developer? -

fb:explicitly_shared=true, image[0][user_generated]=true, expected action display full size image in timeline , small story in activity feed. instead, small (with smallest thumbnail possible) in activity feed. nothing in timeline. the documentation unclear. documentation states regarding user_generated: while might seem appealing use user_generated photos, there criteria must met in order maintain user experience, , app approved capability used people not developers or testers of app this not specify whether 1) post /me/namespace:action succeed without error developers still not display in timeline or 2) post /me/namespace:action should behave in every way if "user generated" approved (for posts on behalf of developers) i have same question fb:explicitly_shared . cannot determine whether behavior unexpected because expected behavior isn't clear in documentation. following examples documented variations on in meta tags , data posted /me/namespace:act

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

the current version of mozilla firefox 23.0.1, version not support play mp3 shoutcast streams tcp port different 80 (most common 8000 shoutcast 1.9.8). i use flash when mp3 support not available in html5 audio, way detect is: try{ var = document.createelement('audio'); r = !!(a.canplaytype && !!a.canplaytype("audio/mpeg; codecs=mp3").replace(/^no$/,'')) }catch(e){ r = false; } the support mp3 shoutcast streams in firefox added in version 24 . a.canplaytype("audio/mpeg; codecs=mp3") = in chrome , firefox, chrome support, firefox not support, due current code detect not work firefox. the current version of jquery support ie 6 1.10.2, version not has .browser i think "stylized" way testing features , not querying browsers / versions, notwithstanding here see hard not violate "principle". what "stylized" way of detect mp3 icy support without navigator.useragent in firefox? ther

PHP: user declared variable overwrites variable in $GLOBALS -

i declared variable ($bonus) in code , assigned value it. after this, $globals['bonus'] contains same value. why happen? that's way $globals works in php http://php.net/manual/fr/reserved.variables.globals.php

openstreetmap - GeoJSON + OpenLayers + OSM -

this basic example, modified openlayers website. when use wms (r2 commented, r3 uncommented) works. when use osm (r2 uncommented, r2 commented) wont work. i want use osm, missing here? var map = new openlayers.map('map'); //osmlayer = new openlayers.layer.osm(); osmlayer = new openlayers.layer.wms("openlayers wms", "http://vmap0.tiles.osgeo.org/wms/vmap0", {layers: 'basic'}); map.addlayer(osmlayer); map.setcenter(new openlayers.lonlat(10, 45), 6); var mygeojson = { "type": "featurecollection", "features": [ {"geometry":{ "type":"geometrycollection", "geometries":[ { "type":"linestring", "coordinates":