Posts

Showing posts from August, 2015

woocommerce - Wordpress multi-vendor setup for deals website, allow sellers to maintain deals -

i know woocommerce has multi-vendor feature allows other vendors sell on website i'm looking specific functionality related that. does know of plugin/theme allows vendors track/fulfill order , importantly, input tracking own orders? want create single page deals instead of multiple stores. yes brother there theme " dokan " allows vendor / seller , admin track , keep full record !

ruby on rails - sunspot/solr multiple indices -

i have sunspot/solr set search products on site. need ability search users , model (too explain is) in out app. there form searching product via solr , works well. there form searching users , other form search other model. i assume recommended have separate index products, users, , other model? it's seems best keep index getting bloated? on right track here? all models indexed in same index. , sunspot index classnames index.

ruby on rails - Heroku Application Error when using Heroku create command -

Image
i following tutorial @ http://onemonth.com created rails app. asked use heroku app live online. followed steps linking github account heroku via ssh key. when use command heroku create , copy past link provided, in case http://young-peak-7631.herokuapp.com/ , "application error" in browser. this exact message: "an error occurred in application , page not served. please try again in few moments.if application owner, check logs details." see picture of heroku error page below here logs: 2014-07-01t06:50:55.157229+00:00 app[web.1]: rendered layouts/_header.html.erb (0.7ms) 2014-07-01t06:50:56.211672+00:00 heroku[router]: at=info method=get path="/about" host=omr-photoshare.herokuapp.com request_id=0b8e9a43-5ffd-4bae-aa4f-61e9f87dfdfc fwd="65.78.4.236" dyno=web.1 connect=2ms service=192ms status=304 bytes=845 2014-07-01t06:50:56.025883+00:00 app[web.1]: started "/about" 65.78.4.236 @ 2014-07-01 06:50:56 +0000 20

linux - Remove non ASCII chars from multiple files recursive -

i have tons of files include non ascii characters , on complete file system. looking batch solution run 1 problem: find . -name "*.yml" -print0 | while read -d $'\0' file; tr -cd '\11\12\15\40-\176' < "$file" > "$file"; done this command should work fine, wouldn't there problem tr -cd doesn't work if use same input , output name. know alternative or how solve small issue? got (no idea if looks nice or crappy): find . -name "*.yml" -print0 | while read -d $'\0' file; cp "$file" "${file}.temp" && tr -cd '\11\12\15\40-\176' < "${file}.temp" > "$file" && rm "${file}.temp"; done depending on file names processing, may want add ifs= , -r read command, see greg's bashfaq 001 details. regarding question, use temporary file suggested carl or use sponge command the moreutils package . either: find . -name &qu

oop - Tree traversal in Java with Generic classes -

to precise, trying flatten tree , stuck on trying values of private attributes in generic class using generic function. i have attached classes show how tree structured exactly. it's looks this: /|\ 1 | 6 /|\ 5 4 9 i going paste attempt @ end. first, let me introduce classes: triple stores 3 values of same type. public class triple<v> { private final v l, m, r; public triple(v l, v m, v r) { this.l = l; this.m = m; this.r = r; } public v left() { return l; } public v middle() { return m; } public v right() { return r; } } straightforward interface: public interface function<p, r> { r apply(p p); } now, tricky class. 1 type stores 1 of eitheror of 2 types of value, not both. public class eitheror<a,b> { // constructs left-type eitheror public static <a> eitheror left(a a) { return new eitheror(a, null); } // constructs right-type eitheror public st

PHP variable not updating in to MYSQl field -

i have piece of code takes keywords out of url database. code updates field within database keywords. code gets keywords url , echo's them out on page perfectly. however when try , update them in database, field doesn't update. if swap out variable $c word such test works , issue variable $c, have tried several different ways can not field update. $result = mysql_query("select * ip_stats1 page 'http://www.google.com/uds/afs?q=%' , id='44'") or die(mysql_error()); $row = mysql_fetch_array( $result ); $keyword = $row['page']; $id = $row['id']; $a = "$keyword"; $b = substr($a, strpos($a, '=') + 1); print $b; $c = substr($b, 0, strpos($b, '$')); echo "$c"; $result2 = mysql_query("update ip_stats1 set string1 = '$c' id = '44'") or die(mysql_error()); update ok, if echo $c keywords, example dough maker, works perfectly. have tried writ

