Posts

Showing posts from April, 2014

Have I to allocate memory before using this system calls? -

i see functions called without allocate memory path , dir , buf , name . char *getcwd(char *path, size_t size); struct dirent *readdir(dir *dir); int stat(const char *file_name, struct stat *buf); dir *opendir(const char *name); why? functions allocate memory? have use free() after using them? thank you! they pseudo-code examples. aren't going show how allocate memory them you, it's assumed know how that. and yes, need free memory allocate, otherwise you'll have memory leak. all examples take pointers, indicate operate on memory have allocated, not allocate you.

python - Convert a path to nodes and edges? -

i have tsv lots of paths in : parts of looks this: 14th_century;china;gunpowder;fire 14th_century;time;isaac_newton;light;color;rainbow 14th_century;15th_century;16th_century;pacific_ocean;atlantic_ocean;accra;africa;atlantic_slave_trade;african_slave_trade i want run trough , somehow convert this: graph = {'a': ['b', 'c'], 'b': ['c', 'd'], 'c': ['d'], 'd': ['c'], 'e': ['f'], 'f': ['c']} note: 'a': edges , others os nodes in path. at sametime want keep track of how many times each node visited?

eclipse - Spring Framework Web page development (Java) -

so have problems , questions: 1. have installed tomcat7 , configured in eclipse works fine when create dynamic web project , dynamic web module 2.4 , doesn't work fine when set 3.0 , when create spring project->simple spring web maven template, getting error: org.apache.tomcat.util.bcel.classfile.classformatexception: invalid byte tag in constant pool: 15 2. can give me direction learn these compatibility versions of tomcat , maven , spring framework 3. find examples of web development using spring, have found some, compatibility issues , configurations setups fried brain... 4. found how download jars spring framework , project source files... for question download spring artefacts have @ github wiki section "manually downloading spring distributions" if whatever reason not using build system dependency management capabilities, can download spring framework distribution zips spring repository @ http://repo.spring.io . a tutorial w

android - Google Map api v2 - setUpMap() causes errors -

what wrong code? doing map/location app. showing map ok trying add setupmap() method/function causes app stop. main_layout.xml: <?xml version="1.0" encoding="utf-8"?> <fragment xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/map" android:layout_width="match_parent" android:layout_height="match_parent" android:name="com.google.android.gms.maps.mapfragment"/> activity: package tri.mylocapp; //import... public class mainactivity extends activity implements locationlistener{ googlemap googlemap = null; latlng latlng; locationmanager lm; string provider; location location; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); if (isgoogleplay()){ setcontentview(r.layout.activity_main); setupmap(); } } private boolean is

java - MongoDB find query -

i use mongodb collect comments inside collection comments i use java programme create them ... basicdbobject comment=new basicdbobject(); basicdbobject auteur=new basicdbobject(); auteur.put("id", id); auteur.put("login", login); auteur.put("contact",false); comment.put("auteur",auteur); comment.put("texte",texte); ... when try find comment using field texte works: db.comments.find({"texte":"my name user1"}) { "_id" : objectid("5341395ae4b082f5895d5967"), "auteur" : { "id" : 1, "login" : "user1", "contact" : false }, "texte" : "my name user1" } however aim find them using the field id of auteur. tried db.comments.find({"auteur":{"id":1}}) but returns nothing... i'm lost. thanks!! you use dot notation access id of sub document auteur : db.comments.find({"

php - Concat a variable to a function name -

how can concatenate variable containing string function name? tried methods, none worked me. $mode = 'remove'; friend.$mode.($mode); function friendremove() { } you can use call_user_func http://lv1.php.net/call_user_func this: $mode = 'remove'; call_user_func('friend'.$mode, $p1, $p2, ...); function friendremove($p1, $p2, ...) {} also there call_user_func_array function useful http://lv1.php.net/call_user_func_array

javascript - Change dateformat output -

