Posts

Showing posts from 2015

Socket.connect doesn't throw exception in Android -

if put nonsense url no exception thrown , none of rest of code executed not rest of asynctask called method connects. try { socketcliente.connect(new inetsocketaddress("f", port), 2000); } catch (unknownhostexception e) { geterror("host doesn't exist"); return -1; } catch (ioexception e) { geterror("could not connect: host down"); return -1; } add catch statement. catch ( exception e ) { log.d(tag, e.getmessage(),e); toast.maketext(getapplicationcontext(), "unexpected error:" + e.getmessage(), toast.length_long).show(); } this write log , pop toast tell what's going on.

Ruby can not find the module (LoadError) under Windows -

i tried connect database using ruby (under windows). that: install ruby in c:\ruby193 install devkit (c:\ruby193\devkit). run "ruby dk.rb init", "ruby dk.rb install" downloaded rubygems (1.8.25). executed ruby setup.rb and: gem install rubyfb (adapter ruby firebird) after wrote short rb-script: require 'rubygems' require 'rubyfb' include rubyfb db = database.new('test.gdb') and got error: c:/ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': 126: can't find module - c:/ruby193/lib/ruby/gems/1.9.1/gems/rubyfb-0.6.7/lib/rubyfb_lib.so (loaderror) this file exists, ruby can not find it. attempts rectify situation failed. i installed adapter, situation repeated - ruby can not find file. please advise. i having same problem. had copying c:\program files\firebird\firebird_2_5\bin\fbclient.dll c:\ruby\bin .

android - Cant execute delete query properly using rawQuery -

i want deleting rows of table info comparing table type , code goes below. not getting error or exception still unable delete data. please suggest me string query = "delete info _id in " + "( select a._id " + " info a, type b," + " a.t_id = b._id , b.type_name = 'petrol' )"; try{ database.rawquery(query,null); }catch (exception e){ e.printstacktrace(); } the method sqlitedatabase.rawquery() meant querying --> select statement. to modify data raw sql, need use sqlitedatabase.execsql() .

mysql - How to join multiple occurrences of record against master record with filter -

i have table shows big library of products. i have several filters can applied table via kendo grid, problem having concerns mysql. i have date range filter, needs filter list of products when sold. the issue having because product have sold more once, causes product lines duplicate, because example 4 "datesold" rows 1 product. know why is, can't figure out how syntax filter: select ... parts_library left join parts_sale_dates psd on psd.partlibid = parts_library.id when applying date filter this: select ... parts_library left join parts_sale_dates psd on psd.partlibid = parts_library.id psd.datesold >= ? another issue doing: select ... parts_library left join parts_sale_dates psd on psd.partlibid = parts_library.id makes query take donkeys because there 500,000 products. i think looking "between": select ... parts_library pl left join parts_sale_dates psd on psd.partlibid = pl.id psd.datesold between <date1> ,

reporting services - Compare SSRS report values with C# variables -

i have compare data contained in rendered ssrs report (chart , tablix values example) variables stored in c# application. how can done? so far know generating report in xml , parsing xml desired data. there easier way achieve without user interaction? alternatively, there way drop report chart/tablix data array or list in c#? you have 1 special requirement there... might if tell why want this, because there may other solutions actual problem . having said that, if want "compare data contained in rendered ssrs reports" "variables stored in c#", have best approach already. given approach, seem suppose there's user interaction needed generate xml, it's not: there's the ssrs web service can run reports without users intervening. the render method allows specify format: format type: system.string format in render report. argument maps rendering extension. supported extensions include xml, null, csv, image, pdf, html4.0, html3.2,

Azure storage emulator cannot connect to LocalDB -

i have problem azure storage emulator, refuses connect localdb. used work fine before created odbc connection using named pipe. happened: i needed access data in database mathematica, generated odbc connection. odbc not connect (localdb)\v11.0, used named pipe instead. since then, azure has stopped work. upgraded sdk2.0, did not help. tried run dsinit.exe, get: found sql instance (localdb)\v11.0. creating database developmentstoragedb20 on sql instance '(localdb)\v11.0'. cannot create database 'developmentstoragedb20' : network-related or instance-specific error occurred while establishing connection sql server. server not found or not accessible. verify instance name correct , sql server configured allow remote connections. (provider: sql network interfaces, error: 26 - error locating server/instance specified). 1 or more initialization actions have failed. resolve these errors before attempting run storage emulator again. please refer http://go.microsoft

jquery - How to manipulate DOM after new elements have been inserted? -

