Posts

Showing posts from June, 2015

android - Dialog List With SQLite data -

i have code shows me list of items have in sqlite database. this list opening in screen clicking button. have problems need display list in same screen, can't open antoher screen, want use dialog wchich have items database. trying modify code ain't results. this code: public list<string> populatelist() { list<string> ugraduatenameslist = new arraylist<string>(); androidopendbhelper openhelperclass = new androidopendbhelper(this); sqlitedatabase sqlitedatabase = openhelperclass.getreadabledatabase(); cursor cursor = sqlitedatabase.query("relpregresppred", null, null, null, null, null, null); startmanagingcursor(cursor); while (cursor.movetonext()) { string descripcionrespuesta = cursor.getstring(cursor .getcolumnindex(androidopendbhelper.rdescripcionrespuesta)); undergraduatedetailspojo ugpojoclass = new undergraduatedetailspojo(); ugpojoclass.setrdescri...

Registering DLL's in Wix using self-registration -

two of library depends on third. latter library must copied system32 directory, 2 - programfiles directory. please advise on how deal registration of first 2 libraries. i need use self-registration. tried specify id of main library companion file, did not help. should do? msi's selfreg table doesn't support ordering operation of registrations. use quietexec custom action call regsvr32 /s in right order wouldn't myself. the optimal design not rely on self reg. have thoroughly exhausted using msi handle registration data designed do?

makefile - Cmake vs make sample codes? -

i wondering if there sample code makefile s ( make ) , cmakelists.txt ( cmake ) both same thing (the difference being 1 written in make , other in cmake ). i tried looking 'cmake vs make', never found code comparisons. helpful understand differences, if simple case. the following makefile builds executable named prog sources prog1.c, prog2.c, prog3.c , main.c . prog linked against libmystatlib.a , libmydynlib.so both built source. additionally, prog uses library libstuff.a in stuff/lib , header in stuff/include . makefile default builds release target, offers debug target: #makefile cc = gcc cpp = g++ ranlib = ar rcs release = -c -o3 debug = -c -g -d_debug incdir = -i./stuff/include libdir = -l./stuff/lib -l. libs = -lstuff -lmystatlib -lmydynlib cflags = $(release) progobjs = prog1.o prog2.o prog3.o prog: main.o $(progobjs) mystatlib mydynlib $(cc) main.o $(progobjs) $(libdir) $(libs) -o prog debug: cflags=$(debug) debug: prog mystatlib:...

preg replace - Clean string from html tags and special characters -

i want clean text html tags, html spacial characters , characters < > [ ] / \ * , i used $str = preg_replace("/&#?[a-za-z0-9]+;/i", "", $str); works html special characters characters doesn't remove : ( /*/*]]>*/ ) how can remove these characters? if using php looks like, can use: $str = htmlspecialchars($str); all html chars escaped (which better stripping them). if want filter these characters, need escape characters on chars list: $str = preg_replace("/[\&#\?\]\[\/\\\<\>\*\:\(\);]*/i","",$str); notice there's 1 "/[]*/i", removed a-za-z0-9 should want these chars in. can classify desired chars enter string (will give trouble accentuations á é ü if use them, have specify every accepted char): $str = preg_replace("/[^a-za-z0-9áÁéÉíÍãÃüÜõÕñÑ\.\+\-\_\%\$\@\!\=;]*/","",$str); notice there's never escape characters, unless example intervals (\a-\z fine, ...

Does dart support client SSL/TLS connections yet? -

i thinking of writing apple push notification server using dart. dart support client side ssl/tls certificates? yes! dart vm supports ssl/tls, , https. see http://code.google.com/p/dart/issues/detail?id=3950 , http://code.google.com/p/dart/issues/detail?id=3593 closed. :)

Flume agent throws java.net.ConnectException: Connection refused -

i have been using flume while now, have got agent , collector running on same machine. configuration agent: exec("/usr/bin/tail -n +0 -f /path/to/file") | agente2esink("hostname", 35855) collector: collectorsource(35855) | collector(10000) { collectorsink("/hdfs/path/to/sink","name") } facing issues in agent node: 2012-06-04 19:13:33,625 [naive file wal consumer-27] info debug.insistentopendecorator: open attempt 0 failed, backoff (1000ms): failed open thrift event sink hostname:35855 : java.net.connectexception: connection refused 2012-06-04 19:13:34,625 [logicalnode hostname-19] error connector.directdriver: expected active timed out in state opening 2012-06-04 19:13:34,632 [naive file wal consumer-27] info debug.insistentopendecorator: open attempt 1 failed, backoff (2000ms): failed open thrift event sink hostname:35855 : java.net.connectexception: connection refused 2012-06-04 19:13:36,635 [naive file wal consumer-27] info debug.i...

CMake to link against non numbered libraries -

how can instruct cmake link against non-numbered version of library? instance when using boost libraries have: find_package(boost components regex program_options required) target_link_libraries(main ${boost_program_options_library}) and executable links against libboost_program_options.so.1.49.0 . if try run executable in older machine fail because library can't found although know functionality present in library version. that doesn't work. though functionality there, exact api may not there. that's why unix linking system uses symlinks, linker accesses unnumbered symlink, dereferences when writing out list of dependencies, require same major version @ runtime. you have 3 choices: recompile on target machine older boost. distribute necessary boost library along executable. involves writing launch script sets ld_library_path before running. link against static boost libraries eliminate runtime dependency. use line before find_package: set(boo...

php - Getting error: Can't connect to MySQL server on 'SERVER_IP' (99) -

i'm using php5 , mysql, fine until more 9,000 petitions send mysql server. for example, i'm trying 10,000 insert csv file 10,000 records (lines). when loop running got error: can't connect mysql server on '192.168.10.11' (99). i wrote little loop 10,000 select field_id table field_id = xx , got same error. my lamp uses debian squeeze, php5, mysql server 5.1, apache2 an important note: using mysql workbench or mysql cli there no errors, on web environment. this my.conf # # mysql database server configuration file. # # can copy 1 of: # - "/etc/mysql/my.cnf" set global options, # - "~/.my.cnf" set user-specific options. # # 1 can use long options program supports. # run program --help list of available options , # --print-defaults see understand , use. # # explanations see # http://dev.mysql.com/doc/mysql/en/server-system-variables.html # passed mysql clients # has been reported passwords should enclosed ticks/quotes # escpe...

time complexity - Worst Case number of rotations for BST to AVL algorithm? -

i have basic algorithm below , know worst case input bst 1 has degenerated linked list inserts 1 side. how compute worst case complexity in terms of number of rotations bst avl conversion algorithm? if tree right heavy { if tree's right subtree left heavy { perform double left rotation } else { perform single left rotation } } else if tree left heavy { if tree's left subtree right heavy { perform double right rotation } else { perform single right rotation } } if single , double rotations take constant time o(1) worst-case input on size n going perform single (or double depending on if input linked list left-sided or right-sided) on nodes. be: o(1) + o(1) + ... + o(1) # n times worst case that makes algorithm o(n) worst case.

testing - Test class instanciation within a method using a spy in Javascript (Jasmine/Mocha) -

i starting test javascipt code , have problem not able solve. have backbone app (amd/requirejs driven) , use mocha (sinon, chai, ...) bdd testing - wraps setup. let's talking class class myapp extends app init: -> @initcontrollers() initcontrollers: -> new headercontroller() new navcontroller() to the first method init , can write following testcase before ... describe 'init', -> 'should call @initcontrollers', -> spy = sinon.spy(@myinstance, 'initcontrollers') @myinstance.init() expect(spy.called).tobetruthy() this works pretty good. i'd test, if second method initcontrollers creates new instances of headercontroller , navcontroller how can achieved that? stuck right , little bit confused because start thinking of not right way call controllers. any appreciated i confused, @mu-is-to-short gave me right hint i did now: describe '@initcontroller...

php - Symfony2 - Use a third party library (SSRS) -

maybe dumb question, i'm new symfony2 , i'm using 1 of projects. i'd able use third party library, namely ssrsreport (an api ssrs reports). i have put library symfony/vendor/ssrs/lib/ssrs/src . there many classes defined here, don't need them autoloaded. i don't know how require , call them controller. for sure doesn't work require_once '/vendor/ssrs/lib/ssrs/src/ssrsreport.php'; class defaultcontroller extends controller { public function viewaction() { define("uid", "xxxxxxxx"); define("paswd", "xxxxxxxx"); define("service_url", "http://xxx.xxx.xxx.xxx/reportserver/"); $report = new ssrsreport(new credentials(uid, paswd), service_url); return $this->render('mybundle:default:view.html.twig' , array('report' => $report) ); } } ssrsreport() , credentials() used here, 2 of many classes ...

Not able to modify the Ok Cancel button in jQuery -

we using jquery change orginal ok/cancel button yes/no button calling below function. function yesnodialog(button1, button2, element) { var btns = {}; btns[button1] = function() { element.parents('li').hide(); $(this).dialog("close"); }; btns[button2] = function() { $(this).dialog("close"); }; $("<div></div>").dialog( { autoopen: true, title: 'condition', modal:true, buttons:btns } } we added dependent js & css files project still 'object required' error when call yesnodialog function can please on this? you missed ); after dialog call must be: function yesnodialog(button1, button2, element) { var btns = {}; btns[button1] = function() { element.parents('li').hide(); $(this).dialog("close"); }; btns[button2] = function() { $(t...

google apps script - Need documentation on method setDataTable(table), Charts service -

when using charts service in gas, can create different type of charts , of them have 2 methods setdatatable(...) push data in: method setdatatable(tablebuilder) method setdatatable(table) for first 1 create datatablebuilder object using charts.newdatatable() . second 1 not documented enough me. does know specification of object table transmit function ? seems me can array or map, had no success in using it. thanks, the second method takes in datatable, result of calling datatablebuilder.build(). unfortunately it's not possible construct pure javascript object accept, , you'll need use datatablebuilder.

arrays - KnockoutJS/AJAX update viewmodel -

currently playing knockoutjs. trying update observable array ajax/json feed (using twitter) in example. it seems lose scope of "this" when trying update observable array (currenttweets). i've tried adding bind various places no such luck. the error is: uncaught typeerror: cannot call method 'push' of undefined i'm sure doing stupid, here in action (not at!) http://jsbin.com/oyuteb i've read lot knockout mapping don't feel confident enough take on yet! so, or guidance fab. thanks the simplest way solve proxy viewmodel's "this" variable available inside handlers. when jquery ajax calls success handler, context different refers else. so have function twitterviewmodel() { var self = this; this.currenttweets = ko.observablearray([]); ... this.gettweets = function(){ $.ajax({ datatype: 'jsonp', url: 'http://search.twitter.com/search.json?callback=?&...

c++ - OpenGl project with drawPrimitive() -

i trying change c++ project, drawing lines when click on view port. functionality fine, trying change when click on "up" or "down" keys color next lines change. if click on keys color changes lines including old ones (already drawn). please give me idea of do. here of code: void drawprimitive() { vertex *temp; // set primitive color glcolor3fv(primitivecolor); // set point size in case drawing point if (type == point) glpointsize(pointsize); // display results depending on mode glbegin(mode); for(temp = head; temp != null; temp = temp->np) { if (smoothshading) glcolor3f(temp->r, temp->g, temp->b); glvertex2f(temp->x, temp->y); } glend(); } void mouse(int button, int state, int x, int y) { if(button == glut_left_button && state == glut_down) { float pointx, pointy; pointx = (float)x/window_width * world_width; pointy = (float)(window_height - y)/window_height * world_h...

android - Create and display a ListView of the ZXing ProductDatabase -

i created app scanning barcodes , qr code using zxing library. implemented database stores scanned products. need implement listview display stored products. ideas? here classes: barcodeactivity @override public void oncreate (bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.spot_pay); button addbutton = (button) findviewbyid (r.id.addmenubutton); addbutton.setonclicklistener (new onclicklistener(){ public void onclick (view v){ startactivity(new intent(codicebarreactivity.this, aggiungicodiceactivity.class)); } }); } static final class productdata { string barcode; string format; string title; bigdecimal price; } } productdatabase: private sqlitedatabase db; private static class productdatabasehelper extends sqliteopenhelper { public productdatabasehelper(context context) { super(context, database_name, null, ...

html5 - Single CSS Stylesheet, or one stylesheet per section? -

i working on website (or rather few websites) done in html5/css3 bit of php thrown in there few functions. so proper practice having css in single stylesheet called page or (because of shear size of code) having each section have own external style sheet? (between nav bar , footer alone 1500-2000 lines of code.) there benefits , fall backs either such code cleanliness , amount of "calls" more 1 style sheet. there solid technical reasons why 1 use more other? goal make best possible website smallest foot print fast , accessed various devices. it's not user intensive or process heavy. regarding tag capitalization, little history may in understanding why trend has shifted uppercase lowercase: in html4 elements typically written in uppercase, according w3schools, w3c recommended written in lowercase (although can't find reference). then, xhtml became popular; the specification stipulated elements , attributes must lowercase . , html5 specification says...

c# - "Specified cast is not valid" error in LINQ's orderby clause -

i doing right join between 2 datatables in linq. getting error @ orderby line ""specified cast not valid". "someotherid" column of type system.int64 in dbml , allows dbnull. column has null values in data, valid. seems these nulls have handled in way in orderby statement not sure how. data coming in through web service. checked reference.cs file , corresponding property column int. how should linq statement be? var query = (from table1 in datatable1.asenumerable() join table2 in datatable2.asenumerable() on (int) table1["customerid"] equals (int) table2["customerid"] outer table2 in outer.defaultifempty() orderby (int?)table2["someotherid"] select new { ...... }); al...

php - How do I restrict page access in IIS based on access count? -

we have internal user has developed few scripts poll of our internal tools @ short intervals, such every 3 seconds. the user has spread scripts (js-based) other employees. such, our server, iis-based, receives numerous hits tools every few seconds. i believe use php stop this, fix ugly. example, question 6202116 has answer similar need php-based fix. however, believe iis 6.0 should able restrict access based on access counts (per ip). example, if user tries access page more 3 times within 2 minute interval, access should denied. anyone?

c++ - minGW CPP G++ Proper Command to Compile -

i installed following: mingw32_nt-6.1 i686 msys i working command line. wrote "typical" helloworld.cpp program. if compile with: cpp helloworld.cpp -o helloworld.exe compile good. (18k) execution fails: 16 bit ms-dos subsystem. ntvdm cpu error if compile with: g++ helloworld.cpp -o helloworld.exe compile good. (48k) execution good. i cannot determine best way execute compile , difference between methods. suggestions? or references? thanks. "cpp" "c preprocessor", not compiler. you're getting strange in helloworld.exe execute "type helloworld.exe" , see gives. shouldn't binary file - long text file "#includes" , "#defines" replaced. to question - second way "right", because invoke compiler/linker , produce valid executable. first "way" valid command, has nothing compilation , linking.

winforms - Can a C# solution have multiple forms, but have one selected to be the main when compiled? -

basically, program want have common backend, have can compile different gui control program. know can make multiple forms, there way tell solution compile, , form1 gui, , later, compile , tell form2 gui (and not include form1 in compiled program). form1 more administrator more features, while form2 normal user far less capabilities form1 . possible, or have make new solution? yes, can use conditional compilation , exclude code compile entirely. can similar to: #if user_gui public class basicform : form { // ... } #endif and #if admin_gui public class advancedform : form { // ... } #endif then have similar #ifdef when starting gui call approriate constructor public static void main(string[] args) { // ... #if user_gui var form = new userform() #endif #if admin_gui var form = new advancedform() #endif application.run(form); } when compile, can set project properties appropriate variable in project -> propert...

javascript - How to round some values in an object array? -

array = [ {name:apples, price:3.99, tax:0.20}, {name:oranges, price:1.40, tax:0.15}, {name:bananas, price:0.99, tax:0.10}, ] how run tofixed() on "price" values (and not names, performance purposes) come this: array = [ {name:apples, price:4, tax:0.20}, {name:oranges, price:1, tax:0.15}, {name:bananas, price:1, tax:0.10}, ] will have go through loop route? just loop on array (btw: never use array variable name): for (var i=0; i<arr.length; i++) arr[i].roundedprice = math.round(arr[i].price);

php - .htaccess accounts for gzip encoding and caching but YSlow reports an 'F' on both -

i new optimization techniques such gzip compression , caching. after research on net, realized possible through .htaccess based on apache handlers. had enquired webhosting know if mod_deflate , mod_headers libraries present , available i checked through firebug. shows request headers "accept-encoding gzip,deflate" there no "content-encoding" in response field. can please me out on going wrong? following code of .htaccess file options -indexes options +followsymlinks rewriteengine on rewritebase / rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . /index.php [l] <ifmodule mod_deflate.c> addoutputfilterbytype deflate application/x-javascript addoutputfilterbytype deflate text/css text/html text/plain text/xml deflatecompressionlevel 9 </ifmodule> # --...

Mass update case Status - Salesforce -

i looking way mass update case status , leave success message or failure message failed case id. have validation rules , triggers update or cases. need keep show @ least first failed case id in error message. is there way put variable in validation rule error message? or explicitly string? i use validation rule cant show failed case in error message because cant put variable in error message. check link might http://appexchange.salesforce.com/listingdetail?listingid=a0n30000003ilefeas you need use before trigger in case , compare list of selected cases before , after update. or can create custom button , add page , run desired javascript check changed before , after. something : {!requirescript("/soap/ajax/13.0/connection.js")} var idarray = {!getrecordids($objecttype.case)}; var err = []; var caseobj; (i=0; i< idarray.length ; i++){ caseobj = new sforce.sobject("case"); caseobj.id = idarray[i]; caseobj.status = ***...

java - How does C# do runtime generics? -

one thing irritates me java awful implementation of compile-time translation of generic type arguments. i can observe , understand c# implementation far better, i'm confused how works. essentially, how can say: t t = new t() if don't know type of t , therefore don't know constructor argument requirements? i can see class<t> cl = t.class or t[] tarr = new t[0] but don't see how can create new instance of t if don't know requirements of constructing it? you can new t(); if t constrained have plain, parameterless public constructor, instance: public class foo<t> t : new() { private myt = new t(); } additionally, there no way specify other sort of constructor exist. not possible: // doesn't work public class foo<t> t : new(string, int) { private myt = new t("foo", 5); } to other points, how type of t @ runtime: var ttype = typeof(t); and creating array of t doesn't create instances...

pygame - Where to put images folder in python exe? -

i have converted python game designed exe. running exe causes flash , close, meaning error has occured. running command prompt causes error well, documents it: cannot load image: playfield.png couldn't open images\playfield.png this telling me load_image block failing. have encountered before when did not have images directory. i attempted move images folder dist directory. error shows up: traceback (most recent call last): file "table_wars.py", line 728, in <module> file "table_wars.py", line 51, in main file "table_wars.py", line 236, in __init__ file "pygame\__init__.pyc", line 70, in __getattr__ notimplementederror: font module not available (importerror: dll load failed: specified module not found.) this first time py2exe, i'm not sure happening. raw python file itself, table_wars.py, runs expected. if helps, location entire table_wars folder inside folder called games, located on desktop (c:...

php - Use fsockopen with proxy -

i have simple whois script if($conn = fsockopen ($whois_server, 43)) { fputs($conn, $domain."\r\n"); while(!feof($conn)) { $output .= fgets($conn, 128); } fclose($conn); return $output; } $whois_server = whois.afilias.info; //whois server info domains but want run in through proxy. need connect proxy -> connect whois server -> , make request. this? $fp = fsockopen($ip,$port); fputs($fp, "connect $whois_server:43\r\n $domain\r\n"); but doesn't work, don't know if i'm making second connection right. sending request proxy should like: <?php $proxy = "1.2.3.4"; // proxy $port = 8080; // proxy port $fp = fsockopen($proxy,$port); // connect proxy fputs($fp, "connect $whois_server:43\r\n $domain\r\n"); $data=""; while (!feof($fp)) $data.=fgets($fp,1024); fclose($fp); var_dump($data); ?> rather doing...

Interacting with Android API Library? -

i'm quite beginner programming in general (and esp. java!), i'm having trouble figuring out how interact unofficial android api library, shown here: http://code.google.com/p/android-market-api/ one of snippets of example code "see appsresponse class definition more info". however, how supposed this? there 2 .jars provided, 1 of corresponds android market api. upon extraction winrar (i'm on windows, way), go in few folders deep , find bunch of .class files. how open read, , figure out how interact api? thanks! you can @ source? http://code.google.com/p/android-market-api/source/browse/trunk/androidmarketapi/src/com/gc/android/market/api/model/market.java

.net - TinyMCE renders non editable after partial postback -

i have integrated tinymce in update panels. it works in major browsers except in firefox (tested firefox 12, 13b7 , latest nightly 15a01). tested firefox 10, same thing , not work firefox 4 i using tinymce 3.5.2 here workflow : tinymce gets loaded correctly first time , can edit content. however, when partial postback, can see gets loaded (i can see text appearing second or two) , after disappears , tinymce gets unusable. meaning can't click in it, can't focus. however, can modify dom manually , see text. my update panel contains user control in tinymce loaded @ page load using following : webhelper.registerrichtexteditorinsidestartupscriptnoloading(page) scriptmanager.registerstartupscript(upanel, upanel.gettype(), upanel.uniqueid, "tinymce.init();", true) where upanel updatepanel id , link tinymce added using web helper any ideas? works in ie 9, chrome, safari on windows , mac. i found : https://bugzilla.mozilla.org/show_bug.cgi?id=737784 ...

asp.net - Load listview with Jquery postback -

i new jquery , want build listview created codebehind function. , want jquery function without page postback. implement updatepanel functionality without using updatepanel. use jquery load call server page returns markup listview/ table //inlcude jquery library here <div id="mydiv"></div> <script type="text/javascript"> $(function(){ //this code execute once dom ready $("#mydiv").load("myserverpage.aspx"); }); </script> and in myserverpage.aspx , can return html markup shown in main page. protected void page_load(object sender, eventargs e) { stringbuilder stritems = new stringbuilder(); stritems.append("<table>"); //you can replace below dummy each loop code //to read data database. for(int i=0;i<10;i++) { stritems.append("<tr><td>"+i.tostring()+"</td><td>i awesome</td></tr...

asp.net mvc - highcharts not working properly -

Image
i want make highchart http://jsfiddle.net/gh/get/jquery/1.7.2/highslide-software/highcharts.com/tree/master/samples/highcharts/demo/line-labels/ have stored procedure count room type reserved every month (january :double 2,triple 4..) need transmit parameter stored procedure in roomtypereservations.roomtypebydate(i); when 1 data january, 2 data february...... public actionresult gresit() { dbcontext.current.open(); list<series> allseries = new list<series>(); list<roomtypereservations> rezervari = new list<roomtypereservations>(); (int =1; < 13; i++) { rezervari = roomtypereservations.roomtypebydate(i); var results = new object[4]; foreach (var in rezervari) { results = (new object[] { a.numrezervari }); allseries.add(new series { name = a.room_type, //data = new data(mydata) data = new data(results.toarray()) }); } }; highcharts chart...

python - Importing modules in a file that declares decorators -

this file structure: annotations helper.py annotations.py test helloworld.py this helloworld.py , simple helloworld class: from annotations.annotations import annie class helloworld: @annie.mydecorate def something(): echo 'hello world' and within annotations.py , i'm declaring simple decorators: from annotations.helper import helper class annie: @staticmethod def mydecorate(func): helper.prepare() print func.__name__ here error saying no such module: helper . guess happening when module helloworld being loaded, loading annotations module, function being called during module being loaded @ time helper module not loaded. i'm not sure how correct am, looking solution here. is problem else? can import modules doing in file declares decorators? appreciated. regards, rohan in annotations.py , try: import helper or (relative imports, python 2.5 , up) from . import helper

Qt Some ASCII Missing Only on Certain Machine -

i have problem qtextedit. when compile , run on development environment qtcreator in either debug or release modes, text edit displays characters fine. show perfectly. additionally, if copy of dependent dll's (i'm on windows) folder , run release version there, still displays correctly. however, when take dir constructed in last step , copy machine, not characters show correctly. of them show up. ascii characters, come on-screen qwerty keyboard. text edit characters displayed on-screen keyboard. when widget containing both text edit , qwerty keyboard closed, text copied out of text edit , new text edit, ascii characters show fine. for quirky text edit, seems characters not showing. same characters show show, , same characters not show not show. assuming i've made clear enough (it's tough describe, that's effort in advance), have idea of how , why happening? how can resolved? it sounds font issue. perhaps font being used in text box missing on targ...

installing a single rpm multiple times on one server -

hello , ahead of time answers can provide question. i have rpm wrapper around exploded war. on server run rpm -i myrpm.rpm this works fine , right world. run rpm again --relocate trigger create identical install. ideally have install application new entry in rpm data base incremented instance or of nature. i can force install happen running rpm -i --force --relocate oldpath=newpath myrpm.rpm the problem here old version no longer managed rpm. there can make work way want? no. rpm maintains database of files, installed rpms etc. way db designed, file (normally) can belong 1 rpm , rpm have 1 copy of file. i.e., cannot track multiple copies of @ multiple locations (--relocate). in general, relocating rpms bad idea - if rely on application reconsider. see this: http://rpm.org/wiki/packagerdocs/multipleversions ideas on how can handle this.

java - String to GZIPOutputStream -

i've tried searching , couldn't find anything. i'm trying i'm looping through list i'm constructing string combination of items multiple lists. want dump these strings gzipped file. got working dumping plain ascii text file can't seem work gzipoutputstream. basically, loop create string dump string gzipped file endloop if possible, i'd avoid dumping plain text file gzipping since these files 100 meg each. yes, can no problem. need use writer convert character based strings byte based gzip stream. bufferedwriter writer = null; try { gzipoutputstream zip = new gzipoutputstream( new fileoutputstream(new file("tmp.zip"))); writer = new bufferedwriter( new outputstreamwriter(zip, "utf-8")); string[] data = new string[] { "this", "is", "some", "data", "in", "a", "list" }; ...

java - Suggestions for a multiple socket design (Android) -

i'm trying think of way implement app that: -opens x amount of sockets (user specified) -each socket can remain open lifetime of application , continues running in background -creates multiple activities of same layout, each used display information received socket. currently have implementation takes sends/receives 1 socket. service runs in background continue processing information socket, , sends activity. however, current train of thought leads me believe i'd need 1 service each socket open continue processing in background. i'm new android clarification great. thanks i implement single service manages socket connections. services defined in androidmanifest consequence can't run multiple services of same type, , can't create services @ runtime (by can't define new services @ runtime). you're stuck using single service. doesn't mean can't have multiple instances of class represent each connection server. in fact that...

Using Silverlight to create a custom control C# ASP.NET -

a few things off bat. i've never used silverlight before. i'll using silverlight v3.0 in vs2008 (3.5 framework) i'm going using create user control existing c# web application doesn't use silverlight , i'm not sure how go doing this. am supposed add silverlight application current project? make it's own project , somehow import later? also, considerations/worries should know of in attempting this? not sure started. guidance appreciated. thanks. i've built custom file uploader in silverlight before, can give tips. create standalone silverlight project the project above builds .xap file there testpage.html generated. contains reference silverlight.js , <object> tag hosts control on web page. you can use figure html required host silverlight control. create own asp.net project, , create control generates required html. include .xap file , silverlight.js file in distribution of custom control.

What is the easiest 2D game library to use with Scala? -

i need integrate scala library reinforcement learning works on scala 2.9.1 2d game library. if uses sbt awesome. i looking @ scage, current master branch broken, works on maven, , examples how set starter project did not work. i not opposed using java library directly, want mimize amount of work needed started. any suggestions? how scalafx? at github javafx , scala milk , cookies

Error 'LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt' after installing Visual Studio 2012 Release Preview -

i've installed visual studio 2012 release preview, , appears fine, when try use visual studio 2010 compile c++ projects, following error message: link : fatal error lnk1123: failure during conversion coff: file invalid or corrupt i'm not 100% sure of this, seems related projects have .rc (resource) files in them. i've tried repairing visual studio 2010 add/remove programs , rebooting, has no effect. i same error if use visual studio 2012 rc compile c++ projects when set use visual studio 2010 toolset. upgrading visual studio 2011 toolset fixes problem (but of course don't want production code). update: i've uninstalled visual studio 2012 , rebooted, , problem still persists! help! this msdn thread explains how fix it. to summarize: either disable incremental linking, going project properties -> configuration properties -> linker (general) -> enable incremental linking -> "no (/incremental:no...

Ignore invalid self-signed ssl certificate in node.js with https.request? -

i'm working on little app logs local wireless router (linksys) i'm running problem router's self-signed ssl certificate. i ran wget 192.168.1.1 , get: error: cannot verify 192.168.1.1's certificate, issued `/c=us/st=california/l=irvine/o=cisco-linksys, llc/ou=division/cn=linksys/emailaddress=support@linksys.com': self-signed certificate encountered. error: certificate common name `linksys' doesn't match requested host name `192.168.1.1'. connect 192.168.1.1 insecurely, use `--no-check-certificate'. in node, error being caught is: { [error: socket hang up] code: 'econnreset' } my current sample code is: var req = https.request({ host: '192.168.1.1', port: 443, path: '/', method: 'get' }, function(res){ var body = []; res.on('data', function(data){ body.push(data); }); res.on('end', function(){ console.log( body.join('') ); }...

android - Calling ArrayList in Java -

Image
hi im trying make code go through arraylist have in xml put them in tablelayout im having trouble calling arraylist xml im trying somethin this arraylist list = collection(r.array.arraylist); int total = list.size(); (int current = 0; current < total; current++) { // create tablerow , give id tablerow tr = new tablerow(this); tr.setid(100+current); tr.setlayoutparams(new layoutparams( layoutparams.fill_parent, layoutparams.wrap_content)); textview labeltv = new textview(this); labeltv.setid(200+current); labeltv.settext(list); labeltv.settextsize(dip, 14); labeltv.setgravity(gravity.center); labeltv.settextcolor(color.white); labeltv.setlayoutparams(new layoutparams( layoutparams.fill_parent, layoutparams.wrap_content)); tr.addview(labeltv); i dont think going through arraylist data , textview isnt displaying tex...

jquery - Changing CSS background color for one link while on that page -

hey trying change background color of link in nav different color rest of nav links when user on particual page link for. the code is: $("#nav li ul li #changebg1").css("background-color","red"); and nav html looks little this: <ul id="nav"> <li><a href="index.php">home</a></li> <li><a href="custhelp.php">who are</a> <ul> <li id="changebg1"><a href="about.php">about</a></li> <li id="changebg2"><a href="help.php">team</a></li> </ul> </li> however, not seem change one, changes of them. can not seem find out how call id of nav , id of changebg1 1 change. the jquery code is: var url = window.location.href; url = url.substr(url.lastindexof("/") + 1); $("#thenav").find("a[href='" + url + "...

dsl - StringTemplate and Xtext -

in current work, have written code generator using string template without thinking parser ( instantiating template files using direct java object). , code generator generator generates nice java code. now, have started write parser. b'coz of nice editor features of xtext, thinking write parser in xtext. my question "is possible use code generator ( written using stringtemplate ) , parse (written in xtext) in same project? yes that's possible. xtext offers typed ast parsed files , pass them code generator (directly, iff fulfil same contract / interfaces, or indirectly transforming them expected structure). xtext not impose constraints on how want use parsed information.

Rails is it possible? -

is possible exec ruby code in instance variable in controller? example: def @code = "redirect_to 'https://www.google.com/'" exec(@code) // , redirect. end don't this. rails ruby. in ruby, can execute command inside string using eval method. , when start getting it, there class_eval. @myvar = "puts 'should not have done this!!'" eval(@myvar) # should not have done this!! keep safe.

lvm - LVM2 : Failing to pvcreate a block device -

i'm trying make use of lvm2 functionality in linux (centos6.0). when trying make first step of defining pv on specific block device, following error message: [root@localhost /] pvcreate /dev/sdb can't open /dev/sdb exclusively. mounted filesystem? /dev/sdb not mounted , partition table deleted. should mention /dev/sdb used represent larger block device (about 4 times larger) , reduced configuration of hardware raid (i split hd 4 in raid controller). has ever encountered error before , knows how take here? maybe device-mapper 'stealing' device. try this: [root@host ~]# dmsetup ls sdb (253, 2) volgroup00-logvol01 (253, 1) volgroup00-logvol00 (253, 0) if find sdb device listed above example, remove using dmsetup , create physical volume: [root@host ~]# dmsetup remove sdb [root@host ~]# pvcreate /dev/sdb physical volume "/dev/sdb" created

android - Convert canvas coordinate system to OpenGLES 2.0 coordinates -

i started drawing hexagonal grid on canvas path object. did calculations on how many hexagons go on particular display, depending on hexagon size. i have hexagon coordinates calculated depending on canvas. now, have serious performance issues , have port opengl. because algorithm works in canvas, i'm trying convert "canvas" hexagon coordinates opengl coordinate system glu.gluunproject. "for loop" float near[] = { 0.0f, 0.0f, 0.0f, 0.0f }; glu.gluunproject(b.hexes[ii][jj].points[ii].x, b.hexes[ii][jj].points[ii].y, 0, mg.mmodelview, 0, mg.mprojection, 0, viewport, 0, near, 0); vertices[zz] = (float) ((near[0])/near[3]); zz++; vertices[zz] = (float) ((near[1])/near[3]); zz++; vertices[zz] = 0; because lack opengl knowledge, dont know how set glviewport,gluperspective,gltranslatef 2d world "the same" canvas. so question is: how set 3 thing...

io - The number of bytes read and unsigned numbers -

as example clarify question, in google go 1.0, following interface defined in "io" package : type reader interface { read(p []byte) (n int, err error) } especially result parameter list (n int, err error) intrigues me. intrinsically number of bytes can not negative, according documentation of interface: it returns number of bytes read (0 <= n <= len(p))[...] in c reason use int in-band value -1 signal error condition (see effective go: multiple return values ). because of multiple return values, special in-band values not necessary. there exists type uint in go 1.0. what specific reason using int versus uint in case of values use positive range [0,∞) without need having special in-band values? the de facto numeric type integers in cases int . example, len(x) , cap(x) return int values though cannot negative. in cases returning int helps avoid type conversions between different numeric types. so yes, read() have returned uint ...

iPhone IOS device testing on Newer iOS than SDK -

when doing preliminary research, minimum requirements ios development limited intel based mac, snow leopard. since then, have purchased new (old) mac, installed sdk (4.3), , wrote first app. unfortunately, highest sdk mac run ios 4.3. iphone want test ios 5.x. cannot figure out how set provisioning allow me install app on iphone. have paid fee, went through brief (aimed @ later sdk) helper, xcode wants me install older ios on phone connect. know way around this? thanks in advance, sagan create ad hoc build, , load resulting .ipa file onto device either via itunes or url. ad hoc builds allow create built copy of app in single packaged file may loaded on device. there's ton of references around web how this, here's 1 guide xcode 4: http://benscheirman.com/2011/06/creating-proper-ipa-files-in-xcode-4 here's guide xcode 3: http://www.springtiger.co.uk/2010/12/06/creating-a-ipa-file-for-your-application/

ios - Tableview reload data not updating tableView -

the else part of works fine. if itemflag true, can't new information display correctly after doing alphabetic sort. quitting programme , restarting shows new item have been added array, , diplayed correctly. so question is, why reloaddata not working if itemflag true? here code: - (void)changefooddetails:(nsstring *)foodname withpoints:(nsstring *)foodpoints{ if (newitemflag) { [_foodstuffsarray insertobject:[[fooditem alloc] initwithname:foodname points:[foodpoints intvalue]] atindex:0]; nsindexpath *indexpath = [nsindexpath indexpathforrow:0 insection:0]; [self.tableview insertrowsatindexpaths:[nsarray arraywithobject:indexpath] withrowanimation:uitableviewrowanimationautomatic]; [sharedmanager sortfoodstuffarraybyname]; [self.tableview reloaddata]; newitemflag = false; }else { [_foodstuffsarray removeobjectatindex:currentfoodstuffarrayentry]; [_foodstuffsarray insertobject:[[fooditem alloc] ini...

Liquibase MySQL: syntax error near '????????????????' -

i trying run liquibase following parameters (default parameters, modified paths): liquibase --driver=com.mysql.jdbc.driver \ --classpath=mysql-connector-java-5.1.20-bin.jar --changelogfile=changelog.xml \ --url="jdbc:mysql://localhost/example" \ --username=root \ migrate changelog.xml minimal: <?xml version="1.0" encoding="utf-8"?> <databasechangelog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd"> </databasechangelog> and error is: liquibase update failed: have error in sql syntax; check manual corresponds mysql server version right syntax use near '????????????????' @ line 1 severe 6/5/12 2:42 a.m.:liquibase: have error in sql syntax; check man...

javascript - Remove image title when mouse hover on the image -

i using lytebox image gallery. works great except when user hovers on images, there texts html tags shown on browser. ex: <h1>this first image </h1> <p>the image desc<p> i need title attribute image gallery don't want show when user hovesr image. possible? help. var imgtitle; $("img").hover(function(){ imgtitle = $(this).attr("title"); $(this).removeattr("title"); }, function(){ $(this).attr("title", imgtitle); });

Adding a database to the Django Project using Sqlite3 with Python 2.7 -

i trying add database django project using sqlite3 , python 2.7. this how setting.py looks like: databases = { 'default': { 'engine': 'django.db.backends.sqlite3', # add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. 'name': 'dev.db', # or path database file if using sqlite3. 'user': '', # not used sqlite3. 'password': '', # not used sqlite3. 'host': '', # set empty string localhost. not used sqlite3. 'port': '', # set empty string default. not used sqlite3. } } it allows me create database , asks me create superuser: you installed django's auth system, means don't have superusers defined. create 1 now? (yes/no): when type yes, gives me error msg. error msg: traceb...