i facing annoying problem in code. i wanna have output date this: 06/04/2014 document.getelementbyid("nights").value = diff + " nights"; { $('#arrival').datepicker().val(); $('#departure').datepicker().val(); var start = new date(document.getelementbyid('arrival').value), end = new date(document.getelementbyid('departure').value), currentdate = new date(start), between = []; while (end > currentdate) { between.push(new date(currentdate)); currentdate.setdate(currentdate.getdate() + 1); } $('#lista').html(between.join('<br> ')); }; where can change output format? in while loop, try: while (end > currentdate) { var month = currentdate.getmonth() + 1; var day = currentdate.getdate(); var year = currentdate.getutcfullyear(); between.push(month + '-' + day + '-' + year); currentdate.s

ios7 - UIRectEdgeNone makes NavigationBar and Tabbar darker -

i have ios 7 app has navigationcontroller inside tabbarcontroller. customize bars background color [[uinavigationbar appearance] setbartintcolor:[uicolor bluecolor]]; [[uitabbar appearance] setbartintcolor:[uicolor bluecolor]]; it runs fine. if there's viewcontroller wants not covered bars, this self.edgesforextendedlayout = uirectedgetop; which means viewcontroller not want covered tabbar. makes tabbar darker normal i think because use custom color bars. how fix ? it means there's nothing show below translucent tab bar. set tab bar translucent property no

javascript - recording voice / video from client side in asp.net -

hi guys i'm creating local website , second question project , searched lot in google matter , find many ways no ways !!! let me tell what's story about, title said want record sound / video client side , save server side in asp.net 4 , realize can jquery , html5 , , javascript libraries , not find project works. know need piece of code write many pages tutorial's , no code !!!!! body can me??

c# - Create and Name a table by a variable while running -

i'm high-school student knowledge in programming pretty low :/... so question: i'm working on registration page website , want create new table in database every person registers system when click registration button creates table named email inserted during registration process. i've looked more 5 hours find solution still couldn't find how name new table variable (email person inserted) while program running. can please me :/ i'm clueless (fyi - i'm working linq sql) thank much!~ :d

asynchronous - Android AsyncTask still hanging UI -

i'm using asynctask grab data web, still seems hanging ui while fetching data. my code: https://gist.github.com/masterejay/10005933 the threadparse class inside main class, , initwebview method inside of main class, not threadparse. you should launch asynctask using execute method. with code call method in main thread. execute create new thread asynctask. public void initwebview(string link) { threadparse parse = new threadparse(); parse.execute(link); } if really need ui in doinbackground should use runonuithread i taked code block example catch (indexoutofboundsexception ex){ currentpage = 1; totalpages = 1; toast.maketext(thread.this, "you on " + currentpage + " of " + totalpages, toast.length_long).show(); webview.loaddatawithbaseurl("http://netdna.bootstrapcdn.com/bootstrap/2.3.2/css/bootstrap.min.css", e.html(), "text/html", "utf-8", null); return; } here, let work s

BiDi text not displayed properly in Delphi 7 when using RTL BiDi mode? -

in delphi 7, drop tmemo on form , in form's oncreate handler enable rtl bidimode this: syslocale.middleeast := true; application.bidimode := bdrighttoleft; if load text file containing bidi text tmemo using lines.loadfromfile , text not displayed correctly. let's have following text in text file (this proper way display it, example when displayed notepad++ or ms word): !ד asd אב!ג text... text2... here's how it's incorrectly displayed in tmemo : אב!ג asd ד! ...text... text2 here's how text stored in text file: 21 e3 20 61 73 64 20 e0 e1 21 e2 0d 0a 74 65 78 74 2e 2e 2e 20 74 65 78 74 32 2e 2e 2e here's visualization of how it's stored (the text never rendered way anywhere, illustration): !ד asd ג!בא text... text2... so, bidi text saved in alternating "blocks": (rtl block)(ltr block)(rtl block)(ltr block) etc. storing order of blocks left right same order of blocks way see them (from left right) when rendered. sto

