Posts

Showing posts from April, 2015

python - is not JSON serializable -

i have following listview import json class countrylistview(listview): model = country def render_to_response(self, context, **response_kwargs): return json.dumps(self.get_queryset().values_list('code', flat=true)) but following error: [u'ae', u'ag', u'ai', u'al', u'am', u'ao', u'ar', u'at', u'au', u'aw', u'az', u'ba', u'bb', u'bd', u'be', u'bg', u'bh', u'bl', u'bm', u'bn', '...(remaining elements truncated)...'] not json serializable any ideas ? i'll add more detailed answer. it's worth noting queryset.values_list() method doesn't return list, object of type django.db.models.query.valueslistqueryset , in order maintain django's goal of lazy evaluation, i.e. db query required generate 'list' isn't performed until object evaluated. somew

Display, sort and filter numbers with multiple decimal in excel 2007 -

Image
i'm using excel 2007. i've list of tasks (200-500) need group in different category/section etc (multiple filters). whole data in excel table can apply excel's build-in table filters display exact data need. however difficult apply multiple filter display expected data, specially need frequently. make things simple i'm planning number each record like a.b.c.d.e.f a, b, c, d, e, f simple numbers. list looks like: 1 1.1 1.2 1.2.1 1.2.1.1 1.2.2 1.3 & on. problem is, excel take number single decimal add second decimal, excel treat text, obvious in general behavior. however, special case, need excel treat both number or text. number preferable want sort them, might difficult text. to make things little more complex, while filtering in table, require if can add formula filter results 1.* should display numbers starts 1. is possible excel's default behavior, without vba? if no, possible vba? if yes, clue appreciated. don't need whole program

Delphi - How to make a diagram? -

i've been problem time.. want make diagram, made on runtime data user enters in other forms etc etc. my first , actual option, making cycles , create shapes / labels, , applying shape.top variable , increasing every cycle 120. works great, if turn more complex thing, give me lot of work create shapes , controlling if in top of each other, , more, connect them line. so, there isn't component can me this? way, there component connect simple line 2 objects visually? nice ! thanks. delphiarea has component called simple graph type of thing. i have never used myself, found today , impressed demo application.

java - How to access a parameter in jrxml file and Print it? -

my query is, have set parameter in java file given below map<string, object> parameters = new hashmap<string, object>(); parameters.put("reporttitle", "mrsg quarterly report"); how access in jrxml file , print text? you need declare parameter in jrxml <parameter name="reporttitle" class="java.lang.string"></parameter> then call in text field <textfield isblankwhennull="true"> <textfieldexpression class="java.lang.string"><![cdata[$p{"reporttitle"}]]> </textfieldexpression> </textfield>

javascript - event handler that knows the event name -

i have socket.io server generates many events, , want catch of them , print similar message. right now, this: for (var event in {eventa: 1, eventb: 1, eventc: 1}) { this.translationsocket.on(event, function(result) { console.log("server sent event of type "+event); }); } when server sends eventa, eventb , eventc, see this: server sent event of type eventc server sent event of type eventc server sent event of type eventc i.e. program catches events, displays type of eventc... i tried following variations: remove "var" before "event" inside "for": "for (event ..." adding statement 'var msg = "server sent event of type "+event;' either before 'on' statement or before 'console.log' statement, , 'console.log(msg)'. none of these variations worked... what should do? this has nothing socket.io or node.js, known javascript "quirk". value of event

xcode - Need a solution to implement xmpp add friends in group chat and sending message to them in once in ios -

i'm having difficulties add friends, sending invitations , in group chat sending 1 message using xmpp. know need use xep-0045. not succeeded. can tell me how it. send friend request 1 one chat. send invitation join chat room. send message chat room's friends. if has sample code great.. thanks in advance for #3 : send message chat room's friends. -(void) sendgroupmessage:(nsstring *) groupjid message:(nsstring *)msg{ xmppjid *roomjid = [xmppjid jidwithstring:[nsstring stringwithformat:@"%@@conference.%@",groupjid,server_url]]; xmpproom *muc = [[xmpproom alloc] initwithroomstorage:xmpproomstorage jid:roomjid dispatchqueue:dispatch_get_main_queue()]; [muc activate:xmppstream]; [muc adddelegate:self delegatequeue:dispatch_get_main_queue()]; [muc sendmessagewithbody:msg]; }

ruby - Rails Json String Length -

i trying pass json api, has possibility long due including territory codes. when restricting territories 20 or 30, works fine, when extending 250, api call not take place. checking length of json string, around 5000 characters. the problem occurs in production, , not in development. app deployed on aws elastic beanstalk. when checking logs no information @ all, if stopped @ point , ignored it. if passing json via request, please note uri in http request has limit. may want pass data post.

