Posts

Showing posts from August, 2012

c - uninitialized local variable 'num' used? -

#include<stdio.h> #include<conio.h> int main() { int num; printf("enter number \n"); scanf_s("%d", num); printf("your number %d", num); _getch(); return 0; } when build above code in vs2013 gives me following error : error c4700: uninitialized local variable 'num' used ?? whhat reason ?? you forgot &: scanf_s("%d", &num); scanf expect pointer, reading value of num find address write user input (and num not initialized, that's why compiler raise warning). meant address of num itself.

sql - Trying to convert DBNull into a date without any luck so far. -

i loading value txtbox(driver) our sql database using filled txtbox(car registration) filter. so able right driver vehicle. each vehicle can have number of people driving in time, using iif clause make sure current driver selected. i getting error: operator '>' not defined type 'dbnull' , type 'date'. i know need convert dbnull date format, struggling so, have tried few things, , far have got to. dim cdriver new dictionary(of string, object) cdriver.add("registration", txtreg.text) dim currentdriver datatable currentdriver = businessdata.verifierlogic.load("[car history]", cdriver) dim currentdrivername string = "" dim currentenddate datetime each row datarow in currentdriver.rows if datediff(dateinterval.day, row("end_date"), datetime.now) > 0 currentdrivername = row("driver_name") cur...

java - Create a json string with List<NameValuePair> in android -

i want send http request url android. ios developer , trying learn android. used send json string in ios below {"function":"login", "parameters": {"username": "nithin""password": "123456"}} how can send in android? tried list<namevaluepair> can't find proper solution. full code of tried - httpclient httpclient = new defaulthttpclient(); httppost httppost = new httppost(url); try { // add data list<namevaluepair> namevaluepairs = new arraylist<namevaluepair>(2); namevaluepairs.add(new basicnamevaluepair("function", "login")); namevaluepairs.add(new basicnamevaluepair("username", "nithin")); namevaluepairs.add(new basicnamevaluepair("password", "123456")); httppost.setentity(new urlencodedformentity(namevaluepairs)); // execute http post request h...

jquery - Uncaught TypeError: Object [object Object] has no method 'slider' on bootstrap=slider plugin -

having slight issue bootstrap-slider plugin http://www.eyecon.ro/bootstrap-slider/ . getting error: uncaught typeerror: object [object object] has no method 'slider' from following code: <head> <link href="./bootstrap/css/bootstrap.css" rel="stylesheet"> <link href="./bootstrap/css/custom.css" rel="stylesheet"> <link href="./bootstrap/css/slider.css" rel="stylesheet"> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <script type="test/javascript" src="./bootstrap/js/bootstrap.js"></script> <script type="test/javascript" src="./bootstrap/js/bootstrap-slider.js"></script> <script type="text/javascript"> $(document).ready(function(){ $('#slider-price').slider(); }); </script> ... </head> ...

wsdl - web service client : Connection Refused, but service works from SoapUI -

i have web service deployed on jboss 7.1 server. want test service, have written simple java application ,which calls service methods. following error : exception in thread "main" com.sun.xml.internal.ws.client.clienttransportexception: http transport error: java.net.connectexception: connection refused: connect but wsdl loads in browser (url same) , soap ui service working. i've found post: https://community.jboss.org/thread/204961?_sscc=t , changed <wsdl-host> in standalone.xml file. after able call web service java application, weirdest part have web service deployed on same jboss , connect without problems. i don't if " localhost " in wsdl 's soap:address location issue, why did service work ?

php - Keeping Values entered on submit -

i have following code in input fields keep date showing when submit button clicked <?= isset($_post['first_name']) ? $_post['first_name'] : '' ?> but how code select area?? eg; <option value="<?= isset($_post['prof']) ? $_post['prof'] : 'prof' ?>">prof</option> <option value="<?= isset($_post['dr']) ? $_post['dr'] : 'dr' ?>">dr</option> <option value="<?= isset($_post['mr']) ? $_post['mr'] : 'mr' ?>">mr</option> <option value="<?= isset($_post['mrs']) ? $_post['mrs'] : 'mrs' ?>">mrs</option> <option value="<?= isset($_post['ms']) ? $_post['ms'] : 'ms' ?>">ms</option> <option value="<?= isset($_post['miss']) ? $_post['miss'] : 'miss' ?>">miss<...

xslt - Contains value xslt2 -

how possible check if array of example strings contains string? <xsl:if test="inarray('a', $array)"></xsl:if> if array mean sequence, use = ... <xsl:variable name="array" select="('a','b','c')"/> <xsl:if test="$array='a'"></xsl:if> you can test multiple values in array/sequence (this example evaluate true if a or c exists in sequence): <xsl:if test="$array=('a','c')"></xsl:if>

jquery - Kendo Chart, overlay of two series -