python - Django count number of times each ForeignKeyField value appears in table & retain __unicode__() -

django 1.3, python 2.7 i have following models (some irrelevant fields omitted): class encounter(models.model): uuid = models.slugfield(max_length=36, unique=true, default=make_uuid, editable=false) created = models.datetimefield(auto_now_add=true) subject = models.foreignkey('subject', to_field='uuid') class subject(models.model): given_name = models.charfield(max_length=64) family_name = models.charfield(max_length=64) system_id = models.charfield(max_length=32, blank=true) uuid = models.slugfield(max_length=36, unique=true, default=make_uuid, editable=false) def __unicode__(self): return u'%s, %s - %s' % (self.family_name, self.given_name, self.system_id) i know subjects appear in encounters table , how many times appear. following code want 1 exception: s_in_e = encounter.objects.values('subject').annotate(mycount=count('subject')) when attempt display results of annotation follows: {% thing in s_in_e %}

python - [solved]how to apply strptime(string,format) on StringProperty? -

[solved] mixed class method , instance method before. when tried call strptime(cls.ts,format) inside @classmethod function , calling ts = ndb.stringproperty() or stringproperty('ts'),but not string value inside ts. the correct 1 remove @ decorator , call strptime(self.ts,format) . original question below 1:when token instance created , init_created() called inititalize ts string. 2:user request verification handler , token arg , token used retrieve token instance. 3:i use token instance call is_valid() .in is_valid , convert ts datetime obj, compare other datetime obj. error 1 : when set( str() method ) delta = (now-datetime.strptime(str(cls.ts),'%y-%b-%d / %h:%m:%s:%f')).total_seconds() i get valueerror: time data "stringproperty('ts')" not match format '%y-%b-%d / %h:%m:%s:%f' error 2 : try way. set (without str() ) delta = (now-datetime.strptime(cls.ts,'%y-%b-%d / %h:%m:%s:%f')).total_seconds()

matrix - String split in matlab -

i have cell value word = '00000' . want take 4th , 5th value. tried kata=word(4:5) , i tried kata=word{4} still cannot. i got error message : index exceeds matrix dimensions. how split it? it's in <cell> type. first need index content of "first" (and only) cell element curly brackets {} , can index vector () . therefore need: word = {'12345'} output = word{1}(4:5) which gives: output = 45

Batch | Net use Password -

sorry bad english, if can great. have couple of file system on network , every night need take 1 file file system mine. happen i'm using batch script how mapping me drive net use command. problem don't want password go through clear text ( see password or sniff it). questions : there way can encrypt password , still login same credentials. thank you if can set domain controller using either 1 of windows machines, or samba , use trusted authentication based on user executing scheduled job executes batch file. alternately, encrypt password , have program decrypt , execute net use, you're always* going faced fact if computer can send password out when don't type in, computer knows password, , physical access computer can password. *unless computer doesn't know password, , instead relies on hsm (hardware security module) .

java - Server using a table that I didn't even mention in my code -

im using netbeans 8.0 . i've created table "full" in database "face" . earlier , created table "student" in database "rishi" . , after deleting table database "rishi" & after changing database "full" , following error :- java.sql.sqlexception: base table or view not found message server: "table 'face.student' doesn't exist". here's html code :- <html> <head> <title>todo supply title</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> </head> <body> <center> <h1>login !</h1> <hr> <form action = "check" method = "post"> <pre> enter email : <input type = "text" name = "email"> enter passwor

Applescript for Outlook 2011 that moves all messages from a specific folder that match a source account to a different folder -

