Posts

Showing posts from August, 2013

linux - sybase ase database is it free -

linux - sybase ase database is it free - we want utilize sybase database, of these versions: 12, 12.5, 12.5.1, 12.5.2, , 12.5.3 i'm not sure if sybase ase linux free production utilize without cpu or disk limitation? if mean ase adaptive server enterprise, "express" , "developer" editions free. more details on sybase website: http://www.sybase.com/products/databasemanagement/adaptiveserverenterprise linux sybase-ase

java - Math line only running once in a loop -

java - Math line only running once in a loop - this first interaction site, have heard things , hope can find reply looking for. learning java , using eclipse ide in computer science class @ high school , came across problem neither teacher or can solve. here instructions. "the high german mathematician gottfriedleibniz developed follow method approximate value of π. π/4 = 1 - 1/3 + 1/5 - 1/7 + ... write programme allows user specify number if iterations used in approximation , displays resulting value." now code. import java.util.scanner; public class gottfriedleibnizpi { public static void main(string[] args) { scanner reader = new scanner(system.in); system.out.print("enter how many iterations want go to: "); int iterations = reader.nextint(); double pi = 0; if (iterations >= 0) { (int count = 0; count <= iterations - 1; count++) { system.out.println(...

asp.net - jQuery script not recognised when injected in my view (.cshtml) -

asp.net - jQuery script not recognised when injected in my view (.cshtml) - usually create javascript file (myfile.js) scripts. example: /// <reference path="../../scripts/jquery/jquery-1.5.1.js" /> $(document).ready(function () { // bind 'myform' , provide simple callback function $('#uploadbackgroundform').ajaxform({ iframe: true, datatype: "json", success: backgrounduploadedsuccess, error: backgrounduploadederror }); }); now place script straight in view (.cshtml) in section (< script type="text/javascript">.....< / script >). example: ...my view goes here... <script type="text/javascript"> /// <reference path="../../scripts/jquery-1.5.1.js" /> $(document).ready(function () { // bind 'myform' , provide simple callback function $('#uploadbackgroundform').aj...

c# - How to apply Graphics scale and translate to the TextRenderer -

c# - How to apply Graphics scale and translate to the TextRenderer - i'm using scaling , transforming graphics object when painting custom control, in order apply zooming , scrolling. utilize following: matrix mx = new matrix(); mx.scale(mzoomfactor, mzoomfactor); mx.translate(-clip.x + mgraphicsoffsetx, -clip.y + mgraphicsoffsety); e.graphics.clip = new region(this.bounds); e.graphics.transform = mx; then when paint strings using: graphics g = ... g.drawstring(...) the scalling , transforming correctly applied strings, zoomed out , in , on. however if utilize next paint strings: textrenderer.drawtext(...) the text not correctly scaled , transformed. do know how apply concepts textrenderer ? the comments above accurate-- textrenderer.drawtext , beingness gdi, has limited back upwards coordinate transformation given resolution dependence. you've noticed, coordinate translation s...

mysql - understanding indexs with a simple select query -

mysql - understanding indexs with a simple select query - i'm trying understand how work indexes basic queries. example: i have table 'testme' next columns: id int primary key username varchar(20) data1 int data2 int data3 int data_order int if select username,data1,data2 testme data3=5 order data_order; which kind of indexes can utilize speed query ? i tried adding index on clumns data3 , data_order result of 'explain' query shows doesn't utilize index. update: using mysql cluster (ndb) think of index 2 things... 1. order in info stored 2. quick way lookup specific pieces of info (like book index) in example, having index on (data3, data_order) create easy find info want, , have in right order. it still needs go table after searching index, fields username, data1, data2 . reason may include them in index well. makes index bigger, using more space , more effort update. cost means index isn't beingness jo...

tomcat7 - java.lang.IllegalArgumentException on startup after moving to tomcat 7 -

tomcat7 - java.lang.IllegalArgumentException on startup after moving to tomcat 7 - after moving jbilling (www.jbilling.org) tomcat 7, not start anymore , throws next exception on startup: java.lang.illegalargumentexception: taglib definition not consistent specification version @ org.apache.catalina.startup.tagliblocationrule.begin(webruleset.java:1164) @ org.apache.tomcat.util.digester.digester.startelement(digester.java:1276) @ com.sun.org.apache.xerces.internal.parsers.abstractsaxparser.startelement(abstractsaxparser.java:501) @ com.sun.org.apache.xerces.internal.impl.xmldocumentfragmentscannerimpl.scanstartelement(xmldocumentfragmentscannerimpl.java:1363) @ com.sun.org.apache.xerces.internal.impl.xmldocumentfragmentscannerimpl$fragmentcontentdriver.next(xmldocumentfragmentscannerimpl.java:2756) @ com.sun.org.apache.xerces.internal.impl.xmldocumentscannerimpl.next(xmldocumentscannerimpl.java:648) @ com.sun.org.apache....

C++: Can I write a template class that derives from T? -

C++: Can I write a template class that derives from T? - i'm not sure how word in english, want this: template <class t> class derived: public t { blah }; where basically, have template class, i'm deriving new class class specified in template? i.e. wouldn't know class @ compile time. is possible? if so, semantics this? for example, i'm trying write "parent" class. purposes of example, let's it's tree parent. tree parent, tree (so inherits tree), has vector of references kid trees.however, parent class doesn't have tree; class, such write like: parent<tree> treeparent; parent<shrub> shrubparent; yes. possible. seek doing that. i wouldn't know class @ compile time. i think, mean "i wouldn't know class @ time of defining class template." by time compile, you've defined class template, , used in code, passing template argument it, means know class (i.e template argument) @ ...

eclipse - android project not getting built -

eclipse - android project not getting built - i newbie android development, , using eclipse 3.7 indigo on ubuntu 11.10. have sdk , adt installed. have 2 problems. an android project takes awfully long time created. when restart eclipse, built projects (even simple hello world ones) have rebuilt, , takes long time build. while building "details" dialog box shows loading info android 2.3.3 android 2.3.3: widgets , layouts then, building workspace (where progress bar seems remain halted eternity). @ times gets built after this. @ other times, first line in helloandroid.java file shows error, when rebuilt yet 1 time again disappears. so when restart eclipse, takes approximately 10 minutes built projects running on emulator. any fixes this? hard telling issue without more information, here thoughts: your machine may underpowered. os, processor speed, ram have? if have big amount of projects, or have big projects, can take long time build them ...

wpf - Is it possible to change value from xaml? -

wpf - Is it possible to change value from xaml? - is possible alter property value xaml? imagine have usercontrol have property initialized already public class myusercontrol : usercontrol { ... public someclass mainwindow { { homecoming _someclass ?? (_someclass = new someclass();) } } } now possible alter property of someclass without initializing xaml, , without animation? why xaml doesn't allow syntax write <usercontrol.mainwindow.property> ? add setter property , allow xaml create own someclass according need - that's done. xaml declarative language, doesn't seek turing finish or that, simply describes creation of objects. of course, there 1 extreme solution. please, don't it. sake, , else's :) edit: another solution create new property in usercontrol, , synchronize property property of someclass ( set{ this._someclass.someproperty = value; } ). if set property i...

debugging - Can I have Visual Studio stop on unhandled exceptions inside Task code? -

debugging - Can I have Visual Studio stop on unhandled exceptions inside Task code? - visual studio has feature makes debugging unhandled exceptions lot easier: stops on offending line of code , shows exception. it seems task class designed in such way feature suppressed: catches every exception, , rethrows different exception when task wait ed or finalized. i know can have stop on first-chance exceptions, doesn't help: imagine number of handled exceptions of same type occur prior unhandled one. in case vs stop on every non-problematic exception in add-on 1 causes problem. another alternative less acceptable: looking @ stack trace of innerexception : means while know line caused exception, cannot access of local state, if programme stopped there. can somehow best of both worlds, using task class not having live degraded exception debugging feature set? bonus question: mean null reference exception within await block not cause visual studio stop right there, i...

c++ - Can UnaryOperator be a member function when std::transform is called -

c++ - Can UnaryOperator be a member function when std::transform is called - based on std::transform template < class inputiterator, class outputiterator, class unaryoperator > outputiterator transform ( inputiterator first1, inputiterator last1, outputiterator result, unaryoperator op ); can op fellow member function? if so, how phone call it? no (well, not directly). need utilize adaptor, either old std::mem_fun (together bind1st , iirc) or std::bind / boost::bind . std::transform( xs.begin(), xs.end(), ys.begin(), std::bind(&class::member, &class_instance) ); c++ stl

ios - Device Directory -

ios - Device Directory - so have app database. database in main bundle. need delete database , new 1 internet. far understood, can't delete bundle , add together new in need work device documents directory. don't know how create first database in documents directory without downloading internet. can help? you need path of documents directory , need place database file there. need read/write operations in application copied database in app's document directory. i utilize these methods create re-create of db in documents directory: need phone call method: +(bool)copydbfiletodocumentsdirectory:(nsstring*)dbfilename overwrite:(bool)yesno and need pass filename extension. +(nsstring*)databaseabspath:(nsstring*)databasename existsindocumentsdirectory:(bool)existencestatus { bool success = no; nsstring *databasepath = nil; if(existencestatus)//documents directory { nsarray *documentpaths = nssearchpathfordirectoriesindoma...

php - How do I INSERT the character "&" into a MySQL database? -

php - How do I INSERT the character "&" into a MySQL database? - i think have seen question before don't think it's answered plenty yet because can't work. the case: want insert url mysql database so: $url = $_post["url"]; //$_post["url"] = "http://example.com/?foo=1&bar=2& ..."; $sql = mysql_query("insert table(url) values('$url')") or die ("error: " . mysql_error()); now, url inserted database when @ it, looks this: http://example.com/?foo=1 it's url cutting right @ "&" character. have tried: mysql_real_escape_string , htmlspecialchars , escaping doing "\" etc. nil seems work. i have read might able "sql plus" or that. thanks in advance. regards, vg chances problem here nil database query, , more how url passed page. suspect you'll find url used load page like: http://mydomain.com/?url=http://example.com/?foo=1...

python - Caught AttributeError while rendering: 'unicode' object has no attribute '_default_manager' -

python - Caught AttributeError while rendering: 'unicode' object has no attribute '_default_manager' - get error next practical django tutorial. have searched here , google , haven't found mentions of this, imagine it's going easy missing. exception in gambino_tags.py: context[self.varname] = self.model._default_manager.all()[:self.num] models.py class entry(models.model): # entry types live_status = 1 draft_status = 2 hidden_status = 3 status_choices = ( (live_status, 'live'), (draft_status, 'draft'), (hidden_status, 'hidden'), ) # foreign key author = models.foreignkey(user) title = models.charfield(max_length=250, help_text='maximum 250 characters.') # bit of redundancy excerpt & excerpt_html , body & body_html, seems cleanest way seperate plain text , html excerpt = models.textfield(blank=true, help_text='add excerpt - short summary ...

Querying directly on results from MongoDB mapreduce versus updating original collection -

Querying directly on results from MongoDB mapreduce versus updating original collection - i have mapreduce job runs on collection of posts , calculates popularity each post. mapreduce outputs collection post_id , popularity each post. application needs able posts sorted popularity. there millions of posts, , these popularities updated every 10 minutes. 2 methods can think of: method 1 keep index on posts table popularity field run mapreduce on posts table (this replace previous mapreduce results) loop through each row in mapreduce results collection , individually update popularity of corresponding post in posts table query straight on posts table posts sorted popularity method 2 run mapreduce on posts table (this replace previous mapreduce results) add index popularity field in resulting mapreduce collection when application needs posts, first query mapreduce results collection sorted post_ids, query posts collection actual post data questions method 1 need maintain...

javascript - Regex add 0 after first decimal -

javascript - Regex add 0 after first decimal - i learning regex need quite urgently. i have set of values (10, 19.5, 13.99, 9.09) . these formats fine except sec value. my problem how rewrite 19.5 becomes 19.50 without affecting other entries i.e (10, 19.50, 13.99, 9.09) many guys. if these numbers, utilize tofixed() if these strings, can use num="19.5" num.replace(/^(\d+\.\d)$/,"$10"); javascript regex currency

c++ - How can I delete dynamic array pointer correctly -

c++ - How can I delete dynamic array pointer correctly - possible duplicate: c++ delete - deletes objects can still access data? why doesn't delete destroy anything? i've created dynamic array, , added values ​​to values ​​of array that. int *parr; parr = new int[10]; for(int i=0;i<10;i++){ parr[i] = i+2; } delete[] parr; // after deletion can find value of array items. cout << parr[5] << endl; as see in code above , in lastly line, can output 5th element in array without problem . supposed array has been removed. to show memory can used again, consider expansion of code: int *parr; parr = new int[10]; for(int i=0;i<10;i++){ parr[i] = i+2; } delete[] parr; int *parr2; parr2 = new int[10]; for(int i=0;i<10;i++){ parr2[i] = (2*i)+2; } cout << parr[5] << endl; that prints out 12 me. i.e. value parr2[5] actually. or @ to the lowest degree should machine specific compiler & vers...

multithreading - Thread abort and ThreadExit not working visualstudio2008 c++ -

multithreading - Thread abort and ThreadExit not working visualstudio2008 c++ - i'm using threads in c++ visualstudio2008, when form closes thread still stays active tried thread::abort when form closing, after calling thread still alive. set excption handler in thread , when abort exception arrive thread exit, thread not come in in exception handler. how can close thread? othread global object thread. private: void threadmethod(/*object^ state*/) { try{ socket server; wsadata wsadata; sockaddr_in local; int wsaret=wsastartup(0x101,&wsadata); if(wsaret!=0) { return; } local.sin_family=af_inet; local.sin_addr.s_un.s_addr=inaddr_any; local.sin_port=htons((u_short)20248); server=socket(af_inet,sock_stream,0); if(server==invalid_socket) { return; } if(bind(server,(sockaddr*)&local,sizeof(local))!=0) { return; } if(listen(server,10)!=0) { return; } ...

ajax - Jquery validation async not working -

ajax - Jquery validation async not working - i have made function, seems work fine, homecoming "#" insted of wainting ajax. have tried remove homecoming call, out look. it need wait until ajax finish before return. jsp working fine. what wrong? jquery.validator.addmethod("knidexist", function(value, element) { var valid = "#"; $.ajax({ async: false, type: "post", url: "user.jsp", data: "knid="+value, datatype: "html", success: function(msg) { // if user exists, returns string "true" if($.trim(msg) != "true") { //return false; valid = false; // exists } else { //return true; valid = true; // username free utilize } } }); homecoming valid; }, 'this user not exist...

OpenCV calibration parameters and a 3d point transformation from stereo cameras -

OpenCV calibration parameters and a 3d point transformation from stereo cameras - i've 4 ps3eye cameras. , i've calibrated camera1 , camera2 using cvstereocalibrate() function of opencv library using chessboard pattern finding corners , passing 3d coordinates function. also i've calibrated camera2 , camera3 using set of chessboard images viewed camera2 , camera3. using same method i've calibrated camera3 , camera4. so i've extrinsic , intrinsic parameters of camera1 , camera2, extrinsic , intrinsic parameters of camera2 , camera3, , extrinsic , intrinsic parameters of camera3 , camera4. where extrinsic parameters matrices of rotation , translation , intrinsic matrices of focus length , principle point. now suppose there's 3d point(world coordinate)(and know how find 3d coordinates stereo cameras) viewed camera3 , camera4 not viewed camera1 , camera2. the question i've is: how take 3d world coordinate point viewed camera3...

internet explorer 9 - How do I stop IE9 automatically going into compatibility mode? -

internet explorer 9 - How do I stop IE9 automatically going into compatibility mode? - i've been working on few hours , still no joy. i'm working on ie9. i have: <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> i have document mode on ie8 set by: <meta http-equiv="x-ua-compatible" content="ie=emulateie8"> this resultsin ie8 document mode (good) results in browser mode automatically going compatibility mode mucks website up. what need alter stop ie9 defaulting compatibility mode when loading page visitor? use meta tag whit way: <meta http-equiv="x-ua-compatible" content="ie=8" > ie=emulateie7. specify ie=5, ie=7, ie=8, or ie=9 http://msdn.microsoft.com/en-us/library/cc288325(v=vs.85).aspx internet-explorer-9

ssh - calling java methods from a terminal -

ssh - calling java methods from a terminal - suppose have java program, myprogram.jar , have running on server. start programme type terminal: >java -jar myprogram.jar and programme go on run indefinitely. if programme had function such as void processinput(string text){ //process text } and wanted ssh server , phone call function particular string? log server @ time , alter state of program. possible? this can done, not easily. there standard ways accomplish want: mbeans. take @ http://docs.oracle.com/javase/tutorial/jmx/mbeans/standard.html java ssh cmd

java - How to traverse Linked Hash Map in reverse? -

java - How to traverse Linked Hash Map in reverse? - possible duplicate: iterating through linkedhashmap in reverse order how traverse linked hash map in reverse order? there predefined method in map that? i'm creating follows: linkedhashmap<integer, string> map = new linkedhashmap<integer,string>(); map.put(1, "one"); map.put(2, "two"); map.put(3, "three"); list<entry<integer,string>> list = new arraylist<>(map.entries()); for( int = list.size() -1; >= 0 ; --){ entry<integer,string> entry = list.get(i); } not pretty , @ cost of re-create of entry set, if map has important number of entries might problem. the excellant guava library have [list.reverse(list<>)][2] allow utilize java 5 each style loop rather indexed loop: //using guava for( entry entry : lists.reverse(list) ){ // much nicer } java reverse linkedhashmap

Codeigniter form validation not working on Mediatemple -

Codeigniter form validation not working on Mediatemple - i have upload , submission form working fine on 2 separate web host not work on mediatemple. everytime form catches error, reloads view without error shown. , kept getting no file selected error in upload field though had 1 selected right file extension allowed. these errors happens in mediatemple. please help. sorry late. have checked out article http://www.renownedmedia.com/blog/codeigniter-htaccess-for-mediatemple/ ? should help through problem running into. codeigniter codeigniter-2 codeigniter-form-helper

vba - Missing Control in Excel Forms -

vba - Missing Control in Excel Forms - i given excel spreadsheet has multiple excel forms inside. 1 of forms can not launched because apparently command missing. usual original developer here anymore hence need find out kind of command , how obtain it. any ideas? used sysinternal debugview haven't managed see point me in right direction. thanks ! are sure command missing form? in experience type of thing caused because dll command belongs isn't registered on computer. open spreadsheet in excel , go vbe. click tools -> references , check see if of references marked missing. excel vba

Unmarshal xhtml as string using xsd -

Unmarshal xhtml as string using xsd - i'm trying unmarshal big xhtml document using xsd's , jaxb. i've got working except 1 part, contains pure html. here illustration of xhtml i'm getting (i able grab every element except "content"): <feed xmlns="http://www.w3.org/2005/atom"> <title type="text">...</title> <id>...</id> <updated>...</updated> <entry> <id>...</id> <title type="text">...</title> <updated>...</updated> <author> <name>...</name> </author> <content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml"> <div>{html...}<div>{html...}</div>/<div>/<div> </content> </entry> </feed> here's expansion of xsd file: <xsd:complextype name="apcategoriesjaxb" > ...

Embedding a Flash player -

Embedding a Flash player - how can embed flash player in flv/swf video itself? have requirement must have standalone swf/flv built in player (start, stop, pause, progress bar). have said, must done via standalone file no additional xml or player files have kept original file. help on matter highly appreciated. sounds making projector. options: native one: flash projector adobe air 3rd party alternative: zinc flash flash-player

c++ - boost::any maps with char[] -

c++ - boost::any maps with char[] - in class, have char data[1000]. want able have map have map of key type string mapped type of info want. in driver, want able out values map. using map able hold info class not restricted info defined in header class can add together , remove info @ runtime. for illustration class definition: public: void populatemap() { classmap["imgdata"] = data; }; private: map<string,boost::any> classmap; char data[1000]; driver: int main(){ myclass test; map<string,boost::any> mymap; test.populatemap()//populates map char info mymap = test.getmap(); char mydata[1000] = boost::any_cast<char*>(mymap["imgdata"]); //runtime error } when this, runtime casting errors. i'm not versed in char[definite_size] versus char *. can direct me in problem is? have not seen many examples of people storing char array's in maps. proper way store char[definite_siz...

multithreading - UI Freeze in simple Socket (Java) app using SWT for UI -

multithreading - UI Freeze in simple Socket (Java) app using SWT for UI - i'm new java socket programming , exploring socket apis. i've created new simple app starts serversocket , listens clients, when client writes on socket, server allocates new thread client. tried first using console app , worked fine. now, i've made gui same using swt (windowbuilder plugin in eclipse 3.7). window has button toggles listening of server on , off. below code written in swt button's click event start listening clients. if(!isserverrunning) { btnserverrunner.settext("stop server"); isserverrunning = true; while (listening) { seek { new clienthandler(listener.accept()).start(); } catch(exception ex) { ex.printstacktrace(); } } } else { seek { listener.close(); } catch(exception ex) { ex.printstacktrace(); } btnserverrunner....

catalog - Magento - product that are not for sale -

catalog - Magento - product that are not for sale - does know how list products in magento not sale? still want items appear in store, "add cart" function disabled. seems easy set up, haven't been able figure out. in advance! set stock level 0 , disable backorders. magento catalog products

unc - Set JFileChooser current dir to remote dir -

unc - Set JFileChooser current dir to remote dir - i have set current dir in jfilechooser remote dir(windows share), doesn't work. jfilechooser chooser = new jfilechooser(); chooser.setcurrentdirectory(new file("\\\\192.168.11.11")); chooser.showsavedialog(null); i found bug description: http://bugs.sun.com/view_bug.do;jsessionid=ad25b2513da86b421875051509357?bug_id=6741919, isn't fixed yet. way work around(i can't map dir)? if set file path in constructor so: fc=new jfilechooser("\\\\10.16.7.139\\errorlogs"); it works fine, although seems can't open root of server. if removed \errorlogs portion of string didn't work. jfilechooser unc

hibernate - I know how it looks in SQL, but I need it in HQL and am stuck -

hibernate - I know how it looks in SQL, but I need it in HQL and am stuck - consider have such sql query: select t1.* table1 t1 left bring together table2 t2 on t1.table2_id = t2.id t2.value = 'something' or t1.value = 'something'; i need same thing done in hql query. more info: have classes table1 , table2 both having field named value , table1 having field table2 of class table2. want list of table1 objects have value or it's fellow member table2 has value , know table2 field might null. i have tried formulate question without trying explain every single way tried without success. sorry if not clear. based on description of problem in question, assume have parent class table1 , kid class table2. table1 has fellow member table2 of type table2. in case, believe, appropriate hql should this: from table1 t1 t1.value = 'something' or t1.table2.value = 'something' sql hibernate hql

android - Reliability of C2DM -

android - Reliability of C2DM - i having issues c2dm. works perfectly, messages not pushed. is there reliable way enforce connection? pull messages. read somewhere google maintain low bandwidth tcp connection server @ time. assume when switching between network types tcp connection falls downwards , android tries reestablish connection c2dm servers. might fail on wifi restricted network. is wrong assumption? i have noticed whatsapp on wifi not messages. when switch 3g them @ moment of switch. what tips experience c2dm offer? c2dm not suitable critical parts of application, since google not offer sla or paid tiers guarantee reliable service , throughput. i've considered several alternatives myself: xmpp via asmack, parse, deacon, urban airship, , mqtt. after reading , experimenting decided go mqtt. lightweight telemetry protocol invented @ ibm fits quite nicely in android force notifications scenario. recommend give try, here's nice blog post guide you: usi...

Empty body content on TYPO3 page -

Empty body content on TYPO3 page - encountered issue today made tweaks typo3 page , page became blank. <body> tag empty! i fixed clearing cache, found page same problem later on. doing research found page empty on cache_pages table. what causing it? using typo3 4.5.6 typo3

Type Error in Java 7 -

Type Error in Java 7 - i have dialog box class extends jdialog. 1 method in class this: public char gettype() { homecoming ((string)filetypecombo.getselecteditem()).charat(0); } where filetypecombo this: jcombobox filetypecombo = new jcombobox( new string[] { "local", "shared", "remote" } ); i getting next error when effort compile using java 7: [javac] /home/satin/decodes-8.0/lrgs/gui/netlistdialog.java:112: error: gettype() in netlistdialog cannot override gettype() in window [javac] public char gettype() [javac] ^ [javac] homecoming type char not compatible type it compiles fine java 6. regards. it because of method added window class in java 7. the super class, window , has public window.type gettype() method signature in java 7. attempting override method, returning char instead of window.type object, compilation error occurring. in java 6 method doesn't exist, don't...

ruby - How to split an array into sub-arrays based on integer values -

ruby - How to split an array into sub-arrays based on integer values - i need know how break array sub-arrays based on value of integers in array. i'm trying take big array , break 1-10, 11-20, 21-30...etc , need able count sub arrays have numbers "7 integers between 1-10, 6 integers between 11-20, 12 integers between 21-30." i've got single line random number generator give me array following: rand_num = (array.new(200) {(1..100).to_a[rand(100)]}) this gives me array of 200 hundred random numbers between 1 , 100 , need able split them apart according value , tell how much in each one. then need display numbers. i've searched everywhere , want .partition, can't work. if buckets simple utilize group_by this: array.group_by { |n| (n - 1) / 10 } that give hash this: {0=>[1, 2, 3, ...], 1=>[11, 12, 13, ...], ...} then throw in sort_by forcefulness nice ordering , map summarize results: array.group_by { |n| (n - 1) /...

asp.net - How can i apply and/or remove a CSS class upon user selection on Radiobuttons with JQuery? -

asp.net - How can i apply and/or remove a CSS class upon user selection on Radiobuttons with JQuery? - my aspx markup follows. visitor may select reply choosing "winning question" radiobutton the hiddenfields contain true or false so if user selects rdansbool1 , value of hiddenfield1 "true", jquery should add together "correct" css class parent div id = answer if user selects rdansbool1 , value of hiddenfield1 "false", jquery should add together "wrong" css class parent div id = answer <div id="answer" class="ans"> <div id ="left"> <asp:radiobutton id="rdansbool1" runat="server" text = '<%# databinder.eval(container.dataitem, "ans1") %>' /> <asp:radiobutton id="rdansbool2" runat="server" text = '<%# databinder.eval(container.dataitem, "ans2") %>' /> <asp:hiddenfi...

new operator - Why isn't __new__ in Python new-style classes a class method? -

new operator - Why isn't __new__ in Python new-style classes a class method? - the changelog python 2.2 (where new-style classes introduced) says next __new__ function: __new__ static method, not class method. thought have class method, , that's why added classmethod primitive. unfortunately, class methods, upcalls don't work right in case, had create static method explicit class first argument. however, cannot think of why class methods wouldn't work purpose, , better. why didn't __new__ end class method in end? guido refer when says "upcalls don't work right in case"? __new__ beingness static method allows use-case when create instance of subclass in it: return super(<currentclass>, cls).__new__(subcls, *args, **kwargs) if new class method above written as: return super(<currentclass>, cls).new(*args, **kwargs) and there no place set subcls . i don't see when proper utilize of __new__ , ...

c# - Parsing strings recursively -

c# - Parsing strings recursively - i trying extract info out of string - fortran formatting string specific. string formatted like: f8.3, i5, 3(5x, 2(a20,f10.3)), 'xxx' with formatting fields delimited "," , formatting groups within brackets, number in front end of brackets indicating how many consecutive times formatting pattern repeated. so, string above expands to: f8.3, i5, 5x, a20,f10.3, a20,f10.3, 5x, a20,f10.3, a20,f10.3, 5x, a20,f10.3, a20,f10.3, 'xxx' i trying create in c# expand string conforms pattern. have started going lots of switch , if statements, wondering if not going wrong way? i wondering if regex wizzard thinks regular expressions can in 1 neat-fell swoop? know nil regular expressions, if solve problem considering putting in time larn how utilize them... on other hand if regular expressions can't sort out i'd rather spend time looking @ method. i suggest using recusive method illustration below( no...

jsf 2 - Disable import of Richfaces 4 CSS -

jsf 2 - Disable import of Richfaces 4 CSS - i tried disable skinning of components using richfaces 4 in jsf 2 application. there's web.xml: <context-param> <param-name>org.richfaces.loadstylestrategy</param-name> <param-value>none</param-value> </context-param> <context-param> <param-name>org.richfaces.skin</param-name> <param-value>plain</param-value> </context-param> <context-param> <param-name>org.richfaces.enablecontrolskinning</param-name> <param-value>false</param-value> </context-param> this makes application not skinned richfaces 4 default skin. when add together richfaces component, still gets classes set. possible disable css, without overriding of richfaces css classes ? ok first of org.richfaces.skin rf 3 has been replaced org.richfaces.skin of rf 4 (notice lowercase). secondly org.richfaces.loadstylestrategy not suppor...

struts2 - Struts 2 - Persist property value for redirect action -

struts2 - Struts 2 - Persist property value for redirect action - i want retain property value after redirecting different action. know value go away since navigating different action (request). need how how can accomplish ? here code : <action name="save" class="saveaction" method="savedata"> <result name="success" type="redirectaction">redirectedpageaction</result> <result name="successview" >successview.jsp</result> <result name="error" >error.jsp</result> </action> <action name="redirectedpageaction" class="month" method=""> <result name="success">employeeslist.jsp</result> </action> in save action class using addactionmessage(string msg) method set value. have getter/setter same. i tried didn't success : <action name=...

If I copy, modify, then submit a file in Perforce, will the copy still retain the original's history? -

If I copy, modify, then submit a file in Perforce, will the copy still retain the original's history? - suppose have file a.txt in perforce client workspace, exists on server //depot/a.txt . now, suppose want create re-create of a.txt, phone call b.txt , , create changes b.txt before commit server. might so: p4 integrate a.txt b.txt p4 edit b.txt vim b.txt p4 submit will perforce remember b.txt started out re-create of a.txt? example, if run p4 filelog b.txt , show //depot/b.txt branched //depot/a.txt ? (actually, know answer, not easy figure out without trying completely, p4 's characteristically confusing output. figure i'll inquire question can provide reply record.) the answer, record, yes. remember utilize -i ("inherited history") flag on p4 filelog . perforce

Send SMS from phone with bluetooth and C# -

Send SMS from phone with bluetooth and C# - i want connect pc via bluetooth mobile phone create phone send sms. possible? suggestion apreciated. give thanks you! not sure if can done or not way described, if goal pc send sms, , don't care how done, check out twilio - awesome platform , incredibly easy utilize (and inexpensive boot). c# bluetooth sms

javascript - clickable image with save as option -

javascript - clickable image with save as option - ive got images on website. create functionality if user clicks on image save window appear , 1 can save image. i wrote this: <a href="/foto1.png" target="_blank"> <img src="/foto1.png" alt="" /> </a> and works opens new tab till user clicks save or close save window. possible rid of new tab ? thanks suggestions i alter mark , include images want saved in 1 container, work in ie i'm afraid so: <div id="imagestosave"> <a href="/foto1.png" target="_blank"> <img src="/foto1.png" alt="" /> </a> </div> then jquery utilize code: $('#imagestosave img').click(function(){ document.execcommand('saveas',true,'file.html'); }); for browsers, you'll want think craig stuntz: hyperlinking img file , setting content-type , cont...

java - Eclipse "Set Next Statement" -

java - Eclipse "Set Next Statement" - is there way jump line of code in eclipse java? useful re-running function debug. visual studio's "set next statement" or draggable yellowish arrow? when in debugger select place in stack, right click, , select "drop frame". unwind phone call stack. can on current method (top of phone call stack) unwind top of method. doesn't work time various reasons can pretty often. java eclipse debugging

c# - Mapping a component with a collection of value objects -

c# - Mapping a component with a collection of value objects - how map (using xml-based approach) value object (component) contains iset<string> property? [serializable] public class contact { public iset<string> phonenumbers { get; set; } public string email { get; set; } } thanks! use element . <set name="phonenumbers" table="phone_numbers"> <key column="contact_id"> <element column="phone_number" type="string"/> </set> if you're going utilize phonenumbers property displaying purpose, consider "cheaper" approach serializing data, without separate table , separate query fetch collection. c# nhibernate orm collections value-objects

unit testing - MOQ returning null. [mock concrete class method] -

unit testing - MOQ returning null. [mock concrete class method] - [using moq] i trying mock concrete class , mock virtual method "get()" of class. when testing method "getitemsnotnull()" returned null, instead of homecoming of mocked function. here code //someclasses.cs namespace moqexamples { public abstract class entity { } public class abc : entity { } public interface irepository<t> t : entity { iqueryable<t> get(); } public class repository<t> : irepository<t> t : entity { private readonly isession _session; public repository() { _session = null; } public repository(isession session) { _session = session; } protected isession currentsession { { homecoming _session; } } public virtual iqueryable<t> get() { homecomi...

tsql - What is the 'N' when you are dealing with SQL such as (N'') -

tsql - What is the 'N' when you are dealing with SQL such as (N'') - just in question, not sure difference between '' , n'' in sql. it's shorthand nvarchar . using notation tells parser treat next string info nvarchar instead of default varchar . example: select n'this test'; -- nvarchar info select 'test test'; -- varchar info sql tsql

return - c# - Returning Method Results -

return - c# - Returning Method Results - i new c# programming , trying improve skills using seek grab blocks , improve error handling. i have class performs mutual task, in case retrieving facebook accesstoken. if successful, want homecoming accesstoken string, if not want homecoming error message. these both strings, no problem. when checking homecoming value on calling side of code, how can effectively? it's need homecoming 2 values. in case of successful attempt, homecoming = true, "acesscodeacxdjgkeidj", or if fails, homecoming = false, "ooops, there error" + ex.tostring(); then checking homecoming value easy (in theory). think of returning true/false homecoming , setting session variable strings...but not sure best method. can point me in right direction? best way accomplish this? i'm sure missing elementary. thanks in advance! chad create result class , homecoming instead... public class result { public bool su...

javascript - var x = x || "default val" not getting set properly if x is defined above it -

javascript - var x = x || "default val" not getting set properly if x is defined above it - html: <script type="text/javascript"> var x = "overriden"; </script> <script src="myjs.js"></script> myjs.js: $(document).ready(function(){ var x = x || "default val"; alert(x); // alerts "default val" , not "overriden" }); for reason, x ending "default val" , not "overriden" , tho i'm setting "overriden" before include script reference myjs.js. any thought why happening? i'm trying enable hosting page set override variable that's used in included js file, otherwise utilize default val. what have after variable declaration hoisting applied: var x; x = 5; $(document).ready(function(){ var x; x = x || "default"; }); it looks @ closest x , sees it's value undefined falsy value, x gets set "d...

python - Cannot import module -

python - Cannot import module - i have created python web app directory structure: # cd /usr/local/www/myapp modules layout __init__.py layout.py packages public myapp.wsgi i have set pythonpath to: /usr/local/www/myapp/modules:/usr/local/www/myapp/packages in myapp.wsgi seek do: import layout but getting internal server error. why? this myapp.wsgi (if remove import layout line, works): import sys import wsgiref import layout def application(environ, start_response): response_status = '200 ok' response_body = 'hello! ' response_headers = [] content_type = ('content-type', 'text-plain') content_length = ('content-length', str(len(response_body))) response_headers.append(content_type) response_headers.append(content_length) start_response(response_status, response_headers) homecoming [response_body] full error message ge...

css - small potion of button is working the rest is left unfocussed -

css - small potion of button is working the rest is left unfocussed - our application having 2 types of buttons,"button-primary","button-secondary". rendering style class css have float text align , width setted value size of button big width 110px , x-large width 130px. i made minor changes in css changing "span" in "a" tag #layout-container span.large, .ui-dialog .ui-dialog-content .modal-content span.large{width:110px;} new css #layout-container a.large, .ui-dialog .ui-dialog-content .modal-content a.large{float:left; text-align:center; width:110px;} because able click button in centre had text , rest of button kept idle. changing css , making minor chages on xhtml page little portion of fixed. old xhtml <span class="button-primary x-small"> <h:commandlink id="btnlogin" value=".."> new xhtml <span class="button-primary"> <h:commandlink id="btnlog...

Why can't I use server controls in ASP.net MVC? -

Why can't I use server controls in ASP.net MVC? - i'm getting ready responsible leading development of little asp.net mvc application. first time creating mvc application, excited! i've read on documentation , sense have general thought of how mvc works. however, if understand correctly, server controls (like gridview, instance) not part of mvc. my question is: why? @ development shop, i'm used using controls gridview , ms chart controls i'm @ finish loss developing without them. seems starting over. why server controls unavailable? how microsoft expect me work without them? alternatives? my question is: why? because of them depend on things viewstate , postback models part of classic webforms model , no longer exist in asp.net mvc. server side controls rely on events perform postbacks server persisting state in hidden fields (viewstate). in asp.net mvc no longer work events such button1_click . in asp.net mvc work model, controller...

visual studio 2010 - C++ ToUnicodeEx() not recognizing shift key unless i have a messgaebox() -

visual studio 2010 - C++ ToUnicodeEx() not recognizing shift key unless i have a messgaebox() - im having bit of problem writing keyboard hook in c++. i can read keystrokes im trying using tounicodeex() convert keystrokes when shift key pressed. in code have far have i = tounicodeex(keyboard.vkcode, keyboard.scancode, (pbyte)&keystate, (lpwstr)&keybuff, sizeof(keybuff) / 16, 0,keyboardlayout); messagebox(mainnhwnd,keybuff, l"message", mb_ok | mb_iconexclamation); with 'messagebox' line when press shift+2 2 message boxes pops up, first blank shift key, sec shows '@' character. expected. but if remove messagebox, tounicodeex() function converts keystroke if shift key had not been used. can see either setting breakpoint, nail counter, or outputting character edit box in programme windows. also when include msgbox line , utilize caplock, letters alter accordingly after remove msgbox line uses state of cap lock @ time programme sta...

actionscript 3 - how to develop a p2p video chat using flash media server -

actionscript 3 - how to develop a p2p video chat using flash media server - i develop little p2p chat using flash media sever 4.0. there many p2p video chat samples using cirrus. please help me if know how flash media server,not cirrus. thanks alot. just giving step develop p2p video chat using flash media server 4.0 (or version). first of setup flash media server. start writing client (flash/flex) appliation using actionscript 3.0. put video display command in ui write downwards code connection fms using netconnection class of flash actionscript 3.0 start capturing video web-cam using photographic camera class create netstream class instance , attach photographic camera (web-cam view) strem , video component. start publishing of web-cam view using netstream instance. now set viewo component person cam view. subscribe remote person published live steam display in client application using netstream. , attach subscribed stream sec 1 video component display.... ...