Posts

Showing posts from May, 2012

jquery - Insert row if not exists otherwise update sqlite - JavaScript -

i know there have been lot of questions on in past, seem unable utilise answers. have tried, don't seem work. i have table stores 2 user inputted values: name , email. when enter name , e-mail, gets stored single row of table. i want able update same row different name , email if user types other values, or insert these values if there weren't previous values. my code here: db.transaction(function(transaction) { transaction.executesql('insert details(name,email)\ values(?,?)',[$('#entername').val(), $('#enteremail').val()], nullhandler,errorhandler); }); and table creation here if needed: db.transaction(function(tx){ tx.executesql( 'create table if not exists details(id integer not\ null primary key,name,email)', [],nullhandler,errorhandler); },errorhandler,successcallback); i have tried using insert or replace, creates new row new details , leaves previo

linux - Searching all files that begin with 's' and end with '.conf' with grep -

using grep command search string ip in files beginning s (case sensitive) , ending .conf in /etc directory. redirect output /usr/local/thirdrock/grep1.txt . you should 8 lines of output. this question i've been given practical exam review, far have grep "ip" s*.conf /etc but returned "no such file or directory" . my question how search in files beginning s , ending .conf in /etc directory. grep "ip" s*.conf /etc searching string "ip" in files in current directory matching s*.conf , "file" /etc, directory. grep "ip" /etc/s*.conf should want. you can redirect standard output using > , wasn't part of question, won't spoil it.

xamarin - How does Mono for Android work and what's the relation between C# and Dalvik? -

i'm trying find information on how c# implementation of android works. is c# -> java -> bytecode -> dalvik: i.e. c# converted java before process happens between bytecode , dalvik? or c# -> dalvik? your guess wrong. more similar .net/com interop wrappers used acrosss boundary. @ runtime there 2 vms, dalvik , mono clr running @ same time, mono android http://tirania.org/pictures/android-dalvik-mono.png there far more information can dig miguel's blog such http://tirania.org/blog/archive/2011/apr-06.html the c# dalvik solutions exist, such dot42 , remobjects c# .

python - EOL while scanning string literal -

this code , following error message: line 8 sepfile=readfile.read().split('\') syntaxerror: eol while scanning string literal me? thanks. import matplotlib.pyplot plt import numpy np x=[] y=[] readfile = open (("/users/sun/desktop/text58.txt"), 'r') sepfile=readfile.read().split('\') readfile.close() plotpair in sepfile: xandy=plotpair.split(',') x.append(int(xandy[2])) y.append(int(xandy[1])) print x print y plt.plot(x,y) plt.title('tweet') plt.xlabel('') plt.ylabel('') plt.show() \ special character in python string literals: starts escape sequence . to fix problem, need double backslash: sepfile=readfile.read().split('\\') doing tells python using literal backslash rather escape sequence. also, for , keywords in python, needs lowercase: for plotpair in sepfile:

.net - Is it possible to use BizTalk Rule Engine independently from BizTalk Server? -

currently i'm involved in project lots of rules in it. there's idea use biztalk's business rule composer rule creation. question1. possible use independently? question2. if so, how can subscribe change of different fact source types .net objects , databases ? fyi, i'm using biztalk server 2013. well, run rules composer need have biztalk engine installed, can't separate them, in such case end pay license of biztalk have rules engine composer. why not use product? think there products concerned business rules engines can use , workflow well. if want free 1 can have worlflow 4.0 microsoft (doesn't include business rules engine can implement 1 using specification pattern - code). other paid products such k2 blackpearl might check them out.

Scale the x axis only in octave plot -

i using octave plot function plat 2d graph. want scale x axis 2x (no change y axis). i.e. distance between each unit in x axis doubled. how do in octave? set(gca,'dataaspectratio',[2 1 1])

opencv - Image alignment error -

i have 2 images, 1 of misaligned. need align images. calculate feature points using surf , match them using bfmatcher , find homography , apply warpperspective . here code for these inputs : input1 , input2 , getting distorted image . i doing wrong. points? first suspect should swap trainidx , queryidx. and try draw matches, in experiments, rather random. for quick test try use same image, or transform little bit first image , use second one.

title - Magento - How to write breadcrumbs with the H1 -

