Posts

Showing posts from April, 2014

cq5 - How to build CQ.Dialog from the dialog json in javascript? -

in javascript, dialog follow: var url = cq.http.externalize(pathtodialog+".infinity.json"); var dialog = cq.http.eval(url); my question how convert dialog cq:dialog widget, sothat can use cq:dialog methods find( string prop, string value ), u can find in cq5 widget api thanks help you can use getdialog() method of cq.wcm class dialog object url. additionally, can pass config object perform functions caching dialog, looking dialog in cache alone , on. var dialog = cq.wcm.getdialog(pathtodialog + ".infinity.json");

java - Input from a multiline TextArea into an array with NetBeans? -

what need have happen: take list of names multiline textarea, put them array, modify them bit, , print them out in list. what i'm having problems with: getting input textarea , sticking in array -- have rest down. read someone's similar question, solution question isn't working me; keep getting nullpointerexception when reference it, meaning there's nothing there, , input wasn't put array. the coding: textarea called "taclient" , activated mouse click on button called "btnprocess" private void btnprocessmouseclicked(java.awt.event.mouseevent evt) { string[] names = taclient.gettext().split("\\n"); account[] account = new account[names.length]; for(int x = 0; x<names.length; x++) { account[x].name = names[x]; } //all modifications , other code , printout. } as far i'm aware, should work, don't have experience textareas or str...

Add new line character at the end of file in bash -

how can use bash command line add new line character @ end of file named file.txt . tried use echo it's not right. can show me how can it? echo "" >> file.txt adds newline character @ end

php - Why isn't my insert data code working? -