replace - Replacing data fields with code in JSON.stringify? -

so can replace property number, string, array, or object in json.stringify, so: var myobj = { 'allstar': afunction; } function myreplacer(key, value) { if(key === 'allstar') { return 'newfunction()'; } } json.stringify(myobj, myreplacer); //returns '{"allstar": "newfunction()"}' but can change instead returns '{"allstar": newfunction()}' (without quotes around newfunction )? i assume typeof afunction == "function" ? if so, json.stringify(myobj) not want do, return '{}' i.e. object without properties, because functions not supported in json. your desired result not valid json. newfunction() without quotes not supported value (string, number, array, object, boolean, null). edit: try return newfunction.tostring() in replacer, should deliver function's source string. when converting json back, must eval() string actual function.

SimpleDateFormat is not interpreting %g -

final string log_filename = new simpledateformat("'tool_'yyyymmddhhmmss_sss_'%g.log'").format(new date(system.currenttimemillis())); string logfileptrn = new stringbuilder(system.getproperty("user.dir")).append(system.getproperty("file.separator")).append(log_filename).tostring(); when print log file prints log file location:/tool/log/tool_20140625155513_309_%g.log but actual log file got generated tool_20140625161235_309_0.log any appreciated.

actionscript 3 - Select column in Flash datagrid? -

when using datagrid, there default way (not involving coding) select 1 entire column? cheers use selecteditem.specificproperty here's posting more info: can select column

How to create a generic autocomplete helper for my domain entities in asp.net mvc -

in 1 of asp.net mvc projects, want provide autocomplete general data source url , typed autocomplete domain entities. looking asp.net mvc helper when started new project in asp.net mvc, had requirement provide input control auto complete many number of domain entities (department, employee, product, categories etc.) , general purpose. wanted use auto completes instead of dropdown list this useful when there requirement provide auto suggestion kind of data entry end user two helpers various overloads in terms of having attributes, auto complete type, required, on select call , source url. 1 helper used type view , other 1 view no model binding how works helper creates 2 html input elements 1 type of hidden , other type of text. id , name of hidden developer give name of autocomplete or model propertyname. id , name textbox name of hidden _autocomplete (ex: hidden name productid, textbox name productid_auto complete). selected text shown in text box , selected value

ubuntu - all files such as name, size and type using PHP are clearly correct but the files unable to move to real folder -

i little bit confuse , have headache find upload file problem. have php script contained simple code of uploading file. below script: $file_path = "doc_student/"; $image = $final_save_dir . $_files['uploadfile']['name']; if($_files['uploadfile']['error'] > 0): echo "error: " . $_files['uploadfile']['error']. "<br>"; else: echo "upload: " .$_files['uploadfile']['name'] . "<br>"; echo "type: " .$_files['uploadfile']['type'] . "<br>"; echo "size: " .($_files['uploadfile']['size'] / 1024) . "kb<br>"; echo "stored in: " .move_uploaded_file($_files['uploadfile']['tmp_name'], $file_path . $_files['uploadfile']['name']) . "<br>"; endif; everything's worked fine except file upload not move $file_path = "doc_stu

javascript - Why not always use the "jQuery" function rather than "$" to avoid problems -

