Posts

Showing posts from May, 2014

javascript - Multiple popup window layers position in CSS -

Image
hi have jquery popup window has 3 layers image below. i'm trying make window3 centered overlaps window2. reason, window3 stays @ top-left corner image. tried many different ways(padding, margin, z-index, position..) no matter do, window3 won't centered. maybe missed , hope other ideas. didn't post html since contains 3 windows div tags bunch data-fields generated javascript below. function( contenturl, container, theight, twidth, controller, param ){ if( container === "dialog" ){ var mask = '<div class="mask"></div>'; var window3 = '<div class="window3"></div>'; $(mask).appendto('body'); $(window3).appendto('body'); style.css .mask { position: fixed; left: 0; top: 0; width: 100%; height: 100%; background: #000000; opacity: 0.7;

html - Javascript, accessing nested frames in framesets from a iFrame -

i'm having issues accessing frame part of page loaded iframe. frame nested in multiple framesets. my html looks this: <iframe name="sourceframe" src="siteindex.html"> #document <-- appears in dom tree. not sure if it's relevant. <html> <head></head> <frameset> ...other frames <frameset> <frame name="targetframe" src="sitesubpage.html"> ...i want access frame , replace contents different html page... </frame> </frameset> </frameset> </html> </iframe> i have read similar questions none of have solution can work. any suggestions appreciated. window.frames['sourceframe'].frames['targetframe'].location.href = 'new_html_page'; ff , chrome have frames collect

SQL Server - Composite key creation -

i'm trying create composite primary key this: create table tablea (column1 nvarchar(50) not null, column2 nvarchar(3) not null, column3 nvarchar(50) not null) alter table tablea add constraint pk_auxgroupdata primary key clustered (column1 , column2) by reason, second query generating following exception: system.data.sqlserverce.sqlceexception occurred message= the constraint specified not valid . source=sql server compact ado.net data provider hresult=-2147217900 nativeerror=25505 this happens when run project microsoft visual studio 2010 in debug mode. my development machine has: microsoft sql server 2008 compact 3.5 sp2 enu microsoft sql server 2008 compact 3.5 sp2 x64 enu any please? unfortunately, sql server compact edition not support clustered indexes. goes primary key well. link showing not support clustered indexes: - http://technet.microsoft.com/en-us/library/ms345331(v=sql.105).aspx link showing primary keys maintain

Getting multiple matches within a string using regex in Perl -

after having read this similar question , having tried code several times, keep on getting same undesired output. let's assume string i'm searching "i saw wilma yesterday". regex should capture each word followed 'a' , optional 5 following characters or spaces. the code wrote following: $_ = "i saw wilma yesterday"; if (@m = /(\w+)a(.{5,})?/g){ print "found " . @m . " matches\n"; foreach(@m){ print "\t\"$_\"\n"; } } however, kept on getting following output: found 2 matches "s" "w wilma yesterday" while expected following one: found 3 matches: "saw wil" "wilma yest" "yesterday" until found out return values inside @m $1 , $2 , can notice. now, since /g flag on, , don't think problem regex, how desired output? you can try pattern allows overlapped results: (?=\b(\w+a.{1,5})) or

matrix - webgl - model coordinates to screen coordinates -

im having issue calculating screen coordinates of vertex. not webgl issue, more of general 3d graphics issue. the sequence of matrix transformations im using is: result_vec4 = perspective_matrix * camera_matrix * model_matrix * vertex_coords_vec4 model_matrix being transformation of vertex in local coordinate system global scene coord system. understanding final result_vec4 in clip space? should in [-1,1] range. not im getting... result_vec4 ends containing standard values coords, not corresponding correct screen position of vertex. does have ideas might issue here? thank thoughts. to go in clip space need project result_vec4 on hyperplane w=1 using: result_vec4 /= result_vec4.w by applying perspective division result_vec4.xyz in [-1,1].

php - Avoiding Duplicate Inserts into Database -

i wanna avoid duplicate reservation has same date , spot . how go doing if possible. wanna make sure no 2 customers can make reservation same spot on same day . // insert data mysql $sql="insert $tbl_name(confirmation, fname, lname, gname, license, floor, spot ) values('$confirm_code', '$fname', '$lname', '$gname', '$license', '$floor', '$spot')"; $result=mysql_query($sql); if (mysql_errno() == 1062) to prevent duplicate entries use unique index . defining multiple rows can can control reservations. adding day column can - create unique index spot on table_name (spot, day) this allow 1 reservation per day per spot.

ajax jquery response in submit form -

