Posts

Showing posts from February, 2013

PHP - get rows in MySQL database ordered by serialized dates -

i have ran predicament on system have been working on. in table "class" there multiple rows of classes. column focusing on "dates". on admin dashboard, need able list classes closest date farthest away. tried using not work way want to. mysqli_query("select * class order dates asc") my problem column "dates" serialized array of start , end dates. because of can't use strtotime() make above code work 100% correctly. my overall question is, there way can sort query serialized date string? i know opinions of different ways arise, that's not i'm shooting for. if possible or have idea, please post answer. mysql order serialized data? no, not possible. possible case when serialized data acceptable when don't need search or order through data. in other cases - store data separated fields.

rubygems - How to uninstall rvm, ruby, rails and gems. I'm getting errors on Mavericks -

i'm new on ruby on rails , have problems configuration. don't know do. installed many times ruby, rails , gems because report problems. read lot of questions on stack overflow , nothing solve. try uninstalling , have errors when trying remove gems, : i report problems on terminal , don't know how send log, etc.. it's correct uninstall: remove gems: $ gem clean -uninstall ruby: $ rvm uninstall ruby (#this uninstall ruby's installed?) or need: -uninstall version: $ rvm uninstall 2.1.0 and others version 2.0.0 , 2.1.1 -uninstall rvm: $ rvm repair $ rvm cleanup $ rvm implode and install again!? when try have this: macbook-pro-de-romenig:~ romenig$ gem clean cleaning installed gems... clean complete macbook-pro-de-romenig:~ romenig$ cd ~ macbook-pro-de-romenig:~ romenig$ ruby -v ruby 2.0.0p247 (2013-06-27 revision 41674) [universal.x86_64-darwin13] macbook-pro-de-romenig:~ romenig$ ruby lis ruby: no such file or directory -- lis (loaderror) macbo...

javascript - EmberJS - Assertion failed: The value that #each loops over must be an Array. You passed (generated application controller) -

i'm struggling model's fixture data render template, receive error above when try each loop in template: {{#each}} {{title}} {{/each}} i have set router so: application.router.map(function() { this.resource('application', { path: '/' }); }); application.applicationroute = ember.route.extend({ model: function() { return this.store.find('applicationmodel'); } }); and model setup so: application.applicationmodel = ds.model.extend({ title: ds.attr('string') }); application.applicationmodel.fixtures = [ { id: 1, title: 'title-1' }, { id: 2, title: 'title-2' } ]; can tell me i'm doing wrong? thanks try this: {{#each content}} {{title}} {{/each}} and app.applicationcontroller = ember.arraycontroller.extend({}) application.applicationroute = ember.route.extend({ model: function() { return this.store.find(...

c++ - Cygwin: Installing quantlib in cygwin -

i've attempted install quantlib-1.4 on cygwin along boost_1_55_0, following these steps: http://quantess.net/2012/09/26/quantlib-get-it-working-on-ubuntu/ after installation, i've ran quantlib's test cases no error detected: xxx@xxx /usr/local/lib/quantlib-1.4/test-suite $ ./quantlib-test-suite.exe running 567 test cases... tests completed in 15 m 20 s *** no errors detected however when ran simple code (main.cpp): #include <ql/quantlib.hpp> int main(){ return 0; } linker errors seems occur. xxx@xxx /usr/local/lib $ g++ -lquantlib main.cpp /tmp/ccvjpqgc.o:main.cpp:(.text$_znk8quantlib4dateplerkns_6periode[__znk8quantlib4dateplerkns_6periode]+0x2e): undefined reference `quantlib::date::advance(quantlib::date const&, int, quantlib::timeunit)' /tmp/ccvjpqgc.o:main.cpp:(.text$_zn8quantlib5errord1ev[__zn8quantlib5errord1ev]+0xd): undefined reference `vtable quantlib::error' /usr/lib/gcc/i686-pc-cygwin/4.8.2/../../../../i686-pc-cygwin/bin...

Running remote commands after vagrant ssh -

vagrant ssh -- ssh args supposed allow args passed ssh. vagrant ssh -- -t 'cd /var/www' should ssh vagrant , change directory /var/www , doesn't. instead returns ssh: not resolve hostname ls: nodename nor servname provided, or not known what missing? this works me: vagrant ssh -- -t 'cd /var/www; /bin/bash'

Passing "extra" arguments to a function stored in a variable - Javascript -

i'm new javascript, i'm self-teaching, might obvious area, no matter how phrase question can't seem head around 1 issue. @ moment i'm reading through http://eloquentjavascript.net/chapter6.html (which on mozilla's mdn). i've come across couple of times now, simple break down if possible. function negate(func) { return function(x) { return !func(x); }; } var isnotnan = negate(isnan); show(isnotnan(nan)); i don't understand how @ last step isnotnan (a variable) passing 'extra argument' (nan) function stored in isnotnan (negate(isnan). "show(isnotnan(nan));" i came across same problem when concept of enclosure trying explained. don't argument "nan" going in above function, seems me last statement ends like: show(negate(isnan, nan)); i happy provide more details. concept of passing argument variable holding function argument confuses hell out of me! there's no "extra" argument. negat...

php - Symfony2 how to fix deploy kernel error -

hi deployed app server , got karnel error. j have no idea can couse it, maybe assets or something? here error: parameternotfoundexception: have requested non-existent parameter "kernel.debug". in /home/public_html/projecname/vendor/symfony/symfony/src/symfony/component/dependencyinjection/parameterbag/parameterbag.php line 106 @ parameterbag->get('kernel.debug') in /home/public_html/projecname/app/bootstrap.php.cache line 1954 @ container->getparameter('kernel.debug') in /home/public_html/projecname/vendor/symfony/symfony/src/symfony/bundle/frameworkbundle/frameworkbundle.php line 85 @ frameworkbundle->build(object(containerbuilder)) in /home/public_html/projecname/app/bootstrap.php.cache line 2557 @ kernel->preparecontainer(object(containerbuilder)) in /home/public_html/projecname/app/bootstrap.php.cache line 2537 @ kernel->buildcontainer() in /home/public_html/projecname/app/bootstrap.php.cache line 2490 @ kernel->initializecontaine...

java - Why can I not use a method to set text for a generic EditText? -

in couple of places in code, i've used method set text of view instead of directly setting it. mean rather doing: edittext.settext(mystring); i've used method follows: public void settext(edittext edittext, string mystring) { edittext.settext(mystring); } (obviously looks little superfluous; used check properties of string may have impact on how set text in cases.) using method way not seem set text. why this? thanks! get id of element , set . example edittext edittext=(edittext)findviewbyid(r.id.edittext_from_example); edtitext.settext("string"); further more, if want can write seperate methods it doesnt know edittext set string.

php - Send email according to input select value -

i need make changes existing form adding dropdown menu have 2 inputs , values. purpose send form recipient_one if address 1 selected or recipient_two when address 2 selected. address 1 needs default value when nothing selected. here added html: <form method="post" action="./index.php" enctype="multipart/form-data"> <fieldset class="elist"> <legend>select shop:</legend> <select name="shop"> <option name="address-chosen" value="tammsaare" >tammsaare</option> <option name="address-chosen" value="Ãœlemiste" >Ãœlemiste</option> </select> </fieldset> </form> and php: $action = isset($_post['action']) ? $_post['action'] : null; $page = null; $pages = array('info', 'en'); if( ...

teradata - SQL Adding the same char into multiple fields -

i have sql query brings 17 numbers format 06037-11 i need add 0 before dash, is: 060370-11 is there easy way this? have seen stuff() option, don't understand it. edit using teradata previous response includes example teradata 14.x using regular expression support. following work in teradata 13.x or teradata 12.x without regular expression support: select substring('06037-11' 1 (position('-' in '06037-11') -1)) || '0-' || substring('06037-11' (position('-' in '06037-11') + 1))

unityscript - accessing user documents folder on unity3d -

is possible path current user documents folder on unity3d using unityscript? trying access on desktop systems (windows, linux or osx). on mobile systems, application.persistentdatapath trick me, desktop use documents folder users can see , change files easily. i don't know if javascript has way windows special folders, c# has environment.getfolderpath . so 1 way of doing create c# script give documents path , put in standard assets folder. way, javascript can call script. c# file using system; public class getuserpathcsharp { public static string getuserpath() { return environment.getfolderpath(environment.specialfolder.mydocuments); } } javascript file #pragma strict function start () { var test = getuserpathcsharp.getuserpath(); print("path " + test); } note: make sure c# script inside folder called standard assets . it's important .

Django 1.5.4 syncdb not creating some fields in PostgreSQL 9.1/PostGIS 2 tables -

i have django model this: class company(models.model): name=models.charfield(max_length=256, default=''), user=models.foreignkey(user), logo=models.imagefield(upload_to='logos') def __unicode__(self): return unicode(self.name) after running syncdb, postgresql table create table myapp_company ( id integer not null, logo character varying(100) not null ); so, no name field, neither user id. same thing happens other model classes: missing fields. , random. example, weird. model class maplayer(models.model): cartodb_layer = models.foreignkey('cartodblayer'), work_map = models.foreignkey('workmap'), overlap = models.booleanfield(default=false), min_zoom = models.integerfield(default=4), max_zoom = models.integerfield(default=14), opacity = models.floatfield(default=0.6), anti_aliasing = models.floatfield(default=0.5) generates postgresql table create table myapp_maplayer ( id i...

javascript - jQuery mobile - panel style removed when loading from any page other than initial one -

i have jquery mobile site 2 pages loaded 1 html file use same panel, in file, outside of data-rol="page" divs. problem when reload second page, in visit before using first page, jquery mobile styling on ul in panel gone. i've tried adding enhancewithin() code after creating panel must missing something, it's loading same panel, how style lost if reloaded page? source <div data-role="page" class="ui-responsive-panel" data-theme="b" id="page"> <div data-role="header" data-position="fixed"> <h1>alpha</h1> <a href="#left-panel" data-icon="bars" data-iconpos="notext">menu</a> </div><!-- /header --> <div data-role="content"> <h1>news , features</h1> <a href="#page2"><p>lorem ipsum</p...

html - Start CSS3 animation with jquery -

i trying start specific css animation jquery when click button. no idea how. ideas? thanks <button>click here start animation!!</button> <div id="ball"></div> #ball { background:tomato; height:50px; width:50px; border-radius:200px; position:absolute; animation:bounce 3s infinite; -webkit-animation:bounce 3s infinite; top:40px; } @-webkit-keyframes bounce { 50% { top: calc(100% - 50px); } } @keyframes bounce { 50% { top: calc(100% - 50px); } } a simple method have css animation properties on seperate class , toggle class when button clicked. example here #ball.animate { animation:bounce 3s infinite; -webkit-animation:bounce 3s infinite; } jquery: $('button').on('click',function(){ $('#ball').toggleclass('animate'); });

Magento pass extra info to payment gateway -

i trying follow http://excellencemagentoblog.com/magento-create-custom-payment-method-api-based build payment gateway. everything ok. need pass digital signature payment gateway. i think should add in class excellence_pay_model_pay assigndata($data) info = $this->getinfoinstance(); $info->setcctype($data->getcctype()) ->setccowner($data->getccowner()) ->setcclast4(substr($data->getccnumber(), -4)) ->setccnumber($data->getccnumber()) ->setcccid($data->getcccid()) ->setccexpmonth($data->getccexpmonth()) ->setccexpyear($data->getccexpyear()) ->setccssissue($data->getccssissue()) ->setccssstartmonth($data->getccssstartmonth()) ->setccssstartyear($data->getccssstartyear()) ->setccsignature($data->getccsignature()); i have added 1 more field : ->setccsignature($data->getccsignatu...

javascript - Make CSS tooltip follow cursor -

i'm creating css based tooltip going have lot of content in tooltip , instead of being in static place wondering there easy way make follow cursor hover on link. here example of css based tooltip <div class="couponcode">first link <span class="coupontooltip">content 1</span> </div> .couponcode:hover .coupontooltip { display: block; } .coupontooltip { display: none; background: #c8c8c8; margin-left: 28px; padding: 10px; position: absolute; z-index: 1000; width:200px; height:100px; } http://jsfiddle.net/q46xz/ something this var tooltip = document.queryselectorall('.coupontooltip'); document.addeventlistener('mousemove', fn, false); function fn(e) { (var i=tooltip.length; i--;) { tooltip[i].style.left = e.pagex + 'px'; tooltip[i].style.top = e.pagey + 'px'; } } fiddle

java - deciphering an array of objects in JSP -

i have array of objects passing servlet jsp i have own class called object located @ com.example class object { string param1; //getters , setters } my servlet code: object[] sampleobject = new object[5]; // code populate object requestdispatcher dispatch = request.getrequestdispatcher("/inc/example.jsp"); request.setattribute("object", sampleobject); dispatch.forward(request, response); my example.jsp <%@ page language="java" contenttype="text/html; charset=iso-8859-1" pageencoding="iso-8859-1" %> <%@ page import="java.util.*" %> <%@ page import="com.example.object" %> <jsp:usebean id="object" scope="request" class="java.util.arrays" /> <% int l = object.length; %> this fails error the value usebean class attribute java.lang.arrays invalid when tried <jsp:usebean id="object" scope=...

sql - Select only if related entities column contains specific value -

i having hard time figuring out sql query. want pick companies has licenses name containing "test". company license |pkid|name | |pkid|companyid|name | ----------------- ----------------------------- |1 |microsoft | |1 |1 |license test| |2 |apple | |2 |1 |commercial | |3 |2 |license test| |4 |2 |license test| so, in example microsoft has 2 licenses. 1 test , 1 commercial don't want company. of apples licenses test licenses want select apple. what i'm thinking of is: select company.name, count(company.name) company inner join license on license.companyid = company.pkid license.name '%test%' group company.name to how many rows containing "test" each company , compare select company.name, count(company.name) company inner join license on license.companyid = compan...

c# - Play a list of songs with media player on WinForm -

namespace windowsformsapplication1 { public partial class form1 : form { public form1() { initializecomponent(); } string[] nomi, percorsi; //nomi means names , percorsi means paths. i'm italian, that's why private void apri_click(object sender, eventargs e) { openfiledialog apri = new openfiledialog(); apri.filter = "file *.mp3|*.mp3"; apri.multiselect = true; dialogresult scelta = apri.showdialog(); if (scelta == dialogresult.ok) { nomi = apri.safefilenames; percorsi = apri.filenames; (int = 0; < nomi.length; i++) files.items.add(nomi[i]); } } private void files_selectedindexchanged(object sender, eventargs e) { player.url = percorsi[files.selectedindex]; } } } i have code create simple mp3 ...

javascript - Updating an Emberjs view as objects are updated -

i'm using nice ember.js mixin: https://github.com/wildhoney/emberdroplet upload images using drag-and-drop , it's working brilliantly. the problem is, don't know how add images view after have been uploaded. model getting updated in rails api, but, short of refreshing whole page, don't know how update model in ember. here's snippets of code: router.js.coffee app.router.map -> @resource('site', { path: '/' }, -> @resource('media') ) routes.js.coffee app.mediaroute = ember.route.extend model: (params)-> return app.media.find() media.handlebars <div class="row"> <div id="media-container" class="large-12"> <div class="row"> {{#each media in model}} <div class="large-4 columns"> <a class="th" {{bind-attr href='media.url'}}> <img {{bind-a...

mysqli - mysqli_stmt_bind_param returns no feedback -

i trying catch error unsuccessful bind statement result in , why deliberately not passing in types mysqli_stmt_bind_param() function. please see code snippet below $email = 'test@test.com'; $password = 'password'; if (!(mysqli_stmt_bind_param($stmt , '' , $email, $password))) { echo "binding parameters failed: (" . mysqli_stmt_errno($stmt) . ") " . mysqli_stmt_error($stmt) . "<br>"; } however, mysqli_stmt_errno returns 0 , mysqli_stmt_error() returns empty string. php gives warning saying warning: mysqli_stmt_bind_param(): invalid type or no types specified in c:\wamp\www\test\database1.php on line 28 why not feedback database? because binding has nothing database.

java - Shifting a type char, similar assignments behave differently -

hi have piece of java code shifts character 2, so char ch = 'a'; ch += 2; system.out.println(ch); the output in case 'c' (as expected). if rewrite code this: char ch = 'a'; ch = ch + 2; system.out.println(ch); i compilation error 'type mismatch: cannot convert int char'. why happening, aren't 2 assingments equal? it's common misconception x += y identical x = x + y . jls §15.26.2 : a compound assignment expression of form e1 op= e2 equivalent e1 = (t) ((e1) op (e2)) , t type of e1 , except e1 evaluated once. notice there implicit cast involved. when have like: ch = ch + 2; // no cast, error the type of right-hand side int while type of left-hand side char , there type mismatch between 2 sides of assignment, hence error. can fixed explicit cast: ch = (char) (ch + 2); // cast, no error

scala - problems with handeling Json request in play -

i'm trying make server can handle http requests json. sorry if haver. i'm still new this. so, made function takes jsvalue , working it. def find(info: jsvalue) = { val req = search.makerequest("person",info) val result = db.withconnection { implicit c => sql(req).as(person *) } json.tojson(result) } then this: val test = json.parse("""{"name":"john"}""") person.find(test) it works fine. try call function http request: routes file: get /findperson controllers.personcontroller.findperson(info: string) controller: def findperson(info: string) = action { ok(person.find(json.parse(info))) } actual request: http://localhost:9000/findperson?info="""{"name":"john"}""" i get: exception: malformed json: got sequence of jsvalue outside array or object. can tell me how right?...

How to retrieve only the nodes from the path in Neo4J Cypher query? -

i have query of following kind: match (u1:user{name:"user_name"}), (s1:statement), s1-[:by]->u1 distinct s1,u1 match (s2:statement), s2-[:by]->u1, p=s1<-[:of]-c-[:of]->s2 s1 <> s2 collect(p) coll, count(p) paths, s1, s2 return s1,s2,paths,coll order paths desc limit 2; right returns list of paths p in coll variable. want list nodes c . how make possible? maybe query not right, in case, i'm trying to 1) find statements made user; 2) find nodes connect 2 statements; 3) return statements, have nodes connecting them, order desc, including names of actual nodes connect them. thank you! i can't test @ moment, try match (u:user {name:"user_name"})<-[:by]-(s1)<-[:of]-(c)-[:of]->(s2)-[:by]->(u) return s1, s2, collect(c) connections order length(connections) desc limit 2

javascript - AngularJS element directive with ng-init runs before view renders -

i attempting loop through array , create multiple instances of custom directive creates different graphs based on variables on rootscope. works fine except when try place in view , call ng-init method on scope , pass arguments. what finding ng-init seems run before (and think ng-init wrong approach), causes errors because variables being set in method aren't set yet when ng-init runs in view. when first load index view, go view, well, when try load view first or reload it, getting errors. ng-init trying call chart() method before else runs. on index view, have chart in modal gets called onclick, ng-init not needed, therefore works great. i little stuck , need advice on "right" or better way accomplish this. on detail view, need loop across array 4 charts based on 4 different objects of data. the data static file now, prototype. my code this: view: <div id="chart_list"> <div class="chart" ng-repeat="val in ['abc...

How to use call/cc for non-local exit in Scheme -

currently, studying scheme language. i'm confused in how use call-with-current-continuation.(call/cc) better understanding it, wrote example code non-local exits. doesn't work properly. does know why? appreciated. in advance [example code] (define (product ls) (call/cc (lambda (return) (cond ((null? ls ) => (begin (display "list end") (newline) 1)) ;; ng ;;(return 1)) ;; ok ((not (number? (car ls))) => (begin (display "not number") (newline) (return 0))) (else => (begin (display (car ls)) (newline) (* (car ls) (product (cdr ls))))))))) [repl output] gosh> (product '(1 2 3)) ; works expected. ==> 1 ==> 2 ==> not number ==> 0 (return) gosh> (product '(1 2 3)) ;; doesn't work expected. expect 6 return value. ==> 1 ==> 2 ==> 3 ==> list end ...

mysql - PHP on submit the variable 'passkey' drops stopping UPDATE to database -

when user selects account activation link taken webpage welcome message, , request them update account details (set own password etc). currently, welcome request works fine, code recognises passkey (which displayed in url code) , print users name. however, problem seems come when user selects 'submit' button update details in form. variable of passkey seems drop, on submission details arent being stored database though php message tells me is. this code: <?php session_start(); include "includes/header.php"; include "includes/connect.php"; ?> <link rel="stylesheet" type="text/css" href="css/login.css"> <div class="jumbotron"> <h1>new users</h1> <p>register details</p> </div> <?php $_session['passkey']=$passkey; $passkey=$_get['passkey']; $sql1="select firstname users confirm_code ='$passkey'"; $res...

javascript - Message passing by chrome.runtime.sendMessage()? -

i refered chrome documentation https://developer.chrome.com/apps/runtime#type-messagesender https://developer.chrome.com/apps/runtime#event-onmessage in sample chrome extension, pass number contentscript.js popup.js : contentscript.js: var fromdom = 100; chrome.runtime.sendmessage({fromdom});//here i'm passing value in fromdom popup.js: chrome.runtime.onmessage.addlistener(function(response){ number = response; //here i'm assigning value in response total document.getelementbyid("output").innerhtml=number;//manipulating element // in popup.html } ); the element "output" isn't getting modified. so, doing right? how should "any message" parameter in general , can use parameter way? updated contenscript.js , background.js: contenscript.js: //code values table in results page var table = document.getelementsbyclassname("collapse")[0]; var marks = new arr...

java - Expandable ListView change childdata on buttonClick -

okay, english not best, give try :) i have 3 buttons, each 1 implements onclicklistener . have expandablelistview , filled data. if 1 button clicked, call method changes child data , show new data changed method. problem data remains same , there no changes. tried call method notifydatasetchanged in onclick method not work. [...] explistview.setadapter(listadapter); dienstag.setonclicklistener(new button.onclicklistener() { @override public void onclick(view v) { arraydienstaginitialsierung(); listadapter.notifydatasetchanged(); } }); } expandablelistadapter listadapter; listadapter = new expandablelistadapter(this, listdataheader, listdatachild); // setting list adapter explistview.setadapter(listadapter); private void arraydienstaginitialsierung() { system.out.println("hallo bin im dienstag drinnen"); //früchstück (int f = 0;f < zwischentabelleliste.size();f++) { ...

c# - Use linq to filter by property of subcollection -

class store { public int id { get; set; } public list<annualdata> annualdata { get; set; } } class annualdata { public int year { get; set; } public dictionary<string, double> data { get; set; } } i need requested stores , requested years' data. can filter stores easily: list<int> storeids = new list<int> {12, 13, 14}; list<store> stores = alldata.stores.where(s => storeids.contains(s.id)).tolist(); but can't figure out how further filter list of years. list<int> years = new list<int> {2012, 2013, 2014}; stores = alldata.stores.where(s => storeids.contains(s.id)).????? tried any/all/contains i'm not understanding linq enough. in advance. update after proposed solutions selmann & timothy using examples still see 3 years store 1 in output - want see 2007 in t case: static void main(string[] args) { list<store> alldata = new list<store> { ...

ios - Saving data to device using Parse array -

my application pulls data parse class called pdftableview , stores name of file , author tableview. programmed when user picks cell taken downloaddetailview can download file push of button. else works don't know how program button save file stored in array onto computer. here code this segue tableview sends "pdffile" download page detailvc.downloadfile=[[pdfarray objectatindex:indexpath.row]objectforkey:@"pdffile"]; this pulls file detail view. property declared in detail view.h @property (retain,nonatomic) pffile * downloadfile; and in implementation have button created , save pdf file on computer. there ton of different ways of doing this. easiest in button targetaction: nsdata *data = [self.downloadfile getdata]; [data writetofile:@"/path/to/save.pdf" atomically:no]; using method happen synchronously though, it'll hold main thread if don't dispatch async, or use pffile's asynchronous methods.

windows - Editing DOT files with Notepad++ -

is possible use notepad++ sort of ide graphviz? gvedit comes graphviz inadequate editing. notepad++ has solved many code-editing problems elegantly, unfortunately there no "compile dot file , show me result" button in notepad++ enable quick compile/edit cycle. i made plugin purpose of quick compile/edit cycle in notepad++: https://github.com/jrebacz/nppgraphviz , scroll down installation section instructions. the plugin takes current tab's document, sends selectable graphviz layout program (like dot.exe), , displays resulting image in preview window. f9 refresh window.

google app engine - goapp deploy: has different path then goapp serve on windows? -

my system: golang 1.2.1 go appengine sdk v1.9.1 windows using command line: goapp serve (works) goapp deploy (does not, telling me can not find imported packages in windows gopath=...?) fixed in go appengine sdk v1.9.3 windows

How to make 'for(){}' code simpler in R? -

thanks comment of matthew lundberg, here attach simplified example of want do. >id = c("a", "b") >citations = c("p,q", "p,q,r,x") >database = data.frame(id, citations) >database id citations 1 p,q 2 b p,q,r,x here want convert 'database' 'datanetwork' below: >datanetwork p q b p b q b r b x according robert krzyzanowski answered question, reduce seems useful. there other useful ways have? i new r, , made code convert csv file network file (from, to) network analysis in pajek, using 'for(){}' below. know there great way make code simpler in r using apply function family, i'm not used it. thus, please me make code simpler? in advance. myfile = file.choose() mydata = read.csv(myfile) dataa = data.frame(mydata$cola, mydata$colb) id = as.vector(dataa[,1]) citationbase = strsplit(gsub(" \\|", "/", dataa[,2]...

vba - Get Manager Email and add to the TO -

how manager email (the person employee reporting "outlook properties>organization") automatically add in code? the code works if hardcode manager email want apply different departments managers different. ' sending copy of email supervisor dim oapp outlook.application dim omail mailitem set oapp = createobject("outlook.application") set omail = oapp.createitem(olmailitem) omail.body = "please review below email sent employee division" _ & vbcrlf & _ "**********************************************************" _ & vbcrlf & _ item.body omail.subject = item.subject & " (email revision)" omail.to = **((manager's email))** omail.send set omail = nothing set oapp = nothing try application.currentuser.addressentry.getexchangeuser().manager. be prepared handle getexchangeuser , manager returning null.

excel - Perform MID or LEFT on ARRAY -

match requires array second parameter. eg. =match(sheet1!a1 ; sheet2!a1:a4 ; 0) is there way match substrings of array values in lookup using left/mid? eg. =match(sheet1!a1 ; left(sheet2!a1:a4;5) ; 0) the above example gives #value! error, understand why not working, want know if there way acheive desired result? matching using substring each value in array? you can array enter formula make work. that, mean need press ctrl + shift + enter after typing in formula instead of hitting enter .

php - Looping through every record from database -

i've searched on internet this, , questions here on using else php. ask own question. what need make button print out (read literally print, in downloading word document details on it) every record database. the id named 'abstract_id'. what i'm going show next print button pages, mean if click on said button print specific page: $abstract_id = addslashes($_post['abstract_id']); //here connect database// $query = "select * abstracts abstract_id = '$abstract_id'"; $result = mysql_query($query); $i = 0; $title = mysql_result($result,$i,"title"); $author[1] = mysql_result($result,$i,"author1"); $organization[1] = mysql_result($result,$i,"organization1"); $author[2] = mysql_result($result,$i,"author2"); $organization[2] = mysql_result($result,$i,"organization2"); $author[3] = mysql_result($result,$i,"author3"); $organization[3] = mysql_r...

How to export n number columns for PDF in Java? -

i have requirement generate pdf file 120 columns(all columns should on single page).i using itext. when generate pdf columns gets overlapped. my questions are: 1)is there way put horizontal scroll bar navigate between columns ? 2)how prevent overlapping of columns? i have seen similar question in site ( how export n number columns headings pdf in java? ) but link mentioned in answer there ( http://itext-general.2136553.n4.nabble.com/what-is-the-maximum-page-size-for-pdf-in-itext-td2150839.html%22 ) is inactive . please suggest me on this. /* following code set page size. so, if have large number of columns (for eg: 120 in case) ,it automatically show horizontal bar in pdf navigate .*/ rectangle pagesize=new rectangle(9400f,9400f); document doc=new document(pagesize); pdfwriter writer=pdfwriter.getinstance(document,baos); writer.setuserunit(9900f); // prevent overlapping of columns , set column widths follows pdfptable=new pdfptable(120); // 120 ...

creating dat file with increasing number of order in visual c++ -

i have particle:: add_particle(int i) { ofstream fp1; fp1.open("output/particle.dat",ios::binary); fp1.write((char*)this,sizeof(*this)); fp1.close(); } fp1.close(); } and loop addition using for(int i=0;i<20;i++) { p.add_particle(i); } however during each loop ,i want file name particle0.dat particle1.dat particle2.dat , on; how can acheive in visual c++; for( int = 0; < 20; ++i ) { std::stringstream str; str << "output/particle" << << ".dat"; fp1.open(str.str().c_str(), ios::binary); ... } you can specify number formatting with: str.width(2); str.fill('0'); ... see: http://www.cplusplus.com/reference/sstream/stringstream/?kw=stringstream

ios - UITextInputMode currentInputMode is deprecated. Suggested replacement? -

in our app, we'd detect current keyboard language. example, if user sets multiple language keyboards under settings->general->keyboard->keyboards, we'd know language they're typing in , notification nsnotificationcenter when changes. - (void)viewdidload { [super viewdidload]; nsnotificationcenter *ncenter = [nsnotificationcenter defaultcenter]; [ncenter addobserver:self selector:@selector(languagechanged:) name:uitextinputcurrentinputmodedidchangenotification object:nil]; [self languagechanged:nil]; } -(void)languagechanged:(nsnotification*)notification { for(uitextinputmode *mode in [uitextinputmode activeinputmodes]) { nslog(@"input mode: %@", mode); nslog(@"input language: %@", mode.primarylanguage); } nslog(@"notification: %@", notification); uitextinputmode *current = [uitextinputmode currentinputmode]; nslog(@"current: %@", current.primarylanguage); } what...

sap - SAPbobsCOM not working -

Image
i developed web application using asp.net c# place online orders. app. works fine on sap server (windows 2008 r2) when copied project local machine (runs windows 7) got error, can't see sapbobscom reference. don't have sap api di on machine tried debug application in x86 solve problem. no luck. error got retrieving com class factory component clsid {632f4591-aa62-4219-8fb6-22bcf5f60090} failed due following error: 80040154 class not registered (exception hresult: 0x80040154 (regdb_e_classnotreg)). thank you i got same problem. because sap business 1 references sapbobscom , sbodi_server missing. added these references , worked. need add sap api di on machine using sapbobscom reference.

Unity Facebook SDK for Android. App keeps asking permissions -

Image
the problem when app requesting permissions popup if click ok nothing happens , popup keeps coming if not user permission. if sign app debug user through these settings work but final build have sign app normal alias. problem be? i found out debug hashkey keeps changing when change between keystores , openssl problem. different key mac win , different key if facebook settings or -keytool command. there way know actual hashkey? you need add hashkeys you're gonna use when signing app facebookapp settings page. can set more 1 , you'll need if you're gonna sign app debug keys , release keys. debug keys may differ machine machine it's better distribute keystore unity3d project , use same 1 everywhere build project. if don't want distribute release keys may want consider setting build machine. to hashes keystore need run: keytool -exportcert -alias keyalias -keystore path_to_keystore | openssl sha1 -binary | openssl base64

flex - How to get the negative position value in Group? -

Image
the dashed rectangle parent group , inside, there label. x negative. now, want relocation outside group contents' top-left point , meanwhile contents' move outside group's (0,0) point. result looks keeps same position before.but in fact, both inside content , outside group moved. it easy realize in flash, however, in flex got trouble. the function "getrect" returns wrong values.it's never return correct position inside content is.(like thumb shows,the position should [-70,50]) (feel free correct me because i'm not sure want accomplish here) if label (let's called mylabel) correctly located directly inside of group, calling mylabel.x return x-coordinate of label compared parent (which group here, should -70). then if want move label fits group viewport, have 2 solutions: either manually set mylabel.x = 0 , mylabel.y = 0. in case label moved @ group origin. either retrieve matrix of label component call .translate(dx, dy) fun...

amazon s3 - How to set Content-Disposition with AWS PHP SDK v2 and CopyObject? -

i'm using aws php sdk v2.x copy objects between s3 buckets using following code: <?php try { self::$aws->copyobject(array( 'bucket' => $target_bucket, 'key' => $target_key, 'copysource' => $source_bucket . '/' . $source_key, 'content-disposition' => 'attachment', //'content-disposition' => 'attachment; filename="' . basename($target_key) . '"' //'contentdisposition' => 'attachment' //'contentdisposition' => 'attachment; filename="' . basename($target_key) . '"' )); } catch (aws\s3\exception\s3exception $e) { echo 'error'; } the file copied s3 bucket without errors, i'm unable set the content-disposition in order force browser download file rather stream it. i've tried few options (commented out above) nothing seem work. ...

testing - junit test case with null object -

i want write person class 3 parameter constructor , if user give null string name , surname person, want return null object because want use junit assertnull function show object not created null string. public person(string names,string surnames,int ages) { if(!names.equals(null) && !surnames.equals(null)) { name = names; surname = surnames; } else { return; } if(ages > 0) age = ages; else return; } and test @test public void createperson() { string ad = null; string soyad = null; int age = 10; person p = new person(ad, soyad, age); assertnull("object not created!", p ); } how can null pointer exception? you nullpointerexception because calling equals method on null object. if want check whether string not null, need use somestring != null . what need is: if (names != null && surnames != null) but not solve problem not possible return...

html - mystery symbol on page -

i have looked @ markup page forever , can't life of me figure out why there "greater than" symbol visible on page in between navigation , main content. keep staring @ because bugs me don't see mistake. appreciated. page: http://cdaniels75.github.io/210/schedule.html on line 57 of source this: <tr><td>33</td> <td>04.28</td>><td>finals week<br /><h6><a notice > between <td> s. that said have large number of markup errors on page, unclosed <a> tags , such. run through validator .

ruby on rails - Capybara save_and_open_page ubuntu -

i running ubunut 13.04, , rubymine 6.0.3 my problem launchy gem isn't opening browser. i debuged capybara save_and_open_page , executed launchy.open(file_name,{debug:true}) the html page saved, browser doesn't launch. this debug result launchy_debug: uri parsing pass 1 : /home/dave/my_i/tmp/capybara/capybara-201401200000077817027890.html -> {:scheme=>nil, :user=>nil, :password=>nil, :host=>nil, :port=>nil, :path=>"/home/dave/my_i/tmp/capybara/capybara-201401200000077817027890.html", :query=>nil, :fragment=>nil} launchy_debug: uri parsing pass 2 : /home/dave/my_i/tmp/capybara/capybara-201401200000077817027890.html -> {:scheme=>nil, :user=>nil, :password=>nil, :host=>nil, :port=>nil, :path=>"/home/dave/my_i/tmp/capybara/capybara-201401200000077817027890.html", :query=>nil, :fragment=>nil} launchy_debug: checking if class launchy::application::browser 1 handles?(/home/dave/my_i/tmp/capybara/...