i trying insert data database mysql phpadmin. my webhost 000webhost. my connection mysql database code: <?php $mysql_host = "mysql2.000webhost.com"; $mysql_database = "*********"; $mysql_user = "********"; $mysql_password = "**********"; $dbcon = mysql_connect($mysql_host,$mysql_user,$mysql_password,$mysql_database); if (!$dbcon) { die('error connecting database'); } echo ('you have connected successfully'); ?> my insert data code: <?php if (isset($_post['submitted'])) { include('connect_mysql.php'); $fname = $_post['fname']; $lname = $_post['lname']; $sqlinsert = "insert people (firstname, lastname) values ('$fname', '$lname')"; if (!mysql_query($dbcon, $sqlinsert)) { die('error inserting new record'); } // end of nested if statement $newrecord = "1 record added database...

asp.net web api2 - Web API 2 cannot register user -

i have web api 2 project using mvc. uses entity framework. entity framework uses database first approach .edmx file. the project based on vs 2013 express web api 2 template. used own database. didn't modify account related code. when try register new user, following statement in accountcontroller.cs throw exception: public async task<ihttpactionresult> register(registerbindingmodel model) { ... identityresult result = await usermanager.createasync(user, model.password); ... } the exception says: cannot insert value null column 'discriminator', table 'xxx.dbo.aspnetusers'; column not allow nulls. insert fails. statement has been terminated. can me? thank you! the answer in question's body. table 'xxx.dbo.aspnetusers'; column not allow nulls. seems be, you're trying insert null value model instance registerbindingmodel model , structure of table in database server doesn't allow accept null value. ...

amazon web services - Ruby: use aws-sdk to list s3 objects with marker and max-keys -

i found there has no example in aws-sdk document list s3 objects marker , max-keys options. in java, can : objectlisting objectlisting = s3.listobjects(new listobjectsrequest() .withbucketname(bucket) .withprefix(s3prefix) .withmarker(s3marker) .withmaxkeys(40)); but in ruby, can find with_prefix method no way fill other options. please tell how config list objects marker or max-kays it took me while figure out, same reasons: no examples in documents. here how managed working, however: items = bucket.objects.with_prefix(prefix).page(:next_token => { :marker => marker }, :per_page => 100) items.each |item| puts item.key end items pageresult object. i figured out using combination of aws docs , reading source code.

Using here maps in blackberry -

can use here maps http://here.com/ , in blackberry rim version 5.0 , above development? because have application gets user location , need put 2 pins on map , distance between them , , client wants here maps. i used bing map lately, need here map now. bing maps sdk blackberry 6.0 option 1) use maps api java me blackberry jdk there no native maps api marketed blackberry, maps api asha general java me api , dependencies cldc1.1 , midp2.0 , there no reason why shouldn't work blackberry jde. article describes similarities . there series of code examples available should work out of box, except 1 thing - you'll need hold of jar files reside in c:/nokia/devices/nokia_asha_sdk_1_0/plugins/maps api/lib/ which can obtained nokia asha sdk . so you'll need download sdk, extract file maps-core.jar or of other packages want , access them external jar dependencies in usual manner. see examples on github idea of capabilities of library. option 2) use map ...

how to find file type in java -

how find file type, example if .xls go xlsconvertcsv method or .xlsx go xlsscsv method, how that.? i used getcanonicalpath() method,i found file type, did not able convert string file. public static void main(string[] args) throws ioexception { file inputfile = new file("test.xls"); file outputfile = new file("output1.csv"); string out=inputfile .getcanonicalpath(); if(out.endswith(".xls")) { system.out.print("text filei\n"+out); converttoxls(out, outputfile); } //system.out.println("out"+out); //converttoxls(inputfile, outputfile); } you can use following code that import javax.activation.mimetypesfiletypemap; import java.io.file; class getmimetype { public static void main(string args[]) { file f = new file("gumby.gif"); system.out.println("mime type of " + f.getname() + " " + ...

Listview Adapter selected row background android -

i changing listviewadapter row selected item dynamically. in adapter default selecteditem -1. public static int selecteditem = -1; // no item selected default and method highlightitem called in adapter getview method. public view getview(final int position, view convertview, viewgroup parent) { view vi = convertview; if (convertview == null) { vi = inflater.inflate(r.layout.catalogue_row, null); holder = new viewholder(); highlightitem(selecteditem,position,vi); and here highlightitem method. private static void highlightitem(int selecteditem,int position, view result) { system.out.println("selected item "+selecteditem); if(position == selecteditem) { // can define own color of selected item here viewholder.lycataloguerow.setbackgroundcolor(color.parsecolor(sharepreferencecontroller.getlistviwhightlightcolor())); } else { // can define own default selector here viewholder.l...

sql server - Stored Procedure for saving into two table -

i want store value of @additional variable getting front end , in format '98789797,879879879,987987978' . want store in different columns of table 'phoneno.s' removing comma between 2 no.s same username. alter procedure [dbo].[addnewemployee] ( @name nvarchar(30), @surname nvarchar(20), @email nvarchar(30), @mobile nvarchar(60), @address nvarchar(65), @file nvarchar(40), @country nvarchar(20), @state nvarchar(20), @city nvarchar(20), @gender nvarchar(10), @additional nvarchar(100) ) begin insert users ( name, surname, email, mobile, address,filepath,country,state,city,gender) values (@name, @surname, @email, @mobile,@address,@file,@country,@state,@city,@gender) insert [phoneno.s] ( userid,phoneno) values ( @name, @additional ) end how can achieve this?? not pro in sql..it looking complex me can no...

android - How to fetch contact details from Contacts and display it in a textview? -

i want fetch contact details contacts , display in textview. tried below code, application gets crashed. i'm beginner in android , i'm not able identify mistake.can me.. here's code: / mainactivity.java / package com.example.retrievecontacts; import android.content.contentresolver; import android.database.cursor; import android.os.bundle; import android.provider.contactscontract; import android.support.v7.app.actionbaractivity; import android.widget.textview; public class mainactivity extends actionbaractivity { textview txtv; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); txtv = (textview) findviewbyid(r.id.viewcontacts); readcontacts(); } public void readcontacts() { stringbuffer sb = new stringbuffer(); sb.append("......contact details....."); content...

c# - How to add separator between rows in asp.net -

here code, in i'm seeing table filled data no separators visible want separator b/w rows , columns. how add separator in asp.net html table. how update in css file separator look <table class="tablestyle" id="table1"> <thead><tr><th id="th1" style="background-color:#507cd1;width:150px;font-weight:bold;color:white"><div>number</div></th> <th id="th2" style="background-color:#507cd1;width:150px;font-weight:bold;color:white">type</th><th id="th3" style="background-color:#507cd1;width:150px;font-weight:bold;color:white">name</th> </tr></thead> <% for(int i=0 ;i<10;i++) { string id = i.tostring(); %> <tr><td headers="th1" style="background-color:#eff3fb;">hello world </td><td headers="th2" style=...

php - Un-Definded variable error when not logged on. -

i've error stating "notice: undefined variable: user_data" when no 1 logged in, when logged in, says hello (users name) here piece of code echos name "hello, <?php echo $user_data['first_name']; ?>!" is there anyway can hello, when no user logged in, instead of error message. thanks. i feel previous answers not explain happening, i'll try more elaborate here. what both of them make use of ternary operator , refer "immediate if", can think of following snippet on 1 line: if ($condition) { echo "this"; } else { echo "that"; } or, ternary operator: echo $condition ? "this" : "that"; // prints if condition true, if false. what need solve problem, check if variable set isset , isset checks if variable set, using in if condition, solve error. example, , answer question: if (isset($user_data['first_name'])) { echo 'hello, ' . $user_data[...

php - Can't $_GET contents of field using quoteid -

i sending myself crazy figuring out issue following code. names within database exact have them here can't seem info quote using $quoteid when type in id static e.g. quoteid = 12 can filter through data. isn't ideal. <?php $quoteid = $_get["quoteid"]; if ($_get['quoteid']) { $quoteid = $_get["quoteid"]; } $quote = $db->getrow("select * quotes quoteid = $quoteid"); ?> html <h1><?php echo $quote->description;?></h1> any appreciated. thanks, melissa note need put php variables inside single quotes when writing sql queries. in example: $quote = $db->getrow("select * quotes quoteid = '$quoteid'");

django - I want only Name of engineers from the engineer table -

it out put after print enigeer,here want name of engineer sachin,rahul,altaf [<engineer: sachin>, <engineer: rahul>, <engineer: altaf>] def enginer(request): engineer=engineer.objects.all() print engineer an more concise way retrieve names use flat list passing flat=true values_list function: engineer.objects.values_list('name', flat=true) and return: [u'sachin', u'rahul', u'altaf'] you can use flat=true if you're retrieving single column. however, if still want use engineer objects down road, you'd better of constructing list using list comprehension: >>> engineers = engineer.objects.all() >>> names = [x.name x in engineers] >>> print names [u'sachin', u'rahul', u'altaf'] >>> engineer in engineers: ... do_something()

sql - Automatically sort data-bound pivot table in two dimensions in Excel 2007 using VBA -

here's annoying issue. i've got pivot table in excel spreadsheet gets data direct sql server query. the table has customers on vertical axis, , dates on horizontal access. both need correctly sorted - i.e. customers alphabetical top bottom , dates in date order left right. i've ensured data coming out of sql recognised excel date field. can sort dates using manual a-z function. need automatically using vba. i had hoped (againt hope) using 2 sorting parameters on sql query might trick: sql = "select * myview order customer, date" set pt = worksheets("myreport").pivottables("mypivot") pt.pivotcache.commandtext = sql pt.refreshtable but doesn't. i see in excel 2010 onwards there's handy autosort function should need. i'm stuck 2007. there way sort data in both dimensions? turns out there autosort feature in excel 2007, belongs pivotfields object, rather pivot table itself. dim pt pivottable set pt = workshee...

windows phone - C# IsolatedStorage problems -

i developing game windows phone using c# xna. unfortunately, xna's storage not supported on windows phone have use c# isolatedstorage, not familiar with. trying make player high score, if players score higher last high score program writes score file stored on device , every time player opens game, high score loaded file , shown them. game seems work fine, tells player have beaten last high score when exit game , run again, high score displayed zero. bug has been killing me. have tried last resort on here. here class deals storage: using system; using system.collections.generic; using system.linq; using system.text; using system.io.isolatedstorage; using system.io; using microsoft.xna.framework.graphics; using microsoft.xna.framework; namespace square_eyes { class rrsavescore { public string highscoreconverted; public int highscore; public rrsavescore() { highscoreconverted = highscore.tostring(); } pub...

gcc - Embed C++ compiler in application -

aren't shaders cool? can toss in plain string , long valid source, compile, link , execute. wondering if there way embed gcc inside user application "self sufficient" e.g. has internal capability compile native binaries compatible itself. so far i've been invoking stand alone gcc process, started inside application, wondering if there api or allow use "directly" rather standalone compiler. also, in case possible, permitted? edit: although original question cgg, i'd settle information how embed llvm/clang too. and special edit people cannot put 2 + 2 together: question asks how embed gcc or clang inside of executable in way allows internal api used code rather invoking compilation command prompt. i'd add +1 suggestion use clang/llvm instead of gcc. few reasons why: it more modular , flexible compilation time can substantially lower gcc it supports platforms listed in comments it has api can used internally string source =...

angularjs - Angular services -

i trying share id between controllers in angular i have created service follows: app.factory("idservice", function() { var id; addid = function(id) { id = id; }; getid = function() { return id; }; }); in controller trying use service follows: app.controller('photoformcontroller', ['$scope', '$http', 'idservice' , function($scope, $http, idservice) { $scope.id = idservice.getid(); }]); i getting error of can't call method of undefined, injecting service incorrectly. can ? edit: based on solution below, service no longer generates errors, unable id varaible back, can see gets set 1 controller, remains undefined in when retrieving : app.factory("idservice", function() { var id; addid = function(id) { id = id; console.log("added id of: " + id); }; getid = function() { console.log("trying return : " + id); ...

mysql - Sort all query results in 2 categories -

i have transaction data in mysql table. 1 of fields name of supplier. in number of records supplier not specified (literally 'unspecified'). so data looks : id date supplier --- 1 1 nov 2013 green supplier 2 3 nov 2013 red supplier 3 15 nov 2013 unspecified 4 2 dec 2013 unspecified 5 6 nov 2013 blue supplier 6 20 nov 2013 unspecified x 100,000 etc i can sum , group each month using sum(if(date_format (date, '%b, %y')= 'nov, 2013', 1,0) etc - nov 2013 dec 2013 unspecified 1 2 green supplier 1 0 red supplier 1 0 blue supplier 0 1 etc however want simplified version breaks results down (1) unspecified , (2) else totalled. results - nov 2013 dec 2013 unspecified 1 2 'not unspecified' 2 1 etc while still retaining sum per month format. sure s...

php - Insert image path in remote database in Android -

i developing android application should save , image remote database. how insert remote database (mysql) path of photo select gallery. i know how select photo gallery , set on image view. how insert path database? , how photo? use following link image path http://www.limbaniandroid.com/2014/03/how-to-get-absolute-path-when-select.html . then can use http post store path in database.

Passing value from javascript to PHP ( Using Hidden Field ) -

after doing googling, still confused... i'm trying pass counted radio button value (javascript) php through hidden field later on inserted database mysql. have form named test.html <html> <head><script type="text/javascript" src="../js/script.js"></script</head> <body> <form name="myform" method="post" onsubmit="return validateradio()" action=""> <table class="tftable" border="1"> <tr><th><div align="center" class="tftable th">questions</div></th><th colspan="2"><div align="center">answer</div></th> </tr> <tr> <td>i dance</td> <td> <label></label> <label> <input name="bm1" type="radio" value="1" /> yes</label> </td> <td> <label></label...

java memory leak with native code -

i'm working on old java program includes native library fortran calls. so, have java calls c via jni, , calls fortran. in production have out of memory error : native memory allocation (malloc) failed allocate 120000 bytes jfloat in c:\build_area\jdk6_37\hotspot\src\share\vm\prims\jni.cpp i suspect it's memory leak. i'm new in company, , work on linux have me working on windows :( under production using .so file because on solaris, , use dll on windows (logical.) first, tried reproduce production problem. so, created unit test loads dll , calls java class calls native method many times. when did that, saw processexplorer.exe memory grew 2mb every 2 seconds. , have exception in production. i'm happy reproduced problem, , problem came c or fortran code. next, tried remove call fortran, , java called c (without fortran, test permitted me see if problem coming c or fortran.) and result memory did't move! cool! didn't have problem malloc/free in...

javascript - jquery calls are not fired in update panel -

i have update panel updates each 1 minutes. in side it, have 2 input files, when click on each one, datepicker function called. include these scripts datepicker <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css"/> <script src="//code.jquery.com/jquery-1.10.2.js"></script> <script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script> <link rel="stylesheet" href="/resources/demos/style.css"/> also, have script in head tag <script> $(function () { $("#cldrfrom, #cldrto").datepicker(); }); </script> the datepicker works before update panel updates content. after that, not working anymore. what should please? note i have function pageload(sender, args) in 1 of scripts don't think cause problem you need reinitialise date picker after each refresh in u...

sdk - Upload file to a certain account on Dropbox -

i want upload file php dropbox. for downloaded dropbox sdk dont see possibility upload file account (the account made dropbox app). possible upload file account of current user. it isn't common use of dropbox api, it's possible use single account. once auth account, access token, use in code call dropbox api. files uploaded whatever account access token for. need auth own account once , hardcode access token.

jquery - dynamic id creation for text field and getting the value of the text field? -

i constructing table checkbox in servlet itself, , trying assigning text field , id while selecting checkbox, after assigning id trying value of check box selected textfield cant textfield value here have included code, my servlet code is, printwriter out = response.getwriter(); preparedstatement distscenarioname = null; preparedstatement minscenariid = null; preparedstatement testcasename = null; string scenari_name = null; connection connection=databaseconnection.getconnection(); distscenarioname=connection.preparestatement("select distinct scenario_name scenario"); resultset rs=distscenarioname.executequery(); out.println("<tr><td><b>"); out.println("scenario name:"); out.println("</b></td><td><b>"); out.println("testcase id:"); out.println("</b></td><td><b>...

Reusing HDFS storage by several Hadoop installations -

is possible reuse hdfs storage 2 or more hadoop installations? or saying in other words, replicate namenode state. i want build small showcase hadoop cluster (3-5 nodes) , i'd able play around several hadoop distributions (hortonworks , cloudera @ least). have not decided yet, how have them installed simultaneously , seems challenge, i'd decide - possible reuse data stored in hdfs different clusters (physically using same hard disks)? for simplicity, i'll happy if works combination of hadoop distros , i'm ready lose data @ point, because it's experiment. update: want use hdfs exclusively 1 chosen hadoop installation @ time. let's 1 day use cloudera, other hortonworks, both use same data in hdfs. the 1 caveat would need have these on separate machines since not able bind multiple namenodes same port 8020. having said cloudera , horton works use same hadoop binaries , same configuration options if built yourself. difference in each of managem...

android - Gradle error with a dollar sign -

sorry english. i'm trying create new project in android studio gradle support, can't correctly build project. there code: gradle 'sportmanager' project refresh failed: cause: startup failed: initialization script 'c:\users\ponomarev\appdata\local\temp\ijinit6732759991667918700.gradle': 33: illegal string body character after dollar sign; solution: either escape literal dollar sign "\$5" or bracket value expression "${5}" @ line 33, column 20. string[] paths = ["/logger-2/c$/program files/android-studio/plugins/gradle/lib/gradle-tooling-extension.jar","/logger-2/c$/program files/android-studio/plugins/gradle/lib/gradle-tooling-extension-v1.9.jar","/logger-2/c$/program files/android-studio/plugins/gradle/lib/gradle-tooling-extension-v1.11.jar","/logger-2/c$/program files/android-studio/plugins/gradle/lib/gradle-tooling-extension-v1.12.jar"] ^ 1 error 'logger-2...

plsql - How to get updated columns indices on BEFORE UPDATE trigger on Oracle? -

in application users can update datas. , want save updated columns values in ag_table_update_history table. table's structure that: create table "ag_table_update_history" ( "table_name" varchar2(20 byte), "row_id" varchar2(20 byte), "column_name" varchar2(20 byte), "previous_value" varchar2(20 byte), "current_value" varchar2(20 byte) ) i know that, can updated column's names comparing :old , :new columns 1 one in before update trigger . but, want know there better way offered oracle? the answer depends on want keep values changed in update statement or want track fact columns have been updated. oracle suggests updating() function works in triggers, maybe can help: sql> create table t (x int, y varchar2(10), z date) 2 / sql> insert t values(1,'a',sysdate) 2 / sql> create or replace trigger tr_t 2 before update on t 3 each row 4...

java - Is it ok to use javax.lang.model.SourceVersion to determine the JRE version? -

is ok use javax.lang.model.sourceversion determine jre version? if is, 1 preffered? int version = sourceversion.latest().ordinal(); // or int version = sourceversion.latestsupported().ordinal(); bonus points whomever explains when sourceversion#latest() , sourceversion#latestsupported() can differ. ps. aware of getting java version @ runtime sourceversion.latest() returns latest source version can modeled. sourceversion.latestsupported() returns latest source version supported current execution environment. {@code release_5} or later when checked sourcecode @ java 7 sourceversion srccode following snippet explains internal behavior public static sourceversion latest() { return release_7; } private static sourceversion more ...getlatestsupported() { try { string specversion = system.getproperty("java.specification.version"); if ("1.7".equals(specversion)) return release_7; e...

mysql - PHP register form not connecting to database -

i have simple user registration form , external connection script strange results. page register.php shows form fine, seems display entire connection string before form? throws errors in relation connection variable '$dbcon' (i have commented line @ happens) here register.php code: <?php session_start(); require "connect.php"; if (isset($_session['username'])){ header("location: members.php"); } if (isset($_post['submit'])) { $user = $_post['user']; $pass = $_post['pass']; $rpass = $_post['rpass']; $fname = $_post['fname']; $lname = $_post['lname']; if ($user == "" || $pass == "" || $rpass == "") { echo "please fill fields"; } else { if ($pass != $rpass) { echo "passwords not match"; } else { //this errors found $query = mysqli_query($dbcon, ...

c - Free function not working -

i have following c code. #include <stdio.h> #include <stdlib.h> int main() { while (1) { int *test = malloc(sizeof(*test)); test = 500; free(test); } return 0; } the free function not seem work allocated memory grows 2gb within few seconds. problem? you can free pointer return of malloc . in writing test = 500 , you've changed memory location pointed test . trying free undefined behaviour . to assign value allocated integer, derefence it: *test = 500 ;

c# - Problems with Session for Sorting my GridView -

i have problems session["tasktable"] datasource gridview. when open .aspx site first time session["tasktable"] null, if reload page (f5) session["tasktable"] datatable tasktable . how be? i'm able sort if first reload page. ideas? thanks protected void page_load(object sender, eventargs e) { if (!page.ispostback) { datatable tasktable = new datatable("tasklist"); tasktable = dtcloned; session["tasktable"] = tasktable; gv_projekte.datasource = session["tasktable"]; gv_projekte.databind(); } } and sorting of gridview protected void gv_sorting(object sender, gridviewsorteventargs e) { datatable dt = session["tasktable"] datatable; if (dt != null) { //sort data. dt.defaultview.sort = e.sortexpression + " " + getsortdirection(e.sorte...

php - Using .htaccess to clean a URL -

this question has answer here: reference: mod_rewrite, url rewriting , “pretty links” explained 4 answers i've looked around, , things either seem overkill, or i'm not understanding something. i've got following urls: http://cms.dev/article.php?post_id=6 and replace them with http://cms.dev/article/6/ i've got following code: rewriteengine on rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^([^\.]+)$ $1.php [nc,l] however, cleans urls /admin.php /admin . what best way clean url, keep .php removed other pages? you can use: rewriteengine on rewritecond %{request_filename} !-d rewritecond %{document_root}/$1\.php -f [nc] rewriterule ^([^/]+)/([0-9]+)/?$ /$1.php?post_id=$2 [l,qsa] rewritecond %{request_filename} !-d rewritecond %{document_root}/$1\.php -f [nc] rewriterule ^(.+?)/?$ /$1.php ...

linq - How to join two tables using c# 4.0? -

i have same issue here linq join 2 datatables datatables made on runtime like datatable dttml = (datatable)jsonconvert.deserializeobject(convert.tostring(data.json.args[0]["tml"]), (typeof(datatable))); the solution gave fine getting error on datarows2 at select dtresult.loaddatarow(new object[] { datarows2.field<int>("stock") // here error : not exist in current context } while datarows1.field(s) fine i can't see what's wrong approach : datatable dt1 = new datatable(); dt1.columns.add("pk", typeof(int)); dt1.columns.add("data1", typeof(int)); datatable dt2 = new datatable(); dt2.columns.add("fk", typeof(int)); dt2.columns.add("data2", typeof(int)); dt2.rows.add(1, 5000); dt1.rows.add(1, 1000); var result = (from r1 in dt1.asenumerable() join r2 in dt2.asenumerable() on r1["pk"] equals r2["fk"] select new { ...

java - Struts:404 Page not found Error -

i trying build struts application basic functionalists. java servlet class myaction returns success. have compiled file , placed .class file in classes folder of project. my struts config xml follows: <struts-config> <action-mappings> <action path="/view" type="myaction" validate="false"> <forward name="success" path="/first.jsp" /> </action> <action path="/view" forward="/view.jsp"/> </action-mappings> </struts-config> i have form on view.jsp has action path first.jsp <form action="first"> enter name : <input type="text" name="name"/> <input type="submit" value="enter"/> </form> but when run code in tomcat server , navigate view.do working fine. , when press submit button of form, page not getting redirected first.jsp. ins...

django - Can I disable a field in the Rest Framework API browsing view -

i using django rest framework serialize model in have foreignkey. models.py class article(models.model): author = models.foreignkey(author, related_name='articles') ... other fields... serializers.py class articleserializer(serializers.hyperlinkedmodelserializer): class meta: model = article i want rid of 'html form' @ bottom of browsable api view since list articles , retrieving them db takes ages (i have 100k articles, , each time html form displayed, server 100k queries). i have read answer how disable admin-style browsable interface of django-rest-framework? , displaying view in json. however, html view , find way avoid html form available @ bottom. i don't want remove field view (i need use it), remove database queries used populate form. any idea ? i answer own question. found in documentation solution problem. had use read_only attribute. serializers.py class articleserializer(serializers.hyperlinkedmode...

c# - ajax CollapsiblePanelExtender inside datalist -

i creating data list have multiple person records displayed inside collapsible panel , iside each dataitem user can edit record etc. following code <%@ register tagname="createeditperson" src="~/ascx/create_edit_person.ascx" tagprefix="wd" %> <asp:datalist id="dlperson" runat="server" onitemdatabound="dlperson_onitemdatabound"> <itemtemplate> <div class="personrow"> <div class="personrowheader" id="diveditperson"> <div class="lastnamecolumn"> <asp:label id="lbllastname" runat="server"></asp:label </div> <div class="firstnamecolumn"> <asp:label id="lblfirstname" runat="server"></asp:label> </div> ...

regex - Case insensitive matching python -

i want match items 1 list in without worrying case sensitivity. mylist1 = ['fbh_q1ba8', 'fhh_q1ba9', 'fbh_q1ba10','hoot'] mylist2 = ['fbh_q1ba8', 'trick','fbh_q1ba9', 'fbh_q1ba10','maj','joe','civic'] i doing before: for item in mylist2: if item in mylist1: print "true" else: print "false" but fails because not case sensitive. i aware of re.match("test", "test", re.ignorecase) how can apply example? normalize case str.lower() : for item in mylist2: print item.lower() in mylist1 the in containment operator returns true or false , easiest print that: >>> mylist1 = ['fbh_q1ba8', 'fhh_q1ba9', 'fbh_q1ba10','hoot'] >>> mylist2 = ['fbh_q1ba8', 'trick','fbh_q1ba9', 'fbh_q1ba10','maj','joe','civic'] >...

c# - Can I pass an object into my method using Unity AOP? -

i use aop wcf log calls webservices log in same way. the log starts writing when call intercepted, details of what's going on, after returns, writes log saying has finished along exceptions webservice may have thrown. what i'd pass logger object webservice add few log statements of own. is possible using aop? the code is: public imethodreturn invoke(imethodinvocation input, getnextinterceptionbehaviordelegate getnext) { logger somelogger = new logger(); return getnext()(input, getnext); } i'd either somelogger getnext() method webservice, or able access global context - global context won't work since webservice can process many requests @ once. any ideas?

php - How do I set two cookies with the same name? -

when try this: cookie::queue('somename', $val, 300, '/', 'main.example.com') cookie::queue('somename', $val, 300, '/', 'other.example.com') only 1 of cookies gets set, because queue function setting queued[$cookie->getname()] cookie, , both have same name. there way can queue 2 cookies same name?

How to link to index.php from static page in wordpress? -

in wordpress template design intro page , set static page, in want put button when user click on index.php's content shown. index.php default template used through wordpress. see https://codex.wordpress.org/template_hierarchy just create page , ensure page template used 'default template' , link page required. index.php template should used default. if have page.php template, override index.php. in case duplicate index.php file, rename page-custom.php , add following code first line of template file. <?php /* template name: custom page */ ?> now 'page attributes > template' drop-down in page editor see 'custom page' template in drop-down list

jquery - How to apply selector on ajax loaded content -

i have refresh() function, set called periodically way: setinterval("refresh()", duration); in refresh() function, dynamically prepending content html table. so have simple table: <table> <tbody> <tr><td>original title</td><td>original date</td></tr> </tbody> </table> that becomes new table: <table> <tbody> <tr><td>new title</td><td>new date</td></tr> <tr><td>original title</td><td>original date</td></tr> </tbody> </table> through action of refresh() function: function refresh() { var lastdate = $('.mytableclass > tbody > tr > td:nth-child(2)').first().text(); $.get("./my_url.html?lastdate="+lastdate+, function (data) { if( data.trim().length > 0 ) { $(data).prependto( $('.mytableclass > tbody...

angularjs - Angular.js how to programatically create new ng-model -

i'm trying add "<label>foos name</label><input ng-model="foo"/>" programmatically dom part of string, have this. .directive( 'showdata', function ( $compile ) { return { scope: true, link: function ( scope, element, attrs ) { var el; attrs.$observe( 'template', function ( tpl ) { if ( angular.isdefined( tpl ) ) { // compile provided template against current scope el = $compile(tpl)( scope ); // stupid way of emptying element element.html(""); // add template content element.append( el ); } }); } }; }); problem is, $scope.foo doesn't exist... any ideas? thanks in advance ok, figured out why wasn't working.. simple too.. i had $scope.foo = '' defined in controller overriding 1 included in string.

rmagic (rpy2) causes kernel crash in ipython notebook (Mac OSX) -

i've tried better part of last 6 months rmagic functions extension running in ipython notebook -- i'm on macos -- , when try load rmagic kernel crashes. i using rpy2 in previous version of ipython notebook, somewhere along way 2 stopped communicating. have installed, reinstalled, reinstalled again, , smashed head on screen. i've tried update rpy2 pip, easy_install, , compile source. this solution windows didn't me. this 1 didn't either. when env archflags="-arch i386 -arch x86_64" python setup.py build install source segmentation fault. here's error i've been getting: sudo env archflags="-arch i386 -arch x86_64" python setup.py build install running build running build_py running build_ext configuration r library: include_dirs: ('/library/frameworks/r.framework/resources/include',) libraries: ('rblas', 'rlapack') library_dirs: ('/library/frameworks/r.framework/resources/lib',) extra_li...

javascript - angular json format using $http on internet explorer -

i have angular app using $http module. server response looks "{"utilisateurannuaire":{"id":"6"}...}" , works. but when try use app on ie 10.0.9, response looks "{\"utilisateurannuaire\":{\"id\":\"6\"}...}" , angular fail use json.parse(). i don't understand why, have idea ? ! a few things: are setting response content type application/json ? are sure ie 10 escaping string? try out in chrome or firefox. ie 10 pretty close them in terms of compliance.

objective c - How to store extra header value with MailCore2? -

i add header value mailcore2: mcomessageheader *messageheader = message.header; [messageheader setextraheadervalue:spamscorestring forname:@"spam score"]; how can save new header value imap server? i have searched sample code , have read class reference mcomessageheader (which, way, states wrong method name - (void)addheadervalue:(nsstring *) value forname:(nsstring *)name ) editwith of dinhviethoa in mailcore2 forum on github ( https://github.com/mailcore/mailcore2/issues/680 ), question answered: it not possible edit header of existing email. however, possible remove existing message server , append new message (with headers).

c - Cannot bind to LLMNR socket -

i trying implement microsoft's llmnr discovery protocol on web server. have zeroconf working, , re-using lot of zeroconf code. zeroconf uses port 5353, ip address 224.0.0.251 messaging, , llmnr uses port 5355, ip address 224.0.0.252. i re-used zeroconf startup code, , changed port , ip address, cannot socket bind port. error 10013 "an attempt made access socket in way forbidden access permissions". here code: #define multicast_port 5355 #define multicast_address "224.0.0.252" int llmnr_open( void ) { char reuseaddress; char loopback; int nret; dword threadid; wifimodule_gethostname(llmnr_strservice); wifimodule_gethostname(llmnr_strhost); llmnr_mreq.imr_multiaddr.s_addr = inet_addr(multicast_address); llmnr_mreq.imr_interface.s_addr = inaddr_any; llmnr_serversocket = socket(af_inet, sock_dgram, 0); if(llmnr_serversocket < 0) { ...

c# - Trigger an SSRS Report from ASP.Net without user intervention -

i'd able fire off ssrs report asp.net application without pulling in application , having print there specified printer. seems highly desired feature, i'm having trouble finding solutions online. can me this? from web application standpoint, in modern prowsers, don't believe can specify printer, , cannot "auto-start" printing. reporting services used have ability print unattended ms browser plugin, removed number of years ago it's considered security risk. the best can "one-click" print, programmatically render report using report execution service reportservice.asmx web service , initiate programmatic solution print rendered report. unfortunately, printing ssrs report automatically quite involved. can read how print reports programmatically here.

jsf 2 - Insert a liferay portlet into Primeface dialog -

i'm using liferay 6.1, jsf 2 , primeface 4.0. i've 2 different project running on liferay tomcat. want insert portlet of "project 1" primefaces dialog of "project 2". i tried using ui:insert, takes source path of current project. can give suggestion how proceed in scenario? thanks in advance. with ui:insert, can insert html code, not whole portlet! should either: create common xhtml page visible both portlets. require have both portlets in same plugin project in dialog, instead of inserting code, can include link page of portal, "project2" portlet placed

mysql - Connecting php to mdb or sql on Mac locally -

i'm running local apache server on mac, , want connect local database (have same db both .sql , .mdb). php $dbname = "\db\dbname.mdb"; $db = new pdo("odbc:driver={microsoft access driver (*.mdb)}; dbq=$dbname; uid=; pwd=;"); i have web stuff in local server , databases in db folder. if or explain how can done locally sql. thanks! working access database php can challenging @ best of times. on os x (or linux) more tenuous (in opinion) if 1 tries use middleware unixodbc , mdb tools . if .sql file indeed mysql (as suggested 1 of question tags) you'll save fair bit of aggravation using local install of mysql server (instead of access .mdb) database storage.

html - Make all buttons on a td show into same line while keeping it shrunk -

i'm using tables represent tabular data app listings. on each row, on first cell, draw several buttons allow users activate de record (edit, delete, enter de detail view, etc...). number of buttons on td can vary, same on every table row. so i'd first column fits number of buttons shown on table. i'm applying class buttonsblock { min-width:1px; } these cells, on table disposition (depending of space occupied rest of cells) buttons fall second line, instead of being together. example html of table <table> <tr> <th></th> <th>field a</th> <th>field b</th> <th>field c</th> <th>field d</th> <th>field e</th> </tr> <tr> <td class="buttonsblock"> <a href="actionbutton1url"> <button type="button" class="btn btn-default btn-xs"> <span class="glyphicon ...

mysql - Rails ActiveRecord delete record, associated records deleted one at a time -

here example... have users table references preferences. preferences table has user_id. when delete user, want delete records in preferences table well. however, using belongs_to , has_many association methods in models, activity on database: preference load (0.4ms) select `preferences`.* `preferences` `preferences`.`user_id` = 2 sql (1.3ms) delete `preferences` `preferences`.`id` = 2 sql (0.2ms) delete `preferences` `preferences`.`id` = 6 sql (0.1ms) delete `preferences` `preferences`.`id` = 16 sql (0.2ms) delete `preferences` `preferences`.`id` = 28 sql (0.2ms) delete `preferences` `preferences`.`id` = 34 sql (0.1ms) delete `preferences` `preferences`.`id` = 44 useraccount load (0.3ms) select `user_accounts`.* `user_accounts` `user_accounts`.`user_id` = 2 sql (0.2ms) delete `user_accounts` `user_accounts`.`id` = 2 is there proper way delete record using perhaps delete preferences user_id = xxxx ? i'd way, because if preferences had million...