deployment - SSRS C# mapping RDL throws the error -

i mapping reports(rdl) data sources through c#. i getting below error the path of item '' not valid. full path must less 260 characters long; other restrictions apply. if report server in native mode, path must start slash. ---> microsoft.reportingservices.diagnostics.utilities.invaliditempathexception: path of item '' not valid. full path must less 260 characters long; other restrictions apply. if report server in native mode, path must start slash. any pointers thanks, sai

utf 8 - ZF2 Doctrine2 MySql charset error -

i've setup mysql db utf8_unicode_ci collation, , tables , columns on have de same collation. my doctrine config have set names utf8 connection option , html files use utf8 charset. the text saved on tables contain accented characters (á,è,etc). the problem when save content db, saves strange characters, when try save iso in utf8 table. (e.g.: notícias) the workaround i've found to, utf8_decode before save, , utf8_encode before printing. that means that, reason, in between messing utf8 iso. what might be? thanks. edit: i've setup encode before saving , decode before printing, , prints correctly in db chars change to: xptÓ -> xptÓ this makes searching in db "xptÓ" impossible... i print bin2hex($string); @ each step of original workflow (i.e. without encode/decode steps). go through each of: the raw $_post data the values after form validation the values put in bound entity the values you'd db if query direct

c++ - I have a character array, i want to shift the bits of it at binary level in right direction by one? -

i have character array, want shift bits of @ binary level in right direction one? char arr[]="this array"; like above array represented in memory in binary form '110010101001110101......' want have program shift whole array? just use << operator: char arr[]="abc"; cout << *(bitset<24>*)arr << endl; cout << (*(bitset<24>*)arr << 1) << endl;

java - using Rhino, I've got a "ReferenceError" exception -