i making phonegap application in use jquery ajax send data server , in response sending message . when run on phonegap give error message . code <!doctype html> <html> <head> <title>-</title> <script type="text/javascript" charset="utf-8" src="cordova.js"> </script> <script type="text/javascript" src="jquery-2.0.3.min.js"></script> <script> function validation2() { alert('validation'); alert("login"); var server_url ="http://dealsscanner.com/labourapp/login_check.php"; /* stop form submitting */ //event.preventdefault(); /*clear result div*/ /* values elements on page: */ //var values = $(this).serialize(); var values = { a1984 : 1, a9873 : 5, a1674 : 2, a8724 : 1, a3574 : 3, a1165 : 5 } /* send data using post , put results in div */ $.aj

ios - 2 problems with dealing with UITextField behind Keyboard -

i have uitextfield in uitableviewcell in view. there possibility uitextfield can behind keyboard deal using following 2 methods. 1 when keyboard clicked , other when dismissed: - (void)keyboardnotification:(nsnotification*)notification { cgsize keyboardsize = [[[notification userinfo] objectforkey:uikeyboardframebeginuserinfokey] cgrectvalue].size; customcell *cell = (customcell*)[[temptextfield superview] superview]; cgrect textfieldrect = [cell convertrect:temptextfield.frame toview:self.view]; if (textfieldrect.origin.y + textfieldrect.size.height >= [uiscreen mainscreen].bounds.size.height - keyboardsize.height) { thetableview.contentinset = uiedgeinsetsmake(0, 0, keyboardsize.height, 0); nsindexpath *pathofthecell = [thetableview indexpathforcell:cell]; [thetableview scrolltorowatindexpath:[nsindexpath indexpathforrow:pathofthecell.row insection:0] atscrollposition:uitableviewscrollpositiontop animated:yes]; } } - (void)keybo

c# - Displaying Different Screens in XNA? -

recently started working xna (coming java) , run problem displaying game screens. when loading xna given game.cs class interpreted set functions drawing single self-contained screen in game. typing code different screens single class messy created below class handle changes: using system; using system.collections.generic; using system.linq; using system.text; using system.threading; namespace colonies { public class gamemanager //manages game screens { microsoft.xna.framework.game currentscreen; public enum screens { menu, game, summary }; public gamemanager() { initialize(); } public void initialize() { currentscreen = new menu(this); ((menu)currentscreen).run(); } public void changescreen(int i) { switch (i) { case 0: currentscreen = new menu(this); ((menu)currentscreen).

save - I need some help on saving pictures to android in a dynamic folder -

this current code: http://pastebin.com/yfav45bd i want able save "bldg front(before).jpg" in specific folder lets "day1" example name of folder. right scattered in public folder(the .jpg's files) file picturesdirectory = environment.getexternalstoragepublicdirectory(environment.directory_pictures); ..... ..... private file imagefile; ....... ....... ....... switch (v.getid()) { case r.id.gcpic1: imagefile = new file(picturesdirectory, "bldg front(before).jpg"); intent intent1 = new intent(android.provider.mediastore.action_image_capture); intent1.putextra(mediastore.extra_output, uri.fromfile(imagefile)); startactivityforresult(intent1, 1);break; case r.id.gcpic2: i want simple "addtional code" this, add have. if want save there, maybe help: http://developer.android.com/guide/topics/data/data-storage.html directory created there: file dir = this.getdir("name", context.mod

qt5 - Using setCellWidget to insert a QTextEdit into a QTableWidget loses keyboard and mouse events -

i trying insert pretty, html text qtablewidget cells using setcellwidget , qtextedit objects. works great, table doesn't mouse clicks (for selection, etc.) or keypresses (for selection, navigation, etc.). here how i'm setting cells: ui.mytablewidget->insertrow(rowcount); qtablewidgetitem *srcitem = new qtablewidgetitem(); ui.mytablewidget->setitem(rowcount, 0, srcitem); qtextedit *text = new qtextedit(); text->inserthtml( _gethtml() ); text->setframestyle( qframe::noframe ); text->setreadonly( true ); ui.mytablewidget->setcellwidget( rowcount, 0, text ); thanks suggestions. i solved problem creating delegate , painting cell myself. used qtextdocument object painting. i referenced example on delegates: http://doc.qt.io/qt-5/qtwidgets-itemviews-stardelegate-example.html

html - Appending string with variable in PHP and looping -

i calling variables mysql database , comparing them variables being posted via html form previous page. correct answers , given answers. my current structure looks this: if($ans1==$que1){ echo"true"; } if($ans2==$que2){ echo"true"; } if($ans3==$que3){ echo"true"; } //and on... the structure not hectic until there 3 questions. questions increased 100. want know how this: for(i=1; i=100; i++){ if($ans.$i==$que.$i){ echo"true"; $total_correct_ans=$total_correct_ans+1; } } echo"total correct answers ". $total_correct_ans; first off, consider using arrays instead; they're meant kind of repetitive stuff: // $answers = [1, 3, 2]; // $questions = [1, 2, 3]; ($i = 0; $i < count($answers); ++$i) { if ($answers[$i] == $questions[$i]) { echo "true" }; } if that's not possible, use variable variables : if (${"ans$i"} == ${"que$i"}) { }

php - Zend DB - Max Time does not return the latest time -

i have follow table value timestamp. [ttimestamp] column 2013-07-11 11:52:19 2013-07-11 11:52:23 2013-07-11 11:52:27 however, instead of return latest time following query, returns smallest... why? $select = $this->dbo->select(array("max(ttimestamp)")) ->from(array('t' => 'table')); there has been bug report http://bugs.mysql.com/bug.php?id=54784 . not sure version running. should work if max(unix_timestamp(ttimestamp))

Getting a Dev-C++ built program to output UNICODE characters to the Windows command line -

if can answer of questions, awesome. here's scoop: i'm teaching intro programming class in thailand 11th graders. it's been going great far, level of english high enough can teach in english , have them write programs in english , fine , dandy. however, speakers of language non-latin characters, feel should @ least learn unicode is. won't test them on or bog them down implementation details, want show them example of unicode program can i/o thai characters. i'm operating under following constraints, none of can changed (at least semester): the program must run on windows 7 the program must in c (not c++) we must use dev-c++ (v. 4.9.9.3) our ide (i'm going try , convince admins change next semester, may not want to) the program should output command line (i'd "look like" programs we've been writing far) i want easy set , run, though i'm not opposed including batch file setup work kids. here's how far i've gotten,

ios - Draw image on canvas with the Retina display -

it web app in phonegap have used 320 480 image draw fuzzy. html <canvas id="canvas" height=480 width=320> browser not support html5 canvas tag.</canvas> javascript var canvas = document.getelementbyid('canvas'); var ctx = canvas.getcontext('2d'); ctx.drawimage(images[index],0,0,320,480); how draw on retina display? if have access larger versions of images, can double visible resolution. the source images need 640x960: this code "pixel double" resolution of image. canvas.width = 640; canvas.height = 960; canvas.style.width = "320px"; canvas.style.height = "480px"; if not, use same "pixel doubling" effect , present smaller clearer version using existing images: canvas.width = 320; canvas.height = 480; canvas.style.width = "160px"; canvas.style.height = "240px";

javascript - Search anywhere in the content instead of starting -

this example taken mdn. <input list="browsers" /> <datalist id="browsers"> <option value="chrome"> <option value="firefox"> <option value="internet explorer"> <option value="opera"> <option value="safari"> </datalist> currently, when type e in input element, no suggestion appear. want suggestions displayed if input value element anywhere in option value instead of starting value. try in jsbin is possible? i'm using jquery ui autocomplete accomplish feature. thanks. try twitter typeahead : https://github.com/twitter/typeahead.js it works jquery

Very basic vertical menu in pure html5 and css -

i've been googling quite bit , can't find helps me put pieces here. specs follows: have 3 files: index.html, menu.html, , style.css the menu.html has content needed menu, , included index.html via html5 objects. understand objects can used this: include html file in html using html5 style.css can have very minimal. maybe blue text on red background, example. what have managed accomplish: getting text menu.html show in index.html my issue putting pieces together. if provide needed lines index.html (ie, object tag correctly references style) , minimal style.css, set. thanks help, , sorry n00b question, can't seem find on combination of html5 objects , css. index.html: http://pastebin.com/xn2pnass menu.html: http://pastebin.com/a72csf14 style.css: http://pastebin.com/qxxwbpyq what broken: i can't object only (the menu) use style sheet , have red background. main page have white background. clicking on menu link seems open page in new frame.

matlab - Put datatip stack on top of axis label and update axes label after a change was done on axes position -

Image
this issue unix matlabs, windows users won't able reproduce it. i having trouble while trying create datatips in on top of y axis label. following picture illustrate issue: as can see, datatips created close ylabel bottom ylabel text, while desire effect opposite: datatip on top of axis label . i generated plot following (not minimal) code, available bellow. may remove lines commented % may removed , or put datatip on −78 instead of loop in order achieve faster testing script, leave code if 1 day wants create custom datatips (in case, consider seeing http://undocumentedmatlab.com/blog/controlling-plot-data-tips/ ): gradientstep = 1e-1; x=-100:gradientstep:100; xsize=numel(x); y=x.^3-x.^2; figh=figure(42); lineh=plot(x,y); ylabel('ylabel (yunits)','fontsize',16) xlabel('xlabel (xunits)','fontsize',16) dch=datacursormode(figh); ntips = 20; % may change loop datatip @ x=-78. pos = round(linspace(2,xsize,ntips)) datatiph=dch.crea

Flex How can I change item in dataProvider when Items is selected or deselected in the mx:List -

flex how can change item in dataprovider when items(multiple selection) selected or deselected in mx:list i want data reflect items selected in list dynamically. base on sorting list, example make selected items first in list when selected, , go original place when items deselected.... you can use iviewcursor get/add/remove items of list. below code example of how create cursor, based on need apply logic need. var col:icollectionview = icollectionview(list.dataprovider); var mycursor:iviewcursor = col.createcursor(); //do logic using mycursor functions ... //refresh collection changes reflect in list col.refresh(); here can check more info it.

java - iReport (5.1.0) for Mac OSX 10.8.4 , The document has no pages Error -

i have problem ireport (5.1.0) mac osx 10.8.4: when create report , preview receive error message: the document has no pages. the connector used mysql , datsources works.

Need to create a persistence session in python using mechanize browser instance -

import mechanize import urllib2 import time import cookielib import requests username = 'user@gmail.com' # username/email password = 'pwd' # password br = mechanize.browser() # browser settings (used emulate browser) br.set_handle_equiv(true) br.set_handle_redirect(true) br.set_handle_referer(true) br.set_handle_robots(false) br.set_debug_http(false) br.set_debug_responses(false) br.set_debug_redirects(false) br.set_handle_refresh(mechanize._http.httprefreshprocessor(), max_time = 1) br.addheaders = [('user-agent', 'mozilla/5.0 (x11; u; linux i686; en-us; rv:1.9.0.1) gecko/2008071615 fedora/3.0.1-1.fc9 firefox/3.0.1')] br.open('https://sso.openx.com/login/login') # open twitter br.select_form(nr=0) # select form br['email'] = username br['password'] = password br.submit() # submit login data # set cookies cookies = cookielib.lwpcookiejar() br.set_cookiejar(cookies) print cookies temp_jar=br.set_cookiejar(cookies)

selector - change textview background until select another textview in android -

i have develop android application. i have using below textview: <textview android:id="@+id/deals" android:layout_width="wrap_content" android:layout_height="50dip" android:background="@drawable/best_deal_bg" android:text="deals" /> this background of these textview: <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/menu_active" android:state_enabled="true" android:state_pressed="true" /> </selector> here .,if have click these textview means tiime ly shows background. but wish need output like.have shows background until select textview. how can ?? please give me solution these ??? edit: i have set background on android textview onclik functionality: deals = (textview) findviewbyid(r.id.deals);

ibm mobilefirst - IBM Worklight - How to connect to another Worklight Server located in another machine in the same network? -

i have setup worklight studio in local machine , developed sample application. need deploy application worklight server set in pc in same network (lan). you have server in local machine - worklight studio contains internal worklight server. doesn't matter... if using worklight 5.x: open application-descriptor.xml find worklightserverrooturl element change value of remote worklight server, example: http://myotherserver:8080 right-click on application folder , choose: run >> build , deploy take *-all.wlapp and/or *.adapter files bin folder , deploy them via worklight console resides in other server machine. if using worklight 6.0: right-click on application folder , choose: run >> build remote server enter details of other server machine (host, port, context root) take *-all.wlapp and/or *.adapter files bin folder , deploy them via worklight console resides in other server machine. the above assumes remote server(s) configured accept

android - why do we use ApacheHttpClient instead of HttpURLConnection? -

why use apachehttpclient instead of httpurlconnection ? , in cases prefer httpurlconnection ? apache clients deprecated still using - why? read blog written jesse wilson dalvik team.: http://android-developers.blogspot.com/2011/09/androids-http-clients.html?m=1

php - Getting a Gumroad Ping with CodeIgniter -

we'll using gumroad facilitate digital downloads. when transaction made we've opted sent 'ping' containing data surrounding purchase (time, value in cents, email used, etc.) our own analytics/affiliate tracking. unfortunately can't seem make post data appear! i've been in touch support team, little lost how data post request. saving $this->input->post() db says nothing in post array. has tried set before? or can offer insight getting gumroad's ping or post data php?

php - preg_match_all function to clip integers -

<div class="final-pro" itemprop="pro"> <meta itemprop="curr" content="yen"> <span style="font-family: yen">d </span>15,675 <span class="base-pro linethrough"> <span style="font-family: yen">d </span>14,999 </span> </div> i need clip values 15,675 , 14,999 above html codes using preg_match_all. tried as possible failed.helping hands welcome. what i've tried far: preg_match_all('/yen">d </span>(.*?)<\span/s',$con,$val); $txt = '<div class="final-pro" itemprop="pro"> <meta itemprop="curr" content="yen"> <span style="font-family: yen">d </span>15,675 <span class="base-pro linethrough"> <span style="font-family: yen">d </span>14,999 </span> </div>'; $matches =

newrelic - Should I group different servers into the same New Relic Application? -

i have application require multiple java servers, e.g. tomcat & solr. jvm based , used single web apps, should group them single application ? i'm making assumptions here, if components here part of same web application, using same new relic application name should right way go. (background: 'application name' used new relic separate performance information out single heading. makes sense use separate application names if you're using 2 separate web apps or have prod , dev version of app) if you'd see information single jvm later, new relic user interface allows view performance information separated out single jvm using drop-down @ top right under application's name.

