Posts

Showing posts from July, 2015

How would I split 'desandro masonry' columns by categories on a responsive wordpress layout -

i have created responsive 'pinterest style' layout on wordpress blog. tiles created the'featured images' functionality on admin side. when user adds featured image blog post, 'featured image' display on home page integrated responsive masonry layout. effect on homepage gallery of tiled images act blog post teasers. images have width of 100% within respective column , height of auto, retain aspect ratio. on mobile layout single column, on tablet layout 2 columns wide , on 900px layout 3 columns wide. bssically works example http://tympanus.net/development/gridloadingeffects/index2.html 'featured images' link through post. i have 2 categories set on blog, let's , b. within layout described above ... on desktop view columns @ 33.3% first column on left populated category , remaining 2 populated category b , on mobile column single ... layout default masonry split, display alternate categories post thumbnails scroll down. does have idea on how a

Appcelerator / Titanium - Are Javascript variables polluting the global scope in controller files? -

i'm new appcelerator , titianium alloy, , wandering how global scope works in controller javascript files. it still best practice attach of variables single global object within these files? in lot of tutorials seems declaring variables quite common names right in file no closure of scope. put global variables , functions in app/alloy.js : alloy.globals.mymodule = require("mymodule"); alloy.globals.myfunction = function(e){ // logic function };

jsf 2 - I would like to know how I can make shorter the text box filter by columns in primefaces Datatable -

i know how can make shorter text box filter columns in primefaces datatable. columns this: <p:column style="width:10%" sortby="#{item.tipofacturautil.esmercantil}" filterby="#{item.tipofacturautil.esmercantil}" filtermatchmode="contains"> <f:facet name="header"> <h:outputtext value="mercantil"/> </f:facet> <h:outputtext value="#{(item.tipofacturautil.esmercantil) eq true ? 'si':'no'}"/> </p:column>

Can you force Facebook to recognize correct image without og: tags? -

i have website news articles posted through cms , there no option add facebook meta og tags <head> . add them manually <body> won't work assume? is there solution can tell facebook image should picked when using like/share buttons? this depends how make share. can use fb.ui request "post wall" can specify specifics of appears on share. https://developers.facebook.com/docs/reference/dialogs/feed/ if sharing url read meta tags state. have not tried making image first within html may make default. you can use link debug meta tags , test sharing if sharing url. https://developers.facebook.com/tools/debug/

c++ - How to use Box2D physics engine into an openCV project? -

i studying opencv , box2d , going diy game.this how works: first put in picture black thick lines, edge detection produce edge. then comes trouble, want use these edges "staticbody" in box2d engine can't find way "transform" edges body.actually edges going used walls in game, , there small virtual point represents motion ball. have control point , move destination.the opencv used processing image can draw map on paper , start game. i'm newbie on box2d way, how can do?

scala - Manifest error for anonymous type -

i still getting head around scala, trying figure out missing in below code. getting error message when try instantiate genericserializer anonymous type description resource path location type type mismatch; found : scala.reflect.manifest[object] required: scala.reflect.manifest[foldermgmtdao.this.anomovetype] note: object >: foldermgmtdao.this.anomovetype, trait manifest invariant in type t. may wish investigate wildcard type such _ >: foldermgmtdao.this.anomovetype . (sls 3.2.10) foldermgmtdao.scala /somucore/src/somu/core line 20 scala problem below code object genericserializer { def apply[t <:anyref:manifest]() = new genericserializer[t]() } class genericserializer[t <:anyref:manifest] extends imongoserializer[t] {} //anonymous type creation , using genericserializer type anomovetype = { def folderpath:string } val szr = genericserializer[anomovetype] looks like it's not possible manifests. shoul

javascript - Angular.js best practice - extending controllers, overriding controller defaults -

here real-life angular problem can't wrap head around. love angular, issue bugging me lot right now. what best practice extend existing controllers's functions, , use extended controller on other page of application? in other words: how controller inheritance in angular? edited out - 23/09/2014, dont think description of original usecase helps visitors understand better i'm after here. think disctracts people real issue. after half year think understand what's going on. pointed out in comment post, simplest answer services. in optimal case, scope variables values gathered factory/service. still, might want use exact same controller 1 function: $scope.somefunction(){}, , keep rest. in case, have 'thin' controller logic, desirable controller design - may still end hundred or more lines of code. don't want being duplicated in other controller, because need controller logic (like $scope.somefunction() ) what do then? the answer this: m

c - Naming function pointers in the vtbl -

sorry beginner question. in article com in plain c read sentence: one requirement of com object first 3 members of our vtable (i.e., our iexamplevtbl struct) must called queryinterface, addref, , release. is true? what if change names, parameters, calling convention , return values same ? do still work this? if not why? many response. (positive or negative.) every com interface must derive iunknown. provides essential services: memory management (addref , release) , ability discover other interfaces implemented com object (queryinterface). v-table com interface therefore starts 3 function pointers implementation of these methods. actual names of functions or language written in not matter @ all, com cares function pointers. you can name implementation functions want. intentionally not using iunknown function names unwise.