i've got error using rhino(17r4). my goal indent javascript source code using jsbeautifier.js . here's code: import java.io.inputstream; import org.mozilla.javascript.context; import org.mozilla.javascript.scriptable; public class jsbeautifier { public string beautify(string jssource) { context context = context.enter(); scriptable globalscope = context.initstandardobjects(); string beautify = getfilecontents(jsbeautifier.class.getresourceasstream("beautify.js")); context.evaluatestring(globalscope, beautify, "beautify", 1, null); globalscope.put("source", globalscope, jssource); context.evaluatestring(globalscope, "result = js_beautify(source);", "beautify", 1, null); object result = globalscope.get("result", globalscope); return (string)result; } private string getfilecontents(inputstream stream) { stringbuffer contents = new stringbuffer(""); try {

c# - Getting values of ApplicationData.Current.LocalSettings in static context -

i have next code: public static class appuser { static appuser() { restorepreviewuserstate(); } private static void restorepreviewuserstate() { var storedtoken = settings.authentification.sessiontoken; //here gets settings var storeduserid = settings.authentification.currentuserid; if (storedtoken == null || storeduserid == default(int)) return; authtoken = storedtoken; currentuserid = storeduserid; } public static bool existauthdata { { return currentuserid != default(int) && authtoken != null; } } private static string _authtoken; public static string authtoken { { return _authtoken; } set { _authtoken = value; settings.authentification.sessiontoken = _authtoken;

java - To separate Integer and String ArrayList from Object ArrayList -

i have arraylist containing objects. have 2 different arraylists, 1 containing strings , other integers. need strings , integers rom parent list , put in new 2 arraylists. arraylists follows. arraylist<object> ldeltaattrlist = new arraylist<object>(); arraylist<string> ldeltaattrliststring = new arraylist<string>(); arraylist<integer> ldeltaattrlistinteger = new arraylist<integer>(); please help. you check if object whether string or integer , put in right list. for(object o : ldeltaattrlist) { if(o instanceof string) { ldeltaattrliststring.add(o); } else if(o instanceof integer) { ldeltaattrlistinteger.add(o); } }

javascript - Active Accordeon Menu don't work with sublinks with query strings -

@ejay me set "opened" main link if click iin sublinks of this... here: set "active" accordion menu after click i make modifications like: <script type="text/javascript"> $(document).ready(function(){ var spath = window.location.pathname; var spage = spath.substring(spath.lastindexof('/') + 1); var url = spage.split('?')[0]; $('dd').filter(function () { return $('a[href="' + url + '"]', $(this)).length == 0 }).hide(); $('dt a.submenu').click(function () { $("dd:visible").slideup("slow"); $(this).parent().next('dd').slidedown("slow"); return false; }); }); </script> this script works if link <a href="test.asp">teste</a> if link way: <a href="tes

CSS Hover effect within Modal popup issue -

i have created web page modal popup control. within control dynamically build html display data. within of tables tags have following: <td> <a href="#"><span>s</span><span class="pop">description</span></a> </td> i want create popup effect when hovering on tag. css is: a .pop { display:inline; position:absolute; visibility: hidden; background-color: #ffffff; border: solid 2px #000000; padding: 5px; margin: 0 0 0 10px; color: #000000; text-align: left; font-weight: normal; } a:hover .pop { visibility: visible; } this works when use control within standard html page. appears work within modal popup control, until need scroll down modal control when table data larger modal window. the hover effect appears not working. think because im using "position":"absolute" ".pop" class, , hover effect working, position no longer relative ta

c# - PowerShell custom Cmdlet using SwitchParameter -

i have following code, try create custom cmdlet powershell using c#. want custom cmdlet that, user should call 2 parameters, first 1 should -text or -file or -dir, , next 1 should value, string specifies value text, or file, or directory. works fine long can see. i'm curious whether there simple method or more elegant method can use achieve want. or solution simplest can get? way, sha256text, sha256file, , sha256directory, custom functions have written, don't worry them. using system; using system.io; using system.text; using system.security.cryptography; using system.management.automation; namespace pssl { [cmdlet(verbscommon.get, "sha256")] public class getsha256 : pscmdlet { #region members private bool text; private bool file; private bool directory; private string argument; #endregion #region parameters [parameter(mandatory = true, position = 0, parametersetname = "text&qu

build - Live console output in Sublime Text 2 -

i managed create simple build configuration project builds , launches it. console freezes during execution , prints messages generated application after close it. build configuration looks this: { "cmd": ["${project_path:${folder}}/run.bat"] } the run.but runs application this: "%moai_bin%\moai" "config\config.lua" "main.lua" i had same issue when running moai host sublime text 2 on mac os x , able fix calling io.stdout:setvbuf("no") at beginning of lua code, this snippet .

html - Linking to arbitrary content on a webpage without anchor tags -

i'm looking way link specific range of words, image or other arbitrary content on web-page. 1 alternative introduce tons of anchors on page, can live solution requires javascript. preferable 1 highlights target content. it great have kind of protection (in form of alert warning) if content of page has been modified, , link no longer valid. does know of library handles this, or have advice on at? assume there no w3c standard enables url scheme arbitrary direct linking without introducing anchors (name tags)? thanks!

html - Difference between these selectors -

this question has answer here: why spaces used separate things in css 3 answers is there difference between these selectors? div.demo , div .demo div#demo , div #demo does select same element? div.demo{some code} div .demo{some code} yes, there is. div.demo match div class demo <div class="demo"> div .demo class demo inside div : <div> <span class="demo"> </div> same id selector # .

sharepoint workflow solution not working -

i have made sequential workflow in visual studio 2010. workflow working fine on me local machine. have packaged solution , uploaded our intranet. using site settings solution , add solution , activate it. when go site features don't see me solution , it's not working on list have made for. knows how fix ? i'm using sharepoint2010 foundation. language have made in english , site im trying install dutch. thanks in advance. check workflow published. this link may of help . there slight chance problem might have localization issues.

android - delete a row in sql and item in listview -

i trying delete row db. i'm using method: public void deleteplayerbyid(int id){mdb.delete(sqlite_table, key_rowid +"="+id, null); } called in activity : listview.setonitemlongclicklistener(new adapterview.onitemlongclicklistener() { @override public boolean onitemlongclick(adapterview<?> av, view v, int pos, long id) { return onlonglistitemclick(v,pos,id); } protected boolean onlonglistitemclick(view v, final int pos, long id) { alertdialog.builder builder = new alertdialog.builder(androidlistviewcursoradaptoractivity.this); builder.setmessage("are sure delete?").setcancelable(false).setpositivebutton("yes", new dialoginterface.onclicklistener() { public void onclick(dialoginterface dialog, int id) {bdhelper.open(); dbhelper.deleteplayerbyid(pos); log.i("listv

mysql - How to get maximum no of id exist in one table? -

i want find maximum number of id s present in table. example, have user_views table: user_views ------------------- u_v_id package_id 1 24 2 24 3 24 4 25 5 25 6 26 7 27 and packages table: package_id name the maximum number of id s present in 1 table 24 , on. how can write query pull value? select package_id, count(*) count mytable group package_id order count(*) desc limit 1

amazon web services - Access Denied to an S3 object in Elastic Beanstalk configuration setting -

i trying configure 'source' parameter in elastic beanstalk application config file. relevant source bz2 file have uploaded in new s3 bucket. example, name of bucket created 'abc' , file name 'mysource.tar.bz2'. relevant line in config file looks this: source: /usr/bin/mysource: https://s3-us-west-2.amazonaws.com/abc/mysource.tar.bz2 when trying deploy code, there error , on checking log, shows 'accessdenied' file. i have created instance profile (role) in aws iam console trust relationship amazon ec2 , have set access required bucket. the permission in role looks this: { "statement": [ { "sid": "stmt13674962346", "action": [ "s3:*" ], "effect": "allow", "resource": [ "arn:aws:s3:::abc/*" ] } ] } have tried setting resource *: "resource": "*" but still accessdenied

How to set up a multi-module project with equal hierarchy modules in IntelliJ? -

i wondering how configure following project layout in intellij: an android application a server end feeding data application bean classes shared between end , android application initially, wanted create 3 modules on equal hierarchy level. however, not seem possible intellij. can add new modules inside of first module. wonder if way supposed it? or there better way configure project layout intellij? these hierarchies represent folders? i feel should make (3) library module , add dependencies (1) , (2). since module defined a discrete unit of functionality can compile, run, test , debug independently feel right approach. this first multi-module project in intellij. explanation appreciated! when creating new project can use empty project option on first wizard step. when project created, add 3 modules in different folders under project structure settings.

javascript - Dynamically accessing properties of knockoutjs observable array -

i using below code handling sort functionality. working me. there way make code common , can use whenever needed. <span class="sorting" data-bind="click: function(){ ui.items.sort(function(a,b){ return a.username < b.username ? -1 : 1; }); }">user name</span> <span class="sorting" data-bind="click: function(){ ui.items.sort(function(a,b){ return a.firstname < b.firstname ? -1 : 1; }); }"> first name</span> <span class="sorting" data-bind="click: function(){ ui.items.sort(function(a,b){ return a.lastname < b.lastname ? -1 : 1; }); }"> last name</span> scripts ui = new listui(config); ko.applybindings(ui); var listui = function listuif(config) { this.items = ko.observablearray([]); } var item = function itemf(data) { var self = this; self.username = ko.observable(data.username); self.firstname = ko.observable(data.fi

Change HTML tag in vim, but keeping the attributes (surround) -

let's have tag (and cursor @ *): <h1 class="blah" id="moo">h*ello!</h1> i want change to: *<h2 class="blah" id="moo">hello</h2> i.e. change type of tag, keep elements. using surround.vim, do: cst<h2> but changes html to: *<h2>hello</h2> is changing tag possible, keeping attributes? surround documentation doesn't seem contain this... i have xml.vim plugin ( https://github.com/othree/xml.vim ) . if had too, requirement rather easy. just move cursor tag, press <leader>c (lowercase c), input new tagname, tag name changed. if press <leader>c (big c), rename tag/element, original attributes removed.

wxpython - Insert Dict into wx Python List Ctrl -

i have list ctrl object several columns. insert dict have generated through pandas list ctrl. can please me this? sample code: df = pandas.read_csv('some_file.csv',header=none) somedict = df.to_dict() i use objectlistview widget instead. it's wrapper wx.listctrl, additional functionality. basically, iterate on csv file , create list of objects based on columns in file. load list objectlistview widget. see following links more information: http://www.blog.pythonlibrary.org/2009/12/23/wxpython-using-objectlistview-instead-of-a-listctrl/ http://wiki.wxpython.org/objectlistview

delphi - Is there any way to get RTTI hints for a real48 and shortstring variable in a structure where FieldType is nil in TRttiField? -

i have discovered think odd oversight (probably intentional) on part of extended rtti feature in delphi. i dump fields in record type has 1500 different fields in it. yes, seriously. some of them of type real48 , shortstring, two, appears fieldtype nil these types @ runtime: function trttifield.getvalue(instance: pointer): tvalue; var ft: trttitype; begin ft := fieldtype; if ft = nil raise insufficientrtti; // fires! tvalue.make(pbyte(instance) + offset, ft.handle, result); end; if willing assume nil-fieldtype fields in fact real48's, use offset , (if field width 6) grab real48 value. however second complication shortstring (ie string[30] ) types afflicted. has got these 2 ancient pascal types work modern extended rtti? right i'm using best-guess approach, , fails hardcoding rules name of field, if there technique use me there without having write lot of code extract information these old pascal file-of-records modernizing, appreciate better idea.

php - preg_replace with similar values -

i working on mentions system , have run across problem, when looping through , changing mentions links, replace similar ones such @tom , @tom123 same link /tom/ instead of individual. i have tried using regex , preg_replace checking see if username exists, wondering if there way can prevent happening. $tweet = "@wayne how you? @wayne123 cool you?"; preg_match_all('/(^|\s)@([a-z0-9_]+)/i', $tweet, $matches); $i = 0; foreach( $matches[2] $value ) { if ( $db_query ) { $tweet = str_replace("@" . $value, "<a href=\"/user/$value\">@$value</a>!", $tweet); } } echo $tweet; // outputs: hi <a href="/user/wayne">@wayne!</a> how you? <a href="/user/wayne">@wayne!</a>123 cool you? any appreciated, have tried regex before continues along line , updates others before

java - How to do different drawings in different methods using paintComponent? -

Image
i have 2 classes, 1 extends panel , other extends frame. first class, panel(used drawings): import java.awt.canvas; import java.awt.color; import java.awt.font; import java.awt.graphics; import javax.swing.jlabel; import javax.swing.jpanel; public class graficpne extends jpanel{ public int dim1 = 0, dim2 = 0; public jlabel lblsem1graficpne, lblsem2graficpne; public graficpne(){ super(); this.setlayout(null); this.setupcomponents(); } public void setupcomponents(){ lblsem1graficpne = new jlabel("sem i"); lblsem2graficpne = new jlabel("sem ii"); lblsem1graficpne.setfont(new font("serif", font.plain, 12)); lblsem2graficpne.setfont(new font("serif", font.plain, 12)); this.add(lblsem1graficpne); this.add(lblsem2graficpne); } public void laycomponents(int firstconv, int secondconv){ lblsem1graficpne.setbounds(20, getheight() - firstconv - 20, 100, 20); lblsem2graficpne.setbounds(100, geth

java - How to configure "hibernate-mapping" to "field" -

i want specify via standard jpa persistence.createentitymanagerfactory(string,map<string,string>) hibernate use "hibernate-mapping" "field" rather "property". how can this, clean way? jpa determines mapping type use based on put @id annotation. if put @id annotation on field mapping field-based. update: in jpa 2.0 can use @access annotation. can apply class specify access type entire entity , can apply individual fields/methods override default single field/property.

c++ - Why is my CFRunLoopTimer not firing? -

i have cfrunlooptimer created within c++ class shown below: #import <corefoundation/corefoundation.h> void cclass::starttimer() { if(!mactivesensetimer) { cftimeinterval timer_interval = 5; cfrunlooptimercontext timercontext = {0, this, null, null, null}; cfabsolutetime firetime = cfabsolutetimegetcurrent() + timer_interval; mtimer = cfrunlooptimercreate(kcfallocatordefault, firetime, 0, 0, 0, activesensetimercallback, &timercontext); nslog(@"runloop:0x%x, timerisvalid:%d, timeisnow:%f, timerwillfireat:%f", cfrunloopgetcurrent(), cfrunlooptimerisvalid(mactivesensetimer), cfabsolutetimegetcurrent(), firetime); } } void activesensetimercallback(cfrunlooptimerref timer, void *info) { nslog(@"timeout"); cfrunlooptimercontext timercontext; t

c# - What is the best way to pull data into a web form's ListView? -

i'm new web forms, , build asp.net web application acts client connects wcf service via tcp connection pulls information , adds information listview object in web form. ideally, able store data in list , able sort, filter, add, remove, , delete items list messages come in, , update listview when these events occur. what best way achieve type of behavior listview, , please show me coded example of how listview can bind list object contains rows of data listview, i'd list object contain 3 strings representing 3 different cells (one per column) in listview create following listview in browser: column 1 header | column 2 header | column 3 header --------------------------------------------------- cell 1 text | cell 2 text | cell 3 text --------------------------------------------------- cell 4 text | cell 5 text | cell 6 text --------------------------------------------------- cell 7 text | cell 8 text | cell 9 text

html - Why isn't this element rotation working? -

Image
i'm trying rotate text in ie8. according this answer, should possible rotate element tried in following example: <!doctype html> <html> <head> <style> #enclosing { width: 20px; height: 100px; border: 1px solid; } #rotated { -ms-filter: "progid:dximagetransform.microsoft.matrix(m11=6.123031769111886e-17, m12=1, m21=-1, m22=6.123031769111886e-17, sizingmethod='auto expand')"; width: 100px; } </style> </head> <body> <div id="enclosing"> <p id="rotated">rotated</p> </div> </body> </html> (got numbers this generator) if inspect p element dev tools can see somehow affected, because blue border showing selected element rotated correctly (but actual element not being rotated), see image below. edit: clarification, how looks without filter stat

r - applying function on data.table having two columns as factors -

i have r data.table looks below table user_id exec_no job_no 1: 2 1 1 2: 2 2 2 3: 3 2 3 4: 1 2 4 5: 1 1 5 6: 3 2 6 7: 2 2 7 8: 1 1 8 now, different combinations of (user_id,exec_no) need vector of job_no fall category. list ( list(user_id = 2, exec_no = 1, job_nos = c(1)) , list(user_id = 2, exec_no = 2, job_nos = c(2,7)) , list(user_id =3, exec_no = 2, job_nos = c(3,6)) , list(user_id =1, exec_no = 2, job_nos = c(4)) , list(user_id =1, exec_no = 1, job_nos = c(5,8)) ) i prefer output of operation list of lists. how achieve in r in quick manner considering input data.table have around half million rows? here go: dt = data.table(user.id = c(2,2,3,1,1,3,2,1), exec.no = c(1,2,2,2,1,2,2,1), job.no = c(1:8)) dt[, list(result = list(list(user.id = user.id, exec.no = exec.no, job.n

git - How to start a new repo from a branch without losing a history of that branch and its child branches -

i have old , huge git repo. long time ago branch created has been acting main development branch since creation. other branches created implement features - taking branch root , merged branch a. what start new git repository. new repository take creation of branch beginning (the beginning of history). abandon previous history. i not git beginner since not standard git operation ask guys advice, ideas, useful links on how can achieve have described. to keep question short: how start new repo branch without losing history of branch , child branches? for each branch want it, create new branch shorter history. branch a important one. use git checkout --orphan new_a <branching_point_sha> create new branch has no history beyond branching point. delete old a , , use git branch -m rename new_a a per se. repeat relevant branches. delete irrelevant branches, well, because irrelevant , useless. delete tags older branching point. it's clear don't need those.

ios - What is `inputProcRefCon` in the `AURenderCallbackStruct`? -

in playing tone (e.g., here ), have tell machine function fill io buffer: // set our tone rendering function on unit aurendercallbackstruct input; input.inputproc = rendertone; input.inputprocrefcon = self; err = audiounitsetproperty(toneunit, kaudiounitproperty_setrendercallback, kaudiounitscope_input, 0, &input, sizeof(input)); it's clear inputproc procedure take input audiounit. inputprocrefcon exactly? there ever case cannot set self ? the refcon void (untyped) pointer arbitrary data, in example c struct backing calling object. if inputproc callback function doesn't need parameters (instance variables) calling object passed, don't need pass self, or can point refcon @ other data (a different c struct or object). callbacks need parameters. it's c void pointer because api real-time code predates newer objective c idioms.

c# - How to retrive records from OData service of crm 2011 IFD -

Image
i have fallowing code. var ctx = new xrmcontext(new uri(serviceurl)); ctx.credentials = new networkcredential("username", "password", "domain"); ctx.accountset.first(); silverlight version (in fiddler have here same result) var ctx = new adzzcontext(new uri(serviceuri)); ctx.httpstack = system.data.services.client.httpstack.clienthttp; ctx.usedefaultcredentials = false; ctx.credentials = new networkcredential("username", "password", "admin"); var query = ctx.accountset; var async = new dataservicecollection<account>(); async.loadcompleted += async_loadcompleted; async.loadasync(query); what give me falling error. the response payload not valid response payload. please make sure top level element valid atom element or belongs ' http://schemas.microsoft.com/ado/2007/08/dataservices ' namespace. when @ fiddler see redirect adfs server i saw link , crm 4, , in context of odata can't p

c++ - Dev C, math.h problems -

i installed devcpp, , attempting make sure working. when ran compile errors surrounding math.h. using couple of simple programs have been compiled , run before, there shouldn't problems there. use cmath instead, need use magick++ few things well, uses math.h. has run this? know of work around? the errors line 594 of math.h expected ')' before '(' token line 594 of math.h expected ',' or ';' before '(' token 'abs' undeclared line 594 extern double __cdecl nearbyint (double); and in context /* 7.12.9.2 double in c89 */ extern float __cdecl floorf (float); extern long double __cdecl floorl (long double); /* 7.12.9.3 */ extern double __cdecl nearbyint (double); extern float __cdecl nearbyintf (float); extern long double __cdecl nearbyintl (long double); does @ - http://www.cplusplus.com/forum/general/5207/ i'm using dev c++ right , can't stand it, required class. there reason can't

vim - Run gVim with several parameters -

i want open txt files in krusader using gvim default. know, when edit files ftp, command open file must this: gvim -f %f without keys ( -f %f ), changes no store server. want open each file in it`s own tab, not in instance of gvim editor. achieve this, open files, using command: gvim --remote-tab-silent i want open files, using parameters 1 , 2 example. when try change command to gvim --remote-tab-silent -f %f or gvim -f %f --remote-tab-silent it doesn't work properly. helps me merge 2 commands? try gvim --remote-tab-wait-silent %f -f seems work local guis. remote server need wait version of --remote command.

asp.net - How can I hash passwords with salt and iterations using PBKDF2 HMAC SHA-256 or SHA-512 in C#? -

i find solution or method allow me add salt , control number of iterations. native rfc2898derivebytes based on hmacsha1. ideally, using sha-256 or sha-512 make system future proof. this best example have found far: http://jmedved.com/2012/04/pbkdf2-with-sha-256-and-others/ when ran sha-256 slower sha-512. used 64k iterations, guid salt , different same length passwords compare. i found solution: http://sourceforge.net/projects/pwdtknet/ has full source code available. seems more robust. so far not able same output each of them. the pwdtk.net library ( http://sourceforge.net/projects/pwdtknet/ ) seems implementation can find pbkdf2 hmac sha-512 , allows salt , iterations. have not been able locate test vectors pbkdf2 hmac sha-512 test with. i surprised there not more devs out there using already. not big fan of answering own questions, since comments degraded discussion speed , no 1 else has answered yet, might well. thanks commented.

Android hacking : where is the methods/functions related to app killing -

if familiar android source code, me point out methods/functions related app/process killing used android? a cross reference link best. i found on stack overflow article. goes through list of running processes/apps , kills based on name: string nameofprocess = "location"; activitymanager manager =(activitymanager)this.getsystemservice(context.activity_service); list<activitymanager.runningappprocessinfo> listofprocesses = manager.getrunningappprocesses(); (activitymanager.runningappprocessinfo process : listofprocesses) { if (process.processname.contains(nameofprocess)) { // ends app manager.restartpackage(process.processname); break; } } you need following permissions: <uses-permission android:name="android.permission.get_tasks" /> <uses-permission android:name="android.permission.restart_packages"/> reference: how kill application using name?

performance - Slow loading SharePoint WebPart to run separately and progressively independent of initial page load -

we have webpart sharepoint project gathers active directory information , takes amount of time load, , drastically slows down load time on pages. i'm not sure if can improve efficiency of webpart, want do, make run progressively independent of initial page load, way doesn't effect rest of page. i'm new sharepoint development, familiar asp.net, , or direction appreciated, thanks. similar search , list oob web parts, use ajax behavior data load. can accomplish asp.net update panel. pretty walk through type of behavior here -> http://msdn.microsoft.com/en-us/sp2010devtrainingcourse_sharepointdevelopmentwithvisualstudio2010lab_topic6.aspx

Integrating Windows/OSX/Linux authentication against Linux Server (web server) -

i have application have authenticate against linux machine . clients run in windows / linux / mac , , must authenticate using user credentials under windows/linux/mac aganist linux machine. my question about, if can use user credential authenticate in linux machine long , instance linux server connected ldap activedirectory in windows server. more conscious: i'm user authenticated in windows under activedirectory , , app connect linux machine , send user credentials authenticate, so, it's possible linux server can connect ldap services in windows domain , validate credentials? thanks in advance. if you're asking whether in general possible app running on linux web-server have users authenticate against ad on windows box: yes. that can done, i've done both perl & php in past. caveats see a) want make sure use ssl browser webserver , b) make sure code won't leak/log credentials on linux box.

sql server - How to create index in SQL from c# -

the scenario follows. need drop particular index @ beginning of c# application. after insert sql statements part of processing complete, need create index again. the reason need index drop , creation part of application because giving application deployment team. deployment team running application in production. is inline sql best way create index - clustered or non-clustered in sql server c#? or there other way? you can use executenonquery , send along create index command.

removing gridlines from excel using python -

i'm trying remove gridlines excel worksheet created using openpyxl, , it's not working. i'm doing this: wb = workbook() ws = wb.get_active_sheet() ws.show_gridlines = false print ws.show_gridlines wb.save('file.xlsx') the code prints 'false', yet saved file shows gridlines. there relevant issue in openpyxl issue tracker. plus, according source code show_gridlines worksheet class property has no affect @ all. watch issue update on it. as alternative solution, try new , awesome xlsxwriter module. has ability hide grid lines on worksheet (see docs ). here's example: from xlsxwriter.workbook import workbook workbook = workbook('hello_world.xlsx') worksheet = workbook.add_worksheet() worksheet.write('a1', 'hello world') worksheet.hide_gridlines(2) workbook.close()

java - Has anyone written a Fuzzy date match to catch data entry errors? -

i wrote routine in pl/sql try , match dates there might typographical/data entry errors. it works, see if has other/better ideas. routine not need in pl/sql, read many languages. function fuzzy_date_match(in_date_1 date, in_date_2 date) return number month_1 number(2); month_2 number(2); day_1 number(2); day_2 number(2); year_1 number(4); year_2 number(4); match_score number(3) := 0; begin if trunc(in_date_1) = trunc(in_date_2) match_score := 100; else if abs(trunc(in_date_1) - trunc(in_date_2)) < 2 match_score :=50; else month_1 := to_number(to_char(in_date_1,'mm')); month_2 := to_number(to_char(in_date_2,'mm')); if month_1 = month_2 match_score := match_score + 15; else if (abs(month_1 - month_2) < 2) or (to_number(substr(lpad(month_1,2,'0'),2,1)||substr(lpad(month_1,2,'0'),1,1)) = month_2)

html - CSS - Multiple uses of class stack on top of each other -

i have css style use labels #profile form label { font-family: "helvetica neue", helvetica, arial, sans-serif; font-size: 21px; text-align: center; color: #fff; text-shadow: 0px 2px 1px #333; top: 318px; text-align: center; width: 273px; opacity: 0.9; left: 140px; display: block; position: absolute; } i have main div called profile , have form uses labels, when try place multiple labels, stack on top of each other. how can space them apart? you're positioning of labels position: absolute , top: 318px , left: 140px . assuming direct children of <form> , place them in exact same spot. you should try different approach positioning labels, maybe position: relative , or trying more row column style approach.

graph - Convert a list of tuples(edges) into list of longest paths in Python -

Image
please @ fig. below. part of project, in need convert list of edges of forest list of unique longest paths. longest paths paths connect root node leaf node or leaf leaf node. problem here is, have list of edges input, which, supposed derive these paths. i trying solve problem recursively looking neighbor nodes using dictionary(created using list of edges), looks not proper way handle problem , finding hard visualize. please suggest if there known efficient algorithms/methods solve problem. p.s.: please neglect weights(they labels). "longest" means path covering maximum nodes. input: list of tuples(edges) edges = [('point', 'floating'), ('754', 'floating'), ('clock', 'ieee'), ('arm', 'barrel'), ('barrel', 'shifter clock'), ('shifter', 'barrel'), ('representation', 'representation'), ('cycles', '754'), ('point representation'

Google Apps spreadsheet indirect sheet name? -

i have google apps spreadsheet 3 sheets, y2013, y2014, , table. on table sheet want place contents of cell b2 either y2013 or y2014 depending upon in contents of cell a1 on table i.e., a1 either y2013 or y2014. i have tried: =a1!b2 ='&a1&'!b2. what else might try? you can use indirect dynamically refer sheetnames in example: =indirect(concatenate(a1;"!b2")) call a1 should contain year number (y2013 or y2014). if want learn more on how use indirect can check this: http://spreadsheetpro.net/how-to-make-a-dynamic-reference-to-a-worksheet-in-excel-and-google-spreadsheets/

ruby - Using delayed_job for Mechanize script in Rails (NoMethodError: undefined method for nil:NilClass) -

i’m going preface saying i’m relative beginner, , while may not understand lot yet, more willing learn. hope can one, have been trying figure out long time , still stuck. know long 1 - wouldn't throw out here unless had put in many days of trying figure out myself first. i using mechanize run script in rails app fill out several webforms. worked locally. however, need use delayed_job in order run time-intensive script in background. now, developing locally (it on heroku) until problem fixed. so installed delayed_job_active_record gem, , have been trying finagle working. know although form takes in of parameters successfully, nothing getting inserted sql table. it’s not picking on object’s id. it's not recognizing object's class (it sees nilclass), considers regular ruby methods (such .strip) unknown. (the console's output showing of toward bottom). i’m doing wrong. painfully obvious - don't have skills yet figure out. i’d forever indebted if can me figure

javascript - Stick label within input field that does not change when typed. (No placeholder). HTML/JS/JQuery -

Image
please see screenshot below, on left side i'm getting , on right side want achieve without using plugins or html5 attributes the way left side of screen happens have 2 input fields out of 1 has value username: , other 1 hidden. when focus username: input field, field gets hidden , new field becomes visible. on blurr event vice-verse happens. js code: $(document).on('focus', '#login .placeholder', function() { var inel = $('#user_name'); if (inel && ! inel.is(':visible')) { $(this).hide(); inel.show().focus(); } }); $(document).on('blur', '#user_name', function() { if ($(this).val().length <= 0) { var placeholderelement = $('#login .placeholder'); placeholderelement.show(); $(this).hide(); } }); http://jsbin.com/emasuj/1/edit <label> username: <input type="text" /> </label> css: input{ border: