Posts

Showing posts from April, 2012

Error while running python program -

Error while running python program - i running code pyzillow , encountering next problem while importing django library. from django.contrib.gis.geos.error import geosexception importerror: no module named django.contrib.gis.geos.error thoughts? follow django docs, find line in settings , create this- geos_library_path = r'c:\program files\osgeo4w64\bin\geos_c.dll' this solve issue python

mysql - The couchdb equivalent of a relational database model -

mysql - The couchdb equivalent of a relational database model - i new @ utilize of couchdb, have background in backend programming , relational databases. i want "migrate knowledge" mysql couchdb. although found lot of info installation , getting started tutorials, having problem "translate" relational model couchdb document storage. , know, need reset way of thinking... i want matter best way possible, started basic exercise. have simple relational model actual in utilize software application. simplicity purposes, toned downwards number of fields. case we have stack of cards. each card has own properties (id, name, imgpath, etc). each user can have random collection of cards picked stack in own cards collection. mysql in mysql there 3 tables: users [id, name, password] cards [id, name, value1, value2, imgpath, etc] usercards [userid, cardid] other relevant information: we have more 10k users , growing. it's mobile app, speed much r...

Python pyodbc Unicode issue -

Python pyodbc Unicode issue - i have string variable res have derived pyodbc cursor shown in bottom. table test has single row info ä unicode codepoint u'\xe4' . the result >>> res,type(res) ('\xe4', <type 'str'>) whereas result should have got is. >>> res,type(res) (u'\xe4', <type 'unicode'>) i tried adding charset utf-8 pyodbc connect string shown below. result correctly set unicode codepoint someother string ꓃ due possible bug in pyodbc driver. conn = pyodbc.connect(dsn='datbase;charset=utf8',ansi=true,autocommit=true) >>> res,type(res) (u'\ua4c3', <type 'unicode'>) actual code import pyodbc pyodbc.pooling=false conn = pyodbc.connect(dsn='datbase',ansi=true,autocommit=true) cursor = conn.cursor() cur = cursor.execute('select col1 test') res = cur.fetchall()[0][0] print(res) additional details database: teradata pyodbc versio...

Syntax when calling an array as the variable in a new block of code? [C] -

Syntax when calling an array as the variable in a new block of code? [C] - i'm still pretty new coding i'm having problem syntax in situation. how supposed format this? whenever seek build program, says there error: error: expected primary-expression before ']' token assign_q(chess[][]); there's no need me set code here, here's little snippet: #define n 8 int chess[n][n] = {2}, l, m; void assign_q(int chess[n][n]); int main() { int i, j; assign_q(chess[][]); in c, if want pass array, have not have utilize [] -operator. [] -operator access array-elements. in illustration chess of type int [][] , there no need de-reference it. however, may not have pass array @ all. if declare array @ global scope have done it, can access straight anywhere within same compilation unit or 1 using extern . c arrays

Serilog - Output/Enrich All Messages with MethodName from which log entry was Called -

Serilog - Output/Enrich All Messages with MethodName from which log entry was Called - is there anyway enrich serilog output method name. for instance consider if have following; public class myclassname private function myfunctionname() boolean logger.information("hello world") homecoming true end function end class the desired output follows; 2015-04-06 18:41:35.361 +10:00 [information] [myfunctionname] hello world! actually qualified name good. 2015-04-06 18:41:35.361 +10:00 [information] [myclassname.myfunctionname] hello world! it seems "enrichers" static info , won't work each time. it's possible enricher reflecting on phone call stack, expensive so, serilog doesn't offer it. instead can utilize like: logger.here().information("hello, world!"); and implement here() method extension method on ilogger : <extension> public sub here(byval logger ilogger, <callermem...

spring mvc wrong error code (405 instead of 415) -

spring mvc wrong error code (405 instead of 415) - i've got next (simple) controller method: @requestmapping( value = "/testjson", method = requestmethod.post, consumes = application_json_value, produces = application_json_value) @responsebody public string testjson() { logger.info("got test"); homecoming "test"; } when send post request url containing header "content-type=application/json" works fine. the unusual thing is, when don't send content-type or content-type "text/plain" (still post request), next error code server: 405 method not allowed. but expect error code: 415 unsupported media type. response header contains next line: allow: get, head not create sense too... i right error code api. thought problem be? i'm using spring 4.1.6.release on tomcat 7.0.59. thanks help. spring-mvc error-code

java - Get Android Notification To Appear As Banner -