i know dollar sign single character type, , "jquery" 6...but doesn't using jquery function prevent sorts of weird problems can occur overloading $ function? if javascript obfuscated won't matter form used anyway during run-time. i'm confused why it's not best practice avoid $ (and treat kind of javascript "bad part"). disregard asked question jquery , $ . (and i'm pretty sure other developers) count practice define name used external library explicitly. either using iife, adm loaders (like requirejs) or similar techniques, no matter how have in common content of js file wrapped function body creates scope encapsulating variable , function definitions have there , pass used libraries arguments wrapper function. 3rd party libraries not passed wrapper parameters have count not existing. so inside of wrapper can use ever name want given libraries (never less should stay common naming used other developers)

ios - Certificate and provisional profile issues -

not sure if certificate #invalid provisional profile# here error: error itms-9000: "invalid provisioning profile. provisioning profile included in bundle com.domain.appname [payload/appname.app] invalid. [missing code-signing certificate.] more information, visit ios developer portal." this error comes in application loader uploading/sending apps app store. need more info? ask! :) taking time me issue! :) edit: when try archive , distribute or validate in xcode, certificate/profile invalid. the appid/bundleidentifier identifies unique app. bundleidentifier means ur app once u created appid bundleidentifier cannot changed u have changed app name after creating appid problem distribute certificate u have created appid not same bundleidentifier u have changed recently. once u create appid 1 bundlename can't changed u need created new appid ur new bundleidentifier name. using new appid create distribute certificate work.

How to put a proper jQuery selector under if condition so that it work for all the cases? -

using jquery each function, parsing div data called myordersdiv as parsing myordersdiv , creating array , storing data . the issue facing that if myordersdiv has got 1 elmenet under working fine , o/p [{"name":"choclate"}] but in case if myordersdiv has got 2 elmenets under , o/p [{"name":"chocolatevanila "}] ( its mixing both of them ) the fiddle first case http://jsfiddle.net/gstdu/3/ the fiddle second case http://jsfiddle.net/gstdu/5/ right jquery selector is $.each($('#myordersdiv > ul'), function(i, elem) { name = $(elem).find("label").text(); if (name != 'undefined') { //creating product array products.push({ 'name': name }); } }); could please ?? try this:- var name; var products = []; $('#myordersdiv > ul').find('ul').each(function(){ name = $(this).fin

pygame - How to make a scrolling screen in python with a simple camera class -

i attempting make game in python screen needs scroll player character. learned strange methods of doing things in python , have no knowledge of how blitting works. teacher didn't show more appears in code enclosing below. want screen move rizer class in center of screen. appreciated. thank you. #contra 5 import pygame import math, random, time livewires import games, color games.init(screen_width = 1000, screen_height = 480, fps = 100) #add things stand on opposed standing on y value of #250, creating illusion of solid object. #make can't hold down jump button stay in air. #make lives. #make don't die when crouching , shooting. #put in camera purpose of scrolling screen. #put in way 2 players play @ once, able shoot, , have #bullets not doing damage teammates. #make title screen works. ##only add more stages , music once first stage , title screen done.## class wrapper(games.sprite): """ sprite wraps around screen. """ def up

TWS : job exiting without executing the script -

i executing job in tws facing problem job exiting status 0 without exexuting script. the script getting executed scuccessfully when executed manually. also , seen in many posts on net , tried comparing env variables in tws , manually, same problem , job exiting without executing env command sorry question lacks crucial information os using, how checked "env" command... tws handles jobs on different systems (unix, windows, mainframe) differently depending on system. if schedule jobs on unix system, check .jobmanrc or jobmanrc files check how load user environment variables. see http://www-01.ibm.com/support/knowledgecenter/ssgspn_8.5.0/com.ibm.tivoli.itws.doc_8.5/awsrgmst41.htm%23dqx2custom515985 (on windows system, it's jobmanrc file think).

java - testng not running in priority order when dependsOnMethods is specified -

whenever specify priority , dependsonmethods on @test annotated method, order of execution of test methods not according priority. why so? here test class demonstrate issue: package unittest.testngtestcases; import org.testng.annotations.test; public class testngtest1 { @test(priority=1) public void t1() { system.out.println("running 1"); } @test(priority=2,dependsonmethods="t1") public void t2() { system.out.println("running 2"); } @test(priority=3,dependsonmethods="t2") public void t3() { system.out.println("running 3"); } @test(priority=4) public void t4() { system.out.println("running 4"); } } actual output : running 1 running 4 running 2 running 3 =============================================== tests suite total tests run: 4, failures: 0, skips: 0 =============================================== expected output

Android Animation - Rotate Image Moves Irregularly -

when start animation moves slow in beginning , gets faster move. suggest me. here code animation rotateanim; rotateanim = new rotateanimation(0, 360, animation.relative_to_self, 0.5f, animation.relative_to_self, 0.5f); rotateanim.setduration(60*1000); rotateanim.setinterpolator(new accelerateinterpolator()); _mclockneedle.startanimation(rotateanim); you using accelerateinterpolator . behavior describe how class made, specified in api. may want use linearinterpolator instead, if want move @ constant rate. there other subclasses of interpolator chose from. if wish animation shorter or longer done setduration method, in milliseconds, you've set 1 minute in example.

kdb - Dot notation with dates -

i'm trying understand how q defines dot notation dates. case 1: temporal variable issue for ex. if following day date: q) d:2014.06.14 q) d.dd 14 but if try doing without temporal variable: q) (2014.06.14).dd error: .dd question : why requires variable apply dot notation. case 2: inside functions: dot notation date doesn't work inside functions. q) {x.mm}[2014.01.01] error: x.mm solution casting q){`mm$x}[2014.01.01] 1i question: why temporal variable property doesn't work inside function? i want understand behaviour of dot notation. dot notation applies things "names" in sense of belonging workspace tree (and columns in qsql queries). essentially, if can't get`a successfully, won't able a.dd either.

java - IntelliJ to move a class along with conflicted classes to a new package? -

when select refactoring > move on java class , result intellij warns that'll cause conflicts other classes. there way tell intellij move class along classes have conflicts well? edit: seems original question unclear i'm providing example. if have classa uses classb inside. if move classa directory (different maven module), classa can no longer access classb. ideally, intellij have option automatically move classb other directory well. when try move class(you can refactoring > move or hit f6 or drag&drop) intellij gives some options like: search in comments , strings search text occurrences search references etc.. if select these intellij handle dependencies. don't have worry them. check move class dialog

c++ - Why does std::shared_ptr not behave like raw point when assign to another? -

#include <iostream> #include <memory> int main () { std::shared_ptr<int> foo; std::shared_ptr<int> bar (new int(10)); foo = bar; bar.reset(new int(20)); std::cout << "*foo: " << *foo << '\n'; std::cout << "*bar: " << *bar << '\n'; return 0; } output: *foo: 10 *bar: 20 #include <iostream> #include <memory> int main () { int * foo; int *bar = new int(10); foo = bar; *bar = 20; std::cout << "*foo: " << *foo << '\n'; std::cout << "*bar: " << *bar << '\n'; return 0; } output: *foo: 20 *bar: 20 how make shared_pt b shared_pt b has same inner value whatever change later (like above raw pointer example) ? they behave same way if same thing int main() { std::shared_ptr<int> foo; std::shared_ptr<int> bar(new int(10)); foo = bar; *bar = 20; std::cout &

c - How does Stack Activation Frame for Variable arguments functions works? -

i reading http://www.cs.utexas.edu/users/lavender/courses/cs345/lectures/cs345-lecture-07.pdf try understand how stack activation frame variable arguments functions works? specifically how can called function knows how many arguments being passed? the slide said: the va_start procedure computes fp+offset value following argument past last known argument (e.g., const char format). rest of arguments computed calling va_arg, ‘ap’ argument va_arg fp+offset value.* my question fp (frame point)? how va_start computes 'fp+offset' values? , how va_arg 'some fp+offset values? , va_end supposed stack? the function doesn't know how many arguments passed. @ least not in way matters, i.e. in c cannot query number of arguments. that's why varargs functions must either: use non-varying argument contains information number , types of variable arguments, printf() does; or use sentinel value on end of variable argument list. i'm not aware of function i

sql server - Logging from multiple databases -

i have usp_x calling others sps different databases , log execution details in single table in database usp_x resides. i thinking someway raise events different invoked sps, of course, not possible in sql server. any ideas how can implemented without send connection details invoked sps? does worth use service broker in case?

java - Cannot render an attribute that is not a string, toString returns: null ERROR in SPRING MVC -

i trying create generic error handler spring mvc project following tutorial: http://www.mkyong.com/spring-mvc/spring-mvc-exceptionhandler-example/ but in project, using tiles-defs , getting error when access error page in browser: org.apache.tiles.request.render.cannotrenderexception: cannot render attribute not string, tostring returns: null @ org.apache.tiles.impl.basictilescontainer.render(basictilescontainer.java:255) @ org.apache.tiles.impl.basictilescontainer.render(basictilescontainer.java:397) @ org.apache.tiles.impl.basictilescontainer.render(basictilescontainer.java:238) @ org.apache.tiles.impl.basictilescontainer.render(basictilescontainer.java:221) @ org.apache.tiles.renderer.definitionrenderer.render(definitionrenderer.java:59) @ org.springframework.web.servlet.view.tiles3.tilesview.rendermergedoutputmodel(tilesview.java:114) @ org.springframework.web.servlet.view.abstractview.render(abstractview.java:267) @ org.springframework.web.servlet.dispatcherservlet.render(

Java printing dialog with Czech locale -

Image
i have problem setting locale in printing dialog in java, setting czech locale. found solution setting locale here , works works new locale("es", "es") not new locale("cs", "cz"). can me, please? tried set default locale too: locale.setdefault(new locale("cs", "cz")); same result, es worked :(. from the locale description , section "user interface translation" the user interface elements provided java se runtime environment 6, include swing dialogs, messages written runtime environment standard output , standard error streams, messages produced tools provided jre. these user interface elements localized following languages: so looks ui elements translated in few languages unfortunatemly, dont know how add localization files in order have uis in czech. maybe swing specialist can you maybe can getting started

spring - Error in running or configuring grails application with asynchrounous mail plugin throws exceptions -

i want integrated grails asynchronous-mail:1.0 plugin app have added following build config compile ":asynchronous-mail:1.0" after tried run-app fails following exceptions | error 2014-06-26 11:49:55,958 [localhost-startstop-1] error context.grailscontextloader - error initializing application: error creating bean name 'nonasynchronousmailservice': error setting property values; nested exception org.springframework.beans.notwritablepropertyexception: invalid property 'grailsapplication' of bean class [grails.plugin.mail.mailservice]: bean property 'grailsapplication' not writable or has invalid setter method. parameter type of setter match return type of getter? message: error creating bean name 'nonasynchronousmailservice': error setting property values; nested exception org.springframework.beans.notwritablepropertyexception: invalid property 'grailsapplication' of bean class [grails.plugin.mail.mailservice]: bean property

android - In JNI, setting and getting elements from jobjectArray -

jstring ret_str = (*env)->newstringutf(env, output); (*env)->setobjectarrayelement(env,result,1,ret_str); jint bit_count = 5; (*env)->setobjectarrayelement(env,result,0,(jobject)bit_count); the last line gives error fatal error. here output char* , result jobjectarray . all need add strings,ints,floats etc... jobjectarray , want return jobjectarray. when adding jstring their's no error other primitive type throwing error. you cannot cast jint jobject in java. c has no idea how promote data type. need find java.lang.integer class in jni , construct jint argument integer jobject. here code, go , review documentation , preform needed error checking. jclass integer_class = (*env)->findclass(env, "java/lang/integer"); jmethodid = integer_init = (*env)->getmethodid( env, integer_class, "<init>", "(i)v"); integer_object = (*env)->newobject(

amazon s3 - Getting S3 CORS Access-Control-Allow-Origin to dynamically echo requesting domain -

how can set s3 cors allowedorigin configuration such dynamically echos requesting domain in access-control-allow-origin header? in post, "cors cloudfront, s3, , multiple domains" , suggested setting allowedorigin <allowedorigin>*</allowedorigin> this. however, s3 returns access-control-allow-origin: * instead. access-control-allow-origin: * not work in case using image.crossorigin = "use-credentials" in javascript app. option, s3 returns access-control-allow-credentials: true . cross origin access image fails because using wildcard allowed origin in conjunction credentials not permitted . background why needed: in setup, access images on s3 has go through our domain, authentication required restrict access , check if account authorized access images. if is, server returns 302 redirect s3 url. for authentication work, image.crossorigin = "use-credentials" has set request hits server required credentials. (incidentally, when

sql - Simple MySql select statement returns 0 rows -

this rather silly, don't know what's problem here. have table 'profiles' column 'country', filled table tab separated value file , table view seems fine. now when executing query: select * profiles country = 'sweden' nothing gets returned, although table has more hundred entry country 'sweden' , double checked spelling. but when executing query: select * profiles country regexp 'sweden' it returns results expected. what's cause of ? , how fix ? here data file used fill table: 0 f germany 1 f canada 2 germany 3 m mexico 4 m united states 5 m united kingdom 6 m finland thanks reading please try operator. select * profiles country '%sweden%'

spring security - RequestEnhancer not used for AuthorizationCodeAccessTokenProvider during getRedirectForAuthorization -

what i'm trying add parameter openid.realm authorization request. my problem similar https://github.com/spring-projects/spring-security-oauth/issues/123 , tried follow outlined way solve it: // create enhancer adds openid.realm defaultrequestenhancer enhancer = new defaultrequestenhancer(); enhancer.setparameterincludes(arrays.aslist("openid.realm")); // create tokenprovider use enhancer authorizationcodeaccesstokenprovider tokenprovider = new authorizationcodeaccesstokenprovider(); tokenprovider.setauthorizationrequestenhancer(enhancer); // give tokenprovider rest template googleoauthresttemplate.setaccesstokenprovider(tokenprovider); googleoauthresttemplate. getoauth2clientcontext(). getaccesstokenrequest().set("openid.realm", "http://localhost:8080/"); // try protected resource googleoauthresttemplate. getforobject("https://www.googleapis.com/...", string.class); now when user first hits code thrown out u

rest - Call HTTPS web service from android device with header to validate -

i want call https web service android device.which contain header validate data on server.i don't know how call https web service writen in java.if 1 explain steps me.thanl ! please check method: private static header[] headers; private string executerequest(httpget request) throws sockettimeoutexception { string responce = null; try { httpparams httpparameters = new basichttpparams(); // set timeout in milliseconds until connection // established. int timeoutconnection = 120000; httpconnectionparams.setconnectiontimeout(httpparameters, timeoutconnection); // set default socket timeout (so_timeout) // in milliseconds timeout waiting data. int timeoutsocket = 120000; httpconnectionparams.setsotimeout(httpparameters, timeoutsocket); httpclient httpclient = new defaulthttpclient(httpparameters); httpresponse httpresponse = httpclient.execute(request)

javascript - Offline map rendering on Android Tab -

i have been trying render map offline on android device. trying use d3 , leads , suggestions go long way in helping me out. can use d3 , geojson/topojson files of region plot map on browser? however, there way without app server? of d3 reads json through function d3.json() needs app server in itself. there way in d3 can read json file directly local file path instead of url? any other direction approach problem appreciated. awaiting response. regards, jones this possible. have done this. for me, used app server pushed json string html , fetched directly using javascript. code this: var root = treedata = json.parse($('#json').val()); function visit(parent, visitfn, childrenfn) { //.... visit(treedata, function(d) { //....

sql server - t-sql possible deadlock solution -

i running time taking (few hours) procedure, doing inserts, updates selects. there possibility make lowest possible locking on used data? think got deadlock problem here when other procedures tries selects on data. i love make insert/delete/update statements in procedure using select on big table date not block data in way (or maybe @ least not selects). would using set transaction isolation level read uncommitted solve problem? read snapshots, database big set on. yes, using set transaction isolation level read uncommitted @ top of each query batch solve issue of deadlocks. keep in mind these dirty reads, in not reading "committed" transactions when using setting. use statement lot avoid causing deadlock issues in production environments high traffic database tables. read full list of pros & cons of using read uncommitted here: http://sqlblog.com/blogs/tamarick_hill/archive/2013/05/06/pros-cons-of-using-read-uncommitted-and-nolock.aspx

android - Get an image asynchronously performs an error -

in xamarin , have gridview adapter sets images each gridview item. gridview adapter loaded fragment part of viewpager . each gridview item has imageview displays image. have code displays image correctly when downloading image synchronously, however, not asynchronously. here code: public override view getview (int position, view convertview, viewgroup parent) { view view = convertview; if (view == null) view = context.layoutinflater.inflate(resource.layout.gridviewwithimageandtextitem, gridview, false); imgicon = view.findviewbyid<imageview> (resource.id.image); if (gridviewtems[position].useresourceasthumbnail) { imgicon.setimageresource (gridviewtems[position].imageresourceid); } else { //code work imgicon.setimagebitmap (getimagebitmapfromurl (gridviewtems[position].thumbnailwebaddress)); //code not work downloadasyncbitmap (gridviewtems[position].thumbnailwebaddress, imgicon); }