Posts

Showing posts from March, 2010

multithreading - threads safe linked list fine grained in C -

i'm implementing linked list fine grained locking, meaning lock in every node. when i'm adding new node, want pass 2 arguments: key , value. how can make sure each node has different lock? lock implemented pthread_mutex_t . this implementation add: int setos_add(int key, void* value) { volatile setos_node* node = head; volatile setos_node* prev; pthread_mutex_t new_mutex; //wrong: put same lock //lock head node if(pthread_mutex_lock(&(node->mutex)) == 0){ printf("failed locking\n"); exit(1); } // go through nodes until key of "node" exceeds "key" // new node should between "prev" , "node" while ((node != null) && (node->key < key)) { prev = node; //already locked node = node->next; //locking 2 nodes each time if (node != null){ if(pthread_mutex_lock(&(node->mutex)) == 0){ printf("failed locking\n"); exit(1); } ...

javascript - Cannot Read Property of Undefined JQuery Option Tag -

i getting error cannot read property '####' of undefined (#### being number attempt use) the goal retrieve inner html/text of form options based on number provide. here example of text trying retrieve using jquery can send form data. <select> <option value="1">sword</option> </select> in example, trying retrieve text -> "sword" based on option value "1". how attempt this: $item = $_post['item']; $option = "option[value='".$item."']"; $_post['item'] returns number (in example, "1") use retrieve inner text of option given value. the following directly after 2 lines above, attempts set jquery variable option. echo '<script type="text/javascript">var option = $(option[value="'.$item.'"]).html();</script>'; lastly jquery code, uses $option variable initialized earlier attempt retrieve text inside...

android - Replacing fragments quickly causes a weird screenshot of the previous fragment to persist and brought forward -

Image
i'm using homeactivity replaces fragments dynamically , adds content frame layout dynamically user selected items drawer. on each fragment, loads feed network renders. here code use switch - public void loadfragment(fragment frag, string tag) { fragmentmanager fragmentmanager = getsupportfragmentmanager(); fragmenttransaction fragmenttransaction = fragmentmanager.begintransaction(); fragmenttransaction.replace(r.id.content_fragment, frag, tag); try { fragmenttransaction.commit(); } catch (illegalstateexception e) { logger.error(tag, "failed commit fragment transaction... ", e); } } now if switch between these fragment drawer (drawerlayout being used) , not let network request each fragment complete, somehow new fragment replaced placed underneath screenshot of old fragment while loading. since old fragment showing values cache, shows partial feed. now if notice top of stack has fee...

C - Simple Linked List program that handles strings -

the program specifications pretty simple, read in input file of words , create linked list each node contains entire string. here's node struct: typedef struct wordnode{ char *word; token_type type; struct wordnode *next; } wordnode; the token type come play later after ll basics working. the general process of main open input file, set head first word, iterate through rest of input file using second node pointer, "current". afterwards, print list head pointer print list function. void printlist(wordnode *head) { while(head != null) { printf("%s ", head->word); head = head->next; } } int main() { //open input file file *input = fopen("input.txt", "r"); char nextword[12] = ""; //scan in first word head node fscanf(input, "%s", nextword); //create head, fill in first word, , create current wordnode *head = malloc(sizeof(wordnode)); ...

c# - could not load all results for selected value in asp.net -

how modify items in listbox when databound. suppose have 1 listbox , 1 combobox.i want display results in listbox value selected in combobox , remove other value in listbox in windows form in asp.net. i think should add onselectedindexchanged combobox , set autopostback="true" then selecting item should trigger post , call method set onselectedindexchanged. there can fill listbox values , remove selected item listbox too.

javascript - don't can use Enter key from textarea -

in project need diable enter key textbox , because don't want post page when enter key button . use code disable enter key : $(document).keypress( function (event) { if (event.which == '13') { event.preventdefault(); } }); its work fine , when add textarea in page , cant enter key break line , because enter key disabled . how can enable enter key textarea? i don't know if recommended attach global keypress handler that. regardless, easiest way out be $(document).on('keypress', function (event) { if (event.which == '13' && event.target.tagname != 'textarea') { event.preventdefault(); } }); in above, checking tagname of event.target see if element in enter occured textarea or not however, recommend approach $('form').on('keypress', 'form', function (event) { if (event.which == '13') { event.preventdefault(); } ...

json - JMS Serialize ArrayCollection as an object -

i'am using jms serializer. jsonserializer gives me incorrect array format when works doctrine arraycollection types. spected results should follow format [ {}, {} ] gives me { 1: {}, 2: {} } . additional information scenario. occurs when try serialize object contains object contains arraycollection , arraycollection includes first level object. example: { "description":"text provided", "date":"1434145921000", "oid":1, "usercreator":{ "username":"name123", "password":"psw", "oid":2, "name":"the-name", "lastname":"the-lasname", "announcements":{ "1":{ "description":"more text", "date":"1434745921000", "oid":3 }, "2":{ ...

Create an array of sub-arrays with the value of an element and the number of times it has repeated in JavaScript -

i'm trying take array (for example, array of years) , make new array of sub-arrays tells, firstly, unique element in original array and, secondly, how many time repeated. for example, lets start of array of numbers [1999, 1999, 2000, 2005, 2005, 2005, 2015] i function return array [[1999, 2], [2000, 1], [2005, 3], [2015, 1] ] because year 1999 repeated twice, year 2000 was not repeated, year 2005 repeated 3 times, etc. i can make new array removes duplicates, im getting weird behavior when comes making sub-arrays. edit here own faulty solution, in case wants point out did wrong. var populateyearslist = function(yearsduplicate){ var uniqueyears = []; (var i=0; < yearsduplicate.length; i++){ if(uniqueyears.indexof(yearsduplicate[i]) == -1){ uniqueyears.push(yearsduplicate[i]) } else { console.log("duplicate found") }; } console.log (uniqueyears) }; i ran problem of trying change uniqueyears.push(yearsduplicate[i]) uniqueyears.push([ yearsdupl...

xcode - collect result of NStableView with checkboxes in Swift -

i have hard time trying collect number of checkboxes checked inside second column of nstableview. i composed nstableview 2 column (via ib), first named : bugcolumn (it contains textfiled) second named : checkedcolumn (it contains checkboxes) here code used display strings in first column : var objets: nsmutablearray! = nsmutablearray() ... extension masterviewcontroller: nstableviewdatasource { func numberofrowsintableview(atableview: nstableview) -> int { return self.objets.count } func tableview(tableview: nstableview, viewfortablecolumn tablecolumn: nstablecolumn?, row: int) -> nsview? { var cellview: nstablecellview = tableview.makeviewwithidentifier(tablecolumn!.identifier, owner: self) as! nstablecellview if tablecolumn!.identifier == "bugcolumn" { cellview.textfield!.stringvalue = self.objets.objectatindex(row) as! string } return cellview } the second column made of checkboxes appearing e...

Android RSS reader with notifications -

i want know need in order make rss parser notifies new posts. want include "add favorite posts" feature. guess rss elements must saved in local database. methods recommend? i'm new android development , use android studio. thanks follow this guide parse rss feeds. if you're not feeds provider , want notify user on new posts should create service within app checks them otherwise can use gcm or parse .

asp.net core - Override site binding using VS2015 and IIS Express -

Image
i'm implementing oauth authentication in mvc6 site using vs2015 rc. previous incarnation of site required custom binding , i'm trying achieve same vs2015. debugging iis express, however, proving difficult. if amend dnx "web" command use alternate url, works expected: "commands": { "web": "microsoft.aspnet.hosting --server microsoft.aspnet.server.weblistener --server.urls http://www.devurl.co.uk:31122", "gen": "microsoft.framework.codegeneration", "ef": "entityframework.commands" }, if try , same thing iis express changing applicationhost.config file (within project/.vs/config folder per wildcard hostname in iis express + vs 2015 )... <sites> <site name="webapp1" id="1"> <!-- removed brevity --> <bindings> <binding protocol="http" bindinginformation="*:31122:www.devurl.co.uk...

cloudfoundry - What is the difference between Cloud Foundry and Docker? -

i java developer. use weblogic host our applications. have been told replacing weblogic opensource alternative. planning use springboot. looking @ docker/cloud foundry. docker/cloud foundry new territory me. can please tell me difference between cloud foundry , docker? if use docker not cloud foundry, missing out on? if use cloud foundry not docker, missing out on? thank help. docker technology creating , running linux "containers." in sense, can think of these lightweight vms. docker container springboot app consist of docker image, contain filesystem things needed run app (jvm, source code, etc.), , docker container metadata, tells docker daemon how run app inside image (e.g. environment variables set, ports expose, commands run, etc.). docker daemon use linux features such cgroups , kernel namespaces run container in isolation other processes running on host machine. docker low-level, in need specify goes image, , runs arbitrary things, namely what...

Integrate paypal with variable items and record order detail on own server -

our website shows list of items user can choose. user can choose several of them , use paypal checkout. need record order on our own server if purchase succeed. i investigated paypal button solution http://paypal.github.io/javascriptbuttons/ however doesn't seem satisfy our need. don't have chance record order , order details(what items in order). highly insecure. suggestions on integration approach. we using spring + jsp server if relevant. thanks in advance. several paypal products can use: cart upload. it's part of website payments standard features. there ways make more secure, it's still product meant entry level merchants. express checkout. powerful product , want. i'd recommend this. once familiar it's powerful. other products using rest api. don't these. start paypal official developer site: developer.paypal.com , search these products on it. you'll find need.

c# - Circle and line segment collision -

this question has answer here: circle line-segment collision detection algorithm? 19 answers what algorithm use check whether line intersects circle? , @ coordinate along circles edge occurred? calculate distance between center of circle , line described here . check if closest point between endpoints of line segment. if between them, check if distance smaller radius; otherwise check if 1 of edge points inside circle.

Qlikview - Pivot Chart accumulation expression -

Image
i pretty new qlikview , need pivot table, accumulation expression (hope makes sense) on time. have tried find solution here, copy pasting expressions doesn't work (trial , error didn't pay off far). hope can me first app. i have managed setup bar chart , works because can check full accumulation, in pivot there no such thing.. here setup: dimension: date expressions: created = count(if(status='new',id)) resolved = count(if(status='resolved',id)) open = created - resolved here find sample data. table modified original date in order "event" list, can track when each ticket created / resolved (thanks contributors stack overflow). understanding practice. in attached image see want achieve, cause issues totals. right now, while open totaly broken, end total @ end of pivot calculated "ok", on each day totally wrong. can have both? gladly give on total sum of open if can work daily. i have personal edition unable open qlik...

mysql - How to get sequence.nextval from SQL in JDBC? -

i have 5 tables use same sequence's next value. problem is, subsequent tables gets bigger value previous ones. my code this: string sql = "insert table1(id, name) values (id_seq.nextval, ?)"; ps.setstring(1, "bar"); ps.executeupdate(); sql = "insert table2(id, name) values (id_seq.nextval, ?)"; ps.setstring(1, "tar"); ps.executeupdate(); sql = "insert table3(id, name) values (id_seq.nextval, ?)"; ps.setstring(1, "par"); ps.executeupdate(); sql = "insert table4(id, name) values (id_seq.nextval, ?)"; ps.setstring(1, "car"); ps.executeupdate(); sql = "insert table5(id, name) values (id_seq.nextval, ?)"; ps.setstring(1, "rar"); ps.executeupdate(); my sequence this: create sequence "id_seq" minvalue 1 maxvalue 9999999999 increment 1 start 10 cache 20 noorder nocycle ; now when @ tables, table1's id 10, table2's id 11 , table3's id ...

javascript - Using Jasmine Ajax -

i writing tests jasmine . running tests via gulp . want use jasmine ajax plugin. however, cannot figure out how include tests. right now, have following: tests.js describe('myapp', function() { beforeeach(function() { jasmine.ajax.install(); }); it('should run ajax request', function() { // test ajax }); }); once again, i'm running via gulp. so, in gulpfile.js have following: gulpfile.js var gulp = require('gulp'); var jasmine = require('gulp-jasmine'); gulp.task('test', function() { return gulp .src('tests/*.js') .pipe(jasmine()); }); when execute this, following command-line: typeerror: cannot read property 'install' of undefined. its jasmine ajax isn't getting loaded. yet, i'm not sure how load it. can please me solve issue? thank you. i haven't tested myself since don't have enough info recreate setup, try put mock-ajax.js file in helpers directo...

scrum - How can a team decide to pick a user story for a sprint, when the Product Manager has already decided on PBI ordering? -

an exam asked: decides take user story sprint, product manager or team? correct answer team. i understand that: product manager prioritizes product backlog items (pbi). team members select user stories sprint. pbis , user stories seem synonymous. so, how can team decide pick user story sprint, when product manager has decided on pbi ordering? it explained jessehouwing. only team decides on selecting user story sprint team has clear understanding of it's capacity & other dependencies implementing user story. product owner prioritise pb , put his/her wish in front of team. team selects pbi can deliver. team's responsibility deliver whatever have picked sprint. team committed deliverables , po involved ( chicken & pig ).

c# - Databinding not working on Avalondock window -

i have project window manager using avalondock. basically there 2 element : layoutanchorableitem show different tool box (currently one, consisting of treeview) , layoutitem show document opened treeview (a custom control, bindable parameters - in theory) the viewmodel of dockingmanager hosts observablecollection named panes layoutitems. things works "fine" if don't try bind parameters in xaml, , force values this <avalondock:dockingmanager.layoutitemtemplateselector> <panes:panestemplateselector> <panes:panestemplateselector.exchangeviewtemplate> <datatemplate> <xchng:exchange/> </datatemplate> </panes:panestemplateselector.exchangeviewtemplate> <panes:panestemplateselector.graphviewtemplate> <datatemplate> <grph:graph tickercode="ild" exchangecode="epa"/> </datatempl...

multithreading - Android Service vs Simple class with thread for network access -

i in quite dilemma how solve problem regarding network access. all of rest based requests routed through own httprequestexecutor class execute each request asynchronously , results sent via handler passed per request. some of these requests originating ui , needs end there example sign in request. in cases user has wait till finishes. write high level , specialized class each of such use case may business level processing before and/or after request executed. result handed down originating activity. this done either using service or simple java class both using thread. not sure way go. a simple java class straight forward , simple solution feel service may correct way it. concerned using service boiler plate code goes using i.e. binder or messaging communicate activity. for problem correct way solve? service provide advantages in case? in opinion, using java multi-threading mechanisms may better android services lightweight , short tasks. as far know, google re...

c# - Setting a string from one destination to another -

i want include string "oldsummary" in second richtextbox, of summary's functionality belongs streamread after opening file. there way when btn1 button clicked, display oldsummary string? @ moment it's blank due it's global string set "" want display oldsummary string set in mnuopen button. string oldsummary = ""; private void mnuopen_click(object sender, eventargs e) { //load file code remove example goes here… //add data text file rich text box richtextbox1.loadfile(chosen_file, richtextboxstreamtype.plaintext); //read lines of text in text file string textline = ""; int linecount = 0; system.io.streamreader txtreader; txtreader = new system.io.streamreader(chosen_file); { textline = textline + txtreader.readline() + " "; linecount++; } //read line until there no more characters while (txtreader.peek() != -1); //seperate...

debugging - Error while build boost release -

i have error while building release: 1>d:\work\boost\boost/asio/detail/socket_types.hpp(38): fatal error c1083: cannot open include file: 'winsock2.h': no such file or directory but when build debug fine. what going on here? first , check have windows sdk installed windows sdk then go project property page , in configuration properties , general select "visual studio 2013 - windows xp (v120_xp)" platform toolset i have same problem , fix way goodluck

How to store simple text data in the python program itself? -

i'm making program ease work. concept of has company names (i'll make button add more of them) , stores info when , loan took. so open program, displays company names, click on them , opens window of taken loans (also going make button add more loans @ different dates). want make program store company names , loans took can add more , more of them. i'm going add info through simple entry dialogs. how possible store info in program when press button? small window pop info? for basics, should check out json library python: https://docs.python.org/2/library/json.html here's quick example: >>> import json # grabs config.json in same directory python file >>> open("config.json", "r") e: ... myconfig = json.load(e) >>> print myconfig {u'4': u'5', u'6': 7} # dump string representation >>> config_string = json.dumps(myconfig) >>> config_string '{"4":...

ios - Why my `IBAction` linked to another Project’s main.storyboard's view -

i copied file named xxcontroller.m project. , found -(ibaction)xxx linked previous project! how delete relation? just delete connection renaming -(ibaction)xxx -(ibaction)yyy & replace name yyy calling in selector . , hope solve issue. happy coding

vba - Outlook: Move item from me to a folder -

Image
i create reminders myself sending email me , moving them folder named '@now' under inbox. wish automate every email addressed me moved '@now'. tried using rules, don't think there such option ('mail me, sent me'). think need vba script. code of such script? (outlook 2013) right click on email - rules > create rule... or go advanced options... , there more options start blank rule, can choose whether apply rule incoming or outgoing messages after select conditions identify messages you're looking for, can select folder copy messages

How to access a key object in jQuery with "/" -

Image
i have object localize.data context: how can access navigation ? not working: $.localize.data.locales/messages.navigation note: can't remove slash. thanks lot! use bracket notation: $.localize.data["locales/messages"].navigation

php - Setting and using parameters from parent class -

is there way can write code this: <?php class baseclass { public $testvar; public function __construct ($testvar) { $this->testvar = $testvar; } } class childclass1 extends baseclass { } class childclass2 extends baseclass { } $bc = new baseclass('test1'); $cc1 = new childclass1(); $bc->testvar = 'test2'; $cc2 = new childclass2(); echo $cc1->testvar; // should echo 'test1' echo $cc2->testvar; // should echo 'test2' ?> the reason asking don't have specify parameters every time create new child class. want make have specify parameters once (preferably when creating base class). is possible? it's point of object oriented programming every instance has it's own parameters. but want use class once whole application. database controller or router. can use static properties , methods: class baseclass { public static $testvar; public function __construct ($testvar) { ...

angularjs - How to make simple animation using ngAnimate -

i not able understand how nganimate works exactly. here doubt. 1) nganimate - works on directives ? 2) how make ng-animate work without directive 3) of above way, how add call after animation complete? because see animation examples directives . i have small demo here, 1 me animation both without directive , directive approach adding class name `fade'? my code: <div class="container" ng-app="myapp"> <div class="content" ng-controller="count"> <h1 ng-click="animate()">click me</h1> <h2>let me fade</h2> </div> </div> <div class="container" ng-app="myapp"> <div class="content" ng-controller="count"> <h1 ng-click="animate()">click me</h1> <h2>let me fade</h2> </div> </div> demo update i not able understand h...

java - How to parse three xml files in Android Application -

i did parsing single xml file , displayed values in textview . tried 3 xml files couldn't find exact way parse 3 xml files, i'm not able find problem. the code provided below. can give suggestions. tv = (textview) findviewbyid(r.id.textview4); tv1 = (textview) findviewbyid(r.id.textview5); try { saxparserfactory factory = saxparserfactory.newinstance(); saxparser saxparser = factory.newsaxparser(); defaulthandler handler = new defaulthandler() { boolean name = false; boolean salary = false; public void startelement(string uri, string localname, string qname, attributes attributes) throws saxexception { if (qname.equalsignorecase("name")) { name = true; } if (qname.equalsignorecase("salary")) { salary = true; } }//end of startelement method public void endelement(string uri, st...

c# - Asp.net MVC Profile image control -

in asp.net mvc site, users need upload profile pictures, , resize/crop , move image until user satisfied (within red border shown here: http://imgur.com/gqectil ) i've stumbled upon http://imageresizing.net/ fine, kinda need front ui control users use. what easiest way achieve kinda control? have develop own, or guys have recommendations? if understood question, added 2 links dealing image re-sizing: http://www.codeproject.com/tips/481015/rename-resize-upload-image-asp-net-mvc http://www.leniel.net/2012/04/resize-img-on-fly-aspnet-webimage.html i hope helps, please let me know... update : link may (from comments) - http://techslides.com/image-zoom-drag-and-crop-with-html5

Xammp bitnami joomla ssl -

hello pointers enabling ssl on bitnami joomla works xampp have read many tutorials nothing seems work.i have tried forse ssl joomla adminstrator says connection not safe might problem see cert not trusted accepted trusted still doesn't work .if knows answer please share! bitnami developer here, i have created new auto-signed certificate using our guide @ https://wiki.bitnami.com/components/apache#how_to_create_a_ssl_certificate.3f , modified file installdir/etc/extras/httpd-ssl.conf use new certificate files , after restarted apache server sudo installdir/ctlscript.sh restart apache . worked me. lines modified in httpd-ssl.conf are: ... sslcertificatefile "/opt/lampp/etc/ssl.crt/server.crt" ... sslcertificatekeyfile "/opt/lampp/etc/ssl.key/server.key" ... then, browsed server using https , showed error page error code net::err_cert_authority_invalid . that means certificate invalid because of certificate authority not trusted one. normal ...

SQL: select from table where it doesnt exist in other for a user -

i have 2 tables, test , studenttest these structures: test : testid subject totalpoints schoolsubject 1 programming 100 informatics 2 webdesign 80 informatics ... studenttest : studenttestid userid testid timestudied points date 1 1 1 60 60 2015-05-20 2 2 1 100 80 2015-05-20 2 2 2 95 75 2015-05-20 ... now want make page user can fill in marks (in studenttest ), want show tests user doesn't have marks for. example if user 1 logged in should see test 2 because user 1 has no marks test. user 2 shouldn't see because has marks existing tests. i don't know sql should like. can me please? you can use exists operator: select subject, schoolsubject test t not exists (select * studenttest st ...

java - How to process large XML's in Apache Camel? -

i using apache camel 2.14.0 version. have created route poll directory containing xml's , pass on activemq broker. from("file://d:/test?sortby=file:modified&include=test_.*.xml$&noop=true").to("activemq:queue:temp.xmlfilequeue"); it works fine small xml's (upto 20mb) if filesize more gives outofmemoryerror . to avoid this, changed route below from("file://d:/test?sortby=file:modified&include=test_.*.xml$&noop=true").split(body().tokenizexml("ship", "ships")).streaming().to("activemq:queue:temp.xmlfilequeue"); after doing this, see camel creating multiple threads process each chunk result of facing new issues. per logic after xml processed, should deleted - earlier single thread , fine due many threads, 1 thread deletes file thread still tries process file , throws filenotfoundexception . how avoid this? please let me know proper way process large xml's single thread.

xmpp - Android aSmack - How to make custom message extension for file sending? -

i'm trying implement offline file extension chat application. i'm using packetextension , embeddedextensionprovider adding , parsing custom extension. can see values , tags added while sending message, @ receiver end these absent. i'm doing wrong ? sending message: <message id="224k2-7" to="testfirzan@sushant" type="chat"> <body>hi</body> <custom xmlns="jabber2:x2:oob2"> <url>url</url> <desc>description</desc> </custom> </message> receiving message: system.out(734): embeddedextensionprovider <message id="224k2-7" to="testfirzan@sushant" from="testsushant@sushant/smack" type="chat"> <body>hi</body> <custom xmlns="jabber2:x2:oob2"></custom> </message> file extension description:(734): <custom xmlns="jabber2:x2:oob2"></custom> ...

Set linear layout as selected on Click Android -

i have multiple linear layouts inside scrollview .each linear layout have image on click of want set linear layout background selected have in listview . xml <scrollview android:layout_width="wrap_content" android:layout_height="wrap_content"> <linearlayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="2" android:orientation="vertical"> <linearlayout android:id="@+id/layout1" android:layout_width="match_parent" android:layout_height="70dp" android:orientation="vertical"> <imageview android:id="@+id/img1" ...

ios - Set the zoom for MKMapCamera and MKUserTrackingMode to be equal in a view controller -

i'm using both mkusertrackingmode , mkmapcamera in same viewcontroller able track user when they're navigating , rotate camera accordingly user travels along route. mkusertrackingmode zooms level, 4,700 meters above current location (using iphone 6 simulator) , mkmapcamera makes specificy eyealtitude. there way make mkmapcamera zoom level equal mkusertrackingmode doesn't first zoom satisfy mkmapcamera parameter readjust accompany mkusertrackingmode function? mkmapcamera in convenience init , mkusertrackingmode in viewdidappear

c# - No Entity Framework provider found for the ADO.NET provider with invariant name -

this problem occurred when trying generate database through model i tried resolve isolated issues mysql56 not running re-adding tray i have updated prerequisites mysql, namely: mysql visual studio 1.2.1 connector/net 6.9.6 product. i tried update , add references via nuget mysql.data 6.9.6 mysql.data.entities 6.8.3.0 mysql.data.entity 6.9.6 mysql.fabric 6.9.6 mysql.net 6.6.4 mysql.web but still getting error... did miss something? in web.config: <entityframework> <defaultconnectionfactory type="system.data.entity.infrastructure.sqlconnectionfactory, entityframework" /> <providers> <provider invariantname="system.data.sqlclient" type="system.data.entity.sqlserver.sqlproviderservices, entityframework.sqlserver" /> <provider invariantname="mysql.data.mysqlclient" type="mysql.data.mysqlclient.mysqlproviderservices, mysql.data.entity.ef6, version=6.9.6.0, culture=neutral, publickeyt...

Save tmux status is possible? -

is possible, in tmux, "export" current session status? list of windows , panes opened and/or that. or, .. possible store session somewhere, , re-open next time tmux opened? checkout tmux-continuum on over github. think that's you're looking for.

python - Django Test Case Can't run method -

i getting started django, may stupid, not sure google @ point. i have method looks this: def get_user(self,user): return utilities.get_userprofile(user) the method looks this: @staticmethod def get_userprofile(user): return userprofile.objects.filter(user_auth__username=user)[0] when include in view, fine. when write test case use of methods inside utility class, none back: two test cases: def test_stack_overflow(self): = objname() print(a.get_user('admin')) def test_utility(self): print(utilities.get_user('admin')) results: creating test database alias 'default'... none ..none . ---------------------------------------------------------------------- can tell me why working in view, not working inside of test case , not generate error messages? thanks verify whether unit test comply followings, testclass must written in file name test*.py testclass must have been subclassed unittest.testcase testclas...

XTend null safe throws NullPointerException -

i porting template code xtend. @ point have type of condition handling in test case: @test def xtendiftest() { val obj = new fd if (true && obj?.property?.isnotnull) { return } fail("not passed") } def boolean isnotnull(object o) { return o != null } class fd { @accessors string property } this works expected property null , test fail "not passed" message. simple change in return type of isnotnull method boolean (wrapper): def boolean isnotnull(object o) { return o != null } fails nullpointerexception. examining generated java code can see xtend using intermediate boolean object expression , cause of npe. missing point of xtend null safe operator (?.) or can't use method after operator? thanks. the operator behaves properly. exception thrown because of usage of boolean in if-expression, requires auto-unboxing. if try following: @test def xtendiftest() { val boolean obj = null if (obj) ...

sql - Oracle Query - Missing Defines -

Image
i created simple table: create table tmp ("id" varchar2(20 byte)); then tried this: declare whatever varchar2(20) := :bananas; begin merge tmp t using (select whatever this_id dual) d on (t.id = d.this_id) when not matched insert (id) values (d.this_id); end; and enter binds and error: error starting @ line : 1 in command - declare whatever varchar2(20) := :bananas; begin merge tmp2 t using (select whatever this_id dual) d on (t.id = d.this_id) when not matched insert (id) values (d.this_id); end; error report - missing defines i've had no luck figuring out wants. if replace ':bananas' value 'a' works, not when use variable , bind value. know whats wrong query? thanks. oracle database 11g enterprise edition release 11.2.0.4.0 - 64bit production pl/sql release 11.2.0.4.0 - production "core 11.2.0.4.0 production" tns ibm/aix risc system/6000: version 11.2.0.4.0 - product...

node.js - Authentication in Socket.io -

i'm going try authenticate connection on socket.io. currently, user first authenticated via rest api, then, send user jsonwebtoken authenticated user's username. after open connection between client , server, plan temporarily delete socket list of connected sockets prevent receiving , sending of data between server while carry out auth. in auth, verify token , if token valid re-add socket's id list of connected sockets. problem first part doesn't work. can't seem delete socket list. to test did following. io.on('connection', function(socket){ //temp delete socket delete io.sockets.connected[socket.id]; console.log(io.sockets.connected); socket.emit("test"); }); as can see delete socket , emit test event see if socket still open. message received client when shouldn't be. does know why occurs? try using disconnect method socket object, this: io.on('connection', function(socket){ //temp dele...

jquery - Cross domain calls IE8 & IE9 -

i making various cross domain ajax calls various endpoints. works fine in chrome, firefox , ie 10 , 11 not working in ie8 , ie9. getting following error in console: [object object]{readystate: 0, status: 0, statustext: "no transport"} the ajax code using following: $.getjson(url).done(function (data) { console.log(data); //do stuff based on response }).fail(function (data){ //do stuff based on response }); i have tried adding following due others saying might work: $.support.cors = true; however still receiving same error. i have read ie8 , ie9 not support ajax calls , need use xdr. i have tried not having luck following code tried: var xdr = new xdomainrequest(); xdr.onload = function () { console.log(xdr.responsetext); } xdr.onerror = function () { /* error handling here */ } xdr.open('get', url); xdr.send(); however, not working either. possible doing wrong since have never worked xdr befo...

java - How to configure log4j2 to log for HikariCP -

i have written small gradle project can learn how configure hikaricp , jdbc , log4j2 in same project. have placed below log4j2 config in src/main/resources directory in project. when execute project using gradle run warning not configuring appender com.zaxxer.hikari.hikariconfig logger. would 1 kindly tell me doing wrong? log4j2.xml <?xml version="1.0" encoding="utf-8"?> <configuration status="warn"> <appenders> <console name="console" target="system_out"> <patternlayout pattern="%d{hh:mm:ss.sss} [%t] %-5level %logger{36} - %msg%n"/> </console> </appenders> <loggers> <logger name="com.zaxxer.hikari.hikariconfig" level="trace"> <appenderref ref="console"/> </logger> <root level="trace"> <appenderref ref="console"/> </root> </logger...

asp.net - Does C# have a method for inserting a string before the extension part of a file name? -

i have bit of code like if (system.io.file.exists(newfilepath)) { string suffix = (datetime.now.ticks / timespan.tickspermillisecond).tostring(); newfilepath += suffix; but realized it's incorrect because meant put suffix before extension part of file name (if there 1 @ all). example: c://somefolder/someotherfolder/somepic.jpg ---> c://somefolder/someotherfolder/somepic0123913123194.jpg is there 1-line way this, instead of me spending time handrolling procedure lastindexof , insert , etc. a simple 1 liner be: newfilepath = string.format("{0}{1}{2}", path.getfilenamewithoutextension(newfilepath), suffix, path.getextension(newfilepath)); edit: or preserve directory too: newfilepath = string.format("{0}{1}{2}{3}", path.getdirectoryname(newfilepath), path.getfilenamewith...

excel - Adding descriptions to arguments in User-defined functions -

whenever type in name of "built-in" excel function (sumif, example), guide pop saying "(range, criteria, [sum_range])", describing arguments function accept. there way add similar names arguments in own user-defined functions, same type of guide appear? partial answer: application.macrooptions want -- when function invoked via insert function dialog. doesn't seem work when type =funcname( directly in cell. following page has nice example of how use it: http://spreadsheetpage.com/index.php/tip/user-defined_function_argument_descriptions_in_excel_2010/

css - how to set a div to 100% width within a parent div that has 40px padding -

i may have asked question in confusing way. basically need this: http://www.jayflood.com/layout.jpg i'm sure there ton of ways this, problem lies in working within preexisting structure. parent container not have set width, have 40px of padding. i need content div considered width 100% can divide divs within. the question - possible have smaller containing div have 100% width. set margin -40px div { margin:-40px; }

Datastage: "connector could not find a column in the input schema" error while using oracle connector stage -

when columns specified in table included in table definition in oracle connector stage, getting error " connector not find column in input schema match parameter ". please let me know if necessary include columns in meta data on oracle connector stage. try enabling run time column propagation (rcp) project datastage administrator client. ensure columns needed pass smoothly 1 stage another.

java - infinite loop issue in my code : my programm seems not stopping -

/* have file containing data: san francisco: 19887.32 chicago: no report received new york: 298734.12 los angelos: no report received , want print cities code seems it's not stopping!*/ public static void main(string[] args) { try (bufferedreader br = new bufferedreader(new filereader("sales.dat"))) { string line; char c; while ((line = br.readline()) != null) { do{ c =(char) br.read(); system.out.print(c); }while(c != ':'); system.out.println(); } } catch (exception e) { // todo auto-generated catch block e.printstacktrace(); } } your code won't doing need anyway, because skip every 2nd line. instead: try (bufferedreader br = new bufferedreader(new filereader("sales.dat"))) { string line; while ((line = br.readline()) != null) { int = line.ind...

javascript - MVC refresh PartialVIew using jQuery, and get "Cross Origin Result blocked: ... " error (when loading markers in Google maps) -

so, here bizzar: have partial view, been refreshed using jquery: <script> $(function () { $('#loadfrommainframe').click(function (e) { e.preventdefault(); console.log("partial load begins here. "); $('#partialparkingdetails').load("/parkingspots/getsearchresult"); }); }); </script> and button of question , html partial is: <div id="partialparkingdetails"> @{ viewbag.listdescription = "test list parkingspot:"; html.renderaction("getsearchresult"); } </div> <button id="loadfrommainframe">load mainframe</button> <div id="map-canvas"></div> the controller contains: public actionresult getsearchresult(int id=0, ....) { var parkingspots = s in db.parkingspots select s; .... return partialview("_searchresult", parkingspots.tolist()); } worth noting worki...

mapreduce - Algorithm/Programming for processing -

i using spark streaming (coding in java), , want understand how can make algorithm following problem. relatively new @ map-reduce , need assistance in designing algorithm. here problem in details. problem details input: initial input of text is: (pattern),(timestamp, message) (3)(12/5/2014 01:00:01, message) where 3 pattern type i have converted dstream key=p1,p2, p1 , p2 pattern classes input line, , value = pattern, input, timestamp. hence each tuple of dstream follows: template: (p1,p2),(pattern_id, timestamp, string) example: (3,4),(3, 12/5/2014 01:00:01, message) here 3 , 4 pattern types paired together. i have model each pair has time difference associated it. example, model in hashmap key-values : template: (p1,p2)(time difference) example: (3,4)(2:20) where time difference in model 2:20, , if have 2 messages of pattern of type 3 , 4 respectively in stream, program should output anomaly if difference between 2 mes...