java - Get Android Notification To Appear As Banner - i've looked extensively across wide range of terminology ("banner", "pop down", "notification type") , can't seem find clarity on 'think' mutual issue. if there obvious solution missed due lack of terminology please advice. the problem this: want android notification appear "banner" drops downwards top of screen (if banner wrong word please advise). went through docs , didn't seem across setting toggles behaviour. here illustration of like: i have notification working showing within drawer. it's not popping downwards drawer (which want). here code, if can advise how can create appear banner appreciate it: public void createnotification(context context, bundle extras) { notificationmanager mnotificationmanager = (notificationmanager) getsystemservice(context.notification_service); string appname = getappname(this); intent notificationin...

unity3d - Sprites are disappearing when I zoom in Unity -

unity3d - Sprites are disappearing when I zoom in Unity - in scene view when zoom in past point sprites (apart one) disappear , makes near impossible me edit them because become little see clearly. this started happening fine before , don't think have changed have affected ability show when zoomed in. the z positions have same of canvas using unity3d sprite zooming unity3d-2dtools

authentication - Login Form for a GoDaddy Reseller Website -

authentication - Login Form for a GoDaddy Reseller Website - i attempting recreate html login form godaddy reseller site can embed in website not having much luck. login form: https://idp.secureserver.net/login.aspx?ci=9106&spkey=spswnet-130506071814002&prog_id=domainspricedright for example, if seek re-create , paste entire dom element blank page , seek logging in it, redirected login page on reseller site have come in credentials again. i tried stripping form downwards bare essentials see if help. ideal form doesn't work either: <form name="form1" method="post" action="https://idp.secureserver.net/login.aspx?spkey=spmya4-130117123532002&amp;target=https%3a%2f%2fmya.secureserver.net%2fdefault.aspx%3fci%3d12819%26prog_id%3ddomainspricedright&amp;prog_id=domainspricedright"> <label for="login$userentrypanel2$usernametextbox">username or client #:</label> <input name="login$userentr...

css - Skrollr Troubles With Chrome Browser -

css - Skrollr Troubles With Chrome Browser - i'm learning how utilize skrollr.js library. awesome cool tool on using scroll bar in dom manipulate appearance of web site. have bit of steep learning curve understand how works. i'm playing simple sample. have image want remain on screen in background 500% of vertical height. have other text items want scroll in foreground. wanted test , have 1 of text items fade zero. helpful references: classic parallax scrolling example, , i hate tomatoes example i've got image in div loaded in position: fixed; location, , few divs in scrolling area below <div id="skrollr-body"> have text header wanted fade 0 utilize scroll bar. note: started skrollr.init() without arguments. also, not using jquery @ all. my problem works erratically on chrome, , works fine on firefox browser. i'm @ loss figure out why? i've created jsfiddle exhibit issue. http://jsfiddle.net/q3z3v6op/4/ fiddle works same ...

c - Is returning zero from main necessary, and how can the return value from main be useful? -

c - Is returning zero from main necessary, and how can the return value from main be useful? - i know it's been convention in c89 homecoming 0 integer value main in c program, this: int main() { /* useful here */ homecoming 0; } this homecoming "successful" result operating system. still consider myself novice (or intermediate programmer @ best) in c, date i've never understood why important. my guess is, useful homecoming result if you're tying output of programme input of another, i'm not sure. i've never found useful, or maybe don't understand intention is. my questions: is returning 0 necessary c program? how homecoming value main() useful? when writing scripts (like in bash, or cmd.exe on windows) can chain commands && , || operators. canonically, a && b run b if result of a zero, , a || b run b if a returned nonzero. this useful if wish conditionally run command if previous 1 ...

php - is_subcategory(); function for wordpress -

php - is_subcategory(); function for wordpress - hi know there many nice functions in wordpress is_page() , is_single() , is_category(); ... do u know how can create is_subcategory() function? thanks million. there not is_subcategory() function can children (sub category) of category , utilize conditional statement. <?php global $ancestor; $childcats = get_categories('child_of=' . $cat . '&hide_empty=1'); foreach ($childcats $childcat) { if (cat_is_ancestor_of($ancestor, $childcat->cat_id) == false){ //do stuff } } ?> php wordpress category

javascript - Best approach to remove special characters using ColdFusion and Microsoft SQL? -

javascript - Best approach to remove special characters using ColdFusion and Microsoft SQL? - i want remove special characters (",/{}etc.) input field beingness saved string db. what best approach? should check tackled js, coldfusion or microsoft sql - maybe three? how go coding using coldfusion or microsoft sql? you mean not alphanumeric? i'd utilize rereplace in info layer. <cfqueryparam cfsqltype="cf_sql_varchar" value="#rereplace(myvar,"[^0-9a-za-z ]","","all")#" /> update: changed include "space". javascript sql coldfusion

Calculating levenshtein distance within a list Python -

Calculating levenshtein distance within a list Python - i have list of strings , want filter out strings similar based on levenstein distance. if lev(list[0], list[10]) < 50 ; del list[10] . there way can calculate such distance between every pair of strings in list, more efficiently?? thanks!! data2= [] in data: index, j in enumerate(data): s = levenshtein(i, j) if s < 50: del data[index] data2.append(i) the rather dumb code above taking long compute... what if kept indexes of hit-strings , skipped them later? ignore how much enumerate() , del() weigh , percentage of hits (i.e. how many strings must removed dataset). threshold = 50 info = ["hel", "how", "are", "you"] # replace dataset tbr = {} # holds index of strings removed idx = 0 in data: j in xrange(len(data)): if j != idx , levenshtein(i, data[j]) < threshold: tbr[j] = true idx += 1 # print t...

asp.net - Get page size of URL -

asp.net - Get page size of URL - how can page size of requested url if url returning view? eg: localhost:800/home/index/3 the above url homecoming viewresult.then how can size of response server side including model data. asp.net asp.net-mvc

How to install mongodb on Redhat Linux PPC64 server -

How to install mongodb on Redhat Linux PPC64 server - hi beginner user of linux operating system, i trying install mongodb on redhat linux server not able achieve. i tried in many ways i downloaded tar file , extracted after running mongod getting cannot execute binary file i added mongo yum repository my repo file : [mongodb-org-3.0] name=mongodb org 3.0 repository baseurl=https://repo.mongodb.org/yum/redhat/5/mongodb-org/3.0/x86_64/ gpgcheck=0 enabled=1 and did yum update after running **sudo yum install -y mongodb-org-3.0 i getting next error this scheme not registered reddish hat subscription management. can utilize subscription-manager register. mongodb-org-3.0 | 951 b 00:00 setting install process no bundle mongodb-org-3.0 available. error: nil i downloaded rpm file when running rpm -i libmongodb-2.4.9-1.el6.ppc64.rpm error: failed dependencies: libcrypto.so.10(libcrypto.so.10)(6...

javascript - Unable to correctly position the tooltip content in HighCharts -

javascript - Unable to correctly position the tooltip content in HighCharts - i using highcharts combination chart compare forecast value(indicated line) , cumulative value (indicated column). cumulative value keeps increasing weekly , want able see if reaches predicted forecast value. i created graph in js fiddle, http://jsfiddle.net/aroauy4t/ . have shown js code below. $(function () { $('#container').highcharts({ title: { text: 'forecast vs cumulative chart' }, xaxis: { categories: [' ', ' ', 'bananas', ' ', ' '] }, labels: { items: [{ style: { left: '50px', top: '18px', color: (highcharts.theme && highcharts.theme.textcolor) || 'black' } }] }, series: [{ type: 'column'...

maven - How to add cookbooks from chef documentation -

maven - How to add cookbooks from chef documentation - i new chef cookbooks , working on task. have completed tutorial on chef.io struggling understand how can install cookbook provided @ chef-io. so of now, have downloaded cookbook. .tar file , extracted it. can see respective default.rb , other files unable how can add together cookbook existing cookbooks creating vm image. is there guide or tutorial can follow ? in add-on josh's reply sounds me want add together chef-repo after downloading , extracting gzip file? just add together maven directory cookbooks directory. or knife cookbook site install maven within chef-repo directory. or maybe want upload chef server? knife cookbook upload maven see: https://docs.chef.io/knife_cookbook.html#upload maven chef cookbook opennebula

web scraping - How to click Logout as finalizer in CasperJS -

web scraping - How to click Logout as finalizer in CasperJS - i creating web scraper (in casperjs using javascript) needs login authentication. need click logout link in end of script when process throws error, such non-existent element might occurs while in trial-and-error development. behavior similar java's finally {} block. this behavior required since web allows single session per user. if don't click logout, next scraper invocation must wait 5 minutes expire previous session not good. where should set logout click? you can set casper.options.exitonerror property false allow script go on execute execute logout click. var casper = require('casper').create({ exitonerror: false, }); or casper.options.exitonerror = false; this works in phantomjs 1.x, because phantomjs 2 doesn't throw error when selector cannot found. casperjs stops in case. web-scraping phantomjs casperjs

MySQL Create Trigger Syntax Error near END -

MySQL Create Trigger Syntax Error near END - when seek , run table/trigger creation script, next error: error 1064 (42000) @ line 19: have error in sql syntax; check manual corresponds mysql server version right syntax utilize near 'set new.fines_remaining = new.total_fines; end if; end' @ line 5 the next create trigger code causing error: delimiter // create trigger fines_trigger before insert on pupil each row begin if tuple.fines_remaining > tuple.total_fines set new.fines_remaining = new.total_fines; end if; end; // delimiter ; i can't figure out why happening, sense syntax fine, it's not since there's error beingness thrown. edit: after posting notice still have these tuple 'variables' using before figured out 'old' , 'new'. i'm changing them , update momentarily. you missing then after if condition delimiter // create tri...

qt - Where to find PySide for Qt5.x -

qt - Where to find PySide for Qt5.x - i know développement of pyside version of qt stopped, cases, want install it. where can download lastly developped version of pyside qt 5.x ? qt qt5 pyside

How can I import in Java top execute scanner.in -

How can I import in Java top execute scanner.in - package com.input; public class input { public static void main(string args[]){ scanner value = new scanner(system.in); system.out.println(value.nextline()); } } i trying input keyboard in java . not import code. please help me find import above programme , find bug in above programme add import java.util.scanner after between package ... , public class input{ import scanner . java

optimization - Is a C++ optimizer allowed to move statements across a function call? -

optimization - Is a C++ optimizer allowed to move statements across a function call? - note: no multithreading @ here. optimized single-threaded code. a function phone call introduces sequence point. (apparently.) does follow compiler (if optimizer inlines function) not allowed move/intermingle instructions prior/after function's instructions? (as long can "proove" no observable effects obviously.) explanatory background: now, there nice article wrt. benchmarking class c++, author stated: the code time won’t rearranged optimizer , lie between start / end calls now(), can guarantee our timing valid. to asked how can sure, , nick replied: you can check comment in reply http://codereview.stackexchange.com/a/48884. quote : “i careful timing things not functions because of optimizations compiler allowed do. not sure sequencing requirements , observable behavior understanding of such program. function phone call compiler not allowed ...

How to figure out what and where files are placed by an installer in Windows 7? -

How to figure out what and where files are placed by an installer in Windows 7? - i have exe installer installs drivers , utility software brother printer in windows 7 x86. able open installer file archive in 7zip , access files ddls. i want create silent installer installs printer drivers , utilities without needing user run installer. in order that, need know files installed installer , installer saves these files can of in silent installer. any thought how can figure out? (e.g. there way record installer does? or if there file in installer's bundle dictated installer files save on hdd , save them?) windows installer driver printers

c# - OpenReadCompleted Event is Not exist for HttpClient in Windows Phone 8.1 -

c# - OpenReadCompleted Event is Not exist for HttpClient in Windows Phone 8.1 - the openreadcompleted event exist in wp8.0 webclient, not exist in wp8.1 httpclient, alternative handle openreadcompleted event httpclient in wp8.1 httpclient client = new httpclient(); client.openreadcompleted += client_openreadcompleted; void client_openreadcompleted(object sender, openreadcompletedeventargs e) { memorystream str = new memorystream(); gifdecoder gd = new gifdecoder(); imagetools.extendedimage img = new imagetools.extendedimage(); gd.decode(img, e.result); //stream means image stream jpegencoder png = new jpegencoder(); png.encode(img, str); } httpclient uses async methods, not events. to utilize them, must first mark method async. can utilize getstreamasync method retrieve stream: private async void button_click(object sender, routedeventargs e) { using (var client = new system.net.http.httpcl...

sql - Pulling content for weekly data -

sql - Pulling content for weekly data - i have been tasked pulling data, each week. count needs restart each mon , ends friday. select count(*) piececount smallpainttransferconveyorfloat datepart allow filter week if have column date in table can utilize : select count(*) piececount smallpainttransferconveyorfloat grouping datepart(wk, <date_column_name>), datepart(year, <date_column_name>) replace 2nd parameter right column name on table here's short sqlfiddle illustration : http://sqlfiddle.com/#!6/a92ad/4/0 edit add datepart(year, date_column_name) remove unwanted merge if info cover more year sql

regex - htaccess proper redirect with trailing slash -

regex - htaccess proper redirect with trailing slash - good day! i want create proper redirect htaccess, when there request this: example.org/directory/page/ it should give example.org/page.php my htaccess lets redirect kind of request example.org/directory/page i utilize config #remove extension rewriterule ^([^\.]+)$ $1.php [nc,l] #remove directory rewriterule ^directory/(.*)$ /$1 [l] thank attention! reorder rules , tweak .php adding rule: #remove directory rewriterule ^directory/(.*)$ /$1 [l] #remove extension rewritecond %{document_root}/$1\.php -f [nc] rewriterule ^([^.]+)/?$ $1.php [l] regex apache .htaccess mod-rewrite clean-urls

javascript - AJAX toolkit -- problem with webservice execute -

javascript - AJAX toolkit -- problem with webservice execute - i'm having hard time understanding going on here. trying code onclick javascript button on force.com list view custom object. here's js. {!requirescript("/soap/ajax/15.0/apex.js")} {!requirescript("/soap/ajax/15.0/connection.js")} var myurl = sforce.apex.execute("mywebservices", "myurl", {}); and here's webservice i'm attempting call. global class mywebservices { webservice static string myurl(){ homecoming 'www.foo.com'; } } when click button, little alert pop-up saying: "a problem onclick javascript button or link encountered: cannot phone call method 'execute' of undefined" when iterate members of "sforce", there no "apex". i using literally exact same syntax in button in same org, difference beingness methods calling. button works. in fact, if re-create code problem script , set...

ruby on rails - How to retrieve values from a column called "object_id" in ActiveRecord? -

ruby on rails - How to retrieve values from a column called "object_id" in ActiveRecord? - i need access legacy relational database via activerecord , database uses column named "object_id" primary key in table. things work when seek specify custom sql query association (see below) activerecord respectively ruby interpreter retrieves object_id of ruby base of operations "object" instead of column value database. i defined next sql query in has_many declaration: :finder_sql => "select * t_object object_id in (select end_object_id t_object, t_connector t_object.object_id = #{object_id} , start_object_id = #{object_id}) i tried solve working alias: alias_attribute :my_oid, :object_id and using "my_oid" in sql query. got next error message: nameerror: undefined local variable or method `my_oid' eatobject(table doesn't exist):class i defined method returns value of read_attribute("object_id"...

XSD problem - trying to generate xsd from xml -

XSD problem - trying to generate xsd from xml - i trying generate schema xml file: http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?rettype=xml&retmode=xml&db=nucleotide&id=ab573763 i store s.xml , tried: xsd s.xml it not finish - seems stuck in endless loop or something. other options have generate xsd or can see wrong? thanks. christian a schema generated single instance document never going high quality 1 created schema can generated schema have distinct limitations. i suggest download schema nih (http://www.ncbi.nlm.nih.gov/dtd/ncbi_seqset.dtd @tuomas hietanen showed) , utilize tool such james clark's trang generate schema. resulting schema of higher quality. if have re-create of oxygen can utilize trang built-in. xsd

php - More professional error handling -

php - More professional error handling - i have contact form , handle errors checking each field one-by-one "if" statement. find hard , can't seem find better/more productive way them working. heading saying "error" if 1 (or more) true. cant them work separate "if" statements. here code: $name = $_post['name']; //get info form $email = $_post['email'];//get info form $message = $_post['message'];//get info form if($name == ""){ echo"<p class='error'>please come in name.</p>"; } if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$",$email)){ echo "<p class='error'>your email address not valid.</p>"; } if($message == ""){ echo"<p class='error'>please come in message.</p>"; } else{ echo"all ok, send email code..."; } edit: these errors validation of f...

jquery - Free jqGrid 4.8.0 - Add buttons to toolbar -

jquery - Free jqGrid 4.8.0 - Add buttons to toolbar - i larn there alternative add together toolbar grid adding toolbar:[true.'top'] (example adding empty toolbar top of grid). how add together buttons toolbar? know how jqgrid('navbuttonadd', nameofpager) works , familier toppager options, don't know how add together buttons toolbar mentioned above. thanks, jqgrid have no api manipulation of toolbar: [true, "top"] . goal of toolbar <div> within of jqgrid. css width attribute changed during resizing grid, nil more done. the answer provides (see the demo) provides practical illustration of usage of toolbar. add together info using $("#t_" + $.jgrid.jqid($grid[0].id)).append toolbar. in case if grid id don't contains special characters ( . , , , other) 1 can utilize simplified selector "#t_" + $grid[0].id . in same way 1 can move navigator buttons standard place top toolbar. practical have many...

java - How to verify the order of mocks without explicitly defining the order of methods? -

java - How to verify the order of mocks without explicitly defining the order of methods? - here method tested: protected void mymethod(final myobject object) { object.setx(...); object.sety(...); myobjectrepository.update(object); } in order verify order of calls -so repository called after setter calls- needed create mock of myobject (since inorder works mocks). at end should this: @mock private myobjectrepository myobjectrepositorymock; @test public void testmymethod() { myobject myobjectmock = mock(myobject.class); inorder inorder = mockito.inorder(myobjectmock, myobjectrepositorymock); // run test ..... inorder.verify(myobjectmock); inorder.verify(myobjectrepositorymock).update(myobjectmock); } .. see exception: .. unfinishedverificationexception missing method phone call verify(mock) here: ... illustration of right verification: verify(mock).dosomething() since not have verify order of setter calls, grouping th...

shell - search files in current directory whose name do not contain "txt" in linux -

shell - search files in current directory whose name do not contain "txt" in linux - i know how find files suffix .txt in current directory: find *.txt how invert this? i new linux, please help. thanks! if want current directory, , shell bash: shopt -s extglob ls !(*.txt) reference linux shell find-util

sql server - recursive calculation in sql view error GROUP BY, HAVING, or aggregate functions are not allowed in the recursive part -

sql server - recursive calculation in sql view error GROUP BY, HAVING, or aggregate functions are not allowed in the recursive part - i have simple sql server table , want find cost of each recipe. each recipe has list of ingredients. recipe may have sub recipes. simplest illustration of recipeid-1 chicken sandwich has below ingredients: ingredientid-1 breadstuff (an ingredient) - cost $1 ingredientid-2 fried chicken (an ingredient) - cost $5 recipeid-2 garlic sauce (a sub recipe) - cost $2 since garlic sauce recipeid-2 recipe (used sub recipe above), has below ingredients: ingredientid-3 raw garlic - cost $1.5 ingredientid-4 water - cost $0.5 finally table structure: now want view gives me cost of chicken sandwich, select * recursiverecipeview recipeid=1 , result be: $8 (1+5+1.5+.5). i have tried below query error "group by, having, or aggregate functions not allowed in recursive part of recursive mutual table look 'tree'" with tree (re...

colors - Multiple Intermittent Errors with Seemingly Simply Graphics Method C# -

colors - Multiple Intermittent Errors with Seemingly Simply Graphics Method C# - i have simple method analyzes sample image in picturebox , increases value of reddish channel. similar other methods analyze other color channels. user given alternative of choosing sample image containing desired color changes , applying original image. everything working fine until added trackbar enable user alter how much red, green, or bluish they'd add together or subtract sample image. now, works fine on first run. getting "cross-thread operation not valid" error, seem have resolved that. after first run, picturebox1 dissapears @ random , replaced dreaded reddish x. other times, picturebox1 has color changes applied @ total power, regardless of trackbar setting. other times, error stating "object in utilize elsewhere." have, best of understanding of concept, tried locking code errors out, has had no effect. have thoroughly researched these problems both h...

jquery - ResponsiveSlides fixed height, not responsive -

jquery - ResponsiveSlides fixed height, not responsive - i'm using responsiveslides project of mine. problem on big screens , height of slide gigantic , can't seem adjust , because if do, either image gets cutting or height of image shrinks bad ration. i've tried max-height on img , doesn't solve anything. i'm looking background-size: cover; achieve. i can't upload jsfiddle because doesn't work, responsiveslides doesn't have cdn. what should do? here screenshots: fullscreen : https://www.dropbox.com/s/dpnjxr9rltspxre/screenshot%202015-04-11%2016.03.49.png?dl=0 i want (which half size) : https://www.dropbox.com/s/7a8hmmp5txzoc7k/screenshot%202015-04-11%2016.04.26.png?dl=0 also having problems making div within slider, responsive, that's time. css: .rslides position relative list-style none overflow hidden width 100% padding 0 margin 0 li -webkit-backface-visibility hidden position absolute display none width...

python - How to get precise division? -

python - How to get precise division? - this question has reply here: how can forcefulness partition floating point in python? 11 answers i'm trying precise partition python without success. 104101/2 gives 52050 whereas need 52050.5 i tried "%0.2f" % (104101/2) giving me '52050.00' . javascript equivalent works. thought what's wrong me? 104101/2.0 104101/float(2) or utilize python 3 python int division python-2.x floating-point-precision

c# - WP multiphotochooser projects returns only small size image -

c# - WP multiphotochooser projects returns only small size image - i trying utilize multiphotochooser wp8, , found on https://multiphotochooser.codeplex.com/. project good, there's 1 problem though. after submitting selected images, shows list of images little , cropped 1:1 ratio. create event move image page next item click listener: private void lls_photolist_selectionchanged(object sender, selectionchangedeventargs e) { if (e.addeditems.count > 0) { phoneapplicationservice.current.state["myobject"] = e; //i used bring image next view. navigationservice.navigate(new uri("/viewimage.xaml", urikind.relative)); } } and in viewimage.xaml create display: var k = phoneapplicationservice.current.state["myobject"]; selectionchangedeventargs obj = (selectionchangedeventargs)k; bitmapimage bmi = ((pictureitem)obj.addeditems[0]).getmyimage(); //getmyimag...

javascript - Angular 'PersonCtrl' is not a function, got undefined -

javascript - Angular 'PersonCtrl' is not a function, got undefined - hi trying build first angular app typescript can not seem bind controller correctly. this typescript code: module app { var modules: string[] = ["app.person"]; angular.module('app', modules) .run([]); } module app.person { angular.module('app.person', []); } module app.person { angular.module("app.person") .controller('personctrl', personctrl); interface ipersonscope extends ng.iscope { fullname: string; } interface ipersonctrl { } class personctrl implements ipersonctrl{ public $scope: ipersonscope; static $inject = ['$scope']; constructor($scope: ipersonscope) { this.$scope = $scope; this.init(); } init() : void { this.$scope.fullname = 'justin s.'; } } } ...

jquery - append HTML from file with Cheerio, NodeJs -

jquery - append HTML from file with Cheerio, NodeJs - i trying append html file existing html cheerio maintain getting errors (the errors beingness produced cheerio library debugging hard) expo.includenav = function(html, result) { var file = 'templates/admin_nav.html'; fs.readfile(file, function(err, nav) { var $ = cheerio.load(html); $('body').append(nav); result($.html()); }); } it dosen't seem passing variable append function. if set html in instead of calling file works, so: $('body').append('<div class="nav"> navigation list here</div>'); but not want want front end end devs able edit html file instead of digging node js code find alter html. i'v worked out. assume else may run issue see beingness mutual need. here answer. you need specify want returned string instaed of buffer. 'utf8' expo.includenav = function(html, result) { ...

javascript - How to use AND Operator -

javascript - How to use AND Operator - if utilize this, not work if (levelspecificdata.labelfont) if (levelspecificdata.labelfont !== "arial" || levelspecificdata.labelfont !== "arial black" || levelspecificdata.labelfont !== "arial narrow" || levelspecificdata.labelfont !== "verdana" || levelspecificdata.labelfont !== "trebuchet ms") homecoming false; if (levelspecificdata.labelfont !== "arial") homecoming false; or operator if (levelspecificdata.labelfontsize) if (levelspecificdata.labelfontsize < 2 || levelspecificdata.labelfontsize > config.20) homecoming false; so utilize comparing between strings utilize , operator if (levelspecificdata.labelfont) if (levelspecificdata.labelfont !== "arial" && levelspecificdata.labelfont !== "arial black" && levelspecificdata.labe...

How to match bare urls with regex in PHP? -

How to match bare urls with regex in PHP? - $bits = preg_split('#((?:https?|ftp)://[^\s\'"<>()]+)#s', $token->data, -1, preg_split_delim_capture); say,i'm trying match urls need linkified.the above permissive. i want match simple urls http://google.com , not <a href="http://google.com">http://google.com</a> , or <iframe src="http://google.com"></iframe> it appears you're trying parse html using regular expressions. you might want rethink that. php regex url

windows phone 7 - Silverlight/WP7: programmatically change the button background image -

windows phone 7 - Silverlight/WP7: programmatically change the button background image - <button x:name="btnsearch" height="120" width="120" margin="-20,-30,0,0" click="btnsearch_click" borderthickness="0" borderbrush="{x:null}" visibility="visible" > <button.background> <imagebrush x:name="searchimage" imagesource="images\appbar.feature.search.rest.png" stretch="fill"/> </button.background> in above xaml have alter imagesource programmatically different image. how do ? an approach can utilize described here. since question not specify action code takes alter background, therefore, may have adapt code in referred link bit. note may have homecoming imagebrush converter, if intend go downwards path suggested in post. hth, indyfromoz silverlight windows-phone-7

c++ - How to detect all the connected neighboring pixels which have same color value in opencv -

c++ - How to detect all the connected neighboring pixels which have same color value in opencv - i should able input pixel position , same coloured(in case should black) pixels connected it. how in opencv c++. output pixels should connected each other color black. findcontours() method not work cannot feeded pixel. opencv has no such function, have implement yourself. easy way implement search algorithm bfs or dfs in trees. som pseudo-code: list<pixels> pixels_in_component; stack<pixels> neighbours; neighbours.add(starting_point) while not neightbours.empty: p = neighbours.pop(); pixels_in_component.append(p) each adjacent pixel n of p: if color(n) == color(starting_point): neighbours.append(n) if utilize stack or queue not relevant , pixels_in_component later contain connected pixels. or (if restricted black components) can utilize cv::threshold invert image. utilize inverted binary threshold pixels above value mapped zero,...

html - Highlight fieldset with focused element, without JavaScript -

html - Highlight fieldset with focused element, without JavaScript - this question has reply here: is possible alter fieldset's background-color on input:focus? 4 answers using html & css , without using javascript, how style fieldset around focused form inputs differently rest of fieldsets? (basically, same thing this question without javascript) below effect want achieve, using javascript: class="snippet-code-js lang-js prettyprint-override"> $(document).ready(function() { $('input').focus(function(){ $(this).parent().addclass('jshack'); }); $('input').blur (function(){ $(this).parent().removeclass('jshack'); }); }); class="snippet-code-css lang-css prettyprint-override"> fieldset { border: 2px solid lightgray; } fieldset.jshack { border: 2px solid black; } input:focus { ba...

php - Radio buttons on WP admin page -

php - Radio buttons on WP admin page - i'm building plugin changes site's background color in accordance user's choice, practice. i'm doing radio buttons. want user have 1 choice, normal radio button behavior, in admin page can chose several colors checkbox behavior, , not able undo chose made. the code: <div class = "wrap"> <h3>please take color</h3> <form style = "line-height:400%" method = "post" action = ""> black <input type="radio" name = "black" value = "black" /> white <input type = "radio" name = "white" value = "white" /> reddish <input type = "radio" name = "eed" value = "red" /> greenish <input type = "radio" name = "green" value = "green" /> yellowish <input type = "radio" name ...

c# - How to use clean urls instead of details.aspx?articleid=52 -

c# - How to use clean urls instead of details.aspx?articleid=52 - example: utilize http://websitename.com/news/fashion/article-name-goes-here instead of http://websitename.com/details.aspx?articleid=52. thanks in advance guyzz best approach show url meaningful text help in seo , can integrate routing in application without changing project architecture. click hear find steps accomplish routing. c# asp.net vb.net url

swift - Comparing optional arrays -

swift - Comparing optional arrays - running next code snippet in playground gives error: let a: [int]? = [1,2] allow b: [int]? = [1,2] == b // value of optional type '[int]?' not unwrapped; did mean utilize '!' or '?'? while doing similar 'simpler' optional type works: var x: int? = 10 var y: int? x == y // false what reasoning behind first case, of optional arrays, not beingness allowed? why can't swift first see if either side if nil ( .none ) , if not, actual array comparison. the reason works simpler types because there version of == defined optionals contain types equatable : func ==<t : equatable>(lhs: t?, rhs: t?) -> bool but while int equatable , array not (because might contain not equatable - in case how be). equatable things have == operator, not things == operator equatable . you write special-case version of == optional arrays containing equatable types: func ==<t: equatable>...

web - Detect user connection 3g,4g,wifi or lite by using php -

web - Detect user connection 3g,4g,wifi or lite by using php - is there way observe connection of user using php script. want observe 3g,wifi,4g , lite. want observe users come from. have solution in javascript want in php reasons. you can tell difference between wifi , non-wifi, , can't tell difference. you can never tell difference between 3g/4g/lte php. assumptions , terminology i assuming smartphone connecting http server via browser, , server uses php handle request. if not case, please clarify question. terminology: utilize word "isp" refer companies provide net service not phone carriers. what info server get? when device connects php server, tells server info itself, server can know device's ip address, user agent, etc. the problem the problem browser "doesn't care" connection on, , has no effect on info browser sends server. if browser on 3g/4g/lte, send exact same info have sent if on wifi. semi "proof...

c# - Show a list from a wcf library to a form -

c# - Show a list from a wcf library to a form - i using form app selfhost wcf service. service works ok , objects it's receiving stored in list. have list within service , foreach list , output in richtextbox . i made list enumerable because receiving error: foreach statement cannot operate on variables of type not contain public definition 'getenumerator' so code now: //selfhosted_listener.service1 class public static list<composite> mylist = new list<composite>(); public ienumerator<composite> getenumerator() { homecoming mylist.getenumerator(); } ienumerator ienumerable.getenumerator() { homecoming mylist.getenumerator(); } while debugging see list has data. that's great far press button initiate process of appending text using code: //anamespace.form1.update() foreach (selfhosted_listener.compositelist compositeobj in selfhosted_listener.service1.mylist) { app...

php - how to create product with custom option on bigcommerce api? -

php - how to create product with custom option on bigcommerce api? - how add together custom alternative color , size when im creating product. there doc: https://github.com/bigcommerce/bigcommerce-api-php this code: public function addproduct($data) { $fields = array( "name" => $data['name'], "description" => $data['description'] ); homecoming bigcommerce_api::createproduct($fields); } i need add together info product options: $data['color'], $data['size'] how that? you need create alternative set, add together options set , assign alternative set product. essentially this: public function addproduct($data) { //create alternative set $optionset = bigcommerce_api::createoptionsets(['name' => 'tshirts']); //create alternative $option = bigcommerce_api::createoptions(['name' => 'color', 'display_name' ...

ios - Sprite Kit and Swift, increasing the speed of a node over time? -

ios - Sprite Kit and Swift, increasing the speed of a node over time? - i have wall generates , moves left (pulls) , i'm curious on if can somehow create overtime gets faster , faster. possible? here code i'm using pull "wall": func startmoving() { allow moveleft = skaction.movebyx(-300, y: 0, duration: 0.35) runaction(skaction.repeatactionforever(moveleft)) } this generates walls in case need know: var generationtimer: nstimer? func startgeneratingwallsevery(seconds: nstimeinterval) { generationtimer = nstimer.scheduledtimerwithtimeinterval(seconds, target: self, selector: "generatewall", userinfo: nil, repeats: true) this line of code starts generator wallgenerator.startgeneratingwallsevery(0.5) everything works, want know how create starts off slow gets faster overtime (makes harder). one alternative create variable duration of action , maintain counter increments every time wall pulled. after number of wa...

r - How to apply loess.smoothing to both plot and then extract points? -

r - How to apply loess.smoothing to both plot and then extract points? - i trying apply loess smoothing scatterplot (i.e. between 2 quantitative variables). plot loess smoothing occurs in scatterplot, , extract info points in scatterplot above smoothing. for instance, if scatterplot: qplot(mpg, cyl, data=mtcars) and wanted superimpose smoother: qplot(mpg, wt, data=mtcars) + with(mtcars, loess.smooth(mpg, wt)) this results in error: "don't know how add together o plot". then, assuming superimposition work, extract cars above line. [disclaimer: reply incomplete] ggplot2 has function adding loess smoother: stat_smooth() , e.g. qplot(mpg, cyl, data=mtcars) + stat_smooth() # datasets n < 1000 default loess, hard-code: qplot(mpg, cyl, data=mtcars) + stat_smooth(method="loess") the function help page states returns data.frame predictions, can utilize extract points. this answer goes through it. unfortunately splits typicall...

java - how to show google ads in LinearLayout randomly time? -

java - how to show google ads in LinearLayout randomly time? - in android .xml. have 2 banner ads. want load ads randomly time possible how ? xml google ads code <linearlayout android:id="@+id/advertisingad7" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="10" android:gravity="bottom" android:orientation="vertical" > <linearlayout android:id="@+id/advertisingad8" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="10" android:gravity="bottom" android:orientation="vertical" > adview adview = new adview(this, adsize.banner,"ad unit id"); linearlayout layout = (linearlayout) findviewbyid(r.id.advertisingad7); layout.addview(adview); adrequest request = new adrequest(); adview.lo...

javascript - Return value from Request -

javascript - Return value from Request - i new in node.js , javasript. possible homecoming value request? thanks var request = require('request'); //parse text function(text) { request(text, function (error, response, body) { if (!error && response.statuscode == 200) { var $ = cheerio.load(body); //get title var title = $("title").text(); }) need title here }; to need understand async nature of node, @ moment title might not available, since request title async, have wait response come before can access it you can this function gettitle(uri, callback) { request(uri, function (error, response, body) { if (error || response.statuscode != 200) { homecoming callback(error); } var $ = cheerio.load(body); //get title homecoming callback(null, $("title").text()); }); } gettitle(uri, function(err, title) { //access title here }); ...

Play sound from WAV file at a time offset from start in C# -

Play sound from WAV file at a time offset from start in C# - i'm trying coordinate playing sound displaying other info on graph recorded @ same time. if user drags graph forwards or backwards how can skip forwards or backward in wav file sound still coordinated? can't see time offset in apis soundplayer. if understood question correctly, utilize wmplib.windowsmediaplayer , add together reference "windows media player" com , set position using: wmplib.windowsmediaplayer player = new wmplib.windowsmediaplayer(); player.url = file; //file played player.controls.play(); player.controls.currentposition = x; //set position want here when user drag or can utilize naudio, free opensource api, download codeplex: naudio library c# wav audio-player soundplayer

c# - Visual Studio Unit Test locking dll -

c# - Visual Studio Unit Test locking dll - simple unit test abstract class p/invoked methods leaving unmanaged dll locked when tests executed. oddly plenty lock not happen when debugging test, when test run. similar problem here reported on visual studio 2012 , using similar workaround, bit less hacky nonetheless not solution. workaround added "teardown" method executed 1 time tests terminate manually free unmanaged library. [dllimport("kernel32", setlasterror=true)] static extern bool freelibrary(intptr hmodule); [assemblycleanup] public static void teardown() { foreach (processmodule mod in process.getcurrentprocess().modules) { if (mod.modulename == "example.dll") { freelibrary(mod.baseaddress); } } } my solution running unit tests in vs: run instance of console administrator , come in script: taskkill /f /im vstest* /t before running test switch console , execute line above ...

c++ - QwtPlot automatically resizes during AutoScale -

c++ - QwtPlot automatically resizes during AutoScale - i'm using libqwt-6.1.1 display variable info in qwtplot element (as histogram) using auto scale y-axis. depending on actual info , number of tics, autoscale-run considers reasonable, minimum height of whole qwtplot element increases. kills whole layout design , makes window larger screen. now 2 questions: 1) how can prevent qwtplot beingness automatically enlarged? 2) how minimum size calculation work? (i got lost somewhere in qwtplotlayout::activate() while trying follow calculation steps.) finally, solution simpler expected ... overloading qwtplot::sizehint() , qwtplot::minimumsizehint() (which virtual, fortunately) making both homecoming little constant value did trick, i.e. qsize myplot::sizehint() const { homecoming qsize(100, 100); } qsize myplot::minimumsizehint() const { homecoming qsize(100, 100); } c++ qwt

powershell - creating keys recursively in registry editor in windows -

powershell - creating keys recursively in registry editor in windows - i need create keys recursively in register editor in windows using powerfulness shell. md hklm:\software\a\b\c in command b , c keys create if parent key exists, want create a\b\c recursively. please help me in this. use -force parameter: ps c:\> md hklm:\software\a\b\c ps c:\> test-path hklm:\software\a\b\c false ps c:\> md hklm:\software\a\b\c -force ps c:\> test-path hklm:\software\a\b\c true windows powershell registry

android - On button click number copy to dial screen, in list view -

android - On button click number copy to dial screen, in list view - this program. in android project there 1 xml file in button is. upon on-clicking of button, dial screen displayed, want. here code tried: arraylist<hashmap<string, string>> list = new arraylist<hashmap<string, string>>(); @override public void oncreate(bundle abc) { //super.oncreate(savedinstancestate); super.oncreate(abc); hashmap<string, string> item = new hashmap<string, string>(); hashmap<string, string> item2 = new hashmap<string, string>(); hashmap<string, string> item3 = new hashmap<string, string>(); item.put("name", "taxi sure"); item.put("number", "020 6060 1010"); item.put("address", "for pune city"); item2.put("name", "ola cabs"); item2.put("number", "020 3355 3355"); item2.put("ad...

Fetch IBM websphere MQ message using Oracle Service Bus -

Fetch IBM websphere MQ message using Oracle Service Bus - i trying fetch messages ibm websphere mq using oracle service bus. have enabled "xa" connection mill in osb , checked "transaction required" check box. when checked "same transaction response" check box , i'm getting "pipelineexception". anyone aware issue?? there guideline or document describe total process?(not sure on right track.) osb constructed in such way request pipeline , response pipeline utilize different threads. when different threads, thread executing request pipeline completed reaches end of request pipeline. new thread allocated executing response pipeline weblogic. now coming "same transaction response" option, means request , response pipeline should utilize same thread , not new threads. the "same transaction response" alternative supposed used when there strict error monitoring (mostly in synchronous cases). illustration ...

apache - Forcing https:// through htaccess -

apache - Forcing https:// through htaccess - i'm new coding in general please forgive me ignorance in subject. understand few questions similar this, none have seemed work me. useful info welcome please due you're best explain me if seems bit excessive because i'm uneducated in theses particular subjects. here entire htaccess file located in root forum directory. class="snippet-code-html lang-html prettyprint-override"> rewriteoptions inherit rewriteengine on <ifmodule mod_rewrite.c> options -multiviews rewriteengine on rewritebase /forums/ rewritecond %{request_filename} !-f rewriterule \.(jpeg|jpg|gif|png)$ /forums/public/404.php [nc,l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . /forums/index.php [l] </ifmodule> <files 403.shtml> order allow,deny allow </files> rewritecond %{http_host} ^perspectiverp\.com$ [or] rewritecond %{http_host} ^www\.perspecti...

ruby - Rspec Class any_instance expects method_name - where it is documented? -

ruby - Rspec Class any_instance expects method_name - where it is documented? - i've stumbled upon next piece of code in rspec test , must more or less figured out can't find relevant sources prove it. please point me gem or docs describe: describe somemodule::salesforce::lead before somemodule::salesforce::lead.any_instance.expects(:materialize) end ... end it seems :each illustration in spec sets expectation on instance of class described above receive phone call :materialize method and redefines method do nothing . lastly part seems crucial because avoids connecting salesforce in test environment can't find confirmation this. any_instance documented under working legacy code you right in both sets expectation , stubs out original method on given instance of class. previous versions of rspec accomplish monkeypatch ruby core classes ( object , baseobject ) rspec 3 has new syntax not rely on monkeypatching: before expect_any_insta...

php - while loop not ending as expected -

php - while loop not ending as expected - i might crazy here, pretty confused why while loop seems never end, causes page continuously load , chokes server several min afterwords. basically have table of photo albums +----+--------+--------+ | id | title | parent | +----+--------+--------+ | 1 | album1 | 0 | +----+--------+--------+ | 2 | album2 | 0 | +----+--------+--------+ | 3 | album3 | 2 | +----+--------+--------+ | 4 | album4 | 3 | +----+--------+--------+ | 5 | album5 | 4 | +----+--------+--------+ | 6 | album6 | 1 | +----+--------+--------+ so have here hierarchy of albums this - album1 ^- album6 - album2 ^- album3 ^- album4 ^- album5 i have table of photos themselves +----+--------+-------+--------+ | id | title | album | master | +----+--------+-------+--------+ | 1 | photo1 | 1 | 1 | +----+--------+-------+--------+ | 2 | photo2 | 2 | 2 | +----+--------+-------+--------+ | 3 | ...