Posts

Showing posts from March, 2014

ejb - Error while publishing to Weblogic Server 11gR1 -

i receiving following error. mean , how fix it? unable deploy ejb : xxxejb xx.jar error deployin gthe ejb 'xxxejb, jndi name 'xxxejb' in use. must set different jndi name in weblogic-ejb-jar.xml deployment descriptor or corresponding annotation ejb before can deployed. thanks help.

xaml - WinRT How to make Logout appbar style? -

i want have logout icon in appbar. sure should in common styles, discovered unfortunately it's not. so, how can it? i've found this site, found icon wanted logout button, , copied xaml gave me path. next added code common: <style x:key="logoutappbarbuttonstyle" targettype="buttonbase" basedon="{staticresource appbarbuttonstyle}"> <setter property="automationproperties.automationid" value="logoutappbarbutton" /> <setter property="automationproperties.name" value="logout" /> <setter property="contenttemplate"> <setter.value> <datatemplate> <grid> <viewbox rendertransformorigin="0.47,0.47"> <viewbox.rendertransform> <transformgroup> <compositetransform rotation=&q

java - OpenAM J2EE Agent 3.2.0 SNAPSHOT - ERROR -

i have requirement implement authentication using openam j2ee agent. i’m using jboss v7.1.1. current production version of j2ee agent (3.1.0) not support jboss 7 (unless hacks implemented). so, used 3.2.0 snapshot version community website run j2ee agent on jboss 7.1.1. able run agent. agent intercepts initial (i.e. when no token exists) request , forwards openam server. redirection openam server after successful login fails , below message logged in agent debug logs. question whether has managed latest 3.2.0 snapshot version working on jboss 7 , whether interception of requests , redirection works properly. amfilter:08/23/2013 10:54:48:229 edt: thread[http--0.0.0.0-9100-1,5,main] error: urlfailoverhelper: no url available @ time amfilter:08/23/2013 10:54:48:230 edt: thread[http--0.0.0.0-9100-1,5,main] error: amfilter: server error occurred. [agentexception stack] com.sun.identity.agents.arch.agentservererrorexception: no url available @ time @ com.sun.identity.agents.common.

python - Can I return a text value if a certain tag is found? -

i searching following html beautiful soup keywords, when keyword found return text contained in next div class ds_data . in case text 1 this has worked fine, few of divs contain image red x indicate 0. there way of saying if image of class spacer_top n-sign detected treat text value of '0'? my code #hdmi pattern = re.compile(r'\s*%s\s*' % 'hdmi ports quantity') hdmi_ports = soup.find(text=pattern).findnext('div',{'class':'ds_data'}).text print hdmi_ports #dvi ports pattern = re.compile(r'\s*%s\s*' % 'dvi port') dvi_ports = soup.find(text=pattern).findnext('div',{'class':'ds_data'}) print dvi_ports html <div class="tablerow"> <div class="ds_label"> <span class="tip-anchor tip-anchor-text"> hdmi ports quantity</span>ev <span class="red line"> <div class="tooltip-text"> </div> <div class=&quo

c - What does this mean?: *(int32 *) 0 = 0; -

in following piece of code, *(int32 *) 0 = 0; mean? void function (void) { ... (;;) *(int32 *) 0 = 0; /* line do? */ } a few notes: the code seems not reachable, there exit statement before particular piece of code. int32 typedef 'ed shouldn't care it. this piece of code language's runtime in compiler, interested. the code doing following: (;;) // while(true) *(int32 *) 0 = 0; // treat 0 address, de-reference 0 address , try , store 0 it. this should segfault, null pointer de-reference. edit compiled , ran further information: #include <stdio.h> #include <stdlib.h> #include <stdint.h> int main(void){ *(int32_t *) 0 = 0; printf("done\n"); return 0; } gcc -g null.c; ./a.out program received signal sigsegv, segmentation fault. 0x00000000004004cd in main () @ null.c:7 7 *(int32_t *) 0 = 0;

java - Can't deploy GWT application on Tomcat 7 and Jboss 7 -

