Posts

Showing posts from January, 2013

linux - Grub configuration for liveCD -

i need create custom linux livecd. used this perfect guide this. in few words: took linux mint livecd, mount it, unpack filesysetm.squashfs, edit chroot , pack iso. faced problem when tried customize grub settings. example, want set grub_timeout zero. can edit grub config file, can't run update-grub. voronwe@sul $ sudo chroot edit sul # mount -t proc none /proc sul # mount -t sysfs none /sys sul # mount -t devpts none /dev/pts sul # export home=/root sul # export lc_all=c sul # update-grub /usr/sbin/grub-probe: error: cannot find device / (is /dev mounted?). and can't mount boot: sul # mount boot mount: can't find boot in /etc/fstab or /etc/mtab sul # cat /etc/fstab # unconfigured fstab base system sul # cat /etc/mtab binfmt_misc /proc/sys/fs/binfmt_misc binfmt_misc rw,noexec,nosuid,nodev 0 0 none /proc proc rw 0 0 none /sys sysfs rw 0 0 none /dev/pts devpts rw 0 0 so, know how can grub configuration update on livecd? i found way. there file ...

javascript - Store `new Date ()` in JSON object -

i have following field validator object: { type:'date', 'min':new date() } i hoping store new date() expression in json , executed when it's parsed save timestamp: { type:'date', 'min':(new date()).gettime() } after read back: var result = json.parse('{ "type":"date", "min":1234567 }'); result.date = new date(result.min);

insert - inserting json data in meteor collection -

here's code. https://github.com/studiomockingbird/sh_meteor its leaderboard example wwhere trying insert of own data in collections. my data resides in lib/book.js , has been defined object (var mybook). the code use inserting in leaderboard.js - pages = new meteor.collection("pages"); if (meteor.isserver) { meteor.startup(function () { if(pages.find().count() === 0){ var pages = json.parse(mybook.stories); (page in pages) { pages.insert(pages[page]); } } }); } when try run code gives me running on: http://localhost:3000/ exited code: 1 exited code: 1 exited code: 1 application crashing. waiting file change. what doing wrong? totally new meteor. there couple of things need iron out: remove scoping of book you've used var mybook , using var mybook variable being scoped, or @ least 0.6.0 rc8, if you're getting book console.log don't worry now, if run lat...

list - Compare numbers in a nested file -

example: let list = [[23, '2'], [2, '3'], [55, '4'], [1, '5']] i'm trying numeric sort of list (using 1st field): list[indexnr][0] i've found function in files: function! mycompare(i1, i2) return (a:i1 + 0) - (a:i2 + 0) endfunction how can adapt nested list let work above example? you have give index params: function! mycompare(i1, i2) return a:i1[0] - a:i2[0] endfunction

cassandra - Datastax DevCenter fails to start -

devcenter 1.5.0 won't start, though working few days ago. have tried suggested answer question : datastax devcenter 1.1 fail start however didn't work me. did lead me think might due having updated eclipse mars yesterday, perhaps? any ideas great. in advance. in response comments below running windows 7. realised though java_home set correctly gettng error when run java -version: microsoft windows [version 6.1.7601] copyright (c) 2009 microsoft corporation. rights reserved. c:\users\username>java -version error occurred during initialization of vm java/lang/noclassdeffounderror: java/lang/object update : fixed java -version issue above removing java.exe c:/windows/system32/ . devcenter still not working.

java - deserialize json field into plain string with gson -

i trying deserialize json object java bean. main issue facing i'd treat field object of json string plain string, if contains potentially correct json object. json structure this: { "type":"user", "object":{ "id":"1", ...} } how can tell gson ignore object value doesn't deserialized object? i'd mapped plain string field in bean can dispose proper deserialization it, once got type type field. just declare of type jsonobject class examplejsonmodel { @serializedname("type") public string type; @serializedname("object") public jsonobject object; }

html - How do I make a div with position sticky works on Chrome and IE? -

i have, global div, 2 divs 1 display header , second display body. scrolling enabled want make header fixed when scrolling vertically. i used position:sticky , works firefox. can me. css: .wrapper{ width: 400px; overflow: auto; } .headertable { background-color: white; min-width: 600px; top: 0; position: sticky; } .bodytable{ min-width: 600px; height: 100px } table{ width: 100%; border: 1px solid; text-align: center; } html : <div class="wrapper"> <div class="headertable" id="headerfixed"> <table> <tr><td>head</td><td>head</td><td>head</td><td>head</td><td>head</td><td>head</td><td>head</td><td>head</td><td>head</td><td>head</td></tr> </table> </div> <div class="bodytable"> <table> ...

