Posts

Showing posts from August, 2015

css - How to create a vignette with background gradients -

Image
is there way create background without use of actual image files has gradient looks this? not wood panel texture, how left , right darker , lighter go inwards. box shadows you can accomplish box-shadow or radial-gradient . let's @ first option: .box { width: 300px; height: 300px; box-shadow: inset 0 0 5em 1em #000; background: url("http://lorempixel.com/300/300"); } this uses inset shadow overlays elements background image. effect resembles example photo: radial gradients you can pretty using several linear gradients, or radial gradient: html { min-height: 100%; background: radial-gradient(transparent, black), url("http://lorempixel.com/500/500"); background-size: cover; } fiddle: http://jsfiddle.net/jonathansampson/t8n5m/ if browser supports gradients , cover , , multiple backgrounds , you'll see this:

c++ - How to raise warning if return value is disregarded? -

i'd see places in code (c++) disregard return value of function. how can - gcc or static code analysis tool? bad code example: int f(int z) { return z + (z*2) + z/3 + z*z + 23; } int main() { int = 7; f(i); ///// <<----- here disregard return value return 1; } please note that: it should work if function , use in different files free static check tool you want gcc's warn_unused_result attribute: #define warn_unused __attribute__((warn_unused_result)) int warn_unused f(int z) { return z + (z*2) + z/3 + z*z + 23; } int main() { int = 7; f(i); ///// <<----- here disregard return value return 1; } trying compile code produces: $ gcc test.c test.c: in function `main': test.c:16: warning: ignoring return value of `f', declared attribute warn_unused_result you can see in use in linux kernel ; have __must_check macro same thing; looks need gcc 3.4 or greater work. find macro used in kernel header files:

sql - Difference in elapsed time of the query where everything in the trace seems to be identical -

while analysing traces of program , 1 before , 1 have run after creating 2 new indexes, found queries having high runtime compared previous run(which not using of new indexes have created , have identical execution plans). one particular query : select gp.period_year, gp.period_name, gp.period_year || '-' || lpad(gp.period_num, 2, '0') gl_periods gp gp.period_type = :b3 , gp.period_set_name = :b2 , gp.adjustment_period_flag = 'n' , trunc (:b1 ) between trunc (gp.start_date) , trunc (gp.end_date) before stats: call count cpu elapsed disk query current rows ------- ------ -------- ---------- ---------- ---------- ---------- ---------- parse 1 0.00 0.00 0 0 0 0 execute 1738112 31.63 31.26 0 0 0 0 fetch 1738112 778.18 780.36 17 6952448 0 1738112 ------- ------ -------- ---------- -----

Escaping spaces in variable while passing as a command line argument in php -

i have php file abc.php , processing command line arguments , @ end calling php def.php , system("php /user/release/scheduler_test/def.php $name $final > ~/scheduler_test/logs/logs_$name.txt 2>&1 &") the problem here is, variable $final having huge string separated spaces , since php space delimiter, not taking entire $final 1 argument. i want pass value inside $final variable single value. can tell me how? hope clear. that why escapeshellarg for. escaping looking for. a clearcut example php docs.. <?php system('ls '.escapeshellarg($dir)); ?> so escape parameters/user-provided parameters using function wrapping around it.

android - how can i show audio recorded file from phone memory to ListView -

i have developed call recording application. record audio file , save phone memory (file manager). know how can show recorded file in application using listview.? kick off example: string[] files = new file("path/to/dir/with_your_files").list(); arrayadapter<string> = new arrayadapter<string>(context, android.r.layout.simple_list_item_1, files); listview.setadapter(a);

html - Complete page shifts to right side after loading in IE 7 and 8 -

it being 2 days , punching head due ie 7 , ie 8. when web site (built in drupal) loaded, shifts right side. link below : http://goo.gl/gkmf6z i applied overflow hidden etc, nothing working , page still moves right side. i need fix issue. thanks in advance. note: if give me details fix , worked, offer bounty of 50 points correct answer after 2 days. looks like.. problem doctype declaration . can check once? i got issue issue #menu #naviagtion_menu li ul try making display:none , fine. menu has position:absolute; left:-999em creating space. try playing display properties instead left. solution : #menu #naviagtion_menu li ul { left:auto; display:none;} on hover of parent ul show #menu #naviagtion_menu li ul jquery/ javascript doing position left.

Grouping related functions in Python -

suppose have module functions spam , ham use functions eggs , foo . def spam(): eggs() foo() ... def ham(): eggs() foo() ... now, eggs , foo used spam , ham , , doesn't make sense expose them @ module level. change names _eggs , _foo indicate internal use doesn't establish relation between spam , ham , eggs , foo . so, make container class hold these functions this: class spamham: @staticmethod def _eggs(): ... @staticmethod def _foo(): ... @staticmethod def spam(): ... @staticmethod def ham(): ... but seems skethy because expect users not instantiate spamham , use call static methods. plus doesn't seem right use class when want establish relation between methods. i create separate module called spamham , put these 4 functions that, spam , ham 'belong' module in. so, correct way establish such relations in python? in general, a