as title states "help applescript outlook 2011 moves messages specific folder match source account different folder." so, have "rule" moves new mail on exchange account "inbox" in subfolder on computer. when delete items form subfolder inbox goes "deleted items" on computer. have made sub-folder "deleted items" in same place "inbox" sub-folder , run applescript on schedule can go main deleted items on computer , find messages exchange account , move them "subfolder/deleted items". googling cobbled below move mail in deleted items: tell application "microsoft outlook" set topfolder mail folder "at&t" of on computer set destfolder folder "deleted items" of topfolder move every message of mail folder "deleted items" of on computer destfolder end tell the part can't past selectively moving mail "account" specific value, thus: tell application "m

javascript - Backbone view fails to render Kendo UI in IE8 -

i debugging project created backbone, marionette , kendo ui. until have check in ie8. initial page renders region's view changes new kendo element doesn't render page. each new view created dynamically backbone , template. data static charts , graph. does have idea maybe causing new view not render kendo properly. here link test version of project. click button proceed part referring. http://cabanapps.com.br/apps/vale-dashboard2014/ i found kendo generating charts not render on ie8. using redraw() method kendo's charts graphics display properly. simple made delayed call redraw method correct problem.

javascript - Grunt recompile since last run -

i have grunt watch setup when i`m developing files automatically compiled, after pull need "touch" files in order trigger recompile new files in case watch not running while pulled, there generic way make grunt track last edit files without having "touch" new files or should have grunt watch running before pull (which while writing seems adequate solution)? just have watch run while make pull, or run tasks manually--the kind of detailed tracking you're suggesting seems overkill me. keep simple!

c++ - assignment operator doesnt work -

i have constructor represent big numbers , store them vector: class composed of vector, boolean , int , supposed represent big numbers. cbigint(const char* str2) { string str=string(str2); num.resize(200000); if (str[0]=='-') { signe=true; pos=str.length()-1; (int i=pos;i>0;i--) { num[pos-i]=str[i]-48; } } else { signe=false; pos=str.length(); (int i=pos;i>=0;i--) { num[pos-i-1]=str[i]-48; } } } and error: http://pastebin.com/cy82xalf declare , implement additional constructor on top of 1 have: cbigint::cbigint(const char* str):cbigint(string(str)){}

networking - Why port 80 is used for server applications? -

i want develop enterprise application wherein each employee has client application , there common server has server application. client , server exchanging information in form of text, image files, zip files, etc. research think tcp best protocol. not understand how assign port numbers. here understanding far. client can have random port selected automatically os. need query os getting port number client? server port number has hard coded in server , client application. server port number should 80. why? possible have other port number server application? if yes how select it? what happens if port number used server being used other application on server? edit: following of articles/questions gave me impression port 80 default port server. how multiple clients connect simultaneously 1 port, 80, on server? freeing tcp/ip port? http://computer.howstuffworks.com/web-server8.htm http://www.thomas-krenn.com/en/wiki/check_tcp_port_80_%28http%29_with_telnet cl

Filling 3d array using for loop in C programming -

i'm working on class project , i'm stuck @ basic one. have fill stack of boxes using loops , 3d array. stack 4 width, 4 length , 3 height , have fill boxes 100 items each. void main(){ int boxshleve[3][4][4]; int i, j, k; (i=0; i<3; ++i){ (j=0; j<4; ++j){ (k=0; k<4; ++k){ boxshleve[3][4][4] = 100; } } } printf("%d", boxshleve[3][4][4]); } this broken piece of work... how make each array has 100 element in it? this meant do: int main() { int boxshleve[3][4][4]; int i, j, k; (i = 0; < 3; ++i) (j = 0; j < 4; ++j) (k = 0; k < 4; ++k) boxshleve[i][j][k] = 100; (i = 0; < 3; i++) (j = 0; j < 4; j++) (k = 0; k < 4; k++) printf("%d ", boxshleve[i][j][k]); return 0; } the reason need nested loops use i , j , k indexes access array. have use them. sa

javascript - Functions results in angularjs view -

i'm afraid question pretty stupid.... using {{current.name}} syntax can show name of $scope.current in view. set current when switch list view ( /mythings ) editing item ( /mythings?id=someid ). actually redundant have information both in $location , in $scope.current . redundancy makes more complicated understand, i'd rid of it. i replaced current current item returning function , hoped work (like in many other cases). doesn't, need write {{current().name}} everywhere, tend forget. maybe i'm doing wrong? i'm beginner here. is there way make work? somehow bless current gets evaluated before use? both alternatives discussed have pros , cons: using property ( current ) easier (and more natural) reference in view, needs manually kept in sync location. using function ( current() ) takes care of keeping in sync issue, less intuitive. all things considered, value auto-syncing feature higher , go second alternative ( current() functio

c++ - Quickly sort 3 values -

i have array of 3 floating-point values , want sort them in ascending order (although order of perhaps sorting algorithm can reversed). calling std::sort seems overkill: float values[3] = {...}; std::sort(values, values + 3); you like: float sorted[3] = {min(values), values[0] + values[1] + values[2] - min(values) - max(values), max(values)}; but seems plain ugly. adding , subtracting of numbers may change value of middle sorted element. , not work in-place. interesting: float sorted[3]; /*for(int = 0; < 3; ++ i) { // unroll sorted[(values[i] > values[0]) + (values[i] > values[1]) + (values[i] > values[2])] = values[i]; }*/ // broken, not work if 2 or values equal sorted[(values[0] > values[1]) + (values[0] > values[2])] = values[0]; sorted[(values[1] >= values[0]) + (values[1] > values[2])] = values[1]; sorted[(values[2] >= values[0]) + (values[2] >= values[1])] = values[2]; but kind of depends on how comparison result can

php - headers already - Puzzling version - . Works locally, not live -

this question has answer here: reference - error mean in php? 29 answers i aware there should no whitespace before php code. code gives me following error on live server, not on test apache server: warning: cannot modify header information - headers sent (output started @ /home/mydomain/public_html/parts/includes/dbinfo.inc.php:5) in /home/mydomain/public_html/parts/update_part.php on line 55 i have tried removing functions.inc.php still getting same problem. below 2 pieces of code involved: a) dbinfo.inc.php <?php $username="myusername"; $password="mypassword"; $database="mydatabase"; ?> b) update_part.php <?php include("./includes/dbinfo.inc.php"); include("./includes/functions.inc.php"); mysql_connect("localhost","$username","$password") or die("e

excel - Linear system solving ( N*N matrix multiplication ), VBA -

Image
i have 2 arrays. array1 n * n , array2 1 * n . these arrays given in worksheets. in case sheet3 , sheet4 , need output answer on sheet5. i multiple errors "subscript out of range". i can't seem figure out why isn't working: public sub linearsystemsolver() x = sheet3.usedrange.rows.count y = sheet3.usedrange.columns.count z = sheet4.usedrange.rows.count dim variant redim a(1 x, 1 y) dim b variant redim b(1 z, 1 1) dim g variant redim g(1 z, 1 1) = 1 x j = 1 y a(i, j) = sheet3.cells(i, j) next next f = 1 z b(f,1) = sheet4.cells(f,1) next g = application.worksheetfunction.mmult((application.worksheetfunction.minverse(a)), b) h = 1 z sheet5.cells(h, 1) = g(h, 1) next end sub you can speed code assigning arrays directly , avoid loops a = sheet3.range("a1").resize(x,y).value b = sheet4.range("a1").resize(z,1).value ... sheet5.range("a1").resize(z,1).value = g now far inverting matrix (if x

python - How to fix Typelib generated by MIDL? -

i trying generate typelib of inetcfg interface using idl in page , seen below: import "netcfgx.idl"; [ uuid(d99085ff-c5d7-4a4c-a987-91a513e268a9), version(1.0), helpstring("netcfgx 1.0 type library") ] library netcfglib { interface ienumnetcfgbindinginterface; interface ienumnetcfgbindingpath; interface ienumnetcfgcomponent; interface inetcfg; interface inetcfgproperties; interface inetcfglock; interface inetcfgbindinginterface; interface inetcfgbindingpath; interface inetcfgcomponentbindings; interface inetcfgbindingpath; interface inetcfgclass; interface inetcfgcomponent; interface inetcfgidentification; interface inetcfgclasssetup; }; unfortunately, generated idl still can't loaded comtype, code given below: import comtypes.client cc cc.getmodule("c:\path\to\netcfg.tlb") it gives error w

How to create multiple users for a single GIT repository with different access permissions? -

how create multiple users single git repository different credentials? i.e. want provide read-only access set of users , read-write access set of users. also, need give unique username each user in both levels. helpful if correct steps perform operation. thanks in advance.!!! one way install gitolite , allows declare , manage set of users with, instance ssh keys authentication. see " how programs gitolite work? " more. but cal plug gitolite https, , use https authentication instead (with ldap example ). gitolite perl script deals authorization, not authentication .

MySQL query with matching and sum - League Table -

Image
i have 5 tables: players (id, name, team_id) teams (id, name) results (id, game_id, player.id, position) games (id, location) score (position, score) as follows i want make league table this i confused how sum scores each player. code far: select players.name, teams.name, results.position players inner join teams on players.team_id = teams.id join results on player.id = results.player_id join scores on results.position = scores.scores any idea? to list players (whether appear on results table or not) have use left join . select p.name player_name,t.name team_name,sum(coalesce(s.score,0)) total_score players p inner join teams t on t.id = p.team_id left join results r on p.id = r.player_id left join scores s on s.position = r.position group p.id order total_score desc

How to write C++ version of Python powerset function -

i want write maximal clique algorithm use adjacency matrix. i'm following video explains how code , implement algorithm using python. i'm trying code powerset function @ 2 minutes video. def powerset(elts): if len(elts) == 0: return [[]] else: smaller = powerset(elts[1:]) elt = [elts[0]] withelt = [] s in smaller: withelt.append(s + elt) allofthem = smaller + withelt return allofthem print powerset([1, 2, 3, 4, 5]) i want rewrite in c++. i'm not sure if should using arrays or not. far have coded below don't know how return empty array inside empty array (when elts list of size 0). i wrote isempty function array since cant use len(elts) in python. approach not best approach take open advice. update: array powerset(int elts[]) { if (isempty(elts)==1) { return {{}}; } } in int main have: list<int> elts; list<int>::iterator i; (i=elts.begin

graph - shortest path with dynamic edge cost (algorithm) -

Image
i'm looking algorithm can find shortest path between 2 nodes in undirected graph cost dynamic. dynamic, mean cost on edge dependent on next (future) step. example, in graph that: i'm looking shortest path "a" "e" cost of "a" "b" depends on next step. if go c 7 , if go d 9. my question is: there algorithm solves problem? reduce problem 'regular' shortest path problem create dummy vertices b1,b2 (instead of b ), , edges: (a,b1,7), (b1,c,6), (a,b2,9), (b2,d,5) the rest of edges , vertices remain were. now, run regular shortest path algorithm ( dijkstra / bellman ford ) source target. (repeat process 'conditional' weight edges).

javascript - AngularJS Abstraction -

i noticed while using angular, html became full of inline-js looking code. for example: <table> <tr> <td ng-click="move('nw')" id="nw" ng-bind-template="{{northwest}}"></td> <td ng-click="move('n')" id="n" ng-bind-template="{{north}}"></td> <td ng-click="move('ne')" id="ne" ng-bind-template="{{northeast}}"></td> </tr> <tr> <td ng-click="move('w')" id="w" ng-bind-template="{{west}}"></td> <td ng-click="move('center')" id="center" ng-bind-template="{{center}}"></td> <td ng-click="move('e')" id="e" ng-bind-template="{{east}}"></td> </tr> <tr> <td ng-click="move('sw

Why PHP GD library fails to write images on my disk? -

i wrote piece of php (test.php) code this $width = 300; $height = 200; $im = imagecreatetruecolor($width,$height); $mypic = imagecolorallocate($im,100,30,125); imagefill($im,0,0,$mypic); imagepng($im,'./mypic.png'); imagepng($im); imagedestroy($im); when run on ubuntu command line (php test.php), works fine , writes mypic.png on disk. however, when access test.php on remote client (chrome), shows picture correctly, program fails write images on disk. try running chown -r www-data:www-data /var/www assuming /var/www/ site directory. or make file writing have write permissions.

c# - My text file will not read into the array -

this has been answered. relatively new c# , experiencing problem. program keeps throwing error per try catch. have looked on , changed things, nothing seems work. error being thrown on line 49 (where while loop reading text file takes place). have idea issue?? know there may other issues min/max/average, can figure out. need me fix reading of file array. the error code is: input string not in correct format. @ system.number.stringtonumber using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.text; using system.windows.forms; using system.io; namespace total_sales_bbrantley { public partial class form1 : form { public form1() { initializecomponent(); } private void btncalc_click(object sender, eventargs e) { try { // declare variable hold amount of sales // declare constant array size

java - Accessing JTextField in a different class and adding it to a String -

i'm making program java , have problem want write file in 1 class. in class want overwrite file, if name of file exsists. first class uses jtextfield in can enter number. number added filename. works perfect, in second class won't. used association, gave me nullpointer exception. can help? public void actionperformed(actionevent e) { //make file string filename = "week " + tf1.gettext(); file planning = new file(filename + ".txt"); // save file if (e.getsource() == b2) { // file does't exists yet , field filled out if (!planning.exists() && allesgevuld()) { filewriter fw; try { fw = new filewriter(planning, false); bufferedwriter bw = new bufferedwriter(fw); bw.write(tostring()); bw.close(); fw.close(); joptionpane.showmessagedialog(nu

r - Concatenating Two Vectors to a New Vector -

i trying combine 2 vectors create new vector. tried (well, similar this). y <- c(10,10,11,11) m <- c(1,2,1,2) <- data.frame(m,y) paste(my[1], my[2], sep = "") i this: # [1] "c(1, 2, 1, 2)c(10, 10, 11, 11)"` i same thing when use collapse instead of sep . i trying get: # ["1 10","2 10","1 11","2 11"] try of following instead: paste(my[[1]], my[[2]]) # [1] "1 10" "2 10" "1 11" "2 11" paste(my[, 1], my[, 2]) # [1] "1 10" "2 10" "1 11" "2 11" paste(my$m, my$y) # [1] "1 10" "2 10" "1 11" "2 11" do.call(paste, my) # [1] "1 10" "2 10" "1 11" "2 11" the problem weren't selecting values in column, rather, single-column data.frame . of course, use original vectors: > paste(m, y) [1] "1 10" "2 10" "1 11&