hello, got kendo ui bar chart 2 series. default series display side side. with "stacked: true" 2 series stacked. (first value + second value) ... seriesdefaults: { type: "column", stack: true <-- make stacked }, ... so far good. want 1 series above other, overlay in way. (first value - second value) i created fiddle . hope understand mean :-) is possible configuration or have manipulate data before in chart!? as far have seen, telerik doesn't support overlaid series data in bar charts beyond standard stack. might try asking on over support forums . if, on other hand, talking taking series1 values minus series2 values, then, yes, can done, have write code it. this: var dataset = new array(10, 15, 20, 10, 15, 20); var dataset2 = new array(2, 2, 4, 6, 5, 20); var dataset3 = new array(); //dataset1 - dataset2 for(var = 0; < dataset.length; i++){ dataset3.push(dataset[i] - dataset2[i]); } here's fiddle tha...

why sometimes you need to have a dummy object for event storage (JavaScript) -

i don't understand why need have dummy object in javascript store evetns, following code. metal.gold = function() { var temp = $("<div>"); //dummy object this.submit = function(url1, method, data){ temp.trigger("submit", data); //invoke trigger dummy object?? $.ajax({ url:url1, data:json.stringify(data), contenttype: "application/json; charset=utf-8", datatype:"json", success: function(data){ temp.trigger("submittsuccess", data); //???? //dosomething }, error: function(error){ temp.trigger("submitfailure", error);// ??? } }); } } why dummy element has been deklared , trigger has been invoked 3 times? thanks. updated here invokes submit method: mygold.submit(.... function(data){ temp.trigger("submitquantitysuccess", data); }, .... this.onsubmitquantitysuccess...

c# - remove a defined number of messages from a message queue -

rather using .purge() , there way delete defined number of messages queue? i've tried setting messageenumerator , using .removecurrrent after i've done whatever need current message not seem work. thanks public message[] get10(messagequeue q) { int counter = 0; int mcount = 0; list<message> ml = new list<message>(); try { messageenumerator me = q.getmessageenumerator2(); while (me.movenext()) { counter++; } if (counter > 10) { mcount = 10; } else { mcount = counter; } counter = 0; me.reset(); { me.movenext(); counter++; ml.add(me.current); me.removecurrent(); } while (counter < mcount); } catch (exce...

jquery - Highcharts tick interval positioning -

Image
the tick intervals on graph not aligned graph lines, occurred when increased height of graph (which design requirement). i've read through , tried out highcharts tick positioner info isn't want, possible position numbers placed? need pushing align them. here's screenshot: edit here's code on fiddle - sorry can't in running on there i can't see on yaxis settings affecting yaxis: { min: 0, labels: { format: '{value}%', style: { fontsize: 26, } }, gridlinecolor: '#f7a600', gridlinewidth: 2, tickinterval: tickintervalnumber, title: { text: '' }, i don't think if statement @ top affect either wrong //tick inteval variable if (total > 200) { var tickintervalnumber = 200 / 4 ...

github - windows git bash wont clone directory -

Image
i having trouble cloning git repo using git bash. basically im trying following angular js tutorial angular js tutorial #clone angular-phonecat repository located @ github running following command: git clone https://github.com/angular/angular-phonecat.git however when it seems hang , fail on cloning angular-phonecar dir. see screenshot. url avtive , can open when load browser? im thinking may have ports blocked?... not sure.. any appreciated. error says http request failed it sounds either github down, or maybe behind firewall blocking access this. have tried connecting github using curl? curl -i https://github.com/angular/angular-phonecat.git also, after clone operation fails, enter in command line: echo $? that exit code of last command. might try googling "git clone fails exit code x".

html - Replace text in div and not in other elements with jquery -

i have issue, here html <div id="slider" class="hidden"> <input type="button">x</input> </div> and here jquery: var el = $('#slider').clone(); el.removeclass("hidden"); el.text("my humble text"); $("#otherdiv").append(el); so issue when execut jquery, replaced button x .. because seemed text. my question how add text div, let other elements texts ...? use .append() instead of .html() var el = $('#slider').clone(); el.removeclass("hidden"); el.append("my humble text"); $("#otherdiv").append(el); demo: fiddle also the resulting html contain multiple elements id slider , have change id of cloned element <input type="button">x</input> should <input type="button" value="x">

node.js - Can I use bitwise operators to request a Loopback model? -

the strongloop loopback documentation not object retrieval using bitwise filters. example in loopback api documentation : // example of syntax, not bitwise filter inventory.find({where: {status: {gt: 4}}); with direct connection mongodb , can : // select items 3rd bit on in `status` field db.inventory.find({status: {$mod: [4, 0]}}); can same behind loopback model interface ? in mongodb docs $were condition can same, while more expensive : db.inventory.find( { $where: "this.qty % 4 == 0" } ) could doing following in loopback : inventory.find({where: "this.qty % 4 == 0"}); or fail ? is whole idea of using bitwise-oriented status field in model overkill ? should use kind of array field containing list of string status ? isn't expensive in terms of db storage ? thanks loopback uses similar json object mongodb describe query. please keep in mind loopback supports multiple databases such mongodb, mysql, , oracle. ideally, opera...

android - How can I brighten the screen when opening an Activity in my Glass GDK immersion application? -

i have gdk immersion application, launcher activity acquires a screen_dim_wake_lock wakelock . app has service receive chat messages , starts intent activity display each one. whenever message activity opened, want brighten screen. however, of methods have found not seem work. for example, adding following onresume has no effect: settings.system.putint(getcontentresolver(), screen_brightness_mode, screen_brightness_mode_manual); windowmanager.layoutparams lp = getwindow().getattributes(); lp.screenbrightness = 1.0f; getwindow().setattributes(lp); to better illustrate problem, here sequence of events in app: activity starts , acquires screen_dim_wake_lock. activity dims after short time. service b receives chat message on network , creates intent activity c activity c opens, sets screen brightness shown above, remains dimmed how can screen brighten? i able find solution acquiring screen_bright_wake_lock acquire_causes_wakeup flag i...

java - How do I use the substr function to grab the last 100 bytes of a 32K in length string? -

summary question: how correctly use substr function grab last 100 bytes of 32k in length string in java? i have admit c/c++ slim , little used , java experience these couple of programs fighting with. just trying test of passing string , forth mainframe comfortzone (no comments please... ;-)...not in wheelchair @ least 3 decades....really!) the string under 32k , on pc eclipse ide side have defined as: string hold_container_data = cont.getchardata(); the sample copied defaulted printing system.out.println 10 strings of 32k overwhelming ide console. trying fix that. so wanted display first 100 , last 100 bytes since diagnostic display handy have working. got first 100 bytes with: hold_container_data.substring( 0, 100 ); started with: hold_container_data.substring( length-100, 100 ); which figured might syntax issue though compiled fine. for grins tried both: hold_container_data.substring( 31000, 100 ); hold_container_data.substring( 500, 100 ); the latte...

ember.js - Getting data from DS.PromiseArray in EmberJS -

i'm new emberjs , i'm having trouble working promises. here router: this.resource('menus', function(){ this.resource('menu', {path: '/:menu_id'}, function(){ this.resource('submodule', {path: '/:submodule_id'}); }); }); }); i have nested routes, , child route returns menuss object based on given id. here menuroute: app.menuroute = ember.route.extend({ model: function(params){ return this.store.find('menuss', params.menu_id); } }); here models: app.menuss = ds.model.extend({ name: ds.attr('string'), submodule: ds.hasmany('submodule', {async:true}) }); app.submodule = ds.model.extend({ name: ds.attr('string'), content: ds.attr('string') }); the 'submodule' attribute of menuss model contains array of submodule model id's. inside menu template, i'm receiving menuss object , want display submodules each menu item has. however, whe...