c# - Post Photos and Videos on Facebook Wall -

i need post photos, videos on facebook walls mvc app. i'm getting below error (oauthexception - #2500) active access token must used query information current user. please me. please find below code i'm using. string appid = string.empty; string appsecretcode = string.empty; appid = "<<application id>>"; appsecretcode = "<<app secretcode>>"; var fb = new facebookclient(); dynamic result = fb.get("oauth/access_token", new { client_id = appid, client_secret = appsecretcode, grant_type = "client_credentials", scope = "publish_stream" }); string accesstoken = result.access_token; var client = new facebookclient(accesstoken); var postparameters = new dictionary<string, object>(); var media = new facebookmediaobject { filename = @"bday.jpg", contenttype = "image/jpeg" }; byte[] img = system.io.file.readallbyte

automatic sending notification to ios/ android devices using urban airship and php -

i need send push notifications app server , thinking use urban airship , using php @ end. got urban's documentation ,my server need send message urban's server , urban's server forward devices now ,i want automate process of sending of message server urban's server. actually, @ server, executing script go through database , fetch list of users whom message need send. please guide me regarding automating sending process. yeah, can use urbanairship (ua) that. provide rest api ( http://docs.urbanairship.com/connect/index.html ) can use send audience (ua slang users). so have use ua sdk in apps. basically, take off when start app, register google / apple push notifications , give token have store in database handle event want send push notifications in script get call data users database, i.e. device type (android / ios / windows phone) , token received ua user send data ua in way want ( http://docs.urbanairship.com/connect/connect_send.html ) , g

codex - How to show WordPress admin menus in a custom dashboard widget? -

i want show wordpress administration menus in custom dashboard widgets. how it? or paste tested solution in theme functions.php , modify. wherever need may call admin setting get_option() corrected input b__ , tested again function register_mysettings() { register_setting( 'michal-option-group', 'new_option_name' ); register_setting( 'michal-option-group', 'some_other_option' ); } add_action( 'admin_init', 'register_mysettings' ); function add_michal_dashboard_widget(){ wp_add_dashboard_widget( 'michal_dashboard_widget', // slug. 'michal dashboard widget', // title 'michal_dashboard_widget_function' // widget code ); } function michal_dashboard_widget_function(){ if (isset($_post['new_option_name'])) update_option( 'new_option_name', sanitize_text_field( $_post['new_option_name'])); if (isset($_post['

yarn - Hadoop doesn't use one node for job -

i've got 4 node yarn cluster set und running. had format namenode due smaller problem. later ran hadoop's pi example verify every node still taking part in calculation, did. when start own job 1 of nodes not being used @ all. i figured might because node doesn't have data work on. tried balance cluster using balancer. doesn't work , balancer tells me cluster balanced. what missing? while processing, applicationmaster negoriate nodemanager containers , nodemanager in turn try obtain nearest datanode resource. since replication factor 3, hdfs try place 1 whole copy on single datanode , distribute rest across datanodes. 1) change replication factor 1 (since trying benchmark, reducing replication should not big issue). 2) make sure client(machine give -copyfromlocal command) not have datanode running on it. if not, hdfs tend place of data in node since have reduced latency. 3) control file distribution using dfs.blocksize property. 4) check stat

testing - How to test logstash with PHP script -