sql - Concatenate variables which appear in the GROUP BY statement -

in database have dimensions of item stored separate columns (i.e. height , width). want pull report grouping 2 size dimensions , possibly concatenate them in results. for instance on result have in first column dimension showed "300x250". i'm using sql server 2008 r2. you want like: select concat(width, 'x', height) dimensions table group width, height

c# - Is there a way to apply [TestMethod] to all methods withing a class -

i getting hacked off having type [testmethod] @ top of each method in class. @ present have on 600 tests in project. there way can add attribute through , il weaver postsharp or fody? or can add 1 class attribute same? cheers the idea comes in mind me write own method attribute [classinitialize] run before tests execution. method implementation: using reflection go through methods in specific class , add attribute @ runtime. there no out of box solution problem.

javascript - Loading DAE in Three.js -

i have problem, can't load dae file in three.js. can please. i have model.dae in same directory index.html , when load page shows black screen. i had file fbx , exported maya fbx_dae <html> <head> <title>my first three.js app</title> <style>canvas { width: 100%; height: 100% }</style> </head> <body> <style type="text/css"> html, body { margin:0; padding: 0; } </style> <script src="js/three.min.js"></script> <script src="js/colladaloader.min.js"></script> <script> var scene = new three.scene(); var camera = new three.perspectivecamera( 75, window.innerwidth / window.innerheight, 0.1, 1000 ); var renderer = new three.webglrenderer(); renderer.setsize( window.innerwidth, window.innerheight ); document.body.appendchild( renderer.domelement );

jquery - How to add sidebar unscrolable -

how create sidebar unscrolabe lifehacker dot com? using css3 or jquery or what? i have searching in jquery plugins database , found nothing please help, thanks this can done position: fixed : .sidebar { position: fixed; top: 0px; left: 0px; } check jsfiddle .

Git automatically declaring subprojects as submodules? -

i had project in 'www' folder. in 'www/vendor', cloned other projects github. cloned them, never did make them submodules or subtrees. quite often, worked on these subprojects, contributed upstream, etc. had cd directory 'www/vendor/projectx' , use git commit there, , if independent projects. go 'www' , make commit there acknowledge changes in subprojects main project. great , simple. then moved 'www/vendor' 'www/php/vendor'. did git add php , committed change, , 'www/php/vendor/*' folders empty on remote server. on machine, files still here git status says there nothing commit. i don't know looks if subprojects had automatically been declared submodules when moved them. see no trace of it: no .gitmodule, nothing in modules folder. , when git rm : $ git rm php/vendor/projectx error: following submodule (or 1 of nested submodules) uses .git directory: php/vendor/projectx am missing or git bug? i'd go way

Printing a string with a class in C++? -

#ifndef date_h #define date_h #include <iostream> #include <iomanip> using namespace std; class date{ private: unsigned int day; unsigned int month; string monthname; unsigned int year; public: date(); void printnumeric() const; void printalpha() const; }; #endif my header file #include "date.h" #include <string> using namespace std; date::date(){ month = 1; monthname = "january"; day = 1; year = 1970; } void date::printnumeric() const{ cout << month << "/" << day << "/" << year; } void date::printalpha() const{ cout << date::monthname << " " << day << ", " << year; } and actual code. printnumeric function works fine according testbed printalpha not producing string month name. supposed monthname produce user input month name? remove date:: , should work

Difference between creating my asp.net MVC web application ,under the IIS Default web site, or create it as a new web site -

i have published asp.net mvc web application under “default web site” inside iis. added 2 versions of web application:- one directly under default website , can accessed typing http://servername one under presaging path , , can accessed typing http://servername/prestaging so got confused on approach recommend add asp.net web application, , difference between adding web application under default web site, or creating whole new web site ? thanks this has more organization within company's iis structure right , wrong. if site built site on server, putting on default site not looked down upon. but if application sub application of default site, latter approach more appropriate approach if access site //servername url. if have separate domain, myapp.servername.com, can install default iis site , add binding or create whole separate web site. has more structure right or wrong. edit answer comment, creating site under default web site make url in cases b

javascript - Use multiple canvas URLs in one Facebook app -