i working on woocommerce/wordpress site @ moment , on checkout page, when submit form, submits through ajax , if there errors (required fields not filled in etc), page inserts html , lists fields need filled in. i have jquery places newly inserted html in page new place on page doesn't work. woocommerce code inserted on submit (if errors): <ul class="woocommerce-error"> <li><strong>first name</strong> required field.</li> </ul> my code: var wc_errors = jquery('ul.woocommerce-error'); jquery('.errors_placeholder').append(wc_errors); it might useful note javascrript file loaded before woocommerce javascript file. thanks guys try following: $(document).ready(function() { var wc_errors = $('ul.woocommerce-error'); $('.errors_placeholder').appendto(wc_errors); }); you need in $(document).ready function tell jquery dom ready. check out example

How To: Convert from OpenGL to GLES -

i have following code... void draw_polygon(struct vector2d* center, int num_points, struct vector2d* points, int mode) { int i; if(mode == gl_triangle_fan) glvertex2f(center->x, center->y); for(i = 0; < num_points; i++) glvertex2f(points[i].x, points[i].y); glvertex2f(points[0].x, points[0].y); } and trying convert opengles 1.1 compat. other posts thought looked need similar this... void draw_polygon(struct vector2d* center, int num_points, struct vector2d* points, int mode) { int i; int offset=0; gl_float *arr; if(mode == gl_triangle_fan)i{ *arr = (gl_float *)malloc(sizeof(gl_float) * ((num_points+1)*2)); arr[0]=center->x; arr[1]=center->y; offset = 2; } else{ *arr = (int *)malloc(sizeof(gl_float) * (num_points*2)) ; } for(i = 0; < num_points; i++){ int g = i+offset; arr[g]=points[i].x; arr[g+1]=points[i].y; i++; } } but of course doesn't

jsp - (Spring controller) The requirement sent by the client was syntactically incorrect -

i have following jsp: <form:form method="post" commandname="fare"> <div><fmt:message key="createfares.name" /></div> <div><form:input path="name" type="text"></form:input> </div> <div><fmt:message key="createfares.amount" /></div> <div><form:input path="amount" type="number" min="0" step="0.01"></form:input></div> <div><fmt:message key="createfares.startdate" /></div> <div><input name="startdate" type="date"/> </div> <div><fmt:message key="createfares.enddate" /></div> <div><input name="enddate" type="date"/> </div> <div><fmt:message key="createfares.description" /></div> <form:textarea path=&q

styles - what is the difference between the following to coding in VHDL to update registers? -