i have installed logstash, configured config file input, filter , output , have run it. possible test if logstash pushes log data writing php script? can provide me php script can catch log data, sending logstash? run following list of logs in elasticsearch index : $date = date("y.m.d"); $host = "127.0.0.1"; $port = "9200"; $index = "logstash-".$date; $type = "*"; $log = array(); $query = '{"query":{"match_all":{}}}'; $curl = curl_init(); if ($curl) { curl_setopt($curl,curlopt_url, $host."/".$index."/".$type."/_search"); curl_setopt($curl, curlopt_port, $port); curl_setopt($curl, curlopt_customrequest, "post"); curl_setopt($curl, curlopt_postfields, $query); curl_setopt($curl, curlopt_returntransfer, 1); $result = curl_exec($curl); if (curl_errno($curl)) {

ambigious column name in sql server -

hello i'm having ambiguous column name in m stored procedure payment .bid-id can resolve issue please? set nocount on; select row_number() on ( order [paymentid] asc )as rownumber ,[paymentid] ,[name] ,[winningprice] ,[paymentdate] ,[payment.bidid] #results item inner join auction on item.itemid = auction.itemid inner join bid on auction.auctionid = bid.auctionid inner join payment on bid.bidid = payment.bidid (bid.status = 'paid') , (bid.buyerid = @buyer) select @recordcount = count(*) #results select * #results rownumber between(@pageindex -1) * @pagesize + 1 and(((@pageindex -1) * @pagesize + 1) + @pagesize) - 1 drop table #results end good practice using aliases like: set nocount on; select row_number() on ( order i.[paymentid] asc --which table belongs? put correct alias )as rownumber ,i.[paymen

jquery - Using ASPX pages in a MVC project using div.load 404'd? -

unfortunatly need render aspx pages in mvc project due legacy software. , think need using jquery's load method , load aspx page div. i've got mvc3 project. project contains homecontroller index method , ofcourse index view. homecontroller: using system; using system.collections.generic; using system.linq; using system.web; using system.web.mvc; namespace combiningmvcandaspx.controllers { public class homecontroller : controller { // // get: /home/ public actionresult index() { return view(); } } } which return index view: <script type="text/javascript"> $(document).ready(function () { alert('loading dashboard...'); $('#dashboard').load('~/webforms/webform1.aspx', function (response, status, xhr) { if (status == "error") { var msg = "sorry there error: "; $("#error").htm

arm - Sending an SMS from LPC2148 to a mobile phone -

i posted similar question yesterday not able edit code , post more problems, reposting here. have connected gsm modem lpc2148 , sending simple message "vehicle" mobile. have put in print statements in between know program is. runs print statements message not sent! so here code main.c #include "i2c.h" #include "lpc214x.h" // lpc2148 mpu register #include <stdio.h> #include "gsm.h" #include "lcd.h" #include "buzzer.h" extern int msgflag; /* main program start here */ int main(void) { pinsel0 = 0x00000000; // enable gpio on pins pinsel1 = 0x00000000; pinsel2 = 0x00000000; lcd_init(); // initial lcd lcd_write_control(0x01); // clear display (clear display,

mysql - Filter SQL result? -

i got same emails in status 3 , 1. , need show emails of status 3 query showing me in page of status 3 email status 1 here query: select live_customers.id, live_customers.date, live_customers.firstname, live_customers.lastname, live_customers.phone, live_customers.phone2, live_customers.email, live_customers.num_sellers, live_customers.sell_date,live_customers.public_description, live_customers.public_image, live_customers.price, live_customers.takanon, live_customers.confirm_mail_sent, live_customers.paid, live_customers.shirt_size, live_customers.shirt_size_extra, live_customers.stand_rent, live_customers.refunded, live_customers.call1, live_customers.call2, live_customers.notes, live_customers.auth_number, live_customers.hascontact, live_customers.ip, live_customers.status, live_status.name statusname, live_status.color statuscolor, live_compound.name compoundname live_custome

linux - How to grep both header and pattern with grep -

i need grep both header , particular pattern using grep, eg for command "ps" output pid tty time cmd 10280 pts/16 00:00:00 ps 32463 pts/16 00:00:00 bash how can grep both header , pattern 32463 output should pid tty time cmd 32463 pts/16 00:00:00 bash and 1 thing solution should general means should applicable commands have headers how can grep both header , pattern you try this ps | grep -e 'pid\|32463' solution should general means should applicable commands have headers this requirement impossible satisfy grep , because different commands have different headers, impossible assign regular expression match of them. but use following command achieve goal: command | perl -e 'while(<stdin>) { print if $. == 1 or m/$argv[0]/ }' pattern if cumbersome daily use, can put in custom script, such my-grep , , put script in $path , can use script normal command: command | my-grep pattern

Why (A - B) .^ 2 is not equal to (B - A) .^ 2 in MATLAB? -

suppose have quantization function quantize 8bit gray scale image : function mse = uni_quan(i, b) q = / 2 ^ (8 - b); q = uint8(q); q = q * 2 ^ (8 - b); mse = sum(sum((i - q) .^ 2, 1), 2) / numel(i); end this function perform uniform quantization on image i , convert b bit image, scale in 0-255 range, want calculate mse (mean square error) of process but result for mse = sum(sum((i - q) .^ 2, 1), 2) / numel(i); and mse = sum(sum((q - i) .^ 2, 1), 2) / numel(i); is different. can please point me out whats problem? thanks the problem type of matrixes. combining 2 unsigned matrixes. if q-i<0 result 0 , different i-q. in order use uint8 , can compute mse in 2 steps: %compute absolute difference, according sign difference = q-i; neg_idx = find(i>q); difference(neg_idx) = i(neg_idx)-q(neg_idx); %compute mse mse = sum(sum((difference) .^ 2, 1), 2) / numel(i);

perl - Why I can't pass one argument to sub -

input directory name , output text file name in directory , file's name, line count, word count. when checked program, know when second sub working, $_ nothing "". how should fix ? #!/usr/bin/perl use strict; use warnings; $dir = <stdin>; chomp($dir); # remove '\n'(new-line character) directory address opendir(dirhandle, "$dir"); @arr = readdir(dirhandle); close(dirhandle); foreach(@arr){ if($_ =~ /.txt/){ print "file name : $_\n"; $tmp = $_; print "line numb : ".&how_many_lines($_)."\n"; print "word numb : ".&how_many_words($_)."\n\n"; } } sub how_many_lines{ open(file, "$_") || die "can't open '$_': $!"; $cnt=0; while(<file>){ $cnt++; } close(file); return $cnt; } sub how_many_words{ open(text, "$_") || die "can't open '$_': $!"

Fetching and caching photos on demand with nginx -

i developing application, use of photos provided third party service. while building first prototype, got images directly service, i.e. <img src="http://thirdpartyservice.com/img/12345.jpg"> it production though, makes no sense grabbing images service every time requested. slow, because serves millions of users @ same time. i'd build thin layer on top of nginx, fetches, , caches images 24 hours based on demand. instead of calling service every time, i'd rather call <img src="http://myapp.com/img?url=thirdpartyservice.com/img/12345.jpg"> if first time image requested, fetched remote service , cached on servers 24 hours. is possible nginx? first suggest not change url format http://myapp.com/img/12345.jpg in case proxy same thirdpartyservice.com. here config example based on nginx wiki . http { proxy_cache_path /data/nginx/cache levels=1:2 keys_zone=static:10m inactive=24

django-allauth, recommendations for limiting failed login attempts -

i'm using django-axes limit login attempts admin backend. however, frontend client login via django-allauth can't find mechanism detect , prevent failed logins. what best way prevent multiple failed login attempts allauth? there recommended solution? i'm not keen on blocking attempts particular ip, prevent multiple attempts @ single username ie 'admin'. thanks in advance, i'm not sure if best way go this, used axes watch allauth login so: from axes.decorators import watch_login allauth.account.views import login url(r'^accounts/login/$', watch_login(login)), url(r'^accounts/', include('allauth.urls')),

ios - How to remove unused images from an Xcode project -

Image
i'm following link find unused images xcode project not working me. tried rob's answer , roman's answer give me png images. tried use tool giving me png images edit the way im using script 1)i copy script , paste in terminal , press enter. 2) save script in txt file , in terminal type sh myscript.txt hey there tool named unused finding unused resources. please check this , download it.

Batch file to move file based on Month & Year on Date modified to folder with YYYY_MM -

anyone can me create batch file move *.xml file x folder yyyy_mm folder based on month & year on date modified xml file? i not sure put inside loop. @echo off echo date %date% dir /od/b "c:\users\*.xml" > test.log /f %%f in (test.log) ( ) at first want put set var = %%~tf inside loop later can use substring on var month , year , can move xml file yyyy_mm folder based on that, seems it's not working. try this[no robocopy required]: @echo off set "src=c:\test" set "dest=c:\test" %%f in ("%src%\*") ( /f "tokens=1,2,3 delims=/ " %%a in ("%%~tf") ( if not exist "%dest%\%%c_%%a" mkdir "%dest%\%%c_%%a" move "%%~ff" "%dest%\%%c_%%a" ) )

html5 - javascript - blocking a set of dates in a date input, is it possible? -

i'm doing upgrade customer's website , found following challenge: this customer has reservation system composed of 2 date input tags determine dates he/she entering hotel room. know there's jquery , pure javascript-driven plug-ins (like dhtmlx suite or jquery easyui controls) wonders in sense, know if possible add date blocking functionality plain <input type="date"> tag. so far, i've got add predefined dates using <datalist> tag , using date input list attribute, that's it. is possible block dates javascript? it looks support <input type="date"> still not solid . interested learn feature coming, though. found this article quite helpful, , examples use opera examples, gives sense of coming. here fiddle containing data input. me renders plain text field :( <input id="startdate" name="startdate" min="2012-01-01" max="2013-01-01" type="date">

android - how to get data(name=“string”) from Arraylist in java? -

i'm trying data arraylist name=telugu. don't know do. please 1 this. my code is(in jsp page): try{ string lang=request.getparameter("languages"); out.println("know languages are:"+lang); }catch(exception e){ e.printstacktrace(); } above languages parameter containe data: [namedfacebooktype[id=107617475934611 metadata=null name=telugu type=null], namedfacebooktype[id=112969428713061 metadata=null name=hindi type=null], namedfacebooktype[id=106059522759137 metadata=null name=english type=null]] i want display know languages are: telugu hindhi english any 1 thank you. from output looks "request.getparameter("languages")" returns collection of objects of type "namedfacebooktype". you need type cast output of "request.getparameter("languages")" collection type (or interface/parent class). ie. list<namedfacebooktype> you need iterate collection , use appropriate ge

java - SimpleDateFormat.parse() converts DTstring to local time. Can be converted to source's time? -

i have followed so answer datetime conversion of 8601. i cite example straight w3 : 1994-11-05t08:15:30-05:00 corresponds november 5, 1994, 8:15:30 am, eastern standard time. 1994-11-05t13:15:30z corresponds same instant. and run in android simpledateformat sdfsource = new simpledateformat("yyyy-mm-dd't'hh:mm:sszzzzz"); datetime = sdfsource.parse("2014-03-06t11:30:00-05:00"); system.out.println(datetime); //thu mar 06 18:30:00 eet 2014 obviously .parse() 's output local aware datetime. there has been conversion est (-05:00) eet (+02:00) since in timezone. not want auto-convertion. is there way parse datetime string in yyyy-mm-dd't'hh:mm:sszzzzz format , display that timezone's datetime? preferable output: thu mar 06 11:30:00 est 2014 the est , location example. can other timezones well. internally date objects in utc , that's they're parsed to. you cannot retrieve original timezone date can att

apache - PHP displays a code in browser rather then execute but only for virtual hosts -

i have installed fresh lamp on ubuntu 13.10 after installation php works fine if put php code default localhost web folder /var/www i created virtual host. did before , never had problems added file /etc/apache2/mods-enabled , activated but when enter virtual host in browser can see code of index.php file in browser. also when execute php code command line can see source of code , not executed. what can be? try use <?php , ?> not short tags, or if want use (their use discouraged due compatibility issues), ensure php.ini configuration have: short_open_tag=on

writing source and custom sink using flume-ng -

i new flume-ng. want source send unique xml files channel 1 one. channel validate xml files , send validity(either true or false) , xml file th custom sink. sink write valid files , invalid files different directories in hdfs. not sure source use. please help. none of current ones fit use case. spoolingdirectorysource line-oriented xml files confuse , not arrive in 1 piece. i suggest write custom source application.

c# - Replace certain string if it has a matching string after it? -

i have string this: this'is'my' test' string' i need find , replace prefer using regex, on '. i need replace ' '\r\n, not change other lines have line spacing, make this: this' is' my' test' string' i can't remove "\r\n"'s , change them all, need quick , change needed changed. currently doing this: var escapecharactor = "?" var lineendcharactor = "'" string result = regex.replace(data, @"(([^\" + escapecharactor + "]" + lineendcharactor + @"[^\r\n|^\r|^\n])|(\" + escapecharactor + @"\" + escapecharactor + lineendcharactor + "[^\r\n|^\r|^\n]))", "$1\r\n"); return edidataunwrapped; but creating this: this'i s'm y' test' string' is possible alter ones , not include letter or going have manage removing \r\n's , adding of them? here non-regex approach: string teststring = @"t

php - if cat is 2 show specific sidebar wordpress -

i trying specific sidebar show when post in specific categories code have doesn't seems work. here code: <div class="sidebar"> <?php if (is_single() && in_category('2') ) { ?> <?php dynamic_sidebar( 'blog-sidebar' ); ?> <?php } else { ?> <?php dynamic_sidebar( 'general-sidebar' ); ?> <?php } <!-- load posts related current post --> $currentcat = get_query_var('cat'); $relatedargs = array ( 'cat' => 'array($currentcat)', 'posts_per_page' => '2', 'ignore_sticky_posts' => true, 'orderby' => 'rand', 'post__not_in' => array( $post->id ), 'cat' => '-1' ); $relatedposts = new wp_query( $relatedargs ); ?> <?php if ( $relatedpost

c# - Entity Framework Working with temporary objects -

i'm using ef 4.1 , want perform checks using temporary objects. the problem i've encountered is, objects written database save changes. tried detach objects, whole object graph gets shredded , can't access referenced objects required checks. my code looks this: createtemporder() { order order = new order(); order.customer = dbcontext.customers.single(c => c.id == cid); dbcontext.detach(order); return order; } are there best practices handle temporary objects in ef or need override detachment procedure? thanks in advance if don't want ef track entities can use asnotracking() method: order = dbcontext.orders.asnotracking().single(o => o.id == oid); of course works if order entity managed ef.

plugins - Liferay 6.2: Documents and Media portlet subscription feature not working for standard user -

i using liferay 6.2 , want set options folder subscription feature in documents , media portlet. problem button "subscribe" appears admin-user. every other user of portal not showing up. i checked every permission set users in portal , subscription-feature seen. how can have normal users subscribe folders? where can find right settings? tia i found solution myself. the problem users not assigned open site. although had roles needed had assigned site, not community.

c# - Multiple forms with listbox -

could tell me how write code when user clicks on specific entry in listbox, example if click first name "josh", open new form can add , edit details paticular person? have looked on website , nothing seems on here. thanks josh. you can use events of listbox click event ... perform action want.

java - application migrate from java6 to java7 -

i using proprietary application server ( sip protocol ) in using embedded tomcat ( http protocol ). running java 1.6u21. now want use java 1.7u51 have compiled code on java1.7u51.when start server , getting below error : org.apache.catalina.lifecycleexception: failed start component [org.apache.catalina.session.standardmanager[]] @ org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:154) @ org.apache.catalina.core.standardcontext.startinternal(standardcontext.java:5294) @ org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:150) @ org.apache.catalina.core.containerbase$startchild.call(containerbase.java:1559) @ org.apache.catalina.core.containerbase$startchild.call(containerbase.java:1549) @ java.util.concurrent.futuretask.run(futuretask.java:262) @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1145) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:615) @ java.lang