i trying host web app on different domains. receive errors like: given url not allowed application configuration.: 1 or more of given urls not allowed app's settings. must match website url or canvas url, or domain must subdomain of 1 of app's domains. however seems can set 1 canvas url , secure canvas url in facebook settings page. possible host web app on different domains? thank much! if can host single php file (although doesn't contain php @ all, javascript) on ssl host can it. wrote blog post on how did using 2 app sharing same canvas url. a ssl host mandatory work. shared certificates work. short story long in index.php file need to: var urlstring=document.referrer; var pagenamen = "?p="; //this specific first application var pagenamez = "?url=";// specific second application var indexn = urlstring.indexof(pagenamen);// , index. var indexz = urlstring.indexof(pagenamez);// , index. if(indexn != -1){ var resn = url

Sitecore create drop-down button in RTE populated from master database -

Image
i'm trying create drop-down button rich text editor (rte) in sitecore cannot figure out how implement this. similar 'insert snippet' command shown below, source of dropdown driven content master database instead of core items within html editor profile. the closest approach i've found article describes how add button opens dialog in rte . another option have save handler can create snippet items in core database based when items created/edited in area of master database. inherit sitecore.shell.controls.richtexteditor.editorconfiguration. if want add snippets standard snippets list, override setupsnippets method , add editor.snippets collection. if want add own dropdown, more complicated, can override setuptoolbars method , add editortoolgroup editordropdown. might want @ telerik's documentation radeditor if run problems. once have draft of class written, register going profile definition in core database under /sitecore/system/settings/html e

javascript - JQuery applying change for each select element in a div section -

i getting following error: typeerror: callback.call not function value = callback.call(obj[i], i, obj[i]); with following code: $("#pagingdetails select").each($(this).change(refreshsearchresults)); $("#peoplesearchfilter select").each($(this).change(refreshsearchresults)); $("#peoplesearchfilter input:checkbox").each($(this).click(refreshsearchresults)); where function refreshsearchresults makes ajax request server new search results based on search criteria or paging provided user through select , checkbox elements in the pagingdetails div , personsearchfilter div. what don't wrong? thanks, -frinny you not need loop stack, can bind on jquery object $("#pagingdetails select").change(refreshsearchresults); $("#peoplesearchfilter select").change(refreshsearchresults); $("#peoplesearchfilter input:checkbox").click(refreshsearchresults); also, documentation say, .each() need fun

unix - Decoding a man page -

i'm taking git man page example, have seen example use many places throughout unix/linux. under git man page, has following header: main porcelain commands underneath header, there lot of commands dashes between such as: git-clone since headed under commands assume means git-clone command (i know git clone [directory] valid. but appears isn't - why man page list git-clone being command? man pages are good, if can decode them right. on system says git-clone(1) . name of man page command not command itself. man git-clone gives: synopsis git clone [--template=<template_directory>] … showing space instead of dash.

forms - Rails Scaffold references with select input and Entity label with generators -

Image
i'm trying scaffold app rails 4 , had little issue foreing keys, forms , entity names. here details: rails g scaffold user_type name:string rails g scaffold user name:string pass:string user_type:references as can see there simple relationship 1:n between user_type , user . generates right scaffold on case. here image of form generated, but want result of generator next form, so first change want rails g scaffold generate, @ least e 1:n relationships select input. , i'm looking solution involves models label or something. need scaffold command generates this. witch means entity user_type has name attribute has "presentation label". i understand can create generator scratch, believe i'm missing options @ command line, because change tiny. and can come solution involves inserting right code in each crud i'm planning use 150 tables database. help? you can replace templates scaffold generator uses creating alternative templat

javascript - Get values of Input[type=(type)] from specific class with jQuery -

i have code not work: kw _class = _keyword1; var text = $("'input." + kw_class + "[type=text]'").val(); var val = $("'input." + kw_class + "[type=hidden]'").val(); firefox console comes out this: `syntax error, unrecognized expression: 'input._keyword1[type=text]' i have tried @ least 3 combos of not working found other questions. yes because have ' ' inside of selector. should be: var text = $("input." + kw_class + "[type=text]").val(); var val = $("input." + kw_class + "[type=hidden]").val();

php - mysqli_query INSERT not working -

i trying execute mysqli_query insert values database not working. mysqli_query($con, "insert `temp` (`name`, `email`, `delivery`, `session`) values ('$name', '$email', '$delivery', '$session'"); can see going wrong? thanks! you're missing ) @ end of query: mysqli_query($con, "insert `temp` (`name`, `email`, `delivery`, `session`) values ('$name', '$email', '$delivery', '$session')"); ^ btw, mysqli supports parametrized queries, should use them instead of string substitution.

C++ Triangulation library in a Java Application -

i'm implementing algorithm pathfinding variant of a* (hpa*) triangulated search space. i've been making java application , have written amount of code, found c++ library takes care of triangulations project. have several options i'm not sure should do: convert library java or integrate c++ code java library. rewrite code in c++ i'm not familiar language. this application tests performance of algorithm paper i'm writing doesn't need portable. think best option is? if want call c++ code java, read on java native interface (jni) coding conventions. but generally, unless have extremely reason cross languages, it's more trouble it's worth. how complicated triangulation code? if it's less few hundred lines, i'd suggest reimplementing; if it's more few thousand, using library may justified should check whether there's java library available or if has written appropriate jni glue code.

c# - P/Invoke Calls Failing -

i have following struct defined in c++: struct graphicsadapterdesc { // ... constructors / operators / destructor here define_default_constructor(graphicsadapterdesc); define_default_destructor(graphicsadapterdesc); allow_copy_assign_move(graphicsadapterdesc); std::wstring adaptername; int32_t adapternum; std::wstring hardwarehash; int64_t dedicatedvmem; int64_t dedicatedsmem; int64_t sharedsmem; int32_t numoutputs; }; in c#, have 'mirror' struct declared thusly: [structlayout(layoutkind.sequential)] public struct graphicsadapterdesc { string adaptername; int adapternum; string hardwarehash; long dedicatedvmem; long dedicatedsmem; long sharedsmem; int numoutputs; }; i've tried careful matching widths of variables (although i'm bit unsure on strings exactly). anyway, have following exported c method: extern "c" __declspec(dllexport) bool getgraphicsadapter(int32_t adapt

php - Using mod_rewrite to make a url prettier -

i trying use mod_rewrite change appearance of url's. lost in , use help. first of all, possible use mod_rewrite alter "front-end" of url , keep same internally? if so, how following: i have https://domain.com/live/page.php?id=x both "page" , "x" being variable, , url's shown https://domain.com/page if possible, or if need id=x in there https://domain.com/page/x/ don't know if need have id somewhere in url. please me know common thing can't figure out! thanks! edit: of anubhava got working halfway. time put code .htaccess /live/ directory not root one. pages change url correctly, still need server load original new url's giving me 404. here code: rewriteengine on rewriteoptions inherit rewritecond %{the_request} \s/+live/([^.]+)\.php\?([^=]+)=([^\s&]+) [nc] rewriterule ^ /%1/%2/%3? [r=302,l] rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^([^/.]+)/([^/.]+)/([^/.]+)/?$ /live

r - Assistance with <name> and <styleUrl> in .kml when using writeOGR() from rgdal -

Image
i have data frame containing coordinates various locations i'd use google earth. here's simple example showing structure: data <- data.frame(country = "usa", city = "saint paul", lat = 44.9629, lon = -93.00146) i followed this post , this guide create kml output using writeogr() function rgdal package, i'm having trouble tweaking attributes. here's code: # may need install gdal package install # install.packages("rgdal") library(rgdal) data_sp <- data coordinates(data_sp) <- c("lon", "lat") proj4string(data_sp) <- crs("+init=epsg:4238") data_ll <- sptransform(data_sp, crs("+proj=longlat +datum=wgs84")) writeogr(data_ll["city"], "/path/to/test.kml", driver = "kml", layer = "city") the result works fine viewing locations, i'd change <styleurl> attribute have <name> attribute populated. without i

c# - Programtically sign into Office 365 OWA using ADFS/MSOSTS tokens -

trying programatically sign owa using adfs 2.0. domain federated , sign in works expected (redirect https://myadfs.server/adfs/ls/?blabla ) https://login.microsoftonline.com/ . instead of using adfs redirect, have created own sign in page using code sample here . but code sharepoint. need owa. guess main thing need change service url office 365 owa return authorization cookies. code uses https://mysharepoint.server/ _forms/default.aspx?wa=wsignin1.0 auth cookies does know equivalent url owa? or code sample? a different approach can used sign o365. main thing i'm not trying sign o365. need obtain logon token, , present "dashboard" user allows them chose service want use token (or logged in identity) for, of office 365 1 of services. answered here on so

jquery - Ajax and Shopify Cart -

i'm using shopify , i'm trying add item cart using ajax. code here not add , item cart. i've spent 5 hours trying fix this, no cigar :/ i've included wrappers in in theme.liquid. here's code: <a class="chicken-fingers" onclick="fastcart('515257513','1')">add cart</a> <script> function fastcart(variantid, quantity){ $.ajax({ type: 'post', url: 'http://name.myshopify.com/cart/add.js', data: 'quantity='+quantity+'&id='+variantid, datatype: 'json', success: function(response){ $.ajax({ type: 'get', url: '/cart.js', datatype: 'json', success: function(cartdata){ $('.cart-total-items .count').html(cartdata.item_count); $('.cart-total-price').html('$'+(cartdata.total_price/100).tofixed

How to search for specific classes in Microsoft Visual Studio Help viewer -

Image
i came xcode world, there no problem in searching specific class in specific section of documentation. however, can't find way find classes in documentation in viewer. for example, search list class. when type "list" in search field, see many unrelated information on tabs (index, search, contents). as can see, there's links list constructor, not link list classes. is there option (or search argument) find specific classes in viewer ? personally don't use offline anymore, searching list class or hitting f1 right editor on type brings directly right page: public list<string> list = new list<string>(); l hit f1 here if you're looking class adding "class" or in case of interface searching "interface" next keyword trick. if looking classes inherit from, it's best search common parent, on page you'll find overview of classes inherit class in base class library.

c# - Split a string containing various spaces -

i have txt file follows , split them double arrays node strain axis strain f p/s sum cur moment 0 0.00000 0.00 0.0000 0 0 0 0 0.00 1 0.00041 -83.19 0.0002 2328 352 0 0 -0.80 2 0.00045 -56.91 0.0002 2329 352 0 0 1.45 3 0.00050 -42.09 0.0002 2327 353 0 0 -0.30 my goal have series of arrays of each column. i.e. node[] = {0,1,2,3), axis[]= {0.00,-83.19,-56.91,-42.09}, .... i know how read txt file , covert strings double arrays. problem values not separated tab, different number of spaces. googled find out way it. however, couldn't find any. discussed way constant spaces. if know how or there existing q&a issue , let me know, appreciated. thanks, stringsplitoptions.removeemptyentires should trick: var items = source.split(new [] { " " }, stringsplitoptions.removeemptyentries); the return value not include array elements contain empty

vb.net - Set web browser URL to textbox contents -

Image
i making project windows 8 app. i set url of web browser element contents of textbox. here code although @ present not work! private sub button_click_1(sender object, e routedeventargs) webbrowser.navigate(new uri(textbox.text)) end sub this works windows forms project not w8 project! edit image demonstrates error getting textbox name of class. since doesn't have shared property named text, saying need to text property of instance of class. typically in winforms, if drag textbox onto form, it'll name textbox1 . you'd want .text property of specific textbox instance textbox1.instance . i'm not entirely sure textbox named in w8.

asp.net mvc - Resharper Navigate to MVC View -

Image
i upgraded resharper 8.1 , vs 2013 before ctrl+click on view jump it, no longer works. there feature need enable back? partialview("_mainmenu", viewmodel); go resharper->manage extensions , click online tab. search resharper.externalannotations, , install package comes with. finally go visual studio tools->options , go resharper->general options page. click suspend followed resume restart resharper.

ruby on rails - Bundler says I already activated a gem but my gemfile requires a different version? -

i ran "bundle exec install" yet still following error: gem::loaderror: have activated metaclass 0.0.2, gemfile requires metaclass 0.0.1. using bundle exec may solve this. why happening? shouldn't executing in context of current app? i think want use: bundle install

check if a directory is already created python -

a basic question, have module creates directories on fly, however, want put more 1 file in dir. if happens, python rises exception , says dir created, how can avoid , check if dir created or not? the save module looks this: def createdirs(realiz): # create necessary directories path = "./doubdifferences_probandamp_realiz%d/"%realiz os.mkdir(path,0755) directory = os.path.split(path)[0] return directory on main program, have this: for realiz in range(1,1000): in range(dim): j in range(i+1,i+4): ... dirspaths = mod_savefile.createdirs(realiz) you go try except: try: os.mkdir(path,0755) except oserror: pass “easier ask forgiveness permission !” also method more safe testing directory before doing mkdir . indeed, possible between 2 os call implied ispath , mkdir directory may have been created or destroyed thread.

swing - in java, when do I get access to this instance if not in main()? -

so trying make simple swing app learning purposes, , bit confused this. understand entry-point of program main() function, , object doesn't exist @ point can't refer this , how , when know instance has been created? my class extends jframe has visual presence when execute it, , right after created, want position on specific position on screen. option seems to use new classname() , create second instance instead....so yeh, total beginner , confused you need create instance of class in main: myclass c = new myclass("a nice frame title here"); then in class constructor or methods: public myclass(string title) { //you can use here } public void method() { //and here }

Triple pointers in C: is it a matter of style? -

i feel triple pointers in c looked @ "bad". me, makes sense use them @ times. starting basics, single pointer has 2 purposes: create array, , allow function change contents (pass reference): char *a; = malloc... or void foo (char *c); //means i'm going modify parameter in foo. { *c = 'f'; } char a; foo(&a); the double pointer can 2d array (or array of arrays, since each "column" or "row" need not same length). use when need pass 1d array: void foo (char **c); //means i'm going modify elements of array in foo. { (*c)[0] = 'f'; } char *a; = malloc... foo(&a); to me, helps describe foo doing. however, not necessary: void foo (char *c); //am modifying char or passing char array? { c[0] = 'f'; } char *a; = malloc... foo(a); will work. according first answer this question , if foo modify size of array, double pointer required. one can see how triple pointer (and beyond, really) required. in

c# - Special characters with XDocument -

i'm trying read file (not xml, structure similar), i'm getting exception: '┴', hexadecimal value 0x15, invalid character. line 8, position 7. and file have lot of symbols, can't replace because can't modify content of file purposes... that's code: try { xdocument doc = new xdocument(new xdeclaration("1.0", "utf-16", "yes")); doc = xdocument.load(arquivo); } catch (exception e) { messagebox.show(e.message.tostring()); } and that's part of file: <codepage>utf16</codepage> <segment>0000016125 <control>0003┴300000┴english(u.s.)portuguese┴┴bla.000┴webgui\messages\xsl\en\blabla\blabla.xlf </control> <source>to blablablah firewall blablablah local ip address. </source> <target>para blablablah uma blablablah local específico. </target> </segment> note: file don't have encode xml declaration. this xml pretty ba

Rails Strip Method Not Working Correctly -

so in case stumbles across same issue, have string: a = " string whitespace @ start , end " interestingly when trying a.strip , string didn't change to: a = "i string whitespace @ start , end" the issue here was, had &nbsp; or other kind of space prevented strip doing best. my solution, first replace spaces spaces: a.gsub("\u00a0", " ") (i tried a.gsub("&nbsp;", " ") @ first, no luck) tada! now got expected a.strip result :) (maybe there clearer way this, if let me know)

php - Apparent Syntax Error -

i first admit bit of newbie when comes php having frustrating issue trying submit data collected form (currently preset in query) , send database, problem saying syntax incorrect, have found not , not have access modify database university server. mysql_query("insert 'nnproduct' values ('', 'something','something','something',5,5,'$image_name', $producttypeid)"); the error having invalid query: have error in sql syntax; check manual corresponds mysql server version right syntax use near ''nnproduct' values ('', 'something','something','something',5,5,'aaron.jpg', 1)' @ line 1 you cannot wrap table name in quotes. need use ticks (or no ticks or quotes): mysql_query("insert `nnproduct` values ('', 'something','something',... ^^^^^ ^^^^ here

scala - Play optional query parameter not parsing -

i trying documented routes example play 2.1.1 routes # version parameter optional. e.g. /api/list-all?version=3.0 /api/list-all controllers.api.list(option[version]) and then $ play-2.1.1 compile [error] /home/paul/server/conf/routes:2: compilation error[`)' expected `[' found] what going wrong? it should this: get /api/list-all controllers.api.list(version: option[string])

