Posts

Showing posts from February, 2012

c# - ABCpdf not applying inline css styles -

in aspx page have script following css <style type="text/css"> .subcontainer{margin: 0 auto; padding-top: 20px} .hide-val{display:none;} </style> in browser page loads ok, div class hide-val not displayed when use addimageurl styles not being applied. doc thedoc2 = new doc(); thedoc2.htmloptions.usescript = true; thedoc2.htmloptions.media = mediatype.print; thedoc2.htmloptions.initialwidth = 1048; //for multiple page thedoc2.rect.inset(10, 30); thedoc2.page = thedoc2.addpage(); int theid2; theid2 = thedoc2.addimageurl(urltohtmlpage); while (true) { thedoc2.framerect(); // add black border if (!thedoc2.chainable(theid2)) break; thedoc2.page = thedoc2.addpage(); theid2 = thedoc2.addimagetochain(theid2); } (i

javascript - add condition to run the script only from my computer's IP in jmeter -

Image
how can add condition run script computer's ip in jmeter ? i'm need write in condition line @ if controller ? thanks below function gives ip of computer in running script. __machineip you need use this. ${__machineip} for below steup in picture, statements inside if controller executed if ip of machine matches given ip "13.28.196.100".

c - Understanding how fork() and wait() work together -

this isn't in code review because not understand full concept of code start with. if should still moved let me know. i have code , explain thoughts on it, , hoping can tell me going wrong or getting confused @ because still not sure occurring. #include <sys/types.h> #include <stdio.h> #include <unistd.h> int main() { pid_t pid, pid1; pid = fork(); if (pid < 0) { fprintf (stderr, “fork() failed\n”); return(1); } else if (pid == 0) { pid1 = getpid(); printf (“pid = %d\n”, pid); // printf (“pid1 = %d\n”, pid1); // b } else { pid1 = getpid(); printf (“pid = %d\n”, pid); // c printf (“pid1 = %d\n”, pid1); // d wait (null); } return 0; } from understand, have 2 process id's, parent (pid) , child (pid1). once call pid = fork() , believe child initiated , given id of 0, while parent get's id of child, let 1337. pid = 1337 , pid1 = 0. so skip first if no error has o

asp.net - How do you specify the project configuration when publishing to an Azure website from source control? -

i have configured azure website deploy bitbucket mercurial repository . have 1 branch. logs (see below), looks deployment process uses release configuration. ... myproject.web -> d:\home\site\repository\myproject.web\bin\myproject.web.dll transformed web.config using d:\home\site\repository\myproject.web\web.release.config obj\release\transformwebconfig\transformed\web.config. ... let's have 3 environments, dev, beta, , prod. have web.config transformations each since may have different connection strings or various other different settings across each environment. how can specify different configuration? you can create .deployment file in root of repo , put in it [config] scm_build_args=-p:configuration=debug alternatively can specify in site's app settings portal. this: scm_build_args=-p:configuration=debug for more custom deployment settings can refer this

c# - Cross-domain ajax calls won't work, even though it works in tutorials -

i'm wokring in asp.net. want create cross domain ajax calls webmethod using cors . i've come across many examples on internet, including many tutorials ans questions, somehow none works me. look @ example, it's 1:1 code tutorial found on matter , basic: // default.aspx.cs [system.web.services.webservicebinding(conformsto = system.web.services.wsiprofiles.basicprofile1_1)] public class myservice : system.web.services.webservice { [system.web.services.webmethod] [system.web.script.services.scriptmethod(responseformat = system.web.script.services.responseformat.json, usehttpget = false)] public string helloworld(string test) { string result = ""; result = "success"; return result; } } // global.asax httpcontext.current.response.addheader("access-control-allow-origin", "*"); if (httpcontext.current.request.httpmethod == "options") { httpcontext.current.response.addhead

css - google font import doesn't work on linux -

i'm finishing website have weird problem. have font imported google, in css file. @import url(http://fonts.googleapis.com/css?family=josefin+slab); then normal font-family call on body tag this. body{ font-family:'josefin sans', sans-serif; } it works fine in chrome, firefox, exploder, safari, opera on windows , whatever else i've been able try on. i @ school yesterday between classes working on it, computers in lab linux machines, opened website firefox on linux , font didn't load on of them. defaulted sans-serif. i checked on safari on mac @ work , doesn't load there either. defaults sans-serif. is problem font file types on google , have go import eof , ttf , in order fix this? or else? i suggest uploading font http://www.fontsquirrel.com/ using webfont generator. this give fontface css , different font file types cross browser compatability.