ios - How can I handle this Array object? (Objective-C) -

first have nsdictionary . nsurlrequest , load dictionary json information request. nsdictionary *json =[nsjsonserialization jsonobjectwithdata:response options:kniloptions error:&error]; this dictionary has 2 keys 2 values. 1 key = (_ nscfstring) "games" (value: ( _nscfarray*)) , other 1 "id"(of player). because want recent games [json objectforkey:@"games"] . nsarray 10 objects. first object listed below. how can label champion (from championid) player played or game type played? because in 1 object. how can split array information? i appreciate every help. thank time. 'nslogged' [ objectatindex:0] { championid = 102; createdate = 1394092919791; fellowplayers = ( { championid = 37; summonerid = 23497430; teamid = 200; }, { championid = 81; summone

css - @font-face fonts doesn't render consistently on all Android versions -

Image
i'm trying use customized roboto font arabic fail rendered in phonegap/android application: on galaxy ace (android 2.3.2), application renders arabic characters (see image#1). on galaxy s3 , s4 (android 4.3), application renders arabic characters using default font (see image#2). image#1 image#2 html page <!doctype html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <style type="text/css"> @font-face { font-family: 'arabicfont'; src: url("fonts/kacsttitle.ttf") format("truetype"); } @font-face { font-family: 'latinfont'; src: url("fonts/dejavuserif.ttf") format("truetype"); } .arabictext { font-family: arabicfont; direction: rtl; } .latintext { font-family: latinfont; dir

c# - Sending mail through SmtpClient -

i trying setup program sent e-mails through smtp server not localhost. using system.net.mail . this: var msmtpclient = new smtpclient(); var mmailmessage = new mailmessage() { subject = subject, body = body, isbodyhtml = true, priority = mailpriority.normal, }; the case is working when using google smtp server smtp.gmail.com . treed send e-mails using server different accounts. , example hotmail.com received (though moved junk) gmail.com not. ok. here comes hint. never use ip of pc. replace domain name or localhost. did trick me. bonus alternateviews can help.

java - Elasticsearch improve query performance -

i'm trying improve query performance. takes average of 3 seconds simple queries don't touch nested document, , it's longer. curl "http://searchbox:9200/global/user/_search?n=0&sort=influence:asc&q=user.name:bill%20smith" even without sort takes seconds. here details of cluster: 1.4tb index size. 210m documents aren't nested (about 10kb each) 500m documents in total. (nested documents small: 2-5 fields). 128 segments per node. 3 nodes, m2.4xlarge (-xmx set 40g, machine memory 60g) 3 shards. index on amazon ebs volumes. replication 0 (have tried replication 2 little improvement) i don't see noticeable spikes in cpu/memory etc. ideas how improved? garry's points heap space true, it's not heap space that's issue here. with current configuration, you'll have less 60gb of page cache available, 1.5 tb index. less 4.2% of index in page cache, there's high probability you'll needing hit disk of searches. you

html - Putting the image behind the background -

i have simple html, i'm not sure if want (the way want it) possible.. <div class="container"> <img src="..." /> </div> .container has sort of gradient background, in case common black bottom text background: -webkit-linear-gradient(top, rgba(255, 255, 255, 0) 65%, rgba(47, 39, 39, 0.7)); this simulated in http://jsfiddle.net/9wql6/ i want dark bottom in front of picture, not behind it. i can't use background-image image because css precompiled. is possible? another way go pseudo-element (ie8+) jsfiddle demo css .container{ max-width: 200px; border: 1px solid black; position: relative; } .container img{ max-width: 200px; } .container:after { position: absolute; content:" "; top:0; left:0; height:100%; width:100%; background: -webkit-gradient(top, from(rgba(255, 255, 255, 0)), color-stop(0.65, rgba(255, 255, 255, 0.7)), color-stop(1, rgba(47, 39, 39, 0

ios - Draw a border around a SKLabelNode -

i'm making app in i'm using sklabelnode . put border around it. this code sofar: sklabelnode *scorelabel; scorelabel = [sklabelnode labelnodewithfontnames:@"helvetica-bold"]; scorelabel.text = @"@"; scorelabel.alpha = 1; scorelabel.fontsize = 30; scorelabel.position = cgpointmake(149,525); [self addchild:scorelabel]; also, know how use custom font this? say make own font, , want put border around it, how this? i bmglyph way go. use time.

mysql query using MAX -

i hope can me. i've looked @ other threads not able find right answer. i have mysql database following data: id, company, datefrom, dateto, rate, point1, point2 1, dhl, 2014-03-01, 2014-03-31, $1000, paris, new york 2, mrw, 2014-03-01, 2014-03-31, $1300, paris, new york 3, exp, 2014-03-01, 2014-03-31, $1000, paris, new york 4, dhl, 2014-03-06, 2014-03-31, $900, paris, new york 5, fed, 2014-03-01, 2014-03-31, $1200, paris, new york i need query where, based on date, display rates valid on date onwards. example if today 2014-03-06, need result : 2, mrw, 2014-03-01, 2014-03-31, $1300, paris, new york 3, exp, 2014-03-01, 2014-03-31, $1000, paris, new york 4, dhl, 2014-03-06, 2014-03-31, $900, paris, new york 5, fed, 2014-03-01, 2014-03-31, $1200, paris, new york as can see, record 1 not displayed record 4 replaces record 1 of 2014-03-06 i have tried following query, worked: select id, company, max(datefrom), dateto, rate, point1, point2 mydatabase datefrom<

Can python list and dictionary be nested infinitely? -

recently found python list , dictionary can nested in multiple level this a = {'a1':[{'a2':{'a3':[4,5,6]}}]} so i'd ask there technical limit nested level? if there isn't, there conventional limit nested level, what's it? the limit memory. given infinite memory can nest python objects infinitely. demo: >>> root = lst = [] >>> levels = 0 >>> while true: ... lst.append([]) ... lst = lst[-1] ... levels += 1 ... if levels % 1000000 == 0: # every 1 million ... print levels ... 1000000 2000000 3000000 4000000 5000000 6000000 7000000 8000000 9000000 10000000 11000000 # .... # [ slower , slower system starts swap ] # .... traceback (most recent call last): file "<stdin>", line 1, in <module> memoryerror for sake of sanity killed @ 30 million objects though.

How can I pass arguments into node.js javascript file? -

i totally new node , have been reading process api site. not think have context down yet on getting better understanding. i want pass argument node script, command line node connecttoerver.js -ip 192.10.10.1. have code below kind of works reading docs not know going on here. process.argv.foreach(function(val, index, array) { console.log(index + ': ' + val); }); your example node docs , process.argv (argv stands arguments vector) is an array containing command line arguments. first element 'node', second element name of javascript file. next elements additional command line arguments. so output connecttoerver.js -ip 192.10.10.1 going be: 0: node 1: path/to/connecttoerver.js 2: --=ip 3: 192.10.10.1 process.argv array of command line arguments passed script. first 1 node , second filepath , others arguments passed script separated white space. what want library parse arguments , pass in handy way. example optimist you'll get: var a

sharepoint - Social rating in SP 2010 - disapering votes -

i've enabled rating feature on sp2010 site. followed material - http://social.technet.microsoft.com/forums/en-us/8b3dccba-1621-47d6-be2d-a47feb74b83f/how-do-i-display-sharepoint-ratings-rating-05-on-a-page?forum=sharepointdevelopmentlegacy problem had missing rating setting in list, fixed ps described here - enable rating feature sharepoint 2010 . the problem ratings disappear after time. e.g. book in library has 7 votes yesterday , 1 today. wasn't 1 accident - received 10 complaints. users can't cancel votes - change. both sync timers set 1 min. really dunno why occurs - active googling haven't me. grateful advice.

Draw text inside android circle -

Image
public static bitmap drawcircle(int width,int height, int borderwidth) { bitmap canvasbitmap = bitmap.createbitmap( 350, 350, bitmap.config.argb_8888); bitmapshader shader = new bitmapshader(canvasbitmap, tilemode.clamp, tilemode.clamp); paint paint = new paint(); paint.setantialias(true); paint.setshader(shader); paint.setshader(null); paint.setstyle(paint.style.stroke); paint.setcolor(color.white); paint.setstrokewidth(borderwidth); paint paint1 = new paint(); paint1.setantialias(true); paint1.setshader(shader); paint1.setshader(null); paint1.setstyle(paint.style.stroke); paint1.setcolor(color.white); paint1.setstrokewidth(borderwidth); canvas canvas = new canvas(canvasbitmap); float radius = width > height ? ((float) height) / 2f : ((float) width) / 2f; //canvas.drawcircle(width / 2, height / 2, radius - borderwidth / 2, paint); final rectf rect = new rectf(); rect.set(100, 100, 300, 300);

javascript - Bootstrap popover replicating code -

i using raty perform rating functionality , showing inside popover. the problem first time click on link, correctly create stars but, when click second time, stars replicated, popups 10 stars instead of 5. $('#member1').popover({ html: true, placement: 'bottom', content: function() { return $($(this).data('contentwrapper')).html(); } }).click(function() { $('.star').each(function(el) { $(this).raty({ staroff : 'http://wbotelhos.com/raty/lib/images/star-off.png', staron : 'http://wbotelhos.com/raty/lib/images/star-on.png', start: $(this).attr('data-rating') }); }); }); i replicate error in fiddle . can let me know how fix this, and, therefore, show 5 stars? thanks!!!! i not overly familiar raty, seems need destroy existing before running code second, or third time. $(this).raty('destroy'); something that, check rat

Changing firefox tab index -

i'm working on addon , change index of tab. possible in xul, know how make jetpack have work xul. idea ? thanks it absolutely is. const {classes: cc, interfaces: ci, utils: cu} = components; cu.import('resource://gre/modules/services.jsm'); var mostrecentchromebrowserwin = services.wm.getmostrecentwindow('navigator:browser'); if (mostrecentchromebrowserwin.gbrowser && mostrecentchromebrowserwin.gbrowser.tabcontainer) { mostrecentchromebrowserwin.gbrowser.selectedtab = mostrecentchromebrowserwin.gbrowser.tabcontainer.childnodes[0]; //make 0 here there number, starts 0 }

Erlang, Matching with list foreach -

i've been making chat application in erlang school project, i've run issue. i'm trying make program concurrent , in order start new thread each message channel sending. using lists:foreach, want make sure don't message person typed in channel. request(state, {message, {userid,userpid}, token}) -> case catch lists:member({userid,userpid}, state#channel.users) of false -> {{error, user_not_joined}, state}; true -> spawn( fun() -> listofusers = state#channel.users, userpids = lists:map(fun ({_, v}) -> v end, listofusers), %spawn( fun() ->end) lists:foreach( fun(userpid) -> ok end, fun(pid) -> spawn( fun() -> genserver:request(pid, {message_from_server, state#channel.name, userid, token}) end) end, userpids) end), {ok, state} end; what pretty want match userpid inside foreach. of warnings: channel.erl:39: warning: variab

c# - EntityConnection error The specified named connection is either not found in the configuration -

well, know there topic that, believe me - tried , still didn't answer how solve issue. error: specified named connection either not found in configuration, not intended used entityclient provider, or not valid. in app.config have connection string: <add name="getproductsentities" connectionstring="metadata=res://*/getproductsmodel.csdl|res://*/getproductsmodel.ssdl|res://*/getproductsmodel.msl;provider=system.data.sqlclient;provider connection string=&quot;data source=(local);initial catalog=maindb;integrated security=true;multipleactiveresultsets=true;app=entityframework&quot;" providername="system.data.entityclient" /> samae in model when click properties: metadata=res://*/getproductsmodel.csdl|res://*/getproductsmodel.ssdl|res://*/getproductsmodel.msl;provider=system.data.sqlclient;provider connection string="data source=(local);initial catalog=maindb;integrated security=true;multipleactiveresultsets=true;app=enti

java ee - Unsatisfied dependencies for type [AbstractFacade<Object>] with qualifiers [@Default] at injection point [[BackedAnnotatedField] on GlassFish 4.0 -

when jsf managed bean extends abstract controller, unsatisfied dependencies exception. have methods in abstractcontroller override in policecaselist bean. however, exception below: tried reading here , here , situation seems different. exception javax.servlet.servletexception: weld-001408 unsatisfied dependencies type [abstractfacade] qualifiers [@default] @ injection point [[backedannotatedfield] @inject private ijmiscrudgen.backing.abstractcontroller.ejbfacade] root cause org.jboss.weld.exceptions.illegalargumentexception: weld-001408 unsatisfied dependencies type [abstractfacade] qualifiers [@default] @ injection point [[backedannotatedfield] @inject private ijmiscrudgen.backing.abstractcontroller.ejbfacade] @managedbean @viewscoped public class policecaselist extends abstractcontroller<tblcase>{ @inject private tblcasefacade casefacade; private tblcaseperson selectedperson; private tblcase selected; @managedproperty(value = "#{logincontroller}"

javascript - On change event on the selection of dropdown's value using underscore and backbone -

i created dynamic dropdown in template. , further requirement change value of dropdown , send value web service hit change in system. have no idea how in underscore template. below code write dynamic dropdown. , have write ratecall function either in template file or in main.js no idea it. , rightnow firing alert showing on change fired not working. error coming ratecall not defined. appreciated. in advance. <select id="rate" onchange="ratecall()"> <% for(var i=0;i<post.scales-1;i++){ if(i==post.rated){ var a= 'selected'; }else{ a=''; } %> <option id="<%=i%>"<%=a %> > <%= i%></option> <%}%> </select> <%}else{ }

svm - Moving from support vector machine to neural network (Back propagation) -

i'm working text recognition , i'm using support vector machine method. try neural network also. read few documents how neural network works, theory quite heavy , don't know how apply case. if can me make clear, neural network's architecture. currently, in svm, have 200 features (divided 4 main categories), used recognize text. if move neural network, 200 features, mean have 200 neutrons in input layer? with 200 features, how result in architecture of neural network (in term of numbers layers (hidden layer) , neutrons)? in svm, have 1 class classification (basically, true , false) , multi-class classification (labels), how difference apply output layer of neural networks? and have few general questions : what decide number of hidden layers , number of neutrons inside each hidden layer? does number of hidden layer relate accuracy ? i'm new neural network great if can explain me in understable way. :) thank much. point 1 - 200 input neuro

Variable constants in PHP -

is possible change value of constant in php? want sensible defaults configuration files our project. currently doing: config.php: define('web_root', '/home/user/public_html'); config.default.php: defined('web_root') || define('web_root', '/home/user/public_html'); the problem in cases, may want access configuration defaults inside 'config.php'. example: config.php define('user_file_root', web_root.'/files'); the scheme constants configuration has been used 5 years, , rewriting framework not option. it's constant, , definition shouldn't able redefine it. problem lies in code logic if ended needing redefine it. but if still want go on path can use runkit_constant_redefine