Posts

Showing posts from February, 2012

c# - How do I set certain checkboxes of a checkedcomboboxedit UI item? -

how set checkboxes of checkedcomboboxedit ui item? devexpress. if have drop down of 5 check boxes, , want 2 of checkboxes in drop down checked when form loads, c# code like? once data loaded checkedcomboboxedit need like: checkedcomboboxedit.properties.items[0].checkstate = checkstate.checked; checkedcomboboxedit.properties.items[3].checkstate = checkstate.checked; that mark 1st , 4th items in list checked. related article: checkedlistboxitem.checkstate

Javascript submit does not work at times in chrome -

i have custom dialog box takes user input , submit form based on user input. javascript works fine on ie , firefox. works on chrome @ times @ times there no response. <html> <head> <script type="text/javascript"> window.onblur = function() { window.focus(); } var realtimepolink = "./processabc.do"; var realtimepomethod = "startabc"; var nightlypolink = "./processxyz.do"; var nightlypomethod= "startxyz"; function startpo(){ var historyporadio = document.getelementbyid("nightlyporadio"); if(historyporadio !=null && historyporadio.checked == true){ document.getelementbyid("method").value = nightlypomethod; document.getelementbyid("postartform").action = nightlypolink; } else{ document.getelementbyid("m...

css - Content scrolling on mobile page with fixed header/footer -

hello building mobile webpage content scrolling , footer , header position:fixed - can make content doesn't scroll under header or footer , scrolls in it's own div. the reason why want going have opacity on header , footer , if content gets scrolled under , it's not looking good. heres jsfiddle made show example of scroll http://jsfiddle.net/vnvqs/ here are: http://jsfiddle.net/vnvqs/3/ i removed position: absolute scrolling part ( wrapper , scroll-content ), , added padding wrapper in order let first , last item not being under header , footer. basically, trick done using position: fixed only on header , footer , , let the rest of page scroll normal page , without using overflow: auto on specific fixed-height element. doing way, problem first lines of content under fixed-positioned header (and last ones under footer), can fix applying padding on content wrapper, as header (and footer) height. got it?

asp.net - ForeignKey not being recognised in VS2012 RC -

after lot of yesterday, came against known error in asp.net4 beta - upgraded vs2012 rc express (4.5), , vs reporting 2 errors in model, ok previously: "the type or namespace name 'foreignkeyattribute' not found (are missing using directive or assembly reference?)" "the type or namespace name 'foreignkey' not found (are missing using directive or assembly reference?)" using system; using system.collections.generic; using system.linq; using system.web; using system.componentmodel.dataannotations; using system.data.entity.modelconfiguration.conventions; using system.data.entity; namespace mvcapplication6.models { public class tblrental { [key()] public int rental_id { get; set; } public int room_id { get; set; } public datetime check_in { get; set; } public datetime check_out { get; set; } public decimal room_cost { get; set; } public long customer_ref { get; set; } [...

sencha touch 2 - Nestedlist not showing store data when inside panel -

i'm having problem loading nestedlist data when list shown inside of panel. here code: var titlebar = ext.create("ext.titlebar", { id: 'mainnavigationbar', xtype : 'titlebar', layout: 'hbox', docked: 'top', title : 'csenchatitlebar', items:[ { xtype:"button", text:"menu", align:"left", listeners:{ tap: function(){ nestedlistxx.showby(this); } } }, ] }); var nestedlist = ext.create('ext.nestedlist', { displayfield: 'text', title:"csenchamenu", store: "onavstore", id: 'mainnestedlist', ...

c# - ActiveX control -Single-threaded apartments -

i'd downloaded facebook-csharp-sdk/facebook-winforms-sample project example, this project working when testing, created new project follow exmaple steps. i error message when testing on new project. line : webbrowser1 = new system.windows.forms.webbrowser(); error message : activex control '8856f961-340a-11d0-a96b-00c04fd705a2' cannot instantiated because current thread not in single-threaded apartment.this check whether ur main() function has [stathread] attribute check whether u r using following line inside method called multiple times. line : webbrowser1 = new system.windows.forms.webbrowser();

javascript - Hiding a button in jsp on closing a pop up window using js? -

in jsp on clicking button, showing pop window using javascript. pop contents displayed using 3rd party site. pop having close button , on closing pop up, need hide or not display button in jsp. how handle this? if you're using jquery, can id/class of button , add following js function called button: $("#yourid").hide(); $(".yourclass").hide();

mysql - How should new line and bold/italic characters be stored? -

i want store paragraphs in database. includes bold , italic characters. there datatype in mysql this; or, should store data in varchar column? how should new line , bold/italic characters stored in mysql? you can't have store html code in varchar/text datatype field in mysql , echo without using htmlspecialchars()

javascript - Backbone.js templating requiring invalid html in Phonegap? -

tl;dr : in template file, if don't have invalid html, template won't display in phonegap. the html index looks this: <body onload="onbodyload()"> <div data-role="page"> <a href="#login" id="clickme">click go login</a> </div> </body> my template file (currently) simple: <div data-role='content' id='loginpage'> test </div> the problem is, when try display template using backbone code: var loginpage = backbone.view.extend({ initialize: function(){ this.template = _.template(tpl.get("login")); console.log("got login template"); console.log(this.template); }, render: function(e){ console.log("rendering login page following user"); console.log(this.model); $(this.el).html(this.template(this.model)); this.mainview = new loginview({ el: $("#loginpage...

osx - Call JavaScript from NPAPI plugin, OS X 10.7? -

i'm writing browser plugin os x lion needs able call javascript functions on page. way know how using webkit/npruntime functions npn_invoke . unfortunately, these functions not available 64-bit environment lion. there alternative way call javascript plugin? thanks.

Jquery PHP - How to handle login callback on same page? -

simply, website allows users login. $('#login').click(function() { var user = $('#username').val(); var pass = $('#password').val(); $.post('authorize.php', { username: user, password: pass }, function(data) { //?? }); }); authorize.php verifies credentials assuring proper login. what? use jquery $.show hidden object, or load new content php page $.get or $.load ? i'm uneasy on using $.show because elements loaded dom regardless of proper login. of takes place on same page. of these 2 options better practice? or there another? using ajax request login not practice. anyway there 3 ways: you can add "blank" object dom without first, last names , other dynamic or important information , fill , show user logins. send dom object response authrize.php do not use ajax login :)

e commerce - drupal 6 or 7 with ubercart -

have not done drupal site in year, comfortable in 6 , 7. need ecommerce section in site too. can advise. is d7 live production website. is ubercart more stable in v6 or v7 potential issues analternative drupal based ecommerce solution? i have several stable sites running ubercart drupal 7. settings in ubercart drupal 6 bit more straight forward, once used 7, it's not hard figure out. drupal 7 ubercart pretty comparable drupal 6 offer. thing still issue multiple product imports. no module or combination quite right. lot of things controlled modules before can taken care of actions. i haven't used commerce, understanding works bit more magento. if have white tshirt in 3 sizes, have 3 items 3 skus. in d7 can have 3 skus still contained within same product. in commerce 3 skus need combined product. commerce sounds more promising large stores once it's bit more stable. ubercart stay go under 300 or products, unless great module created importing via excel....

install - Error after reinstall magento extension -

when tried reinstall magento extension, got error: connect error: package community/special_settings failed: no releases 'special_settings', skipping. then magento has turned on maintenance mode (file maintenance.flag root directory of site). google has not answered problem. simply delete file maintenance.flag

asp.net mvc - How to get the textbox values which are generated dynamically using razor? -

<tr> @foreach (string s in "1,2,3,4,5,6,7,8,9,10,11,12,13,14,15".split(',')) { <td>@html.textbox("time","") </td> <p> </p> } </tr> how values textboxes created above using either javascript or jquery. kindly assist me here is: $('input[name=time]').each(function(index, element){ var txtvalue = element.value; });

how to restrict the users to change theme other than site admins using features in share point 2010? -

i new sharepoint 2010. restrict users change theme other site admins using feature in sharepoint 2010. tried below code same. spsecurity.runwithelevatedprivileges(delegate() { spwebapplication webapp = properties.feature.parent spwebapplication; sppolicyrole restrictthemes; //we removing applystylesheets permission , applythemeandborder permission passing //to policyroles. spbasepermissions restrictpermissions = spbasepermissions.applystylesheets | spbasepermissions.applythemeandborder; //we not granting permissions spbasepermissions grantpermissions = new spbasepermissions(); restrictthemes = webapp.policyroles["restrict themes"]; if (restrictthemes == null) { restrictthemes = webapp.policyroles.add("restrict themes", "restricts the...

jquery - Custom Designed Radio Button Inputs Styled with CSS and Voice over accessibility -

for website use custom radio button based on model: http://www.filamentgroup.com/examples/custominput/ it's working different browser , it's accessible jaws. but when try solution voice on can't check radio button. there jquery event allow solution ? regards, boby you can use onclick event : <p onclick="test" id="css">this clickable</p> upon clicking this, execute javascript function named "test" , formatting programmed css id "css". can format , adding onclick tag, can want function. <img src="https://www.google.nl/images/nav_logo195.png" onclick="search" id="css">

javascript - JQuery is adding a class but not removing it from multiple td elements -

i'm trying make more 1 <td> field visible or invisible on screen based on user input , element class. i'm using jquery, html, , javascript. basically, have html table different fields. want these fields have class of either "visible", "visible , required", or "invisible". when user selects option, changes class of element removing previous 1 , adding new one. onload default of these fields should invisible. html: <body onload="showthescreen()"> <table border="1"> <tr> <td class="reasoncode" align="center"> <span class="fieldlabel">reason code</span> </td> <td class="costcenter" align="center"> <span class="fieldlabel">cost center</span> </td> </tr> <tr> <td class="reasoncode" align="center"> <input type="text" id=...

internet explorer - Javascript SDK not working in Facebook Canvas App IE7/8 -

i developing canvas app , got working required in browsers apart ie 7/8 cannot app auto redirect facebook login screen if users not logged facebook. i suspect ie not getting state of users through getloginstatus method , therefore cannot fire javascript redirect, , because of remove app functionality not working. i have ran code through online js lint tool , have tidied few things , tried again having no luck if try outside of facebook e.g https://mydomain.com/directory , js sdk works , redirects facebook login page not same within facebook iframe i have noticed within facebook iframe system cannot browser mode , uncertain whether have bearing here complete code $(document).ready( function() { //facebook js sdk window.fbasyncinit = function () { fb.init({ appid: 'xxxxxxxxxxxxxxxxx', channelurl: '//www.mydomain.co.uk/facebook-notes/channel.html', // channel file cookie: true, xfbml: true, oauth: true, ...

python - Readline and threading -

so run code below, , when use queue.qsize() after run it, there still 450,000 or items in queue, implying lines of text file not read. idea going on here? from queue import queue threading import thread lines = 660918 #int(str.split(os.popen('wc -l hgdp_finalreport_forward.txt').read())[0]) -1 queue = queue() file = 'hgdp_finalreport_forward.txt' num_threads =10 short_file = open(file) class worker(thread): def __init__(self,queue): thread.__init__(self) self.queue = queue def run(self): while true: try: self.queue.get() = short_file.readline() self.queue.task_done() #signal queue task done except: break ## should make call threads def main(): in range(num_threads): worker(queue).start() queue.join() in range(lines): # put range of number of lines in .txt file queue.put(...

Silverlight and WCF -

i have wcf querying table, 1 record have showing in datagrid. how set columns values of 1 record variables , have variables available rest of silverlight app? what trying do: have wcf query sql table set results variables have chart react variables please help!!!! your wcf call should return type current datagrid binding too. can use same type pass chart. in other words, don't have read values out of datagrid, have values there datagrid being populated from.

java - How do I datamine financial tables using Htmlunit? -

using java/htmlunit want data mine (web scrape) bunch of hedge fund sec 13f filings. have no clue how datamine sec's .txt files such this table . table layout seems clean , structured, how grab < table > corresponding < s > , < c > ? moreover, how can grab company names , < c > value (in column 3) , < c > shares amt (in column 4). not sure if i'm on right track, used bufferedreader, not sure next grab data within < table > ... here's have far: import java.io.bufferedreader; import java.io.ioexception; import java.io.inputstreamreader; import java.net.malformedurlexception; import java.net.url; public class bufferedreaderexample { public static void main(string[] args) { try { // create url desired page url url = new url("http://www.sec.gov/archives/edgar/data/1047644/000104746912006072/a2209520z13f-hr.txt"); bufferedreader in = new bufferedreader(new inputstreamreader(url.openstream()...

javascript - My jQuery function is loads an HTML, but that HTML does not load a different jQuery selector from a different function (from flowplayer) -

my jquery function loads html, html not load different jquery selector different function (from flowplayer) flowplayer("player", {src: "http://releases.flowplayer.org/swf/flowplayer-3.2.7.swf", cachebusting: true, wmode: "transparent"}); $('#options li a').click( function (evt){ evt.preventdefault(); $('#options li').removeclass('current'); $(this).parent('li').addclass('current'); var rackvideo = $(this).attr('href'); //jquery pulls info link var rackoutput = '<a href="http://c3426439.r39.cf0.rackcdn.com/pritchett/'+ rackvideo +'" id="player" style="display:block;width:348x;height:216px; display:block;">'+ '<img src="http://www.p2ortho.com/wp-content/uploads/2010/10/intro-thumb.jpg" alt="introduction video" title="introduction video" width="348" height=...

ios - Call method when user changes focus from on textfield to another (RubyMotion) -

i'm using rubymotion (had been writing obj c in xcode i'm collaborating wants use rubymotion due bkgd in ruby) i have viewcontroller 2 textfields. need have whenever user switches being in textfield1 textfield2 if condition of textfield1 isn't met, error label shows (i use self.errorlabel.show this). know how write condition statements not know how know when user switches next textfield. i thought use: if ([textfield1 isfirstresponder] && (textfield1 != touch.view)) log( 'left textfield1' ) end if ([textfield2 isfirstresponder] && (textfield2 != touch.view)) log( 'left textfield2' ) end from question detect uitextfield lost focus no such luck. know i'm using rubymotion there differences. how work? don't think i'm searching right keywords because seems developers use time yet i'm not finding results. thank available. update: thinking using method: - (void)textfielddidendediting:(uitextfield *)te...

javascript - Compare 2 arrays which returns difference -

what's fastest/best way compare 2 arrays , return difference? array_diff in php. there easy function or going have create 1 via each() ? or foreach loop? working demo http://jsfiddle.net/u9xes/ good link (jquery documentation): http://docs.jquery.com/main_page {you can search or read apis here} hope if looking in jquery. the alert in end prompts array of uncommon element array i.e. difference between 2 array. please lemme know if missed anything, cheers! code var array1 = [1, 2, 3, 4, 5, 6]; var array2 = [1, 2, 3, 4, 5, 6, 7, 8, 9]; var difference = []; jquery.grep(array2, function(el) { if (jquery.inarray(el, array1) == -1) difference.push(el); }); alert(" difference " + difference);​ // changed variable name

spring mvc - Do AOP violate layered architecture for enterprise apps? -

the question(as stated in title) comes me looking @ spring mvc 3.1 annotation support , considering ddd upcoming project. in new spring pojo business methods can annotated act controller, concerns have addressed within controller class can expressed exclusively through annotations. so, technically can take class , wire act controller , java code free controller specific code, hence java code deal things checking security , starting txn etc. such class belong presentation or application layer ?? taking argument further , can pull out things security, txn mgmt , express them through annotations , java code of domain object. mean have fused 2 layers? please clarify you can't take pojo , make controller. controller's job inputs browser, call services, prepare model view, , return view dispatch to. it's still controller. instead of configuring through xml , method overrides, configure through annotations, that's all. the code far being free controller spe...

java - Deselecting a table row in PrimeFaces -

i have table this: <p:datatable id="table" selectionmode="single"> ... <p:ajax event="rowselect" listener="#{mybean.onrowselect}" update="somestuff"/> <p:ajax event="rowunselect" listener="#{mybean.onrowunselect}" update="otherstuff"/> </p:datatable> does know how trigger rowunselect event on ui ? another thing, possible values of selectionmode attribute ? don't seem in documentation. thanks, to trigger rowunselect, once row selected, hold control key , click on row again. way row gets unselected, , ajax event executed. possibles values selectionmode attribute "single" , "multiple".

javascript - Getting a label's value using select's name tag -

i have system can output 0 or more select boxes , need add javascript/jquery validation. new writing jquery , stuck getting content of text label error message: here example of select boxes form: <div id="prodoptions" class="sale"> <p class="eleventext floatleft">product options</p> <div class="floatleft"><label for="colour">select colour</label> <select name="colour"> <option value="" selected="selected">---</option> <option value="blue">blue</option> </select> </div> <div class="floatleft"> <label for="size">select size</label> <select name="size"> <option value="" selected="selected">---</option> <option value="small">small</option> </select>...

Jquery mobile, implement popup with numeric input, plus/minus buttons -

i trying create popup dialog box user can input amount of x (numeric), plus , minus button. after long, unsuccessful, search exist solution. i use jquery.mobile.simpledialog2.min.js. --------- code: ------------------ <script type="text/javascript"> $(document).delegate('#inliner', 'click', function() { $('#inlinecontent').simpledialog2(); }); $(document).delegate('#amount_plus', 'click', function() { x = $('#prod_amount_input').val(); x = eval(x)+1; $('#prod_amount_input').val(x); //$('#prod_amount_input').textinput('refresh'); //$('#prod_amount_input_div').textinput('refresh'); //$('#prod_amount_input').trigger('create'); //$('#prod_amount_input_div').trigger('create'); alert($('#prod_amount_input').val()); }); $(document).delegate(...

linux - How can I get perf to find symbols in my program -

when using perf report , don't see symbols program, instead output this: $ perf record /path/to/racket ints.rkt 10000 $ perf report --stdio # overhead command shared object symbol # ........ ........ ................. ...... # 70.06% ints.rkt [unknown] [.] 0x5f99b8 26.28% ints.rkt [kernel.kallsyms] [k] 0xffffffff8103d0ca 3.66% ints.rkt perf-32046.map [.] 0x7f1d9be46650 which uninformative. the relevant program built debugging symbols, , sysprof tool shows appropriate symbols, zoom, think using perf under hood. note on x86-64, binary compiled -fomit-frame-pointer , that's case when running under other tools well. this post on year old, since came out @ top of google search results when had same problem, thought i'd answer here. after more searching around, found answer given in related stackoverflow question helpful. on ubuntu raring system, ended doing following: compile c++ sources -g (f...

Running python script from php -

i trying run python script php. exec("../cgi-bin/form.py", $output); var_dump($output); i'm path correct, , form.py executable. this form.py #!/usr/bin/env python print "in form.py' however, prints out null. don't think script being executed. how make sure is? you're literally typing in location of file. need tell exec execute python script. exec("python ../cgi-bin/form.py", $output);

sql - MySQL CASE when SELECT -

i have following query: select case when `def_spell`.`type` = 0 `spells_damage`.* when `def_spell`.`type` = 1 `spells_weaken`.* end `def_spell` left join `spells_damage` on `def_spell`.`id` = `spells_damage`.`spell_id` left join `spells_weaken` on `def_spell`.`id` = `spells_weaken`.`spell_id` `def_spell`.`id` = 1; hopefully makes sense... i'm trying select spells_damage providing type 0 , spells_weaken providing type 1. i'd select def_spell regardless. can please fix query? i've never used cases before , not sure how to. you can't use case choose between output of 2 tables that. unfortunately, that's easy bit; working out (a) you're trying , (b) achieving equivalent result going take little longer. it easier if gave information columns in spells_weaken , spells_damage table. presumably, there differences; otherwise, you'd have single table. indeed, single spells table might still better design. let...

java - How can I check keyboard for a single press? -

i can't figure how condition work. there keyboard.iskeydown(//anykey) condition? import org.lwjgl.input.keyboard; import org.lwjgl.input.mouse; public class inputhandler { public static boolean currentkeystate, previouskeystate; public static void update() { previouskeystate = currentkeystate; if (//condition keydown) { currentkeystate = true; } else { currentkeystate = false; } } public static boolean keyreleased() { if (currentkeystate == true && previouskeystate == false) { return true; } else { return false; } } } here's c# version of i'm trying accomplish. there method similar keyboard.getstate() in java? using system; using system.collections.generic; using system.linq; using microsoft.xna.framework; using microsoft.xna.framework.input; namespace game.controls { public class inputhandler { public keyboardstate cu...

iphone - How to READ/PARSE the PDF contents loaded in an UIWEBVIEW -

assume situation, have uiwebview , signed in gmail account, have received e-mail attached pdf file. clicking on attachment link webview open pdf file there itself. at time if trying read html contents returns null . please me giving idea. how read/parse pdf content loaded in webview , store data nsstring . if have url pdf file directly load url in webview otherwise have use nsurlrequest download file , load file local directory of application. shall glad provide code of loading pdf file local directory suggest google it.

What is the best way to save/load img/file(word,excel etc.) in php/asp.net application? -

i'm student , aspire become great web developer :) i want work on 'practice' projects capable of storing/retrieving images or type of file(.doc,.xcl,.txt, etc.). saying it's better store img/any file in file system opposed saving inside database. i know pros , cons of both side. i know what's best data type storing imgs/files in mysql (i'm using longblob php-mysql) for saving imgs i know what's best data type storing imgs/files in sql server (i'm using asp.net varbinary(max) sql server 2008) for saving imgs lastly,i'm curious on how websites facebook , other big web applications store imgs , files. sir/ma'am, answers of great , appreciated. thank you++ pros: storing in database files saved "forever" can restrict access real file more easily you can, technically, check duplicate files. you not keeping files on drive, can faster access server less files on server considered "better" , more organ...

Conversion of bitmap into jpeg in android -

is there way convert android.graphics.bitmap instance jpeg in android? try compress method like: bitmap.compress(bitmap.compressformat.jpeg, quality, outstream); here sample program : compressing-a-bitmap-to-jpg-format-android-example

for loop - What is the difference between :while and :when in clojure? -

i'm studying clojure not quite clear on difference between :while , :when test: => (for [x [1 2 3] y [1 2 3] :while (= (mod x y) 0)] [x y]) ([1 1] [2 1] [2 2] [3 1]) => (for [x [1 2 3] y [1 2 3] :when (= (mod x y) 0)] [x y]) ([1 1] [2 1] [2 2] [3 1] [3 3]) can elaborating on them ? :when iterates on bindings, evaluates body of loop when condition true. :while iterates on bindings , evaluates body until condition false: (for [x (range 20) :when (not= x 10)] x) ; =>(0 1 2 3 4 5 6 7 8 9 11 12 13 14 15 16 17 18 19) (for [x (range 20) :while (not= x 10)] x) ; => (0 1 2 3 4 5 6 7 8 9)

Wordpress MU, can't access /wp-admin -

i've set mu install 2 domains, using wordpress mu domain mapping-plugin. the system first configured subdomain d2.domain1.com (under sitesand mapped domain2.com d2.domain1.com the following settings in domain mapping checked: remote login, permanent redirect, user domain mapping page, redirect administration pages site's original domain my problem can't access admin domain2.com/wp-admin - gives me error: now domain mapping plugin works if site installed in /. limitation of how virtual servers work , difficult work around. but wordpress installed in /. relevant wp-config below: define( 'multisite', true ); define( 'subdomain_install', true ); // $base = '/'; define( 'domain_current_site', 'domain1.com' ); define( 'path_current_site', '/' ); define( 'site_id_current...

nullpointerexception - Android PreferenceManager NullPointException -

i'm struggling understand why i'm getting null point exception when using preferencemanager. i'm using button within current activity call activity named location /** location selection */ blocation = (button) findviewbyid(r.id.blocation); blocation.setonclicklistener(new view.onclicklistener() { public void onclick(view v) { loc = new location(); loc.locationselection(); } }); // button above calls class below public class location extends activity { networkconnection nc; sharedpreferences prefs; sharedpreferences sharedprefs; networkconnection netconnect; options opts; public void locationselection(){ try{ sharedprefs = preferencemanager.getdefaultsharedpreferences(getapplicationcontext()); if (sharedprefs.contains("location")){ log.d("if", "if"); }else{ log.d("if...

android - ScrollView how to scroll to bottom of another view -

how can scroll linearlayout in scrollview bottom of view? i have calendar imageview @ top of view. underneath there scrollview contain list of events month. scrollview contains several linearlayouts detail events month. when user selects event touching button in linear layout re-position current linearlayout top of scrollview, how can accomplish this? below brief snippet of layout looks brevity. <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/cirlinlaycontainer" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@drawable/bg_calendar"> <relativelayout> <button android:id="@+id/calleft" ...

web services - Options for In-memory databases (Open source and Java-based) -

i've web app makes external web service calls on behalf of it's clients. want cache data returns web services in web app other clients can reuse data , run filters , queries on cached data. the current architecture of web app uses apache camel, spring , jetty. i'm looking options (pros/cons) of in-memory database options. hazelcast (java api) - can distribute in-memory datagrid (with map, multimap, sets, lists, queues, topics) on multiple nodes & use load/store interface implementation disk based db. can similar ehcache. redis option (use java client access it). can configure conf file write data disk (or avoid altogether) & should not have write own load/store classes. besides these, there number of options use. not sure if looking @ open source options, looking @ distributed options or not. hope helps.

ruby on rails 3.1 - two simple forms, why I can't submit the one I want? -

the 2 simple forms have looks this: = simple_form_for(@class_room, :html=>{:id=>'class_room_form'}) |class_room_form| and = simple_form_for(@lesson, :html => {:id=>'lesson_form'}) |lesson_form| now, although submitting form of id lesson_form, form id class_room_form submitted instead! idea ? here how submit lesson_form form: :javascript $('#submit_lesson_button').bind('click', function() { $("#lesson_form").trigger('submit'); }); here how submit other form ( 1 still submitted regardlessly ) :javascript $('#submit_button').bind('click', function() { $('#sidenav a:first').tab('show'); $('#class_room_form').trigger('submit'); }); you see, each form different ids, , targeting different ids jquery, wrong ?? notice form lesson_form contained within form class_room_form you're not supposed have form contained form. if can ...

python - Can a URL be opened with a limit on the number of lines returned using urllib2? -

i know might sound ridiculous, possible use urllib2 open url, set number of lines returned? the reason reduce load time, large pages working with. example, page: 1. <html> 2. <head> 3. <title>hello!</title> 4. </head> 5. <body> 6. <p>hi there.</p> 7. </body> 8. </html> say open page line 5, , printing once has been read, give me: 1. <html> 2. <head> 3. <title>hello!</title> 4. </head> 5. <body> is possible @ all? sure is, can use readline() instead of read() import urllib2 req = urllib2.request('http://www.python.org') response = urllib2.urlopen(req) lines = "" x in range(10): lines += response.readline() print(lines)

codeigniter - PHP memcached wont connect but no error in log files or on screen -

i cant not codeigniter speak external memcached server. i'm running memcached -vvv flag, when using memcached via php normally, works fine (thank zerkms). when try set/get values via codeigniter, not connect remove server, no errors @ all. memached.php config file <?php $config['memcached'] = array( 'server_1' => array( 'host' => 'xx.xx.xx.xx', 'port' => 11211, 'weight' => 1 ) ); ?> code being run: $this->load->driver('cache', array('adapter' => 'memcached', 'backup' => 'file')); $userid = '1'; $key = 'user_products_'.$userid; $results = $this->cache->memcached->get($key); if($results == null) { $qry = $this->db->query("select * products user_id=$userid"); $results = $qry->result_array(); $this->cache->memcached->save($key,$results,'60'); }...

c++ - Multithread webservice? -

i need write program calculation intensive. need load data database memory before calculation (to save time fetching data database each time. i want program webservice, , want many clients able run multiple calcuations @ same time. since load data takes quite memory, want calculations sharing same data(global data). however, if 2 users call loading same data @ same time, there synchronization issue, when 1 loading data, , 2nd begin load same data again. do need thread lock this? webservice mean multi-thread programming? plan use wws(windows web service), since c++ programmer, handled pure algorithms before, new me. sorry if confuse you. thank much. if able distinguish each client reliably, can create context each one, , context may expire if client disconnects or remains idle specified amount of time. additionally, if want allow each client multiple "calculation requests" simultaneously, need unique way identify each of these requests, , keep track ...

qt - qdatawidgetmapper for displaying qicons? -

i'm trying create widget allows me display properties of given tool. have model containing tools, , create combobox allows select 1 tool , tools properties displayed using icons. my model has defined different roles e.g. decoration , display role, i'm wondering how build widget reacts on decoration role of model. thanks lot in advance donny try qlabel specifically mapping pixmap property: mymapper.addmapping(mylabel, itssection, "pixmap")

javascript - How to make work the jquery nested tab link? -

i having problem jquery tabs ui. <script type="text/javascript"> $(document).ready(function() { $('.tabs').tabs(); $('.subtabs').tabs(); }); <div class="tabs"> <ul> <li><a href="#tab1">tab1</a></li> <li><a href="#tab2">tab2</a></li> </ul> <div id="tab1"> <div class="subtabs"> <ul> <li><a href="#subtab1">subtab1</a></li> <li><a href="#subtab2">subtab2</a></li> </ul> <div id="subtab1"> content1 </div> <div id="subtab2"> content2 </div> </div> </div> <div id=...

mysql - Using an alias within a join -

i'm trying use sql alias within left join. while using alias in join, error 'unknown a_alias column in on clause' point me in right direction? select a_alias table_a left join table_b on a_alias = b cheers you can't use alias in or join hasn't been evaluated yet. they're available in aggregates , group by/order by/having clauses iirc.

multithreading - Java Synchronization Not Working as Expected -

i have "simple" 4 class example reliably shows unexpected behavior java synchronization on multiple machines. can read below, given contract of java sychronized keyword, broke synchronization should never printed class testbuffer. here 4 classes reproduce issue (at least me). i'm not interested in how fix broken example, rather why breaks in first place. sync issue - controller.java sync issue - synctest.java sync issue - testbuffer.java sync issue - tuple3f.java and here output when run it: java -cp . synctest before adding creating testbuffer before remove broke synchronization 1365192 broke synchronization 1365193 broke synchronization 1365194 broke synchronization 1365195 broke synchronization 1365196 done update: @gray has simplest example breaks far. example can found here: strange jrc race condition based on feedback i've gotten others, looks issue may occur on java 64-bit 1.6.0_20-1.6.0_31 (unsure newer 1.6.0's) on windows , os...

javascript - Nested asynchronous calls do not seem to execute as expected -

while trying out jquery, have question newbie mistake, cannot seem find solution. code: $.get("index.html", function() { var = 0; (; < 3; i++) { var ldiv = document.createelement('div'); ldiv.id = 'body-' + i; document.getelementbyid('body').appendchild(ldiv); $.get('index.html', function(data) { ldiv.innerhtml = "<p>hello world " + + "</p>"; }); } }); the output seems be <div id='body-0'></div> <div id='body-1'></div> <div id='body-2'> <p>hello world 3</p> </div> i expected ldiv.innerhtml= code executed each i, apparently executed last i? overlooking? this happens because loop completes ( i 2) before of callbacks fired. @thecodeparadox's solution works, serializes http requests. (makes them fire one-at-a-time.) allows requests execute i...

fortran - Hide full path in gfortran run-time error messages -

i using gfortran compile big program dozen of modules. whenever there error in code program generates error message line number error has happened , full path of module line belongs to. example: at line 1775 of file c:\temp\test.f90 (unit = 200, file=' ') fortran run time error: file '*' not exist my question how stop program listing full path of offending module , rather make report module name error has happened. gfortran embeds path used access source file during compilation phase. e.g. if compile full path file full path in debug output. if compile relative path relative path in output: ~/tests[520]$ gfortran -o test.x test.f90 ~/tests[521]$ test.x @ line 3 of file test.f90 (unit = 200, file = '') fortran runtime error: file '' not exist ~/tests[522]$ gfortran -o test.x ./test.f90 ~/tests[523]$ test.x @ line 3 of file ./test.f90 (unit = 200, file = '') fortran runtime error: file '' not exist ~/tests[524]$ gfortr...

fonts - Image watermarking algorithm -

Image
i want join image text in 'disneyland paris ticket on site : (which given alphabet 'a'). there mickey picture , many of tiling name on it. is there know how implement this? algorithm i've used?

How to send 2 dimensional array from php to android -

i want send result proccess in php android want display result in emulator.. but cant send result php android cz result array 2dimension 1 2 3 4 5 6 7 8 9 10 11 12 how parse result in android? i use json_encode() in php, , decode in android.

mysql - Altering the data type of a column in a HUGE table. Performance issues -

i want run on table: alter table table_name modify col_name varchar(255) but table huge, has more 65m (65 million) rows. when execute, takes 50mins execute command. better way alter table? well, need alter table table_name change col_name new_name varchar(255) but, right, takes while make change. there isn't faster way change table in mysql. is concern downtime during change? if so, here's possible approach: copy table new one, change column name on copy, rename copy. you have figured out routinely changing column names in tables in production system not idea.

Haskell Alex - regex matches wrong string? -

i'm trying write lexer indentation-based grammar , i'm having trouble matching indentation. here's code: { module lexer ( main ) import system.io.unsafe } %wrapper "monaduserstate" $whitespace = [\ \t\b] $digit = 0-9 -- digits $alpha = [a-za-z] $letter = [a-za-z] -- alphabetic characters $ident = [$letter $digit _] -- identifier character $indent = [\ \t] @number = [$digit]+ @identifier = $alpha($alpha|_|$digit)* error:- @identifier { mkl lvarid } \n $whitespace* \n { skip } \n $whitespace* { setindent } $whitespace+ { skip } { data lexeme = lexeme alexposn lexemeclass (maybe string) instance show lexeme show (lexeme _ leof _) = " lexeme eof" show (lexeme p cl mbs) = " lexeme class=" ++ show cl ++ showap p ++ showst mbs showap pp = " posn=" ++ show...