Cygnus Fiware docker Error -

i have downloaded git repository server , have followed steps in readme file located @ docker folder: docker-compose -f ./docker/0.compose.jar-compiler.yml -p cygnus run --rm compiler docker build -f ./docker/dockerfile -t fiware/cygnus . docker-compose -f ./docker/docker-compose.yml however i'm getting java error when i'm try run last command /docker-compose.yml up recreating docker_cygnus_1... attaching docker_cygnus_1 cygnus_1 | + exec /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.95-2.6.4.0.el7_2.x86_64/jre/bin/java -xmx20m -dflume.root.logger=debug,console -cp '/flume/conf:/flume/lib/*:/flume/plugins.d/cygnus/lib/*' -djava.library.path= com.telefonica.iot.cygnus.nodes.cygnusapplication -f flume/conf/agent_0.conf -n cygnusagent cygnus_1 | flume/bin/cygnus-flume-ng: line 232: /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.95-2.6.4.0.el7_2.x86_64/jre/bin/java: no such file or directory can me out on this? i did replicate steps, output [ root: fiware-cygnus ]# do...

android - ImageView on top of SurfaceView -

i have following layout, <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <com.example.linux.camtest.camerapreview android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/camera_surfaceview" android:layout_alignparentleft="true" android:layout_alignparentstart="true" android:layout_centervertical="true"/> <imageview android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/image" android:layout_alignparenttop="true" android:layout_alignparentleft="true" android:layout_alignparentstart=...

SUMIF formula doesn't give the correct answer in excel vba -