sql - MySQL update statement that partially changes the value of a column -

i need update value of column in db table substituting part of path. my current path is: software-features/adadadad.html it should become: software/adadadad.html i need sql update statement (valid mysql 5.5) changes part of value of column is want? update t set path = replace(path, 'software-features', 'software') path 'software-features%';

r - Multiple boxplots with ggplot2 in the same layer from a melted data frame with a condition -

Image
i have data here [in .txt file] read data frame, mydf <- read.table("data.txt", header=t,sep="\t") i melt data frame next using following piece of code, df_mlt <-melt(mydf, id=names(mydf)[1], variable = "cols") now plot data boxplot displaying values of x>0 , use following code, plt_bx <- ggplot(df_mlt, aes(x=id1,y=value>0, color=cols))+geom_boxplot() but resulting plot looks following, however need display positive values of x individual box plots in same plot layer. please suggest need change in above code proper output, thanks. plt_bx <- ggplot(subset(df_mlt, value > 0), aes(x=id1,y=value, color=cols)) + geom_boxplot() you need subset data frame remove undesirable values. right you're plotting value > 0 , either true or false, instead of boxplot of values greater 0.

c# - Get GeckoFx firefox browser control iframe html not accessible -

i using geckofx 22 c# web browser control cannot manage access tags within iframe. when check gecko innerhtml seems although iframe tag shows in html, contents of not. this code used inner html of browser control shows iframe tag empty (when should have doc inside of it): geckohtmlelement element = null; var geckodomelement = webbrowser.document.documentelement; if (geckodomelement geckohtmlelement) { element = (geckohtmlelement)geckodomelement; var innerhtml = element.innerhtml; } previously used code similar code below access individual elements works fine: geckodocument checkdoc = (geckodocument)webbrowser.window.document; var x = (checkdoc.getelementsbytagname("a").where(b => b.id == "ipt-form-format-aside").first()); i able individual elements , change values/trigger events etc without problems main html document in iframe impossible elements of. think per...

javascript - Get Wikipedia Article excluding ones with Title in a list -