on cms pages ( http://trustedsurgery.com/cat-scratch/declawing-cats ) breadcrumb pulling in title of page. how can change breadcrumb h1 displayed , not title? on product pages, h1 being pulled in ( http://trustedsurgery.com/cat-scratching-products/2-pack-deal-cat-nail-caps-8-12-months-pd25.html ) any advice appreciated :) please check breadcrumbs div present in page layout. think cms pages have 2columns layout . chk 2columns layout file having breadcrumbs div. if it's not present means plz add code need breadcrumbs <?php echo $this->getchildhtml('breadcrumbs') ?>

Cannot write to word from asp.net -

recently created method in c# in aps.net form used take data textboxes in asp.net page , export them pre-defined bookmarks in word. tested worked fine both on desktop computer , working fine in hosted environment. not working. not exporting word anymore. however, works fine in local computer not when hosted. permission ok , there not other problem. now i'm stacked , don't know do. there hint or please?

regex - regular expression doesn't match, why? -

i want match paths that: don't start "/foo-bar/" or not ends extension (.jpg, .gif, etc) examples: /foo-bar/aaaa/fff not match /foo-bar/aaaa/fff.jpg not match /aaa/bbb match /aaaa/bbbb.jpg not match /bbb.a not match this regex: ^\/(?!foo-bar\/).*(?!\.).*$ but not working, why? thanks! it more easy try match don't want. example php: if (!preg_match('~^/foo-bar/|\.[^/]+$~', $url)) echo 'valid!'; your pattern doesn't work because of part .*(?!\.).*$ . first .* greedy , take characters of string until end, after, make end of pattern succeed, regex engine backtrack 1 character (the last of string). (?!\.).*$ match last character if not dot. if absolutely need affirmative pattern, can use this: if (preg_match('~^/(?!foo-bar/)(?:[^/]*/)*+[^./]*$~', $url)) echo 'valid!';

audio - Can't get music to play in java -

i'm trying background music play in text adventure making. however, cant sound class work. import sun.audio.*; import java.io.*; public class sound { public static void music() { audioplayer mgp = audioplayer.player; audiostream bgm; audiodata md; continuousaudiodatastream loop = null; try { inputstream test = new fileinputstream(new file "trainerredmusic.wav"); bgm = new audiostream(test); audioplayer.player.start(bgm); } catch(filenotfoundexception e){ system.out.print(e.tostring()); } catch(ioexception error) { system.out.print(error.tostring()); } mgp.start(loop); } } i have scoured internet looking simple guide, nothing works doing. trying run .wav file in background of text adventure. help?

node.js - can't install ionic framework -

i'm trying install ionic framework keep getting error when run "npm install -g ionic". that's error: npm err! error: no compatible version found: colors@'^0.6.2' npm err! valid install targets: npm err! ["0.3.0","0.5.0","0.5.1","0.6.0","0.6.0-1","0.6.1","0.6.2"] npm err! @ installtargetserror (/home/myname/local/lib/node_modules/npm/lib/cache.js:685:10) npm err! @ /home/myname/local/lib/node_modules/npm/lib/cache.js:607:10 npm err! @ saved (/home/myname/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/get.js:138:7) npm err! @ object.oncomplete (fs.js:107:15) npm err! if need help, may report log at: npm err! http://github.com/isaacs/npm/issues npm err! or email to: npm err! i updatet node , cleared cache. any idea? try this sudo npm install -g cordova ionic both cordova , ionic @ same time. makesure add su

apache pig - When not to use Pig Latin -

in hadoop definitive guide it's said pig latin doesn't suit data processing task. cites "to perform queries of small amount of data in large set" example. which other examples bad scenarios of use pig latin? there may situations when have simple ad-hoc analytical queries data in hdfs. there hive more useful hive queries lot faster write types of queries. also may refer post pig vs hive vs native map reduce !.

sql - Oracle user_constraints view not showing all constraints -

i need info oracle metadata objects (such constraints, indices , on). when browsing database pl/sql developer, able view and/or edit objects of such kind. objective data programmatically desktop application. and here, issue comes: when executing query user_constraints of constraints, not of them (i still can see them in pl/sql developer though). , same situation occurs when try data all_constraints (i don't have access dba_constraints ). can help? p.s. problem solved tried filtering user_constraints view constraints' names (and strangely didn't find them), able see them once filtered names of tables own them. anyway, help!

Browser Tab Close Event for javascript or jquery -

i have added div contains survey questions hidden. once user closes window or navigate away page, need popup survey div confirmation. know there browser default confirm box method using onbeforeunload event. need popup div rather browser default confirm box. there way this? (or there way interrupt close event without clicks on "stay on page" button found in browser default confirm box?) update : seems cannot action asking. there solutions cover in ie overall not possible. ignore previous code.

model - Having multiple radiobuttonlist in a form in yii -

i have model named "myform" , each myform has 25 questions(questions themselfs not store in database).answer each question store in table ( table ), there 1 many relations between form , answers. want show each question in form radiobuttonlist , save or retrieve data to/from database. know can show radiobutton this: <?php echo $form->radiobuttonlist($model,'question', array('1'=>'option1 ', '2'=>'option 2 ', '3'=>'option3 ')); ?> and set value this: $model->question='1'; now should show/save other questions? cause second, third questions need question2 ,question3 in second parameter des not exists in model. if want save 25 answers each model need 25 columns in answers table, each row represents record the 25 answers. your table should have columns id, name (or other info), answer1, answer2, answer3, , on. when receive answers should save using $answermodel->answe

javascript - What is the different between calling a function like this CH.home.init({}) or CH.home.init()? -

i know if there different between calling function this ch.home.init({}) or calling normal function? ch.home.init() here's context it's in: var ch = ch || {}; ch.core = function () { ch.home.init({}); }, ... ch.home = function () { function init(a) { $.extend(k, a) ... var k = { adatas: null, loaderid: "home", transitionease: "cubic-bezier(0.18, 0.11, 0.3, 1)", timer: null, nbrandom: 1, ratioimg: .625, opacityoff: .35, speedopacity: 400, delayhome: 2500, indexbkg: 0, $logo: $("h1"), $nav: $("nav"), $lineh: $("span.lineh"), $linev: $(&q

c++ - Serialize a class with a Qlist of custom classes as member (using QDataStream) -

i'm trying serialize class lesson(my custom class[i removed setters]), includes qlist(question custom class). during test serialization sigsegv(segmentation fault) when deserializing object of qlist inside class lesson. upd1: serialized qlist* , changed qlist, sigsegv still appears. class lesson { public: lesson(); lesson(qstring, qstring, qlist<question>); qstring getname() const; qstring gettext() const; qlist<question>* gettest() const; friend qdatastream &operator<<(qdatastream &out, const lesson &l){ out << l.getname() << l.gettext(); out << l.gettest(); return out; } friend qdatastream &operator>>(qdatastream &in, lesson &l){ qstring name; qstring text; qlist<question> t; in >> name >> text >> t; l = lesson(name, text, t); return in; } friend qdatastream &operator<<(qdatastream &out, const lesson *&l){ out << l

c - Reading text file into structure -

i trying write program can take data text file , put struct, add struct linked list , later display list. no arrays. having problems reading line line each field of struct, when try display list, gives me wrong values/gibberish. section focusing on in main method. this text file trying read: #1 flat blade screwdriver 12489 36 .65 1.75 #2 flat blade screwdriver 12488 24 .70 1.85 #1 phillips screwdriver 12456 27 0.67 1.80 #2 phillips screwdriver 12455 17 0.81 2.00 claw hammer 03448 14 3.27 4.89 tack hammer 03442 9 3.55 5.27 cross cut saw 07224 6 6.97 8.25 rip saw 07228 5 6.48 7.99 6" adjustable wrench 06526 11 3.21 4.50 and program far: #include "stdafx.h" #include <stdio.h> #include <stdlib.h> #include <stddef.h> typedef struct inventory { char invname[36]; int invpartno; int invqoh; float invunitcost; float invprice; }stock; struct node { union { int nodecounter; void *dataitem; }item;

c++ - how to cast void* to shared_ptr<mytype> -

i have problem opengl project, converting void* pointer shared_ptr<mytype> . i using bullet set pointers on rigid body with: root_physics->rigidbody->setuserpointer(&this->root_directory->handle); the handle of type shared_ptr<mytype> . the void* pointer returned bullet's library function, getuserpointer() : raycallback.m_collisionobject->getuserpointer() to convert mytype , static_cast not working: std::shared_ptr<disk_node> u_poi = static_cast< std::shared_ptr<disk_node> >( raycallback.m_collisionobject->getuserpointer() ); the error, @ compilation time: /usr/include/c++/4.8/bits/shared_ptr_base.h:739:39: error: invalid conversion ‘void*’ ‘mytype*’ [-fpermissive] any idea how can convert void* returned getuserpointer() shared_ptr<mytype> ? since storing pointer instance of std::shared_ptr need cast value returned getuserpointer std::shared_ptr<>* instead of std::shared_ptr<

Chrome JSON Extension does nothing -

i installed google chrome json extension. opened local .json file. don't see syntax highlighting , collapse buttons. file being treated plain text. there have make chrome treat json? i'm on mac 10.9.2. chrome version 34.0.1847.116. i had failed select "allow access file urls" checkbox in chrome extensions control panel json extension. unchecked default. trying open local json files , seeing no formatting. after checking box, able see json formatting on local files. user error. (though i'll bet other people confused too.)

ios - Add Arrays of (parse.com) to a UICollectionView SubView -

i trying add label (string array) parse.com subview shows after tapping image inside uicollectionviewcell. the subview appears, , text it's same text in every subview of each cell. not changing.. arrays in databrowser are: precio_0, precio_1, precio_2 etc.. what doing wrong? how code go recognize cell. if set code in uicollectionviewcell , not in subview there no problem, text changes in every view. i'm missing don't know is. **note: detailview , data being passed property data method goes: [self.vestimenta objectforkey:@"string"] my code: -(uicollectionviewcell *)collectionview:(uicollectionview *)collectionview cellforitematindexpath:(nsindexpath *)indexpath { static nsstring *cellidentifier = @"cell"; vestimentadetailcell *cell = (vestimentadetailcell *) [collectionview dequeuereusablecellwithreuseidentifier:cellidentifier forindexpath:indexpath]; [cell.activityindicator startanimating]; cell.imagefile.image = [uiimage imagenamed:@&qu

javascript - Angularjs $http and progress bar -

i need upload file , use $http (this code .service() function): sendfile: function (params) { return $http({method : 'post', url : 'http://xxxxxxxxxxxxx/rest/file.json', headers : { 'x-csrf-token' : $cookies['csrftoken']}, data : params }) }, now, little file , line there no problem, big file and/or bad/slow line there problem of ui: user can not know when upload end. need progress bar. so have search on internet, have not found solution. there possibility progress/notification $http ? i have tried code without luck: profileservice.sendfile(data) .then(function(ret) { var uri = ret.data.uri; scope.content = "upload finished"; scope.postform.fid = ret.data.fid; scope.postform.buttondisabled = false;

AngularJS: cleanest way to fix jQuery bug without updating the DOM in the controller -

i happened hit this bug in angular app (which uses codef0rmer's dragdrop wrapper around jquery ui's draggable. it's tempting put prevailing best solution answer $('body').css('cursor', 'auto'); at end of controller function handles stop event. it's quick, simple, works charm , unlikely cause issues because doesn't update models or bits of dom linked models. on other hand, fear angular police come after me. so what's "angular" way this? if codef0rmer's wrapper own, i'd hack in fix there. don't want mess plugin. default answer be in stop event function in controller, set dragstopped flag instead create whole directive listens dragstopped change css property, , add directive every draggable element but seems ridiculous overkill use ng-style. in body tag, put ng-style="{cursor: cursorcss}" in controller $scope.cursorcss = 'auto';

android - How check status of Phone is Landscape or Portrait when Ativity not auto rotation? -

ativity not auto rotation: <activity android:name=".e028" android:label="@string/app_name" android:screenorientation="portrait" android:theme="@android:style/theme.black.notitlebar" > </activity> if use onconfigurationchanged , not working: @override public void onconfigurationchanged(configuration newconfig) { // todo auto-generated method stub super.onconfigurationchanged(newconfig); if (newconfig.orientation == configuration.orientation_landscape) { toast.maketext(this, "landscape", toast.length_short).show(); } else if (newconfig.orientation == configuration.orientation_portrait) { toast.maketext(this, "portrait", toast.length_short).show(); } } how check status of phone landscape or portrait when ativity not auto rotation? i think case: must use sensor my code:

wordpress - WP No slug when adding a pending post -

i'm using following snippet of code add post: $post_args = array( 'post_content' => 'test test', 'post_name' => 'slughere', 'post_title' => 'title', 'post_status' => 'pending', 'ping_status' => 'closed', 'comment_status' => 'closed' ); $new_post_id = wp_insert_post( $post_args ); if add post 'publish' status, works. when post 'pending' post, reason slug not being added. stays empty. does have idea how possible of why happening? running latest wp , updated core again sure there nothing weird going on there. if want add parameter post_name manually make sure sanitize , assure uniqueness , so try following code:- $post_args = array( 'post_content' => 'test test', 'post_name' => wp_unique_post_slug( sanitize_title( 'slughere' ) ),

php - Get selected text from combox to a variable -

i want select school year combobox , use search classes letter year selected. need put selected text variable. $yeardb = "select distinct `year` `class`"; $do_year = mysqli_query($connectdb, $yeardb); $num_year = mysqli_num_rows($do_year); year: <form method="post" > <select id="yearcb" name="year" onchange="document.getelementbyid('selected_text').value=this.options[this.selectedindex].text"> <?php ($i=0; $i<$num_year; $i++) { $yr = mysqli_fetch_array($do_year); echo'<option value="'.$i.'">'.$yr ['year'].'</option>'; } ?> </select> <input type="hidden" name="selected_text" id="selected_text" /> </form> <?php if(isset

c# - How to keep the checkbox inside gridview checked based on certain condition? -

i have gridview on web , checkbox inside template field. having field in database holds integer value 0 or 1. 0 enable , 1 disable. when check checkbox inserts 1 particular field in database , vice-versa. want when open page, rows value 1 in table should remain checked , rows value 0 in table should remain unchecked.i have tried doing this- aspx page- <asp:gridview id="gridmain" runat="server" width="1000px" autogeneratecolumns="false" onrowdatabound="gridmain_rowdatabound"> <columns> <asp:templatefield headertext="student name"> <itemtemplate> <asp:label id="lblname" runat="server" text='<%# eval("name") %>'></asp:label> </itemtemplate> </asp:templatefield> <asp:templatefield headertext="enable/disable">

android - assign arraylist value to textview -

i'm trying set value arraylist textview arraylist<integer> arraylistpage1, arraylistpage2, arraylistpage3, arraylistpage4, arraylistpage5; arraylistpage1 = new arraylist<integer>(rangemode); arraylistpage2 = new arraylist<integer>(rangemode); arraylistpage3 = new arraylist<integer>(rangemode); arraylistpage4 = new arraylist<integer>(rangemode); arraylistpage5 = new arraylist<integer>(rangemode); totalcardinpage = new int[totalpage+1]; for(int j=1;j<=totalpage;j++){ int x=0; for(int i=1;i<=rangemode;i++){ if(binarytable[i][j]==1){ //maka ada di page j cardinpage[j][x]=i; //array buat card di page 1 if (j==1){ arraylistpage1.add(i); }else if(j==2){ arraylistpage2.add(i); }else if(j==3){ arraylistpage3.a

fonts - Build asset folder empty : android Studio, using Gradle -

i have created simple app in android studio, have placed font under src/main/assets/fonts/fontname.ttf when running build/clean etc. asset folder in build stays empty. (build/exploded-aar/com.android.support/appcompat-v7/19.1.0/assets) the application runs, no instances of file found on device.

php - wordpress - is it possible to add one post with multiple custom post type -

i have create module admin admin can manage post. suppose have create 3 post types new added post type entertainment post type featured post type when user add post post come can add "new added post type" or "entertainment post type", show in admin module respective post type module manage admin. so main issue if admin want show post in "featured post type" admin can this. as per concern admin can switch post "featured post type". , post remove "old post type". so main issue want show post in both post type in front end front end users end module admin user. this fact single can not 2 types because in database can store single value this. but according case don't think difficult task. have problem of end unable show post under 2 types. not need create different post types each. just create category , add post in category 1) category 1 2) category 2 3) category 3 4) category 4 you can create multipl

php - How to download directly from one website to another -

i have piece of php code: <?php $image_cdn = "http://ddragon.leagueoflegends.com/cdn/4.2.6/img/champion/"; $championsjson = "http://ddragon.leagueoflegends.com/cdn/4.2.6/data/en_gb/champion.json"; $ch = curl_init();` $timeout = 0; curl_setopt ($ch, curlopt_url, $championsjson); curl_setopt ($ch, curlopt_connecttimeout, $timeout); curl_setopt($ch, curlopt_returntransfer, 1); curl_setopt($ch, curlopt_binarytransfer, 1); $json = curl_exec($ch); curl_close($ch); $json_array = json_decode($json, true); $champions = $json_array["data"]; foreach ($champions $championdata) { $image_url = $image_cdn.$championdata["image"]["full"]; $image = file_get_contents($image_url); file_put_contents("imgfolder/".$championdata["image"]["full"], $image); } ?> so idea of code decode json , download images following website: http://gameinfo.na.leagueoflegends.com/en/game-info/champions/ the pictu

Read and Display Input Using 2D array Java -

i totally new in java 2d array. , trying project a) ask student number b) ask name c) ask exam marks d) display of results. thanks , appreciated if kind enough provide me solution. thanks. i won't directly give code because not here assignment. however, can give hints. the choice of 2d array might not right option you, because suspect you're gonna use way: 1 dimension indexing students, 2nd dimension indexing properties of student. a more java-like approach (or oop approach) create objects representing students, , read 1d array of student objects instead.

java - EBNF to JavaCC lexer -

how convert ::= [a-za-z] javacc? what have done: token : { < letter : (["a"-"z"])> } but don't know how smaller letter parts like this: token : { < letter : (["a"-"z", "a"-"z"])> } reference : a character list describes set of characters. legal match character list character in set. character list list of character descriptors separated commas within square brackets. each character descriptor describes single character or range of characters (see character descriptor below), , added set of characters of character list. if character list prefixed "~" symbol, set of characters represents unicode character not in specified set. note rule: token : { < letter : (["a"-"z", "a"-"z"])> } is equivalent to: token : { < letter : ["a"-"z", "a"-"z"]> } which both match single

ios - iPhone retina 4-inch Simulator with Storyboard set to 3.5 inch -

Image
i'm testing application if run " " , storyboard set 3,5 inch result the following. why? this viewcontroller uitableview inside. tha view controller background color blue. what matter? setting storaybaord 3.5 simulation. might change autolayout in process. if want quick solution try doing following. select viewcontroller in storyboard and, tick both options "under top bars" , "under bottm bars"

android - Scringo - Managing our own users -

i trying implement group chat within our application. have started scringo. able use exisiting example projects open default chat interface , signup inside scringo app. not want users sign inside chat. i have separate database of users login. how integrate myuser info scringouser classes ? relevant details can 1 hour of google search/scringo docs search this.. http://www.scringo.com/docs/api/android/com/scringo/scringogetuserlistener.html according below link scringo docs, seems allowing it. find no information on apis related registering our users scringo user database. http://www.scringo.com/docs/android-guides/popular/setup-a-chat-client/ can me in ? yes.it possible integrate scringo chat interface manage our own users . allow users signup application , onsuccess programatically signup user scringo using thier api. on successfull registration of user @ scringo, retrieve scringo user id , store in db. thats it. play scringo id. link follow: scringo api doc

.htaccess - Trailing slash removal opening full directory -

i'm trying remove trailing slash of urls. whatever htaccess script lines try, redirects seems full server directory. example.com/xyz/ weirdly redirects example.com/customers/b/7/3/example.com/httpd.www/xyz – not found. basically, i'm not using subdirectories getting data out of database according what's last string after last slash. "not found" error ok, because there isn't existing folder. i'm new htaccess, trying out whatever lines found. rewrite opens index.php , not folder (which works fine without trailing slash, engine on): rewriterule ^([a-za-z0-9_-]+)$ index.php?$1 rewriterule ^([a-za-z0-9_-]+)/$ index.php?$1 i failed using remove slash: rewriterule ^(.+)/$ /$1 [r=301,l] so i'm trying is: open url index.php. example example.com/xy doesn't redirect show/open index.php (i think achieved above 2 lines) while doing so, i'm trying remove trailing slash e.g. example.com/xy/ , example.com/xy , example.com/xy/ both sh

php - $_POST from checkbox with the same name and different values -

this question has answer here: getting multiple checkboxes names/id's php 4 answers i have sql database has table (results) gonna save of results of survey. one of questions checkbox (multiple answer), made code should gather results of checkbox questions , put values database. but, something's missing, overwrites last value in array there easy solution cannot see. clarify, want store values of 1 checkbox question if user checks everything. html form <input type="checkbox" name="checkbox1" value="this first value"> <input type="checkbox" name="checkbox1" value="this second value"> <input type="checkbox" name="checkbox1" value="this third value"> php script for($i=1;$i<101;$i++) { if(isset($_post['checkbox'.$i])) { $q[$

smoothing graph line in Matlab -

Image
i have following graph , make more pleasing eyes smoothing graph. possible ? tempyr = 1880:1:2014; temperature = temp(1:2, 1:135); tempval = {'annual mean','5 year mean'} th = zeros(size(tempval)); hold on th = plot( tempyr', temperature', '-o', 'marker', '.'); xlabel( 'year', 'fontsize', 24); ylabel( 'temperature anomaly (degree cel)', 'fontsize', 24 ); legend(th, tempval) grid on ideal graph. try th = plot( tempyr', temperature', '-o', 'marker', '.','linesmoothing','on'); and have here , export_fig reference might prove useful.

HashMap java.util.ConcurrentModificationException -

i have following code: public list<string> processmap(map<string, string> amap) { cloner cloner = new cloner(); map<string, string> tempmap = cloner.deepclone(amap); while(!tempmap.isempty()) { iterator<entry<string, string>> iterator = tempmap.entryset().iterator(); while(iterator.hasnext()) { entry<string, string> entry = iterator.next(); // !!! } } return null; } to deep copy map use library: cloner i marked line unfortunately ava.util.concurrentmodificationexception '!!!' can please tell me why exception? the complete code: cloner cloner = new cloner(); map<string, freebasetype> tempfreebasetypes = new hashmap<string, freebasetype>(); map<string, freebasetype> freebasetypescopy = cloner.deepclone(freebasetypes); while(!freebasetypescopy.isempty()) { iterator<entry<string, freebasetype>> iterator = freebasety

javascript - Bootstrap-select plugin: how to avoid flickering -

the bootsrap-select plugin amazing ( http://silviomoreto.github.io/bootstrap-select/ ). provides extremely easy way of creating gorgeous select menus in bootstrap. 1 problem i've encountered it, however, "flickering" on page load. mean straight forward: the page loads original html select element (which of course looks crap) the bootstrap-select plugin js runs at noticeable time after page loads original html select element converted nice bootstrap-select element js in step (2). so, user first sees html select element , sees switch pretty bootstrap-select item, "flickering". has found solution problem? to show blank until bootstrap-select loaded, add css. select { visibility: hidden; }

objective c - Change UIImageview shape to match shape -

i have had around forums , cannot find answer question makes sense me..so hoping can shed light on this. i have cloud , object , when these make contact game on (really basic explanation of game) - problem have cloud, being in shape of..well..a cloud, , image view being rectangle means other object makes contact , runs method game on before, visually, has made contact. please me! :-)

multithreading - Android java.util.concurrent.Executors newSingleThreadScheduledExecutor example -

i having problem android java.util.concurrent.executors. i trying use newsinglethreadscheduledexecutor run runnable every x seconds. saw executor.scheduleatfixedrate(mytask, 0, 50, timeunit.milliseconds); doesn't exists in android. the android documentation link , not give clue how should use newsinglethreadscheduledexecutor; could give me example how should use run runnable every x seconds? know can use handler, wondering how can use singlethreadscheduledexecutor same. thanks in advance. you can example here: http://www.java2s.com/code/javaapi/java.util.concurrent/executorsnewsinglethreadscheduledexecutor.htm actually executors comes java 7 .

java - Looping through image pixels is crashing my program -

i started work little image processing software. need set image black & white , loop through pixels , generate report of counter, coordinates , color of each pixel (#,x,y,color). it works fine tiny images create test, when use real picture, takes several minutes or crash software. code inside loop seems simple crashing. any tip on how can improve it? in advance! void processimage(bufferedimage image) { exportstr = "#,x,y,color"+ newline; color c = new color(0); int imgw = image.getwidth(); int imgh = image.getheight(); matrix = new int[imgw][imgh]; int currentpx = 1; for(int x=0; x < imgw; x++) { for(int y=0; y < imgh; y++) { c = new color(image.getrgb(x, y)); if(c.equals(color.white)) { matrix[x][y] = 1; } string color = matrix[x][y]==1 ?

jquery - Creating a full width slider with custom icons as pagination -

i attempting create full width jquery slider custom icons pagination. image slide vertically when each icon clicked , icon remain highlighted sections title replacing icon (active link). best way go doing this? have not written code yet please dont ask me post any. if kind guide me through maybe first slide, ill able achieve rest. thanks in advance! iosslider pretty good, , worth $15 license fee. should able achieve custom icons regardless of plugin use - css selectors set background image each element index.

Nonsense prediction using package segmented in R -

i first fitted poisson glm in r follows: > y<-c(13,21,12,11,16,9,7,5,8,8) > x<-c(74,81,80,79,89,96,69,88,53,72) > age<-c(50.45194,54.89382,46.52569,44.84934,53.25541,60.16029,50.33870, + 51.44643,38.20279,59.76469) > dat=data.frame(y=y,off.set.term=log(x),age=age) > fit.1=glm(y~age+offset(off.set.term),data=dat,family=poisson) next tried predictions of response (on log scale) new dataset using predict function. note set offset term zero. > newdat=data.frame(age=c(52.09374,50.89329,50.61472,39.13358,44.79453),off.set.term=rep(0,5)) > predict(fit.1,newdata =newdat,type="link") 1 2 3 4 5 -1.964381 -1.956234 -1.954343 -1.876416 -1.914839 next tried package segmented (version 0.3-0.0) in r , fitted segmented glm follows. (the latest version of segmented package (i.e. 0.3-1.0) not seem support offset term when using predict function.) > library(segmented) > fit.2=segmented(fit.1,seg.z=~age

javascript - Canvas snippets for sublime or atom text editor -

how can convert textmate snippets sublime or atom.. https://github.com/johnhunter/javascriptcanvas.tmbundle and please best text editor developing canvas application support autocomplete , live preview. i got :) i tried make package atom , works fine. also think orginal snippets i've shared above works fine in sublime, i've tried it. https://atom.io/packages/canvas-snippets if found more packages can within developing canvas apps please post here :) here. thanks

java - Android - GET Request using Https failing - not sure why -

good afternoon, i have been making http , post requests various websites using android's httpurlconnection object few weeks , have had no problems in doing until now. i have been required make request server using https rather http. i presumed needed change object in use httpsurlconnection object instead in order access page. i can verify able access page both desktop , mobile browsers. output of page text - list of items in plain text format (generated php on server). but when try , download information using android app io exception error @ point specified below (see code block below). the code snippet below run in different thread. manages connect , set connection parameters, upon trying open input stream fails. unfortunately error message doesn't mean lot me. contains url of website no other information. my thoughts either: a) i'm missing when connecting using https - tips here great. b) website doing different other http based websites i'v

Multilevel category showing for select options in rails -

currently using grouped_options_for_select show category in rails project. code below collection = ["north america",[["united states",["inner"]],["canada",["inner"]]]] <%= select_tag(::id_methods, grouped_options_for_select(collection, selected_key = " ", prompt = nil)) %> this output below north america united states inner canada inner but want output below north america united sates inner canada inner how can this? try this:- collection = ["north america",["united states",["inner"]],["canada",["inner"]]] <%= select_tag(:id_methods, grouped_options_for_select(collection, selected_key = " ", prompt = nil)) %>

vbscript - Classic ASP - looping through folder with large amount of images -

i maintaining site uses html editor image upload feature. when click upload opens popup lists path every image in folder. there more 7000 images in folder. the code quite messy. uses scripting.filesystemobject array of files , loops using each statement.a response.write used display each file's info , reason issue occurring if there's more 4015 images in folder. no error occurring such seems function writing out files fails silently , page stops rendering. i confused why works when there's less 4015 files. memory issue ? expecting receive error of sort. thanks info. below response.write being used each file response.write "<tr style='background:" & scolorresult & "'>" & vbcrlf & _ "<td><img src='images/"&sicon&"'></td>" & vbcrlf & _ "<td valign=top width=100% ><u id=""idfile"&nindex

php - Xampp Virtual Host for sub directory -

question i map www.mydomain.com/some/url to c:/xampp/htdocs/some/dir what i've got xampp wordpress htaccess <ifmodule mod_rewrite.c> rewriteengine on rewritebase /some/path/ rewriterule ^index\.php$ - [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . /some/path/index.php [l] </ifmodule> hosts file 127.0.0.1 www.mydomain.com httpd-vhosts.conf (included in httpd.conf ) <virtualhost *:80> documentroot "c:/xampp/htdocs/somedir/" servername mydomain.com/some/path </virtualhost> additional info (httpd.conf) documentroot "c:/xampp/htdocs" <directory "c:/xampp/htdocs"> options indexes followsymlinks includes execcgi allowoverride require granted </directory> current outcome 500 internal server error error log shows request exceeded limit of 10 internal redirects due probable configuration error. add alias httpd.co

html - AngularJS - ng-repeat inside of ng-grids cellTemplate -

given following data set: { "url": "www", "words": [ { "name": "fish", "count": 1 }, { "name": "pig", "count": 60 } ] }, { "url": "www", "words": [ { "name": "zebra", "count": 0 }, { "name": "cat", "count": 12 } ] }, { "url": "www", "words": [ { "name": "dog", "count": 0 }, { "name": "antilope", "count": 2 } ] } i'd create grid like: url words:count --------|-------------- | | fish:1 | | www | pig:60 | etc...

ios - CCSprites and CCButton in wrong spot in iPad Simulator -

Image
i trying achieve this: here code: cgsize size = [uiscreen mainscreen].bounds.size; [self resizesprite:background towidth:size.width toheight:size.height]; nslog(@"screen size: %@",nsstringfromcgsize(size)); background.position = cgpointmake(0 + background.contentsize.width ,size.height - background.contentsize.height); playbutton.position = cgpointmake(size.width/2, size.height/2); nslog(@"button position: %@",nsstringfromcgpoint(playbutton.position)); nslog(@"background position: %@",nsstringfromcgpoint(background.position)); and here resizesprite method: -(void)resizesprite:(ccsprite*)sprite towidth:(float)width toheight:(float)height { sprite.scalex = width / sprite.contentsize.width; sprite.scaley = height / sprite.contentsize.height; } when run in iphone 4 inch simulator looks perfect when run on ipad simulator looks this: if use: cgsize size = [[ccdirector shareddirector]viewsize]; it looks on ipad: right so

What is an efficient way to get column from multi-dimensional array in C? -

i have 2 structs: array2d (multidimensional) , array (one-dimensional). column type array2d , copy type array. although code works below, , recognize poor way of getting column array, i'm curious optimizations there might avoid o(n2) algorithm. efficient way column array in c? bool arr2_getcolumn(array2d *arr, const int column_index, array *returnedarray) { int x, y; int = 0; /* check valid array. */ if (arr->blnisinit != true) return false; /* initialize array column's height. */ if (!arr_init(returnedarray, arr->height)) return false; /* copy on column. */ (y = 0; y < arr->height; y++) { (x = 0; x <= column_index; x++) { if (x == column_index) { returnedarray->array[i] = arr->array[y * arr->width + x]; i++; } } } /* set new size. */ returnedarray->size = arr->height; retur

objective c - iOS Dropbox SDK: Error Domain=NSURLErrorDomain Code=-1005 -

my code, in i'm uploading file dropbox, used work properly. make connection , had no problems whatsoever, seems it's not able make connection anymore , i'm getting "error domain=nsurlerrordomain code=-1005 "the operation couldn’t completed." this line error seems occurring: [self.restclient uploadfile:filename topath:destdir withparentrev:nil frompath:localpath]; i've been using example given on dropbox core api website main reference, stuff comes directly example, , therefore not sure problem be. edit: i'm getting following: "file upload failed error: error domain=dropbox.com code=401"

jquery - Add Element/Paragraph after html BR? -

evening all! i'm having issues styling out few pages on site. problem i'm having information that's being pulled , displayed on page has no real styling included, contain <brs> which end rendering content quite ugly! i'm looking see if there's way can insert paragraph tag, after br element, before text. , add closing paragraph tag after text, before br tag underneath. - putting text that's between breaks paragraphs allow further styling. i've dropped example on on: http://jsfiddle.net/fish_r/9efc8/ - here, i've started experimenting $( "#property-info p br" ).before( "<p>" ); but adds punch of paragraph tags around br's rather around text. i don't have control of way information output onto page manually. please try below code part. can set p tag. $( "#property-info p br" ).each(function( index ) { //console.log( index + ": " + $( ).text() ); $(this).before(

mysql - Counting how many times each unique element appeared in `select` query -

Image
i have mysql database million of records, table indexed. below table structure. i ran below code in table. select `iwebs` `wordstable` `iwebs` 'a1' or `iwebs` 'a2' or `iwebs` 'a3' or `iwebs` 'a4' or `iwebs` 'a5' or `iwebs` 'a6' or `iwebs` 'a7' or `iwebs` 'a8' or `iwebs` 'a9' or `iwebs` 'a10' now code generates below output (small part of output displayed). however, not need. need key-value pair displays how many times each individual element appeared in result. like [a1,400] [a2,100] [a3,5] [a5,500] ........ in above example, first item in each bracket means individual element appeared in select query , second item means number of times appeared. in other words, means "a1 appeared 400 times in select query", "a2 appeared 100 times in select query", "a3 appeared 5 times in select query" , "a5 appeared 500 times in select query" , on. how can i

excel - Infinite For...Next loop: how do I fix it? -

i'm trying delete rows cell values non equivalent 1 of values array ar(). when put logical operator not loop goes infinite reason (excel freezes). in opposite works flawlessly, in case if want delete rows containing values array. the problem on line: if not .cells(i, 10).value = ar(j) then my code: sub tims() dim lastrow long, lr long dim long, j long dim t integer dim ar() string worksheets("start").activate t = count("a", range("a3:a14")) lr = range("i3:i10").end(xldown).row worksheets("master").activate sheets("master").range("a100:a" & 100 + lr - 3).value = sheets("start").range("i3:i" & lr).value worksheets("master") j = 1 lr - 2 redim preserve ar(j) ar(j) = cells(99 + j, 1) next j end worksheets("master") lastrow = .cells(.rows.count, "b").e