php - get JSON from long string -

since host doesn't allow file_get_contents must use else api call. got code content of website: function get_contents_by_uri($uri) { $urielem = parse_url ( $uri ); $fp = @fsockopen ( $urielem ['host'], 80, $errno, $errstr, 10 ); if (! $fp) { throw new exception ( "could not create socket: '" . $errnstr . "' (" . $errno . ")." ); } $request = "get " . $urielem ['path'] . (isset ( $urielem ['query'] ) ? "?" . $urielem ['query'] : "") . " http/1.1\r\n"; $request .= "host: " . $urielem ['host'] . "\r\n"; $request .= "connection: close\r\n\r\n"; fwrite ( $fp, $request ); $response = ""; while ( ! feof ( $fp ) ) { $response .= fgets ( $fp, 128 ); } fclose ( $fp ); // split headers data $responsesplit = explode ( "\r\n\r\n", $response, 2 ); return $responsesplit [1]; } this works fine simple call: http

java - Android - Cant read file, getting exception -

i have issue driving me crazy. have 2 methods, 1 reading , other writing. have class called converastion holds arraylist<chatmessage> , string properties. both converastion , chatmessage implements serializable , have know can save conversation object filesystem . but when try read , write (update conversation ), doesn't work quite well. issue on reading, java.io.eofexception when know conversation object has been written before. here 2 methods: public conversation getconversation(string userid, boolean createbydefault){ try { file f = new file(sapplicationcontext.getfilesdir() + "/" + "conversation" + "/" + userid); fileinputstream fis = new fileinputstream(f); objectinputstream in = new objectinputstream(fis); conversation ret = (conversation) in.readobject(); in.close(); return ret; } catch (exception e) { e.printstacktrace();