c - Passing pointer to string, incompatible pointer type -

so i'm sure question answered many times having trouble seeing how fix situation. took snippet of program contains warning-generating code: #include <stdio.h> #include <stdlib.h> inputdata(int size, char *storage[size]) { int iterator = -1; { iterator++; *storage[iterator] = getchar(); } while (*storage[iterator] != '\n' && iterator < size); } main() { char name[30]; inputdata(30, name); } the warning message: $ gcc text.c text.c: in function ‘main’: text.c:18:5: warning: passing argument 2 of ‘inputdata’ incompatible pointer type [enabled default] inputdata(30, name); ^ text.c:4:1: note: expected ‘char **’ argument of type ‘char *’ inputdata(int size, char *storage[size]) edit: ok, managed play around syntax , fixed problem. still wouldn;t mind hearing more knowledgeable why precisely needed. here changed: #include <stdio.h> #include <stdlib.h> inputdata(int size, char *storage) //

ios - How do I get rid of the -16 when doing horizontal layout to the edge of the superview in Xcode 6? -

Image
when try layout view edge of super view in xcode 6 storyboards constraint generated has constant of -16. why this, , how can make 0? the -16 because constraint set against superview.trailing/leading margin not edge of superview. can fix selecting constraint , in info in top right select drop down superview item , toggle relative margin off.

JQuery Mobile Popup with Canvas -

