Posts

Showing posts from February, 2014

ios - Back Button does not color accordingly (objective c) -

i’m working on iphone/ipad app has multiple navigation bar colours. in 1 part of app navigation bar has orange , in other part has purple. on start screen of app navigation bar hidden. the colour of navigation bar, button , bar button set in prepareforsegue according segue identifier both sections of app. uiimage *navbackgroundimage = [uiimage imagenamed:@"navigation-bar-orange.png"]; [[uinavigationbar appearance] setbackgroundimage:navbackgroundimage forbarmetrics:uibarmetricsdefault]; //change appearance of button uiimage *backbuttonimage = [[uiimage imagenamed:@"back-orange"] resizableimagewithcapinsets:uiedgeinsetsmake(0, 13, 0, 6)]; [[uibarbuttonitem appearance] setbackbuttonbackgroundimage:backbuttonimage forstate:uicontrolstatenormal barmetrics:uibarmetricsdefault]; //change appearance of standard navigation button uiimage *barbuttonimage = [[uiimage imagenamed:@"standard-orange"] resizableimagewithcapinsets:uiedgeinsetsmake(0, 6, 0, 6)];

c# - where t : class generic constraint and const value declaration -

according c# specification in 10.4 constants : the type specified in constant declaration must be sbyte, byte, short, ushort, int, uint, long, ulong, char, float, double, decimal, bool, string, enum-type, or reference-type. each constant-expression must yield value of target type or of type can converted target type implicit conversion (§6.1). why can't following: public class genericclass<t> t : class { public const t val = null; } that should possible, because: where t : class means, the type argument must reference type; applies class, interface, delegate, or array type (from msdn ) it satisfies words specification: the possible value constants of reference-types other string null . any possible explanation? possible explanation consider how clr initializes static members of generic classes or when invokes static constructors on generic types. normally, static initialization occurs when program first loaded; however

centos - PHP date() function gives the wrong time -

date('d-m-y h:i:s a') the above code displays correct date wrong time. isn't off hours either; minutes off. have set default time zone in php using function in php.ini, set date , time on server, , restarted it. ideas why still won't work? i'm running centos apache , php. latest versions. [update] looks it's problem system clock. resets random time whenever manually update it. i've tried disabling ntpd still this, not sure why. i'm not sure if should close question or open new one. [another update] set timezone in linux , went whm > server configuration > server time , set update date , time. said updated , displays correct date , time, refresh or check on server it's other date , time. can't tell @ point if reverting instantly or not being set @ without throwing errors. after digging, found out vps hosts don't let change time on own vm, had take out support ticket , have them fix it. if else having similar issues i&

css - Using divs in a looping list -