ios - Phonegap Plugin - append lines to app delegate -

i'm developing phonegap plugin. far good. append 1 or 2 methods appdelegate.m through config.xml populated developer automatically. possible? thanks. take push plugin, use objective-c category appdelegate https://github.com/phonegap-build/pushplugin if want notified when app becomes active don't need change on appdelegate, put on plugin: [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(onappdidbecomeactive:) name:uiapplicationdidbecomeactivenotification object:nil]; - (void)onappdidbecomeactive:(nsnotification*)notification { nslog(@"%@",@"applicationdidbecomeactive"); }

sorting - Can't sort Excel PivotTable Row Label as Numbers -

using powerpivot , creating pivottable in excel 2010, trying sort row label column contains numerical values numbers instead of text. no matter i've tried, though, excel refuses play along. for example, created simple excel spreadsheet single column called "myvalues" looks so: **myvalues** 1 2 3 4 12 12 23 44 12292 i've imported spreadsheet file using powerpivot and, in both source spreadsheet , in powerpivot window, have confirmed a) data type numeric , b) values sort expected (i.e. largest smallest or vice versa). but when create pivottable off , use myvalues column row label, excel instead sorts values though text: **myvalues** 1 12 12292 2 23 3 4 44 am missing something, or can sort numbers numbers when they're in values column? it's tedious, drag them place.