so want random wikipedia article don't want grab ones title or category in specific list have (for bad word filtering). i using javascript , i'm not familiar wikipedia api have query string generate random article , grab extract i'm not sure on how excluding. didn't see in documentation or searching google on how that. the code working , fetching random articles need filter them. my actual javascript code fetching if (tempscript) return; if (!isretry) { attempts = 0; minchars = minimumcharacters; maxchars = maximumcharacters; button.disabled = true; button.style.cursor = "wait"; } tempscript = document.createelement("script"); tempscript.type = "text/javascript"; tempscript.id = "tempscript"; tempscript.src = "http://en.wikipedia.org/w/api.php" + "?action=query&generator=random&prop=extrac...

linux - Where does Trac store its environment information -

following initial trac installation on ubuntu 10.04 system, overwhelmed plugins available. some theme installation messing environments. removed environments , tried re-create them. trac still seemed keep information on installed environments , installed plugins. even removing both installation , plugins didnt seem work - doing fulltext search on whole server didnt bring results either. does know trac stores info on created envinronment + plugins? trac pickup plugins python's site-packages directory, environment's plugins directory. 1 possibility plugins installed in site-packages directory, regardless should able disable them through web administration page, or editing [components] section of trac.ini . documentation available on tracplugins page. check if have globalconfiguration if else setup initial trac installation.

python - Flask with gevent multicore -