so i'm working on project display list in mvc 4 listview. 1 of fields has large amount of data instead of displaying info in table, made css modal window display. here's snippet of html listview , clickable modal view: <table class="srrtable"> <tr> <th> dwelling id </th> <th> postal address id </th> <th> insuance policy id <th> xml text </th> </tr> @foreach (var item in model) { <tr> <td> @html.displayfor(modelitem => item.dwellingide

c# - Select Multiple Dates in one calendar control with different SelectedBackgroundColor -

Image
i want make calendar this: the main idea select diferent days each day color selected in radiobutton. radiobuttons piece of code done , works fine but, have not idea how select days in 1 color, because multiplerange select mode, each time clear days selected... i'm working styles complicated... style calendard <style x:key="calendarstyle" targettype="{x:type calendar}"> <setter property="foreground" value="{dynamicresource itemtext}"/> <setter property="background" value="transparent"/> <setter property="borderbrush" value="{dynamicresource itemborder}"/> <setter property="borderthickness" value="1"/> <!--<setter property="calendarbuttonstyle" value="{dynamicresource {x:type calendarbutton}}"/>--> <!--<setter property="calendardaybuttonstyle" value="{dynamicresource

php - Multifunctional button -

i have problem posting text fields , uploading picture @ same time, @ moment can either upload picture or post text fields. how can post @ same time using 1 button? $photo_form = '<form id="photo_form" enctype="multipart/form-data" method="post" action="php_parsers/status_system.php">'; $photo_form .= '<select name="gallery" required>'; $photo_form .= '<option value="cover">cover</option>'; $photo_form .= '</select>'; $photo_form .= ' &nbsp; &nbsp; &nbsp; <b>browse:</b> '; $photo_form .= '<input type="file" name="photo" accept="image/*" required>'; $photo_form .= '<p><input type="submit" value="upload"></p>'; $photo_form .= '</form>'; $status_ui = ""; $status_ui = '<div><textarea id="

ASP.NET MVC Html.BeginForm decodes URL -

i'm requesting asp.net mvc controller using url this: http://mysite.com/controller/myaction/invalid%23name%25x where invalid%23name%25x parameter public actionresult myaction(string id) { return view(); } the request works fine. myaction view looks this: @using (html.beginform()) { ... <input name="save" type="submit" value="save" /> } the generated html is: <form action="/controller/myaction/invalid#name%x" method="post"> ... <input name="save" type="submit" value="save" /> </form> when click on "save", form gets posted , post request goes http://mysite.com/controller/myaction/invalid#name%x i.e. initial url decoded. means the post action receives first part of parameter - "invalid" [httppost] public actionresult myaction(string id, ...) { return view(); } how can prevent html.beginform decoding initial urls i

c# - How to generate similar hash password using sql server? -

cryptography algorithm md5. in c#, using following code generate password:- private md5 _md5; var plain = asciiencoding.default.getbytes('admin'); var hashed = _md5.computehash(plain); var shashed = asciiencoding.default.getstring(hashed); console.write(shashed); result is: !#/)zw¥§c‰jj€Ãƒ when use sql server code generate password:- declare @hashthis varchar(100); select @hashthis = convert(varchar(100),'admin'); select hashbytes('md5', @hashthis); go result is: 0x21232f297a57a5a743894a0e4a801fc3 i using same algorithm. how can generate same hash value in sql server? your c# code , sql code both computing same hash value, sql formatting result hex string while c# code attempting cast bytes of hash value directly ascii characters (which not). same result in c# use bitconverter class: var shashed = "0x" + system.bitconverter.tostring(hashed).replace("-", ""); output: 0x21232f297a57a5a743894a0e4a801fc3

Audio doesn't sound in a few iOS devices -

Image
i have developed app plays audio files voices recordings. when debug have no problems it, when download appstore works perfectly, friends use , haven't got problem app, few people on world have contacted me tell me app doesn't sound. it strange because tell me sound of bell (mp3 44100hz, mono, 128kbps) plays first sounds voices (mp3 44100hz, stereo, 96kbps) don't sound. people contact me has different devices models , different versions of ios 6. i use avaudioplayer play files , think work well. have experienced same problem? thank update this localizable.strings have i load file this: // nsstring *filelang = nslocalizedstring(aitem.filename, nil); //more code ... theplayerurl = [[nsbundle mainbundle] urlforresource:filelang withextension:@"mp3"]; //more code ... avaudioplayer *player = [[avaudioplayer alloc] initwithcontentsofurl: aitem.urlaudio error:&error]; player.delegate = self; [player preparetoplay]; this example of localizab

android - how to get full address from passing Latitude and Latitude? -

i used code on phone bellow address { country, street, city}, didnt work many inputs, why? , crashing . please how full address passing longitude , latitude method returns available address longitude , latitude. can please provide me answer best result. me. import java.io.ioexception; import java.util.list; import java.util.locale; import android.app.activity; import android.content.context; import android.location.address; import android.location.geocoder; import android.location.location; import android.net.connectivitymanager; import android.net.networkinfo; import android.os.bundle; import android.os.handler; import android.util.log; import android.view.view; import android.view.view.onclicklistener; import android.widget.button; import android.widget.edittext; import android.widget.textview; public class get_location_name extends activity implements onclicklistener { private edittext et1; private edittext et2; private textview tv1; private button b1; static string resul

git - .gitignore whitelist * not working correctly -

i have attempted create whitelist in .gitignore file such: #ignore * #don't ignore directories, can recurse them !*/ #don't ignore files !*/docs #!cmd_mux.vhd !.gitignore !*.vhd !*.v !*.fdo !*.xise however, git still ignoring cmd_mux.vhd. if uncomment line directly specifies cmd_mux.vhd, works fine. what's going on here? you try check-ignore command debug ignore process: $ git check-ignore cmd_mux.vhd -v .gitignore:7:!cmd_mux.vhd it should print out pattern (whith enclosing file) affects ignore status of file.

Git rebase duplicates functions -

i pretty new git, , can't find seeing, figure maybe doing wrong. i trying rebase branch onto master branch has latest commits master, can test before final merge. here workflow following: > git clone <master> > git remote add branch_repo <branch> > git fetch branch_repo > git checkout -b new_branch branch_repo/branch > git fetch origin > git rebase origin/master other important information: this branch has several significant changes throughout code base master has been refactored @ least once since initial branch the result is, after rebase completes, , resolve merge conflicts, resulting files have many duplicate functions. auto-merge makes no sense me - body of 1 function placed declaration of different function. is workflow wrong, or unfortunate by-product of refactor+ major revision must resolved manually? okay, if understand situation correct, how is. branched off master, made changes before push changes master, else

html - Why wont a td that contains a div stretch to proper size IE7 -

Image
my markup is: <table style="table-layout:fixed"> <tr> <td class="key"> <div>age:</div> </td> <td class="value"> <div>69</div> </td> </tr> </table> and css is: td.key { border-left: 1px solid #d6d6d6; text-align: right; font-weight: normal; color: #7f7f7f; background-color: peachpuff; width: 115px; } td.key div { width: 100%; background-color: lightseagreen; } "computed style" screenshots chrome td element: "computed style" screenshots chrome div child element: now when renders in chrome result: when renders in ie7 result: not sure i'm doing wrong great! note: problem not occur on ie8+ if want apply attribute ie7 , below, use * key so: td.key { border-left: 1px solid #d6d6d6; text-align: right; font-weight: normal; color: #7f7f7f; background-color: peachpuff; w

php - Embedding name into picture -

i have section of site user uploads picture , provide first , last name... is there way there name can embedded there picture , saved? a watermark fill needs :) <?php function watermarkimage ($sourcefile, $watermarktext, $destinationfile) { list($width, $height) = getimagesize($sourcefile); $image_p = imagecreatetruecolor($width, $height); $image = imagecreatefromjpeg($sourcefile); imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width, $height); $black = imagecolorallocate($image_p, 0, 0, 0); $font = 'arial.ttf'; $font_size = 10; imagettftext($image_p, $font_size, 0, 10, 20, $black, $font, $watermarktext); if ($destinationfile<>'') { imagejpeg ($image_p, $destinationfile, 100); } else { header('content-type: image/jpeg'); imagejpeg($image_p, null, 100); }; imagedestroy($image); imagedest

callback - Passing an Array with Objects to another function in GAS -

just give little background on question: creating form in google app script using ui services , storing specific calendar events in dataarray. event object stored in array. want pass array submit function can't figure out how go because : i can't add callback element (because isn't widget) i can't store event object in widget (i.e. listbox, etc) , add widget callback element. here brief sample of trying do: var cal= calendarapp.getdefaultcalendar(); var event= cal.getevents(new date("june 16, 2013 pst"), new date("july 22, 2013 pst")); var specific = new array; for( var j=0; j<event.length;j++){ specific.push(event[j]); //this stores events in specific variable //i want send variable (w/ data) function on submit i appreciate suggestions can lend me. thanks! as complement answer gave in comments : "you store id , while read events again using same start/end time can check if event corre

breeze - AngularJS dataservice using breezejs it not resolving the promise -

i'm trying setup data service in angular application using breezejs. after resolve promise can't .then file in controller. getting data database via breeze in data service. pass breeze promise want able use $q.all know when data has been found. in controller` proapp.controller('caseinfocontroller', function caseinfocontroller($scope, $log, $timeout, casedataservice) { /***initialize data ***/ // initializeapp(); atpinitializeapp(); function atpinitializeapp() { $scope.mystatelist= casedataservice.getallstates() .then(function assignstates(data) { $log.info("this not fire"); }); } ` the above not fire when promise data service fulfilled. proapp.factory('casedataservice', function ($log, $q) { breeze.config.initializeadapterinstance("modellibrary", "backingstore", true); var servicename = "http://localhost:60882/b

c# - I'm editing an application that loads data from a database, but it runs slower as it continues running -

it's not well-designed application, gets job done gets used. on past week, i've been making modifications it. i've added , removed features. gets data sql table. depending on run, data can upwards of 20,000 rows! i thinking trying load 500 rows application @ time because when there 500 rows process, takes seconds, not minutes. working pdfs, , may part of issue too, figure shouldn't hard implement. the thing though, i'm not sure how implement it. idea limit query 0 500, increment limit. main loop checks if row returned null. how know if row returned null because it's last row of table not last row of chunk? edit: apologize. query quick. however, during operations pdf files, stored locally on filesystem application running on, speed of these operations gets slower. thinking fact pulling 20,000 rows of data application , having loop through locally causing slow-down. may wrong, why wanted implement paging. running program on 500 rows fast. both pull in of

asp.net mvc - reCaptcha valid if first word is correct -

i implementing recaptcha in mvc project follows. [httppost] [validateantiforgerytoken] [recaptchacontrolmvc.captchavalidatorattribute] public actionresult index(indextemp indextemp, bool captchavalid) { if (!captchavalid) { modelstate.addmodelerror("", "you did not type verification word correctly. please try again."); } if (modelstate.isvalid) { // stuff here } } and in web.config have following. <add key="recaptchaprivatekey" value="some_key"/> <add key="recaptchapublickey" value="another_key"/> i got recaptcha here . i noticed recaptcha not work expected (i.e. validates when words entered invalid). after bit of testing noticed long enter first word correctly valid! any ideas? this answer helpful: recaptcha authenticates valid 2 incorrect words from recaptcha wiki: recaptcha consists of

java - High Score in Android -

i totally broke high score leaderboard in android... want display top 5 high scores in game.. how can it... have scores , names stored in database... should next ? i have code sorting of scores... collections.sort(scorelist); for(int i=0; i<5;i++){ highscorelist.add(scorelist.get(i)); } return highscorelist; } i looking possiblity of sorting descending , getting first 5 records.. question, if that's happen, how can compare score if belongs high score? like tobiel said if data stored in database query better. however, if need in code should modify collection sort. if in scorelist have collection of score objects can compare scores this: collections.sort(scorelist, new comparator<score>() { @override public int compare(score score1, score score2){ if(score1.getscore() < score2.getscore()) return -1; else if(score1.getscore() > score2.getscore())

Copy .bak file to another Windows server using job MS SQL Server agent -

i trying copy .bak file nightly server server b. can using sql server job agent run every night? thinking of adding copy command statement within step of job. like: 'copy "g:\source\folder\" "\target\folder\"' inside step , setting type operating system(cmdexec). there way it? is question command copy files? if want copy entire folder use robocopy instead of copy

css - center fixed width divs in a variable parent div -

i have problem can't solve. i'm trying auto center multiple 150x150px divs in parent div 80% width (but 90% or 100%). have isotope jquery attached works fine when enlarge navigator window, child divs not move , furthermore, not center "live" (the menu above works fine). here html code : <div class="portfoliocontainer"> <div id="marque" class="interieur"> <p class="categorie"><a href="http://www.arper.it" target="_blank"> <img src="images/logo_arper_140_noir.jpg" width="100" height="33"></a><br> <span class="txt">arper</span><br> mobilier</p> </div> <div id="marque" class="interieur exterieur"> <p class="categorie"><a href="http://www.b-line.it" target="_blank"> <img src="images/logo_blin

php - How can i manage my dependencies? -

i'm working on large php project have many classes, , problem appears when classes depends on others, example error-handling class may depend on security class, user class may depend on database class , on... $obj1 = new class1(); $obj2 = new class2($obj1); $obj3 = new class3(); $obj4 = new class4($obj3 , $obj1); etc... hence quesion comes in! best way manage dependancies ? try autoloading classes. way if class needs class, doesn't have require() it. http://php.net/manual/en/function.spl-autoload-register.php example documentation: <?php function my_autoloader($class) { include 'classes/' . $class . '.class.php'; } spl_autoload_register('my_autoloader'); // or, using anonymous function of php 5.3.0 spl_autoload_register(function ($class) { include 'classes/' . $class . '.class.php'; }); ?>

javascript - appended html to the dom doesn't respect the charset -

Image
i have html rendered ajax, works fine using char-set utf-8 nevertheless content it's appended dom javascript function using jquery. problem is, html rendered doesn't have correct char-set. here's example of content added javascript var html = '<div class="right-item-container"><a href="#"><span style="font-size:24px;" class="item-friend-name">mamá</span></a><br/><a href="#"><span class="clubname-container">school</span></a></div>'; $('.profile-container').empty().css({ 'padding-top' : '0'}).html(html); it renders this: this works fine in fiddle. http://jsfiddle.net/hjcpp/ var html = '<div class="right-item-container"><a href="#"><span style="font-size:24px;" class="item-friend-name">mamá</span></a><br/><a hre

r - Correct number of decimal places reading in a .csv -

i have .csv 1 of columns contains numbers have 7 decimal places, e.g.: -117.2403266 . when i'm reading .csv r ever shows 4 decimal places column, e.g.: -117.2403 . or maybe there when print shows 4 decimal places? i thought might solved within arguments of read.csv() function, doesn't decimal places. read.csv not truncating or rounding, print.data.frame function displaying values precision specified in options() . try: print(dfrm, digits=10) > dfrm<- data.frame(test=-117.2403266) > print(dfrm) test 1 -117.2403 > print(dfrm, digits=10) test 1 -117.2403266 using format suggested show precision has not been lost, return character vector, might not suitable assignment when numeric value expected. edit of 2 yr-old post: topic might bring question regarding how integers can imported when larger .machine$integer.max #[1] 2147483647 , since such can internally stored 'numeric'-abscissa values, maximum 2^52 (or 2^53-1,

java - Profiling hadoop job with yourkit -

i following tutorial http://www.michael-noll.com/tutorials/running-hadoop-on-ubuntu-linux-single-node-cluster i want see method or java process use cpu wordcount mapper going through corpus using yourkit. understand hadoop type "text" in utf-8 , java string in utf-16. trying see wordcount mapper work in converting utf-8 utf-16. however, yourkit doesn't show details process. shows cpu time follow: org.apache.hadoop.mapred.child.main(string[]) ~ 96% , org.apache.hadoop.hdfs.dfsclient$dfsoutputstream$responseprocessor.run() ~ 4% i not familiar yourkit. please point out how should approach this?

eclipse - Getting started with Apache Tika? -

i program java web crawler uses apache tika download webpage textual content, i'm newbie using apache projects , haven't found definitive source clarifies how integrate tika programs, exactly. i've gathered internet, have built tika maven in command line, i'm not sure go here use tika classes(?) parser, etc in java programs. i'm using eclipse, if makes difference - i've installed maven plugin eclipse i'm not sure it...do need "import..." line? please excuse "beginner" questions step-by-step guide preparing tika used appreciated. first up, you'll want read through apache tika getting started guide , covers how tika included in project. (this assumes have basic knowledge of including third party jars own project, if not you'll need go read tutorials on that) the easiest way started tika in project via tika facade class . provides single class can use detection, parsing plain text string, , parsing xhtml via reader, va

javascript - Change H3 text to input val with Jquery -

i have straight forward question. have h3 tag text in it. need have text show text value inputted in text field, how can make h3 text same text field jquery? here id of h3, detectivefill_1 here id of input loc_else_text thanks in advanced! this update h3 element on input focus lost $('#loc_else_text').change(function(){ $('#detectivefill_1').text(this.value); }); this update instantly on key pressed $('#loc_else_text').keyup(function(){ $('#detectivefill_1').text(this.value); })

objective c - Using dealloc method to release -

i'm trying understand memory management better apps, stopped @ 1 point : i use uibuttons . alloc them, work them etc. need release them @ 1 moment. implement dealloc method object usefull time uiviewcontroller on screen, , need released when desappeard. in uiviewcontroller implement : -(void)dealloc { nslog(@"dealloc call"); [mybutton release]; .... //some objects release [super dealloc]; } but never see dealloc call printed, think doesn't passed dealloc method when uiviewcontroller desappeard. so, how work ? / false ? thanks ! edit : method change of viewcontroller : -(void)mymethod { if (!nextviewcontroller) { nextviewcontroller = [[nextviewcontroller alloc]init]; } uiview *nextview = nextviewcontroller.view; uiview *actualview = actualviewcontroller.view; [actualviewcontroller viewwillappear:no]; [nextviewcontroller viewwilldisappear:no]; [actualview removefromsuperview]; [self.view a

java - Implementing Dependency Injection using Custom Annotation -

i working on core java framework. don't want create instances directly inside class why want use dependency injection. i thinking of declaring custom annotations on fields instantiated. , having call function create instance , inject field. i had tried create custom annotation. looks there's no direct way callback on declared annotation. so, trying scan classes that. ended problem java scanning class annotation using google reflections please let me know if right way of achieving this. since question tagged 'spring', can use spring framework's bean annotations (@component / @service / @repository / ...), classpath scanning , @autowired. for example: setup classpath scanning on spring config xml: <context:component-scan base-package="com.mycompany.myapp" /> create bean scanned. spring container automatically create singleton instance of bean using default constructor: @repository public class foodao { ... } inject refe

How do you import a JSON model to Three.js...? -

i looking @ older question had code fixed this: but won't work reason. there json files available work sure test with? i tried json of ship exported using three.js editor (ship.js) , doesnt seem display anything- in fact, won't "hit" alert have set, indicating issue load of json file, perhaps? <html> <head></head> <body> <script src="three.min.js"></script> <script> var camera, scene, renderer, mesh, loader; init(); animate(); function init() { camera = new three.perspectivecamera( 75, window.innerwidth / window.innerheight, 1, 10000 ); camera.position.z = 1000; scene = new three.scene(); loader = new three.jsonloader(); loader.load( "ship.js", function( geometry ) { //var geometry = new three.cubegeometry(5,10,5); mesh = new three.mesh( geometry, new three.meshnormalmaterial() ); mesh.scale.set( 10, 10, 10 ); mesh.position.y = 0; mesh.position.x = 0; scene.ad

jquery - Replace CSS after compare today's date in Javascript -

i have block of js code generates date dynamically in table cells. '<td class="datestyleblue" data="date"><span id = "' + customers.productid + 'date">' + util.utility( customers.getdate) + '</span></td>' current css .datestyleblue{ color: blue; text-align:center; font-size: 10px; } new css style .datestylered{ color: red; text-align:center; font-size: 10px; } i want replace current css class new css if date past today. so here have far, var today = new date(); if (customer.getdate < today) { $(datestyleblue).replacewith(datestylered); } you should removeclass , addclass. if (customer.getdate < today) { $('.datestyleblue').removeclass('datestyleblue').addclass('datestylered'); } don't forget use dot ( . ) select class , need string unless it's javascript variable. edit you

PHP - Count items in object -

i'm using kirby cms , need find out how many posts have. my posts gotten with $posts = $pages->find('posts')->children(); which echos object 10 items (links posts). it not array using count() returns 1. how can count items in object array? i have no experience library. try this, might work: $count = $pages->find('posts')->children()->count();

linux - Script to extract a range of lines from a file in bash -

i have code week=`date +%v_%d` date=`date +%d%m%y` #cat file let tamano=`cat prenum` file="white_prepago_${date}.txt" name="base_prepago_paqu_w$week_" cat whitelist.txt | grep ",0" | sed '/^57/!s/^/57/' | awk '{fs=","}{print $1}'> $file # number of lines of file let numlines=$2 #must begin in line in file let lines=$tamano+$2 num=$3 ((i=1; i<=$num; i++)) let d=$4+$i cat $file | head -$lines | tail -$numlines > base_$d let lines=$lines+$numlines done let lines=$lines-$numlines echo $lines>prenum i executing code in vm linux , works, , intenting run code in solaris machine not works, in solaris file run not works fine because create number of files write files seim, , in linux create files increment. code have split file in lines write for example bash script.sh 5000 3 0 this code create 3 files of 5000 lines since base_1 file: base_prepago_paqu_w$week_&

multidimensional array - C# - Create hollow rectangle -

i'm using multidimensional array create "border". if printed, this: ###### # # # # # # ###### the code have far can create top, left, , bottom borders. @ moment don't know how create border right hand side of it. int[,] array = new int[10, 10]; //create border around box //top (int = 0; < array.getlength(0); i++) { array[0, i] = 1; } //bottom (int = 0; < array.getlength(0); i++) { array[array.getlength(0) - 1, i] = 1; } //left (int = 0; < array.getlength(0); i++) { array[i, 0] = 1; } how go creating border on right? also, think code improved, i'm new c#. thanks the right border the right border reflection of bottom border along diagonal (top-left bottom-right). so, take bottom drawing code , invert x, , y coordinates. gives: // right (int = 0; < array.getlength(0); i++) { array[i, array.getlength(0) - 1] = 1; } code improvements your code correct. suggest 2 improvements: first, in c#, array di

javascript - String is not a function -

i keep on getting "string not function" error on line five. function swapcase(str) { var words = [] var q = str (var = 0; i<q.length; i++) { if (q(i) === q(i).tolowercase) { var upper = q(i).touppercase words.push(upper) }; else { var lower = q(i).tolowercase words.push(lower) }; }; words.join return words; }; swapcase("heleeer") i still noobie @ coding sorry missing semi-colons , other spacing , indenting errors. q(i) that's function call, q string, not function. you can single character string using array indexing: q[i] . separately, want call tolowercase , touppercase functions. also, words.join has no effect, 2 reasons.

ios - Does RubyMotion 2.5 solve the memory management issue? -

rubymotion 2.5 out. solve memory management problem mentioned in "why mobile web apps slow" article? the rm-3 bug mentioned in article fixed in rubymotion 2.4. rm 2.5 introduced rewritten dynamic variable handling fixes other difficult-to-diagnose issues. so, yes, i'd specific issues mentioned in article have been addressed.

objective c - NSMutableDictionary with accent -

i working nsmutabledictionary , in array using words accent , add work, fine. problem retrieve , work with. to add: [dicpt_sp setobject:@"são paulo" forkey:@"são paulo"]; when retrieving, getting: "s\u00e3o paulo" how can solve issue? think simple, cant find solution googling. idea welcome. i think need encode string first...this unicode string getting. need encode utf8 string this. char cstring[] = "this isn\u2019t bike"; nsdata *data = [nsdata datawithbytes:cstring length:strlen(cstring)]; nsstring *string = [[nsstring alloc] initwithdata:data encoding:nsutf8stringencoding]; nslog(@"result string: %@", string); or nsstring *input = @"\\u5404\\u500b\\u90fd"; nsstring *convertedstring = [input mutablecopy]; cfstringref transform = cfstr("any-hex/java"); cfstringtransform((__bridge cfmutablestringref)convertedstring, null, transform, yes); nslog(@"conve

python - Socket.error with foreman start: Tesing deploying a simple flask app to Heroku -

the problem socket.error: [errno 98] address in use what i'm doing i'm testing simple flask app foreman start in local environment. app contains few functions erroring here: if __name__ == '__main__': app.run() the full trace shown below. i'm not sure wrong, or how socket in use on local machine. when run app python runapp.py terminal works fine. what i've tired. heroku, flask, , python sockets? deploying flask app heroku following last question tired change port runs on using if __name__ == '__main__': import os port = int(os.environ.get('port', 5000)) app.run(host='0.0.0.0', port=port) but didnt help. suggestions appreciated! i'm new heroku please let me know if there anymore information can provided make solving easier. thanks! stack trace of error: 22:13:45 web.1 | started pid 11121 22:13:45 web.1 | * running on http://127.0.0.1:5000/ 22:13:

iphone - How can I get a custom UIControl to participate in a segue as a push action? -

Image
i have custom class inherits uicontrol, touch events. it's collection of other controls acts one. i'm converting app xibs storyboard. it's been painless, except this. i drag uiview scene, change class custom control, hook outlets on viewcontroller. want control when it's clicked perform (push) segue viewcontroller. outlets in designer aren't there uicontrol set segue. is possible this? if so, do class enable that? i don't think so. looking @ connections inspector pane, uibutton , uibarbuttonitem instances special treatment—an "triggered segues" action can connect adjacent view controllers: while changing view's class descendent of uicontrol makes standard suite of control events available, unfortunately interface builder not let hook segue. best can create manually-triggered segue view controller another, connect custom control ibaction method performs segue programmatically: - (ibaction)performmanualsegue:(xyzcustomcontr

ruby on rails - Arel returning count column as string instead of int -

i have 3 models: video , tag , , tagging . tags have many videos through taggings. i have added scope tag includes video count each tag attribute on returned records: class tag def self.include_video_count t = tag.arel_table v = video.arel_table joins(:videos).select([t[arel.star], v[:id].count.as("video_count")]).group(t[:id]) end end tag.include_video_count.first.video_count # => "42" the problem count attribute being returned string instead of integer. is there arel method missing specifies type value should returned as? apparently depends on type of column database returns (which makes sense!) postgres example returns count string. https://github.com/rails/rails/issues/3647 so... basically.. you're outa luck (as ;)

Adding viewport tag to header.php causes php error -

i using php script has file header.php normal web page header info. however, when add viewport tag throws error. header.php: <?php /* usercake version: 2.0.2 http://usercake.com */ echo " <!doctype html public '-//w3c//dtd xhtml 1.0 transitional//en' 'http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd'> <html xmlns='http://www.w3.org/1999/xhtml'> <head> <meta name="viewport" content="width=device-width, initial-scale=1.0"/> <meta http-equiv='content-type' content='text/html; charset=utf-8' /> <title>".$websitename."</title> <link href='".$template."' rel='stylesheet' type='text/css' /> <script src='models/funcs.js' type='text/javascript'> </script> </head>"; ?> error returned: parse error: syntax error, unexpected t_string, expecting ',' or ';' in /hom

python - Clutter messing up animations -

Image
clutter not doing full animation. this current code: from gi.repository import clutter, gtk import sys def onclick(actor, event): actor.animatev(clutter.animationmode.linear, 1000, ["x"], [280]) # clutter not seem running line actor.animatev(clutter.animationmode.linear, 1000, ["x"], [20]) def main(): clutter.init(sys.argv) # colors red = clutter.color().new(255, 0, 0, 255) black = clutter.color().new(0, 0, 0, 255) # create stage stage = clutter.stage() stage.set_title("basic usage") stage.set_size(400, 200) stage.set_color(black) # rectangle actor actor = clutter.rectangle() actor.set_size(100, 50) actor.set_position(150, 100) actor.set_color(red) actor.set_reactive(true) actor.connect("button-press-event", onclick) # add actor stage stage.add_actor(actor) stage.connect("destroy", lambda w: clutter.main_quit()) stage.show_all()

android application to upload an image file to localhost -

07-24 09:43:44.198: e/upload file server exception(8298): exception : failed connect /127.0.0.1 (port 80): connect failed: econnrefused (connection refused) 07-24 09:43:44.198: e/upload file server exception(8298): java.net.connectexception: failed connect /127.0.0.1 (port 80): connect failed: econnrefused (connection refused) i tried android application upload image file localhost(ubuntu).when try above error use ip address 10.0.2.2 instead of 127.0.0.1

selenium - I'm trying to validate all links on a webpage are working. How do I ignore a logout link -

the following method clicks on links of our application home page , validates working. problem logout link on page, can imagine once click test fails. there way can ignore or remove check of logout link? fyi logout first element in array. appreciated public void checkalllinks() { driver.switchto().defaultcontent().switchto().frame("mainframe"); list<webelement> linkelements = driver.findelements(by.tagname("a")); string[] linktexts = new string[linkelements.size()]; int = 0; // extract link texts of each link element (webelement e : linkelements) { logger.info(linktexts[i] = e.gettext()); i++; } (string l : linktexts) { driver.findelement(by.linktext(l)).click(); if (driver.gettitle().equals(title)) { system.out.println("\"" + l + "\"" + " not working."); } else { system.out.println("\&qu