i have deployed gwt application, , works fine on dev mode, when try upload on tomcat, or jboss, 404 page despide server on. tried enter: http://localhost:8080/gwtexample , http://localhost:8080/gwtexample/index.html and 127.0.0.1:8080/gwrexample` without succes. i put war file under jboss/standalone/deployment , under c:\program files\apache software foundation\tomcat 7.0\webapps\root and here web.xml <?xml version="1.0" encoding="utf-8"?> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> <servlet> <servlet-name>requestfactoryservlet</servlet-name> <servlet-class>com.google.web.bindery.requestfactory.server.requestfactoryservlet</servlet-class> <init-param> <param-name>symbo

Java Error "Exception in thread "main" java.util.InputMismatchException" On an Array program -

i typed out java program accept ten areas , pin-codes , search find particular area , print out it's pin-code. here's code program : import java.util.scanner; public class sal { public static void main (string args []){ scanner s=new scanner(system.in); system.out.println("enter 10 areas , pincodes"); string area[]=new string [10]; int pincode[]=new int [10]; string search; int chk=0; int p=0; (int i=0;i<=9;i++){ area[i]=s.nextline(); pincode[i]=s.nextint(); } system.out.println("enter search"); search=s.nextline(); (int j=0;j<=9;j++){ if(search==area[j]){ chk=1; j=p; break; } } if(chk==1){ system.out.println("search found "+"pincode : "+pincode[p] ); } else { system.out.println(

xml - XSL value-of returns no match -

alright trying convert xhtml document rdf/xml (don't ask, it's assignment) using xslt information rdf file located in meta tags in xhtml document. have first xpath query done locate value of about attribute of <rdf:description> . tested xpath query on separate website returned proper result. however, when try incorporate in xslt result empty string. i'm looking nudge in right direction. don't see i'm wrong. here's example xhtml document. <?xml version="1.0" encoding="iso-8859-1" ?> <?xml-stylesheet href="tn6_q6.xsl" type="text/xsl" ?> <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <link rel="schema.dc" href="http://purl.org/dc/elements/1.1/" /> <meta name="dc.title" content

c - Compiling half float neon instructions for iOS -

the issue having neon instructions believe supported on arm7 architecture. using default compiler (apple llvm 5.0), recognises other neon instructions although not half-float instruction. here code: vcvt.f32.f16, q0, d1 this has compiled on gcc although apple compiler not instruction , gives error: instruction requires: half-float is there compiler flag can give xcode? can't find out how enable half float instructions googling around. thanks! the half-float format not supported on arm v7 implementations. see arm manual here . it's required vfp4, if chip supports that, that's start. in general recommend using run-time detection , dispatching. enable instruction in general, need use 1 of several floating point support options, in general "fp16" keyword, example: -mfpu=neon-fp16 if sure target supports neon. couldn't find of examples llvm either, think compatible gcc options, found in gcc manual .

PHP Function that Counts String Length and Charges Price Based on # of Characters -

i've got opencart vqmod counts string length , charges character. works perfectly, need charge following rules: 30-45 characters: $8.50 46+ characters: $12.00 edit: of now, mod multiplies string length set price per character, need charge flat $8.50 30-45 characters, or $12 46+ characters. can me modify following php? i'm pasting entire file here. responses far. appreciate of community. edit 2: removed unnecessary code, showing string length potion. //q: option price character $optprice = ''; $optprefix = ''; if ($option_query->row['type'] == 'text' || $option_query->row['type'] == 'textarea') { if (strlen($option_value)) { $optprice = (strlen($option_value) * $option_query->row['price_per_char']); $optprefix = '+';

ajax - Custom error headings for form validation doesn't display properly -

my contact form uses ajax, however, when try validate form without filling in of fields, 3 out of 4 error messages display. 'last name', 'email address' , 'message' error headings display, 'first name' error heading not. when take out 'last name' error field , retest, 'first name' field displays. i have tried expanding box make large, thinking there no room 4 error headings display, don't think case. how can correct 4 error messages (headings) display if user not fill out of fields? here code: $(document).ready(function() { $('form #response').hide(); $('.button').click(function(e) { e.preventdefault(); var valid = ''; var required = ' required.'; var first = $('form #first').val(); var last = $('form #last').val(); var email = $('form #email').val(); var message = $('form #message').val();

java - Android: Add view into another while having a click listener on the parent -

i trying achieve following hierarchy: gridview -> every item view (let's call 'container') contains background, imageview , checkbox. if user clicks on container, doesn't matter where, whether on checkbox, image, or background, checkbox should change checked state. right have following layout it: <!-- main layout --> <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"> <button android:id="@+id/selectbtn" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="select" android:layout_alignparentbottom="true" android:layout_centerhorizontal="true" android:minwidth="200dp" /> <gridview android:id="@+id/image

ios - UIPageViewController page control background color -

Image
i'm using uipageviewcontroller in app , it's working fine. however, it's page control has been added automatically has black background hiding current view controller's bottom material (see picture below). possible call uipageviewcontroller's page control , change it's color? want page control shown on view controller (example, path app's walkthrough) setting color instead of black clear. you can use appearance change color of uipagecontrol otherwise not accessible. try doing in appdelegate's didfinishlaunchingwithoptions function given below. - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { uipagecontrol *pagecontrol = [uipagecontrol appearance]; pagecontrol.pageindicatortintcolor = [uicolor lightgraycolor]; pagecontrol.currentpageindicatortintcolor = [uicolor blackcolor]; pagecontrol.backgroundcolor = [uicolor bluecolor]; return yes; } to apply style

java - Execution of multiple select statements -

i want execute multiple select statements using group by . i have tried following one: resultset rs=s.executequery("select attr_name, count(*)" + " table_name" + " group attr_name;" + "select attr_name, count(*)" + " table_name" + " group attr_name"); but not coming. the way join 2 sets of results use union all resultset rs=s.executequery( "select attr_name,count(*) table_name group attr_name union select attr_name,count(*) table_name group attr_name" ); be careful make sure columns same: there must same number of columns , must of same type. worth explicitly naming columns make sure: select attr_name, count(*) attr_count from...

xpages - Does view.postscript() allow you to call functions loaded as output scripts? -

i using <xpscriptblock> store contents of 2 rather long client side functions loads extjs grid. can call function using clientside javascript fine. i discovered need show different grid based on condition in underlining document. reference backend moved code serverside , tried call grid using view.postscript. not work , basis of question. is approach possible? not wish put code event. functions quite long , better kept in script block readability , maintainability. functions loaded in client, can manually load them using firebug console. perhaps missing simple wanted ask before changing approach. var typepo = document1.getitemvaluestring("typepo"); if(typepo == "afs"){ view.postscript("loadgridafs();") } else { view.postscript("loadgridother();") } this code in serverside onclientload event of panel. have tried adding 'return' keyword , makes no difference. update: can't simple alerts work

variables - Scope, closures and bindings in javascript. Why is my loop not working correctly? -

i trying create list when li element clicked, specific div displayed. want read id of div , other properties dictionary. so, dictionary looks this: var ifsrc = {"welcome":"welcome.html", "proceduresandcomputers":"../proceduresandcomputers/index.html", "someid":"../somesourcefileforaniframe"} and function form li elements function createmenu(){ var listy = document.getelementbyid("sidebar"); for(var key in ifsrc){ var elem = document.createelement('li'); elem.innerhtml = key; elem.classname = "unselected"; elem.addeventlistener("click",function(){opendiv(this,key);},false); listy.appendchild(elem); } listy.firstelementchild.classname="selected"; } so, menu (ul li elements) looks ok, no matter li click on, opendiv function passes right value this , same value key . in particular, passes last val

xml - Is xmllint handling a nillable compexType correctly? -

we have xsds , sample xmls created under .net (and presumably passed validation), fail validated under xmllint. we're trying determine if 1 side or other 'incorrect' or if ambiguous in spec. i've tried searching here , on google, can't find describes same problem. instead of posting original xsds & xml, i've created smaller test reproduces problem. the xsd is: <?xml version="1.0" encoding="utf-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/xmlschema" elementformdefault="qualified" attributeformdefault="unqualified"> <xs:complextype name="a"> <xs:sequence> <xs:element name="b" nillable="true" type="b" /> </xs:sequence> </xs:complextype> <xs:element name="a" nillable="true" type="a" /> <xs:complextype name="b"> <xs

ghc - Dead code and/or how to generate a cross reference from Haskell source -

i've got unused functionality in codebase, it's hard identify. code has evolved on last year explore problem space , possible solutions. i'm needing find unused code can rid of it. i'm happy if deals problem on exportable name basis.ghc has warnings deal non-exported unused code. tools specific task of interest. however, i'm curious comprehensive cross referencing tool. can find unused code such tool. years ago when working in c , assembler, found xref pretty handy tool, useful many different purposes. i'm getting googling. apparently in haskell dominant meaning of cross-reference within literate programming. though maybe there useful. i don’t know of such tool, in past have done bit of hack instead. if have comprehensive test suite, can run ghc’s code coverage tracing enabled. compile -fhpc , use hpc markup generate annotated source. gives union of unused code , untested code, both of address anyway. sourcegraph can give a bunch of i

php - Errors from simplexml_load_file -

i'm several errors [23-aug-2013 15:35:20 america/sao_paulo] php warning: simplexml_load_file() [<a href='function.simplexml-load-file'>function.simplexml-load-file</a>]: /home/lineage/public_html/acp/xml/banners.xml:48: parser error : opening , ending tag mismatch: banner line 33 , list in /home/lineage/public_html/acp/core.php on line 191 [23-aug-2013 15:35:20 america/sao_paulo] php warning: simplexml_load_file() [<a href='function.simplexml-load-file'>function.simplexml-load-file</a>]: &lt;/list&gt; in /home/lineage/public_html/acp/core.php on line 191 [23-aug-2013 15:35:20 america/sao_paulo] php warning: simplexml_load_file() [<a href='function.simplexml-load-file'>function.simplexml-load-file</a>]: ^ in /home/lineage/public_html/acp/core.php on line 191 [23-aug-2013 15:35:20 america/sao_paulo] php warning: simplexml_load_file() [<a href='function.simplexml-load-file'>function.simp

Install Laravel 4 with no root php 5.3 -

to install laravel 4 i've tricks because don't have root php 5.3 instead of using php i've use: /opt/php53/bin/ so after downloading composer.phar type: /opt/php53/bin/php ~/composer.phar create-project laravel/laravel everything works fine until gets json file line: php artisan optimize then have edit json file , change occurrences of php /opt/php53/bin/ , run /opt/php53/bin/php ~/composer.phar update is there better way deal this? which operating system on? can create alias in linux or mac , add php path in windows. in either case have better , short representation long path php.

html - CSS margin-top on inner div pushing parent div down -

this question has answer here: margin-top push outer div down 6 answers i trying push child div down 5px inside of parent div. when put margin-top:5px; on inner div pushes down both inner div , parent div div above parent div, not push inner div down parent div. how set inner div pushed down 5px parent div? not want parent div push down div above it. help. html navigation: <nav> <div class="nav-container"> <div id="cat_14623_divs"> <ul id="nav_14623"> <li><a href="#" onclick="return false;">akina &amp; red lake</a</li> <li><a href="#" onclick="return false;">fresh wild caught fish</a> <ul id="navsub_14623_2326"> <

svn - When checking in code using ahnk to Visual Studio should I check in empty obj and bin folders? -

i checking code visual studio project source control. best practice check in empty bin , obj folders or should let ide create them everyone? imagine answer doesn't matter wondering if 1 choice on the other has advantage cannot see. for obj , bin folders, prefer add them ignore list directory. way, , contents don't show if select option "show unversioned files", , no 1 confused need add them or contents.

c# - Saving source code formatting to TXT file -

Image
i trying extract source code webpage , save text file. however, want keep formatting of source code. my code below. // block fetches source code url entered. private void buttonfetch_click(object sender, eventargs e) { using (webclient webclient = new webclient()) { string s = webclient.downloadstring("http://www.ebay.com"); clipboard.settext(s, textdataformat.text); string[] lines = { s }; system.io.file.writealllines(@"c:\users\user\dropbox\personal projects\writelines.txt", lines); messagebox.show(s.tostring(), "source code", messageboxbuttons.okcancel, messageboxicon.asterisk); } } i text file show source code formatted in messagebox. messagebox screenshot: text file screenshot: how go getting text document's formatting same in messagebox? i agree comment, i'll ad

string - Python Insert new line if line has more than 50 characters -

i've been trying figure out issue on python that's driving me crazy couple of weeks... have text file decent amount of text. of lines has more 50 characters , issue me, because has aligned text box. my question : how manage insert new line (\n) if line on text file has more 50 characters (including spaces)? thanks in advance. this should trick with open('path/to/input') infile, open('path/to/output', 'w') outfile: line in infile: if len(line) > 50: outfile.write('\n'.join(line[i:i+50] in xrange(0,len(line), 50))) else: outfile.write(line)

ios - How to resolve conflicts in UIManagedDocument? Should I use NSFileVersion? -

i've been looking through lot of icloud documentation. can find documentation on how resolve conflicts , helpful documentation on icloud , core data, such designing core data in icloud , using core data icloud release notes . none of address how resolve icloud conflicts using uimanageddocument. should use nsfileversion uimanageddocument? a uidocument supposed resolved using nsfileversion. true subclass uimanageddocument? do uimanageddocuments automatically resolve conflicts? the icloud , core data docs refer nspersistentstoredidimportubiquitouscontentchangesnotification lot. notification lets know when changes have been made, doesn't notify of conflicts. mean conflicts automatically resolved (probably based on time stamps in core data log)? do nsmergepolicy , nsmergeconflict have icloud? core data has classes nsmergepolicy , nsmergeconflict , documentation doesn't mention icloud , seems apply conflicts between persistent store , managed context (rather i

regex - Regular Expression With String Contain Digit With WildCard/Min,MaxLength In Javascript -

i new javascript regular expressions. trying create regex on string may contain digit. scenario following:< the string may contain * either before or after or both not in middle. the string length minimum of 2 characters , maximum of 12 characters (not counting * ). input string example: ab1542378522 ac6546457869 oa6546457869 other valid strings are: *154* *c6* ab* ab154237* *2378522 *c654645 *645 *ab* *ac6546457869* oa* invalid strings: *15*4 *15*4* *a*b15*42*37* only * wildcard supported, no other special character allowed in input. example in above input string ab , ac , oa valid first 2 character not aa , ax , os ... follow 10 digits @ max. i unable create such regex covers above use-cases. code getting exhausted if else branching. if find answer post in comment. make comment confusion. try use pattern: /^\*?(?=[^*]{2})[a-z]{0,2}[0-9]{0,10}\*?$/ pattern explanation: ^ begining of string \*? optional * (?=[^*]{2}) ch

oracle11g - Oracle 11G, external tables and .csv file -

having issue external tables in oracle 11g. i'm using db artisan run query. create , organization code executes successfully, when run select statement getting error. .csv file set same way layout external_table header such. create table external_table ( col1 number(14), col2 varchar2(10), col3 varchar2(3), col4 varchar2(3), col4 varchar2(4), col6 number(4,0), col7 varchar2(20), col8 varchar2(20), col9 number(3) ) organization external ( type oracle_loader default directory folder1 access parameters ( records delimited newline fields terminated ',' missing field values null (col1 char(14), col2 char(10), col3 char(3), col4 char(3), col4 char(4), col6 char(4), col7 char(20), col8 char(20), col9 char(3) ) ) location ('filename.csv') --name of flat file. ) reject limit 0; running: sel

Windows Phone app services -

i've released 2 months ago app windows phone marketplace , yesterday i've released update app. after update app seems ask permission access "location services" , "microphone". while understand why app needs location services, it's difficult understand microphone part i'm not using microphone anywhere... give logical explanation why such requirement set in marketplace , if there way remove don't access microphone in app? in case wondering app wrote wp 7.5 well... thank in advance! andrei in properties - > wmappmanifest.xml -> should unchecked " id_cap_microphon " before submit app store .

Which Trello API Action occurs when someone moves a card between boards? -

i trying card history series of boards within organization. can actions when card moved between lists, action records when card moved between boards. have stepped though getting actions boards, lists , cards , have not seen indicate when card moved between boards. it's called movecardtoboard. can actions associated board ( https://trello.com/docs/api/board/index.html#get-1-boards-board-id-actions ) or actions associated card ( https://trello.com/docs/api/card/index.html#get-1-cards-card-id-or-shortlink-actions ); don't think it's in actions associated list.

c# - Load a control in the main page from usercontrol -

i have unique problem. i'm working on .net solution not have access main aspx pages. mainly, cannot modify of them. i'm building whole bunch of usercontrols, used on various .aspx page. want use updatepanel, , 1 knows requires scriptmanager control on page. so - have access placeholder on .aspx page. want try , place scriptmanager control in placeholder. know how this, getting reference context page , adding control in there. however, i'm having issue timing. have updatepanel on .ascx control, , have scriptmanager load in page_preload event of control. doesn't seem work, complains "'the control id 'updusers' requires scriptmanager on page. scriptmanager must appear before controls need it.' obvious updatepanel loading before page_preload event. question is, method can use load control? can done @ all? there better way this? edit: i've tried events: protected void page_preinit(object sender, eventargs e) protected override void onin

jquery - JSPlumb Line Connectors -

i have inner divs want able attach end points have been able accomplish breaks connection if move div. please see example have posted on jsfiddle http://jsfiddle.net/scripter78/v3byw/ jsplumb.bind("ready", function () { var windows = $(".w"); var subwindows = $(".s"); jsplumb.draggable($(".x")); jsplumb.draggable(windows); window.jsplumbdemo = { init: function () { // setup defaults jsplumb. jsplumb.importdefaults({ endpoint: ["dot", { radius: 2 }], hoverpaintstyle: { strokestyle: "#1e8151", linewidth: 2 }, connectionoverlays: [ ["arrow", { location: 1, id: "arrow", length: 14, foldback: 0.8 }] ] });

What should be the format for the following ldap workerid? -

i trying use following code email address ldap active directory? should format of workerid? should domainname\userid or environment.username only? thinking of using directorysearcher search = new directorysearcher(entry); search.filter = "(samaccountname=" + workerid + ")"; the samaccountname attribute reflect combination of first initial , last name of user. being greg stachurski, samaccountname in active directory gstachurski . also, should check out softerra's ldap browser (the free version of ldap administrator). it's fantastic piece of software invaluable build applications around ldap protocol. you can download here - http://www.ldapbrowser.com/download.htm

php - Converting Array Values from ISO-8859-1 to UTF8 for JSON Encoding -

i receive response web service, , values iso-8859-1 encoded. supplied library converts response array, , using json_encode serialize response , store in database. it's mysql database, innodb engine, utf8 character set. the encoding issue revealed warning in log: php warning: json_encode(): invalid utf-8 sequence in argument in... i know array key values alright because they're same , don't see warning every request. is there downside using array_map utf8_encode rid of warnings? json_encode(array_map('utf8_encode', $response)) you anyway need call systematically. go it.

android - AChartEngine - GraphicalView always match parent -

Image
i created graphicalview (a combinedxychartview ) , added layout. @ next, add checkboxes below graphicalview. the problem is, graphicalview match parent , that's why can't see checkboxes (because there no space them). here screenshot: and here code (snipped): layout_chart.xml <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/background_color" android:orientation="vertical" > <!-- layout chart --> <linearlayout android:id="@+id/linearlayout_chart" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" > </linearlayout> <!-- layout checkboxes --> <linearlayout android:layout_width="

jquery - bootstrap typeahead ugly completion -

Image
i'm using bootstrap(2.3.2 version) typeahead completion in rails project simple_form not suggest completion set writes first matched string in field, making ugly. solution? there option disable it? update1: way, enable completion feature, included external js file ( mean not implemented in bootstrap) , suggested in q&as, used this css file keep ui beautiful.

bash - Reading a file and storing values into variables in python -

let's have filename (test.txt) following data in it: aa11 bb11 cc11 dd11 aa22 bb22 cc22 dd22 aa33 bb44 cc44 dd33 in bash (shell scripting) can following: cat test.txt | while read b c d echo "this first column $a " echo "this second column $b " echo "this third column $c " echo "this fifth column $d " done how can same python? how can store value of each column in variable , read file line line while storing , manipulating value? file = open('test.txt') line in file: fields = line.strip().split() print fields[0], fields[1], fields[2], fields[3] python easy :) to more specific, split() splits contents of string fields delimited delimiter (by default blank character, e.g. space, tab etc.), , returns array split fields. strip() strips blank characters beginning , end of line. , file in python iterable object when iterated on keyword in , gives lines in file 1 one. more information on these, can @ http

javascript - How to send AJAX/Jquery object to Controller (discrepancy) MVC4 -

i have had confusion while , it's because of following reason: i trying send jquery object var myobject = { title: $('#title').val(), title2: $('#title2').val(), title3: $('#title3').val(), }; through ajax call $.ajax({ data: { myobjectname = myobject }, datatype: "json", url: "myurl", cache: false, error: function (ts) {//handle error}, success: function (result) {//handle success} }); i'm receiving object in controller this: public actionresult myaction(objecttype myobjectname) however, when receiving object javascript, not recognize such , instantiates new objecttype. i know can send string, serialize if put object inside for

rest - RESTful web service for systems integration understaning -

i am, indeed, new restful services , while feel understand concepts resistant aspects of use in current project. the project involves provision of form data system. project members insist form data should broken down "resources" there customer , customer addresses etc on form. so how granular rest api is... form data not complete , actionable until have of form data (and there's little @ that). and, in fact, guess have prepare integrator on service side assemble of these resource bits before can use them because @ present have no persistence them or, specifically, have persistence them need hide data before becomes actionable. again, @ present point point communications without business case sharing or service composition. so, i'm of idea 1 service "form" using post acceptable optimization , amount of work cuts pragamatic approach. what not getting doing hard , expensive way? if don't need high level definition in need use heavier

c# 4.0 - C# Winforms: GroupBox not resizing -

i have 2 groupboxes on left side of 1 of tabcontrols , call them groupbox (top left), , groupbox b (bottom left). groupboxes not resize hope. example: when resize main form has tabcontrols mouse, or maximize it, or move screen lower resolution, groupbox b keeps width / height. causes groupbox b draw on groupbox a, kind of 'always on top' effect. desired: both groupboxes resize according 1 / proporitionally , fit area given. ideas? a tablelayoutpanel can this. add tablelayoutpanel , size fit needs. anchor table top, bottom, left, , right put groupboxa upper left cell of table put groupboxb lower right cell of table for both groupbox size them accordingly , anchor them 4 sides. now grow , shrink proportionately app. additionally can add more of controls table. if need control span multiple rows or columns use rowspan/columnspan property.

php - Form information not being 'seen' by MySQL -

i've made new log in / register template uses css3 , html, yet had working form, basic, before this. decided make 'form' should this: http://www.script-tutorials.com/css 3-modal-popups/ now, use form handle registration: <!-- popup form #2 --> <a href="#x" class="overlay" id="join_form"></a> <div class="popup"> <h2>sign up</h2> <p> please enter details here. </p> <div> <form action="register.php" action="post"> <label for="username">username</label> <input type="text" id="username" placeholder="max 32 characters" name="username" /> </div> <div> <label for="password">password</label> <input type="password" id="password" placeholder="pas

c++ - Why do spaces get lost in pipes in Linux? -

i have issue pipes in linux. looks space characters lost after piping. running following c++ code #include <iostream> #include <stdio.h> #include <string.h> using namespace std; int main(){ char s[] = "ab cd", c; int n = strlen(s); for(int = 0; i<n && (cin >> c); i++) if(s[i] != c){ printf("wrong @ %d : '%c' != '%c' \n", i, s[i], c); break; } return 0; } from echo "ab cd" | ./checker shell command gives wrong @ 2 : ' ' != 'c' is normal behavior? how avoid losing characters in pipes? the problem isn't pipe, problem cin >> c skips on whitespace. it work if cin >> noskipws >> c or this: std::string q; getline(cin, q); for(i = 0; < n && < q.size(); i++) { if (q[i] != s[i]) ... }

Matlab matrix with different Row Sizes -

i create matrix has different row sizes i'm not sure start. i have function produces time signatures of 5000 photons. not photons produce meaningful time signatures. function discards signatures. iterate on function 5000 times means column vector have varying sizes on each iteration never more 5000. function photon_fwhm = processfates(string,num) = 1:num fates = 'fates'; str = int2str(i); filename = strcat(fates,str); timestamp = timestamp(filename); if timestamp == 0 continue; end; photon_timestamps(:,i) = timestamp; end; all in have 5000 columns number of rows vary column. i'm not sure solution is. you try using cell arrays. cell arrays may little slower, can job. photon_timestamps{i} = vector; then each element photon_timestamps{i} can of different size. also block if timestamp == 0 continue; end; needs else part right?

php - Prevent my script from using so much memory? -

i have script lists possible permutations in array, which, admittedly, might used instead of wordlist. if work, it'll impossible not hit unless there limit on attempts. anyway, script takes huge amount of memory, set server on fire. need finding way spread out memory usage, somehow resetting script , continuing left off going file or something, possibly using sessions. have no clue. here's i've got far: <?php ini_set('memory_limit', '-1'); ini_set('max_execution_time', '0'); $possible = "abcdefghi"; $input = "$possible"; function string_getpermutations($prefix, $characters, &$permutations) { if (count($characters) == 1) $permutations[] = $prefix . array_pop($characters); else { ($i = 0; $i < count($characters); $i++) { $tmp = $characters; unset($tmp[$i]); string_getpermutations($prefix . $characters[$i], array_values($tmp), $pe

ruby on rails 4 - Deprecation warning when using `rake db:seed` -

i'm having deprecation warning when using rake db:seed this dynamic method deprecated. this happens on user.add_role :admin of block below: user = user.find_or_create_by(email: env['admin_email'].dup) |u| u.password = env['admin_password'].dup u.password_confirmation = env['admin_password'].dup end puts 'user: ' << user.email user.add_role :admin user.skip_confirmation! user.save! i have cleaned code find_or_create_by_email warning, cannot find answer add_role . it due version of rolify. it's been fixed 3.2 me cf

How to toggle prepend in jquery -

i want toggle css link using jquery, via single button. catch is, want in target of iframe. so far have following code, insets link fine: $("#custom").click(function() { $("#content").contents().find("head").prepend("<link href=\"../build/css/custom.css\" rel=\"stylesheet\" id=\"custom-css\">"); }); this activated following html: <div class="toggle-custom"> <a target="custom" id="custom" class="btn btn-primary btn-lg">toggle custom style</a> </div> <iframe id="content" src="carousel.html" frameborder="0" scrolling="auto"> </iframe> i know way remove is: $("#content").contents().find("#custom-css").remove(); but how can toggle same button? thanks try var contents = $("#content").contents(); var ccss = contents.find("head")

mysql - Stackoverflow-like commenting database schema -

i'd make commenting thread stackoverflow on each q&a page. issue see how notify each subscriber (questioner, answerers, commenters) of new comment allowing them each ability mark comment read. i see 2 general solutions: make row each subscriber, replicating actual comment in every 1 of these rows. allow field in each row each subscriber mark comment read (eliminating little red circle @ top of page). only have 1 row each comment. subscribers lumped in single field , there have complex queries select , update whether each subscriber has marked comment read. maybe there better way? here's generic schema show 2nd approach answers can have refer to: comments table comment_id user_id question_id comment comment_read 1 1 1 stuff yes=user_id=1, no=user_id=2, no=user_id=3 2 2 1 bad stuff yes=user_id=1, yes=user_id=2, no=user_id=3 3 3 1 worse stuff yes=user

Set LESS variable if it's not set -

is possible set less variable given value, if hasn't been defined? i can seem find solutions sass. an important remark : turns out need such trick happens xy-problem (as result of misunderstanding less variable semantics). there's no real use-cases want (in less instead always define default value (so exists) overridden @ will). before using trick below, make sure it's not something else want actually . it quite simple (since v1.4.0) if need provide such variable same scope (i.e. global or local) defined: @bar: 41; // comment/uncomment test .define-bar-if-not-defined() {@bar: 42} .define-bar-if-not-defined(); // exposes variable if it's not in scope #using-global-bar { global-bar: @bar; } #using-local-bar { @bar: 43; // comment/uncomment test .define-bar-if-not-defined(); local-bar: @bar; } however method won't work if try use global/parent scope variables used in local scope (and may problem if need generic method when yo

objective c - Problems with NSDecimalNumber Arithmetic when NSDecimalNumbers are stored in NSDictionary from NSExpression Core Data Fetch -

i have been experimenting trying learn how use nsexpressions fetch aggregate info core data. have fetch working i'm having trouble trying parse resulting data processing. i'm sure must missing can't figure out is. i'm fetching sum of attribute on entities , have part right. want math on results not getting desired results. here sample code [_maincontext save:nil]; nsmutabledictionary *accountbalances = [[nsmutabledictionary alloc] init]; nsfetchrequest* request = [[nsfetchrequest alloc] init]; request.entity = [nsentitydescription entityforname:@"accounttransaction" inmanagedobjectcontext:_maincontext]; // build expression calculate sum nsexpressiondescription* totaloftransactionsdescription = [[nsexpressiondescription alloc] init]; nsexpression *keyexpression = [nsexpression expressionforkeypath:@"amount"]; nsexpression *theexpression = [nsexpression expressionforfunction:@"sum:"