javascript - save form data for next visit -

i have page form in web (using jsp). question is: there option go page , return 1 without losing form data. javascrip command- history.back(); is not because before return form pass in several pages (move one). there way save data or need create semi program javascript/jsp/java it? this need. if want try on own @duke's solution works well.

Does an HTML select lose document flow when placed inside a CSS drop menu? -

okay, question create confusion, it's way can think ask it. here's gist of what's occurring. have menu: edit: here's requested fiddle (note: have view in ie8 in order replicate issue) fiddle <ul> <li class="dropdown"> <a href="#">sort</a> <ul class="dropdown-menu"> <li>link 1</li> <li>link 2</li> </ul> </li> <li class="dropdown"> <a href="#">filter</a> <ul class="dropdown-menu"> <li> <div class="usedproducts-filter-container"> <select> <option>option 1</option> <option>option 2</option> </select> </div> </li> </ul> </li> i'm using css style , create drop down functionality:

automation - Matlab, Automatic Function Start -

i have function 3 inputs. change inputs , record outcomes. so, if have inputs in excel, can automize things? have? function of matlab, (lets say) 1000 different input function want? want function work every input , record excel outputs without user intervention. do have idea how can that? regards, you can using xlsread , xlswrite . write script to: load inputs excel file using xlsread loop through inputs, calling function each set of inputs , storing result in array write results output file using xlswrite