Ruby method call with a symbol parameter with no space -

i saw in rails app reviewing expected error, working. confused way method being called parameter. no spaces, 2 words separated colon: ree-1.8.7-2012.02 :001 > def muffin(x) ree-1.8.7-2012.02 :002?> puts x.inspect ree-1.8.7-2012.02 :003?> end => nil ree-1.8.7-2012.02 :004 > muffin:tuffin :tuffin also works string: ree-1.8.7-2012.02 :004 > muffin'd' "d" is expected , correct thing? ruby enjoys 1 of relaxed grammars in industry. yes, space optional. , try muffin(:tuffin) if want colleagues see what's going on. furtherless, can write: def muffin x yet example of "because can" isn't valid reason doing something. c-;

java - PHP Rest api security -

we working on game in java. user authentication using rest api made in php. i'm using sessions store uid , game stores session in cookiestore . we've come conclusion isn't secure enough. thought temporary token, 'attackers' somehow able tokens himself. use api secret key, attackers might able reverse-engineer game. what want nobody can access api except our game. probably make 1 time use token generated on request? , obfuscate code.

paperclip - Rails video uploading -

i've searched around different uploading options rails , video , paperclip seems pretty good, there others people recommend, should have tutorials , docs because can't find great paperclip docs involving uploading video content. we got paperclip working video while back systems you'll have same ambiguity whether use carrierwave or paperclip (rails' 2 main "attachment" handlers) any upload system handles transfer of file data between pc, rails app & db. each of them (from understanding). e.g paperclip creates activerecord object file, saves data server's public dir & creates record in db code the question of video 1 of using right processor , rather right uploader: #app/models/attachment.rb has_attached_file :attachment, styles: lambda { |a| a.instance.is_image? ? {:small => "x200>", :medium => "x300>", :large => "x400>"} : {:thumb => { :geometry => "100