what clear way run flask application gevent backend server , utilize processor cores? have idea run multiple copies of flask application gevent wsgiserver listen 1 port in diapason 5000..5003 (for 4 processes) , nginx load balancer. but i'm not sure way best , may there other ways it. example, master process listen 1 port , workers process incoming connections. i'll take shot! nginx! server section: location / { include proxy_params; proxy_pass http://127.0.0.1:5000; } flask app this simple flask app using example. myapp.py: from flask import flask app = flask(__name__) @app.route("/") def hello(): return "hello world!" if __name__ == "__main__": app.run() uwsgi okay know said wanted use gevent, if willing compromise on little bit think happy setup. [uwsgi] master = true plugin = python http-socket = 127.0.0.1:5000 workers = 4 wsgi-file = myapp.py callable = app gunicorn...

bitbucket - errors while committing the repository in sourcetree, Git window client -

i new bitbucket, git , sourcetree. created repository on bitbucket, installed sourcetree client win 7, clone repository local desktop folder, placed file in local folder, when try commit changes, sourcetree give me following errors. git -c diff.mnemonicprefix=false -c core.quotepath=false commit -q -f c:\users\shahjahan_khokher\appdata\local\temp\vrkvrvyu.uba * please tell me are. run git config --global user.email "you@example.com" git config --global user.name "your name" to set account's default identity. omit --global set identity in repository. fatal: unable auto-detect email address (got 'shahjahan_khokher@shahjahan_khokh.(none)') completed errors, see above. how can resolve issue , successful commit , push. the easiest way solve issue identity without using git bash set in sourcetree directly: - got menu: tools -> options on general tab fill in full name , email address field...

javascript - closest/next div selecting jquery -

i have html this: <table> <tr> <td> <button class="popup" id="$row[0]"></button> </td> </tr> </table> <div class="details"> <div id="section-2"> </div> </div> here goes jquery script: $(document).ready(function() { $('.popup').click(function () { // : $(this).next(".details").dialog('open'); $('.details').dialog('open'); }); }); }); i want dialog closest/next div class details the details element next sibling of table element, use .closest() find table ancestor of button use .next() find details element $(document).ready(function () { $('.popup').click(function () { // : $(this).next(".details").dialog('open'); $(this).closest('table').next('.details').dialog('open'); });...

php - What is making the background of the image black in my code? -

i have code creates image - has background colour of black of can't seem find in code this. also, if can show me cleaner/better/more efficient way of writing code fabulous know isn't. the basic functionality of code create image, random numbers on used captcha type image. keeping in mind, can help? also, might able tell, have code adds lines image attempt confuse spam bot in case tries read image. if me please write code same cleaner, thank much! <?php session_start(); $_session['replace'] = rand(1,99999); $image = imagecreatetruecolor(80, 20); ($i=0; $i < rand(20,40); $i++) { $x = rand(0, 70); $y = rand(0, 20); imagedashedline($image, $x, $y, $x+rand(0,10), $y+rand(0,240), imagecolorallocate($image, rand(0,1),rand(0,1),rand(1,2))); imagedashedline($image, $x, $y, $x+rand(0,11), $y+rand(0,34), imagecolorallocate($image, 255,rand(50,240),rand(241,240))); } $pos_x = rand(4,15); $strarr = str_split($_session['replace']); foreach ($strarr ...

service - How to catch specific Exception in VB.NET -

vb.net 2010, framework 3.5 not catch exception identify type of error is. create error write pc's event log when event log full. sample below throws system.componentmodel.win32exception. that's great , doesn't tell me 'event log full', other errors encompassed system.componentmodel.win32exception. safe @ errorcode = -2147467259 or nativeerrorcode = 1502 determine event log full? sub main() try while true ' loop overflow event log eventlog.writeentry("source", "message") loop catch w system.componentmodel.win32exception if w.errorcode = -2147467259 ' errorcode = -2147467259 when event log file full? end if if w.nativeerrorcode = 1502 ' nativeerrorcode = 1502 when event log file full? end if if w.message = "the event log file full" ' code event log full end if if w.errorcode = -214746...

printf - Formated print opening hours (string) in php -

in c there formatted print, allows formatted printing of numbers - aligning them. similar possible in php strings? i have 2 strings $open_time , $close_time . example $open_time="12:00" , $close_time="23:00" . desired output 12:00 - 23:00 7:00 - 20:00 12:30 - 1:00 5:00 - 6:00 output echo 12:00 - 23:00 7:00 - 20:00 12:30 - 1:00 5:00 - 6:00 see 12:00 5 characters, 7:00 4 characters? need add space. there function in php print mask in c (not sure if possible in c) some_print("string_5_charactersspace-spacestring_5_characters", $open_time,$close_time); where space mean space: "%string_5_characters - %string_5_characters" . my simple solution check if string has 5 chars , if not concatenate space 5 chars ... i'm curious if possible 1 function possible printing numbers in c. you looking sprintf() , take @ printf() too.

css - Text image replacement within a link -

i trying replace navigation text images. i've applied images backgrounds, text-indent: -9999px trick doesn't seem working. if apply nav holding links, links , images disappear entirely. if apply links themselves, nothing changes. replacement being made updated wordpress plugin, changing html code prohibitive. <nav class="webcomic-above"> <a href="#" class="webcomic-link webcomic1-link first-webcomic-link first-webcomic1-link">&laquo;</a> <a href="#" class="webcomic-link webcomic1-link previous-webcomic-link previous-webcomic1-link" rel="prev">&lsaquo;</a> <a href="#" class="webcomic-link webcomic1-link random-webcomic-link random-webcomic1-link">&infin;</a> <a href="#" class="webcomic-link webcomic1-link next-webcomic-link next-webcomic1-link current-webcomic" rel="next">&rsaquo;</a> <a h...

apache - A perl/cgi script for uploading files -

i've tried run script: http://www.seaglass.com/file-upload-pl.html . in apache. since i'm running win7 x64, modified script, goes: #! c:\perl64\bin\perl.exe -wt instead of #! /usr/bin/perl page runs smoothly, uploading attempts fail can't open /tmp/outfile writing - no such file or directory error. have created /tmp/outfile directory , a /tmp/outfile.txt file. i'm new perl, , don't know wrong. please advise. /tmp/outfile output filename, not directory name. create c:\tmp, remove c:\tmp\outfile if created directory too.

android - Webview plugins are no longer supported. Is there another way to display flash? -

i making flash game android app following code. works fine compiler gives error the method setpluginstate(websettings.pluginstate) type websettings deprecated here code. webview.getsettings().setjavascriptenabled(true); webview.getsettings().setpluginstate(pluginstate.on); webview.loadurl("file:///android_asset/myflashgame.swf"); this code works wont long. is there way make app of flash game? tried converting .swf file html5 google swiffy game became slow , laggy. there way?

Check if Django queryset is read or write -

i have route django queryset different db's. easy way know if query set read or write method? i have found answer: queryset object has property- queryset._for_write queryset._for_read

How to overwrite tags in local git repository? -

i have local clone of git repository created new tag. didn't push tag remote repository. revert local list of tags match remote. how can achieve that? i have check solution how overwrite local tags git fetch? without success. just delete local tag(s): git tag -d <tag> and re-fetch tags remote: git fetch --tags if want delete local tags: git tag | xargs -n1 git tag -d

javascript - Combining ngClick with ngSwitch -

i know scoping issue, can't seem figure out. want change 1 div 1 pressing button. in other words, ng-click perform necessary changes ng-switch activate. however, buttons both nested within respective ng-switch-when div i'm assuming problem. here fiddle of i'm talking about: http://jsfiddle.net/ggkgx/8/ thank in advance! in angular, ng-switch creates new scope, means variables set in ng-switch constructs aren't accessible outside of it. in current scenario have defined thingtoshow in controller use $parent.thingtoshow <button ng-click="$parent.thingtoshow='two'">switch!</button> demo

android - Getting width of a Custom View -

i need width of custom view i'm creating extending linearlayout. initial stab do int width = this.getlayoutparams().width however, return -1. next, attempted overriding onmeasure(int, int) @override protected void onmeasure(int width, int height) { super.onmeasure(width, height); this.width = measurespec.getsize(width); } this worked width being executed after needed width (i guess view wasn't built yet?) i need google maps method: `map.movecamera(cameraupdatefactory.newlatlngbounds(bounds, width, height, map_padding)); any suggestions on getting width? unless explicitly set view's width/height static value (like x-dp or match_parent), cannot know size of view until onmeasure loop completed. android can call onmeasure multiple times find suitable size, it's not best place find exact size. may have find way delay map.movecamera onlayout function.

mysql - Voting system and PHP session is not working -

i developing voting system in php mysql, in user enter choice through radio button , go in database. on same page, percentage of user votes appears after clicking submit button. but code not work more 1 time. please me sort out query. further detail in program use database table poll in make 2 columns named yes , no , set value 0. then, use 2 variables $i , $j updating value of yes or no in database on click submit button. if "yes" selected $i increments value , using update query saved. fetch value both yes , no columns calculate percentage. i set $_session['yes'] store result of percentage of voters voted "yes", , same variable $_session['no'] . finally, fetch values database store in $i , $j next click, values not changing. php code: <?php ob_start(); session_start(); $conn=mysql_connect('localhost','root',''); mysql_select_db('oop',$conn); global $i,$j; if(i...

php - Display Different Image Based on Google AdWords Ad -

we have many different adwords campaigns various products , i'd have main image on website change depending on google ad user clicked on. for example, if user clicks on ad our widget 1 campaign, i'd display image 1 when arrive @ our website. subsequently, if user clicks on ad our widget 2 campaign, i'd image 2 display when arrive. can done or chasing tail? i don't believe you're doing tail-chasing @ all. the simplest solution can think of put kind of parameter destination url of ads. site can extract parameter , display appropriate image. for example: ads in 'widget1' campaign might have destination url of: http://www.yoursite.com/?c=widget1 ads in 'widget2' campaign might have destination url of: http://www.yoursite.com/?c=widget2 you can extract 'c' parameter incoming request , display image 1 or image 2 appropriately. you might want take on little , extract 'c' parameter when google click id (aka ...

php - Sonata-admin cannot modify classes with inheritance -

Image
i using symfony2 , have hierarchy of classes. hierarchy pretty simple, have question (the parent) , many different sub-questions. using sonata, want able create different types of questions, sub-questions. so, created hierarchy of classes follows : hippy\scavengerhuntbundle\entity\question: type: entity table: null inheritancetype: joined discriminatorcolumn: name: subclass type: string discriminatormap: blurredmultiplechoicequestion: blurredmultiplechoicequestion blurredtextquestion: blurredtextquestion slidingpuzzlequestion: slidingpuzzlequestion associationquestion: associationquestion trueorfalsequestion: trueorfalsequestion lettersinorderquestion: lettersinorderquestion shorttextquestion: shorttextquestion multiplechoicequestion: multiplechoicequestion sentencegapquestion: sentencegapquestion fields: id: type: integer id: true ...

python - Is there a way to output multiple lists from a single list comprehension expression? -

something like x, y = [expression d in data] basically i'd obtain equivalent of this: x = [] y = [] d in data: x.append(d[0]) y.append(d[1]) where data nested list? and if data list of dictionaries? x = [] y = [] d in data: x.append(d['key1']) y.append(d['key2']) and if want apply different function each column data list of dictionaries? x = [] y = [] d in data: x.append(func1(d['key1'])) y.append(func2(d['key2'])) x, y = zip(*[d[:2] d in data]) i think want ... give list of x's , list of y's if each row in data has d[0] , d[1] can do x1,x2,x3 = 1,2,3 y1,y2,y3 = 3,4,5 data = [(x1,y1),(x1,y2),(x3,y3)] x,y = zip(*data) if have dict from operator import itemgetter x,y,z = zip(*map(itemgetter('key1','key2','key3'),data)) if wanted apply function need x,y = zip(*[(function1(row['key']),function2(row['key2'])) row in data])

Creating a dynamically-named variable in PowerShell -

i'd create variable offsetx , x number. right now, use: new-variable -name offset$i where $i integer. however, want offset($i-1) . how change syntax of above statement accomplish this? my latest attempt was: new-variable -name offset+"[int]$i-1" which didn't result in error being thrown, still doesn't accomplish goal. put subtraction part inside $(...) , known subexpression operator . below demonstration: ps > $i = 2 ps > new-variable -name offset$($i - 1) -value value ps > $offset1 value ps >

naming conventions - Rails Load Class With Unconventional Folder Name -

i have module want call oauth , class inside called accesstoken. in rails want put in app/models/o_auth/access_token.rb . how can load path app/models/oauth/access_token.rb ? add require 'app/models/o_auth/access_token' @ top of application.rb , , @ top of other model uses it. you'd have every model, without ror's "convention on configuration" ideal, , magic importer.

ggplot2 - R running average for non-time data -

Image
this plot i'm having now. it's generated code: ggplot(data1, aes(x=pos,y=diff,colour=gt)) + geom_point() + facet_grid(~ chrom,scales="free_x",space="free_x") + theme(strip.text.x = element_text(size=40), strip.background = element_rect(color='lightblue',fill='lightblue'), legend.position="top", legend.title = element_text(size=40,colour="lightblue"), legend.text = element_text(size=40), legend.key.size = unit(2.5, "cm")) + guides(fill = guide_legend(title.position="top", title = "legend:gt='ref'+'alt'"), shape = guide_legend(override.aes=list(size=10))) + scale_y_log10(breaks=trans_breaks("log10", function(x) 10^x, n=10)) + scale_x_continuous(breaks = pretty_breaks(n=3)) + geom_line(stat = "hline", yintercept = "mean", size...

c# - Trim off last directory/folder without using GetParent() -

i trying emulate "cd .." does, without using getparent(). input: /var/mobile/documents/ actual output: /var/mobile/documents/ desired output: /var/mobile/ public arraylist jumpupdirectory() { arraylist directorylisting = new arraylist(); stringbuilder storedpath = new stringbuilder(); foreach (var directories in storedpreviousdirectory.split('/')) { storedpath.append(directories + "/"); } storedpath.replace("//", "/"); directorylisting = iphonefilesystembrowse(storedpreviousdirectory); return directorylisting; } try this: string input = "/var/mobile/documents/"; var parts = input.split(new []{'/'}, stringsplitoptions.removeemptyentries).tolist(); parts.removeat(parts.count - 1); string output = string.concat("/", string.join("/", parts), "/");

Zend Framework 2 routing and setting the defaults 'module', 'controller', 'action' of a route -

i'm using zend 2 version 2.2.5 , skeleton application. added simple 'member' module , inside 'testcontroller.php'. what best way write 'test' route's 'defaults' section? and later, how 'module' name matched route? expect there simple way in zf2 'module', 'controller', 'action', don't know how. option 1: produces 404 error 'defaults' => array( 'module' => 'member', 'controller' => 'test', 'action' => 'index', ), $matchedroute->getparam('module'); prints 'member' $matchedroute->getparam('controller'); prints 'test' $matchedroute->getparam('action'); prints 'index' a 404 error occurred page not found. requested controller not mapped existing controller class. controller: test(resolves invalid controller class or alias: test) option 2: works, 'modu...

C# Code hangs after Pinvoke SendMessage -

i automating test procedures separate windows form application. using pinvoke communicate other application. in application, there button creates new pop window when clicked. i communicating buttons , fields successfully. however, when clicking button code following sendmessage() not run. button clicked , window appears, following code not ran until manually close window. here code: [dllimport("user32.dll")] public static extern int sendmessage(intptr hwnd, int wmsg, intptr wparam, intptr lparam); . buttonhandle = findwindowex(parenthandle, new intptr(0), new intptr(0), windowtitle); sendmessage(childhandle, bm_click, new intptr(0), ""); messagebox.show("this won't show until close window"); everything works fine, except whatever line of code comes after sendmessage() isn't ran until close new window created when button clicked. can explain may going on here? thanks! sendmessage block until recipient...

sql - URlencode with php dynamic drop downs -

i'm working try , establish "safe" dynamic form using php/jquery. trying figure out how encode query result in url, being able display query correctly in browser. ive tried wrapping urlencode around data in each of loops outputs encoded data , disables ability populate second drop down. <!-- populate first dropdown --> <select id="first-choice" name="cardset"> <?php foreach ($data $row): ?> <option><?=htmlentities($row["name"])?></option> <?php endforeach ?> </select> <br /> <!-- populate second dropdown --> <select id="second-choice" name="card"> <option>please choose above</option> </select> <!-- jquery populate second , produce image --> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery....

javascript - Is it possible for an object to have one value when accessed directly and also nested object inside? -

i wondering if it's possible in javascript object property have following behaviour: console.log(obj); // output 'something' console.log(obj.prop_a); // output 'a' and also var = obj; // === 'something' var b = obj.prop_a; /// b === 'a' the object kind of have 2 versions, 1 when access directly, , 1 when access 1 of it's children props thanks yes, can override tostring() method: obj.tostring = function() { return "something"; }

eclipse - Android same layout different data -

i'm creating local android application , trying following: the main menu consists of 4 buttons, each lead (different) list of chapters. layout of chapters view same, trying use 1 layout every chapters page, using different strings depending on button that's being pressed @ main menu. when user presses button 1, list of chapters differs when user presses button 2, etc. i have tried looking solutions, unable find far. there way call set of strings depending on button chosen? have tried use custom list adapter take array of strings parameter? list of chapter simple listview 1 string in each row right?

Table border and caption issue for PDF generation in docx4j -

i'm having issue getting table caption , border output in pdf. i'm using docx4j 3.0.0 had same issue 2.8.1. i have xhtml fragment generated tinymce. processing way docx4j wants it, , convert openxml using xhtmlimporterimpl. use marshaller docx format working , docx4j.topdf pdf format. works cases, italics, underline, bold, alignment, images, etc. when comes table caption , border, works in docx format, not pdf format. excludes table these properties. think xhtml -> openxml working properly, docx4j.topdf not supporting these properties or something. tried searching web no luck. wondering if knew this. the error is java.lang.stringindexoutofboundsexception: string index out of range: 9 @ java.lang.string.substring(string.java:1907) @ org.apache.fop.fo.expr.propertytokenizer.nextcolor(propertytokenizer.java:239) @ org.apache.fop.fo.expr.propertytokenizer.next(propertytokenizer.java:175) @ org.apache.fop.fo.expr.propertyparser.parseproperty(propertyparser.java:118) @...

Ajax Async File Upload: On Upload Complete isn't triggering -

here html: <ajax:asyncfileupload runat="server" onuploadedcomplete="asyncfileuploaderuploadedcomplete" /> here code behind: protected void asyncfileuploaderuploadedcomplete(object sender, asyncfileuploadeventargs e) { string file = "upload complete!"; } when put debug break on string line , run program, never hits debug line. idea why onuploadedcomplete not working? help try modify html: <ajax:asyncfileupload id="fileupload1" runat="server" onuploadedcomplete="asyncfileuploaderuploadedcomplete" />

javascript - Approach to check if callback was last fired? -

i have function looks that: function update() { buildupdate(function(result) { // send result clients }); } this works correctly. if like: // data state 1 update(); // time, buildupdate() won't take long time // work resulting in: // data state 2 update(); // time, buildupdate() take long time // , finish after third call // work resulting in: // data state 3 update(); // time, buildupdate() won't take long time as expected, clients receive 3 updates. in wrong order because third call of update() did finish earlier second. clients point of view looks this: receives update calculated based on data state 1 receives update calculated based on data state 3 receives update calculated based on data state 2 (this update should not sent) is there design pattern or function helps avoid such case? note: doesn't matter if client doesn't receive updates. matters last 1 received must consistent current data state. my idea gener...

css - Bootstrap 3 & Font Awesome clipping -

Image
i have created quick & dirty simple website bootstrap 3 & fontawesome . looks except when on mobile (phone) , phone in landscape (rotated). seeing weird right hand clipping (see below) on 2 of 4 font awesome icons. have tested on several different browsers / mobile phones, same results. correct incorrect - clipping <div class="row rowpad"> <div class="col-sm-3 col-xs-6 text-center"> <a class="btn btn-default btn-lg" href="/menu/"><span class="fa-stack fa-3x"><i class="fa fa-circle fa-stack-2x"></i><i class="fa fa-cutlery fa-stack-1x fa-inverse"></i></span> <h5>menu</h5></a> </div> <div class="col-sm-3 col-xs-6 text-center"> <a class="btn btn-default btn-lg" href="/bar/"><span class="fa-stack fa-3x"><i class="fa fa-circle fa-stack-2x">...

How to find Cell that contains a Range in Word VBA -

in word vba have reference range contained withing table cell. how can reference containing cell (the innermost cell if there nested tables)? what i'm trying achieve find cell containing range, move next adjacent cell. this worked me: debug.print rng.cells(1).next.range.text

javascript - Using phantomsjs, how to get a value and assign it to an element of an array? -

the following piece of code when ran produces "undefined". var getlist = document.getelementbyid('lbexercises').option; console.log(getlist); the html wish data follows: <select id="lbexercises" class="listbox" style="height:400px;width:350px;" name="lbexercises" size="4"> <option value="1270">value want extract 2</option> the issue js code - if helps im running code using phantomsjs filename.js thanks. you first value of first option this: var getlist = document.getelementbyid('lbexercises'); console.log(getlist.options[0].value); see jsfiddle: http://jsfiddle.net/3llbs/ this how assign element of array: var anarray = new array(); anarray[0] = 123; anarray[1] = 456; anarray[2] = 789; // assign new value anarray[1] = getlist.options[0].value; console.log(anarray[1]); see jsfiddle: http://jsfiddle.net/3llbs/1/

excel - Use two drop down list selections to get a final value -

i have 2 drop down lists. first employee name , second given calendar week. want able select employee select week , have cell pull hours second worksheet. have drop down lists done can vlookup work week list meaning hours won't change when selecting employee name. a simple way add column on left of lookup table like: =i2&"|"&j2 then use like: =vlookup(a1&"|"&b1,sheet2!$h$1:$k$4,4,0) in first sheet. vlookup happy when there single possible answer.

javascript - submit form check if checkbox is checked -

i use form signup checkbox 'terms of use' <form action="/signup/signup_success.html" id="regform" class="form-horizontal" novalidate="novalidate" autocomplete="off"> <fieldset> <div class="checkbox"> <label for="agb" id="checkbox_validate" class="hide success">please accept terms of use</label> <label> <input type="checkbox" name="agbcheckbox" id="agbcheckbox"> yes <a target="_blank" href="http://example.de">datenschutzbestimmungen</a>. </label> </div> <div class="buttonwrapper"> <button type="submit" class="try-button" > register ...

c, macro with 2 arguments issue -

#define led 3,3 #define gpiohigh(port,pin) (lpc_gpio ## port->masked_access[(1<< pin)] = (1<< pin)) #define gpiolow(port,pin) (lpc_gpio ## port->masked_access[(1<< pin)] = 0) #define led_on() gpiohigh(led) #define led_off() gpiolow(led) is not working, complaining gpiohigh() , low() needs 2 arguments. there magic trick out there? "led" 3,3 interpreted single argument. complaining missing argument. macro substitutions not literal substitution of 1 another.