c# - how to encrypt a file While downloading -

i having problem encrypt file while downloading.i using code download database excel file gridview gv = new gridview(); gv.datasource = graphids.tolist(); gv.databind(); response.clearcontent(); response.buffer = true; response.addheader("content-disposition", "attachment; filename=graphtable.xls"); response.contenttype = "application/ms-excel"; response.charset = ""; stringwriter sw = new stringwriter(); htmltextwriter htw = new htmltextwriter(sw); response.output.write(sw.tostring()); response.flush(); response.end(); now after code file automatically downloaded download folder of pc , want encrypt xls file before downloading? use system.security filestream fsinput = new filestream(sinputfilename, filemode.open,

select - How to add a default option with value -1 and have that selected Angularjs -

using select ng-options leads selected option value '?' <select ng-model="somethinghere" ng-options="option.value option.name option in options" class="ng-pristine ng-valid"> <option value="?" selected="selected"></option> <option value="0">something cool</option> <option value="1">something else</option> </select> i need have <option value="-1" selected="selected"></option> <option value="0">something cool</option> <option value="1">something else</option> how can this? how can add default option value -1 , set selected. using <select ng-model="somethinghere" ng-options="option.value option.name option in options" class="ng-pristine ng-valid"> <option

Is this type of while loop acceptable in Java? -

i have seen form used in snippets , wondering if correct implementation of while loop in java: while ((bytesread = bin.read(contentbytes)) != -1) { response = new string(contentbytes, 0, bytesread); responsebuffer.append(response); } it reads byte contentbyte , stores in bytesread, if byte read not end of file (-1 indicates end of file) executes statements in loop body. hope helps

Error 500 Failed to upload file using Delphi Indy -

i'm trying upload file oboom.com logged in when try post file error http/1.1500 internal server error. with respose text [500,"illegal post header","content-transfer-encoding"] procedure tform1.button1click(sender: tobject); var s: tstringlist; html: string; clhttprequest1: tclhttprequest; ssliohandlersocketopenssl: tidssliohandlersocketopenssl; params: tidmultipartformdatastream; http, http2: tidhttp; begin params := tidmultipartformdatastream.create; s := tstringlist.create; http2 := tidhttp.create(nil); try cookie := tidcookiemanager.create(nil); ssliohandlersocketopenssl := tidssliohandlersocketopenssl.create(nil); http2.iohandler := ssliohandlersocketopenssl; http2.handleredirects := false; http2.connecttimeout := 10000; http2.readtimeout := 10000; http2.cookiemanager := cookie; http2.allowcookies := true; http2.request.useragent := 'mozilla/5.0 (windows nt 6.1; wow64) applewe

trigonometry - Solve trigonometrics equations in Matlab -

i'm trying solve t trigonometric equations in matlab, i.e. 7*cos(t) + 5*sin(t) = 0 . solve as: sin(t)/cos(t) = -7/5 , find arctan(-7/5) = -0.9505 . i have tried on matlab using solve function: syms t theta = solve(7*cos(t) + 5*sin(t)==0, t); disp(theta); but -(log(- 12/37 - (35*i)/37)*i)/2 instead of -0.9505 . explain me why answer solve , how -0.9505 ? the expression exact result, expressed symbolically (due use of syms). to make matlab display result in format looking use double(theta) which should give you: double(theta) ans = -0.9505