osx mavericks - mac osx 10.9, Automatically connect to network drive on startup, wake up -

i have shared folder in ubuntu 13.10 server. can connect shared folder mac os using "connect server" smb://ubuntunas/download i dont want manually everytime. possible connect @ startup go apple menu , system preferences. select "users" tab , select own user. drag share startup items.

eggdrop - TCL if inside if -

i'm trying make display contents of if statement if if inside it, returning desired value. doesn't work, guess it's not how in tcl. advice appreciated. if {$firstq == 1} { set sql "select * users username='$text' , ircban='yes' limit 1" set result [mysqlsel $db_handle $sql] if{$result == 1} { putquick "notice $nick :user banned." } elseif{$result == 0} { putquick "notice $nick :user not banned." } you missing closing brace after elseif , need spaces after if , elseif : if {$firstq == 1} { set sql "select * users username='$text' , ircban='yes' limit 1" set result [mysqlsel $db_handle $sql] if {$result == 1} { ;# <-- need space after if putquick "notice $nick :user banned." } elseif {$result == 0} { ;# <-- need space after elseif putquick "notice $nick :user not banned." } ;# <-- missing closing br

c++ - Forwarding to in-place constructor -

i have message class bit of pain work with, had construct message class, tell allocate space object , populate space either construction or memberwise. i want make possible construct message object immediate, inline new of resulting object, simple syntax @ call site while ensuring copy elision. #include <cstdint> typedef uint8_t id_t; enum class messageid { worldpeace }; class message { uint8_t* m_data; // current memory uint8_t m_localdata[64]; // upto 64 bytes. id_t m_messageid; size_t m_size; // amount of data used size_t m_capacity; // amount of space available // ... public: message(size_t requestsize, id_t messageid) : m_data(m_localdata) , m_messageid(messageid) , m_size(0), m_capacity(sizeof(m_localdata)) { grow(requestsize); } void grow(size_t newsize) { if (newsize > m_capacity) { m_data = realloc((m_data == m_localdata) ? nullptr : m_data, news

css - I can not figure out why my drop down menue is not hiding -

so, can not figure out why drop down menu not hiding #nav ul set left:-999px , should way off screen, reason not hiding , instead sitting in plain view. btw nav bar php include, have gotten work before, missed along way , stupid mistake on part, feel free call me idiot, can not life of me figure out did wrong time. here link hosted: http://addisonbwilson.com/index.php the css @charset "utf-8"; /* css document */ /*the body responsiable background image, rest of site divided between sub wrapper , includes */ /*bground tile http://subtlepatterns.com/white-brushed/ created andre schouten, crediting him here per usage agreement */ body {margin-top: 0px; background-image:url(../portfolio/images/brushed_@2x.png)} /* navbar php include*/ #navbarwrapper{positon: absolute; width:980px; height: 120px; z-index:30; background-color:#fff;} #navbar{width:980px; height:120px; background-image:url(../portfolio/images/bannerbgimg.png); background-repeat:repeat-x; z-index:31;}

Collections.max(array) is Not Working - Java -