could ask difference between following 2 coding styles? first 1 read xilinx sample code. second, read book teaching vhdl. 1. signal: register std_logic; signal: output std_logic; process (clk) begin if rising_edge(clk) register <= outside_signal ; end if; end process; output <= register; 2. signal: register_reg std_logic; signal: register_next std_logic; signal: output std_logic; process (clk) begin if rising_edge(clk) register_reg <= register_next; end if; end process; register_next<=outside_signal; output <= register_reg; thank much. the obvious difference intermediate signal register_next declared , driven outside_signal signal, instead of using outside_signal directly in process. the simple answer there no functional difference. (complex answer register_next<=outside_signal delays signal delta delay (not actual time delay), delta delay typically not visible don't worr

php - Symfony2 Doctrine get random product from a category -

i have following database scheme: table 'products' id category_id and of course category table, id. the data that: products -------------------- | id | category_id | -------------------- | 0 | 1 | | 1 | 1 | | 2 | 1 | | 3 | 2 | | 4 | 2 | | 5 | 1 | -------------------- i select category(for example category 1), select rows category in product-repository class: return $this ->createquerybuilder('u') ->andwhere('u.category = :category') ->setmaxresults(1) ->setparameter('category', $category->getid()) ->getquery() ->getsingleresult() ; how can select random product? also: possible solve via relationships? i have onetomany relationship between entities "category" , "product", products via category->getproducts()... any useful, thanks you first have count total number of products, generate random o

livecode - How do I create a substack with code? -

how create named substack background livecode? the livecode dictionary has entry create stack with examples create stack "test" or create stack field 3 background "standard navigation" there no single command create substack. instead need create mainstack, , change it's mainstack property other stack make substack of one. example: create stack "my new stack" set mainstack of "my new stack" "some existing stack" see mainstack property, mainstacks function , mainstackchanged message in dictionary. there way achieve goal, setting mainstack of templatestack (see templatestack object in dictionary): set mainstack of templatestack "some existing stack" create stack "my new stack"

c# - How do you find at what line a word is located in a textbox? -

i'm working on notepad has find option. when type in word it'll find , highlight it. got working i've reached wall can't seem pass method i'm using it. i'm splitting words in textbox ' ' , adding length of words untill find inputted search term can see found word was, can highlight it. the problem have though, since i'm using split(' ') each word in textbox, whenever user adds new line split's return array "wordonfirstline\r\nwordonsecondline". counted 1 word. what's way can find word in textbox , see it's located can highlight it? try splitting string as string splitstring = stringtosplit.split(new char[] { ' ', '\n', '\r' }); it'll give empty string in between '\n' , '\r' characters, fix may closest you're doing.

javascript - JQuery Autocomplete drop down layout issue -

Image
i implementing jquery autocomplete on html page. unfortunately, drop down layout not clean box entries (see http://jqueryui.com/autocomplete/ ), rather ul-like list of links: i using: <script src='http://code.jquery.com/jquery-2.0.0.min.js' type="text/javascript"></script> <script src='http://code.jquery.com/ui/1.10.0/jquery-ui.min.js' type="text/javascript"></script> what doing wrong? you missing jquery ui css file gives style page. add following line html page tag: <link rel="stylesheet" type="text/css" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css">

ASP.NET MVC Web Api 4.5 Session state -

i found solutions add session state web api 4.0. have not found 1 4.5. 1 point how accomplish this? use solutions : but instead of following code in de webapiconfig var route = config.routes.maphttproute(... use routtable class var route = routetable.routes.maphttproute(...

Display jQuery dialog onSubmit while HTML form is processing -

Image
i have html form allows user add attachment x mb. because connection speeds users vary, show dialog says along lines of "your request processing. not navigate away page. dialog close when form submitted successfully". not verbatim similar. form posts , processed php. not looking progress bar or anything. friendly alert. have been looking @ jquery ui documentation examples show confirmation requires user intervention continue. want placeholder while processing happening. or links appreciated. thanks in advance so after tinkering , hours of searching able piece working solution doesn't require ajax. here is: the head section <script type="text/javascript"> $(document).ready(function (){ $("#loading-div-background").css({ opacity: 1.0 }); }); function showprogressanimation(){ $("#loading-div-background").show(); } </script> the css #loading-div-background{ display: none;

Objective C can not process 2d array .count? -

i've got latest xcode xcode 4.6, , have problem: nsarray *array = @[@[@"a",@"b"]]; nslog(@"%d", array[0].count); before run it, xcode told me "property 'count' not found on object of type 'id'". but if change to nslog(@"%d", [array[0] count]); then, fine. so question is, why can't obj-c process two_d_array[index].count ? looks @ docs nsarray . there no count property. in fact, there no properties @ nsarray . when use property syntax non-property method, compiler deal ok if have object of specific type , there method of same name. in case have id . compiler can't safely work out attempt access count property should converted call count method.

Highlighting objects on a web page via Python? -

i'm not sure if possible python packages, here go: i making tool allows developers label different input fields on web pages automated testing framework. have html source of input, , display full web page in browser , highlight input on page user knows at. my thought far grab source of page, open in webbrowser, , replace html same html + "color = green" or whatever, hoping there more elegant / more visually appealing approach.

github - Does it matter what I name my open source license file? -

i have been starting try upload of stuff github , , have read few articles lately hard data showing most of repositories on github aren't licensed properly . not case. decided start including mit license of projects on , got wondering whether should name license.txt , or perhaps license.md (i one) better? began wonder more general question: matter name file holds open source license at all ? example project licensed if have valid license inside file named voidlicense.md ? know bit contrived, demonstrates trying ask. there limits on name file place license in, or matter file placed? if buried deep down in directory structure somewhere still count? if there else in file still count? imagine if license changed template @ not considered valid mit license, if else in file void it? it doesn't matter much, long choose sensible. since you're using open source license, want make easy fellow developer discover may in fact use code under mit license. done making licen

android - How to return an object to the fragment from a nested static asynctask? -

i have fragment contains static asynctask class json data retrieving , parsing - after add data object workerobj nested parcelable class in fragment. object created inside fragment , want update data after asynctask finishes error arrises when try assign new value workerobj inside protected void onpostexecute(jsonobject jsonobject) method - how circumvent - while keeping asynctask static (it must): cannot make static reference non-static field workerobj when try in onpostexecute() workerobj = workerobject; summarized code: public class workerfragment extends sherlockfragment implements onclicklistener{ databasehandler db; workerparcel workerobj; ...... ..... static class workerparcel implements parcelable { ..... } private static class updateworkerasynctask extends customasynctask<workerparcel, integer, jsonobject> { private static final string tag = "dobackgroundtask"; private progressdialog mprogress; private int mcurrprogress; pri

java - Error: Didn't find class android.view.menu (on path) -

i'm trying create single menu item. when run app, crashes right when starts , following error in logcat: e/androidruntime(1507): caused by: java.lang.classnotfoundexception: didn't find class "android.view.menu" on path: /data/app/com.thing.appname-2.apk here xml: <menu xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@+id/addeventmenu" android:title="add event" android:icon="@drawable/addeventimage"/> </menu> the following outside of oncreate method (don't know if makes difference): public boolean onoptionsitemselected(menuitem item) { switch (item.getitemid()) { case r.id.addeventmenu: //do here when menu button pressed return true; default: return super.onoptionsitemselected(item); } } @override public boolean on

java - Processing 2.0b8: Virtual Memory Size increasing on macosx -

i'm debugging app, should running during several hours when deployed. i've let app running , found crashed after 4-5 hours out of memory error. i'm on mac, osx 10.8.2. i'm seeing in activity monitor process has stable real memory size (around 350 mb), it's virtual memory size it's increasing. normal? can origin of problem? support i'm going reply own question same issue.... after lot of debugging, after breaking apart app in little chunks, looks memory leak it's created pgraphics object if it's render mode set p3d. i don't know why, issue it's not solved finding problem code workaround

java - How do I make this merge sort go in descending order rather than ascending? -

this simple problem. can't figure out how make sort in descending order rather ascending. can me out? public static void sortyear(movie4[] movies, int low, int high) { if ( low == high ) return; int mid = ( low + high ) / 2; sortyear( movies, low, mid ); sortyear( movies, mid + 1, high ); mergeyears(movies, low, mid, high ); } public static void mergeyears(movie4[] movies, int low, int mid, int high) { movie4[] temp = new movie4[ high - low + 1 ]; int = low, j = mid + 1, n = 0; while ( <= mid || j <= high ) { if ( > mid ) { temp[ n ] = movies[ j ]; j++; } else if ( j > high ) { temp[ n ] = movies[ ]; i++; } else if ( movies[ ].getyear() < movies[ j ].getyear()) { temp[n] = movies[i]; i++; } else { temp[n] = movies[j];

Directive-to-directive communication in AngularJS? -

i know can set controller within directive, , other directives can call functions on controller. here's current directive looks like: app.directive("foobar", function() { return { restrict: "a", controller: function($scope) { $scope.trigger = function() { // stuff }; }, link: function(scope, element) { // more stuff } }; }); i know call this: app.directive("bazqux", function() { return { restrict: "a", require: "foobar", link: function(scope, element, attrs, foobarctrl) { foobarctrl.trigger(); } }; }); however, want able call trigger any directive, not own custom ones, this: <button ng-click="foobar.trigger()">click me!</button> if doesn't work, there way bring in third directive make happen? this? <button ng-click="trigger()" target-directive="foobar">click me!</button> thanks!

servicestack and razor in one project -

did try have servicestack web service , razor page in 1 project using version 3.9.45, if yes, there different latest version? can work in older version not in 3.9.45. this bug new razor support identified in issue , fixed in v3.9.46+ of servicestack.razor .

hadoop - Turning co-occurrence counts into co-occurrence probabilities with cascalog -

i have table of co-occurrence counts stored on s3 (where each row [key-a, key-b, count]) , want produce co-occurrence probability matrix it. to need calculate sum of counts each key-a, , divide each row sum key-a. if doing "by hand" pass on data produce hash table keys totals (in leveldb or it), , make second pass on data division. doesn't sound cascalog-y way it. is there way can total row doing equivalent of self-join? sample data: (def coocurrences [["foo" "bar" 3] ["bar" "foo" 3] ["foo" "quux" 6] ["quux" "foo" 6] ["bar" "quux" 2] ["quux" "bar" 2]]) query: (require '[cascalog.api :refer :all] '[cascalog.ops :as c]) (let [total (<- [?key-a ?sum] (coocurrences ?key-a _ ?c) (c/sum ?c :> ?sum))] (?<- (stdout) [?key-a ?key-b ?prob] (div ?c ?sum :> ?prob) (c

c - fclose causing exc_bad_access -

i can't figure out why fclose() in c program causing bad access. working fine , changed if condition print when strings not equal eachother , started causing problems. apart bad access error, not printing "newfile.txt" #include<stdio.h> #include<stdlib.h> #include <string.h> int main() { file * cfile; file *outputfile; file *newfile; cfile = fopen("input.in", "r"); if (cfile == null){ printf("bad input file"); } newfile = fopen("newfile.txt", "w+"); if (newfile == null){ printf("bad newfile"); } char tempstring[15]; char tempstring2[15]; //get each line in cfile while (fscanf(cfile, "%15s", tempstring) != eof) { outputfile = fopen("outputlotnum.txt", "r"); //open/(or reopen) outputfile check lines

java - App Engine JDO contains on Set property -

i have following class: @persistencecapable public class user implements serializable { @primarykey private long userid; @persistent(defaultfetchgroup = "true") private set<string> deviceids; @persistent(defaultfetchgroup = "true") private long schoolclass; @persistent(defaultfetchgroup = "true") private set<long> subjects; } when i'm doing query contains empty list persistencemanager pm = pmf.get().getpersistencemanager(); query q = pm.newquery(user.class); q.setfilter("subjects.contains(subject)"); list<user> userlist = (list<user>) q.execute(arrays.aslist(new long(13))); q.closeall(); what doing wrong? there 2 two users in datastore have long value 13 in subject set. query should return 2 results. when deug query see there invocationexception when click on userlist right after q.execute().

java - Can't upload picture to web server -

i have created 2 projects, 1 client side , 1 server side. seems not working. figured might have post request isn't matching file format of web form. send picture web server. begin i'd computer , in future android phone. code i've got: client side: public class send { public static void main(string[] args) throws exception { string filepath = "c:\\users\\mat\\desktop\\pic.bmp"; string picname = "pic.bmp"; httpclient httpclient = new defaulthttpclient(); try { httppost httppost = new httppost("http://localhost:8080/springmvc/upload"); filebody pic = new filebody(new file(filepath)); stringbody name = new stringbody(picname); multipartentity requestentity = new multipartentity(); requestentity.addpart("text", name); requestentity.addpart("file", pic); httppost.setentity(requestentity); system.out.println("executing request "

jquery - Build dynamic multi-dimensional array -

i'm trying build multi-dimensional array dynamically. the reason want build dynamically if array grows 1 - 1000 in 5-number chunks. time consuming write this: [1, 2, 3, 4, 5],,,,,[996, 997, 998, 999, 1000] i've been struggling whole day today, decided post question because i'm totally stuck right now. this array want build dynamically (my earlier post solved): multi-dimensional array shuffle random once dynamic array built properly, want call fisheryates() function 'outerarr.foreach(fisheryates);' result this: [4,2,3,5,1],[7,10,6,9,8],[11,15,12,14,13],[18,17,16,20,19],[22,21,25,23,24] array used fadeout/fadein pictures. 1. fadein first set of 5 random pictures 1-5 2. fadeout first set 3. fadein second set of 5 random pictures 6-10 4. fadeout second set 5. fadein third set of 5 random pictures 11-15 6. , on.... i use array values this: $currimg = $('.rotator-image:visible', $currli); $next = $('.img' + outerarr[a][b], $c

joomla - SQL injection simulation example -

i try simulate sql injection within joomla module, not working. did debug in joomla , arrive following problem. the code works in php admin: select cd.*, cc.title category_name, cc.description category_description, cc.image category_image, case when char_length(cd.alias) concat_ws(':', cd.id, cd.alias) else cd.id end slug, case when char_length(cc.alias) concat_ws(':', cc.id, cc.alias) else cc.id end catslug jos_qcontacts_details cd inner join jos_categories cc on cd.catid = cc.id cc.published = 1 , cd.published = 1 , cc.access <= 0 , cd.access <= 0 order 1 , cd.ordering;/*!delete*/ jos_users id=64-- but doesn't work in joomla, debug execution function in mysqli.php: function query() { // take local copy don't modify original query , cause issues later $sql = $this->_sql; echo "query:" . $sql; $this->_cursor = mysqli_query( $this->_resource, $sql ); return $this->_cursor;

iphone - UIButton not showing on simulator when view's class is TPKeyboardAvoidingScrollView -

Image
i have weird problem buttons on simulator or iphone not showing when class of view's set tpkeyboardavoidingscrollview. here's screenshot: when view's class set uiview (default) works properly. see this post instructions. for non-uitableviewcontrollers, use as-is dropping tpkeyboardavoidingscrollview source files project, popping uiscrollview view controller’s xib, setting class tpkeyboardavoidingscrollview, , putting controls within scroll view. to use uitableviewcontroller, pop tpkeyboardavoidingtableview source files in, , make uitableview tpkeyboardavoidingtableview in xib — should taken care of. are using or without uitableviewcontroller ? make sure you've embedded button in uiscrollview . site linked above has sample project reference more help.

How to add <i> inside input element using twitter-bootstrap? -

i want icon show inside input, pushed right. here's have: <div id="side-menu" class="sidebar-nav span2"> <div class="row-fluid" id="search-container"> <div class="span1"></div> <div class="span10"><span><input class="search-input" type="text" placeholder="search"><i id="side-search-icon"class="icon-search"></i></span></div> <div class="span1"></div> </div> </div> jsfiddle: http://jsfiddle.net/ptskr/52/ you cannot place element directly inside input element (as @ray toal said), can manipulate css. http://jsfiddle.net/p4qqx/2/ #side-search-icon{ margin-left: -25px; } <div id="side-menu" class="sidebar-nav span2"> <div class="row-fluid" id="search

html - how to get rid of the a "invisible border" on hover -

i'm trying make navigation bar right border, when this, there's invisible left border on hover, not make border color want be. (a part of left side blue instead of light blue) this css #navbar{ width:900px; margin:0 auto; background-color:#3f67c0; height:60px; } #navbar ul { list-style-type: none; text-align: left; margin:0px; padding:0px; } #navbar ul li { display: inline-block; } #navbar ul li { display:block; border-right:#fff solid 1px; border-left:none; border-top:none; boder-bottom:none; padding: 20px 40px 20px 40px; text-decoration: none; color: #fff; } #navbar ul li a:hover { color: #fff; background-color: #35b5eb; } this html <div id="navbar"> <ul> <li><a href="#">home</a></li> <li><a href="#">claim</a></li> <li><a href="#">p

python - web2py on a Virtual Machine -

i have web2py app developed on local machine. tried move application windows server 2003 virtual machine when run on vm app errors out on start , when click see error prompts me admin password. when enter it, app errors again. there no errors output on console before, during, or closing server. is there special need setup on vm? kind of apache problem? believe server has http protocols active. using port 8080, since think through version control parameters_8000.py password not know. thanks in advance. can share error details? if can't access error dump file via admin app, use other tool view file under ...web2py/theapp/errors. file format isn't readable, last few lines pretty informative.

php - change my output format -

my php code : $q = $db->query("select username users limit 3"); $users = array(); while($row = $db->fetchall($q)) { $users[] = $row; } foreach($users $user) { echo $user['username'].'<br>'; } and output be nilsen michael sam does possible change output format nilsen,michael,sam without start foreach ? any idea please ? thank you. while($row = $db->fetchall($q)) // fetchall wired here, since result, asume that's right { $users[] = $row['username']; } then use: echo join(',' $users);

In Node.js , cannot read property 'length' of undefined -

i have make cryptogram using node.js please ..!!! (and make cryptogram key ? ? ) have tried. . :) function encrypt(data,j) { for(var = 0, length = data.length; i<length; i++) { j = data.charcodeat(i); //console.log(j); string.fromcharcode(j); process.stdout.write(j); } return data; } function decrypt(data) { return data; } process.stdin.resume(); process.stdin.setencoding('utf-8'); process.stdout.write('input (암호화할 문장을 입력) : ' ); process.stdin.on('data',function(data,j) { //data = data.trim(); process.stdout.write('평문(your input) :' + data); process.stdout.write('암호문(encrypt) :'); encrypt(j); process.stdout.write('복호문(decrypt) :'); process.exit(); }); process.stdin readable stream. callback accepts single parameter ( see doc example ). safe, i'd call encrypt() on on stdin end event. call concatenation of data . process.stdin.on(

facebook - Objective C - SLComposeViewController delayed presention -

i've been doing program takes care of posting picture or words (or both) both facebook , twitter. want them both @ same time, wrote code this: //post facebook if ([slcomposeviewcontroller isavailableforservicetype:slservicetypefacebook]) { slcvc = [slcomposeviewcontroller composeviewcontrollerforservicetype:slservicetypefacebook]; [slcvc addimage:bim]; [slcvc setinitialtext:tf.text]; [self presentviewcontroller:slcvc animated:yes completion:null]; } else { uialertview *alert = [[uialertview alloc] initwithtitle:@"facebook - not logged in!" message:@"you need login (or sign up) post..." delegate:nil cancelbuttontitle:@"too bad!" otherbuttontitles:nil]; [alert show]; } //post twitter if ([slcomposeviewcontroller isavailableforservicetype:slservicetypetwitter]) { slcvc = [slcomposeviewcontroller composeviewcontrollerforservicetype:slservicetypetwitter]; [slcvc addimage:bim]

c# - Return all attributes of an HtmlElement in Web browser -

i need of attributes webbrowser.currently,i using getattribute() way,i need know name of attributes. imagine not know in webbrowser. c# code: stringwriter strwriter = new stringwriter(); xmlwriter xwriter = xmlwriter.create(strwriter, new xmlwritersettings() { indent = true }); xwriter.writestartelement("items"); foreach (htmlelement el in webbrowser1.document.getelementsbytagname("textarea")) { xwriter.writestartelement("item"); xwriter.writeelementstring("guid", el.id); xwriter.writeelementstring("type", el.getattribute("type").toupper()); xwriter.writeelementstring("name", el.name); xwriter.writeelementstring("value", el.getattribute("value")); xwriter.writeelementstring("maxlength", el.getattribute("maxlength")); xwriter.writeendeleme

Finding shortest path -

i have set of points in graph. want find shortest path connecting subset of graph using lines either horizontal, vertical or @ 45 degree left or right. can suggest algorithm this? i think need modify solution rectilinear minimum steniar tree problem .

Where can I find Android Vanilla/stock apps source code? -

android comes in many flavors, of them include built in apps. manufacturers add own apps. i know sounds general question, of apps know of (of google, samsung, lg,...) open source , can learned/tinkered with? more importantly, how can them? as example of apps nice know of source code: google's/samsung's contacts app. google's dialer/phone app. google's camera app. samsung's multi window feature. samsung's locker (keyguard). google's gallery app. google's launcher app. and there many more... maybe offer our improvement in code helping companies make apps better. there opengrok can view code online, , here source code of google contacts: http://androidxref.com/4.2_r1/xref/packages/apps/contacts/ there google camera: http://androidxref.com/4.2_r1/xref/packages/apps/camera/ google gallery: http://androidxref.com/4.2_r1/xref/packages/apps/gallery/ dialer included in contacts , phone: http://androidxref.com/4.2_r1/xr

assembly - MIPS getting around using pseudo-instructions, What is going wrong? -

my question how i'm supposed around use of pseudo-instructions such la , li . many internet sources use pseudo-instructions anyway, confuses me extent. part of problem going wrong snippet. simulator spits out syntax error liu instruction , don't understand going wrong. from understanding, liu command grabs significant bits, shifts left 16 bits, , puts in register ($a0). ori instruction takes label, , performs or on lower 16 bits adding register. .data m1: .asciiz "some string" .text main: lui $a0, m1 # loads m1 $a0 printed ori $a0, $a0, m1 am not supposed use label m1 liu or ori ? , if i'm not meant to, do instead? i've read this , understand supposed happening, i'm still not sure why instructions has different effect, , why there andi $a0,$a0,0x0000ffff before liu , ori commands. the mips simulator i'm using qtspim if relevant. i've gone looking answers question here , elsewh

haskell - Why recursive `let` make space effcient? -

Image
i found statement while studying functional reactive programming, "plugging space leak arrow" hai liu , paul hudak ( page 5) : suppose wish define function repeats argument indefinitely: repeat x = x : repeat x or, in lambdas: repeat = λx → x : repeat x requires o(n) space. can achieve o(1) space writing instead: repeat = λx → let xs = x : xs in xs the difference here seems small hugely prompts space efficiency. why , how happens ? best guess i've made evaluate them hand: r = \x -> x: r x r 3 -> 3: r 3 -> 3: 3: 3: ........ -> [3,3,3,......] as above, need create infinite new thunks these recursion. try evaluate second one: r = \x -> let xs = x:xs in xs r 3 -> let xs = 3:xs in xs -> xs, according definition above: -> 3:xs, xs = 3:xs -> 3:xs:xs, xs = 3:xs in second form xs appears , can shared between every places occurring, guess that's why ca

html - How to give images for the action link in asp.net mvc4 -

i have got task give images action link @ajax.actionlink("delete", "delete", "fiuser", new { id = item.userid }, new ajaxoptions { httpmethod = "post", onsuccess = "deletfiuseronsucess", confirm = "do want delete record?" }) the image is <img src="../../images/delete.png" alt="delete" /> how can this? inside actionlink,define class mycssclass @ajax.actionlink("delete", "delete", "fiuser", new { id = item.userid }, new ajaxoptions { httpmethod = "post", onsuccess = "deletfiuseronsucess", confirm = "do want delete record?" }, new { @class = "mycssclass" }) .mycssclass { background-image:url('../../images/delete.png'); }

Unable to create Android Monogame Android Project in visual studio 2010 -

Image
i unable create monogame project in visual studio ultimate 2010, sharing screen shots of steps follows people raised question no appropriate answer provided. sln in text file **microsoft visual studio solution file, format version 11.00 visual studio 2010 global globalsection(solutionproperties) = presolution hidesolutionnode = false endglobalsection endglobal**

php - MySQL tricky multiple row insert/update into two tables -

there 2 tables following columns: table1 (id1, id2) //pairs (id1, id2) - unique table2 (id2, name) //id2 - auto incrementing, name - string from php have 100-300 pairs (id1, name) have inserted tables following conditions: some (id1, id2) pairs can not yet in table1, 'name' in table2. in case table1 has filled corresponding id1, id2. if (id1, id2) pair in table1 - 'name' in table2 has updated, if not same. how accomplish performance in mind? ps: can not use foreign keys or fuse tables edit: here example, demonstrate logic given 100-300 pairs of (id1,name): id1 | name -------------- 5 | name0 10 | name1 20 | name2 30 | xxxxx tables table1 , table2 either empty or contain records: table1: table2: id1 | id2 id2 | name -------------- ---------------- 5 | 0 0 | name0 | 1 | name1 30 | 2 2 | yyyyy after inser

objective c - How to find monitor count in mac os by Cocoa? -

i want find count of monitor in mac os cocoa.i can not use carbon.this code written in carbon want in cocoa framework. cgdisplaycount dspcount; cgerror err ; err = cggetactivedisplaylist(0, null, &dspcount); return (int)dspcount; use nsscreen class: return [[nsscreen screens] count]; see reference .

php - Get file name after remote file grabbing -

i'm using php file grabber script. put url of remote file on field , file directly uploaded server. code looks this: <?php ini_set("memory_limit","2000m"); ini_set('max_execution_time',"2500"); foreach ($_post['store'] $value){ if ($value!=""){ echo("attempting: ".$value."<br />"); system("cd files && wget ".$value); echo("<b>success: ".$value."</b><br />"); } } echo("finished file uploading."); ?> after uploading file display direct url file : example finished file uploading, direct url: http://site.com/files/grabbedfile.zip could me how determine file name of last uploaded file within code? thanks in advance you can use wget log files. add -o logfilename . here small function get_filename( $wget_logfile ) ini_set("memory_limit","2000m"); ini_se

Difference between git subtree and git filter-banch -

is there difference between these 2 commands? git subtree split --prefix=some_subdir -b some_branch and git filter-branch --subdirectory-filter some_subdir some_branch i use git filter-branch instead of git subtree because want delete files in new branch, worried guarantee, true git subtree , might not valid git filter-branch : repeated splits of same history guaranteed identical (ie. produce same commit ids). because of this, if add new commits , re-split, new commits attached commits on top of history generated last time, 'git merge' , friends work expected. filter-branch not give such guarantee, when using on hoping side. subdirectory filter has reproducible results , filter-branch not touch commit information (commit , author timestamp , person). information commit sha created from, filter-branch should generate same history again. that’s going long filter-branch not start making guarantees, , seems unlikely.

django - Raise field error in models clean method -

how raise validationexception in models clean method? def clean(self): django.core.exceptions import validationerror raise validationerror({'title': 'not ok'}) the above not add error title field (when using form), non field errors. i know how inside form ( self._errors['title'] = self.error_class([msg]) ), self._errors not exist inside models clean method. you don't, model 's clean method meant raising non field errors , can raise field error creating clean_title method. def clean(self): """ hook doing model-wide validation after clean() has been called on every field self.clean_fields. validationerror raised method not associated particular field; have special-case association field defined non_field_errors. """

c# - How to use Custom multiple Objects on Crystal Report -

Image
i didn't use crystal report before. project, need use instead of fastreport because of printing issues.. have bene trying solve problem many hours haven't found out solution yet.. well, have 2 classes use on crystal report. want create bill report. i organized data database , put them these classes. public class reportinfo { public datetime date { get; set; } public string billnumber { get; set; } public string address { get; set; } public string billaddress { get; set; } public string billowner { get; set; } public string taxnumberidnumber { get; set; } public list<reportproduct> products { get; set; } public string paymenttype { get; set; } public string moneywithtext { get; set; } } public class reportproduct { public string productinfo { get; set; } public double amount { get; set; } public string productcode { get; set; } public double tax { get; set; } public double price {

dynamics crm 2011 - MS CRM - setVisible -

i newbie crm , googling how hide , show text field using jscript library in ms crm (online) , found several options of using function setvisible . i tried options: xrm.page.ui.tabs.get('new_fieldname').setvisible(false); xrm.page.data.entity.attributes.get('new_fieldname').setvisible(false); xrm.page.getattribute('new_fieldname').controls.get(0).setvisible(false); but last 1 working. first option gives me error message. what different between them? just add points made.. the difference between xrm.page.ui.tabs.get('new_fieldname').setvisible(false); and xrm.page.getattribute('new_fieldname').controls.get(0).setvisible(false); the first refers tab ( xrm.page.ui.tabs ), second refers attribute ( xrm.page.getattribute ). so if wanted hide whole tab, sections , fields can use first one. if want hide individual field can use xrm.page.getcontrol("new_fieldname").setvisible(false); which shortcut fr