jquery - getting results back from json array within function -

i trying build re-usable function pulling json results , writing page so far json , when returned run function passes data index , result. works fine the problem when went iteration around result in function (seen below) sometimes data structure data.usergroup.form , other times data.usergroup.user , on what have tried pass name want use function last argument i.e. "user" , wihin inner .each call element.name (where name can vary) doesnt work. can help? here code $.when(promise).then(function(result) { $(result.data.usergroup).each(function(index, element) { var html = gethtml( ["name", "delete"], index, element, "user"); $("#accordion2").append(html); }); }) function gethtml(array, index, element, name) { var html = " <div class='accordion-group'>"; html = html + "<div class='accordion-heading'>"; html = html + "<span class='accordian-i

c - How does “continue" work in this code? -

while ( fgets(eqvline, 1024, eqvfile) != null ) { eqvline[strlen(eqvline)-1] = '\0'; if (!strcmp (eqvline, "$signalmap")) { start_store_mask = 1; continue; } if (!strcmp (eqvline, "$signalmapend")) { _num_mask_pins = i; sim_inform ( sim, "[vtpsim] total of %d pins found in equivalent file.\n", _num_mask_pins); //return; start_store_mask = 0; } } can explain how continue; in code works? when continue; executed, code jump to? again compare eqvline read new line? when code if (!strcmp (eqvline, "$signalmapend")) { called? the continue statement passes control next iteration of nearest enclosing do, for, or while statement in appears, bypassing remaining statements in do, for, or while statement body. in code, after continue; executed, condition while loop checked immediately. if condition satisfied, control enters inside loop. first eq

php - Send Email with codeigniter(configuration) from my own server -

in past have send email through google smtp want send email own server. i have followed this example setup email config file. how email.php file looks like: $config['useragent'] = 'codeigniter'; $config['protocol'] = 'mail'; $config['mailpath'] = '/usr/sbin/sendmail'; $config['smtp_host'] = 'localhost'; $config['smtp_user'] = 'noreply@publish.mmedija.com'; $config['smtp_pass'] = 'testtest'; $config['smtp_port'] = 25; $config['smtp_timeout'] = 5; $config['wordwrap'] = true; $config['wrapchars'] = 76; $config['mailtype'] = 'text'; $config['charset'] = 'utf-8'; $config['validate'] = false; $config['priority'] = 3; $config['crlf'] = "\r\n"; $config['newline&

c# - User not found when adding an AD group to an SP group -

i trying run code suggested here: https://sharepoint.stackexchange.com/questions/72431/what-is-the-correct-way-to-add-an-ad-group-to-an-sp-group-with-permissions the ensureuser line works, on web.users line, says user not found. var membersgroup = web.sitegroups.getbyname(string.concat(web.title, " ", "members")); if (!string.isnullorempty(xlosgroupname)) { string xlosgroupnamewithdomain = string.concat(domainname, @"\", xlosgroupname); web.ensureuser(xlosgroupnamewithdomain); var adlosgroup = web.users[xlosgroupnamewithdomain]; membersgroup.users.add(adlosgroup.loginname, string.empty, adlosgroup.name, adlosgroup.notes); sproledefinition contribute = web.roledefinitions.getbytype(sproletype.contributor); sproleassignmentcollection roleassignments = web.roleassignments; sproleassignment roleassignment = new sproleassignment(xlosgroupnamewithdomain, string.empty, string.empty, string.empty); sproledefinitionbindingco

magento modules duplicated into include/src -

i've build custom module at magentoroot/app/code/local/custommodule/catalog/model/product.php that extends "on save" event products , categories. worked fine until i've noticed update made file not firing longer. after debugging found out file has been duplicated at magentoroot/includes/src/custommodule_catalog_model/product.php it seems in folder path magentoroot/includes/src there duplicated other modules/extensions since there 7k files present. @ point team (including me) has enabled magento feature, or extension has updated magento's ways , want revert back. has ever encountered issue or knows how rid of this? note: i'm not 1 working on project, assume don't know answer to: have installed/activated. someone team has enabled compilation in magento. this tutorial covers issue: if accidentally enabled compilation, or if actively using compilation instead of apc cache , need disable compilation perform upgrade

excel charts not accepting date-time series in x axis -

how make excel accept following different data points on x-axis. time licenses used 2013-07-09 11:34 512 2013-07-09 11:36 523 2013-07-09 11:40 621 2013-07-09 11:43 125 2013-07-10 09:30 526 2013-07-10 10:30 589 2013-07-10 11:30 546 2013-07-11 10:40 549 why excel charts club times on date together, why cant interpret different time entries? if using line chart, change xy scatter chart lines instead; date axis on line chart ignore time portion

c# - Disabling AutoPostback on gridview asp:hyperlinkfield? -

i trying execute javascript on click of asp gridview's hyperlinkfield. javascript executes fine page posts when iframe flickers before showing (the javascript sets iframe's source , display none block.). how can go disabling autopostback on control since not have such attribute? <columns> <asp:hyperlinkfield text="update" navigateurl="javascript:showform('frmaddaudits.aspx');" headertext="update" target="_blank"/> <asp:hyperlinkfield text="add findings" navigateurl="javascript:showform('frmauditfindings.aspx');" headertext="add findings" target="_blank" /> </columns> css .showme{display:block;} .hideme{display:none;} javascript function showform(urltogoto){ document.getelementbyid('myiframe').src = urltogoto; document.g

java - In regex difference betewen \\G and ^ -

i see link these 2 boundary matches quite similar: \g , ^ . i have seen example of \g have shown @ end of same link . enter regex: dog enter input string search: dog dog found text "dog" starting @ index 0 , ending @ index 3. found text "dog" starting @ index 4 , ending @ index 7. enter regex: \gdog enter input string search: dog dog found text "dog" starting @ index 0 , ending @ index 3. it's clear compared no boundary matchers, about: enter regex: \gdog enter input string search: dog dog found text "dog" starting @ index 0 , ending @ index 3. vs enter regex: ^dog enter input string search: dog dog found text "dog" starting @ index 0 , ending @ index 3. what subtle difference between 2? this explains \g https://forums.oracle.com/thread/1255361 \g start searches start of string , keep searching after first match ended. ^ give 1 result search ends if match found @ beginning of search

java - Guice Singleton and Servlet -

i'm using guice , have question. there servlet that's singleton. there 1 instance of class in jvm or 1 instance of session scope? , concurrency access class? there problem of concurrency access of servlet resource. servlet container handles well, spawn new thread @ eaach request , pass servlet reference , request processed. and make servlet single threaded confirm single memory space use, container lightweight. same concept available in spring default every bean singleton.

c# - Switching which data field is assigned to item repeater -

i've been having hunt around , can't find out if possible. have button (inside repeater) , text of button determined couple of values being returned in dataset, this: text='<%# databinder.eval(container.dataitem, "eventnumber") + "|" + databinder.eval(container.dataitem, "type" )%>' but i'd able switch field gets assigned dependant on whether eventnumber has value in it. this: text='<%# databinder.eval(container.dataitem, "eventnumber")!=""?databinder.eval(container.dataitem, "eventnumber"):databinder.eval(container.dataitem, "productid") + "|" + databinder.eval(container.dataitem, "type" )%>' but can't seem work. (in instance no errors text empty) could assist please? thank you, craig i recommend start using codebehind, itemdatabound best place here: protected void repeater1_itemdatabound(object sender, repeateritemeventargs

google chrome - Python - Selenium unresponsive and blocking the program -

i using selenium python. after multiple find , click operations, script stops executing. when check, selenium blocking entire code, either @ click operation or @ find_element_by_* or other selenium based code. anyone else facing it?

android - Query to retrieve json objects from facebook graph api(search) -

i want url this facebook graph api search retrieve data. when tried using url , gives { "error": { "message": "(#200) must have valid access_token access endpoint", "type": "oauthexception", "code": 200 } } i using on android. can please guide me in achieving this. facebook's graph api public until when added access_token . from documentation explain how create temporary access token. unfortunately, creating in way, need deal sort of job update (i.e. renew existing access token/generate new access token) once in while access_token can able make use of graph api. most probably, there libraries out there might deal renewing or generating new access token, maybe won't fit app. so avoid mentioned "problem", found there way have non-expiring access token. what need following steps: create facebook account (if don't have 1 or if want create account develop

how to get the base url using regex in javascript -

This summary is not available. Please click here to view the post.

javascript - form.submit() not working in firefox -

i using following javascript function construct form , submitting server. works fine in chrome browser not working in firefox. function loadpage(url, projectname){ var jform = $('<form></form>'); jform.attr('action', url); jform.attr('method', 'post'); var jinput = $("<input>"); jinput.attr('name', 'curprj'); jinput.attr('value', projectname); jform.append(jinput); jform.submit(); } i got suggestion se's older post mozilla form.submit() not working , append form document body document.body.appendchild(jform) unfortunately didn't work me either. got following error in debug console when used document.body.appendchild(jform) before form submit. typeerror: argument 1 of node.appendchild not implement interface node. @ http://localhost:9000/assets/javascripts/global.js am missing here? pls advise. document.body.appendchild(jform) won't wo

java - return class names not working in Jar -

i have used code list of class names package: private list<string> getclasses() { list<string> classes = new arraylist<string>(); string packagename = "algorithm/impl"; url directoryurl = thread.currentthread().getcontextclassloader(). getresource(packagename); file directory = new file(directoryurl.getfile()); if(directory.exists()) { string [] files = directory.list(); for(string filename : files) { classes.add(filename.substring(0, filename.lastindexof("."))); } } return classes; } but not work when app packaged executable jar file. why? you can make use of class jarfile . jarfile file = new jarfile("yourfilename.jar"); (enumeration<jarentry> enum = file.entries(); enum.hasmoreelements();) { jarentry entry = enum.next(); system.out.println(entry.getname()); } or if want search particular class inside jar can

C struct string error -

here chunks of code give view of problem typedef struct { int count; char *item; int price; char *buyer; date *date; }transaction; transaction *open(file *src, char* path) { char buffer[100], *token; int count = 0; transaction *tlist = (transaction*)malloc(sizeof(transaction)); tlist = alloc(tlist, count); src = fopen(path, "r"); if (src != null) { printf("\nsoubor nacten.\n"); } else { printf("\nchyba cteni souboru.\n"); return null; } while (fgets(buffer, sizeof(buffer), src)) { tlist = alloc(tlist, count+1); token = strtok(buffer, "\t"); //zahodit jméno obchodníka tlist[count].count = strtok(null, "x"); tlist[count].item = strtok(null, "\t"); tlist[count].item++; tlist[count].item[strlen(tlist[count].item)] = '\0'; tlist[count].price = atoi(strtok(null, "\t ")); token = strtok(null, "\t"); //zahodit md tlist[count]

Bypassing DNS requests app-wise in iOS -

i know can't permanently set dns servers programmatically on non-jailbroken device, i'm searching method route dns requests in app specified dns server (e.g. google dns 4.2.2.1) in order bypass dns-based government censoring. know can hard-code specified ip addresses hosts setting ip , host header in nsurlrequest (i'm doing in app), i'm looking more general way achieve this. there way redirect dns requests in app? category-overriding nsurlconnection's methods (i know in general it's bad practice, work beautifully in app) allow me override default behavior of url requests? involve accessing/overriding (if possible) private apis , cause app rejected app store? best practice?

c - Determine if a lib/program/executable (nano for instance) is shipped with a UNIX/Linux distribution (lets say solaris 10) by default -

i want add dynamic link specific library in c code and/or call specific program in script. im writing c application in linux/unix. i can not manage determine beforehand if these libs/executables, want run, 100% present in normal default new copy of each specific release of unix/linux. for example: lets want link libz and/or call nano program in c code/script. how can sure libz and/or nano shipped fresh release of ubuntu12 or hpux31 instance. is there document comes os releases states programs/libs present in release? can not manage find such documentation. i can buy platforms/machines , install fresh copy of each , every platform/distribution want use , check if files exist, though, expensive in time/money , effort. i check upon installation of application's package if wanted lib/program exist on target machine, can not afford stopping installation reason. have 100% sure program able run on normal fresh copy of distribution of unix/linux. does have clue?

xml - XPath search by "id" attribute , giving NPE - Java -

all, i have multiple xml templates need fill data, allow document builder class use multiple templates , insert data correctly i designate node want class insert data adding attribute of: id="root" one example of xml <?xml version="1.0" encoding="utf-8" standalone="yes" ?> <siebelmessage messageid="07f33fa0-2045-46fd-b88b-5634a3de9a0b" messagetype="integration object" intobjectname="" intobjectformat="siebel hierarchical" returncode="0" errormessage=""> <listofreadaudit > <readaudit id="root"> <recordid mapping="record id"></recordid> <userid mapping="user id"></userid> <customerid mapping="customer id"></customerid> <lastupd mapping="last updated"></lastupd> <lastupdby mappin

sql - Subquery in access with self-join, it does not recognize table alias -

i built subquery: select q2.addedquests, q2.daynum qrnumberofqueststodo q2 inner join qrnumberofqueststodo q3 on q2.daynum > q3.daynum q2.daynum = (select max(q3.daynum) q3); but ms access not recognize q3 in subquery. why? why not? because how sql works. can refer column of q3 in subquery (in select , where , group by , having , order by , or on clause instance), not entire table. i continuing, think query non-sensical. in 1 place, query says q2.daynum > q3.daynum . in another, q2.daynum = q3.daynum . hence, query not return anything. but, can still express valid sql. notice q3 not needed in outer query. try correlated subquery instead: select q2.addedquests, q2.daynum qrnumberofqueststodo q2 q2.daynum = (select max(q3.daynum) qrnumberofqueststodo q3 q2.daynum>q3.daynum ) ;

download - Create thumbnail after upload of any file extension -

i want upload file extensions , extension need create thumbnail image particular image. example, if upload .pdf file thumbnail image should 'pdf.jpg', if .docx file should 'word.jpg' , if .zip file name should 'zip.jpg'. i have tried no luck, file uploaded thumbnails not. is there codes can this, mean upload extension , extension create thumbnail image also? if 1 has idea please share. :)

struts2 - Log4j not logging when an error occured in my struts 2 action class -

in struts 2 application have no stacktrace when error occurs. test in action class created null object on try call method. struts 2 filter shows me error screen excepions mapping correct, in log file have nothing. way add try/catch log.error(e) in catch statement. struts.xml : <interceptors> <interceptor name="authz" class="com.omb.controller.security.authzinterceptor"/> <interceptor name="params-filter" class="com.opensymphony.xwork2.interceptor.parameterfilterinterceptor"/> <interceptor name="user" class="com.omb.controller.interceptor.userinterceptor"/> <interceptor-stack name="defaultstack"> <interceptor-ref name="exception"> <param name="exception.logenabled">true</param> <param name="exception.loglevel">error</par

java - Sort LinkedHashMap using Comparable based on object attribute -

i want sort linkedhashmap based on object attribute , using comparable. here code: public class mapclass{ public static void main(string args[]){ sortmapbasedonvalueobjectusingcomprable(); } public static void sortmapbasedonvalueobjectusingcomprable(){ map map = new linkedhashmap(); map.put("2",new pojo("456")); map.put("4",new pojo("366")); map.put("1",new pojo("466")); map.put("8",new pojo("5666")); map.put("9",new pojo("456")); map.put("3",new pojo("66")); // how sort ...? set<map.entry<string,object>> st = map.entryset(); iterator itr = st.iterator(); while(itr.hasnext()){ map.entry mxt= (map.entry)itr.next(); pojo pj = (pojo)mxt.getvalue(); system.out.println(pj.getx()); } } pub

php - "Notice: Undefined index" on some values when pushing to array -

i adding values keys array: public function adddata($key, $value){ $this->data[$key] = $value; } //this line y in class $dataholder->adddata($fieldnames[$i], $row{$fieldnames[$i]}); it works of time. notice: undefined index [keyvalue] in x.php in line y the array empty , values , keys database table. most of fields inserted without problem, gives error? ideas on why works sometimes? delcare $this->data = array(); above function or it might happen when key or value passing empty value function database.

excel - Run-time error '1004', Placing a formula in a acell -

=== edit: answer seems highlight has more syntax foo else === all i'm trying put formula in cell. it's formula developed before using vba , need automate process. when run code it's fine until gets line. then receive error- run-time error '1004': application-defined or object-defined error the code contained in loop context or school boy errors i've made. sheets("data summary").activate dim startdate date startdate = now() dim integer = 1 7 startdate = dateadd("d", 1, startdate) cells.range("b9").formula = "=countifs(discharged!$e$2:$e$200, " & _ " "">="" & startdate, " & _ " discharged!$e$2:$e$200, " & _ " ""<"" & startdate.adddays(1), " & _ " discharged!$h$2:$h$200, &

Logout link with Spring and Thymeleaf -

according official example ( secure web content ), have use form , button aim perform logout spring security. there way use link thymeleaf instead of button? i have used <a th:href="@{/logout}">logout</a> the relevant spring security config used http .formlogin() .loginpage("/login") .permitall() .and() .logout() .logouturl("/logout") .logoutsuccessurl("/login");

python - scikit learn PCA dimension reduction - data lot of features and few samples -

i trying dimension reduction using pca scikit-learn. data set has around 300 samples , 4096 features. want reduce dimensions 400 , 40. when call algorithm resulting data have @ "number of samples" features. from sklearn.decomposition import pca pca = pca(n_components = 400) traindata = pca.fit_transform(traindata) testdata = pca.transform(testdata) where initial shape of traindata 300x4096 , resulting data shape 300x300. there way perform operation on kind of data (lot of features, few samples)? the maximum number of principal components can extracted , m x n dataset min(m, n). not algorithm issue. fundamentally, maximum number there are.

how to convert text values in an array to float and add in python -

i have text file containing values: 120 25 50 149 33 50 095 41 50 093 05 50 081 11 50 i extracted values in first column , put array: adjusted how convert values text float , add 5 each of them using for loop? my desired output : 125 154 100 098 086 here code: adjusted = [(adj + (y)) y in floats] a1 = adjusted[0:1] a2 = adjusted[1:2] a3 = adjusted[2:3] a4 = adjusted[3:4] a5 = adjusted[4:5] print a1 print a2 print a3 print a4 print a5 a11= [float(x) x in adjusted] fbearingbc = 5 + float(a11) print fbearingbc it gives me errors says cant add float , string pliz help assuming have: adjusted = ['120', '149', '095', ...] the simplest way convert float , add 5 is: converted = [float(s) + 5 s in adjusted] this create new list, iterating on each string s in old list, converting float , adding 5 . assigning each value in list separate name ( a1 , etc.) not way proceed; break if have more or fewer entries expected. cleaner