i looking create popup in jquery mobile has canvas embedded in it. the trick need popup/cavans launch in landscape mode.. no matter current orientation of screen? any advice? thanks you use css transform on popup content rotate 90 degrees when detect device in portrait mode. create css class performs rotation (-90 counter clockwise, 90 clockwise): .rotateccw { -ms-transform: rotate(-90deg); -moz-transform: rotate(-90deg); -o-transform: rotate(-90deg); -webkit-transform: rotate(-90deg); transform: rotate(-90deg); } then on popup popupbeforeposition event, check orientation , either add or remove css class: $("#popupdialog").on("popupbeforeposition", function(event, ui) { if (is_landscape()){ $("#popupdialog").removeclass("rotateccw"); } else { $("#popupdialog").addclass("rotateccw"); } }); function is_landscape() { return (window.

javascript - prevent duplicated item in jQueryUI sortable -

fiddle example i trying prevent duplicated items being dragged #sort2 #sort using condition check if there identical items based on title attributes in #sort2 . if there duplicated, remove old 1 before appending new one $("#sort2").sortable({ receive: function (e, ui) { var title = ui.item.attr('title'); var img = $('#sort2').find('img[title="'+title+'"]'); console.log(title); if(img.length) { img.remove(); } ui.sender.data('copied', true); } }); but attempt didn't work, removes item being dragged #sort2 . can show me how that? $("#sort").sortable({ connectwith: ".connectedsortable", helper: function (e, li) { this.copyhelper = li.clone().insertafter(li); $(this).data('copied', false); return li.clone(); }, stop: function () { var copied = $(this).data('copie

Dynamically create object of DLLs form Factory - C++ -

hi have 6 projects defined in ide. eventhelper configparser officeeventhandler messaging loggingandpersistence screencamera eventhelper has entry point. rest of projects dll gets absorbed eventhelper . messaging , configparser being used in every other dlls well. code loading dlls , acessing common in modules (code redundancy). dllhandle_parser = ::loadlibrary(text("configparser.dll")); if (!dllhandle_parser){ return; } configparserclient_fctry = reinterpret_cast<configparser>(::getprocaddress(dllhandle_parser, "getparserinstance")); if (!configparserclient_fctry) { ::freelibrary(dllhandle_parser); return; } parser = configparserclient_fctry(); and similar code messaging my question is there way can have 1 dll called objectfactory can give name of class (in runtime, in string format) created. objectfactory.getinstance("configparser/messaging") . (java class.forname("classname") ) or if not possibl

richfaces - Rich:ExtendedDataTable using frozenColumns makes non frozen columns disappear -

i trying freeze columns in rich:extendeddatatable using frozencolumns attribute. when not using attribute every column visible it's supposed in normal case, when use attribute ( frozencolumns="2" ) 2 frozen columns showing , other non frozen columns not showing @ all, not scrollbar. using rich:columns extended datatable. alright managed sort out. problem div in extendeddatattable contained. div had given styling class ' .searchcontent table { width:1000px'} ' so when use frozencolumn attribute, in html format spilts table 2 tables frozencolumns in 1 , non frozen columns in other. given 1000px styling width assigned first table has frozen columns , 1000px width of parent container div. shows first table making second table, has non frozen columns , scroll stuffs, disappear. i removed styling class , got working. cheers.

OWL Carousel 2: current item when page loads -

i need change class current item when page loaded. i'm showing caption in current item. here code: $(document).ready(function() { $('#slider').on('change.owl.carousel changed.owl.carousel', function(e) { if (e.property.name != 'position') return; var current = e.relatedtarget.current() var items = $(this).find('.owl-stage').children() var add = e.type == 'changed' items.eq(e.relatedtarget.normalize(current )).toggleclass('current', add) }); $('#slider').owlcarousel({ items : 2, nav: true, loop: true, }); }) here working example: http://jsfiddle.net/kurtko/1qdurrlz/16/ this code works fine when carousel changes fails when page loaded because e.relatedtarget.current() null any ideas? thanks. you have use initialized event this: $(document).ready(function() { $('#slider').on('init

CreateTextFile Method is basic fails to create file at specified path -

i using basic first time automate lecroy oscilloscope. following examples provided them attempting create program uses oscilloscope features , prints measured values file. the oscilloscope specific features appear function correctly file creation code not create file @ specified path. private sub makefile() fso = createobject("scripting.filesystemobject") myfile = fso.createtextfile("e:\test.txt") end sub when run script produces nothing. haven't used basic before , naively seems should, bare minimum, create file @ path specified. seems compared examples provided lecroy. i use method examples provided make use of: on error resume next set fso = createobject("scripting.filesystemobject") set myfile = fso.opentextfile("d:\hardcopy\logfile.txt", 8, true) also basis of oscilloscope windows 7 pc , claim both basic , additional methods work within system. i don't know if me being unable basic or if there nuance m

sql server - Order by clause doesn't work when Select DISTINCT from #temp table -

basically, have complicated join statement temporary store result in #temp table, need reuse #temp table multiple other queries. here sample code: insert #temp_table select --some complicated join statement --many tables --some complicated conditions order case when @orderby = 'lname' (last_name + first_name) end, case when @orderby = 'fname' (first_name + last_name) end @orderby accept either 'lname' or 'fname' , cannot null. until part, working fine. then, when perform following query: select distinct * #temp_table there absolutely no sorting in result table anymore. i have tried sorting @ #temp_table, such this: select distinct * #temp_table order case when @orderby = 'lname' (last_name + first_name) end, case when @orderby = 'fname' (first_name + last_name) end but give me error saying "order items must appear in select list if select distinct specified." notes: there last_name , first_name colum

jquery - How do I extract JSON string using a JavaScript variable? -

i trying retrieve corresponding dial_code using name obtaining variable. the application uses map of world. when user hovers on particular country, country obtained using 'getregionname'. used alter variable name . how can use variable name retrieve dial_code relates to? json var dialcodes = [ {"name":"china","dial_code":"+86","code":"cn"}, {"name":"afghanistan","dial_code":"+93","code":"af"} ]; the following code runs on mouse hover of country var countryname = map.getregionname(code); label.html(name + ' (' + code.tostring() + ')<br>' + dialcodes[0][countryname].dial_code); this code doesn't work correctly. dialcodes[0][countryname].dial_code part causing error, i'm not sure how correctly refer corresponding key/value pair if have support old browsers: loop on entries in array , compare given n

android - Assigning unique tag to list item in a list -

i need setting tags in viewholder object. have list longer screen (on phone) , need set different tag each view. can see in preview app (link below)in exterior fragment first item , last item binded together. dont' want that, want every views unique. how can that. https://drive.google.com/file/d/0b2xlu23gjnfvtegtbkprothtmmm/edit?usp=sharing thanks my inspectionlistadapter public class inspectionlistadapter extends arrayadapter<string> { private final activity context; private final string[] inspectiontitles; private final string[] description; public inspectionlistadapter(activity context, string[] inspectiontitles, string[] description) { super(context, r.layout.inspection_item_layout, inspectiontitles); this.context = context; this.inspectiontitles = inspectiontitles; this.description = description; } public static class viewholder { public imageview imageview, expandbutton; public textview txttitle; public textview txtdesc

Write Ruby Hash with duplicate values without repeating value -

i have following code in rails controller: @users = user.where(["first_name = :first_name or last_name = :last_name or company = :company", { first_name: term, last_name: term, company: term }]) term term = params[:search] i don't i'm repeating term { first_name: term, last_name: term, company: term } is there dryer way accomplish this? thank you! you can this: @users = user.where("first_name = :term or last_name = :term or company = :term", term: term)

android - Robospice. Retry failed request on demand -

i need implement quite popular template of app behaviour - give opportunity user retry failed requests. right catch failed request spiceservicelistener , , shows dialog user can press "retry" button. unfortunately, using same cachedspicerequest object spicemanager.execute() don't give desired behaviour, because rs removing request listeners maprequesttolaunchtorequestlistener if request wasn't successful. request can work fine, not return information activity. is there easy way (without modifying code of library) implement this? unfortunately looks there no abstract solution situation this, had add code in every request. getspicemanager().execute(r, new requestlistener<countprofiles>() { @override public void onrequestfailure(spiceexception spiceexception) { if (act.getsupportfragmentmanager().findfragmentbytag("network_problem") == null) { networkproblemdialogfragm.newinstance(r, this)

java - Why solr reindex data on highlighting? -

i wrote custom tokenizer solr, when first add records solr, going throug tokenizer , other filters, when going through tokenizer call web service , add needed attributes. after can use search without sending requests web service. when use search highlighting data going through tokenizer again, should not going through tokenizer again? when highlighter run on text highlight, analyzer , tokenizer field re-run on text score different tokens against submitted text, determine fragment best match query produced. can see this code around line #62 of highlighter.java in lucene . there few options might negating need re-parse document text, given options on the community wiki highlighting : for standard highlighter: it not require special datastructures such termvectors, although use them if present. if not, highlighter re-analyze document on-the-fly highlight it. highlighter choice wide variety of search use-cases. there 2 other highlighter-implementations migh

python - Running a module that I've created out of Enthought Canopy -

i've created module, , access through python script in enthought canopy. when attempt same thing using python directly through command line, works fine -- import myfile.py. additionally, know default python distribution on machine enthought canopy. know why i'm not able access module i've created within python script in canopy editor? says there 'no module named myfile', though myfile.py in same directory. there issue current working directory--it's not set default file saved. cd ing directory module in fixed it.

php - Time-out error uploading file using Dropbox API -

i try upload file dropbox using api , php. thats code: require_once "dropbox/lib/dropbox/autoload.php"; use \dropbox dbx; $appinfo = dbx\appinfo::loadfromjsonfile("app_info.json"); $csrftokenstore = new dbx\arrayentrystore($_session, 'dropbox-auth-csrf-token'); $webauth = new dbx\webauth($appinfo, "noteboxapp/0.01", "http://localhost/notes", $csrftokenstore, null); $title=$_post["titulo"].".txt"; $nota=$_post["conteudo"]; $accesstoken=$_session["token"]; $clientidentifier=$_session["userid"]; $client= new dbx\client($accesstoken, $clientidentifier); $file = fopen($title, "w") or die("unable open file!"); fwrite($file, $nota); $stat = fstat($file); $size = (int) $stat['size']; $dropboxpath="/aplicativos/notes01"; try{ $metadata = $client->uploadfile($dropboxpath, dbx\writemode::add(), $file, $size); } catch(exception $e) { ech

c# - Parse a key1="foo",key2="bar" CSV string into a Dictionary(Of TKey, TValue) -

please take following string: cbr="lacbtn",detnumber="1232700",laclvetype="ann=x",laccalcrun="2014-09-10",lacbutton="y",lacaccdays="0.00000000",lacentdate="2014-03-31",lactotdays="32.00",laclastent="2014-04-01",lacsrvdays="3,4",status="ok" its output 3rd party sdk , need access values in our .net application. what objects available in .net 2 parse string dictionary(of tkey, tvalue) ? for instance, we'd grab values using key names, instance: dim x = whatever("detnumber") '#### x contain "1232700" i started coding manual stuff split on commas got messy when "," & "=" existed inside quoted values, example: key1="foo,bar",key2="hello=dorothy!" & thought myself must exist parse type of string? i'm not having luck finding anything. suggestions in either vb.net or c# fine. string

php - PhalconPHP MVC Micro app: Specify a request path and assert the response code -

i've followed unit testing tutorial , modified test http request micro mvc app, based on post . can validate output string, i'm not sure how assert response status code or change request path. index.php <?php $app = new \phalcon\mvc\micro(); #default handler 404 $app->notfound(function () use ($app) { $app->response->setstatuscode(404, "not found")->sendheaders(); }); $app->post('/api/robots', function() use ($app) { //parse json object $robot = $app->request->getjsonrawbody(); //build response $app->response->setjsoncontent($robot); return $app->response; }); $app->get('/', function() { echo 'hello'; }); $app->handle(); tests/unittest.php class mvcmicrounittest extends \unittestcase { public function testnotfound() { $path = '/invalid'; $mockrequest = $this->getmock("\\phalcon\\http\\request"); //todo: set inva

How to convert Arraylist to Json in Java -

i have arraylist, arraylist holds bunch of domain object. it's below showed: domain [domainid=19, name=a, dnsname=a.com, type=0, flags=0] domain [domainid=20, name=b, dnsname=b.com, type=0, flags=12] domain [domainid=21, name=c, dnsname=c.com, type=0, flags=0] domain [domainid=22, name=d, dnsname=d.com, type=0, flags=0] my question how convert arraylist json? data format should be: { "param":{ "domain":[ { "domid":19, "name":"a", "dnsname":"a.com", "type":0, "flags": }, ... ] } not sure if it's need, can use gson library ( link ) arraylist json conversion. arraylist<string> list = new arraylist<string>(); list.add("str1"); list.add("str2"); list.add("str3"); string json = new gson().tojson(list); or in case: arraylist<domain> list = new arraylist<domain>(

ios - Lock App into one specific orientation in Cocos2D v3 -

i trying disable screen rotation in cocos2d-3.x , cannot figure out how. have following code in ccappdelegate : -(bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { setupcocos2dwithoptions: [self setupcocos2dwithoptions:@{ ccsetupshowdebugstats: @(yes), // run in portrait mode. ccsetupscreenorientation: ccscreenorientationportrait, }]; return yes; } the screen in portrait mode, rotates portrait upsidedown. read cocos2d uses uiviewcontroller should use apple method this? cocos2d allows choose between "landscape" or "portrait" doesn't allow specify orientation more specific. fixed in cocos2d can modify cocos2d source code workaround. have opened github issue problem. implementing supportedinterfaceorientations in ccappdelegate not fix issue because method implemented ccnavigationcontroller , overrides settings. open "ccappdelegate.m"

shell - When creating symbolic links on ubuntu I sometimes get an odd result -

i'm trying create bunch of symbolic links files in directory. seems like, when type command in shell manually, works fine, when run in shell script, or use arrow re-run it, following problem. $ sudo ln -s /path/to/my/files/* /the/target/directory/ this should create bunch of sym links in /path/to/my/files , if type command in manuall, indeed does, however, when run command shell script, or use arrow re-run single symbolic link in /the/target/directory/ called * in link name '*' , have run $ sudo rm * to delete it, seems insane me. when run command in script, there files in /path/to/my/files ? if not, default wildcard has nothing expand to, , not replaced. end literal "*". might want check out shopt -s nullglob , run ln command this: shopt -s nullglob sudo ln -s -t /the/target/directory /path/to/my/files/*

java - Defining required hash values in a javadoc -

let's have java method this: void configure(map<string, string> values) { assert values.containskey("x"), "missing parameter x" } is possible specify in javadoc comment "x" required value in values ? if can change method's signature, , assuming x mandatory parameter, there other (optional) parameters map may contain, communicate in signature via void configure(string xvalue, map<string, string> optionalvalues = [:]) { }

Creating a Reusable Component in AngularJS -

i new stackoverflow. i'm new angularjs. apologize if i'm not using correctly. still, i'm trying create ui control angularjs. ui control this: +---------------------+ | | +---------------------+ yup. textbox, has special features. plan on putting on pages buttons. thought developer, want type this: <ul class="list-inline" ng-controller="entrycontroller"> <li><my-text-box data="entereddata" /></li> <li><button class="btn btn-info" ng-click="enterclick();">enter</button></li> </ul> please note, not want buttons in control. want entereddata available on scope associated child controls. in other words, when enterclick called, want able read value via $scope.entereddata . in attempt create my-text-box , i've built following directive: myapp.directive('mytextbox', [function() { return { restrict:'e',

Filter users by user group in tastypie -

this user resource class class userresource(modelresource): class meta: queryset = user.objects.all() allowed_methods = ['get', 'post', 'put', 'patch'] resource_name = 'user' excludes = ['password'] #authentication = sessionauthentication() #authorization = djangoauthorization() authorization = authorization() authentication = authentication() always_return_data = true filtering = { 'id': all, 'username': all, 'groups': all_with_relations } i want filter user group names. /api/v1/user/?format=json&groups__name=group_name the above format not working. how can filter in request? you have add relational fields model going use resource. in first place have create model resource group model. create many field in userresource linked groupresource. something this: class

html - Bootstrap navbar displaying 2 rows when screen size is not mobile -

i'm using bootstrap3, trying build responsive navbar. @ normal resolutions, navbar taking 2 rows. @ small resolutions, (correctly) takes 1 row. how can make link4 , link5 appear on same row links 1-3? (fiddle below code) <div class="navbar navbar-inverse navbar-static-top" data-role="navigation"> <div class="navbar-header navbar-left"> <a class="navbar-brand" href="#">title</a> <button type="button" class="navbar-toggle navbar-left left pull-left collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"> <span class="sr-only">toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <button type="button" class=&q

Custom pageing plugin in jquery -

Image
i have build custom paging plugin in jquery. have write code stuck in 1 place paging default number 10 page when user click on greater page 8 should show 2 further page. expected result shown below. fiddle $(function(){ $.fn.pageing= function(options){ var settings =$.extend({ // these defaults. totalpage: $(this).find('li').length, currentpage: 2, defaultdisplay:10 }, options), el= this; var defaultfunction= { showdefault: function(){ for(i=0; i<(settings.defaultdisplay);i++){ $(el).find('li').eq(i).show() } }, selectcurrentpage: function (){ $(el).find('li:eq('+settings.currentpage+')').addclass('active') } } defaultfunction.showdefault(); defaultfunction.selectcurrentpage(); } $('ul').pageing({defaultdisplay:10}) }) i have worked on more , find 1 solution. fiddle $(function(){ var apply= { init: function (settings){ if(apply.isnegative(settings.moving-settings.defaultdisplay) && settings

python - How to enumerate starting with custom number -

using: mylist=['one','two','three'[ i,each in enumerate(mylist): print i,each results to: 0,'one' 1,'two' 2,'three' as can see enumerate starts iterating i=0, 1, 2 , one. if start other 0 value, lets want 5. result be: 5,'one' 6,'two' 7,'three' is doable? just pass in starting number: for i,each in enumerate(mylist,5): # <- start @ 5 mylist=['one','two','three'] i,each in enumerate(mylist,5): print i,each 5 1 6 2 7 3

php - REST API wrapper design -

i'm writing wrapper (adapter pattern) number of rest calls. i'm trying decide how response object should able do. class job { private $xml; public function __construct(simplexmlelement $xml) { $this->xml = $xml; } public function getname() { return $this->xml->name; } public function getid() { return $this->xml->id; } ... ... ... } class restmanager { private $client; public function __construct(guzzle $client) { $this->client = $client } public function getjobbyname($name) { $job = $this->client->get('/query/job/' . $name); return new job($job->asxmlobj()) } } so have similar above. once have job object want additional information such as, list of items in job. requires server call should ask job items class job { private $manager; ... ... public function addmanager(restmanager $manager

c# - MVC 5 Creating all elements of model that has one to one relationship with another model -

i've been searching , trying figure out on own while now, , haven't been successful, i'll see if can me out here... i'm building mvc 5 web application ef 6 code-first. 'model1' contains single "public virtual 'model2'" (one 1 relationship). now, issue is: i need able create model1 it's associated model2 in 1 view click of single "submit" button. i need view 1 can open details model1 , add model2 it. in other words: have company has address. users should able create new company related address, , separately, @ company details , add address if don't have 1 related them. i've managed figure out editing existing address in company, haven't been able figure out other 2 things. any appreciated. if necessary, can provide code explain situation more clearly. thanks!

How can split field results with multiple values in PHP? -

i try split field multiple values, have field.. colors values separated |.. blue|yellow|green|white function getautocomplete($term) { global $db; global $config_table_prefix; $result = $db->fetchrowlist("select `colors` ".table_colors." `colors` '$term%' limit 10"); //this code need code here split values return $result; } i assume working php use function explode() , you'll array : $result = explode("|", $result);

angularjs - Setting input type text values for ngdialog -

i trying set values input type="text" in ngdialog server, find populating dummy values not make values show "in dialog" - in if set values in form using javascript see them on textbox in view. however, not seem work ngdialog, - inspite of binding textbox ng-model , name attributes. question is, ngdialog setting text using $modelvalue not show values in text box? for e.g - $scope.myform.mytextbox.$modelvalue = "xyz" not show form in html similar shown below - <div class="container-fluid" ng-controller="addusercontroller"> <div class="text-center"> <label class="sub-header">add user</label> </div> <form action="...r" method="post" name="myform"> <div> <div> <input type="text" class="form-control" ng-model="mytextbox" name=&q

android - 3 Pane Layout using SlidingPaneLayout like Yatra.com -

Image
i want 3 column pane layout yatra.com app in sliding pane can slide either left or right side. slidingpanelayout accepts 2 panes. when try put 3 fragments in there doesn't show @ all. i tried changing sliding pane fragment view, solution hacky , doesn't slide right @ all. got successful in having 3 panes using navigationdrawer, don't want pane overlay main fragment. my question is, possible have 3 panes using slidingpanelayout or should try else. if it's possible how can achieved? missing something? use this library has demo on play store download libraries required sliding drawer lib, download sample , see left , right activity similar wanted... the main code set left , right drawer line: getslidingmenu().setmode(slidingmenu.left_right); getslidingmenu().settouchmodeabove(slidingmenu.touchmode_fullscreen); setcontentview(r.layout.content_frame); and populate right fragment this: getslidingmenu().setsecondarymenu(r.layout.menu_fr

powershell - Find a value in excel and print it -

i'm stuck powershell once more. here scenario: have excel sheet report in it. within excel file there 2 lines i'm looking for total number of errors = 0 total number of fatal errors = 0 the problem these 2 lines spaces after "errors" may vary depending on report. issue number of errors (in case 0) in same cell. what i'm trying find 2 lines , return number of errors. here code looks far. know it's missing stuff , not working. tried lots of regular expressions no luck. any appreciated. thank in advance. $file = "c:\test\setup.xlsx" $excel = new-object -comobject excel.application $excel.visible = $true $workbook = $excel.workbooks.open($file) $worksheets = $workbooks.worksheets $worksheet = $workbook.worksheets.item(1) $range = $worksheet.usedrange $keywords="fatal errors", "errors" $filter = "total number of"+ ($(($keywords|%{[regex]::escape($_)}) -join "|")) $search = $range.fi

How to Keep Docker Container Running After Starting Services? -

i've seen bunch of tutorials seem same thing i'm trying do, reason docker containers exit. basically, i'm setting web-server , few daemons inside docker container. final parts of through bash script called run-all.sh run through cmd in dockerfile. run-all.sh looks this: service supervisor start service nginx start and start inside of dockerfile follows: cmd ["sh", "/root/credentialize_and_run.sh"] i can see services start correctly when run things manually (i.e. getting on image -i -t /bin/bash), , looks runs correctly when run image, exits once finishes starting processes. i'd processes run indefinitely, , far understand, container has keep running happen. nevertheless, when run docker ps -a , see: ➜ docker_test docker ps -a container id image command created status ports names c7706edc4189 some_name/some_repo:blah "sh /roo

python - Entrez epost + elink returns results out of order with Biopython -

i ran today , wanted toss out there. appears using the biopython interface entrez @ ncbi, it's not possible results (at least elink) in correct (same input) order. please see code below example. have thousands of gis need taxonomy information, , querying them individually painfully slow due ncbi restrictions. from bio import entrez entrez.email = "my@email.com" ids = ["148908191", "297793721", "48525513", "507118461"] search_results = entrez.read(entrez.epost("protein", id=','.join(ids))) webenv = search_results["webenv"] query_key = search_results["querykey"] print entrez.read(entrez.elink(webenv=webenv, query_key=query_key, dbfrom="protein", db="taxonomy")) print "-------" in ids: search_results = entrez.read(entrez.epost("protein", id=i)) webenv = searc

javascript - Why does my image preloading method work? -

my question the goal make sure images loaded before new game can begin. second solution (fiddle b) achieves goal more consistently , accurately first solution (fiddle a). why? jsfiddle a jsfiddle b methods here both of fiddle solutions preload images: there array of absolute image urls of assets required game the init() function has loop generates new canvas image() per url in array each newly created image pushed array so, have first array containing url strings, , second array containing 'htmlimageelement' objects fiddle b differs fiddle a, in utilises '.onload' event, plus counter. 2 fiddles use different ways of checking see if image assets have loaded: fiddle a: compares length of 2 arrays. if match, start game for (var = 0; < allgameimageurls.length; i++) { var img = new image(); img.src = allgameimageurls[i]; allgameimages.push(img); console.log(allgameimages.length); if (allgameimages.length

php - Use array of keys to access multidimensional array? -

for example, if had array: $my_array = array('a' => array('b' => 'c')); is there way access this: $my_value = access_array($my_array, array('a', 'b')); // $my_value == 'c' i know write this, i'm curious if exists in php already. easy function get_nested_key_val($ary, $keys) { foreach($keys $key) $ary = $ary[$key]; return $ary; } $my_array = array('a' => array('b' => 'c')); print get_nested_key_val($my_array, array('a', 'b')); for functional programming proponents function get_nested_key_val($ary, $keys) { return array_reduce($keys, function($a, $k) { return $a[$k]; }, $ary); }

How to solve battling Type & Warning popups in Intellij Scala editor -

Image
in intellij, when hover of variable, helpfully show type above it: and if have error or warning, hover helpfully show warning below it. however, of time warning related variable, millisecond of warning popup replaced type unlike above images, there isn't enough time read warning. there way defeat behavior or change 1 of 2 winds pop-up war? in preferences -> scala, there option named 'show type info on mouse motion delay'. change delay, or uncheck box. this stackoverflow question related.

git - How can I find who pushed a tag(s) to BitBucket -

we deleted unwanted tags our bitbucket repository , (so thought) our local repositories, have missed 1 repo somewhere keep getting re-pushed. how can find out pushing them? you can't find (maybe bitbucket support has log), but, workaround, add post-receive hook (like a post one ) in order git client notified of push. that git client check if tags pushed, and, if tags unwanted, push deletion.

sql server - Adding Trailing Zeros to an int field in SQL -

in process of resequencing web items, trying append 4 zeros on end of each item sequence number. try not work, seems automatically remove trailing zeros because of formatting. int field. thing got work 1 item test doing replace such as: update sacatalogitem set itm_seq = replace(itm_seq, '8021', '80210000') itm_id = '13' , ctg_id = '917' i have tried using cursor replace , strips trailing zeros when executing this: declare @seq int declare @id int declare @ctg int declare cur cursor select a.itm_seq, a.itm_id, a.ctg_id sacatalogitem join saitem b on b.itm_id = a.itm_id a.cat_id = '307' , a.itm_id = '13' , a.ctg_id = '917' open cur fetch next cur @seq,@id,@ctg while (@@fetch_status=0) begin update sacatalogitem set itm_seq = replace(itm_seq, @seq, @seq + '0000') itm_id = @id , ctg_id = @ctg update saitem set itm_import_action = 'p' itm_id = @id fetch next cur @seq,@id,@ctg end close cu

Magento fall-back on theme -

i installed theme on magento instance, i'd further customize. imagine similar magento's fallback hierarchy theme can fall-back on default packages, should able structure directories in such way can make changes particular parts of theme maintaining similar structure , relying on fall-back. so here's question: how can develop child-theme of theme, fall-back setup way? performed structuring directories way, or performed other way? thanks! if using magento ee 1.14 or ce 1.9 can utilize method described here make child-theme: http://www.magentocommerce.com/knowledge-base/entry/ee114-ce19-rwd-dev-guide http://alanstorm.com/magento_parent_child_themes important: it's important have theme.xml in app/design/frontend/custompackage/customtheme/etc directory contents shown. failure configure theme.xml correctly prevents magento loading theme. you must create theme structure noted , place theme.xml file within it, containing following code: magento

Spring Roo 1.2.5 + Oracle database = ORA-00902: invalid datatype -

using oracle 11g express edition 11.2.0.2.0 database, have simple project using following roo script: // spring roo 1.2.5.release [rev 8341dc2] log opened @ 2014-09-10 17:06:13 project --toplevelpackage com.example --java 7 --packaging jar --projectname testbug jpa setup --provider hibernate --database oracle --hostname 192.168.3.44 // edits database.properties allow access oracle xe entity jpa --class ~.domain.abstracttestclass --abstract field string --fieldname stringname entity jpa --class ~.domain.concretetestclass --extends ~.domain.abstracttestclass --testautomatically // test succeeds perform test field boolean --fieldname testfield // test fails perform test the failing test results in following error: hhh000389: unsuccessful: create table abstract_test_class (dtype varchar2(31) not null, id number(19,0) not null, string_name varchar2(255), version number(10,0), monkey boolean, primary key (id)) 2014-09-10 17:24:36,534 [main] error org.hibernate.tool.hbm2ddl.schem

mongodb - Mongo Group Query using the Ruby driver -

i've got working mongo query need translate ruby: var reducer = function(current, result){ result.loginscount++; result.lastlogints = math.max(result.lastlogints, current.timestamp); } var finalizer = function(result){ result.lastlogindate = new date(result.lastlogints).toisostring().split('t')[0]; } db.audit_log.group({ key : {user : true}, cond : {events : { $elemmatch : { action : 'login_success'}}}, initial : {lastlogints : -1, loginscount : 0}, reduce : reducer, finalize : finalizer }) i'm hitting several sticking points getting work in ruby. i'm not familiar mongo, , i'm not sure pass arguments method calls. best guess, after connecting database , collection called audit_log: audit_log.group({ "key" => {"user" => "true"}, "cond" => {"events" => { "$elemmatch" => { "action" => "login_success&qu