i'm using sumif formula gives me wrong output. can me? have checked lot of times unable find mistake! in advance! range("b10", range("b10").offset(0, -1).end(xldown).offset(0, 1)).formula = _ "=sumif('[" & dest_name & "]cu part pvo l'!$m$10:$m$2000,a10," & _ "'[" & dest_name & "]cu part pvo l'!$ad$10:$ad$2000)" [output][1] to clarify vba approach here's rough out: dim long dim wb workbook set wb = applications.workbooks.open(dest_name) 'dest_name need full file 'path, i.e. c:\<folder 1>\<folder 2>\....\<file name>.<file extension> dim cppl worksheet set cppl = workbooks(dest_name).worksheets("cu part pvo l") dim v string 'change type based on what's in a10 v = range("a10").value dim t long = 10 while < 2001 if cppl.range("m" & i).value = v t = t + cppl.range("ad" ...

sql - What would be the most efficient way to query large amounts of dynamic profiles in MySQL? -

i've got usersystem. every user has profile. profile fields dynamically stored in database. database looks like: create table profilefields( profilefield_id int(255) auto_increment, profilefield_name varchar(255), profilefield_value varchar(255), profilefield_type varchar(255), profilefield_isoptional tinyint(1), primary key(profilefield_id) ); create table users( user_id int(255) auto_increment, user_username varchar(255), user_password varchar(255), user_email varchar(255), primary key(user_id) ); create table profilevalues( profilevalue_id int(255) auto_increment, profilevalue_profilefield_id int(255), profilevalue_user_id int(255), profilevalue_value varchar(255), primary key(profilevalue_id) ); i'm trying list of users profile fields , values. i've got total of 50.000 users , 60 profile fields, resulting in 3.000.000 profile values. what efficient way retrieve such list (and possibly perform sear...

java - Combine separate RRD files to a single graph -

using rrd4j , how can combine several .rrd files either single .rrd or (ideally) single graph? more details: i have several copies of same .rrd . each file records several sensor data readings, name sensor-1 , sensor-2 across files. data1.rrd , data2.rrd contain data sources of sensor-1 etc. the ds definition follows. ds:sensor-1:gauge:35:u:u ds:sensor-2:gauge:35:u:u ds:sensor-3:gauge:35:u:u i can generate graph each individually adding data source graph this; val graph = new rrdgraphdef() graph.datasource("sensor-1", data1.rrd", "sensor-1", average) graph.datasource("sensor-2", data1.rrd", "sensor-1", average) graph.line("sensor-1", green) graph.line("sensor-2", red) but if same data2.rrd (adding datasource same graph instance), seems loose preceding data , graphs 1 of file's data. i suspect each ds having same name across files may problem. suggestions on how achieve same regular rr...

asp.net mvc - How can i load Partial view inside the view -

i confuse partial view... i want load partial view inside main view ... here simple exmaple... i loading index.cshtml of homecontroller index action main page.. in index.cshtml creating link via @html.actionlink("load partial view","load","home") in homecontroller adding new action called public partialviewresult load() { return partialview("_loadview"); } in _loadview.cshmtl having <div> welcome !! </div> but, when run project, index.cshtml renders first , shows me link "load partial view" ... when click on goes new page instade of rendering welcome message _loadview.cshtml index.cshtml. what can wrong? note: don't want load page through ajax or don't want use ajax.actionlink if want load partial view directly inside main view use html.action helper: @html.action("load", "home") or if don't want go through load action use htmlpartial hepler: ...

javascript - Lots of problems with AngularJS and Typescript on Visual Studio (DefinitelyTyped) -

i'm getting lots of errors on visual studio typescript compiler when running solution after adding simple angularjs controller /// <reference path="../../../scripts/typings/angularjs/angular.d.ts" /> "use strict"; class progressbarcontroller { static $inject: array<string> = ["$rootscope", "$element"]; static measure = "px"; static startpagefactor = 1; static endpagefactor = 1; private rootscope; // todo define rootscope boilerplate private element: jquery; constructor($rootscope, $element: jquery) { this.rootscope = $rootscope; this.element = $element; } getwidth(): string { var self = progressbarcontroller, masterbarwidth = parsefloat(this.element.css("width").split(self.measure)[0]), totalpages = this.rootscope.app.pages.length - self.endpagefactor, eachpageprogress = (masterbarwidth / totalpages), ...

java - Converting image to byte array, then to int array, then to byte array for image output -

i'm trying implement dct on image, , far have been able read image, grayscale it, turn byte array , output byte array image. works fine. however, in order work on image need convert byte array int array , again, , problem comes in. this first part reads image , converts image grayscale. bufferedimage image = imageio.read(new file("c:\\users\\a00226084\\desktop\\image.jpg")); int width = image.getwidth(); int height = image.getheight(); for(int i=0; i<height; i++){ for(int j=0; j<width; j++){ color c = new color(image.getrgb(j, i)); int red = (int)(c.getred() * 0.299); int green = (int)(c.getgreen() * 0.587); int blue = (int)(c.getblue() *0.114); color newcolor = new color(red+green+blue, red+green+blue,red+green+blue); image.setrgb(j,i,newcolor.getrgb()); } } this part converts image byte array. bytearrayoutputstream baos = new bytearrayoutputstream(); imageio.write(image, "jpg...

c# - The header property/field must be of type SoapHeader or a derived type, or an array of SoapHeader or SoapUnknownHeader -

using system.data; using system.web.services; using system.web.services.protocols; namespace myservices { /// <summary> /// summary description enroll /// </summary> [webservice(namespace = "http://tempuri.org/")] [webservicebinding(conformsto = wsiprofiles.basicprofile1_1)] [system.componentmodel.toolboxitem(false)] // allow web service called script, using asp.net ajax, uncomment following line. // [system.web.script.services.scriptservice] public class enroll : webservice { public credentials credentials = new credentials(); [webmethod(description = "this method call insert public note given comments", enablesession = false)] [soapheader("credentials")] public bool activityinsert(int docid, string activitytype, string comments, string usernameon247, string usernameet) { return enrollbl.activityinsertbl(docid, activitytype, ref comments, userna...

ios - How to change UICollection View cell data with new data -

i want change uicollection view cell data new data when user tap button mean want remove previous data , add new 1 use collectionview.reloaddata() adds new data previous, not replace it. how can that? you might adding new data existing data source.so new data added existing one. better add code in question.

Html color code with double double quotes -

i trying solve puzzle. think solution involves working out why in html if colour code has double double inverted commas display wrong colour. eg ... <font face color="“#b80707”" size> this wrong colour. green hex key red? there colour display correctly syntax? if be?

image - Crop Intent doesn't work properly in Android -

here intent code select picture , cropping gallery. int pick_image_request = 100; intent intent = new intent(); intent.settype("image/*"); intent.setaction(intent.action_pick); intent.putextra(mediastore.extra_output, mediastore.images.media.external_content_uri.tostring()); intent.putextra("crop", "true"); intent.putextra("aspectx", 150); intent.putextra("aspecty", 150); intent.putextra("outputx", 150); intent.putextra("outputy", 150); intent.putextra("return-data", true); getactivity().startactivityforresult(intent.createchooser(intent, "complete using with."), pick_image_request); here onactivityresult @override...

javascript - Button click event wont fire after adding tween.js -

when add line of code tween display box click event not fire anymore. no errors in console. how fix issue? did wrong? createjs.tween.get(directionsbox, { loop: false }).to({ x:800, y: 650 }, 4000) full code var directionsbox = new createjs.container(); displaybox = new createjs.shape(); displaybox.graphics.beginfill("#d8d8d8").drawroundrect(0, 0, 800, 570, 2); displaybox.name = "directionsbox"; displaybox.x = -800; displaybox.y = -650; var label = new createjs.text("\congratulations! \n \nyou have completed 3 levels." + "\n \nyour score: " + totalscoresfromalllevels + "\n \nyour sccore submited arcade. \n\n\nplay again? click here.", "bold 20px arial", "#000"); label.textalign = "left"; label.linewidth = 540; label.y = displaybox.y + 5; ...

R: Special characters when creating a folder or file -

i trying create pdf inside folder special character , have error , have no idea why. can create folder special character write tables inside folder (using write.table) can not create pdf files. has idea can solve problem? library(ggplot) > print(output_folder) "/users/name/documents/imperial_airlines_flight_201%2f8" > file_name <- paste(output_folder,"/","test.pdf", sep="") pdf(file_name,width = 20, height=10) qplot(gear, mpg, data=mtcars, geom=c("boxplot", "jitter"), fill=gear, main="mileage gear number", xlab="", ylab="miles per gallon") dev.off() i can not modify name of folder. thanks lot help.

How 2 methods in different class use method dependency in testNG -

i wanted access test method class , b class a{ @test(dependsonmethods="verifyelementsonprofilescreen",alwaysrun = true) public void verifymyselfprofilevisibility(){} } class b @test(dependsonmethods="testdemo",alwaysrun = true) public void verifymyselfprofilevisibility(){}

css3 - CSS: Flip a div on hover. Front and back content not hiding with flip on phone -

Image
i spaced out here site working in iphone view in chrome in developer tool when launch website on iphone itself, looks skewed. anyway, have multiple divs on home page. divs show title , when hover on them, want them flip on y axis in place, hide title , show more details. everything works on macbook , imac, when head on iphone, details show overlapping on title when load page. when hover on content flips stays overlapped. on macbook , imac, front content goes away , content shows flip works want. what doing wrong? here picture here code. html <div class="flip-container col-md-4" ng-repeat="webinar in webinars" ontouchstart="this.classlist.toggle('hover');"> <div class="flipper"> <div class="front"> <!-- front content --> <h3> {{ webinar.title }} </h3> ...

mysql - How efficient are Hibernate's interceptors compared to database triggers? -

since i can't make mysql update column on update , i'm thinking of using hibernate's interceptors , update updated table each time row updated. my concern is, how of performance penalty imply, compared ideal case of having mysql updating it? there's no significant performance penalty , don't need interceptor either. i created example on github this. you need create jpa callback listener: public class updatablelistener { @prepersist @preupdate private void setcurrenttimestamp(object entity) { if(entity instanceof updatable) { updatable updatable = (updatable) entity; updatable.settimestamp(new date()); } } } which uses interface that's defined this: public interface updatable { void settimestamp(date timestamp); date gettimestamp(); } you can define base class entities: @mappedsuperclass @entitylisteners(updatablelistener.class) public class baseentity implements up...

javascript - Parsing invalid JSON string to JSON2 in java script -

i have invalid json string below wanted convert json. want rid of eval(). json.parse() throwing exception. there anyother way this? "{user:'c3dc5ff987acb5c8cb7adf9d774775fa', recover:[{client:'call', call:{cti_telephone_called:'sip:217812@ukavayatest.fnfis.com;user=phone', cti_caller_telephone:'0031205849948', cti_time_in_queue:'created:10:59:48 03/08/15;queued:11:00:42 03/08/15;answered:11:00:46 03/08/15', customer_nbr:'817', sortcodeacctno:'no_value', idvs:'3', skill:'sby sav se e blocked acct d', cdn_name:'sby sav se e blocked acct d', contact_id:'ukbiataaep-2015141090031-5', tp_call_type:'no_value', tp_call_status:'no_value'}, contactid:'ukbiataaep-2015086103648-14'},{end:'end'}]}" well rules invalid json violating missing quotes around key names (like "name": ) , use of single quotes around string literals (like 'call' ...

ruby - Cannot chain the searching in rails -

i'm trying searching title/body simple search rails. when tried put matched string in title/body, cannot display expect result. please me have check? thank in advance article.rb def self.search(query) # where(:title, query) -> return exact match of query where("title ? or body ?", "%#{query}%", "%#{query}%") end controller if params[:search] @articles = article.search(params[:search]) #@articles = article.where(["title || body ?","%#{params[:search]}%"]) else @articles = article.all end show <%= form_tag(articles_path, :method => "get", id: "search-form") %> <%= text_field_tag :search, params[:search], placeholder: "title or body" %> <button class="btn btn-success-outline" type="submit">search</button> please details @ github link : https://github.com/khoinguyen91/coderschool_blog ok, too...

zapier - PayPal IPN settings -

i have been looking everywhere , cannot seem find it. may have more 1 ipn? ask because right now, ipn setup work membership site kajabi. want add zapier ipn paypal can more paying clients. works super stripe looks have remove current ipn add zapier hooks. could use feedback. thanks! it doesn't seem can create multiple ipn's single paypal account. may have consider using the rest api create webhooks (you can have 10 different webhooks).

python - django 1.6 how to use sqlite3 in virtualenv on windows? -

i'm new django. i'm trying learn online video tutorial. i'm running django 1.6 , while running command python manage.py dbshell then error 'sqlite3' not recognized internal or external command,operable program or batch file. i downloaded dll files , sqlite.exe file website , added path. works on computer intended, not affect virtualenv i'm working on , kinda out of clue how proceed. i'm using django 1.6 because tutorial follows it.

php - Codeigniter SQL query no records in other table -

i join 2 tables there no record in other table. for example table name: shop_items shop_item_id shop_item_sk shop_item_name table name: item_reviews item_review_id item_review_sk item_review_desc item_review_rate shop_item_sk item_review_by the problem item details doesn't appear when don't have record in item_reviews table this sql statement $query = $this->db->select('*') ->from('shop_items') ->join('item_reviews', 'shop_items.shop_item_sk=item_reviews.shop_item_sk','inner') ->where('shop_items.shop_item_sk',$id) ->limit(1) ->get(); return $query->result(); i researched union don't know how use in codeigniter. advance thank can me. use left outer join. here shop_items table left table join item_reviews it.

javascript - why this code didn't work correctly? -

i have following problem resolve, don't understand why code doesn't work correctly. write javascript function takes input array of 2 numbers (start , end) , prints @ console html table of 3 columns. column 1 should hold number num , changing start end. column 2 should hold num*num . columns 3 should hold "yes" if num fibonacci number or "no" otherwise. the table should have header cells titled "num", "square" , "fib". see below examples. input input data comes array of 2 numbers: start , end. input data valid , in format described. there no need check explicitly. output print @ console above described table in same format examples below. don't add additional spaces. whitespace , character casing important, please use same in below examples. constraints • input passed first javascript function found in code array of 2 elements. • numbers start , end positive integers in range...

Electron Node.js node localstorage osx mkdir permission denied -

i working electron , node.js. have developed application works fine on windows , requirement had package mac os. packaged application using electron-packager, packaging process completes , package generated. double clicking throws error permission denied mkdir, using node localstorage maintain settings on user's local machine. somehow mac doesn't local storage create folder in root of application. in matter great. thanks first off, code in question in main process or in renderer process? if latter, don't need use 'node-localstorage', because can use renderer's native localstorage. if in main process, need provide own storage strategy using 'node-localstorage' viable option. in case, need consider store data; starters, let's @ electron's renderer processes store localstorage data: differs based on os, can get , set paths using app module -- path in question userdata , on os x default ~/library/application support/<app name> ...

mongodb - Checking data integrity with counts -

i have field dictionary in it, mapping people numbers 0-9. {peopledict : {bob: 3, les: 3, meg: 8, sara: 6}} i have field dictionary in it, supposed count number of people assigned each number. {countdict : {"3" : 2, "8" : 1, "6" : 1}} so document looks like {peopledict : {bob: 3, les: 3, meg: 8, sara: 6}, countdict : {"3" : 2, "8" : 1, "6" : 1}} i trying write query tests whether countdict matches peopledict each document. i'm sure there must way aggregate i'm not quite sure how. as far know, can't join data different collections. if have them in separate collections need analyze data on application level, or redesign data structure put of them single collection.

mysql - Displaying data from database from Controller to View using jQuery AJAX request CodeIgniter without refereshing the page -

how can load particular portion of page in codeigniter? ajax working reloads views calling controller name(like header, body, footer) want reload body, how can separate code work properly. its ajax code $('label#showdata').click(function(){ var fromdate =document.getelementbyid('fromdate').value; var todate = $(this).val(); var datastring = 'fromdate='+ fromdate+'todate='+todate; $.ajax({ type: "post", url: "https://chotigaadi.com/myadmin/references", data: datastring, cache: false, success: function(html) { $("div#result").html(html).show(); //alert(datastring); } }); }); its view <div class="col s12 m12"> <form action="<?php echo base_url();?>myadmin/exportcsv" method="post"> <div class="col s12 m3"> ...

Exchange 2010: Recover mailboxes (not mails) after completely losing the Db -

we have windows server 2008 r2 machine running our primary domain controller exchange 2010 server running on it. have windows server 2008 r2 machine secondary domain controller no exchange installed. pdc exchange has crashed , beyond recovery. promoted other domain controller pdc , installed exchange 2010 on it. my requirement enable users access mailboxes again. don't want recover mails or other data. users can log exchange accounts , send mails again. thanks. you try disabling , re-enabling mailbox each user, : disable-mailbox "username" enable-mailbox "username" this assuming users showing in new environment ecp @ all if not, may have remove users exchange attributes ad. link below seems broach same issue, , gives list of attributes need removed. you should note, removing these attributes mean users lose e-mail addresses attached account. avoid this, retrieve value of "proxyaddresses" before removing attribute, allowing res...

ios - Put Mobile App Launch Icon on Notifications Screen to Launch from Locked Device -

want put icon our ios app on ios notifications screen can accessed when user has not entered passcode, user can launch app when phone locked without needing input passcode. goal fast launch minimum time locked iphone. don't need send user notification. great work on android, ios more important feature. what best way using cordova? there existing plugin purpose? thanks it not possible launch ios app without unlocking phone/device. notifications screen available once ios device unlocked. (thanks dan)

java - Writing a DF as a parquet with null values using Spark -

i trying read csv using struct type more struct fields csv file has columns. results in extraneous columns being null. when trying write file out parquet getting java.lang.numberformatexception: null. java.lang.numberformatexception: null @ java.lang.long.parselong(long.java:404) @ java.lang.long.parselong(long.java:483) @ scala.collection.immutable.stringlike$class.tolong(stringlike.scala:230) @ scala.collection.immutable.stringops.tolong(stringops.scala:31) @ com.databricks.spark.csv.util.typecast$.castto(typecast.scala:54) @ com.databricks.spark.csv.csvrelation$$anonfun$buildscan$6.apply(csvrelation.scala:181) @ com.databricks.spark.csv.csvrelation$$anonfun$buildscan$6.apply(csvrelation.scala:162) @ scala.collection.iterator$$anon$13.hasnext(iterator.scala:371) @ scala.collection.iterator$$anon$11.hasnext(iterator.scala:327) @ scala.collection.iterator$$anon$11.hasnext(iterator.scala:327) @ scala.collection.iterator$$anon$13.hasnext(iterator.scala:371) @ org.apache.spark.s...

c++ - How can I enumerate text read from a file line by line, and find the line with the most characters and words in C? -

i'm writing program supposed read text file (fed program via command line), , enumerate , print out each line , provide information on number of words, characters, , lines, information on line has characters/words. so far i've been able count number of words, characters, , lines having trouble finding way enumerate , print each line out , find lines have characters/words. here code #include <stdio.h> #define in 1 #define out 0 int main( ) { int line, word, character, state, place, flag maxw, maxc; state = out; line = word = character = 0; while( (place = getchar()) != eof ) { ++character; flag = in; printf("%c", place); if( place == '\n' ) { ++line; printf("%d: ", (line + 1)); flag = in; } if(flag == in) { } if( place == ' ' || place == '\n' || place == '\t' ) state = out; else if( state == out ) { state = in; ++word;...

javascript - ZeroClipboard - How to use -

i'm using 1 http://jonrohan.github.io/zeroclipboard/ i spent whole day figuring out how use zeroclipboard(zc). read instructions: https://github.com/jonrohan/zeroclipboard/blob/master/docs/instructions.md , followed step step , couldn't it. i tried again , again , again can't work. spent hours reading other guides @ stackoverflow , other pages both couldn't work. moreover, of answers outdated. can please write simple working zc code copies paragraph tag: <p>hello, i'm armesh</p> then tell me each part of zc code , why wrote way. i plan use zc copy references generated generator: http://anonoz.com/armesh/ this code wrote, link references correct: <!doctype html> <html> <head> <title>zero test</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <script src="javascripts/zeroclipboard.js"></script> </head...

java - Date conversion Simple Date format -

i need convert date format yyyy.mm.dd , using below formula - date curdate = new date(); out.println(curdate); string pattern = "yyyy.mm.dd"; dateformat format1 = new simpledateformat(pattern, locale.english); string datetostr = format1.format(curdate); out.println(datetostr); the output getting curdate - fri feb 05 15:21:28 cst 2016 datetostr - 2016.21.05 i need instead of 2016.21.05, should datetostr - 2016.02.05. any doing wrong here? thanks, arun what want yyyy.mm.dd = year.month.day, while yyyy.mm.dd = year.minute.day. see cheat sheet more info.

Android display a button with OnTouchListener -

i have button disappears 3 seconds after press on it. make visible again touching screen. public class mainactivity extends activity { runnable buttonrunnable; handler buttonhandler = new handler(); protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); final button button=(button)findviewbyid(r.id.mybutton); buttonrunnable = new runnable() { public void run() { button.setvisibility(view.gone); } }; button.setonclicklistener(new view.onclicklistener() { public void onclick(view view) { buttonhandler.postdelayed(buttonrunnable, 3000); } }); } private ontouchlistener buttonontouchlistener = new ontouchlistener() { @override public boolean ontouch(view v, motionevent event) { final button button=(button)findviewbyid(r.i...

Return value from nested Subroutine Perl -

we've received assignment school, we're supposed make our own small n' simple perl application. thought i'd make atm simulator. far, it's been going great; i've created menu (withdraw, balance, transfer), using subroutines. code far: #! /usr/bin/perl #written by: tobias svenblad, h15tobsv@du.se, digitalbrott & e-säkerhetsprogrammet (2015) #perllab03-2c.plx use warnings; use strict; use term::ansicolor; use text::format; $firstname; $lastname; $acc_balance = 2451.26; $acc_withdraw; $clr_scr = join( "", ( "\033[2j", "\033[0;0h" ) ); #this variable clear screen , jump postion 0, 0. $atm = text::format->new; print color('green'); print $atm->center("atm v. 1.20"); print color('reset'); #create account message. $crt_acc_msg = <<"end_msg"; \ndear sir or madam,\n we're happy you've chose bank. before proceed, need set-up account.\n end_msg print $crt_acc_msg; &a...

php - Customizing URLs with prefix in laravel -

i have html: <ul> <li><a href="index.php/page1">page 01</a></ <li><a href="index.php/page2">page 02</a></li> <li><a href="index.php/page3">page 03</a></li> </ul> as can see, need use index.php/ prefix in links due server of university (i can't change it). way done above, works fine go straightfoward home page, if try access page page, wrong url , can't access page: examples: home http://localhost/php-project/public/ page1 (from home) from: http://localhost/php-project/public/ to: http://localhost/php-project/public/index.php/page1 page2 (from home) from: http://localhost/php-project/public/ to: http://localhost/php-project/public/index.php/page2 page1 (from page2) from: http://localhost/php-project/public/index.php/page2 to: http://localhost/php-project/public/index.php/index.php/page1 as can see, prefix repe...

time - R strptime() still returns NA when locale is English_United States.1252 -

my time dataset hourlyload.csv$localdatetime like: 07nov10:12:45:00 07nov10:13:00:00 07nov10:13:15:00 07nov10:13:30:00 i'm trying convert string date numeric date, subset data starting date 2013-01-01 , end dates 2015-09-31. i tried x<- strptime(hourlyload.csv$localdatetime, format="%d/%b/%y:%h:%m:%s",tz="america/los_angeles") but x returns na i checked locale, , it's english_united states.1252. don't think na caused non-english locale. i tried as.posixct(), as.date...none of them work. use sys.setlocale("lc_all","english") sys.setlocale("lc_time", "english") strptime("07nov10:12:45:00", format="%d%h%y:%h:%m:%s",tz="america/los_angeles") [1] "2010-11-07 12:45:00 pst"

ios - Allow call (and maps, and mail) in cordova -

i've been struggling while. i'm trying make call after people press 'call' popup. funny thing is, goes straight calling when click phone number. when hit 'call', console returns: error internal navigation rejected - <allow-navigation> not set url='tel:06-83237516 code: controller: $scope.callperson = function() { var link = "tel:" + $scope.person.phonenumber; var confirmtel = $ionicpopup.confirm({ title: $scope.person.phonenumber, canceltext: 'cancel', oktext: 'call' }); confirmtel.then(function(res) { if (res) { window.open(link); } else { console.log('cancel call'); } }); } config.xml: <access origin="*"/> <allow-intent href="tel:*"/> <allow-intent href="mailto:*"/> <access origin="tel:*" launch-external="yes"/> <access origin="ma...

data modeling - How model multiple 1-to-n relationships in firebase? -

Image
i'm coming parse firebase , want implement project non-trivial 1-to-n relationships follows: entity --1-to-n--> person person --1-to-n--> credit creditor --1-to-n--> credit data write , read — added clarification person , related credit created @ same time. each person may read / update each of own credit few times. then read creditor: run queries gather credit of given creditor. looking @ firebase's documentation would have use relationship below, wonder if i'm thinking correctly. { "entities": { "entitya": { "name": "...", "persons": { "persona": true, "personb": true, "...": true } }, "entityb": { "name": "...", /* ... */ } }, "persons": { "persona": { "name": "...", "entity": "entitya...

objective c - Can I use my remote cloudant(nosqlDB) path for CDTDatastoreManager directory in IBM Bluemix SDK? -

i migrating application backend parse.com ibm bluemix. not want cdtdatastore take control of persistent store(core data) exist. as per blue mix documentation: nserror *outerror = nil; nsfilemanager *filemanager= [nsfilemanager defaultmanager]; nsurl *documentsdir = [[filemanager urlsfordirectory:nsdocumentdirectory indomains:nsuserdomainmask] lastobject]; nsurl *storeurl = [documentsdir urlbyappendingpathcomponent:@"cloudant-sync-datastore"]; nsstring *path = [storeurl path]; can make "storeurl" remote database url( https://apikey:apipassword@username.cloudant.com/my_database ) i.e cloudant database? must in position create,update,delete,documents in remote database directly out using cdtreplicatorfactory , no offline storage. please let me know if further architectural design of application required. this pod should looking for. https://cocoapods.org/?q=objectivecloudant

Grails Stripe plugin error -

Image
i'm using stripe plugin grails ,grails version 2.5.1 can't make successful transaction there error processing credit card. shown in controller , noticed charge method not defined shown in screenshot i tried import com.stripe.stripe i'm getting unable resolve class com.stripe.stripe . here action: def charge(string stripetoken, double amount) { //stripe.apikey = grailsapplication.config.grails.plugins.stripe.secretkey def amountincents = (amount * 100) integer def chargeparams = [ 'amount': amountincents, 'currency': 'usd', 'card': stripetoken, 'description': 'customer@sample.org' ] def status try { charge.create(chargeparams) status = 'your purchase successful.' } catch(cardexception) { status = 'there error processing credit card.' } redirect(action: "confirmation", params: [msg: status]) return } try this, in build config add: plugins { ... ...

visual studio - Are synonymous `typedef`s in C interchangable? -

the declaration qboolean snddma_initdirect (void); appears in 'winquake/snd_win.c' on line 69 . however, function's definition (appearing on line 183 of same file written as: sndinitstat snddma_initdirect (void) { /* actual implementation unimportant in discussion. */ } both qboolean , , sndinitstat typedef s of enumerations: sndinitstat on line 33 of 'winquake/snd_win.c' , typedef enum {sis_success, sis_failure, sis_notavail} sndinitstat; and qboolean in 'winquake/common.h' (line 30) typedef enum {false, true} qboolean; these different enumerations . i have been compiling source both visual studio 2015's built in compiler -- cl.exe -- , clang v3.7.1 via llvm plugin visual studio. clang states difference in declaration/definition error. visual studio compiles okay. who correct? now, quote c: reference manual (fourth edition) : section 5.5 enumerated types (page 127) the enumeration constants specified when type defi...

javascript - Undefined when returning $http promise in controller from factory -

no matter $$state or undefined factory api call. i've tried promises , returning response.data .then nothing tried works. i can proper response data controller when try assign undefined or $$state , depending on method use. my factory: factory('forecastfactory', function ($http, $q, sundialconfig) { var forecast = {}; var weatherkey = sundialconfig.openweatherkey; forecast.daycnt = 1; forecast.preparecity = function (city) { city === undefined ? city = 'chicago, il' : city = city; return city; } forecast.getforecast = function (city) { var preparedcity = forecast.preparecity(city); var deferred = $q.defer(); $http.jsonp('http://api.openweathermap.org/data/2.5/forecast/daily?', { params: { appid: weatherkey, q: preparedcity, cnt: forecast.daycnt, callback: 'json_callback' } ...