i using collections.max(array); determine largest number in selected array is. when use it, error message: exception in thread "main" java.lang.error: unresolved compilation problem: method max(collection<? extends t>) in type collections not applicable arguments (int) @ array_6.main(array_6.java:23) my code follows: int input; int highestnumber = 0; int arraynumber = 0; int[] intarray = new int[10]; system.out.println("this application determines highest number out of 10 inputed numbers"); system.out.println("welcome, please input first number:"); (int = 0; < 10; i++){ system.out.print(i+1 + ": "); input = textio.getlnint(); // retrieves input intarray[i] = input; } highestnumber = collections.max(arrayint); system.out.println("highest number " + highestnumber); edit i did recommended below, , message exception in thread "main&

arrays - Scanf error in C -

so have following c code: #include<stdio.h> #include<stdlib.h> int main() { int l,r; scanf("%d",&l); scanf("%d",&r); long long int *a=malloc(l*sizeof(long long int*)); long long int *a=malloc(l*sizeof(long long int*)); int i; for(i=0;i<l;i++) scanf("%lld %lld",&a[i],&a[i]); for(i=0;i<l;i++) { printf("a(%d)==%lld , a(%d)==%lld\n",i,a[i],i,a[i]); } return 0; } which unfortunately starter of problem, , print loop on end want determine if input values assigned correctly arrays , ( r value has 2 arrays b , b doesn't matter). when compile , run program these inputs: 3 5 10 1 3 2 10 1 i on output: a(0)==10 , a(0)==10 a(1)==3 , a(1)==2 a(2)==10 , a(2)==1 notice puts correctly, value a(0)=10 instead of calculated 1 , scanf reads second time value 10, skips value 1 , proceeds reading rest of values correctly. i

java - Best way to get a single value from request returning xml? -

i have android app, , specific value xml result set, getting request api. making multiple requests, , request returns xml. here xml result: https://mcxnow.com/orders?cur=wdc how value of 'doc > history > o[0] > p' string efficiently possible in java android? i've looked @ sax xml parser seems overkill. there lightweight should use? should use, , how go getting 1 value? i've looked @ sax xml parser seems overkill. there lightweight should use? should use, , how go getting 1 value? i going recommend use sax parser! the problem thing more "light-weight" in performance terms pattern matching; i.e. ignoring xml grammar / syntax, , using regexes or equivalent fish out data want. the problem using pattern matching instead of proper xml parsing code liable fragile: it liable break in unpredictable / undetectable fashion if implied xml schema changes. it liable break in unpredictable / undetectable fashion variations in way

javascript - Mapping the latitude longitude co-ordinates on Map -

i have list of 1000 locations in city. location information available in form of csv file in form:(name, latitude, longitude). need plot same on map of city. i have started learning d3 past 2 days using this excellent guide.i'm not sure if d3 right tool create visualization. started using because later create few dynamic visualization using location -like when user clicks on location , highlight other locations within distance of 'x' miles, draw line between 2 different locations, etc.. d3, right tool achieve ? , recommendation on what(new tools, library etc...) should ramp same. so! i have been using d3 while, doing simple graphics (linecharts, barcharts). in order use information, recommend use json format store csv data in object. i have found example on web, creator of d3: http://bost.ocks.org/mike/map/ hope little, nice if put fiddle when work done

ruby on rails - Error installing Jekyll -

i'm getting error every time try install jekyll here of output terminal - moooobile:~ usr$ gem install jekyll error: while executing gem ... (gem::filepermissionerror) don't have write permissions /library/ruby/gems/2.0.0 directory. i've installed rbenv , changed path to: moooobile:~ usr$ echo $path /usr/local/bin:/usr/local/sbin:~/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/x11/bin could give me tips wrong? you need reinstall ruby correct permissions. consult rbenv readme installing rubies. also, need create .ruby-version file in project directory ensure loading of correct ruby version. more in command reference in same readme.

architecture - Incrementing program counter on branch address -

how increment program counter using mips instruction? have code below: if (r[rs] > 0) r[rs] = r[rs] - 1 else pc = pc + 4 - branch address so far think works: slt $t0, $rs, $rt #this pseudoinstruction translation r[rs] > 0 bne $t0, $zero, else add $rs, $rs, -1 #add -1 $rs decrement else: #do here: maybe jump branch address? jr branch address how branch address? slt $t0, $rs, $rt #this pseudoinstruction translation r[rs] > 0 bne $t0, $zero, else add $rs, $rs, -1 #add -1 $rs decrement b endif else: # else endif: # rest of program

Proper usage of javascript in developing a website using wordpress -

i'm not sure seems problem.. i've used get_template_directory(); , bloginfo(); properly.. working are.. problem is.. javascript isn't working.. i'm not sure if have add get_template_directory_uri every javascript calls. appreciated header.php <head> <title>blank</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link href='http://fonts.googleapis.com/css?family=mr+de+haviland|yanone+kaffeesatz:400,700|open+sans:400italic,400,700,600' rel='stylesheet' type='text/css' /> <!-- inluding styles --> <link rel="stylesheet" type="text/css" href="<?php echo get_template_directory_uri(); ?>/css/bootstrap.min.css" media="screen" /> <!-- html5 shim , respond.js ie8 support of html5 elements , media queries --> <!-- warning: respond.js doesn't work if view page via fi